This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Need some clarification about optimization flags, what "exactly" does -O1 do?


Andrzej Giniewicz wrote:

>> Yeah, but that bug almost certainly isn't in the code you're looking at.
>>
>> I've recently seen a bug that was triggered by -O in an enum where the
>> declaration was:
>>
>>   enum Cell {
>>    Cell_0
>>   };
>>
>> and gcc quite correctly assumed that a Cell could only have one value.
>>
>> I'm not saying I'm absolutely certain this isn't a bug in gcc.  It's just
>> that it probably isn't.
> 
> interesting, seems like something similar, any hints how to start
> tracking real issue?
> 
> thanks in advance for your help,
> Andrzej.
> 
> btw... I found the flag... - well, kind of... -O0 and -O0 -ftree-dce
> and -O1 -fno-tree-dce all works, but -O1 as stated before don't... so
> I can workaround the issue just for now with -fno-tree-dce until real
> one is found - this gives me some more time :)

That's interesting.  tree-dce is Dead Code Elimination on trees, where
gcc removes code that can't possibly be reached.  It's possible that
there's a bug in DCE, but I bet it's something like the enum bug above.
If you're interested in finding the real bug I can tell you how to read
the compiler dumps.

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]