This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

GCC-3.0.2 m68k-cross-compiler segmentation violation


Here's a bug I've encountered in gcc-3.0 (CVS snapshot) when configured
as an m68k cross-compiler.  The same version configured as an i386
cross-compiler works properly.  I hope I've provided the correct
information.  I know the example source file and command line are both
big, but I don't have any more time to pare things down.

GCC version (CVS update, September 23):
/opt/rtems/lib/gcc-lib/m68k-rtems/3.0.2/cc1plus --version
GNU C++ version 3.0.2 20010923 (prerelease) (m68k-rtems)
        compiled by GNU C version 2.96 20000731 (Red Hat Linux 7.1
2.96-85).
GNU CPP version 3.0.2 20010923 (prerelease) (cpplib) (68k, Motorola
syntax)

Host: uname -a
Linux norum1.usask.ca 2.2.19-7.0.8 #1 Thu Jun 21 06:28:56 EDT 2001 i686
unknown

Configuration:
../gcc-CVS/configure --target=m68k-rtems --with-gnu-as --with-gnu-ld
--with-newlib --verbose --enable-threads --enable-languages=c,c++
--prefix=/opt/rtems

Command:
/opt/rtems/lib/gcc-lib/m68k-rtems/3.0.2/cc1plus -v -I. -I..
-I../../../src/libCom/bucketLib -I../../../src/libCom/ring
-I../../../src/libCom/calc -I../../../src/libCom/cvtFast 
-I../../../src/libCom/cppStd -I../../../src/libCom/cxxTemplates
-I../../../src/libCom/dbmf -I../../../src/libCom/ellLib
-I../../../src/libCom/env -I../../../src/libCom/error
-I../../../src/libCom/fdmgr -I../../../src/libCom/freeList
-I../../../src/libCom/gpHash -I../../../src/libCom/logClient
-I../../../src/libCom/macLib -I../../../src/libCom/misc
-I../../../src/libCom/osi -I../../../src/libCom/taskw 
-I../../../src/libCom/timer -I../../../src/libCom/tsDef
-I../../../include/os/RTEMS -I../../../include -I/usr/local//include
-isystem /opt/rtems/m68k-rtems/gen68360/lib/include -D__GNUC__=3
-D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=2 -D__mc68000__ -D__rtems__
-D__rtems__ -D__ELF__ -D__mc68000 -D__rtems -Asystem=rtems -Acpu=mc68000
-Acpu=m68k -Amachine=m68k -D__OPTIMIZE__ -D__STDC_HOSTED__=1 -Wall
-D__mcpu32__ -D__mcpu32 -DOSITHREAD_USE_DEFAULT_STACK
-Dfopen=rtems_fopen -Dmain=rtems_main foo -D__GNUG__=3
-D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100
-D__STRICT_ANSI__ -trigraphs -$ -quiet -dumpbase epicsListBase.cpp
-mcpu32 -ansi -O3 -Wall -ansi -version -fasm -o /tmp/ccnPUGAN.s

Post-mortem gdb operation shows that fault is a null-pointer dereference
in sjlj_emit_dispatch_table: 
2319        }
2320
2321      seq = get_insns ();
2322      end_sequence ();
2323
2324      emit_insns_before (seq,
(cfun->eh->region_array[first_reachable]
2325                               ->post_landing_pad));
2326    }
2327
2328    static void
(gdb) print first_reachable
$1 = 0
(gdb) print cfun->eh->region_array[first_reachable]
$2 = (struct eh_region *) 0x0         <<<<<<<< NULL POINTER
DEREFERENCE!!!
(gdb) print cfun->eh->region_array
$3 = (struct eh_region **) 0x82d5078
(gdb) where
#0  0x80f0f4e in sjlj_emit_dispatch_table (dispatch_label=0x4027ce80,
lp_info=0x82e0510) at ../../gcc-CVS/gcc/except.c:2324
#1  0x80f0fed in sjlj_build_landing_pads () at
../../gcc-CVS/gcc/except.c:2349
#2  0x80f107f in finish_eh_generation () at 
../../gcc-CVS/gcc/except.c:2387
#3  0x80c7466 in rest_of_compilation (decl=0x40287068) at
../../gcc-CVS/gcc/toplev.c:2936
#4  0x80ae256 in genrtl_finish_function (fn=0x40287068) at
../../gcc-CVS/gcc/cp/semantics.c:2719
#5  0x80adf6a in expand_body (fn=0x40287068) at
../../gcc-CVS/gcc/cp/semantics.c:2505
#6  0x807fb3d in finish_file () at ../../gcc-CVS/gcc/cp/decl2.c:3580
#7  0x80893cd in yyparse_1 () at parse.y:441
#8  0x80c6acb in compile_file (name=0x82c167e "foo") at
../../gcc-CVS/gcc/toplev.c:2369
#9  0x80ca01e in main (argc=70, argv=0xbffff004) at
../../gcc-CVS/gcc/toplev.c:4990
#10 0x4004557e in __libc_start_main (main=0x80c98e8 <main>, argc=70,
ubp_av=0xbffff004, init=0x80490d8 <_init>, fini=0x82005d0 <_fini>,
rtld_fini=0x4000dc78 <_dl_fini>, stack_end=0xbfffeffc) at
../sysdeps/generic/libc-start.c:129

Compressed, preprocessed source file (foo) attached.


-- 
Eric Norum                                 eric.norum@usask.ca
Department of Electrical Engineering       Phone: (306) 966-5394
University of Saskatchewan                 FAX:   (306) 966-5407
Saskatoon, Canada.

foo.gz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]