https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86835
Bug ID: 86835 Summary: [8/9 Regression] Bogus "is used uninitialized" warning with -ffast-math Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: bunk at stusta dot de Target Milestone: --- From https://bugs.debian.org/897876 $ cat test.c #include <math.h> void evallogisticML(const double *x, const int n, double *params, double *fvec, double **fjac) { int i; double a, b, amxb, /* exp_xmab,*/ cosh_amxb, nd, xi, diff; a = params[0]; b = params[1]; nd = (double) n; fvec[0] = fvec[1] = fjac[0][0] = fjac[1][0] = fjac[0][1] = fjac[1][1] = 0.0; for (i = 0; i < n; ++i) { xi = x[i]; /* xmab = (x[i] - a) / b; */ diff = a - xi; amxb = diff / b; cosh_amxb = cosh(amxb); fvec[0] += tanh(amxb/2.0); /* good */ fvec[1] += diff * tanh(amxb/2.0); /* good */ fjac[0][0] += (1.0 / (1.0 + cosh(amxb))); /* good */ fjac[0][1] += (diff / (1.0 + cosh_amxb)); /* good */ fjac[1][0] += (diff + b * sinh(amxb)) / (1.0 + cosh_amxb); /* good */ fjac[1][1] += diff * diff / (1.0 + cosh_amxb); /* good */ } fvec[0] = fvec[0]; /* good */ fvec[1] -= (b * nd); /* good */ fjac[0][0] /= b; /* good */ fjac[0][1] /= b*b; /* good */ fjac[1][0] /= b; /* good */ fjac[1][1] = -fjac[1][1]/(b*b) - nd; /* good */ } $ gcc-7 -O1 -ffast-math -Wall -c test.c $ gcc-8 -O1 -ffast-math -Wall -c test.c test.c: In function 'evallogisticML': test.c:4:1: warning: 'reciptmp.6' is used uninitialized in this function [-Wuninitialized] evallogisticML(const double *x, const int n, ^~~~~~~~~~~~~~ $ /usr/lib/gcc-snapshot/bin/gcc -O1 -ffast-math -Wall -c test.c test.c: In function 'evallogisticML': test.c:4:1: warning: 'reciptmp.6' is used uninitialized in this function [-Wuninitialized] evallogisticML(const double *x, const int n, ^~~~~~~~~~~~~~ $ gcc-8 --version gcc-8 (Debian 8.2.0-2) 8.2.0 ... $ /usr/lib/gcc-snapshot/bin/gcc --version gcc (Debian 20180721-1) 9.0.0 20180721 (experimental) [trunk revision 262917] 8.2.0-2 is r263045 from the gcc-8-branch.