re PR c++/79641 (ICE with const variable and attribute)
authorJakub Jelinek <jakub@redhat.com>
Tue, 21 Feb 2017 16:55:00 +0000 (17:55 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 21 Feb 2017 16:55:00 +0000 (17:55 +0100)
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
gcc/c-family/c-attribs.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/pr79641.c [new file with mode: 0644]

index 4bdd4747a89b7ec8da43a6de9db752bf2c6720e7..91c739d4aa0ca8e21b309a3717ef476b696d5069 100644 (file)
@@ -1,3 +1,9 @@
+2017-02-21  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/79641
+       * c-attribs.c (handle_mode_attribute): Use build_qualified_type to
+       preserve quals.
+
 2017-02-17  Joseph Myers  <joseph@codesourcery.com>
 
        * c-cppbuiltin.c (builtin_define_float_constants): Define
index ce7fcaafcac400a5e50bf6c37305214c1a8b3866..8058a6518c53a1f527a29ea14df63231b340d8e8 100644 (file)
@@ -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;
index e35dd7c0cda0194804ccfcd8565653098dcb3311..c432fb0f0c6b688e8becbf7c16b49b183a10bc33 100644 (file)
@@ -1,5 +1,8 @@
 2017-02-21  Jakub Jelinek  <jakub@redhat.com>
 
+       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 (file)
index 0000000..5d2c9b4
--- /dev/null
@@ -0,0 +1,4 @@
+/* PR c++/79641 */
+/* { dg-do compile } */
+
+const int __attribute__((__mode__ (__QI__))) i = 0;