Bug 184053

Summary: internal compiler error: Segmentation fault
Product: [Fedora] Fedora Reporter: Mario Torre <neugens>
Component: gcc4Assignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-05-12 09:21:21 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Preprocessed file that cause the compiler error
none
Whole, preprocessed, package that cause the compiler error none

Description Mario Torre 2006-03-05 16:05:22 UTC
Description of problem:

I got an internal compiler error (segmentation fault) while trying to compile
e-uae (an amiga emulator based on uae) on fedora core 4, using gcc 4 (system
completely updated with all updates from errata).

The program compiles and run without problems with gcc32.

The error shown is this:

rm -f libcaps.a
ar cru libcaps.a caps.o
ranlib libcaps.a
make[3]: Leaving directory `/home/neugens/rpmbuild/BUILD/e-uae-0.8.28/src/caps'
make[3]: Entering directory `/home/neugens/rpmbuild/BUILD/e-uae-0.8.28/src'
gcc -I../src/include -I../src -I../src -I.. -c -I/usr/include  -DFPUEMU
-DCPUEMU_0 -DCPUEMU_5 -DCPUEMU_6 -DUNALIGNED_PROFITABLE -DJIT
-DNATMEM_OFFSET=0x50000000 -DAGA -DAUTOCONFIG -DFILESYS -DBSDSOCKET
-DSUPPORT_THREADS -DCAPS -DFDI2RAW -DENFORCER -DACTION_REPLAY  -I/usr/include
-I/usr/include/SDL -D_REENTRANT -DUSE_SDL -O2 -g -march=i386 -mcpu=i686
-Wa,--execstack  -O2 -fomit-frame-pointer   -Wall -Wno-unused -Wno-format -W
-Wmissing-prototypes -Wstrict-prototypes -fno-strength-reduce
-DREGPARAM="__attribute__((regparm(3)))" -O2 -g -march=i386 -mcpu=i686
-DNO_MAIN_IN_MAIN_C -I/usr/include/SDL -D_REENTRANT     cpuemu_0.c -o cpuemu_0.o
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
gcc -I../src/include -I../src -I../src -I.. -c -I/usr/include  -DFPUEMU
-DCPUEMU_0 -DCPUEMU_5 -DCPUEMU_6 -DUNALIGNED_PROFITABLE -DJIT
-DNATMEM_OFFSET=0x50000000 -DAGA -DAUTOCONFIG -DFILESYS -DBSDSOCKET
-DSUPPORT_THREADS -DCAPS -DFDI2RAW -DENFORCER -DACTION_REPLAY  -I/usr/include
-I/usr/include/SDL -D_REENTRANT -DUSE_SDL -O2 -g -march=i386 -mcpu=i686
-Wa,--execstack  -O2 -fomit-frame-pointer   -Wall -Wno-unused -Wno-format -W
-Wmissing-prototypes -Wstrict-prototypes -fno-strength-reduce
-DREGPARAM="__attribute__((regparm(3)))" -O2 -g -march=i386 -mcpu=i686
-DNO_MAIN_IN_MAIN_C -I/usr/include/SDL -D_REENTRANT     cpuemu_5.c -o cpuemu_5.o
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
cpuemu_5.c: In function âop_0178_5_ffâ:
cpuemu_5.c:806: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla> for instructions.
The bug is not reproducible, so it is likely a hardware or OS problem.
make[3]: *** [cpuemu_5.o] Error 1
make[3]: Leaving directory `/home/neugens/rpmbuild/BUILD/e-uae-0.8.28/src'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/neugens/rpmbuild/BUILD/e-uae-0.8.28/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/neugens/rpmbuild/BUILD/e-uae-0.8.28/src'
make: *** [all-recursive] Error 1
error: Bad exit status from /home/neugens/rpmbuild/tmp/rpm-tmp.30154 (%build)



Version-Release number of selected component (if applicable):

output of rpm -q gcc:
gcc-4.0.2-8.fc4

output of gcc -v:
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --host=i386-redhat-linux
Thread model: posix
gcc version 4.0.2 20051125 (Red Hat 4.0.2-8)


How reproducible:

Always reproducible if compiled with gcc 4.0.2-8
I have compiled it only via rpmbuild.

Steps to Reproduce:
1. download and install libcapsimage-2.0.0-2.iss.src.rpm
2. download e-uae-0.8.28-1.iss.src.rpm
3. rpmbuild --rebuild libcapsimage-2.0.0-2.iss.src.rpm
  
all the packages can be found here:

http://packages.amiga-hardware.com/

Actual results:

cpuemu_5.c:806: internal compiler error: Segmentation fault

Expected results:

normal end of compilation, with package built.

Additional info:

The package is clearly developed with gcc32 in mind, infact there are lots of
warnings about deprecated compiler flags when compiled with gcc4.

Anyway, even programming errors in the emulator should not affect the gcc
compiler, and should not produce segmentation faults.

gcc complains about an hardware failure, I cannot confirm this as my pc is
surely pretty old, but this is the only problem I had. I tried a memtest but all
test passed.

I'm running an intel pentium III with 768 mega of memory:

[neugens@nirvana amiga]$ cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 8
model name      : Pentium III (Coppermine)
stepping        : 6
cpu MHz         : 933.180
cache size      : 256 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 mtrr pge mca cmov pat pse36
mmx fxsr sse
bogomips        : 1868.37

e-uae optimize itself for i686 when compiling.

Comment 1 Jakub Jelinek 2006-03-07 08:46:52 UTC
GCC told you that the bug isn't reproduceable.  So, unless there is a bug
in the reproduceability detection (can you reproduce the problem when you rerun
the same gcc command line, always with the same errors?), you need to blame your
hardware.  If you really can reproduce it always on the same file same command
line options same errors, then we need a preprocessed source attached to this
bugreport.

Comment 2 Mario Torre 2006-03-07 13:05:27 UTC
Hi!

Yes, I have reproduced the same exact error, with the same command (rpmbuild -bb
e-uae-0.8.28.iss.spec) for at least 5 times, in the same location, but now I'm
unable to reproduce it anymore, so an hardware problem may be (sadly) possible.

Note that I have always compiled with rpmbuild -bb e-uae-0.8.28.iss.spec (gcc4)
to get the error, while CC=gcc32 rpmbuild -bb e-uae-0.8.28.iss.spec (gcc32) have
always succeded.

Now both commands are ok.

Note also that if I run "make" on the directory that was preprocessed when the
build failed I still have the same error (that is, I have no more errors on
clean builds).

Anyway, this should be the piece of code that actualy trigger the bug:

unsigned long REGPARAM2 CPUFUNC(op_0178_5)(uae_u32 opcode, struct regstruct *regs)
{
	uae_u32 srcreg = ((opcode >> 9) & 7);
{{	uae_s8 src = m68k_dreg (regs, srcreg);
{	uaecptr dsta = (uae_s32)(uae_s16)get_word_prefetch (regs, 4);
{	uae_s8 dst = get_byte (dsta);
	regs->ir = regs->irc;
	get_word_prefetch (regs, 6);
	src &= 7;
	dst ^= (1 << src);
	SET_ZFLG (&regs->ccrflags, ((uae_u32)dst & (1 << src)) >> src);
	put_byte (dsta,dst);
}}}}	m68k_incpc (regs, 4);
return 16 * 256;
}

I have attached the whole package (as left when the compilation fails) in bug_2.zip.
In bug_1.zip there is only the preprocessed file cpuemu_5.c and the caps
directory (also preprocessed),

Hope that helps

Comment 3 Mario Torre 2006-03-07 13:07:32 UTC
Created attachment 125750 [details]
Preprocessed file that cause the compiler error

This is only the file that trigger the error, see bug_2.tar.gz for whole
package

Comment 4 Mario Torre 2006-03-07 13:10:52 UTC
Created attachment 125751 [details]
Whole, preprocessed, package that cause the compiler error

Comment 5 Mario Torre 2006-03-07 13:24:25 UTC
I did another couple of tests:

1. make clean && make (in the directory from attachment 125751 [details]):

cpuemu_0.c: In function âop_21fb_3_ffâ:
cpuemu_0.c:28997: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla> for instructions.
The bug is not reproducible, so it is likely a hardware or OS problem.
make[3]: *** [cpuemu_0.o] Error 1
make[3]: Leaving directory
`/home/neugens/work_space/tmp/bug_2/e-uae-0.8.28_broken/src'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory
`/home/neugens/work_space/tmp/bug_2/e-uae-0.8.28_broken/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory
`/home/neugens/work_space/tmp/bug_2/e-uae-0.8.28_broken/src'
make: *** [all-recursive] Error 1

Same error, but different file and function (but still auto generated).

2. again rpmbuild --rebuild e-uae-0.8.28-1.iss.src.rpm

Guess what?

cpuemu_5.c: In function âop_013a_5_ffâ:
cpuemu_5.c:640: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla> for instructions.
The bug is not reproducible, so it is likely a hardware or OS problem.
make[3]: *** [cpuemu_5.o] Error 1
make[3]: Leaving directory `/home/neugens/rpmbuild/BUILD/e-uae-0.8.28/src'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/neugens/rpmbuild/BUILD/e-uae-0.8.28/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/neugens/rpmbuild/BUILD/e-uae-0.8.28/src'
make: *** [all-recursive] Error 1
error: Bad exit status from /home/neugens/rpmbuild/tmp/rpm-tmp.50661 (%build)

Again, the location of the error has changed, but the error is still of the same
type.

I really don't know what is happening there.

I wonder if I need a better computer...

Comment 6 Jakub Jelinek 2006-05-12 09:21:21 UTC
Clear sign of flakey hardware.