This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/47918] [4.6/4.7 Regression] noreturn discovery broke non local gotos on m68k
- From: "mikpe at it dot uu.se" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 8 Jul 2011 09:43:55 +0000
- Subject: [Bug rtl-optimization/47918] [4.6/4.7 Regression] noreturn discovery broke non local gotos on m68k
- Auto-submitted: auto-generated
- References: <bug-47918-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47918
--- Comment #6 from Mikael Pettersson <mikpe at it dot uu.se> 2011-07-08 09:42:26 UTC ---
I can trigger the bug on i386 too, if I tweak the i386 backend to push function
parameters rather than moving them to pre-allocated stack space, and to
disallow regparm promotion for calls to non-exported functions, via this patch:
--- gcc-4.6-r160123/gcc/config/i386/i386.h.~1~ 2010-05-29 16:03:31.000000000
+0200
+++ gcc-4.6-r160123/gcc/config/i386/i386.h 2011-07-08 10:43:46.000000000
+0200
@@ -1513,13 +1513,21 @@ enum reg_class
prologue and apilogue. This is not possible without
ACCUMULATE_OUTGOING_ARGS. */
+#if 0
#define ACCUMULATE_OUTGOING_ARGS \
(TARGET_ACCUMULATE_OUTGOING_ARGS || ix86_cfun_abi () == MS_ABI)
+#else
+#define ACCUMULATE_OUTGOING_ARGS 0
+#endif
/* If defined, a C expression whose value is nonzero when we want to use PUSH
instructions to pass outgoing arguments. */
+#if 0
#define PUSH_ARGS (TARGET_PUSH_ARGS && !ACCUMULATE_OUTGOING_ARGS)
+#else
+#define PUSH_ARGS 1
+#endif
/* We want the stack and args grow in opposite directions, even if
PUSH_ARGS is 0. */
@@ -1804,7 +1812,11 @@ typedef struct ix86_args {
#define X86_64_REGPARM_MAX 6
#define X86_64_MS_REGPARM_MAX 4
+#if 0
#define X86_32_REGPARM_MAX 3
+#else
+#define X86_32_REGPARM_MAX 0
+#endif
#define REGPARM_MAX \
(TARGET_64BIT ? (TARGET_64BIT_MS_ABI ? X86_64_MS_REGPARM_MAX \
With that in place gcc still bootstraps ok on i686-linux, but r160124 now
miscompiles non-local-goto-4.c just like on m68k (see the changed and now
incorrect stack offset in the first insn after L4):
--- non-local-goto-4.s-r160123 2011-07-08 10:58:40.000000000 +0200
+++ non-local-goto-4.s-r160124 2011-07-08 11:24:05.000000000 +0200
@@ -25,19 +25,17 @@
movl %esp, 8(%esp)
pushl 36(%esp)
call y.1220
- popl %eax
+ .p2align 4,,7
+ .p2align 3
+.L2:
.L4:
- movl 36(%esp), %eax
+ movl 40(%esp), %eax
movl 16(%esp), %ebx
movl 20(%esp), %esi
movl 24(%esp), %edi
movl 28(%esp), %ebp
addl $32, %esp
ret
- .p2align 4,,7
- .p2align 3
-.L2:
- jmp .L4
.size x, .-x
.p2align 4,,15
.globl main
When I look at dumps everything looks ok up to .188r.asmcons, but in .191r.ira
I see a new load from the stack with the wrong offset.