This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [gfortran] Fix PR 18111: set DECL_ARTIFICAL on function resultparameters
- From: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- To: GCC Fortran mailing list <fortran at gcc dot gnu dot org>
- Cc: patch <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 26 Oct 2004 19:28:35 +0200
- Subject: Re: [gfortran] Fix PR 18111: set DECL_ARTIFICAL on function resultparameters
- References: <417AB3BA.5090401@physik.uni-muenchen.de>
Tobias Schlüter wrote:
> PR 18111 is a case where the hidden function argument .__result is not set,
> and a warning is emitted about this when the compiler is run with -Wunused.
> This patch sets DECL_ARTIFICIAL on this and the accompanying __result, which
> fixes the warning.
This is an updated patch which also deals with cases where the hidden string
length parameter is not used (i.e. when the character length is fixed).
Built and tested, ok?
- Tobi
2004-10-23 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/18111
* trans-decl.c (create_function_arglist): Set DECL_ARTIFICIAL for
hidden parameters.
Index: trans-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/trans-decl.c,v
retrieving revision 1.46
diff -u -p -r1.46 trans-decl.c
--- trans-decl.c 13 Oct 2004 22:37:12 -0000 1.46
+++ trans-decl.c 26 Oct 2004 17:23:38 -0000
@@ -1135,6 +1135,7 @@ create_function_arglist (gfc_symbol * sy
DECL_CONTEXT (parm) = fndecl;
DECL_ARG_TYPE (parm) = type;
TREE_READONLY (parm) = 1;
+ DECL_ARTIFICIAL (parm) = 1;
gfc_finish_decl (parm, NULL_TREE);
arglist = chainon (arglist, parm);
@@ -1162,6 +1163,7 @@ create_function_arglist (gfc_symbol * sy
DECL_CONTEXT (length) = fndecl;
DECL_ARG_TYPE (length) = type;
TREE_READONLY (length) = 1;
+ DECL_ARTIFICIAL (length) = 1;
gfc_finish_decl (length, NULL_TREE);
}
}
@@ -1216,6 +1218,7 @@ create_function_arglist (gfc_symbol * sy
arglist = chainon (arglist, length);
DECL_CONTEXT (length) = fndecl;
+ DECL_ARTIFICIAL (length) = 1;
DECL_ARG_TYPE (length) = type;
TREE_READONLY (length) = 1;
gfc_finish_decl (length, NULL_TREE);