gcc 4.1 -O1 problem

Kevin Shanahan kmshanah@disenchant.net
Thu Mar 16 06:11:00 GMT 2006


On Wed, Mar 15, 2006 at 09:57:13PM -0800, Ian Lance Taylor wrote:
> Kevin Shanahan <kmshanah@disenchant.net> writes:
> > Are there any other options besides these which -O1 affects?
> 
> -O1 is unfortunately not the sum of individual options.  The compiler
> often simply checks whether you are optimizing at all, rather than
> checking specific options.

Okay, thanks anyway. I found out that the signed char cast in this
snippet of code changed behaviour with -O1:

    int snd_scaletable[32][256];
    int i, j;

    for (i = 0; i < 32; i++)
	for (j = 0; j < 256; j++)
	    snd_scaletable[i][j] = ((signed char)j) * i * 8;

I made the value explicit as '(j < 128) ? j : j - 256' instead.

Cheers,
Kevin.



More information about the Gcc-help mailing list