Re: Program that segfaults with -Ofast

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

 



On 08/01/18 09:28, Christer Solskogen wrote:
> On 08.01.2018 10:13, Andrew Haley wrote:
>> On 07/01/18 21:27, Christer Solskogen wrote:
>>> Fixed!
>>>
>>> Wanna know something funny?
>>> Having a printf fixed the segfault. Without it, it would crash.
>>> So the workaround in read_kickstart (memory.cpp) was to add
>>> "volatile int i" instead of "int i".
>>>
>>> Just one simple printf("Value of i: %d\n", i); was enough to not segfault.
>>
>> That's probably not the real fix, unless you have another thread accessing
>> i.
> 
> Hm.. perhaps.
> Is there a way to see how the code looks like with different 
> optimization flags?

Sure.  Compile with -Wa,-adhls.  But you'll get too much information to go on.

-- 
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671



[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