public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103580] New: G++ internal compiler error with coroutines and initializer list
@ 2021-12-06 11:15 lcw at fb dot com
  2021-12-06 13:51 ` [Bug c++/103580] " marxin at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: lcw at fb dot com @ 2021-12-06 11:15 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103580
           Summary: G++ internal compiler error with coroutines and
                    initializer list
           Product: gcc
           Version: 10.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lcw at fb dot com
  Target Milestone: ---

$ g++-10 -v repro.cc -std=c++20 -fcoroutines
Using built-in specs.
COLLECT_GCC=g++-10
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
10.3.0-1ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-10
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib
--enable-libphobos-checking=release --with-target-system-zlib=auto
--enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic
--enable-offload-targets=nvptx-none=/build/gcc-10-S4I5Pr/gcc-10-10.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-10-S4I5Pr/gcc-10-10.3.0/debian/tmp-gcn/usr,hsa
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
--with-build-config=bootstrap-lto-lean --enable-link-mutex
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.3.0 (Ubuntu 10.3.0-1ubuntu1~20.04)
COLLECT_GCC_OPTIONS='-v' '-std=c++2a' '-fcoroutines' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/10/cc1plus -quiet -v -imultiarch
x86_64-linux-gnu -D_GNU_SOURCE repro.cc -quiet -dumpbase repro.cc
-mtune=generic -march=x86-64 -auxbase repro -std=c++2a -version -fcoroutines
-fasynchronous-unwind-tables -fstack-protector-strong -Wformat
-Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/cckM8bJv.s
GNU C++17 (Ubuntu 10.3.0-1ubuntu1~20.04) version 10.3.0 (x86_64-linux-gnu)
        compiled by GNU C version 10.3.0, GMP version 6.2.0, MPFR version
4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/10"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/10/include-fixed"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/10
 /usr/include/x86_64-linux-gnu/c++/10
 /usr/include/c++/10/backward
 /usr/lib/gcc/x86_64-linux-gnu/10/include
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
GNU C++17 (Ubuntu 10.3.0-1ubuntu1~20.04) version 10.3.0 (x86_64-linux-gnu)
        compiled by GNU C version 10.3.0, GMP version 6.2.0, MPFR version
4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 169ee3a1708a329c07eaf03cc8dfbe6c
repro.cc: In lambda function:
repro.cc:39:68: internal compiler error: in build_special_member_call, at
cp/call.c:9787
   39 |   Task task = [this]() -> Task { co_await Parallel({doNothing()}); }();
      |                                                                    ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-10/README.Bugs> for instructions.





Here is the full source:
#include <coroutine>
#include <vector>

class Task {
 public:
  class promise_type {
   public:
    Task get_return_object() { return Task(); }
    std::suspend_never initial_suspend() { return {}; }
    std::suspend_never final_suspend() noexcept { return {}; }
    void return_void() {}
    void unhandled_exception() {}
  };

  Task() {}

  bool await_ready() { return true; }
  bool await_suspend(std::coroutine_handle<> handle) { return false; }\
  void await_resume() {}
};

class Parallel {
 public:
  Parallel(std::vector<Task> tasks) {}
  bool await_ready() { return true; }
  bool await_suspend(std::coroutine_handle<> handle) { return false; }
  void await_resume() {}
};

class MyClass {
 public:
  void doSomething();

 private:
  Task doNothing();
};

void MyClass::doSomething() {
  Task task = [this]() -> Task { co_await Parallel({doNothing()}); }();
}

Task MyClass::doNothing() {
  co_return;
}

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

* [Bug c++/103580] G++ internal compiler error with coroutines and initializer list
  2021-12-06 11:15 [Bug c++/103580] New: G++ internal compiler error with coroutines and initializer list lcw at fb dot com
@ 2021-12-06 13:51 ` marxin at gcc dot gnu.org
  2021-12-06 14:03 ` lcw at fb dot com
  2021-12-06 14:56 ` iains at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-06 13:51 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-12-06
                 CC|                            |iains at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Since r12-618-g14ed21f8749ae359, the code is rejected with:

pr103580.C:39:68: error: array used as initializer
   39 |   Task task = [this]() -> Task { co_await Parallel({doNothing()}); }();
      |                                                                    ^

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

* [Bug c++/103580] G++ internal compiler error with coroutines and initializer list
  2021-12-06 11:15 [Bug c++/103580] New: G++ internal compiler error with coroutines and initializer list lcw at fb dot com
  2021-12-06 13:51 ` [Bug c++/103580] " marxin at gcc dot gnu.org
@ 2021-12-06 14:03 ` lcw at fb dot com
  2021-12-06 14:56 ` iains at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: lcw at fb dot com @ 2021-12-06 14:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Luca Wehrstedt <lcw at fb dot com> ---
I've been trying this out on GodBolt and indeed there's an ICE on 10.3 and 11.2
but not on trunk. However that code "seems valid" to me: is there still a bug
on trunk (a different one) or am I missing something?

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

* [Bug c++/103580] G++ internal compiler error with coroutines and initializer list
  2021-12-06 11:15 [Bug c++/103580] New: G++ internal compiler error with coroutines and initializer list lcw at fb dot com
  2021-12-06 13:51 ` [Bug c++/103580] " marxin at gcc dot gnu.org
  2021-12-06 14:03 ` lcw at fb dot com
@ 2021-12-06 14:56 ` iains at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: iains at gcc dot gnu.org @ 2021-12-06 14:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Iain Sandoe <iains at gcc dot gnu.org> ---
Although the ICE has been "downgraded" to an error, the underlying problem
remains - I just need to find some cycles to clean up the WIP patch I have.

*** This bug has been marked as a duplicate of bug 98056 ***

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

end of thread, other threads:[~2021-12-06 14:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-06 11:15 [Bug c++/103580] New: G++ internal compiler error with coroutines and initializer list lcw at fb dot com
2021-12-06 13:51 ` [Bug c++/103580] " marxin at gcc dot gnu.org
2021-12-06 14:03 ` lcw at fb dot com
2021-12-06 14:56 ` 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).