This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
target/9506: ABI breakage: structure return
- From: pfeifer at dbai dot tuwien dot ac dot at (Gerald Pfeifer)
- To: gcc-gnats at gcc dot gnu dot org
- Date: Thu, 30 Jan 2003 14:46:29 +0100 (CET)
- Subject: target/9506: ABI breakage: structure return
>Number: 9506
>Category: target
>Synopsis: ABI breakage: structure return
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jan 30 13:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:
>Release: 3.4 20030130 (experimental)
>Organization:
>Environment:
System: FreeBSD naos.dbai.tuwien.ac.at 4.7-RELEASE FreeBSD 4.7-RELEASE #0: Thu Jan 9 09:25:29 CET 2003 root@aludra.dbai.tuwien.ac.at:/usr/src/sys/compile/DBAI-MP i386
host: i386-unknown-freebsd4.7
build: i386-unknown-freebsd4.7
target: i386-unknown-freebsd4.7
configured with: /sw/test/gcc/cvs/configure --prefix=/sw/gcc-current --enable-languages=c,c++ --disable-checking
>Description:
Unless I am completely mistaken, the following patch is responsible for an
ABI change I am seeing on FreeBSD (and apparently also Cygwin, Interix,
OpenBSD, NetBSD) on i386 platforms for GCC 3.2.1 as well as the 3.3 branch
and mainline:
Thu Oct 31 18:08:00 CET 2002 Jan Hubicka <jh@suse.cz>
* i386.c (override_options): Set defaults for flag_omit_frame_pointer,
flag_asynchronous_unwind_tables, flag_pcc_struct_return.
* i386.c (optimization_options): Set flag_omit_frame_pointer,
flag_asynchronous_unwind_tables, flag_pcc_struct_return to 2.
Do not clear -momit-leaf-frame-pointer when profiling.
(ix86_frame_pointer_required): Frame pointer is always required when
profiling.
http://gcc.gnu.org/ml/gcc-patches/2002-10/msg01887.html
>How-To-Repeat:
#include <stdio.h>
#include <stdlib.h>
int main() {
div_t d = div(20,5);
printf("20/5 = %d mod %d\n",d.quot,d.rem);
}
will print something different from "20/5 = 4 mod 0".
>Fix:
What I believe is wrong with this patch is that it _completely_ ignores
DEFAULT_PCC_STRUCT_RETURN when setting flag_pcc_struct_return:
gcc/config/i386% grep DEFAULT_PCC_STRUCT_RETURN *.h | wc -l
19
gcc/config/i386% grep DEFAULT_PCC_STRUCT_RETURN i386.c | wc -l
0
>Release-Note:
>Audit-Trail:
>Unformatted: