[llvm-bugs] [Bug 41552] New: different result from __builtin_add_overflow in constant expresion

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Apr 21 07:37:42 PDT 2019


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

            Bug ID: 41552
           Summary: different result from __builtin_add_overflow in
                    constant expresion
           Product: clang
           Version: 7.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: john at mcfarlane.name
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Description:
Normally, when passing a combination of large signed and unsigned integer
values to the generic overload of __builtin_add_overflow and requesting back an
unsigned integer, the function correctly identifies overflow. When the same
operation takes place in a constant expression, __builtin_add_overflow fails to
identify that the overflow took place.

Example:
https://wandbox.org/permlink/hDCXNEThgH3NmdLz

Affected:
This affects 7.x and upward. Earlier versions do not support
__builtin_add_overflow in constant expressions. 
This affects C++14 and later. A repro for C++11 is not possible due to
limitations imposed on constexpr fns.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190421/82a4d447/attachment.html>


More information about the llvm-bugs mailing list