Program that segfaults with-Ofast

Christer Solskogen christer.solskogen@gmail.com
Wed Jan 3 14:45:00 GMT 2018


On 03.01.2018 14:59, Andrew Haley wrote:
> On 03/01/18 12:28, Christer Solskogen wrote:
>> ... but works fine with O2.
>> How can I debug that?
> 
> In GDB.
> 
>> It does not with happen on 6.3.0, but it does with 7.2.0. Or.. say in
>> another way: It works in Raspbian, but not in Arch Linux ARM. And it's
>> quite easy to make the assumption that the compiler is to blame (it
>> might not be!)
>>
>> So the question is... How can I debug it?
> 
> Run it in GDB, and look at where the segfault happens.  It's probably
> not a compiler bug.  Come back when you have more info.
> 

Okay, so it won't mess up how the code is presented in GDB if it is 
compiled with the different optimizations? Adding -g should be enough?

Just to be clear; I do not think it is compiler bug either. It's just 
that I "blame" the compiler when it seems to not be triggered on a older 
compiler. There's no question in my mind that the real problem is the code.

-- 
chs



More information about the Gcc-help mailing list