https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70512
Bug ID: 70512 Summary: ICE on valid code on x86_64-linux-gnu: canonical types differ for identical types Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- The following code causes an ICE when compiled with the current GCC trunk on x86_64-linux-gnu in both 32-bit and 64-bit modes. This is a regression from 5.3.x. $ g++-trunk -v Using built-in specs. COLLECT_GCC=g++-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/usr/local/gcc-trunk --disable-bootstrap Thread model: posix gcc version 6.0.0 20160401 (experimental) [trunk revision 234665] (GCC) $ $ g++-5.3 -c small.cpp $ $ g++-trunk -c small.cpp small.cpp: In member function ‘S& S::operator=(int)’: small.cpp:5:13: internal compiler error: canonical types differ for identical types S* and S* return *this; ^~~~ 0x76ac7f comptypes(tree_node*, tree_node*, int) ../../gcc-source-trunk/gcc/cp/typeck.c:1428 0x786c1e ocp_convert(tree_node*, tree_node*, int, int, int) ../../gcc-source-trunk/gcc/cp/cvt.c:697 0x615753 convert_like_real ../../gcc-source-trunk/gcc/cp/call.c:6695 0x62197b initialize_reference(tree_node*, tree_node*, int, int) ../../gcc-source-trunk/gcc/cp/call.c:9958 0x775bdb check_return_expr(tree_node*, bool*) ../../gcc-source-trunk/gcc/cp/typeck.c:8920 0x7b609e finish_return_stmt(tree_node*) ../../gcc-source-trunk/gcc/cp/semantics.c:870 0x732aea cp_parser_jump_statement ../../gcc-source-trunk/gcc/cp/parser.c:11808 0x732aea cp_parser_statement ../../gcc-source-trunk/gcc/cp/parser.c:10414 0x73315c cp_parser_statement_seq_opt ../../gcc-source-trunk/gcc/cp/parser.c:10806 0x73324f cp_parser_compound_statement ../../gcc-source-trunk/gcc/cp/parser.c:10760 0x751a8f cp_parser_function_body ../../gcc-source-trunk/gcc/cp/parser.c:20653 0x751a8f cp_parser_ctor_initializer_opt_and_function_body ../../gcc-source-trunk/gcc/cp/parser.c:20689 0x752531 cp_parser_function_definition_after_declarator ../../gcc-source-trunk/gcc/cp/parser.c:25351 0x757960 cp_parser_late_parsing_for_member ../../gcc-source-trunk/gcc/cp/parser.c:26191 0x730039 cp_parser_class_specifier_1 ../../gcc-source-trunk/gcc/cp/parser.c:21524 0x730039 cp_parser_class_specifier ../../gcc-source-trunk/gcc/cp/parser.c:21550 0x730039 cp_parser_type_specifier ../../gcc-source-trunk/gcc/cp/parser.c:15834 0x749ea3 cp_parser_decl_specifier_seq ../../gcc-source-trunk/gcc/cp/parser.c:12758 0x753296 cp_parser_simple_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12301 0x753721 cp_parser_block_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12248 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. $ ------------------------------------- struct S { S& operator= (int) { return *this; } } __attribute__ ((__may_alias__));