This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/34868] ICE with -ff2c for function returning a complex number
- From: "fxcoudert at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Feb 2008 10:35:14 -0000
- Subject: [Bug fortran/34868] ICE with -ff2c for function returning a complex number
- References: <bug-34868-15665@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #7 from fxcoudert at gcc dot gnu dot org 2008-02-27 10:35 -------
Actually, after looking more in depth at the front-end code, we do a fairly
good job of supporting the use of f2c calling conventions for Fortran 95 code
(it's mainly handled by the use of sym->attr.always_explicit, which does the
trick very nicely. Following on that, I found that there is one place this use
of sym->attr.always_explicit is missing, and that's where the bug is triggered.
The following patch fixes it:
Index: trans-expr.c
===================================================================
--- trans-expr.c (revision 132578)
+++ trans-expr.c (working copy)
@@ -513,7 +513,8 @@
/* 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.
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |fxcoudert at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Keywords| |patch
Last reconfirmed|2008-01-19 12:43:02 |2008-02-27 10:35:14
date| |
Target Milestone|--- |4.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34868