This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/34868] ICE with -ff2c for function returning a complex number



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]