Bug 52411 - BUG gcc 4.6.2 Illegal Instruction (core dumped) asterisk
Summary: BUG gcc 4.6.2 Illegal Instruction (core dumped) asterisk
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.6.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 52410 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-02-28 08:36 UTC by evrinoma
Modified: 2012-03-02 11:17 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-02-28 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description evrinoma 2012-02-28 08:36:54 UTC
hello 

i found some bug gcc 4.6.2 when i build asterisk 1.8 

All started when i want build ipsec-0.8.0 
http://sourceforge.net/projects/ipsec-tools/files/ipsec-tools/0.8.0/

I had a simple linux PC with installed OS Linux CentOS 6.2 
CentOS 6.2 have a rpm installed gcc version 4.4.6-3 
with configure parameters 
--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux 

when i try build this program i have a some errors. Solving this errors i replaced gcc version more then 4.4. 
I download version 4.6.2 

and build gcc 4.6.2 in native mode with configure parameters like this 
--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux 

and like this 
--disable-cloog-version-check --enable-cloog-backend=isl --enable-lto --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++ --disable-dssi --enable-libgcj-multifile --without-ppl --without-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux 

i install gcc 4.6.2 (with cloog and ppl) i successful build ipsec 0.8.0. The program ipsec successful work. 

After that i tried build asterisk version 1.8.9.2 
The program successful build but when program start is crush with next error 
--- SIGILL (Illegal instruction) @ 0 (0) --- 
+++ killed by SIGILL (core dumped) +++ 
Illegal Instruction (core dumped) 

after that i install gcc 4.6.2 (without cloog and ppl) and rebuild asterisk version 1.8.9.2 
The program successful build but when program start is crush with next error 
--- SIGILL (Illegal instruction) @ 0 (0) --- 
+++ killed by SIGILL (core dumped) +++ 
Illegal Instruction (core dumped) 

i tried rebuild gcc with any configure parameters, but asterisk does not start 

okey i get oldest version gcc 4.5.3 and build him with next parameters 
--disable-cloog-version-check --enable-cloog-backend=isl --enable-lto --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++ --disable-dssi --enable-libgcj-multifile --without-ppl --without-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux 

after that i install gcc  version 4.5.3 (without cloog and ppl) and rebuild asterisk version 1.8.9.2 
The program successful build and program successful start without any errors 

after that i rebuild ipsec 0.8.0. The program ipsec successful work.
Comment 1 Jonathan Wakely 2012-02-28 09:39:21 UTC
*** Bug 52410 has been marked as a duplicate of this bug. ***
Comment 2 Richard Biener 2012-02-28 12:57:30 UTC
Please look at what the illegal instruction is and make sure your CPU has
all features required by your compile.  Also nobody is going to download
tarballs, so you need to provide us with a testcase.
Comment 3 evrinoma 2012-02-28 13:07:14 UTC
gcc-4.7-20120225/configure 

--disable-cloog-version-check --enable-cloog-backend=isl --enable-lto
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --with-system-zlib
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object
--enable-languages=c,c++,objc,obj-c++ --disable-dssi --enable-libgcj-multifile
--without-ppl --without-cloog --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux


posix
gcc 4.7.0 20120225 (experimental) (GCC)


similar problem
Comment 4 evrinoma 2012-02-28 13:38:29 UTC
(gdb) r -vvvc
Starting program: /home/nikolns/bld/aster/gcc-4.7/asterisk-1.8.9.2/main/asterisk -vvvc
[Thread debugging using libthread_db enabled]
[New Thread 0x7ffff7fd9700 (LWP 15132)]

Program received signal SIGILL, Illegal instruction.
0x000000000053e80f in tzload (name=<value optimized out>, sp=0x82bd40, doextend=1) at stdtime/localtime.c:657
657     static int tzload(const char *name, struct state * const sp, const int doextend)
Comment 5 evrinoma 2012-02-28 13:45:16 UTC
cat /proc/cpuinfo 
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 4
model name      : Intel(R) Celeron(R) CPU 3.06GHz
stepping        : 9
cpu MHz         : 3066.590
cache size      : 256 KB
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc up pebs bts pni dtes64 monitor ds_cpl tm2 cid cx16 xtpr lahf_lm
bogomips        : 6118.58
clflush size    : 64
cache_alignment : 128
address sizes   : 36 bits physical, 48 bits virtual
power management:

uname -a
Linux IT0917 2.6.32-220.4.2.el6.x86_64 #1 SMP Tue Feb 14 04:00:16 GMT 2012 x86_64 x86_64 x86_64 GNU/Linux

free
             total       used       free     shared    buffers     cached
Mem:       2044416    1971600      72816          0      60636    1615176
-/+ buffers/cache:     295788    1748628
Swap:      2000052          0    2000052
Comment 6 Richard Biener 2012-02-28 14:41:29 UTC
(In reply to comment #4)
> (gdb) r -vvvc
> Starting program:
> /home/nikolns/bld/aster/gcc-4.7/asterisk-1.8.9.2/main/asterisk -vvvc
> [Thread debugging using libthread_db enabled]
> [New Thread 0x7ffff7fd9700 (LWP 15132)]
> 
> Program received signal SIGILL, Illegal instruction.
> 0x000000000053e80f in tzload (name=<value optimized out>, sp=0x82bd40,
> doextend=1) at stdtime/localtime.c:657
> 657     static int tzload(const char *name, struct state * const sp, const int
> doextend)

That does not show the instuction.  Do

(gdb) disassemble 0x000000000053e800,+32

(assuming the crash is still at 0x000000000053e80f when you re-try)
Comment 7 evrinoma 2012-02-29 12:53:01 UTC
gdb) disassemble 0x000000000053e800,+32
Dump of assembler code from 0x53e800 to 0x53e820:
   0x000000000053e800 <tzload+3040>:    movdqu -0x40(%rcx),%xmm0
   0x000000000053e805 <tzload+3045>:    prefetcht0 0x190(%rcx)
   0x000000000053e80c <tzload+3052>:    mov    %rcx,%r10
=> 0x000000000053e80f <tzload+3055>:    prefetchw 0x1d0(%rdi)
   0x000000000053e816 <tzload+3062>:    add    $0x4,%esi
   0x000000000053e819 <tzload+3065>:    movaps %xmm0,(%rdi)
   0x000000000053e81c <tzload+3068>:    movdqu -0x30(%rcx),%xmm0
End of assembler dump.
(gdb)
Comment 8 Mikael Pettersson 2012-02-29 13:18:52 UTC
(In reply to comment #7)
> gdb) disassemble 0x000000000053e800,+32
> Dump of assembler code from 0x53e800 to 0x53e820:
>    0x000000000053e800 <tzload+3040>:    movdqu -0x40(%rcx),%xmm0
>    0x000000000053e805 <tzload+3045>:    prefetcht0 0x190(%rcx)
>    0x000000000053e80c <tzload+3052>:    mov    %rcx,%r10
> => 0x000000000053e80f <tzload+3055>:    prefetchw 0x1d0(%rdi)
>    0x000000000053e816 <tzload+3062>:    add    $0x4,%esi
>    0x000000000053e819 <tzload+3065>:    movaps %xmm0,(%rdi)
>    0x000000000053e81c <tzload+3068>:    movdqu -0x30(%rcx),%xmm0
> End of assembler dump.
> (gdb)

prefetchw is an AMD 3dnow! instruction, I'm not surprised it SIGILLs on your Intel Netburst/P4 based machine.

Please ensure you're not using any compilation flags that imply the presence of an AMD processor.
Comment 9 evrinoma 2012-02-29 13:33:36 UTC
okey

i tried build astrisk on OpenSuse 12.1
with gcc

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/4.6/lto-wrapper
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.6 --enable-ssp --disable-libssp --disable-plugin --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --disable-libgcj --disable-libmudflap --with-slibdir=/lib64 --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --program-suffix=-4.6 --enable-linux-futex --without-system-libunwind --with-arch-32=i586 --with-tune=generic --build=x86_64-suse-linux
Thread model: posix
gcc version 4.6.2 (SUSE Linux) 

The program successful build and program successful start without any errors
Comment 10 evrinoma 2012-02-29 13:37:09 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > gdb) disassemble 0x000000000053e800,+32
> > Dump of assembler code from 0x53e800 to 0x53e820:
> >    0x000000000053e800 <tzload+3040>:    movdqu -0x40(%rcx),%xmm0
> >    0x000000000053e805 <tzload+3045>:    prefetcht0 0x190(%rcx)
> >    0x000000000053e80c <tzload+3052>:    mov    %rcx,%r10
> > => 0x000000000053e80f <tzload+3055>:    prefetchw 0x1d0(%rdi)
> >    0x000000000053e816 <tzload+3062>:    add    $0x4,%esi
> >    0x000000000053e819 <tzload+3065>:    movaps %xmm0,(%rdi)
> >    0x000000000053e81c <tzload+3068>:    movdqu -0x30(%rcx),%xmm0
> > End of assembler dump.
> > (gdb)
> 
> prefetchw is an AMD 3dnow! instruction, I'm not surprised it SIGILLs on your
> Intel Netburst/P4 based machine.
> 
> Please ensure you're not using any compilation flags that imply the presence of
> an AMD processor.

i saw this
I begin tracing asterisk code
Comment 11 evrinoma 2012-03-02 11:13:22 UTC
many thanks for help 

the asterisk makefile detecting and using incorrect compilation flags

ifeq ($(OSARCH),linux-gnu)
  ifeq ($(PROC),x86_64)
    # You must have GCC 3.4 to use k8, otherwise use athlon
#    PROC=k8
PROC=nocona
    #PROC=athlon
  endif

i changed parameter PROC on nocona 
The program successful build and program successful start without any errors
Comment 12 Jonathan Wakely 2012-03-02 11:17:59 UTC
not a gcc bug then