public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/43796]  New: ICE with -fcheck=all
@ 2010-04-19 10:11 mathewc at nag dot co dot uk
  2010-04-19 10:56 ` [Bug fortran/43796] " dominiq at lps dot ens dot fr
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: mathewc at nag dot co dot uk @ 2010-04-19 10:11 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2218 bytes --]

> uname -a
Linux loanamd25 2.6.16.46-0.10-smp #1 SMP Mon May 7 13:37:05 UTC 2007 x86_64
x86_64 x86_64 GNU/Linux

> gfortran --version
GNU Fortran (GCC) 4.5.0

> cat f06fkfn.f90
    FUNCTION F06FKFN(N,W,INCW,X,INCX)
       IMPLICIT NONE
       INTEGER, PARAMETER :: WP = KIND(0.0D0)
       REAL (KIND=WP)                  :: F06FKFN
       REAL (KIND=WP), PARAMETER       :: ONE = 1.0E+0_WP
       REAL (KIND=WP), PARAMETER       :: ZERO = 0.0E+0_WP
       INTEGER, INTENT (IN)            :: INCW, INCX, N
       REAL (KIND=WP), INTENT (IN)     :: W(*), X(*)
       REAL (KIND=WP)                  :: ABSYI, NORM, SCALE, SSQ
       INTEGER                         :: I, IW, IX
       REAL (KIND=WP), EXTERNAL        :: F06BMFN
       INTRINSIC                          ABS, SQRT
       IF (N<1) THEN
          NORM = ZERO
       ELSE IF (N==1) THEN
          NORM = SQRT(W(1))*ABS(X(1))
       ELSE
          IF (INCW>0) THEN
             IW = 1
          ELSE
             IW = 1 - (N-1)*INCW
          END IF
          IF (INCX>0) THEN
             IX = 1
          ELSE
             IX = 1 - (N-1)*INCX
          END IF
          SCALE = ZERO
          SSQ = ONE
          DO I = 1, N
             IF ((W(IW)/=ZERO) .AND. (X(IX)/=ZERO)) THEN
                ABSYI = SQRT(W(IW))*ABS(X(IX))
                IF (SCALE<ABSYI) THEN
                   SSQ = 1 + SSQ*(SCALE/ABSYI)**2
                   SCALE = ABSYI
                ELSE
                   SSQ = SSQ + (ABSYI/SCALE)**2
                END IF
             END IF
             IW = IW + INCW
             IX = IX + INCX
          END DO
          NORM = F06BMFN(SCALE,SSQ)
       END IF
       F06FKFN = NORM
       RETURN
    END FUNCTION F06FKFN

> gfortran -O3 -m32 -fcheck=all -c f06fkfn.f90
f06fkfn.f90: In function ‘f06fkfn’:
f06fkfn.f90:1:0: internal compiler error: Segmentation fault


-- 
           Summary: ICE with -fcheck=all
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mathewc at nag dot co dot uk


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


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

* [Bug fortran/43796] ICE with -fcheck=all
  2010-04-19 10:11 [Bug fortran/43796] New: ICE with -fcheck=all mathewc at nag dot co dot uk
@ 2010-04-19 10:56 ` dominiq at lps dot ens dot fr
  2010-04-19 11:40 ` [Bug middle-end/43796] [4.5/4.6 Regression] ICE in is_overflow_infinity (tree-vrp.c:184) with gfortran -fcheck=bounds -O2 burnus at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-04-19 10:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dominiq at lps dot ens dot fr  2010-04-19 10:56 -------
Confirmed on trunk with '-O[23] -m32 -fcheck=bounds' (compiles with '-O[01s]').
Works for me with 4.5 revision 157991 and 4.4.2 (with '-fbounds-check' instead
of '-fcheck=bounds'), hence at least a 4.6 regression.


-- 


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


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

* [Bug middle-end/43796] [4.5/4.6 Regression] ICE in is_overflow_infinity (tree-vrp.c:184) with gfortran -fcheck=bounds -O2
  2010-04-19 10:11 [Bug fortran/43796] New: ICE with -fcheck=all mathewc at nag dot co dot uk
  2010-04-19 10:56 ` [Bug fortran/43796] " dominiq at lps dot ens dot fr
@ 2010-04-19 11:40 ` burnus at gcc dot gnu dot org
  2010-04-19 12:26 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-04-19 11:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2010-04-19 11:39 -------
Confirm. It fails with 4.5 and 4.6 using the option -fbounds-check (==
-fcheck-bounds), but only with -O2 and higher and for some reasons only with
-m32 and not with -m64 on x86_64-unknown-linux-gnu.

It works with GCC 4.1/4.2/4.3/4.4.

Valgrind shows:

==2634== Invalid read of size 2
==2634==    at 0x9643CA: is_overflow_infinity (tree-vrp.c:184)
==2634==    by 0x96447D: usable_range_p (tree-vrp.c:797)
==2634==    by 0x96A3DD: compare_ranges (tree-vrp.c:3388)
==2634==    by 0x96B083: vrp_evaluate_conditional_warnv_with_ops
(tree-vrp.c:5669)
==2634==    by 0x96B91F: vrp_evaluate_conditional (tree-vrp.c:5710)
==2634==    by 0x9309DE: thread_across_edge (tree-ssa-threadedge.c:537)
==2634==    by 0x9765ED: execute_vrp (tree-vrp.c:7214)
==2634==    by 0x785B9A: execute_one_pass (passes.c:1569)
==2634==    by 0x785E24: execute_pass_list (passes.c:1624)
==2634==    by 0x785E36: execute_pass_list (passes.c:1625)
==2634==    by 0x87AB34: tree_rest_of_compilation (tree-optimize.c:413)
==2634==    by 0x9FCA60: cgraph_expand_function (cgraphunit.c:1548)
==2634==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==2634==
test.f90: In function 'f06fkfn':
test.f90:1:0: internal compiler error: Segmentation fault
Please submit a full bug report,


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu dot
                   |                            |org
          Component|fortran                     |middle-end
 GCC target triplet|                            |i386-unknown-linux-gnu
           Keywords|                            |ice-on-valid-code
      Known to fail|                            |4.5.0 4.6.0
      Known to work|                            |4.4.4
            Summary|ICE with -fcheck=all        |[4.5/4.6 Regression] ICE in
                   |                            |is_overflow_infinity (tree-
                   |                            |vrp.c:184) with gfortran -
                   |                            |fcheck=bounds -O2


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


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

* [Bug middle-end/43796] [4.5/4.6 Regression] ICE in is_overflow_infinity (tree-vrp.c:184) with gfortran -fcheck=bounds -O2
  2010-04-19 10:11 [Bug fortran/43796] New: ICE with -fcheck=all mathewc at nag dot co dot uk
  2010-04-19 10:56 ` [Bug fortran/43796] " dominiq at lps dot ens dot fr
  2010-04-19 11:40 ` [Bug middle-end/43796] [4.5/4.6 Regression] ICE in is_overflow_infinity (tree-vrp.c:184) with gfortran -fcheck=bounds -O2 burnus at gcc dot gnu dot org
@ 2010-04-19 12:26 ` rguenth at gcc dot gnu dot org
  2010-04-19 15:17 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-04-19 12:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2010-04-19 12:26 -------
Program received signal SIGSEGV, Segmentation fault.
0x0000000000bdb380 in needs_overflow_infinity (type=0x0)
    at /space/rguenther/src/svn/gcc-4_5-branch/gcc/tree-vrp.c:184
184       return INTEGRAL_TYPE_P (type) && !TYPE_OVERFLOW_WRAPS (type);
(gdb) up
#1  0x0000000000bdb434 in is_overflow_infinity (val=0x7ffff5adfe70)
    at /space/rguenther/src/svn/gcc-4_5-branch/gcc/tree-vrp.c:269
269       return (needs_overflow_infinity (TREE_TYPE (val))
(gdb) call debug_tree (val)
 <ssa_name 0x7ffff5adfe70 nothrow var <var_decl 0x7ffff7fbf0a0 i>def_stmt 

    version 56 in-free-list>

Confirmed.

We free the SSA name in substitute_and_fold () but it is still used in
symbolical ranges which we end up using by jump threading.

If we do so we shouldn't DCE stmts in substitute_and_fold ().

There's also a missed-optimization which if fixed fixes this PR as well.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-04-19 12:26:31
               date|                            |


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


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

* [Bug middle-end/43796] [4.5/4.6 Regression] ICE in is_overflow_infinity (tree-vrp.c:184) with gfortran -fcheck=bounds -O2
  2010-04-19 10:11 [Bug fortran/43796] New: ICE with -fcheck=all mathewc at nag dot co dot uk
                   ` (2 preceding siblings ...)
  2010-04-19 12:26 ` rguenth at gcc dot gnu dot org
@ 2010-04-19 15:17 ` rguenth at gcc dot gnu dot org
  2010-04-19 15:21 ` [Bug middle-end/43796] [4.5 " rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-04-19 15:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2010-04-19 15:17 -------
Subject: Bug 43796

Author: rguenth
Date: Mon Apr 19 15:17:26 2010
New Revision: 158520

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158520
Log:
2010-04-19  Richard Guenther  <rguenther@suse.de>

        PR tree-optimization/43796
        * tree-vrp.c (adjust_range_with_scev): Lookup init and step
        from SCEV in the lattice.
        (vrp_visit_phi_node): Dump change.

        * gfortran.dg/pr43796.f90: New testcase.

Added:
    trunk/gcc/testsuite/gfortran.dg/pr43796.f90
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vrp.c


-- 


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


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

* [Bug middle-end/43796] [4.5 Regression] ICE in is_overflow_infinity (tree-vrp.c:184) with gfortran -fcheck=bounds -O2
  2010-04-19 10:11 [Bug fortran/43796] New: ICE with -fcheck=all mathewc at nag dot co dot uk
                   ` (3 preceding siblings ...)
  2010-04-19 15:17 ` rguenth at gcc dot gnu dot org
@ 2010-04-19 15:21 ` rguenth at gcc dot gnu dot org
  2010-04-20  9:04 ` rguenth at gcc dot gnu dot org
  2010-04-20  9:06 ` rguenth at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-04-19 15:21 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|4.5.0 4.6.0                 |4.5.0
      Known to work|4.4.4                       |4.4.4 4.6.0
            Summary|[4.5/4.6 Regression] ICE in |[4.5 Regression] ICE in
                   |is_overflow_infinity (tree- |is_overflow_infinity (tree-
                   |vrp.c:184) with gfortran -  |vrp.c:184) with gfortran -
                   |fcheck=bounds -O2           |fcheck=bounds -O2
   Target Milestone|---                         |4.5.1


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


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

* [Bug middle-end/43796] [4.5 Regression] ICE in is_overflow_infinity (tree-vrp.c:184) with gfortran -fcheck=bounds -O2
  2010-04-19 10:11 [Bug fortran/43796] New: ICE with -fcheck=all mathewc at nag dot co dot uk
                   ` (4 preceding siblings ...)
  2010-04-19 15:21 ` [Bug middle-end/43796] [4.5 " rguenth at gcc dot gnu dot org
@ 2010-04-20  9:04 ` rguenth at gcc dot gnu dot org
  2010-04-20  9:06 ` rguenth at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-04-20  9:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2010-04-20 09:04 -------
Subject: Bug 43796

Author: rguenth
Date: Tue Apr 20 09:04:05 2010
New Revision: 158548

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158548
Log:
2010-04-20  Richard Guenther  <rguenther@suse.de>

        PR tree-optimization/43796
        * tree-vrp.c (adjust_range_with_scev): Lookup init and step
        from SCEV in the lattice.
        (vrp_visit_phi_node): Dump change.

        * gfortran.dg/pr43796.f90: New testcase.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/gfortran.dg/pr43796.f90
Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_5-branch/gcc/tree-vrp.c


-- 


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


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

* [Bug middle-end/43796] [4.5 Regression] ICE in is_overflow_infinity (tree-vrp.c:184) with gfortran -fcheck=bounds -O2
  2010-04-19 10:11 [Bug fortran/43796] New: ICE with -fcheck=all mathewc at nag dot co dot uk
                   ` (5 preceding siblings ...)
  2010-04-20  9:04 ` rguenth at gcc dot gnu dot org
@ 2010-04-20  9:06 ` rguenth at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-04-20  9:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2010-04-20 09:05 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2010-04-20  9:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-19 10:11 [Bug fortran/43796] New: ICE with -fcheck=all mathewc at nag dot co dot uk
2010-04-19 10:56 ` [Bug fortran/43796] " dominiq at lps dot ens dot fr
2010-04-19 11:40 ` [Bug middle-end/43796] [4.5/4.6 Regression] ICE in is_overflow_infinity (tree-vrp.c:184) with gfortran -fcheck=bounds -O2 burnus at gcc dot gnu dot org
2010-04-19 12:26 ` rguenth at gcc dot gnu dot org
2010-04-19 15:17 ` rguenth at gcc dot gnu dot org
2010-04-19 15:21 ` [Bug middle-end/43796] [4.5 " rguenth at gcc dot gnu dot org
2010-04-20  9:04 ` rguenth at gcc dot gnu dot org
2010-04-20  9:06 ` rguenth 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).