public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56710] New: Using reserved double underscore variable name in a lambda causes internal compiler error
@ 2013-03-24 14:24 noname at nurd dot se
  2013-03-24 14:47 ` [Bug c++/56710] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: noname at nurd dot se @ 2013-03-24 14:24 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56710
           Summary: Using reserved double underscore variable name in a
                    lambda causes internal compiler error
    Classification: Unclassified
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: noname@nurd.se


When using any reserved double underscore prefix variable name within a lambda
combined with a non-double underscore variable with the same name will cause a
name lookup internal compiler error.

Minimal example:

int main()
{
    int t = 0;
    return [&]() -> int {int __t; __t = t; return __t; }();
}

command line and output from the latest git snapshot of 4.9.0:
(fyi. g++ 4.7.2-2ubuntu1 produces similar results but with less verbose output,
so the bug was likely introduced before or with 4.7.2)

$ g++ -v -save-temps -std=c++0x -o test test.cpp
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure
Thread model: posix
gcc version 4.9.0 20130324 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-o' 'test'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/cc1plus -E -quiet -v
-imultilib . -imultiarch x86_64-linux-gnu -D_GNU_SOURCE test.cpp -mtune=generic
-march=x86-64 -std=c++11 -fpch-preprocess -o test.ii
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:

/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0

/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/x86_64-unknown-linux-gnu/.

/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/backward
 /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/include
 /usr/local/include
 /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-o' 'test'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/cc1plus -fpreprocessed
test.ii -quiet -dumpbase test.cpp -mtune=generic -march=x86-64 -auxbase test
-std=c++11 -version -o test.s
GNU C++ (GCC) version 4.9.0 20130324 (experimental) (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.9.0 20130324 (experimental), GMP version 5.0.2,
MPFR version 3.1.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU C++ (GCC) version 4.9.0 20130324 (experimental) (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.9.0 20130324 (experimental), GMP version 5.0.2,
MPFR version 3.1.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 06fd05e24840af5f20c0ad55456ec1cf
test.cpp: In lambda function:
test.cpp:4:53: internal compiler error: in pop_binding, at cp/name-lookup.c:380
  return [&]() -> int {int __t; __t = t; return __t; }();
                                                     ^
0x6c1c4e pop_binding(tree_node*, tree_node*)
    ../.././gcc/cp/name-lookup.c:380
0x523427 poplevel(int, int, int)
    ../.././gcc/cp/decl.c:731
0x66fbb3 do_poplevel(tree_node*)
    ../.././gcc/cp/semantics.c:436
0x673cf9 finish_compound_stmt(tree_node*)
    ../.././gcc/cp/semantics.c:1287
0x603241 cp_parser_lambda_body
    ../.././gcc/cp/parser.c:8725
0x603241 cp_parser_lambda_expression
    ../.././gcc/cp/parser.c:8272
0x603241 cp_parser_primary_expression
    ../.././gcc/cp/parser.c:4087
0x604f78 cp_parser_postfix_expression
    ../.././gcc/cp/parser.c:5643
0x607545 cp_parser_unary_expression
    ../.././gcc/cp/parser.c:6711
0x60815b cp_parser_binary_expression
    ../.././gcc/cp/parser.c:7403
0x60860f cp_parser_assignment_expression
    ../.././gcc/cp/parser.c:7639
0x60a483 cp_parser_expression
    ../.././gcc/cp/parser.c:7801
0x601462 cp_parser_expression
    ../.././gcc/cp/parser.c:7840
0x601462 cp_parser_jump_statement
    ../.././gcc/cp/parser.c:10109
0x601462 cp_parser_statement
    ../.././gcc/cp/parser.c:8843
0x601cde cp_parser_statement_seq_opt
    ../.././gcc/cp/parser.c:9207
0x601e26 cp_parser_compound_statement
    ../.././gcc/cp/parser.c:9161
0x613253 cp_parser_function_body
    ../.././gcc/cp/parser.c:17775
0x613253 cp_parser_ctor_initializer_opt_and_function_body
    ../.././gcc/cp/parser.c:17811
0x6142df cp_parser_function_definition_after_declarator
    ../.././gcc/cp/parser.c:21786
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.


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

* [Bug c++/56710] Using reserved double underscore variable name in a lambda causes internal compiler error
  2013-03-24 14:24 [Bug c++/56710] New: Using reserved double underscore variable name in a lambda causes internal compiler error noname at nurd dot se
@ 2013-03-24 14:47 ` redi at gcc dot gnu.org
  2013-03-28 20:05 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2013-03-24 14:47 UTC (permalink / raw)
  To: gcc-bugs


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-checking,
                   |                            |ice-on-invalid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-03-24
     Ever Confirmed|0                           |1


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

* [Bug c++/56710] Using reserved double underscore variable name in a lambda causes internal compiler error
  2013-03-24 14:24 [Bug c++/56710] New: Using reserved double underscore variable name in a lambda causes internal compiler error noname at nurd dot se
  2013-03-24 14:47 ` [Bug c++/56710] " redi at gcc dot gnu.org
@ 2013-03-28 20:05 ` jason at gcc dot gnu.org
  2013-11-07  6:06 ` allan at archlinux dot org
  2014-10-15 16:47 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-28 20:05 UTC (permalink / raw)
  To: gcc-bugs


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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jason at gcc dot gnu.org
         Resolution|                            |FIXED
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |
   Target Milestone|---                         |4.9.0

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-28 20:05:42 UTC ---
Fixed for 4.9.


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

* [Bug c++/56710] Using reserved double underscore variable name in a lambda causes internal compiler error
  2013-03-24 14:24 [Bug c++/56710] New: Using reserved double underscore variable name in a lambda causes internal compiler error noname at nurd dot se
  2013-03-24 14:47 ` [Bug c++/56710] " redi at gcc dot gnu.org
  2013-03-28 20:05 ` jason at gcc dot gnu.org
@ 2013-11-07  6:06 ` allan at archlinux dot org
  2014-10-15 16:47 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: allan at archlinux dot org @ 2013-11-07  6:06 UTC (permalink / raw)
  To: gcc-bugs

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

Allan McRae <allan at archlinux dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |allan at archlinux dot org

--- Comment #2 from Allan McRae <allan at archlinux dot org> ---
I had a user report an ICE in gcc-4.8 that is fixed with this change [1].  Is
it possible to get this backported?


[1] https://bugs.archlinux.org/task/35803


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

* [Bug c++/56710] Using reserved double underscore variable name in a lambda causes internal compiler error
  2013-03-24 14:24 [Bug c++/56710] New: Using reserved double underscore variable name in a lambda causes internal compiler error noname at nurd dot se
                   ` (2 preceding siblings ...)
  2013-11-07  6:06 ` allan at archlinux dot org
@ 2014-10-15 16:47 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2014-10-15 16:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Wed Oct 15 16:46:23 2014
New Revision: 216275

URL: https://gcc.gnu.org/viewcvs?rev=216275&root=gcc&view=rev
Log:
    PR c++/56710
    * semantics.c (finish_member_declaration): Don't push closure
    members.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-names1.C
Modified:
    branches/gcc-4_8-branch/gcc/cp/ChangeLog
    branches/gcc-4_8-branch/gcc/cp/semantics.c


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

end of thread, other threads:[~2014-10-15 16:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-24 14:24 [Bug c++/56710] New: Using reserved double underscore variable name in a lambda causes internal compiler error noname at nurd dot se
2013-03-24 14:47 ` [Bug c++/56710] " redi at gcc dot gnu.org
2013-03-28 20:05 ` jason at gcc dot gnu.org
2013-11-07  6:06 ` allan at archlinux dot org
2014-10-15 16:47 ` jason 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).