Bug 243681 - lang/gcc10-devel: Build of 10.0.1.s20200126 fails from "reinterpret_cast from 'nullptr_t' to 'function *' is not allowed"
Summary: lang/gcc10-devel: Build of 10.0.1.s20200126 fails from "reinterpret_cast from...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Gerald Pfeifer
Depends on:
Reported: 2020-01-28 20:43 UTC by Philippe Michel
Modified: 2020-02-04 22:08 UTC (History)
2 users (show)

See Also:

Proposed patch (640 bytes, patch)
2020-01-28 21:59 UTC, Gerald Pfeifer
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Michel 2020-01-28 20:43:57 UTC
Build of 10.0.1.s20200126 fails as shown below.
System compiler is FreeBSD clang version 9.0.1, x86_64-unknown-freebsd12.1.
Previous snapshot had failed similarly but 10.0.0.s20200105 completed ok. I didn't try those in between.

c++ -fno-PIE -c   -O2 -pipe -march=sandybridge   -DLIBICONV_PLUG  -DIN_GCC    -fno-strict-aliasing -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag  -fno-common  -DHAVE_CONFIG_H -I. -Ianalyzer -I/usr/ports/lang/gcc10-devel/work/gcc-10-20200126/gcc -I/usr/ports/lang/gcc10-devel/work/gcc-10-20200126/gcc/analyzer -I/usr/ports/lang/gcc10-devel/work/gcc-10-20200126/gcc/../include -I/usr/ports/lang/gcc10-devel/work/gcc-10-20200126/gcc/../libcpp/include -I/usr/local/include  -I/usr/ports/lang/gcc10-devel/work/gcc-10-20200126/gcc/../libdecnumber -I/usr/ports/lang/gcc10-devel/work/gcc-10-20200126/gcc/../libdecnumber/dpd -I../libdecnumber -I/usr/ports/lang/gcc10-devel/work/gcc-10-20200126/gcc/../libbacktrace  -DLIBICONV_PLUG -o analyzer/engine.o -MT analyzer/engine.o -MMD -MP -MF analyzer/.deps/engine.TPo /usr/ports/lang/gcc10-devel/work/gcc-10-20200126/gcc/analyzer/engine.cc
[... multiple warnings ...]
/usr/ports/lang/gcc10-devel/work/gcc-10-20200126/gcc/analyzer/engine.cc:2971:13: error: 
      reinterpret_cast from 'nullptr_t' to 'function *' is not allowed
  v.m_fun = reinterpret_cast<function *> (NULL);
/usr/ports/lang/gcc10-devel/work/gcc-10-20200126/gcc/analyzer/engine.cc:2983:21: error: 
      reinterpret_cast from 'nullptr_t' to 'function *' is not allowed
  return v.m_fun == reinterpret_cast<function *> (NULL);
Comment 1 Gerald Pfeifer freebsd_committer 2020-01-28 21:09:09 UTC
Would you mind reporting such issues upstream, cf. https://gcc.gnu.org/bugs/ ?

gcc10-devel tracks upstream HEAD, the equivalent of -CURRENT in FreeBSD, so
it is quite likely to be broken somewhat regularly.  I am test building both
on a daily base and when updating the port, but as we have seen here there is
always some configuration that may escape.

On this one I reached out to who I believe is the upstream author of the code
in question and hope he'll look into it.
Comment 2 Gerald Pfeifer freebsd_committer 2020-01-28 21:59:08 UTC
Created attachment 211143 [details]
Proposed patch

Can you please test the attached patch?  (Put the attached file into
lang/gcc10/files in your ports tree and try building lang/gcc10 with
Comment 3 Philippe Michel 2020-01-28 23:32:06 UTC
The patch allows the build to complete.
Comment 4 commit-hook freebsd_committer 2020-01-30 20:48:57 UTC
A commit references this bug:

Author: gerald
Date: Thu Jan 30 20:48:54 UTC 2020
New revision: 524659
URL: https://svnweb.freebsd.org/changeset/ports/524659

  Fix a build failure in the new analyzer module that was reported with
  clang 9.0.1 (only):

     ports/lang/gcc10-devel/work/gcc-10-20200126/gcc/analyzer/engine.cc:2971:13: error:
           reinterpret_cast from 'nullptr_t' to 'function *' is not allowed
       v.m_fun = reinterpret_cast<function *> (NULL);

  PR:		243681
  Reported by:	Philippe Michel <philippe.michel7@free.fr>

Comment 5 Gerald Pfeifer freebsd_committer 2020-01-30 20:58:24 UTC
Thanks for verifying the patch!  I have applied this locally for the
time being and will keep an eye on it getting upstream (or a different
fix being applied there).
Comment 6 Gerald Pfeifer freebsd_committer 2020-02-02 22:43:19 UTC
To make sure this gets into the GCC 10.1 release I filed an upstream bug
to track the issue and (proposed) fix:

Comment 7 Gerald Pfeifer freebsd_committer 2020-02-03 22:28:47 UTC
There's a new patch at

Can you please give that a try?
Comment 8 Philippe Michel 2020-02-04 21:46:34 UTC
I see that they have already settled the matter but, anyway, the patch from gcc.gnu.org works for me as well.
Comment 9 Gerald Pfeifer freebsd_committer 2020-02-04 22:08:45 UTC
Cool, thank you for the confirmation, Philippe!

We should then receive this fix with the next snapshot (due to be
created upstream next Sunday), at which point I'll remove the local
patch we are carrying for now.