https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81156
Bug ID: 81156 Summary: GCC fails to compile a formula with tgmath.h Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: equilibrium556 at gmx dot de Target Milestone: --- Created attachment 41603 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41603&action=edit C file that fails to compile with GCC Hey, I ran into some problems compiling code that contained a specific formula. I am using the type generic tgmath.h header because I am switching between float and double for performance testing reasons. If I include the tgmath.h header, the code doesn't compile, GCC ends up filling up all my RAM and doesn't succeed to compile the file. It compiles using the math.h header without a problem. Here's the code in question (also in the attachment): /* memory_leak.c */ #include <stdio.h> #include <stdlib.h> #include <tgmath.h> #ifdef TEST_SP typedef float test_float; #else typedef double test_float; #endif int main(int argc, char *argv[]) { int b = -1; test_float a, c, d, e, f, g, h, i; a = c = d = e = f = g = h = i = 1; a = 2*b/abs(b)*sqrt(pow(sqrt(pow(c, 2) - pow(d, 2)) - e*f*cos(g)*cos(h)/abs(b)*(i - 1), 2) + pow(d/2, 2)); return 0; } /* END */ Compile with: gcc -o memory_leak -DTEST_SP -std=c99 memory_leak.c -lm It ends up eating all the memory there is. Doesn't work on current GCC 7.1.1 on Arch nor on an RHEL6 distro with GCC 4.4.7. Works with GCC 5.3 in Cygwin. Clang and ICC compile without problems as well on Linux.