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

            Bug ID: 42949
           Summary: __builtin_constant_p lowering is inconsistent,
                    producing false-negatives
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

It appears that __builtin_constant_p will eagerly get lowered to `false` in the
frontend if clang has reason to believe that __bcp's argument may have
side-effects. This has unintuitive consequences: https://godbolt.org/z/P-8vLS

Looks like this is a result of some special casing added in r359844.

It's understandable that __builtin_constant_p is totally a best-effort thing,
and there may be cases where it produces odd results, but this particular case
seems like it may be pretty confusing to anyone who isn't willing to read
clang's source code. :)

-- 
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