This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Need some clarification about optimization flags, what "exactly" does -O1 do?
Hi,
> What does the declaration of IndexType look like?
nothing special:
enum IndexType {
IT_16BIT,
IT_32BIT
};
> The bug is probably in your app, not in gcc.
> I think you'd be much better off fixing the bug than trying to
> discover which optimization pass it breaks.
not quite my app just app I try to build, i.e. developer seems to not
have gcc 4.3 yet and I am just trying to get it on :) To be more
precise - the value that is defined as:
... ? HardwareIndexBuffer::IT_32BIT : HardwareIndexBuffer::IT_16BIT
is then checked with:
switch (mIndexType)
{
case IT_16BIT:
mIndexSize = sizeof(unsigned short);
break;
case IT_32BIT:
mIndexSize = sizeof(unsigned int);
break;
}
but it don't trigger any of those in anything more than -O0 (if I add
default with cerr<< it is triggered) and works on -O0... I didn't
thought such funny thing can be caused by some bug where code is quite
easy, simple switch on enumerated value that is set to one of two and
not used/changed anywhere else...
cheers,
Andrzej.