public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114292] New: ICE with a lambda capturing a constant for VLA allocation
@ 2024-03-09 16:26 franckbehaghel_gcc at protonmail dot com
  2024-03-09 22:01 ` [Bug c++/114292] ICE with a generic (templated) " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: franckbehaghel_gcc at protonmail dot com @ 2024-03-09 16:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114292
           Summary: ICE with a lambda capturing a constant for VLA
                    allocation
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: franckbehaghel_gcc at protonmail dot com
  Target Milestone: ---

cat main.cpp

void process_tile( int tile_cols)
{
    constexpr int tile_rows = 4;

    auto lambda = [&](auto param1) {

        // Define an tmp buffer.
        float buffer[tile_rows * tile_cols]  ;

    };

    int param1=0;
    lambda(param1);

}

int main(int, const char**) {

    int tile_cols = 4;
    process_tile(tile_cols);

    return 0;
}

g++ --version 
g++ (GCC) 14.0.1 20240307 (experimental)

g++ main.cpp
main.cpp: In instantiation of ‘process_tile(int)::<lambda(auto:1)> [with auto:1
= int]’:
main.cpp:14:11:   required from here
   14 |     lambda(param1);
      |     ~~~~~~^~~~~~~~
main.cpp:9:22: internal compiler error: in tsubst_expr, at cp/pt.cc:21412
    9 |         float buffer[tile_rows * tile_cols]  ;
      |                      ^~~~~~~~~
0x778cc4 tsubst_expr(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.cc:21412
0x967c7a tsubst_expr(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.cc:20082
0x969973 tsubst_expr(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.cc:20297
0x96eb39 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.cc:16278
0x96ee98 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.cc:16723
0x97e712 tsubst_decl
        ../../gcc/gcc/cp/pt.cc:15532
0x978e8e tsubst_stmt
        ../../gcc/gcc/cp/pt.cc:18524
0x977905 tsubst_stmt
        ../../gcc/gcc/cp/pt.cc:18393
0x977905 tsubst_stmt
        ../../gcc/gcc/cp/pt.cc:18780
0x977847 tsubst_stmt
        ../../gcc/gcc/cp/pt.cc:18393
0x977847 tsubst_stmt
        ../../gcc/gcc/cp/pt.cc:18407
0x977905 tsubst_stmt
        ../../gcc/gcc/cp/pt.cc:18393
0x977905 tsubst_stmt
        ../../gcc/gcc/cp/pt.cc:18780
0x9760e6 tsubst_stmt
        ../../gcc/gcc/cp/pt.cc:27065
0x9760e6 instantiate_body
        ../../gcc/gcc/cp/pt.cc:27065
0x97688e instantiate_decl(tree_node*, bool, bool)
        ../../gcc/gcc/cp/pt.cc:27350
0x8732af maybe_instantiate_decl(tree_node*)
        ../../gcc/gcc/cp/decl2.cc:5616
0x8732af maybe_instantiate_decl(tree_node*)
        ../../gcc/gcc/cp/decl2.cc:5603
0x8742f5 mark_used(tree_node*, int)
        ../../gcc/gcc/cp/decl2.cc:5915
0x7e283a build_over_call
        ../../gcc/gcc/cp/call.cc:10563
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.

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

* [Bug c++/114292] ICE with a generic (templated) lambda capturing a constant for VLA allocation
  2024-03-09 16:26 [Bug c++/114292] New: ICE with a lambda capturing a constant for VLA allocation franckbehaghel_gcc at protonmail dot com
@ 2024-03-09 22:01 ` pinskia at gcc dot gnu.org
  2024-03-09 22:05 ` [Bug c++/114292] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-09 22:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-03-09
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confiremed. reduced testcase:
```
void f(int c)
{
    constexpr int r = 4;
    [&](auto) { int t[r * c]; }(0);
}
```

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

* [Bug c++/114292] [11/12/13/14 Regression] ICE with a generic (templated) lambda capturing a constant for VLA allocation
  2024-03-09 16:26 [Bug c++/114292] New: ICE with a lambda capturing a constant for VLA allocation franckbehaghel_gcc at protonmail dot com
  2024-03-09 22:01 ` [Bug c++/114292] ICE with a generic (templated) " pinskia at gcc dot gnu.org
@ 2024-03-09 22:05 ` pinskia at gcc dot gnu.org
  2024-03-09 22:07 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-09 22:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.9.4, 5.3.0, 5.5.0, 6.4.0,
                   |                            |7.1.0, 7.5.0
            Summary|ICE with a generic          |[11/12/13/14 Regression]
                   |(templated) lambda          |ICE with a generic
                   |capturing a constant for    |(templated) lambda
                   |VLA allocation              |capturing a constant for
                   |                            |VLA allocation
      Known to fail|                            |5.1.0, 5.2.0, 8.1.0
   Target Milestone|---                         |11.5

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

* [Bug c++/114292] [11/12/13/14 Regression] ICE with a generic (templated) lambda capturing a constant for VLA allocation
  2024-03-09 16:26 [Bug c++/114292] New: ICE with a lambda capturing a constant for VLA allocation franckbehaghel_gcc at protonmail dot com
  2024-03-09 22:01 ` [Bug c++/114292] ICE with a generic (templated) " pinskia at gcc dot gnu.org
  2024-03-09 22:05 ` [Bug c++/114292] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
@ 2024-03-09 22:07 ` pinskia at gcc dot gnu.org
  2024-03-13 16:17 ` jakub at gcc dot gnu.org
  2024-03-13 16:26 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-09 22:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It looks like tile_rows is not being captured correctly.

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

* [Bug c++/114292] [11/12/13/14 Regression] ICE with a generic (templated) lambda capturing a constant for VLA allocation
  2024-03-09 16:26 [Bug c++/114292] New: ICE with a lambda capturing a constant for VLA allocation franckbehaghel_gcc at protonmail dot com
                   ` (2 preceding siblings ...)
  2024-03-09 22:07 ` pinskia at gcc dot gnu.org
@ 2024-03-13 16:17 ` jakub at gcc dot gnu.org
  2024-03-13 16:26 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-03-13 16:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r8-7213-g1577f10a637352b4fe7fb4a4c0fd672a96c84f58

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

* [Bug c++/114292] [11/12/13/14 Regression] ICE with a generic (templated) lambda capturing a constant for VLA allocation
  2024-03-09 16:26 [Bug c++/114292] New: ICE with a lambda capturing a constant for VLA allocation franckbehaghel_gcc at protonmail dot com
                   ` (3 preceding siblings ...)
  2024-03-13 16:17 ` jakub at gcc dot gnu.org
@ 2024-03-13 16:26 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-03-13 16:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |mpolacek at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org
           Priority|P3                          |P2

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
void
foo (int c)
{
  constexpr int r = 4;
  [&] (auto) { int n = r * c; int t[n]; } (0);
  [&] (auto) { int t[c]; } (0);
  [&] (auto) { int t[r]; } (0);
  [&] (auto) { int t[c * 4]; } (0);
}

works fine though.

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

end of thread, other threads:[~2024-03-13 16:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-09 16:26 [Bug c++/114292] New: ICE with a lambda capturing a constant for VLA allocation franckbehaghel_gcc at protonmail dot com
2024-03-09 22:01 ` [Bug c++/114292] ICE with a generic (templated) " pinskia at gcc dot gnu.org
2024-03-09 22:05 ` [Bug c++/114292] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
2024-03-09 22:07 ` pinskia at gcc dot gnu.org
2024-03-13 16:17 ` jakub at gcc dot gnu.org
2024-03-13 16:26 ` jakub 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).