public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96517] New: ICE in is_this_parameter when accessing constexpr method of a field inside coroutine lambda (with optimization)
@ 2020-08-07  8:56 przemekmirek at gmail dot com
  2021-09-30 15:50 ` [Bug c++/96517] " iains at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: przemekmirek at gmail dot com @ 2020-08-07  8:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96517
           Summary: ICE in is_this_parameter when accessing constexpr
                    method of a field inside coroutine lambda (with
                    optimization)
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: przemekmirek at gmail dot com
  Target Milestone: ---

Created attachment 49017
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49017&action=edit
preprocessed source

Compiling the following code with any level of optimization enabled (anything
except O0) causes gcc to exit with an ICE. I'm using GCC 10.2.0 from MSYS2
MinGW, however the same error occurs on any GCC > 10.0 available in Compiler
Explorer, including trunk. 

See https://godbolt.org/z/h7bjKG

I've been trying to reduce it to a less-specific example, the original code
failed when accessing std::optional. I don't think I can shorten it any
further. Making get() non-constexpr, making _data static, making coroutine a
member function instead of a lambda, all stop the error from appearing.

---

#include <coroutine>

struct coroutine {
    struct promise_type {
        coroutine get_return_object() { return {}; }
        void return_void() {}
        void unhandled_exception() {}
        auto initial_suspend() noexcept { return std::suspend_never{}; }
        auto final_suspend() noexcept { return std::suspend_never{}; }
    };
};

struct data {
    constexpr int get() { return 5; }
};

struct test {
    data _data;

    void foo() {
        [this]() -> coroutine {
            _data.get();
            co_return;
        };
    }
};

int main() {}

---

The full commandline and output is attached below:

$ g++ -v -std=c++20 -fcoroutines -O1 -save-temps main.cpp

Using built-in specs.
COLLECT_GCC=C:\msys64\mingw32\bin\g++.exe
COLLECT_LTO_WRAPPER=C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: ../gcc-10.2.0/configure --prefix=/mingw32
--with-local-prefix=/mingw32/local --build=i686-w64-mingw32
--host=i686-w64-mingw32 --target=i686-w64-mingw32
--with-native-system-header-dir=/mingw32/i686-w64-mingw32/include
--libexecdir=/mingw32/lib --enable-bootstrap --with-arch=i686
--with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++
--enable-shared --enable-static --enable-libatomic --enable-threads=posix
--enable-graphite --enable-fully-dynamic-string
--enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes
--disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check
--enable-lto --enable-libgomp --disable-multilib --enable-checking=release
--disable-rpath --disable-win32-registry --disable-nls --disable-werror
--disable-symvers --disable-plugin --with-libiconv --with-system-zlib
--with-gmp=/mingw32 --with-mpfr=/mingw32 --with-mpc=/mingw32
--with-isl=/mingw32 --with-pkgversion='Rev1, Built by MSYS2 project'
--with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as
--with-gnu-ld --disable-sjlj-exceptions --with-dwarf2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.0 (Rev1, Built by MSYS2 project)
COLLECT_GCC_OPTIONS='-v' '-std=c++2a' '-fcoroutines' '-O1' '-save-temps'
'-shared-libgcc' '-mtune=generic' '-march=i686'
 C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/cc1plus.exe -E -quiet
-v -iprefix C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/
-D_REENTRANT main.cpp -mtune=generic -march=i686 -std=c++2a -fcoroutines -O1
-fpch-preprocess -o main.ii
ignoring duplicate directory
"C:/msys64/mingw32/lib/gcc/../../lib/gcc/i686-w64-mingw32/10.2.0/../../../../include/c++/10.2.0"
ignoring duplicate directory
"C:/msys64/mingw32/lib/gcc/../../lib/gcc/i686-w64-mingw32/10.2.0/../../../../include/c++/10.2.0/i686-w64-mingw32"
ignoring duplicate directory
"C:/msys64/mingw32/lib/gcc/../../lib/gcc/i686-w64-mingw32/10.2.0/../../../../include/c++/10.2.0/backward"
ignoring duplicate directory
"C:/msys64/mingw32/lib/gcc/../../lib/gcc/i686-w64-mingw32/10.2.0/include"
ignoring nonexistent directory "D:/msys64/mingw32/include"
ignoring nonexistent directory "/mingw32/include"
ignoring duplicate directory
"C:/msys64/mingw32/lib/gcc/../../lib/gcc/i686-w64-mingw32/10.2.0/include-fixed"
ignoring duplicate directory
"C:/msys64/mingw32/lib/gcc/../../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/include"
ignoring nonexistent directory "D:/msys64/mingw32/i686-w64-mingw32/include"
#include "..." search starts here:
#include <...> search starts here:

C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../include/c++/10.2.0

C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../include/c++/10.2.0/i686-w64-mingw32

C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../include/c++/10.2.0/backward
 C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/include
 C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../include
 C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/include-fixed

C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-std=c++2a' '-fcoroutines' '-O1' '-save-temps'
'-shared-libgcc' '-mtune=generic' '-march=i686'
 C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/cc1plus.exe
-fpreprocessed main.ii -quiet -dumpbase main.cpp -mtune=generic -march=i686
-auxbase main -O1 -std=c++2a -version -fcoroutines -o main.s
GNU C++17 (Rev1, Built by MSYS2 project) version 10.2.0 (i686-w64-mingw32)
        compiled by GNU C version 10.2.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
GNU C++17 (Rev1, Built by MSYS2 project) version 10.2.0 (i686-w64-mingw32)
        compiled by GNU C version 10.2.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: b383ad3e7b4fa535de44ee60f873a45a
main.cpp: In function 'void
test::foo()::<lambda()>::_ZZN4test3fooEvENKUlvE_clEv.actor(test::foo()::<lambda()>::_ZZN4test3fooEvENKUlvE_clEv.frame*)':
main.cpp:24:9: internal compiler error: in is_this_parameter, at
cp/semantics.c:10206
   24 |         };
      |         ^

main.cpp:24:9: internal compiler error: Aborted
g++.exe: internal compiler error: Aborted signal terminated program cc1plus

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

* [Bug c++/96517] ICE in is_this_parameter when accessing constexpr method of a field inside coroutine lambda (with optimization)
  2020-08-07  8:56 [Bug c++/96517] New: ICE in is_this_parameter when accessing constexpr method of a field inside coroutine lambda (with optimization) przemekmirek at gmail dot com
@ 2021-09-30 15:50 ` iains at gcc dot gnu.org
  2021-10-21 20:46 ` iains at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: iains at gcc dot gnu.org @ 2021-09-30 15:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|                            |2021-09-30
   Target Milestone|---                         |10.4
             Status|UNCONFIRMED                 |NEW
                 CC|                            |iains at gcc dot gnu.org
     Ever confirmed|0                           |1

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

* [Bug c++/96517] ICE in is_this_parameter when accessing constexpr method of a field inside coroutine lambda (with optimization)
  2020-08-07  8:56 [Bug c++/96517] New: ICE in is_this_parameter when accessing constexpr method of a field inside coroutine lambda (with optimization) przemekmirek at gmail dot com
  2021-09-30 15:50 ` [Bug c++/96517] " iains at gcc dot gnu.org
@ 2021-10-21 20:46 ` iains at gcc dot gnu.org
  2021-11-06 19:30 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: iains at gcc dot gnu.org @ 2021-10-21 20:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lcw at fb dot com

--- Comment #1 from Iain Sandoe <iains at gcc dot gnu.org> ---
*** Bug 102878 has been marked as a duplicate of this bug. ***

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

* [Bug c++/96517] ICE in is_this_parameter when accessing constexpr method of a field inside coroutine lambda (with optimization)
  2020-08-07  8:56 [Bug c++/96517] New: ICE in is_this_parameter when accessing constexpr method of a field inside coroutine lambda (with optimization) przemekmirek at gmail dot com
  2021-09-30 15:50 ` [Bug c++/96517] " iains at gcc dot gnu.org
  2021-10-21 20:46 ` iains at gcc dot gnu.org
@ 2021-11-06 19:30 ` pinskia at gcc dot gnu.org
  2021-12-17 16:55 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-06 19:30 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |visual2017cpp at hotmail dot com

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 103108 has been marked as a duplicate of this bug. ***

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

* [Bug c++/96517] ICE in is_this_parameter when accessing constexpr method of a field inside coroutine lambda (with optimization)
  2020-08-07  8:56 [Bug c++/96517] New: ICE in is_this_parameter when accessing constexpr method of a field inside coroutine lambda (with optimization) przemekmirek at gmail dot com
                   ` (2 preceding siblings ...)
  2021-11-06 19:30 ` pinskia at gcc dot gnu.org
@ 2021-12-17 16:55 ` cvs-commit at gcc dot gnu.org
  2022-06-28 10:41 ` jakub at gcc dot gnu.org
  2023-07-07  9:02 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-17 16:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:39d2ec41509e3b0d130215a65d7aacbd064b5532

commit r12-6044-g39d2ec41509e3b0d130215a65d7aacbd064b5532
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Fri Oct 15 09:42:25 2021 +0100

    coroutines, c++: Add test for PR 96517.

    This PR was fixed by r12-5255-gdaa9c6b015, this adds
    the testcase.

    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

    gcc/testsuite/ChangeLog:

            PR c++/96517
            * g++.dg/coroutines/pr96517.C: New test.

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

* [Bug c++/96517] ICE in is_this_parameter when accessing constexpr method of a field inside coroutine lambda (with optimization)
  2020-08-07  8:56 [Bug c++/96517] New: ICE in is_this_parameter when accessing constexpr method of a field inside coroutine lambda (with optimization) przemekmirek at gmail dot com
                   ` (3 preceding siblings ...)
  2021-12-17 16:55 ` cvs-commit at gcc dot gnu.org
@ 2022-06-28 10:41 ` jakub at gcc dot gnu.org
  2023-07-07  9:02 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:41 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug c++/96517] ICE in is_this_parameter when accessing constexpr method of a field inside coroutine lambda (with optimization)
  2020-08-07  8:56 [Bug c++/96517] New: ICE in is_this_parameter when accessing constexpr method of a field inside coroutine lambda (with optimization) przemekmirek at gmail dot com
                   ` (4 preceding siblings ...)
  2022-06-28 10:41 ` jakub at gcc dot gnu.org
@ 2023-07-07  9:02 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07  9:02 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |10.5.0
             Status|NEW                         |RESOLVED
   Target Milestone|10.5                        |11.3
      Known to work|                            |11.3.0, 12.1.0
         Resolution|---                         |FIXED

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed in GCC 11.3.

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

end of thread, other threads:[~2023-07-07  9:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-07  8:56 [Bug c++/96517] New: ICE in is_this_parameter when accessing constexpr method of a field inside coroutine lambda (with optimization) przemekmirek at gmail dot com
2021-09-30 15:50 ` [Bug c++/96517] " iains at gcc dot gnu.org
2021-10-21 20:46 ` iains at gcc dot gnu.org
2021-11-06 19:30 ` pinskia at gcc dot gnu.org
2021-12-17 16:55 ` cvs-commit at gcc dot gnu.org
2022-06-28 10:41 ` jakub at gcc dot gnu.org
2023-07-07  9:02 ` rguenth 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).