public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/108936] New: internal compiler error: in type_has_nontrivial_copy_init, at cp/tree.cc:4525 @ 2023-02-26 23:18 movaki1751 at vootin dot com 2023-02-27 15:25 ` [Bug c++/108936] " marxin at gcc dot gnu.org 2023-02-27 18:10 ` mpolacek at gcc dot gnu.org 0 siblings, 2 replies; 3+ messages in thread From: movaki1751 at vootin dot com @ 2023-02-26 23:18 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108936 Bug ID: 108936 Summary: internal compiler error: in type_has_nontrivial_copy_init, at cp/tree.cc:4525 Product: gcc Version: 12.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: movaki1751 at vootin dot com Target Milestone: --- Created attachment 54538 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54538&action=edit The attachment was generated with the "-freport-bug" option. It contains all the required technical information and the preprocessed file Trying to use "(union{short s;char c;}){1}.c != 1;" in a constexpr to determine host byte order Expected behavior: error: accessing ‘<unnamed union>::c’ member instead of initialized ‘<unnamed union>::s’ member in constant expression 6 | static constexpr bool BigEndianHost = (union{short s;char c;}){1}.c != 1; Actual behavior: internal compiler error: in type_has_nontrivial_copy_init, at cp/tree.cc:4525 6 | static constexpr bool BigEndianHost = (union{short s;char c;}){1}.c != 1; If i remove "template<bool BigEndianData = true>" from the example code (see attachment), i get the expected behavior The exact version of GCC, and other required information is in the attachment ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/108936] internal compiler error: in type_has_nontrivial_copy_init, at cp/tree.cc:4525 2023-02-26 23:18 [Bug c++/108936] New: internal compiler error: in type_has_nontrivial_copy_init, at cp/tree.cc:4525 movaki1751 at vootin dot com @ 2023-02-27 15:25 ` marxin at gcc dot gnu.org 2023-02-27 18:10 ` mpolacek at gcc dot gnu.org 1 sibling, 0 replies; 3+ messages in thread From: marxin at gcc dot gnu.org @ 2023-02-27 15:25 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108936 Martin Liška <marxin at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2023-02-27 CC| |jason at gcc dot gnu.org, | |marxin at gcc dot gnu.org Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> --- Started likely with r9-1493-g8945521a50a7dd26, it was rejected before the revision. ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/108936] internal compiler error: in type_has_nontrivial_copy_init, at cp/tree.cc:4525 2023-02-26 23:18 [Bug c++/108936] New: internal compiler error: in type_has_nontrivial_copy_init, at cp/tree.cc:4525 movaki1751 at vootin dot com 2023-02-27 15:25 ` [Bug c++/108936] " marxin at gcc dot gnu.org @ 2023-02-27 18:10 ` mpolacek at gcc dot gnu.org 1 sibling, 0 replies; 3+ messages in thread From: mpolacek at gcc dot gnu.org @ 2023-02-27 18:10 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108936 Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mpolacek at gcc dot gnu.org --- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> --- template<bool BigEndianData = true> struct Endianness { static constexpr bool BigEndianHost = (union{short s;char c;}){1}.c != 1; }; int main() { Endianness<>::BigEndianHost; } $ ./cc1plus -quiet bz.C bz.C: In instantiation of ‘constexpr const bool Endianness<>::BigEndianHost’: bz.C:9:17: required from here bz.C:4:69: internal compiler error: in type_has_nontrivial_copy_init, at cp/tree.cc:4631 4 | static constexpr bool BigEndianHost = (union{short s;char c;}){1}.c != 1; | ~~~~^ 0x1058fa5 type_has_nontrivial_copy_init(tree_node const*) /home/mpolacek/src/gcc/gcc/cp/tree.cc:4631 0x1047c78 build_target_expr_with_type(tree_node*, tree_node*, int) /home/mpolacek/src/gcc/gcc/cp/tree.cc:904 0x1047e65 get_target_expr(tree_node*, int) /home/mpolacek/src/gcc/gcc/cp/tree.cc:948 0x10112be finish_compound_literal(tree_node*, tree_node*, int, fcl_t) /home/mpolacek/src/gcc/gcc/cp/semantics.cc:3356 0xfbfd62 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*) /home/mpolacek/src/gcc/gcc/cp/pt.cc:21515 0xfb763b tsubst_non_call_postfix_expression /home/mpolacek/src/gcc/gcc/cp/pt.cc:19866 0xfbe98a tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*) /home/mpolacek/src/gcc/gcc/cp/pt.cc:21314 0xfbab12 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*) /home/mpolacek/src/gcc/gcc/cp/pt.cc:20576 0xfb7019 tsubst_expr(tree_node*, tree_node*, int, tree_node*) /home/mpolacek/src/gcc/gcc/cp/pt.cc:19775 0xfa50de tsubst_init /home/mpolacek/src/gcc/gcc/cp/pt.cc:17014 0xfd413b regenerate_decl_from_template /home/mpolacek/src/gcc/gcc/cp/pt.cc:26334 0xfd62e8 instantiate_body /home/mpolacek/src/gcc/gcc/cp/pt.cc:26651 0xfd8412 instantiate_decl(tree_node*, bool, bool) /home/mpolacek/src/gcc/gcc/cp/pt.cc:27006 0xdc8886 mark_used(tree_node*, int) /home/mpolacek/src/gcc/gcc/cp/decl2.cc:5840 0x1016792 finish_id_expression_1 /home/mpolacek/src/gcc/gcc/cp/semantics.cc:4252 0x1017079 finish_id_expression(tree_node*, tree_node*, tree_node*, cp_id_kind*, bool, bool, bool*, bool, bool, bool, bool, char const**, unsigned int) /home/mpolacek/src/gcc/gcc/cp/semantics.cc:4398 0xed94b6 cp_parser_primary_expression /home/mpolacek/src/gcc/gcc/cp/parser.cc:6149 0xedd48c cp_parser_postfix_expression /home/mpolacek/src/gcc/gcc/cp/parser.cc:7777 0xee0e91 cp_parser_unary_expression /home/mpolacek/src/gcc/gcc/cp/parser.cc:9138 0xee243b cp_parser_cast_expression /home/mpolacek/src/gcc/gcc/cp/parser.cc:10044 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-27 18:10 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-02-26 23:18 [Bug c++/108936] New: internal compiler error: in type_has_nontrivial_copy_init, at cp/tree.cc:4525 movaki1751 at vootin dot com 2023-02-27 15:25 ` [Bug c++/108936] " marxin at gcc dot gnu.org 2023-02-27 18:10 ` mpolacek at gcc dot gnu.org
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).