https://bugs.llvm.org/show_bug.cgi?id=48441

            Bug ID: 48441
           Summary: SVE builtins accepting enum svprfop or svpattern do
                    not fire -Wenum-conversion on misuse
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

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);
  }

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to