clang makes segfaulting code with -march=core2 on i386

Andrey Chernov ache at freebsd.org
Fri Sep 12 18:40:51 UTC 2014


On 12.09.2014 21:20, Dimitry Andric wrote:
> On 12 Sep 2014, at 17:01, Andrey Chernov <ache at freebsd.org> wrote:
>>
>> Please look at this thread. At the end the bug trigger found, since
>> removing -march=core2 fix the thing. tijl@ suspects that clang produce
>> 64bit instruction on i386 in that case.
>>
>> https://lists.freebsd.org/pipermail/freebsd-ports/2014-September/095466.html
> 
> I just built lang/gcc successfully on 11.0-CURRENT and i386, using
> -march=core2, but saw no crashes at all.  Is this limited specifically
> to stable/10?  Do you also have a coredump of the crashed process?
> 
> -Dimitry
> 
For all cases check in 'make config' that BOOTSTRAP is off, because it not fail when gcc bootstraps itself.
To see correct error place set env MAKE_JOBS_UNSAFE=yes because gcc try to build some things in parallel and segfault can come in the middle of other unrelated compilation.
Not only lang/gcc segfaulting, but also lang/gcc48 and lang/gcc49 (last one fails in stdc++ too but for different (first) file).

xgcc does not dump core by default. I use -dH switch to force core dump running the faulting command manually.
Core was generated by `cc1plus'.
Program terminated with signal 6, Aborted.
(gdb) bt
#0  0x28f4c307 in kill () from /lib/libc.so.7
#1  0x28f4c297 in raise () from /lib/libc.so.7
#2  0x28f4a8d6 in abort () from /lib/libc.so.7
#3  0x0892f138 in real_abort ()
#4  0x0892e7ac in diagnostic_action_after_output ()
#5  0x0892e4ca in diagnostic_report_diagnostic ()
#6  0x0892f106 in internal_error ()
#7  0x0853b17e in crash_signal ()
#8  0xbfbff004 in ?? ()
#9  0x0000000b in ?? ()
#10 0x00000001 in ?? ()
#11 0xbfbfab40 in ?? ()
#12 0x08d208d8 in ?? ()
#13 0x0853b140 in alloc_for_identifier_to_locale ()
#14 0x081f2a8c in gt_pch_nx_lang_tree_node ()
#15 0x081f1bd6 in gt_pch_nx_lang_tree_node ()
#16 0x081f26c1 in gt_pch_nx_lang_tree_node ()
#17 0x081f22ab in gt_pch_nx_lang_tree_node ()
#18 0x081f2260 in gt_pch_nx_lang_tree_node ()
#19 0x081f1e62 in gt_pch_nx_lang_tree_node ()
#20 0x081f271b in gt_pch_nx_lang_tree_node ()
#21 0x081f231d in gt_pch_nx_lang_tree_node ()
#22 0x081f4304 in gt_pch_nx_lang_type ()
#23 0x081f270c in gt_pch_nx_lang_tree_node ()
#24 0x081f1ba9 in gt_pch_nx_lang_tree_node ()
#25 0x081f226f in gt_pch_nx_lang_tree_node ()
#26 0x081f1ba9 in gt_pch_nx_lang_tree_node ()
#27 0x081f2a8c in gt_pch_nx_lang_tree_node ()
#28 0x081f42f5 in gt_pch_nx_lang_type ()
#29 0x081f270c in gt_pch_nx_lang_tree_node ()
#30 0x081f26fd in gt_pch_nx_lang_tree_node ()
#31 0x081f26ee in gt_pch_nx_lang_tree_node ()
#32 0x081f26d0 in gt_pch_nx_lang_tree_node ()
#33 0x081f26df in gt_pch_nx_lang_tree_node ()
#34 0x081f1ba9 in gt_pch_nx_lang_tree_node ()
#35 0x081f26c1 in gt_pch_nx_lang_tree_node ()
#36 0x081f2260 in gt_pch_nx_lang_tree_node ()
#37 0x081f2a8c in gt_pch_nx_lang_tree_node ()
#38 0x081f271b in gt_pch_nx_lang_tree_node ()
#39 0x081f1ff9 in gt_pch_nx_lang_tree_node ()
[rest stripped...]

As you see, last meaningful info say something about "locale". If system locale assumed here, I use ru_RU.KOI8-R. I try to check this thing with LANG=C later.

I don't have -current & i386 combination, but I can try -current & x64 later (with different -march).
Instruction set may depends on CPU, I have "Core2 Duo E8400" which should match -march=core2 in theory.
For lang/gcc the bug starts on second stdc++ file compiling, related log from the entering stdc++ directory:

gmake[5]: Entering directory `/usr/ports/lang/gcc/work/build/i386-portbld-freebsd10.1/libstdc++-v3'
Making all in include
gmake[6]: Entering directory `/usr/ports/lang/gcc/work/build/i386-portbld-freebsd10.1/libstdc++-v3/include'
mkdir -p ./i386-portbld-freebsd10.1/bits/stdc++.h.gch
/usr/ports/lang/gcc/work/build/./gcc/xgcc -shared-libgcc -B/usr/ports/lang/gcc/work/build/./gcc -nostdinc++ -L/usr/ports/lang/gcc/work/build/i386-portbld-freebsd10.1/libstdc++-v3/src -L/usr/ports/lang/gcc/work/build/i386-portbld-freebsd10.1/libstdc++-v3/src/.libs -B/usr/local/i386-portbld-freebsd10.1/bin/ -B/usr/local/i386-portbld-freebsd10.1/lib/ -isystem /usr/local/i386-portbld-freebsd10.1/include -isystem /usr/local/i386-portbld-freebsd10.1/sys-include    -x c++-header -nostdinc++ -g -O2 -pipe -march=core2 -DLIBICONV_PLUG -fno-strict-aliasing  -DLIBICONV_PLUG -I/usr/ports/lang/gcc/work/build/i386-portbld-freebsd10.1/libstdc++-v3/include/i386-portbld-freebsd10.1 -I/usr/ports/lang/gcc/work/build/i386-portbld-freebsd10.1/libstdc++-v3/include -I/usr/ports/lang/gcc/work/gcc-4.8.3/libstdc++-v3/libsupc++ -O2 -g -std=gnu++0x /usr/ports/lang/gcc/work/gcc-4.8.3/libstdc++-v3/include/precompiled/stdc++.h \
-o i386-portbld-freebsd10.1/bits/stdc++.h.gch/O2ggnu++0x.gch
mkdir -p ./i386-portbld-freebsd10.1/bits/stdc++.h.gch
/usr/ports/lang/gcc/work/build/./gcc/xgcc -shared-libgcc -B/usr/ports/lang/gcc/work/build/./gcc -nostdinc++ -L/usr/ports/lang/gcc/work/build/i386-portbld-freebsd10.1/libstdc++-v3/src -L/usr/ports/lang/gcc/work/build/i386-portbld-freebsd10.1/libstdc++-v3/src/.libs -B/usr/local/i386-portbld-freebsd10.1/bin/ -B/usr/local/i386-portbld-freebsd10.1/lib/ -isystem /usr/local/i386-portbld-freebsd10.1/include -isystem /usr/local/i386-portbld-freebsd10.1/sys-include    -x c++-header -nostdinc++ -g -O2 -pipe -march=core2 -DLIBICONV_PLUG -fno-strict-aliasing  -DLIBICONV_PLUG -I/usr/ports/lang/gcc/work/build/i386-portbld-freebsd10.1/libstdc++-v3/include/i386-portbld-freebsd10.1 -I/usr/ports/lang/gcc/work/build/i386-portbld-freebsd10.1/libstdc++-v3/include -I/usr/ports/lang/gcc/work/gcc-4.8.3/libstdc++-v3/libsupc++ -O2 -g /usr/ports/lang/gcc/work/gcc-4.8.3/libstdc++-v3/include/precompiled/stdc++.h -o i386-portbld-freebsd10.1/bits/stdc++.h.gch/O2g.gch
In file included from /usr/ports/lang/gcc/work/gcc-4.8.3/libstdc++-v3/include/precompiled/stdc++.h:94:0:
/usr/ports/lang/gcc/work/build/i386-portbld-freebsd10.1/libstdc++-v3/include/valarray:1233:1: internal compiler error: Segmentation fault
 } // namespace
 ^
no stack trace because unwind library not available
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
gmake[6]: *** [i386-portbld-freebsd10.1/bits/stdc++.h.gch/O2g.gch] Error 1

-- 
http://ache.vniz.net/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-toolchain/attachments/20140912/2c7e652e/attachment.sig>


More information about the freebsd-toolchain mailing list