public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/44724] New: LTO segfault
@ 2010-06-30 12:23 moonshine at kapsi dot fi
2010-06-30 12:28 ` [Bug lto/44724] " moonshine at kapsi dot fi
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: moonshine at kapsi dot fi @ 2010-06-30 12:23 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4137 bytes --]
VICE Commodore emulator lto-build fails with a segfault in lto1. The code has
both C and C++ source files so it is linked with g++. As compilation fails
during lto, it is difficult to produce a self-contained testcase, but you
should be able to reproduce the fault by downloading and building VICE
http://www.zimmers.net/anonftp/pub/cbm/crossplatform/emulators/VICE/vice-2.2.tar.gz
If there is a simple way to produce a smaller testcase for this bug, please let
me know.
I am using newest binutils from cvs, configured with
--enable-gold --enable-plugins
$ ld -v
GNU gold (GNU Binutils 2.20.51.20100629) 1.9
and gcc from svn 4.5 branch revision 161539.
$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/misty/gcc/libexec/gcc/i686-pc-linux-gnu/4.5.1/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../gcc-45branch/configure --prefix=/home/misty/gcc
--enable-languages=c,c++ --enable-gold --enable-lto --enable-plugins
Thread model: posix
gcc version 4.5.1 20100629 (prerelease) (GCC)
Link command:
g++ -flto -fuse-linker-plugin -O3 -fomit-frame-pointer -march=pentium4 -o x64
alarm.o attach.o autostart.o autostart-prg.o charset.o clkguard.o clipboard.o
cmdline.o cbmdos.o cbmimage.o color.o crc32.o datasette.o debug.o dma.o
embedded.o emuid.o event.o findpath.o fliplist.o gcr.o info.o init.o
initcmdline.o interrupt.o ioutil.o joystick.o kbdbuf.o keyboard.o lib.o
libm_math.o lightpen.o log.o machine-bus.o machine.o main.o network.o
opencbmlib.o palette.o ram.o rawfile.o resources.o romset.o screenshot.o
snapshot.o socket.o sound.o sysfile.o translate.o traps.o util.o vsync.o
zfile.o zipcode.o maincpu.o mouse.o midi.o ../src/c64/libc64.a
../src/c64/cart/libc64cart.a ../src/drive/iec/libdriveiec.a
../src/drive/iecieee/libdriveiecieee.a
../src/drive/iec/c64exp/libdriveiecc64exp.a ../src/drive/ieee/libdriveieee.a
../src/drive/libdrive.a ../src/iecbus/libiecbus.a ../src/parallel/libparallel.a
../src/vdrive/libvdrive.a ../src/sid/libsid.a ../src/monitor/libmonitor.a
../src/sounddrv/libsounddrv.a ../src/gfxoutputdrv/libgfxoutputdrv.a
../src/printerdrv/libprinterdrv.a ../src/rs232drv/librs232drv.a
../src/diskimage/libdiskimage.a ../src/fsdevice/libfsdevice.a
../src/tape/libtape.a ../src/imagecontents/libimagecontents.a
../src/fileio/libfileio.a ../src/serial/libserial.a ../src/core/libcore.a
../src/vicii/libvicii.a ../src/raster/libraster.a ../src/video/libvideo.a
../src/arch/unix/libarch.a ../src/arch/unix/gui/libarchgui.a
../src/arch/unix/x11/gnome/libgnomeui.a ../src/arch/unix/x11/libx11ui.a
../src/resid/libresid.a ../src/resid-fp/libresidfp.a -lXrandr -lXxf86vm
-pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0
-lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig
-lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 -lasound
-lreadline -ljpeg -lgif -lpng -lz -ldl -lbsd -lnsl -lbsd -lm
resid-fp.h:32:21: warning: type of residfp_hooks does not match original
declaration
resid-fp.cc:282:14: note: previously declared here
../../src/interrupt.h:289:14: warning: type of drive_clk does not match
original declaration
drive.c:131:7: note: previously declared here
fastsid.h:33:21: warning: type of fastsid_hooks does not match original
declaration
fastsid.c:1028:14: note: previously declared here
lto1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
lto-wrapper: g++ returned 1 exit status
/home/misty/gcc/lib/gcc/i686-pc-linux-gnu/4.5.1/../../../../i686-pc-linux-gnu/bin/ld:
fatal error: lto-wrapper failed
collect2: ld returned 1 exit status
--
Summary: LTO segfault
Product: gcc
Version: 4.5.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: moonshine at kapsi dot fi
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44724
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/44724] LTO segfault
2010-06-30 12:23 [Bug lto/44724] New: LTO segfault moonshine at kapsi dot fi
@ 2010-06-30 12:28 ` moonshine at kapsi dot fi
2010-06-30 13:00 ` rguenth at gcc dot gnu dot org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: moonshine at kapsi dot fi @ 2010-06-30 12:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from moonshine at kapsi dot fi 2010-06-30 12:27 -------
(In reply to comment #0)
I forgot to add that I configured VICE with a following command:
CFLAGS='-flto -fuse-linker-plugin -O3 -fomit-frame-pointer -march=pentium4'
CXXFLAGS='-O3 -fomit-frame-pointer -funroll-loops -march=pentium4 -flto
-fuse-linker-plugin' ./configure --prefix=/home/misty/gcc --enable-gnomeui
--enable-fullscreen; make
If you forget --enable-gnomeui, build will fail in my experience, so this is
important.
--
moonshine at kapsi dot fi changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|LTO segfault |LTO segfault
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44724
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/44724] LTO segfault
2010-06-30 12:23 [Bug lto/44724] New: LTO segfault moonshine at kapsi dot fi
2010-06-30 12:28 ` [Bug lto/44724] " moonshine at kapsi dot fi
@ 2010-06-30 13:00 ` rguenth at gcc dot gnu dot org
2010-07-01 10:47 ` moonshine at kapsi dot fi
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-06-30 13:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rguenth at gcc dot gnu dot org 2010-06-30 12:59 -------
On the link command-line add -r -nostdlib and start removing as many objects
and libraries from the command-line as possible (preserving the crash of
course).
If static libraries remain, open them up and add/remove individual object
files.
For the smallest set of object files we need preprocessed source and the
command-lines to produce them.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44724
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/44724] LTO segfault
2010-06-30 12:23 [Bug lto/44724] New: LTO segfault moonshine at kapsi dot fi
2010-06-30 12:28 ` [Bug lto/44724] " moonshine at kapsi dot fi
2010-06-30 13:00 ` rguenth at gcc dot gnu dot org
@ 2010-07-01 10:47 ` moonshine at kapsi dot fi
2010-07-01 11:18 ` moonshine at kapsi dot fi
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: moonshine at kapsi dot fi @ 2010-07-01 10:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from moonshine at kapsi dot fi 2010-07-01 10:47 -------
Created an attachment (id=21055)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21055&action=view)
Preprocessed source files to reproduce this problem
I was able to reduce this to two (2) source files. Quite an improvement,
original was more than hundred files :) The exact command I used to reproduce
this bug is:
g++ -r -nostdlib -O3 -fomit-frame-pointer -funroll-loops -march=pentium4 -flto
-fuse-linker-plugin sid.ii wave.ii
The .ii files were created with
g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"resid\"
-DVERSION=\"0.16vice\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1
-DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1
-DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1
-DSIZEOF_INT=4 -I. -I. -O3 -fomit-frame-pointer -funroll-loops
-march=pentium4 -flto -fuse-linker-plugin -MT sid.o -MD -MP -MF ".deps/sid.Tpo"
-E sid.cc > sid.ii
g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"resid\"
-DVERSION=\"0.16vice\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1
-DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1
-DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1
-DSIZEOF_INT=4 -I. -I. -O3 -fomit-frame-pointer -funroll-loops
-march=pentium4 -flto -fuse-linker-plugin -MT wave.o -MD -MP -MF
".deps/wave.Tpo" -E wave.cc > wave.ii
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44724
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/44724] LTO segfault
2010-06-30 12:23 [Bug lto/44724] New: LTO segfault moonshine at kapsi dot fi
` (2 preceding siblings ...)
2010-07-01 10:47 ` moonshine at kapsi dot fi
@ 2010-07-01 11:18 ` moonshine at kapsi dot fi
2010-07-01 11:35 ` [Bug lto/44724] LTO segfault with -fuse-linker-plugin rguenth at gcc dot gnu dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: moonshine at kapsi dot fi @ 2010-07-01 11:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from moonshine at kapsi dot fi 2010-07-01 11:18 -------
In the meantime I also built gcc trunk revision 161601 and this also fails
with:
lto1: internal compiler error: vector VEC(cgraph_node_ptr,base) index domain
error, in lto_cgraph_encoder_deref at lto-cgraph.c:141
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44724
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/44724] LTO segfault with -fuse-linker-plugin
2010-06-30 12:23 [Bug lto/44724] New: LTO segfault moonshine at kapsi dot fi
` (3 preceding siblings ...)
2010-07-01 11:18 ` moonshine at kapsi dot fi
@ 2010-07-01 11:35 ` rguenth at gcc dot gnu dot org
2010-07-01 11:41 ` rguenth at gcc dot gnu dot org
2010-07-06 12:57 ` moonshine at kapsi dot fi
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-07-01 11:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from rguenth at gcc dot gnu dot org 2010-07-01 11:35 -------
Confirmed. Works without -fuse-linker-plugin.
Reduced testcases:
wave.ii
-------
typedef unsigned int reg8;
typedef unsigned int reg12;
class WaveformGenerator {
public:
reg8 readOSC();
inline reg12 output();
reg8 waveform;
reg12 output____();
};
inline reg12 WaveformGenerator::output() {
switch (waveform) {
default:
return output____();
}
}
reg8 WaveformGenerator::readOSC() {
return output() >> 4;
}
sid.ii
------
typedef unsigned int reg8;
typedef unsigned int reg12;
typedef int sound_sample;
class WaveformGenerator {
public:
reg8 readOSC();
inline reg12 output();
reg8 waveform;
reg12 output____();
};
inline reg12 WaveformGenerator::output() {
switch (waveform) {
case 0x0:
return output____();
}
}
class Voice {
inline sound_sample output();
WaveformGenerator wave;
friend class SID;
};
inline sound_sample Voice::output() {
return wave.output();
};
class Filter {
public:
void clock(sound_sample voice1, sound_sample voice2, sound_sample voice3);
};
class SID {
void clock();
Voice voice[3];
Filter filter;
};
void SID::clock() {
filter.clock(voice[0].output(), voice[1].output(), voice[2].output());
}
rguenther@murzim:/tmp> g++-4.5 -r -nostdlib -O2 -march=pentium4 -flto
-fuse-linker-plugin -m32 sid.3.ii wave.3.ii
/usr/bin/gold: error: /tmp/ccbAKTWf.lto.o: incompatible target
collect2: ld returned 1 exit status
rguenther@murzim:/tmp> g++-4.5 -r -nostdlib -O2 -march=pentium4 -flto
-fuse-linker-plugin -m32 wave.3.ii sid.3.ii
lto1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugs.opensuse.org/> for instructions.
lto-wrapper: g++-4.5 returned 1 exit status
/usr/bin/gold: fatal error: lto-wrapper failed
collect2: ld returned 1 exit status
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
Ever Confirmed|0 |1
Keywords| |lto
Last reconfirmed|0000-00-00 00:00:00 |2010-07-01 11:35:19
date| |
Summary|LTO segfault |LTO segfault with -fuse-
| |linker-plugin
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44724
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/44724] LTO segfault with -fuse-linker-plugin
2010-06-30 12:23 [Bug lto/44724] New: LTO segfault moonshine at kapsi dot fi
` (4 preceding siblings ...)
2010-07-01 11:35 ` [Bug lto/44724] LTO segfault with -fuse-linker-plugin rguenth at gcc dot gnu dot org
@ 2010-07-01 11:41 ` rguenth at gcc dot gnu dot org
2010-07-06 12:57 ` moonshine at kapsi dot fi
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-07-01 11:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from rguenth at gcc dot gnu dot org 2010-07-01 11:40 -------
On trunk with the original testcase we fail with
/abuild/rguenther/trunk-g/gcc> ./xgcc -B. -r -nostdlib -O -march=pentium4 -flto
-fuse-linker-plugin sid.ii wave.ii -m32 -B ../lto-plugin/.libs
lto1: out of memory allocating 8589934596 bytes after a total of 520192 bytes
lto-wrapper: ./xgcc returned 1 exit status
/usr/bin/gold: fatal error: lto-wrapper failed
collect2: ld returned 1 exit status
#4 0x00000000007bd6e1 in input_cgraph_1 (file_data=0x7ffff7ee2300,
ib=0x166a340) at /space/rguenther/src/svn/trunk/gcc/lto-cgraph.c:1257
1257 char *str = (char *)xmalloc (len + 1);
(gdb) l
1252
1253 /* Input toplevel asms. */
1254 len = lto_input_uleb128 (ib);
1255 while (len)
1256 {
1257 char *str = (char *)xmalloc (len + 1);
1258 for (i = 0; i < len; ++i)
1259 str[i] = lto_input_1_unsigned (ib);
1260 cgraph_add_asm_node (build_string (len, str));
1261 free (str);
(gdb) p len
$1 = 8589934595
so somehow the output cgraph is corrupt. Works fine without using the
linker-plugin on trunk, too.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44724
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/44724] LTO segfault with -fuse-linker-plugin
2010-06-30 12:23 [Bug lto/44724] New: LTO segfault moonshine at kapsi dot fi
` (5 preceding siblings ...)
2010-07-01 11:41 ` rguenth at gcc dot gnu dot org
@ 2010-07-06 12:57 ` moonshine at kapsi dot fi
6 siblings, 0 replies; 8+ messages in thread
From: moonshine at kapsi dot fi @ 2010-07-06 12:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from moonshine at kapsi dot fi 2010-07-06 12:57 -------
This issue is now fixed in trunk. I have no obligation to push it for 4.5
series as I am now able to build whole VICE successfully with 4.6 so I am
closing the ticket.
--
moonshine at kapsi dot fi changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WORKSFORME
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44724
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-07-06 12:57 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-30 12:23 [Bug lto/44724] New: LTO segfault moonshine at kapsi dot fi
2010-06-30 12:28 ` [Bug lto/44724] " moonshine at kapsi dot fi
2010-06-30 13:00 ` rguenth at gcc dot gnu dot org
2010-07-01 10:47 ` moonshine at kapsi dot fi
2010-07-01 11:18 ` moonshine at kapsi dot fi
2010-07-01 11:35 ` [Bug lto/44724] LTO segfault with -fuse-linker-plugin rguenth at gcc dot gnu dot org
2010-07-01 11:41 ` rguenth at gcc dot gnu dot org
2010-07-06 12:57 ` moonshine at kapsi dot fi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).