* [PATCH] s390: Add emit_barrier() after trap.
@ 2015-08-26 15:10 Dominik Vogt
2015-08-27 7:55 ` Andreas Krebbel
0 siblings, 1 reply; 2+ messages in thread
From: Dominik Vogt @ 2015-08-26 15:10 UTC (permalink / raw)
To: gcc-patches; +Cc: Andreas Krebbel, Ulrich Weigand
[-- Attachment #1: Type: text/plain, Size: 325 bytes --]
This patch fixes an ICE on S390 when a trap is generated because
the given -mstack-size is to small. A barrier was missing after
the trap, so on higher optimization levels a NULL pointer fron an
uninitialized basic block was used. The patch also contains a
test case.
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
IBM Germany
[-- Attachment #2: ChangeLog --]
[-- Type: text/plain, Size: 173 bytes --]
gcc/ChangeLog
* config/s390/s390.c (s390_emit_prologue): Add emit_barrier() after
trap to fix ICE.
gcc/testsuite/ChangeLog
* gcc.target/s390/20150826-1.c: New test.
[-- Attachment #3: 0001-s390-Add-emit_barrier-after-trap.patch --]
[-- Type: text/x-diff, Size: 1332 bytes --]
From ec6b88cd51234d138bd559271def086156fcae07 Mon Sep 17 00:00:00 2001
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
Date: Wed, 26 Aug 2015 14:37:00 +0100
Subject: [PATCH] s390: Add emit_barrier() after trap.
---
gcc/config/s390/s390.c | 1 +
gcc/testsuite/gcc.target/s390/20150826-1.c | 11 +++++++++++
2 files changed, 12 insertions(+)
create mode 100644 gcc/testsuite/gcc.target/s390/20150826-1.c
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 6366691..5951598 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -10491,6 +10491,7 @@ s390_emit_prologue (void)
current_function_name(), cfun_frame_layout.frame_size,
s390_stack_size);
emit_insn (gen_trap ());
+ emit_barrier ();
}
else
{
diff --git a/gcc/testsuite/gcc.target/s390/20150826-1.c b/gcc/testsuite/gcc.target/s390/20150826-1.c
new file mode 100644
index 0000000..830772f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/20150826-1.c
@@ -0,0 +1,11 @@
+/* Check that -mstack-size=32 does not cause an ICE. */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -mstack-size=32 -Wno-pointer-to-int-cast" } */
+
+extern char* bar(char *);
+int foo(void)
+{
+ char b[100];
+ return (int)bar(b);
+} /* { dg-warning "An unconditional trap is added" } */
--
2.3.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] s390: Add emit_barrier() after trap.
2015-08-26 15:10 [PATCH] s390: Add emit_barrier() after trap Dominik Vogt
@ 2015-08-27 7:55 ` Andreas Krebbel
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Krebbel @ 2015-08-27 7:55 UTC (permalink / raw)
To: gcc-patches, Ulrich Weigand
On 08/26/2015 04:03 PM, Dominik Vogt wrote:
> This patch fixes an ICE on S390 when a trap is generated because
> the given -mstack-size is to small. A barrier was missing after
> the trap, so on higher optimization levels a NULL pointer fron an
> uninitialized basic block was used. The patch also contains a
> test case.
Applied with minor changes to the testcase.
Thanks!
-Andreas-
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-27 7:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-26 15:10 [PATCH] s390: Add emit_barrier() after trap Dominik Vogt
2015-08-27 7:55 ` Andreas Krebbel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).