public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115586] New: name-independent declarations causing an internal compiler error (c++26)
@ 2024-06-22  1:59 amuly.jain at gmail dot com
  2024-06-22  2:09 ` [Bug c++/115586] " amuly.jain at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: amuly.jain at gmail dot com @ 2024-06-22  1:59 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115586
           Summary: name-independent declarations causing an internal
                    compiler error (c++26)
           Product: gcc
           Version: 14.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: amuly.jain at gmail dot com
  Target Milestone: ---

gcc -v output:
Using built-in specs.
COLLECT_GCC=g++-14
COLLECT_LTO_WRAPPER=/home/amuhak/gcc/gcc-14/bin/../libexec/gcc/x86_64-linux-gnu/14.1.0/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../gcc/configure -v --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
--prefix=/home/amuhak/build/gcc-14 --enable-checking=release
--enable-languages=c,c++,fortran,go --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.1.0 (GCC)


Command run: g++-14 main.cpp
Output:
main.cpp: In function ‘int main()’:
main.cpp:8:19: warning: name-independent declarations only available with
‘-std=c++2c’ or ‘-std=gnu++2c’ [-Wc++26-extensions]
    8 |     for (auto [_, _, a] : in) {
      |                   ^
main.cpp:8:25: internal compiler error: Segmentation fault
    8 |     for (auto [_, _, a] : in) {
      |                         ^
0x7f179196831f ???
        ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x7f179194d1c9 __libc_start_call_main
        ../sysdeps/nptl/libc_start_call_main.h:58
0x7f179194d28a __libc_start_main_impl
        ../csu/libc-start.c:360
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


Command run: g++-14 -freport-bug main.cpp
Output:
main.cpp: In function ‘int main()’:
main.cpp:8:19: warning: name-independent declarations only available with
‘-std=c++2c’ or ‘-std=gnu++2c’ [-Wc++26-extensions]
    8 |     for (auto [_, _, a] : in) {
      |                   ^
main.cpp:8:25: internal compiler error: Segmentation fault
    8 |     for (auto [_, _, a] : in) {
      |                         ^
0x7f5ccf93631f ???
        ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x7f5ccf91b1c9 __libc_start_call_main
        ../sysdeps/nptl/libc_start_call_main.h:58
0x7f5ccf91b28a __libc_start_main_impl
        ../csu/libc-start.c:360
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
The bug is not reproducible, so it is likely a hardware or OS problem.

Here is a "working" example (https://godbolt.org/z/7vdoj7z3j):
#include <vector>
#include <tuple>
#include <iostream>

int main() {
    std::vector<std::tuple<int, int, int>> in;
    in.emplace_back(1, 2, 3);
    for (auto [_, _, a] : in) {
        std::cout << a << std::endl;
    }
}

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

* [Bug c++/115586] name-independent declarations causing an internal compiler error (c++26)
  2024-06-22  1:59 [Bug c++/115586] New: name-independent declarations causing an internal compiler error (c++26) amuly.jain at gmail dot com
@ 2024-06-22  2:09 ` amuly.jain at gmail dot com
  2024-06-22  2:11 ` pinskia at gcc dot gnu.org
  2024-06-22  2:17 ` [Bug c++/115586] c++26: with 2 or more name-independent declarations (anonymous structure bindings) with for loop pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: amuly.jain at gmail dot com @ 2024-06-22  2:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Amulya Jain <amuly.jain at gmail dot com> ---
Created attachment 58485
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58485&action=edit
The preprocessed file

I am unable to attach the preprocessed file due to the 1000kb limit (my file is
1040kb). So I have attached a zip file zipped with 7z.

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

* [Bug c++/115586] name-independent declarations causing an internal compiler error (c++26)
  2024-06-22  1:59 [Bug c++/115586] New: name-independent declarations causing an internal compiler error (c++26) amuly.jain at gmail dot com
  2024-06-22  2:09 ` [Bug c++/115586] " amuly.jain at gmail dot com
@ 2024-06-22  2:11 ` pinskia at gcc dot gnu.org
  2024-06-22  2:17 ` [Bug c++/115586] c++26: with 2 or more name-independent declarations (anonymous structure bindings) with for loop pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-22  2:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|https://godbolt.org/z/7vdoj |
                   |7z3j                        |

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
https://godbolt.org/z/7vdoj7z3j

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

* [Bug c++/115586] c++26: with 2 or more name-independent declarations (anonymous structure bindings) with for loop
  2024-06-22  1:59 [Bug c++/115586] New: name-independent declarations causing an internal compiler error (c++26) amuly.jain at gmail dot com
  2024-06-22  2:09 ` [Bug c++/115586] " amuly.jain at gmail dot com
  2024-06-22  2:11 ` pinskia at gcc dot gnu.org
@ 2024-06-22  2:17 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-22  2:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-06-22
            Summary|name-independent            |c++26: with 2 or more
                   |declarations causing an     |name-independent
                   |internal compiler error     |declarations (anonymous
                   |(c++26)                     |structure bindings) with
                   |                            |for loop
                 CC|                            |pinskia at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |ice-on-valid-code
     Ever confirmed|0                           |1

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
Reduced testcase:
```
struct f
{
        int a;
        int b;
        int c;
};

int main() {
    f in1[4];
    //auto [_, _, b] = in1[0];

    for (auto [_, _, a] : in1) { }
}
```

Note if uncomment the other name-independent declaration, we get a slightly
different ICE:
<source>:12:34: internal compiler error: in pop_local_binding, at
cp/name-lookup.cc:2655

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

end of thread, other threads:[~2024-06-22  2:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-22  1:59 [Bug c++/115586] New: name-independent declarations causing an internal compiler error (c++26) amuly.jain at gmail dot com
2024-06-22  2:09 ` [Bug c++/115586] " amuly.jain at gmail dot com
2024-06-22  2:11 ` pinskia at gcc dot gnu.org
2024-06-22  2:17 ` [Bug c++/115586] c++26: with 2 or more name-independent declarations (anonymous structure bindings) with for loop pinskia 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).