aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2012-01-25 07:59:21 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2012-01-25 07:59:21 +0100
commit083dd940dcb2169786fbd523059e8c7f41093812 (patch)
tree8adc73a26009f770be87bc669b8215fa124f5621
parentd2bb8192ee35dfe3388c8cad3fc8b66a94c676d0 (diff)
downloadgcc-083dd940dcb2169786fbd523059e8c7f41093812.zip
gcc-083dd940dcb2169786fbd523059e8c7f41093812.tar.gz
gcc-083dd940dcb2169786fbd523059e8c7f41093812.tar.bz2
re PR fortran/51966 (ICE in gfc_conv_array_constructor_expr)
2012-01-24 Tobias Burnus <burnus@net-b.de> PR fortran/51966 * resolve.c (resolve_structure_cons): Only create an array constructors for nonscalars. 2012-01-24 Tobias Burnus <burnus@net-b.de> PR fortran/51966 * gfortran.dg/derived_constructor_char_3.f90: New. From-SVN: r183510
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/resolve.c1
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/derived_constructor_char_3.f9030
4 files changed, 42 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 2d1e700..70bd5ee 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2012-01-24 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/51966
+ * resolve.c (resolve_structure_cons): Only create an
+ array constructors for nonscalars.
+
2012-01-23 Tobias Burnus <burnus@net-b.de>
PR fortran/51948
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index c169b9e..b24399d 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -1051,6 +1051,7 @@ resolve_structure_cons (gfc_expr *expr, int init)
&& comp->ts.u.cl->length->expr_type == EXPR_CONSTANT
&& cons->expr->ts.u.cl && cons->expr->ts.u.cl->length
&& cons->expr->ts.u.cl->length->expr_type == EXPR_CONSTANT
+ && cons->expr->rank != 0
&& mpz_cmp (cons->expr->ts.u.cl->length->value.integer,
comp->ts.u.cl->length->value.integer) != 0)
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9f56773..1e7e0e6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-01-24 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/51966
+ * gfortran.dg/derived_constructor_char_3.f90: New.
+
2012-01-24 Ian Lance Taylor <iant@google.com>
* go.test/go-test.exp (filecmp): New procedure.
diff --git a/gcc/testsuite/gfortran.dg/derived_constructor_char_3.f90 b/gcc/testsuite/gfortran.dg/derived_constructor_char_3.f90
new file mode 100644
index 0000000..e238785
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/derived_constructor_char_3.f90
@@ -0,0 +1,30 @@
+! { dg-do compile }
+!
+! PR fortran/51966
+!
+! Contributed by Peter Wind
+!
+
+ type :: Deriv
+ character(len=10) :: name
+ end type
+ character(len=8), dimension(2), parameter :: &
+ DEF_ECOSYSTEMS = (/ "Gridxxxx", "StringYY" /)
+
+ type(Deriv), save :: DepEcoSystem = Deriv(DEF_ECOSYSTEMS(1))
+
+ if (DepEcoSystem%name /= "Gridxxxx" &
+ .or. DepEcoSystem%name(9:9) /= ' ' &
+ .or. DepEcoSystem%name(10:10) /= ' ') call abort()
+ DepEcoSystem%name = 'ABCDEFGHIJ'
+ call Init_EcoSystems()
+ if (DepEcoSystem%name /= "StringYY" &
+ .or. DepEcoSystem%name(9:9) /= ' ' &
+ .or. DepEcoSystem%name(10:10) /= ' ') call abort()
+
+contains
+ subroutine Init_EcoSystems()
+ integer :: i =2
+ DepEcoSystem = Deriv(DEF_ECOSYSTEMS(i))
+ end subroutine Init_EcoSystems
+end