Port-sh3 archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: NetBSD 7 and segfault
John wrote:
> perl.c: In function 'S_my_exit_jump':
> perl.c:5042:1: internal compiler error: Segmentation fault
> S_my_exit_jump(pTHX)
> ^
> no stack trace because unwind library not available
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <http://www.NetBSD.org/support/send-pr.html> for instructions.
> *** Error code 1
The same occurred on my NetBSD/landisk 7.0-BETA environment
when building pkgsrc 'pkgtools/digest'.
===> Building for digest-20121220
gcc -DHAVE_CONFIG_H -I. -I. -DHOST=\"shle--netbsdelf\" -DVERSION=\"20121220\" -Os -freorder-blocks -c digest.c -o digest.o
digest.c: In function 'digest_file':
digest.c:130:1: internal compiler error: Segmentation fault
digest_file(char *fn, alg_t *alg)
^
no stack trace because unwind library not available
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://www.NetBSD.org/support/send-pr.html> for instructions.
*** Error code 1
I tried some changes optimization flag.
1) add DBG=-O0 in /etc/mk.conf
No problem, built success. All binary files were built.
2) add DBG=-O1,-O2 in /etc/mk.conf
Same SEGV problem occurred.
I think it is the problem of GCC 4.8.3 optimization for netbsd-sh3.
3) gcc with gcc
I built gcc 4.8.3 (in-tree netbsd-src, src/external/gpl3/gcc) with
-g flag, and run with gdb by gcc -wrapper gdb,--args.
It said:
(gdb) r
Starting program: /usr/libexec/cc1 -quiet -I . -I . -D HAVE_CONFIG_H -D HOST=\"shle--netbsdelf\" -D VERSION=\"20121220\" digest.c -quiet -dumpbase digest.c -auxbase-strip digest.o -Os -freorder-blocks -o /var/tmp//ccg04THT.s
Program received signal SIGSEGV, Segmentation fault.
0x004b0a22 in mark_ref_stored (loop=0x0, loop@entry=0x20fe0320,
ref=<optimized out>)
at /export/netbsd-7/src/external/gpl3/gcc/dist/gcc/tree-ssa-loop-im.c:1626
1626 && !bitmap_bit_p (ref->stored, loop->num);
(gdb) bt
#0 0x004b0a22 in mark_ref_stored (loop=0x0, loop@entry=0x20fe0320,
ref=<optimized out>)
at /export/netbsd-7/src/external/gpl3/gcc/dist/gcc/tree-ssa-loop-im.c:1626
#1 0x004b3484 in gather_mem_refs_stmt (stmt=0x21069e60, loop=0x20fe0320)
at /export/netbsd-7/src/external/gpl3/gcc/dist/gcc/tree-ssa-loop-im.c:1661
#2 gather_mem_refs_in_loops ()
at /export/netbsd-7/src/external/gpl3/gcc/dist/gcc/tree-ssa-loop-im.c:1714
#3 analyze_memory_references ()
at /export/netbsd-7/src/external/gpl3/gcc/dist/gcc/tree-ssa-loop-im.c:1800
#4 tree_ssa_lim ()
at /export/netbsd-7/src/external/gpl3/gcc/dist/gcc/tree-ssa-loop-im.c:2708
#5 0x0054e108 in execute_one_pass (pass=0x20e0b680)
at /export/netbsd-7/src/external/gpl3/gcc/dist/gcc/passes.c:2333
#6 0x0054e2e2 in execute_pass_list (pass=0x20e0b680)
at /export/netbsd-7/src/external/gpl3/gcc/dist/gcc/passes.c:2381
#7 0x0054e300 in execute_pass_list (pass=0xa95324 <pass_tree_loop>)
at /export/netbsd-7/src/external/gpl3/gcc/dist/gcc/passes.c:2382
#8 0x0054e300 in execute_pass_list (pass=0xa91b9c <pass_all_optimizations>)
at /export/netbsd-7/src/external/gpl3/gcc/dist/gcc/passes.c:2382
#9 0x006f5f5c in expand_function (node=0x2103cbd0)
at /export/netbsd-7/src/external/gpl3/gcc/dist/gcc/cgraphunit.c:1640
#10 0x006f7086 in expand_all_functions ()
at /export/netbsd-7/src/external/gpl3/gcc/dist/gcc/cgraphunit.c:1744
#11 compile ()
at /export/netbsd-7/src/external/gpl3/gcc/dist/gcc/cgraphunit.c:2042
(snip)
(gdb) l
1621 static void
1622 mark_ref_stored (mem_ref_p ref, struct loop *loop)
1623 {
1624 for (;
1625 loop != current_loops->tree_root
1626 && !bitmap_bit_p (ref->stored, loop->num);
1627 loop = loop_outer (loop))
1628 bitmap_set_bit (ref->stored, loop->num);
1629 }
'loop' is 0, so SEGV occurs by loop->num.
'loop' is create by loop_outer(loop), which from original loop->superloops
(in cfgloop.c: http://nxr.netbsd.org/xref/src/external/gpl3/gcc/dist/gcc/cfgloop.h#460 )
loop@entry is:
(gdb) print *loop@entry
$2 = {num = 0, ninsns = 0, header = 0x21076800, latch = 0x21076840,
lpt_decision = {decision = LPT_NONE, times = 0}, av_ninsns = 0,
num_nodes = 10, superloops = 0x0, inner = 0x20fe02bc, next = 0x0, aux = 0x0,
nb_iterations = 0x0, nb_iterations_upper_bound = {low = 0, high = 0},
nb_iterations_estimate = {low = 0, high = 0}, any_upper_bound = false,
any_estimate = false, can_be_parallel = false,
warned_aggressive_loop_optimizations = false,
estimate_state = EST_NOT_COMPUTED, bounds = 0x0, exits = 0x210816c0}
I do not know why this is 0.
4) I built gcc 4.8.3 with -O0 flag, and run it on NetBSD/sh3
No problem, compiling digest.c is successfull even if add flag -Os
or -O1 or -O2.
In the case of '-Os -freorder-blocks' (system default):
# gcc -DHAVE_CONFIG_H -I. -I. -DHOST=\"shle--netbsdelf\" -DVERSION=\"20121220\" -Os -freorder-blocks -c digest.c -o digest.o
% ls -l digest.o
-rw-r--r-- 1 root wheel 8084 Sep 27 15:02 digest.o
# file digest.o
digest.o: ELF 32-bit LSB relocatable, Renesas SH, version 1 (SYSV), not stripped
In the case of '-O1':
# gcc -DHAVE_CONFIG_H -I. -I. -DHOST=\"shle--netbsdelf\" -DVERSION=\"20121220\" -O1 -c digest.c -o digest.o
# ls -l digest.o
-rw-r--r-- 1 root wheel 8016 Sep 27 15:03 digest.o
In the case of '-O2':
# gcc -DHAVE_CONFIG_H -I. -I. -DHOST=\"shle--netbsdelf\" -DVERSION=\"20121220\" -O2 -c digest.c -o digest.o
usl5p2# ls -l digest.o
-rw-r--r-- 1 root wheel 8208 Sep 27 15:04 digest.o
Howerver, I don't know where these objects (compiled with -Ox) works corectly.
This shows that the result has been changed by optimizaton flag when
compiling target-gcc.
Maybe, sh3-target object compiled by gcc4.8 with -Os(or O1, O2,...) has
some promblems, not correct.
Usual NetBSD/sh3 binaries include target sh3's gcc were made with
'-Os freorder-blocks' from build.sh, so I think target-gcc binary may
be not work correctly, too.
I cannot debug gcc anymore.
Anyone please advices.
Thanks.
--
Yasushi Oshima
Home |
Main Index |
Thread Index |
Old Index