[MacPorts] #60356: MacPorts gcc 9.3.0 internal compiler error: Segmentation fault: 11 - not seen with Homebrew gcc 9.3.0
MacPorts
noreply at macports.org
Wed Apr 15 20:11:40 UTC 2020
#60356: MacPorts gcc 9.3.0 internal compiler error: Segmentation fault: 11 - not
seen with Homebrew gcc 9.3.0
-----------------------------+--------------------
Reporter: attiliodefalco | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: gcc9 |
-----------------------------+--------------------
Description changed by mf2k:
Old description:
> 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
New description:
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
--
--
Ticket URL: <https://trac.macports.org/ticket/60356#comment:2>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list