public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/26717]  New: gfortran: ICE at tree-complex.c:133 with -O -ffast-math in LAPACK,
@ 2006-03-16 15:43 anlauf at gmx dot de
  2006-03-16 15:45 ` [Bug middle-end/26717] " anlauf at gmx dot de
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: anlauf at gmx dot de @ 2006-03-16 15:43 UTC (permalink / raw)
  To: gcc-bugs

Hi,

compiling LAPACK with -O -ffast-math leads to an ICE
in LAPACK's csptri.f and csytri.f:

% gfortran -O -ffast-math -c csptri.f
csptri.f: In function 'csptri':
csptri.f:1: internal compiler error: in find_lattice_value, at
tree-complex.c:133

The same error is encountered in the other file.

Cheers,
-ha


-- 
           Summary: gfortran: ICE at tree-complex.c:133 with -O -ffast-math
                    in LAPACK,
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anlauf at gmx dot de
  GCC host triplet: i686-pc-linux-gnu


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


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

* [Bug middle-end/26717] gfortran: ICE at tree-complex.c:133 with -O -ffast-math in LAPACK,
  2006-03-16 15:43 [Bug fortran/26717] New: gfortran: ICE at tree-complex.c:133 with -O -ffast-math in LAPACK, anlauf at gmx dot de
@ 2006-03-16 15:45 ` anlauf at gmx dot de
  2006-03-16 15:59 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gmx dot de @ 2006-03-16 15:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from anlauf at gmx dot de  2006-03-16 15:45 -------
Created an attachment (id=11059)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11059&action=view)
Original LAPACK source file


-- 


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


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

* [Bug middle-end/26717] gfortran: ICE at tree-complex.c:133 with -O -ffast-math in LAPACK,
  2006-03-16 15:43 [Bug fortran/26717] New: gfortran: ICE at tree-complex.c:133 with -O -ffast-math in LAPACK, anlauf at gmx dot de
  2006-03-16 15:45 ` [Bug middle-end/26717] " anlauf at gmx dot de
@ 2006-03-16 15:59 ` pinskia at gcc dot gnu dot org
  2006-03-16 16:21 ` [Bug middle-end/26717] [4.2 Regression] " pinskia 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 @ 2006-03-16 15:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-03-16 15:59 -------
Reducing.


-- 


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


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

* [Bug middle-end/26717] [4.2 Regression] gfortran: ICE at tree-complex.c:133 with -O -ffast-math in LAPACK,
  2006-03-16 15:43 [Bug fortran/26717] New: gfortran: ICE at tree-complex.c:133 with -O -ffast-math in LAPACK, anlauf at gmx dot de
  2006-03-16 15:45 ` [Bug middle-end/26717] " anlauf at gmx dot de
  2006-03-16 15:59 ` pinskia at gcc dot gnu dot org
@ 2006-03-16 16:21 ` pinskia at gcc dot gnu dot org
  2006-03-16 18:58 ` kargl at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-16 16:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-03-16 16:21 -------
Reduced C testcase:
_Complex float f(_Complex float a, _Complex float b)
{
  _Complex float c = a/a;
  return c/ b;
}
------
The problem is that fold is folding a/a to 1.0 but not the complex version.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-03-16 16:21:05
               date|                            |
            Summary|gfortran: ICE at tree-      |[4.2 Regression] gfortran:
                   |complex.c:133 with -O -     |ICE at tree-complex.c:133
                   |ffast-math in LAPACK,       |with -O -ffast-math in
                   |                            |LAPACK,
   Target Milestone|---                         |4.2.0


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


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

* [Bug middle-end/26717] [4.2 Regression] gfortran: ICE at tree-complex.c:133 with -O -ffast-math in LAPACK,
  2006-03-16 15:43 [Bug fortran/26717] New: gfortran: ICE at tree-complex.c:133 with -O -ffast-math in LAPACK, anlauf at gmx dot de
                   ` (2 preceding siblings ...)
  2006-03-16 16:21 ` [Bug middle-end/26717] [4.2 Regression] " pinskia at gcc dot gnu dot org
@ 2006-03-16 18:58 ` kargl at gcc dot gnu dot org
  2006-03-17  8:06 ` anlauf at gmx dot de
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: kargl at gcc dot gnu dot org @ 2006-03-16 18:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from kargl at gcc dot gnu dot org  2006-03-16 18:58 -------
It looks like Andrew has found your problem.  I will, however,
suggest that you reconsider using --fast-math with gfortran.
One of my codes works correctly without --fast-math, but it
will generate NaN's with it.  I have not tracked down the problem,
nor have I files a bug report because the code is fairly large
and complicated.


-- 


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


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

* [Bug middle-end/26717] [4.2 Regression] gfortran: ICE at tree-complex.c:133 with -O -ffast-math in LAPACK,
  2006-03-16 15:43 [Bug fortran/26717] New: gfortran: ICE at tree-complex.c:133 with -O -ffast-math in LAPACK, anlauf at gmx dot de
                   ` (3 preceding siblings ...)
  2006-03-16 18:58 ` kargl at gcc dot gnu dot org
@ 2006-03-17  8:06 ` anlauf at gmx dot de
  2006-03-22  3:14 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gmx dot de @ 2006-03-17  8:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from anlauf at gmx dot de  2006-03-17 08:06 -------
(In reply to comment #4)
> I will, however, suggest that you reconsider using --fast-math with gfortran.
> One of my codes works correctly without --fast-math, but it
> will generate NaN's with it.  I have not tracked down the problem,

A fairly well-known case is complex division, where -ffast-math
assumes a reduced range of the variables so that no overflow
can occur.  See the gcc option -fno-cx-limited-range for more
details.

Here's an example where -fno-cx-limited-range does not counter
the effect of -ffast-math and produces an NaN:

% cat gfc_complex_div.f90
program gfc_complex_div
  implicit none
  complex, parameter :: a = 1.e-30 * (1.0, 1.0)

  print *, cx_div (a, a)

contains

  function cx_div (a, b)
    complex :: cx_div, a, b

    cx_div = a / b
  end function cx_div

end program gfc_complex_div
% gfc gfc_complex_div.f90 -O && ./a.out
 (  1.000000    ,  0.000000    )
% gfc gfc_complex_div.f90 -O -ffast-math && ./a.out
 (           NaN,           NaN)
% gfc gfc_complex_div.f90 -O -ffast-math -fno-cx-limited-range && ./a.out
 (           NaN,           NaN)

I think this used to work (with g77?), but it appears not to work any
longer.


-- 


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


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

* [Bug middle-end/26717] [4.2 Regression] gfortran: ICE at tree-complex.c:133 with -O -ffast-math in LAPACK,
  2006-03-16 15:43 [Bug fortran/26717] New: gfortran: ICE at tree-complex.c:133 with -O -ffast-math in LAPACK, anlauf at gmx dot de
                   ` (4 preceding siblings ...)
  2006-03-17  8:06 ` anlauf at gmx dot de
@ 2006-03-22  3:14 ` pinskia at gcc dot gnu dot org
  2006-03-23 10:33 ` [Bug middle-end/26717] [4.2 Regression] complex/complex gives a REAL_CST uros at kss-loka dot si
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-22  3:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2006-03-22 03:14 -------
The problem is here:
8910              tree r = build_real (TREE_TYPE (arg0), dconst1);
in fold-const.c

And this was caused by:
2005-11-21  Uros Bizjak  <uros@kss-loka.si>

        * fold-const.c (fold_binary) <RDIV_EXPR>: Optimize A / A to 1.0
        if we don't care about NaNs or Infinities.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |uros at kss-loka dot si


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


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

* [Bug middle-end/26717] [4.2 Regression] complex/complex gives a REAL_CST
  2006-03-16 15:43 [Bug fortran/26717] New: gfortran: ICE at tree-complex.c:133 with -O -ffast-math in LAPACK, anlauf at gmx dot de
                   ` (5 preceding siblings ...)
  2006-03-22  3:14 ` pinskia at gcc dot gnu dot org
@ 2006-03-23 10:33 ` uros at kss-loka dot si
  2006-03-25 17:32 ` uros at gcc dot gnu dot org
  2006-03-25 21:58 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: uros at kss-loka dot si @ 2006-03-23 10:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from uros at kss-loka dot si  2006-03-23 10:33 -------
Patch at http://gcc.gnu.org/ml/gcc-patches/2006-03/msg01435.html


-- 

uros at kss-loka dot si changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |uros at kss-loka dot si
                   |dot org                     |
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2006-
                   |                            |03/msg01435.html
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-03-16 16:21:05         |2006-03-23 10:33:46
               date|                            |


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


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

* [Bug middle-end/26717] [4.2 Regression] complex/complex gives a REAL_CST
  2006-03-16 15:43 [Bug fortran/26717] New: gfortran: ICE at tree-complex.c:133 with -O -ffast-math in LAPACK, anlauf at gmx dot de
                   ` (6 preceding siblings ...)
  2006-03-23 10:33 ` [Bug middle-end/26717] [4.2 Regression] complex/complex gives a REAL_CST uros at kss-loka dot si
@ 2006-03-25 17:32 ` uros at gcc dot gnu dot org
  2006-03-25 21:58 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: uros at gcc dot gnu dot org @ 2006-03-25 17:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from uros at gcc dot gnu dot org  2006-03-25 17:32 -------
Subject: Bug 26717

Author: uros
Date: Sat Mar 25 17:32:34 2006
New Revision: 112379

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=112379
Log:
        PR middle-end/26717
        * fold-const.c (fold_binary) [RDIV_EXPR]: Do not optimize A / A
        to 1.0 for non-real operands. Implement A / A optimization for
        complex operands.


Added:
    trunk/gcc/testsuite/gcc.dg/pr26717.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/26717] [4.2 Regression] complex/complex gives a REAL_CST
  2006-03-16 15:43 [Bug fortran/26717] New: gfortran: ICE at tree-complex.c:133 with -O -ffast-math in LAPACK, anlauf at gmx dot de
                   ` (7 preceding siblings ...)
  2006-03-25 17:32 ` uros at gcc dot gnu dot org
@ 2006-03-25 21:58 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-25 21:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pinskia at gcc dot gnu dot org  2006-03-25 21:58 -------
Fixed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2006-03-25 21:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-16 15:43 [Bug fortran/26717] New: gfortran: ICE at tree-complex.c:133 with -O -ffast-math in LAPACK, anlauf at gmx dot de
2006-03-16 15:45 ` [Bug middle-end/26717] " anlauf at gmx dot de
2006-03-16 15:59 ` pinskia at gcc dot gnu dot org
2006-03-16 16:21 ` [Bug middle-end/26717] [4.2 Regression] " pinskia at gcc dot gnu dot org
2006-03-16 18:58 ` kargl at gcc dot gnu dot org
2006-03-17  8:06 ` anlauf at gmx dot de
2006-03-22  3:14 ` pinskia at gcc dot gnu dot org
2006-03-23 10:33 ` [Bug middle-end/26717] [4.2 Regression] complex/complex gives a REAL_CST uros at kss-loka dot si
2006-03-25 17:32 ` uros at gcc dot gnu dot org
2006-03-25 21:58 ` pinskia 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).