From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17252 invoked by alias); 31 Jan 2008 15:37:32 -0000 Received: (qmail 16999 invoked by uid 48); 31 Jan 2008 15:36:45 -0000 Date: Thu, 31 Jan 2008 16:05:00 -0000 Message-ID: <20080131153645.16998.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/34868] ICE with -ff2c for function returning a complex number In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "fxcoudert at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-01/txt/msg03789.txt.bz2 ------- 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