[PATCH] Emit Fortran PARAMETERs as DW_TAG_constant into debuginfo

Eric Botcazou ebotcazou@adacore.com
Tue Sep 2 17:28:00 GMT 2008


> BTW, in the backport of the native_encode_initializer patch to 4.3 branch
> Ada passed a type in DECL_INITIALIZER, the committed patch will avoid
> it because of the inializer_constant_valid_p test I've added, but having
> type in DECL_INITIALIZER seems terribly broken to me and surprises me
> other code doesn't break on it.
> In particular it was a PARM_DECL, which had
> TREE_TYPE (parm) == DECL_INITIALIZER (parm)
> && TREE_CODE (TREE_TYPE (parm)) == RECORD_TYPE.

/* For a PARM_DECL, records the data type used to pass the argument,
   which may be different from the type seen in the program.  */
#define DECL_ARG_TYPE(NODE) (PARM_DECL_CHECK (NODE)->decl_common.initial)

Excerpt from c-decl.c:store_parm_decls_oldstyle

	      if (TYPE_MAIN_VARIANT (TREE_TYPE (parm))
		  == TYPE_MAIN_VARIANT (TREE_VALUE (type)))
		{
		  /* Adjust argument to match prototype.  E.g. a previous
		     `int foo(float);' prototype causes
		     `int foo(x) float x; {...}' to be treated like
		     `int foo(float x) {...}'.  This is particularly
		     useful for argument types like uid_t.  */
		  DECL_ARG_TYPE (parm) = TREE_TYPE (parm);

Ada does exactly the same as C.

-- 
Eric Botcazou



More information about the Fortran mailing list