I am cross-building a compiler, hosted on FC4 (i686-pc-linux-gnu) and targeting
m68k-elf. The following bug is reproducible in gcc-4.0.1 and gcc-4.0.2. The
offending line number is in gcc-4.0.2. The bug causes build of newlib to fail.

Here is how I am building the cross tool chain. I am aware that this is not
ideal, but it is simpler than the real build for my actual target
(m68k-unknown-coyotos). The failure is reproducible using the instructions
below.

# Unpack binutils-2.16.1
# make an empty directory, configure as
{BINUTILS_SRC}/configure --prefix=/usr/local/m68k-elf --target m68k-elf

# Build binutils as follows:
make tooldir=/usr/local/m68k-elf all
make install

#Unpack gcc-core-4.0.2 from FSF
# configure with:
{GCC_SRC}/configure --prefix=/usr/local/m68k-elf --without-headers
--with-newlib --disable-libmudflap --enable-languages=c --target m68k-elf

# build with:
PATH=/usr/local/m68k-elf/bin:${PATH} make gcc_tooldir=/usr/local/m68k-elf/bin
all-gcc
PATH=/usr/local/m68k-elf/bin:${PATH} make gcc_tooldir=/usr/local/m68k-elf/bin
install-gcc


This build proceeds successfully. Following the build, I attempt to execute
(vfprintf.i attached):

/usr/local/m68k-elf/libexec/gcc/m68k-elf/4.0.2/cc1  -fpreprocessed vfprintf.i
-quiet -dumpbase vfprintf.c -m68000 -m68000 -auxbase vfprintf -g -O2 -version
-fno-builtin -fshort-enums -o vfprintf.s
GNU C version 4.0.2 (m68k-elf)
        compiled by GNU C version 4.0.1 20050727 (Red Hat 4.0.1-5).
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129233
../../../../../../newlib-1.13.0/newlib/libc/stdio/vfprintf.c: In function
‘_vfprintf_r’:
../../../../../../newlib-1.13.0/newlib/libc/stdio/vfprintf.c:1220: internal
compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.


Compilation succeeds if '-O2' is replaced with '-O1' or '-O'. Turning off the
various -f options has no impact.

I am more than happy to test proposed patches if helpful.


-- 
           Summary: SEGV at reload.c:2400 with -O2
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: shap at eros-os dot org
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: m68k-elf


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24279

Reply via email to