Bug 65936 - [6 Regression] ICE: canonical types differ for identical types
Summary: [6 Regression] ICE: canonical types differ for identical types
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: 6.0
Assignee: Nathan Sidwell
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-30 05:38 UTC by James Almer
Modified: 2015-05-23 22:30 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.9.2, 5.0
Known to fail: 6.0
Last reconfirmed: 2015-04-30 00:00:00


Attachments
Preprocessed source as generated by -freport-bug (128.27 KB, application/x-gzip)
2015-04-30 05:38 UTC, James Almer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description James Almer 2015-04-30 05:38:14 UTC
Created attachment 35428 [details]
Preprocessed source as generated by -freport-bug

In file included from ./boost/move/utility_core.hpp:29:0,
                 from ./boost/intrusive/list.hpp:39,
                 from libs/log/src/attribute_set.cpp:19:
./boost/log/attributes/attribute_set.hpp: In member function ‘boost::log::v2_mt_posix::attribute_set::operator boost::rv<boost::log::v2_mt_posix::attribute_set>&()’:
./boost/move/core.hpp:246:56: internal compiler error: canonical types differ for identical types boost::rv<boost::log::v2_mt_posix::attribute_set>* and boost::rv<boost::log::v2_mt_posix::attribute_set>*
       {  return *static_cast< ::boost::rv<TYPE>* >(this);  }\
                                                        ^
./boost/log/attributes/attribute_set.hpp:82:5: note: in expansion of macro ‘BOOST_COPYABLE_AND_MOVABLE_ALT’
     BOOST_COPYABLE_AND_MOVABLE_ALT(attribute_set)
     ^
0x746a4e comptypes(tree_node*, tree_node*, int)
	/home/jamrial/gcc-6-20150426/gcc/cp/typeck.c:1428
0x7619de ocp_convert(tree_node*, tree_node*, int, int, int)
	/home/jamrial/gcc-6-20150426/gcc/cp/cvt.c:704
0x607310 convert_like_real
	/home/jamrial/gcc-6-20150426/gcc/cp/call.c:6557
0x612e0b initialize_reference(tree_node*, tree_node*, int, int)
	/home/jamrial/gcc-6-20150426/gcc/cp/call.c:9746
0x750bf2 check_return_expr(tree_node*, bool*)
	/home/jamrial/gcc-6-20150426/gcc/cp/typeck.c:8718
0x78e59e finish_return_stmt(tree_node*)
	/home/jamrial/gcc-6-20150426/gcc/cp/semantics.c:887
0x731cbe cp_parser_jump_statement
	/home/jamrial/gcc-6-20150426/gcc/cp/parser.c:11057
0x731cbe cp_parser_statement
	/home/jamrial/gcc-6-20150426/gcc/cp/parser.c:9707
0x732252 cp_parser_statement_seq_opt
	/home/jamrial/gcc-6-20150426/gcc/cp/parser.c:10095
0x7323ab cp_parser_compound_statement
	/home/jamrial/gcc-6-20150426/gcc/cp/parser.c:10049
0x7325db cp_parser_function_body
	/home/jamrial/gcc-6-20150426/gcc/cp/parser.c:19185
0x7325db cp_parser_ctor_initializer_opt_and_function_body
	/home/jamrial/gcc-6-20150426/gcc/cp/parser.c:19221
0x73341a cp_parser_function_definition_after_declarator
	/home/jamrial/gcc-6-20150426/gcc/cp/parser.c:23467
0x736a6c cp_parser_late_parsing_for_member
	/home/jamrial/gcc-6-20150426/gcc/cp/parser.c:24150
0x711c71 cp_parser_class_specifier_1
	/home/jamrial/gcc-6-20150426/gcc/cp/parser.c:20041
0x711c71 cp_parser_class_specifier
	/home/jamrial/gcc-6-20150426/gcc/cp/parser.c:20067
0x711c71 cp_parser_type_specifier
	/home/jamrial/gcc-6-20150426/gcc/cp/parser.c:14707
0x724eff cp_parser_decl_specifier_seq
	/home/jamrial/gcc-6-20150426/gcc/cp/parser.c:11938
0x7361b1 cp_parser_simple_declaration
	/home/jamrial/gcc-6-20150426/gcc/cp/parser.c:11515
0x72fe23 cp_parser_block_declaration
	/home/jamrial/gcc-6-20150426/gcc/cp/parser.c:11462
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.

-----

This is one of many ICEs i get while compiling libboost_log.so from Boost 1.58 with GCC 6.0.0 (20150426 snapshot) on ArchLinux x86_64. Most if not all seem to have a similar backtrace, so I'm posting only the first.
Comment 1 Markus Trippelsdorf 2015-04-30 06:13:03 UTC
markus@x4 tmp % cat test.ii
class A;
template <typename> struct B
{
  typedef A type;
};
template <class T> class C : public B<T>::type
{
}

__attribute__ ((__may_alias__));
class A
{
  operator const C<int> &() { return *static_cast<const C<int> *> (this); }
};

markus@x4 tmp % g++ -c test.ii
test.ii: In member function ‘A::operator const C<int>&()’:
test.ii:13:72: internal compiler error: canonical types differ for identical types const C<int>* and const C<int>*
Comment 2 Marek Polacek 2015-04-30 14:58:04 UTC
Started with r222419.
Comment 3 Nathan Sidwell 2015-05-23 22:29:25 UTC
Author: nathan
Date: Sat May 23 22:28:54 2015
New Revision: 223613

URL: https://gcc.gnu.org/viewcvs?rev=223613&root=gcc&view=rev
Log:
	cp/
	PR c++/65936
	* pt.c (lookup_template_class_1): Copy may_alias attribute too.

	testsuite/
	PR c++/65936
	* g++.dg/template/pr65936.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/template/pr65936.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog
Comment 4 Nathan Sidwell 2015-05-23 22:30:36 UTC
Patch committed to trunk