GCC 5.1 is too old to compile under Ubuntu 22.04.5
Compiling command:
cd ~
mkdir gcc-5.1
cd gcc-5.1
mkdir build
git clone ../gcc
cd gcc
git checkout releases/gcc-5.1.0
contrib/download_prerequisites
cd ../build
../gcc/configure -v --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --prefix=/usr/local/gcc-5.1 --enable-checking=release --enable-languages=c,c++,fortran,go,ada --disable-multilib --program-suffix=-5.1 CC=gnatgcc
make -j 8
make install
Error message after compiling:
make[3]: Entering directory '/root/gcc-5.1/build/gcc'
x86_64-linux-gnu-g++ -c -g -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../gcc/gcc -I../../gcc/gcc/build -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include \
-o build/genpreds.o ../../gcc/gcc/genpreds.c
In file included from ./tm.h:27,
from ../../gcc/gcc/genpreds.c:26:
../../gcc/gcc/config/elfos.h:102:21: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
102 | fprintf ((FILE), "%s"HOST_WIDE_INT_PRINT_UNSIGNED"\n",\
| ^
../../gcc/gcc/config/elfos.h:170:24: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
170 | fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
| ^
In file included from ./tm.h:48,
from ../../gcc/gcc/genpreds.c:26:
../../gcc/gcc/defaults.h:126:24: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
126 | fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
| ^
In file included from ../../gcc/gcc/real.h:25,
from ../../gcc/gcc/rtl.h:26,
from ../../gcc/gcc/genpreds.c:27:
../../gcc/gcc/wide-int.h:370:10: error: too many template-parameter-lists
370 | struct binary_traits <T1, T2, FLEXIBLE_PRECISION, FLEXIBLE_PRECISION>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../gcc/gcc/wide-int.h:377:10: error: too many template-parameter-lists
377 | struct binary_traits <T1, T2, FLEXIBLE_PRECISION, VAR_PRECISION>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../gcc/gcc/wide-int.h:384:10: error: too many template-parameter-lists
384 | struct binary_traits <T1, T2, FLEXIBLE_PRECISION, CONST_PRECISION>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../gcc/gcc/wide-int.h:394:10: error: too many template-parameter-lists
394 | struct binary_traits <T1, T2, VAR_PRECISION, FLEXIBLE_PRECISION>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../gcc/gcc/wide-int.h:401:10: error: too many template-parameter-lists
401 | struct binary_traits <T1, T2, CONST_PRECISION, FLEXIBLE_PRECISION>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../gcc/gcc/wide-int.h:411:10: error: too many template-parameter-lists
411 | struct binary_traits <T1, T2, CONST_PRECISION, CONST_PRECISION>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../gcc/gcc/wide-int.h:422:10: error: too many template-parameter-lists
422 | struct binary_traits <T1, T2, VAR_PRECISION, VAR_PRECISION>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../gcc/gcc/wide-int.h:886:10: error: too many template-parameter-lists
886 | struct int_traits < generic_wide_int <storage> >
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../gcc/gcc/wide-int.h:898:51: error: invalid use of incomplete type ‘struct wi::int_traits<generic_wide_int<T> >’
898 | get_precision (const generic_wide_int <storage> &x)
| ^
../../gcc/gcc/wide-int.h:349:32: note: declaration of ‘struct wi::int_traits<generic_wide_int<T> >’
349 | template <typename T> struct int_traits;
| ^~~~~~~~~~
../../gcc/gcc/wide-int.h:907:47: error: invalid use of incomplete type ‘struct wi::int_traits<generic_wide_int<T> >’
907 | const generic_wide_int <storage> &x)
| ^
../../gcc/gcc/wide-int.h:349:32: note: declaration of ‘struct wi::int_traits<generic_wide_int<T> >’
349 | template <typename T> struct int_traits;
| ^~~~~~~~~~
../../gcc/gcc/wide-int.h:965:10: error: too many template-parameter-lists
965 | struct int_traits <wide_int_ref_storage <SE> >
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../gcc/gcc/wide-int.h: In instantiation of ‘struct wi::unary_traits<generic_wide_int<wide_int_storage> >’:
../../gcc/gcc/wide-int.h:685:3: required from ‘class generic_wide_int<wide_int_storage>’
../../gcc/gcc/wide-int.h:1080:14: required from here
../../gcc/gcc/wide-int.h:362:10: error: incomplete type ‘wi::int_traits<generic_wide_int<wide_int_storage> >’ used in nested name specifier
362 | struct unary_traits : public binary_traits <T, T> {};
| ^~~~~~~~~~~~
../../gcc/gcc/wide-int.h: In instantiation of ‘class generic_wide_int<wide_int_storage>’:
../../gcc/gcc/wide-int.h:1080:14: required from here
../../gcc/gcc/wide-int.h:685:19: error: no type named ‘result_type’ in ‘struct wi::unary_traits<generic_wide_int<wide_int_storage> >’
685 | UNARY_OPERATOR (operator ~, bit_not)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:671:38: note: in definition of macro ‘UNARY_OPERATOR’
671 | WI_UNARY_RESULT (generic_wide_int) OP () const { return wi::F (*this); }
| ^~
../../gcc/gcc/wide-int.h:686:19: error: no type named ‘result_type’ in ‘struct wi::unary_traits<generic_wide_int<wide_int_storage> >’
686 | UNARY_OPERATOR (operator -, neg)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:671:38: note: in definition of macro ‘UNARY_OPERATOR’
671 | WI_UNARY_RESULT (generic_wide_int) OP () const { return wi::F (*this); }
| ^~
../../gcc/gcc/wide-int.h:689:20: error: incomplete type ‘wi::int_traits<generic_wide_int<wide_int_storage> >’ used in nested name specifier
689 | BINARY_OPERATOR (operator &, bit_and)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h:690:20: error: incomplete type ‘wi::int_traits<generic_wide_int<wide_int_storage> >’ used in nested name specifier
690 | BINARY_OPERATOR (and_not, bit_and_not)
| ^~~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h:691:20: error: incomplete type ‘wi::int_traits<generic_wide_int<wide_int_storage> >’ used in nested name specifier
691 | BINARY_OPERATOR (operator |, bit_or)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h:692:20: error: incomplete type ‘wi::int_traits<generic_wide_int<wide_int_storage> >’ used in nested name specifier
692 | BINARY_OPERATOR (or_not, bit_or_not)
| ^~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h:693:20: error: incomplete type ‘wi::int_traits<generic_wide_int<wide_int_storage> >’ used in nested name specifier
693 | BINARY_OPERATOR (operator ^, bit_xor)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h:694:20: error: incomplete type ‘wi::int_traits<generic_wide_int<wide_int_storage> >’ used in nested name specifier
694 | BINARY_OPERATOR (operator +, add)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h:695:20: error: incomplete type ‘wi::int_traits<generic_wide_int<wide_int_storage> >’ used in nested name specifier
695 | BINARY_OPERATOR (operator -, sub)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h:696:20: error: incomplete type ‘wi::int_traits<generic_wide_int<wide_int_storage> >’ used in nested name specifier
696 | BINARY_OPERATOR (operator *, mul)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h: In instantiation of ‘struct wi::unary_traits<generic_wide_int<wide_int_ref_storage<false> > >’:
../../gcc/gcc/wide-int.h:685:3: required from ‘class generic_wide_int<wide_int_ref_storage<false> >’
../../gcc/gcc/wide-int.h:1083:60: required from here
../../gcc/gcc/wide-int.h:362:10: error: incomplete type ‘wi::int_traits<generic_wide_int<wide_int_ref_storage<false> > >’ used in nested name specifier
362 | struct unary_traits : public binary_traits <T, T> {};
| ^~~~~~~~~~~~
../../gcc/gcc/wide-int.h: In instantiation of ‘class generic_wide_int<wide_int_ref_storage<false> >’:
../../gcc/gcc/wide-int.h:1083:60: required from here
../../gcc/gcc/wide-int.h:685:19: error: no type named ‘result_type’ in ‘struct wi::unary_traits<generic_wide_int<wide_int_ref_storage<false> > >’
685 | UNARY_OPERATOR (operator ~, bit_not)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:671:38: note: in definition of macro ‘UNARY_OPERATOR’
671 | WI_UNARY_RESULT (generic_wide_int) OP () const { return wi::F (*this); }
| ^~
../../gcc/gcc/wide-int.h:686:19: error: no type named ‘result_type’ in ‘struct wi::unary_traits<generic_wide_int<wide_int_ref_storage<false> > >’
686 | UNARY_OPERATOR (operator -, neg)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:671:38: note: in definition of macro ‘UNARY_OPERATOR’
671 | WI_UNARY_RESULT (generic_wide_int) OP () const { return wi::F (*this); }
| ^~
../../gcc/gcc/wide-int.h:689:20: error: incomplete type ‘wi::int_traits<generic_wide_int<wide_int_ref_storage<false> > >’ used in nested name specifier
689 | BINARY_OPERATOR (operator &, bit_and)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h:690:20: error: incomplete type ‘wi::int_traits<generic_wide_int<wide_int_ref_storage<false> > >’ used in nested name specifier
690 | BINARY_OPERATOR (and_not, bit_and_not)
| ^~~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h:691:20: error: incomplete type ‘wi::int_traits<generic_wide_int<wide_int_ref_storage<false> > >’ used in nested name specifier
691 | BINARY_OPERATOR (operator |, bit_or)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h:692:20: error: incomplete type ‘wi::int_traits<generic_wide_int<wide_int_ref_storage<false> > >’ used in nested name specifier
692 | BINARY_OPERATOR (or_not, bit_or_not)
| ^~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h:693:20: error: incomplete type ‘wi::int_traits<generic_wide_int<wide_int_ref_storage<false> > >’ used in nested name specifier
693 | BINARY_OPERATOR (operator ^, bit_xor)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h:694:20: error: incomplete type ‘wi::int_traits<generic_wide_int<wide_int_ref_storage<false> > >’ used in nested name specifier
694 | BINARY_OPERATOR (operator +, add)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h:695:20: error: incomplete type ‘wi::int_traits<generic_wide_int<wide_int_ref_storage<false> > >’ used in nested name specifier
695 | BINARY_OPERATOR (operator -, sub)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h:696:20: error: incomplete type ‘wi::int_traits<generic_wide_int<wide_int_ref_storage<false> > >’ used in nested name specifier
696 | BINARY_OPERATOR (operator *, mul)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h:1152:10: error: too many template-parameter-lists
1152 | struct int_traits < fixed_wide_int_storage <N> >
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../gcc/gcc/wide-int.h:1244:42: error: invalid use of incomplete type ‘struct wi::int_traits<fixed_wide_int_storage<N> >’
1244 | get_binary_result (const T1 &, const T2 &)
| ^
../../gcc/gcc/wide-int.h:349:32: note: declaration of ‘struct wi::int_traits<fixed_wide_int_storage<N> >’
349 | template <typename T> struct int_traits;
| ^~~~~~~~~~
../../gcc/gcc/wide-int.h: In instantiation of ‘struct wi::unary_traits<generic_wide_int<trailing_wide_int_storage> >’:
../../gcc/gcc/wide-int.h:685:3: required from ‘class generic_wide_int<trailing_wide_int_storage>’
../../gcc/gcc/wide-int.h:1378:56: required from here
../../gcc/gcc/wide-int.h:362:10: error: incomplete type ‘wi::int_traits<generic_wide_int<trailing_wide_int_storage> >’ used in nested name specifier
362 | struct unary_traits : public binary_traits <T, T> {};
| ^~~~~~~~~~~~
../../gcc/gcc/wide-int.h: In instantiation of ‘class generic_wide_int<trailing_wide_int_storage>’:
../../gcc/gcc/wide-int.h:1378:56: required from here
../../gcc/gcc/wide-int.h:685:19: error: no type named ‘result_type’ in ‘struct wi::unary_traits<generic_wide_int<trailing_wide_int_storage> >’
685 | UNARY_OPERATOR (operator ~, bit_not)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:671:38: note: in definition of macro ‘UNARY_OPERATOR’
671 | WI_UNARY_RESULT (generic_wide_int) OP () const { return wi::F (*this); }
| ^~
../../gcc/gcc/wide-int.h:686:19: error: no type named ‘result_type’ in ‘struct wi::unary_traits<generic_wide_int<trailing_wide_int_storage> >’
686 | UNARY_OPERATOR (operator -, neg)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:671:38: note: in definition of macro ‘UNARY_OPERATOR’
671 | WI_UNARY_RESULT (generic_wide_int) OP () const { return wi::F (*this); }
| ^~
../../gcc/gcc/wide-int.h:689:20: error: incomplete type ‘wi::int_traits<generic_wide_int<trailing_wide_int_storage> >’ used in nested name specifier
689 | BINARY_OPERATOR (operator &, bit_and)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h:690:20: error: incomplete type ‘wi::int_traits<generic_wide_int<trailing_wide_int_storage> >’ used in nested name specifier
690 | BINARY_OPERATOR (and_not, bit_and_not)
| ^~~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h:691:20: error: incomplete type ‘wi::int_traits<generic_wide_int<trailing_wide_int_storage> >’ used in nested name specifier
691 | BINARY_OPERATOR (operator |, bit_or)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h:692:20: error: incomplete type ‘wi::int_traits<generic_wide_int<trailing_wide_int_storage> >’ used in nested name specifier
692 | BINARY_OPERATOR (or_not, bit_or_not)
| ^~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h:693:20: error: incomplete type ‘wi::int_traits<generic_wide_int<trailing_wide_int_storage> >’ used in nested name specifier
693 | BINARY_OPERATOR (operator ^, bit_xor)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h:694:20: error: incomplete type ‘wi::int_traits<generic_wide_int<trailing_wide_int_storage> >’ used in nested name specifier
694 | BINARY_OPERATOR (operator +, add)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h:695:20: error: incomplete type ‘wi::int_traits<generic_wide_int<trailing_wide_int_storage> >’ used in nested name specifier
695 | BINARY_OPERATOR (operator -, sub)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
../../gcc/gcc/wide-int.h:696:20: error: incomplete type ‘wi::int_traits<generic_wide_int<trailing_wide_int_storage> >’ used in nested name specifier
696 | BINARY_OPERATOR (operator *, mul)
| ^~~~~~~~
../../gcc/gcc/wide-int.h:676:5: note: in definition of macro ‘BINARY_OPERATOR’
676 | OP (const T &c) const { return wi::F (*this, c); }
| ^~
In file included from ../../gcc/gcc/rtl.h:27,
from ../../gcc/gcc/genpreds.c:27:
../../gcc/gcc/vec.h: In instantiation of ‘bool vec<T, va_heap, vl_ptr>::reserve(unsigned int, bool) [with T = std::pair<unsigned int, const char*>]’:
../../gcc/gcc/vec.h:1537:3: required from ‘T* vec<T, va_heap, vl_ptr>::safe_push(const T&) [with T = std::pair<unsigned int, const char*>]’
../../gcc/gcc/genpreds.c:1383:19: required from here
../../gcc/gcc/vec.h:1431:14: warning: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘struct std::pair<unsigned int, const char*>’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
1431 | memcpy (m_vec->address (), oldvec->address (), sizeof (T) * oldsize);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:64,
from /usr/include/c++/11/bits/char_traits.h:39,
from /usr/include/c++/11/string:40,
from ../../gcc/gcc/system.h:201,
from ../../gcc/gcc/genpreds.c:24:
/usr/include/c++/11/bits/stl_pair.h:211:12: note: ‘struct std::pair<unsigned int, const char*>’ declared here
211 | struct pair
| ^~~~
make[3]: *** [Makefile:2422: build/genpreds.o] Error 1
make[3]: Leaving directory '/root/gcc-5.1/build/gcc'
make[2]: *** [Makefile:4380: all-stage1-gcc] Error 2
make[2]: Leaving directory '/root/gcc-5.1/build'
make[1]: *** [Makefile:25529: stage1-bubble] Error 2
make[1]: Leaving directory '/root/gcc-5.1/build'
make: *** [Makefile:911: all] Error 2