]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/38859 (ubound and lbound treat structure component references as whole...
authorMikael Morin <mikael.morin@tele2.fr>
Mon, 19 Jan 2009 22:19:34 +0000 (23:19 +0100)
committerMikael Morin <mikael@gcc.gnu.org>
Mon, 19 Jan 2009 22:19:34 +0000 (22:19 +0000)
2009-01-19  Mikael Morin  <mikael.morin@tele2.fr>

PR fortran/38859
* simplify.c (simplify_bound): Don't use array specification
if variable or component has subsequent references.

2009-01-19  Mikael Morin  <mikael.morin@tele2.fr>

PR fortran/38859
* gfortran.dg/bound_5.f90: New test.

From-SVN: r143501

gcc/fortran/ChangeLog
gcc/fortran/simplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/bound_5.f90 [new file with mode: 0644]

index a5244ab70c672eb5f857768e825afde2625fe01b..2f33c655d96f4992ca482eba9ac87309637a0075 100644 (file)
@@ -1,3 +1,9 @@
+2009-01-19  Mikael Morin  <mikael.morin@tele2.fr>
+
+       PR fortran/38859
+       * simplify.c (simplify_bound): Don't use array specification
+       if variable or component has subsequent references.
+
 2009-01-17  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/38657
index 90c91ae4e85b5817150ceca96935365a08a9f412..c460f312db271bf547ddd03588fc622f4fc11c4d 100644 (file)
@@ -2253,7 +2253,10 @@ simplify_bound (gfc_expr *array, gfc_expr *dim, gfc_expr *kind, int upper)
            case AR_FULL:
              /* We're done because 'as' has already been set in the
                 previous iteration.  */
-             goto done;
+             if (!ref->next)
+               goto done;
+
+           /* Fall through.  */
 
            case AR_SECTION:
            case AR_UNKNOWN:
index 8f42d58e6c6c675f8d4dcf2ae7fb0029ea8294fc..bbe897580dde30e65bf9470bda98c6cebd67d5d8 100644 (file)
@@ -1,3 +1,8 @@
+2009-01-19  Mikael Morin  <mikael.morin@tele2.fr>
+
+       PR fortran/38859
+       * gfortran.dg/bound_5.f90: New test.
+
 2009-01-18  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/38736
diff --git a/gcc/testsuite/gfortran.dg/bound_5.f90 b/gcc/testsuite/gfortran.dg/bound_5.f90
new file mode 100644 (file)
index 0000000..04245d6
--- /dev/null
@@ -0,0 +1,26 @@
+! { dg-do run }
+!
+! PR fortran/38859
+! Wrong bounds simplification
+!
+! Contributed by Dick Hendrickson <dick.hendrickson@gmail.com>
+
+       type x
+         integer I
+       end type x
+       type (x) A(0:5, 2:8)
+       integer ida(2)
+
+       ida = lbound(a)
+       if (any(ida /= (/0,2/))) call abort
+
+       ida = lbound(a%i)
+       if (any(ida /= (/1,1/))) call abort
+
+       ida = ubound(a)
+       if (any(ida /= (/5,8/))) call abort
+       
+       ida = ubound(a%i)
+       if (any(ida /= (/6,7/))) call abort
+
+       end