So it looks like the addition of reading ldblspecs causes crashes
because it's reading from unallocated memory.

(i found this because bootstrap on dataflow branch fails on ppc64 with
this crash).

I can't trigger it with -save-temps, sadly.

According to valgrind on ppc (3.1.0 from developer.valgrind.org):

valgrind /home/dberlin/gcc/build/./gcc/xgcc
-B/home/dberlin/gcc/build/./gcc/ -B/usr/local/powerpc-suse-linux/bin/
-B/usr/local/powerpc-suse-linux/lib/ -isystem
/usr/local/powerpc-suse-linux/include -isystem
/usr/local/powerpc-suse-linux/sys-include -O2 -O2 -g -O2 -DIN_GCC -W
-Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition -isystem ./include -fPIC -specs=ldblspecs -g
-DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -I. -I.
-I../../gcc -I../../gcc/. -I../../gcc/../include
-I../../gcc/../libcpp/include -I../../gcc/../libdecnumber
-I../libdecnumber -DSHARED -fPIC -mstrict-align -DL_divdi3 -fexceptions
-fnon-call-exceptions -c ../../gcc/libgcc2.c -o libgcc/./_divdi3_s.o

gives

==10712== Memcheck, a memory error detector.
==10712== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==10712== Using LibVEX rev 1471, a library for dynamic binary translation.
==10712== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==10712== Using valgrind-3.1.0, a dynamic binary instrumentation framework.
==10712== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==10712== For more details, rerun with: -v
==10712==
Reading specs from /home/dberlin/gcc/build/./gcc/specs
Reading specs from /home/dberlin/gcc/build/./gcc/ldblspecs
==10712== Invalid read of size 1
==10712==    at 0x100141D4: used_arg (gcc.c:7070)
==10712==    by 0x10014B0C: set_multilib_dir (gcc.c:7315)
==10712==    by 0x10011C38: main (gcc.c:6348)
==10712==  Address 0x44D25D4 is 0 bytes after a block of size 12 alloc'd
==10712==    at 0xFFBA77C: malloc (vg_replace_malloc.c:149)
==10712==    by 0x1001FE90: xmalloc (xmalloc.c:147)
==10712==    by 0x10020024: xstrdup (xstrdup.c:34)
==10712==    by 0x10002E30: set_spec (gcc.c:1843)
==10712==    by 0x10003DC0: read_specs (gcc.c:2223)
==10712==    by 0x10011BBC: main (gcc.c:6333)
Target: powerpc-suse-linux
Configured with: ../configure --enable-languages=c,c++,f95
powerpc-suse-linux
Thread model: posix
gcc version 4.2.0 20060201 (experimental)
 /home/dberlin/gcc/build/./gcc/cc1 -quiet -v -I. -I. -I../../gcc
-I../../gcc/. -I../../gcc/../include -I../../gcc/../libcpp/include
-I../../gcc/../libdecnumber -I../libdecnumber -iprefix
/home/dberlin/gcc/build/gcc/../lib/gcc/powerpc-suse-linux/4.2.0/
-isystem /home/dberlin/gcc/build/./gcc/include -D__unix__
-D__gnu_linux__ -D__linux__ -Dunix -D__unix -Dlinux -D__linux
-Asystem=linux -Asystem=unix -Asystem=posix -DIN_GCC -DHAVE_GTHR_DEFAULT
-DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -DSHARED -DL_divdi3 -isystem
/usr/local/powerpc-suse-linux/include -isystem
/usr/local/powerpc-suse-linux/sys-include -isystem ./include
../../gcc/libgcc2.c -quiet -dumpbase libgcc2.c -mstrict-align
-auxbase-strip libgcc/./_divdi3_s.o -g -g -O2 -O2 -O2 -W -Wall
-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition -version -fPIC -fPIC -fexceptions
-fnon-call-exceptions -mlong-double-128 -o /tmp/cc96agbK.s
ignoring nonexistent directory "/usr/local/powerpc-suse-linux/include"
ignoring nonexistent directory "/usr/local/powerpc-suse-linux/sys-include"
ignoring duplicate directory "./include"
ignoring nonexistent directory
"/home/dberlin/gcc/build/gcc/../lib/gcc/powerpc-suse-linux/4.2.0/include"
ignoring nonexistent directory
"/home/dberlin/gcc/build/gcc/../lib/gcc/powerpc-suse-linux/4.2.0/../../../../powerpc-suse-linux/include"
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory
"/usr/local/lib/gcc/powerpc-suse-linux/4.2.0/include"
ignoring nonexistent directory
"/usr/local/lib/../powerpc-suse-linux/include"
ignoring duplicate directory "."
ignoring duplicate directory "../../gcc/."
#include "..." search starts here:
#include <...> search starts here:
 .
 ../../gcc
 ../../gcc/../include
 ../../gcc/../libcpp/include
 ../../gcc/../libdecnumber
 ../libdecnumber
 /home/dberlin/gcc/build/./gcc/include
 /usr/local/include
 /usr/include
End of search list.
GNU C version 4.2.0 20060201 (experimental) (powerpc-suse-linux)
        compiled by GNU C version 4.0.2 20050901 (prerelease) (SUSE Linux).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 536fdbb2127ba0d2ba62501205c6db21
 /home/dberlin/gcc/build/./gcc/as -mppc -many -V -Qy -K PIC -o
libgcc/./_divdi3_s.o /tmp/cc96agbK.s
GNU assembler version 2.16.91.0.2 (powerpc-suse-linux) using BFD version
2.16.91.0.2 20050720 (SuSE Linux)
==10712==
==10712== ERROR SUMMARY: 2 errors from 1 contexts (suppressed: 6 from 2)
==10712== malloc/free: in use at exit: 97,812 bytes in 911 blocks.
==10712== malloc/free: 1,214 allocs, 303 frees, 152,021 bytes allocated.
==10712== For counts of detected errors, rerun with: -v
==10712== searching for pointers to 911 not-freed blocks.
==10712== checked 81,660 bytes.
==10712==
==10712== LEAK SUMMARY:
==10712==    definitely lost: 65,177 bytes in 551 blocks.
==10712==      possibly lost: 0 bytes in 0 blocks.
==10712==    still reachable: 32,635 bytes in 360 blocks.
==10712==         suppressed: 0 bytes in 0 blocks.
==10712== Use --leak-check=full to see details of leaked memory.



Note that you can do it on any file though.

valgrind ./xgcc -B ./ -specs=ldblspecs <file> will show the same error.

Reply via email to