Bug 8994 - [3.2 regression] ICE with -O -march=pentium4
[3.2 regression] ICE with -O -march=pentium4
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: rtl-optimization
3.2.2
: P3 normal
: ---
Assigned To: Not yet assigned to anyone
: ice-on-valid-code
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2002-12-18 11:46 UTC by towa8667
Modified: 2003-07-25 17:33 UTC (History)
7 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description towa8667 2002-12-18 11:46:00 UTC
This is causing problems when compiling mozilla's javascript-source (see bugzilla.mozilla.org 172618) with -O -march=pentium4, note that this is not a dup of 7630.


gcc -Wall -save-temps -O -march=pentium4 -o A -c A.c
A.c: In function `js_dtoa':
A.c:12: warning: deprecated use of label at end of compound statement
A.c:12: unable to find a register to spill in class `AREG'
A.c:12: this is the insn:
(insn 26 25 27 (set (reg:CCNO 17 flags)
        (compare:CCNO (and:SI (subreg:SI (reg/v:DI 21 rxmm0 [59]) 0)
                (const_int 1 [0x1]))
            (const_int 0 [0x0]))) 281 {testsi_1} (insn_list 22 (nil))
    (expr_list:REG_DEAD (reg/v:DI 21 rxmm0 [59])
        (nil)))
A.c:12: confused by earlier errors, bailing out


# 1 "A.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "A.c"
typedef union {
  double value;
  int lsw;
} astr;

void js_dtoa(double d)
{
  while(1)
    if (( { astr sh_u; sh_u.value = d; sh_u.lsw; }) & 1)
      goto ret;
ret:
}

Release:
gcc version 3.2.2 20021218 (prerelease)

Environment:
Mandrake 9.0 x86
binutils 2.13.90.0.10
Configured with: ../gcc/configure --prefix=/usr/local/gcc-3_2-branch --enable-languages=c

How-To-Repeat:
gcc -O -march=pentium4 -o A -c A.c
Comment 1 towa8667 2002-12-18 11:46:00 UTC
Fix:
Change -march=pentium4 to something else
Comment 2 Wolfgang Bangerth 2002-12-18 12:23:22 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed. It's a regression: it works in 3.0.4, but fails
    with 3.2 and 3.3. It should not ICE, but it is worth
    mentioning that it prints this:
      x.c:12: warning: deprecated use of label at end of compound statement
Comment 3 Wolfgang Bangerth 2002-12-18 14:34:40 UTC
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: gcc-gnats@gcc.gnu.org
Cc: Janis Johnson <janis187@us.ibm.com>
Subject: Re: optimization/8994
Date: Wed, 18 Dec 2002 14:34:40 -0600 (CST)

 This regression was introduced sometimes between
   2001-12-10
 and
   2001-12-15
 
 W.
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth              email:           bangerth@ticam.utexas.edu
                                www: http://www.ticam.utexas.edu/~bangerth
 
 

Comment 4 Wolfgang Bangerth 2002-12-18 14:46:29 UTC
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: Torbjorn Wassberg <Torbjorn.Wassberg.8667@student.uu.se>
Cc: bangerth@dealii.org, <gcc-gnats@gcc.gnu.org>
Subject: Re: optimization/8994: [3.2/3.3 regression] ICE with -O -march=pentium4
Date: Wed, 18 Dec 2002 14:46:29 -0600 (CST)

 > >       x.c:12: warning: deprecated use of label at end of compound statement
 > > 
 
 > It should not matter as the original source (~3000 lines) doesn't have this problem.
 
 I may be blind, but if I remember right then a compound statement is a 
 ({...}) thing, of which there is exactly one, and it does not have a label 
 at its end. However, this warning is given by all gcc versions I checked.
 
 W.
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth              email:           bangerth@ticam.utexas.edu
                                www: http://www.ticam.utexas.edu/~bangerth
 
 

Comment 5 Wolfgang Bangerth 2002-12-18 15:08:46 UTC
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: "Joseph S. Myers" <jsm28@cam.ac.uk>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: optimization/8994: [3.2/3.3 regression] ICE with -O -march=pentium4
Date: Wed, 18 Dec 2002 15:08:46 -0600 (CST)

 On Wed, 18 Dec 2002, Joseph S. Myers wrote:
 
 > On 18 Dec 2002, Wolfgang Bangerth wrote:
 > 
 > >  I may be blind, but if I remember right then a compound statement is a 
 > >  ({...}) thing, of which there is exactly one, and it does not have a label 
 > >  at its end. However, this warning is given by all gcc versions I checked.
 > 
 > No, that's a statement expression, which contains a compound statement.  
 > A compound statement is simply { ...  }.
 
 Oh, sorry, then I was confused. Still, the testcase is
 ----------------------------
 typedef union {
   double value;
   int lsw;
 } astr;
 
 void js_dtoa(double d)
 {
   while(1)
     if (( { astr sh_u; sh_u.value = d; sh_u.lsw; }) & 1)
       goto ret;
 ret:
 }
 ---------------------------
 
 Why is it warning about this:
 
 tmp/regression/test/PR8994.c: In function `js_dtoa':
 tmp/regression/test/PR8994.c:12: warning: deprecated use of label at end 
                                  of compound statement
 
 The compound statement is then actually the function body, and this seems 
 like a pretty common technique. Also, saying deprecated means that it is 
 either deprecated by the standard, or it is illegal but accepted by gcc as 
 an extension. It is the latter, right, since a label must be followed by 
 another statement, and be it only ";".
 
 W.
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth              email:           bangerth@ticam.utexas.edu
                                www: http://www.ticam.utexas.edu/~bangerth
 
 

Comment 6 janis187 2002-12-18 16:29:57 UTC
From: Janis Johnson <janis187@us.ibm.com>
To: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, towa8667@student.uu.se,
   gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org
Cc:  
Subject: Re: optimization/8994: [3.2/3.3 regression] ICE with -O -march=pentium4
Date: Wed, 18 Dec 2002 16:29:57 -0800

 The regression reported in PR optimization/8994 showed up
 starting with this patch:
 
 Thu Dec 13 12:31:07 CET 2001  Jan Hubicka  <jh@suse.cz>
 
         * i386.c (override_options): Recognize various CPU variants and
 set
         SSE/MMX/3dNOW flags accordingly.
         * i386.h (MASK_MMX_SET, MASK_SSE_SET, MASK_SSE2_SET,
 MASK_3DNOW_SET,
         MASK_3DNOW_A_SET): New.
         (MASK_ACCUMULATE_OUTGOING_ARGS_SET): New.
         (MASK_NO_ACCUMULATE_OUTGOING_ARGS): Delete.
         (MASK_*): Renumber.
         (TARGET_FLAGS): Use new masks.
         (CPP_CPU_SPECS): Recognize new CPU variants.
         * invoke.texi (-mcpu): Update documentation.
 
 In the ChangeLog and cvs logs, this in included with
 several other files whose changes seem to be separate.
 If I build cc1 just before this patch was added, the test
 compiles cleanly, but when the files i386.c and i386.h are
 updated it gets the same ICE as the mainline.
 
 I used Wolfgang's new test case:
 
 ---------------------
 void foo (double d)
 {
   union { double d; int i; } u;
 
   while (1)
   {
     u.d = d;
     if (u.i & 1) return;
   }
 }
 ---------------------
 
 Here's the compiler output when compiled with
 "-O -march=pentium4" on i686-linux with the mainline
 or the 3.2 branch:
 
 8994.c: In function `foo':
 8994.c:10: error: unable to find a register to spill in class `AREG'
 8994.c:10: error: this is the insn:
 (insn 19 18 20 1 0x2abbc2c0 (set (reg:CCNO 17 flags)
         (compare:CCNO (and:SI (subreg:SI (reg/v:DI 21 rxmm0 [59]) 0)
                 (const_int 1 [0x1]))
             (const_int 0 [0x0]))) 199 {testsi_1} (insn_list 16 (nil))
     (expr_list:REG_DEAD (reg/v:DI 21 rxmm0 [59])
         (nil)))
 8994.c:10: internal compiler error: in spill_failure, at reload1.c:1922
 Please submit a full bug report,
 with preprocessed source if appropriate.
 See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8994
 
 
 
Comment 7 Joseph S. Myers 2002-12-18 21:01:02 UTC
From: "Joseph S. Myers" <jsm28@cam.ac.uk>
To: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
Cc: <gcc-gnats@gcc.gnu.org>
Subject: Re: optimization/8994: [3.2/3.3 regression] ICE with -O -march=pentium4
Date: Wed, 18 Dec 2002 21:01:02 +0000 (GMT)

 On 18 Dec 2002, Wolfgang Bangerth wrote:
 
 >  I may be blind, but if I remember right then a compound statement is a 
 >  ({...}) thing, of which there is exactly one, and it does not have a label 
 >  at its end. However, this warning is given by all gcc versions I checked.
 
 No, that's a statement expression, which contains a compound statement.  
 A compound statement is simply { ...  }.
 
 -- 
 Joseph S. Myers
 jsm28@cam.ac.uk
 

Comment 8 torbjorn.wassberg.8667 2002-12-18 21:37:57 UTC
From: Torbjorn Wassberg <Torbjorn.Wassberg.8667@student.uu.se>
To: bangerth@dealii.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
	nobody@gcc.gnu.org, torbjorn.wassberg.8667@student.uu.se,
	gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: optimization/8994: [3.2/3.3 regression] ICE with -O -march=pentium4
Date: Wed, 18 Dec 2002 21:37:57 +0100 (CET)

 Quoting bangerth@dealii.org:
 
 > Old Synopsis: ICE with -O -march=pentium4
 > New Synopsis: [3.2/3.3 regression] ICE with -O -march=pentium4
 > 
 > State-Changed-From-To: open->analyzed
 > State-Changed-By: bangerth
 > State-Changed-When: Wed Dec 18 12:23:22 2002
 > State-Changed-Why:
 >     Confirmed. It's a regression: it works in 3.0.4, but fails
 >     with 3.2 and 3.3. It should not ICE, but it is worth
 >     mentioning that it prints this:
 >       x.c:12: warning: deprecated use of label at end of compound
 > statement
 > 
 > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8994
 > 
 It should not matter as the original source (~3000 lines) doesn't have this problem.

Comment 9 Joseph S. Myers 2002-12-18 21:41:44 UTC
From: "Joseph S. Myers" <jsm28@cam.ac.uk>
To: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
Cc: <gcc-gnats@gcc.gnu.org>
Subject: Re: optimization/8994: [3.2/3.3 regression] ICE with -O -march=pentium4
Date: Wed, 18 Dec 2002 21:41:44 +0000 (GMT)

 On 18 Dec 2002, Wolfgang Bangerth wrote:
 
 >  Why is it warning about this:
 >  
 >  tmp/regression/test/PR8994.c: In function `js_dtoa':
 >  tmp/regression/test/PR8994.c:12: warning: deprecated use of label at end 
 >                                   of compound statement
 >  
 >  The compound statement is then actually the function body, and this seems 
 >  like a pretty common technique. Also, saying deprecated means that it is 
 
 Yes, it is the function body.  The standard syntax says that the function
 body is a compound statement.
 
 >  either deprecated by the standard, or it is illegal but accepted by gcc as 
 >  an extension. It is the latter, right, since a label must be followed by 
 >  another statement, and be it only ";".
 
 Yes.  It in a deprecated undocumented extension.  See the 3.0 release
 notes.
 
 -- 
 Joseph S. Myers
 jsm28@cam.ac.uk
 

Comment 10 Volker Reichelt 2002-12-18 23:06:09 UTC
From: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
To: gcc-gnats@gcc.gnu.org, towa8667@student.uu.se, gcc-bugs@gcc.gnu.org,
        nobody@gcc.gnu.org
Cc:  
Subject: Re: optimization/8994: [3.2/3.3 regression] ICE with -O -march=pentium4
Date: Wed, 18 Dec 2002 23:06:09 +0100

 Hi,
 
 here's a cleaned-up testcase that just ICEs - no warning:
 
 ------------------------------snip here-------------------------------
 void foo (double d)
 {
     union { double d; int i; } u;
 
     while (1)
     {
         u.d = d;
         if (u.i & 1) return;
     }
 }
 ------------------------------snip here-------------------------------
 
 BTW, if you add a semicolon after "ret:" in the original testcase, the
 warning also vanishes.
 
 Regards,
 Volker
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8994
 
 

Comment 11 Joe Buck 2003-04-25 21:31:02 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed for 3.3.