From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 41D373858D32; Sun, 8 Oct 2023 17:03:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 41D373858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696784632; bh=s+ypXcA0FHY0Z/ZW2eFgFlk5wCum/YjUpZtYKFfKvas=; h=From:To:Subject:Date:From; b=Q5oRCNdshPnF5f1RFncDd3OuZ1VrvOCKVQc7WxtJMPNAbzxN7Z78brmuK93xP/nBE /uLOEslxIIst+cvG5lf043ni3Q6JvAwrgIgPbYsoYrZOGKAq68NRN8kO1KbSnEeYvo 8RmzkBUzQ0AeJctrJ/zMvlflyZpwmd3G1FJ/8iEM= From: "yunus at ayar dot eu" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/111728] New: C++ 20 coroutine segmentation fault in generic lambda Date: Sun, 08 Oct 2023 17:03:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: yunus at ayar dot eu X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111728 Bug ID: 111728 Summary: C++ 20 coroutine segmentation fault in generic lambda Product: gcc Version: 13.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: yunus at ayar dot eu Target Milestone: --- Created attachment 56074 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D56074&action=3Dedit Compressed version of main.cpp.ii (~ 5.5 MB) from g++ -save-temps The following code causes a segmentation fault with ASIO 1.28, C++ 20's coroutines and evaluating of expressions inside a generic coroutine lambda.= I tried to strip the test case as much as possible: ```cpp #include #include inline asio::awaitable write_fields() { std::byte static_buffer[10]; co_await [&](auto field) -> asio::awaitable { // Next line is not ok. if (0 =3D=3D sizeof(static_buffer)); co_return 0; }(0); co_return 0; } int main() { static_cast(write_fields()); } ``` My exact version: ```txt Using built-in specs. COLLECT_GCC=3Dg++ COLLECT_LTO_WRAPPER=3D/usr/libexec/gcc/x86_64-redhat-linux/13/lto-wrapper OFFLOAD_TARGET_NAMES=3Dnvptx-none OFFLOAD_TARGET_DEFAULT=3D1 Target: x86_64-redhat-linux Configured with: ../configure --enable-bootstrap --enable-languages=3Dc,c++,fortran,objc,obj-c++,ada,go,d,m2,lto --prefix=3D= /usr --mandir=3D/usr/share/man --infodir=3D/usr/share/info --with-bugurl=3Dhttp://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=3Dposix --enable-checking=3Drelease --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-libstdcxx-backtrace --with-libstdcxx-zoneinfo=3D/usr/share/zoneinfo --with-linker-hash-style=3D= gnu --enable-plugin --enable-initfini-array --with-isl=3D/builddir/build/BUILD/gcc-13.2.1-20230728/obj-x86_64-redhat-li= nux/isl-install --enable-offload-targets=3Dnvptx-none --without-cuda-driver --enable-offload-defaulted --enable-gnu-indirect-function --enable-cet --with-tune=3Dgeneric --with-arch_32=3Di686 --build=3Dx86_64-redhat-linux --with-build-config=3Dbootstrap-lto --enable-link-serialization=3D1 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 13.2.1 20230728 (Red Hat 13.2.1-1) (GCC) ``` I compiled the attached (main.cpp.ii) with: g++ main.cpp.ii -std=3Dgnu++20 The following output was generated: ```txt /home/yunus/Projects/terraqtt/examples/main.cpp: In instantiation of =E2=80=98write_fields(write_fields()::_Z12write_fieldsv.Frame*):: [with auto:50 =3D int]=E2=80=99: /home/yunus/Projects/terraqtt/examples/main.cpp:12:4: required from here /home/yunus/Projects/terraqtt/examples/main.cpp:12:3: internal compiler err= or: Segmentation fault 12 | }(0); | ^ Please submit a full bug report, with preprocessed source. See for instructions. Preprocessed source stored into /tmp/cchUnOPu.out file, please attach this = to your bugreport. ```=