This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/33636] Rejects valid use of vector subscript in derived type parameter
- From: "fxcoudert at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Oct 2007 11:23:10 -0000
- Subject: [Bug fortran/33636] Rejects valid use of vector subscript in derived type parameter
- References: <bug-33636-10259@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from fxcoudert at gcc dot gnu dot org 2007-10-10 11:23 -------
The problem is that we try simplification in find_array_section() because the
vector subscript is EXPR_ARRAY, which is not necessarily constant (in this
case, the values in the constructor depend on variable i). So, the check for
constantness needs to call gfc_is_constant_expr(), as in the patch below.
(This was hidden on 64-bit machines because there, expressions "i", "i+1" and
"i-1" have to be converted to integer(8), which means the vector subscript
isn't an EXPR_ARRAY but and EXPR_FUNCTION. Thus, we bailed out of the
simplification business.)
Index: expr.c
===================================================================
--- expr.c (revision 129054)
+++ expr.c (working copy)
@@ -1165,7 +1165,7 @@ find_array_section (gfc_expr *expr, gfc_
{
gcc_assert (begin);
- if (begin->expr_type != EXPR_ARRAY)
+ if (begin->expr_type != EXPR_ARRAY || !gfc_is_constant_expr (begin))
{
t = FAILURE;
goto cleanup;
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |fxcoudert at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2007-10-03 12:27:28 |2007-10-10 11:23:10
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33636