[LLVMbugs] [Bug 17073] wrong code (SIGFPE) at -O3 on x86_64-linux-gnu (in 32-bit mode)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jan 4 20:01:09 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=17073

Zhendong Su <su at cs.ucdavis.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #2 from Zhendong Su <su at cs.ucdavis.edu> ---
> int foo(int p1, long long p2) {
>   /* 'p1 == 2' and 'p2' == 0
>    * This implies 'p1 % p2' is UB.
>    */
>   return p2 == 0 ? 0 : p1 % p2;
> }

Bill, we'll need to be careful here. Since p2 == 0 holds, p1 % p2 isn't
executed at all.  This is exactly how we guard for division by zeros. 

The code is valid and doesn't have any UBs.

-- 
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/20140105/5ebd2b1b/attachment.html>


More information about the llvm-bugs mailing list