<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Infinite loop with -O3"
href="https://bugs.llvm.org/show_bug.cgi?id=45106">45106</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Infinite loop with -O3
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>8.0
</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>C
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>oyvind.harboe@zylin.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>this application completes immediately without -O3 and runs indefinitely with
-O3.
The application comes from the gcc-testsuite.
This is with clang-8.
$ cat gcc/gcc/testsuite/gcc.c-torture/execute/930529-1.c
/* { dg-options { "-fwrapv" } } */
extern void abort (void);
extern void exit (int);
int dd (int x, int d) { return x / d; }
int
main ()
{
int i;
for (i = -3; i <= 3; i++)
{
if (dd (i, 1) != i / 1)
abort ();
if (dd (i, 2) != i / 2)
abort ();
if (dd (i, 3) != i / 3)
abort ();
if (dd (i, 4) != i / 4)
abort ();
if (dd (i, 5) != i / 5)
abort ();
if (dd (i, 6) != i / 6)
abort ();
if (dd (i, 7) != i / 7)
abort ();
if (dd (i, 8) != i / 8)
abort ();
}
for (i = ((unsigned) ~0 >> 1) - 3; i <= ((unsigned) ~0 >> 1) + 3; i++)
{
if (dd (i, 1) != i / 1)
abort ();
if (dd (i, 2) != i / 2)
abort ();
if (dd (i, 3) != i / 3)
abort ();
if (dd (i, 4) != i / 4)
abort ();
if (dd (i, 5) != i / 5)
abort ();
if (dd (i, 6) != i / 6)
abort ();
if (dd (i, 7) != i / 7)
abort ();
if (dd (i, 8) != i / 8)
abort ();
}
exit (0);
}</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>