public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58600] New: [c++0x] ICE on wrong usage of alignas
@ 2013-10-02 21:00 reichelt at gcc dot gnu.org
  2013-10-03 10:26 ` [Bug c++/58600] [c++11] " mpolacek at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-10-02 21:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58600
           Summary: [c++0x] ICE on wrong usage of 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++11") triggers an ICE
since GCC 4.8.0 (when alignas was introduced):

================================
namespace N {}
using namespace N alignas(int);
================================

bug.cc:2:30: internal compiler error: tree check: expected identifier_node,
have tree_list in private_is_attribute_p, at tree.c:5540
 using namespace N alignas(int);
                              ^
0xcd87ea tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/gcc/tree.c:9176
0xcd8b64 tree_check
        ../../gcc/gcc/tree.h:2819
0xcd8b64 private_is_attribute_p(char const*, unsigned long, tree_node const*)
        ../../gcc/gcc/tree.c:5540
0x6ff9ff is_attribute_p
        ../../gcc/gcc/tree.h:3678
0x6ff9ff parse_using_directive(tree_node*, tree_node*)
        ../../gcc/gcc/cp/name-lookup.c:3995
0x6545c2 cp_parser_using_directive
        ../../gcc/gcc/cp/parser.c:15951
0x6545c2 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:10837
0x65cf1e cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10764
0x65bc8a cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10650
0x65d556 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:3939
0x65d556 c_parse_file()
        ../../gcc/gcc/cp/parser.c:28899
0x7709e3 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1046
Please submit a full bug report, [etc.]

A slightly modified example crashes in a different location:

================================
namespace N {}
using namespace N alignas(X);
================================

bug.cc:2:27: error: 'X' was not declared in this scope
 using namespace N alignas(X);
                           ^
bug.cc:2:27: internal compiler error: tree check: expected tree_list, have
error_mark in parse_using_directive, at cp/name-lookup.c:3994
0xcd87ea tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/gcc/tree.c:9176
0x6ffabe tree_check
        ../../gcc/gcc/tree.h:2609
0x6ffabe parse_using_directive(tree_node*, tree_node*)
        ../../gcc/gcc/cp/name-lookup.c:3994
0x6545c2 cp_parser_using_directive
        ../../gcc/gcc/cp/parser.c:15951
0x6545c2 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:10837
0x65cf1e cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10764
0x65bc8a cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10650
0x65d556 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:3939
0x65d556 c_parse_file()
        ../../gcc/gcc/cp/parser.c:28899
0x7709e3 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1046
Please submit a full bug report, [etc.]


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

* [Bug c++/58600] [c++11] ICE on wrong usage of alignas
  2013-10-02 21:00 [Bug c++/58600] New: [c++0x] ICE on wrong usage of alignas reichelt at gcc dot gnu.org
@ 2013-10-03 10:26 ` mpolacek at gcc dot gnu.org
  2013-10-04  1:05 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-03 10:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-10-03
                 CC|                            |dodji at gcc dot gnu.org,
                   |                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r192199.


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

* [Bug c++/58600] [c++11] ICE on wrong usage of alignas
  2013-10-02 21:00 [Bug c++/58600] New: [c++0x] ICE on wrong usage of alignas reichelt at gcc dot gnu.org
  2013-10-03 10:26 ` [Bug c++/58600] [c++11] " mpolacek at gcc dot gnu.org
@ 2013-10-04  1:05 ` paolo.carlini at oracle dot com
  2014-04-11  0:01 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-10-04  1:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Not sure if we want to do much better than below: it's suboptimal from many
points of view, but simply rejecting the alignas with the right location for
the error message (cmp, clang) as we probably should, requires rather invasive
changes.

Dodji, with your new diagnostic maintainer hat, what do you think? Should we
have interim something like the below, or not?

//////////////

Index: cp/name-lookup.c
===================================================================
--- cp/name-lookup.c    (revision 203192)
+++ cp/name-lookup.c    (working copy)
@@ -3985,13 +3985,14 @@ do_using_directive (tree name_space)
 void
 parse_using_directive (tree name_space, tree attribs)
 {
-  tree a;
-
   do_using_directive (name_space);

-  for (a = attribs; a; a = TREE_CHAIN (a))
+  if (attribs == error_mark_node)
+    return;
+
+  for (tree a = attribs; a; a = TREE_CHAIN (a))
     {
-      tree name = TREE_PURPOSE (a);
+      tree name = get_attribute_name (a);
       if (is_attribute_p ("strong", name))
     {
       if (!toplevel_bindings_p ())


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

* [Bug c++/58600] [c++11] ICE on wrong usage of alignas
  2013-10-02 21:00 [Bug c++/58600] New: [c++0x] ICE on wrong usage of alignas reichelt at gcc dot gnu.org
  2013-10-03 10:26 ` [Bug c++/58600] [c++11] " mpolacek at gcc dot gnu.org
  2013-10-04  1:05 ` paolo.carlini at oracle dot com
@ 2014-04-11  0:01 ` paolo.carlini at oracle dot com
  2014-04-11 17:37 ` paolo at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-04-11  0:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

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


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

* [Bug c++/58600] [c++11] ICE on wrong usage of alignas
  2013-10-02 21:00 [Bug c++/58600] New: [c++0x] ICE on wrong usage of alignas reichelt at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-04-11  0:01 ` paolo.carlini at oracle dot com
@ 2014-04-11 17:37 ` paolo at gcc dot gnu.org
  2014-04-11 17:38 ` paolo.carlini at oracle dot com
  2014-04-11 19:35 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-04-11 17:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Fri Apr 11 17:36:44 2014
New Revision: 209310

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

    PR c++/58600
    * name-lookup.c (parse_using_directive): Return early if the
    attribs argument is error_mark_node; use get_attribute_name.

/testsuite
2014-04-11  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/58600
    * g++.dg/cpp0x/gen-attrs-58.C: New.
    * g++.dg/cpp0x/gen-attrs-59.C: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/gen-attrs-58.C
    trunk/gcc/testsuite/g++.dg/cpp0x/gen-attrs-59.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/name-lookup.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/58600] [c++11] ICE on wrong usage of alignas
  2013-10-02 21:00 [Bug c++/58600] New: [c++0x] ICE on wrong usage of alignas reichelt at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-04-11 17:37 ` paolo at gcc dot gnu.org
@ 2014-04-11 17:38 ` paolo.carlini at oracle dot com
  2014-04-11 19:35 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-04-11 17:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 4.9.0.


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

* [Bug c++/58600] [c++11] ICE on wrong usage of alignas
  2013-10-02 21:00 [Bug c++/58600] New: [c++0x] ICE on wrong usage of alignas reichelt at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2014-04-11 17:38 ` paolo.carlini at oracle dot com
@ 2014-04-11 19:35 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-04-11 19:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.9.0                       |4.10.0

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> ---
In fact, only fixed for 4.10.0 so far.


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

end of thread, other threads:[~2014-04-11 19:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-02 21:00 [Bug c++/58600] New: [c++0x] ICE on wrong usage of alignas reichelt at gcc dot gnu.org
2013-10-03 10:26 ` [Bug c++/58600] [c++11] " mpolacek at gcc dot gnu.org
2013-10-04  1:05 ` paolo.carlini at oracle dot com
2014-04-11  0:01 ` paolo.carlini at oracle dot com
2014-04-11 17:37 ` paolo at gcc dot gnu.org
2014-04-11 17:38 ` paolo.carlini at oracle dot com
2014-04-11 19:35 ` paolo.carlini at oracle dot com

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).