re PR sanitizer/88619 (ICE in asan_emit_stack_protection, at asan.c:1574 since r266664)
authorJakub Jelinek <jakub@redhat.com>
Mon, 7 Jan 2019 08:50:57 +0000 (09:50 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 7 Jan 2019 08:50:57 +0000 (09:50 +0100)
PR sanitizer/88619
* cfgexpand.c (expand_stack_vars): Only align prev_offset to
ASAN_MIN_RED_ZONE_SIZE, not to maximum of that and alignb.

* c-c++-common/asan/pr88619.c: New test.

From-SVN: r267633

gcc/ChangeLog
gcc/cfgexpand.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/asan/pr88619.c [new file with mode: 0644]

index 25660bd1c8aa92ec124789344443388b166409f2..73fd2460724242eb853945d248e6c874300966f3 100644 (file)
@@ -1,5 +1,9 @@
 2019-01-07  Jakub Jelinek  <jakub@redhat.com>
 
+       PR sanitizer/88619
+       * cfgexpand.c (expand_stack_vars): Only align prev_offset to
+       ASAN_MIN_RED_ZONE_SIZE, not to maximum of that and alignb.
+
        PR c++/85052
        * tree-vect-generic.c: Include insn-config.h and recog.h.
        (expand_vector_piecewise): Add defaulted ret_type argument,
index 60c1cfb4556e1a659db19f6719adccc1dab0fe46..f4786d5da09c35490ad923510a62b6c3662a5e92 100644 (file)
@@ -1130,7 +1130,7 @@ expand_stack_vars (bool (*pred) (size_t), struct stack_vars_data *data)
                  prev_offset = frame_offset.to_constant ();
                }
              prev_offset = align_base (prev_offset,
-                                       MAX (alignb, ASAN_MIN_RED_ZONE_SIZE),
+                                       ASAN_MIN_RED_ZONE_SIZE,
                                        !FRAME_GROWS_DOWNWARD);
              tree repr_decl = NULL_TREE;
              unsigned HOST_WIDE_INT size
index a0d74152badf1003a72ce9591565550e5bc98379..538f7f30062627be13ebdc85128a42508426f3c9 100644 (file)
@@ -1,5 +1,8 @@
 2019-01-07  Jakub Jelinek  <jakub@redhat.com>
 
+       PR sanitizer/88619
+       * c-c++-common/asan/pr88619.c: New test.
+
        PR c++/85052
        * c-c++-common/builtin-convertvector-1.c: New test.
        * c-c++-common/torture/builtin-convertvector-1.c: New test.
diff --git a/gcc/testsuite/c-c++-common/asan/pr88619.c b/gcc/testsuite/c-c++-common/asan/pr88619.c
new file mode 100644 (file)
index 0000000..aab8a4c
--- /dev/null
@@ -0,0 +1,14 @@
+/* PR sanitizer/88619 */
+/* { dg-do compile { target fstack_protector } } */
+/* { dg-options "-fstack-protector-strong -fsanitize=address" } */
+
+typedef int A __attribute__((aligned (64)));
+
+int
+main ()
+{
+  A b;
+  int *p = &b;
+  *(p - 1) = 123;
+  __builtin_alloca (b);
+}