public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95711] New: namespace alias fails inside coroutine
@ 2020-06-16 19:01 alejandromagic at hotmail dot com
  2020-06-16 21:28 ` [Bug c++/95711] " alejandromagic at hotmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: alejandromagic at hotmail dot com @ 2020-06-16 19:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95711
           Summary: namespace alias fails inside coroutine
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alejandromagic at hotmail dot com
  Target Milestone: ---

Created attachment 48743
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48743&action=edit
Preprocessed file

The following codes triggers a "Compiler internal Error":
namespace A
{

}
generator<int> parse()
{
    namespace B = A;
    co_yield 1;
}

Where generator<T> is just any generator implementation I've tried (I don't
think it have nothing to do with its actual implementation anyway, so I'm
providing the simplest working generator in the attached files). It essentially
happens when any namespace alias is defined inside a lambda. As an attachment I
provide the preprocessed file, although I guess the source should be enough (I
only #include coroutine for obvious reasons).

The command used to compile is:
gcc -v -save-temps --std=c++20 -fcoroutines main.cpp

The system is:
Linux parrot 4.14.0-parrot13-amd64 #1 SMP Parrot 4.14.13-1parrot13 (2018-01-21)
x86_64 GNU/Linux

The output of the compiler (in case it is needed):


Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --disable-multilib
--enable-languages=c,c++,go
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20200507 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++2a' '-fcoroutines'
'-mtune=generic' '-march=x86-64'
 /usr/local/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/cc1plus -E -quiet -v
-imultiarch x86_64-linux-gnu -D_GNU_SOURCE main.cpp -mtune=generic
-march=x86-64 -std=c++2a -fcoroutines -fpch-preprocess -o main.ii
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/local/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../include/c++/11.0.0

/usr/local/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../include/c++/11.0.0/x86_64-pc-linux-gnu

/usr/local/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../include/c++/11.0.0/backward
 /usr/local/lib/gcc/x86_64-pc-linux-gnu/11.0.0/include
 /usr/local/include
 /usr/local/lib/gcc/x86_64-pc-linux-gnu/11.0.0/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++2a' '-fcoroutines'
'-mtune=generic' '-march=x86-64'
 /usr/local/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/cc1plus -fpreprocessed
main.ii -quiet -dumpbase main.cpp -mtune=generic -march=x86-64 -auxbase main
-std=c++2a -version -fcoroutines -o main.s
GNU C++17 (GCC) version 11.0.0 20200507 (experimental) (x86_64-pc-linux-gnu)
        compiled by GNU C version 11.0.0 20200507 (experimental), GMP version
6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version none
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU C++17 (GCC) version 11.0.0 20200507 (experimental) (x86_64-pc-linux-gnu)
        compiled by GNU C version 11.0.0 20200507 (experimental), GMP version
6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version none
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 879e7d5007757f82203f25a489026164
main.cpp: In function ‘generator<int> parse()’:
main.cpp:60:1: internal compiler error: tree check: expected var_decl or
parm_decl or result_decl, have namespace_decl in register_local_var_uses, at
cp/coroutines.cc:3440
   60 | }
      | ^
0x7df6ea tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/gcc/tree.c:9731
0x61a5d5 tree_check3(tree_node*, char const*, int, char const*, tree_code,
tree_code, tree_code)
        ../../gcc/gcc/tree.h:3334
0x61a5d5 register_local_var_uses
        ../../gcc/gcc/cp/coroutines.cc:3440
0x12ab9fa walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
        ../../gcc/gcc/tree.c:12001
0x8e44e6 morph_fn_to_coro(tree_node*, tree_node**, tree_node**)
        ../../gcc/gcc/cp/coroutines.cc:3815
0x92ebf1 finish_function(bool)
        ../../gcc/gcc/cp/decl.c:16921
0x9d8427 cp_parser_function_definition_after_declarator
        ../../gcc/gcc/cp/parser.c:29013
0x9d9409 cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/gcc/cp/parser.c:28926
0x9d9409 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:20675
0x9ba1d2 cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:13739
0x9e33d2 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:13438
0x9e3b5a cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4734
0x9e3b5a c_parse_file()
        ../../gcc/gcc/cp/parser.c:43989
0xaf965b c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1190
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug c++/95711] namespace alias fails inside coroutine
  2020-06-16 19:01 [Bug c++/95711] New: namespace alias fails inside coroutine alejandromagic at hotmail dot com
@ 2020-06-16 21:28 ` alejandromagic at hotmail dot com
  2020-06-21 12:59 ` iains at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: alejandromagic at hotmail dot com @ 2020-06-16 21:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Alejandro <alejandromagic at hotmail dot com> ---
When I said "It essentially happens when any namespace alias is defined inside
a lambda" I meant inside a coroutine

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

* [Bug c++/95711] namespace alias fails inside coroutine
  2020-06-16 19:01 [Bug c++/95711] New: namespace alias fails inside coroutine alejandromagic at hotmail dot com
  2020-06-16 21:28 ` [Bug c++/95711] " alejandromagic at hotmail dot com
@ 2020-06-21 12:59 ` iains at gcc dot gnu.org
  2020-06-28 12:52 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: iains at gcc dot gnu.org @ 2020-06-21 12:59 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Assignee|unassigned at gcc dot gnu.org      |iains at gcc dot gnu.org
   Last reconfirmed|2020-06-17 00:00:00         |2020-06-21
     Ever confirmed|0                           |1
   Target Milestone|---                         |10.2

--- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> ---
thanks for the report.

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

* [Bug c++/95711] namespace alias fails inside coroutine
  2020-06-16 19:01 [Bug c++/95711] New: namespace alias fails inside coroutine alejandromagic at hotmail dot com
  2020-06-16 21:28 ` [Bug c++/95711] " alejandromagic at hotmail dot com
  2020-06-21 12:59 ` iains at gcc dot gnu.org
@ 2020-06-28 12:52 ` cvs-commit at gcc dot gnu.org
  2020-06-30 12:46 ` cvs-commit at gcc dot gnu.org
  2020-06-30 12:50 ` iains at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-28 12:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:

https://gcc.gnu.org/g:06ed4aae1c2fa84b7050a286d866db4a6def3c36

commit r11-1694-g06ed4aae1c2fa84b7050a286d866db4a6def3c36
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Sun Jun 28 12:29:11 2020 +0100

    coroutines: Handle namespaces while scanning local vars [PR95711].

    We need to skip past namespace decls when scanning the bind
    expression var lists checking for local vars.

    gcc/cp/ChangeLog:

            PR c++/95711
            * coroutines.cc (register_local_var_uses): Skip past
            namespace decls.

    gcc/testsuite/ChangeLog:

            PR c++/95711
            * g++.dg/coroutines/pr95711.C: New test.

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

* [Bug c++/95711] namespace alias fails inside coroutine
  2020-06-16 19:01 [Bug c++/95711] New: namespace alias fails inside coroutine alejandromagic at hotmail dot com
                   ` (2 preceding siblings ...)
  2020-06-28 12:52 ` cvs-commit at gcc dot gnu.org
@ 2020-06-30 12:46 ` cvs-commit at gcc dot gnu.org
  2020-06-30 12:50 ` iains at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-30 12:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Iain D Sandoe
<iains@gcc.gnu.org>:

https://gcc.gnu.org/g:65025a6dae4b2c62ca79d2d0687229dafa93af7f

commit r10-8395-g65025a6dae4b2c62ca79d2d0687229dafa93af7f
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Tue Jun 30 08:29:11 2020 +0100

    coroutines: Handle namespaces while scanning local vars [PR95711].

    We need to skip past namespace decls when scanning the bind
    expression var lists checking for local vars.

    gcc/cp/ChangeLog:

            PR c++/95711
            * coroutines.cc (register_local_var_uses): Skip past
            namespace decls.

    gcc/testsuite/ChangeLog:

            PR c++/95711
            * g++.dg/coroutines/pr95711.C: New test.

    (cherry picked from commit 06ed4aae1c2fa84b7050a286d866db4a6def3c36)

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

* [Bug c++/95711] namespace alias fails inside coroutine
  2020-06-16 19:01 [Bug c++/95711] New: namespace alias fails inside coroutine alejandromagic at hotmail dot com
                   ` (3 preceding siblings ...)
  2020-06-30 12:46 ` cvs-commit at gcc dot gnu.org
@ 2020-06-30 12:50 ` iains at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: iains at gcc dot gnu.org @ 2020-06-30 12:50 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #5 from Iain Sandoe <iains at gcc dot gnu.org> ---
fixed for master and 10.2

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

end of thread, other threads:[~2020-06-30 12:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-16 19:01 [Bug c++/95711] New: namespace alias fails inside coroutine alejandromagic at hotmail dot com
2020-06-16 21:28 ` [Bug c++/95711] " alejandromagic at hotmail dot com
2020-06-21 12:59 ` iains at gcc dot gnu.org
2020-06-28 12:52 ` cvs-commit at gcc dot gnu.org
2020-06-30 12:46 ` cvs-commit at gcc dot gnu.org
2020-06-30 12:50 ` iains 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).