<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 - Segmentation fault in simple function call using O1 ~ Os"
href="https://bugs.llvm.org/show_bug.cgi?id=45121">45121</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Segmentation fault in simple function call using O1 ~ Os
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>6.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>haoxintu@gmail.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>Hi, the test.c
#include <stdio.h>
void foo( ) {
while(1){}
//do {}while(1); //crash
//for(;;); //crash
while(-1){} // non-executed loop, but still crash
}
int main () {
int size = 100;
printf("size = %d\n", size);
foo();
return 0;
}
is a simple function call code. When I compiler is using `clang-6.0 -O1 test.c`
(or O2, O3, and Os) and then `./a.out`, the output is
size=100
size=100
Segmentation fault(code dumped).
The strange thing is that `printf` function executed twice and whatever loop I
use in the function foo(), even a non-executed loop, it gets faults.</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>