[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-bugs
Subject:    [Bug fortran/34868] ICE with -ff2c for function returning a complex number
From:       "fxcoudert at gcc dot gnu dot org" <gcc-bugzilla () gcc ! gnu ! org>
Date:       2008-01-31 15:36:45
Message-ID: 20080131153645.16998.qmail () sourceware ! org
[Download RAW message or body]



------- Comment #6 from fxcoudert at gcc dot gnu dot org  2008-01-31 15:36 -------
That one is not a regression. It happens because, when the a argument is an
assumed-shape array, gfc_return_by_reference() return 0 because
sym->attr.always_explicit is set for the function.

There are two interesting comments about that in trans-types.c:

  /* Possibly return complex numbers by reference for g77 compatibility.
     We don't do this for calls to intrinsics (as the library uses the
     -fno-f2c calling convention), nor for calls to functions which always
     require an explicit interface, as no compatibility problems can
     arise there.  */

  /* Special case: f2c calling conventions require that (scalar)
     default REAL functions return the C type double instead.  f2c
     compatibility is only an issue with functions that don't
     require an explicit interface, as only these could be
     implemented in Fortran 77.  */

So I guess the answer is: assumed-shape array and f2c calling conventions are
mutually incompatible. From that point, a few courses of action are possible.
The best of all, IMHO, is to document the fact and error out when someone tries
that thing. F2C callings conventions aren't, by definition, usable for F95
code.

PS: this is not a regression, the ICE was already in 4.1.2 and 4.2.2.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org
      Known to fail|                            |4.1.2 4.2.2 4.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34868

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic