public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60217] New: Numerous ICEs involving wrong usage of __bases
@ 2014-02-15 22:20 reichelt at gcc dot gnu.org
  2015-02-10  6:13 ` [Bug c++/60217] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: reichelt at gcc dot gnu.org @ 2014-02-15 22:20 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60217

            Bug ID: 60217
           Summary: Numerous ICEs involving wrong usage of __bases
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org

One note up front: The testcases below involving __bases can be compiled
in C++98 mode. But, since __bases yields a parameter pack, shouldn't its
use only be allowed in C++11 mode - or at least trigger a warning in
C++98 mode?

The following invalid code snippet triggers an ICE since GCC 4.7.0
(when __bases was introduced):

==================================
template<typename> struct A
{
  typedef A<__bases(int)> B;
};
==================================

bug.cc:3:25: internal compiler error: tree check: expected tree that contains
'typed' structure, have 'bases' in
any_template_arguments_need_structural_equality_p, at cp/pt.c:20994
   typedef A<__bases(int)> B;
                         ^
0xdc0f94 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
        ../../gcc/gcc/tree.c:9364
0x626497 contains_struct_check
        ../../gcc/gcc/tree.h:2823
0x626497 any_template_arguments_need_structural_equality_p
        ../../gcc/gcc/cp/pt.c:20994
0x626497 lookup_template_class_1
        ../../gcc/gcc/cp/pt.c:7553
0x626497 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ../../gcc/gcc/cp/pt.c:7725
0x72dcb2 finish_template_type(tree_node*, tree_node*, int)
        ../../gcc/gcc/cp/semantics.c:2953
0x6c2068 cp_parser_template_id
        ../../gcc/gcc/cp/parser.c:13440
0x6c2388 cp_parser_class_name
        ../../gcc/gcc/cp/parser.c:19074
0x6b3bb9 cp_parser_qualifying_entity
        ../../gcc/gcc/cp/parser.c:5524
0x6b3bb9 cp_parser_nested_name_specifier_opt
        ../../gcc/gcc/cp/parser.c:5249
0x6cba67 cp_parser_simple_type_specifier
        ../../gcc/gcc/cp/parser.c:14638
0x6a948d cp_parser_type_specifier
        ../../gcc/gcc/cp/parser.c:14380
0x6c2ba0 cp_parser_decl_specifier_seq
        ../../gcc/gcc/cp/parser.c:11547
0x6a5fb3 cp_parser_member_declaration
        ../../gcc/gcc/cp/parser.c:20121
0x6a9724 cp_parser_member_specification_opt
        ../../gcc/gcc/cp/parser.c:19976
0x6a9724 cp_parser_class_specifier_1
        ../../gcc/gcc/cp/parser.c:19210
0x6a9724 cp_parser_class_specifier
        ../../gcc/gcc/cp/parser.c:19437
0x6a9724 cp_parser_type_specifier
        ../../gcc/gcc/cp/parser.c:14302
0x6c2ba0 cp_parser_decl_specifier_seq
        ../../gcc/gcc/cp/parser.c:11547
0x6c8883 cp_parser_single_declaration
        ../../gcc/gcc/cp/parser.c:23039
Please submit a full bug report, [etc.]

With an even shorter testcase one can trigger a different ICE:

==================================
template<typename> struct A
{
  typedef __bases(int) B;
};
==================================

bug.cc:3:24: internal compiler error: tree check: expected tree that contains
'common' structure, have 'bases' in set_underlying_type, at
c-family/c-common.c:11445
   typedef __bases(int) B;
                        ^
0xdc0f94 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
        ../../gcc/gcc/tree.c:9364
0x7e1c54 contains_struct_check
        ../../gcc/gcc/tree.h:2823
0x7e1c54 set_underlying_type(tree_node*)
        ../../gcc/gcc/c-family/c-common.c:11445
0x686426 grokfield(cp_declarator const*, cp_decl_specifier_seq*, tree_node*,
bool, tree_node*, tree_node*)
        ../../gcc/gcc/cp/decl2.c:898
0x6a611f cp_parser_member_declaration
        ../../gcc/gcc/cp/parser.c:20429
0x6a9724 cp_parser_member_specification_opt
        ../../gcc/gcc/cp/parser.c:19976
0x6a9724 cp_parser_class_specifier_1
        ../../gcc/gcc/cp/parser.c:19210
0x6a9724 cp_parser_class_specifier
        ../../gcc/gcc/cp/parser.c:19437
0x6a9724 cp_parser_type_specifier
        ../../gcc/gcc/cp/parser.c:14302
0x6c2ba0 cp_parser_decl_specifier_seq
        ../../gcc/gcc/cp/parser.c:11547
0x6c8883 cp_parser_single_declaration
        ../../gcc/gcc/cp/parser.c:23039
0x6c8d64 cp_parser_template_declaration_after_export
        ../../gcc/gcc/cp/parser.c:22915
0x6d4119 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10947
0x6d2c08 cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10869
0x6d44aa cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4014
0x6d44aa c_parse_file()
        ../../gcc/gcc/cp/parser.c:31536
0x7f3813 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1060
Please submit a full bug report, [etc.]

The last testcase only crashes trunk:

==================================
template<typename> struct A
{
  typedef A<__bases(int) = int> B;
};
==================================

bug.cc:3:24: internal compiler error: tree check: expected tree that contains
'typed' structure, have 'bases' in build_functional_cast, at cp/typeck2.c:1787
   typedef A<__bases(int) = int> B;
                        ^
0xdc0f94 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
        ../../gcc/gcc/tree.c:9364
0x653589 contains_struct_check
        ../../gcc/gcc/tree.h:2823
0x653589 build_functional_cast(tree_node*, tree_node*, int)
        ../../gcc/gcc/cp/typeck2.c:1787
0x6b8559 cp_parser_functional_cast
        ../../gcc/gcc/cp/parser.c:23195
0x6b20fa cp_parser_postfix_expression
        ../../gcc/gcc/cp/parser.c:5884
0x6b5116 cp_parser_unary_expression
        ../../gcc/gcc/cp/parser.c:7170
0x6b5e3f cp_parser_binary_expression
        ../../gcc/gcc/cp/parser.c:7874
0x6b6331 cp_parser_assignment_expression
        ../../gcc/gcc/cp/parser.c:8112
0x6b6793 cp_parser_assignment_expression
        ../../gcc/gcc/cp/parser.c:8162
0x6b6793 cp_parser_constant_expression
        ../../gcc/gcc/cp/parser.c:8372
0x6c0d30 cp_parser_template_argument
        ../../gcc/gcc/cp/parser.c:13998
0x6c0d30 cp_parser_template_argument_list
        ../../gcc/gcc/cp/parser.c:13721
0x6c0d30 cp_parser_enclosed_template_argument_list
        ../../gcc/gcc/cp/parser.c:23330
0x6c1d22 cp_parser_template_id
        ../../gcc/gcc/cp/parser.c:13419
0x6c2388 cp_parser_class_name
        ../../gcc/gcc/cp/parser.c:19074
0x6b3bb9 cp_parser_qualifying_entity
        ../../gcc/gcc/cp/parser.c:5524
0x6b3bb9 cp_parser_nested_name_specifier_opt
        ../../gcc/gcc/cp/parser.c:5249
0x6cba67 cp_parser_simple_type_specifier
        ../../gcc/gcc/cp/parser.c:14638
0x6a948d cp_parser_type_specifier
        ../../gcc/gcc/cp/parser.c:14380
0x6c2ba0 cp_parser_decl_specifier_seq
        ../../gcc/gcc/cp/parser.c:11547
Please submit a full bug report, [etc.]


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/60217] Numerous ICEs involving wrong usage of __bases
  2014-02-15 22:20 [Bug c++/60217] New: Numerous ICEs involving wrong usage of __bases reichelt at gcc dot gnu.org
@ 2015-02-10  6:13 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-02-10  6:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60217

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-02-10
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-10  6:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-15 22:20 [Bug c++/60217] New: Numerous ICEs involving wrong usage of __bases reichelt at gcc dot gnu.org
2015-02-10  6:13 ` [Bug c++/60217] " pinskia 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).