diff -ruw gcc-6.5.0/configure gcc-6.5.0-irix/configure
--- gcc-6.5.0/configure	Mon Jan  9 16:01:26 2017
+++ gcc-6.5.0-irix/configure	Mon Jul 26 16:23:49 2021
@@ -3192,7 +3192,7 @@
 	;;
     *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly*)
 	;;
-    *-*-solaris2* | *-*-hpux11*)
+    *-*-solaris2* | *-*-hpux11* | mips*-*-irix6*)
 	;;
     *-*-darwin* | *-*-aix*)
 	;;
@@ -4727,13 +4727,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -5075,13 +5075,13 @@
   CXXFLAGS=$ac_save_CXXFLAGS
 elif test $ac_cv_prog_cxx_g = yes; then
   if test "$GXX" = yes; then
-    CXXFLAGS="-g -O2"
+    CXXFLAGS="-g -O1"
   else
     CXXFLAGS="-g"
   fi
 else
   if test "$GXX" = yes; then
-    CXXFLAGS="-O2"
+    CXXFLAGS="-O1"
   else
     CXXFLAGS=
   fi
@@ -6784,16 +6784,16 @@
 # might be empty or "-g".  We don't require a C++ compiler, so CXXFLAGS
 # might also be empty (or "-g", if a non-GCC C++ compiler is in the path).
 # We want to ensure that TARGET libraries (which we know are built with
-# gcc) are built with "-O2 -g", so include those options when setting
+# gcc) are built with "-O1 -g", so include those options when setting
 # CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
 if test "x$CFLAGS_FOR_TARGET" = x; then
   if test "x${is_cross_compiler}" = xyes; then
-    CFLAGS_FOR_TARGET="-g -O2"
+    CFLAGS_FOR_TARGET="-g -O1"
   else
     CFLAGS_FOR_TARGET=$CFLAGS
     case " $CFLAGS " in
-      *" -O2 "*) ;;
-      *) CFLAGS_FOR_TARGET="-O2 $CFLAGS_FOR_TARGET" ;;
+      *" -O1 "*) ;;
+      *) CFLAGS_FOR_TARGET="-O1 $CFLAGS_FOR_TARGET" ;;
     esac
     case " $CFLAGS " in
       *" -g "* | *" -g3 "*) ;;
@@ -6805,12 +6805,12 @@
 
 if test "x$CXXFLAGS_FOR_TARGET" = x; then
   if test "x${is_cross_compiler}" = xyes; then
-    CXXFLAGS_FOR_TARGET="-g -O2"
+    CXXFLAGS_FOR_TARGET="-g -O1"
   else
     CXXFLAGS_FOR_TARGET=$CXXFLAGS
     case " $CXXFLAGS " in
-      *" -O2 "*) ;;
-      *) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS_FOR_TARGET" ;;
+      *" -O1 "*) ;;
+      *) CXXFLAGS_FOR_TARGET="-O1 $CXXFLAGS_FOR_TARGET" ;;
     esac
     case " $CXXFLAGS " in
       *" -g "* | *" -g3 "*) ;;
@@ -6983,7 +6983,7 @@
     ;;
 esac
 
-# If --enable-target-optspace always use -Os instead of -O2 to build
+# If --enable-target-optspace always use -Os instead of -O1 to build
 # the target libraries, similarly if it is not specified, use -Os
 # on selected platforms.
 ospace_frag=/dev/null
diff -ruw gcc-6.5.0/configure.ac gcc-6.5.0-irix/configure.ac
--- gcc-6.5.0/configure.ac	Mon Jan  9 16:01:26 2017
+++ gcc-6.5.0-irix/configure.ac	Thu Jun 10 23:58:55 2021
@@ -549,7 +549,7 @@
 	;;
     *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly*)
 	;;
-    *-*-solaris2* | *-*-hpux11*)
+    *-*-solaris2* | *-*-hpux11* | mips*-*-irix6*)
 	;;
     *-*-darwin* | *-*-aix*)
 	;;
Only in gcc-6.5.0: gmp-6.1.0.tar.bz2
Only in gcc-6.5.0: isl-0.18.tar.bz2
Only in gcc-6.5.0: mpc-1.0.3.tar.gz
Only in gcc-6.5.0: mpfr-3.1.4.tar.bz2
diff -ruw gcc-6.5.0/boehm-gc/configure gcc-6.5.0-irix/boehm-gc/configure
--- gcc-6.5.0/boehm-gc/configure	Wed May 13 06:56:33 2015
+++ gcc-6.5.0-irix/boehm-gc/configure	Sat Jun 12 22:27:11 2021
@@ -3666,13 +3666,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -4205,13 +4205,13 @@
   CXXFLAGS=$ac_save_CXXFLAGS
 elif test $ac_cv_prog_cxx_g = yes; then
   if test "$GXX" = yes; then
-    CXXFLAGS="-g -O2"
+    CXXFLAGS="-g -O1"
   else
     CXXFLAGS="-g"
   fi
 else
   if test "$GXX" = yes; then
-    CXXFLAGS="-O2"
+    CXXFLAGS="-O1"
   else
     CXXFLAGS=
   fi
diff -ruw gcc-6.5.0/fixincludes/Makefile.in gcc-6.5.0-irix/fixincludes/Makefile.in
--- gcc-6.5.0/fixincludes/Makefile.in	Fri Dec 20 07:07:52 2013
+++ gcc-6.5.0-irix/fixincludes/Makefile.in	Thu Jun 10 23:59:46 2021
@@ -49,7 +49,7 @@
 target_noncanonical:=@target_noncanonical@
 
 # The version of GCC in this tree
-gcc_version := $(shell cat $(srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(srcdir)/../gcc/BASE-VER)
 
 # Directory in which the compiler finds libraries etc.
 libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)
diff -ruw gcc-6.5.0/fixincludes/configure gcc-6.5.0-irix/fixincludes/configure
--- gcc-6.5.0/fixincludes/configure	Fri Oct 26 05:56:36 2018
+++ gcc-6.5.0-irix/fixincludes/configure	Sat Jun 12 22:27:10 2021
@@ -590,6 +590,7 @@
 
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+get_gcc_base_ver
 MAINT
 TARGET
 target_noncanonical
@@ -664,6 +665,7 @@
 with_local_prefix
 enable_twoprocess
 enable_maintainer_mode
+with_gcc_major_version_only
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1298,6 +1300,8 @@
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --with-local-prefix=DIR specifies directory to put local include
+  --with-gcc-major-version-only
+                          use only GCC major number in filesystem paths
 
 Some influential environment variables:
   CC          C compiler command
@@ -3920,13 +3924,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -4561,6 +4565,12 @@
 # Figure out what compiler warnings we can enable.
 # See config/warnings.m4 for details.
 
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
 WARN_CFLAGS=
 save_CFLAGS="$CFLAGS"
 for real_option in -W -Wall -Wwrite-strings -Wstrict-prototypes \
@@ -4607,7 +4617,19 @@
 fi
   done
 CFLAGS="$save_CFLAGS"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
 WARN_PEDANTIC=
 # Do the check with the no- prefix removed from the warning options
 # since gcc silently accepts any -Wno-* option on purpose
@@ -4645,10 +4667,22 @@
 fi
 
 fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
+
 # Only enable with --enable-werror-always until existing warnings are
 # corrected.
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
 WERROR=
 # Check whether --enable-werror-always was given.
 if test "${enable_werror_always+set}" = set; then :
@@ -4661,8 +4695,14 @@
   WERROR="$WERROR${WERROR:+ }-Werror"
 fi
 
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
+
 # Determine the noncanonical target name, for directory use.
  case ${build_alias} in
   "") build_noncanonical=${build} ;;
@@ -5354,6 +5394,21 @@
 _ACEOF
 
 
+# Determine what GCC version number to use in filesystem paths.
+
+  get_gcc_base_ver="cat"
+
+# Check whether --with-gcc-major-version-only was given.
+if test "${with_gcc_major_version_only+set}" = set; then :
+  withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
+        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
+      fi
+
+fi
+
+
+
+
 ac_config_headers="$ac_config_headers config.h"
 
 ac_config_files="$ac_config_files Makefile mkheaders.almost:mkheaders.in"
diff -ruw gcc-6.5.0/fixincludes/configure.ac gcc-6.5.0-irix/fixincludes/configure.ac
--- gcc-6.5.0/fixincludes/configure.ac	Tue May 29 15:28:57 2012
+++ gcc-6.5.0-irix/fixincludes/configure.ac	Fri Jun 11 00:00:40 2021
@@ -114,6 +114,9 @@
 AC_DEFINE_UNQUOTED([SED_PROGRAM], "${SED}",
    [Defined to the best working sed program on the host system])
 
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
+
 AC_CONFIG_HEADERS(config.h, [echo timestamp > stamp-h])
 AC_CONFIG_FILES(Makefile mkheaders.almost:mkheaders.in)
 AC_OUTPUT
diff -ruw gcc-6.5.0/fixincludes/fixfixes.c gcc-6.5.0-irix/fixincludes/fixfixes.c
--- gcc-6.5.0/fixincludes/fixfixes.c	Thu Apr  9 11:00:19 2009
+++ gcc-6.5.0-irix/fixincludes/fixfixes.c	Fri Jun 11 00:00:40 2021
@@ -790,7 +790,8 @@
       return EXIT_FAILURE;
     }
 
-  apply_fix (pFix, argv[1]);
+  /* Second parameter of apply_fix is file name */
+  apply_fix (pFix, argv[2]);
   fclose (stdout);
   fclose (stdin);
   unlink (argv[4]);
diff -ruw gcc-6.5.0/fixincludes/fixinc.in gcc-6.5.0-irix/fixincludes/fixinc.in
--- gcc-6.5.0/fixincludes/fixinc.in	Sun Oct 28 17:42:48 2012
+++ gcc-6.5.0-irix/fixincludes/fixinc.in	Fri Jun 11 00:00:40 2021
@@ -41,7 +41,7 @@
 
 # Make sure it exists.
 if [ ! -d $LIB ]; then
-  mkdir $LIB || {
+  mkdir -p $LIB || {
     echo fixincludes:  output dir '`'$LIB"' cannot be created"
     exit 1
   }
@@ -344,7 +344,7 @@
             mkdir $component >/dev/null 2>&1
             cd $component
             dirmade=$dirmade/$component
-            dirname=`echo $dirname | sed -e 's|[^/]*/||'`
+            dirname=`echo $dirname | sed -e 's|[^/]*//*||'`
           done
         fi
 
diff -ruw gcc-6.5.0/gcc/config.gcc gcc-6.5.0-irix/gcc/config.gcc
--- gcc-6.5.0/gcc/config.gcc	Tue Nov 21 04:41:34 2017
+++ gcc-6.5.0-irix/gcc/config.gcc	Sun Dec 22 11:36:58 2024
@@ -2048,6 +2048,28 @@
 	cxx_target_objs="${cxx_target_objs} microblaze-c.o"
 	tmake_file="${tmake_file} microblaze/t-microblaze"
         ;;
+mips-sgi-irix6.5*)
+	tm_file="elfos.h ${tm_file} mips/iris6.h"
+	tmake_file="mips/t-irix6 t-slibgcc"
+	c_target_objs="irix6-c.o"
+	cxx_target_objs="irix6-c.o"
+	extra_options="${extra_options} rpath.opt mips/iris6.opt"
+	target_cpu_default="MASK_ABICALLS"
+	tm_defines="${tm_defines} MIPS_ISA_DEFAULT=4 MIPS_ABI_DEFAULT=ABI_N32"
+	# Only IRIX Development Foundation 1.3 for IRIX 6.5 provides stdint.h.
+	use_gcc_stdint=wrap
+	if test "x$stabs" = xyes
+	then
+		tm_file="${tm_file} dbx.h"
+	fi
+	if test "x$gnu_ld" = xyes
+	then
+		tm_defines="${tm_defines} IRIX_USING_GNU_LD"
+	fi
+	case ${enable_threads}:${have_pthread_h} in
+	  "":yes | yes:yes ) thread_file=posix ;;
+	esac
+	;;
 mips*-*-netbsd*)			# NetBSD/mips, either endian.
 	target_cpu_default="MASK_ABICALLS"
 	tm_file="elfos.h ${tm_file} mips/elf.h netbsd.h netbsd-elf.h mips/netbsd.h"
diff -ruw gcc-6.5.0/gcc/config.host gcc-6.5.0-irix/gcc/config.host
--- gcc-6.5.0/gcc/config.host	Mon Jan  9 16:01:26 2017
+++ gcc-6.5.0-irix/gcc/config.host	Fri Jun 11 00:13:30 2021
@@ -133,9 +133,9 @@
 	;;
     esac
     ;;
-  mips*-*-linux*)
+  mips*-*-linux* | mips-sgi-irix*)
     case ${target} in
-      mips*-*-linux*)
+      mips*-*-linux* | mips-sgi-irix*)
 	host_extra_gcc_objs="driver-native.o"
 	host_xmake_file="${host_xmake_file} mips/x-native"
       ;;
diff -ruw gcc-6.5.0/gcc/configure gcc-6.5.0-irix/gcc/configure
--- gcc-6.5.0/gcc/configure	Thu Mar  8 03:55:59 2018
+++ gcc-6.5.0-irix/gcc/configure	Mon Jul 26 16:20:24 2021
@@ -4402,13 +4402,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -4750,13 +4750,13 @@
   CXXFLAGS=$ac_save_CXXFLAGS
 elif test $ac_cv_prog_cxx_g = yes; then
   if test "$GXX" = yes; then
-    CXXFLAGS="-g -O2"
+    CXXFLAGS="-g -O1"
   else
     CXXFLAGS="-g"
   fi
 else
   if test "$GXX" = yes; then
-    CXXFLAGS="-O2"
+    CXXFLAGS="-O1"
   else
     CXXFLAGS=
   fi
@@ -4995,7 +4995,7 @@
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
-# Remove the -O2: for historical reasons, unless bootstrapping we prefer
+# Remove the -O1: for historical reasons, unless bootstrapping we prefer
 # optimizations to be activated explicitly by the toplevel.
 case "$CC" in
   */prev-gcc/xgcc*) ;;
@@ -5050,7 +5050,7 @@
 	# sets the default TLS model and affects inlining.
 	PICFLAG_FOR_TARGET=-fPIC
 	;;
-    mips-sgi-irix6*)
+    mips*-sgi-irix6*)
 	# PIC is the default.
 	;;
     rs6000-ibm-aix* | powerpc-ibm-aix*)
@@ -7355,7 +7355,7 @@
     coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O0 -fkeep-static-functions"
     ;;
   opt)
-    coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O2 -fkeep-static-functions"
+    coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O1 -fkeep-static-functions"
     ;;
   no)
     # a.k.a. --disable-coverage
@@ -7548,8 +7548,17 @@
       ;;
 
     mips*-*-*)
+      case $host in
+	mips*-sgi-irix*)
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: fixed-point is not supported on IRIX, ignored" >&5
+$as_echo "$as_me: WARNING: fixed-point is not supported on IRIX, ignored" >&2;}
+	  enable_fixed_point=no
+	  ;;
+	*)
       enable_fixed_point=yes
       ;;
+      esac
+      ;;
     *)
       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: fixed-point is not supported for this target, ignored" >&5
 $as_echo "$as_me: WARNING: fixed-point is not supported for this target, ignored" >&2;}
diff -ruw gcc-6.5.0/gcc/configure.ac gcc-6.5.0-irix/gcc/configure.ac
--- gcc-6.5.0/gcc/configure.ac	Thu Mar  8 03:55:59 2018
+++ gcc-6.5.0-irix/gcc/configure.ac	Fri Jun 11 00:13:30 2021
@@ -832,8 +832,16 @@
       ;;
 
     mips*-*-*)
+      case $host in
+	mips*-sgi-irix*)
+	  AC_MSG_WARN([fixed-point is not supported on IRIX, ignored])
+	  enable_fixed_point=no
+	  ;;
+	*)
       enable_fixed_point=yes
       ;;
+      esac
+      ;;
     *)
       AC_MSG_WARN([fixed-point is not supported for this target, ignored])
       enable_fixed_point=no
@@ -3568,6 +3576,10 @@
 	  gcc_cv_ld_dynamic_option="-adefault"
 	fi
 	;;
+      # IRIX 6 ld supports -Bstatic/-Bdynamic.
+      mips-sgi-irix6*)
+        gcc_cv_ld_static_dynamic=yes
+        ;;
       # Solaris 2 ld always supports -Bstatic/-Bdynamic.
       *-*-solaris2*)
         gcc_cv_ld_static_dynamic=yes
diff -ruw gcc-6.5.0/gcc/dwarf2cfi.c gcc-6.5.0-irix/gcc/dwarf2cfi.c
--- gcc-6.5.0/gcc/dwarf2cfi.c	Mon Jan  4 09:30:50 2016
+++ gcc-6.5.0-irix/gcc/dwarf2cfi.c	Sat Jun 12 02:41:28 2021
@@ -771,6 +771,7 @@
 	cfi->dw_cfi_opc = DW_CFA_def_cfa_offset;
       cfi->dw_cfi_oprnd1.dw_cfi_offset = new_cfa->offset;
     }
+#ifndef SGUG_DEBUGGING_INFO
   else if (new_cfa->offset == old_cfa->offset
 	   && old_cfa->reg != INVALID_REGNUM
 	   && !new_cfa->indirect
@@ -782,6 +783,8 @@
       cfi->dw_cfi_opc = DW_CFA_def_cfa_register;
       cfi->dw_cfi_oprnd1.dw_cfi_reg_num = new_cfa->reg;
     }
+#endif
+
   else if (new_cfa->indirect == 0)
     {
       /* Construct a "DW_CFA_def_cfa <register> <offset>" instruction,
@@ -1280,6 +1283,10 @@
       unsigned int regno = dwf_regno (reg);
       add_cfi_restore (regno);
       update_row_reg_save (cur_row, regno, NULL);
+  if (REG_P (INCOMING_RETURN_ADDR_RTX)
+    && regno == dwf_regno (INCOMING_RETURN_ADDR_RTX)
+    && regno != DWARF_FRAME_RETURN_COLUMN)
+    reg_save (DWARF_FRAME_RETURN_COLUMN, regno, 0);
     }
   else
     {
@@ -2770,7 +2777,8 @@
 create_pseudo_cfg (void)
 {
   bool saw_barrier, switch_sections;
-  dw_trace_info ti;
+  dw_trace_info ti1;
+  dw_trace_info* ti = &ti1;
   rtx_insn *insn;
   unsigned i;
 
@@ -2777,15 +2785,15 @@
   /* The first trace begins at the start of the function,
      and begins with the CIE row state.  */
   trace_info.create (16);
-  memset (&ti, 0, sizeof (ti));
-  ti.head = get_insns ();
-  ti.beg_row = cie_cfi_row;
-  ti.cfa_store = cie_cfi_row->cfa;
-  ti.cfa_temp.reg = INVALID_REGNUM;
-  trace_info.quick_push (ti);
+  memset (&ti1, 0, sizeof (ti1));
+  ti1.head = get_insns ();
+  ti1.beg_row = cie_cfi_row;
+  ti1.cfa_store = cie_cfi_row->cfa;
+  ti1.cfa_temp.reg = INVALID_REGNUM;
+  ti = trace_info.quick_push (ti1);
 
   if (cie_return_save)
-    ti.regs_saved_in_regs.safe_push (*cie_return_save);
+    ti->regs_saved_in_regs.safe_push (*cie_return_save);
 
   /* Walk all the insns, collecting start of trace locations.  */
   saw_barrier = false;
@@ -2807,11 +2815,12 @@
       else if (save_point_p (insn)
 	       && (LABEL_P (insn) || !saw_barrier))
 	{
-	  memset (&ti, 0, sizeof (ti));
-	  ti.head = insn;
-	  ti.switch_sections = switch_sections;
-	  ti.id = trace_info.length ();
-	  trace_info.safe_push (ti);
+	  dw_trace_info ti2;
+	  memset (&ti2, 0, sizeof (ti2));
+	  ti2.head = insn;
+	  ti2.switch_sections = switch_sections;
+	  ti2.id = trace_info.length ();
+	  ti = trace_info.safe_push (ti2);
 
 	  saw_barrier = false;
 	  switch_sections = false;
@@ -2822,19 +2831,18 @@
      avoiding stale pointer problems due to reallocation.  */
   trace_index
     = new hash_table<trace_info_hasher> (trace_info.length ());
-  dw_trace_info *tp;
-  FOR_EACH_VEC_ELT (trace_info, i, tp)
+  FOR_EACH_VEC_ELT (trace_info, i, ti)
     {
       dw_trace_info **slot;
 
       if (dump_file)
-	fprintf (dump_file, "Creating trace %u : start at %s %d%s\n", tp->id,
-		 rtx_name[(int) GET_CODE (tp->head)], INSN_UID (tp->head),
-		 tp->switch_sections ? " (section switch)" : "");
+	fprintf (dump_file, "Creating trace %u : start at %s %d%s\n", ti->id,
+		 rtx_name[(int) GET_CODE (ti->head)], INSN_UID (ti->head),
+		 ti->switch_sections ? " (section switch)" : "");
 
-      slot = trace_index->find_slot_with_hash (tp, INSN_UID (tp->head), INSERT);
+      slot = trace_index->find_slot_with_hash (ti, INSN_UID (ti->head), INSERT);
       gcc_assert (*slot == NULL);
-      *slot = tp;
+      *slot = ti;
     }
 }
 
@@ -3395,6 +3403,10 @@
 {
   int enc;
 
+#ifdef SGUG_DEBUGGING_INFO
+  return false;
+#endif
+
   if (saved_do_cfi_asm != 0)
     return saved_do_cfi_asm > 0;
 
diff -ruw gcc-6.5.0/gcc/dwarf2out.c gcc-6.5.0-irix/gcc/dwarf2out.c
--- gcc-6.5.0/gcc/dwarf2out.c	Mon Jun 25 13:44:31 2018
+++ gcc-6.5.0-irix/gcc/dwarf2out.c	Fri Jun 11 00:13:30 2021
@@ -948,7 +948,13 @@
 
   if (for_eh && targetm.terminate_dw2_eh_frame_info)
     dw2_asm_output_data (4, 0, "End of Table");
+#ifdef SGUG_DEBUGGING_INFO
+  /* Work around Irix 6 assembler bug whereby labels at the end of a section
+     get a value of 0.  Putting .align 0 after the label fixes it.  */
+  ASM_OUTPUT_ALIGN (asm_out_file, 0);
+#endif
 
+
   /* Turn off app to make assembly quicker.  */
   if (flag_debug_asm)
     app_disable ();
@@ -16928,7 +16934,14 @@
 	  /* The DWARF2 standard says that we should assume that the structure
 	     address is already on the stack, so we can specify a structure
 	     field address by using DW_OP_plus_uconst.  */
+#ifdef SGUG_DEBUGGING_INFO
+	  /* ??? The SGI dwarf reader does not handle the DW_OP_plus_uconst
+	     operator correctly.  It works only if we leave the offset on the
+	     stack.  */
+	  op = DW_OP_constu;
+#else
 	  op = DW_OP_plus_uconst;
+#endif
 	  loc_descr = new_loc_descr (op, offset, 0);
 	}
     }
@@ -19284,6 +19297,17 @@
       return;
     }
 
+  /* ??? The SGI dwarf reader fails for array of array of enum types
+     (e.g. const enum machine_mode insn_operand_mode[2][10]) unless the inner
+     array type comes before the outer array type.  We thus call gen_type_die
+     before we new_die and must prevent nested array types collapsing for this
+     target.  */
+
+#ifdef SGUG_DEBUGGING_INFO
+  gen_type_die (TREE_TYPE (type), context_die);
+  collapse_nested_arrays = false;
+#endif
+
   array_die = new_die (DW_TAG_array_type, scope_die, type);
   add_name_attribute (array_die, type_tag (type));
   equate_type_number_to_die (type, array_die);
@@ -19308,6 +19332,14 @@
      for multidimensional arrays.  */
   add_AT_unsigned (array_die, DW_AT_ordering, DW_ORD_row_major);
 #endif
+#ifdef SGUG_DEBUGGING_INFO
+  /* The SGI compilers handle arrays of unknown bound by setting
+     AT_declaration and not emitting any subrange DIEs.  */
+  if (TREE_CODE (type) == ARRAY_TYPE
+      && ! TYPE_DOMAIN (type))
+    add_AT_flag (array_die, DW_AT_declaration, 1);
+  else
+#endif
 
   if (TREE_CODE (type) == VECTOR_TYPE)
     {
@@ -20691,6 +20723,11 @@
                                false);
 	}
 
+#ifdef SGUG_DEBUGGING_INFO
+      /* Add a reference to the FDE for this routine.  */
+      add_AT_fde_ref (subr_die, DW_AT_MIPS_fde, cfun->fde->fde_index);
+#endif
+
       cfa_fb_offset = CFA_FRAME_BASE_OFFSET (decl);
 
       /* We define the "frame base" as the function's CFA.  This is more
@@ -21817,6 +21854,24 @@
   sprintf (tail, "%s %s", language_string, version_string);
   tail += plen;
 
+  if (!dwarf_record_gcc_switches)
+    {
+#ifdef SGUG_DEBUGGING_INFO
+      /* The MIPS/SGI compilers place the 'cc' command line options in the
+	 producer string.  The SGI debugger looks for -g, -g1, -g2, or -g3;
+	 if they do not appear in the producer string, the debugger reaches
+	 the conclusion that the object file is stripped and has no debugging
+	 information.  To get the MIPS/SGI debugger to believe that there is
+	 debugging information in the object file, we add a -g to the producer
+	 string.  */
+      if (debug_info_level > DINFO_LEVEL_TERSE)
+	{
+	  memcpy (tail, " -g", 3);
+	  tail += 3;
+	}
+#endif
+    }
+
   FOR_EACH_VEC_ELT (switches, j, p)
     {
       len = strlen (p);
diff -ruw gcc-6.5.0/gcc/config/mips/driver-native.c gcc-6.5.0-irix/gcc/config/mips/driver-native.c
--- gcc-6.5.0/gcc/config/mips/driver-native.c	Mon Jan  4 09:30:50 2016
+++ gcc-6.5.0-irix/gcc/config/mips/driver-native.c	Fri Jun 11 00:13:30 2021
@@ -22,6 +22,59 @@
 #include "coretypes.h"
 #include "tm.h"
 
+#ifdef __sgi__
+#include <invent.h>
+#include <sys/sbd.h>
+
+/* Cf. MIPS R10000 Microprocessor User Guide, Version 2.0, 14.13 Processor
+   Revision Identifier (PRId) Register (15).
+
+   http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi/hdwr/bks/SGI_Developer/books/R10K_UM/sgi_html/t5.Ver.2.0.book_279.html  */
+
+static const struct cpu_types {
+  int impl;
+  const char *cpu;
+} cpu_types[] = {
+  { C0_IMP_R2000, "r2000" },
+  { C0_IMP_R3000, "r3000" },
+  { C0_IMP_R6000, "r6000" },
+  { C0_IMP_R4000, "r4000" },
+  { C0_IMP_R6000A, "r6000" },
+  { C0_IMP_R10000, "r10000" },
+  { C0_IMP_R12000, "r12000" },
+  { C0_IMP_R14000, "r14000" },
+  { C0_IMP_R8000,  "r8000" },
+  { C0_IMP_R4600,  "r4600" },
+  { C0_IMP_R4700,  "r4600" },
+  { C0_IMP_R4650,  "r4650" },
+  { C0_IMP_R5000,  "vr5000" },
+  { C0_IMP_RM7000, "rm7000" },
+  { C0_IMP_RM5271, "vr5000" },
+  { 0, 0 }
+};
+
+static int
+cputype (inventory_t *inv, void *arg)
+{
+  if (inv != NULL
+      && inv->inv_class == INV_PROCESSOR
+      && inv->inv_type == INV_CPUCHIP)
+    {
+      int i;
+      /* inv_state is the cpu revision number.  */
+      int impl = (inv->inv_state & C0_IMPMASK) >> C0_IMPSHIFT;
+
+      for (i = 0; cpu_types[i].cpu != NULL; i++)
+	if (cpu_types[i].impl == impl)
+	  {
+	    *((const char **) arg) = cpu_types[i].cpu;
+	    break;
+	  }
+    }
+  return 0;
+}
+#endif
+
 /* This will be called by the spec parser in gcc.c when it sees
    a %:local_cpu_detect(args) construct.  Currently it will be called
    with either "arch" or "tune" as argument depending on if -march=native
@@ -39,8 +92,10 @@
 host_detect_local_cpu (int argc, const char **argv)
 {
   const char *cpu = NULL;
+#ifndef __sgi__
   char buf[128];
   FILE *f;
+#endif
   bool arch;
 
   if (argc < 1)
@@ -50,6 +105,9 @@
   if (!arch && strcmp (argv[0], "tune"))
     return NULL;
 
+#ifdef __sgi__
+  scaninvent (cputype, &cpu);
+#else
   f = fopen ("/proc/cpuinfo", "r");
   if (f == NULL)
     return NULL;
@@ -81,6 +139,7 @@
       }
 
   fclose (f);
+#endif
 
   if (cpu == NULL)
     return NULL;
Only in gcc-6.5.0-irix/gcc/config/mips: iris6.h
Only in gcc-6.5.0-irix/gcc/config/mips: iris6.opt
Only in gcc-6.5.0-irix/gcc/config/mips: irix6-c.c
diff -ruw gcc-6.5.0/gcc/config/mips/mips.c gcc-6.5.0-irix/gcc/config/mips/mips.c
--- gcc-6.5.0/gcc/config/mips/mips.c	Thu Feb 11 18:53:54 2016
+++ gcc-6.5.0-irix/gcc/config/mips/mips.c	Fri Jun 11 00:13:30 2021
@@ -456,6 +456,12 @@
 enum processor mips_arch;
 const struct mips_cpu_info *mips_arch_info;
 
+#if TARGET_IRIX6
+/* On IRIX 6, intmax_t and uintmax_t depend on __c99, which is only
+   available in C-family compilers.  See irix6_c_common_override_options.  */
+int long_intmax = -1;
+#endif
+
 /* The processor that we should tune the code for.  */
 enum processor mips_tune;
 const struct mips_cpu_info *mips_tune_info;
@@ -6163,6 +6169,9 @@
       layout_type (record);
       return record;
     }
+  else if (TARGET_IRIX6)
+    /* On IRIX 6, this type is 'char *'.  */
+    return build_pointer_type (char_type_node);
   else
     /* Otherwise, we use 'void *'.  */
     return ptr_type_node;
@@ -9239,6 +9248,8 @@
   /* Generate a special section to describe the ABI switches used to
      produce the resultant binary.  */
 
+  if (!TARGET_IRIX6)    {
+
   /* Record the ABI itself.  Modern versions of binutils encode
      this information in the ELF header flags, but GDB needs the
      information in order to correctly debug binaries produced by
@@ -9319,6 +9330,7 @@
   }
 #endif
 #endif
+  }
 
   /* If TARGET_ABICALLS, tell GAS to generate -KPIC code.  */
   if (TARGET_ABICALLS)
@@ -18107,6 +18119,10 @@
       REAL_MODE_FORMAT (TFmode) = &mips_quad_format;
     }
 
+#ifdef MIPS_TFMODE_FORMAT
+  REAL_MODE_FORMAT (TFmode) = &MIPS_TFMODE_FORMAT;
+#endif
+
   /* Make sure that the user didn't turn off paired single support when
      MIPS-3D support is requested.  */
   if (TARGET_MIPS3D
diff -ruw gcc-6.5.0/gcc/config/mips/mips.h gcc-6.5.0-irix/gcc/config/mips/mips.h
--- gcc-6.5.0/gcc/config/mips/mips.h	Mon Jan 18 08:30:43 2016
+++ gcc-6.5.0-irix/gcc/config/mips/mips.h	Fri Jun 11 00:13:30 2021
@@ -191,7 +191,9 @@
 
 /* True if .gpword or .gpdword should be used for switch tables.  */
 #define TARGET_GPWORD				\
-  (TARGET_ABICALLS && !TARGET_ABSOLUTE_ABICALLS)
+  (TARGET_ABICALLS				\
+   && !TARGET_ABSOLUTE_ABICALLS			\
+   && !(mips_abi == ABI_64 && TARGET_IRIX6))
 
 /* True if the output must have a writable .eh_frame.
    See ASM_PREFERRED_EH_DATA_FORMAT for details.  */
diff -ruw gcc-6.5.0/gcc/config/mips/t-irix6 gcc-6.5.0-irix/gcc/config/mips/t-irix6
--- gcc-6.5.0/gcc/config/mips/t-irix6	Fri Jun  3 13:16:44 2011
+++ gcc-6.5.0-irix/gcc/config/mips/t-irix6	Fri Jun 11 00:13:30 2021
@@ -2,3 +2,7 @@
 MULTILIB_DIRNAMES=n32 64
 MULTILIB_MATCHES=
 MULTILIB_OSDIRNAMES=../lib32 ../lib64
+
+irix6-c.o: $(srcdir)/config/mips/irix6-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+  tree.h $(TM_H) $(C_COMMON_H)
+	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
diff -ruw gcc-6.5.0/gmp/gmp-h.in gcc-6.5.0-irix/gmp/gmp-h.in
--- gcc-6.5.0/gmp/gmp-h.in	Sun Nov  1 10:19:48 2015
+++ gcc-6.5.0-irix/gmp/gmp-h.in	Sat Jun 12 23:32:57 2021
@@ -289,6 +289,10 @@
    application uses for gmp_vprintf etc will almost certainly require the
    whole <stdarg.h> anyway.  */
 
+
+#ifdef __sgi
+ typedef char *va_list;
+#endif
 #ifdef va_start
 #define _GMP_H_HAVE_VA_LIST 1
 #endif
@@ -470,8 +474,10 @@
 
 #if defined (__cplusplus)
 extern "C" {
+#ifndef __sgi
 using std::FILE;
 #endif
+#endif
 
 #define mp_set_memory_functions __gmp_set_memory_functions
 __GMP_DECLSPEC void mp_set_memory_functions (void *(*) (size_t),
diff -ruw gcc-6.5.0/gmp/gmp-impl.h gcc-6.5.0-irix/gmp/gmp-impl.h
--- gcc-6.5.0/gmp/gmp-impl.h	Sun Nov  1 10:19:48 2015
+++ gcc-6.5.0-irix/gmp/gmp-impl.h	Sat Jun 12 23:31:19 2021
@@ -229,6 +229,9 @@
 
 /* gmp_uint_least32_t is an unsigned integer type with at least 32 bits. */
 #if HAVE_UINT_LEAST32_T
+#ifdef __sgi
+ typedef unsigned int uint_least32_t;
+#endif
 typedef uint_least32_t      gmp_uint_least32_t;
 #else
 #if SIZEOF_UNSIGNED_SHORT >= 4
diff -ruw gcc-6.5.0/gmp-6.1.0/gmp-h.in gcc-6.5.0-irix/gmp-6.1.0/gmp-h.in
--- gcc-6.5.0/gmp-6.1.0/gmp-h.in	Sun Nov  1 10:19:48 2015
+++ gcc-6.5.0-irix/gmp-6.1.0/gmp-h.in	Sat Jun 12 23:32:57 2021
@@ -289,6 +289,10 @@
    application uses for gmp_vprintf etc will almost certainly require the
    whole <stdarg.h> anyway.  */
 
+
+#ifdef __sgi
+ typedef char *va_list;
+#endif
 #ifdef va_start
 #define _GMP_H_HAVE_VA_LIST 1
 #endif
@@ -470,8 +474,10 @@
 
 #if defined (__cplusplus)
 extern "C" {
+#ifndef __sgi
 using std::FILE;
 #endif
+#endif
 
 #define mp_set_memory_functions __gmp_set_memory_functions
 __GMP_DECLSPEC void mp_set_memory_functions (void *(*) (size_t),
diff -ruw gcc-6.5.0/gmp-6.1.0/gmp-impl.h gcc-6.5.0-irix/gmp-6.1.0/gmp-impl.h
--- gcc-6.5.0/gmp-6.1.0/gmp-impl.h	Sun Nov  1 10:19:48 2015
+++ gcc-6.5.0-irix/gmp-6.1.0/gmp-impl.h	Sat Jun 12 23:31:19 2021
@@ -229,6 +229,9 @@
 
 /* gmp_uint_least32_t is an unsigned integer type with at least 32 bits. */
 #if HAVE_UINT_LEAST32_T
+#ifdef __sgi
+ typedef unsigned int uint_least32_t;
+#endif
 typedef uint_least32_t      gmp_uint_least32_t;
 #else
 #if SIZEOF_UNSIGNED_SHORT >= 4
diff -ruw gcc-6.5.0/gnattools/configure gcc-6.5.0-irix/gnattools/configure
--- gcc-6.5.0/gnattools/configure	Mon Jun  8 03:27:56 2015
+++ gcc-6.5.0-irix/gnattools/configure	Sat Jun 12 22:27:10 2021
@@ -2752,13 +2752,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
diff -ruw gcc-6.5.0/gotools/configure gcc-6.5.0-irix/gotools/configure
--- gcc-6.5.0/gotools/configure	Wed May 13 06:59:14 2015
+++ gcc-6.5.0-irix/gotools/configure	Sat Jun 12 22:27:11 2021
@@ -3259,13 +3259,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -3775,7 +3775,7 @@
   fi
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
-GOCFLAGS="-g -O2"
+GOCFLAGS="-g -O1"
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
diff -ruw gcc-6.5.0/include/libiberty.h gcc-6.5.0-irix/include/libiberty.h
--- gcc-6.5.0/include/libiberty.h	Tue Jan  5 15:23:30 2016
+++ gcc-6.5.0-irix/include/libiberty.h	Sat Jun 12 18:29:39 2021
@@ -109,7 +109,7 @@
  || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) \
  || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) \
  || defined (__DragonFly__) || defined (HAVE_DECL_BASENAME) 
-extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
+extern char *basename (const char *)  ATTRIBUTE_NONNULL(1);
 #else
 /* Do not allow basename to be used if there is no prototype seen.  We
    either need to use the above prototype or have one from
@@ -120,18 +120,18 @@
 
 /* A well-defined basename () that is always compiled in.  */
 
-extern const char *lbasename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
+extern const char *lbasename (const char *)  ATTRIBUTE_NONNULL(1);
 
 /* Same, but assumes DOS semantics (drive name, backslash is also a
    dir separator) regardless of host.  */
 
-extern const char *dos_lbasename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
+extern const char *dos_lbasename (const char *)  ATTRIBUTE_NONNULL(1);
 
 /* Same, but assumes Unix semantics (absolute paths always start with
    a slash, only forward slash is accepted as dir separator)
    regardless of host.  */
 
-extern const char *unix_lbasename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
+extern const char *unix_lbasename (const char *)  ATTRIBUTE_NONNULL(1);
 
 /* A well-defined realpath () that is always compiled in.  */
 
@@ -141,7 +141,7 @@
    the last argument of this function, to terminate the list of
    strings.  Allocates memory using xmalloc.  */
 
-extern char *concat (const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_SENTINEL;
+extern char *concat (const char *, ...) ATTRIBUTE_MALLOC  ATTRIBUTE_SENTINEL;
 
 /* Concatenate an arbitrary number of strings.  You must pass NULL as
    the last argument of this function, to terminate the list of
@@ -150,7 +150,7 @@
    pointer to be freed after the new string is created, similar to the
    way xrealloc works.  */
 
-extern char *reconcat (char *, const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_SENTINEL;
+extern char *reconcat (char *, const char *, ...) ATTRIBUTE_MALLOC  ATTRIBUTE_SENTINEL;
 
 /* Determine the length of concatenating an arbitrary number of
    strings.  You must pass NULL as the last argument of this function,
@@ -163,7 +163,7 @@
    to terminate the list of strings.  The supplied memory is assumed
    to be large enough.  */
 
-extern char *concat_copy (char *, const char *, ...) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL;
+extern char *concat_copy (char *, const char *, ...)  ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL;
 
 /* Concatenate an arbitrary number of strings into a GLOBAL area of
    memory.  You must pass NULL as the last argument of this function,
@@ -170,7 +170,7 @@
    to terminate the list of strings.  The supplied memory is assumed
    to be large enough.  */
 
-extern char *concat_copy2 (const char *, ...) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_SENTINEL;
+extern char *concat_copy2 (const char *, ...)  ATTRIBUTE_SENTINEL;
 
 /* This is the global area used by concat_copy2.  */
 
@@ -229,11 +229,11 @@
 /* Returns a pointer to a directory path suitable for creating temporary
    files in.  */
 
-extern const char *choose_tmpdir (void) ATTRIBUTE_RETURNS_NONNULL;
+extern const char *choose_tmpdir (void) ;
 
 /* Choose a temporary directory to use for scratch files.  */
 
-extern char *choose_temp_base (void) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL;
+extern char *choose_temp_base (void) ATTRIBUTE_MALLOC ;
 
 /* Return a temporary file name or NULL if unable to create one.  */
 
@@ -263,7 +263,7 @@
 
 /* ANSI's strerror(), but more robust.  */
 
-extern char *xstrerror (int) ATTRIBUTE_RETURNS_NONNULL;
+extern char *xstrerror (int) ;
 
 /* Return the maximum signal number for which strsignal will return a
    string.  */
@@ -305,30 +305,30 @@
    message to stderr (using the name set by xmalloc_set_program_name,
    if any) and then call xexit.  */
 
-extern void *xmalloc (size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL;
+extern void *xmalloc (size_t) ATTRIBUTE_MALLOC ;
 
 /* Reallocate memory without fail.  This works like xmalloc.  Note,
    realloc type functions are not suitable for attribute malloc since
    they may return the same address across multiple calls. */
 
-extern void *xrealloc (void *, size_t) ATTRIBUTE_RETURNS_NONNULL;
+extern void *xrealloc (void *, size_t) ;
 
 /* Allocate memory without fail and set it to zero.  This works like
    xmalloc.  */
 
-extern void *xcalloc (size_t, size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL;
+extern void *xcalloc (size_t, size_t) ATTRIBUTE_MALLOC ;
 
 /* Copy a string into a memory buffer without fail.  */
 
-extern char *xstrdup (const char *) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL;
+extern char *xstrdup (const char *) ATTRIBUTE_MALLOC ;
 
 /* Copy at most N characters from string into a buffer without fail.  */
 
-extern char *xstrndup (const char *, size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL;
+extern char *xstrndup (const char *, size_t) ATTRIBUTE_MALLOC ;
 
 /* Copy an existing memory buffer to a new memory buffer without fail.  */
 
-extern void *xmemdup (const void *, size_t, size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL;
+extern void *xmemdup (const void *, size_t, size_t) ATTRIBUTE_MALLOC ;
 
 /* Physical memory routines.  Return values are in BYTES.  */
 extern double physmem_total (void);
@@ -406,7 +406,7 @@
    Returns NULL on error.  */
 
 extern struct pex_obj *pex_init (int flags, const char *pname,
-				 const char *tempbase) ATTRIBUTE_RETURNS_NONNULL;
+				 const char *tempbase) ;
 
 /* Flags for pex_run.  These are bits to be or'ed together.  */
 
diff -ruw gcc-6.5.0/intl/configure gcc-6.5.0-irix/intl/configure
--- gcc-6.5.0/intl/configure	Fri Aug  7 01:13:52 2015
+++ gcc-6.5.0-irix/intl/configure	Sat Jun 12 22:27:10 2021
@@ -3286,13 +3286,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
diff -ruw gcc-6.5.0/isl/isl_schedule_tree.c gcc-6.5.0-irix/isl/isl_schedule_tree.c
--- gcc-6.5.0/isl/isl_schedule_tree.c	Thu Dec 15 06:27:30 2016
+++ gcc-6.5.0-irix/isl/isl_schedule_tree.c	Sun Dec 22 11:54:48 2024
@@ -84,45 +84,45 @@
 			"allocation should have failed",
 			isl_schedule_tree_free(dup));
 	case isl_schedule_node_band:
-		dup->band = isl_schedule_band_copy(tree->band);
-		if (!dup->band)
+		dup->anonunion.band = isl_schedule_band_copy(tree->anonunion.band);
+		if (!dup->anonunion.band)
 			return isl_schedule_tree_free(dup);
 		break;
 	case isl_schedule_node_context:
-		dup->context = isl_set_copy(tree->context);
-		if (!dup->context)
+		dup->anonunion.context = isl_set_copy(tree->anonunion.context);
+		if (!dup->anonunion.context)
 			return isl_schedule_tree_free(dup);
 		break;
 	case isl_schedule_node_domain:
-		dup->domain = isl_union_set_copy(tree->domain);
-		if (!dup->domain)
+		dup->anonunion.domain = isl_union_set_copy(tree->anonunion.domain);
+		if (!dup->anonunion.domain)
 			return isl_schedule_tree_free(dup);
 		break;
 	case isl_schedule_node_expansion:
-		dup->contraction =
-			isl_union_pw_multi_aff_copy(tree->contraction);
-		dup->expansion = isl_union_map_copy(tree->expansion);
-		if (!dup->contraction || !dup->expansion)
+		dup->anonunion.anonstruct.contraction =
+			isl_union_pw_multi_aff_copy(tree->anonunion.anonstruct.contraction);
+		dup->anonunion.anonstruct.expansion = isl_union_map_copy(tree->anonunion.anonstruct.expansion);
+		if (!dup->anonunion.anonstruct.contraction || !dup->anonunion.anonstruct.expansion)
 			return isl_schedule_tree_free(dup);
 		break;
 	case isl_schedule_node_extension:
-		dup->extension = isl_union_map_copy(tree->extension);
-		if (!dup->extension)
+		dup->anonunion.extension = isl_union_map_copy(tree->anonunion.extension);
+		if (!dup->anonunion.extension)
 			return isl_schedule_tree_free(dup);
 		break;
 	case isl_schedule_node_filter:
-		dup->filter = isl_union_set_copy(tree->filter);
-		if (!dup->filter)
+		dup->anonunion.filter = isl_union_set_copy(tree->anonunion.filter);
+		if (!dup->anonunion.filter)
 			return isl_schedule_tree_free(dup);
 		break;
 	case isl_schedule_node_guard:
-		dup->guard = isl_set_copy(tree->guard);
-		if (!dup->guard)
+		dup->anonunion.guard = isl_set_copy(tree->anonunion.guard);
+		if (!dup->anonunion.guard)
 			return isl_schedule_tree_free(dup);
 		break;
 	case isl_schedule_node_mark:
-		dup->mark = isl_id_copy(tree->mark);
-		if (!dup->mark)
+		dup->anonunion.mark = isl_id_copy(tree->anonunion.mark);
+		if (!dup->anonunion.mark)
 			return isl_schedule_tree_free(dup);
 		break;
 	case isl_schedule_node_leaf:
@@ -180,29 +180,29 @@
 
 	switch (tree->type) {
 	case isl_schedule_node_band:
-		isl_schedule_band_free(tree->band);
+		isl_schedule_band_free(tree->anonunion.band);
 		break;
 	case isl_schedule_node_context:
-		isl_set_free(tree->context);
+		isl_set_free(tree->anonunion.context);
 		break;
 	case isl_schedule_node_domain:
-		isl_union_set_free(tree->domain);
+		isl_union_set_free(tree->anonunion.domain);
 		break;
 	case isl_schedule_node_expansion:
-		isl_union_pw_multi_aff_free(tree->contraction);
-		isl_union_map_free(tree->expansion);
+		isl_union_pw_multi_aff_free(tree->anonunion.anonstruct.contraction);
+		isl_union_map_free(tree->anonunion.anonstruct.expansion);
 		break;
 	case isl_schedule_node_extension:
-		isl_union_map_free(tree->extension);
+		isl_union_map_free(tree->anonunion.extension);
 		break;
 	case isl_schedule_node_filter:
-		isl_union_set_free(tree->filter);
+		isl_union_set_free(tree->anonunion.filter);
 		break;
 	case isl_schedule_node_guard:
-		isl_set_free(tree->guard);
+		isl_set_free(tree->anonunion.guard);
 		break;
 	case isl_schedule_node_mark:
-		isl_id_free(tree->mark);
+		isl_id_free(tree->anonunion.mark);
 		break;
 	case isl_schedule_node_sequence:
 	case isl_schedule_node_set:
@@ -241,7 +241,7 @@
 	if (!tree)
 		goto error;
 
-	tree->band = band;
+	tree->anonunion.band = band;
 	tree->anchored = isl_schedule_band_is_anchored(band);
 
 	return tree;
@@ -268,7 +268,7 @@
 	if (!tree)
 		goto error;
 
-	tree->context = context;
+	tree->anonunion.context = context;
 	tree->anchored = 1;
 
 	return tree;
@@ -293,7 +293,7 @@
 	if (!tree)
 		goto error;
 
-	tree->domain = domain;
+	tree->anonunion.domain = domain;
 
 	return tree;
 error:
@@ -319,8 +319,8 @@
 	if (!tree)
 		goto error;
 
-	tree->contraction = contraction;
-	tree->expansion = expansion;
+	tree->anonunion.anonstruct.contraction = contraction;
+	tree->anonunion.anonstruct.expansion = expansion;
 
 	return tree;
 error:
@@ -348,7 +348,7 @@
 	if (!tree)
 		goto error;
 
-	tree->extension = extension;
+	tree->anonunion.extension = extension;
 	tree->anchored = 1;
 
 	return tree;
@@ -373,7 +373,7 @@
 	if (!tree)
 		goto error;
 
-	tree->filter = filter;
+	tree->anonunion.filter = filter;
 
 	return tree;
 error:
@@ -399,7 +399,7 @@
 	if (!tree)
 		goto error;
 
-	tree->guard = guard;
+	tree->anonunion.guard = guard;
 	tree->anchored = 1;
 
 	return tree;
@@ -425,7 +425,7 @@
 	if (!tree)
 		goto error;
 
-	tree->mark = mark;
+	tree->anonunion.mark = mark;
 
 	return tree;
 error:
@@ -456,7 +456,7 @@
 	case isl_schedule_node_error:
 		return -1;
 	case isl_schedule_node_band:
-		return isl_schedule_band_is_anchored(tree->band);
+		return isl_schedule_band_is_anchored(tree->anonunion.band);
 	case isl_schedule_node_context:
 	case isl_schedule_node_extension:
 	case isl_schedule_node_guard:
@@ -639,34 +639,34 @@
 
 	switch (tree1->type) {
 	case isl_schedule_node_band:
-		equal = isl_schedule_band_plain_is_equal(tree1->band,
-							tree2->band);
+		equal = isl_schedule_band_plain_is_equal(tree1->anonunion.band,
+							tree2->anonunion.band);
 		break;
 	case isl_schedule_node_context:
-		equal = isl_set_is_equal(tree1->context, tree2->context);
+		equal = isl_set_is_equal(tree1->anonunion.context, tree2->anonunion.context);
 		break;
 	case isl_schedule_node_domain:
-		equal = isl_union_set_is_equal(tree1->domain, tree2->domain);
+		equal = isl_union_set_is_equal(tree1->anonunion.domain, tree2->anonunion.domain);
 		break;
 	case isl_schedule_node_expansion:
-		equal = isl_union_map_is_equal(tree1->expansion,
-						tree2->expansion);
+		equal = isl_union_map_is_equal(tree1->anonunion.anonstruct.expansion,
+						tree2->anonunion.anonstruct.expansion);
 		if (equal >= 0 && equal)
 			equal = isl_union_pw_multi_aff_plain_is_equal(
-				    tree1->contraction, tree2->contraction);
+				    tree1->anonunion.anonstruct.contraction, tree2->anonunion.anonstruct.contraction);
 		break;
 	case isl_schedule_node_extension:
-		equal = isl_union_map_is_equal(tree1->extension,
-						tree2->extension);
+		equal = isl_union_map_is_equal(tree1->anonunion.extension,
+						tree2->anonunion.extension);
 		break;
 	case isl_schedule_node_filter:
-		equal = isl_union_set_is_equal(tree1->filter, tree2->filter);
+		equal = isl_union_set_is_equal(tree1->anonunion.filter, tree2->anonunion.filter);
 		break;
 	case isl_schedule_node_guard:
-		equal = isl_set_is_equal(tree1->guard, tree2->guard);
+		equal = isl_set_is_equal(tree1->anonunion.guard, tree2->anonunion.guard);
 		break;
 	case isl_schedule_node_mark:
-		equal = tree1->mark == tree2->mark;
+		equal = tree1->anonunion.mark == tree2->anonunion.mark;
 		break;
 	case isl_schedule_node_leaf:
 	case isl_schedule_node_sequence:
@@ -1002,7 +1002,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return 0);
 
-	return isl_schedule_band_n_member(tree->band);
+	return isl_schedule_band_n_member(tree->anonunion.band);
 }
 
 /* Is the band member at position "pos" of the band tree root
@@ -1018,7 +1018,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return isl_bool_error);
 
-	return isl_schedule_band_member_get_coincident(tree->band, pos);
+	return isl_schedule_band_member_get_coincident(tree->anonunion.band, pos);
 }
 
 /* Mark the given band member as being coincident or not
@@ -1039,9 +1039,9 @@
 	if (!tree)
 		return NULL;
 
-	tree->band = isl_schedule_band_member_set_coincident(tree->band, pos,
+	tree->anonunion.band = isl_schedule_band_member_set_coincident(tree->anonunion.band, pos,
 							coincident);
-	if (!tree->band)
+	if (!tree->anonunion.band)
 		return isl_schedule_tree_free(tree);
 	return tree;
 }
@@ -1058,7 +1058,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return isl_bool_error);
 
-	return isl_schedule_band_get_permutable(tree->band);
+	return isl_schedule_band_get_permutable(tree->anonunion.band);
 }
 
 /* Mark the band tree root permutable or not according to "permutable"?
@@ -1077,8 +1077,8 @@
 	if (!tree)
 		return NULL;
 
-	tree->band = isl_schedule_band_set_permutable(tree->band, permutable);
-	if (!tree->band)
+	tree->anonunion.band = isl_schedule_band_set_permutable(tree->anonunion.band, permutable);
+	if (!tree->anonunion.band)
 		return isl_schedule_tree_free(tree);
 	return tree;
 }
@@ -1095,7 +1095,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return NULL);
 
-	return isl_schedule_band_get_space(tree->band);
+	return isl_schedule_band_get_space(tree->anonunion.band);
 }
 
 /* Intersect the domain of the band schedule of the band tree root
@@ -1111,8 +1111,8 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", goto error);
 
-	tree->band = isl_schedule_band_intersect_domain(tree->band, domain);
-	if (!tree->band)
+	tree->anonunion.band = isl_schedule_band_intersect_domain(tree->anonunion.band, domain);
+	if (!tree->anonunion.band)
 		return isl_schedule_tree_free(tree);
 
 	return tree;
@@ -1134,7 +1134,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return NULL);
 
-	return isl_schedule_band_get_partial_schedule(tree->band);
+	return isl_schedule_band_get_partial_schedule(tree->anonunion.band);
 }
 
 /* Replace the schedule of the band tree root by "schedule".
@@ -1150,7 +1150,7 @@
 	if (tree->type != isl_schedule_node_band)
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return NULL);
-	tree->band = isl_schedule_band_set_partial_schedule(tree->band,
+	tree->anonunion.band = isl_schedule_band_set_partial_schedule(tree->anonunion.band,
 								schedule);
 
 	return tree;
@@ -1173,7 +1173,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return isl_ast_loop_error);
 
-	return isl_schedule_band_member_get_ast_loop_type(tree->band, pos);
+	return isl_schedule_band_member_get_ast_loop_type(tree->anonunion.band, pos);
 }
 
 /* Set the loop AST generation type for the band member of the band tree root
@@ -1191,9 +1191,9 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return isl_schedule_tree_free(tree));
 
-	tree->band = isl_schedule_band_member_set_ast_loop_type(tree->band,
+	tree->anonunion.band = isl_schedule_band_member_set_ast_loop_type(tree->anonunion.band,
 								pos, type);
-	if (!tree->band)
+	if (!tree->anonunion.band)
 		return isl_schedule_tree_free(tree);
 
 	return tree;
@@ -1212,7 +1212,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return isl_ast_loop_error);
 
-	return isl_schedule_band_member_get_isolate_ast_loop_type(tree->band,
+	return isl_schedule_band_member_get_isolate_ast_loop_type(tree->anonunion.band,
 									pos);
 }
 
@@ -1232,9 +1232,9 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return isl_schedule_tree_free(tree));
 
-	tree->band = isl_schedule_band_member_set_isolate_ast_loop_type(
-							tree->band, pos, type);
-	if (!tree->band)
+	tree->anonunion.band = isl_schedule_band_member_set_isolate_ast_loop_type(
+							tree->anonunion.band, pos, type);
+	if (!tree->anonunion.band)
 		return isl_schedule_tree_free(tree);
 
 	return tree;
@@ -1252,7 +1252,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return NULL);
 
-	return isl_schedule_band_get_ast_build_options(tree->band);
+	return isl_schedule_band_get_ast_build_options(tree->anonunion.band);
 }
 
 /* Replace the AST build options associated to band tree root by "options".
@@ -1273,9 +1273,9 @@
 			"not a band node", goto error);
 
 	was_anchored = isl_schedule_tree_is_anchored(tree);
-	tree->band = isl_schedule_band_set_ast_build_options(tree->band,
+	tree->anonunion.band = isl_schedule_band_set_ast_build_options(tree->anonunion.band,
 								options);
-	if (!tree->band)
+	if (!tree->anonunion.band)
 		return isl_schedule_tree_free(tree);
 	if (isl_schedule_tree_is_anchored(tree) != was_anchored)
 		tree = isl_schedule_tree_update_anchored(tree);
@@ -1300,7 +1300,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return NULL);
 
-	return isl_schedule_band_get_ast_isolate_option(tree->band, depth);
+	return isl_schedule_band_get_ast_isolate_option(tree->anonunion.band, depth);
 }
 
 /* Return the context of the context tree root.
@@ -1315,7 +1315,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a context node", return NULL);
 
-	return isl_set_copy(tree->context);
+	return isl_set_copy(tree->anonunion.context);
 }
 
 /* Return the domain of the domain tree root.
@@ -1330,7 +1330,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a domain node", return NULL);
 
-	return isl_union_set_copy(tree->domain);
+	return isl_union_set_copy(tree->anonunion.domain);
 }
 
 /* Replace the domain of domain tree root "tree" by "domain".
@@ -1346,8 +1346,8 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a domain node", goto error);
 
-	isl_union_set_free(tree->domain);
-	tree->domain = domain;
+	isl_union_set_free(tree->anonunion.domain);
+	tree->anonunion.domain = domain;
 
 	return tree;
 error:
@@ -1368,7 +1368,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not an expansion node", return NULL);
 
-	return isl_union_pw_multi_aff_copy(tree->contraction);
+	return isl_union_pw_multi_aff_copy(tree->anonunion.anonstruct.contraction);
 }
 
 /* Return the expansion of the expansion tree root.
@@ -1383,7 +1383,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not an expansion node", return NULL);
 
-	return isl_union_map_copy(tree->expansion);
+	return isl_union_map_copy(tree->anonunion.anonstruct.expansion);
 }
 
 /* Replace the contraction and the expansion of the expansion tree root "tree"
@@ -1403,10 +1403,10 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not an expansion node", return NULL);
 
-	isl_union_pw_multi_aff_free(tree->contraction);
-	tree->contraction = contraction;
-	isl_union_map_free(tree->expansion);
-	tree->expansion = expansion;
+	isl_union_pw_multi_aff_free(tree->anonunion.anonstruct.contraction);
+	tree->anonunion.anonstruct.contraction = contraction;
+	isl_union_map_free(tree->anonunion.anonstruct.expansion);
+	tree->anonunion.anonstruct.expansion = expansion;
 
 	return tree;
 error:
@@ -1428,7 +1428,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not an extension node", return NULL);
 
-	return isl_union_map_copy(tree->extension);
+	return isl_union_map_copy(tree->anonunion.extension);
 }
 
 /* Replace the extension of extension tree root "tree" by "extension".
@@ -1443,8 +1443,8 @@
 	if (tree->type != isl_schedule_node_extension)
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not an extension node", return NULL);
-	isl_union_map_free(tree->extension);
-	tree->extension = extension;
+	isl_union_map_free(tree->anonunion.extension);
+	tree->anonunion.extension = extension;
 
 	return tree;
 error:
@@ -1465,7 +1465,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a filter node", return NULL);
 
-	return isl_union_set_copy(tree->filter);
+	return isl_union_set_copy(tree->anonunion.filter);
 }
 
 /* Replace the filter of the filter tree root by "filter".
@@ -1481,8 +1481,8 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a filter node", return NULL);
 
-	isl_union_set_free(tree->filter);
-	tree->filter = filter;
+	isl_union_set_free(tree->anonunion.filter);
+	tree->anonunion.filter = filter;
 
 	return tree;
 error:
@@ -1503,7 +1503,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a guard node", return NULL);
 
-	return isl_set_copy(tree->guard);
+	return isl_set_copy(tree->anonunion.guard);
 }
 
 /* Return the mark identifier of the mark tree root "tree".
@@ -1518,7 +1518,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a mark node", return NULL);
 
-	return isl_id_copy(tree->mark);
+	return isl_id_copy(tree->anonunion.mark);
 }
 
 /* Set dim to the range dimension of "map" and abort the search.
@@ -1828,7 +1828,7 @@
 	case isl_schedule_node_band:
 		if (isl_schedule_tree_band_n_member(tree) == 0)
 			return subtree_schedule_extend_child(tree, outer);
-		mupa = isl_schedule_band_get_partial_schedule(tree->band);
+		mupa = isl_schedule_band_get_partial_schedule(tree->anonunion.band);
 		umap = isl_union_map_from_multi_union_pw_aff(mupa);
 		outer = isl_union_map_flat_range_product(outer, umap);
 		umap = subtree_schedule_extend_child(tree, outer);
@@ -1940,7 +1940,7 @@
 				isl_error_internal,
 				"0D band should be handled by caller",
 				return NULL);
-		mupa = isl_schedule_band_get_partial_schedule(tree->band);
+		mupa = isl_schedule_band_get_partial_schedule(tree->anonunion.band);
 		domain = isl_multi_union_pw_aff_domain(mupa);
 		domain = isl_union_set_universe(domain);
 		break;
@@ -2008,8 +2008,8 @@
 	if (!tree)
 		goto error;
 
-	tree->band = isl_schedule_band_scale(tree->band, mv);
-	if (!tree->band)
+	tree->anonunion.band = isl_schedule_band_scale(tree->anonunion.band, mv);
+	if (!tree->anonunion.band)
 		return isl_schedule_tree_free(tree);
 
 	return tree;
@@ -2035,8 +2035,8 @@
 	if (!tree)
 		goto error;
 
-	tree->band = isl_schedule_band_scale_down(tree->band, mv);
-	if (!tree->band)
+	tree->anonunion.band = isl_schedule_band_scale_down(tree->anonunion.band, mv);
+	if (!tree->anonunion.band)
 		return isl_schedule_tree_free(tree);
 
 	return tree;
@@ -2062,8 +2062,8 @@
 	if (!tree)
 		goto error;
 
-	tree->band = isl_schedule_band_mod(tree->band, mv);
-	if (!tree->band)
+	tree->anonunion.band = isl_schedule_band_mod(tree->anonunion.band, mv);
+	if (!tree->anonunion.band)
 		return isl_schedule_tree_free(tree);
 
 	return tree;
@@ -2089,8 +2089,8 @@
 	if (!tree)
 		goto error;
 
-	tree->band = isl_schedule_band_shift(tree->band, shift);
-	if (!tree->band)
+	tree->anonunion.band = isl_schedule_band_shift(tree->anonunion.band, shift);
+	if (!tree->anonunion.band)
 		return isl_schedule_tree_free(tree);
 
 	return tree;
@@ -2165,12 +2165,12 @@
 	if (!tree || !child)
 		goto error;
 
-	tree->band = isl_schedule_band_tile(tree->band,
+	tree->anonunion.band = isl_schedule_band_tile(tree->anonunion.band,
 					    isl_multi_val_copy(sizes));
-	if (!tree->band)
+	if (!tree->anonunion.band)
 		goto error;
-	child->band = isl_schedule_band_point(child->band, tree->band, sizes);
-	if (!child->band)
+	child->anonunion.band = isl_schedule_band_point(child->anonunion.band, tree->anonunion.band, sizes);
+	if (!child->anonunion.band)
 		child = isl_schedule_tree_free(child);
 
 	tree = isl_schedule_tree_replace_child(tree, 0, child);
@@ -2295,14 +2295,14 @@
 	isolate = isl_schedule_tree_band_get_ast_isolate_option(tree, depth);
 	tree_isolate = isolate_initial(isolate, pos, n - pos);
 	child_isolate = isolate_final(isolate, pos, n - pos);
-	child->band = isl_schedule_band_drop(child->band, 0, pos);
-	child->band = isl_schedule_band_replace_ast_build_option(child->band,
+	child->anonunion.band = isl_schedule_band_drop(child->anonunion.band, 0, pos);
+	child->anonunion.band = isl_schedule_band_replace_ast_build_option(child->anonunion.band,
 					isl_set_copy(isolate), child_isolate);
-	tree->band = isl_schedule_band_drop(tree->band, pos, n - pos);
-	tree->band = isl_schedule_band_replace_ast_build_option(tree->band,
+	tree->anonunion.band = isl_schedule_band_drop(tree->anonunion.band, pos, n - pos);
+	tree->anonunion.band = isl_schedule_band_replace_ast_build_option(tree->anonunion.band,
 					isl_set_copy(isolate), tree_isolate);
 	isl_set_free(isolate);
-	if (!child->band || !tree->band)
+	if (!child->anonunion.band || !tree->anonunion.band)
 		goto error;
 
 	tree = isl_schedule_tree_replace_child(tree, 0, child);
@@ -2369,40 +2369,40 @@
 	case isl_schedule_node_error:
 		return isl_schedule_tree_free(tree);
 	case isl_schedule_node_band:
-		tree->band = isl_schedule_band_reset_user(tree->band);
-		if (!tree->band)
+		tree->anonunion.band = isl_schedule_band_reset_user(tree->anonunion.band);
+		if (!tree->anonunion.band)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_context:
-		tree->context = isl_set_reset_user(tree->context);
-		if (!tree->context)
+		tree->anonunion.context = isl_set_reset_user(tree->anonunion.context);
+		if (!tree->anonunion.context)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_domain:
-		tree->domain = isl_union_set_reset_user(tree->domain);
-		if (!tree->domain)
+		tree->anonunion.domain = isl_union_set_reset_user(tree->anonunion.domain);
+		if (!tree->anonunion.domain)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_expansion:
-		tree->contraction =
-			isl_union_pw_multi_aff_reset_user(tree->contraction);
-		tree->expansion = isl_union_map_reset_user(tree->expansion);
-		if (!tree->contraction || !tree->expansion)
+		tree->anonunion.anonstruct.contraction =
+			isl_union_pw_multi_aff_reset_user(tree->anonunion.anonstruct.contraction);
+		tree->anonunion.anonstruct.expansion = isl_union_map_reset_user(tree->anonunion.anonstruct.expansion);
+		if (!tree->anonunion.anonstruct.contraction || !tree->anonunion.anonstruct.expansion)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_extension:
-		tree->extension = isl_union_map_reset_user(tree->extension);
-		if (!tree->extension)
+		tree->anonunion.extension = isl_union_map_reset_user(tree->anonunion.extension);
+		if (!tree->anonunion.extension)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_filter:
-		tree->filter = isl_union_set_reset_user(tree->filter);
-		if (!tree->filter)
+		tree->anonunion.filter = isl_union_set_reset_user(tree->anonunion.filter);
+		if (!tree->anonunion.filter)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_guard:
-		tree->guard = isl_set_reset_user(tree->guard);
-		if (!tree->guard)
+		tree->anonunion.guard = isl_set_reset_user(tree->anonunion.guard);
+		if (!tree->anonunion.guard)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_leaf:
@@ -2436,43 +2436,43 @@
 	case isl_schedule_node_error:
 		goto error;
 	case isl_schedule_node_band:
-		tree->band = isl_schedule_band_align_params(tree->band, space);
-		if (!tree->band)
+		tree->anonunion.band = isl_schedule_band_align_params(tree->anonunion.band, space);
+		if (!tree->anonunion.band)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_context:
-		tree->context = isl_set_align_params(tree->context, space);
-		if (!tree->context)
+		tree->anonunion.context = isl_set_align_params(tree->anonunion.context, space);
+		if (!tree->anonunion.context)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_domain:
-		tree->domain = isl_union_set_align_params(tree->domain, space);
-		if (!tree->domain)
+		tree->anonunion.domain = isl_union_set_align_params(tree->anonunion.domain, space);
+		if (!tree->anonunion.domain)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_expansion:
-		tree->contraction =
-			isl_union_pw_multi_aff_align_params(tree->contraction,
+		tree->anonunion.anonstruct.contraction =
+			isl_union_pw_multi_aff_align_params(tree->anonunion.anonstruct.contraction,
 							isl_space_copy(space));
-		tree->expansion = isl_union_map_align_params(tree->expansion,
+		tree->anonunion.anonstruct.expansion = isl_union_map_align_params(tree->anonunion.anonstruct.expansion,
 								space);
-		if (!tree->contraction || !tree->expansion)
+		if (!tree->anonunion.anonstruct.contraction || !tree->anonunion.anonstruct.expansion)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_extension:
-		tree->extension = isl_union_map_align_params(tree->extension,
+		tree->anonunion.extension = isl_union_map_align_params(tree->anonunion.extension,
 								space);
-		if (!tree->extension)
+		if (!tree->anonunion.extension)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_filter:
-		tree->filter = isl_union_set_align_params(tree->filter, space);
-		if (!tree->filter)
+		tree->anonunion.filter = isl_union_set_align_params(tree->anonunion.filter, space);
+		if (!tree->anonunion.filter)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_guard:
-		tree->guard = isl_set_align_params(tree->guard, space);
-		if (!tree->guard)
+		tree->anonunion.guard = isl_set_align_params(tree->anonunion.guard, space);
+		if (!tree->anonunion.guard)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_leaf:
@@ -2552,30 +2552,30 @@
 		goto error;
 
 	if (tree->type == isl_schedule_node_band) {
-		tree->band = isl_schedule_band_pullback_union_pw_multi_aff(
-							    tree->band, upma);
-		if (!tree->band)
+		tree->anonunion.band = isl_schedule_band_pullback_union_pw_multi_aff(
+							    tree->anonunion.band, upma);
+		if (!tree->anonunion.band)
 			return isl_schedule_tree_free(tree);
 	} else if (tree->type == isl_schedule_node_domain) {
-		tree->domain =
-			isl_union_set_preimage_union_pw_multi_aff(tree->domain,
+		tree->anonunion.domain =
+			isl_union_set_preimage_union_pw_multi_aff(tree->anonunion.domain,
 									upma);
-		if (!tree->domain)
+		if (!tree->anonunion.domain)
 			return isl_schedule_tree_free(tree);
 	} else if (tree->type == isl_schedule_node_expansion) {
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_unsupported,
 			"cannot pullback expansion node", goto error);
 	} else if (tree->type == isl_schedule_node_extension) {
-		tree->extension =
+		tree->anonunion.extension =
 			isl_union_map_preimage_range_union_pw_multi_aff(
-			    tree->extension, upma);
-		if (!tree->extension)
+			    tree->anonunion.extension, upma);
+		if (!tree->anonunion.extension)
 			return isl_schedule_tree_free(tree);
 	} else if (tree->type == isl_schedule_node_filter) {
-		tree->filter =
-			isl_union_set_preimage_union_pw_multi_aff(tree->filter,
+		tree->anonunion.filter =
+			isl_union_set_preimage_union_pw_multi_aff(tree->anonunion.filter,
 									upma);
-		if (!tree->filter)
+		if (!tree->anonunion.filter)
 			return isl_schedule_tree_free(tree);
 	}
 
@@ -2600,8 +2600,8 @@
 	if (!tree)
 		goto error;
 
-	tree->band = isl_schedule_band_gist(tree->band, context);
-	if (!tree->band)
+	tree->anonunion.band = isl_schedule_band_gist(tree->anonunion.band, context);
+	if (!tree->anonunion.band)
 		return isl_schedule_tree_free(tree);
 	return tree;
 error:
@@ -2729,7 +2729,7 @@
 		p = isl_printer_print_str(p, "context");
 		p = isl_printer_yaml_next(p);
 		p = isl_printer_print_str(p, "\"");
-		p = isl_printer_print_set(p, tree->context);
+		p = isl_printer_print_set(p, tree->anonunion.context);
 		p = isl_printer_print_str(p, "\"");
 		break;
 	case isl_schedule_node_domain:
@@ -2736,7 +2736,7 @@
 		p = isl_printer_print_str(p, "domain");
 		p = isl_printer_yaml_next(p);
 		p = isl_printer_print_str(p, "\"");
-		p = isl_printer_print_union_set(p, tree->domain);
+		p = isl_printer_print_union_set(p, tree->anonunion.domain);
 		p = isl_printer_print_str(p, "\"");
 		break;
 	case isl_schedule_node_expansion:
@@ -2743,13 +2743,13 @@
 		p = isl_printer_print_str(p, "contraction");
 		p = isl_printer_yaml_next(p);
 		p = isl_printer_print_str(p, "\"");
-		p = isl_printer_print_union_pw_multi_aff(p, tree->contraction);
+		p = isl_printer_print_union_pw_multi_aff(p, tree->anonunion.anonstruct.contraction);
 		p = isl_printer_print_str(p, "\"");
 		p = isl_printer_yaml_next(p);
 		p = isl_printer_print_str(p, "expansion");
 		p = isl_printer_yaml_next(p);
 		p = isl_printer_print_str(p, "\"");
-		p = isl_printer_print_union_map(p, tree->expansion);
+		p = isl_printer_print_union_map(p, tree->anonunion.anonstruct.expansion);
 		p = isl_printer_print_str(p, "\"");
 		break;
 	case isl_schedule_node_extension:
@@ -2756,7 +2756,7 @@
 		p = isl_printer_print_str(p, "extension");
 		p = isl_printer_yaml_next(p);
 		p = isl_printer_print_str(p, "\"");
-		p = isl_printer_print_union_map(p, tree->extension);
+		p = isl_printer_print_union_map(p, tree->anonunion.extension);
 		p = isl_printer_print_str(p, "\"");
 		break;
 	case isl_schedule_node_filter:
@@ -2763,7 +2763,7 @@
 		p = isl_printer_print_str(p, "filter");
 		p = isl_printer_yaml_next(p);
 		p = isl_printer_print_str(p, "\"");
-		p = isl_printer_print_union_set(p, tree->filter);
+		p = isl_printer_print_union_set(p, tree->anonunion.filter);
 		p = isl_printer_print_str(p, "\"");
 		break;
 	case isl_schedule_node_guard:
@@ -2770,7 +2770,7 @@
 		p = isl_printer_print_str(p, "guard");
 		p = isl_printer_yaml_next(p);
 		p = isl_printer_print_str(p, "\"");
-		p = isl_printer_print_set(p, tree->guard);
+		p = isl_printer_print_set(p, tree->anonunion.guard);
 		p = isl_printer_print_str(p, "\"");
 		break;
 	case isl_schedule_node_mark:
@@ -2777,11 +2777,11 @@
 		p = isl_printer_print_str(p, "mark");
 		p = isl_printer_yaml_next(p);
 		p = isl_printer_print_str(p, "\"");
-		p = isl_printer_print_str(p, isl_id_get_name(tree->mark));
+		p = isl_printer_print_str(p, isl_id_get_name(tree->anonunion.mark));
 		p = isl_printer_print_str(p, "\"");
 		break;
 	case isl_schedule_node_band:
-		p = print_tree_band(p, tree->band);
+		p = print_tree_band(p, tree->anonunion.band);
 		break;
 	}
 	p = isl_printer_yaml_next(p);
Only in gcc-6.5.0-irix/isl: isl_schedule_tree.c.orig
Only in gcc-6.5.0-irix/isl: isl_schedule_tree.c.rej
diff -ruw gcc-6.5.0/isl/isl_schedule_tree.h gcc-6.5.0-irix/isl/isl_schedule_tree.h
--- gcc-6.5.0/isl/isl_schedule_tree.h	Mon Dec 12 04:15:44 2016
+++ gcc-6.5.0-irix/isl/isl_schedule_tree.h	Sun Dec 22 11:54:48 2024
@@ -63,12 +63,12 @@
 		struct {
 			isl_union_pw_multi_aff *contraction;
 			isl_union_map *expansion;
-		};
+		} anonstruct;
 		isl_union_map *extension;
 		isl_union_set *filter;
 		isl_set *guard;
 		isl_id *mark;
-	};
+	} anonunion;
 	isl_schedule_tree_list *children;
 };
 
Only in gcc-6.5.0-irix/isl: isl_schedule_tree.h.orig
Only in gcc-6.5.0-irix/isl: isl_schedule_tree.h.rej
diff -ruw gcc-6.5.0/isl/isl_test.c gcc-6.5.0-irix/isl/isl_test.c
--- gcc-6.5.0/isl/isl_test.c	Thu Dec 15 06:27:30 2016
+++ gcc-6.5.0-irix/isl/isl_test.c	Sun Dec 22 11:54:48 2024
@@ -493,19 +493,23 @@
 	return 0;
 }
 
-struct {
+struct vbo {
 	__isl_give isl_val *(*fn)(__isl_take isl_val *v1,
 				__isl_take isl_val *v2);
-} val_bin_op[] = {
-	['+'] = { &isl_val_add },
-	['-'] = { &isl_val_sub },
-	['*'] = { &isl_val_mul },
-	['/'] = { &isl_val_div },
-	['g'] = { &isl_val_gcd },
-	['m'] = { &isl_val_min },
-	['M'] = { &isl_val_max },
-};
+} vbo;
+struct vbo val_bin_op[256];
 
+void setup_val_bin_ops()
+{
+  val_bin_op['+'].fn=&isl_val_add;
+  val_bin_op['-'].fn=&isl_val_sub;
+  val_bin_op['*'].fn=&isl_val_mul;
+  val_bin_op['/'].fn=&isl_val_div;
+  val_bin_op['g'].fn=&isl_val_gcd;
+  val_bin_op['m'].fn=&isl_val_min;
+  val_bin_op['M'].fn=&isl_val_max;
+}
+
 struct {
 	const char *arg1;
 	unsigned char op;
@@ -4344,14 +4348,18 @@
 	return 0;
 }
 
-struct {
+struct abo {
 	__isl_give isl_aff *(*fn)(__isl_take isl_aff *aff1,
 				__isl_take isl_aff *aff2);
-} aff_bin_op[] = {
-	['+'] = { &isl_aff_add },
-	['-'] = { &isl_aff_sub },
-	['*'] = { &isl_aff_mul },
-	['/'] = { &isl_aff_div },
+} abo;
+struct abo aff_bin_op[256];
+
+void setup_aff_bin_ops()
+{
+  aff_bin_op['+'].fn=&isl_aff_add;
+  aff_bin_op['-'].fn=&isl_aff_sub;
+  aff_bin_op['*'].fn=&isl_aff_mul;
+  aff_bin_op['/'].fn=&isl_aff_div;
 };
 
 struct {
@@ -6943,6 +6951,9 @@
 	struct isl_ctx *ctx;
 	struct isl_options *options;
 
+	setup_val_bin_ops();
+	setup_aff_bin_ops();
+
 	options = isl_options_new_with_defaults();
 	assert(options);
 	argc = isl_options_parse(options, argc, argv, ISL_ARG_ALL);
Only in gcc-6.5.0-irix/isl: isl_test.c.orig
Only in gcc-6.5.0-irix/isl: isl_test.c.rej
Only in gcc-6.5.0-irix/isl: libisl.sgifixes.patch
diff -ruw gcc-6.5.0/isl-0.18/isl_schedule_tree.c gcc-6.5.0-irix/isl-0.18/isl_schedule_tree.c
--- gcc-6.5.0/isl-0.18/isl_schedule_tree.c	Thu Dec 15 06:27:30 2016
+++ gcc-6.5.0-irix/isl-0.18/isl_schedule_tree.c	Sun Dec 22 11:54:48 2024
@@ -84,45 +84,45 @@
 			"allocation should have failed",
 			isl_schedule_tree_free(dup));
 	case isl_schedule_node_band:
-		dup->band = isl_schedule_band_copy(tree->band);
-		if (!dup->band)
+		dup->anonunion.band = isl_schedule_band_copy(tree->anonunion.band);
+		if (!dup->anonunion.band)
 			return isl_schedule_tree_free(dup);
 		break;
 	case isl_schedule_node_context:
-		dup->context = isl_set_copy(tree->context);
-		if (!dup->context)
+		dup->anonunion.context = isl_set_copy(tree->anonunion.context);
+		if (!dup->anonunion.context)
 			return isl_schedule_tree_free(dup);
 		break;
 	case isl_schedule_node_domain:
-		dup->domain = isl_union_set_copy(tree->domain);
-		if (!dup->domain)
+		dup->anonunion.domain = isl_union_set_copy(tree->anonunion.domain);
+		if (!dup->anonunion.domain)
 			return isl_schedule_tree_free(dup);
 		break;
 	case isl_schedule_node_expansion:
-		dup->contraction =
-			isl_union_pw_multi_aff_copy(tree->contraction);
-		dup->expansion = isl_union_map_copy(tree->expansion);
-		if (!dup->contraction || !dup->expansion)
+		dup->anonunion.anonstruct.contraction =
+			isl_union_pw_multi_aff_copy(tree->anonunion.anonstruct.contraction);
+		dup->anonunion.anonstruct.expansion = isl_union_map_copy(tree->anonunion.anonstruct.expansion);
+		if (!dup->anonunion.anonstruct.contraction || !dup->anonunion.anonstruct.expansion)
 			return isl_schedule_tree_free(dup);
 		break;
 	case isl_schedule_node_extension:
-		dup->extension = isl_union_map_copy(tree->extension);
-		if (!dup->extension)
+		dup->anonunion.extension = isl_union_map_copy(tree->anonunion.extension);
+		if (!dup->anonunion.extension)
 			return isl_schedule_tree_free(dup);
 		break;
 	case isl_schedule_node_filter:
-		dup->filter = isl_union_set_copy(tree->filter);
-		if (!dup->filter)
+		dup->anonunion.filter = isl_union_set_copy(tree->anonunion.filter);
+		if (!dup->anonunion.filter)
 			return isl_schedule_tree_free(dup);
 		break;
 	case isl_schedule_node_guard:
-		dup->guard = isl_set_copy(tree->guard);
-		if (!dup->guard)
+		dup->anonunion.guard = isl_set_copy(tree->anonunion.guard);
+		if (!dup->anonunion.guard)
 			return isl_schedule_tree_free(dup);
 		break;
 	case isl_schedule_node_mark:
-		dup->mark = isl_id_copy(tree->mark);
-		if (!dup->mark)
+		dup->anonunion.mark = isl_id_copy(tree->anonunion.mark);
+		if (!dup->anonunion.mark)
 			return isl_schedule_tree_free(dup);
 		break;
 	case isl_schedule_node_leaf:
@@ -180,29 +180,29 @@
 
 	switch (tree->type) {
 	case isl_schedule_node_band:
-		isl_schedule_band_free(tree->band);
+		isl_schedule_band_free(tree->anonunion.band);
 		break;
 	case isl_schedule_node_context:
-		isl_set_free(tree->context);
+		isl_set_free(tree->anonunion.context);
 		break;
 	case isl_schedule_node_domain:
-		isl_union_set_free(tree->domain);
+		isl_union_set_free(tree->anonunion.domain);
 		break;
 	case isl_schedule_node_expansion:
-		isl_union_pw_multi_aff_free(tree->contraction);
-		isl_union_map_free(tree->expansion);
+		isl_union_pw_multi_aff_free(tree->anonunion.anonstruct.contraction);
+		isl_union_map_free(tree->anonunion.anonstruct.expansion);
 		break;
 	case isl_schedule_node_extension:
-		isl_union_map_free(tree->extension);
+		isl_union_map_free(tree->anonunion.extension);
 		break;
 	case isl_schedule_node_filter:
-		isl_union_set_free(tree->filter);
+		isl_union_set_free(tree->anonunion.filter);
 		break;
 	case isl_schedule_node_guard:
-		isl_set_free(tree->guard);
+		isl_set_free(tree->anonunion.guard);
 		break;
 	case isl_schedule_node_mark:
-		isl_id_free(tree->mark);
+		isl_id_free(tree->anonunion.mark);
 		break;
 	case isl_schedule_node_sequence:
 	case isl_schedule_node_set:
@@ -241,7 +241,7 @@
 	if (!tree)
 		goto error;
 
-	tree->band = band;
+	tree->anonunion.band = band;
 	tree->anchored = isl_schedule_band_is_anchored(band);
 
 	return tree;
@@ -268,7 +268,7 @@
 	if (!tree)
 		goto error;
 
-	tree->context = context;
+	tree->anonunion.context = context;
 	tree->anchored = 1;
 
 	return tree;
@@ -293,7 +293,7 @@
 	if (!tree)
 		goto error;
 
-	tree->domain = domain;
+	tree->anonunion.domain = domain;
 
 	return tree;
 error:
@@ -319,8 +319,8 @@
 	if (!tree)
 		goto error;
 
-	tree->contraction = contraction;
-	tree->expansion = expansion;
+	tree->anonunion.anonstruct.contraction = contraction;
+	tree->anonunion.anonstruct.expansion = expansion;
 
 	return tree;
 error:
@@ -348,7 +348,7 @@
 	if (!tree)
 		goto error;
 
-	tree->extension = extension;
+	tree->anonunion.extension = extension;
 	tree->anchored = 1;
 
 	return tree;
@@ -373,7 +373,7 @@
 	if (!tree)
 		goto error;
 
-	tree->filter = filter;
+	tree->anonunion.filter = filter;
 
 	return tree;
 error:
@@ -399,7 +399,7 @@
 	if (!tree)
 		goto error;
 
-	tree->guard = guard;
+	tree->anonunion.guard = guard;
 	tree->anchored = 1;
 
 	return tree;
@@ -425,7 +425,7 @@
 	if (!tree)
 		goto error;
 
-	tree->mark = mark;
+	tree->anonunion.mark = mark;
 
 	return tree;
 error:
@@ -456,7 +456,7 @@
 	case isl_schedule_node_error:
 		return -1;
 	case isl_schedule_node_band:
-		return isl_schedule_band_is_anchored(tree->band);
+		return isl_schedule_band_is_anchored(tree->anonunion.band);
 	case isl_schedule_node_context:
 	case isl_schedule_node_extension:
 	case isl_schedule_node_guard:
@@ -639,34 +639,34 @@
 
 	switch (tree1->type) {
 	case isl_schedule_node_band:
-		equal = isl_schedule_band_plain_is_equal(tree1->band,
-							tree2->band);
+		equal = isl_schedule_band_plain_is_equal(tree1->anonunion.band,
+							tree2->anonunion.band);
 		break;
 	case isl_schedule_node_context:
-		equal = isl_set_is_equal(tree1->context, tree2->context);
+		equal = isl_set_is_equal(tree1->anonunion.context, tree2->anonunion.context);
 		break;
 	case isl_schedule_node_domain:
-		equal = isl_union_set_is_equal(tree1->domain, tree2->domain);
+		equal = isl_union_set_is_equal(tree1->anonunion.domain, tree2->anonunion.domain);
 		break;
 	case isl_schedule_node_expansion:
-		equal = isl_union_map_is_equal(tree1->expansion,
-						tree2->expansion);
+		equal = isl_union_map_is_equal(tree1->anonunion.anonstruct.expansion,
+						tree2->anonunion.anonstruct.expansion);
 		if (equal >= 0 && equal)
 			equal = isl_union_pw_multi_aff_plain_is_equal(
-				    tree1->contraction, tree2->contraction);
+				    tree1->anonunion.anonstruct.contraction, tree2->anonunion.anonstruct.contraction);
 		break;
 	case isl_schedule_node_extension:
-		equal = isl_union_map_is_equal(tree1->extension,
-						tree2->extension);
+		equal = isl_union_map_is_equal(tree1->anonunion.extension,
+						tree2->anonunion.extension);
 		break;
 	case isl_schedule_node_filter:
-		equal = isl_union_set_is_equal(tree1->filter, tree2->filter);
+		equal = isl_union_set_is_equal(tree1->anonunion.filter, tree2->anonunion.filter);
 		break;
 	case isl_schedule_node_guard:
-		equal = isl_set_is_equal(tree1->guard, tree2->guard);
+		equal = isl_set_is_equal(tree1->anonunion.guard, tree2->anonunion.guard);
 		break;
 	case isl_schedule_node_mark:
-		equal = tree1->mark == tree2->mark;
+		equal = tree1->anonunion.mark == tree2->anonunion.mark;
 		break;
 	case isl_schedule_node_leaf:
 	case isl_schedule_node_sequence:
@@ -1002,7 +1002,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return 0);
 
-	return isl_schedule_band_n_member(tree->band);
+	return isl_schedule_band_n_member(tree->anonunion.band);
 }
 
 /* Is the band member at position "pos" of the band tree root
@@ -1018,7 +1018,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return isl_bool_error);
 
-	return isl_schedule_band_member_get_coincident(tree->band, pos);
+	return isl_schedule_band_member_get_coincident(tree->anonunion.band, pos);
 }
 
 /* Mark the given band member as being coincident or not
@@ -1039,9 +1039,9 @@
 	if (!tree)
 		return NULL;
 
-	tree->band = isl_schedule_band_member_set_coincident(tree->band, pos,
+	tree->anonunion.band = isl_schedule_band_member_set_coincident(tree->anonunion.band, pos,
 							coincident);
-	if (!tree->band)
+	if (!tree->anonunion.band)
 		return isl_schedule_tree_free(tree);
 	return tree;
 }
@@ -1058,7 +1058,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return isl_bool_error);
 
-	return isl_schedule_band_get_permutable(tree->band);
+	return isl_schedule_band_get_permutable(tree->anonunion.band);
 }
 
 /* Mark the band tree root permutable or not according to "permutable"?
@@ -1077,8 +1077,8 @@
 	if (!tree)
 		return NULL;
 
-	tree->band = isl_schedule_band_set_permutable(tree->band, permutable);
-	if (!tree->band)
+	tree->anonunion.band = isl_schedule_band_set_permutable(tree->anonunion.band, permutable);
+	if (!tree->anonunion.band)
 		return isl_schedule_tree_free(tree);
 	return tree;
 }
@@ -1095,7 +1095,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return NULL);
 
-	return isl_schedule_band_get_space(tree->band);
+	return isl_schedule_band_get_space(tree->anonunion.band);
 }
 
 /* Intersect the domain of the band schedule of the band tree root
@@ -1111,8 +1111,8 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", goto error);
 
-	tree->band = isl_schedule_band_intersect_domain(tree->band, domain);
-	if (!tree->band)
+	tree->anonunion.band = isl_schedule_band_intersect_domain(tree->anonunion.band, domain);
+	if (!tree->anonunion.band)
 		return isl_schedule_tree_free(tree);
 
 	return tree;
@@ -1134,7 +1134,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return NULL);
 
-	return isl_schedule_band_get_partial_schedule(tree->band);
+	return isl_schedule_band_get_partial_schedule(tree->anonunion.band);
 }
 
 /* Replace the schedule of the band tree root by "schedule".
@@ -1150,7 +1150,7 @@
 	if (tree->type != isl_schedule_node_band)
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return NULL);
-	tree->band = isl_schedule_band_set_partial_schedule(tree->band,
+	tree->anonunion.band = isl_schedule_band_set_partial_schedule(tree->anonunion.band,
 								schedule);
 
 	return tree;
@@ -1173,7 +1173,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return isl_ast_loop_error);
 
-	return isl_schedule_band_member_get_ast_loop_type(tree->band, pos);
+	return isl_schedule_band_member_get_ast_loop_type(tree->anonunion.band, pos);
 }
 
 /* Set the loop AST generation type for the band member of the band tree root
@@ -1191,9 +1191,9 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return isl_schedule_tree_free(tree));
 
-	tree->band = isl_schedule_band_member_set_ast_loop_type(tree->band,
+	tree->anonunion.band = isl_schedule_band_member_set_ast_loop_type(tree->anonunion.band,
 								pos, type);
-	if (!tree->band)
+	if (!tree->anonunion.band)
 		return isl_schedule_tree_free(tree);
 
 	return tree;
@@ -1212,7 +1212,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return isl_ast_loop_error);
 
-	return isl_schedule_band_member_get_isolate_ast_loop_type(tree->band,
+	return isl_schedule_band_member_get_isolate_ast_loop_type(tree->anonunion.band,
 									pos);
 }
 
@@ -1232,9 +1232,9 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return isl_schedule_tree_free(tree));
 
-	tree->band = isl_schedule_band_member_set_isolate_ast_loop_type(
-							tree->band, pos, type);
-	if (!tree->band)
+	tree->anonunion.band = isl_schedule_band_member_set_isolate_ast_loop_type(
+							tree->anonunion.band, pos, type);
+	if (!tree->anonunion.band)
 		return isl_schedule_tree_free(tree);
 
 	return tree;
@@ -1252,7 +1252,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return NULL);
 
-	return isl_schedule_band_get_ast_build_options(tree->band);
+	return isl_schedule_band_get_ast_build_options(tree->anonunion.band);
 }
 
 /* Replace the AST build options associated to band tree root by "options".
@@ -1273,9 +1273,9 @@
 			"not a band node", goto error);
 
 	was_anchored = isl_schedule_tree_is_anchored(tree);
-	tree->band = isl_schedule_band_set_ast_build_options(tree->band,
+	tree->anonunion.band = isl_schedule_band_set_ast_build_options(tree->anonunion.band,
 								options);
-	if (!tree->band)
+	if (!tree->anonunion.band)
 		return isl_schedule_tree_free(tree);
 	if (isl_schedule_tree_is_anchored(tree) != was_anchored)
 		tree = isl_schedule_tree_update_anchored(tree);
@@ -1300,7 +1300,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a band node", return NULL);
 
-	return isl_schedule_band_get_ast_isolate_option(tree->band, depth);
+	return isl_schedule_band_get_ast_isolate_option(tree->anonunion.band, depth);
 }
 
 /* Return the context of the context tree root.
@@ -1315,7 +1315,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a context node", return NULL);
 
-	return isl_set_copy(tree->context);
+	return isl_set_copy(tree->anonunion.context);
 }
 
 /* Return the domain of the domain tree root.
@@ -1330,7 +1330,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a domain node", return NULL);
 
-	return isl_union_set_copy(tree->domain);
+	return isl_union_set_copy(tree->anonunion.domain);
 }
 
 /* Replace the domain of domain tree root "tree" by "domain".
@@ -1346,8 +1346,8 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a domain node", goto error);
 
-	isl_union_set_free(tree->domain);
-	tree->domain = domain;
+	isl_union_set_free(tree->anonunion.domain);
+	tree->anonunion.domain = domain;
 
 	return tree;
 error:
@@ -1368,7 +1368,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not an expansion node", return NULL);
 
-	return isl_union_pw_multi_aff_copy(tree->contraction);
+	return isl_union_pw_multi_aff_copy(tree->anonunion.anonstruct.contraction);
 }
 
 /* Return the expansion of the expansion tree root.
@@ -1383,7 +1383,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not an expansion node", return NULL);
 
-	return isl_union_map_copy(tree->expansion);
+	return isl_union_map_copy(tree->anonunion.anonstruct.expansion);
 }
 
 /* Replace the contraction and the expansion of the expansion tree root "tree"
@@ -1403,10 +1403,10 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not an expansion node", return NULL);
 
-	isl_union_pw_multi_aff_free(tree->contraction);
-	tree->contraction = contraction;
-	isl_union_map_free(tree->expansion);
-	tree->expansion = expansion;
+	isl_union_pw_multi_aff_free(tree->anonunion.anonstruct.contraction);
+	tree->anonunion.anonstruct.contraction = contraction;
+	isl_union_map_free(tree->anonunion.anonstruct.expansion);
+	tree->anonunion.anonstruct.expansion = expansion;
 
 	return tree;
 error:
@@ -1428,7 +1428,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not an extension node", return NULL);
 
-	return isl_union_map_copy(tree->extension);
+	return isl_union_map_copy(tree->anonunion.extension);
 }
 
 /* Replace the extension of extension tree root "tree" by "extension".
@@ -1443,8 +1443,8 @@
 	if (tree->type != isl_schedule_node_extension)
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not an extension node", return NULL);
-	isl_union_map_free(tree->extension);
-	tree->extension = extension;
+	isl_union_map_free(tree->anonunion.extension);
+	tree->anonunion.extension = extension;
 
 	return tree;
 error:
@@ -1465,7 +1465,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a filter node", return NULL);
 
-	return isl_union_set_copy(tree->filter);
+	return isl_union_set_copy(tree->anonunion.filter);
 }
 
 /* Replace the filter of the filter tree root by "filter".
@@ -1481,8 +1481,8 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a filter node", return NULL);
 
-	isl_union_set_free(tree->filter);
-	tree->filter = filter;
+	isl_union_set_free(tree->anonunion.filter);
+	tree->anonunion.filter = filter;
 
 	return tree;
 error:
@@ -1503,7 +1503,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a guard node", return NULL);
 
-	return isl_set_copy(tree->guard);
+	return isl_set_copy(tree->anonunion.guard);
 }
 
 /* Return the mark identifier of the mark tree root "tree".
@@ -1518,7 +1518,7 @@
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_invalid,
 			"not a mark node", return NULL);
 
-	return isl_id_copy(tree->mark);
+	return isl_id_copy(tree->anonunion.mark);
 }
 
 /* Set dim to the range dimension of "map" and abort the search.
@@ -1828,7 +1828,7 @@
 	case isl_schedule_node_band:
 		if (isl_schedule_tree_band_n_member(tree) == 0)
 			return subtree_schedule_extend_child(tree, outer);
-		mupa = isl_schedule_band_get_partial_schedule(tree->band);
+		mupa = isl_schedule_band_get_partial_schedule(tree->anonunion.band);
 		umap = isl_union_map_from_multi_union_pw_aff(mupa);
 		outer = isl_union_map_flat_range_product(outer, umap);
 		umap = subtree_schedule_extend_child(tree, outer);
@@ -1940,7 +1940,7 @@
 				isl_error_internal,
 				"0D band should be handled by caller",
 				return NULL);
-		mupa = isl_schedule_band_get_partial_schedule(tree->band);
+		mupa = isl_schedule_band_get_partial_schedule(tree->anonunion.band);
 		domain = isl_multi_union_pw_aff_domain(mupa);
 		domain = isl_union_set_universe(domain);
 		break;
@@ -2008,8 +2008,8 @@
 	if (!tree)
 		goto error;
 
-	tree->band = isl_schedule_band_scale(tree->band, mv);
-	if (!tree->band)
+	tree->anonunion.band = isl_schedule_band_scale(tree->anonunion.band, mv);
+	if (!tree->anonunion.band)
 		return isl_schedule_tree_free(tree);
 
 	return tree;
@@ -2035,8 +2035,8 @@
 	if (!tree)
 		goto error;
 
-	tree->band = isl_schedule_band_scale_down(tree->band, mv);
-	if (!tree->band)
+	tree->anonunion.band = isl_schedule_band_scale_down(tree->anonunion.band, mv);
+	if (!tree->anonunion.band)
 		return isl_schedule_tree_free(tree);
 
 	return tree;
@@ -2062,8 +2062,8 @@
 	if (!tree)
 		goto error;
 
-	tree->band = isl_schedule_band_mod(tree->band, mv);
-	if (!tree->band)
+	tree->anonunion.band = isl_schedule_band_mod(tree->anonunion.band, mv);
+	if (!tree->anonunion.band)
 		return isl_schedule_tree_free(tree);
 
 	return tree;
@@ -2089,8 +2089,8 @@
 	if (!tree)
 		goto error;
 
-	tree->band = isl_schedule_band_shift(tree->band, shift);
-	if (!tree->band)
+	tree->anonunion.band = isl_schedule_band_shift(tree->anonunion.band, shift);
+	if (!tree->anonunion.band)
 		return isl_schedule_tree_free(tree);
 
 	return tree;
@@ -2165,12 +2165,12 @@
 	if (!tree || !child)
 		goto error;
 
-	tree->band = isl_schedule_band_tile(tree->band,
+	tree->anonunion.band = isl_schedule_band_tile(tree->anonunion.band,
 					    isl_multi_val_copy(sizes));
-	if (!tree->band)
+	if (!tree->anonunion.band)
 		goto error;
-	child->band = isl_schedule_band_point(child->band, tree->band, sizes);
-	if (!child->band)
+	child->anonunion.band = isl_schedule_band_point(child->anonunion.band, tree->anonunion.band, sizes);
+	if (!child->anonunion.band)
 		child = isl_schedule_tree_free(child);
 
 	tree = isl_schedule_tree_replace_child(tree, 0, child);
@@ -2295,14 +2295,14 @@
 	isolate = isl_schedule_tree_band_get_ast_isolate_option(tree, depth);
 	tree_isolate = isolate_initial(isolate, pos, n - pos);
 	child_isolate = isolate_final(isolate, pos, n - pos);
-	child->band = isl_schedule_band_drop(child->band, 0, pos);
-	child->band = isl_schedule_band_replace_ast_build_option(child->band,
+	child->anonunion.band = isl_schedule_band_drop(child->anonunion.band, 0, pos);
+	child->anonunion.band = isl_schedule_band_replace_ast_build_option(child->anonunion.band,
 					isl_set_copy(isolate), child_isolate);
-	tree->band = isl_schedule_band_drop(tree->band, pos, n - pos);
-	tree->band = isl_schedule_band_replace_ast_build_option(tree->band,
+	tree->anonunion.band = isl_schedule_band_drop(tree->anonunion.band, pos, n - pos);
+	tree->anonunion.band = isl_schedule_band_replace_ast_build_option(tree->anonunion.band,
 					isl_set_copy(isolate), tree_isolate);
 	isl_set_free(isolate);
-	if (!child->band || !tree->band)
+	if (!child->anonunion.band || !tree->anonunion.band)
 		goto error;
 
 	tree = isl_schedule_tree_replace_child(tree, 0, child);
@@ -2369,40 +2369,40 @@
 	case isl_schedule_node_error:
 		return isl_schedule_tree_free(tree);
 	case isl_schedule_node_band:
-		tree->band = isl_schedule_band_reset_user(tree->band);
-		if (!tree->band)
+		tree->anonunion.band = isl_schedule_band_reset_user(tree->anonunion.band);
+		if (!tree->anonunion.band)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_context:
-		tree->context = isl_set_reset_user(tree->context);
-		if (!tree->context)
+		tree->anonunion.context = isl_set_reset_user(tree->anonunion.context);
+		if (!tree->anonunion.context)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_domain:
-		tree->domain = isl_union_set_reset_user(tree->domain);
-		if (!tree->domain)
+		tree->anonunion.domain = isl_union_set_reset_user(tree->anonunion.domain);
+		if (!tree->anonunion.domain)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_expansion:
-		tree->contraction =
-			isl_union_pw_multi_aff_reset_user(tree->contraction);
-		tree->expansion = isl_union_map_reset_user(tree->expansion);
-		if (!tree->contraction || !tree->expansion)
+		tree->anonunion.anonstruct.contraction =
+			isl_union_pw_multi_aff_reset_user(tree->anonunion.anonstruct.contraction);
+		tree->anonunion.anonstruct.expansion = isl_union_map_reset_user(tree->anonunion.anonstruct.expansion);
+		if (!tree->anonunion.anonstruct.contraction || !tree->anonunion.anonstruct.expansion)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_extension:
-		tree->extension = isl_union_map_reset_user(tree->extension);
-		if (!tree->extension)
+		tree->anonunion.extension = isl_union_map_reset_user(tree->anonunion.extension);
+		if (!tree->anonunion.extension)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_filter:
-		tree->filter = isl_union_set_reset_user(tree->filter);
-		if (!tree->filter)
+		tree->anonunion.filter = isl_union_set_reset_user(tree->anonunion.filter);
+		if (!tree->anonunion.filter)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_guard:
-		tree->guard = isl_set_reset_user(tree->guard);
-		if (!tree->guard)
+		tree->anonunion.guard = isl_set_reset_user(tree->anonunion.guard);
+		if (!tree->anonunion.guard)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_leaf:
@@ -2436,43 +2436,43 @@
 	case isl_schedule_node_error:
 		goto error;
 	case isl_schedule_node_band:
-		tree->band = isl_schedule_band_align_params(tree->band, space);
-		if (!tree->band)
+		tree->anonunion.band = isl_schedule_band_align_params(tree->anonunion.band, space);
+		if (!tree->anonunion.band)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_context:
-		tree->context = isl_set_align_params(tree->context, space);
-		if (!tree->context)
+		tree->anonunion.context = isl_set_align_params(tree->anonunion.context, space);
+		if (!tree->anonunion.context)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_domain:
-		tree->domain = isl_union_set_align_params(tree->domain, space);
-		if (!tree->domain)
+		tree->anonunion.domain = isl_union_set_align_params(tree->anonunion.domain, space);
+		if (!tree->anonunion.domain)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_expansion:
-		tree->contraction =
-			isl_union_pw_multi_aff_align_params(tree->contraction,
+		tree->anonunion.anonstruct.contraction =
+			isl_union_pw_multi_aff_align_params(tree->anonunion.anonstruct.contraction,
 							isl_space_copy(space));
-		tree->expansion = isl_union_map_align_params(tree->expansion,
+		tree->anonunion.anonstruct.expansion = isl_union_map_align_params(tree->anonunion.anonstruct.expansion,
 								space);
-		if (!tree->contraction || !tree->expansion)
+		if (!tree->anonunion.anonstruct.contraction || !tree->anonunion.anonstruct.expansion)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_extension:
-		tree->extension = isl_union_map_align_params(tree->extension,
+		tree->anonunion.extension = isl_union_map_align_params(tree->anonunion.extension,
 								space);
-		if (!tree->extension)
+		if (!tree->anonunion.extension)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_filter:
-		tree->filter = isl_union_set_align_params(tree->filter, space);
-		if (!tree->filter)
+		tree->anonunion.filter = isl_union_set_align_params(tree->anonunion.filter, space);
+		if (!tree->anonunion.filter)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_guard:
-		tree->guard = isl_set_align_params(tree->guard, space);
-		if (!tree->guard)
+		tree->anonunion.guard = isl_set_align_params(tree->anonunion.guard, space);
+		if (!tree->anonunion.guard)
 			return isl_schedule_tree_free(tree);
 		break;
 	case isl_schedule_node_leaf:
@@ -2552,30 +2552,30 @@
 		goto error;
 
 	if (tree->type == isl_schedule_node_band) {
-		tree->band = isl_schedule_band_pullback_union_pw_multi_aff(
-							    tree->band, upma);
-		if (!tree->band)
+		tree->anonunion.band = isl_schedule_band_pullback_union_pw_multi_aff(
+							    tree->anonunion.band, upma);
+		if (!tree->anonunion.band)
 			return isl_schedule_tree_free(tree);
 	} else if (tree->type == isl_schedule_node_domain) {
-		tree->domain =
-			isl_union_set_preimage_union_pw_multi_aff(tree->domain,
+		tree->anonunion.domain =
+			isl_union_set_preimage_union_pw_multi_aff(tree->anonunion.domain,
 									upma);
-		if (!tree->domain)
+		if (!tree->anonunion.domain)
 			return isl_schedule_tree_free(tree);
 	} else if (tree->type == isl_schedule_node_expansion) {
 		isl_die(isl_schedule_tree_get_ctx(tree), isl_error_unsupported,
 			"cannot pullback expansion node", goto error);
 	} else if (tree->type == isl_schedule_node_extension) {
-		tree->extension =
+		tree->anonunion.extension =
 			isl_union_map_preimage_range_union_pw_multi_aff(
-			    tree->extension, upma);
-		if (!tree->extension)
+			    tree->anonunion.extension, upma);
+		if (!tree->anonunion.extension)
 			return isl_schedule_tree_free(tree);
 	} else if (tree->type == isl_schedule_node_filter) {
-		tree->filter =
-			isl_union_set_preimage_union_pw_multi_aff(tree->filter,
+		tree->anonunion.filter =
+			isl_union_set_preimage_union_pw_multi_aff(tree->anonunion.filter,
 									upma);
-		if (!tree->filter)
+		if (!tree->anonunion.filter)
 			return isl_schedule_tree_free(tree);
 	}
 
@@ -2600,8 +2600,8 @@
 	if (!tree)
 		goto error;
 
-	tree->band = isl_schedule_band_gist(tree->band, context);
-	if (!tree->band)
+	tree->anonunion.band = isl_schedule_band_gist(tree->anonunion.band, context);
+	if (!tree->anonunion.band)
 		return isl_schedule_tree_free(tree);
 	return tree;
 error:
@@ -2729,7 +2729,7 @@
 		p = isl_printer_print_str(p, "context");
 		p = isl_printer_yaml_next(p);
 		p = isl_printer_print_str(p, "\"");
-		p = isl_printer_print_set(p, tree->context);
+		p = isl_printer_print_set(p, tree->anonunion.context);
 		p = isl_printer_print_str(p, "\"");
 		break;
 	case isl_schedule_node_domain:
@@ -2736,7 +2736,7 @@
 		p = isl_printer_print_str(p, "domain");
 		p = isl_printer_yaml_next(p);
 		p = isl_printer_print_str(p, "\"");
-		p = isl_printer_print_union_set(p, tree->domain);
+		p = isl_printer_print_union_set(p, tree->anonunion.domain);
 		p = isl_printer_print_str(p, "\"");
 		break;
 	case isl_schedule_node_expansion:
@@ -2743,13 +2743,13 @@
 		p = isl_printer_print_str(p, "contraction");
 		p = isl_printer_yaml_next(p);
 		p = isl_printer_print_str(p, "\"");
-		p = isl_printer_print_union_pw_multi_aff(p, tree->contraction);
+		p = isl_printer_print_union_pw_multi_aff(p, tree->anonunion.anonstruct.contraction);
 		p = isl_printer_print_str(p, "\"");
 		p = isl_printer_yaml_next(p);
 		p = isl_printer_print_str(p, "expansion");
 		p = isl_printer_yaml_next(p);
 		p = isl_printer_print_str(p, "\"");
-		p = isl_printer_print_union_map(p, tree->expansion);
+		p = isl_printer_print_union_map(p, tree->anonunion.anonstruct.expansion);
 		p = isl_printer_print_str(p, "\"");
 		break;
 	case isl_schedule_node_extension:
@@ -2756,7 +2756,7 @@
 		p = isl_printer_print_str(p, "extension");
 		p = isl_printer_yaml_next(p);
 		p = isl_printer_print_str(p, "\"");
-		p = isl_printer_print_union_map(p, tree->extension);
+		p = isl_printer_print_union_map(p, tree->anonunion.extension);
 		p = isl_printer_print_str(p, "\"");
 		break;
 	case isl_schedule_node_filter:
@@ -2763,7 +2763,7 @@
 		p = isl_printer_print_str(p, "filter");
 		p = isl_printer_yaml_next(p);
 		p = isl_printer_print_str(p, "\"");
-		p = isl_printer_print_union_set(p, tree->filter);
+		p = isl_printer_print_union_set(p, tree->anonunion.filter);
 		p = isl_printer_print_str(p, "\"");
 		break;
 	case isl_schedule_node_guard:
@@ -2770,7 +2770,7 @@
 		p = isl_printer_print_str(p, "guard");
 		p = isl_printer_yaml_next(p);
 		p = isl_printer_print_str(p, "\"");
-		p = isl_printer_print_set(p, tree->guard);
+		p = isl_printer_print_set(p, tree->anonunion.guard);
 		p = isl_printer_print_str(p, "\"");
 		break;
 	case isl_schedule_node_mark:
@@ -2777,11 +2777,11 @@
 		p = isl_printer_print_str(p, "mark");
 		p = isl_printer_yaml_next(p);
 		p = isl_printer_print_str(p, "\"");
-		p = isl_printer_print_str(p, isl_id_get_name(tree->mark));
+		p = isl_printer_print_str(p, isl_id_get_name(tree->anonunion.mark));
 		p = isl_printer_print_str(p, "\"");
 		break;
 	case isl_schedule_node_band:
-		p = print_tree_band(p, tree->band);
+		p = print_tree_band(p, tree->anonunion.band);
 		break;
 	}
 	p = isl_printer_yaml_next(p);
Only in gcc-6.5.0-irix/isl-0.18: isl_schedule_tree.c.orig
Only in gcc-6.5.0-irix/isl-0.18: isl_schedule_tree.c.rej
diff -ruw gcc-6.5.0/isl-0.18/isl_schedule_tree.h gcc-6.5.0-irix/isl-0.18/isl_schedule_tree.h
--- gcc-6.5.0/isl-0.18/isl_schedule_tree.h	Mon Dec 12 04:15:44 2016
+++ gcc-6.5.0-irix/isl-0.18/isl_schedule_tree.h	Sun Dec 22 11:54:48 2024
@@ -63,12 +63,12 @@
 		struct {
 			isl_union_pw_multi_aff *contraction;
 			isl_union_map *expansion;
-		};
+		} anonstruct;
 		isl_union_map *extension;
 		isl_union_set *filter;
 		isl_set *guard;
 		isl_id *mark;
-	};
+	} anonunion;
 	isl_schedule_tree_list *children;
 };
 
Only in gcc-6.5.0-irix/isl-0.18: isl_schedule_tree.h.orig
Only in gcc-6.5.0-irix/isl-0.18: isl_schedule_tree.h.rej
diff -ruw gcc-6.5.0/isl-0.18/isl_test.c gcc-6.5.0-irix/isl-0.18/isl_test.c
--- gcc-6.5.0/isl-0.18/isl_test.c	Thu Dec 15 06:27:30 2016
+++ gcc-6.5.0-irix/isl-0.18/isl_test.c	Sun Dec 22 11:54:48 2024
@@ -493,19 +493,23 @@
 	return 0;
 }
 
-struct {
+struct vbo {
 	__isl_give isl_val *(*fn)(__isl_take isl_val *v1,
 				__isl_take isl_val *v2);
-} val_bin_op[] = {
-	['+'] = { &isl_val_add },
-	['-'] = { &isl_val_sub },
-	['*'] = { &isl_val_mul },
-	['/'] = { &isl_val_div },
-	['g'] = { &isl_val_gcd },
-	['m'] = { &isl_val_min },
-	['M'] = { &isl_val_max },
-};
+} vbo;
+struct vbo val_bin_op[256];
 
+void setup_val_bin_ops()
+{
+  val_bin_op['+'].fn=&isl_val_add;
+  val_bin_op['-'].fn=&isl_val_sub;
+  val_bin_op['*'].fn=&isl_val_mul;
+  val_bin_op['/'].fn=&isl_val_div;
+  val_bin_op['g'].fn=&isl_val_gcd;
+  val_bin_op['m'].fn=&isl_val_min;
+  val_bin_op['M'].fn=&isl_val_max;
+}
+
 struct {
 	const char *arg1;
 	unsigned char op;
@@ -4344,14 +4348,18 @@
 	return 0;
 }
 
-struct {
+struct abo {
 	__isl_give isl_aff *(*fn)(__isl_take isl_aff *aff1,
 				__isl_take isl_aff *aff2);
-} aff_bin_op[] = {
-	['+'] = { &isl_aff_add },
-	['-'] = { &isl_aff_sub },
-	['*'] = { &isl_aff_mul },
-	['/'] = { &isl_aff_div },
+} abo;
+struct abo aff_bin_op[256];
+
+void setup_aff_bin_ops()
+{
+  aff_bin_op['+'].fn=&isl_aff_add;
+  aff_bin_op['-'].fn=&isl_aff_sub;
+  aff_bin_op['*'].fn=&isl_aff_mul;
+  aff_bin_op['/'].fn=&isl_aff_div;
 };
 
 struct {
@@ -6943,6 +6951,9 @@
 	struct isl_ctx *ctx;
 	struct isl_options *options;
 
+	setup_val_bin_ops();
+	setup_aff_bin_ops();
+
 	options = isl_options_new_with_defaults();
 	assert(options);
 	argc = isl_options_parse(options, argc, argv, ISL_ARG_ALL);
Only in gcc-6.5.0-irix/isl-0.18: isl_test.c.orig
Only in gcc-6.5.0-irix/isl-0.18: isl_test.c.rej
Only in gcc-6.5.0-irix/isl-0.18: libisl.sgifixes.patch
diff -ruw gcc-6.5.0/libada/configure gcc-6.5.0-irix/libada/configure
--- gcc-6.5.0/libada/configure	Thu Jun  1 06:52:29 2017
+++ gcc-6.5.0-irix/libada/configure	Sat Jun 12 22:27:11 2021
@@ -2681,13 +2681,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
diff -ruw gcc-6.5.0/libatomic/configure gcc-6.5.0-irix/libatomic/configure
--- gcc-6.5.0/libatomic/configure	Fri Oct 26 05:56:36 2018
+++ gcc-6.5.0-irix/libatomic/configure	Sat Jun 12 22:27:10 2021
@@ -3876,13 +3876,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
diff -ruw gcc-6.5.0/libbacktrace/configure gcc-6.5.0-irix/libbacktrace/configure
--- gcc-6.5.0/libbacktrace/configure	Fri Oct 26 05:56:36 2018
+++ gcc-6.5.0-irix/libbacktrace/configure	Sat Jun 12 22:27:09 2021
@@ -3287,13 +3287,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -4806,13 +4806,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
diff -ruw gcc-6.5.0/libcc1/configure gcc-6.5.0-irix/libcc1/configure
--- gcc-6.5.0/libcc1/configure	Mon Mar 14 04:54:06 2016
+++ gcc-6.5.0-irix/libcc1/configure	Sat Jun 12 22:27:10 2021
@@ -3160,13 +3160,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -11124,13 +11124,13 @@
   CXXFLAGS=$ac_save_CXXFLAGS
 elif test $ac_cv_prog_cxx_g = yes; then
   if test "$GXX" = yes; then
-    CXXFLAGS="-g -O2"
+    CXXFLAGS="-g -O1"
   else
     CXXFLAGS="-g"
   fi
 else
   if test "$GXX" = yes; then
-    CXXFLAGS="-O2"
+    CXXFLAGS="-O1"
   else
     CXXFLAGS=
   fi
diff -ruw gcc-6.5.0/libcilkrts/configure gcc-6.5.0-irix/libcilkrts/configure
--- gcc-6.5.0/libcilkrts/configure	Wed May 13 07:01:24 2015
+++ gcc-6.5.0-irix/libcilkrts/configure	Sat Jun 12 22:27:10 2021
@@ -3573,13 +3573,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -4112,13 +4112,13 @@
   CXXFLAGS=$ac_save_CXXFLAGS
 elif test $ac_cv_prog_cxx_g = yes; then
   if test "$GXX" = yes; then
-    CXXFLAGS="-g -O2"
+    CXXFLAGS="-g -O1"
   else
     CXXFLAGS="-g"
   fi
 else
   if test "$GXX" = yes; then
-    CXXFLAGS="-O2"
+    CXXFLAGS="-O1"
   else
     CXXFLAGS=
   fi
diff -ruw gcc-6.5.0/libcpp/configure gcc-6.5.0-irix/libcpp/configure
--- gcc-6.5.0/libcpp/configure	Fri Oct 26 05:56:36 2018
+++ gcc-6.5.0-irix/libcpp/configure	Sat Jun 12 22:27:10 2021
@@ -3482,13 +3482,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -3830,13 +3830,13 @@
   CXXFLAGS=$ac_save_CXXFLAGS
 elif test $ac_cv_prog_cxx_g = yes; then
   if test "$GXX" = yes; then
-    CXXFLAGS="-g -O2"
+    CXXFLAGS="-g -O1"
   else
     CXXFLAGS="-g"
   fi
 else
   if test "$GXX" = yes; then
-    CXXFLAGS="-O2"
+    CXXFLAGS="-O1"
   else
     CXXFLAGS=
   fi
diff -ruw gcc-6.5.0/libdecnumber/configure gcc-6.5.0-irix/libdecnumber/configure
--- gcc-6.5.0/libdecnumber/configure	Tue Jun 30 12:42:07 2015
+++ gcc-6.5.0-irix/libdecnumber/configure	Sat Jun 12 22:27:10 2021
@@ -2936,13 +2936,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
diff -ruw gcc-6.5.0/libffi/configure gcc-6.5.0-irix/libffi/configure
--- gcc-6.5.0/libffi/configure	Fri Oct 26 05:56:36 2018
+++ gcc-6.5.0-irix/libffi/configure	Sat Jun 12 22:27:11 2021
@@ -3963,13 +3963,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -4502,13 +4502,13 @@
   CXXFLAGS=$ac_save_CXXFLAGS
 elif test $ac_cv_prog_cxx_g = yes; then
   if test "$GXX" = yes; then
-    CXXFLAGS="-g -O2"
+    CXXFLAGS="-g -O1"
   else
     CXXFLAGS="-g"
   fi
 else
   if test "$GXX" = yes; then
-    CXXFLAGS="-O2"
+    CXXFLAGS="-O1"
   else
     CXXFLAGS=
   fi
diff -ruw gcc-6.5.0/libgcc/config.host gcc-6.5.0-irix/libgcc/config.host
--- gcc-6.5.0/libgcc/config.host	Tue Nov 21 04:41:34 2017
+++ gcc-6.5.0-irix/libgcc/config.host	Fri Jun 11 00:13:30 2021
@@ -141,6 +141,15 @@
 microblaze*-*-*)
 	cpu_type=microblaze
 	;;
+mips-sgi-irix6.5*)
+	# Use the historical IRIX mips FP configs
+	cpu_type=mips
+	tmake_file="mips/t-mips-irixfp"
+	# This doesn't work yet.
+	if test "${host_address}" = 64; then
+		tmake_file="${tmake_file} mips/t-mips-irixfp64"
+	fi
+	;;
 mips*-*-*)
 	# All MIPS targets provide a full set of FP routines.
 	cpu_type=mips
@@ -853,6 +862,11 @@
 	tmake_file="${tmake_file} microblaze/t-microblaze t-fdpbit"
 	extra_parts="$extra_parts crtbeginS.o crtendS.o crtbeginT.o crti.o crtn.o"
 	;;
+mips-sgi-irix6.5*)
+	tmake_file="$tmake_file mips/t-irix6 t-crtfm mips/t-tpbit t-slibgcc mips/t-slibgcc-irix"
+	extra_parts="crtbegin.o crtend.o crtfastmath.o irix-crti.o irix-crtn.o"
+	md_unwind_header=mips/irix6-unwind.h
+	;;
 microblaze*-*-rtems*)
 	tmake_file="${tmake_file} microblaze/t-microblaze t-fdpbit"
 	extra_parts="$extra_parts crtbeginS.o crtendS.o crtbeginT.o crti.o crtn.o"
diff -ruw gcc-6.5.0/libgcc/configure gcc-6.5.0-irix/libgcc/configure
--- gcc-6.5.0/libgcc/configure	Tue Nov 21 04:41:34 2017
+++ gcc-6.5.0-irix/libgcc/configure	Mon Jul 26 16:23:20 2021
@@ -2338,7 +2338,7 @@
 	# sets the default TLS model and affects inlining.
 	PICFLAG=-fPIC
 	;;
-    mips-sgi-irix6*)
+    mips*-sgi-irix6*)
 	# PIC is the default.
 	;;
     rs6000-ibm-aix* | powerpc-ibm-aix*)
@@ -3805,13 +3805,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
Only in gcc-6.5.0-irix/libgcc/config/mips: irix-crti.S
Only in gcc-6.5.0-irix/libgcc/config/mips: irix-crtn.S
Only in gcc-6.5.0-irix/libgcc/config/mips: irix6-unwind.h
diff -ruw gcc-6.5.0/libgcc/config/mips/sfp-machine.h gcc-6.5.0-irix/libgcc/config/mips/sfp-machine.h
--- gcc-6.5.0/libgcc/config/mips/sfp-machine.h	Mon Jan  4 09:30:50 2016
+++ gcc-6.5.0-irix/libgcc/config/mips/sfp-machine.h	Fri Jun 11 00:13:30 2021
@@ -22,6 +22,8 @@
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#if !defined(__sgi)
+
 #ifdef __mips64
 #define _FP_W_TYPE_SIZE		64
 #define _FP_W_TYPE		unsigned long long
@@ -178,3 +180,5 @@
 # define strong_alias(name, aliasname) _strong_alias(name, aliasname)
 # define _strong_alias(name, aliasname) \
   extern __typeof (name) aliasname __attribute__ ((alias (#name)));
+
+#endif /* !defined(__sgi) */
Only in gcc-6.5.0-irix/libgcc/config/mips: t-irix6
Only in gcc-6.5.0-irix/libgcc/config/mips: t-mips-irixfp
Only in gcc-6.5.0-irix/libgcc/config/mips: t-slibgcc-irix
diff -ruw gcc-6.5.0/libgfortran/configure gcc-6.5.0-irix/libgfortran/configure
--- gcc-6.5.0/libgfortran/configure	Fri Oct 26 05:56:36 2018
+++ gcc-6.5.0-irix/libgfortran/configure	Sat Jun 12 22:27:11 2021
@@ -4223,13 +4223,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -5399,13 +5399,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -12923,13 +12923,13 @@
   FCFLAGS=$ac_save_FCFLAGS
 elif test $ac_cv_prog_fc_g = yes; then
   if test "x$ac_cv_fc_compiler_gnu" = xyes; then
-    FCFLAGS="-g -O2"
+    FCFLAGS="-g -O1"
   else
     FCFLAGS="-g"
   fi
 else
   if test "x$ac_cv_fc_compiler_gnu" = xyes; then
-    FCFLAGS="-O2"
+    FCFLAGS="-O1"
   else
     FCFLAGS=
   fi
diff -ruw gcc-6.5.0/libgo/configure gcc-6.5.0-irix/libgo/configure
--- gcc-6.5.0/libgo/configure	Tue Jun 26 00:44:49 2018
+++ gcc-6.5.0-irix/libgo/configure	Sat Jun 12 22:27:10 2021
@@ -3822,13 +3822,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -4338,7 +4338,7 @@
   fi
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
-GOCFLAGS="-g -O2"
+GOCFLAGS="-g -O1"
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
diff -ruw gcc-6.5.0/libgomp/configure gcc-6.5.0-irix/libgomp/configure
--- gcc-6.5.0/libgomp/configure	Fri Oct 26 05:56:36 2018
+++ gcc-6.5.0-irix/libgomp/configure	Sat Jun 12 22:27:10 2021
@@ -4023,13 +4023,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -11743,13 +11743,13 @@
   FCFLAGS=$ac_save_FCFLAGS
 elif test $ac_cv_prog_fc_g = yes; then
   if test "x$ac_cv_fc_compiler_gnu" = xyes; then
-    FCFLAGS="-g -O2"
+    FCFLAGS="-g -O1"
   else
     FCFLAGS="-g"
   fi
 else
   if test "x$ac_cv_fc_compiler_gnu" = xyes; then
-    FCFLAGS="-O2"
+    FCFLAGS="-O1"
   else
     FCFLAGS=
   fi
diff -ruw gcc-6.5.0/libgomp/configure.tgt gcc-6.5.0-irix/libgomp/configure.tgt
--- gcc-6.5.0/libgomp/configure.tgt	Thu Sep  3 12:20:35 2015
+++ gcc-6.5.0-irix/libgomp/configure.tgt	Fri Jun 11 00:13:30 2021
@@ -145,6 +145,11 @@
 	XLDFLAGS="${XLDFLAGS} -lpthread"
 	;;
 
+  mips-sgi-irix*)
+	# Need to link with -lpthread so libgomp.so is self-contained.
+	XLDFLAGS="${XLDFLAGS} -lpthread"
+	;;
+
   *-*-aix*)
 	config_path="posix"
 	# Need to link with -lpthread so libgomp.so is self-contained.
diff -ruw gcc-6.5.0/libgomp/env.c gcc-6.5.0-irix/libgomp/env.c
--- gcc-6.5.0/libgomp/env.c	Fri May  5 17:47:20 2017
+++ gcc-6.5.0-irix/libgomp/env.c	Sun Dec 22 13:34:47 2024
@@ -1166,6 +1166,10 @@
     {
       fputs ("  GOMP_CPU_AFFINITY = ''\n", stderr);
       fprintf (stderr, "  GOMP_STACKSIZE = '%lu'\n", stacksize);
+#if defined(__sgi)
+      fprintf (stderr, "  GOMP_SPINCOUNT = '%lu'\n",
+               (unsigned long) gomp_spin_count_var);
+#else
 #ifdef HAVE_INTTYPES_H
       fprintf (stderr, "  GOMP_SPINCOUNT = '%"PRIu64"'\n",
 	       (uint64_t) gomp_spin_count_var);
@@ -1173,6 +1177,7 @@
       fprintf (stderr, "  GOMP_SPINCOUNT = '%lu'\n",
 	       (unsigned long) gomp_spin_count_var);
 #endif
+#endif
     }
 
   fputs ("OPENMP DISPLAY ENVIRONMENT END\n", stderr);
diff -ruw gcc-6.5.0/libgomp/oacc-parallel.c gcc-6.5.0-irix/libgomp/oacc-parallel.c
--- gcc-6.5.0/libgomp/oacc-parallel.c	Thu Mar 17 11:07:54 2016
+++ gcc-6.5.0-irix/libgomp/oacc-parallel.c	Sun Dec 22 13:37:03 2024
@@ -75,7 +75,10 @@
   int async = GOMP_ASYNC_SYNC;
   unsigned dims[GOMP_DIM_MAX];
   unsigned tag;
-
+#if defined(__sgi)
+  gomp_debug (0, "%s: mapnum=%lu, hostaddrs=%p, sizes=%p, kinds=%p\n",
+              __FUNCTION__, (unsigned long) mapnum, hostaddrs, sizes, kinds);
+#else 
 #ifdef HAVE_INTTYPES_H
   gomp_debug (0, "%s: mapnum=%"PRIu64", hostaddrs=%p, size=%p, kinds=%p\n",
 	      __FUNCTION__, (uint64_t) mapnum, hostaddrs, sizes, kinds);
@@ -83,6 +86,7 @@
   gomp_debug (0, "%s: mapnum=%lu, hostaddrs=%p, sizes=%p, kinds=%p\n",
 	      __FUNCTION__, (unsigned long) mapnum, hostaddrs, sizes, kinds);
 #endif
+#endif
   goacc_lazy_initialize ();
 
   thr = goacc_thread ();
@@ -214,7 +218,10 @@
 {
   bool host_fallback = device == GOMP_DEVICE_HOST_FALLBACK;
   struct target_mem_desc *tgt;
-
+#if defined(__sgi)
+  gomp_debug (0, "%s: mapnum=%lu, hostaddrs=%p, sizes=%p, kinds=%p\n",
+              __FUNCTION__, (unsigned long) mapnum, hostaddrs, sizes, kinds);
+#else
 #ifdef HAVE_INTTYPES_H
   gomp_debug (0, "%s: mapnum=%"PRIu64", hostaddrs=%p, size=%p, kinds=%p\n",
 	      __FUNCTION__, (uint64_t) mapnum, hostaddrs, sizes, kinds);
@@ -222,6 +229,7 @@
   gomp_debug (0, "%s: mapnum=%lu, hostaddrs=%p, sizes=%p, kinds=%p\n",
 	      __FUNCTION__, (unsigned long) mapnum, hostaddrs, sizes, kinds);
 #endif
+#endif
 
   goacc_lazy_initialize ();
 
diff -ruw gcc-6.5.0/libgomp/target.c gcc-6.5.0-irix/libgomp/target.c
--- gcc-6.5.0/libgomp/target.c	Tue Apr 12 03:05:29 2016
+++ gcc-6.5.0-irix/libgomp/target.c	Sun Dec 22 13:27:42 2024
@@ -734,6 +734,11 @@
 			 was missing.  */
 		      size_t size = k->host_end - k->host_start;
 		      gomp_mutex_unlock (&devicep->lock);
+#if defined(__sgi)
+                      gomp_fatal ("present clause: !acc_is_present (%p, "
+                                  "%lu (0x%lx))", (void *) k->host_start,
+                                  (unsigned long) size, (unsigned long) size);
+#else
 #ifdef HAVE_INTTYPES_H
 		      gomp_fatal ("present clause: !acc_is_present (%p, "
 				  "%"PRIu64" (0x%"PRIx64"))",
@@ -744,6 +749,7 @@
 				  "%lu (0x%lx))", (void *) k->host_start,
 				  (unsigned long) size, (unsigned long) size);
 #endif
+#endif
 		    }
 		    break;
 		  case GOMP_MAP_FORCE_DEVICEPTR:
diff -ruw gcc-6.5.0/libgomp/config/posix/proc.c gcc-6.5.0-irix/libgomp/config/posix/proc.c
--- gcc-6.5.0/libgomp/config/posix/proc.c	Mon Jan  4 09:30:50 2016
+++ gcc-6.5.0-irix/libgomp/config/posix/proc.c	Fri Jun 11 00:19:05 2021
@@ -38,6 +38,9 @@
 # endif
 #endif
 
+#ifdef __sgi
+ #define _SC_NPROCESSORS_ONLN _SC_NPROC_ONLN
+#endif
 
 /* At startup, determine the default number of threads.  It would seem
    this should be related to the number of cpus online.  */
diff -ruw gcc-6.5.0/libiberty/configure gcc-6.5.0-irix/libiberty/configure
--- gcc-6.5.0/libiberty/configure	Sun Nov  8 23:32:08 2015
+++ gcc-6.5.0-irix/libiberty/configure	Sat Jun 12 22:27:11 2021
@@ -3619,13 +3619,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
diff -ruw gcc-6.5.0/libitm/configure gcc-6.5.0-irix/libitm/configure
--- gcc-6.5.0/libitm/configure	Fri Oct 26 05:56:36 2018
+++ gcc-6.5.0-irix/libitm/configure	Sat Jun 12 22:27:10 2021
@@ -4062,13 +4062,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -4601,13 +4601,13 @@
   CXXFLAGS=$ac_save_CXXFLAGS
 elif test $ac_cv_prog_cxx_g = yes; then
   if test "$GXX" = yes; then
-    CXXFLAGS="-g -O2"
+    CXXFLAGS="-g -O1"
   else
     CXXFLAGS="-g"
   fi
 else
   if test "$GXX" = yes; then
-    CXXFLAGS="-O2"
+    CXXFLAGS="-O1"
   else
     CXXFLAGS=
   fi
diff -ruw gcc-6.5.0/libjava/configure gcc-6.5.0-irix/libjava/configure
--- gcc-6.5.0/libjava/configure	Fri Oct 26 05:56:36 2018
+++ gcc-6.5.0-irix/libjava/configure	Sat Jun 12 22:27:11 2021
@@ -4071,13 +4071,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -4419,13 +4419,13 @@
   CXXFLAGS=$ac_save_CXXFLAGS
 elif test $ac_cv_prog_cxx_g = yes; then
   if test "$GXX" = yes; then
-    CXXFLAGS="-g -O2"
+    CXXFLAGS="-g -O1"
   else
     CXXFLAGS="-g"
   fi
 else
   if test "$GXX" = yes; then
-    CXXFLAGS="-O2"
+    CXXFLAGS="-O1"
   else
     CXXFLAGS=
   fi
@@ -16882,7 +16882,7 @@
 
 test -z "$GCJ" && as_fn_error "no acceptable gcj found in \$PATH" "$LINENO" 5
 if test "x${GCJFLAGS-unset}" = xunset; then
-   GCJFLAGS="-g -O2"
+   GCJFLAGS="-g -O1"
 fi
 
 
@@ -17115,7 +17115,7 @@
 
 test -z "$GCJ" && as_fn_error "no acceptable gcj found in \$PATH" "$LINENO" 5
 if test "x${GCJFLAGS-unset}" = xunset; then
-   GCJFLAGS="-g -O2"
+   GCJFLAGS="-g -O1"
 fi
 
 
@@ -23481,7 +23481,7 @@
 
 test -z "$GCJ" && as_fn_error "no acceptable gcj found in \$PATH" "$LINENO" 5
 if test "x${GCJFLAGS-unset}" = xunset; then
-   GCJFLAGS="-g -O2"
+   GCJFLAGS="-g -O1"
 fi
 
 
diff -ruw gcc-6.5.0/libjava/classpath/configure gcc-6.5.0-irix/libjava/classpath/configure
--- gcc-6.5.0/libjava/classpath/configure	Tue Aug 11 13:59:25 2015
+++ gcc-6.5.0-irix/libjava/classpath/configure	Sat Jun 12 22:27:10 2021
@@ -4676,13 +4676,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -12699,13 +12699,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -13438,13 +13438,13 @@
   CXXFLAGS=$ac_save_CXXFLAGS
 elif test $ac_cv_prog_cxx_g = yes; then
   if test "$GXX" = yes; then
-    CXXFLAGS="-g -O2"
+    CXXFLAGS="-g -O1"
   else
     CXXFLAGS="-g"
   fi
 else
   if test "$GXX" = yes; then
-    CXXFLAGS="-O2"
+    CXXFLAGS="-O1"
   else
     CXXFLAGS=
   fi
diff -ruw gcc-6.5.0/libjava/libltdl/configure gcc-6.5.0-irix/libjava/libltdl/configure
--- gcc-6.5.0/libjava/libltdl/configure	Wed May 13 07:08:26 2015
+++ gcc-6.5.0-irix/libjava/libltdl/configure	Sat Jun 12 22:27:11 2021
@@ -3610,13 +3610,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
diff -ruw gcc-6.5.0/libmpx/configure gcc-6.5.0-irix/libmpx/configure
--- gcc-6.5.0/libmpx/configure	Thu Jul 16 04:36:02 2015
+++ gcc-6.5.0-irix/libmpx/configure	Sat Jun 12 22:27:10 2021
@@ -3561,13 +3561,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -4607,13 +4607,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
diff -ruw gcc-6.5.0/libobjc/configure gcc-6.5.0-irix/libobjc/configure
--- gcc-6.5.0/libobjc/configure	Fri Oct 26 05:56:36 2018
+++ gcc-6.5.0-irix/libobjc/configure	Sat Jun 12 22:27:10 2021
@@ -3209,13 +3209,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
diff -ruw gcc-6.5.0/liboffloadmic/configure gcc-6.5.0-irix/liboffloadmic/configure
--- gcc-6.5.0/liboffloadmic/configure	Fri Jul 24 14:20:44 2015
+++ gcc-6.5.0-irix/liboffloadmic/configure	Sat Jun 12 22:27:09 2021
@@ -3611,13 +3611,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -4150,13 +4150,13 @@
   CXXFLAGS=$ac_save_CXXFLAGS
 elif test $ac_cv_prog_cxx_g = yes; then
   if test "$GXX" = yes; then
-    CXXFLAGS="-g -O2"
+    CXXFLAGS="-g -O1"
   else
     CXXFLAGS="-g"
   fi
 else
   if test "$GXX" = yes; then
-    CXXFLAGS="-O2"
+    CXXFLAGS="-O1"
   else
     CXXFLAGS=
   fi
diff -ruw gcc-6.5.0/liboffloadmic/plugin/configure gcc-6.5.0-irix/liboffloadmic/plugin/configure
--- gcc-6.5.0/liboffloadmic/plugin/configure	Wed May 13 07:10:33 2015
+++ gcc-6.5.0-irix/liboffloadmic/plugin/configure	Sat Jun 12 22:27:09 2021
@@ -3523,13 +3523,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -4062,13 +4062,13 @@
   CXXFLAGS=$ac_save_CXXFLAGS
 elif test $ac_cv_prog_cxx_g = yes; then
   if test "$GXX" = yes; then
-    CXXFLAGS="-g -O2"
+    CXXFLAGS="-g -O1"
   else
     CXXFLAGS="-g"
   fi
 else
   if test "$GXX" = yes; then
-    CXXFLAGS="-O2"
+    CXXFLAGS="-O1"
   else
     CXXFLAGS=
   fi
diff -ruw gcc-6.5.0/libquadmath/configure gcc-6.5.0-irix/libquadmath/configure
--- gcc-6.5.0/libquadmath/configure	Wed May 13 07:27:43 2015
+++ gcc-6.5.0-irix/libquadmath/configure	Sat Jun 12 22:27:10 2021
@@ -3658,13 +3658,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -11405,13 +11405,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
diff -ruw gcc-6.5.0/libsanitizer/configure gcc-6.5.0-irix/libsanitizer/configure
--- gcc-6.5.0/libsanitizer/configure	Fri Oct 26 05:56:36 2018
+++ gcc-6.5.0-irix/libsanitizer/configure	Sat Jun 12 22:27:11 2021
@@ -3340,13 +3340,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -5232,13 +5232,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -5580,13 +5580,13 @@
   CXXFLAGS=$ac_save_CXXFLAGS
 elif test $ac_cv_prog_cxx_g = yes; then
   if test "$GXX" = yes; then
-    CXXFLAGS="-g -O2"
+    CXXFLAGS="-g -O1"
   else
     CXXFLAGS="-g"
   fi
 else
   if test "$GXX" = yes; then
-    CXXFLAGS="-O2"
+    CXXFLAGS="-O1"
   else
     CXXFLAGS=
   fi
diff -ruw gcc-6.5.0/libssp/configure gcc-6.5.0-irix/libssp/configure
--- gcc-6.5.0/libssp/configure	Wed May 13 07:12:39 2015
+++ gcc-6.5.0-irix/libssp/configure	Sat Jun 12 22:27:10 2021
@@ -3599,13 +3599,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
diff -ruw gcc-6.5.0/libstdc++-v3/acinclude.m4 gcc-6.5.0-irix/libstdc++-v3/acinclude.m4
--- gcc-6.5.0/libstdc++-v3/acinclude.m4	Fri May 26 08:01:06 2017
+++ gcc-6.5.0-irix/libstdc++-v3/acinclude.m4	Fri Jun 11 00:14:45 2021
@@ -316,7 +316,7 @@
     AC_MSG_CHECKING([for ld that supports -Wl,-z,relro])
     cxx_z_relo=`$LD -v --help 2>/dev/null | grep "z relro"`
     if test -n "$cxx_z_relo"; then
-      OPT_LDFLAGS="-Wl,-z,relro"
+      OPT_LDFLAGS="-Wl,-z,relro $OPT_LDFLAGS"
       ac_ld_relro=yes
     fi
     AC_MSG_RESULT($ac_ld_relro)
diff -ruw gcc-6.5.0/libstdc++-v3/configure gcc-6.5.0-irix/libstdc++-v3/configure
--- gcc-6.5.0/libstdc++-v3/configure	Mon Feb 19 12:02:38 2018
+++ gcc-6.5.0-irix/libstdc++-v3/configure	Sat Jun 12 22:27:10 2021
@@ -4313,13 +4313,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -4661,13 +4661,13 @@
   CXXFLAGS=$ac_save_CXXFLAGS
 elif test $ac_cv_prog_cxx_g = yes; then
   if test "$GXX" = yes; then
-    CXXFLAGS="-g -O2"
+    CXXFLAGS="-g -O1"
   else
     CXXFLAGS="-g"
   fi
 else
   if test "$GXX" = yes; then
-    CXXFLAGS="-O2"
+    CXXFLAGS="-O1"
   else
     CXXFLAGS=
   fi
@@ -22001,7 +22001,7 @@
 $as_echo_n "checking for ld that supports -Wl,-z,relro... " >&6; }
     cxx_z_relo=`$LD -v --help 2>/dev/null | grep "z relro"`
     if test -n "$cxx_z_relo"; then
-      OPT_LDFLAGS="-Wl,-z,relro"
+      OPT_LDFLAGS="-Wl,-z,relro $OPT_LDFLAGS"
       ac_ld_relro=yes
     fi
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5
diff -ruw gcc-6.5.0/libstdc++-v3/configure.host gcc-6.5.0-irix/libstdc++-v3/configure.host
--- gcc-6.5.0/libstdc++-v3/configure.host	Tue Sep 27 02:11:15 2016
+++ gcc-6.5.0-irix/libstdc++-v3/configure.host	Fri Jun 11 00:13:30 2021
@@ -277,6 +277,15 @@
   hpux*)
     os_include_dir="os/hpux"
     ;;
+  irix6.5*)
+    os_include_dir="os/irix/irix6.5"
+    atomicity_dir=os/irix
+    atomic_word_dir=os/irix
+    # libstdc++.so relies on emutls on IRIX, which only works with the
+    # real functions implemented in libpthread.so, not with the stubs in
+    # libc, so always pass -lpthread.
+    OPT_LDFLAGS="${OPT_LDFLAGS} -lpthread"
+    ;;
   mingw32*)
     case "$host" in
       *-w64-*)
Only in gcc-6.5.0-irix/libstdc++-v3/config/os: irix
diff -ruw gcc-6.5.0/libvtv/configure gcc-6.5.0-irix/libvtv/configure
--- gcc-6.5.0/libvtv/configure	Fri Oct 26 05:56:36 2018
+++ gcc-6.5.0-irix/libvtv/configure	Sat Jun 12 22:27:10 2021
@@ -3211,13 +3211,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -5076,13 +5076,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -5424,13 +5424,13 @@
   CXXFLAGS=$ac_save_CXXFLAGS
 elif test $ac_cv_prog_cxx_g = yes; then
   if test "$GXX" = yes; then
-    CXXFLAGS="-g -O2"
+    CXXFLAGS="-g -O1"
   else
     CXXFLAGS="-g"
   fi
 else
   if test "$GXX" = yes; then
-    CXXFLAGS="-O2"
+    CXXFLAGS="-O1"
   else
     CXXFLAGS=
   fi
diff -ruw gcc-6.5.0/lto-plugin/configure gcc-6.5.0-irix/lto-plugin/configure
--- gcc-6.5.0/lto-plugin/configure	Thu Jul  2 04:30:07 2015
+++ gcc-6.5.0-irix/lto-plugin/configure	Sat Jun 12 22:27:11 2021
@@ -3713,13 +3713,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
@@ -4841,13 +4841,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
diff -ruw gcc-6.5.0/zlib/configure gcc-6.5.0-irix/zlib/configure
--- gcc-6.5.0/zlib/configure	Wed May 13 07:31:32 2015
+++ gcc-6.5.0-irix/zlib/configure	Sat Jun 12 22:27:10 2021
@@ -3597,13 +3597,13 @@
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+    CFLAGS="-g -O1"
   else
     CFLAGS="-g"
   fi
 else
   if test "$GCC" = yes; then
-    CFLAGS="-O2"
+    CFLAGS="-O1"
   else
     CFLAGS=
   fi
