<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 --- - another example of different code generation at -O2 -g and -O2"
href="http://llvm.org/bugs/show_bug.cgi?id=19051">19051</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>another example of different code generation at -O2 -g and -O2
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</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>Common Code Generator Code
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>katya_romanova@playstation.sony.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>Code motion is noticed when running tests with and without the debug info at
O2.
I've triaged this bug, and it's not a duplicate of BZ #18590.
========Testcase==================
extern void foo(char *dst,unsigned siz,const char *src);
extern const char * i2str(int);
struct AAA3 {
AAA3(const char *value) { foo(text,sizeof(text),value);}
void operator=(const char *value) { foo(text,sizeof(text),value);}
operator const char*() const { return text;}
char text[4];
};
void bar (int param1,int param2) {
const char * temp(0);
if (param2) {
temp = i2str(param2);
}
AAA3 var1("");
AAA3 var2("");
if (param1)
var2 = "+";
else
var2 = "-";
var1 = "";
}
==============================================
clang -c -g -O2 test.cpp -o test.g.o
clang -c -O2 test.cpp -o test.o
objdump -d test.g.o > test.g.txt
objdump -d test.o > test.txt
diff test.txt test.g.txt
2c2
< test.o: file format elf64-x86-64
---
<span class="quote">> test.g.o: file format elf64-x86-64</span >
23,25c23,25
< 39: 48 8d 3c 24 lea (%rsp),%rdi
< 3d: be 04 00 00 00 mov $0x4,%esi
< 42: 85 db test %ebx,%ebx
---
<span class="quote">> 39: 85 db test %ebx,%ebx
> 3b: 48 8d 3c 24 lea (%rsp),%rdi
> 3f: be 04 00 00 00 mov $0x4,%esi</span >
Katya.</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>