<html>
<head>
<base href="https://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 --- - Assignment of structure being optimized out"
href="https://llvm.org/bugs/show_bug.cgi?id=25873">25873</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Assignment of structure being optimized out
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>sunil_srivastava@playstation.sony.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Following example shows a wrong optimization with current trunk (r255918)
#include <stdio.h>
struct point {
float x, y;
public:
point() { x = 0.0f; y = 0.0f; }
};
struct p2 {
point a, b;
public:
p2(): a(), b() {}
};
int main() {
p2 p,q;
q.a.x = 1.0f;
q.a.y = 2.0f;
q.b = q.a; // set q.b to same as q.a
p = q; // hence p.a must be same as p.b
printf( "p.a=( %f, %f ), p.b=( %f, %f )\n", p.a.x, p.a.y, p.b.x, p.b.y );
}
with -O, it gives
p.a=( 1.000000, 2.000000 ), p.b=( 0.000000, 0.000000 )
I have tried it on linux/pc, but I think other platforms have same issue.
It is a regression. 3.5 did not have this bug. I will pin down further as to
when it happened.
The problem does not show if x and y are ints.</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>