public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/17075] New: galgel crashes if compiled with -foptimize-sibling-calls
@ 2004-08-18 9:14 lei at il dot ibm dot com
2004-08-18 14:31 ` [Bug middle-end/17075] " pinskia at gcc dot gnu dot org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: lei at il dot ibm dot com @ 2004-08-18 9:14 UTC (permalink / raw)
To: gcc-bugs
When SPEC 2000 benchmark 178.galgel is compiled with -O2
option, galgel crashes.
This problem is possibly specific to ia32. I was unable
to reproduce it on ppc.
I don't have a small testcase that reproduces the problem.
The problem seems to be with the function DNRM2 inside lapak.f90.
If that function is compiled with -O2 -fno-optimize-sibling-calls,
galgel works okay. The problem seems to be connected to the call to SQRT.
function dnrm2 ( n, dx, incx)
real*8 dnrm2
integer i, incx, ix, j, n, next
real*8 dx(*), cutlo, cuthi, hitest, sum, xmax,zero,one
data zero, one /0.0d0, 1.0d0/
data cutlo, cuthi / 8.232d-11, 1.304d19 /
if(n .gt. 0) go to 10
dnrm2 = zero
go to 300
10 assign 30 to next
sum = zero
i = 1
if( incx .lt. 0 )i = (-n+1)*incx + 1
ix = 1
20 go to next,(30, 50, 70, 110)
30 if( dabs(dx(i)) .gt. cutlo) go to 85
assign 50 to next
xmax = zero
50 if( dx(i) .eq. zero) go to 200
if( dabs(dx(i)) .gt. cutlo) go to 85
assign 70 to next
go to 105
100 continue
ix = j
assign 110 to next
sum = (sum / dx(i)) / dx(i)
105 xmax = dabs(dx(i))
go to 115
70 if( dabs(dx(i)) .gt. cutlo ) go to 75
110 if( dabs(dx(i)) .le. xmax ) go to 115
sum = one + sum * (xmax / dx(i))**2
xmax = dabs(dx(i))
go to 200
115 sum = sum + (dx(i)/xmax)**2
go to 200
75 sum = (sum * xmax) * xmax
85 hitest = cuthi/float( n )
do 95 j = ix,n
if(dabs(dx(i)) .ge. hitest) go to 100
sum = sum + dx(i)**2
i = i + incx
95 continue
dnrm2 = dsqrt( sum )
go to 300
200 continue
ix = ix + 1
i = i + incx
if( ix .le. n ) go to 20
dnrm2 = xmax * dsqrt(sum)
300 continue
return
end
--
Summary: galgel crashes if compiled with -foptimize-sibling-calls
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: lei at il dot ibm dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17075
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/17075] galgel crashes if compiled with -foptimize-sibling-calls
2004-08-18 9:14 [Bug fortran/17075] New: galgel crashes if compiled with -foptimize-sibling-calls lei at il dot ibm dot com
@ 2004-08-18 14:31 ` pinskia at gcc dot gnu dot org
2004-08-18 15:44 ` [Bug middle-end/17075] [3.5 Regression] " pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-18 14:31 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO| |15502
nThis| |
Component|fortran |middle-end
Keywords| |wrong-code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17075
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/17075] [3.5 Regression] galgel crashes if compiled with -foptimize-sibling-calls
2004-08-18 9:14 [Bug fortran/17075] New: galgel crashes if compiled with -foptimize-sibling-calls lei at il dot ibm dot com
2004-08-18 14:31 ` [Bug middle-end/17075] " pinskia at gcc dot gnu dot org
@ 2004-08-18 15:44 ` pinskia at gcc dot gnu dot org
2004-08-18 15:56 ` steven at gcc dot gnu dot org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-18 15:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-08-18 15:44 -------
Confirmed (yes it had to do with the sqrt):
Here is a simple testcase:
#include <stdio.h>
double f(double x){return __builtin_sqrt(x);}
int main()
{
printf("%f\n", f(10));
}
We get printted NAN instead of the correct answer.
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |critical
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Known to fail| |3.5.0
Known to work| |3.4.0
Last reconfirmed|0000-00-00 00:00:00 |2004-08-18 15:44:39
date| |
Summary|galgel crashes if compiled |[3.5 Regression] galgel
|with -foptimize-sibling- |crashes if compiled with -
|calls |foptimize-sibling-calls
Target Milestone|--- |3.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17075
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/17075] [3.5 Regression] galgel crashes if compiled with -foptimize-sibling-calls
2004-08-18 9:14 [Bug fortran/17075] New: galgel crashes if compiled with -foptimize-sibling-calls lei at il dot ibm dot com
2004-08-18 14:31 ` [Bug middle-end/17075] " pinskia at gcc dot gnu dot org
2004-08-18 15:44 ` [Bug middle-end/17075] [3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-08-18 15:56 ` steven at gcc dot gnu dot org
2004-08-22 18:47 ` steven at gcc dot gnu dot org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-08-18 15:56 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2004-08-18 15:56 -------
I'll have a look.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |steven at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17075
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/17075] [3.5 Regression] galgel crashes if compiled with -foptimize-sibling-calls
2004-08-18 9:14 [Bug fortran/17075] New: galgel crashes if compiled with -foptimize-sibling-calls lei at il dot ibm dot com
` (2 preceding siblings ...)
2004-08-18 15:56 ` steven at gcc dot gnu dot org
@ 2004-08-22 18:47 ` steven at gcc dot gnu dot org
2004-08-22 21:54 ` steven at gcc dot gnu dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-08-22 18:47 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2004-08-22 18:47 -------
This bug is caused by the following patch:
2004-07-21 Richard Henderson <rth@redhat.com>
* cfgexpand.c (expand_gimple_tailcall): Fix case where we need
to create a new basic block.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |rth at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17075
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/17075] [3.5 Regression] galgel crashes if compiled with -foptimize-sibling-calls
2004-08-18 9:14 [Bug fortran/17075] New: galgel crashes if compiled with -foptimize-sibling-calls lei at il dot ibm dot com
` (3 preceding siblings ...)
2004-08-22 18:47 ` steven at gcc dot gnu dot org
@ 2004-08-22 21:54 ` steven at gcc dot gnu dot org
2004-08-22 22:05 ` [Bug middle-end/17075] [3.5 Regression] miscompilation with tail calls in cfgexpand steven at gcc dot gnu dot org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-08-22 21:54 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2004-08-22 21:54 -------
The problem appears to be that the function result assignment is
removed in this part of the patch:
+ while (NEXT_INSN (last))
+ {
+ /* For instance an sqrt builtin expander expands if with
+ sibcall in the then and label for `else`. */
+ if (LABEL_P (NEXT_INSN (last)))
+ break;
+ delete_insn (NEXT_INSN (last));
+ }
"before" is just before we enter this loop, after is when we've
finished the loop:
--- before 2004-08-22 23:43:38.188246232 +0200
+++ after 2004-08-22 23:44:31.837195217 +0200
@@ -27,21 +27,9 @@
(nil))
(nil))
-(barrier 17 15 16)
+(barrier 17 15 19)
-(insn 16 17 18 (parallel [
- (set (reg/f:SI 7 sp)
- (plus:SI (reg/f:SI 7 sp)
- (const_int 8 [0x8])))
- (clobber (reg:CC 17 flags))
- ]) -1 (nil)
- (nil))
-
-(insn 18 16 19 (set (reg:DF 61)
- (reg:DF 8 st)) -1 (nil)
- (nil))
-
-(code_label 19 18 20 2 "" [0 uses])
+(code_label 19 17 20 2 "" [0 uses])
(insn 20 19 0 (set (reg:DF 58 [ T.0 ])
(reg:DF 61)) -1 (nil)
The result of that loop is that the set for reg 61 is deleted, so
that when we do (set (T.0) (reg 61)), nothing has set reg 61 to
the function result at that point.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17075
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/17075] [3.5 Regression] miscompilation with tail calls in cfgexpand
2004-08-18 9:14 [Bug fortran/17075] New: galgel crashes if compiled with -foptimize-sibling-calls lei at il dot ibm dot com
` (4 preceding siblings ...)
2004-08-22 21:54 ` steven at gcc dot gnu dot org
@ 2004-08-22 22:05 ` steven at gcc dot gnu dot org
2004-08-22 22:34 ` rth at gcc dot gnu dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-08-22 22:05 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2004-08-22 22:05 -------
I bet this could manifest itself with builtins on other targets
as well.
(Unfortunately I have no idea what intention rth had
with the patch that breaks this, as it is supposed to fix another
problem from an earlier patch. Rth??)
--
What |Removed |Added
----------------------------------------------------------------------------
Priority|P2 |P1
Summary|[3.5 Regression] galgel |[3.5 Regression]
|crashes if compiled with - |miscompilation with tail
|foptimize-sibling-calls |calls in cfgexpand
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17075
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/17075] [3.5 Regression] miscompilation with tail calls in cfgexpand
2004-08-18 9:14 [Bug fortran/17075] New: galgel crashes if compiled with -foptimize-sibling-calls lei at il dot ibm dot com
` (5 preceding siblings ...)
2004-08-22 22:05 ` [Bug middle-end/17075] [3.5 Regression] miscompilation with tail calls in cfgexpand steven at gcc dot gnu dot org
@ 2004-08-22 22:34 ` rth at gcc dot gnu dot org
2004-08-23 0:03 ` cvs-commit at gcc dot gnu dot org
2004-08-23 0:08 ` rth at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-08-22 22:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rth at gcc dot gnu dot org 2004-08-22 22:34 -------
Testing a patch.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|steven at gcc dot gnu dot |rth at gcc dot gnu dot org
|org |
Priority|P1 |P2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17075
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/17075] [3.5 Regression] miscompilation with tail calls in cfgexpand
2004-08-18 9:14 [Bug fortran/17075] New: galgel crashes if compiled with -foptimize-sibling-calls lei at il dot ibm dot com
` (6 preceding siblings ...)
2004-08-22 22:34 ` rth at gcc dot gnu dot org
@ 2004-08-23 0:03 ` cvs-commit at gcc dot gnu dot org
2004-08-23 0:08 ` rth at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-08-23 0:03 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-08-23 00:03 -------
Subject: Bug 17075
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: rth@gcc.gnu.org 2004-08-23 00:02:58
Modified files:
gcc : ChangeLog cfgexpand.c
Log message:
PR 17075
* cfgexpand.c (expand_gimple_tailcall): Detect when we can both
create new blocks and fall through.
(expand_gimple_basic_block): Update to match.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.5023&r2=2.5024
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cfgexpand.c.diff?cvsroot=gcc&r1=2.17&r2=2.18
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17075
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/17075] [3.5 Regression] miscompilation with tail calls in cfgexpand
2004-08-18 9:14 [Bug fortran/17075] New: galgel crashes if compiled with -foptimize-sibling-calls lei at il dot ibm dot com
` (7 preceding siblings ...)
2004-08-23 0:03 ` cvs-commit at gcc dot gnu dot org
@ 2004-08-23 0:08 ` rth at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-08-23 0:08 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rth at gcc dot gnu dot org 2004-08-23 00:07 -------
Fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17075
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2004-08-23 0:08 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-18 9:14 [Bug fortran/17075] New: galgel crashes if compiled with -foptimize-sibling-calls lei at il dot ibm dot com
2004-08-18 14:31 ` [Bug middle-end/17075] " pinskia at gcc dot gnu dot org
2004-08-18 15:44 ` [Bug middle-end/17075] [3.5 Regression] " pinskia at gcc dot gnu dot org
2004-08-18 15:56 ` steven at gcc dot gnu dot org
2004-08-22 18:47 ` steven at gcc dot gnu dot org
2004-08-22 21:54 ` steven at gcc dot gnu dot org
2004-08-22 22:05 ` [Bug middle-end/17075] [3.5 Regression] miscompilation with tail calls in cfgexpand steven at gcc dot gnu dot org
2004-08-22 22:34 ` rth at gcc dot gnu dot org
2004-08-23 0:03 ` cvs-commit at gcc dot gnu dot org
2004-08-23 0:08 ` rth at gcc dot gnu dot org
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).