The following valid line of code triggers an ICE since GCC 4.2.0: ============================================== const int __attribute__((mode (QI))) i = 0; ============================================== bug.cc:1:38: internal compiler error: in start_decl, at cp/decl.c:5150 const int __attribute__((mode (QI))) i = 0; ^ 0x63673f start_decl(cp_declarator const*, cp_decl_specifier_seq*, int, tree_node*, tree_node*, tree_node**) ../../gcc/gcc/cp/decl.c:5150 0x7195d7 cp_parser_init_declarator ../../gcc/gcc/cp/parser.c:19273 0x73dc1c cp_parser_simple_declaration ../../gcc/gcc/cp/parser.c:12795 0x73e9c5 cp_parser_block_declaration ../../gcc/gcc/cp/parser.c:12620 0x743d94 cp_parser_declaration ../../gcc/gcc/cp/parser.c:12518 0x7459bb cp_parser_declaration_seq_opt ../../gcc/gcc/cp/parser.c:12394 0x745c9a cp_parser_translation_unit ../../gcc/gcc/cp/parser.c:4366 0x745c9a c_parse_file() ../../gcc/gcc/cp/parser.c:38430 0x8a4de3 c_common_parse_file() ../../gcc/gcc/c-family/c-opts.c:1107 Please submit a full bug report, [etc.] The C-frontend compiles the code without problem.
Confirmed.
Started most likely with r123432 (r123407 works, r123477 ICEs). Looks like a bug in handle_mode_attribute, looking into it.
Created attachment 40802 [details] gcc7-pr79641.patch Untested fix.
Author: jakub Date: Tue Feb 21 16:55:00 2017 New Revision: 245632 URL: https://gcc.gnu.org/viewcvs?rev=245632&root=gcc&view=rev Log: PR c++/79641 * c-attribs.c (handle_mode_attribute): Use build_qualified_type to preserve quals. * c-c++-common/pr79641.c: New test. Added: trunk/gcc/testsuite/c-c++-common/pr79641.c Modified: trunk/gcc/c-family/ChangeLog trunk/gcc/c-family/c-attribs.c trunk/gcc/testsuite/ChangeLog
Fixed on the trunk so far.
Author: jakub Date: Fri May 5 21:28:09 2017 New Revision: 247672 URL: https://gcc.gnu.org/viewcvs?rev=247672&root=gcc&view=rev Log: 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. Added: branches/gcc-6-branch/gcc/testsuite/c-c++-common/pr79641.c Modified: branches/gcc-6-branch/gcc/c-family/ChangeLog branches/gcc-6-branch/gcc/c-family/c-common.c branches/gcc-6-branch/gcc/testsuite/ChangeLog
Author: jakub Date: Tue May 30 08:02:18 2017 New Revision: 248648 URL: https://gcc.gnu.org/viewcvs?rev=248648&root=gcc&view=rev Log: 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. Added: branches/gcc-5-branch/gcc/testsuite/c-c++-common/pr79641.c Modified: branches/gcc-5-branch/gcc/c-family/ChangeLog branches/gcc-5-branch/gcc/c-family/c-common.c branches/gcc-5-branch/gcc/testsuite/ChangeLog
Fixed.