I’m trying to bootstrap a GCC 10 compiler on macOS with clang, and I am getting
errors in stage 1, because there is C++11 code that is rejected by clang
(because the bootstrap involves compiling stage 1 with -std=gnu++98, online on
master (see top-level configure.ac). These errors are not seen, I believe, when
GCC is the bootstrap compiler, because GCC will issue a warning instead of an
error (as clang does).
One place with such issue is in aarch64-builtins.c, which contains a C++11
constructor. I can fix it with this:
diff --git a/gcc/config/aarch64/aarch64-builtins.c
b/gcc/config/aarch64/aarch64-builtins.c
index cba596765..184e9095d 100644
--- a/gcc/config/aarch64/aarch64-builtins.c
+++ b/gcc/config/aarch64/aarch64-builtins.c
@@ -1225,8 +1225,9 @@ aarch64_init_memtag_builtins (void)
= aarch64_general_add_builtin ("__builtin_aarch64_memtag_"#N, \
T, AARCH64_MEMTAG_BUILTIN_##F); \
aarch64_memtag_builtin_data[AARCH64_MEMTAG_BUILTIN_##F - \
- AARCH64_MEMTAG_BUILTIN_START - 1] = \
- {T, CODE_FOR_##I};
+ AARCH64_MEMTAG_BUILTIN_START - 1].ftype = T; \
+ aarch64_memtag_builtin_data[AARCH64_MEMTAG_BUILTIN_##F - \
+ AARCH64_MEMTAG_BUILTIN_START - 1].icode =
CODE_FOR_##I;
fntype = build_function_type_list (ptr_type_node, ptr_type_node,
uint64_type_node, NULL);
but later I am getting further errors:
../../gcc/gcc/config/darwin.c:1357:16: error: no viable conversion from
'poly_uint16' (aka 'poly_int<2, unsigned short>') to 'unsigned int'
unsigned int modesize = GET_MODE_BITSIZE (mode);
^ ~~~~~~~~~~~~~~~~~~~~~~~
../../gcc/gcc/config/darwin.c:1752:28: error: invalid operands to binary
expression ('poly_uint16' (aka 'poly_int<2, unsigned short>') and 'int')
if (GET_MODE_SIZE (mode) == 8
~~~~~~~~~~~~~~~~~~~~ ^ ~
../../gcc/gcc/wide-int.h:3289:19: note: candidate template ignored:
substitution failure [with T1 = poly_int<2, unsigned short>, T2 = int]:
implicit instantiation of undefined template
'wi::int_traits<poly_int<2, unsigned short> >'
BINARY_PREDICATE (operator ==, eq_p)
^
../../gcc/gcc/wide-int.h:3266:3: note: expanded from macro 'BINARY_PREDICATE'
OP (const T1 &x, const T2 &y) \
^
../../gcc/gcc/config/darwin.c:1757:33: error: invalid operands to binary
expression ('poly_uint16' (aka 'poly_int<2, unsigned short>') and 'int')
else if (GET_MODE_SIZE (mode) == 4
~~~~~~~~~~~~~~~~~~~~ ^ ~
../../gcc/gcc/wide-int.h:3289:19: note: candidate template ignored:
substitution failure [with T1 = poly_int<2, unsigned short>, T2 = int]:
implicit instantiation of undefined template
'wi::int_traits<poly_int<2, unsigned short> >'
BINARY_PREDICATE (operator ==, eq_p)
^
../../gcc/gcc/wide-int.h:3266:3: note: expanded from macro 'BINARY_PREDICATE'
OP (const T1 &x, const T2 &y) \
^
../../gcc/gcc/config/darwin.c:1764:29: error: invalid operands to binary
expression ('poly_uint16' (aka 'poly_int<2, unsigned short>') and 'int')
&& GET_MODE_SIZE (mode) == 16
~~~~~~~~~~~~~~~~~~~~ ^ ~~
../../gcc/gcc/wide-int.h:3289:19: note: candidate template ignored:
substitution failure [with T1 = poly_int<2, unsigned short>, T2 = int]:
implicit instantiation of undefined template
'wi::int_traits<poly_int<2, unsigned short> >'
BINARY_PREDICATE (operator ==, eq_p)
^
../../gcc/gcc/wide-int.h:3266:3: note: expanded from macro 'BINARY_PREDICATE'
OP (const T1 &x, const T2 &y) \
^
I would welcome:
1. confirmation that the C++11 code in aarch64-builtins.c is indeed a bug, and
that a patch for it would be welcome
2. guidance about how to fix that next issue
Thanks,
FX