Greg Schafer wrote:
Jürg Billeter wrote:


It's not as easy as it sounds. As it's very likely that it's a GCC
optimization bug you can't really debug the compiled cfdisk as the
generated code is wrong. The stack after the SEGV is completely
destroyed, gdb doesn't help at all.


It seems as if you are able to reproduce the bug and have already
investigated the issue in detail. You may well be correct about GCC
optimization.

I just did a quick test with -fverbose-asm of -O vs -O2 and here are the
extra options that are enabled at -O2. While this is not guaranteed to
show every GCC optimization pass, it should be pretty close. Presumably,
it's one of these options that is causing the grief:

-fcaller-saves
-fcrossjumping
-fcse-follow-jumps
-fcse-skip-blocks
-fdelete-null-pointer-checks
-fexpensive-optimizations
-fforce-mem
-fgcse
-foptimize-register-move
-foptimize-sibling-calls
-fpeephole2
-fregmove
-freorder-blocks
-freorder-functions
-frerun-cse-after-loop
-frerun-loop-opt
-fschedule-insns2
-fstrength-reduce
-fstrict-aliasing
-fthread-jumps
-ftree-pre
-funit-at-a-time


For anyone who can reproduce the crash, here is a suggested brute force
approach to try and pinpoint the culprit:

CFLAGS="-O" ./configure
make -C fdisk
<test cfdisk to see if it segfaults>
make clean

CFLAGS="-O -fcaller-saves" ./configure
make -C fdisk
<test cfdisk to see if it segfaults>
make clean

CFLAGS="-O -fcrossjumping" ./configure
etc..
rinse, repeat

well, you get the idea :-)

T'is worth a shot methinks..


What should really be done is trying to minimize the source code of
cfdisk as much as possible while keeping the segfault, so we'd have a
testcase to submit upstream resp. see whether it's already reported in
gcc's bugzilla.

Maybe it wouldn't be that unwise to test with current 4.0 (or maybe also
4.1) snapshot as it may already have been fixed. Will test that
afterwards and maybe try to create a testcase.


Agreed. I wish I could reproduce this bug :(

Regards
Greg
--
http://www.diy-linux.org/


I already tested with -O -feach-optimization-enabled-with-O2-one-at-a-time with the script that Matt has just provided in his latest message. As Matt mentions, -O -funit-at-a-time will cause a segfault.
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to