Bug 89138 - typeof VLA in lambdas
Summary: typeof VLA in lambdas
Status: RESOLVED DUPLICATE of bug 60855
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: c++-lambda
Depends on:
Blocks: C++VLA lambdas
  Show dependency treegraph
 
Reported: 2019-01-31 11:45 UTC by Zhendong Su
Modified: 2022-03-11 00:32 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2019-01-31 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zhendong Su 2019-01-31 11:45:41 UTC
The test seems to cause all versions since 4.x to crash. 

$ g++tk -v
Using built-in specs.
COLLECT_GCC=g++tk
COLLECT_LTO_WRAPPER=/home/su/software/tmp/gcc/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/9.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/home/su/software/tmp/gcc/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 9.0.1 20190130 (experimental) [trunk revision 268383] (GCC) 
$ 
$ clang++ -std=c++11 -c tmp.cpp
$ 
$ g++tk -c tmp.cpp
during RTL pass: expand
tmp.cpp: In lambda function:
tmp.cpp:6:22: internal compiler error: in expand_expr_real_1, at expr.c:9993
    6 |   [&] { __typeof (b) c; } ();
      |                      ^
0xb4094b expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool)
        ../../gcc-source-trunk/gcc/expr.c:9987
0xb57c2c expand_expr
        ../../gcc-source-trunk/gcc/expr.h:279
0xb57c2c expand_expr_real_2(separate_ops*, rtx_def*, machine_mode, expand_modifier)
        ../../gcc-source-trunk/gcc/expr.c:8484
0xa088c0 expand_gimple_stmt_1
        ../../gcc-source-trunk/gcc/cfgexpand.c:3790
0xa088c0 expand_gimple_stmt
        ../../gcc-source-trunk/gcc/cfgexpand.c:3850
0xa0c44b expand_gimple_basic_block
        ../../gcc-source-trunk/gcc/cfgexpand.c:5886
0xa11e36 execute
        ../../gcc-source-trunk/gcc/cfgexpand.c:6509
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$ 


--------------------------------


int a = 1;

void f ()
{
  int b[a];
  [&] { __typeof (b) c; } ();
}
Comment 1 Jakub Jelinek 2019-01-31 12:25:31 UTC
Likely since r152318 when lambda support has been added.
Guess we'd need to capture the VLA array sizes in the lambda.
Comment 2 Arseny Solokha 2019-01-31 16:51:22 UTC
I guess it may be a duplicate of PR60855 and (or) PR86432.
Comment 3 Andrew Pinski 2021-09-20 21:51:02 UTC
Yes this is a dup of bug 60855.  It has been fixed for GCC 10+.

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