Bug 11260 - [alpha] 'output_operand: floating constant misused' with sqrt(0.0) and -mcpu=ev6
Summary: [alpha] 'output_operand: floating constant misused' with sqrt(0.0) and -mcpu=ev6
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.1
: P2 normal
Target Milestone: 3.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-20 00:00 UTC by daevens
Modified: 2003-06-24 22:36 UTC (History)
1 user (show)

See Also:
Host: alphaev68-unknown-linux-gnu
Target: alphaev68-unknown-linux-gnu
Build: alphaev68-unknown-linux-gnu
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 daevens 2003-06-20 00:00:56 UTC
Summary: code causes 'output_operand: floating constant misused' under
 g77 3.1 and an 'internal compiler error: Segmentation fault' under g77
 3.3.  These results are under an alphaev68-unknown-linux-gnu system
 running RedHat 7.1 with a stock 2.4.20 kernel.

The trivial program below is the minimum bit of munged code that
yields the same error as the real code. For 3.1, we only get an error
on compilation if we specify -O2, if we leave that out or specify -O0
then it doesn't fail. For 3.3, it fails regardless of the -O
level. Additionally the Compaq fortran compiler generates a .o file,
but does issue warnings about things not being used.

> cat t.F
      program badone
      FS(a)=EXP(a)
      SHF(a)=Y-FS(a)

      SIG= 0.0
      P=-SIG/3.0
      X=SIG+P
      Y=sqrt(X)
      CAsv=CA
      end

> /usr/local/gcc-3.1/bin/g77 -v -save-temps -c -O2 -Wall -o t.o t.F
Reading specs from
/usr/local/gcc-3.1/bin/../lib/gcc-lib/alphaev68-unknown-linux-gnu/3.1/specs
Configured with: ../gcc-3.1/configure --prefix=/usr/local/gcc-3.1-gstabs
--enable-threads --enable-long-long --with-ld=/usr/local/binuti\
ls-2.12.1/bin/ld --with-as=/usr/local/binutils-2.12.1/bin/as
--with-nm=/usr/local/binutils-2.12.1/bin/nm --with-objdump=/usr/local/binut\
ils-2.12.1/bin/objdump
Thread model: posix
gcc version 3.1
 /usr/local/gcc-3.1/bin/../lib/gcc-lib/alphaev68-unknown-linux-gnu/3.1/tradcpp0
-lang-fortran -v -iprefix /usr/local/gcc-3.1/bin/../lib/\
gcc-lib/alphaev68-unknown-linux-gnu/3.1/ -D__GNUC__=3 -D__GNUC_MINOR__=1
-D__GNUC_PATCHLEVEL__=0 -D__gnu_linux__ -Dlinux -Dunix -D_LONGL\
ONG -D__alpha__ -D__ELF__ -D__gnu_linux__ -D__linux__ -D__unix__ -D_LONGLONG
-D__alpha__ -D__ELF__ -D__linux -D__unix -Asystem=linux -D_\
_OPTIMIZE__ -D__STDC_HOSTED__=1 -D__LANGUAGE_C__ -D__LANGUAGE_C -DLANGUAGE_C
-Acpu=alpha -Amachine=alpha -D__alpha -D__alpha__ -D__alpha\
_ev6__ -Acpu=ev6 -D__alpha_bwx__ -Acpu=bwx -D__alpha_max__ -Acpu=max
-D__alpha_fix__ -Acpu=fix -D__alpha_cix__ -Acpu=cix t.F -Wall t.f
GNU traditional CPP version 3.1
 /usr/local/gcc-3.1/bin/../lib/gcc-lib/alphaev68-unknown-linux-gnu/3.1/f771 t.f
-quiet -dumpbase t.F -O2 -Wall -version -o t.s
GNU F77 version 3.1 (alphaev68-unknown-linux-gnu)
        compiled by GNU C version 3.1.
t.F: In program `badone':
t.F:10: output_operand: floating constant misused
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

> cat t.f
# 1 "t.F"
      program badone
      FS(a)=EXP(a)
      SHF(a)=Y-FS(a)

      SIG= 0.0
      P=-SIG/3.0
      X=SIG+P
      Y=sqrt(X)
      CAsv=CA
      end


> /usr/local/gcc-3.3/bin/g77 -v -save-temps -c -O2 -Wall -o t.o t.F
Reading specs from
/usr/local/gcc-3.3/lib/gcc-lib/alphaev68-unknown-linux-gnu/3.3/specs
Configured with: ../gcc-3.3/configure --prefix=/usr/local/gcc-3.3
--enable-threads --enable-long-long : (reconfigured) ../gcc-3.3/config\
ure --prefix=/usr/local/gcc-3.3 --enable-threads --enable-long-long
--with-ld=/usr/local/binutils-2.14/bin/ld --with-as=/usr/local/binut\
ils-2.14/bin/as --with-nm=/usr/local/binutils-2.14/bin/nm
--with-objdump=/usr/local/binutils-2.14/bin/objdump
Thread model: posix
gcc version 3.3
 /usr/local/gcc-3.3/lib/gcc-lib/alphaev68-unknown-linux-gnu/3.3/cc1 -E
-traditional-cpp -D_LANGUAGE_FORTRAN -quiet -v -D__GNUC__=3 -D__G\
NUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ t.F -Wall -O2 t.f
ignoring nonexistent directory
"/usr/local/gcc-3.3/alphaev68-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/gcc-3.3/include
 /usr/local/gcc-3.3/lib/gcc-lib/alphaev68-unknown-linux-gnu/3.3/include
 /usr/include
End of search list.
 /usr/local/gcc-3.3/lib/gcc-lib/alphaev68-unknown-linux-gnu/3.3/f771 t.f -quiet
-dumpbase t.F -auxbase-strip t.o -O2 -Wall -version -o t\
.s
GNU F77 version 3.3 (alphaev68-unknown-linux-gnu)
        compiled by GNU C version 3.3.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
t.F: In program `badone':
t.F:3: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Andrew Pinski 2003-06-20 00:12:27 UTC
This is looks like it is a target problem, not a generic Fortan problem as on i686-pc-linux-
gnu I do not get an error with 3.2.3 and the error is from the file final.c which has a 
description of "Convert RTL to assembler code and output it".
Comment 2 Falk Hueffner 2003-06-20 00:20:42 UTC
I can reproduce this with 3.3. Note -mcpu=ev67 is needed (which is implicit
for the reporter, since he built gcc on such a machine).
Comment 3 Falk Hueffner 2003-06-20 00:48:00 UTC
Here's a C test case:

double f(void)
{
    return sqrt(0.0);
}

The ICE does not happen with mainline, most likely because of Roger's sqrt
constant folding stuff.
Comment 4 Andrew Pinski 2003-06-21 18:19:32 UTC
The fix is in <http://gcc.gnu.org/ml/gcc-patches/2003-06/msg02366.html> but has not be 
commited yet, it has been okayed already by Richard Henderson for the mainline.
Comment 5 GCC Commits 2003-06-24 17:29:27 UTC
Subject: Bug 11260

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rth@gcc.gnu.org	2003-06-24 16:54:33

Modified files:
	gcc            : ChangeLog 
	gcc/config/alpha: alpha.md 

Log message:
	PR target/11260
	* config/alpha/alpha.md (sqrtdf2): Fix operand substitution.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.140&r2=2.141
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/alpha/alpha.md.diff?cvsroot=gcc&r1=1.208&r2=1.209

Comment 6 GCC Commits 2003-06-24 18:52:53 UTC
Subject: Bug 11260

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	rth@gcc.gnu.org	2003-06-24 17:49:26

Modified files:
	gcc            : ChangeLog 
	gcc/config/alpha: alpha.md 

Log message:
	PR target/11260
	* config/alpha/alpha.md (sqrtdf2): Fix operand substitution.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.612&r2=1.16114.2.613
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/alpha/alpha.md.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.199.4.3&r2=1.199.4.4

Comment 7 Richard Henderson 2003-06-24 22:36:02 UTC
http://gcc.gnu.org/ml/gcc-patches/2003-06/msg02366.html