This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug math/21660] New: GCC fails to compile a formula with tgmath.h
- From: "equilibrium556 at gmx dot de" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Fri, 23 Jun 2017 05:13:18 +0000
- Subject: [Bug math/21660] New: GCC fails to compile a formula with tgmath.h
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=21660
Bug ID: 21660
Summary: GCC fails to compile a formula with tgmath.h
Product: glibc
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: math
Assignee: unassigned at sourceware dot org
Reporter: equilibrium556 at gmx dot de
Target Milestone: ---
Created attachment 10214
--> https://sourceware.org/bugzilla/attachment.cgi?id=10214&action=edit
C file that fails to compile with GCC
Hello, I reported a bug on the GCC bugtracker
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81156) and it might have
something to do with glibc, I am gonna copy & paste the original post here:
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.
--
You are receiving this mail because:
You are on the CC list for the bug.