]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/68560 (The test gfortran.dg/shape_8.f90 now fails when compiled with...
authorThomas Koenig <tkoenig@gcc.gnu.org>
Mon, 12 Feb 2018 20:27:11 +0000 (20:27 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Mon, 12 Feb 2018 20:27:11 +0000 (20:27 +0000)
2018-02-12  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/68560
* trans-intrinsic.c (gfc_conv_intrinsic_shape): New function.
(gfc_conv_intrinsic_function): Call it.

2018-02-12  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/68560
* gfortran.dg/shape_9.f90: New test.

From-SVN: r257603

gcc/fortran/ChangeLog
gcc/fortran/trans-intrinsic.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/shape_9.f90 [new file with mode: 0644]

index 66ebb310265df9c328b8547c120475b5dd3c8f12..486b7d41394d917c067a52db64282c1dabaa1a01 100644 (file)
@@ -1,3 +1,8 @@
+2018-02-12  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/68560
+       * gfortran.dg/shape_9.f90: New test.
+
 2018-02-12  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
        PR fortran/35299
index fea26d15d0fc876e939d0362ba85df8d7e96e041..e0ecc3d902d6517c33bff9963d793bf005f74df5 100644 (file)
@@ -4692,6 +4692,22 @@ gfc_conv_intrinsic_ibits (gfc_se * se, gfc_expr * expr)
   se->expr = fold_build2_loc (input_location, BIT_AND_EXPR, type, tmp, mask);
 }
 
+static void
+gfc_conv_intrinsic_shape (gfc_se *se, gfc_expr *expr)
+{
+  gfc_actual_arglist *s, *k;
+  gfc_expr *e;
+
+  /* Remove the KIND argument, if present. */
+  s = expr->value.function.actual;
+  k = s->next;
+  e = k->expr;
+  gfc_free_expr (e);
+  k->expr = NULL;
+
+  gfc_conv_intrinsic_funcall (se, expr);
+}
+
 static void
 gfc_conv_intrinsic_shift (gfc_se * se, gfc_expr * expr, bool right_shift,
                          bool arithmetic)
@@ -7753,6 +7769,10 @@ gfc_conv_intrinsic_function (gfc_se * se, gfc_expr * expr)
              conv_generic_with_optional_char_arg (se, expr, 1, 3);
              break;
 
+           case GFC_ISYM_SHAPE:
+             gfc_conv_intrinsic_shape (se, expr);
+             break;
+
            default:
              gfc_conv_intrinsic_funcall (se, expr);
              break;
index cb53750fd61b087336e715cab0698b418f5b6fe9..aba0918751cd37945c4a6aff7c27f6a197158eff 100644 (file)
@@ -1,3 +1,8 @@
+2018-02-12  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/68560
+       * gfortran.dg/shape_9.f90: New test.
+
 2018-02-12  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
        PR fortran/35299
diff --git a/gcc/testsuite/gfortran.dg/shape_9.f90 b/gcc/testsuite/gfortran.dg/shape_9.f90
new file mode 100644 (file)
index 0000000..6d33f97
--- /dev/null
@@ -0,0 +1,16 @@
+! { dg-do  run }
+! { dg-require-effective-target lto }
+! { dg-options "-flto" }
+! Check that there are no warnings with LTO for a KIND argument.
+!
+program test
+   implicit none
+   real, allocatable :: x(:,:)
+
+   allocate(x(2,5))
+   if (any(shape(x) /= [ 2, 5 ])) call abort
+   if (any(shape(x,kind=1) /= [ 2, 5 ])) call abort
+   if (any(shape(x,kind=2) /= [ 2, 5 ])) call abort
+   if (any(shape(x,kind=4) /= [ 2, 5 ])) call abort
+   if (any(shape(x,kind=8) /= [ 2, 5 ])) call abort
+ end program test