aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans.h
diff options
context:
space:
mode:
authorMikael Morin <mikael@gcc.gnu.org>2012-01-04 14:04:24 +0000
committerMikael Morin <mikael@gcc.gnu.org>2012-01-04 14:04:24 +0000
commit0192ef204cbc1b80a1da59dae7b275cb7de67c81 (patch)
tree35ecccc993dae3c75c7845b088145f81382da192 /gcc/fortran/trans.h
parent591823cc9aba6f6943f7204df365bf2f0ca593ca (diff)
downloadgcc-0192ef204cbc1b80a1da59dae7b275cb7de67c81.zip
gcc-0192ef204cbc1b80a1da59dae7b275cb7de67c81.tar.gz
gcc-0192ef204cbc1b80a1da59dae7b275cb7de67c81.tar.bz2
re PR fortran/50981 ([OOP] Wrong-code for scalarizing ELEMENTAL call with absent OPTIONAL argument)
PR fortran/50981 * trans.h (struct gfc_ss_info): New field data::scalar::can_be_null_ref * trans-array.c: If the reference can be NULL, save the reference instead of the value. * trans-expr.c (gfc_conv_expr): If we have saved a reference, dereference it. From-SVN: r182874
Diffstat (limited to 'gcc/fortran/trans.h')
-rw-r--r--gcc/fortran/trans.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h
index 259a08a..61a4817 100644
--- a/gcc/fortran/trans.h
+++ b/gcc/fortran/trans.h
@@ -145,8 +145,9 @@ typedef enum
GFC_SS_SCALAR,
/* Like GFC_SS_SCALAR it evaluates the expression outside the
- loop. Is always evaluated as a reference to the temporary.
- Used for elemental function arguments. */
+ loop. Is always evaluated as a reference to the temporary, unless
+ temporary evaluation can result in a NULL pointer dereferencing (case of
+ optional arguments). Used for elemental function arguments. */
GFC_SS_REFERENCE,
/* An array section. Scalarization indices will be substituted during
@@ -196,6 +197,9 @@ typedef struct gfc_ss_info
struct
{
tree value;
+ /* Tells whether the reference can be null in the GFC_SS_REFERENCE case.
+ Used to handle elemental procedures' optional arguments. */
+ bool can_be_null_ref;
}
scalar;