aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2016-10-27 03:08:13 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2016-10-27 03:08:13 +0000
commitfe14572b1ae8dc408645a0c4ce1d043d44acece6 (patch)
treed6a0715dfb2350c08461e2362777f5bd529fc257
parent145f20675b26a0141f3ac2d0dc25290d016c0fc5 (diff)
downloadgcc-fe14572b1ae8dc408645a0c4ce1d043d44acece6.zip
gcc-fe14572b1ae8dc408645a0c4ce1d043d44acece6.tar.gz
gcc-fe14572b1ae8dc408645a0c4ce1d043d44acece6.tar.bz2
re PR fortran/78092 (ICE when calling SIZEOF on CLASS(*) entry)
2016-10-26 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/78092 * trans-intrinsic.c (gfc_conv_intrinsic_sizeof): Fix reference to an array element of type CLASS. 2016-10-26 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/78092 * gfortran.dg/pr78092.f90: New test. From-SVN: r241610
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/trans-intrinsic.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/pr78092.f9021
4 files changed, 35 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index bae08b8..a4bfb0a 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2016-10-26 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/78092
+ * trans-intrinsic.c (gfc_conv_intrinsic_sizeof): Fix reference to an
+ array element of type CLASS.
+
2016-10-26 Paul Thomas <pault@gcc.gnu.org>
PR fortran/78108
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 2911d64..463bb58 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -6708,7 +6708,9 @@ gfc_conv_intrinsic_sizeof (gfc_se *se, gfc_expr *expr)
TREE_OPERAND (argse.expr, 0), 0)))
|| GFC_DECL_CLASS (TREE_OPERAND (argse.expr, 0)))))
byte_size = gfc_class_vtab_size_get (TREE_OPERAND (argse.expr, 0));
- else if (arg->rank > 0)
+ else if (arg->rank > 0
+ || (arg->rank == 0
+ && arg->ref && arg->ref->type == REF_COMPONENT))
/* The scalarizer added an additional temp. To get the class' vptr
one has to look at the original backend_decl. */
byte_size = gfc_class_vtab_size_get (
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8e3e49f..ac9901b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-10-26 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/78092
+ * gfortran.dg/pr78092.f90: New test.
+
2016-10-26 Kelvin Nilsen <kelvin@gcc.gnu.org>
PR target/78056
diff --git a/gcc/testsuite/gfortran.dg/pr78092.f90 b/gcc/testsuite/gfortran.dg/pr78092.f90
new file mode 100644
index 0000000..ba615d1
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr78092.f90
@@ -0,0 +1,21 @@
+! { dg-do run }
+program test_stuff
+
+ implicit none
+
+ integer :: ivar1(2,3), ivar2
+
+ ivar1 = 6
+ call poly_sizeof(ivar1, ivar2)
+
+ if (ivar2 /= 4) call abort
+
+ contains
+
+ subroutine poly_sizeof(arg1,arg2)
+ class(*), intent(in) :: arg1(:,:)
+ integer, intent(out) :: arg2
+ arg2 = sizeof(arg1(1,1))
+ end subroutine
+
+end program test_stuff