[gfortran] Fix PR15140: Bogus assertion
Tobias Schlüter
tobias.schlueter@physik.uni-muenchen.de
Thu Jul 15 18:11:00 GMT 2004
In PR 15140 we would hit this assertion in gfc_trans_deferred_vars():
case AS_ASSUMED_SIZE:
/* Must be a dummy parameter. */
assert (sym->attr.dummy);
/* We should always pass assumed size arrays the g77 way. */
assert (TREE_CODE (sym->backend_decl) == PARM_DECL);
fnbody = gfc_trans_g77_array (sym, fnbody);
break;
This assertion is bogus because of the special case outlined in front of
gfc_build_dummy_array_decl:
/* For some dummy arguments we don't use the actual argument directly.
Instead we create a local decl and use that. This allows us to preform
initialization, and construct full type information. */
In that case sym->backend_decl is a VAR_DECL, not a PARM_DECL, and this
is the problem in PR15140. Removing the assertion lets the compiler
continue and generate working code, as I verified, both by looking at
the tree dumps, and by running testcases.
Built and tested on i686-pc-linux. Attached is a testcase that I will
add to the testsuite.
- Tobi
Index: trans-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/trans-decl.c,v
retrieving revision 1.22
diff -u -p -r1.22 trans-decl.c
--- trans-decl.c 12 Jul 2004 01:23:36 -0000 1.22
+++ trans-decl.c 15 Jul 2004 18:01:53 -0000
@@ -1710,7 +1730,6 @@ gfc_trans_deferred_vars (gfc_symbol * pr
assert (sym->attr.dummy);
/* We should always pass assumed size arrays the g77 way. */
- assert (TREE_CODE (sym->backend_decl) == PARM_DECL);
fnbody = gfc_trans_g77_array (sym, fnbody);
break;
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pr15140.f90
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20040715/5fe20927/attachment.f90>
More information about the Fortran
mailing list