public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "tangyixuan at mail dot dlut.edu.cn" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/97468] New: gcc crashes when using __may_alias__ attribute Date: Sat, 17 Oct 2020 07:50:14 +0000 [thread overview] Message-ID: <bug-97468-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97468 Bug ID: 97468 Summary: gcc crashes when using __may_alias__ attribute Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: tangyixuan at mail dot dlut.edu.cn Target Milestone: --- Hi, the following code uses '__attribute__ ((__may_alias__))' to alias a struct 'S' to 'a'. However, gcc crashes at compilation time while clang successfully compiles. gcc doc: https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Common-Type-Attributes.html#Common-Type-Attributes 'Accesses through pointers to types with this attribute are not subject to type-based alias analysis, but are instead assumed to be able to alias any other type of objects.' $ cat s.cpp template<typename T> struct S{}; auto __attribute__ ((__may_alias__)) a=S<int>{}; $ g++ -c s.cpp s.cpp:2:38: internal compiler error: in layout_type, at stor-layout.c:2618 2 | auto __attribute__ ((__may_alias__)) a=S<int>{}; | ^ 0x62d384 layout_type(tree_node*) ../../gcc-11-20201011/gcc/stor-layout.c:2618 0xebaf34 type_hash_canon(unsigned int, tree_node*) ../../gcc-11-20201011/gcc/tree.c:7140 0x7e6beb build_type_attribute_qual_variant(tree_node*, tree_node*, int) ../../gcc-11-20201011/gcc/attribs.c:1166 0x7e8702 build_type_attribute_variant(tree_node*, tree_node*) ../../gcc-11-20201011/gcc/attribs.c:1377 0x7e8702 decl_attributes(tree_node**, tree_node*, int, tree_node*) ../../gcc-11-20201011/gcc/attribs.c:794 0x6d9e93 cplus_decl_attributes(tree_node**, tree_node*, int) ../../gcc-11-20201011/gcc/cp/decl2.c:1595 0x6cd1bf start_decl(cp_declarator const*, cp_decl_specifier_seq*, int, tree_node*, tree_node*, tree_node**) ../../gcc-11-20201011/gcc/cp/decl.c:5267 0x7590ce cp_parser_init_declarator ../../gcc-11-20201011/gcc/cp/parser.c:20936 0x73a65c cp_parser_simple_declaration ../../gcc-11-20201011/gcc/cp/parser.c:13878 0x7630a6 cp_parser_declaration ../../gcc-11-20201011/gcc/cp/parser.c:13577 0x7636dd cp_parser_translation_unit ../../gcc-11-20201011/gcc/cp/parser.c:4793 0x7636dd c_parse_file() ../../gcc-11-20201011/gcc/cp/parser.c:44172 0x82f13d c_common_parse_file() ../../gcc-11-20201011/gcc/c-family/c-opts.c:1188 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.
next reply other threads:[~2020-10-17 7:50 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-10-17 7:50 tangyixuan at mail dot dlut.edu.cn [this message] 2020-10-19 7:22 ` [Bug c++/97468] " marxin at gcc dot gnu.org 2020-10-19 7:28 ` rguenth at gcc dot gnu.org 2021-10-01 9:57 ` pinskia at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-97468-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).