<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - SVE builtins accepting enum svprfop or svpattern do not fire -Wenum-conversion on misuse"
href="https://bugs.llvm.org/show_bug.cgi?id=48441">48441</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>SVE builtins accepting enum svprfop or svpattern do not fire -Wenum-conversion on misuse
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>peter.waller@arm.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>peter.waller@arm.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>The Arm C Language Extensions for SVE specification (Version 00bet6) defines a
number of builtins accepting two enum types, `svprfop` and `svpattern`.
The problem is that clang currently defines the builtins to take a values of
type "immediate integer", and this conversion-to-integer is allowed even with
-Wenum-conversion specified.
GCC correctly raises a warning with -Wenum-conversion, clang does not. Consider
this example in this case when we pass an enum prfop value through to an
intrinsic expecting an svpattern, gcc reports:
foo.c: In function 'test_pattern_fail':
foo.c:3:25: warning: implicit conversion from 'enum svprfop' to 'enum
svpattern' [-Wenum-conversion]
3 | return svptrue_pat_b8(SV_PLDL1KEEP);
| ^~~~~~~~~~~~
// REQUIRES: aarch64-registered-target
// RUN: %clang_cc1 %s -triple aarch64-none-linux-gnu -target-feature +sve
-fallow-half-arguments-and-returns -fsyntax-only -verify -Wenum-conversion
#include <arm_sve.h>
svbool_t test_pattern_fail() {
return svptrue_pat_b8(SV_PLDL1KEEP);
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>