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 a71d88fa9e1fb4980d73355b421738e015e894ec..22ca348641957e3c5e2d1a66113c5f7b1c3bb866 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 5e23bc242b98ee281d2284b9c8af68507596975b..9b3259d12ed198b3e8330751b25d7a87d39eaa0c 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 8b74eb02bfbd6a0910903c45e2ae3537a7a97698..1c9008261ebd523776aeca3e7566659e0d7e5104 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);
+}