https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89478
Bug ID: 89478 Summary: missed optimization for lambda expression when variable is uninitialized when declared Product: gcc Version: 9.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: SztfG at yandex dot ru Target Milestone: --- testcase: constexpr void mul2(int &a, const int b) { a = b * 2; } int test = []() {int a; mul2(a, 123); return a;}(); int test2 = []() {int a = 0; mul2(a, 123); return a;}(); output for GCC trunk with -O3 -std=c++17 _GLOBAL__sub_I_test: movl $246, test(%rip) ret test2: .long 246 test: .zero 4 simple testcase: int test3 = []() {int a; a = 5; return a;}(); _GLOBAL__sub_I_test: movl $5, test(%rip) ret test: .zero 4