From 00bc9de3fe5a713cc074938d53dc87da3f21c6de Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 21 Feb 2017 17:55:00 +0100 Subject: [PATCH] re PR c++/79641 (ICE with const variable and attribute) PR c++/79641 * c-attribs.c (handle_mode_attribute): Use build_qualified_type to preserve quals. * c-c++-common/pr79641.c: New test. From-SVN: r245632 --- gcc/c-family/ChangeLog | 6 ++++++ gcc/c-family/c-attribs.c | 2 +- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/c-c++-common/pr79641.c | 4 ++++ 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/c-c++-common/pr79641.c diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 4bdd4747a89..91c739d4aa0 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2017-02-21 Jakub Jelinek + + PR c++/79641 + * c-attribs.c (handle_mode_attribute): Use build_qualified_type to + preserve quals. + 2017-02-17 Joseph Myers * c-cppbuiltin.c (builtin_define_float_constants): Define diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c index ce7fcaafcac..8058a6518c5 100644 --- a/gcc/c-family/c-attribs.c +++ b/gcc/c-family/c-attribs.c @@ -1430,7 +1430,7 @@ handle_mode_attribute (tree *node, tree name, tree args, return NULL_TREE; } - *node = typefm; + *node = build_qualified_type (typefm, TYPE_QUALS (type)); } return NULL_TREE; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e35dd7c0cda..c432fb0f0c6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2017-02-21 Jakub Jelinek + PR c++/79641 + * c-c++-common/pr79641.c: New test. + PR tree-optimization/79649 * gcc.target/i386/pr79649.c: New test. diff --git a/gcc/testsuite/c-c++-common/pr79641.c b/gcc/testsuite/c-c++-common/pr79641.c new file mode 100644 index 00000000000..5d2c9b4d38b --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr79641.c @@ -0,0 +1,4 @@ +/* PR c++/79641 */ +/* { dg-do compile } */ + +const int __attribute__((__mode__ (__QI__))) i = 0; -- 2.30.2