optimization/4888: incorrect code with -Ox, x >= 2
jfran@clip.dia.fi.upm.es
jfran@clip.dia.fi.upm.es
Sun Nov 4 13:51:00 GMT 2001
>Number: 4888
>Category: optimization
>Synopsis: incorrect code with -Ox, x >= 2
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Fri Nov 16 04:06:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: jfran
>Release: gcc >=2.96 <=3.0.2
>Organization:
>Environment:
>Description:
With optimizations enabled, "f=x; y=*(type*)&f;" reads garbage
on 'y' unless 'type'=='char' (problem with memory alias?)
"f=x; g(); y=*(type*)&f;" works fine if g() is not
inlined.
>How-To-Repeat:
Compile with -O0, execute.
Compile with -O2, execute.
Uncomment the commented line.
Test again.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="mem.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="mem.c"
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp2b2lkIGcoKTsKCmludCBtYWluKCkgewogIGRvdWJsZSBmOwog
IHVuc2lnbmVkIGludCAqaTsKICBpbnQgeDsKICBmID0gMS4wOwogIGkgPSAodW5zaWduZWQgaW50
ICopJmY7CiAgLy8gZygpOwogIHggPSBpWzFdOwogIHByaW50ZigiJXhcbiIsIHgpOwogIHJldHVy
biAwOwp9Cgp2b2lkIGcoKSB7Cn0K
More information about the Gcc-bugs
mailing list