re PR sanitizer/88333 (ice in asan_emit_stack_protection, at asan.c:1574)
authorJakub Jelinek <jakub@redhat.com>
Wed, 5 Dec 2018 08:26:06 +0000 (09:26 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 5 Dec 2018 08:26:06 +0000 (09:26 +0100)
PR sanitizer/88333
* cfgexpand.c (expand_stack_vars): If asan_vec is empty, start with
aligning frame offset to ASAN_RED_ZONE_SIZE bytes.

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

From-SVN: r266817

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

index a71d88f..22ca348 100644 (file)
@@ -1,3 +1,9 @@
+2018-12-05  Jakub Jelinek  <jakub@redhat.com>
+
+       PR sanitizer/88333
+       * cfgexpand.c (expand_stack_vars): If asan_vec is empty, start with
+       aligning frame offset to ASAN_RED_ZONE_SIZE bytes.
+
 2018-12-05  Xianmiao Qu  <xianmiao_qu@c-sky.com>
 
        * config.gcc (csky-*-linux-gnu*): Force .init_array support.
index 5e23bc2..9b3259d 100644 (file)
@@ -1124,6 +1124,11 @@ expand_stack_vars (bool (*pred) (size_t), struct stack_vars_data *data)
              && frame_offset.is_constant (&prev_offset)
              && stack_vars[i].size.is_constant ())
            {
+             if (data->asan_vec.is_empty ())
+               {
+                 alloc_stack_frame_space (0, ASAN_RED_ZONE_SIZE);
+                 prev_offset = frame_offset.to_constant ();
+               }
              prev_offset = align_base (prev_offset,
                                        MAX (alignb, ASAN_MIN_RED_ZONE_SIZE),
                                        !FRAME_GROWS_DOWNWARD);
index 8b74eb0..1c90082 100644 (file)
@@ -1,3 +1,8 @@
+2018-12-05  Jakub Jelinek  <jakub@redhat.com>
+
+       PR sanitizer/88333
+       * c-c++-common/asan/pr88333.c: New test.
+
 2018-12-05  Alexandre Oliva <aoliva@redhat.com>
 
        PR c++/85569
diff --git a/gcc/testsuite/c-c++-common/asan/pr88333.c b/gcc/testsuite/c-c++-common/asan/pr88333.c
new file mode 100644 (file)
index 0000000..0f257a8
--- /dev/null
@@ -0,0 +1,12 @@
+/* PR sanitizer/88333 */
+/* { dg-do compile { target fstack_protector } } */
+/* { dg-options "-fstack-protector-strong -fsanitize=address" } */
+
+void bar (int *);
+
+void
+foo (void)
+{
+  int c;
+  bar (&c);
+}