Summary: | [4.3 Regression] GCC uses non-standard calling conventions for static functions with -O0. | ||
---|---|---|---|
Product: | gcc | Reporter: | Jim Blandy <jimb> |
Component: | target | Assignee: | Richard Biener <rguenth> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | gcc-bugs |
Priority: | P2 | ||
Version: | 4.4.0 | ||
Target Milestone: | 4.3.4 | ||
Host: | i686-pc-linux-gnu | Target: | i686-pc-linux-gnu |
Build: | i686-pc-linux-gnu | Known to work: | 3.3.6 4.3.4 4.4.0 |
Known to fail: | 4.0.4 4.3.3 | Last reconfirmed: | 2009-03-18 21:32:10 |
Attachments: |
Test case
gcc44-pr39496.patch |
Description
Jim Blandy
2009-03-18 21:10:03 UTC
Created attachment 17490 [details]
Test case
This is the same test case used in the transcript; attached just for convenience.
"even though the standard IA-32 calling conventions pass the first argument on the stack" I thought this was disabled at -O0. At -O1 this should be enabled. Confirmed. In 3.3 this worked (was probably not implemented). /* Use register calling convention for local functions when possible. */ if (decl && TREE_CODE (decl) == FUNCTION_DECL && !profile_flag) That should include !optimize I think. We used to check flag_unit_at_a_time in this function: /* Use register calling convention for local functions when possible. */ if (decl && TREE_CODE (decl) == FUNCTION_DECL && flag_unit_at_a_time && !profile_flag) Which meant it never worked for C++ in 3.4 and above , for C, it always worked until 4.4 which removed the check. Created attachment 17491 [details] gcc44-pr39496.patch && optimize, not !optimize. Here is what I'm going to bootstrap/regtest. Subject: Bug 39496 Author: jakub Date: Thu Mar 19 10:25:43 2009 New Revision: 144955 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=144955 Log: PR target/39496 * config/i386/i386.c (ix86_function_regparm): Don't optimize local functions using regparm calling conventions when not optimizing. (ix86_function_sseregparm): Similarly for sseregparm calling conventions. * gcc.target/i386/pr39496.c: New test. * g++.dg/other/pr39496.C: New test. Added: trunk/gcc/testsuite/g++.dg/other/pr39496.C trunk/gcc/testsuite/gcc.target/i386/pr39496.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386.c trunk/gcc/testsuite/ChangeLog Fixed on the trunk so far. Closing 4.2 branch. This is worth fixing for 4.3.4. I am testing a backport. Fixed. Subject: Bug 39496 Author: rguenth Date: Wed Apr 22 15:01:45 2009 New Revision: 146583 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146583 Log: 2009-04-22 Richard Guenther <rguenther@suse.de> Backport from mainline: PR target/39496 * config/i386/i386.c (ix86_function_regparm): Don't optimize local functions using regparm calling conventions when not optimizing. (ix86_function_sseregparm): Similarly for sseregparm calling conventions. * gcc.target/i386/pr39496.c: New test. * g++.dg/other/pr39496.C: New test. Added: branches/gcc-4_3-branch/gcc/testsuite/g++.dg/other/pr39496.C - copied unchanged from r144955, trunk/gcc/testsuite/g++.dg/other/pr39496.C branches/gcc-4_3-branch/gcc/testsuite/gcc.target/i386/pr39496.c - copied unchanged from r144955, trunk/gcc/testsuite/gcc.target/i386/pr39496.c Modified: branches/gcc-4_3-branch/gcc/ChangeLog branches/gcc-4_3-branch/gcc/config/i386/i386.c branches/gcc-4_3-branch/gcc/testsuite/ChangeLog |