public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58584] New: [c++11] ICE with invalid argument for alignas
@ 2013-09-30 20:27 reichelt at gcc dot gnu.org
  2013-09-30 21:29 ` [Bug c++/58584] " paolo.carlini at oracle dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-09-30 20:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58584
           Summary: [c++11] ICE with invalid argument for alignas
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org

The following invalid code snippet (compiled with "-std=c++0x") triggers an ICE
since GCC 4.8.0 (when alignas was introduced):

========================
struct A
{
  int i alignas(this);
};
========================

bug.cc:3:17: error: invalid use of 'this' at top level
   int i alignas(this);
                 ^
bug.cc:3:17: internal compiler error: tree check: expected tree_list, have
error_mark in cp_check_const_attributes, at cp/decl2.c:1325
0xcd8a0a tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/gcc/tree.c:9176
0x6110cb tree_check
        ../../gcc/gcc/tree.h:2609
0x6110cb cp_check_const_attributes
        ../../gcc/gcc/cp/decl2.c:1325
0x6110cb cplus_decl_attributes(tree_node**, tree_node*, int)
        ../../gcc/gcc/cp/decl2.c:1351
0x6161b7 grokfield(cp_declarator const*, cp_decl_specifier_seq*, tree_node*,
bool, tree_node*, tree_node*)
        ../../gcc/gcc/cp/decl2.c:989
0x636a92 cp_parser_member_declaration
        ../../gcc/gcc/cp/parser.c:20084
0x6376ce cp_parser_member_specification_opt
        ../../gcc/gcc/cp/parser.c:19630
0x6376ce cp_parser_class_specifier_1
        ../../gcc/gcc/cp/parser.c:18885
0x63a070 cp_parser_class_specifier
        ../../gcc/gcc/cp/parser.c:19101
0x63a070 cp_parser_type_specifier
        ../../gcc/gcc/cp/parser.c:14080
0x64f549 cp_parser_decl_specifier_seq
        ../../gcc/gcc/cp/parser.c:11328
0x6535d9 cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:10918
0x6555e0 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:10867
0x65e5ee cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10764
0x65d35a cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10650
0x65ec36 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:3939
0x65ec36 c_parse_file()
        ../../gcc/gcc/cp/parser.c:28898
0x772143 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1046
Please submit a full bug report, [etc.]

A template version of the code crashes in a different place:

========================
template<int> struct A
{
  int i alignas(this);
};
========================

neu50B.cc:3:17: error: invalid use of 'this' at top level
   int i alignas(this);
                 ^
neu50B.cc:3:17: internal compiler error: tree check: expected tree_list, have
error_mark in get_attribute_name, at attribs.c:659
0xcd8a0a tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/gcc/tree.c:9176
0x72a595 tree_check
        ../../gcc/gcc/tree.h:2819
0x72a595 get_attribute_name(tree_node const*)
        ../../gcc/gcc/attribs.c:659
0x610d23 is_late_template_attribute
        ../../gcc/gcc/cp/decl2.c:1120
0x610d23 splice_template_attributes
        ../../gcc/gcc/cp/decl2.c:1200
0x610d23 save_template_attributes
        ../../gcc/gcc/cp/decl2.c:1221
0x610d23 cplus_decl_attributes(tree_node**, tree_node*, int)
        ../../gcc/gcc/cp/decl2.c:1348
0x6161b7 grokfield(cp_declarator const*, cp_decl_specifier_seq*, tree_node*,
bool, tree_node*, tree_node*)
        ../../gcc/gcc/cp/decl2.c:989
0x636a92 cp_parser_member_declaration
        ../../gcc/gcc/cp/parser.c:20084
0x6376ce cp_parser_member_specification_opt
        ../../gcc/gcc/cp/parser.c:19630
0x6376ce cp_parser_class_specifier_1
        ../../gcc/gcc/cp/parser.c:18885
0x63a070 cp_parser_class_specifier
        ../../gcc/gcc/cp/parser.c:19101
0x63a070 cp_parser_type_specifier
        ../../gcc/gcc/cp/parser.c:14080
0x64f549 cp_parser_decl_specifier_seq
        ../../gcc/gcc/cp/parser.c:11328
0x653bb3 cp_parser_single_declaration
        ../../gcc/gcc/cp/parser.c:22578
0x656990 cp_parser_template_declaration_after_export
        ../../gcc/gcc/cp/parser.c:22454
0x65e789 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10728
0x65d35a cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10650
0x65ec36 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:3939
0x65ec36 c_parse_file()
        ../../gcc/gcc/cp/parser.c:28898
Please submit a full bug report, [etc.]


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

* [Bug c++/58584] [c++11] ICE with invalid argument for alignas
  2013-09-30 20:27 [Bug c++/58584] New: [c++11] ICE with invalid argument for alignas reichelt at gcc dot gnu.org
@ 2013-09-30 21:29 ` paolo.carlini at oracle dot com
  2013-10-01 11:46 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-09-30 21:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Please don't use anymore -std=c++0x, it's legacy, supported only for backward
compatibility.


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

* [Bug c++/58584] [c++11] ICE with invalid argument for alignas
  2013-09-30 20:27 [Bug c++/58584] New: [c++11] ICE with invalid argument for alignas reichelt at gcc dot gnu.org
  2013-09-30 21:29 ` [Bug c++/58584] " paolo.carlini at oracle dot com
@ 2013-10-01 11:46 ` mpolacek at gcc dot gnu.org
  2013-10-01 11:47 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-01 11:46 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-10-01
     Ever confirmed|0                           |1


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

* [Bug c++/58584] [c++11] ICE with invalid argument for alignas
  2013-09-30 20:27 [Bug c++/58584] New: [c++11] ICE with invalid argument for alignas reichelt at gcc dot gnu.org
  2013-09-30 21:29 ` [Bug c++/58584] " paolo.carlini at oracle dot com
  2013-10-01 11:46 ` mpolacek at gcc dot gnu.org
@ 2013-10-01 11:47 ` mpolacek at gcc dot gnu.org
  2013-10-03  0:25 ` paolo.carlini at oracle dot com
  2013-10-03 22:51 ` paolo at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-01 11:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The second one started with r192199 as well.


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

* [Bug c++/58584] [c++11] ICE with invalid argument for alignas
  2013-09-30 20:27 [Bug c++/58584] New: [c++11] ICE with invalid argument for alignas reichelt at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2013-10-01 11:47 ` mpolacek at gcc dot gnu.org
@ 2013-10-03  0:25 ` paolo.carlini at oracle dot com
  2013-10-03 22:51 ` paolo at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-10-03  0:25 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com
   Target Milestone|---                         |4.9.0

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Mine.


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

* [Bug c++/58584] [c++11] ICE with invalid argument for alignas
  2013-09-30 20:27 [Bug c++/58584] New: [c++11] ICE with invalid argument for alignas reichelt at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2013-10-03  0:25 ` paolo.carlini at oracle dot com
@ 2013-10-03 22:51 ` paolo at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: paolo at gcc dot gnu.org @ 2013-10-03 22:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Thu Oct  3 22:50:59 2013
New Revision: 203193

URL: http://gcc.gnu.org/viewcvs?rev=203193&root=gcc&view=rev
Log:
/cp
2013-10-04  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/58584
    * decl2.c (save_template_attributes): Handle error_mark_node as
    *attr_p argument.
    (cp_check_const_attributes): Likewise for attributes.
    * parser.c (cp_parser_std_attribute_spec): When alignas_expr is an
    error_mark_node call cp_parser_skip_to_end_of_statement.

/testsuite
2013-10-04  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/58584
    * g++.dg/cpp0x/gen-attrs-55.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/gen-attrs-55.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl2.c
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2013-10-03 22:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-30 20:27 [Bug c++/58584] New: [c++11] ICE with invalid argument for alignas reichelt at gcc dot gnu.org
2013-09-30 21:29 ` [Bug c++/58584] " paolo.carlini at oracle dot com
2013-10-01 11:46 ` mpolacek at gcc dot gnu.org
2013-10-01 11:47 ` mpolacek at gcc dot gnu.org
2013-10-03  0:25 ` paolo.carlini at oracle dot com
2013-10-03 22:51 ` paolo 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).