Commit 0df50e7a by Francois-Xavier Coudert Committed by François-Xavier Coudert

re PR fortran/34083 (internal compiler error: in…

re PR fortran/34083 (internal compiler error: in gfc_conv_array_constructor_expr, at fortran/trans-expr.c:2819)

	PR fortran/34083

	* resolve.c (resolve_structure_cons): Also check for zero rank.

	* gfortran.dg/derived_constructor_comps_2.f90: Add check.

From-SVN: r130332
parent c60cd1dc
2007-11-21 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/34083
* resolve.c (resolve_structure_cons): Also check for zero rank.
2007-11-19 Jerry DeLisle <jvdelisle@gcc.gnu.org> 2007-11-19 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/33317 PR fortran/33317
......
...@@ -742,6 +742,8 @@ resolve_structure_cons (gfc_expr *expr) ...@@ -742,6 +742,8 @@ resolve_structure_cons (gfc_expr *expr)
for (; comp; comp = comp->next, cons = cons->next) for (; comp; comp = comp->next, cons = cons->next)
{ {
int rank;
if (!cons->expr) if (!cons->expr)
continue; continue;
...@@ -751,14 +753,14 @@ resolve_structure_cons (gfc_expr *expr) ...@@ -751,14 +753,14 @@ resolve_structure_cons (gfc_expr *expr)
continue; continue;
} }
if (cons->expr->expr_type != EXPR_NULL rank = comp->as ? comp->as->rank : 0;
&& comp->as && comp->as->rank != cons->expr->rank if (cons->expr->expr_type != EXPR_NULL && rank != cons->expr->rank
&& (comp->allocatable || cons->expr->rank)) && (comp->allocatable || cons->expr->rank))
{ {
gfc_error ("The rank of the element in the derived type " gfc_error ("The rank of the element in the derived type "
"constructor at %L does not match that of the " "constructor at %L does not match that of the "
"component (%d/%d)", &cons->expr->where, "component (%d/%d)", &cons->expr->where,
cons->expr->rank, comp->as ? comp->as->rank : 0); cons->expr->rank, rank);
t = FAILURE; t = FAILURE;
} }
......
2007-11-21 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/34083
* gfortran.dg/derived_constructor_comps_2.f90: Add check.
2007-11-20 Richard Guenther <rguenther@suse.de> 2007-11-20 Richard Guenther <rguenther@suse.de>
PR middle-end/34154 PR middle-end/34154
...@@ -13,3 +13,15 @@ ...@@ -13,3 +13,15 @@
marge = homer (duff_beer) ! { dg-error "should be a POINTER or a TARGET" } marge = homer (duff_beer) ! { dg-error "should be a POINTER or a TARGET" }
end end
!
! The following yield an ICE, see PR 34083
!
subroutine foo
type ByteType
character(len=1) :: singleByte
end type
type (ByteType) :: bytes(4)
print *, size(bytes)
bytes = ByteType((/'H', 'i', '!', ' '/)) ! { dg-error "rank of the element in the derived type constructor" }
end subroutine foo
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment