From: Paul Brook Date: Wed, 18 Aug 2004 13:08:08 +0000 (+0000) Subject: * trans-types.c (gfc_sym_type): Use pointer types for optional args. X-Git-Tag: releases/gcc-4.0.0~5794 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1619aa6f3e47bcb5f8e88c293a3c716a22288302;p=thirdparty%2Fgcc.git * trans-types.c (gfc_sym_type): Use pointer types for optional args. From-SVN: r86182 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index c6e5cbe191bc..eae37c8c7481 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,7 @@ +2004-08-18 Paul Brook + + * trans-types.c (gfc_sym_type): Use pointer types for optional args. + 2004-08-18 Victor Leikehman PR fortran/13278 diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 85c13fa1a21e..2b4edfc0e279 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -972,7 +972,14 @@ gfc_sym_type (gfc_symbol * sym) See f95_get_function_decl. For dummy function parameters return the function type. */ if (byref) - type = build_reference_type (type); + { + /* We must use pointer types for potentially absent variables. The + optimizers assume a reference type argument is never NULL. */ + if (sym->attr.optional || sym->ns->proc_name->attr.entry_master) + type = build_pointer_type (type); + else + type = build_reference_type (type); + } return (type); }