https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90740
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |ice-on-valid-code, | |wrong-code Status|UNCONFIRMED |NEW Last reconfirmed| |2019-06-04 Known to work| |8.3.0 Target Milestone|--- |9.2 Summary|VLA with lamba causes an |[9/10 Regression] VLA with |incorrect unitialized in |lamba causes an incorrect |this function warning |unitialized in this | |function warning Ever confirmed|0 |1 --- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- Hmm, plain 9.1.0 ICEs for me at -O0 t.C: In lambda function: t.C:14:59: warning: fold-expressions only available with ‘-std=c++17’ or ‘-std=gnu++17’ 14 | bar([&buf, &out...](auto&... column) { (doit(column), ...); }, out...); | ^~~ during RTL pass: expand t.C: In lambda function: t.C:14:9: internal compiler error: in expand_expr_real_1, at expr.c:10012 14 | bar([&buf, &out...](auto&... column) { (doit(column), ...); }, out...); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ v0x5c58c8 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) Confirmed with -O2 -Wall. Note with checking enabled on the branch we ICE also with -O2 -Wall: t.C: In instantiation of ‘read(Vs& ...) [with Vs = {int}]::<lambda(auto:1& ...)> [with auto:1 = {int}]’: t.C:3:6: required from ‘void bar(T, U ...) [with T = read(Vs& ...) [with Vs = {int}]::<lambda(auto:1& ...)>; U = {int}]’ t.C:14:8: required from ‘void read(Vs& ...) [with Vs = {int}]’ t.C:19:12: required from here t.C:13:10: internal compiler error: in tsubst_copy, at cp/pt.c:16185 13 | char buf[SIZE]; | ^~~ 0xafa361 tsubst_copy /space/rguenther/src/svn/gcc-9-branch/gcc/cp/pt.c:16185 0xb0df7b tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /space/rguenther/src/svn/gcc-9-branch/gcc/cp/pt.c:19612 default: /* We shouldn't get here, but keep going if !flag_checking. */ if (flag_checking) gcc_unreachable (); and that likely is the reason for the breakage. The gimple dump already shows: read(Vs& ...) [with Vs = {int}]::<lambda(auto:1& ...)>::operator()<int> (const struct __lambda1 * const this, int & column#0) { sizetype D.2163; bitsizetype D.2164; sizetype D.2165; int & out#0 [value-expr: ((const struct __lambda1 *) this)->__out#0]; char[0:D.2163] & buf [value-expr: ((const struct __lambda1 *) this)->__buf]; _1 = D.2153 + -1; D.2163 = (sizetype) _1; _3 = (sizetype) D.2153; _4 = (bitsizetype) _3; D.2164 = _4 * 8; D.2165 = (sizetype) D.2153; { _7 = *column#0; doit<int> (_7); } } see how D.2153 is never initialized, so this is also wrong-code with -fno-checking (and we shouldn't have this kind of continue-if-not-checking...). ICEs are better than silent wrong-code. We don't handle SAVE_EXPR <(ssizetype) SIZE + -1> not sure why.