Bug 70098

Summary: Compiler bails out when compiling mozilla with pentium4 cpu optimisation
Product: [Retired] Red Hat Linux Reporter: Chris Chabot <chabotc>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-06-20 03:19:23 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 source
none
preprocessed source
none
preprocessed source
none
preprocessed source
none
preprocessed source
none
Gcc 3.2.1 / Moz 1.2.1 generated jsdtoa.i file none

Description Chris Chabot 2002-07-30 11:08:05 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.7 [en] (Win98; U)

Description of problem:
When i try to compile mozilla with gcc 3.2 (limbo beta 2), it bails out when
trying to compile jsdtoa.c when the cflags are set to  -mcpu=pentium4
-march=pentium4. When compiling the same source tree with i686, it compiles just
fine.

How reproducible:
Always

Steps to Reproduce:
The mozilla tree i am trying to compile is 1.1b (but i had the same results with
1.0.1 src.rpm's) The compiler is limbo's beta 2 gcc 3.2, the output is:

gcc -o jsdtoa.o -c -DOSTYPE=\"Linux2.4.18-7\" -DOSARCH=\"Linux\" -DOJI
-DEXPORT_JS_API  -DJS_USE_SAFE_ARENA   -I../../dist/include/js
-I../../dist/include -I/usr/src/redhat/BUILD/mozilla/dist/include/nspr      -I.
-I/usr/X11R6/include   -fPIC -I/usr/X11R6/include -Wall -W -Wno-unused
-Wpointer-arith -Wcast-align -pedantic -Wno-long-long -O2 -march=pentium4
-mcpu=pentium4 -pthread -pipe  -DNDEBUG -DTRIMMED -O2 -march=pentium4
-mcpu=pentium4  -I/usr/X11R6/include -include ../../config-defs.h
-DMOZILLA_CLIENT -Wp,-MD,.deps/jsdtoa.pp jsdtoa.c
jsdtoa.c: In function `ulp':
jsdtoa.c:977: warning: `a' might be used uninitialized in this function
jsdtoa.c: In function `b2d':
jsdtoa.c:1008: warning: `d' might be used uninitialized in this function
jsdtoa.c: In function `JS_strtod':
jsdtoa.c:1229: warning: `rv0' might be used uninitialized in this function
jsdtoa.c:1864: unable to find a register to spill in class `AREG'
jsdtoa.c:1864: this is the insn:
(insn:QI 1952 1951 1953 (set (reg:CCNO 17 flags)
        (compare:CCNO (and:SI (subreg:SI (reg/v:DI 21 rxmm0 [268]) 0)
                (const_int 1 [0x1]))
            (const_int 0 [0x0]))) 281 {testsi_1} (insn_list 1948 (nil))
    (expr_list:REG_DEAD (reg/v:DI 21 rxmm0 [268])
        (nil)))
jsdtoa.c:1864: confused by earlier errors, bailing out
make[2]: *** [jsdtoa.o] Error 1
make[2]: Leaving directory `/usr/src/redhat/BUILD/mozilla/js/src'
make[1]: *** [libs] Error 2
make[1]: Leaving directory `/usr/src/redhat/BUILD/mozilla/js'
make: *** [libs] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.87717 (%build)

Comment 1 Jakub Jelinek 2002-07-30 14:12:36 UTC
Please provide preprocessed source for this (jsdtoa.i).

Comment 2 Chris Chabot 2002-07-30 14:44:38 UTC
How do i get this .i file? Even if i compile the .c file by hand, it doesnt
create any .i files.. 

the line i use to compile it is:
gcc -o jsdtoa.o -c -DOSTYPE=\"Linux2.4.18-7\" -DOSARCH=\"Linux\" -DOJI
-DEXPORT_JS_API  -DJS_USE_SAFE_ARENA   -I../../dist/include/js
-I../../dist/include -I/usr/src/redhat/BUILD/mozilla/dist/include/nspr      -I.
-I/usr/X11R6/include   -fPIC -I/usr/X11R6/include -Wall -W -Wno-unused
-Wpointer-arith -Wcast-align -pedantic -Wno-long-long -O2 -march=pentium4
-mcpu=pentium4 -pthread  -DNDEBUG -DTRIMMED -O2 -march=pentium4 -mcpu=pentium4 
-I/usr/X11R6/include -include ../../config-defs.h -DMOZILLA_CLIENT
-Wp,-MD,.deps/jsdtoa.pp jsdtoa.c

This results in the error i originaly described, but find -name "*.i" tells me
there's no .i files to be found anywhere in the build tree.. 

Is there anything i can add/remove from the compile command so it does generate
this .i file?



Comment 3 Jakub Jelinek 2002-07-30 14:47:37 UTC
Yes. Either add -save-temps option to the command line, or replace
"-o jsdtoa.o -c" with "-o jsdtoa.i -E".

Comment 4 Chris Chabot 2002-07-30 15:01:46 UTC
Ps, adding the jsdtoa.i file is failing due to a oracle/bugzilla error. I have
send the file as attachment in a direct email. (All the attachments listed in
this bug are empty since the storare failed). I will try to re-add it again in
an hour or so

Comment 5 Jakub Jelinek 2002-07-30 18:45:46 UTC
Simplified into:
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-options "-O2 -march=pentium4" } */

const double h [10];

typedef union
{
  double u1;
  struct { unsigned int u21, u22; } u2;
} U;

double bar (double x);

double
foo (int x, unsigned int y, unsigned int z)
{
  int a, b;
  double c;

  b = x < 15 + 1 ? x : 15 + 1;
  c = y;
  if (b > 9)
    c = h [b - 9] * c + z;
  a = 0;
  if (((__extension__ ({ U d; d.u1 = (c); d.u2.u21; })) & 1))
    c += bar (c);
  return c;
}

Comment 6 Alan Cox 2002-12-15 22:03:07 UTC
Works for me with the 3.2-7 compiler


Comment 7 Chris Chabot 2002-12-16 03:27:33 UTC
It still fails for me. I tried upgrading to the 3.2.1 compiler (rawhide), and
still a similar error:
gcc -o jsdtoa.o -c -DOSTYPE="Linux2.4" -DOSARCH="Linux" -DOJI -DEXPORT_JS_API
-DJS_USE_SAFE_ARENA -I../../dist/include/js -I../../dist/include
-I/usr/src/redhat/BUILD/mozilla/dist/include/nspr -I. -I/usr/X11R6/include -fPIC
-I/usr/X11R6/include -Wall -W -Wno-unused -Wpointer-arith -Wcast-align -pedantic
-Wno-long-long -O2 -march=pentium4 -mcpu=pentium4 -pthread -pipe -DNDEBUG
-DTRIMMED -ffunction-sections -O2 -march=pentium4 -mcpu=pentium4
-I/usr/X11R6/include -include ../../mozilla-config.h -DMOZILLA_CLIENT
-Wp,-MD,.deps/jsdtoa.pp jsdtoa.c 
jsdtoa.c: In function `ulp':
jsdtoa.c:987: warning: `a' might be used uninitialized in this function
jsdtoa.c: In function `b2d':
jsdtoa.c:1018: warning: `d' might be used uninitialized in this function
jsdtoa.c: In function `JS_strtod':
jsdtoa.c:1239: warning: `rv0' might be used uninitialized in this function
jsdtoa.c:1874: unable to find a register to spill in class `AREG'
jsdtoa.c:1874: this is the insn:
(insn:QI 1952 1951 1953 (set (reg:CCNO 17 flags)
        (compare:CCNO (and:SI (subreg:SI (reg/v:DI 21 rxmm0 [268]) 0)
                (const_int 1 [0x1]))
            (const_int 0 [0x0]))) 281 {testsi_1} (insn_list 1948 (nil))
    (expr_list:REG_DEAD (reg/v:DI 21 rxmm0 [268])
        (nil)))
jsdtoa.c:1874: confused by earlier errors, bailing out

This is while compiling mozilla-1.2.1 btw.

I'll attach the generated jsdtoa.i file to the bug

Comment 8 Chris Chabot 2002-12-16 03:29:08 UTC
Created attachment 88750 [details]
Gcc 3.2.1 / Moz 1.2.1 generated jsdtoa.i file

Comment 9 Chris Chabot 2003-06-20 03:19:23 UTC
Now works with recent gcc 3.2 (in rh9 and rawhide) and 3.3 (rawhide) packages,
so closing bug.

(Confirmed with both compiler versions using -march=pentium4 -pipe flags and
mozilla-1.4rc2)

Thanks for your time and great work