[llvm-bugs] [Bug 25552] New: extend -fwrapv to apply to left shifts

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 17 04:07:22 PST 2015


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

            Bug ID: 25552
           Summary: extend -fwrapv to apply to left shifts
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bonzini at gnu.org
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

If you pass clang -fwrapv then this causes -fsanitize=undefined to no longer
complain about signed integer overflows from addition.  However the sanitizer
will still complain about left shifts of negative values.

-fwrapv should apply also to shifts.  In addition -fwrapv in clang should
suppress -Wshift-negative-value.

(The GCC manuals only mention -fwrapv to affect add/sub/mult because GCC
currently _never_ treats signed left shifts as having undefined behavior.  GCC
documentation however says very clearly, under -fstrict-overflow, that "Using
'-fwrapv' means that integer signed overflow is fully defined: it wraps").

-- 
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/20151117/4b38b160/attachment-0001.html>


More information about the llvm-bugs mailing list