aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-12-03 21:57:14 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2018-12-03 21:57:14 +0100
commit413eb4c65c69c8bf7204ef824b1c6722067c61ee (patch)
treee7eaa3bf708a11a779220e92f6c6559028a03759 /gcc
parent44b619c14cad4e9e8a10b469ef1075886b27ddc0 (diff)
downloadgcc-413eb4c65c69c8bf7204ef824b1c6722067c61ee.zip
gcc-413eb4c65c69c8bf7204ef824b1c6722067c61ee.tar.gz
gcc-413eb4c65c69c8bf7204ef824b1c6722067c61ee.tar.bz2
re PR middle-end/64242 (Longjmp expansion incorrect)
PR middle-end/64242 * gcc.c-torture/execute/pr64242.c (foo, bar): New functions. (p): Make it void *volatile instead of volatile void *. (q): New variable. (main): Add a dummy 32-byte aligned variable and escape its address. Don't require that the two __builtin_alloca (0) calls return the same address, just require that their difference is smaller than 1024 bytes. From-SVN: r266766
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog11
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr64242.c33
2 files changed, 38 insertions, 6 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index afe837f..f6bd456 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2018-12-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/64242
+ * gcc.c-torture/execute/pr64242.c (foo, bar): New functions.
+ (p): Make it void *volatile instead of volatile void *.
+ (q): New variable.
+ (main): Add a dummy 32-byte aligned variable and escape its address.
+ Don't require that the two __builtin_alloca (0) calls return the
+ same address, just require that their difference is smaller than
+ 1024 bytes.
+
2018-12-03 Marek Polacek <polacek@redhat.com>
* g++.dg/cpp1y/lambda-generic-83856.C: Use __SIZE_TYPE__.
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr64242.c b/gcc/testsuite/gcc.c-torture/execute/pr64242.c
index 72dab57..46a7b23 100644
--- a/gcc/testsuite/gcc.c-torture/execute/pr64242.c
+++ b/gcc/testsuite/gcc.c-torture/execute/pr64242.c
@@ -3,7 +3,7 @@
extern void abort (void);
__attribute ((noinline)) void
-broken_longjmp(void *p)
+broken_longjmp (void *p)
{
void *buf[5];
__builtin_memcpy (buf, p, 5 * sizeof (void*));
@@ -11,20 +11,41 @@ broken_longjmp(void *p)
__builtin_longjmp (buf, 1);
}
+__attribute ((noipa)) __UINTPTR_TYPE__
+foo (void *p)
+{
+ return (__UINTPTR_TYPE__) p;
+}
+
+__attribute ((noipa)) void
+bar (void *p)
+{
+ asm volatile ("" : : "r" (p));
+}
+
volatile int x = 0;
-volatile void *p;
+void *volatile p;
+void *volatile q;
+
int
-main (void)
+main ()
{
void *buf[5];
+ struct __attribute__((aligned (32))) S { int a[4]; } s;
+ bar (&s);
p = __builtin_alloca (x);
-
if (!__builtin_setjmp (buf))
broken_longjmp (buf);
/* Fails if stack pointer corrupted. */
- if (p != __builtin_alloca (x))
- abort();
+ q = __builtin_alloca (x);
+ if (foo (p) < foo (q))
+ {
+ if (foo (q) - foo (p) >= 1024)
+ abort ();
+ }
+ else if (foo (p) - foo (q) >= 1024)
+ abort ();
return 0;
}