Re: Program that segfaults with-Ofast

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

 



On 04/01/18 09:18, Christer Solskogen wrote:
> On 03.01.2018 16:23, David Brown wrote:
>> On 03/01/18 13:28, Christer Solskogen wrote:
>>> ... but works fine with O2.
>>> How can I debug that?
>>>
>>> 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?
>>> Oh, it also segfaults with O3.
>>>
>>>
>>
>> First, make sure you are compiling with plenty of warnings (-Wall
>> -Wextra to start with, but look at the manual for more) to see if there
>> is anything obvious going on.  Newer versions of gcc have more warnings.
>>
> 
> No warnings :(
> 

It was worth a shot!

> 
>> Then try the sanitize options.  That won't stop the program crashing,
>> but will (hopefully!) stop the program with useful information when the
>> error occurs.
>>
> 
> Any tips on which one? The options for gcc was a bit far over my head.
> 

Start with

	-fsanitize=address
	-fsanitize=undefined

If your code is multi-threading, also try -fsanitize=thread.







[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