Re: Question regarding C code generation for a compound condition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 7, 2011 at 16:05, David Brown <david@xxxxxxxxxxxxxxx> wrote:
> On 07/06/2011 15:38, Albert ARIBAUD wrote:
>>
>> Hi all,
>>
>> First of all, apologies if this is not the right list, or the correct
>> way, to ask -- just point me in the right direction.
>>
>> We have encountered a weird case of gcc C code generation when
>> compiling an if statement with a compound condition under -Os -O2; we
>> suspect that the generated code is wrong, and we would like to make
>> sure before we report a compiler bug...
>>
>
> The options "-Os -O2" are contradictory.  "-Os" enables most of the same
> optimisations as "-O2" except those that are expected to increase code size,
> and it also makes the compiler pick smaller code on some occasions.

Thanks for pointing this out
>
> The key issue is documented here :
>
> <http://gcc.gnu.org/onlinedocs/gcc-4.3.5/gcc/Optimize-Options.html#index-fdelete_002dnull_002dpointer_002dchecks-658>
>
> Disable this optimisation and you'll get the "correct" result for your
> "incorrect" C code.
>
> mvh.,
>
> David

Thanks David. I wanted to make sure whether we'd uncovered a compiler
bug (and thus had to report it) or not, but anyway, as I admitted up
front our C code is obviously bad here and will be fixed anyway.

Regards,
-- 
Albert ARIBAUD - Motorola Mobility France SAS



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux