This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/32682] [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664
- From: "pault at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Jul 2007 22:40:38 -0000
- Subject: [Bug fortran/32682] [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664
- References: <bug-32682-14773@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from pault at gcc dot gnu dot org 2007-07-09 22:40 -------
(In reply to comment #2)
Whilst I agree that this is a regession, it is so because an underlying bug is
exposed - in other words, r124541 is perfectly correct.
The following also fails:
program matrix
implicit none
real,dimension(2,2),parameter::c=reshape((/1,2,3,4/),(/2,2/))
real,dimension(2,2)::m
m=f()+c
m=c+f()
call sub(m+f())
call sub(c+m)
call sub(f()+c)
call sub(c+f())
contains
function f()
implicit none
real, dimension(2,2)::f
f=0
end function f
subroutine sub(a)
implicit none
real, dimension(2,2)::a
print *, a
end subroutine sub
end program matrix
which was not affected by the above patch.
This fixes both versions of the bug:
Index: gcc/fortran/trans-array.c
===================================================================
*** gcc/fortran/trans-array.c (revision 126461)
--- gcc/fortran/trans-array.c (working copy)
*************** gfc_trans_array_constructor (gfc_loopinf
*** 1656,1661 ****
--- 1656,1673 ----
/* See if the constructor determines the loop bounds. */
dynamic = false;
+
+ if (ss->expr->shape && loop->to[0] == NULL_TREE)
+ {
+ int n;
+ for (n = 0; n < ss->expr->rank; n++)
+ {
+ loop->to[n] = gfc_conv_mpz_to_tree (ss->expr->shape [n],
+ gfc_index_integer_kind);
+ loop->from[n] = gfc_index_zero_node;
+ }
+ }
+
if (loop->to[0] == NULL_TREE)
{
mpz_t size;
Paul
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pault at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2007-07-09 06:01:16 |2007-07-09 22:40:38
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32682