+2004-05-22 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
+
+ * trans-decl.c (gfc_get_extern_function_decl): Set DECL_IS_PURE
+ only for functions.
+ (gfc_build_function_decl): Likewise.
+
2004-05-22 Steven G. Kargl <kargls@comcast.net>
* check.c (gfc_check_system_clock): New function.
sense. */
if (sym->attr.pure || sym->attr.elemental)
{
- DECL_IS_PURE (fndecl) = 1;
-/* TODO: check if pure/elemental procedures can have INTENT(OUT) parameters.
- TREE_SIDE_EFFECTS (fndecl) = 0;*/
+ if (sym->attr.function)
+ DECL_IS_PURE (fndecl) = 1;
+ /* TODO: check if pure SUBROUTINEs don't have INTENT(OUT)
+ parameters and don't use alternate returns (is this
+ allowed?). In that case, calls to them are meaningless, and
+ can be optimized away. See also in gfc_build_function_decl(). */
+ TREE_SIDE_EFFECTS (fndecl) = 0;
}
sym->backend_decl = fndecl;
sense. */
if (attr.pure || attr.elemental)
{
- DECL_IS_PURE (fndecl) = 1;
+ /* TODO: check if a pure SUBROUTINE has no INTENT(OUT) arguments
+ including a alternate return. In that case it can also be
+ marked as PURE. See also in gfc_get_extern_fucntion_decl(). */
+ if (attr.function)
+ DECL_IS_PURE (fndecl) = 1;
TREE_SIDE_EFFECTS (fndecl) = 0;
}