Summary: | optimization of bit-shifts leads to strange results | ||
---|---|---|---|
Product: | gcc | Reporter: | blake tregre <blake.tregre> |
Component: | c | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | normal | CC: | alexcher, attardi, blake.tregre, cdfrey, chiabaut, Dries.Decock, dvt, gcc-bugs, gcc2eran, hans.buchmann.wantuch, honza, lucifer_ww, mihai.dontu, mueller, myan, rosenfeld, sb, schendel, sorenj, stillzhang, takahisa.yokota, tompa-l, unaiur |
Priority: | P3 | ||
Version: | 4.1.2 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | ||
Attachments: | test code shown in bug report |
Description
blake tregre
2007-12-22 03:42:14 UTC
Created attachment 14806 [details]
test code shown in bug report
uint32_t* foo = (uint32_t*)&z; zbuf[3] = ((*foo) & 0x000000ffL); It is obvious you are violating C/C++ aliasing rules which leads to undefined behavior. Use either -fno-strict-aliasing, an union, or memcpy. *** This bug has been marked as a duplicate of 21920 *** |