------- Comment #2 from mikael at gcc dot gnu dot org 2009-09-09 20:41 -------
(In reply to comment #1)
> Thus the question is: Why is the last expr == NULL and not EXPR_VARIABLE of
> flavour FL_PARAMETER?
gfc_match_rvalue replaces parameters with their values:
case FL_PARAMETER:
/* A statement of the form "REAL, parameter :: a(0:10) = 1" will
end up here. Unfortunately, sym->value->expr_type is set to
EXPR_CONSTANT, and so the if () branch would be followed without
the !sym->as check. */
if (sym->value && sym->value->expr_type != EXPR_ARRAY && !sym->as)
e = gfc_copy_expr (sym->value);
Then why is the value a NULL expr?
Because that's how we recognise c_null(_fun)?_ptr at resolution time.
See the comment in gen_special_c_interop_ptr:
/* Create a constructor with no expr, that way we can recognize if the user
tries to call the structure constructor for one of the iso_c_binding
derived types during resolution (resolve_structure_cons). */
tmp_sym->value->value.constructor = gfc_get_constructor ();
So, it's a feature ;)
Tried a bit, but no idea how to fix it.
--
mikael at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-09-09 20:41:34
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41298