public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug bootstrap/49104] New: bootstrap failure on AMD K6-2 with illegal instruction (cmove) in stage2
@ 2011-05-21 18:00 rfo at gmx dot de
  2011-05-22 11:36 ` [Bug bootstrap/49104] " rfo at gmx dot de
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: rfo at gmx dot de @ 2011-05-21 18:00 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: bootstrap failure on AMD K6-2 with illegal instruction
                    (cmove) in stage2
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rfo@gmx.de


I get the error in 4.6.0 and 4.6-20110520. 4.5.3 is fine.

$ ../gcc-4.6-20110520/configure --prefix=/usr/pkg/gcc-4.6 \
--enable-languages=c --disable-nls --disable-multilib --disable-lto \
--enable-checking=release --with-system-zlib

$ make bootstrap
...
Configuring stage 2 in i586-pc-linux-gnu/libgcc
configure: creating cache ./config.cache
checking for --enable-version-specific-runtime-libs... no
checking for a BSD-compatible install... /usr/bin/install -c
checking for gawk... gawk
checking build system type... i586-pc-linux-gnu
checking host system type... i586-pc-linux-gnu
checking for i586-pc-linux-gnu-ar... ar
checking for i586-pc-linux-gnu-lipo... lipo
checking for i586-pc-linux-gnu-nm... /home/rf11/src/build1/./gcc/nm
checking for i586-pc-linux-gnu-ranlib... ranlib
checking for i586-pc-linux-gnu-strip... strip
checking whether ln -s works... yes
checking for i586-pc-linux-gnu-gcc... /home/rf11/src/build1/./gcc/xgcc
-B/home/rf11/src/build1/./gcc/ -B/usr/pkg/gcc-4.6/i586-pc-linux-gnu/bin/
-B/usr/pkg/gcc-4.6/i586-pc-linux-gnu/lib/ -isystem
/usr/pkg/gcc-4.6/i586-pc-linux-gnu/include -isystem
/usr/pkg/gcc-4.6/i586-pc-linux-gnu/sys-include
checking for suffix of object files... configure: error: in
`/home/rf11/src/build1/i586-pc-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[2]: *** [configure-stage2-target-libgcc] Error 1
make[2]: Leaving directory `/home/rf11/src/build1'
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory `/home/rf11/src/build1'
make: *** [bootstrap] Error 2

from ./i586-pc-linux-gnu/libgcc/config.log:
configure:3268: /home/rf11/src/build1/./gcc/xgcc -B/home/rf11/src/build1/./gcc/
-B/usr/pkg/gcc-4.6/i586-pc-linux-gnu/bin/
-B/usr/pkg/gcc-4.6/i586-pc-linux-gnu/lib/ -isystem
/usr/pkg/gcc-4.6/i586-pc-linux-gnu/include -isystem
/usr/pkg/gcc-4.6/i586-pc-linux-gnu/sys-include    -c -g -O2  conftest.c >&5
xgcc: internal compiler error: Illegal instruction (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
configure:3272: $? = 4
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Runtime Library"
| #define PACKAGE_TARNAME "libgcc"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU C Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libgcc/"
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:3286: error: in `/home/rf11/src/build1/i586-pc-linux-gnu/libgcc':
configure:3289: error: cannot compute suffix of object files: cannot compile


The illegal insn is at the end of init_vectorized_lexer() in cc1:

Program received signal SIGILL, Illegal instruction.
0x086f977c in init_vectorized_lexer ()
(gdb) disas init_vectorized_lexer
...
0x086f9745 <init_vectorized_lexer+101>: cpuid
0x086f9747 <init_vectorized_lexer+103>: test   %eax,%eax
0x086f9749 <init_vectorized_lexer+105>: je     0x86f96fa
<init_vectorized_lexer+26>
0x086f974b <init_vectorized_lexer+107>: mov    $0x1,%eax
0x086f9750 <init_vectorized_lexer+112>: mov    $0x86f65b0,%esi
0x086f9755 <init_vectorized_lexer+117>: cpuid  
0x086f9757 <init_vectorized_lexer+119>: and    $0x100000,%ecx
0x086f975d <init_vectorized_lexer+125>: jne    0x86f973a
<init_vectorized_lexer+90>
0x086f975f <init_vectorized_lexer+127>: mov    $0x86f6530,%esi
0x086f9764 <init_vectorized_lexer+132>: test   $0x4000000,%edx
0x086f976a <init_vectorized_lexer+138>: jne    0x86f973a
<init_vectorized_lexer+90>
0x086f976c <init_vectorized_lexer+140>: mov    $0x86f64c0,%esi
0x086f9771 <init_vectorized_lexer+145>: mov    $0x86f6060,%eax
0x086f9776 <init_vectorized_lexer+150>: and    $0x2000000,%edx
0x086f977c <init_vectorized_lexer+156>: cmove  %eax,%esi
0x086f977f <init_vectorized_lexer+159>: jmp    0x86f973a
<init_vectorized_lexer+90>

$ cat /proc/cpuinfo
processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 5
model           : 8
model name      : AMD-K6(tm) 3D processor
stepping        : 12
cpu MHz         : 400.922
cache size      : 64 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu vme de pse tsc msr cx8 pge mmx syscall 3dnow k6_mtrr
bogomips        : 801.84
clflush size    : 32
cache_alignment : 32
address sizes   : 32 bits physical, 32 bits virtual


  Reinhard


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug bootstrap/49104] bootstrap failure on AMD K6-2 with illegal instruction (cmove) in stage2
  2011-05-21 18:00 [Bug bootstrap/49104] New: bootstrap failure on AMD K6-2 with illegal instruction (cmove) in stage2 rfo at gmx dot de
@ 2011-05-22 11:36 ` rfo at gmx dot de
  2011-05-22 11:38 ` rfo at gmx dot de
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rfo at gmx dot de @ 2011-05-22 11:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Reinhard Foerster <rfo at gmx dot de> 2011-05-22 11:09:24 UTC ---
Created attachment 24324
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24324
preprocessed lex.c


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug bootstrap/49104] bootstrap failure on AMD K6-2 with illegal instruction (cmove) in stage2
  2011-05-21 18:00 [Bug bootstrap/49104] New: bootstrap failure on AMD K6-2 with illegal instruction (cmove) in stage2 rfo at gmx dot de
  2011-05-22 11:36 ` [Bug bootstrap/49104] " rfo at gmx dot de
@ 2011-05-22 11:38 ` rfo at gmx dot de
  2011-05-22 15:01 ` mikpe at it dot uu.se
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rfo at gmx dot de @ 2011-05-22 11:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Reinhard Foerster <rfo at gmx dot de> 2011-05-22 11:18:42 UTC ---
init_vectorized_lexer() is in libcpp/lex.c which is compiled in stage2 by:

/home/rf11/src/build1/./prev-gcc/xgcc -B/home/rf11/src/build1/./prev-gcc/
-B/usr/pkg/gcc-4.6/i586-pc-linux-gnu/bin/
-B/usr/pkg/gcc-4.6/i586-pc-linux-gnu/bin/
-B/usr/pkg/gcc-4.6/i586-pc-linux-gnu/lib/ -isystem
/usr/pkg/gcc-4.6/i586-pc-linux-gnu/include -isystem
/usr/pkg/gcc-4.6/i586-pc-linux-gnu/sys-include    
-I../../gcc-4.6-20110520/libcpp -I. -I../../gcc-4.6-20110520/libcpp/../include
-I../../gcc-4.6-20110520/libcpp/include  -g -O2 -fomit-frame-pointer -gtoggle
-W -Wall -Wwrite-strings -Wmissing-format-attribute -Wstrict-prototypes
-Wmissing-prototypes -Wold-style-definition -Wc++-compat -pedantic
-Wno-long-long  -I../../gcc-4.6-20110520/libcpp -I.
-I../../gcc-4.6-20110520/libcpp/../include
-I../../gcc-4.6-20110520/libcpp/include  -c -o lex.o -MT lex.o -MMD -MP -MF
.deps/lex.Tpo ../../gcc-4.6-20110520/libcpp/lex.c

Adding "-Q --help=target|grep arch" to the command i get "-march=pentium".
Seems to be ok on my i586-linux target. The compiler should not generate cmov*
instructions. I get 14 cmov* in the whole file.

Adding -march=i386 or -march=i486 doesn't help. Without -O2 most but not
all (13 of 14) cmov* go away.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug bootstrap/49104] bootstrap failure on AMD K6-2 with illegal instruction (cmove) in stage2
  2011-05-21 18:00 [Bug bootstrap/49104] New: bootstrap failure on AMD K6-2 with illegal instruction (cmove) in stage2 rfo at gmx dot de
  2011-05-22 11:36 ` [Bug bootstrap/49104] " rfo at gmx dot de
  2011-05-22 11:38 ` rfo at gmx dot de
@ 2011-05-22 15:01 ` mikpe at it dot uu.se
  2011-05-22 18:44 ` ubizjak at gmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mikpe at it dot uu.se @ 2011-05-22 15:01 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Pettersson <mikpe at it dot uu.se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikpe at it dot uu.se

--- Comment #3 from Mikael Pettersson <mikpe at it dot uu.se> 2011-05-22 14:25:51 UTC ---
I believe this is a dupe of PR48743.  Please check if the second proposed patch
for PR48743 solves your problem.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug bootstrap/49104] bootstrap failure on AMD K6-2 with illegal instruction (cmove) in stage2
  2011-05-21 18:00 [Bug bootstrap/49104] New: bootstrap failure on AMD K6-2 with illegal instruction (cmove) in stage2 rfo at gmx dot de
                   ` (2 preceding siblings ...)
  2011-05-22 15:01 ` mikpe at it dot uu.se
@ 2011-05-22 18:44 ` ubizjak at gmail dot com
  2011-05-22 19:14 ` uros at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ubizjak at gmail dot com @ 2011-05-22 18:44 UTC (permalink / raw)
  To: gcc-bugs

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

Uros Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011.05.22 18:04:30
   Target Milestone|---                         |4.6.1
     Ever Confirmed|0                           |1

--- Comment #4 from Uros Bizjak <ubizjak at gmail dot com> 2011-05-22 18:04:30 UTC ---
No, the problem is in search_line_mmx (lex.c), compiled with SSE option.  This
option also enables CMOVE instruction, so we have protect usage of
search_line_mmx with following patch:

--cut here--
Index: libcpp/lex.c
===================================================================
--- libcpp/lex.c    (revision 174030)
+++ libcpp/lex.c    (working copy)
@@ -480,7 +480,7 @@
 static void __attribute__((constructor))
 init_vectorized_lexer (void)
 {
-  unsigned dummy, ecx = 0, edx = 0;
+  unsigned dummy, ecx = 0, edx = 0, edx_e = 0;
   search_line_fast_type impl = search_line_acc_char;
   int minimum = 0;

@@ -488,7 +488,7 @@
   minimum = 3;
 #elif defined(__SSE2__)
   minimum = 2;
-#elif defined(__SSE__) || defined(__3dNOW_A__)
+#elif defined(__SSE__)
   minimum = 1;
 #endif

@@ -503,9 +503,9 @@
       else if (minimum == 1 || (edx & bit_SSE))
     impl = search_line_mmx;
     }
-  else if (__get_cpuid (0x80000001, &dummy, &dummy, &dummy, &edx))
+  else if (__get_cpuid (0x80000001, &dummy, &dummy, &dummy, &edx_e))
     {
-      if (minimum == 1 || edx & bit_3DNOWP)
+      if (minimum == 1 || (edx_e & bit_3DNOWP && edx & bit_CMOV))
     impl = search_line_mmx;
     }

--cut here--

Reinhard, can you please test the above patch?


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug bootstrap/49104] bootstrap failure on AMD K6-2 with illegal instruction (cmove) in stage2
  2011-05-21 18:00 [Bug bootstrap/49104] New: bootstrap failure on AMD K6-2 with illegal instruction (cmove) in stage2 rfo at gmx dot de
                   ` (3 preceding siblings ...)
  2011-05-22 18:44 ` ubizjak at gmail dot com
@ 2011-05-22 19:14 ` uros at gcc dot gnu.org
  2011-05-22 19:17 ` ubizjak at gmail dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: uros at gcc dot gnu.org @ 2011-05-22 19:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from uros at gcc dot gnu.org 2011-05-22 18:53:35 UTC ---
Author: uros
Date: Sun May 22 18:53:32 2011
New Revision: 174032

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174032
Log:
    PR target/49104
    * config/i386/cpuid.h (bit_MMXEXT): New define.

libcpp/ChangeLog:

2011-05-22  Uros Bizjak  <ubizjak@gmail.com>

    PR target/49104
    * lex.c (init_vectorized_lexer): Do not set "minimum" when __3dNOW_A__
    is defined.  Check bit_MMXEXT and bit_CMOV to use search_line_mmx.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/cpuid.h
    trunk/libcpp/ChangeLog
    trunk/libcpp/lex.c


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug bootstrap/49104] bootstrap failure on AMD K6-2 with illegal instruction (cmove) in stage2
  2011-05-21 18:00 [Bug bootstrap/49104] New: bootstrap failure on AMD K6-2 with illegal instruction (cmove) in stage2 rfo at gmx dot de
                   ` (4 preceding siblings ...)
  2011-05-22 19:14 ` uros at gcc dot gnu.org
@ 2011-05-22 19:17 ` ubizjak at gmail dot com
  2011-05-22 19:44 ` uros at gcc dot gnu.org
  2011-05-22 20:05 ` ubizjak at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: ubizjak at gmail dot com @ 2011-05-22 19:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Uros Bizjak <ubizjak at gmail dot com> 2011-05-22 18:45:30 UTC ---
Actually, PMOVMSKB belongs to "AMD extensions to MMX" instruction set, so we
should check MMXEXT bit (see PR 48743).

bit_CMOVE can be also checked in %edx as returned from 0x8000 0001 function.

Index: libcpp/lex.c
===================================================================
--- libcpp/lex.c    (revision 174030)
+++ libcpp/lex.c    (working copy)
@@ -488,7 +488,7 @@
   minimum = 3;
 #elif defined(__SSE2__)
   minimum = 2;
-#elif defined(__SSE__) || defined(__3dNOW_A__)
+#elif defined(__SSE__)
   minimum = 1;
 #endif

@@ -505,7 +505,7 @@
     }
   else if (__get_cpuid (0x80000001, &dummy, &dummy, &dummy, &edx))
     {
-      if (minimum == 1 || edx & bit_3DNOWP)
+      if (minimum == 1 || (edx & (bit_MMXEXT | bit_CMOV)))
     impl = search_line_mmx;
     }


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug bootstrap/49104] bootstrap failure on AMD K6-2 with illegal instruction (cmove) in stage2
  2011-05-21 18:00 [Bug bootstrap/49104] New: bootstrap failure on AMD K6-2 with illegal instruction (cmove) in stage2 rfo at gmx dot de
                   ` (5 preceding siblings ...)
  2011-05-22 19:17 ` ubizjak at gmail dot com
@ 2011-05-22 19:44 ` uros at gcc dot gnu.org
  2011-05-22 20:05 ` ubizjak at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: uros at gcc dot gnu.org @ 2011-05-22 19:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from uros at gcc dot gnu.org 2011-05-22 19:14:54 UTC ---
Author: uros
Date: Sun May 22 19:14:50 2011
New Revision: 174038

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174038
Log:
    PR target/49104
    * config/i386/cpuid.h (bit_MMXEXT): New define.

libcpp/ChangeLog:

2011-05-22  Uros Bizjak  <ubizjak@gmail.com>

    PR target/49104
    * lex.c (init_vectorized_lexer): Do not set "minimum" when __3dNOW_A__
    is defined.  Check bit_MMXEXT and bit_CMOV to use search_line_mmx.


Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/config/i386/cpuid.h
    branches/gcc-4_6-branch/libcpp/ChangeLog
    branches/gcc-4_6-branch/libcpp/lex.c


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug bootstrap/49104] bootstrap failure on AMD K6-2 with illegal instruction (cmove) in stage2
  2011-05-21 18:00 [Bug bootstrap/49104] New: bootstrap failure on AMD K6-2 with illegal instruction (cmove) in stage2 rfo at gmx dot de
                   ` (6 preceding siblings ...)
  2011-05-22 19:44 ` uros at gcc dot gnu.org
@ 2011-05-22 20:05 ` ubizjak at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: ubizjak at gmail dot com @ 2011-05-22 20:05 UTC (permalink / raw)
  To: gcc-bugs

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

Uros Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                URL|                            |http://gcc.gnu.org/ml/gcc-p
                   |                            |atches/2011-05/msg01561.htm
                   |                            |l
         Resolution|                            |FIXED

--- Comment #8 from Uros Bizjak <ubizjak at gmail dot com> 2011-05-22 19:19:13 UTC ---
Fixed. (The compare in the patch in comment #5 was also fixed ;) )


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-05-22 20:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-21 18:00 [Bug bootstrap/49104] New: bootstrap failure on AMD K6-2 with illegal instruction (cmove) in stage2 rfo at gmx dot de
2011-05-22 11:36 ` [Bug bootstrap/49104] " rfo at gmx dot de
2011-05-22 11:38 ` rfo at gmx dot de
2011-05-22 15:01 ` mikpe at it dot uu.se
2011-05-22 18:44 ` ubizjak at gmail dot com
2011-05-22 19:14 ` uros at gcc dot gnu.org
2011-05-22 19:17 ` ubizjak at gmail dot com
2011-05-22 19:44 ` uros at gcc dot gnu.org
2011-05-22 20:05 ` ubizjak at gmail dot com

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).