]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c++/79641 (ICE with const variable and attribute)
authorJakub Jelinek <jakub@redhat.com>
Tue, 30 May 2017 08:02:18 +0000 (10:02 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 30 May 2017 08:02:18 +0000 (10:02 +0200)
Backported from mainline
2017-02-21  Jakub Jelinek  <jakub@redhat.com>

PR c++/79641
* c-common.c (handle_mode_attribute): Use build_qualified_type to
preserve quals.

* c-c++-common/pr79641.c: New test.

From-SVN: r248648

gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/pr79641.c [new file with mode: 0644]

index bd8449932be813ae23304f02f5a91f9fa5b26bfd..f32254a5e03768e20310cf986ffc657ce079300e 100644 (file)
@@ -1,3 +1,12 @@
+2017-05-30  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2017-02-21  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/79641
+       * c-common.c (handle_mode_attribute): Use build_qualified_type to
+       preserve quals.
+
 2017-05-10  Richard Biener  <rguenther@suse.de>
 
        Backport from mainline
index aa81d1944b89cce2f40aaa5793db416b0c7131f1..4a63c325d05ad514f2fbfaa8bd398839717530eb 100644 (file)
@@ -7561,7 +7561,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 8452081abc5be665f023e5ef331de6c1448532f2..5344f8f39d6fdddd4c264aa705a4d17e34d56a56 100644 (file)
@@ -3,6 +3,9 @@
        Backported from mainline
        2017-02-21  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/79641
+       * c-c++-common/pr79641.c: New test.
+
        PR target/79494
        * gcc.dg/pr79494.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;