aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2017-05-26 11:17:34 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2017-05-26 11:17:34 +0000
commit015cf5d1d1ea43b9ade4c58a365be11b02e10df3 (patch)
tree2a622999af4d0ec7d9c9d50704ecff2844b27c0d /gcc/c
parent9e2248e6d31fcb697a83337438ef9509b19db7e5 (diff)
downloadgcc-015cf5d1d1ea43b9ade4c58a365be11b02e10df3.zip
gcc-015cf5d1d1ea43b9ade4c58a365be11b02e10df3.tar.gz
gcc-015cf5d1d1ea43b9ade4c58a365be11b02e10df3.tar.bz2
re PR sanitizer/80659 (-fsanitize=address evokes ICE in in gimplify_switch_expr)
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. From-SVN: r248491
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog9
-rw-r--r--gcc/c/c-decl.c4
2 files changed, 11 insertions, 2 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 922e190..7567aa7 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,12 @@
+2017-05-26 Marek Polacek <polacek@redhat.com>
+
+ Backported from mainline
+ 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.
+
2017-05-03 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 64a11079..2acedac 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -5261,6 +5261,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
@@ -5297,8 +5299,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);
}