From 3a146d46ce1d0977776ab2c1147c707796565ddd Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 17 Aug 2016 21:08:49 +0200 Subject: [PATCH] re PR fortran/67496 (trans-array.c sanitizer runtime error: load of value 124, which is not a valid value for type 'bool') PR fortran/67496 * trans-array.c (trans_array_constructor): Load expr->ts.u.cl->length_from_typespec only if expr->ts.type is BT_CHARACTER. * gfortran.dg/pr67496.f90: New test. From-SVN: r239544 --- gcc/fortran/ChangeLog | 8 +++++++- gcc/fortran/trans-array.c | 3 ++- gcc/testsuite/ChangeLog | 23 ++++++++++++++--------- gcc/testsuite/gfortran.dg/pr67496.f90 | 12 ++++++++++++ 4 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr67496.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index c6d1ff38598..53c17042b7c 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,6 +1,12 @@ +2016-08-17 Jakub Jelinek + + PR fortran/67496 + * trans-array.c (trans_array_constructor): Load + expr->ts.u.cl->length_from_typespec only if expr->ts.type is + BT_CHARACTER. + 2016-08-15 Fritz Reese - gcc/fortran/ * lang.opt, invoke.texi: New flag -finit-derived. * gfortran.h (gfc_build_default_init_expr, gfc_apply_init, gfc_generate_initializer): New prototypes. diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index bd232c28cc3..2699a767dbf 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -2239,7 +2239,8 @@ trans_array_constructor (gfc_ss * ss, locus * where) /* Do bounds-checking here and in gfc_trans_array_ctor_element only if no typespec was given for the array constructor. */ - typespec_chararray_ctor = (expr->ts.u.cl + typespec_chararray_ctor = (expr->ts.type == BT_CHARACTER + && expr->ts.u.cl && expr->ts.u.cl->length_from_typespec); if ((gfc_option.rtcheck & GFC_RTCHECK_BOUNDS) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2c6ed263dca..f1a0fa86c34 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,7 +1,12 @@ +2016-08-17 Jakub Jelinek + + PR fortran/67496 + * gfortran.dg/pr67496.f90: New test. + 2015-08-17 Alan Hayward PR tree-optimization/71752 - * gcc.dg/vect/pr71752.c: New + * gcc.dg/vect/pr71752.c: New. 2016-08-17 Uros Bizjak @@ -489,9 +494,9 @@ 2016-08-08 Martin Sebor PR testsuite/72838 - * gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C: Correct target selector. - * gcc/testsuite/g++.dg/warn/overflow-warn-3.C: Same. - * gcc/testsuite/g++.dg/warn/overflow-warn-4.C: Same. + * g++.dg/cpp0x/constexpr-cast.C: Correct target selector. + * g++.dg/warn/overflow-warn-3.C: Same. + * g++.dg/warn/overflow-warn-4.C: Same. 2016-08-08 Andre Vehreschild @@ -1835,7 +1840,7 @@ 2016-07-05 David Malcolm PR c++/62314 - * gcc/testsuite/g++.dg/parse/error5.C: Update column + * g++.dg/parse/error5.C: Update column number of missing semicolon error. * g++.dg/pr62314-2.C: New test case. @@ -1895,8 +1900,8 @@ 2016-07-04 Yuri Rumyantsev - * gcc/testsuite/gcc.target/i386/avx512f-vect-perm-1.c: New test. - * gcc/testsuite/gcc.target/i386/avx512f-vect-perm-2.c: New test. + * gcc.target/i386/avx512f-vect-perm-1.c: New test. + * gcc.target/i386/avx512f-vect-perm-2.c: New test. 2016-07-04 Ramana Radhakrishnan @@ -2847,7 +2852,7 @@ 2016-06-16 Uros Bizjak PR target/71242 - * testsuite/gcc.dg/torture/float128-nan.c: Also run on ia64-*-*. + * gcc.dg/torture/float128-nan.c: Also run on ia64-*-*. 2016-06-16 Jan Hubicka @@ -3042,7 +3047,7 @@ 2016-06-12 Uros Bizjak PR target/71241 - * testsuite/gcc.dg/torture/float128-nan.c: New test. + * gcc.dg/torture/float128-nan.c: New test. 2016-06-12 Dominique d'Humieres diff --git a/gcc/testsuite/gfortran.dg/pr67496.f90 b/gcc/testsuite/gfortran.dg/pr67496.f90 new file mode 100644 index 00000000000..754310262bd --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr67496.f90 @@ -0,0 +1,12 @@ +! PR fortran/67496 +! { dg-do compile } + + type :: a + end type a + type :: b + type (a) :: j(1) + end type b + type(a) :: x + type(b) :: y + y = b((/x/)) +end -- 2.30.2