[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 19:24:04 PST 2014


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

Bill Wendling <isanbard at gmail.com> changed:

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

--- Comment #1 from Bill Wendling <isanbard at gmail.com> ---
The SIGFPE is correct. See the comments:

int a, b, d, e, *f = &b, g, i;
char c;

int main() {
  /* '&c == (void*)&a' is false */
  bar (&c == (void *)&a);
  return 0;
}

void bar(int p) {
 /* 'p' is 0 */
 lbl:
  if (*f)
    g = 0;
  int **l = &f;
  *l = 0;
  for (; i < 1; i++)
    {
      if (i)
        /* i == 1 */
    goto lbl;
      /* 'd == 0' and 'p == 0' (see above)
       * Therefore, this call is 'foo(2, 0)'
       */
      if (foo (2, d || p))
    {
      int **m = &f;
      *m = &e;
    }
      /* i == 1 */
    }
}

int foo(int p1, long long p2) {
  /* 'p1 == 2' and 'p2' == 0
   * This implies 'p1 % p2' is UB.
   */
  return p2 == 0 ? 0 : p1 % p2;
}

So, it looks like it's valid for it to have a SIGFPE. The other optimization
levels don't convert to the same code (of course). It results in either the '%'
never being called or possibly never emitted.

-- 
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/4f3bc1d8/attachment.html>


More information about the llvm-bugs mailing list