<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - SIGFPE due to illegal FP optimization"
   href="http://llvm.org/bugs/show_bug.cgi?id=17088">17088</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>SIGFPE due to illegal FP optimization
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>kcc@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre><this is fresh clang trunk r189814 on linux x86_64>

% cat fpe.cc 
#include <fenv.h>
double zero = 0.0;
#define max(a, b) (a > b ? a : b)
int main() {
  feenableexcept(FE_DIVBYZERO);
  double z = 3.0 / max(1.0, zero);
  return z == 3.0;
}
% clang  fpe.cc -lm -g && ./a.out 
% gcc  fpe.cc -lm -g && ./a.out 
% gcc -O1  fpe.cc -lm -g && ./a.out 
% clang -O1  fpe.cc -lm -g && ./a.out 
Floating point exception (core dumped)
% gdb ./a.out 
Reading symbols from /home/kcc/tmp/./a.out...done.
(gdb) r
Starting program: /home/kcc/tmp/./a.out 

Program received signal SIGFPE, Arithmetic exception.
0x000000000040057e in main () at fpe.cc:6
6      double z = 3.0 / max(1.0, zero);
(gdb) disassemble 
Dump of assembler code for function main():
   0x0000000000400560 <+0>:    push   %rax
   0x0000000000400561 <+1>:    mov    $0x4,%edi
   0x0000000000400566 <+6>:    callq  0x400460 <feenableexcept@plt>
   0x000000000040056b <+11>:    movsd  0x12d(%rip),%xmm0        # 0x4006a0
   0x0000000000400573 <+19>:    movsd  0x200ab5(%rip),%xmm1        # 0x601030
<zero>
   0x000000000040057b <+27>:    movaps %xmm0,%xmm2
=> 0x000000000040057e <+30>:    divsd  %xmm1,%xmm2
   0x0000000000400582 <+34>:    movsd  0x11e(%rip),%xmm3        # 0x4006a8
   0x000000000040058a <+42>:    ucomisd %xmm1,%xmm3
   0x000000000040058e <+46>:    seta   %al
   0x0000000000400591 <+49>:    ucomisd %xmm0,%xmm2
   0x0000000000400595 <+53>:    setnp  %cl
   0x0000000000400598 <+56>:    sete   %dl
   0x000000000040059b <+59>:    and    %cl,%dl
   0x000000000040059d <+61>:    or     %al,%dl
   0x000000000040059f <+63>:    movzbl %dl,%eax
   0x00000000004005a2 <+66>:    pop    %rdx
   0x00000000004005a3 <+67>:    retq   
End of assembler dump.
(gdb)</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>