https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67149
Bug ID: 67149 Summary: false positive maybe-uniniialized in the presense of cilk spawn Product: gcc Version: 5.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: kuszmaul at gmail dot com Target Milestone: --- The following program produces an invalid maybe-uninitialized warning on variable z, which is initialized. There is no way for z to be used uninitialized. $ cat warning.cc extern void f(); extern void h(int, int*); void g(int m, int *a){ if (m <= 1) return; int j = 0; for (int k = m; k < m + 2; k++){ if(a[k]) j = (a)[k]; } if (j) { f(); } int z = m +1; _Cilk_spawn h(m+1, a); h(z+2, a); } $ g++ --version g++ (GCC) 5.1.1 20150618 (Red Hat 5.1.1-4) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ g++ -O3 -Wall -Werror -g -std=c++11 warning.cc -c -fcilkplus warning.cc: In function ‘void g(int, int*)’: warning.cc:13:9: error: ‘z’ may be used uninitialized in this function [-Werror=maybe-uninitialized] int z = m +1; ^ cc1plus: all warnings being treated as errors $