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: Question regarding C code generation for a compound condition


On Tue, Jun 7, 2011 at 16:05, David Brown <david@westcontrol.com> 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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]