Summary: | [4.1 Regression] Fatal miscompile with -O1 -finline-functions | ||
---|---|---|---|
Product: | gcc | Reporter: | Martin Drab <martin.drab> |
Component: | tree-optimization | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | critical | CC: | dnovillo, gcc-bugs |
Priority: | P1 | Keywords: | alias, wrong-code |
Version: | 4.1.0 | ||
Target Milestone: | 4.1.0 | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | ||
Attachments: | This is the testcode that triggers the bug (stripped from latest CVS LAME). |
Description
Martin Drab
2005-05-14 00:45:00 UTC
Created attachment 8887 [details]
This is the testcode that triggers the bug (stripped from latest CVS LAME).
(In reply to comment #0) > > But when compiling with only the following: > > -------------------------- > gcc -O1 -fno-strict-aliasing -finline-functions -o lame lame.c > -------------------------- Sorry this should have been: -------------------------- gcc -O0 -fno-strict-aliasing -finline-functions -o lame lame.c -------------------------- I have no idea what is causing the problem. I tried the following options and it is still messed up: " -O1 -finline-functions -fno-tree-dominator-opts -fno-tree-fre -fno-tree-ccp -fno-tree-store-ccp -fno-tree-salias -fno-tree-sink -fno-tree-dse -fno-tree-sra " some how the store is becoming dead. This is an aliasing issue, -O1 -fno-ivopts -finline-functions works. DCE thinks the store to gfp->out_samplerate is dead. Note the code will seg fault right away anyways, you need the following change to main: Replace: lame_global_flags *gf ; With: lame_global_flags gf1; lame_global_flags *gf = &gf1; Strict aliasing does not matter in this case as it is not enabled at -O1 anyways. Oh and -fno-tree-saliasing does not fix it, this is just for Dan. (In reply to comment #7) > Oh and -fno-tree-saliasing does not fix it, this is just for Dan. I mean "-fno-tree-salias". (In reply to comment #5) > This is an aliasing issue, -O1 -fno-ivopts -finline-functions works. > DCE thinks the store to gfp->out_samplerate is dead. > > Note the code will seg fault right away anyways, you need the following change to main: > Replace: > lame_global_flags *gf ; > With: > lame_global_flags gf1; > lame_global_flags *gf = &gf1; Yes, you are absolutely correct. Just a result of too much stripping and 3:00 AM. ;-) But the problem isn't affected by that. (In reply to comment #6) > Strict aliasing does not matter in this case as it is not enabled at -O1 anyways. It does! Although not with -O1. But I just wanted to point out (which I forgot before) that with '-fstrict-aliasing' it works, i.e.: ---------------------- gcc -O1 -fstrict-aliasing -finline-functions -I. -o lame lame.c ---------------------- I don't know who did it and how, but recently I checked latest CVS after a while (CVS-20050612) and all of a sudden it seems to work. The bug seems to be gone. Can anyone check it out and confirm? Any idea what happend? (In reply to comment #11) > I don't know who did it and how, but recently I checked latest CVS after a while > (CVS-20050612) and all of a sudden it seems to work. The bug seems to be gone. > Can anyone check it out and confirm? Any idea what happend? Well, actually it was CVS-20050613 that I checked (sorry a misspell). But anyway. Fixed. |