[ Jeff, approval request below ]

On Wed, 5 Aug 2020, Aldy Hernandez wrote:
>> I believe this has broken the bootstrap with clang (specifically
>> FreeBSD clang version 10.0.0):
>>
>> In file included from /scratch/tmp/gerald/GCC-HEAD/gcc/c/gimple-parser.c:44:
>> In file included from /scratch/tmp/gerald/GCC-HEAD/gcc/tree-vrp.h:23:
>> /scratch/tmp/gerald/GCC-HEAD/gcc/value-range.h:347:1: error: static
>> declaration of 'gt_ggc_mx' follows non-static declaration gt_ggc_mx
>> (int_range<N> *x)
>> /scratch/tmp/gerald/GCC-HEAD/gcc/value-range.h:150:37: note: previous
>> declaration is here
>>    template <unsigned X> friend void gt_ggc_mx (int_range<X> *);
:
>> My daily tester started to 20200803T1640, so the root cause of this must
>> have entered GCC trunk between Sunday 16:40 UTC and Monday 16:40 UTC.
> Yeah, this is definitely caused by the irange patch.
> 
> GTY makes my head spin, and it took forever to get these gt_* functions 
> set up.  I can't claim I understand them entirely :).
> 
> Just a guess, does removing the static solve the problem?

Yes, that appears to solve this issue.  

Thank you, Aldy!  (And, yes, I ought to have thought of that myself. ;-)


Bootstrap still fails, but quite later (the log file is 13M as opposed 
to 0.8M) and related to something else ... also triggered by your patch, 
though, I'm afraid:

In file included from /scratch/tmp/gerald/GCC-HEAD/gcc/ipa-fnsummary.c:85:
In file included from /usr/include/c++/v1/vector:274:
In file included from /usr/include/c++/v1/__bit_reference:15:
In file included from /usr/include/c++/v1/algorithm:643:
In file included from /usr/include/c++/v1/memory:653:
/usr/include/c++/v1/typeinfo:346:5: error: no member named 'fancy_abort' in 
namespace 'std::__1'; did you mean simply 'fancy_abort'?
    _VSTD::abort();
    ^~~~~~~
/usr/include/c++/v1/__config:782:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_ABI_NAMESPACE
              ^
/scratch/tmp/gerald/GCC-HEAD/gcc/system.h:762:13: note: 'fancy_abort' declared 
here
extern void fancy_abort (const char *, int, const char *)
            ^

I believe this is due to the following:

diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c
index 55a0b272a96..49bab04524b 100644
--- a/gcc/ipa-fnsummary.c
+++ b/gcc/ipa-fnsummary.c
@@ -82,6 +82,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "gimplify.h"
 #include "stringpool.h"
 #include "attribs.h"
+#include <vector>
 #include "tree-into-ssa.h"
 
 /* Summaries.  */


This is nearly the only case in all of GCC where <vector> is included
directly; are you sure that's appropriate?

Digging a bit...

  2017-01-22  Dimitry Andric <d...@freebsd.org>

        * gcov.c (INCLUDE_ALGORITHM): Define.
        (INCLUDE_VECTOR): Define.
        No longer include <vector> and <algorithm> directly.

...makes me think this is a repeat of a similar situation around gcov
three years ago.

The patch below similarly uses INCLUDE_VECTOR and "system.h" and restores 
bootstrap.  Tested on i386-unknown-freebsd11.4 which uses clang 10.0.0 as 
system compiler.

Okay?

Gerald


2020-08-05  Gerald Pfeifer  <ger...@pfeifer.com> 
 
        * ipa-fnsummary.c (INCLUDE_VECTOR): Define. 
        Remove direct inclusion of <vector>. 

diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c
index 49bab04524b..59e52927151 100644
--- a/gcc/ipa-fnsummary.c
+++ b/gcc/ipa-fnsummary.c
@@ -52,6 +52,7 @@ along with GCC; see the file COPYING3.  If not see
    inlined performs analysis via its analyze_function method. */
 
 #include "config.h"
+#define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
 #include "backend.h"
@@ -82,7 +83,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "gimplify.h"
 #include "stringpool.h"
 #include "attribs.h"
-#include <vector>
 #include "tree-into-ssa.h"
 
 /* Summaries.  */

Reply via email to