aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>2008-02-28 15:42:21 +0000
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2008-02-28 15:42:21 +0000
commit43e7fd21ac4980fc31c40e76abf3223e2be167f1 (patch)
treea13a53820b1a4fc0ec96de75d9fa6c175f09961a /gcc/fortran
parentcbfb21c1c1e1b9d012f4d67838a88a94b5fb5e24 (diff)
downloadgcc-43e7fd21ac4980fc31c40e76abf3223e2be167f1.zip
gcc-43e7fd21ac4980fc31c40e76abf3223e2be167f1.tar.gz
gcc-43e7fd21ac4980fc31c40e76abf3223e2be167f1.tar.bz2
re PR fortran/34868 (ICE with -ff2c for function returning a complex number)
PR fortran/34868 * trans-expr.c (gfc_conv_variable): Don't build indirect references when explicit interface is mandated. * resolve.c (resolve_formal_arglist): Set attr.always_explicit on the result symbol as well as the procedure symbol. * gfortran.dg/f2c_9.f90: New test. From-SVN: r132751
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/resolve.c11
-rw-r--r--gcc/fortran/trans-expr.c3
3 files changed, 19 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 0b69dd5..2082054 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,11 @@
+2008-02-28 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR fortran/34868
+ * trans-expr.c (gfc_conv_variable): Don't build indirect
+ references when explicit interface is mandated.
+ * resolve.c (resolve_formal_arglist): Set attr.always_explicit
+ on the result symbol as well as the procedure symbol.
+
2008-02-27 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/33387
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 3df9791..ead60f2 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -106,7 +106,10 @@ resolve_formal_arglist (gfc_symbol *proc)
if (gfc_elemental (proc)
|| sym->attr.pointer || sym->attr.allocatable
|| (sym->as && sym->as->rank > 0))
- proc->attr.always_explicit = 1;
+ {
+ proc->attr.always_explicit = 1;
+ sym->attr.always_explicit = 1;
+ }
formal_arg_flag = 1;
@@ -187,7 +190,11 @@ resolve_formal_arglist (gfc_symbol *proc)
if ((sym->as && sym->as->rank > 0 && sym->as->type == AS_ASSUMED_SHAPE)
|| sym->attr.pointer || sym->attr.allocatable || sym->attr.target
|| sym->attr.optional)
- proc->attr.always_explicit = 1;
+ {
+ proc->attr.always_explicit = 1;
+ if (proc->result)
+ proc->result->attr.always_explicit = 1;
+ }
/* If the flavor is unknown at this point, it has to be a variable.
A procedure specification would have already set the type. */
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 471f168..a348451 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -513,7 +513,8 @@ gfc_conv_variable (gfc_se * se, gfc_expr * expr)
/* Dereference scalar hidden result. */
if (gfc_option.flag_f2c && sym->ts.type == BT_COMPLEX
&& (sym->attr.function || sym->attr.result)
- && !sym->attr.dimension && !sym->attr.pointer)
+ && !sym->attr.dimension && !sym->attr.pointer
+ && !sym->attr.always_explicit)
se->expr = build_fold_indirect_ref (se->expr);
/* Dereference non-character pointer variables.