Opened 5 years ago
Last modified 2 years ago
#60356 new defect
MacPorts gcc 9.3.0 internal compiler error: Segmentation fault: 11 - not seen with Homebrew gcc 9.3.0 — at Version 2
Reported by: | attiliodefalco | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | Cc: | david.sagan@… | |
Port: | gcc9 |
Description (last modified by mf2k (Frank Schima))
The following code fails to compile with MacPorts gcc 9.3.0 but not Homebrew gcc 9.3.0
#include <math.h> double vec_dist () {double r=0; return sqrt(r); }
And compile with:
gcc -O2 -ffast-math -c test.c
The output is:
test.c: In function 'vec_dist': test.c:6:1: internal compiler error: Segmentation fault: 11 } ^ test.c:6:1: internal compiler error: Abort trap: 6 gcc: internal compiler error: Abort trap: 6 (program cc1)
This reproduces on my 4-year old laptop, but not my 5-year old mini. Both are currently running 10.15.4 (usually the mini runs betas) and have gcc 9.3.0 from MacPorts. On the laptop, this segfaults the compiler when compiled with '-O2 -ffastmath':
extern double sqrt(double); double mad_vec_dist () { double r=0; return sqrt(r); }
(note that I removed the include of math.h). Changing sqrt() to sin() also segfaults. However, this compiles fine:
extern double trqs(double); double vec_dist () { double r=0; return trqs(r); }
and the ones that segfault the compiler don't segfault if I add the '-fno-builtin' flag--so it's something about the optimization of the builtin math functions that are enabled by -ffastmath. This is likely actually a bug in the upstream gcc but I don't see the segfault with Homebrew gcc 9.3 (or even on CentOS 7 gcc 9.3).
Please let me know if I should notify GNU, as well.
Thanks!
Attilio
Change History (2)
comment:1 Changed 5 years ago by mf2k (Frank Schima)
Port: | gcc9 added |
---|
comment:2 Changed 5 years ago by mf2k (Frank Schima)
Description: | modified (diff) |
---|
In the future, please fill in the Port field.