public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/50130] New: ICE with invalid array slice
@ 2011-08-19 18:15 Joost.VandeVondele at pci dot uzh.ch
  2011-08-19 19:28 ` [Bug fortran/50130] [4.6/4.7 Regression] " dominiq at lps dot ens.fr
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Joost.VandeVondele at pci dot uzh.ch @ 2011-08-19 18:15 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50130
           Summary: ICE with invalid array slice
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: Joost.VandeVondele@pci.uzh.ch


The following triggers an ICE

integer, parameter :: a(10)=0
integer, parameter :: b(10)=a(1:10:0)
END


f951: internal compiler error: Floating point exception
Please submit a full bug report,


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

* [Bug fortran/50130] [4.6/4.7 Regression] ICE with invalid array slice
  2011-08-19 18:15 [Bug fortran/50130] New: ICE with invalid array slice Joost.VandeVondele at pci dot uzh.ch
@ 2011-08-19 19:28 ` dominiq at lps dot ens.fr
  2011-08-19 20:23 ` kargl at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens.fr @ 2011-08-19 19:28 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-08-19
            Summary|ICE with invalid array      |[4.6/4.7 Regression] ICE
                   |slice                       |with invalid array slice
     Ever Confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2011-08-19 18:29:25 UTC ---
Confirmed with the same range of versions (4.4, 4.5, and early 4.6) giving

pr50130.f90:2.30:

integer, parameter :: b(10)=a(1:10:0)
                              1
Error: Illegal stride of zero at (1)

and versions (late 4.6 and trunk) giving the floating point exception as for
pr50129.


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

* [Bug fortran/50130] [4.6/4.7 Regression] ICE with invalid array slice
  2011-08-19 18:15 [Bug fortran/50130] New: ICE with invalid array slice Joost.VandeVondele at pci dot uzh.ch
  2011-08-19 19:28 ` [Bug fortran/50130] [4.6/4.7 Regression] " dominiq at lps dot ens.fr
@ 2011-08-19 20:23 ` kargl at gcc dot gnu.org
  2011-08-19 21:27 ` burnus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: kargl at gcc dot gnu.org @ 2011-08-19 20:23 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #2 from kargl at gcc dot gnu.org 2011-08-19 19:43:13 UTC ---
(gdb) bt
#0  0x48c9efc5 in __gmp_exception () from /usr/local/lib/libgmp.so.10
#1  0x48c9effe in __gmp_divide_by_zero () from /usr/local/lib/libgmp.so.10
#2  0x48cb5120 in __gmpz_tdiv_qr () from /usr/local/lib/libgmp.so.10
#3  0x48cab4c7 in __gmpz_fdiv_q () from /usr/local/lib/libgmp.so.10
#4  0x080bf989 in gfc_ref_dimen_size (ar=0x0, dimen=1221515100, 
    result=0xbfbfdf90, end=0xbfbfdf84) at ../../gcc4x/gcc/fortran/array.c:2047
#5  0x08131db8 in resolve_ref (expr=0x49091710)
    at ../../gcc4x/gcc/fortran/resolve.c:4576
#6  0x08132523 in resolve_variable (e=0x49091710)
    at ../../gcc4x/gcc/fortran/resolve.c:5007
#7  0x0812d018 in gfc_resolve_expr (e=0x49091710)
    at ../../gcc4x/gcc/fortran/resolve.c:6107
#8  0x080e5739 in gfc_reduce_init_expr (expr=0x49091710)
    at ../../gcc4x/gcc/fortran/expr.c:2609
#9  0x080e57e1 in gfc_match_init_expr (result=0xbfbfe254)
    at ../../gcc4x/gcc/fortran/expr.c:2650
#10 0x080d7ca4 in gfc_match_data_decl () at ../../gcc4x/gcc/fortran/decl.c:1997
#11 0x0811b637 in match_word (str=0xa <Address 0xa out of bounds>, 
    subr=0x80d72a0 <gfc_match_data_decl>, old_locus=0xbfbfe2c0)
    at ../../gcc4x/gcc/fortran/parse.c:65
#12 0x0811bd11 in decode_statement () at ../../gcc4x/gcc/fortran/parse.c:283
#13 0x0811cf49 in next_statement () at ../../gcc4x/gcc/fortran/parse.c:724
#14 0x0811dffd in parse_spec (st=ST_DATA_DECL)
    at ../../gcc4x/gcc/fortran/parse.c:2576
#15 0x0811eecc in parse_progunit (st=ST_COMMON)


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

* [Bug fortran/50130] [4.6/4.7 Regression] ICE with invalid array slice
  2011-08-19 18:15 [Bug fortran/50130] New: ICE with invalid array slice Joost.VandeVondele at pci dot uzh.ch
  2011-08-19 19:28 ` [Bug fortran/50130] [4.6/4.7 Regression] " dominiq at lps dot ens.fr
  2011-08-19 20:23 ` kargl at gcc dot gnu.org
@ 2011-08-19 21:27 ` burnus at gcc dot gnu.org
  2011-08-21 11:55 ` tkoenig at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-08-19 21:27 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |tkoenig at gcc dot gnu.org
   Target Milestone|---                         |4.6.2

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-08-19 21:19:50 UTC ---
Working: GCC 4.6-trunk 2010-07-16-r162255
Failing: GCC 4.6-trunk 2010-08-28-r163612

array.c's gfc_ref_dimen_size contains:

      mpz_div (*result, *result, stride);
      /* Zero stride caught earlier.  */

The comment is correct: The ICE comes already one line earlier ...

Seemingly caused by Rev. 163041:
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163041
    2010-08-09  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR fortran/44235
        * array.c (gfc_ref_dimen_size):  Add end argument.
        If end is non-NULL, calculate it.
        (ref_size):  Adjust call to gfc_ref_dimen_size.
        (gfc_array_dimen_size):  Likewise.
        (gfc_array_res_shape):  Likewise.
        * gfortran.h:  Adjust prototype for gfc_ref_dimen_size.
        * resolve.c (resolve_array_ref):  For stride not equal to -1,
        fill in the lowest possible end.


The problem seems to be the following in resolve_array_ref:

      /* Fill in the upper bound, which may be lower than the
         specified one for something like a(2:10:5), which is
         identical to a(2:7:5).  Only relevant for strides not equal
         to one.  */
      [...]
          if (gfc_ref_dimen_size (ar, i, &size, &end) == SUCCESS)
[...]
  if (!ar->as->cray_pointee && compare_spec_to_ref (ar) == FAILURE)

In the call to gfc_ref_dimen_size one has the division by zero.

With the call to compare_spec_to_ref one reaches via check_dimension the
"Illegal stride of zero" check, which obviously comes too late.


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

* [Bug fortran/50130] [4.6/4.7 Regression] ICE with invalid array slice
  2011-08-19 18:15 [Bug fortran/50130] New: ICE with invalid array slice Joost.VandeVondele at pci dot uzh.ch
                   ` (2 preceding siblings ...)
  2011-08-19 21:27 ` burnus at gcc dot gnu.org
@ 2011-08-21 11:55 ` tkoenig at gcc dot gnu.org
  2011-08-21 14:38 ` tkoenig at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2011-08-21 11:55 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |tkoenig at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #4 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-08-21 11:37:45 UTC ---
This one should be easy enough.


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

* [Bug fortran/50130] [4.6/4.7 Regression] ICE with invalid array slice
  2011-08-19 18:15 [Bug fortran/50130] New: ICE with invalid array slice Joost.VandeVondele at pci dot uzh.ch
                   ` (3 preceding siblings ...)
  2011-08-21 11:55 ` tkoenig at gcc dot gnu.org
@ 2011-08-21 14:38 ` tkoenig at gcc dot gnu.org
  2011-08-22 15:13 ` tkoenig at gcc dot gnu.org
  2011-08-22 15:19 ` tkoenig at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2011-08-21 14:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-08-21 12:02:16 UTC ---
Author: tkoenig
Date: Sun Aug 21 12:02:12 2011
New Revision: 177940

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=177940
Log:
2011-08-21  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/50130
    * resolve.c (resolve_array_ref):  Don't calculate upper bound
    if the stride is zero.

2011-08-21  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/50130
    * gfortran.dg/zero_stride_1.f90:  New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/zero_stride_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/50130] [4.6/4.7 Regression] ICE with invalid array slice
  2011-08-19 18:15 [Bug fortran/50130] New: ICE with invalid array slice Joost.VandeVondele at pci dot uzh.ch
                   ` (4 preceding siblings ...)
  2011-08-21 14:38 ` tkoenig at gcc dot gnu.org
@ 2011-08-22 15:13 ` tkoenig at gcc dot gnu.org
  2011-08-22 15:19 ` tkoenig at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2011-08-22 15:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-08-22 15:12:09 UTC ---
Author: tkoenig
Date: Mon Aug 22 15:12:04 2011
New Revision: 177961

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=177961
Log:
2011-08-22  Thomas Koenig  <tkoenig@gcc.gnu.org>

    Backport from trunk
    PR fortran/50130
    * resolve.c (resolve_array_ref):  Don't calculate upper bound
    if the stride is zero.

2011-08-22  Thomas Koenig  <tkoenig@gcc.gnu.org>

    Backport from trunk
    PR fortran/50130
    * gfortran.dg/zero_stride_1.f90:  New test.


Added:
    branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/zero_stride_1.f90
Modified:
    branches/gcc-4_6-branch/gcc/fortran/ChangeLog
    branches/gcc-4_6-branch/gcc/fortran/resolve.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


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

* [Bug fortran/50130] [4.6/4.7 Regression] ICE with invalid array slice
  2011-08-19 18:15 [Bug fortran/50130] New: ICE with invalid array slice Joost.VandeVondele at pci dot uzh.ch
                   ` (5 preceding siblings ...)
  2011-08-22 15:13 ` tkoenig at gcc dot gnu.org
@ 2011-08-22 15:19 ` tkoenig at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2011-08-22 15:19 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

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

--- Comment #7 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-08-22 15:13:52 UTC ---
Fixed everywhere.

Closing.


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

end of thread, other threads:[~2011-08-22 15:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-19 18:15 [Bug fortran/50130] New: ICE with invalid array slice Joost.VandeVondele at pci dot uzh.ch
2011-08-19 19:28 ` [Bug fortran/50130] [4.6/4.7 Regression] " dominiq at lps dot ens.fr
2011-08-19 20:23 ` kargl at gcc dot gnu.org
2011-08-19 21:27 ` burnus at gcc dot gnu.org
2011-08-21 11:55 ` tkoenig at gcc dot gnu.org
2011-08-21 14:38 ` tkoenig at gcc dot gnu.org
2011-08-22 15:13 ` tkoenig at gcc dot gnu.org
2011-08-22 15:19 ` tkoenig at gcc dot gnu.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).