diff options
author | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-05-17 09:59:20 +0000 |
---|---|---|
committer | Mikhail Kashkarov <m.kashkarov@partner.samsung.com> | 2018-10-18 16:20:10 +0300 |
commit | e2cd7f1b65dcf4eae695360c87fd4dd6159d54ca (patch) | |
tree | a68d4702a66d5eb110e823cf518655583c00f0cd | |
parent | 037f5c0adf25b4487ca4c0621f26fb6171b40f07 (diff) | |
download | linaro-gcc-e2cd7f1b65dcf4eae695360c87fd4dd6159d54ca.tar.gz linaro-gcc-e2cd7f1b65dcf4eae695360c87fd4dd6159d54ca.tar.bz2 linaro-gcc-e2cd7f1b65dcf4eae695360c87fd4dd6159d54ca.zip |
PR sanitizer/80659
* c-decl.c (build_compound_literal): Set DECL_ARTIFICIAL and
DECL_IGNORED_P even for non-static compound literals.
* gcc.dg/asan/pr80659.c: New test.
Change-Id: I7565aba65e49836947e0faf2eb5ea668b46a0d87
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248143138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/c/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c/c-decl.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | testsuite/gcc.dg/asan/pr80659.c | 13 |
4 files changed, 27 insertions, 2 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 2b1f71855ad..de88c936df5 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2017-05-17 Marek Polacek <polacek@redhat.com> + + PR sanitizer/80659 + * c-decl.c (build_compound_literal): Set DECL_ARTIFICIAL and + DECL_IGNORED_P even for non-static compound literals. + 2016-12-21 Jakub Jelinek <jakub@redhat.com> PR c/77767 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 7f9d8825bd8..93c11cc53f6 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -5091,6 +5091,8 @@ build_compound_literal (location_t loc, tree type, tree init, bool non_const) DECL_CONTEXT (decl) = current_function_decl; TREE_USED (decl) = 1; DECL_READ_P (decl) = 1; + DECL_ARTIFICIAL (decl) = 1; + DECL_IGNORED_P (decl) = 1; TREE_TYPE (decl) = type; TREE_READONLY (decl) = (TYPE_READONLY (type) || (TREE_CODE (type) == ARRAY_TYPE @@ -5127,8 +5129,6 @@ build_compound_literal (location_t loc, tree type, tree init, bool non_const) set_compound_literal_name (decl); DECL_DEFER_OUTPUT (decl) = 1; DECL_COMDAT (decl) = 1; - DECL_ARTIFICIAL (decl) = 1; - DECL_IGNORED_P (decl) = 1; pushdecl (decl); rest_of_decl_compilation (decl, 1, 0); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0cfd70fbfa3..fcfdf8437d7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -19,6 +19,12 @@ PR sanitizer/81111 * g++.dg/ubsan/pr81111.C: New test. +2017-05-17 Marek Polacek <polacek@redhat.com> + + PR sanitizer/80659 + * gcc.dg/asan/pr80659.c: New test. + + 2017-04-13 Denis Khalikov <d.khalikov@partner.samsung.com> PR sanitizer/80414 diff --git a/testsuite/gcc.dg/asan/pr80659.c b/testsuite/gcc.dg/asan/pr80659.c new file mode 100644 index 00000000000..0cbf2e498f7 --- /dev/null +++ b/testsuite/gcc.dg/asan/pr80659.c @@ -0,0 +1,13 @@ +/* PR sanitizer/80659 */ +/* { dg-do compile } */ + +void +foo (int a) +{ + switch (a) + { + case 0: + (int[3]) { }; + int h; + } +} |