[LLVMbugs] [Bug 8642] New: possible spurious divide by zero

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Nov 17 20:57:36 PST 2010


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

           Summary: possible spurious divide by zero
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: regehr at cs.utah.edu
                CC: llvmbugs at cs.uiuc.edu, chenyang at cs.utah.edu


Not sure what is going on here but the FPE looks fishy.

[regehr at n1 ~]$ clang -v
clang version 2.9 (trunk 119679)
Target: i386-pc-linux-gnu
Thread model: posix
[regehr at n1 ~]$ clang -O1 foo.c -o foo
[regehr at n1 ~]$ ./foo
[regehr at n1 ~]$ clang -O2 foo.c -o foo
[regehr at n1 ~]$ ./foo
Floating point exception
[regehr at n1 ~]$ cat foo.c
struct S1 {
   signed f0 : 19;
};

struct S1 g_2[2] = {{1}, {2}};
struct S1 g_4 = {3};
short g_19 = 0;

static short
foo(short si1, short si2)
{
  return (si2 == 0) ?  (si1) : (si1 % si2);
}

int main(int argc, char* argv[])
{
    struct S1 *l_48 = &g_2[1];
    struct S1 *l_49 = &g_4;
    g_19 = foo(1, (l_48 == l_49));
    return 0;
}

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list