https://llvm.org/bugs/show_bug.cgi?id=25873
Bug ID: 25873 Summary: Assignment of structure being optimized out Product: clang Version: trunk Hardware: All OS: Windows NT Status: NEW Severity: normal Priority: P Component: -New Bugs Assignee: unassignedclangb...@nondot.org Reporter: sunil_srivast...@playstation.sony.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified 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. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs