From 3904e8e8ab4027a64110ff368d42784287114314 Mon Sep 17 00:00:00 2001
From: CentOS Sources
Date: Tue, 17 May 2022 06:33:24 -0400
Subject: [PATCH] import gcc-11.2.1-9.4.el9
---
.gcc.metadata | 4 +
.gitignore | 4 +
SOURCES/gcc11-Wbidi-chars.patch | 1721 +++++++
SOURCES/gcc11-Wno-format-security.patch | 27 +
SOURCES/gcc11-bind-now.patch | 333 ++
SOURCES/gcc11-d-shared-libphobos.patch | 20 +
SOURCES/gcc11-dejagnu-multiline.patch | 32 +
SOURCES/gcc11-dg-ice-fixes.patch | 83 +
SOURCES/gcc11-foffload-default.patch | 116 +
...c11-fortran-fdec-add-missing-indexes.patch | 181 +
SOURCES/gcc11-fortran-fdec-duplicates.patch | 215 +
SOURCES/gcc11-fortran-fdec-ichar.patch | 78 +
...gcc11-fortran-fdec-non-integer-index.patch | 158 +
.../gcc11-fortran-fdec-non-logical-if.patch | 378 ++
SOURCES/gcc11-fortran-fdec-old-init.patch | 185 +
.../gcc11-fortran-fdec-override-kind.patch | 588 +++
SOURCES/gcc11-fortran-fdec-promotion.patch | 2093 +++++++++
SOURCES/gcc11-fortran-fdec-sequence.patch | 262 ++
.../gcc11-fortran-flogical-as-integer.patch | 305 ++
SOURCES/gcc11-hack.patch | 126 +
SOURCES/gcc11-isl-dl.patch | 716 +++
SOURCES/gcc11-isl-dl2.patch | 71 +
SOURCES/gcc11-libgcc-link.patch | 57 +
SOURCES/gcc11-libgomp-omp_h-multilib.patch | 17 +
SOURCES/gcc11-libsanitizer-pthread.patch | 54 +
SOURCES/gcc11-libstdc++-docs.patch | 24 +
SOURCES/gcc11-libtool-no-rpath.patch | 27 +
SOURCES/gcc11-no-add-needed.patch | 37 +
SOURCES/gcc11-pie.patch | 886 ++++
SOURCES/gcc11-pr101786.patch | 66 +
SOURCES/gcc11-relocatable-pch.patch | 828 ++++
SOURCES/gcc11-rh1574936.patch | 30 +
SOURCES/gcc11-sparc-config-detection.patch | 40 +
SOURCES/gcc11-stringify-__VA_OPT__-2.patch | 197 +
SOURCES/gcc11-stringify-__VA_OPT__.patch | 307 ++
SPECS/gcc.spec | 3958 +++++++++++++++++
36 files changed, 14224 insertions(+)
create mode 100644 .gcc.metadata
create mode 100644 .gitignore
create mode 100644 SOURCES/gcc11-Wbidi-chars.patch
create mode 100644 SOURCES/gcc11-Wno-format-security.patch
create mode 100644 SOURCES/gcc11-bind-now.patch
create mode 100644 SOURCES/gcc11-d-shared-libphobos.patch
create mode 100644 SOURCES/gcc11-dejagnu-multiline.patch
create mode 100644 SOURCES/gcc11-dg-ice-fixes.patch
create mode 100644 SOURCES/gcc11-foffload-default.patch
create mode 100644 SOURCES/gcc11-fortran-fdec-add-missing-indexes.patch
create mode 100644 SOURCES/gcc11-fortran-fdec-duplicates.patch
create mode 100644 SOURCES/gcc11-fortran-fdec-ichar.patch
create mode 100644 SOURCES/gcc11-fortran-fdec-non-integer-index.patch
create mode 100644 SOURCES/gcc11-fortran-fdec-non-logical-if.patch
create mode 100644 SOURCES/gcc11-fortran-fdec-old-init.patch
create mode 100644 SOURCES/gcc11-fortran-fdec-override-kind.patch
create mode 100644 SOURCES/gcc11-fortran-fdec-promotion.patch
create mode 100644 SOURCES/gcc11-fortran-fdec-sequence.patch
create mode 100644 SOURCES/gcc11-fortran-flogical-as-integer.patch
create mode 100644 SOURCES/gcc11-hack.patch
create mode 100644 SOURCES/gcc11-isl-dl.patch
create mode 100644 SOURCES/gcc11-isl-dl2.patch
create mode 100644 SOURCES/gcc11-libgcc-link.patch
create mode 100644 SOURCES/gcc11-libgomp-omp_h-multilib.patch
create mode 100644 SOURCES/gcc11-libsanitizer-pthread.patch
create mode 100644 SOURCES/gcc11-libstdc++-docs.patch
create mode 100644 SOURCES/gcc11-libtool-no-rpath.patch
create mode 100644 SOURCES/gcc11-no-add-needed.patch
create mode 100644 SOURCES/gcc11-pie.patch
create mode 100644 SOURCES/gcc11-pr101786.patch
create mode 100644 SOURCES/gcc11-relocatable-pch.patch
create mode 100644 SOURCES/gcc11-rh1574936.patch
create mode 100644 SOURCES/gcc11-sparc-config-detection.patch
create mode 100644 SOURCES/gcc11-stringify-__VA_OPT__-2.patch
create mode 100644 SOURCES/gcc11-stringify-__VA_OPT__.patch
create mode 100644 SPECS/gcc.spec
diff --git a/.gcc.metadata b/.gcc.metadata
new file mode 100644
index 0000000..4f649ba
--- /dev/null
+++ b/.gcc.metadata
@@ -0,0 +1,4 @@
+54f8e112180f2cad6cf9459aab4681c7f157aca9 SOURCES/gcc-11.2.1-20220127.tar.xz
+bbffc5a2b05e4f0c97e882f96c448504491dc4ed SOURCES/isl-0.18.tar.bz2
+6ec33952e824e837fef0e829c93d39d6a507082f SOURCES/newlib-cygwin-50e2a63b04bdd018484605fbb954fd1bd5147fa0.tar.xz
+0e0c6f8d68ab0878f02287ac082c1077c831cd81 SOURCES/nvptx-tools-5f6f343a302d620b0868edab376c00b15741e39e.tar.xz
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..316ddb7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+SOURCES/gcc-11.2.1-20220127.tar.xz
+SOURCES/isl-0.18.tar.bz2
+SOURCES/newlib-cygwin-50e2a63b04bdd018484605fbb954fd1bd5147fa0.tar.xz
+SOURCES/nvptx-tools-5f6f343a302d620b0868edab376c00b15741e39e.tar.xz
diff --git a/SOURCES/gcc11-Wbidi-chars.patch b/SOURCES/gcc11-Wbidi-chars.patch
new file mode 100644
index 0000000..c2b4211
--- /dev/null
+++ b/SOURCES/gcc11-Wbidi-chars.patch
@@ -0,0 +1,1721 @@
+commit 51c500269bf53749b107807d84271385fad35628
+Author: Marek Polacek
+Date: Wed Oct 6 14:33:59 2021 -0400
+
+ libcpp: Implement -Wbidi-chars for CVE-2021-42574 [PR103026]
+
+ From a link below:
+ "An issue was discovered in the Bidirectional Algorithm in the Unicode
+ Specification through 14.0. It permits the visual reordering of
+ characters via control sequences, which can be used to craft source code
+ that renders different logic than the logical ordering of tokens
+ ingested by compilers and interpreters. Adversaries can leverage this to
+ encode source code for compilers accepting Unicode such that targeted
+ vulnerabilities are introduced invisibly to human reviewers."
+
+ More info:
+ https://nvd.nist.gov/vuln/detail/CVE-2021-42574
+ https://trojansource.codes/
+
+ This is not a compiler bug. However, to mitigate the problem, this patch
+ implements -Wbidi-chars=[none|unpaired|any] to warn about possibly
+ misleading Unicode bidirectional control characters the preprocessor may
+ encounter.
+
+ The default is =unpaired, which warns about improperly terminated
+ bidirectional control characters; e.g. a LRE without its corresponding PDF.
+ The level =any warns about any use of bidirectional control characters.
+
+ This patch handles both UCNs and UTF-8 characters. UCNs designating
+ bidi characters in identifiers are accepted since r204886. Then r217144
+ enabled -fextended-identifiers by default. Extended characters in C/C++
+ identifiers have been accepted since r275979. However, this patch still
+ warns about mixing UTF-8 and UCN bidi characters; there seems to be no
+ good reason to allow mixing them.
+
+ We warn in different contexts: comments (both C and C++-style), string
+ literals, character constants, and identifiers. Expectedly, UCNs are ignored
+ in comments and raw string literals. The bidirectional control characters
+ can nest so this patch handles that as well.
+
+ I have not included nor tested this at all with Fortran (which also has
+ string literals and line comments).
+
+ Dave M. posted patches improving diagnostic involving Unicode characters.
+ This patch does not make use of this new infrastructure yet.
+
+ PR preprocessor/103026
+
+ gcc/c-family/ChangeLog:
+
+ * c.opt (Wbidi-chars, Wbidi-chars=): New option.
+
+ gcc/ChangeLog:
+
+ * doc/invoke.texi: Document -Wbidi-chars.
+
+ libcpp/ChangeLog:
+
+ * include/cpplib.h (enum cpp_bidirectional_level): New.
+ (struct cpp_options): Add cpp_warn_bidirectional.
+ (enum cpp_warning_reason): Add CPP_W_BIDIRECTIONAL.
+ * internal.h (struct cpp_reader): Add warn_bidi_p member
+ function.
+ * init.c (cpp_create_reader): Set cpp_warn_bidirectional.
+ * lex.c (bidi): New namespace.
+ (get_bidi_utf8): New function.
+ (get_bidi_ucn): Likewise.
+ (maybe_warn_bidi_on_close): Likewise.
+ (maybe_warn_bidi_on_char): Likewise.
+ (_cpp_skip_block_comment): Implement warning about bidirectional
+ control characters.
+ (skip_line_comment): Likewise.
+ (forms_identifier_p): Likewise.
+ (lex_identifier): Likewise.
+ (lex_string): Likewise.
+ (lex_raw_string): Likewise.
+
+ gcc/testsuite/ChangeLog:
+
+ * c-c++-common/Wbidi-chars-1.c: New test.
+ * c-c++-common/Wbidi-chars-2.c: New test.
+ * c-c++-common/Wbidi-chars-3.c: New test.
+ * c-c++-common/Wbidi-chars-4.c: New test.
+ * c-c++-common/Wbidi-chars-5.c: New test.
+ * c-c++-common/Wbidi-chars-6.c: New test.
+ * c-c++-common/Wbidi-chars-7.c: New test.
+ * c-c++-common/Wbidi-chars-8.c: New test.
+ * c-c++-common/Wbidi-chars-9.c: New test.
+ * c-c++-common/Wbidi-chars-10.c: New test.
+ * c-c++-common/Wbidi-chars-11.c: New test.
+ * c-c++-common/Wbidi-chars-12.c: New test.
+ * c-c++-common/Wbidi-chars-13.c: New test.
+ * c-c++-common/Wbidi-chars-14.c: New test.
+ * c-c++-common/Wbidi-chars-15.c: New test.
+ * c-c++-common/Wbidi-chars-16.c: New test.
+ * c-c++-common/Wbidi-chars-17.c: New test.
+
+diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
+index 8a4cd634f77..3976fc368db 100644
+--- a/gcc/c-family/c.opt
++++ b/gcc/c-family/c.opt
+@@ -374,6 +374,30 @@ Wbad-function-cast
+ C ObjC Var(warn_bad_function_cast) Warning
+ Warn about casting functions to incompatible types.
+
++Wbidi-chars
++C ObjC C++ ObjC++ Warning Alias(Wbidi-chars=,any,none)
++;
++
++Wbidi-chars=
++C ObjC C++ ObjC++ RejectNegative Joined Warning CPP(cpp_warn_bidirectional) CppReason(CPP_W_BIDIRECTIONAL) Var(warn_bidirectional) Init(bidirectional_unpaired) Enum(cpp_bidirectional_level)
++-Wbidi-chars=[none|unpaired|any] Warn about UTF-8 bidirectional control characters.
++
++; Required for these enum values.
++SourceInclude
++cpplib.h
++
++Enum
++Name(cpp_bidirectional_level) Type(int) UnknownError(argument %qs to %<-Wbidi-chars%> not recognized)
++
++EnumValue
++Enum(cpp_bidirectional_level) String(none) Value(bidirectional_none)
++
++EnumValue
++Enum(cpp_bidirectional_level) String(unpaired) Value(bidirectional_unpaired)
++
++EnumValue
++Enum(cpp_bidirectional_level) String(any) Value(bidirectional_any)
++
+ Wbool-compare
+ C ObjC C++ ObjC++ Var(warn_bool_compare) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
+ Warn about boolean expression compared with an integer value different from true/false.
+diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
+index 6070288856c..a22758d18ee 100644
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -325,7 +325,9 @@ Objective-C and Objective-C++ Dialects}.
+ -Warith-conversion @gol
+ -Warray-bounds -Warray-bounds=@var{n} @gol
+ -Wno-attributes -Wattribute-alias=@var{n} -Wno-attribute-alias @gol
+--Wno-attribute-warning -Wbool-compare -Wbool-operation @gol
++-Wno-attribute-warning @gol
++-Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{]} @gol
++-Wbool-compare -Wbool-operation @gol
+ -Wno-builtin-declaration-mismatch @gol
+ -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
+ -Wc11-c2x-compat @gol
+@@ -7557,6 +7559,23 @@ Attributes considered include @code{alloc_align}, @code{alloc_size},
+ This is the default. You can disable these warnings with either
+ @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
+
++@item -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{]}
++@opindex Wbidi-chars=
++@opindex Wbidi-chars
++@opindex Wno-bidi-chars
++Warn about possibly misleading UTF-8 bidirectional control characters in
++comments, string literals, character constants, and identifiers. Such
++characters can change left-to-right writing direction into right-to-left
++(and vice versa), which can cause confusion between the logical order and
++visual order. This may be dangerous; for instance, it may seem that a piece
++of code is not commented out, whereas it in fact is.
++
++There are three levels of warning supported by GCC@. The default is
++@option{-Wbidi-chars=unpaired}, which warns about improperly terminated
++bidi contexts. @option{-Wbidi-chars=none} turns the warning off.
++@option{-Wbidi-chars=any} warns about any use of bidirectional control
++characters.
++
+ @item -Wbool-compare
+ @opindex Wno-bool-compare
+ @opindex Wbool-compare
+diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-1.c b/gcc/testsuite/c-c++-common/Wbidi-chars-1.c
+new file mode 100644
+index 00000000000..34f5ac19271
+--- /dev/null
++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-1.c
+@@ -0,0 +1,12 @@
++/* PR preprocessor/103026 */
++/* { dg-do compile } */
++
++int main() {
++ int isAdmin = 0;
++ /* } if (isAdmin) begin admins only */
++/* { dg-warning "bidirectional" "" { target *-*-* } .-1 } */
++ __builtin_printf("You are an admin.\n");
++ /* end admins only { */
++/* { dg-warning "bidirectional" "" { target *-*-* } .-1 } */
++ return 0;
++}
+diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-10.c b/gcc/testsuite/c-c++-common/Wbidi-chars-10.c
+new file mode 100644
+index 00000000000..3f851b69e65
+--- /dev/null
++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-10.c
+@@ -0,0 +1,27 @@
++/* PR preprocessor/103026 */
++/* { dg-do compile } */
++/* { dg-options "-Wbidi-chars=unpaired" } */
++/* More nesting testing. */
++
++/* RLE LRI PDF PDI*/
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int LRE_\u202a_PDF_\u202c;
++int LRE_\u202a_PDF_\u202c_LRE_\u202a_PDF_\u202c;
++int LRE_\u202a_LRI_\u2066_PDF_\u202c_PDI_\u2069;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int RLE_\u202b_RLI_\u2067_PDF_\u202c_PDI_\u2069;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int RLE_\u202b_RLI_\u2067_PDI_\u2069_PDF_\u202c;
++int FSI_\u2068_LRO_\u202d_PDI_\u2069_PDF_\u202c;
++int FSI_\u2068;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int FSI_\u2068_PDI_\u2069;
++int FSI_\u2068_FSI_\u2068_PDI_\u2069;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069;
++int RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDF_\u202c;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_FSI_\u2068_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
+diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-11.c b/gcc/testsuite/c-c++-common/Wbidi-chars-11.c
+new file mode 100644
+index 00000000000..270ce2368a9
+--- /dev/null
++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-11.c
+@@ -0,0 +1,13 @@
++/* PR preprocessor/103026 */
++/* { dg-do compile } */
++/* { dg-options "-Wbidi-chars=unpaired" } */
++/* Test that we warn when mixing UCN and UTF-8. */
++
++int LRE__PDF_\u202c;
++/* { dg-warning "mismatch" "" { target *-*-* } .-1 } */
++int LRE_\u202a_PDF__;
++/* { dg-warning "mismatch" "" { target *-*-* } .-1 } */
++const char *s1 = "LRE__PDF_\u202c";
++/* { dg-warning "mismatch" "" { target *-*-* } .-1 } */
++const char *s2 = "LRE_\u202a_PDF_";
++/* { dg-warning "mismatch" "" { target *-*-* } .-1 } */
+diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-12.c b/gcc/testsuite/c-c++-common/Wbidi-chars-12.c
+new file mode 100644
+index 00000000000..b07eec1da91
+--- /dev/null
++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-12.c
+@@ -0,0 +1,19 @@
++/* PR preprocessor/103026 */
++/* { dg-do compile { target { c || c++11 } } } */
++/* { dg-options "-Wbidi-chars=any" } */
++/* Test raw strings. */
++
++const char *s1 = R"(a b c LRE 1 2 3 PDF x y z)";
++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
++const char *s2 = R"(a b c RLE 1 2 3 PDF x y z)";
++/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */
++const char *s3 = R"(a b c LRO 1 2 3 PDF x y z)";
++/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */
++const char *s4 = R"(a b c RLO 1 2 3 PDF x y z)";
++/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */
++const char *s7 = R"(a b c FSI 1 2 3 PDI x y) z";
++/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */
++const char *s8 = R"(a b c PDI x y )z";
++/* { dg-warning "U\\+2069" "" { target *-*-* } .-1 } */
++const char *s9 = R"(a b c PDF x y z)";
++/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */
+diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-13.c b/gcc/testsuite/c-c++-common/Wbidi-chars-13.c
+new file mode 100644
+index 00000000000..b2dd9fde752
+--- /dev/null
++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-13.c
+@@ -0,0 +1,17 @@
++/* PR preprocessor/103026 */
++/* { dg-do compile { target { c || c++11 } } } */
++/* { dg-options "-Wbidi-chars=unpaired" } */
++/* Test raw strings. */
++
++const char *s1 = R"(a b c LRE 1 2 3)";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++const char *s2 = R"(a b c RLE 1 2 3)";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++const char *s3 = R"(a b c LRO 1 2 3)";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++const char *s4 = R"(a b c FSI 1 2 3)";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++const char *s5 = R"(a b c LRI 1 2 3)";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++const char *s6 = R"(a b c RLI 1 2 3)";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
+diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-14.c b/gcc/testsuite/c-c++-common/Wbidi-chars-14.c
+new file mode 100644
+index 00000000000..ba5f75d9553
+--- /dev/null
++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-14.c
+@@ -0,0 +1,38 @@
++/* PR preprocessor/103026 */
++/* { dg-do compile } */
++/* { dg-options "-Wbidi-chars=unpaired" } */
++/* Test PDI handling, which also pops any subsequent LREs, RLEs, LROs,
++ or RLOs. */
++
++/* LRI__LRI__RLE__RLE__RLE__PDI_*/
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++// LRI__RLE__RLE__RLE__PDI_
++// LRI__RLO__RLE__RLE__PDI_
++// LRI__RLO__RLE__PDI_
++// FSI__RLO__PDI_
++// FSI__FSI__RLO__PDI_
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++
++int LRI_\u2066_LRI_\u2066_LRE_\u202a_LRE_\u202a_LRE_\u202a_PDI_\u2069;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int LRI_\u2066_LRI_\u2066_LRE_\u202a_LRE_\u202a_LRE_\u202a_PDI_\u2069_PDI_\u2069;
++int LRI_\u2066_LRI_\u2066_LRI_\u2066_LRE_\u202a_LRE_\u202a_LRE_\u202a_PDI_\u2069_PDI_\u2069;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int PDI_\u2069;
++int LRI_\u2066_PDI_\u2069;
++int RLI_\u2067_PDI_\u2069;
++int LRE_\u202a_LRI_\u2066_PDI_\u2069;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int LRI_\u2066_LRE_\u202a_PDF_\u202c_PDI_\u2069;
++int LRI_\u2066_LRE_\u202a_LRE_\u202a_PDF_\u202c_PDI_\u2069;
++int RLI_\u2067_LRI_\u2066_LRE_\u202a_LRE_\u202a_PDF_\u202c_PDI_\u2069;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int FSI_\u2068_LRI_\u2066_LRE_\u202a_LRE_\u202a_PDF_\u202c_PDI_\u2069;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int RLO_\u202e_PDI_\u2069;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int RLI_\u2067_PDI_\u2069_RLI_\u2067;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int FSI_\u2068_PDF_\u202c_PDI_\u2069;
++int FSI_\u2068_FSI_\u2068_PDF_\u202c_PDI_\u2069;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
+diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-15.c b/gcc/testsuite/c-c++-common/Wbidi-chars-15.c
+new file mode 100644
+index 00000000000..a0ce8ff5e2c
+--- /dev/null
++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-15.c
+@@ -0,0 +1,59 @@
++/* PR preprocessor/103026 */
++/* { dg-do compile } */
++/* { dg-options "-Wbidi-chars=unpaired" } */
++/* Test unpaired bidi control chars in multiline comments. */
++
++/*
++ * LRE end
++ */
++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
++/*
++ * RLE end
++ */
++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
++/*
++ * LRO end
++ */
++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
++/*
++ * RLO end
++ */
++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
++/*
++ * LRI end
++ */
++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
++/*
++ * RLI end
++ */
++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
++/*
++ * FSI end
++ */
++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
++/* LRE
++ PDF */
++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
++/* FSI
++ PDI */
++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
++
++/* LRE<>
++ *
++ */
++/* { dg-warning "unpaired" "" { target *-*-* } .-3 } */
++
++/*
++ * LRE<>
++ */
++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
++
++/*
++ *
++ * LRE<> */
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++
++/* RLI<> */ /* PDI<> */
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++/* LRE<> */ /* PDF<> */
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
+diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-16.c b/gcc/testsuite/c-c++-common/Wbidi-chars-16.c
+new file mode 100644
+index 00000000000..baa0159861c
+--- /dev/null
++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-16.c
+@@ -0,0 +1,26 @@
++/* PR preprocessor/103026 */
++/* { dg-do compile } */
++/* { dg-options "-Wbidi-chars=any" } */
++/* Test LTR/RTL chars. */
++
++/* LTR<> */
++/* { dg-warning "U\\+200E" "" { target *-*-* } .-1 } */
++// LTR<>
++/* { dg-warning "U\\+200E" "" { target *-*-* } .-1 } */
++/* RTL<> */
++/* { dg-warning "U\\+200F" "" { target *-*-* } .-1 } */
++// RTL<>
++/* { dg-warning "U\\+200F" "" { target *-*-* } .-1 } */
++
++const char *s1 = "LTR<>";
++/* { dg-warning "U\\+200E" "" { target *-*-* } .-1 } */
++const char *s2 = "LTR\u200e";
++/* { dg-warning "U\\+200E" "" { target *-*-* } .-1 } */
++const char *s3 = "LTR\u200E";
++/* { dg-warning "U\\+200E" "" { target *-*-* } .-1 } */
++const char *s4 = "RTL<>";
++/* { dg-warning "U\\+200F" "" { target *-*-* } .-1 } */
++const char *s5 = "RTL\u200f";
++/* { dg-warning "U\\+200F" "" { target *-*-* } .-1 } */
++const char *s6 = "RTL\u200F";
++/* { dg-warning "U\\+200F" "" { target *-*-* } .-1 } */
+diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-17.c b/gcc/testsuite/c-c++-common/Wbidi-chars-17.c
+new file mode 100644
+index 00000000000..07cb4321f96
+--- /dev/null
++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-17.c
+@@ -0,0 +1,30 @@
++/* PR preprocessor/103026 */
++/* { dg-do compile } */
++/* { dg-options "-Wbidi-chars=unpaired" } */
++/* Test LTR/RTL chars. */
++
++/* LTR<> */
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++// LTR<>
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++/* RTL<> */
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++// RTL<>
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++int ltr_\u200e;
++/* { dg-error "universal character " "" { target *-*-* } .-1 } */
++int rtl_\u200f;
++/* { dg-error "universal character " "" { target *-*-* } .-1 } */
++
++const char *s1 = "LTR<>";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++const char *s2 = "LTR\u200e";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++const char *s3 = "LTR\u200E";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++const char *s4 = "RTL<>";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++const char *s5 = "RTL\u200f";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++const char *s6 = "RTL\u200F";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
+diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-2.c b/gcc/testsuite/c-c++-common/Wbidi-chars-2.c
+new file mode 100644
+index 00000000000..2340374f276
+--- /dev/null
++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-2.c
+@@ -0,0 +1,9 @@
++/* PR preprocessor/103026 */
++/* { dg-do compile } */
++
++int main() {
++ /* Say hello; newline/*/ return 0 ;
++/* { dg-warning "bidirectional" "" { target *-*-* } .-1 } */
++ __builtin_printf("Hello world.\n");
++ return 0;
++}
+diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-3.c b/gcc/testsuite/c-c++-common/Wbidi-chars-3.c
+new file mode 100644
+index 00000000000..9dc7edb6e64
+--- /dev/null
++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-3.c
+@@ -0,0 +1,11 @@
++/* PR preprocessor/103026 */
++/* { dg-do compile } */
++
++int main() {
++ const char* access_level = "user";
++ if (__builtin_strcmp(access_level, "user // Check if admin ")) {
++/* { dg-warning "bidirectional" "" { target *-*-* } .-1 } */
++ __builtin_printf("You are an admin.\n");
++ }
++ return 0;
++}
+diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-4.c b/gcc/testsuite/c-c++-common/Wbidi-chars-4.c
+new file mode 100644
+index 00000000000..639e5c62e88
+--- /dev/null
++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-4.c
+@@ -0,0 +1,188 @@
++/* PR preprocessor/103026 */
++/* { dg-do compile } */
++/* { dg-options "-Wbidi-chars=any -Wno-multichar -Wno-overflow" } */
++/* Test all bidi chars in various contexts (identifiers, comments,
++ string literals, character constants), both UCN and UTF-8. The bidi
++ chars here are properly terminated, except for the character constants. */
++
++/* a b c LRE 1 2 3 PDF x y z */
++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
++/* a b c RLE 1 2 3 PDF x y z */
++/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */
++/* a b c LRO 1 2 3 PDF x y z */
++/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */
++/* a b c RLO 1 2 3 PDF x y z */
++/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */
++/* a b c LRI 1 2 3 PDI x y z */
++/* { dg-warning "U\\+2066" "" { target *-*-* } .-1 } */
++/* a b c RLI 1 2 3 PDI x y */
++/* { dg-warning "U\\+2067" "" { target *-*-* } .-1 } */
++/* a b c FSI 1 2 3 PDI x y z */
++/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */
++
++/* Same but C++ comments instead. */
++// a b c LRE 1 2 3 PDF x y z
++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
++// a b c RLE 1 2 3 PDF x y z
++/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */
++// a b c LRO 1 2 3 PDF x y z
++/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */
++// a b c RLO 1 2 3 PDF x y z
++/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */
++// a b c LRI 1 2 3 PDI x y z
++/* { dg-warning "U\\+2066" "" { target *-*-* } .-1 } */
++// a b c RLI 1 2 3 PDI x y
++/* { dg-warning "U\\+2067" "" { target *-*-* } .-1 } */
++// a b c FSI 1 2 3 PDI x y z
++/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */
++
++/* Here we're closing an unopened context, warn when =any. */
++/* a b c PDI x y z */
++/* { dg-warning "U\\+2069" "" { target *-*-* } .-1 } */
++/* a b c PDF x y z */
++/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */
++// a b c PDI x y z
++/* { dg-warning "U\\+2069" "" { target *-*-* } .-1 } */
++// a b c PDF x y z
++/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */
++
++/* Multiline comments. */
++/* a b c PDI x y z
++ */
++/* { dg-warning "U\\+2069" "" { target *-*-* } .-2 } */
++/* a b c PDF x y z
++ */
++/* { dg-warning "U\\+202C" "" { target *-*-* } .-2 } */
++/* first
++ a b c PDI x y z
++ */
++/* { dg-warning "U\\+2069" "" { target *-*-* } .-2 } */
++/* first
++ a b c PDF x y z
++ */
++/* { dg-warning "U\\+202C" "" { target *-*-* } .-2 } */
++/* first
++ a b c PDI x y z */
++/* { dg-warning "U\\+2069" "" { target *-*-* } .-1 } */
++/* first
++ a b c PDF x y z */
++/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */
++
++void
++g1 ()
++{
++ const char *s1 = "a b c LRE 1 2 3 PDF x y z";
++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
++ const char *s2 = "a b c RLE 1 2 3 PDF x y z";
++/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */
++ const char *s3 = "a b c LRO 1 2 3 PDF x y z";
++/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */
++ const char *s4 = "a b c RLO 1 2 3 PDF x y z";
++/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */
++ const char *s5 = "a b c LRI 1 2 3 PDI x y z";
++/* { dg-warning "U\\+2066" "" { target *-*-* } .-1 } */
++ const char *s6 = "a b c RLI 1 2 3 PDI x y z";
++/* { dg-warning "U\\+2067" "" { target *-*-* } .-1 } */
++ const char *s7 = "a b c FSI 1 2 3 PDI x y z";
++/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */
++ const char *s8 = "a b c PDI x y z";
++/* { dg-warning "U\\+2069" "" { target *-*-* } .-1 } */
++ const char *s9 = "a b c PDF x y z";
++/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */
++
++ const char *s10 = "a b c LRE\u202a 1 2 3 PDF\u202c x y z";
++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
++ const char *s11 = "a b c LRE\u202A 1 2 3 PDF\u202c x y z";
++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
++ const char *s12 = "a b c RLE\u202b 1 2 3 PDF\u202c x y z";
++/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */
++ const char *s13 = "a b c RLE\u202B 1 2 3 PDF\u202c x y z";
++/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */
++ const char *s14 = "a b c LRO\u202d 1 2 3 PDF\u202c x y z";
++/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */
++ const char *s15 = "a b c LRO\u202D 1 2 3 PDF\u202c x y z";
++/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */
++ const char *s16 = "a b c RLO\u202e 1 2 3 PDF\u202c x y z";
++/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */
++ const char *s17 = "a b c RLO\u202E 1 2 3 PDF\u202c x y z";
++/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */
++ const char *s18 = "a b c LRI\u2066 1 2 3 PDI\u2069 x y z";
++/* { dg-warning "U\\+2066" "" { target *-*-* } .-1 } */
++ const char *s19 = "a b c RLI\u2067 1 2 3 PDI\u2069 x y z";
++/* { dg-warning "U\\+2067" "" { target *-*-* } .-1 } */
++ const char *s20 = "a b c FSI\u2068 1 2 3 PDI\u2069 x y z";
++/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */
++}
++
++void
++g2 ()
++{
++ const char c1 = '\u202a';
++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
++ const char c2 = '\u202A';
++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
++ const char c3 = '\u202b';
++/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */
++ const char c4 = '\u202B';
++/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */
++ const char c5 = '\u202d';
++/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */
++ const char c6 = '\u202D';
++/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */
++ const char c7 = '\u202e';
++/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */
++ const char c8 = '\u202E';
++/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */
++ const char c9 = '\u2066';
++/* { dg-warning "U\\+2066" "" { target *-*-* } .-1 } */
++ const char c10 = '\u2067';
++/* { dg-warning "U\\+2067" "" { target *-*-* } .-1 } */
++ const char c11 = '\u2068';
++/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */
++}
++
++int abc;
++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
++int abc;
++/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */
++int abc;
++/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */
++int abc;
++/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */
++int abc;
++/* { dg-warning "U\\+2066" "" { target *-*-* } .-1 } */
++int abc;
++/* { dg-warning "U\\+2067" "" { target *-*-* } .-1 } */
++int abc;
++/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */
++int AX;
++/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */
++int A\u202cY;
++/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */
++int A\u202CY2;
++/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */
++
++int d\u202ae\u202cf;
++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
++int d\u202Ae\u202cf2;
++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
++int d\u202be\u202cf;
++/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */
++int d\u202Be\u202cf2;
++/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */
++int d\u202de\u202cf;
++/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */
++int d\u202De\u202cf2;
++/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */
++int d\u202ee\u202cf;
++/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */
++int d\u202Ee\u202cf2;
++/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */
++int d\u2066e\u2069f;
++/* { dg-warning "U\\+2066" "" { target *-*-* } .-1 } */
++int d\u2067e\u2069f;
++/* { dg-warning "U\\+2067" "" { target *-*-* } .-1 } */
++int d\u2068e\u2069f;
++/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */
++int X\u2069;
++/* { dg-warning "U\\+2069" "" { target *-*-* } .-1 } */
+diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-5.c b/gcc/testsuite/c-c++-common/Wbidi-chars-5.c
+new file mode 100644
+index 00000000000..68cb053144b
+--- /dev/null
++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-5.c
+@@ -0,0 +1,188 @@
++/* PR preprocessor/103026 */
++/* { dg-do compile } */
++/* { dg-options "-Wbidi-chars=unpaired -Wno-multichar -Wno-overflow" } */
++/* Test all bidi chars in various contexts (identifiers, comments,
++ string literals, character constants), both UCN and UTF-8. The bidi
++ chars here are properly terminated, except for the character constants. */
++
++/* a b c LRE 1 2 3 PDF x y z */
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++/* a b c RLE 1 2 3 PDF x y z */
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++/* a b c LRO 1 2 3 PDF x y z */
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++/* a b c RLO 1 2 3 PDF x y z */
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++/* a b c LRI 1 2 3 PDI x y z */
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++/* a b c RLI 1 2 3 PDI x y */
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++/* a b c FSI 1 2 3 PDI x y z */
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++
++/* Same but C++ comments instead. */
++// a b c LRE 1 2 3 PDF x y z
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++// a b c RLE 1 2 3 PDF x y z
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++// a b c LRO 1 2 3 PDF x y z
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++// a b c RLO 1 2 3 PDF x y z
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++// a b c LRI 1 2 3 PDI x y z
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++// a b c RLI 1 2 3 PDI x y
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++// a b c FSI 1 2 3 PDI x y z
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++
++/* Here we're closing an unopened context, warn when =any. */
++/* a b c PDI x y z */
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++/* a b c PDF x y z */
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++// a b c PDI x y z
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++// a b c PDF x y z
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++
++/* Multiline comments. */
++/* a b c PDI x y z
++ */
++/* { dg-bogus "unpaired" "" { target *-*-* } .-2 } */
++/* a b c PDF x y z
++ */
++/* { dg-bogus "unpaired" "" { target *-*-* } .-2 } */
++/* first
++ a b c PDI x y z
++ */
++/* { dg-bogus "unpaired" "" { target *-*-* } .-2 } */
++/* first
++ a b c PDF x y z
++ */
++/* { dg-bogus "unpaired" "" { target *-*-* } .-2 } */
++/* first
++ a b c PDI x y z */
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++/* first
++ a b c PDF x y z */
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++
++void
++g1 ()
++{
++ const char *s1 = "a b c LRE 1 2 3 PDF x y z";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++ const char *s2 = "a b c RLE 1 2 3 PDF x y z";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++ const char *s3 = "a b c LRO 1 2 3 PDF x y z";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++ const char *s4 = "a b c RLO 1 2 3 PDF x y z";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++ const char *s5 = "a b c LRI 1 2 3 PDI x y z";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++ const char *s6 = "a b c RLI 1 2 3 PDI x y z";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++ const char *s7 = "a b c FSI 1 2 3 PDI x y z";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++ const char *s8 = "a b c PDI x y z";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++ const char *s9 = "a b c PDF x y z";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++
++ const char *s10 = "a b c LRE\u202a 1 2 3 PDF\u202c x y z";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++ const char *s11 = "a b c LRE\u202A 1 2 3 PDF\u202c x y z";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++ const char *s12 = "a b c RLE\u202b 1 2 3 PDF\u202c x y z";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++ const char *s13 = "a b c RLE\u202B 1 2 3 PDF\u202c x y z";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++ const char *s14 = "a b c LRO\u202d 1 2 3 PDF\u202c x y z";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++ const char *s15 = "a b c LRO\u202D 1 2 3 PDF\u202c x y z";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++ const char *s16 = "a b c RLO\u202e 1 2 3 PDF\u202c x y z";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++ const char *s17 = "a b c RLO\u202E 1 2 3 PDF\u202c x y z";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++ const char *s18 = "a b c LRI\u2066 1 2 3 PDI\u2069 x y z";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++ const char *s19 = "a b c RLI\u2067 1 2 3 PDI\u2069 x y z";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++ const char *s20 = "a b c FSI\u2068 1 2 3 PDI\u2069 x y z";
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++}
++
++void
++g2 ()
++{
++ const char c1 = '\u202a';
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char c2 = '\u202A';
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char c3 = '\u202b';
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char c4 = '\u202B';
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char c5 = '\u202d';
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char c6 = '\u202D';
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char c7 = '\u202e';
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char c8 = '\u202E';
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char c9 = '\u2066';
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char c10 = '\u2067';
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char c11 = '\u2068';
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++}
++
++int abc;
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++int abc;
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++int abc;
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++int abc;
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++int abc;
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++int abc;
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++int abc;
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++int AX;
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++int A\u202cY;
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++int A\u202CY2;
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++
++int d\u202ae\u202cf;
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++int d\u202Ae\u202cf2;
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++int d\u202be\u202cf;
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++int d\u202Be\u202cf2;
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++int d\u202de\u202cf;
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++int d\u202De\u202cf2;
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++int d\u202ee\u202cf;
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++int d\u202Ee\u202cf2;
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++int d\u2066e\u2069f;
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++int d\u2067e\u2069f;
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++int d\u2068e\u2069f;
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
++int X\u2069;
++/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
+diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-6.c b/gcc/testsuite/c-c++-common/Wbidi-chars-6.c
+new file mode 100644
+index 00000000000..0ce6fff2dee
+--- /dev/null
++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-6.c
+@@ -0,0 +1,155 @@
++/* PR preprocessor/103026 */
++/* { dg-do compile } */
++/* { dg-options "-Wbidi-chars=unpaired" } */
++/* Test nesting of bidi chars in various contexts. */
++
++/* Terminated by the wrong char: */
++/* a b c LRE 1 2 3 PDI x y z */
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++/* a b c RLE 1 2 3 PDI x y z*/
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++/* a b c LRO 1 2 3 PDI x y z */
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++/* a b c RLO 1 2 3 PDI x y z */
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++/* a b c LRI 1 2 3 PDF x y z */
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++/* a b c RLI 1 2 3 PDF x y z */
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++/* a b c FSI 1 2 3 PDF x y z*/
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++
++/* LRE PDF */
++/* LRE LRE PDF PDF */
++/* PDF LRE PDF */
++/* LRE PDF LRE PDF */
++/* LRE LRE PDF */
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++/* PDF LRE */
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++
++// a b c LRE 1 2 3 PDI x y z
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++// a b c RLE 1 2 3 PDI x y z*/
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++// a b c LRO 1 2 3 PDI x y z
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++// a b c RLO 1 2 3 PDI x y z
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++// a b c LRI 1 2 3 PDF x y z
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++// a b c RLI 1 2 3 PDF x y z
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++// a b c FSI 1 2 3 PDF x y z
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++
++// LRE PDF
++// LRE LRE PDF PDF
++// PDF LRE PDF
++// LRE PDF LRE PDF
++// LRE LRE PDF
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++// PDF LRE
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++
++void
++g1 ()
++{
++ const char *s1 = "a b c LRE 1 2 3 PDI x y z";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char *s2 = "a b c LRE\u202a 1 2 3 PDI\u2069 x y z";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char *s3 = "a b c RLE 1 2 3 PDI x y ";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char *s4 = "a b c RLE\u202b 1 2 3 PDI\u2069 x y z";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char *s5 = "a b c LRO 1 2 3 PDI x y z";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char *s6 = "a b c LRO\u202d 1 2 3 PDI\u2069 x y z";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char *s7 = "a b c RLO 1 2 3 PDI x y z";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char *s8 = "a b c RLO\u202e 1 2 3 PDI\u2069 x y z";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char *s9 = "a b c LRI 1 2 3 PDF x y z";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char *s10 = "a b c LRI\u2066 1 2 3 PDF\u202c x y z";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char *s11 = "a b c RLI 1 2 3 PDF x y z\
++ ";
++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
++ const char *s12 = "a b c RLI\u2067 1 2 3 PDF\u202c x y z";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char *s13 = "a b c FSI 1 2 3 PDF x y z";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char *s14 = "a b c FSI\u2068 1 2 3 PDF\u202c x y z";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char *s15 = "PDF LRE";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char *s16 = "PDF\u202c LRE\u202a";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char *s17 = "LRE PDF";
++ const char *s18 = "LRE\u202a PDF\u202c";
++ const char *s19 = "LRE LRE PDF PDF";
++ const char *s20 = "LRE\u202a LRE\u202a PDF\u202c PDF\u202c";
++ const char *s21 = "PDF LRE PDF";
++ const char *s22 = "PDF\u202c LRE\u202a PDF\u202c";
++ const char *s23 = "LRE LRE PDF";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char *s24 = "LRE\u202a LRE\u202a PDF\u202c";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char *s25 = "PDF LRE";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char *s26 = "PDF\u202c LRE\u202a";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char *s27 = "PDF LRE\u202a";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++ const char *s28 = "PDF\u202c LRE";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++}
++
++int aLREbPDI;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int A\u202aB\u2069C;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int aRLEbPDI;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int a\u202bB\u2069c;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int aLRObPDI;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int a\u202db\u2069c2;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int aRLObPDI;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int a\u202eb\u2069;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int aLRIbPDF;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int a\u2066b\u202c;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int aRLIbPDFc
++;
++/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
++int a\u2067b\u202c;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int aFSIbPDF;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int a\u2068b\u202c;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int aFSIbPD\u202C;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int aFSI\u2068bPDF_;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int aLREbPDFb;
++int A\u202aB\u202c;
++int a_LRE_LRE_b_PDF_PDF;
++int A\u202aA\u202aB\u202cB\u202c;
++int aPDFbLREadPDF;
++int a_\u202C_\u202a_\u202c;
++int a_LRE_b_PDF_c_LRE_PDF;
++int a_\u202a_\u202c_\u202a_\u202c_;
++int a_LRE_b_PDF_c_LRE;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int a_\u202a_\u202c_\u202a_;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
+diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-7.c b/gcc/testsuite/c-c++-common/Wbidi-chars-7.c
+new file mode 100644
+index 00000000000..d012d420ec0
+--- /dev/null
++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-7.c
+@@ -0,0 +1,9 @@
++/* PR preprocessor/103026 */
++/* { dg-do compile } */
++/* { dg-options "-Wbidi-chars=any" } */
++/* Test we ignore UCNs in comments. */
++
++// a b c \u202a 1 2 3
++// a b c \u202A 1 2 3
++/* a b c \u202a 1 2 3 */
++/* a b c \u202A 1 2 3 */
+diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-8.c b/gcc/testsuite/c-c++-common/Wbidi-chars-8.c
+new file mode 100644
+index 00000000000..4f54c5092ec
+--- /dev/null
++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-8.c
+@@ -0,0 +1,13 @@
++/* PR preprocessor/103026 */
++/* { dg-do compile } */
++/* { dg-options "-Wbidi-chars=any" } */
++/* Test \u vs \U. */
++
++int a_\u202A;
++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
++int a_\u202a_2;
++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
++int a_\U0000202A_3;
++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
++int a_\U0000202a_4;
++/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
+diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-9.c b/gcc/testsuite/c-c++-common/Wbidi-chars-9.c
+new file mode 100644
+index 00000000000..e2af1b1ca97
+--- /dev/null
++++ b/gcc/testsuite/c-c++-common/Wbidi-chars-9.c
+@@ -0,0 +1,29 @@
++/* PR preprocessor/103026 */
++/* { dg-do compile } */
++/* { dg-options "-Wbidi-chars=unpaired" } */
++/* Test that we properly separate bidi contexts (comment/identifier/character
++ constant/string literal). */
++
++/* LRE -><- */ int pdf_\u202c_1;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++/* RLE -><- */ int pdf_\u202c_2;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++/* LRO -><- */ int pdf_\u202c_3;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++/* RLO -><- */ int pdf_\u202c_4;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++/* LRI -><-*/ int pdi_\u2069_1;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++/* RLI -><- */ int pdi_\u2069_12;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++/* FSI -><- */ int pdi_\u2069_3;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++
++const char *s1 = "LRE\u202a"; /* PDF -><- */
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++/* LRE -><- */ const char *s2 = "PDF\u202c";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++const char *s3 = "LRE\u202a"; int pdf_\u202c_5;
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
++int lre_\u202a; const char *s4 = "PDF\u202c";
++/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
+diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
+index 176f8c5bbce..112b9c24751 100644
+--- a/libcpp/include/cpplib.h
++++ b/libcpp/include/cpplib.h
+@@ -319,6 +319,17 @@ enum cpp_main_search
+ CMS_system, /* Search the system INCLUDE path. */
+ };
+
++/* The possible bidirectional control characters checking levels, from least
++ restrictive to most. */
++enum cpp_bidirectional_level {
++ /* No checking. */
++ bidirectional_none,
++ /* Only detect unpaired uses of bidirectional control characters. */
++ bidirectional_unpaired,
++ /* Detect any use of bidirectional control characters. */
++ bidirectional_any
++};
++
+ /* This structure is nested inside struct cpp_reader, and
+ carries all the options visible to the command line. */
+ struct cpp_options
+@@ -539,6 +550,10 @@ struct cpp_options
+ /* True if warn about differences between C++98 and C++11. */
+ bool cpp_warn_cxx11_compat;
+
++ /* Nonzero if bidirectional control characters checking is on. See enum
++ cpp_bidirectional_level. */
++ unsigned char cpp_warn_bidirectional;
++
+ /* Dependency generation. */
+ struct
+ {
+@@ -643,7 +658,8 @@ enum cpp_warning_reason {
+ CPP_W_C90_C99_COMPAT,
+ CPP_W_C11_C2X_COMPAT,
+ CPP_W_CXX11_COMPAT,
+- CPP_W_EXPANSION_TO_DEFINED
++ CPP_W_EXPANSION_TO_DEFINED,
++ CPP_W_BIDIRECTIONAL
+ };
+
+ /* Callback for header lookup for HEADER, which is the name of a
+diff --git a/libcpp/init.c b/libcpp/init.c
+index 5a424e23553..f9a8f5f088f 100644
+--- a/libcpp/init.c
++++ b/libcpp/init.c
+@@ -223,6 +223,7 @@ cpp_create_reader (enum c_lang lang, cpp_hash_table *table,
+ = ENABLE_CANONICAL_SYSTEM_HEADERS;
+ CPP_OPTION (pfile, ext_numeric_literals) = 1;
+ CPP_OPTION (pfile, warn_date_time) = 0;
++ CPP_OPTION (pfile, cpp_warn_bidirectional) = bidirectional_unpaired;
+
+ /* Default CPP arithmetic to something sensible for the host for the
+ benefit of dumb users like fix-header. */
+diff --git a/libcpp/internal.h b/libcpp/internal.h
+index 8577cab6c83..0ce0246c5a2 100644
+--- a/libcpp/internal.h
++++ b/libcpp/internal.h
+@@ -597,6 +597,13 @@ struct cpp_reader
+ /* Location identifying the main source file -- intended to be line
+ zero of said file. */
+ location_t main_loc;
++
++ /* Returns true iff we should warn about UTF-8 bidirectional control
++ characters. */
++ bool warn_bidi_p () const
++ {
++ return CPP_OPTION (this, cpp_warn_bidirectional) != bidirectional_none;
++ }
+ };
+
+ /* Character classes. Based on the more primitive macros in safe-ctype.h.
+diff --git a/libcpp/lex.c b/libcpp/lex.c
+index fa2253d41c3..6a4fbce6030 100644
+--- a/libcpp/lex.c
++++ b/libcpp/lex.c
+@@ -1164,6 +1164,324 @@ _cpp_process_line_notes (cpp_reader *pfile, int in_comment)
+ }
+ }
+
++namespace bidi {
++ enum class kind {
++ NONE, LRE, RLE, LRO, RLO, LRI, RLI, FSI, PDF, PDI, LTR, RTL
++ };
++
++ /* All the UTF-8 encodings of bidi characters start with E2. */
++ constexpr uchar utf8_start = 0xe2;
++
++ /* A vector holding currently open bidi contexts. We use a char for
++ each context, its LSB is 1 if it represents a PDF context, 0 if it
++ represents a PDI context. The next bit is 1 if this context was open
++ by a bidi character written as a UCN, and 0 when it was UTF-8. */
++ semi_embedded_vec vec;
++
++ /* Close the whole comment/identifier/string literal/character constant
++ context. */
++ void on_close ()
++ {
++ vec.truncate (0);
++ }
++
++ /* Pop the last element in the vector. */
++ void pop ()
++ {
++ unsigned int len = vec.count ();
++ gcc_checking_assert (len > 0);
++ vec.truncate (len - 1);
++ }
++
++ /* Return the context of the Ith element. */
++ kind ctx_at (unsigned int i)
++ {
++ return (vec[i] & 1) ? kind::PDF : kind::PDI;
++ }
++
++ /* Return which context is currently opened. */
++ kind current_ctx ()
++ {
++ unsigned int len = vec.count ();
++ if (len == 0)
++ return kind::NONE;
++ return ctx_at (len - 1);
++ }
++
++ /* Return true if the current context comes from a UCN origin, that is,
++ the bidi char which started this bidi context was written as a UCN. */
++ bool current_ctx_ucn_p ()
++ {
++ unsigned int len = vec.count ();
++ gcc_checking_assert (len > 0);
++ return (vec[len - 1] >> 1) & 1;
++ }
++
++ /* We've read a bidi char, update the current vector as necessary. */
++ void on_char (kind k, bool ucn_p)
++ {
++ switch (k)
++ {
++ case kind::LRE:
++ case kind::RLE:
++ case kind::LRO:
++ case kind::RLO:
++ vec.push (ucn_p ? 3u : 1u);
++ break;
++ case kind::LRI:
++ case kind::RLI:
++ case kind::FSI:
++ vec.push (ucn_p ? 2u : 0u);
++ break;
++ /* PDF terminates the scope of the last LRE, RLE, LRO, or RLO
++ whose scope has not yet been terminated. */
++ case kind::PDF:
++ if (current_ctx () == kind::PDF)
++ pop ();
++ break;
++ /* PDI terminates the scope of the last LRI, RLI, or FSI whose
++ scope has not yet been terminated, as well as the scopes of
++ any subsequent LREs, RLEs, LROs, or RLOs whose scopes have not
++ yet been terminated. */
++ case kind::PDI:
++ for (int i = vec.count () - 1; i >= 0; --i)
++ if (ctx_at (i) == kind::PDI)
++ {
++ vec.truncate (i);
++ break;
++ }
++ break;
++ case kind::LTR:
++ case kind::RTL:
++ /* These aren't popped by a PDF/PDI. */
++ break;
++ [[likely]] case kind::NONE:
++ break;
++ default:
++ abort ();
++ }
++ }
++
++ /* Return a descriptive string for K. */
++ const char *to_str (kind k)
++ {
++ switch (k)
++ {
++ case kind::LRE:
++ return "U+202A (LEFT-TO-RIGHT EMBEDDING)";
++ case kind::RLE:
++ return "U+202B (RIGHT-TO-LEFT EMBEDDING)";
++ case kind::LRO:
++ return "U+202D (LEFT-TO-RIGHT OVERRIDE)";
++ case kind::RLO:
++ return "U+202E (RIGHT-TO-LEFT OVERRIDE)";
++ case kind::LRI:
++ return "U+2066 (LEFT-TO-RIGHT ISOLATE)";
++ case kind::RLI:
++ return "U+2067 (RIGHT-TO-LEFT ISOLATE)";
++ case kind::FSI:
++ return "U+2068 (FIRST STRONG ISOLATE)";
++ case kind::PDF:
++ return "U+202C (POP DIRECTIONAL FORMATTING)";
++ case kind::PDI:
++ return "U+2069 (POP DIRECTIONAL ISOLATE)";
++ case kind::LTR:
++ return "U+200E (LEFT-TO-RIGHT MARK)";
++ case kind::RTL:
++ return "U+200F (RIGHT-TO-LEFT MARK)";
++ default:
++ abort ();
++ }
++ }
++}
++
++/* Parse a sequence of 3 bytes starting with P and return its bidi code. */
++
++static bidi::kind
++get_bidi_utf8 (const unsigned char *const p)
++{
++ gcc_checking_assert (p[0] == bidi::utf8_start);
++
++ if (p[1] == 0x80)
++ switch (p[2])
++ {
++ case 0xaa:
++ return bidi::kind::LRE;
++ case 0xab:
++ return bidi::kind::RLE;
++ case 0xac:
++ return bidi::kind::PDF;
++ case 0xad:
++ return bidi::kind::LRO;
++ case 0xae:
++ return bidi::kind::RLO;
++ case 0x8e:
++ return bidi::kind::LTR;
++ case 0x8f:
++ return bidi::kind::RTL;
++ default:
++ break;
++ }
++ else if (p[1] == 0x81)
++ switch (p[2])
++ {
++ case 0xa6:
++ return bidi::kind::LRI;
++ case 0xa7:
++ return bidi::kind::RLI;
++ case 0xa8:
++ return bidi::kind::FSI;
++ case 0xa9:
++ return bidi::kind::PDI;
++ default:
++ break;
++ }
++
++ return bidi::kind::NONE;
++}
++
++/* Parse a UCN where P points just past \u or \U and return its bidi code. */
++
++static bidi::kind
++get_bidi_ucn (const unsigned char *p, bool is_U)
++{
++ /* 6.4.3 Universal Character Names
++ \u hex-quad
++ \U hex-quad hex-quad
++ where \unnnn means \U0000nnnn. */
++
++ if (is_U)
++ {
++ if (p[0] != '0' || p[1] != '0' || p[2] != '0' || p[3] != '0')
++ return bidi::kind::NONE;
++ /* Skip 4B so we can treat \u and \U the same below. */
++ p += 4;
++ }
++
++ /* All code points we are looking for start with 20xx. */
++ if (p[0] != '2' || p[1] != '0')
++ return bidi::kind::NONE;
++ else if (p[2] == '2')
++ switch (p[3])
++ {
++ case 'a':
++ case 'A':
++ return bidi::kind::LRE;
++ case 'b':
++ case 'B':
++ return bidi::kind::RLE;
++ case 'c':
++ case 'C':
++ return bidi::kind::PDF;
++ case 'd':
++ case 'D':
++ return bidi::kind::LRO;
++ case 'e':
++ case 'E':
++ return bidi::kind::RLO;
++ default:
++ break;
++ }
++ else if (p[2] == '6')
++ switch (p[3])
++ {
++ case '6':
++ return bidi::kind::LRI;
++ case '7':
++ return bidi::kind::RLI;
++ case '8':
++ return bidi::kind::FSI;
++ case '9':
++ return bidi::kind::PDI;
++ default:
++ break;
++ }
++ else if (p[2] == '0')
++ switch (p[3])
++ {
++ case 'e':
++ case 'E':
++ return bidi::kind::LTR;
++ case 'f':
++ case 'F':
++ return bidi::kind::RTL;
++ default:
++ break;
++ }
++
++ return bidi::kind::NONE;
++}
++
++/* We're closing a bidi context, that is, we've encountered a newline,
++ are closing a C-style comment, or are at the end of a string literal,
++ character constant, or identifier. Warn if this context was not
++ properly terminated by a PDI or PDF. P points to the last character
++ in this context. */
++
++static void
++maybe_warn_bidi_on_close (cpp_reader *pfile, const uchar *p)
++{
++ if (CPP_OPTION (pfile, cpp_warn_bidirectional) == bidirectional_unpaired
++ && bidi::vec.count () > 0)
++ {
++ const location_t loc
++ = linemap_position_for_column (pfile->line_table,
++ CPP_BUF_COLUMN (pfile->buffer, p));
++ cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0,
++ "unpaired UTF-8 bidirectional control character "
++ "detected");
++ }
++ /* We're done with this context. */
++ bidi::on_close ();
++}
++
++/* We're at the beginning or in the middle of an identifier/comment/string
++ literal/character constant. Warn if we've encountered a bidi character.
++ KIND says which bidi character it was; P points to it in the character
++ stream. UCN_P is true iff this bidi character was written as a UCN. */
++
++static void
++maybe_warn_bidi_on_char (cpp_reader *pfile, const uchar *p, bidi::kind kind,
++ bool ucn_p)
++{
++ if (__builtin_expect (kind == bidi::kind::NONE, 1))
++ return;
++
++ const auto warn_bidi = CPP_OPTION (pfile, cpp_warn_bidirectional);
++
++ if (warn_bidi != bidirectional_none)
++ {
++ const location_t loc
++ = linemap_position_for_column (pfile->line_table,
++ CPP_BUF_COLUMN (pfile->buffer, p));
++ /* It seems excessive to warn about a PDI/PDF that is closing
++ an opened context because we've already warned about the
++ opening character. Except warn when we have a UCN x UTF-8
++ mismatch. */
++ if (kind == bidi::current_ctx ())
++ {
++ if (warn_bidi == bidirectional_unpaired
++ && bidi::current_ctx_ucn_p () != ucn_p)
++ cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0,
++ "UTF-8 vs UCN mismatch when closing "
++ "a context by \"%s\"", bidi::to_str (kind));
++ }
++ else if (warn_bidi == bidirectional_any)
++ {
++ if (kind == bidi::kind::PDF || kind == bidi::kind::PDI)
++ cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0,
++ "\"%s\" is closing an unopened context",
++ bidi::to_str (kind));
++ else
++ cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0,
++ "found problematic Unicode character \"%s\"",
++ bidi::to_str (kind));
++ }
++ }
++ /* We're done with this context. */
++ bidi::on_char (kind, ucn_p);
++}
++
+ /* Skip a C-style block comment. We find the end of the comment by
+ seeing if an asterisk is before every '/' we encounter. Returns
+ nonzero if comment terminated by EOF, zero otherwise.
+@@ -1175,6 +1493,7 @@ _cpp_skip_block_comment (cpp_reader *pfile)
+ cpp_buffer *buffer = pfile->buffer;
+ const uchar *cur = buffer->cur;
+ uchar c;
++ const bool warn_bidi_p = pfile->warn_bidi_p ();
+
+ cur++;
+ if (*cur == '/')
+@@ -1189,7 +1508,11 @@ _cpp_skip_block_comment (cpp_reader *pfile)
+ if (c == '/')
+ {
+ if (cur[-2] == '*')
+- break;
++ {
++ if (warn_bidi_p)
++ maybe_warn_bidi_on_close (pfile, cur);
++ break;
++ }
+
+ /* Warn about potential nested comments, but not if the '/'
+ comes immediately before the true comment delimiter.
+@@ -1208,6 +1531,8 @@ _cpp_skip_block_comment (cpp_reader *pfile)
+ {
+ unsigned int cols;
+ buffer->cur = cur - 1;
++ if (warn_bidi_p)
++ maybe_warn_bidi_on_close (pfile, cur);
+ _cpp_process_line_notes (pfile, true);
+ if (buffer->next_line >= buffer->rlimit)
+ return true;
+@@ -1218,6 +1543,13 @@ _cpp_skip_block_comment (cpp_reader *pfile)
+
+ cur = buffer->cur;
+ }
++ /* If this is a beginning of a UTF-8 encoding, it might be
++ a bidirectional control character. */
++ else if (__builtin_expect (c == bidi::utf8_start, 0) && warn_bidi_p)
++ {
++ bidi::kind kind = get_bidi_utf8 (cur - 1);
++ maybe_warn_bidi_on_char (pfile, cur, kind, /*ucn_p=*/false);
++ }
+ }
+
+ buffer->cur = cur;
+@@ -1233,9 +1565,31 @@ skip_line_comment (cpp_reader *pfile)
+ {
+ cpp_buffer *buffer = pfile->buffer;
+ location_t orig_line = pfile->line_table->highest_line;
++ const bool warn_bidi_p = pfile->warn_bidi_p ();
+
+- while (*buffer->cur != '\n')
+- buffer->cur++;
++ if (!warn_bidi_p)
++ while (*buffer->cur != '\n')
++ buffer->cur++;
++ else
++ {
++ while (*buffer->cur != '\n'
++ && *buffer->cur != bidi::utf8_start)
++ buffer->cur++;
++ if (__builtin_expect (*buffer->cur == bidi::utf8_start, 0))
++ {
++ while (*buffer->cur != '\n')
++ {
++ if (__builtin_expect (*buffer->cur == bidi::utf8_start, 0))
++ {
++ bidi::kind kind = get_bidi_utf8 (buffer->cur);
++ maybe_warn_bidi_on_char (pfile, buffer->cur, kind,
++ /*ucn_p=*/false);
++ }
++ buffer->cur++;
++ }
++ maybe_warn_bidi_on_close (pfile, buffer->cur);
++ }
++ }
+
+ _cpp_process_line_notes (pfile, true);
+ return orig_line != pfile->line_table->highest_line;
+@@ -1346,11 +1700,13 @@ static const cppchar_t utf8_signifier = 0xC0;
+
+ /* Returns TRUE if the sequence starting at buffer->cur is valid in
+ an identifier. FIRST is TRUE if this starts an identifier. */
++
+ static bool
+ forms_identifier_p (cpp_reader *pfile, int first,
+ struct normalize_state *state)
+ {
+ cpp_buffer *buffer = pfile->buffer;
++ const bool warn_bidi_p = pfile->warn_bidi_p ();
+
+ if (*buffer->cur == '$')
+ {
+@@ -1373,6 +1729,13 @@ forms_identifier_p (cpp_reader *pfile, int first,
+ cppchar_t s;
+ if (*buffer->cur >= utf8_signifier)
+ {
++ if (__builtin_expect (*buffer->cur == bidi::utf8_start, 0)
++ && warn_bidi_p)
++ {
++ bidi::kind kind = get_bidi_utf8 (buffer->cur);
++ maybe_warn_bidi_on_char (pfile, buffer->cur, kind,
++ /*ucn_p=*/false);
++ }
+ if (_cpp_valid_utf8 (pfile, &buffer->cur, buffer->rlimit, 1 + !first,
+ state, &s))
+ return true;
+@@ -1381,6 +1744,13 @@ forms_identifier_p (cpp_reader *pfile, int first,
+ && (buffer->cur[1] == 'u' || buffer->cur[1] == 'U'))
+ {
+ buffer->cur += 2;
++ if (warn_bidi_p)
++ {
++ bidi::kind kind = get_bidi_ucn (buffer->cur,
++ buffer->cur[-1] == 'U');
++ maybe_warn_bidi_on_char (pfile, buffer->cur, kind,
++ /*ucn_p=*/true);
++ }
+ if (_cpp_valid_ucn (pfile, &buffer->cur, buffer->rlimit, 1 + !first,
+ state, &s, NULL, NULL))
+ return true;
+@@ -1489,6 +1859,7 @@ lex_identifier (cpp_reader *pfile, const uchar *base, bool starts_ucn,
+ const uchar *cur;
+ unsigned int len;
+ unsigned int hash = HT_HASHSTEP (0, *base);
++ const bool warn_bidi_p = pfile->warn_bidi_p ();
+
+ cur = pfile->buffer->cur;
+ if (! starts_ucn)
+@@ -1512,6 +1883,8 @@ lex_identifier (cpp_reader *pfile, const uchar *base, bool starts_ucn,
+ pfile->buffer->cur++;
+ }
+ } while (forms_identifier_p (pfile, false, nst));
++ if (warn_bidi_p)
++ maybe_warn_bidi_on_close (pfile, pfile->buffer->cur);
+ result = _cpp_interpret_identifier (pfile, base,
+ pfile->buffer->cur - base);
+ *spelling = cpp_lookup (pfile, base, pfile->buffer->cur - base);
+@@ -1758,6 +2131,7 @@ static void
+ lex_raw_string (cpp_reader *pfile, cpp_token *token, const uchar *base)
+ {
+ const uchar *pos = base;
++ const bool warn_bidi_p = pfile->warn_bidi_p ();
+
+ /* 'tis a pity this information isn't passed down from the lexer's
+ initial categorization of the token. */
+@@ -1994,8 +2368,15 @@ lex_raw_string (cpp_reader *pfile, cpp_token *token, const uchar *base)
+ pos = base = pfile->buffer->cur;
+ note = &pfile->buffer->notes[pfile->buffer->cur_note];
+ }
++ else if (__builtin_expect ((unsigned char) c == bidi::utf8_start, 0)
++ && warn_bidi_p)
++ maybe_warn_bidi_on_char (pfile, pos - 1, get_bidi_utf8 (pos - 1),
++ /*ucn_p=*/false);
+ }
+
++ if (warn_bidi_p)
++ maybe_warn_bidi_on_close (pfile, pos);
++
+ if (CPP_OPTION (pfile, user_literals))
+ {
+ /* If a string format macro, say from inttypes.h, is placed touching
+@@ -2090,15 +2471,27 @@ lex_string (cpp_reader *pfile, cpp_token *token, const uchar *base)
+ else
+ terminator = '>', type = CPP_HEADER_NAME;
+
++ const bool warn_bidi_p = pfile->warn_bidi_p ();
+ for (;;)
+ {
+ cppchar_t c = *cur++;
+
+ /* In #include-style directives, terminators are not escapable. */
+ if (c == '\\' && !pfile->state.angled_headers && *cur != '\n')
+- cur++;
++ {
++ if ((cur[0] == 'u' || cur[0] == 'U') && warn_bidi_p)
++ {
++ bidi::kind kind = get_bidi_ucn (cur + 1, cur[0] == 'U');
++ maybe_warn_bidi_on_char (pfile, cur, kind, /*ucn_p=*/true);
++ }
++ cur++;
++ }
+ else if (c == terminator)
+- break;
++ {
++ if (warn_bidi_p)
++ maybe_warn_bidi_on_close (pfile, cur - 1);
++ break;
++ }
+ else if (c == '\n')
+ {
+ cur--;
+@@ -2115,6 +2508,11 @@ lex_string (cpp_reader *pfile, cpp_token *token, const uchar *base)
+ }
+ else if (c == '\0')
+ saw_NUL = true;
++ else if (__builtin_expect (c == bidi::utf8_start, 0) && warn_bidi_p)
++ {
++ bidi::kind kind = get_bidi_utf8 (cur - 1);
++ maybe_warn_bidi_on_char (pfile, cur - 1, kind, /*ucn_p=*/false);
++ }
+ }
+
+ if (saw_NUL && !pfile->state.skipping)
diff --git a/SOURCES/gcc11-Wno-format-security.patch b/SOURCES/gcc11-Wno-format-security.patch
new file mode 100644
index 0000000..974ea44
--- /dev/null
+++ b/SOURCES/gcc11-Wno-format-security.patch
@@ -0,0 +1,27 @@
+2017-02-25 Jakub Jelinek
+
+ * configure.ac: When adding -Wno-format, also add -Wno-format-security.
+ * configure: Regenerated.
+
+--- gcc/configure.ac.jj 2017-02-13 12:20:53.000000000 +0100
++++ gcc/configure.ac 2017-02-25 12:42:32.859175403 +0100
+@@ -480,7 +480,7 @@ AC_ARG_ENABLE(build-format-warnings,
+ AS_HELP_STRING([--disable-build-format-warnings],[don't use -Wformat while building GCC]),
+ [],[enable_build_format_warnings=yes])
+ AS_IF([test $enable_build_format_warnings = no],
+- [wf_opt=-Wno-format],[wf_opt=])
++ [wf_opt="-Wno-format -Wno-format-security"],[wf_opt=])
+ ACX_PROG_CXX_WARNING_OPTS(
+ m4_quote(m4_do([-W -Wall -Wno-narrowing -Wwrite-strings ],
+ [-Wcast-qual -Wno-error=format-diag $wf_opt])),
+--- gcc/configure.jj 2017-02-13 12:20:52.000000000 +0100
++++ gcc/configure 2017-02-25 12:42:50.041946391 +0100
+@@ -6647,7 +6647,7 @@ else
+ fi
+
+ if test $enable_build_format_warnings = no; then :
+- wf_opt=-Wno-format
++ wf_opt="-Wno-format -Wno-format-security"
+ else
+ wf_opt=
+ fi
diff --git a/SOURCES/gcc11-bind-now.patch b/SOURCES/gcc11-bind-now.patch
new file mode 100644
index 0000000..8710490
--- /dev/null
+++ b/SOURCES/gcc11-bind-now.patch
@@ -0,0 +1,333 @@
+From 36362544fb039599c0eb58d839e90ffb5410ad27 Mon Sep 17 00:00:00 2001
+From: Marek Polacek
+Date: Wed, 9 Feb 2022 15:18:43 -0500
+Subject: [PATCH] configure: Implement --enable-host-bind-now
+
+As promised in the --enable-host-pie patch, this patch adds another
+configure option, --enable-host-bind-now, which adds -z now when linking
+the compiler executables in order to extend hardening. BIND_NOW with RELRO
+allows the GOT to be marked RO; this prevents GOT modification attacks.
+
+This option does not affect linking of target libraries; you can use
+LDFLAGS_FOR_TARGET=-Wl,-z,relro,-z,now to enable RELRO/BIND_NOW.
+
+Bootstrapped/regtested on x86_64-pc-linux-gnu (with the option enabled vs
+not enabled). I suppose this is GCC 13 material, but maybe I'll get some
+comments anyway.
+
+c++tools/ChangeLog:
+
+ * configure.ac (--enable-host-bind-now): New check.
+ * configure: Regenerate.
+
+gcc/ChangeLog:
+
+ * configure.ac (--enable-host-bind-now): New check. Add
+ -Wl,-z,now to LD_PICFLAG if --enable-host-bind-now.
+ * configure: Regenerate.
+ * doc/install.texi: Document --enable-host-bind-now.
+
+lto-plugin/ChangeLog:
+
+ * configure.ac (--enable-host-bind-now): New check. Link with
+ -z,now.
+ * configure: Regenerate.
+---
+ c++tools/configure | 11 +++++++++++
+ c++tools/configure.ac | 7 +++++++
+ gcc/configure | 20 ++++++++++++++++++--
+ gcc/configure.ac | 13 ++++++++++++-
+ gcc/doc/install.texi | 6 ++++++
+ lto-plugin/configure | 20 ++++++++++++++++++--
+ lto-plugin/configure.ac | 11 +++++++++++
+ 7 files changed, 83 insertions(+), 5 deletions(-)
+
+diff --git a/c++tools/configure b/c++tools/configure
+index c1aceb8404a..25432b5040d 100755
+--- a/c++tools/configure
++++ b/c++tools/configure
+@@ -631,6 +631,7 @@ ac_ct_CC
+ CFLAGS
+ CC
+ LD_PICFLAG
++enable_host_bind_now
+ PICFLAG
+ MAINTAINER
+ CXX_AUX_TOOLS
+@@ -704,6 +705,7 @@ enable_c___tools
+ enable_maintainer_mode
+ enable_default_pie
+ enable_host_pie
++enable_host_bind_now
+ with_gcc_major_version_only
+ '
+ ac_precious_vars='build_alias
+@@ -1336,6 +1338,7 @@ Optional Features:
+ configurey bits
+ --enable-default-pie enable Position Independent Executable as default
+ --enable-host-pie build host code as PIE
++ --enable-host-bind-now link host code as BIND_NOW
+
+ Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+@@ -3009,6 +3012,14 @@ fi
+
+
+
++# Enable --enable-host-bind-now
++# Check whether --enable-host-bind-now was given.
++if test "${enable_host_bind_now+set}" = set; then :
++ enableval=$enable_host_bind_now; LD_PICFLAG="$LD_PICFLAG -Wl,-z,now"
++fi
++
++
++
+
+ # Check if O_CLOEXEC is defined by fcntl
+ ac_ext=c
+diff --git a/c++tools/configure.ac b/c++tools/configure.ac
+index 1e42689f2eb..d3f23f66f00 100644
+--- a/c++tools/configure.ac
++++ b/c++tools/configure.ac
+@@ -110,6 +110,13 @@ AC_ARG_ENABLE(host-pie,
+ [build host code as PIE])],
+ [PICFLAG=-fPIE; LD_PICFLAG=-pie], [])
+ AC_SUBST(PICFLAG)
++
++# Enable --enable-host-bind-now
++AC_ARG_ENABLE(host-bind-now,
++[AS_HELP_STRING([--enable-host-bind-now],
++ [link host code as BIND_NOW])],
++[LD_PICFLAG="$LD_PICFLAG -Wl,-z,now"], [])
++AC_SUBST(enable_host_bind_now)
+ AC_SUBST(LD_PICFLAG)
+
+ # Check if O_CLOEXEC is defined by fcntl
+diff --git a/gcc/configure b/gcc/configure
+index 2ded5d4c50b..5671dc7dcf4 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -635,6 +635,7 @@ CET_HOST_FLAGS
+ LD_PICFLAG
+ PICFLAG
+ enable_default_pie
++enable_host_bind_now
+ enable_host_pie
+ enable_host_shared
+ enable_plugin
+@@ -1023,6 +1024,7 @@ enable_version_specific_runtime_libs
+ enable_plugin
+ enable_host_shared
+ enable_host_pie
++enable_host_bind_now
+ enable_libquadmath_support
+ with_linker_hash_style
+ with_diagnostics_color
+@@ -1786,6 +1788,7 @@ Optional Features:
+ --enable-plugin enable plugin support
+ --enable-host-shared build host code as shared libraries
+ --enable-host-pie build host code as PIE
++ --enable-host-bind-now link host code as BIND_NOW
+ --disable-libquadmath-support
+ disable libquadmath support for Fortran
+ --enable-default-pie enable Position Independent Executable as default
+@@ -19394,7 +19397,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 19409 "configure"
++#line 19412 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -19500,7 +19503,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 19515 "configure"
++#line 19518 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -32109,6 +32112,14 @@ fi
+
+
+
++# Enable --enable-host-bind-now
++# Check whether --enable-host-bind-now was given.
++if test "${enable_host_bind_now+set}" = set; then :
++ enableval=$enable_host_bind_now;
++fi
++
++
++
+ # Check whether --enable-libquadmath-support was given.
+ if test "${enable_libquadmath_support+set}" = set; then :
+ enableval=$enable_libquadmath_support; ENABLE_LIBQUADMATH_SUPPORT=$enableval
+@@ -32295,6 +32306,8 @@ else
+ PICFLAG=
+ fi
+
++
++
+ if test x$enable_host_pie = xyes; then
+ LD_PICFLAG=-pie
+ elif test x$gcc_cv_no_pie = xyes; then
+@@ -32303,6 +32316,9 @@ else
+ LD_PICFLAG=
+ fi
+
++if test x$enable_host_bind_now = xyes; then
++ LD_PICFLAG="$LD_PICFLAG -Wl,-z,now"
++fi
+
+
+
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index dca995aeec7..6017bcbc8c6 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -7497,6 +7497,12 @@ AC_ARG_ENABLE(host-pie,
+ [build host code as PIE])])
+ AC_SUBST(enable_host_pie)
+
++# Enable --enable-host-bind-now
++AC_ARG_ENABLE(host-bind-now,
++[AS_HELP_STRING([--enable-host-bind-now],
++ [link host code as BIND_NOW])])
++AC_SUBST(enable_host_bind_now)
++
+ AC_ARG_ENABLE(libquadmath-support,
+ [AS_HELP_STRING([--disable-libquadmath-support],
+ [disable libquadmath support for Fortran])],
+@@ -7638,6 +7644,8 @@ else
+ PICFLAG=
+ fi
+
++AC_SUBST([PICFLAG])
++
+ if test x$enable_host_pie = xyes; then
+ LD_PICFLAG=-pie
+ elif test x$gcc_cv_no_pie = xyes; then
+@@ -7646,7 +7654,10 @@ else
+ LD_PICFLAG=
+ fi
+
+-AC_SUBST([PICFLAG])
++if test x$enable_host_bind_now = xyes; then
++ LD_PICFLAG="$LD_PICFLAG -Wl,-z,now"
++fi
++
+ AC_SUBST([LD_PICFLAG])
+
+ # Enable Intel CET on Intel CET enabled host if jit is enabled.
+diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
+index 9747f832a75..b59af198d3e 100644
+--- a/gcc/doc/install.texi
++++ b/gcc/doc/install.texi
+@@ -1041,6 +1041,12 @@ protection against Return Oriented Programming (ROP) attacks.
+ in which case @option{-fPIC} is used when compiling, and @option{-pie} when
+ linking.
+
++@item --enable-host-bind-now
++Specify that the @emph{host} executables should be linked with the option
++@option{-Wl,-z,now}, which means that the dynamic linker will resolve all
++symbols when the executables are started, and that in turn allows RELRO to
++mark the GOT read-only, resulting in better security.
++
+ @item @anchor{with-gnu-as}--with-gnu-as
+ Specify that the compiler should assume that the
+ assembler it finds is the GNU assembler. However, this does not modify
+diff --git a/lto-plugin/configure b/lto-plugin/configure
+index baa84adbb6c..669ccaede52 100755
+--- a/lto-plugin/configure
++++ b/lto-plugin/configure
+@@ -656,6 +656,7 @@ accel_dir_suffix
+ gcc_build_dir
+ CET_HOST_FLAGS
+ ac_lto_plugin_ldflags
++enable_host_bind_now
+ ac_lto_plugin_warn_cflags
+ EGREP
+ GREP
+@@ -771,6 +772,7 @@ enable_maintainer_mode
+ with_libiberty
+ enable_dependency_tracking
+ enable_largefile
++enable_host_bind_now
+ enable_cet
+ with_gcc_major_version_only
+ enable_shared
+@@ -1418,6 +1420,7 @@ Optional Features:
+ --disable-dependency-tracking
+ speeds up one-time build
+ --disable-largefile omit support for large files
++ --enable-host-bind-now link host code as BIND_NOW
+ --enable-cet enable Intel CET in host libraries [default=auto]
+ --enable-shared[=PKGS] build shared libraries [default=yes]
+ --enable-static[=PKGS] build static libraries [default=yes]
+@@ -5662,6 +5665,19 @@ if test "x$have_static_libgcc" = xyes; then
+ ac_lto_plugin_ldflags="-Wc,-static-libgcc"
+ fi
+
++# Enable --enable-host-bind-now
++# Check whether --enable-host-bind-now was given.
++if test "${enable_host_bind_now+set}" = set; then :
++ enableval=$enable_host_bind_now;
++fi
++
++
++
++if test x$enable_host_bind_now = xyes; then
++ ac_lto_plugin_ldflags="$ac_lto_plugin_ldflags -Wl,-z,now"
++fi
++
++
+
+ # Check whether --enable-cet was given.
+ if test "${enable_cet+set}" = set; then :
+@@ -11950,7 +11968,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 11963 "configure"
++#line 11983 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -12056,7 +12074,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 12069 "configure"
++#line 12089 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+diff --git a/lto-plugin/configure.ac b/lto-plugin/configure.ac
+index 7e6f729e9dc..5d5fea8fe70 100644
+--- a/lto-plugin/configure.ac
++++ b/lto-plugin/configure.ac
+@@ -25,6 +25,17 @@ LDFLAGS="$saved_LDFLAGS"
+ if test "x$have_static_libgcc" = xyes; then
+ ac_lto_plugin_ldflags="-Wc,-static-libgcc"
+ fi
++
++# Enable --enable-host-bind-now
++AC_ARG_ENABLE(host-bind-now,
++[AS_HELP_STRING([--enable-host-bind-now],
++ [link host code as BIND_NOW])])
++AC_SUBST(enable_host_bind_now)
++
++if test x$enable_host_bind_now = xyes; then
++ ac_lto_plugin_ldflags="$ac_lto_plugin_ldflags -Wl,-z,now"
++fi
++
+ AC_SUBST(ac_lto_plugin_ldflags)
+
+ GCC_CET_HOST_FLAGS(CET_HOST_FLAGS)
+
+base-commit: bf799d3409cb9a189114a6c9ff5b7cd123915764
+--
+2.34.1
+
diff --git a/SOURCES/gcc11-d-shared-libphobos.patch b/SOURCES/gcc11-d-shared-libphobos.patch
new file mode 100644
index 0000000..6384bbb
--- /dev/null
+++ b/SOURCES/gcc11-d-shared-libphobos.patch
@@ -0,0 +1,20 @@
+2019-01-17 Jakub Jelinek
+
+ * d-spec.cc (lang_specific_driver): Make -shared-libphobos
+ the default rather than -static-libphobos.
+
+--- gcc/d/d-spec.cc.jj 2019-01-01 12:37:49.502444257 +0100
++++ gcc/d/d-spec.cc 2019-01-17 17:09:45.364949246 +0100
+@@ -408,9 +408,9 @@ lang_specific_driver (cl_decoded_option
+ /* Add `-lgphobos' if we haven't already done so. */
+ if (phobos_library != PHOBOS_NOLINK)
+ {
+- /* Default to static linking. */
+- if (phobos_library != PHOBOS_DYNAMIC)
+- phobos_library = PHOBOS_STATIC;
++ /* Default to shared linking. */
++ if (phobos_library != PHOBOS_STATIC)
++ phobos_library = PHOBOS_DYNAMIC;
+
+ #ifdef HAVE_LD_STATIC_DYNAMIC
+ if (phobos_library == PHOBOS_STATIC && !static_link)
diff --git a/SOURCES/gcc11-dejagnu-multiline.patch b/SOURCES/gcc11-dejagnu-multiline.patch
new file mode 100644
index 0000000..12a702b
--- /dev/null
+++ b/SOURCES/gcc11-dejagnu-multiline.patch
@@ -0,0 +1,32 @@
+commit 14c7757e9b751781360737f53b71f851fc356d3d
+Author: Jeff Law
+Date: Fri Oct 29 11:30:15 2021 -0400
+
+ Avoid overly-greedy match in dejagnu regexp.
+
+ Occasionally I've been seeing failures with the multi-line diagnostics. It's never been clear what's causing the spurious failures, though I have long suspected a greedy regexp match.
+
+ It happened again yesterday with a local change that in no way should affect diagnostics, so I finally went searching and found that sure enough the multi-line diagnostics had a ".*" in their regexp. According to the comments, the .* is primarily to catch any dg directives that may appear -- ie it should eat to EOL, but not multiple lines. But a .* can indeed match a newline and cause it to eat multiple lines.
+
+ The fix is simple. [^\r\n]* will eat to EOL, but not further.
+
+ Regression tested on x86_64 and on our internal target.
+
+ gcc/testsuite
+
+ * lib/multiline.exp (_build_multiline_regex): Use a better
+ regexp than .* to match up to EOL.
+
+diff --git a/gcc/testsuite/lib/multiline.exp b/gcc/testsuite/lib/multiline.exp
+index 0e151b6d222..86387f8209b 100644
+--- a/gcc/testsuite/lib/multiline.exp
++++ b/gcc/testsuite/lib/multiline.exp
+@@ -331,7 +331,7 @@ proc _build_multiline_regex { multiline index } {
+ # Support arbitrary followup text on each non-empty line,
+ # to deal with comments containing containing DejaGnu
+ # directives.
+- append rexp ".*"
++ append rexp "\[^\\n\\r\]*"
+ }
+ }
+ append rexp "\n"
diff --git a/SOURCES/gcc11-dg-ice-fixes.patch b/SOURCES/gcc11-dg-ice-fixes.patch
new file mode 100644
index 0000000..33d0bc4
--- /dev/null
+++ b/SOURCES/gcc11-dg-ice-fixes.patch
@@ -0,0 +1,83 @@
+diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c
+index 8c3884bdc00..141f089d4f8 100644
+--- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c
++++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c
+@@ -1,7 +1,7 @@
+ /* Test OpenACC 'kernels' construct decomposition. */
+
+ /* { dg-additional-options "-fopt-info-omp-all" } */
+-/* { dg-additional-options "-fchecking --param=openacc-kernels=decompose" } */
++/* { dg-additional-options "-fno-report-bug -fchecking --param=openacc-kernels=decompose" } */
+ /* { dg-ice "TODO" }
+ { dg-prune-output "during GIMPLE pass: omplower" } */
+
+diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c
+index 8bf60a9a509..a07e0a42116 100644
+--- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c
++++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c
+@@ -1,6 +1,6 @@
+ /* Test OpenACC 'kernels' construct decomposition. */
+
+-/* { dg-additional-options "-fchecking --param=openacc-kernels=decompose" } */
++/* { dg-additional-options "-fno-report-bug -fchecking --param=openacc-kernels=decompose" } */
+ /* { dg-ice "TODO" }
+ { dg-prune-output "during GIMPLE pass: omplower" } */
+
+diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C
+index eae0d8c377b..ed37f95e865 100644
+--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C
++++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C
+@@ -1,6 +1,6 @@
+ // PR c++/52830
+ // { dg-do compile { target c++11 } }
+-// { dg-additional-options "-fchecking" }
++// { dg-additional-options "-fchecking -fno-report-bug" }
+ // { dg-ice "comptypes" }
+
+ template struct eif { typedef void type; };
+diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-88982.C b/gcc/testsuite/g++.dg/cpp0x/vt-88982.C
+index 7a868233d73..45307a63483 100644
+--- a/gcc/testsuite/g++.dg/cpp0x/vt-88982.C
++++ b/gcc/testsuite/g++.dg/cpp0x/vt-88982.C
+@@ -1,6 +1,6 @@
+ // PR c++/88982
+ // { dg-do compile { target c++11 } }
+-// { dg-additional-options "-fchecking" }
++// { dg-additional-options "-fchecking -fno-report-bug" }
+ // { dg-ice "tsubst_pack_expansion" }
+
+ template struct A {
+diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn61.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn61.C
+index bed5ea0cfc0..cb235bf891a 100644
+--- a/gcc/testsuite/g++.dg/cpp1y/auto-fn61.C
++++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn61.C
+@@ -1,6 +1,6 @@
+ // PR c++/88003
+ // { dg-do compile { target c++14 } }
+-// { dg-additional-options "-fchecking" }
++// { dg-additional-options "-fchecking -fno-report-bug" }
+ // { dg-ice "poplevel_class" }
+
+ auto test() {
+diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C
+index 0cdb400d21c..8f17cca31dd 100644
+--- a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C
++++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C
+@@ -1,6 +1,6 @@
+ // PR c++/87765
+ // { dg-do compile { target c++17 } }
+-// { dg-additional-options "-fchecking" }
++// { dg-additional-options "-fchecking -fno-report-bug" }
+ // { dg-ice "cxx_eval_constant_expression" }
+
+ template
+diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/declare-vla-kernels-decompose-ice-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/declare-vla-kernels-decompose-ice-1.c
+index 0777b612b63..53abbe2db83 100644
+--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/declare-vla-kernels-decompose-ice-1.c
++++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/declare-vla-kernels-decompose-ice-1.c
+@@ -1,4 +1,4 @@
+-/* { dg-additional-options "--param=openacc-kernels=decompose" } */
++/* { dg-additional-options "--param=openacc-kernels=decompose -fno-report-bug" } */
+ /* Hopefully, this is the same issue as '../../../gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c'.
+ { dg-ice "TODO" }
+ TODO { dg-prune-output "during GIMPLE pass: omplower" }
diff --git a/SOURCES/gcc11-foffload-default.patch b/SOURCES/gcc11-foffload-default.patch
new file mode 100644
index 0000000..d1aae64
--- /dev/null
+++ b/SOURCES/gcc11-foffload-default.patch
@@ -0,0 +1,116 @@
+2019-01-17 Jakub Jelinek
+
+ * gcc.c (offload_targets_default): New variable.
+ (process_command): Set it if -foffload is defaulted.
+ (driver::maybe_putenv_OFFLOAD_TARGETS): Add OFFLOAD_TARGET_DEFAULT=1
+ into environment if -foffload has been defaulted.
+ * lto-wrapper.c (OFFLOAD_TARGET_DEFAULT_ENV): Define.
+ (compile_offload_image): If OFFLOAD_TARGET_DEFAULT
+ is in the environment, don't fail if corresponding mkoffload
+ can't be found.
+ (compile_images_for_offload_targets): Likewise. Free and clear
+ offload_names if no valid offload is found.
+libgomp/
+ * target.c (gomp_load_plugin_for_device): If a plugin can't be
+ dlopened, assume it has no devices silently.
+
+--- gcc/gcc.c.jj 2017-01-17 10:28:40.000000000 +0100
++++ gcc/gcc.c 2017-01-20 16:26:29.649962902 +0100
+@@ -319,6 +319,10 @@ static const char *spec_host_machine = D
+
+ static char *offload_targets = NULL;
+
++/* Set to true if -foffload has not been used and offload_targets
++ is set to the configured in default. */
++static bool offload_targets_default;
++
+ /* Nonzero if cross-compiling.
+ When -b is used, the value comes from the `specs' file. */
+
+@@ -4828,7 +4832,10 @@ process_command (unsigned int decoded_op
+ /* If the user didn't specify any, default to all configured offload
+ targets. */
+ if (ENABLE_OFFLOADING && offload_targets == NULL)
+- handle_foffload_option (OFFLOAD_TARGETS);
++ {
++ handle_foffload_option (OFFLOAD_TARGETS);
++ offload_targets_default = true;
++ }
+
+ /* Handle -gtoggle as it would later in toplev.c:process_options to
+ make the debug-level-gt spec function work as expected. */
+@@ -8494,6 +8501,8 @@ driver::maybe_putenv_OFFLOAD_TARGETS ()
+ obstack_grow (&collect_obstack, offload_targets,
+ strlen (offload_targets) + 1);
+ xputenv (XOBFINISH (&collect_obstack, char *));
++ if (offload_targets_default)
++ xputenv ("OFFLOAD_TARGET_DEFAULT=1");
+ }
+
+ free (offload_targets);
+--- gcc/lto-wrapper.c.jj 2017-01-01 12:45:34.000000000 +0100
++++ gcc/lto-wrapper.c 2017-01-20 16:34:18.294016997 +0100
+@@ -52,6 +52,7 @@ along with GCC; see the file COPYING3.
+ /* Environment variable, used for passing the names of offload targets from GCC
+ driver to lto-wrapper. */
+ #define OFFLOAD_TARGET_NAMES_ENV "OFFLOAD_TARGET_NAMES"
++#define OFFLOAD_TARGET_DEFAULT_ENV "OFFLOAD_TARGET_DEFAULT"
+
+ /* By default there is no special suffix for target executables. */
+ #ifdef TARGET_EXECUTABLE_SUFFIX
+@@ -906,6 +907,12 @@ compile_offload_image (const char *targe
+ break;
+ }
+
++ if (!compiler && getenv (OFFLOAD_TARGET_DEFAULT_ENV))
++ {
++ free_array_of_ptrs ((void **) paths, n_paths);
++ return NULL;
++ }
++
+ if (!compiler)
+ fatal_error (input_location,
+ "could not find %s in %s (consider using %<-B%>)",
+@@ -975,6 +982,7 @@ compile_images_for_offload_targets (unsi
+ if (!target_names)
+ return;
+ unsigned num_targets = parse_env_var (target_names, &names, NULL);
++ int next_name_entry = 0;
+
+ const char *compiler_path = getenv ("COMPILER_PATH");
+ if (!compiler_path)
+@@ -985,13 +993,19 @@ compile_images_for_offload_targets (unsi
+ offload_names = XCNEWVEC (char *, num_targets + 1);
+ for (unsigned i = 0; i < num_targets; i++)
+ {
+- offload_names[i]
++ offload_names[next_name_entry]
+ = compile_offload_image (names[i], compiler_path, in_argc, in_argv,
+ compiler_opts, compiler_opt_count,
+ linker_opts, linker_opt_count);
+- if (!offload_names[i])
+- fatal_error (input_location,
+- "problem with building target image for %s", names[i]);
++ if (!offload_names[next_name_entry])
++ continue;
++ next_name_entry++;
++ }
++
++ if (next_name_entry == 0)
++ {
++ free (offload_names);
++ offload_names = NULL;
+ }
+
+ out:
+--- libgomp/target.c.jj 2017-01-01 12:45:52.000000000 +0100
++++ libgomp/target.c 2017-01-20 20:12:13.756710875 +0100
+@@ -2356,7 +2356,7 @@ gomp_load_plugin_for_device (struct gomp
+
+ void *plugin_handle = dlopen (plugin_name, RTLD_LAZY);
+ if (!plugin_handle)
+- goto dl_fail;
++ return 0;
+
+ /* Check if all required functions are available in the plugin and store
+ their handlers. None of the symbols can legitimately be NULL,
diff --git a/SOURCES/gcc11-fortran-fdec-add-missing-indexes.patch b/SOURCES/gcc11-fortran-fdec-add-missing-indexes.patch
new file mode 100644
index 0000000..d707b94
--- /dev/null
+++ b/SOURCES/gcc11-fortran-fdec-add-missing-indexes.patch
@@ -0,0 +1,181 @@
+From 7001d522d0273658d9e1fb12ca104d56bfcae34d Mon Sep 17 00:00:00 2001
+From: Mark Eggleston
+Date: Fri, 22 Jan 2021 15:06:08 +0000
+Subject: [PATCH 10/10] Fill in missing array dimensions using the lower bound
+
+Use -fdec-add-missing-indexes to enable feature. Also enabled by fdec.
+---
+ gcc/fortran/lang.opt | 8 ++++++++
+ gcc/fortran/options.c | 1 +
+ gcc/fortran/resolve.c | 24 ++++++++++++++++++++++++
+ gcc/testsuite/gfortran.dg/array_6.f90 | 23 +++++++++++++++++++++++
+ gcc/testsuite/gfortran.dg/array_7.f90 | 23 +++++++++++++++++++++++
+ gcc/testsuite/gfortran.dg/array_8.f90 | 23 +++++++++++++++++++++++
+ 6 files changed, 102 insertions(+)
+ create mode 100644 gcc/testsuite/gfortran.dg/array_6.f90
+ create mode 100644 gcc/testsuite/gfortran.dg/array_7.f90
+ create mode 100644 gcc/testsuite/gfortran.dg/array_8.f90
+
+diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
+index 019c798cf09..f27de88ea3f 100644
+--- a/gcc/fortran/lang.opt
++++ b/gcc/fortran/lang.opt
+@@ -281,6 +281,10 @@ Wmissing-include-dirs
+ Fortran
+ ; Documented in C/C++
+
++Wmissing-index
++Fortran Var(warn_missing_index) Warning LangEnabledBy(Fortran,Wall)
++Warn that the lower bound of a missing index will be used.
++
+ Wuse-without-only
+ Fortran Var(warn_use_without_only) Warning
+ Warn about USE statements that have no ONLY qualifier.
+@@ -460,6 +464,10 @@ fdec
+ Fortran Var(flag_dec)
+ Enable all DEC language extensions.
+
++fdec-add-missing-indexes
++Fortran Var(flag_dec_add_missing_indexes)
++Enable the addition of missing indexes using their lower bounds.
++
+ fdec-blank-format-item
+ Fortran Var(flag_dec_blank_format_item)
+ Enable the use of blank format items in format strings.
+diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
+index 050f56fdc25..c3b2822685d 100644
+--- a/gcc/fortran/options.c
++++ b/gcc/fortran/options.c
+@@ -84,6 +84,7 @@ set_dec_flags (int value)
+ SET_BITFLAG (flag_dec_non_logical_if, value, value);
+ SET_BITFLAG (flag_dec_promotion, value, value);
+ SET_BITFLAG (flag_dec_sequence, value, value);
++ SET_BITFLAG (flag_dec_add_missing_indexes, value, value);
+ }
+
+ /* Finalize DEC flags. */
+diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
+index fe7d0cc5944..0efeedab46e 100644
+--- a/gcc/fortran/resolve.c
++++ b/gcc/fortran/resolve.c
+@@ -4806,6 +4806,30 @@ compare_spec_to_ref (gfc_array_ref *ar)
+ if (ar->type == AR_FULL)
+ return true;
+
++ if (flag_dec_add_missing_indexes && as->rank > ar->dimen)
++ {
++ /* Add in the missing dimensions, assuming they are the lower bound
++ of that dimension if not specified. */
++ int j;
++ if (warn_missing_index)
++ {
++ gfc_warning (OPT_Wmissing_index, "Using the lower bound for "
++ "unspecified dimensions in array reference at %L",
++ &ar->where);
++ }
++ /* Other parts of the code iterate ar->start and ar->end from 0 to
++ ar->dimen, so it is safe to assume slots from ar->dimen upwards
++ are unused (i.e. there are no gaps; the specified indexes are
++ contiguous and start at zero. */
++ for(j = ar->dimen; j <= as->rank; j++)
++ {
++ ar->start[j] = gfc_copy_expr (as->lower[j]);
++ ar->end[j] = gfc_copy_expr (as->lower[j]);
++ ar->dimen_type[j] = DIMEN_ELEMENT;
++ }
++ ar->dimen = as->rank;
++ }
++
+ if (as->rank != ar->dimen)
+ {
+ gfc_error ("Rank mismatch in array reference at %L (%d/%d)",
+diff --git a/gcc/testsuite/gfortran.dg/array_6.f90 b/gcc/testsuite/gfortran.dg/array_6.f90
+new file mode 100644
+index 00000000000..5c26e18ab3e
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/array_6.f90
+@@ -0,0 +1,23 @@
++! { dg-do run }
++! { dg-options "-fdec -Wmissing-index" }!
++! Checks that under-specified arrays (referencing arrays with fewer
++! dimensions than the array spec) generates a warning.
++!
++! Contributed by Jim MacArthur
++! Updated by Mark Eggleston
++!
++
++program under_specified_array
++ integer chessboard(8,8)
++ integer chessboard3d(8,8,3:5)
++ chessboard(3,1) = 5
++ chessboard(3,2) = 55
++ chessboard3d(4,1,3) = 6
++ chessboard3d(4,1,4) = 66
++ chessboard3d(4,4,3) = 7
++ chessboard3d(4,4,4) = 77
++
++ if (chessboard(3).ne.5) stop 1 ! { dg-warning "Using the lower bound for unspecified dimensions in array reference" }
++ if (chessboard3d(4).ne.6) stop 2 ! { dg-warning "Using the lower bound for unspecified dimensions in array reference" }
++ if (chessboard3d(4,4).ne.7) stop 3 ! { dg-warning "Using the lower bound for unspecified dimensions in array reference" }
++end program
+diff --git a/gcc/testsuite/gfortran.dg/array_7.f90 b/gcc/testsuite/gfortran.dg/array_7.f90
+new file mode 100644
+index 00000000000..5588a5bd02d
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/array_7.f90
+@@ -0,0 +1,23 @@
++! { dg-do run }
++! { dg-options "-fdec-add-missing-indexes -Wmissing-index" }!
++! Checks that under-specified arrays (referencing arrays with fewer
++! dimensions than the array spec) generates a warning.
++!
++! Contributed by Jim MacArthur
++! Updated by Mark Eggleston
++!
++
++program under_specified_array
++ integer chessboard(8,8)
++ integer chessboard3d(8,8,3:5)
++ chessboard(3,1) = 5
++ chessboard(3,2) = 55
++ chessboard3d(4,1,3) = 6
++ chessboard3d(4,1,4) = 66
++ chessboard3d(4,4,3) = 7
++ chessboard3d(4,4,4) = 77
++
++ if (chessboard(3).ne.5) stop 1 ! { dg-warning "Using the lower bound for unspecified dimensions in array reference" }
++ if (chessboard3d(4).ne.6) stop 2 ! { dg-warning "Using the lower bound for unspecified dimensions in array reference" }
++ if (chessboard3d(4,4).ne.7) stop 3 ! { dg-warning "Using the lower bound for unspecified dimensions in array reference" }
++end program
+diff --git a/gcc/testsuite/gfortran.dg/array_8.f90 b/gcc/testsuite/gfortran.dg/array_8.f90
+new file mode 100644
+index 00000000000..f0d2ef5e37d
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/array_8.f90
+@@ -0,0 +1,23 @@
++! { dg-do compile }
++! { dg-options "-fdec -fno-dec-add-missing-indexes" }!
++! Checks that under-specified arrays (referencing arrays with fewer
++! dimensions than the array spec) generates a warning.
++!
++! Contributed by Jim MacArthur
++! Updated by Mark Eggleston
++!
++
++program under_specified_array
++ integer chessboard(8,8)
++ integer chessboard3d(8,8,3:5)
++ chessboard(3,1) = 5
++ chessboard(3,2) = 55
++ chessboard3d(4,1,3) = 6
++ chessboard3d(4,1,4) = 66
++ chessboard3d(4,4,3) = 7
++ chessboard3d(4,4,4) = 77
++
++ if (chessboard(3).ne.5) stop 1 ! { dg-error "Rank mismatch" }
++ if (chessboard3d(4).ne.6) stop 2 ! { dg-error "Rank mismatch" }
++ if (chessboard3d(4,4).ne.7) stop 3 ! { dg-error "Rank mismatch" }
++end program
+--
+2.27.0
+
diff --git a/SOURCES/gcc11-fortran-fdec-duplicates.patch b/SOURCES/gcc11-fortran-fdec-duplicates.patch
new file mode 100644
index 0000000..b5d1104
--- /dev/null
+++ b/SOURCES/gcc11-fortran-fdec-duplicates.patch
@@ -0,0 +1,215 @@
+From 23b1fcb104c666429451ffaf936f8da5fcd3d43a Mon Sep 17 00:00:00 2001
+From: Mark Eggleston
+Date: Fri, 22 Jan 2021 12:29:47 +0000
+Subject: [PATCH 01/10] Allow duplicate declarations.
+
+Enabled by -fdec-duplicates and -fdec.
+
+Some fixes by Jim MacArthur
+Addition of -fdec-duplicates by Mark Eggleston
+---
+ gcc/fortran/lang.opt | 4 ++++
+ gcc/fortran/options.c | 1 +
+ gcc/fortran/symbol.c | 21 +++++++++++++++++--
+ .../gfortran.dg/duplicate_type_4.f90 | 13 ++++++++++++
+ .../gfortran.dg/duplicate_type_5.f90 | 13 ++++++++++++
+ .../gfortran.dg/duplicate_type_6.f90 | 13 ++++++++++++
+ .../gfortran.dg/duplicate_type_7.f90 | 13 ++++++++++++
+ .../gfortran.dg/duplicate_type_8.f90 | 12 +++++++++++
+ .../gfortran.dg/duplicate_type_9.f90 | 12 +++++++++++
+ 9 files changed, 100 insertions(+), 2 deletions(-)
+ create mode 100644 gcc/testsuite/gfortran.dg/duplicate_type_4.f90
+ create mode 100644 gcc/testsuite/gfortran.dg/duplicate_type_5.f90
+ create mode 100644 gcc/testsuite/gfortran.dg/duplicate_type_6.f90
+ create mode 100644 gcc/testsuite/gfortran.dg/duplicate_type_7.f90
+ create mode 100644 gcc/testsuite/gfortran.dg/duplicate_type_8.f90
+ create mode 100644 gcc/testsuite/gfortran.dg/duplicate_type_9.f90
+
+diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
+index 2b1977c523b..52bd522051e 100644
+--- a/gcc/fortran/lang.opt
++++ b/gcc/fortran/lang.opt
+@@ -469,6 +469,10 @@ Fortran Var(flag_dec_char_conversions)
+ Enable the use of character literals in assignments and data statements
+ for non-character variables.
+
++fdec-duplicates
++Fortran Var(flag_dec_duplicates)
++Allow varibles to be duplicated in the type specification matches.
++
+ fdec-include
+ Fortran Var(flag_dec_include)
+ Enable legacy parsing of INCLUDE as statement.
+diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
+index 3a0b98bf1ec..f19ba87f8a0 100644
+--- a/gcc/fortran/options.c
++++ b/gcc/fortran/options.c
+@@ -77,6 +77,7 @@ set_dec_flags (int value)
+ SET_BITFLAG (flag_dec_format_defaults, value, value);
+ SET_BITFLAG (flag_dec_blank_format_item, value, value);
+ SET_BITFLAG (flag_dec_char_conversions, value, value);
++ SET_BITFLAG (flag_dec_duplicates, value, value);
+ }
+
+ /* Finalize DEC flags. */
+diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
+index 3b988d1be22..9843175cc2a 100644
+--- a/gcc/fortran/symbol.c
++++ b/gcc/fortran/symbol.c
+@@ -1995,6 +1995,8 @@ gfc_add_type (gfc_symbol *sym, gfc_typespec *ts, locus *where)
+ if (sym->attr.result && type == BT_UNKNOWN && sym->ns->proc_name)
+ type = sym->ns->proc_name->ts.type;
+
++ flavor = sym->attr.flavor;
++
+ if (type != BT_UNKNOWN && !(sym->attr.function && sym->attr.implicit_type)
+ && !(gfc_state_stack->previous && gfc_state_stack->previous->previous
+ && gfc_state_stack->previous->previous->state == COMP_SUBMODULE)
+@@ -2007,6 +2009,23 @@ gfc_add_type (gfc_symbol *sym, gfc_typespec *ts, locus *where)
+ else if (sym->attr.function && sym->attr.result)
+ gfc_error ("Symbol %qs at %L already has basic type of %s",
+ sym->ns->proc_name->name, where, gfc_basic_typename (type));
++ else if (flag_dec_duplicates)
++ {
++ /* Ignore temporaries and class/procedure names */
++ if (sym->ts.type == BT_DERIVED || sym->ts.type == BT_CLASS
++ || sym->ts.type == BT_PROCEDURE)
++ return false;
++
++ if (gfc_compare_types (&sym->ts, ts)
++ && (flavor == FL_UNKNOWN || flavor == FL_VARIABLE
++ || flavor == FL_PROCEDURE))
++ {
++ return gfc_notify_std (GFC_STD_LEGACY,
++ "Symbol '%qs' at %L already has "
++ "basic type of %s", sym->name, where,
++ gfc_basic_typename (type));
++ }
++ }
+ else
+ gfc_error ("Symbol %qs at %L already has basic type of %s", sym->name,
+ where, gfc_basic_typename (type));
+@@ -2020,8 +2039,6 @@ gfc_add_type (gfc_symbol *sym, gfc_typespec *ts, locus *where)
+ return false;
+ }
+
+- flavor = sym->attr.flavor;
+-
+ if (flavor == FL_PROGRAM || flavor == FL_BLOCK_DATA || flavor == FL_MODULE
+ || flavor == FL_LABEL
+ || (flavor == FL_PROCEDURE && sym->attr.subroutine)
+diff --git a/gcc/testsuite/gfortran.dg/duplicate_type_4.f90 b/gcc/testsuite/gfortran.dg/duplicate_type_4.f90
+new file mode 100644
+index 00000000000..cdd29ea8846
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/duplicate_type_4.f90
+@@ -0,0 +1,13 @@
++! { dg-do compile }
++! { dg-options "-std=f95" }
++
++! PR fortran/30239
++! Check for errors when a symbol gets declared a type twice, even if it
++! is the same.
++
++INTEGER FUNCTION foo ()
++ IMPLICIT NONE
++ INTEGER :: x
++ INTEGER :: x ! { dg-error "basic type of" }
++ x = 42
++END FUNCTION foo
+diff --git a/gcc/testsuite/gfortran.dg/duplicate_type_5.f90 b/gcc/testsuite/gfortran.dg/duplicate_type_5.f90
+new file mode 100644
+index 00000000000..00f931809aa
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/duplicate_type_5.f90
+@@ -0,0 +1,13 @@
++! { dg-do run }
++! { dg-options "-fdec" }
++!
++! Test case contributed by Mark Eggleston
++!
++
++program test
++ implicit none
++ integer :: x
++ integer :: x
++ x = 42
++ if (x /= 42) stop 1
++end program test
+diff --git a/gcc/testsuite/gfortran.dg/duplicate_type_6.f90 b/gcc/testsuite/gfortran.dg/duplicate_type_6.f90
+new file mode 100644
+index 00000000000..f0df27e323c
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/duplicate_type_6.f90
+@@ -0,0 +1,13 @@
++! { dg-do run }
++! { dg-options "-std=legacy -fdec-duplicates" }
++!
++! Test case contributed by Mark Eggleston
++!
++
++program test
++ implicit none
++ integer :: x
++ integer :: x
++ x = 42
++ if (x /= 42) stop 1
++end program test
+diff --git a/gcc/testsuite/gfortran.dg/duplicate_type_7.f90 b/gcc/testsuite/gfortran.dg/duplicate_type_7.f90
+new file mode 100644
+index 00000000000..f32472ff586
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/duplicate_type_7.f90
+@@ -0,0 +1,13 @@
++! { dg-do run }
++! { dg-options "-fdec-duplicates" }
++!
++! Test case contributed by Mark Eggleston
++!
++
++program test
++ implicit none
++ integer :: x
++ integer :: x! { dg-warning "Legacy Extension" }
++ x = 42
++ if (x /= 42) stop 1
++end program test
+diff --git a/gcc/testsuite/gfortran.dg/duplicate_type_8.f90 b/gcc/testsuite/gfortran.dg/duplicate_type_8.f90
+new file mode 100644
+index 00000000000..23c94add179
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/duplicate_type_8.f90
+@@ -0,0 +1,12 @@
++! { dg-do compile }
++! { dg-options "-fdec -fno-dec-duplicates" }
++!
++! Test case contributed by Mark Eggleston
++!
++
++integer function foo ()
++ implicit none
++ integer :: x
++ integer :: x ! { dg-error "basic type of" }
++ x = 42
++end function foo
+diff --git a/gcc/testsuite/gfortran.dg/duplicate_type_9.f90 b/gcc/testsuite/gfortran.dg/duplicate_type_9.f90
+new file mode 100644
+index 00000000000..d5edee4d8ee
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/duplicate_type_9.f90
+@@ -0,0 +1,12 @@
++! { dg-do compile }
++! { dg-options "-fdec-duplicates -fno-dec-duplicates" }
++!
++! Test case contributed by Mark Eggleston
++!
++
++integer function foo ()
++ implicit none
++ integer :: x
++ integer :: x ! { dg-error "basic type of" }
++ x = 42
++end function foo
+--
+2.27.0
+
diff --git a/SOURCES/gcc11-fortran-fdec-ichar.patch b/SOURCES/gcc11-fortran-fdec-ichar.patch
new file mode 100644
index 0000000..e7b0522
--- /dev/null
+++ b/SOURCES/gcc11-fortran-fdec-ichar.patch
@@ -0,0 +1,78 @@
+From f883ac209b0feea860354cb4ef7ff06dc8063fab Mon Sep 17 00:00:00 2001
+From: Mark Eggleston
+Date: Fri, 22 Jan 2021 12:53:35 +0000
+Subject: [PATCH 03/10] Allow more than one character as argument to ICHAR
+
+Use -fdec to enable.
+---
+ gcc/fortran/check.c | 2 +-
+ gcc/fortran/simplify.c | 4 ++--
+ .../gfortran.dg/dec_ichar_with_string_1.f | 21 +++++++++++++++++++
+ 3 files changed, 24 insertions(+), 3 deletions(-)
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_ichar_with_string_1.f
+
+diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
+index 82db8e4e1b2..623c1cc470e 100644
+--- a/gcc/fortran/check.c
++++ b/gcc/fortran/check.c
+@@ -3157,7 +3157,7 @@ gfc_check_ichar_iachar (gfc_expr *c, gfc_expr *kind)
+ else
+ return true;
+
+- if (i != 1)
++ if (i != 1 && !flag_dec)
+ {
+ gfc_error ("Argument of %s at %L must be of length one",
+ gfc_current_intrinsic, &c->where);
+diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
+index 23317a2e2d9..9900572424f 100644
+--- a/gcc/fortran/simplify.c
++++ b/gcc/fortran/simplify.c
+@@ -3261,7 +3261,7 @@ gfc_simplify_iachar (gfc_expr *e, gfc_expr *kind)
+ if (e->expr_type != EXPR_CONSTANT)
+ return NULL;
+
+- if (e->value.character.length != 1)
++ if (e->value.character.length != 1 && !flag_dec)
+ {
+ gfc_error ("Argument of IACHAR at %L must be of length one", &e->where);
+ return &gfc_bad_expr;
+@@ -3459,7 +3459,7 @@ gfc_simplify_ichar (gfc_expr *e, gfc_expr *kind)
+ if (e->expr_type != EXPR_CONSTANT)
+ return NULL;
+
+- if (e->value.character.length != 1)
++ if (e->value.character.length != 1 && !flag_dec)
+ {
+ gfc_error ("Argument of ICHAR at %L must be of length one", &e->where);
+ return &gfc_bad_expr;
+diff --git a/gcc/testsuite/gfortran.dg/dec_ichar_with_string_1.f b/gcc/testsuite/gfortran.dg/dec_ichar_with_string_1.f
+new file mode 100644
+index 00000000000..85efccecc0f
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_ichar_with_string_1.f
+@@ -0,0 +1,21 @@
++! { dg-do run }
++! { dg-options "-fdec" }
++!
++! Test ICHAR and IACHAR with more than one character as argument
++!
++! Test case contributed by Jim MacArthur
++! Modified by Mark Eggleston
++!
++ PROGRAM ichar_more_than_one_character
++ CHARACTER*4 st/'Test'/
++ INTEGER i
++
++ i = ICHAR(st)
++ if (i.NE.84) STOP 1
++ i = IACHAR(st)
++ if (i.NE.84) STOP 2
++ i = ICHAR('Test')
++ if (i.NE.84) STOP 3
++ i = IACHAR('Test')
++ if (i.NE.84) STOP 4
++ END
+--
+2.27.0
+
diff --git a/SOURCES/gcc11-fortran-fdec-non-integer-index.patch b/SOURCES/gcc11-fortran-fdec-non-integer-index.patch
new file mode 100644
index 0000000..074df3b
--- /dev/null
+++ b/SOURCES/gcc11-fortran-fdec-non-integer-index.patch
@@ -0,0 +1,158 @@
+From 67aef262311d6a746786ee0f59748ccaa7e1e711 Mon Sep 17 00:00:00 2001
+From: Mark Eggleston
+Date: Fri, 22 Jan 2021 13:09:54 +0000
+Subject: [PATCH 04/10] Allow non-integer substring indexes
+
+Use -fdec-non-integer-index compiler flag to enable. Also enabled by -fdec.
+---
+ gcc/fortran/lang.opt | 4 ++++
+ gcc/fortran/options.c | 1 +
+ gcc/fortran/resolve.c | 20 +++++++++++++++++++
+ .../dec_not_integer_substring_indexes_1.f | 18 +++++++++++++++++
+ .../dec_not_integer_substring_indexes_2.f | 18 +++++++++++++++++
+ .../dec_not_integer_substring_indexes_3.f | 18 +++++++++++++++++
+ 6 files changed, 79 insertions(+)
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_not_integer_substring_indexes_1.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_not_integer_substring_indexes_2.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_not_integer_substring_indexes_3.f
+
+diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
+index c4da248f07c..d527c106bd6 100644
+--- a/gcc/fortran/lang.opt
++++ b/gcc/fortran/lang.opt
+@@ -489,6 +489,10 @@ fdec-math
+ Fortran Var(flag_dec_math)
+ Enable legacy math intrinsics for compatibility.
+
++fdec-non-integer-index
++Fortran Var(flag_dec_non_integer_index)
++Enable support for non-integer substring indexes.
++
+ fdec-structure
+ Fortran Var(flag_dec_structure)
+ Enable support for DEC STRUCTURE/RECORD.
+diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
+index f19ba87f8a0..9a042f64881 100644
+--- a/gcc/fortran/options.c
++++ b/gcc/fortran/options.c
+@@ -78,6 +78,7 @@ set_dec_flags (int value)
+ SET_BITFLAG (flag_dec_blank_format_item, value, value);
+ SET_BITFLAG (flag_dec_char_conversions, value, value);
+ SET_BITFLAG (flag_dec_duplicates, value, value);
++ SET_BITFLAG (flag_dec_non_integer_index, value, value);
+ }
+
+ /* Finalize DEC flags. */
+diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
+index 4b90cb59902..bc0df0fdb99 100644
+--- a/gcc/fortran/resolve.c
++++ b/gcc/fortran/resolve.c
+@@ -5131,6 +5131,16 @@ gfc_resolve_substring (gfc_ref *ref, bool *equal_length)
+ if (!gfc_resolve_expr (ref->u.ss.start))
+ return false;
+
++ /* In legacy mode, allow non-integer string indexes by converting */
++ if (flag_dec_non_integer_index && ref->u.ss.start->ts.type != BT_INTEGER
++ && gfc_numeric_ts (&ref->u.ss.start->ts))
++ {
++ gfc_typespec t;
++ t.type = BT_INTEGER;
++ t.kind = ref->u.ss.start->ts.kind;
++ gfc_convert_type_warn (ref->u.ss.start, &t, 2, 1);
++ }
++
+ if (ref->u.ss.start->ts.type != BT_INTEGER)
+ {
+ gfc_error ("Substring start index at %L must be of type INTEGER",
+@@ -5160,6 +5170,16 @@ gfc_resolve_substring (gfc_ref *ref, bool *equal_length)
+ if (!gfc_resolve_expr (ref->u.ss.end))
+ return false;
+
++ /* Non-integer string index endings, as for start */
++ if (flag_dec_non_integer_index && ref->u.ss.end->ts.type != BT_INTEGER
++ && gfc_numeric_ts (&ref->u.ss.end->ts))
++ {
++ gfc_typespec t;
++ t.type = BT_INTEGER;
++ t.kind = ref->u.ss.end->ts.kind;
++ gfc_convert_type_warn (ref->u.ss.end, &t, 2, 1);
++ }
++
+ if (ref->u.ss.end->ts.type != BT_INTEGER)
+ {
+ gfc_error ("Substring end index at %L must be of type INTEGER",
+diff --git a/gcc/testsuite/gfortran.dg/dec_not_integer_substring_indexes_1.f b/gcc/testsuite/gfortran.dg/dec_not_integer_substring_indexes_1.f
+new file mode 100644
+index 00000000000..0be28abaa4b
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_not_integer_substring_indexes_1.f
+@@ -0,0 +1,18 @@
++! { dg-do run }
++! { dg-options "-fdec" }
++!
++! Test not integer substring indexes
++!
++! Test case contributed by Mark Eggleston
++!
++ PROGRAM not_integer_substring_indexes
++ CHARACTER*5 st/'Tests'/
++ REAL ir/1.0/
++ REAL ir2/4.0/
++
++ if (st(ir:4).ne.'Test') stop 1
++ if (st(1:ir2).ne.'Test') stop 2
++ if (st(1.0:4).ne.'Test') stop 3
++ if (st(1:4.0).ne.'Test') stop 4
++ if (st(2.5:4).ne.'est') stop 5
++ END
+diff --git a/gcc/testsuite/gfortran.dg/dec_not_integer_substring_indexes_2.f b/gcc/testsuite/gfortran.dg/dec_not_integer_substring_indexes_2.f
+new file mode 100644
+index 00000000000..3cf05296d0c
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_not_integer_substring_indexes_2.f
+@@ -0,0 +1,18 @@
++! { dg-do run }
++! { dg-options "-fdec-non-integer-index" }
++!
++! Test not integer substring indexes
++!
++! Test case contributed by Mark Eggleston
++!
++ PROGRAM not_integer_substring_indexes
++ CHARACTER*5 st/'Tests'/
++ REAL ir/1.0/
++ REAL ir2/4.0/
++
++ if (st(ir:4).ne.'Test') stop 1
++ if (st(1:ir2).ne.'Test') stop 2
++ if (st(1.0:4).ne.'Test') stop 3
++ if (st(1:4.0).ne.'Test') stop 4
++ if (st(2.5:4).ne.'est') stop 5
++ END
+diff --git a/gcc/testsuite/gfortran.dg/dec_not_integer_substring_indexes_3.f b/gcc/testsuite/gfortran.dg/dec_not_integer_substring_indexes_3.f
+new file mode 100644
+index 00000000000..703de995897
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_not_integer_substring_indexes_3.f
+@@ -0,0 +1,18 @@
++! { dg-do compile }
++! { dg-options "-fdec -fno-dec-non-integer-index" }
++!
++! Test not integer substring indexes
++!
++! Test case contributed by Mark Eggleston
++!
++ PROGRAM not_integer_substring_indexes
++ CHARACTER*5 st/'Tests'/
++ REAL ir/1.0/
++ REAL ir2/4.0/
++
++ if (st(ir:4).ne.'Test') stop 1 ! { dg-error "Substring start index" }
++ if (st(1:ir2).ne.'Test') stop 2 ! { dg-error "Substring end index" }
++ if (st(1.0:4).ne.'Test') stop 3 ! { dg-error "Substring start index" }
++ if (st(1:4.0).ne.'Test') stop 4 ! { dg-error "Substring end index" }
++ if (st(2.5:4).ne.'est') stop 5 ! { dg-error "Substring start index" }
++ END
+--
+2.27.0
+
diff --git a/SOURCES/gcc11-fortran-fdec-non-logical-if.patch b/SOURCES/gcc11-fortran-fdec-non-logical-if.patch
new file mode 100644
index 0000000..0133d23
--- /dev/null
+++ b/SOURCES/gcc11-fortran-fdec-non-logical-if.patch
@@ -0,0 +1,378 @@
+From cc87ddb841017bb0976b05091733609ee17d7f05 Mon Sep 17 00:00:00 2001
+From: Mark Eggleston
+Date: Fri, 22 Jan 2021 13:15:17 +0000
+Subject: [PATCH 07/10] Allow non-logical expressions in IF statements
+
+Use -fdec-non-logical-if to enable feature. Also enabled using -fdec.
+---
+ gcc/fortran/lang.opt | 4 ++
+ gcc/fortran/options.c | 1 +
+ gcc/fortran/resolve.c | 60 ++++++++++++++++---
+ ...gical_expressions_if_statements_blocks_1.f | 25 ++++++++
+ ...gical_expressions_if_statements_blocks_2.f | 25 ++++++++
+ ...gical_expressions_if_statements_blocks_3.f | 25 ++++++++
+ ...gical_expressions_if_statements_blocks_4.f | 45 ++++++++++++++
+ ...gical_expressions_if_statements_blocks_5.f | 45 ++++++++++++++
+ ...gical_expressions_if_statements_blocks_6.f | 45 ++++++++++++++
+ 9 files changed, 266 insertions(+), 9 deletions(-)
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_1.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_2.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_3.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_4.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_5.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_6.f
+
+diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
+index 4a269ebb22d..d886c2f33ed 100644
+--- a/gcc/fortran/lang.opt
++++ b/gcc/fortran/lang.opt
+@@ -497,6 +497,10 @@ fdec-override-kind
+ Fortran Var(flag_dec_override_kind)
+ Enable support for per variable kind specification.
+
++fdec-non-logical-if
++Fortran Var(flag_dec_non_logical_if)
++Enable support for non-logical expressions in if statements.
++
+ fdec-old-init
+ Fortran Var(flag_dec_old_init)
+ Enable support for old style initializers in derived types.
+diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
+index edbab483b36..a946c86790a 100644
+--- a/gcc/fortran/options.c
++++ b/gcc/fortran/options.c
+@@ -81,6 +81,7 @@ set_dec_flags (int value)
+ SET_BITFLAG (flag_dec_non_integer_index, value, value);
+ SET_BITFLAG (flag_dec_old_init, value, value);
+ SET_BITFLAG (flag_dec_override_kind, value, value);
++ SET_BITFLAG (flag_dec_non_logical_if, value, value);
+ }
+
+ /* Finalize DEC flags. */
+diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
+index bc0df0fdb99..07dd039f3bf 100644
+--- a/gcc/fortran/resolve.c
++++ b/gcc/fortran/resolve.c
+@@ -10789,10 +10789,31 @@ gfc_resolve_blocks (gfc_code *b, gfc_namespace *ns)
+ switch (b->op)
+ {
+ case EXEC_IF:
+- if (t && b->expr1 != NULL
+- && (b->expr1->ts.type != BT_LOGICAL || b->expr1->rank != 0))
+- gfc_error ("IF clause at %L requires a scalar LOGICAL expression",
+- &b->expr1->where);
++ if (t && b->expr1 != NULL)
++ {
++ if (flag_dec_non_logical_if && b->expr1->ts.type != BT_LOGICAL)
++ {
++ gfc_expr* cast;
++ cast = gfc_ne (b->expr1,
++ gfc_get_int_expr (1, &gfc_current_locus, 0),
++ INTRINSIC_NE);
++ if (cast == NULL)
++ gfc_internal_error ("gfc_resolve_blocks(): Failed to cast "
++ "to LOGICAL in IF");
++ b->expr1 = cast;
++ if (warn_conversion_extra)
++ {
++ gfc_warning (OPT_Wconversion_extra, "Non-LOGICAL type in"
++ " IF statement condition %L will be true if"
++ " it evaluates to nonzero",
++ &b->expr1->where);
++ }
++ }
++
++ if ((b->expr1->ts.type != BT_LOGICAL || b->expr1->rank != 0))
++ gfc_error ("IF clause at %L requires a scalar LOGICAL "
++ "expression", &b->expr1->where);
++ }
+ break;
+
+ case EXEC_WHERE:
+@@ -12093,11 +12114,32 @@ start:
+ break;
+
+ case EXEC_IF:
+- if (t && code->expr1 != NULL
+- && (code->expr1->ts.type != BT_LOGICAL
+- || code->expr1->rank != 0))
+- gfc_error ("IF clause at %L requires a scalar LOGICAL expression",
+- &code->expr1->where);
++ if (t && code->expr1 != NULL)
++ {
++ if (flag_dec_non_logical_if
++ && code->expr1->ts.type != BT_LOGICAL)
++ {
++ gfc_expr* cast;
++ cast = gfc_ne (code->expr1,
++ gfc_get_int_expr (1, &gfc_current_locus, 0),
++ INTRINSIC_NE);
++ if (cast == NULL)
++ gfc_internal_error ("gfc_resolve_code(): Failed to cast "
++ "to LOGICAL in IF");
++ code->expr1 = cast;
++ if (warn_conversion_extra)
++ {
++ gfc_warning (OPT_Wconversion_extra, "Non-LOGICAL type in"
++ " IF statement condition %L will be true if"
++ " it evaluates to nonzero",
++ &code->expr1->where);
++ }
++ }
++
++ if (code->expr1->ts.type != BT_LOGICAL || code->expr1->rank != 0)
++ gfc_error ("IF clause at %L requires a scalar LOGICAL "
++ "expression", &code->expr1->where);
++ }
+ break;
+
+ case EXEC_CALL:
+diff --git a/gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_1.f b/gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_1.f
+new file mode 100644
+index 00000000000..0101db893ca
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_1.f
+@@ -0,0 +1,25 @@
++! { dg-do run }
++! { dg-options "-fdec -Wconversion-extra" }
++!
++! Allow logical expressions in if statements and blocks
++!
++! Contributed by Francisco Redondo Marchena
++! and Jeff Law
++! Modified by Mark Eggleston
++!
++ PROGRAM logical_exp_if_st_bl
++ INTEGER ipos/1/
++ INTEGER ineg/0/
++
++ ! Test non logical variables
++ if (ineg) STOP 1 ! { dg-warning "if it evaluates to nonzero" }
++ if (0) STOP 2 ! { dg-warning "if it evaluates to nonzero" }
++
++ ! Test non logical expressions in if statements
++ if (MOD(ipos, 1)) STOP 3 ! { dg-warning "if it evaluates to nonzero" }
++
++ ! Test non logical expressions in if blocks
++ if (MOD(2 * ipos, 2)) then ! { dg-warning "if it evaluates to nonzero" }
++ STOP 4
++ endif
++ END
+diff --git a/gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_2.f b/gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_2.f
+new file mode 100644
+index 00000000000..876f4e09508
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_2.f
+@@ -0,0 +1,25 @@
++! { dg-do run }
++! { dg-options "-fdec-non-logical-if -Wconversion-extra" }
++!
++! Allow logical expressions in if statements and blocks
++!
++! Contributed by Francisco Redondo Marchena
++! and Jeff Law
++! Modified by Mark Eggleston
++!
++ PROGRAM logical_exp_if_st_bl
++ INTEGER ipos/1/
++ INTEGER ineg/0/
++
++ ! Test non logical variables
++ if (ineg) STOP 1 ! { dg-warning "if it evaluates to nonzero" }
++ if (0) STOP 2 ! { dg-warning "if it evaluates to nonzero" }
++
++ ! Test non logical expressions in if statements
++ if (MOD(ipos, 1)) STOP 3 ! { dg-warning "if it evaluates to nonzero" }
++
++ ! Test non logical expressions in if blocks
++ if (MOD(2 * ipos, 2)) then ! { dg-warning "if it evaluates to nonzero" }
++ STOP 4
++ endif
++ END
+diff --git a/gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_3.f b/gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_3.f
+new file mode 100644
+index 00000000000..35cb4c51b8d
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_3.f
+@@ -0,0 +1,25 @@
++! { dg-do compile }
++! { dg-options "-fdec -fno-dec-non-logical-if" }
++!
++! Allow logical expressions in if statements and blocks
++!
++! Contributed by Francisco Redondo Marchena
++! and Jeff Law
++! Modified by Mark Eggleston
++!
++ PROGRAM logical_exp_if_st_bl
++ INTEGER ipos/1/
++ INTEGER ineg/0/
++
++ ! Test non logical variables
++ if (ineg) STOP 1 ! { dg-error "IF clause at" }
++ if (0) STOP 2 ! { dg-error "IF clause at" }
++
++ ! Test non logical expressions in if statements
++ if (MOD(ipos, 1)) STOP 3 ! { dg-error "IF clause at" }
++
++ ! Test non logical expressions in if blocks
++ if (MOD(2 * ipos, 2)) then ! { dg-error "IF clause at" }
++ STOP 4
++ endif
++ END
+diff --git a/gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_4.f b/gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_4.f
+new file mode 100644
+index 00000000000..7b60b60827f
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_4.f
+@@ -0,0 +1,45 @@
++! { dg-do run }
++! { dg-options "-fdec -Wconversion-extra" }
++!
++! Contributed by Francisco Redondo Marchena
++! and Jeff Law
++! Modified by Mark Eggleston
++!
++ function othersub1()
++ integer*4 othersub1
++ othersub1 = 9
++ end
++
++ function othersub2()
++ integer*4 othersub2
++ othersub2 = 0
++ end
++
++ program MAIN
++ integer*4 othersub1
++ integer*4 othersub2
++ integer a /1/
++ integer b /2/
++
++ if (othersub1()) then ! { dg-warning "if it evaluates to nonzero" }
++ write(*,*) "OK"
++ else
++ stop 1
++ end if
++ if (othersub2()) then ! { dg-warning "if it evaluates to nonzero" }
++ stop 2
++ else
++ write(*,*) "OK"
++ end if
++ if (a-b) then ! { dg-warning "if it evaluates to nonzero" }
++ write(*,*) "OK"
++ else
++ stop 3
++ end if
++ if (b-(a+1)) then ! { dg-warning "if it evaluates to nonzero" }
++ stop 3
++ else
++ write(*,*) "OK"
++ end if
++ end
++
+diff --git a/gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_5.f b/gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_5.f
+new file mode 100644
+index 00000000000..80336f48ca1
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_5.f
+@@ -0,0 +1,45 @@
++! { dg-do run }
++! { dg-options "-fdec-non-logical-if -Wconversion-extra" }
++!
++! Contributed by Francisco Redondo Marchena
++! and Jeff Law
++! Modified by Mark Eggleston
++!
++ function othersub1()
++ integer*4 othersub1
++ othersub1 = 9
++ end
++
++ function othersub2()
++ integer*4 othersub2
++ othersub2 = 0
++ end
++
++ program MAIN
++ integer*4 othersub1
++ integer*4 othersub2
++ integer a /1/
++ integer b /2/
++
++ if (othersub1()) then ! { dg-warning "Non-LOGICAL type in IF statement" }
++ write(*,*) "OK"
++ else
++ stop 1
++ end if
++ if (othersub2()) then ! { dg-warning "Non-LOGICAL type in IF statement" }
++ stop 2
++ else
++ write(*,*) "OK"
++ end if
++ if (a-b) then ! { dg-warning "Non-LOGICAL type in IF statement" }
++ write(*,*) "OK"
++ else
++ stop 3
++ end if
++ if (b-(a+1)) then ! { dg-warning "Non-LOGICAL type in IF statement" }
++ stop 3
++ else
++ write(*,*) "OK"
++ end if
++ end
++
+diff --git a/gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_6.f b/gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_6.f
+new file mode 100644
+index 00000000000..e1125ca717a
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_logical_expressions_if_statements_blocks_6.f
+@@ -0,0 +1,45 @@
++! { dg-do compile }
++! { dg-options "-fdec -fno-dec-non-logical-if" }
++!
++! Contributed by Francisco Redondo Marchena
++! and Jeff Law
++! Modified by Mark Eggleston
++!
++ function othersub1()
++ integer*4 othersub1
++ othersub1 = 9
++ end
++
++ function othersub2()
++ integer*4 othersub2
++ othersub2 = 0
++ end
++
++ program MAIN
++ integer*4 othersub1
++ integer*4 othersub2
++ integer a /1/
++ integer b /2/
++
++ if (othersub1()) then ! { dg-error "IF clause at" }
++ write(*,*) "OK"
++ else
++ stop 1
++ end if
++ if (othersub2()) then ! { dg-error "IF clause at" }
++ stop 2
++ else
++ write(*,*) "OK"
++ end if
++ if (a-b) then ! { dg-error "IF clause at" }
++ write(*,*) "OK"
++ else
++ stop 3
++ end if
++ if (b-(a+1)) then ! { dg-error "IF clause at" }
++ stop 3
++ else
++ write(*,*) "OK"
++ end if
++ end
++
+--
+2.27.0
+
diff --git a/SOURCES/gcc11-fortran-fdec-old-init.patch b/SOURCES/gcc11-fortran-fdec-old-init.patch
new file mode 100644
index 0000000..8554f2e
--- /dev/null
+++ b/SOURCES/gcc11-fortran-fdec-old-init.patch
@@ -0,0 +1,185 @@
+From 8bcc0f85ed1718c0dd9033ad4a34df181aabaffe Mon Sep 17 00:00:00 2001
+From: Mark Eggleston
+Date: Fri, 22 Jan 2021 13:11:06 +0000
+Subject: [PATCH 05/10] Allow old-style initializers in derived types
+
+This allows simple declarations in derived types and structures, such as:
+ LOGICAL*1 NIL /0/
+Only single value expressions are allowed at the moment.
+
+Use -fdec-old-init to enable. Also enabled by -fdec.
+---
+ gcc/fortran/decl.c | 27 +++++++++++++++----
+ gcc/fortran/lang.opt | 4 +++
+ gcc/fortran/options.c | 1 +
+ ...ec_derived_types_initialised_old_style_1.f | 25 +++++++++++++++++
+ ...ec_derived_types_initialised_old_style_2.f | 25 +++++++++++++++++
+ ...ec_derived_types_initialised_old_style_3.f | 26 ++++++++++++++++++
+ 6 files changed, 103 insertions(+), 5 deletions(-)
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_derived_types_initialised_old_style_1.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_derived_types_initialised_old_style_2.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_derived_types_initialised_old_style_3.f
+
+diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
+index 723915822f3..5c8c1b7981b 100644
+--- a/gcc/fortran/decl.c
++++ b/gcc/fortran/decl.c
+@@ -2827,12 +2827,29 @@ variable_decl (int elem)
+ but not components of derived types. */
+ else if (gfc_current_state () == COMP_DERIVED)
+ {
+- gfc_error ("Invalid old style initialization for derived type "
+- "component at %C");
+- m = MATCH_ERROR;
+- goto cleanup;
++ if (flag_dec_old_init)
++ {
++ /* Attempt to match an old-style initializer which is a simple
++ integer or character expression; this will not work with
++ multiple values. */
++ m = gfc_match_init_expr (&initializer);
++ if (m == MATCH_ERROR)
++ goto cleanup;
++ else if (m == MATCH_YES)
++ {
++ m = gfc_match ("/");
++ if (m != MATCH_YES)
++ goto cleanup;
++ }
++ }
++ else
++ {
++ gfc_error ("Invalid old style initialization for derived type "
++ "component at %C");
++ m = MATCH_ERROR;
++ goto cleanup;
++ }
+ }
+-
+ /* For structure components, read the initializer as a special
+ expression and let the rest of this function apply the initializer
+ as usual. */
+diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
+index d527c106bd6..25cc948699b 100644
+--- a/gcc/fortran/lang.opt
++++ b/gcc/fortran/lang.opt
+@@ -493,6 +493,10 @@ fdec-non-integer-index
+ Fortran Var(flag_dec_non_integer_index)
+ Enable support for non-integer substring indexes.
+
++fdec-old-init
++Fortran Var(flag_dec_old_init)
++Enable support for old style initializers in derived types.
++
+ fdec-structure
+ Fortran Var(flag_dec_structure)
+ Enable support for DEC STRUCTURE/RECORD.
+diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
+index 9a042f64881..d6bd36c3a8a 100644
+--- a/gcc/fortran/options.c
++++ b/gcc/fortran/options.c
+@@ -79,6 +79,7 @@ set_dec_flags (int value)
+ SET_BITFLAG (flag_dec_char_conversions, value, value);
+ SET_BITFLAG (flag_dec_duplicates, value, value);
+ SET_BITFLAG (flag_dec_non_integer_index, value, value);
++ SET_BITFLAG (flag_dec_old_init, value, value);
+ }
+
+ /* Finalize DEC flags. */
+diff --git a/gcc/testsuite/gfortran.dg/dec_derived_types_initialised_old_style_1.f b/gcc/testsuite/gfortran.dg/dec_derived_types_initialised_old_style_1.f
+new file mode 100644
+index 00000000000..eac4f9bfcf1
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_derived_types_initialised_old_style_1.f
+@@ -0,0 +1,25 @@
++! { dg-do run }
++! { dg-options "-fdec" }
++!
++! Test old style initializers in derived types
++!
++! Contributed by Jim MacArthur
++! Modified by Mark Eggleston
++!
++ PROGRAM spec_in_var
++ TYPE STRUCT1
++ INTEGER*4 ID /8/
++ INTEGER*4 TYPE /5/
++ INTEGER*8 DEFVAL /0/
++ CHARACTER*(5) NAME /'tests'/
++ LOGICAL*1 NIL /0/
++ END TYPE STRUCT1
++
++ TYPE (STRUCT1) SINST
++
++ IF(SINST%ID.NE.8) STOP 1
++ IF(SINST%TYPE.NE.5) STOP 2
++ IF(SINST%DEFVAL.NE.0) STOP 3
++ IF(SINST%NAME.NE.'tests') STOP 4
++ IF(SINST%NIL) STOP 5
++ END
+diff --git a/gcc/testsuite/gfortran.dg/dec_derived_types_initialised_old_style_2.f b/gcc/testsuite/gfortran.dg/dec_derived_types_initialised_old_style_2.f
+new file mode 100644
+index 00000000000..d904c8b2974
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_derived_types_initialised_old_style_2.f
+@@ -0,0 +1,25 @@
++! { dg-do run }
++! { dg-options "-std=legacy -fdec-old-init" }
++!
++! Test old style initializers in derived types
++!
++! Contributed by Jim MacArthur
++! Modified by Mark Eggleston
++!
++ PROGRAM spec_in_var
++ TYPE STRUCT1
++ INTEGER*4 ID /8/
++ INTEGER*4 TYPE /5/
++ INTEGER*8 DEFVAL /0/
++ CHARACTER*(5) NAME /'tests'/
++ LOGICAL*1 NIL /0/
++ END TYPE STRUCT1
++
++ TYPE (STRUCT1) SINST
++
++ IF(SINST%ID.NE.8) STOP 1
++ IF(SINST%TYPE.NE.5) STOP 2
++ IF(SINST%DEFVAL.NE.0) STOP 3
++ IF(SINST%NAME.NE.'tests') STOP 4
++ IF(SINST%NIL) STOP 5
++ END
+diff --git a/gcc/testsuite/gfortran.dg/dec_derived_types_initialised_old_style_3.f b/gcc/testsuite/gfortran.dg/dec_derived_types_initialised_old_style_3.f
+new file mode 100644
+index 00000000000..58c2b4b66cf
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_derived_types_initialised_old_style_3.f
+@@ -0,0 +1,26 @@
++! { dg-do compile }
++! { dg-options "-std=legacy -fdec -fno-dec-old-init" }
++!
++! Test old style initializers in derived types
++!
++! Contributed by Jim MacArthur
++! Modified by Mark Eggleston
++!
++
++ PROGRAM spec_in_var
++ TYPE STRUCT1
++ INTEGER*4 ID /8/ ! { dg-error "Invalid old style initialization" }
++ INTEGER*4 TYPE /5/ ! { dg-error "Invalid old style initialization" }
++ INTEGER*8 DEFVAL /0/ ! { dg-error "Invalid old style initialization" }
++ CHARACTER*(5) NAME /'tests'/ ! { dg-error "Invalid old style initialization" }
++ LOGICAL*1 NIL /0/ ! { dg-error "Invalid old style initialization" }
++ END TYPE STRUCT1
++
++ TYPE (STRUCT1) SINST
++
++ IF(SINST%ID.NE.8) STOP 1 ! { dg-error "'id' at \\(1\\) is not a member" }
++ IF(SINST%TYPE.NE.5) STOP 2 ! { dg-error "'type' at \\(1\\) is not a member" }
++ IF(SINST%DEFVAL.NE.0) STOP 3 ! { dg-error "'defval' at \\(1\\) is not a member" }
++ IF(SINST%NAME.NE.'tests') STOP 4 ! { dg-error "'name' at \\(1\\) is not a member" }
++ IF(SINST%NIL) STOP 5 ! { dg-error "'nil' at \\(1\\) is not a member" }
++ END
+--
+2.27.0
+
diff --git a/SOURCES/gcc11-fortran-fdec-override-kind.patch b/SOURCES/gcc11-fortran-fdec-override-kind.patch
new file mode 100644
index 0000000..e1c7b83
--- /dev/null
+++ b/SOURCES/gcc11-fortran-fdec-override-kind.patch
@@ -0,0 +1,588 @@
+From 786869fd62813e80da9b6545a295d53c36275c19 Mon Sep 17 00:00:00 2001
+From: Mark Eggleston
+Date: Fri, 22 Jan 2021 13:12:14 +0000
+Subject: [PATCH 06/10] Allow string length and kind to be specified on a per
+ variable basis.
+
+This allows kind/length to be mixed with array specification in
+declarations.
+
+e.g.
+
+ INTEGER*4 x*2, y*8
+ CHARACTER names*20(10)
+ REAL v(100)*8, vv*4(50)
+
+The per-variable size overrides the kind or length specified for the type.
+
+Use -fdec-override-kind to enable. Also enabled by -fdec.
+
+Note: this feature is a merger of two previously separate features.
+
+Now accepts named constants as kind parameters:
+
+ INTEGER A
+ PARAMETER (A=2)
+ INTEGER B*(A)
+
+Contributed by Mark Eggleston
+
+Now rejects invalid kind parameters and prints error messages:
+
+ INTEGER X*3
+
+caused an internal compiler error.
+
+Contributed by Mark Eggleston
+---
+ gcc/fortran/decl.c | 156 ++++++++++++++----
+ gcc/fortran/lang.opt | 4 +
+ gcc/fortran/options.c | 1 +
+ .../dec_mixed_char_array_declaration_1.f | 13 ++
+ .../dec_mixed_char_array_declaration_2.f | 13 ++
+ .../dec_mixed_char_array_declaration_3.f | 13 ++
+ .../gfortran.dg/dec_spec_in_variable_1.f | 31 ++++
+ .../gfortran.dg/dec_spec_in_variable_2.f | 31 ++++
+ .../gfortran.dg/dec_spec_in_variable_3.f | 31 ++++
+ .../gfortran.dg/dec_spec_in_variable_4.f | 14 ++
+ .../gfortran.dg/dec_spec_in_variable_5.f | 19 +++
+ .../gfortran.dg/dec_spec_in_variable_6.f | 19 +++
+ .../gfortran.dg/dec_spec_in_variable_7.f | 15 ++
+ .../gfortran.dg/dec_spec_in_variable_8.f | 14 ++
+ 14 files changed, 340 insertions(+), 34 deletions(-)
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_mixed_char_array_declaration_1.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_mixed_char_array_declaration_2.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_mixed_char_array_declaration_3.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_spec_in_variable_1.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_spec_in_variable_2.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_spec_in_variable_3.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_spec_in_variable_4.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_spec_in_variable_5.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_spec_in_variable_6.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_spec_in_variable_7.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_spec_in_variable_8.f
+
+diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
+index 5c8c1b7981b..f7dc9d8263d 100644
+--- a/gcc/fortran/decl.c
++++ b/gcc/fortran/decl.c
+@@ -1213,6 +1213,54 @@ syntax:
+ return MATCH_ERROR;
+ }
+
++/* This matches the nonstandard kind given after a variable name, like:
++ INTEGER x*2, y*4
++ The per-variable kind will override any kind given in the type
++ declaration.
++*/
++
++static match
++match_per_symbol_kind (int *length)
++{
++ match m;
++ gfc_expr *expr = NULL;
++
++ m = gfc_match_char ('*');
++ if (m != MATCH_YES)
++ return m;
++
++ m = gfc_match_small_literal_int (length, NULL);
++ if (m == MATCH_YES || m == MATCH_ERROR)
++ return m;
++
++ if (gfc_match_char ('(') == MATCH_NO)
++ return MATCH_ERROR;
++
++ m = gfc_match_expr (&expr);
++ if (m == MATCH_YES)
++ {
++ m = MATCH_ERROR; // Assume error
++ if (gfc_expr_check_typed (expr, gfc_current_ns, false))
++ {
++ if ((expr->expr_type == EXPR_CONSTANT)
++ && (expr->ts.type == BT_INTEGER))
++ {
++ *length = mpz_get_si(expr->value.integer);
++ m = MATCH_YES;
++ }
++ }
++
++ if (m == MATCH_YES)
++ {
++ if (gfc_match_char (')') == MATCH_NO)
++ m = MATCH_ERROR;
++ }
++ }
++
++ if (expr != NULL)
++ gfc_free_expr (expr);
++ return m;
++}
+
+ /* Special subroutine for finding a symbol. Check if the name is found
+ in the current name space. If not, and we're compiling a function or
+@@ -2443,6 +2491,35 @@ check_function_name (char *name)
+ }
+
+
++static match
++match_character_length_clause (gfc_charlen **cl, bool *cl_deferred, int elem)
++{
++ gfc_expr* char_len;
++ char_len = NULL;
++
++ match m = match_char_length (&char_len, cl_deferred, false);
++ if (m == MATCH_YES)
++ {
++ *cl = gfc_new_charlen (gfc_current_ns, NULL);
++ (*cl)->length = char_len;
++ }
++ else if (m == MATCH_NO)
++ {
++ if (elem > 1
++ && (current_ts.u.cl->length == NULL
++ || current_ts.u.cl->length->expr_type != EXPR_CONSTANT))
++ {
++ *cl = gfc_new_charlen (gfc_current_ns, NULL);
++ (*cl)->length = gfc_copy_expr (current_ts.u.cl->length);
++ }
++ else
++ *cl = current_ts.u.cl;
++
++ *cl_deferred = current_ts.deferred;
++ }
++ return m;
++}
++
+ /* Match a variable name with an optional initializer. When this
+ subroutine is called, a variable is expected to be parsed next.
+ Depending on what is happening at the moment, updates either the
+@@ -2453,7 +2530,7 @@ variable_decl (int elem)
+ {
+ char name[GFC_MAX_SYMBOL_LEN + 1];
+ static unsigned int fill_id = 0;
+- gfc_expr *initializer, *char_len;
++ gfc_expr *initializer;
+ gfc_array_spec *as;
+ gfc_array_spec *cp_as; /* Extra copy for Cray Pointees. */
+ gfc_charlen *cl;
+@@ -2462,11 +2539,15 @@ variable_decl (int elem)
+ match m;
+ bool t;
+ gfc_symbol *sym;
++ match cl_match;
++ match kind_match;
++ int overridden_kind;
+ char c;
+
+ initializer = NULL;
+ as = NULL;
+ cp_as = NULL;
++ kind_match = MATCH_NO;
+
+ /* When we get here, we've just matched a list of attributes and
+ maybe a type and a double colon. The next thing we expect to see
+@@ -2519,6 +2600,28 @@ variable_decl (int elem)
+
+ var_locus = gfc_current_locus;
+
++
++ cl = NULL;
++ cl_deferred = false;
++ cl_match = MATCH_NO;
++
++ /* Check for a character length clause before an array clause */
++ if (flag_dec_override_kind)
++ {
++ if (current_ts.type == BT_CHARACTER)
++ {
++ cl_match = match_character_length_clause (&cl, &cl_deferred, elem);
++ if (cl_match == MATCH_ERROR)
++ goto cleanup;
++ }
++ else
++ {
++ kind_match = match_per_symbol_kind (&overridden_kind);
++ if (kind_match == MATCH_ERROR)
++ goto cleanup;
++ }
++ }
++
+ /* Now we could see the optional array spec. or character length. */
+ m = gfc_match_array_spec (&as, true, true);
+ if (m == MATCH_ERROR)
+@@ -2667,40 +2770,12 @@ variable_decl (int elem)
+ }
+ }
+
+- char_len = NULL;
+- cl = NULL;
+- cl_deferred = false;
+-
+- if (current_ts.type == BT_CHARACTER)
++ /* Second chance for a character length clause */
++ if (cl_match == MATCH_NO && current_ts.type == BT_CHARACTER)
+ {
+- switch (match_char_length (&char_len, &cl_deferred, false))
+- {
+- case MATCH_YES:
+- cl = gfc_new_charlen (gfc_current_ns, NULL);
+-
+- cl->length = char_len;
+- break;
+-
+- /* Non-constant lengths need to be copied after the first
+- element. Also copy assumed lengths. */
+- case MATCH_NO:
+- if (elem > 1
+- && (current_ts.u.cl->length == NULL
+- || current_ts.u.cl->length->expr_type != EXPR_CONSTANT))
+- {
+- cl = gfc_new_charlen (gfc_current_ns, NULL);
+- cl->length = gfc_copy_expr (current_ts.u.cl->length);
+- }
+- else
+- cl = current_ts.u.cl;
+-
+- cl_deferred = current_ts.deferred;
+-
+- break;
+-
+- case MATCH_ERROR:
+- goto cleanup;
+- }
++ m = match_character_length_clause (&cl, &cl_deferred, elem);
++ if (m == MATCH_ERROR)
++ goto cleanup;
+ }
+
+ /* The dummy arguments and result of the abreviated form of MODULE
+@@ -2802,6 +2877,19 @@ variable_decl (int elem)
+ goto cleanup;
+ }
+
++ if (kind_match == MATCH_YES)
++ {
++ gfc_find_symbol (name, gfc_current_ns, 1, &sym);
++ /* sym *must* be found at this point */
++ sym->ts.kind = overridden_kind;
++ if (gfc_validate_kind (sym->ts.type, sym->ts.kind, true) < 0)
++ {
++ gfc_error ("Kind %d not supported for type %s at %C",
++ sym->ts.kind, gfc_basic_typename (sym->ts.type));
++ return MATCH_ERROR;
++ }
++ }
++
+ if (!check_function_name (name))
+ {
+ m = MATCH_ERROR;
+diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
+index 25cc948699b..4a269ebb22d 100644
+--- a/gcc/fortran/lang.opt
++++ b/gcc/fortran/lang.opt
+@@ -493,6 +493,10 @@ fdec-non-integer-index
+ Fortran Var(flag_dec_non_integer_index)
+ Enable support for non-integer substring indexes.
+
++fdec-override-kind
++Fortran Var(flag_dec_override_kind)
++Enable support for per variable kind specification.
++
+ fdec-old-init
+ Fortran Var(flag_dec_old_init)
+ Enable support for old style initializers in derived types.
+diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
+index d6bd36c3a8a..edbab483b36 100644
+--- a/gcc/fortran/options.c
++++ b/gcc/fortran/options.c
+@@ -80,6 +80,7 @@ set_dec_flags (int value)
+ SET_BITFLAG (flag_dec_duplicates, value, value);
+ SET_BITFLAG (flag_dec_non_integer_index, value, value);
+ SET_BITFLAG (flag_dec_old_init, value, value);
++ SET_BITFLAG (flag_dec_override_kind, value, value);
+ }
+
+ /* Finalize DEC flags. */
+diff --git a/gcc/testsuite/gfortran.dg/dec_mixed_char_array_declaration_1.f b/gcc/testsuite/gfortran.dg/dec_mixed_char_array_declaration_1.f
+new file mode 100644
+index 00000000000..706ea4112a4
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_mixed_char_array_declaration_1.f
+@@ -0,0 +1,13 @@
++! { dg-do run }
++! { dg-options "-fdec" }
++!
++! Test character declaration with mixed string length and array specification
++!
++! Contributed by Jim MacArthur
++! Modified by Mark Eggleston
++!
++ PROGRAM character_declaration
++ CHARACTER ASPEC_SLENGTH*2 (5) /'01','02','03','04','05'/
++ CHARACTER SLENGTH_ASPEC(5)*2 /'01','02','03','04','05'/
++ if (ASPEC_SLENGTH(3).NE.SLENGTH_ASPEC(3)) STOP 1
++ END
+diff --git a/gcc/testsuite/gfortran.dg/dec_mixed_char_array_declaration_2.f b/gcc/testsuite/gfortran.dg/dec_mixed_char_array_declaration_2.f
+new file mode 100644
+index 00000000000..26d2acf01de
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_mixed_char_array_declaration_2.f
+@@ -0,0 +1,13 @@
++! { dg-do run }
++! { dg-options "-fdec-override-kind" }
++!
++! Test character declaration with mixed string length and array specification
++!
++! Contributed by Jim MacArthur
++! Modified by Mark Eggleston
++!
++ PROGRAM character_declaration
++ CHARACTER ASPEC_SLENGTH*2 (5) /'01','02','03','04','05'/
++ CHARACTER SLENGTH_ASPEC(5)*2 /'01','02','03','04','05'/
++ if (ASPEC_SLENGTH(3).NE.SLENGTH_ASPEC(3)) STOP 1
++ END
+diff --git a/gcc/testsuite/gfortran.dg/dec_mixed_char_array_declaration_3.f b/gcc/testsuite/gfortran.dg/dec_mixed_char_array_declaration_3.f
+new file mode 100644
+index 00000000000..76e4f0bdb93
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_mixed_char_array_declaration_3.f
+@@ -0,0 +1,13 @@
++! { dg-do compile }
++! { dg-options "-fdec-override-kind -fno-dec-override-kind" }
++!
++! Test character declaration with mixed string length and array specification
++!
++! Contributed by Jim MacArthur
++! Modified by Mark Eggleston
++!
++ PROGRAM character_declaration
++ CHARACTER ASPEC_SLENGTH*2 (5) /'01','02','03','04','05'/ ! { dg-error "Syntax error" }
++ CHARACTER SLENGTH_ASPEC(5)*2 /'01','02','03','04','05'/
++ if (ASPEC_SLENGTH(3).NE.SLENGTH_ASPEC(3)) STOP 1 ! { dg-error " Operands of comparison operator" }
++ END
+diff --git a/gcc/testsuite/gfortran.dg/dec_spec_in_variable_1.f b/gcc/testsuite/gfortran.dg/dec_spec_in_variable_1.f
+new file mode 100644
+index 00000000000..edd0f5874b7
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_spec_in_variable_1.f
+@@ -0,0 +1,31 @@
++! { dg-do run }
++! { dg-options "-fdec" }
++!
++! Test kind specification in variable not in type
++!
++! Contributed by Mark Eggleston
++!
++ program spec_in_var
++ integer*8 ai*1, bi*4, ci
++ real*4 ar*4, br*8, cr
++
++ ai = 1
++ ar = 1.0
++ bi = 2
++ br = 2.0
++ ci = 3
++ cr = 3.0
++
++ if (ai .ne. 1) stop 1
++ if (abs(ar - 1.0) > 1.0D-6) stop 2
++ if (bi .ne. 2) stop 3
++ if (abs(br - 2.0) > 1.0D-6) stop 4
++ if (ci .ne. 3) stop 5
++ if (abs(cr - 3.0) > 1.0D-6) stop 6
++ if (kind(ai) .ne. 1) stop 7
++ if (kind(ar) .ne. 4) stop 8
++ if (kind(bi) .ne. 4) stop 9
++ if (kind(br) .ne. 8) stop 10
++ if (kind(ci) .ne. 8) stop 11
++ if (kind(cr) .ne. 4) stop 12
++ end
+diff --git a/gcc/testsuite/gfortran.dg/dec_spec_in_variable_2.f b/gcc/testsuite/gfortran.dg/dec_spec_in_variable_2.f
+new file mode 100644
+index 00000000000..bfaba584dbb
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_spec_in_variable_2.f
+@@ -0,0 +1,31 @@
++! { dg-do run }
++! { dg-options "-fdec-override-kind" }
++!
++! Test kind specification in variable not in type
++!
++! Contributed by Mark Eggleston
++!
++ program spec_in_var
++ integer*8 ai*1, bi*4, ci
++ real*4 ar*4, br*8, cr
++
++ ai = 1
++ ar = 1.0
++ bi = 2
++ br = 2.0
++ ci = 3
++ cr = 3.0
++
++ if (ai .ne. 1) stop 1
++ if (abs(ar - 1.0) > 1.0D-6) stop 2
++ if (bi .ne. 2) stop 3
++ if (abs(br - 2.0) > 1.0D-6) stop 4
++ if (ci .ne. 3) stop 5
++ if (abs(cr - 3.0) > 1.0D-6) stop 6
++ if (kind(ai) .ne. 1) stop 7
++ if (kind(ar) .ne. 4) stop 8
++ if (kind(bi) .ne. 4) stop 9
++ if (kind(br) .ne. 8) stop 10
++ if (kind(ci) .ne. 8) stop 11
++ if (kind(cr) .ne. 4) stop 12
++ end
+diff --git a/gcc/testsuite/gfortran.dg/dec_spec_in_variable_3.f b/gcc/testsuite/gfortran.dg/dec_spec_in_variable_3.f
+new file mode 100644
+index 00000000000..5ff434e7466
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_spec_in_variable_3.f
+@@ -0,0 +1,31 @@
++! { dg-do compile }
++! { dg-options "-fdec -fno-dec-override-kind" }
++!
++! Test kind specification in variable not in type
++!
++! Contributed by Mark Eggleston
++!
++ program spec_in_var
++ integer*8 ai*1, bi*4, ci ! { dg-error "Syntax error" }
++ real*4 ar*4, br*8, cr ! { dg-error "Syntax error" }
++
++ ai = 1
++ ar = 1.0
++ bi = 2
++ br = 2.0
++ ci = 3
++ cr = 3.0
++
++ if (ai .ne. 1) stop 1
++ if (abs(ar - 1.0) > 1.0D-6) stop 2
++ if (bi .ne. 2) stop 3
++ if (abs(br - 2.0) > 1.0D-6) stop 4
++ if (ci .ne. 3) stop 5
++ if (abs(cr - 3.0) > 1.0D-6) stop 6
++ if (kind(ai) .ne. 1) stop 7
++ if (kind(ar) .ne. 4) stop 8
++ if (kind(bi) .ne. 4) stop 9
++ if (kind(br) .ne. 8) stop 10
++ if (kind(ci) .ne. 8) stop 11
++ if (kind(cr) .ne. 4) stop 12
++ end
+diff --git a/gcc/testsuite/gfortran.dg/dec_spec_in_variable_4.f b/gcc/testsuite/gfortran.dg/dec_spec_in_variable_4.f
+new file mode 100644
+index 00000000000..c01980e8b9d
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_spec_in_variable_4.f
+@@ -0,0 +1,14 @@
++! { dg-do compile }
++!
++! Test kind specification in variable not in type. The per variable
++! kind specification is not enabled so these should fail
++!
++! Contributed by Mark Eggleston
++!
++ program spec_in_var
++ integer a
++ parameter(a=2)
++ integer b*(a) ! { dg-error "Syntax error" }
++ real c*(8) ! { dg-error "Syntax error" }
++ logical d*1_1 ! { dg-error "Syntax error" }
++ end
+diff --git a/gcc/testsuite/gfortran.dg/dec_spec_in_variable_5.f b/gcc/testsuite/gfortran.dg/dec_spec_in_variable_5.f
+new file mode 100644
+index 00000000000..e2f39da3f4f
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_spec_in_variable_5.f
+@@ -0,0 +1,19 @@
++! { dg-do run }
++! { dg-options "-fdec-override-kind" }
++!
++! Test kind specification in variable not in type
++!
++! Contributed by Mark Eggleston
++!
++ program spec_in_var
++ integer a
++ parameter(a=2)
++ integer b*(a)
++ real c*(8)
++ logical d*(1_1)
++ character e*(a)
++ if (kind(b).ne.2) stop 1
++ if (kind(c).ne.8) stop 2
++ if (kind(d).ne.1) stop 3
++ if (len(e).ne.2) stop 4
++ end
+diff --git a/gcc/testsuite/gfortran.dg/dec_spec_in_variable_6.f b/gcc/testsuite/gfortran.dg/dec_spec_in_variable_6.f
+new file mode 100644
+index 00000000000..569747874e3
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_spec_in_variable_6.f
+@@ -0,0 +1,19 @@
++! { dg-do run }
++! { dg-options "-fdec" }
++!
++! Test kind specification in variable not in type
++!
++! Contributed by Mark Eggleston
++!
++ program spec_in_var
++ integer a
++ parameter(a=2)
++ integer b*(a)
++ real c*(8)
++ logical d*(1_1)
++ character e*(a)
++ if (kind(b).ne.2) stop 1
++ if (kind(c).ne.8) stop 2
++ if (kind(d).ne.1) stop 3
++ if (len(e).ne.2) stop 4
++ end
+diff --git a/gcc/testsuite/gfortran.dg/dec_spec_in_variable_7.f b/gcc/testsuite/gfortran.dg/dec_spec_in_variable_7.f
+new file mode 100644
+index 00000000000..b975bfd15c5
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_spec_in_variable_7.f
+@@ -0,0 +1,15 @@
++! { dg-do compile }
++! { dg-options "-fdec -fno-dec-override-kind" }
++!
++! Test kind specification in variable not in type as the per variable
++! kind specification is not enables these should fail
++!
++! Contributed by Mark Eggleston
++!
++ program spec_in_var
++ integer a
++ parameter(a=2)
++ integer b*(a) ! { dg-error "Syntax error" }
++ real c*(8) ! { dg-error "Syntax error" }
++ logical d*1_1 ! { dg-error "Syntax error" }
++ end
+diff --git a/gcc/testsuite/gfortran.dg/dec_spec_in_variable_8.f b/gcc/testsuite/gfortran.dg/dec_spec_in_variable_8.f
+new file mode 100644
+index 00000000000..85732e0bd85
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_spec_in_variable_8.f
+@@ -0,0 +1,14 @@
++! { dg-do compile }
++! { dg-options "-fdec" }
++!
++! Check that invalid kind values are rejected.
++!
++! Contributed by Mark Eggleston
++!
++ program spec_in_var
++ integer a
++ parameter(a=3)
++ integer b*(a) ! { dg-error "Kind 3 not supported" }
++ real c*(78) ! { dg-error "Kind 78 not supported" }
++ logical d*(*) ! { dg-error "Invalid character" }
++ end
+--
+2.27.0
+
diff --git a/SOURCES/gcc11-fortran-fdec-promotion.patch b/SOURCES/gcc11-fortran-fdec-promotion.patch
new file mode 100644
index 0000000..36e0ff0
--- /dev/null
+++ b/SOURCES/gcc11-fortran-fdec-promotion.patch
@@ -0,0 +1,2093 @@
+From 7a27318818e359a277f2fa5f7dc3932d0fb950f5 Mon Sep 17 00:00:00 2001
+From: Mark Eggleston
+Date: Fri, 22 Jan 2021 14:58:07 +0000
+Subject: [PATCH 08/10] Support type promotion in calls to intrinsics
+
+Use -fdec-promotion or -fdec to enable this feature.
+
+Merged 2 commits: worked on by Ben Brewer ,
+Francisco Redondo Marchena and
+Jeff Law
+
+Re-worked by Mark Eggleston
+---
+ gcc/fortran/check.c | 71 +++++-
+ gcc/fortran/intrinsic.c | 5 +
+ gcc/fortran/iresolve.c | 91 ++++---
+ gcc/fortran/lang.opt | 4 +
+ gcc/fortran/options.c | 1 +
+ gcc/fortran/simplify.c | 240 ++++++++++++++----
+ ...trinsic_int_real_array_const_promotion_1.f | 18 ++
+ ...trinsic_int_real_array_const_promotion_2.f | 18 ++
+ ...trinsic_int_real_array_const_promotion_3.f | 18 ++
+ ...dec_intrinsic_int_real_const_promotion_1.f | 90 +++++++
+ ...dec_intrinsic_int_real_const_promotion_2.f | 90 +++++++
+ ...dec_intrinsic_int_real_const_promotion_3.f | 92 +++++++
+ .../dec_intrinsic_int_real_promotion_1.f | 130 ++++++++++
+ .../dec_intrinsic_int_real_promotion_2.f | 130 ++++++++++
+ .../dec_intrinsic_int_real_promotion_3.f | 130 ++++++++++
+ .../dec_intrinsic_int_real_promotion_4.f | 118 +++++++++
+ .../dec_intrinsic_int_real_promotion_5.f | 118 +++++++++
+ .../dec_intrinsic_int_real_promotion_6.f | 118 +++++++++
+ .../dec_intrinsic_int_real_promotion_7.f | 118 +++++++++
+ .../gfortran.dg/dec_kind_promotion-1.f | 40 +++
+ .../gfortran.dg/dec_kind_promotion-2.f | 40 +++
+ .../gfortran.dg/dec_kind_promotion-3.f | 39 +++
+ 22 files changed, 1639 insertions(+), 80 deletions(-)
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_array_const_promotion_1.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_array_const_promotion_2.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_array_const_promotion_3.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_const_promotion_1.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_const_promotion_2.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_const_promotion_3.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_1.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_2.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_3.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_4.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_5.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_6.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_7.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_kind_promotion-1.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_kind_promotion-2.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_kind_promotion-3.f
+
+diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
+index 623c1cc470e..e20a834a860 100644
+--- a/gcc/fortran/check.c
++++ b/gcc/fortran/check.c
+@@ -1396,12 +1396,40 @@ gfc_check_allocated (gfc_expr *array)
+ }
+
+
++/* Check function where both arguments must be real or integer
++ and warn if they are different types. */
++
++bool
++check_int_real_promotion (gfc_expr *a, gfc_expr *b)
++{
++ gfc_expr *i;
++
++ if (!int_or_real_check (a, 0))
++ return false;
++
++ if (!int_or_real_check (b, 1))
++ return false;
++
++ if (a->ts.type != b->ts.type)
++ {
++ i = (a->ts.type != BT_REAL ? a : b);
++ gfc_warning_now (OPT_Wconversion, "Conversion from INTEGER to REAL "
++ "at %L might lose precision", &i->where);
++ }
++
++ return true;
++}
++
++
+ /* Common check function where the first argument must be real or
+ integer and the second argument must be the same as the first. */
+
+ bool
+ gfc_check_a_p (gfc_expr *a, gfc_expr *p)
+ {
++ if (flag_dec_promotion)
++ return check_int_real_promotion (a, p);
++
+ if (!int_or_real_check (a, 0))
+ return false;
+
+@@ -3724,6 +3752,41 @@ check_rest (bt type, int kind, gfc_actual_arglist *arglist)
+ }
+
+
++/* Check function where all arguments of an argument list must be real
++ or integer. */
++
++static bool
++check_rest_int_real (gfc_actual_arglist *arglist)
++{
++ gfc_actual_arglist *arg, *tmp;
++ gfc_expr *x;
++ int m, n;
++
++ if (!min_max_args (arglist))
++ return false;
++
++ for (arg = arglist, n=1; arg; arg = arg->next, n++)
++ {
++ x = arg->expr;
++ if (x->ts.type != BT_INTEGER && x->ts.type != BT_REAL)
++ {
++ gfc_error ("% argument of %qs intrinsic at %L must be "
++ "INTEGER or REAL", n, gfc_current_intrinsic, &x->where);
++ return false;
++ }
++
++ for (tmp = arglist, m=1; tmp != arg; tmp = tmp->next, m++)
++ if (!gfc_check_conformance (tmp->expr, x,
++ "arguments 'a%d' and 'a%d' for "
++ "intrinsic '%s'", m, n,
++ gfc_current_intrinsic))
++ return false;
++ }
++
++ return true;
++}
++
++
+ bool
+ gfc_check_min_max (gfc_actual_arglist *arg)
+ {
+@@ -3748,7 +3811,10 @@ gfc_check_min_max (gfc_actual_arglist *arg)
+ return false;
+ }
+
+- return check_rest (x->ts.type, x->ts.kind, arg);
++ if (flag_dec_promotion && x->ts.type != BT_CHARACTER)
++ return check_rest_int_real (arg);
++ else
++ return check_rest (x->ts.type, x->ts.kind, arg);
+ }
+
+
+@@ -5121,6 +5187,9 @@ gfc_check_shift (gfc_expr *i, gfc_expr *shift)
+ bool
+ gfc_check_sign (gfc_expr *a, gfc_expr *b)
+ {
++ if (flag_dec_promotion)
++ return check_int_real_promotion (a, b);
++
+ if (!int_or_real_check (a, 0))
+ return false;
+
+diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c
+index e68eff8bdbb..81b3a24c2be 100644
+--- a/gcc/fortran/intrinsic.c
++++ b/gcc/fortran/intrinsic.c
+@@ -4467,6 +4467,11 @@ check_arglist (gfc_actual_arglist **ap, gfc_intrinsic_sym *sym,
+ if (ts.kind == 0)
+ ts.kind = actual->expr->ts.kind;
+
++ /* If kind promotion is allowed don't check for kind if it is smaller */
++ if (flag_dec_promotion && ts.type == BT_INTEGER)
++ if (actual->expr->ts.kind < ts.kind)
++ ts.kind = actual->expr->ts.kind;
++
+ if (!gfc_compare_types (&ts, &actual->expr->ts))
+ {
+ if (error_flag)
+diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c
+index e17fe45f080..b9cdaff2499 100644
+--- a/gcc/fortran/iresolve.c
++++ b/gcc/fortran/iresolve.c
+@@ -817,19 +817,22 @@ gfc_resolve_dble (gfc_expr *f, gfc_expr *a)
+ void
+ gfc_resolve_dim (gfc_expr *f, gfc_expr *a, gfc_expr *p)
+ {
+- f->ts.type = a->ts.type;
+ if (p != NULL)
+- f->ts.kind = gfc_kind_max (a,p);
+- else
+- f->ts.kind = a->ts.kind;
+-
+- if (p != NULL && a->ts.kind != p->ts.kind)
+ {
+- if (a->ts.kind == gfc_kind_max (a,p))
+- gfc_convert_type (p, &a->ts, 2);
++ f->ts.kind = gfc_kind_max (a,p);
++ if (a->ts.type == BT_REAL || p->ts.type == BT_REAL)
++ f->ts.type = BT_REAL;
+ else
+- gfc_convert_type (a, &p->ts, 2);
++ f->ts.type = BT_INTEGER;
++
++ if (a->ts.kind != f->ts.kind || a->ts.type != f->ts.type)
++ gfc_convert_type (a, &f->ts, 2);
++
++ if (p->ts.kind != f->ts.kind || p->ts.type != f->ts.type)
++ gfc_convert_type (p, &f->ts, 2);
+ }
++ else
++ f->ts = a->ts;
+
+ f->value.function.name
+ = gfc_get_string ("__dim_%c%d", gfc_type_letter (f->ts.type), f->ts.kind);
+@@ -1606,14 +1609,17 @@ gfc_resolve_minmax (const char *name, gfc_expr *f, gfc_actual_arglist *args)
+ /* Find the largest type kind. */
+ for (a = args->next; a; a = a->next)
+ {
++ if (a->expr-> ts.type == BT_REAL)
++ f->ts.type = BT_REAL;
++
+ if (a->expr->ts.kind > f->ts.kind)
+ f->ts.kind = a->expr->ts.kind;
+ }
+
+- /* Convert all parameters to the required kind. */
++ /* Convert all parameters to the required type and/or kind. */
+ for (a = args; a; a = a->next)
+ {
+- if (a->expr->ts.kind != f->ts.kind)
++ if (a->expr->ts.type != f->ts.type || a->expr->ts.kind != f->ts.kind)
+ gfc_convert_type (a->expr, &f->ts, 2);
+ }
+
+@@ -2106,19 +2112,22 @@ gfc_resolve_minval (gfc_expr *f, gfc_expr *array, gfc_expr *dim,
+ void
+ gfc_resolve_mod (gfc_expr *f, gfc_expr *a, gfc_expr *p)
+ {
+- f->ts.type = a->ts.type;
+ if (p != NULL)
+- f->ts.kind = gfc_kind_max (a,p);
+- else
+- f->ts.kind = a->ts.kind;
+-
+- if (p != NULL && a->ts.kind != p->ts.kind)
+ {
+- if (a->ts.kind == gfc_kind_max (a,p))
+- gfc_convert_type (p, &a->ts, 2);
++ f->ts.kind = gfc_kind_max (a,p);
++ if (a->ts.type == BT_REAL || p->ts.type == BT_REAL)
++ f->ts.type = BT_REAL;
+ else
+- gfc_convert_type (a, &p->ts, 2);
++ f->ts.type = BT_INTEGER;
++
++ if (a->ts.kind != f->ts.kind || a->ts.type != f->ts.type)
++ gfc_convert_type (a, &f->ts, 2);
++
++ if (p->ts.kind != f->ts.kind || p->ts.type != f->ts.type)
++ gfc_convert_type (p, &f->ts, 2);
+ }
++ else
++ f->ts = a->ts;
+
+ f->value.function.name
+ = gfc_get_string ("__mod_%c%d", gfc_type_letter (f->ts.type), f->ts.kind);
+@@ -2128,19 +2137,22 @@ gfc_resolve_mod (gfc_expr *f, gfc_expr *a, gfc_expr *p)
+ void
+ gfc_resolve_modulo (gfc_expr *f, gfc_expr *a, gfc_expr *p)
+ {
+- f->ts.type = a->ts.type;
+ if (p != NULL)
+- f->ts.kind = gfc_kind_max (a,p);
+- else
+- f->ts.kind = a->ts.kind;
+-
+- if (p != NULL && a->ts.kind != p->ts.kind)
+ {
+- if (a->ts.kind == gfc_kind_max (a,p))
+- gfc_convert_type (p, &a->ts, 2);
++ f->ts.kind = gfc_kind_max (a,p);
++ if (a->ts.type == BT_REAL || p->ts.type == BT_REAL)
++ f->ts.type = BT_REAL;
+ else
+- gfc_convert_type (a, &p->ts, 2);
++ f->ts.type = BT_INTEGER;
++
++ if (a->ts.kind != f->ts.kind || a->ts.type != f->ts.type)
++ gfc_convert_type (a, &f->ts, 2);
++
++ if (p->ts.kind != f->ts.kind || p->ts.type != f->ts.type)
++ gfc_convert_type (p, &f->ts, 2);
+ }
++ else
++ f->ts = a->ts;
+
+ f->value.function.name
+ = gfc_get_string ("__modulo_%c%d", gfc_type_letter (f->ts.type),
+@@ -2515,9 +2527,26 @@ gfc_resolve_shift (gfc_expr *f, gfc_expr *i, gfc_expr *shift ATTRIBUTE_UNUSED)
+
+
+ void
+-gfc_resolve_sign (gfc_expr *f, gfc_expr *a, gfc_expr *b ATTRIBUTE_UNUSED)
++gfc_resolve_sign (gfc_expr *f, gfc_expr *a, gfc_expr *b)
+ {
+- f->ts = a->ts;
++ if (b != NULL)
++ {
++ f->ts.kind = gfc_kind_max (a, b);
++ if (a->ts.type == BT_REAL || b->ts.type == BT_REAL)
++ f->ts.type = BT_REAL;
++ else
++ f->ts.type = BT_INTEGER;
++
++ if (a->ts.kind != f->ts.kind || a->ts.type != f->ts.type)
++ gfc_convert_type (a, &f->ts, 2);
++
++ if (b->ts.kind != f->ts.kind || b->ts.type != f->ts.type)
++ gfc_convert_type (b, &f->ts, 2);
++ }
++ else
++ {
++ f->ts = a->ts;
++ }
+ f->value.function.name
+ = gfc_get_string ("__sign_%c%d", gfc_type_letter (a->ts.type), a->ts.kind);
+ }
+diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
+index d886c2f33ed..4ca2f93f2df 100644
+--- a/gcc/fortran/lang.opt
++++ b/gcc/fortran/lang.opt
+@@ -505,6 +505,10 @@ fdec-old-init
+ Fortran Var(flag_dec_old_init)
+ Enable support for old style initializers in derived types.
+
++fdec-promotion
++Fortran Var(flag_dec_promotion)
++Add support for type promotion in intrinsic arguments.
++
+ fdec-structure
+ Fortran Var(flag_dec_structure)
+ Enable support for DEC STRUCTURE/RECORD.
+diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
+index a946c86790a..15079c7e95a 100644
+--- a/gcc/fortran/options.c
++++ b/gcc/fortran/options.c
+@@ -82,6 +82,7 @@ set_dec_flags (int value)
+ SET_BITFLAG (flag_dec_old_init, value, value);
+ SET_BITFLAG (flag_dec_override_kind, value, value);
+ SET_BITFLAG (flag_dec_non_logical_if, value, value);
++ SET_BITFLAG (flag_dec_promotion, value, value);
+ }
+
+ /* Finalize DEC flags. */
+diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
+index 9900572424f..3419e06fec2 100644
+--- a/gcc/fortran/simplify.c
++++ b/gcc/fortran/simplify.c
+@@ -2333,39 +2333,79 @@ gfc_simplify_digits (gfc_expr *x)
+ }
+
+
++/* Simplify function which sets the floating-point value of ar from
++ the value of a independently if a is integer of real. */
++
++static void
++simplify_int_real_promotion (const gfc_expr *a, const gfc_expr *b, mpfr_t *ar)
++{
++ if (a->ts.type == BT_REAL)
++ {
++ mpfr_init2 (*ar, (a->ts.kind * 8));
++ mpfr_set (*ar, a->value.real, GFC_RND_MODE);
++ }
++ else
++ {
++ mpfr_init2 (*ar, (b->ts.kind * 8));
++ mpfr_set_z (*ar, a->value.integer, GFC_RND_MODE);
++ }
++}
++
++
++/* Simplify function which promotes a and b arguments from integer to real if
++ required in ar and br floating-point values. This function returns true if
++ a or b are reals and false otherwise. */
++
++static bool
++simplify_int_real_promotion2 (const gfc_expr *a, const gfc_expr *b, mpfr_t *ar,
++ mpfr_t *br)
++{
++ if (a->ts.type != BT_REAL && b->ts.type != BT_REAL)
++ return false;
++
++ simplify_int_real_promotion (a, b, ar);
++ simplify_int_real_promotion (b, a, br);
++
++ return true;
++}
++
++
+ gfc_expr *
+ gfc_simplify_dim (gfc_expr *x, gfc_expr *y)
+ {
+ gfc_expr *result;
+ int kind;
+
++ mpfr_t xr;
++ mpfr_t yr;
++
+ if (x->expr_type != EXPR_CONSTANT || y->expr_type != EXPR_CONSTANT)
+ return NULL;
+
+- kind = x->ts.kind > y->ts.kind ? x->ts.kind : y->ts.kind;
+- result = gfc_get_constant_expr (x->ts.type, kind, &x->where);
+-
+- switch (x->ts.type)
++ if ((x->ts.type != BT_REAL && x->ts.type != BT_INTEGER)
++ || (y->ts.type != BT_REAL && y->ts.type != BT_INTEGER))
+ {
+- case BT_INTEGER:
+- if (mpz_cmp (x->value.integer, y->value.integer) > 0)
+- mpz_sub (result->value.integer, x->value.integer, y->value.integer);
+- else
+- mpz_set_ui (result->value.integer, 0);
+-
+- break;
+-
+- case BT_REAL:
+- if (mpfr_cmp (x->value.real, y->value.real) > 0)
+- mpfr_sub (result->value.real, x->value.real, y->value.real,
+- GFC_RND_MODE);
+- else
+- mpfr_set_ui (result->value.real, 0, GFC_RND_MODE);
++ gfc_internal_error ("gfc_simplify_dim(): Bad arguments");
++ return NULL;
++ }
+
+- break;
++ kind = x->ts.kind > y->ts.kind ? x->ts.kind : y->ts.kind;
+
+- default:
+- gfc_internal_error ("gfc_simplify_dim(): Bad type");
++ if (simplify_int_real_promotion2 (x, y, &xr, &yr))
++ {
++ result = gfc_get_constant_expr (BT_REAL, kind, &x->where);
++ if (mpfr_cmp (xr, yr) > 0)
++ mpfr_sub (result->value.real, xr, yr, GFC_RND_MODE);
++ else
++ mpfr_set_ui (result->value.real, 0, GFC_RND_MODE);
++ }
++ else
++ {
++ result = gfc_get_constant_expr (BT_INTEGER, kind, &x->where);
++ if (mpz_cmp (x->value.integer, y->value.integer) > 0)
++ mpz_sub (result->value.integer, x->value.integer, y->value.integer);
++ else
++ mpz_set_ui (result->value.integer, 0);
+ }
+
+ return range_check (result, "DIM");
+@@ -4953,6 +4993,76 @@ min_max_choose (gfc_expr *arg, gfc_expr *extremum, int sign, bool back_val)
+ {
+ int ret;
+
++ mpfr_t *arp;
++ mpfr_t *erp;
++ mpfr_t ar;
++ mpfr_t er;
++
++ if (arg->ts.type != extremum->ts.type)
++ {
++ if (arg->ts.type == BT_REAL)
++ {
++ arp = &arg->value.real;
++ }
++ else
++ {
++ mpfr_init2 (ar, (arg->ts.kind * 8));
++ mpfr_set_z (ar, arg->value.integer, GFC_RND_MODE);
++ arp = &ar;
++ }
++
++ if (extremum->ts.type == BT_REAL)
++ {
++ erp = &extremum->value.real;
++ }
++ else
++ {
++ mpfr_init2 (er, (extremum->ts.kind * 8));
++ mpfr_set_z (er, extremum->value.integer, GFC_RND_MODE);
++ erp = &er;
++ }
++
++ if (mpfr_nan_p (*erp))
++ {
++ ret = 1;
++ extremum->ts.type = arg->ts.type;
++ extremum->ts.kind = arg->ts.kind;
++ if (arg->ts.type == BT_INTEGER)
++ {
++ mpz_init2 (extremum->value.integer, (arg->ts.kind * 8));
++ mpz_set (extremum->value.integer, arg->value.integer);
++ }
++ else
++ {
++ mpfr_init2 (extremum->value.real, (arg->ts.kind * 8));
++ mpfr_set (extremum->value.real, *arp, GFC_RND_MODE);
++ }
++ }
++ else if (mpfr_nan_p (*arp))
++ ret = -1;
++ else
++ {
++ ret = mpfr_cmp (*arp, *erp) * sign;
++ if (ret > 0)
++ {
++ extremum->ts.type = arg->ts.type;
++ extremum->ts.kind = arg->ts.kind;
++ if (arg->ts.type == BT_INTEGER)
++ {
++ mpz_init2 (extremum->value.integer, (arg->ts.kind * 8));
++ mpz_set (extremum->value.integer, arg->value.integer);
++ }
++ else
++ {
++ mpfr_init2 (extremum->value.real, (arg->ts.kind * 8));
++ mpfr_set (extremum->value.real, *arp, GFC_RND_MODE);
++ }
++ }
++ }
++
++ return ret;
++ }
++
+ switch (arg->ts.type)
+ {
+ case BT_INTEGER:
+@@ -5912,7 +6022,9 @@ gfc_simplify_mod (gfc_expr *a, gfc_expr *p)
+ gfc_expr *result;
+ int kind;
+
+- /* First check p. */
++ mpfr_t ar;
++ mpfr_t pr;
++
+ if (p->expr_type != EXPR_CONSTANT)
+ return NULL;
+
+@@ -5942,16 +6054,24 @@ gfc_simplify_mod (gfc_expr *a, gfc_expr *p)
+ if (a->expr_type != EXPR_CONSTANT)
+ return NULL;
+
++ if (a->ts.type != BT_REAL && a->ts.type != BT_INTEGER)
++ {
++ gfc_internal_error ("gfc_simplify_mod(): Bad arguments");
++ return NULL;
++ }
++
+ kind = a->ts.kind > p->ts.kind ? a->ts.kind : p->ts.kind;
+- result = gfc_get_constant_expr (a->ts.type, kind, &a->where);
+
+- if (a->ts.type == BT_INTEGER)
+- mpz_tdiv_r (result->value.integer, a->value.integer, p->value.integer);
+- else
++ if (simplify_int_real_promotion2 (a, p, &ar, &pr))
+ {
++ result = gfc_get_constant_expr (BT_REAL, kind, &a->where);
+ gfc_set_model_kind (kind);
+- mpfr_fmod (result->value.real, a->value.real, p->value.real,
+- GFC_RND_MODE);
++ mpfr_fmod (result->value.real, ar, pr, GFC_RND_MODE);
++ }
++ else
++ {
++ result = gfc_get_constant_expr (BT_INTEGER, kind, &a->where);
++ mpz_tdiv_r (result->value.integer, a->value.integer, p->value.integer);
+ }
+
+ return range_check (result, "MOD");
+@@ -5964,7 +6084,9 @@ gfc_simplify_modulo (gfc_expr *a, gfc_expr *p)
+ gfc_expr *result;
+ int kind;
+
+- /* First check p. */
++ mpfr_t ar;
++ mpfr_t pr;
++
+ if (p->expr_type != EXPR_CONSTANT)
+ return NULL;
+
+@@ -5991,28 +6113,36 @@ gfc_simplify_modulo (gfc_expr *a, gfc_expr *p)
+ gfc_internal_error ("gfc_simplify_modulo(): Bad arguments");
+ }
+
++ if (a->ts.type != BT_REAL && a->ts.type != BT_INTEGER)
++ {
++ gfc_internal_error ("gfc_simplify_modulo(): Bad arguments");
++ return NULL;
++ }
++
+ if (a->expr_type != EXPR_CONSTANT)
+ return NULL;
+
+ kind = a->ts.kind > p->ts.kind ? a->ts.kind : p->ts.kind;
+- result = gfc_get_constant_expr (a->ts.type, kind, &a->where);
+
+- if (a->ts.type == BT_INTEGER)
+- mpz_fdiv_r (result->value.integer, a->value.integer, p->value.integer);
+- else
++ if (simplify_int_real_promotion2 (a, p, &ar, &pr))
+ {
++ result = gfc_get_constant_expr (BT_REAL, kind, &a->where);
+ gfc_set_model_kind (kind);
+- mpfr_fmod (result->value.real, a->value.real, p->value.real,
+- GFC_RND_MODE);
++ mpfr_fmod (result->value.real, ar, pr, GFC_RND_MODE);
+ if (mpfr_cmp_ui (result->value.real, 0) != 0)
+- {
+- if (mpfr_signbit (a->value.real) != mpfr_signbit (p->value.real))
+- mpfr_add (result->value.real, result->value.real, p->value.real,
+- GFC_RND_MODE);
+- }
+- else
+- mpfr_copysign (result->value.real, result->value.real,
+- p->value.real, GFC_RND_MODE);
++ {
++ if (mpfr_signbit (ar) != mpfr_signbit (pr))
++ mpfr_add (result->value.real, result->value.real, pr,
++ GFC_RND_MODE);
++ }
++ else
++ mpfr_copysign (result->value.real, result->value.real, pr,
++ GFC_RND_MODE);
++ }
++ else
++ {
++ result = gfc_get_constant_expr (BT_INTEGER, kind, &a->where);
++ mpz_fdiv_r (result->value.integer, a->value.integer, p->value.integer);
+ }
+
+ return range_check (result, "MODULO");
+@@ -7578,27 +7708,41 @@ gfc_expr *
+ gfc_simplify_sign (gfc_expr *x, gfc_expr *y)
+ {
+ gfc_expr *result;
++ bool neg;
+
+ if (x->expr_type != EXPR_CONSTANT || y->expr_type != EXPR_CONSTANT)
+ return NULL;
+
+ result = gfc_get_constant_expr (x->ts.type, x->ts.kind, &x->where);
+
++ switch (y->ts.type)
++ {
++ case BT_INTEGER:
++ neg = (mpz_sgn (y->value.integer) < 0);
++ break;
++
++ case BT_REAL:
++ neg = (mpfr_sgn (y->value.real) < 0);
++ break;
++
++ default:
++ gfc_internal_error ("Bad type in gfc_simplify_sign");
++ }
++
+ switch (x->ts.type)
+ {
+ case BT_INTEGER:
+ mpz_abs (result->value.integer, x->value.integer);
+- if (mpz_sgn (y->value.integer) < 0)
++ if (neg)
+ mpz_neg (result->value.integer, result->value.integer);
+ break;
+
+ case BT_REAL:
+- if (flag_sign_zero)
++ if (flag_sign_zero && y->ts.type == BT_REAL)
+ mpfr_copysign (result->value.real, x->value.real, y->value.real,
+- GFC_RND_MODE);
++ GFC_RND_MODE);
+ else
+- mpfr_setsign (result->value.real, x->value.real,
+- mpfr_sgn (y->value.real) < 0 ? 1 : 0, GFC_RND_MODE);
++ mpfr_setsign (result->value.real, x->value.real, neg, GFC_RND_MODE);
+ break;
+
+ default:
+diff --git a/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_array_const_promotion_1.f b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_array_const_promotion_1.f
+new file mode 100644
+index 00000000000..25763852139
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_array_const_promotion_1.f
+@@ -0,0 +1,18 @@
++! { dg-do compile }
++! { dg-options "-fdec" }
++!
++! Test promotion between integers and reals for mod and modulo where
++! A is a constant array and P is zero.
++!
++! Compilation errors are expected
++!
++! Contributed by Francisco Redondo Marchena
++! and Jeff Law
++! Modified by Mark Eggleston
++!
++ program promotion_int_real_array_const
++ real a(2) = mod([12, 34], 0.0)*4 ! { dg-error "shall not be zero" }
++ a = mod([12.0, 34.0], 0)*4 ! { dg-error "shall not be zero" }
++ real b(2) = modulo([12, 34], 0.0)*4 ! { dg-error "shall not be zero" }
++ b = modulo([12.0, 34.0], 0)*4 ! { dg-error "shall not be zero" }
++ end program
+diff --git a/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_array_const_promotion_2.f b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_array_const_promotion_2.f
+new file mode 100644
+index 00000000000..b78a46054f4
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_array_const_promotion_2.f
+@@ -0,0 +1,18 @@
++! { dg-do compile }
++! { dg-options "-fdec-promotion" }
++!
++! Test promotion between integers and reals for mod and modulo where
++! A is a constant array and P is zero.
++!
++! Compilation errors are expected
++!
++! Contributed by Francisco Redondo Marchena
++! and Jeff Law
++! Modified by Mark Eggleston
++!
++ program promotion_int_real_array_const
++ real a(2) = mod([12, 34], 0.0)*4 ! { dg-error "shall not be zero" }
++ a = mod([12.0, 34.0], 0)*4 ! { dg-error "shall not be zero" }
++ real b(2) = modulo([12, 34], 0.0)*4 ! { dg-error "shall not be zero" }
++ b = modulo([12.0, 34.0], 0)*4 ! { dg-error "shall not be zero" }
++ end program
+diff --git a/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_array_const_promotion_3.f b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_array_const_promotion_3.f
+new file mode 100644
+index 00000000000..318ab5db97e
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_array_const_promotion_3.f
+@@ -0,0 +1,18 @@
++! { dg-do compile }
++! { dg-options "-fdec -fno-dec-promotion" }
++!
++! Test promotion between integers and reals for mod and modulo where
++! A is a constant array and P is zero.
++!
++! Compilation errors are expected
++!
++! Contributed by Francisco Redondo Marchena
++! and Jeff Law
++! Modified by Mark Eggleston
++!
++ program promotion_int_real_array_const
++ real a(2) = mod([12, 34], 0.0)*4 ! { dg-error "'a' and 'p' arguments of 'mod'" }
++ a = mod([12.0, 34.0], 0)*4 ! { dg-error "'a' and 'p' arguments of 'mod'" }
++ real b(2) = modulo([12, 34], 0.0)*4 ! { dg-error "'a' and 'p' arguments of 'modulo'" }
++ b = modulo([12.0, 34.0], 0)*4 ! { dg-error "'a' and 'p' arguments of 'modulo'" }
++ end program
+diff --git a/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_const_promotion_1.f b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_const_promotion_1.f
+new file mode 100644
+index 00000000000..27eb2582bb2
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_const_promotion_1.f
+@@ -0,0 +1,90 @@
++! { dg-do run }
++! { dg-options "-fdec -finit-real=snan" }
++!
++! Test promotion between integers and reals in intrinsic operations.
++! These operations are: mod, modulo, dim, sign, min, max, minloc and
++! maxloc.
++!
++! Contributed by Francisco Redondo Marchena
++! and Jeff Law
++! Modified by Mark Eggleston
++!
++ PROGRAM promotion_int_real_const
++ ! array_nan 4th position value is NAN
++ REAL array_nan(4)
++ DATA array_nan(1)/-4.0/
++ DATA array_nan(2)/3.0/
++ DATA array_nan(3)/-2/
++
++ INTEGER m_i/0/
++ REAL m_r/0.0/
++
++ INTEGER md_i/0/
++ REAL md_r/0.0/
++
++ INTEGER d_i/0/
++ REAL d_r/0.0/
++
++ INTEGER s_i/0/
++ REAL s_r/0.0/
++
++ INTEGER mn_i/0/
++ REAL mn_r/0.0/
++
++ INTEGER mx_i/0/
++ REAL mx_r/0.0/
++
++ m_i = MOD(4, 3)
++ if (m_i .ne. 1) STOP 1
++ m_r = MOD(4.0, 3.0)
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 2
++ m_r = MOD(4, 3.0)
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 3
++ m_r = MOD(4.0, 3)
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 4
++
++ md_i = MODULO(4, 3)
++ if (md_i .ne. 1) STOP 5
++ md_r = MODULO(4.0, 3.0)
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 6
++ md_r = MODULO(4, 3.0)
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 7
++ md_r = MODULO(4.0, 3)
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 8
++
++ d_i = DIM(4, 3)
++ if (d_i .ne. 1) STOP 9
++ d_r = DIM(4.0, 3.0)
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 10
++ d_r = DIM(4.0, 3)
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 11
++ d_r = DIM(3, 4.0)
++ if (abs(d_r) > 1.0D-6) STOP 12
++
++ s_i = SIGN(-4, 3)
++ if (s_i .ne. 4) STOP 13
++ s_r = SIGN(4.0, -3.0)
++ if (abs(s_r - (-4.0)) > 1.0D-6) STOP 14
++ s_r = SIGN(4.0, -3)
++ if (abs(s_r - (-4.0)) > 1.0D-6) STOP 15
++ s_r = SIGN(-4, 3.0)
++ if (abs(s_r - 4.0) > 1.0D-6) STOP 16
++
++ mx_i = MAX(-4, -3, 2, 1)
++ if (mx_i .ne. 2) STOP 17
++ mx_r = MAX(-4.0, -3.0, 2.0, 1.0)
++ if (abs(mx_r - 2.0) > 1.0D-6) STOP 18
++ mx_r = MAX(-4, -3.0, 2.0, 1)
++ if (abs(mx_r - 2.0) > 1.0D-6) STOP 19
++ mx_i = MAXLOC(array_nan, 1)
++ if (mx_i .ne. 2) STOP 20
++
++ mn_i = MIN(-4, -3, 2, 1)
++ if (mn_i .ne. -4) STOP 21
++ mn_r = MIN(-4.0, -3.0, 2.0, 1.0)
++ if (abs(mn_r - (-4.0)) > 1.0D-6) STOP 22
++ mn_r = MIN(-4, -3.0, 2.0, 1)
++ if (abs(mn_r - (-4.0)) > 1.0D-6) STOP 23
++ mn_i = MINLOC(array_nan, 1)
++ if (mn_i .ne. 1) STOP 24
++ END PROGRAM
+diff --git a/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_const_promotion_2.f b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_const_promotion_2.f
+new file mode 100644
+index 00000000000..bdd017b7280
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_const_promotion_2.f
+@@ -0,0 +1,90 @@
++! { dg-do run }
++! { dg-options "-fdec-promotion -finit-real=snan" }
++!
++! Test promotion between integers and reals in intrinsic operations.
++! These operations are: mod, modulo, dim, sign, min, max, minloc and
++! maxloc.
++!
++! Contributed by Francisco Redondo Marchena
++! and Jeff Law
++! Modified by Mark Eggleston
++!
++ PROGRAM promotion_int_real_const
++ ! array_nan 4th position value is NAN
++ REAL array_nan(4)
++ DATA array_nan(1)/-4.0/
++ DATA array_nan(2)/3.0/
++ DATA array_nan(3)/-2/
++
++ INTEGER m_i/0/
++ REAL m_r/0.0/
++
++ INTEGER md_i/0/
++ REAL md_r/0.0/
++
++ INTEGER d_i/0/
++ REAL d_r/0.0/
++
++ INTEGER s_i/0/
++ REAL s_r/0.0/
++
++ INTEGER mn_i/0/
++ REAL mn_r/0.0/
++
++ INTEGER mx_i/0/
++ REAL mx_r/0.0/
++
++ m_i = MOD(4, 3)
++ if (m_i .ne. 1) STOP 1
++ m_r = MOD(4.0, 3.0)
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 2
++ m_r = MOD(4, 3.0)
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 3
++ m_r = MOD(4.0, 3)
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 4
++
++ md_i = MODULO(4, 3)
++ if (md_i .ne. 1) STOP 5
++ md_r = MODULO(4.0, 3.0)
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 6
++ md_r = MODULO(4, 3.0)
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 7
++ md_r = MODULO(4.0, 3)
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 8
++
++ d_i = DIM(4, 3)
++ if (d_i .ne. 1) STOP 9
++ d_r = DIM(4.0, 3.0)
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 10
++ d_r = DIM(4.0, 3)
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 11
++ d_r = DIM(3, 4.0)
++ if (abs(d_r) > 1.0D-6) STOP 12
++
++ s_i = SIGN(-4, 3)
++ if (s_i .ne. 4) STOP 13
++ s_r = SIGN(4.0, -3.0)
++ if (abs(s_r - (-4.0)) > 1.0D-6) STOP 14
++ s_r = SIGN(4.0, -3)
++ if (abs(s_r - (-4.0)) > 1.0D-6) STOP 15
++ s_r = SIGN(-4, 3.0)
++ if (abs(s_r - 4.0) > 1.0D-6) STOP 16
++
++ mx_i = MAX(-4, -3, 2, 1)
++ if (mx_i .ne. 2) STOP 17
++ mx_r = MAX(-4.0, -3.0, 2.0, 1.0)
++ if (abs(mx_r - 2.0) > 1.0D-6) STOP 18
++ mx_r = MAX(-4, -3.0, 2.0, 1)
++ if (abs(mx_r - 2.0) > 1.0D-6) STOP 19
++ mx_i = MAXLOC(array_nan, 1)
++ if (mx_i .ne. 2) STOP 20
++
++ mn_i = MIN(-4, -3, 2, 1)
++ if (mn_i .ne. -4) STOP 21
++ mn_r = MIN(-4.0, -3.0, 2.0, 1.0)
++ if (abs(mn_r - (-4.0)) > 1.0D-6) STOP 22
++ mn_r = MIN(-4, -3.0, 2.0, 1)
++ if (abs(mn_r - (-4.0)) > 1.0D-6) STOP 23
++ mn_i = MINLOC(array_nan, 1)
++ if (mn_i .ne. 1) STOP 24
++ END PROGRAM
+diff --git a/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_const_promotion_3.f b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_const_promotion_3.f
+new file mode 100644
+index 00000000000..ce90a5667d6
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_const_promotion_3.f
+@@ -0,0 +1,92 @@
++! { dg-do compile }
++! { dg-options "-fdec -fno-dec-promotion -finit-real=snan" }
++!
++! Test that there is no promotion between integers and reals in
++! intrinsic operations.
++!
++! These operations are: mod, modulo, dim, sign, min, max, minloc and
++! maxloc.
++!
++! Contributed by Francisco Redondo Marchena
++! and Jeff Law
++! Modified by Mark Eggleston
++!
++ PROGRAM promotion_int_real_const
++ ! array_nan 4th position value is NAN
++ REAL array_nan(4)
++ DATA array_nan(1)/-4.0/
++ DATA array_nan(2)/3.0/
++ DATA array_nan(3)/-2/
++
++ INTEGER m_i/0/
++ REAL m_r/0.0/
++
++ INTEGER md_i/0/
++ REAL md_r/0.0/
++
++ INTEGER d_i/0/
++ REAL d_r/0.0/
++
++ INTEGER s_i/0/
++ REAL s_r/0.0/
++
++ INTEGER mn_i/0/
++ REAL mn_r/0.0/
++
++ INTEGER mx_i/0/
++ REAL mx_r/0.0/
++
++ m_i = MOD(4, 3)
++ if (m_i .ne. 1) STOP 1
++ m_r = MOD(4.0, 3.0)
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 2
++ m_r = MOD(4, 3.0) ! { dg-error "'a' and 'p' arguments" }
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 3
++ m_r = MOD(4.0, 3) ! { dg-error "'a' and 'p' arguments" }
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 4
++
++ md_i = MODULO(4, 3)
++ if (md_i .ne. 1) STOP 5
++ md_r = MODULO(4.0, 3.0)
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 6
++ md_r = MODULO(4, 3.0) ! { dg-error "'a' and 'p' arguments" }
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 7
++ md_r = MODULO(4.0, 3) ! { dg-error "'a' and 'p' arguments" }
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 8
++
++ d_i = DIM(4, 3)
++ if (d_i .ne. 1) STOP 9
++ d_r = DIM(4.0, 3.0)
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 10
++ d_r = DIM(4.0, 3) ! { dg-error "'x' and 'y' arguments" }
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 11
++ d_r = DIM(3, 4.0) ! { dg-error "'x' and 'y' arguments" }
++ if (abs(d_r) > 1.0D-6) STOP 12
++
++ s_i = SIGN(-4, 3)
++ if (s_i .ne. 4) STOP 13
++ s_r = SIGN(4.0, -3.0)
++ if (abs(s_r - (-4.0)) > 1.0D-6) STOP 14
++ s_r = SIGN(4.0, -3) ! { dg-error "'b' argument" }
++ if (abs(s_r - (-4.0)) > 1.0D-6) STOP 15
++ s_r = SIGN(-4, 3.0) ! { dg-error "'b' argument" }
++ if (abs(s_r - 4.0) > 1.0D-6) STOP 16
++
++ mx_i = MAX(-4, -3, 2, 1)
++ if (mx_i .ne. 2) STOP 17
++ mx_r = MAX(-4.0, -3.0, 2.0, 1.0)
++ if (abs(mx_r - 2.0) > 1.0D-6) STOP 18
++ mx_r = MAX(-4, -3.0, 2.0, 1) ! { dg-error "'a2' argument" }
++ if (abs(mx_r - 2.0) > 1.0D-6) STOP 19
++ mx_i = MAXLOC(array_nan, 1)
++ if (mx_i .ne. 2) STOP 20
++
++ mn_i = MIN(-4, -3, 2, 1)
++ if (mn_i .ne. -4) STOP 21
++ mn_r = MIN(-4.0, -3.0, 2.0, 1.0)
++ if (abs(mn_r - (-4.0)) > 1.0D-6) STOP 22
++ mn_r = MIN(-4, -3.0, 2.0, 1) ! { dg-error "'a2' argument" }
++ if (abs(mn_r - (-4.0)) > 1.0D-6) STOP 23
++ mn_i = MINLOC(array_nan, 1)
++ if (mn_i .ne. 1) STOP 24
++ END PROGRAM
+diff --git a/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_1.f b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_1.f
+new file mode 100644
+index 00000000000..5c2cd931a4b
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_1.f
+@@ -0,0 +1,130 @@
++! { dg-do run }
++! { dg-options "-fdec" }
++!
++! Test promotion between integers and reals in intrinsic operations.
++! These operations are: mod, modulo, dim, sign, min, max, minloc and
++! maxloc.
++!
++! Contributed by Francisco Redondo Marchena
++! and Jeff Law
++! Modified by Mark Eggleston
++!
++ PROGRAM promotion_int_real
++ REAL l/0.0/
++ INTEGER a_i/4/
++ INTEGER*4 a2_i/4/
++ INTEGER b_i/3/
++ INTEGER*8 b2_i/3/
++ INTEGER x_i/2/
++ INTEGER y_i/1/
++ REAL a_r/4.0/
++ REAL*4 a2_r/4.0/
++ REAL b_r/3.0/
++ REAL*8 b2_r/3.0/
++ REAL x_r/2.0/
++ REAL y_r/1.0/
++
++ REAL array_nan(4)
++ DATA array_nan(1)/-4.0/
++ DATA array_nan(2)/3.0/
++ DATA array_nan(3)/-2/
++
++ INTEGER m_i/0/
++ REAL m_r/0.0/
++
++ INTEGER md_i/0/
++ REAL md_r/0.0/
++
++ INTEGER d_i/0/
++ REAL d_r/0.0/
++
++ INTEGER s_i/0/
++ REAL s_r/0.0/
++
++ INTEGER mn_i/0/
++ REAL mn_r/0.0/
++
++ INTEGER mx_i/0/
++ REAL mx_r/0.0/
++
++ ! array_nan 4th position value is NAN
++ array_nan(4) = 0/l
++
++ m_i = MOD(a_i, b_i)
++ if (m_i .ne. 1) STOP 1
++ m_i = MOD(a2_i, b2_i)
++ if (m_i .ne. 1) STOP 2
++ m_r = MOD(a_r, b_r)
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 3
++ m_r = MOD(a2_r, b2_r)
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 4
++ m_r = MOD(a_i, b_r)
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 5
++ m_r = MOD(a_r, b_i)
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 6
++
++ md_i = MODULO(a_i, b_i)
++ if (md_i .ne. 1) STOP 7
++ md_i = MODULO(a2_i, b2_i)
++ if (md_i .ne. 1) STOP 8
++ md_r = MODULO(a_r, b_r)
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 9
++ md_r = MODULO(a2_r, b2_r)
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 10
++ md_r = MODULO(a_i, b_r)
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 11
++ md_r = MODULO(a_r, b_i)
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 12
++
++ d_i = DIM(a_i, b_i)
++ if (d_i .ne. 1) STOP 13
++ d_i = DIM(a2_i, b2_i)
++ if (d_i .ne. 1) STOP 14
++ d_r = DIM(a_r, b_r)
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 15
++ d_r = DIM(a2_r, b2_r)
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 16
++ d_r = DIM(a_r, b_i)
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 17
++ d_r = DIM(b_i, a_r)
++ if (abs(d_r) > 1.0D-6) STOP 18
++
++ s_i = SIGN(-a_i, b_i)
++ if (s_i .ne. 4) STOP 19
++ s_i = SIGN(-a2_i, b2_i)
++ if (s_i .ne. 4) STOP 20
++ s_r = SIGN(a_r, -b_r)
++ if (abs(s_r - (-a_r)) > 1.0D-6) STOP 21
++ s_r = SIGN(a2_r, -b2_r)
++ if (abs(s_r - (-a2_r)) > 1.0D-6) STOP 22
++ s_r = SIGN(a_r, -b_i)
++ if (abs(s_r - (-a_r)) > 1.0D-6) STOP 23
++ s_r = SIGN(-a_i, b_r)
++ if (abs(s_r - a_r) > 1.0D-6) STOP 24
++
++ mx_i = MAX(-a_i, -b_i, x_i, y_i)
++ if (mx_i .ne. x_i) STOP 25
++ mx_i = MAX(-a2_i, -b2_i, x_i, y_i)
++ if (mx_i .ne. x_i) STOP 26
++ mx_r = MAX(-a_r, -b_r, x_r, y_r)
++ if (abs(mx_r - x_r) > 1.0D-6) STOP 27
++ mx_r = MAX(-a_r, -b_r, x_r, y_r)
++ if (abs(mx_r - x_r) > 1.0D-6) STOP 28
++ mx_r = MAX(-a_i, -b_r, x_r, y_i)
++ if (abs(mx_r - x_r) > 1.0D-6) STOP 29
++ mx_i = MAXLOC(array_nan, 1)
++ if (mx_i .ne. 2) STOP 30
++
++ mn_i = MIN(-a_i, -b_i, x_i, y_i)
++ if (mn_i .ne. -a_i) STOP 31
++ mn_i = MIN(-a2_i, -b2_i, x_i, y_i)
++ if (mn_i .ne. -a2_i) STOP 32
++ mn_r = MIN(-a_r, -b_r, x_r, y_r)
++ if (abs(mn_r - (-a_r)) > 1.0D-6) STOP 33
++ mn_r = MIN(-a2_r, -b2_r, x_r, y_r)
++ if (abs(mn_r - (-a2_r)) > 1.0D-6) STOP 34
++ mn_r = MIN(-a_i, -b_r, x_r, y_i)
++ if (abs(mn_r - (-a_r)) > 1.0D-6) STOP 35
++ mn_i = MINLOC(array_nan, 1)
++ if (mn_i .ne. 1) STOP 36
++ END PROGRAM
+diff --git a/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_2.f b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_2.f
+new file mode 100644
+index 00000000000..d64d468f7d1
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_2.f
+@@ -0,0 +1,130 @@
++! { dg-do run }
++! { dg-options "-fdec-promotion" }
++!
++! Test promotion between integers and reals in intrinsic operations.
++! These operations are: mod, modulo, dim, sign, min, max, minloc and
++! maxloc.
++!
++! Contributed by Francisco Redondo Marchena
++! and Jeff Law
++! Modified by Mark Eggleston
++!
++ PROGRAM promotion_int_real
++ REAL l/0.0/
++ INTEGER a_i/4/
++ INTEGER*4 a2_i/4/
++ INTEGER b_i/3/
++ INTEGER*8 b2_i/3/
++ INTEGER x_i/2/
++ INTEGER y_i/1/
++ REAL a_r/4.0/
++ REAL*4 a2_r/4.0/
++ REAL b_r/3.0/
++ REAL*8 b2_r/3.0/
++ REAL x_r/2.0/
++ REAL y_r/1.0/
++
++ REAL array_nan(4)
++ DATA array_nan(1)/-4.0/
++ DATA array_nan(2)/3.0/
++ DATA array_nan(3)/-2/
++
++ INTEGER m_i/0/
++ REAL m_r/0.0/
++
++ INTEGER md_i/0/
++ REAL md_r/0.0/
++
++ INTEGER d_i/0/
++ REAL d_r/0.0/
++
++ INTEGER s_i/0/
++ REAL s_r/0.0/
++
++ INTEGER mn_i/0/
++ REAL mn_r/0.0/
++
++ INTEGER mx_i/0/
++ REAL mx_r/0.0/
++
++ ! array_nan 4th position value is NAN
++ array_nan(4) = 0/l
++
++ m_i = MOD(a_i, b_i)
++ if (m_i .ne. 1) STOP 1
++ m_i = MOD(a2_i, b2_i)
++ if (m_i .ne. 1) STOP 2
++ m_r = MOD(a_r, b_r)
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 3
++ m_r = MOD(a2_r, b2_r)
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 4
++ m_r = MOD(a_i, b_r)
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 5
++ m_r = MOD(a_r, b_i)
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 6
++
++ md_i = MODULO(a_i, b_i)
++ if (md_i .ne. 1) STOP 7
++ md_i = MODULO(a2_i, b2_i)
++ if (md_i .ne. 1) STOP 8
++ md_r = MODULO(a_r, b_r)
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 9
++ md_r = MODULO(a2_r, b2_r)
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 10
++ md_r = MODULO(a_i, b_r)
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 11
++ md_r = MODULO(a_r, b_i)
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 12
++
++ d_i = DIM(a_i, b_i)
++ if (d_i .ne. 1) STOP 13
++ d_i = DIM(a2_i, b2_i)
++ if (d_i .ne. 1) STOP 14
++ d_r = DIM(a_r, b_r)
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 15
++ d_r = DIM(a2_r, b2_r)
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 16
++ d_r = DIM(a_r, b_i)
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 17
++ d_r = DIM(b_i, a_r)
++ if (abs(d_r) > 1.0D-6) STOP 18
++
++ s_i = SIGN(-a_i, b_i)
++ if (s_i .ne. 4) STOP 19
++ s_i = SIGN(-a2_i, b2_i)
++ if (s_i .ne. 4) STOP 20
++ s_r = SIGN(a_r, -b_r)
++ if (abs(s_r - (-a_r)) > 1.0D-6) STOP 21
++ s_r = SIGN(a2_r, -b2_r)
++ if (abs(s_r - (-a2_r)) > 1.0D-6) STOP 22
++ s_r = SIGN(a_r, -b_i)
++ if (abs(s_r - (-a_r)) > 1.0D-6) STOP 23
++ s_r = SIGN(-a_i, b_r)
++ if (abs(s_r - a_r) > 1.0D-6) STOP 24
++
++ mx_i = MAX(-a_i, -b_i, x_i, y_i)
++ if (mx_i .ne. x_i) STOP 25
++ mx_i = MAX(-a2_i, -b2_i, x_i, y_i)
++ if (mx_i .ne. x_i) STOP 26
++ mx_r = MAX(-a_r, -b_r, x_r, y_r)
++ if (abs(mx_r - x_r) > 1.0D-6) STOP 27
++ mx_r = MAX(-a_r, -b_r, x_r, y_r)
++ if (abs(mx_r - x_r) > 1.0D-6) STOP 28
++ mx_r = MAX(-a_i, -b_r, x_r, y_i)
++ if (abs(mx_r - x_r) > 1.0D-6) STOP 29
++ mx_i = MAXLOC(array_nan, 1)
++ if (mx_i .ne. 2) STOP 30
++
++ mn_i = MIN(-a_i, -b_i, x_i, y_i)
++ if (mn_i .ne. -a_i) STOP 31
++ mn_i = MIN(-a2_i, -b2_i, x_i, y_i)
++ if (mn_i .ne. -a2_i) STOP 32
++ mn_r = MIN(-a_r, -b_r, x_r, y_r)
++ if (abs(mn_r - (-a_r)) > 1.0D-6) STOP 33
++ mn_r = MIN(-a2_r, -b2_r, x_r, y_r)
++ if (abs(mn_r - (-a2_r)) > 1.0D-6) STOP 34
++ mn_r = MIN(-a_i, -b_r, x_r, y_i)
++ if (abs(mn_r - (-a_r)) > 1.0D-6) STOP 35
++ mn_i = MINLOC(array_nan, 1)
++ if (mn_i .ne. 1) STOP 36
++ END PROGRAM
+diff --git a/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_3.f b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_3.f
+new file mode 100644
+index 00000000000..0708b666633
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_3.f
+@@ -0,0 +1,130 @@
++! { dg-do compile }
++! { dg-options "-fdec -fno-dec-promotion" }
++!
++! Test promotion between integers and reals in intrinsic operations.
++! These operations are: mod, modulo, dim, sign, min, max, minloc and
++! maxloc.
++!
++! Contributed by Francisco Redondo Marchena
++! and Jeff Law
++! Modified by Mark Eggleston
++!
++ PROGRAM promotion_int_real
++ REAL l/0.0/
++ INTEGER a_i/4/
++ INTEGER*4 a2_i/4/
++ INTEGER b_i/3/
++ INTEGER*8 b2_i/3/
++ INTEGER x_i/2/
++ INTEGER y_i/1/
++ REAL a_r/4.0/
++ REAL*4 a2_r/4.0/
++ REAL b_r/3.0/
++ REAL*8 b2_r/3.0/
++ REAL x_r/2.0/
++ REAL y_r/1.0/
++
++ REAL array_nan(4)
++ DATA array_nan(1)/-4.0/
++ DATA array_nan(2)/3.0/
++ DATA array_nan(3)/-2/
++
++ INTEGER m_i/0/
++ REAL m_r/0.0/
++
++ INTEGER md_i/0/
++ REAL md_r/0.0/
++
++ INTEGER d_i/0/
++ REAL d_r/0.0/
++
++ INTEGER s_i/0/
++ REAL s_r/0.0/
++
++ INTEGER mn_i/0/
++ REAL mn_r/0.0/
++
++ INTEGER mx_i/0/
++ REAL mx_r/0.0/
++
++ ! array_nan 4th position value is NAN
++ array_nan(4) = 0/l
++
++ m_i = MOD(a_i, b_i)
++ if (m_i .ne. 1) STOP 1
++ m_i = MOD(a2_i, b2_i)
++ if (m_i .ne. 1) STOP 2
++ m_r = MOD(a_r, b_r)
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 3
++ m_r = MOD(a2_r, b2_r)
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 4
++ m_r = MOD(a_i, b_r) ! { dg-error "'a' and 'p' arguments" }
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 5
++ m_r = MOD(a_r, b_i) ! { dg-error "'a' and 'p' arguments" }
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 6
++
++ md_i = MODULO(a_i, b_i)
++ if (md_i .ne. 1) STOP 7
++ md_i = MODULO(a2_i, b2_i)
++ if (md_i .ne. 1) STOP 8
++ md_r = MODULO(a_r, b_r)
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 9
++ md_r = MODULO(a2_r, b2_r)
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 10
++ md_r = MODULO(a_i, b_r) ! { dg-error "'a' and 'p' arguments" }
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 11
++ md_r = MODULO(a_r, b_i) ! { dg-error "'a' and 'p' arguments" }
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 12
++
++ d_i = DIM(a_i, b_i)
++ if (d_i .ne. 1) STOP 13
++ d_i = DIM(a2_i, b2_i)
++ if (d_i .ne. 1) STOP 14
++ d_r = DIM(a_r, b_r)
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 15
++ d_r = DIM(a2_r, b2_r)
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 16
++ d_r = DIM(a_r, b_i) ! { dg-error "'x' and 'y' arguments" }
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 17
++ d_r = DIM(b_i, a_r) ! { dg-error "'x' and 'y' arguments" }
++ if (abs(d_r) > 1.0D-6) STOP 18
++
++ s_i = SIGN(-a_i, b_i)
++ if (s_i .ne. 4) STOP 19
++ s_i = SIGN(-a2_i, b2_i) ! { dg-error "'b' argument" }
++ if (s_i .ne. 4) STOP 20
++ s_r = SIGN(a_r, -b_r)
++ if (abs(s_r - (-a_r)) > 1.0D-6) STOP 21
++ s_r = SIGN(a2_r, -b2_r) ! { dg-error "'b' argument" }
++ if (abs(s_r - (-a2_r)) > 1.0D-6) STOP 22
++ s_r = SIGN(a_r, -b_i) ! { dg-error "'b' argument" }
++ if (abs(s_r - (-a_r)) > 1.0D-6) STOP 23
++ s_r = SIGN(-a_i, b_r) ! { dg-error "'b' argument" }
++ if (abs(s_r - a_r) > 1.0D-6) STOP 24
++
++ mx_i = MAX(-a_i, -b_i, x_i, y_i)
++ if (mx_i .ne. x_i) STOP 25
++ mx_i = MAX(-a2_i, -b2_i, x_i, y_i)
++ if (mx_i .ne. x_i) STOP 26
++ mx_r = MAX(-a_r, -b_r, x_r, y_r)
++ if (abs(mx_r - x_r) > 1.0D-6) STOP 27
++ mx_r = MAX(-a_r, -b_r, x_r, y_r)
++ if (abs(mx_r - x_r) > 1.0D-6) STOP 28
++ mx_r = MAX(-a_i, -b_r, x_r, y_i) ! { dg-error "'a2' argument" }
++ if (abs(mx_r - x_r) > 1.0D-6) STOP 29
++ mx_i = MAXLOC(array_nan, 1)
++ if (mx_i .ne. 2) STOP 30
++
++ mn_i = MIN(-a_i, -b_i, x_i, y_i)
++ if (mn_i .ne. -a_i) STOP 31
++ mn_i = MIN(-a2_i, -b2_i, x_i, y_i)
++ if (mn_i .ne. -a2_i) STOP 32
++ mn_r = MIN(-a_r, -b_r, x_r, y_r)
++ if (abs(mn_r - (-a_r)) > 1.0D-6) STOP 33
++ mn_r = MIN(-a2_r, -b2_r, x_r, y_r)
++ if (abs(mn_r - (-a2_r)) > 1.0D-6) STOP 34
++ mn_r = MIN(-a_i, -b_r, x_r, y_i) ! { dg-error "'a2' argument" }
++ if (abs(mn_r - (-a_r)) > 1.0D-6) STOP 35
++ mn_i = MINLOC(array_nan, 1)
++ if (mn_i .ne. 1) STOP 36
++ END PROGRAM
+diff --git a/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_4.f b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_4.f
+new file mode 100644
+index 00000000000..efa4f236410
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_4.f
+@@ -0,0 +1,118 @@
++! { dg-do compile }
++! { dg-options "-fdec" }
++!
++! Test promotion between integers and reals in intrinsic operations.
++! These operations are: mod, modulo, dim, sign, min, max, minloc and
++! maxloc.
++!
++! Contributed by Francisco Redondo Marchena
++! and Jeff Law
++! Modified by Mark Eggleston
++!
++ PROGRAM promotion_int_real
++ REAL l/0.0/
++ LOGICAL a_l
++ LOGICAL*4 a2_l
++ LOGICAL b_l
++ LOGICAL*8 b2_l
++ LOGICAL x_l
++ LOGICAL y_l
++ CHARACTER a_c
++ CHARACTER*4 a2_c
++ CHARACTER b_c
++ CHARACTER*8 b2_c
++ CHARACTER x_c
++ CHARACTER y_c
++
++ INTEGER m_i/0/
++ REAL m_r/0.0/
++
++ INTEGER md_i/0/
++ REAL md_r/0.0/
++
++ INTEGER d_i/0/
++ REAL d_r/0.0/
++
++ INTEGER s_i/0/
++ REAL s_r/0.0/
++
++ INTEGER mn_i/0/
++ REAL mn_r/0.0/
++
++ INTEGER mx_i/0/
++ REAL mx_r/0.0/
++
++ m_i = MOD(a_l, b_l) ! { dg-error "" }
++ if (m_i .ne. 1) STOP 1
++ m_i = MOD(a2_l, b2_l) ! { dg-error "" }
++ if (m_i .ne. 1) STOP 2
++ m_r = MOD(a_c, b_c) ! { dg-error "" }
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 3
++ m_r = MOD(a2_c, b2_c) ! { dg-error "" }
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 4
++ m_r = MOD(a_l, b_c) ! { dg-error "" }
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 5
++ m_r = MOD(a_c, b_l) ! { dg-error "" }
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 6
++
++ md_i = MODULO(a_l, b_l) ! { dg-error "" }
++ if (md_i .ne. 1) STOP 7
++ md_i = MODULO(a2_l, b2_l) ! { dg-error "" }
++ if (md_i .ne. 1) STOP 8
++ md_r = MODULO(a_c, b_c) ! { dg-error "" }
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 9
++ md_r = MODULO(a2_c, b2_c) ! { dg-error "" }
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 10
++ md_r = MODULO(a_l, b_c) ! { dg-error "" }
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 11
++ md_r = MODULO(a_c, b_l) ! { dg-error "" }
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 12
++
++ d_i = DIM(a_l, b_l) ! { dg-error "" }
++ if (d_i .ne. 1) STOP 13
++ d_i = DIM(a2_l, b2_l) ! { dg-error "" }
++ if (d_i .ne. 1) STOP 14
++ d_r = DIM(a_c, b_c) ! { dg-error "" }
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 15
++ d_r = DIM(a2_c, b2_c) ! { dg-error "" }
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 16
++ d_r = DIM(a_c, b_l) ! { dg-error "" }
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 17
++ d_r = DIM(b_l, a_c) ! { dg-error "" }
++ if (abs(d_r) > 1.0D-6) STOP 18
++
++ s_i = SIGN(-a_l, b_l) ! { dg-error "" }
++ if (s_i .ne. 4) STOP 19
++ s_i = SIGN(-a2_l, b2_l) ! { dg-error "" }
++ if (s_i .ne. 4) STOP 20
++ s_r = SIGN(a_c, -b_c) ! { dg-error "" }
++ if (abs(s_r - (-a_c)) > 1.0D-6) STOP 21 ! { dg-error "" }
++ s_r = SIGN(a2_c, -b2_c) ! { dg-error "" }
++ if (abs(s_r - (-a2_c)) > 1.0D-6) STOP 22 ! { dg-error "" }
++ s_r = SIGN(a_c, -b_l) ! { dg-error "" }
++ if (abs(s_r - (-a_c)) > 1.0D-6) STOP 23 ! { dg-error "" }
++ s_r = SIGN(-a_l, b_c) ! { dg-error "" }
++ if (abs(s_r - a_c) > 1.0D-6) STOP 24 ! { dg-error "" }
++
++ mx_i = MAX(-a_l, -b_l, x_l, y_l) ! { dg-error "" }
++ if (mx_i .ne. x_l) STOP 25 ! { dg-error "" }
++ mx_i = MAX(-a2_l, -b2_l, x_l, y_l) ! { dg-error "" }
++ if (mx_i .ne. x_l) STOP 26 ! { dg-error "" }
++ mx_r = MAX(-a_c, -b_c, x_c, y_c) ! { dg-error "" }
++ if (abs(mx_r - x_c) > 1.0D-6) STOP 27 ! { dg-error "" }
++ mx_r = MAX(-a_c, -b_c, x_c, y_c) ! { dg-error "" }
++ if (abs(mx_r - x_c) > 1.0D-6) STOP 28 ! { dg-error "" }
++ mx_r = MAX(-a_l, -b_c, x_c, y_l) ! { dg-error "" }
++ if (abs(mx_r - x_c) > 1.0D-6) STOP 29 ! { dg-error "" }
++
++ mn_i = MIN(-a_l, -b_l, x_l, y_l) ! { dg-error "" }
++ if (mn_i .ne. -a_l) STOP 31 ! { dg-error "" }
++ mn_i = MIN(-a2_l, -b2_l, x_l, y_l) ! { dg-error "" }
++ if (mn_i .ne. -a2_l) STOP 32 ! { dg-error "" }
++ mn_r = MIN(-a_c, -b_c, x_c, y_c) ! { dg-error "" }
++ if (abs(mn_r - (-a_c)) > 1.0D-6) STOP 33 ! { dg-error "" }
++ mn_r = MIN(-a2_c, -b2_c, x_c, y_c) ! { dg-error "" }
++ if (abs(mn_r - (-a2_c)) > 1.0D-6) STOP 34 ! { dg-error "" }
++ mn_r = MIN(-a_l, -b_c, x_c, y_l) ! { dg-error "" }
++ if (abs(mn_r - (-a_c)) > 1.0D-6) STOP 35 ! { dg-error "" }
++ END PROGRAM
+diff --git a/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_5.f b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_5.f
+new file mode 100644
+index 00000000000..d023af5086d
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_5.f
+@@ -0,0 +1,118 @@
++! { dg-do compile }
++! { dg-options "-fdec-promotion" }
++!
++! Test promotion between integers and reals in intrinsic operations.
++! These operations are: mod, modulo, dim, sign, min, max, minloc and
++! maxloc.
++!
++! Contributed by Francisco Redondo Marchena
++! and Jeff Law
++! Modified by Mark Eggleston
++!
++ PROGRAM promotion_int_real
++ REAL l/0.0/
++ LOGICAL a_l
++ LOGICAL*4 a2_l
++ LOGICAL b_l
++ LOGICAL*8 b2_l
++ LOGICAL x_l
++ LOGICAL y_l
++ CHARACTER a_c
++ CHARACTER*4 a2_c
++ CHARACTER b_c
++ CHARACTER*8 b2_c
++ CHARACTER x_c
++ CHARACTER y_c
++
++ INTEGER m_i/0/
++ REAL m_r/0.0/
++
++ INTEGER md_i/0/
++ REAL md_r/0.0/
++
++ INTEGER d_i/0/
++ REAL d_r/0.0/
++
++ INTEGER s_i/0/
++ REAL s_r/0.0/
++
++ INTEGER mn_i/0/
++ REAL mn_r/0.0/
++
++ INTEGER mx_i/0/
++ REAL mx_r/0.0/
++
++ m_i = MOD(a_l, b_l) ! { dg-error "" }
++ if (m_i .ne. 1) STOP 1
++ m_i = MOD(a2_l, b2_l) ! { dg-error "" }
++ if (m_i .ne. 1) STOP 2
++ m_r = MOD(a_c, b_c) ! { dg-error "" }
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 3
++ m_r = MOD(a2_c, b2_c) ! { dg-error "" }
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 4
++ m_r = MOD(a_l, b_c) ! { dg-error "" }
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 5
++ m_r = MOD(a_c, b_l) ! { dg-error "" }
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 6
++
++ md_i = MODULO(a_l, b_l) ! { dg-error "" }
++ if (md_i .ne. 1) STOP 7
++ md_i = MODULO(a2_l, b2_l) ! { dg-error "" }
++ if (md_i .ne. 1) STOP 8
++ md_r = MODULO(a_c, b_c) ! { dg-error "" }
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 9
++ md_r = MODULO(a2_c, b2_c) ! { dg-error "" }
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 10
++ md_r = MODULO(a_l, b_c) ! { dg-error "" }
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 11
++ md_r = MODULO(a_c, b_l) ! { dg-error "" }
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 12
++
++ d_i = DIM(a_l, b_l) ! { dg-error "" }
++ if (d_i .ne. 1) STOP 13
++ d_i = DIM(a2_l, b2_l) ! { dg-error "" }
++ if (d_i .ne. 1) STOP 14
++ d_r = DIM(a_c, b_c) ! { dg-error "" }
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 15
++ d_r = DIM(a2_c, b2_c) ! { dg-error "" }
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 16
++ d_r = DIM(a_c, b_l) ! { dg-error "" }
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 17
++ d_r = DIM(b_l, a_c) ! { dg-error "" }
++ if (abs(d_r) > 1.0D-6) STOP 18
++
++ s_i = SIGN(-a_l, b_l) ! { dg-error "" }
++ if (s_i .ne. 4) STOP 19
++ s_i = SIGN(-a2_l, b2_l) ! { dg-error "" }
++ if (s_i .ne. 4) STOP 20
++ s_r = SIGN(a_c, -b_c) ! { dg-error "" }
++ if (abs(s_r - (-a_c)) > 1.0D-6) STOP 21 ! { dg-error "" }
++ s_r = SIGN(a2_c, -b2_c) ! { dg-error "" }
++ if (abs(s_r - (-a2_c)) > 1.0D-6) STOP 22 ! { dg-error "" }
++ s_r = SIGN(a_c, -b_l) ! { dg-error "" }
++ if (abs(s_r - (-a_c)) > 1.0D-6) STOP 23 ! { dg-error "" }
++ s_r = SIGN(-a_l, b_c) ! { dg-error "" }
++ if (abs(s_r - a_c) > 1.0D-6) STOP 24 ! { dg-error "" }
++
++ mx_i = MAX(-a_l, -b_l, x_l, y_l) ! { dg-error "" }
++ if (mx_i .ne. x_l) STOP 25 ! { dg-error "" }
++ mx_i = MAX(-a2_l, -b2_l, x_l, y_l) ! { dg-error "" }
++ if (mx_i .ne. x_l) STOP 26 ! { dg-error "" }
++ mx_r = MAX(-a_c, -b_c, x_c, y_c) ! { dg-error "" }
++ if (abs(mx_r - x_c) > 1.0D-6) STOP 27 ! { dg-error "" }
++ mx_r = MAX(-a_c, -b_c, x_c, y_c) ! { dg-error "" }
++ if (abs(mx_r - x_c) > 1.0D-6) STOP 28 ! { dg-error "" }
++ mx_r = MAX(-a_l, -b_c, x_c, y_l) ! { dg-error "" }
++ if (abs(mx_r - x_c) > 1.0D-6) STOP 29 ! { dg-error "" }
++
++ mn_i = MIN(-a_l, -b_l, x_l, y_l) ! { dg-error "" }
++ if (mn_i .ne. -a_l) STOP 31 ! { dg-error "" }
++ mn_i = MIN(-a2_l, -b2_l, x_l, y_l) ! { dg-error "" }
++ if (mn_i .ne. -a2_l) STOP 32 ! { dg-error "" }
++ mn_r = MIN(-a_c, -b_c, x_c, y_c) ! { dg-error "" }
++ if (abs(mn_r - (-a_c)) > 1.0D-6) STOP 33 ! { dg-error "" }
++ mn_r = MIN(-a2_c, -b2_c, x_c, y_c) ! { dg-error "" }
++ if (abs(mn_r - (-a2_c)) > 1.0D-6) STOP 34 ! { dg-error "" }
++ mn_r = MIN(-a_l, -b_c, x_c, y_l) ! { dg-error "" }
++ if (abs(mn_r - (-a_c)) > 1.0D-6) STOP 35 ! { dg-error "" }
++ END PROGRAM
+diff --git a/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_6.f b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_6.f
+new file mode 100644
+index 00000000000..00f8fb88f1b
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_6.f
+@@ -0,0 +1,118 @@
++! { dg-do compile }
++! { dg-options "-fdec" }
++!
++! Test promotion between integers and reals in intrinsic operations.
++! These operations are: mod, modulo, dim, sign, min, max, minloc and
++! maxloc.
++!
++! Contributed by Francisco Redondo Marchena
++! and Jeff Law
++! Modified by Mark Eggleston
++!
++ PROGRAM promotion_int_real
++ REAL l/0.0/
++ INTEGER a_i/4/
++ INTEGER*4 a2_i/4/
++ CHARACTER b_c
++ CHARACTER*8 b2_c
++ INTEGER x_i/2/
++ CHARACTER y_c
++ REAL a_r/4.0/
++ REAL*4 a2_r/4.0/
++ LOGICAL b_l
++ LOGICAL*8 b2_l
++ REAL x_r/2.0/
++ LOGICAL y_l
++
++ INTEGER m_i/0/
++ REAL m_r/0.0/
++
++ INTEGER md_i/0/
++ REAL md_r/0.0/
++
++ INTEGER d_i/0/
++ REAL d_r/0.0/
++
++ INTEGER s_i/0/
++ REAL s_r/0.0/
++
++ INTEGER mn_i/0/
++ REAL mn_r/0.0/
++
++ INTEGER mx_i/0/
++ REAL mx_r/0.0/
++
++ m_i = MOD(a_i, b_c) ! { dg-error "" }
++ if (m_i .ne. 1) STOP 1
++ m_i = MOD(a2_i, b2_c) ! { dg-error "" }
++ if (m_i .ne. 1) STOP 2
++ m_r = MOD(a_r, b_l) ! { dg-error "" }
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 3
++ m_r = MOD(a2_r, b2_l) ! { dg-error "" }
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 4
++ m_r = MOD(a_i, b_l) ! { dg-error "" }
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 5
++ m_r = MOD(a_r, b_c) ! { dg-error "" }
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 6
++
++ md_i = MODULO(a_i, b_c) ! { dg-error "" }
++ if (md_i .ne. 1) STOP 7
++ md_i = MODULO(a2_i, b2_c) ! { dg-error "" }
++ if (md_i .ne. 1) STOP 8
++ md_r = MODULO(a_r, b_l) ! { dg-error "" }
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 9
++ md_r = MODULO(a2_r, b2_l) ! { dg-error "" }
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 10
++ md_r = MODULO(a_i, b_l) ! { dg-error "" }
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 11
++ md_r = MODULO(a_r, b_c) ! { dg-error "" }
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 12
++
++ d_i = DIM(a_i, b_c) ! { dg-error "" }
++ if (d_i .ne. 1) STOP 13
++ d_i = DIM(a2_i, b2_c) ! { dg-error "" }
++ if (d_i .ne. 1) STOP 14
++ d_r = DIM(a_r, b_l) ! { dg-error "" }
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 15
++ d_r = DIM(a2_r, b2_l) ! { dg-error "" }
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 16
++ d_r = DIM(a_r, b_c) ! { dg-error "" }
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 17
++ d_r = DIM(b_c, a_r) ! { dg-error "" }
++ if (abs(d_r) > 1.0D-6) STOP 18
++
++ s_i = SIGN(-a_i, b_c) ! { dg-error "" }
++ if (s_i .ne. 4) STOP 19
++ s_i = SIGN(-a2_i, b2_c) ! { dg-error "" }
++ if (s_i .ne. 4) STOP 20
++ s_r = SIGN(a_r, -b_l) ! { dg-error "" }
++ if (abs(s_r - (-a_r)) > 1.0D-6) STOP 21
++ s_r = SIGN(a2_r, -b2_l) ! { dg-error "" }
++ if (abs(s_r - (-a2_r)) > 1.0D-6) STOP 22
++ s_r = SIGN(a_r, -b_c) ! { dg-error "" }
++ if (abs(s_r - (-a_r)) > 1.0D-6) STOP 23
++ s_r = SIGN(-a_i, b_l) ! { dg-error "" }
++ if (abs(s_r - a_r) > 1.0D-6) STOP 24
++
++ mx_i = MAX(-a_i, -b_c, x_i, y_c) ! { dg-error "" }
++ if (mx_i .ne. x_i) STOP 25
++ mx_i = MAX(-a2_i, -b2_c, x_i, y_c) ! { dg-error "" }
++ if (mx_i .ne. x_i) STOP 26
++ mx_r = MAX(-a_r, -b_l, x_r, y_l) ! { dg-error "" }
++ if (abs(mx_r - x_r) > 1.0D-6) STOP 27
++ mx_r = MAX(-a_r, -b_l, x_r, y_l) ! { dg-error "" }
++ if (abs(mx_r - x_r) > 1.0D-6) STOP 28
++ mx_r = MAX(-a_i, -b_l, x_r, y_c) ! { dg-error "" }
++ if (abs(mx_r - x_r) > 1.0D-6) STOP 29
++
++ mn_i = MIN(-a_i, -b_c, x_i, y_c) ! { dg-error "" }
++ if (mn_i .ne. -a_i) STOP 31
++ mn_i = MIN(-a2_i, -b2_c, x_i, y_c) ! { dg-error "" }
++ if (mn_i .ne. -a2_i) STOP 32
++ mn_r = MIN(-a_r, -b_l, x_r, y_l) ! { dg-error "" }
++ if (abs(mn_r - (-a_r)) > 1.0D-6) STOP 33
++ mn_r = MIN(-a2_r, -b2_l, x_r, y_l) ! { dg-error "" }
++ if (abs(mn_r - (-a2_r)) > 1.0D-6) STOP 34
++ mn_r = MIN(-a_i, -b_l, x_r, y_c) ! { dg-error "" }
++ if (abs(mn_r - (-a_r)) > 1.0D-6) STOP 35
++ END PROGRAM
+diff --git a/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_7.f b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_7.f
+new file mode 100644
+index 00000000000..1d4150d81c0
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_intrinsic_int_real_promotion_7.f
+@@ -0,0 +1,118 @@
++! { dg-do compile }
++! { dg-options "-fdec-promotion" }
++!
++! Test promotion between integers and reals in intrinsic operations.
++! These operations are: mod, modulo, dim, sign, min, max, minloc and
++! maxloc.
++!
++! Contributed by Francisco Redondo Marchena
++! and Jeff Law
++! Modified by Mark Eggleston
++!
++ PROGRAM promotion_int_real
++ REAL l/0.0/
++ INTEGER a_i/4/
++ INTEGER*4 a2_i/4/
++ CHARACTER b_c
++ CHARACTER*8 b2_c
++ INTEGER x_i/2/
++ CHARACTER y_c
++ REAL a_r/4.0/
++ REAL*4 a2_r/4.0/
++ LOGICAL b_l
++ LOGICAL*8 b2_l
++ REAL x_r/2.0/
++ LOGICAL y_l
++
++ INTEGER m_i/0/
++ REAL m_r/0.0/
++
++ INTEGER md_i/0/
++ REAL md_r/0.0/
++
++ INTEGER d_i/0/
++ REAL d_r/0.0/
++
++ INTEGER s_i/0/
++ REAL s_r/0.0/
++
++ INTEGER mn_i/0/
++ REAL mn_r/0.0/
++
++ INTEGER mx_i/0/
++ REAL mx_r/0.0/
++
++ m_i = MOD(a_i, b_c) ! { dg-error "" }
++ if (m_i .ne. 1) STOP 1
++ m_i = MOD(a2_i, b2_c) ! { dg-error "" }
++ if (m_i .ne. 1) STOP 2
++ m_r = MOD(a_r, b_l) ! { dg-error "" }
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 3
++ m_r = MOD(a2_r, b2_l) ! { dg-error "" }
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 4
++ m_r = MOD(a_i, b_l) ! { dg-error "" }
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 5
++ m_r = MOD(a_r, b_c) ! { dg-error "" }
++ if (abs(m_r - 1.0) > 1.0D-6) STOP 6
++
++ md_i = MODULO(a_i, b_c) ! { dg-error "" }
++ if (md_i .ne. 1) STOP 7
++ md_i = MODULO(a2_i, b2_c) ! { dg-error "" }
++ if (md_i .ne. 1) STOP 8
++ md_r = MODULO(a_r, b_l) ! { dg-error "" }
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 9
++ md_r = MODULO(a2_r, b2_l) ! { dg-error "" }
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 10
++ md_r = MODULO(a_i, b_l) ! { dg-error "" }
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 11
++ md_r = MODULO(a_r, b_c) ! { dg-error "" }
++ if (abs(md_r - 1.0) > 1.0D-6) STOP 12
++
++ d_i = DIM(a_i, b_c) ! { dg-error "" }
++ if (d_i .ne. 1) STOP 13
++ d_i = DIM(a2_i, b2_c) ! { dg-error "" }
++ if (d_i .ne. 1) STOP 14
++ d_r = DIM(a_r, b_l) ! { dg-error "" }
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 15
++ d_r = DIM(a2_r, b2_l) ! { dg-error "" }
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 16
++ d_r = DIM(a_r, b_c) ! { dg-error "" }
++ if (abs(d_r - 1.0) > 1.0D-6) STOP 17
++ d_r = DIM(b_c, a_r) ! { dg-error "" }
++ if (abs(d_r) > 1.0D-6) STOP 18
++
++ s_i = SIGN(-a_i, b_c) ! { dg-error "" }
++ if (s_i .ne. 4) STOP 19
++ s_i = SIGN(-a2_i, b2_c) ! { dg-error "" }
++ if (s_i .ne. 4) STOP 20
++ s_r = SIGN(a_r, -b_l) ! { dg-error "" }
++ if (abs(s_r - (-a_r)) > 1.0D-6) STOP 21
++ s_r = SIGN(a2_r, -b2_l) ! { dg-error "" }
++ if (abs(s_r - (-a2_r)) > 1.0D-6) STOP 22
++ s_r = SIGN(a_r, -b_c) ! { dg-error "" }
++ if (abs(s_r - (-a_r)) > 1.0D-6) STOP 23
++ s_r = SIGN(-a_i, b_l) ! { dg-error "" }
++ if (abs(s_r - a_r) > 1.0D-6) STOP 24
++
++ mx_i = MAX(-a_i, -b_c, x_i, y_c) ! { dg-error "" }
++ if (mx_i .ne. x_i) STOP 25
++ mx_i = MAX(-a2_i, -b2_c, x_i, y_c) ! { dg-error "" }
++ if (mx_i .ne. x_i) STOP 26
++ mx_r = MAX(-a_r, -b_l, x_r, y_l) ! { dg-error "" }
++ if (abs(mx_r - x_r) > 1.0D-6) STOP 27
++ mx_r = MAX(-a_r, -b_l, x_r, y_l) ! { dg-error "" }
++ if (abs(mx_r - x_r) > 1.0D-6) STOP 28
++ mx_r = MAX(-a_i, -b_l, x_r, y_c) ! { dg-error "" }
++ if (abs(mx_r - x_r) > 1.0D-6) STOP 29
++
++ mn_i = MIN(-a_i, -b_c, x_i, y_c) ! { dg-error "" }
++ if (mn_i .ne. -a_i) STOP 31
++ mn_i = MIN(-a2_i, -b2_c, x_i, y_c) ! { dg-error "" }
++ if (mn_i .ne. -a2_i) STOP 32
++ mn_r = MIN(-a_r, -b_l, x_r, y_l) ! { dg-error "" }
++ if (abs(mn_r - (-a_r)) > 1.0D-6) STOP 33
++ mn_r = MIN(-a2_r, -b2_l, x_r, y_l) ! { dg-error "" }
++ if (abs(mn_r - (-a2_r)) > 1.0D-6) STOP 34
++ mn_r = MIN(-a_i, -b_l, x_r, y_c) ! { dg-error "" }
++ if (abs(mn_r - (-a_r)) > 1.0D-6) STOP 35
++ END PROGRAM
+diff --git a/gcc/testsuite/gfortran.dg/dec_kind_promotion-1.f b/gcc/testsuite/gfortran.dg/dec_kind_promotion-1.f
+new file mode 100644
+index 00000000000..435bf98350c
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_kind_promotion-1.f
+@@ -0,0 +1,40 @@
++!{ dg-do run }
++!{ dg-options "-fdec" }
++!
++! integer types of a smaller kind than expected should be
++! accepted by type specific intrinsic functions
++!
++! Contributed by Mark Eggleston
++!
++ program test_small_type_promtion
++ implicit none
++ integer(1) :: a = 1
++ integer :: i
++ if (iiabs(-9_1).ne.9) stop 1
++ if (iabs(-9_1).ne.9) stop 2
++ if (iabs(-9_2).ne.9) stop 3
++ if (jiabs(-9_1).ne.9) stop 4
++ if (jiabs(-9_2).ne.9) stop 5
++ if (iishft(1_1, 2).ne.4) stop 6
++ if (jishft(1_1, 2).ne.4) stop 7
++ if (jishft(1_2, 2).ne.4) stop 8
++ if (kishft(1_1, 2).ne.4) stop 9
++ if (kishft(1_2, 2).ne.4) stop 10
++ if (kishft(1_4, 2).ne.4) stop 11
++ if (imod(17_1, 3).ne.2) stop 12
++ if (jmod(17_1, 3).ne.2) stop 13
++ if (jmod(17_2, 3).ne.2) stop 14
++ if (kmod(17_1, 3).ne.2) stop 15
++ if (kmod(17_2, 3).ne.2) stop 16
++ if (kmod(17_4, 3).ne.2) stop 17
++ if (inot(5_1).ne.-6) stop 18
++ if (jnot(5_1).ne.-6) stop 19
++ if (jnot(5_2).ne.-6) stop 20
++ if (knot(5_1).ne.-6) stop 21
++ if (knot(5_2).ne.-6) stop 22
++ if (knot(5_4).ne.-6) stop 23
++ if (isign(-77_1, 1).ne.77) stop 24
++ if (isign(-77_1, -1).ne.-77) stop 25
++ if (isign(-77_2, 1).ne.77) stop 26
++ if (isign(-77_2, -1).ne.-77) stop 27
++ end program
+diff --git a/gcc/testsuite/gfortran.dg/dec_kind_promotion-2.f b/gcc/testsuite/gfortran.dg/dec_kind_promotion-2.f
+new file mode 100644
+index 00000000000..7b1697ca665
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_kind_promotion-2.f
+@@ -0,0 +1,40 @@
++!{ dg-do run }
++!{ dg-options "-fdec-intrinsic-ints -fdec-promotion" }
++!
++! integer types of a smaller kind than expected should be
++! accepted by type specific intrinsic functions
++!
++! Contributed by Mark Eggleston
++!
++ program test_small_type_promtion
++ implicit none
++ integer(1) :: a = 1
++ integer :: i
++ if (iiabs(-9_1).ne.9) stop 1
++ if (iabs(-9_1).ne.9) stop 2
++ if (iabs(-9_2).ne.9) stop 3
++ if (jiabs(-9_1).ne.9) stop 4
++ if (jiabs(-9_2).ne.9) stop 5
++ if (iishft(1_1, 2).ne.4) stop 6
++ if (jishft(1_1, 2).ne.4) stop 7
++ if (jishft(1_2, 2).ne.4) stop 8
++ if (kishft(1_1, 2).ne.4) stop 9
++ if (kishft(1_2, 2).ne.4) stop 10
++ if (kishft(1_4, 2).ne.4) stop 11
++ if (imod(17_1, 3).ne.2) stop 12
++ if (jmod(17_1, 3).ne.2) stop 13
++ if (jmod(17_2, 3).ne.2) stop 14
++ if (kmod(17_1, 3).ne.2) stop 15
++ if (kmod(17_2, 3).ne.2) stop 16
++ if (kmod(17_4, 3).ne.2) stop 17
++ if (inot(5_1).ne.-6) stop 18
++ if (jnot(5_1).ne.-6) stop 19
++ if (jnot(5_2).ne.-6) stop 20
++ if (knot(5_1).ne.-6) stop 21
++ if (knot(5_2).ne.-6) stop 22
++ if (knot(5_4).ne.-6) stop 23
++ if (isign(-77_1, 1).ne.77) stop 24
++ if (isign(-77_1, -1).ne.-77) stop 25
++ if (isign(-77_2, 1).ne.77) stop 26
++ if (isign(-77_2, -1).ne.-77) stop 27
++ end program
+diff --git a/gcc/testsuite/gfortran.dg/dec_kind_promotion-3.f b/gcc/testsuite/gfortran.dg/dec_kind_promotion-3.f
+new file mode 100644
+index 00000000000..db8dff6c55d
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_kind_promotion-3.f
+@@ -0,0 +1,39 @@
++!{ dg-do compile }
++!{ dg-options "-fdec -fno-dec-promotion" }
++!
++! integer types of a smaller kind than expected should be
++! accepted by type specific intrinsic functions
++!
++! Contributed by Mark Eggleston
++!
++ program test_small_type_promtion
++ integer(1) :: a = 1
++ integer :: i
++ if (iiabs(-9_1).ne.9) stop 1
++ if (iabs(-9_1).ne.9) stop 2 ! { dg-error "type mismatch in argument" }
++ if (iabs(-9_2).ne.9) stop 3 ! { dg-error "type mismatch in argument" }
++ if (jiabs(-9_1).ne.9) stop 4
++ if (jiabs(-9_2).ne.9) stop 5
++ if (iishft(1_1, 2).ne.4) stop 6
++ if (jishft(1_1, 2).ne.4) stop 7
++ if (jishft(1_2, 2).ne.4) stop 8
++ if (kishft(1_1, 2).ne.4) stop 9
++ if (kishft(1_2, 2).ne.4) stop 10
++ if (kishft(1_4, 2).ne.4) stop 11
++ if (imod(17_1, 3).ne.2) stop 12
++ if (jmod(17_1, 3).ne.2) stop 13
++ if (jmod(17_2, 3).ne.2) stop 14
++ if (kmod(17_1, 3).ne.2) stop 15
++ if (kmod(17_2, 3).ne.2) stop 16
++ if (kmod(17_4, 3).ne.2) stop 17
++ if (inot(5_1).ne.-6) stop 18
++ if (jnot(5_1).ne.-6) stop 19
++ if (jnot(5_2).ne.-6) stop 20
++ if (knot(5_1).ne.-6) stop 21
++ if (knot(5_2).ne.-6) stop 22
++ if (knot(5_4).ne.-6) stop 23
++ if (isign(-77_1, 1).ne.77) stop 24 ! { dg-error "type mismatch in argument" }
++ if (isign(-77_1, -1).ne.-77) stop 25 ! { dg-error "type mismatch in argument" }
++ if (isign(-77_2, 1).ne.77) stop 26 ! { dg-error "type mismatch in argument" }
++ if (isign(-77_2, -1).ne.-77) stop 27 ! { dg-error "type mismatch in argument" }
++ end program
+--
+2.27.0
+
diff --git a/SOURCES/gcc11-fortran-fdec-sequence.patch b/SOURCES/gcc11-fortran-fdec-sequence.patch
new file mode 100644
index 0000000..7b9ce71
--- /dev/null
+++ b/SOURCES/gcc11-fortran-fdec-sequence.patch
@@ -0,0 +1,262 @@
+From bb76446db10c21860a4e19569ce3e350d8a2b59f Mon Sep 17 00:00:00 2001
+From: Mark Eggleston
+Date: Fri, 22 Jan 2021 15:00:44 +0000
+Subject: [PATCH 09/10] Add the SEQUENCE attribute by default if it's not
+ present.
+
+Use -fdec-sequence to enable this feature. Also enabled by -fdec.
+---
+ gcc/fortran/lang.opt | 4 ++
+ gcc/fortran/options.c | 1 +
+ gcc/fortran/resolve.c | 13 ++++-
+ ...dd_SEQUENCE_to_COMMON_block_by_default_1.f | 57 +++++++++++++++++++
+ ...dd_SEQUENCE_to_COMMON_block_by_default_2.f | 57 +++++++++++++++++++
+ ...dd_SEQUENCE_to_COMMON_block_by_default_3.f | 57 +++++++++++++++++++
+ 6 files changed, 186 insertions(+), 3 deletions(-)
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_add_SEQUENCE_to_COMMON_block_by_default_1.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_add_SEQUENCE_to_COMMON_block_by_default_2.f
+ create mode 100644 gcc/testsuite/gfortran.dg/dec_add_SEQUENCE_to_COMMON_block_by_default_3.f
+
+diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
+index 4ca2f93f2df..019c798cf09 100644
+--- a/gcc/fortran/lang.opt
++++ b/gcc/fortran/lang.opt
+@@ -509,6 +509,10 @@ fdec-promotion
+ Fortran Var(flag_dec_promotion)
+ Add support for type promotion in intrinsic arguments.
+
++fdec-sequence
++Fortran Var(flag_dec_sequence)
++Add the SEQUENCE attribute by default if it's not present.
++
+ fdec-structure
+ Fortran Var(flag_dec_structure)
+ Enable support for DEC STRUCTURE/RECORD.
+diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
+index 15079c7e95a..050f56fdc25 100644
+--- a/gcc/fortran/options.c
++++ b/gcc/fortran/options.c
+@@ -83,6 +83,7 @@ set_dec_flags (int value)
+ SET_BITFLAG (flag_dec_override_kind, value, value);
+ SET_BITFLAG (flag_dec_non_logical_if, value, value);
+ SET_BITFLAG (flag_dec_promotion, value, value);
++ SET_BITFLAG (flag_dec_sequence, value, value);
+ }
+
+ /* Finalize DEC flags. */
+diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
+index 07dd039f3bf..fe7d0cc5944 100644
+--- a/gcc/fortran/resolve.c
++++ b/gcc/fortran/resolve.c
+@@ -978,9 +978,16 @@ resolve_common_vars (gfc_common_head *common_block, bool named_common)
+
+ if (!(csym->ts.u.derived->attr.sequence
+ || csym->ts.u.derived->attr.is_bind_c))
+- gfc_error_now ("Derived type variable %qs in COMMON at %L "
+- "has neither the SEQUENCE nor the BIND(C) "
+- "attribute", csym->name, &csym->declared_at);
++ {
++ if (flag_dec_sequence)
++ /* Assume sequence. */
++ csym->ts.u.derived->attr.sequence = 1;
++ else
++ gfc_error_now ("Derived type variable '%s' in COMMON at %L "
++ "has neither the SEQUENCE nor the BIND(C) "
++ "attribute", csym->name, &csym->declared_at);
++ }
++
+ if (csym->ts.u.derived->attr.alloc_comp)
+ gfc_error_now ("Derived type variable %qs in COMMON at %L "
+ "has an ultimate component that is "
+diff --git a/gcc/testsuite/gfortran.dg/dec_add_SEQUENCE_to_COMMON_block_by_default_1.f b/gcc/testsuite/gfortran.dg/dec_add_SEQUENCE_to_COMMON_block_by_default_1.f
+new file mode 100644
+index 00000000000..fe7b39625eb
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_add_SEQUENCE_to_COMMON_block_by_default_1.f
+@@ -0,0 +1,57 @@
++! { dg-do run }
++! { dg-options "-fdec" }
++!
++! Test add default SEQUENCE attribute derived types appearing in
++! COMMON blocks and EQUIVALENCE statements.
++!
++! Contributed by Francisco Redondo Marchena
++! Modified by Mark Eggleston
++!
++ MODULE SEQ
++ TYPE STRUCT1
++ INTEGER*4 ID
++ INTEGER*4 TYPE
++ INTEGER*8 DEFVAL
++ CHARACTER*(4) NAME
++ LOGICAL*1 NIL
++ END TYPE STRUCT1
++ END MODULE
++
++ SUBROUTINE A
++ USE SEQ
++ TYPE (STRUCT1) S
++ COMMON /BLOCK1/ S
++ IF (S%ID.NE.5) STOP 1
++ IF (S%TYPE.NE.1000) STOP 2
++ IF (S%DEFVAL.NE.-99) STOP 3
++ IF (S%NAME.NE."JANE") STOP 4
++ IF (S%NIL.NEQV..FALSE.) STOP 5
++ END SUBROUTINE
++
++ PROGRAM sequence_att_common
++ USE SEQ
++ IMPLICIT NONE
++ TYPE (STRUCT1) S1
++ TYPE (STRUCT1) S2
++ TYPE (STRUCT1) S3
++
++ EQUIVALENCE (S1,S2)
++ COMMON /BLOCK1/ S3
++
++ S1%ID = 5
++ S1%TYPE = 1000
++ S1%DEFVAL = -99
++ S1%NAME = "JANE"
++ S1%NIL = .FALSE.
++
++ IF (S2%ID.NE.5) STOP 1
++ IF (S2%TYPE.NE.1000) STOP 2
++ IF (S2%DEFVAL.NE.-99) STOP 3
++ IF (S2%NAME.NE."JANE") STOP 4
++ IF (S2%NIL.NEQV..FALSE.) STOP 5
++
++ S3 = S1
++
++ CALL A
++
++ END
+diff --git a/gcc/testsuite/gfortran.dg/dec_add_SEQUENCE_to_COMMON_block_by_default_2.f b/gcc/testsuite/gfortran.dg/dec_add_SEQUENCE_to_COMMON_block_by_default_2.f
+new file mode 100644
+index 00000000000..83512f0f3a2
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_add_SEQUENCE_to_COMMON_block_by_default_2.f
+@@ -0,0 +1,57 @@
++! { dg-do run }
++! { dg-options "-fdec-sequence" }
++!
++! Test add default SEQUENCE attribute derived types appearing in
++! COMMON blocks and EQUIVALENCE statements.
++!
++! Contributed by Francisco Redondo Marchena
++! Modified by Mark Eggleston
++!
++ MODULE SEQ
++ TYPE STRUCT1
++ INTEGER*4 ID
++ INTEGER*4 TYPE
++ INTEGER*8 DEFVAL
++ CHARACTER*(4) NAME
++ LOGICAL*1 NIL
++ END TYPE STRUCT1
++ END MODULE
++
++ SUBROUTINE A
++ USE SEQ
++ TYPE (STRUCT1) S
++ COMMON /BLOCK1/ S
++ IF (S%ID.NE.5) STOP 1
++ IF (S%TYPE.NE.1000) STOP 2
++ IF (S%DEFVAL.NE.-99) STOP 3
++ IF (S%NAME.NE."JANE") STOP 4
++ IF (S%NIL.NEQV..FALSE.) STOP 5
++ END SUBROUTINE
++
++ PROGRAM sequence_att_common
++ USE SEQ
++ IMPLICIT NONE
++ TYPE (STRUCT1) S1
++ TYPE (STRUCT1) S2
++ TYPE (STRUCT1) S3
++
++ EQUIVALENCE (S1,S2)
++ COMMON /BLOCK1/ S3
++
++ S1%ID = 5
++ S1%TYPE = 1000
++ S1%DEFVAL = -99
++ S1%NAME = "JANE"
++ S1%NIL = .FALSE.
++
++ IF (S2%ID.NE.5) STOP 1
++ IF (S2%TYPE.NE.1000) STOP 2
++ IF (S2%DEFVAL.NE.-99) STOP 3
++ IF (S2%NAME.NE."JANE") STOP 4
++ IF (S2%NIL.NEQV..FALSE.) STOP 5
++
++ S3 = S1
++
++ CALL A
++
++ END
+diff --git a/gcc/testsuite/gfortran.dg/dec_add_SEQUENCE_to_COMMON_block_by_default_3.f b/gcc/testsuite/gfortran.dg/dec_add_SEQUENCE_to_COMMON_block_by_default_3.f
+new file mode 100644
+index 00000000000..26cd59f9090
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/dec_add_SEQUENCE_to_COMMON_block_by_default_3.f
+@@ -0,0 +1,57 @@
++! { dg-do compile }
++! { dg-options "-fdec -fno-dec-sequence" }
++!
++! Test add default SEQUENCE attribute derived types appearing in
++! COMMON blocks and EQUIVALENCE statements.
++!
++! Contributed by Francisco Redondo Marchena
++! Modified by Mark Eggleston
++!
++ MODULE SEQ
++ TYPE STRUCT1
++ INTEGER*4 ID
++ INTEGER*4 TYPE
++ INTEGER*8 DEFVAL
++ CHARACTER*(4) NAME
++ LOGICAL*1 NIL
++ END TYPE STRUCT1
++ END MODULE
++
++ SUBROUTINE A
++ USE SEQ
++ TYPE (STRUCT1) S ! { dg-error "Derived type variable" }
++ COMMON /BLOCK1/ S
++ IF (S%ID.NE.5) STOP 1
++ IF (S%TYPE.NE.1000) STOP 2
++ IF (S%DEFVAL.NE.-99) STOP 3
++ IF (S%NAME.NE."JANE") STOP 4
++ IF (S%NIL.NEQV..FALSE.) STOP 5
++ END SUBROUTINE
++
++ PROGRAM sequence_att_common
++ USE SEQ
++ IMPLICIT NONE
++ TYPE (STRUCT1) S1
++ TYPE (STRUCT1) S2
++ TYPE (STRUCT1) S3 ! { dg-error "Derived type variable" }
++
++ EQUIVALENCE (S1,S2) ! { dg-error "Derived type variable" }
++ COMMON /BLOCK1/ S3
++
++ S1%ID = 5
++ S1%TYPE = 1000
++ S1%DEFVAL = -99
++ S1%NAME = "JANE"
++ S1%NIL = .FALSE.
++
++ IF (S2%ID.NE.5) STOP 1
++ IF (S2%TYPE.NE.1000) STOP 2
++ IF (S2%DEFVAL.NE.-99) STOP 3
++ IF (S2%NAME.NE."JANE") STOP 4
++ IF (S2%NIL.NEQV..FALSE.) STOP 5
++
++ S3 = S1
++
++ CALL A
++
++ END
+--
+2.27.0
+
diff --git a/SOURCES/gcc11-fortran-flogical-as-integer.patch b/SOURCES/gcc11-fortran-flogical-as-integer.patch
new file mode 100644
index 0000000..41cbf60
--- /dev/null
+++ b/SOURCES/gcc11-fortran-flogical-as-integer.patch
@@ -0,0 +1,305 @@
+From 9b45f3063dfd2b893e7963a4828c1b0afecdc68a Mon Sep 17 00:00:00 2001
+From: Mark Eggleston
+Date: Fri, 22 Jan 2021 12:41:46 +0000
+Subject: [PATCH 02/10] Convert LOGICAL to INTEGER for arithmetic ops, and vice
+ versa
+
+We allow converting LOGICAL types to INTEGER when doing arithmetic
+operations, and converting INTEGER types to LOGICAL for use in
+boolean operations.
+
+This feature is enabled with the -flogical-as-integer flag.
+
+Note: using this feature will disable bitwise logical operations enabled by
+-fdec.
+---
+ gcc/fortran/lang.opt | 4 ++
+ gcc/fortran/resolve.c | 55 ++++++++++++++++++-
+ .../logical_to_integer_and_vice_versa_1.f | 31 +++++++++++
+ .../logical_to_integer_and_vice_versa_2.f | 31 +++++++++++
+ .../logical_to_integer_and_vice_versa_3.f | 33 +++++++++++
+ .../logical_to_integer_and_vice_versa_4.f | 33 +++++++++++
+ 6 files changed, 186 insertions(+), 1 deletion(-)
+ create mode 100644 gcc/testsuite/gfortran.dg/logical_to_integer_and_vice_versa_1.f
+ create mode 100644 gcc/testsuite/gfortran.dg/logical_to_integer_and_vice_versa_2.f
+ create mode 100644 gcc/testsuite/gfortran.dg/logical_to_integer_and_vice_versa_3.f
+ create mode 100644 gcc/testsuite/gfortran.dg/logical_to_integer_and_vice_versa_4.f
+
+diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
+index 52bd522051e..c4da248f07c 100644
+--- a/gcc/fortran/lang.opt
++++ b/gcc/fortran/lang.opt
+@@ -497,6 +497,10 @@ fdec-static
+ Fortran Var(flag_dec_static)
+ Enable DEC-style STATIC and AUTOMATIC attributes.
+
++flogical-as-integer
++Fortran Var(flag_logical_as_integer)
++Convert from integer to logical or logical to integer for arithmetic operations.
++
+ fdefault-double-8
+ Fortran Var(flag_default_double)
+ Set the default double precision kind to an 8 byte wide type.
+diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
+index c075d0fa0c4..4b90cb59902 100644
+--- a/gcc/fortran/resolve.c
++++ b/gcc/fortran/resolve.c
+@@ -3915,7 +3915,6 @@ lookup_uop_fuzzy (const char *op, gfc_symtree *uop)
+ return gfc_closest_fuzzy_match (op, candidates);
+ }
+
+-
+ /* Callback finding an impure function as an operand to an .and. or
+ .or. expression. Remember the last function warned about to
+ avoid double warnings when recursing. */
+@@ -3975,6 +3974,22 @@ convert_hollerith_to_character (gfc_expr *e)
+ }
+ }
+
++/* If E is a logical, convert it to an integer and issue a warning
++ for the conversion. */
++
++static void
++convert_integer_to_logical (gfc_expr *e)
++{
++ if (e->ts.type == BT_INTEGER)
++ {
++ /* Convert to LOGICAL */
++ gfc_typespec t;
++ t.type = BT_LOGICAL;
++ t.kind = 1;
++ gfc_convert_type_warn (e, &t, 2, 1);
++ }
++}
++
+ /* Convert to numeric and issue a warning for the conversion. */
+
+ static void
+@@ -3987,6 +4002,22 @@ convert_to_numeric (gfc_expr *a, gfc_expr *b)
+ gfc_convert_type_warn (a, &t, 2, 1);
+ }
+
++/* If E is a logical, convert it to an integer and issue a warning
++ for the conversion. */
++
++static void
++convert_logical_to_integer (gfc_expr *e)
++{
++ if (e->ts.type == BT_LOGICAL)
++ {
++ /* Convert to INTEGER */
++ gfc_typespec t;
++ t.type = BT_INTEGER;
++ t.kind = 1;
++ gfc_convert_type_warn (e, &t, 2, 1);
++ }
++}
++
+ /* Resolve an operator expression node. This can involve replacing the
+ operation with a user defined function call. */
+
+@@ -4072,6 +4103,12 @@ resolve_operator (gfc_expr *e)
+ case INTRINSIC_TIMES:
+ case INTRINSIC_DIVIDE:
+ case INTRINSIC_POWER:
++ if (flag_logical_as_integer)
++ {
++ convert_logical_to_integer (op1);
++ convert_logical_to_integer (op2);
++ }
++
+ if (gfc_numeric_ts (&op1->ts) && gfc_numeric_ts (&op2->ts))
+ {
+ gfc_type_convert_binary (e, 1);
+@@ -4108,6 +4145,13 @@ resolve_operator (gfc_expr *e)
+ case INTRINSIC_OR:
+ case INTRINSIC_EQV:
+ case INTRINSIC_NEQV:
++
++ if (flag_logical_as_integer)
++ {
++ convert_integer_to_logical (op1);
++ convert_integer_to_logical (op2);
++ }
++
+ if (op1->ts.type == BT_LOGICAL && op2->ts.type == BT_LOGICAL)
+ {
+ e->ts.type = BT_LOGICAL;
+@@ -4158,6 +4202,9 @@ resolve_operator (gfc_expr *e)
+ goto simplify_op;
+ }
+
++ if (flag_logical_as_integer)
++ convert_integer_to_logical (op1);
++
+ if (op1->ts.type == BT_LOGICAL)
+ {
+ e->ts.type = BT_LOGICAL;
+@@ -4198,6 +4245,12 @@ resolve_operator (gfc_expr *e)
+ convert_hollerith_to_character (op2);
+ }
+
++ if (flag_logical_as_integer)
++ {
++ convert_logical_to_integer (op1);
++ convert_logical_to_integer (op2);
++ }
++
+ if (op1->ts.type == BT_CHARACTER && op2->ts.type == BT_CHARACTER
+ && op1->ts.kind == op2->ts.kind)
+ {
+diff --git a/gcc/testsuite/gfortran.dg/logical_to_integer_and_vice_versa_1.f b/gcc/testsuite/gfortran.dg/logical_to_integer_and_vice_versa_1.f
+new file mode 100644
+index 00000000000..938a91d9e9a
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/logical_to_integer_and_vice_versa_1.f
+@@ -0,0 +1,31 @@
++! { dg-do run }
++! { dg-options "-std=legacy -flogical-as-integer" }
++!
++! Test conversion between logical and integer for logical operators
++!
++! Test case contributed by Jim MacArthur
++! Modified for -flogical-as-integer by Mark Eggleston
++!
++!
++ PROGRAM logical_integer_conversion
++ LOGICAL lpos /.true./
++ INTEGER ineg/0/
++ INTEGER ires
++ LOGICAL lres
++
++ ! Test Logicals converted to Integers
++ if ((lpos.AND.ineg).EQ.1) STOP 3
++ if ((ineg.AND.lpos).NE.0) STOP 4
++ ires = (.true..AND.0)
++ if (ires.NE.0) STOP 5
++ ires = (1.AND..false.)
++ if (ires.EQ.1) STOP 6
++
++ ! Test Integers converted to Logicals
++ if (lpos.EQ.ineg) STOP 7
++ if (ineg.EQ.lpos) STOP 8
++ lres = (.true..EQ.0)
++ if (lres) STOP 9
++ lres = (1.EQ..false.)
++ if (lres) STOP 10
++ END
+diff --git a/gcc/testsuite/gfortran.dg/logical_to_integer_and_vice_versa_2.f b/gcc/testsuite/gfortran.dg/logical_to_integer_and_vice_versa_2.f
+new file mode 100644
+index 00000000000..9f146202ba5
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/logical_to_integer_and_vice_versa_2.f
+@@ -0,0 +1,31 @@
++! { dg-do compile }
++! { dg-options "-std=legacy -flogical-as-integer -fno-logical-as-integer" }
++!
++! Based on logical_to_integer_and_vice_versa_1.f but with option disabled
++! to test for error messages.
++!
++! Test case contributed by by Mark Eggleston
++!
++!
++ PROGRAM logical_integer_conversion
++ LOGICAL lpos /.true./
++ INTEGER ineg/0/
++ INTEGER ires
++ LOGICAL lres
++
++ ! Test Logicals converted to Integers
++ if ((lpos.AND.ineg).EQ.1) STOP 3 ! { dg-error "Operands of logical operator" }
++ if ((ineg.AND.lpos).NE.0) STOP 4 ! { dg-error "Operands of logical operator" }
++ ires = (.true..AND.0) ! { dg-error "Operands of logical operator" }
++ if (ires.NE.0) STOP 5
++ ires = (1.AND..false.) ! { dg-error "Operands of logical operator" }
++ if (ires.EQ.1) STOP 6
++
++ ! Test Integers converted to Logicals
++ if (lpos.EQ.ineg) STOP 7 ! { dg-error "Operands of comparison operator" }
++ if (ineg.EQ.lpos) STOP 8 ! { dg-error "Operands of comparison operator" }
++ lres = (.true..EQ.0) ! { dg-error "Operands of comparison operator" }
++ if (lres) STOP 9
++ lres = (1.EQ..false.) ! { dg-error "Operands of comparison operator" }
++ if (lres) STOP 10
++ END
+diff --git a/gcc/testsuite/gfortran.dg/logical_to_integer_and_vice_versa_3.f b/gcc/testsuite/gfortran.dg/logical_to_integer_and_vice_versa_3.f
+new file mode 100644
+index 00000000000..446873eb2dc
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/logical_to_integer_and_vice_versa_3.f
+@@ -0,0 +1,33 @@
++! { dg-do compile }
++! { dg-options "-std=legacy -flogical-as-integer" }
++!
++! Test conversion between logical and integer for logical operators
++!
++ program test
++ logical f /.false./
++ logical t /.true./
++ real x
++
++ x = 7.7
++ x = x + t*3.0
++ if (abs(x - 10.7).gt.0.00001) stop 1
++ x = x + .false.*5.0
++ if (abs(x - 10.7).gt.0.00001) stop 2
++ x = x - .true.*5.0
++ if (abs(x - 5.7).gt.0.00001) stop 3
++ x = x + t
++ if (abs(x - 6.7).gt.0.00001) stop 4
++ x = x + f
++ if (abs(x - 6.7).gt.0.00001) stop 5
++ x = x - t
++ if (abs(x - 5.7).gt.0.00001) stop 6
++ x = x - f
++ if (abs(x - 5.7).gt.0.00001) stop 7
++ x = x**.true.
++ if (abs(x - 5.7).gt.0.00001) stop 8
++ x = x**.false.
++ if (abs(x - 1.0).gt.0.00001) stop 9
++ x = x/t
++ if (abs(x - 1.0).gt.0.00001) stop 10
++ if ((x/.false.).le.huge(x)) stop 11
++ end
+diff --git a/gcc/testsuite/gfortran.dg/logical_to_integer_and_vice_versa_4.f b/gcc/testsuite/gfortran.dg/logical_to_integer_and_vice_versa_4.f
+new file mode 100644
+index 00000000000..4301a4988d8
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/logical_to_integer_and_vice_versa_4.f
+@@ -0,0 +1,33 @@
++! { dg-do compile }
++! { dg-options "-std=legacy -flogical-as-integer -fno-logical-as-integer" }
++!
++! Test conversion between logical and integer for logical operators
++!
++ program test
++ logical f /.false./
++ logical t /.true./
++ real x
++
++ x = 7.7
++ x = x + t*3.0 ! { dg-error "Operands of binary numeric" }
++ if (abs(x - 10.7).gt.0.00001) stop 1
++ x = x + .false.*5.0 ! { dg-error "Operands of binary numeric" }
++ if (abs(x - 10.7).gt.0.00001) stop 2
++ x = x - .true.*5.0 ! { dg-error "Operands of binary numeric" }
++ if (abs(x - 5.7).gt.0.00001) stop 3
++ x = x + t ! { dg-error "Operands of binary numeric" }
++ if (abs(x - 6.7).gt.0.00001) stop 4
++ x = x + f ! { dg-error "Operands of binary numeric" }
++ if (abs(x - 6.7).gt.0.00001) stop 5
++ x = x - t ! { dg-error "Operands of binary numeric" }
++ if (abs(x - 5.7).gt.0.00001) stop 6
++ x = x - f ! { dg-error "Operands of binary numeric" }
++ if (abs(x - 5.7).gt.0.00001) stop 7
++ x = x**.true. ! { dg-error "Operands of binary numeric" }
++ if (abs(x - 5.7).gt.0.00001) stop 8
++ x = x**.false. ! { dg-error "Operands of binary numeric" }
++ if (abs(x - 1.0).gt.0.00001) stop 9
++ x = x/t ! { dg-error "Operands of binary numeric" }
++ if (abs(x - 1.0).gt.0.00001) stop 10
++ if ((x/.false.).le.huge(x)) stop 11 ! { dg-error "Operands of binary numeric" }
++ end
+--
+2.27.0
+
diff --git a/SOURCES/gcc11-hack.patch b/SOURCES/gcc11-hack.patch
new file mode 100644
index 0000000..3a5f3f3
--- /dev/null
+++ b/SOURCES/gcc11-hack.patch
@@ -0,0 +1,126 @@
+--- libada/Makefile.in.jj 2019-01-09 13:01:18.015608205 +0100
++++ libada/Makefile.in 2019-01-11 18:16:23.441726931 +0100
+@@ -71,18 +71,40 @@ version := $(shell @get_gcc_base_ver@ $(
+ libsubdir := $(libdir)/gcc/$(target_noncanonical)/$(version)$(MULTISUBDIR)
+ ADA_RTS_DIR=$(GCC_DIR)/ada/rts$(subst /,_,$(MULTISUBDIR))
+
++DEFAULTMULTIFLAGS :=
++ifeq ($(MULTISUBDIR),)
++targ:=$(subst -, ,$(target))
++arch:=$(word 1,$(targ))
++ifeq ($(words $(targ)),2)
++osys:=$(word 2,$(targ))
++else
++osys:=$(word 3,$(targ))
++endif
++ifeq ($(strip $(filter-out i%86 x86_64 powerpc% ppc% s390% sparc% linux%, $(arch) $(osys))),)
++ifeq ($(shell $(CC) $(CFLAGS) -print-multi-os-directory),../lib64)
++DEFAULTMULTIFLAGS := -m64
++else
++ifeq ($(strip $(filter-out s390%, $(arch))),)
++DEFAULTMULTIFLAGS := -m31
++else
++DEFAULTMULTIFLAGS := -m32
++endif
++endif
++endif
++endif
++
+ # exeext should not be used because it's the *host* exeext. We're building
+ # a *target* library, aren't we?!? Likewise for CC. Still, provide bogus
+ # definitions just in case something slips through the safety net provided
+ # by recursive make invocations in gcc/ada/Makefile.in
+ LIBADA_FLAGS_TO_PASS = \
+ "MAKEOVERRIDES=" \
+- "LDFLAGS=$(LDFLAGS)" \
++ "LDFLAGS=$(LDFLAGS) $(DEFAULTMULTIFLAGS)" \
+ "LN_S=$(LN_S)" \
+ "SHELL=$(SHELL)" \
+- "GNATLIBFLAGS=$(GNATLIBFLAGS) $(MULTIFLAGS)" \
+- "GNATLIBCFLAGS=$(GNATLIBCFLAGS) $(MULTIFLAGS)" \
+- "GNATLIBCFLAGS_FOR_C=$(GNATLIBCFLAGS_FOR_C) $(MULTIFLAGS)" \
++ "GNATLIBFLAGS=$(GNATLIBFLAGS) $(MULTIFLAGS) $(DEFAULTMULTIFLAGS)" \
++ "GNATLIBCFLAGS=$(GNATLIBCFLAGS) $(MULTIFLAGS) $(DEFAULTMULTIFLAGS)" \
++ "GNATLIBCFLAGS_FOR_C=$(GNATLIBCFLAGS_FOR_C) $(MULTIFLAGS) $(DEFAULTMULTIFLAGS)" \
+ "PICFLAG_FOR_TARGET=$(PICFLAG)" \
+ "THREAD_KIND=$(THREAD_KIND)" \
+ "TRACE=$(TRACE)" \
+@@ -93,7 +115,7 @@ LIBADA_FLAGS_TO_PASS = \
+ "exeext=.exeext.should.not.be.used " \
+ 'CC=the.host.compiler.should.not.be.needed' \
+ "GCC_FOR_TARGET=$(CC)" \
+- "CFLAGS=$(CFLAGS)"
++ "CFLAGS=$(CFLAGS) $(DEFAULTMULTIFLAGS)"
+
+ .PHONY: libada gnatlib gnatlib-shared gnatlib-sjlj gnatlib-zcx osconstool
+
+--- config-ml.in.jj 2019-01-09 12:50:16.646501448 +0100
++++ config-ml.in 2019-01-11 18:16:23.442726914 +0100
+@@ -511,6 +511,8 @@ multi-do:
+ ADAFLAGS="$(ADAFLAGS) $${flags}" \
+ prefix="$(prefix)" \
+ exec_prefix="$(exec_prefix)" \
++ mandir="$(mandir)" \
++ infodir="$(infodir)" \
+ GOCFLAGS="$(GOCFLAGS) $${flags}" \
+ GDCFLAGS="$(GDCFLAGS) $${flags}" \
+ CXXFLAGS="$(CXXFLAGS) $${flags}" \
+--- libcpp/macro.c.jj 2019-01-09 13:01:21.420552123 +0100
++++ libcpp/macro.c 2019-01-11 18:18:17.736876285 +0100
+@@ -3256,8 +3256,6 @@ static cpp_macro *
+ create_iso_definition (cpp_reader *pfile)
+ {
+ bool following_paste_op = false;
+- const char *paste_op_error_msg =
+- N_("'##' cannot appear at either end of a macro expansion");
+ unsigned int num_extra_tokens = 0;
+ unsigned nparms = 0;
+ cpp_hashnode **params = NULL;
+@@ -3382,7 +3380,9 @@ create_iso_definition (cpp_reader *pfile
+ function-like macros, but not at the end. */
+ if (following_paste_op)
+ {
+- cpp_error (pfile, CPP_DL_ERROR, paste_op_error_msg);
++ cpp_error (pfile, CPP_DL_ERROR,
++ "'##' cannot appear at either end of a macro "
++ "expansion");
+ goto out;
+ }
+ if (!vaopt_tracker.completed ())
+@@ -3397,7 +3397,9 @@ create_iso_definition (cpp_reader *pfile
+ function-like macros, but not at the beginning. */
+ if (macro->count == 1)
+ {
+- cpp_error (pfile, CPP_DL_ERROR, paste_op_error_msg);
++ cpp_error (pfile, CPP_DL_ERROR,
++ "'##' cannot appear at either end of a macro "
++ "expansion");
+ goto out;
+ }
+
+--- libcpp/expr.c.jj 2019-01-09 13:01:22.415535734 +0100
++++ libcpp/expr.c 2019-01-11 18:16:23.444726882 +0100
+@@ -803,16 +803,17 @@ cpp_classify_number (cpp_reader *pfile,
+ if ((result & CPP_N_WIDTH) == CPP_N_LARGE
+ && CPP_OPTION (pfile, cpp_warn_long_long))
+ {
+- const char *message = CPP_OPTION (pfile, cplusplus)
+- ? N_("use of C++11 long long integer constant")
+- : N_("use of C99 long long integer constant");
+-
+ if (CPP_OPTION (pfile, c99))
+ cpp_warning_with_line (pfile, CPP_W_LONG_LONG, virtual_location,
+- 0, message);
++ 0, CPP_OPTION (pfile, cplusplus)
++ ? N_("use of C++11 long long integer constant")
++ : N_("use of C99 long long integer constant"));
+ else
+ cpp_pedwarning_with_line (pfile, CPP_W_LONG_LONG,
+- virtual_location, 0, message);
++ virtual_location, 0,
++ CPP_OPTION (pfile, cplusplus)
++ ? N_("use of C++11 long long integer constant")
++ : N_("use of C99 long long integer constant"));
+ }
+
+ if ((result & CPP_N_SIZE_T) == CPP_N_SIZE_T
diff --git a/SOURCES/gcc11-isl-dl.patch b/SOURCES/gcc11-isl-dl.patch
new file mode 100644
index 0000000..b3982f9
--- /dev/null
+++ b/SOURCES/gcc11-isl-dl.patch
@@ -0,0 +1,716 @@
+--- gcc/Makefile.in.jj 2015-06-06 10:00:25.000000000 +0200
++++ gcc/Makefile.in 2015-11-04 14:56:02.643536437 +0100
+@@ -1063,7 +1063,7 @@ BUILD_LIBDEPS= $(BUILD_LIBIBERTY)
+ # and the system's installed libraries.
+ LIBS = @LIBS@ libcommon.a $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBBACKTRACE) \
+ $(LIBIBERTY) $(LIBDECNUMBER) $(HOST_LIBS)
+-BACKENDLIBS = $(ISLLIBS) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \
++BACKENDLIBS = $(if $(ISLLIBS),-ldl) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \
+ $(ZLIB) $(ZSTD_LIB)
+ # Any system libraries needed just for GNAT.
+ SYSLIBS = @GNAT_LIBEXC@
+@@ -2302,6 +2302,15 @@ $(out_object_file): $(out_file)
+ $(common_out_object_file): $(common_out_file)
+ $(COMPILE) $<
+ $(POSTCOMPILE)
++
++graphite%.o : \
++ ALL_CFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CFLAGS))
++graphite.o : \
++ ALL_CFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CFLAGS))
++graphite%.o : \
++ ALL_CXXFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CXXFLAGS))
++graphite.o : \
++ ALL_CXXFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CXXFLAGS))
+ #
+ # Generate header and source files from the machine description,
+ # and compile them.
+--- gcc/graphite.h.jj 2016-01-27 12:44:06.000000000 +0100
++++ gcc/graphite.h 2016-01-27 13:26:38.309876856 +0100
+@@ -24,6 +24,591 @@ along with GCC; see the file COPYING3.
+
+ #include "sese.h"
+
++#include
++#include
++
++#define DYNSYMS \
++ DYNSYM (isl_aff_add_coefficient_si); \
++ DYNSYM (isl_aff_free); \
++ DYNSYM (isl_aff_get_space); \
++ DYNSYM (isl_aff_set_coefficient_si); \
++ DYNSYM (isl_aff_set_constant_si); \
++ DYNSYM (isl_aff_zero_on_domain); \
++ DYNSYM (isl_band_free); \
++ DYNSYM (isl_band_get_children); \
++ DYNSYM (isl_band_get_partial_schedule); \
++ DYNSYM (isl_band_has_children); \
++ DYNSYM (isl_band_list_free); \
++ DYNSYM (isl_band_list_get_band); \
++ DYNSYM (isl_band_list_get_ctx); \
++ DYNSYM (isl_band_list_n_band); \
++ DYNSYM (isl_band_n_member); \
++ DYNSYM (isl_basic_map_add_constraint); \
++ DYNSYM (isl_basic_map_project_out); \
++ DYNSYM (isl_basic_map_universe); \
++ DYNSYM (isl_constraint_set_coefficient_si); \
++ DYNSYM (isl_constraint_set_constant_si); \
++ DYNSYM (isl_ctx_alloc); \
++ DYNSYM (isl_ctx_free); \
++ DYNSYM (isl_equality_alloc); \
++ DYNSYM (isl_id_alloc); \
++ DYNSYM (isl_id_copy); \
++ DYNSYM (isl_id_free); \
++ DYNSYM (isl_inequality_alloc); \
++ DYNSYM (isl_local_space_copy); \
++ DYNSYM (isl_local_space_free); \
++ DYNSYM (isl_local_space_from_space); \
++ DYNSYM (isl_local_space_range); \
++ DYNSYM (isl_map_add_constraint); \
++ DYNSYM (isl_map_add_dims); \
++ DYNSYM (isl_map_align_params); \
++ DYNSYM (isl_map_apply_range); \
++ DYNSYM (isl_map_copy); \
++ DYNSYM (isl_map_dim); \
++ DYNSYM (isl_map_dump); \
++ DYNSYM (isl_map_equate); \
++ DYNSYM (isl_map_fix_si); \
++ DYNSYM (isl_map_flat_product); \
++ DYNSYM (isl_map_flat_range_product); \
++ DYNSYM (isl_map_free); \
++ DYNSYM (isl_map_from_basic_map); \
++ DYNSYM (isl_map_from_pw_aff); \
++ DYNSYM (isl_map_from_union_map); \
++ DYNSYM (isl_map_get_ctx); \
++ DYNSYM (isl_map_get_space); \
++ DYNSYM (isl_map_get_tuple_id); \
++ DYNSYM (isl_map_insert_dims); \
++ DYNSYM (isl_map_intersect); \
++ DYNSYM (isl_map_intersect_domain); \
++ DYNSYM (isl_map_intersect_range); \
++ DYNSYM (isl_map_is_empty); \
++ DYNSYM (isl_map_lex_ge); \
++ DYNSYM (isl_map_lex_le); \
++ DYNSYM (isl_map_n_out); \
++ DYNSYM (isl_map_range); \
++ DYNSYM (isl_map_set_tuple_id); \
++ DYNSYM (isl_map_universe); \
++ DYNSYM (isl_options_set_on_error); \
++ DYNSYM (isl_options_set_schedule_serialize_sccs); \
++ DYNSYM (isl_printer_set_yaml_style); \
++ DYNSYM (isl_options_set_schedule_max_constant_term); \
++ DYNSYM (isl_options_set_schedule_maximize_band_depth); \
++ DYNSYM (isl_printer_free); \
++ DYNSYM (isl_printer_print_aff); \
++ DYNSYM (isl_printer_print_constraint); \
++ DYNSYM (isl_printer_print_map); \
++ DYNSYM (isl_printer_print_set); \
++ DYNSYM (isl_printer_to_file); \
++ DYNSYM (isl_pw_aff_add); \
++ DYNSYM (isl_pw_aff_alloc); \
++ DYNSYM (isl_pw_aff_copy); \
++ DYNSYM (isl_pw_aff_eq_set); \
++ DYNSYM (isl_pw_aff_free); \
++ DYNSYM (isl_pw_aff_from_aff); \
++ DYNSYM (isl_pw_aff_ge_set); \
++ DYNSYM (isl_pw_aff_gt_set); \
++ DYNSYM (isl_pw_aff_is_cst); \
++ DYNSYM (isl_pw_aff_le_set); \
++ DYNSYM (isl_pw_aff_lt_set); \
++ DYNSYM (isl_pw_aff_mul); \
++ DYNSYM (isl_pw_aff_ne_set); \
++ DYNSYM (isl_pw_aff_nonneg_set); \
++ DYNSYM (isl_pw_aff_set_tuple_id); \
++ DYNSYM (isl_pw_aff_sub); \
++ DYNSYM (isl_pw_aff_zero_set); \
++ DYNSYM (isl_schedule_free); \
++ DYNSYM (isl_schedule_get_band_forest); \
++ DYNSYM (isl_set_add_constraint); \
++ DYNSYM (isl_set_add_dims); \
++ DYNSYM (isl_set_apply); \
++ DYNSYM (isl_set_coalesce); \
++ DYNSYM (isl_set_copy); \
++ DYNSYM (isl_set_dim); \
++ DYNSYM (isl_set_fix_si); \
++ DYNSYM (isl_set_free); \
++ DYNSYM (isl_set_get_space); \
++ DYNSYM (isl_set_get_tuple_id); \
++ DYNSYM (isl_set_intersect); \
++ DYNSYM (isl_set_is_empty); \
++ DYNSYM (isl_set_n_dim); \
++ DYNSYM (isl_set_nat_universe); \
++ DYNSYM (isl_set_project_out); \
++ DYNSYM (isl_set_set_tuple_id); \
++ DYNSYM (isl_set_universe); \
++ DYNSYM (isl_space_add_dims); \
++ DYNSYM (isl_space_alloc); \
++ DYNSYM (isl_space_copy); \
++ DYNSYM (isl_space_dim); \
++ DYNSYM (isl_space_domain); \
++ DYNSYM (isl_space_find_dim_by_id); \
++ DYNSYM (isl_space_free); \
++ DYNSYM (isl_space_from_domain); \
++ DYNSYM (isl_space_get_tuple_id); \
++ DYNSYM (isl_space_params_alloc); \
++ DYNSYM (isl_space_range); \
++ DYNSYM (isl_space_set_alloc); \
++ DYNSYM (isl_space_set_dim_id); \
++ DYNSYM (isl_space_set_tuple_id); \
++ DYNSYM (isl_union_map_add_map); \
++ DYNSYM (isl_union_map_align_params); \
++ DYNSYM (isl_union_map_apply_domain); \
++ DYNSYM (isl_union_map_apply_range); \
++ DYNSYM (isl_union_map_compute_flow); \
++ DYNSYM (isl_union_map_copy); \
++ DYNSYM (isl_union_map_empty); \
++ DYNSYM (isl_union_map_flat_range_product); \
++ DYNSYM (isl_union_map_foreach_map); \
++ DYNSYM (isl_union_map_free); \
++ DYNSYM (isl_union_map_from_map); \
++ DYNSYM (isl_union_map_get_ctx); \
++ DYNSYM (isl_union_map_get_space); \
++ DYNSYM (isl_union_map_gist_domain); \
++ DYNSYM (isl_union_map_gist_range); \
++ DYNSYM (isl_union_map_intersect_domain); \
++ DYNSYM (isl_union_map_is_empty); \
++ DYNSYM (isl_union_map_subtract); \
++ DYNSYM (isl_union_map_union); \
++ DYNSYM (isl_union_set_add_set); \
++ DYNSYM (isl_union_set_compute_schedule); \
++ DYNSYM (isl_union_set_copy); \
++ DYNSYM (isl_union_set_empty); \
++ DYNSYM (isl_union_set_from_set); \
++ DYNSYM (isl_aff_add_constant_val); \
++ DYNSYM (isl_aff_get_coefficient_val); \
++ DYNSYM (isl_aff_get_ctx); \
++ DYNSYM (isl_aff_mod_val); \
++ DYNSYM (isl_ast_build_ast_from_schedule); \
++ DYNSYM (isl_ast_build_free); \
++ DYNSYM (isl_ast_build_from_context); \
++ DYNSYM (isl_ast_build_get_ctx); \
++ DYNSYM (isl_ast_build_get_schedule); \
++ DYNSYM (isl_ast_build_get_schedule_space); \
++ DYNSYM (isl_ast_build_set_before_each_for); \
++ DYNSYM (isl_ast_build_set_options); \
++ DYNSYM (isl_ast_expr_free); \
++ DYNSYM (isl_ast_expr_from_val); \
++ DYNSYM (isl_ast_expr_get_ctx); \
++ DYNSYM (isl_ast_expr_get_id); \
++ DYNSYM (isl_ast_expr_get_op_arg); \
++ DYNSYM (isl_ast_expr_get_op_n_arg); \
++ DYNSYM (isl_ast_expr_get_op_type); \
++ DYNSYM (isl_ast_expr_get_type); \
++ DYNSYM (isl_ast_expr_get_val); \
++ DYNSYM (isl_ast_expr_sub); \
++ DYNSYM (isl_ast_node_block_get_children); \
++ DYNSYM (isl_ast_node_for_get_body); \
++ DYNSYM (isl_ast_node_for_get_cond); \
++ DYNSYM (isl_ast_node_for_get_inc); \
++ DYNSYM (isl_ast_node_for_get_init); \
++ DYNSYM (isl_ast_node_for_get_iterator); \
++ DYNSYM (isl_ast_node_free); \
++ DYNSYM (isl_ast_node_get_annotation); \
++ DYNSYM (isl_ast_node_get_type); \
++ DYNSYM (isl_ast_node_if_get_cond); \
++ DYNSYM (isl_ast_node_if_get_else); \
++ DYNSYM (isl_ast_node_if_get_then); \
++ DYNSYM (isl_ast_node_list_free); \
++ DYNSYM (isl_ast_node_list_get_ast_node); \
++ DYNSYM (isl_ast_node_list_n_ast_node); \
++ DYNSYM (isl_ast_node_user_get_expr); \
++ DYNSYM (isl_constraint_set_coefficient_val); \
++ DYNSYM (isl_constraint_set_constant_val); \
++ DYNSYM (isl_id_get_user); \
++ DYNSYM (isl_local_space_get_ctx); \
++ DYNSYM (isl_map_fix_val); \
++ DYNSYM (isl_options_set_ast_build_atomic_upper_bound); \
++ DYNSYM (isl_printer_print_ast_node); \
++ DYNSYM (isl_printer_print_str); \
++ DYNSYM (isl_printer_set_output_format); \
++ DYNSYM (isl_pw_aff_mod_val); \
++ DYNSYM (isl_schedule_constraints_compute_schedule); \
++ DYNSYM (isl_schedule_constraints_on_domain); \
++ DYNSYM (isl_schedule_constraints_set_coincidence); \
++ DYNSYM (isl_schedule_constraints_set_proximity); \
++ DYNSYM (isl_schedule_constraints_set_validity); \
++ DYNSYM (isl_set_get_dim_id); \
++ DYNSYM (isl_set_max_val); \
++ DYNSYM (isl_set_min_val); \
++ DYNSYM (isl_set_params); \
++ DYNSYM (isl_space_align_params); \
++ DYNSYM (isl_space_map_from_domain_and_range); \
++ DYNSYM (isl_space_set_tuple_name); \
++ DYNSYM (isl_space_wrap); \
++ DYNSYM (isl_union_map_from_domain_and_range); \
++ DYNSYM (isl_union_map_range); \
++ DYNSYM (isl_union_set_union); \
++ DYNSYM (isl_union_set_universe); \
++ DYNSYM (isl_val_2exp); \
++ DYNSYM (isl_val_add_ui); \
++ DYNSYM (isl_val_copy); \
++ DYNSYM (isl_val_free); \
++ DYNSYM (isl_val_int_from_si); \
++ DYNSYM (isl_val_int_from_ui); \
++ DYNSYM (isl_val_mul); \
++ DYNSYM (isl_val_neg); \
++ DYNSYM (isl_val_sub); \
++ DYNSYM (isl_printer_print_union_map); \
++ DYNSYM (isl_pw_aff_get_ctx); \
++ DYNSYM (isl_val_is_int); \
++ DYNSYM (isl_ctx_get_max_operations); \
++ DYNSYM (isl_ctx_set_max_operations); \
++ DYNSYM (isl_ctx_last_error); \
++ DYNSYM (isl_ctx_reset_operations); \
++ DYNSYM (isl_map_coalesce); \
++ DYNSYM (isl_printer_print_schedule); \
++ DYNSYM (isl_set_set_dim_id); \
++ DYNSYM (isl_union_map_coalesce); \
++ DYNSYM (isl_multi_val_set_val); \
++ DYNSYM (isl_multi_val_zero); \
++ DYNSYM (isl_options_set_schedule_max_coefficient); \
++ DYNSYM (isl_options_set_tile_scale_tile_loops); \
++ DYNSYM (isl_schedule_copy); \
++ DYNSYM (isl_schedule_get_map); \
++ DYNSYM (isl_schedule_map_schedule_node_bottom_up); \
++ DYNSYM (isl_schedule_node_band_get_permutable); \
++ DYNSYM (isl_schedule_node_band_get_space); \
++ DYNSYM (isl_schedule_node_band_tile); \
++ DYNSYM (isl_schedule_node_child); \
++ DYNSYM (isl_schedule_node_free); \
++ DYNSYM (isl_schedule_node_get_child); \
++ DYNSYM (isl_schedule_node_get_ctx); \
++ DYNSYM (isl_schedule_node_get_type); \
++ DYNSYM (isl_schedule_node_n_children); \
++ DYNSYM (isl_union_map_is_equal); \
++ DYNSYM (isl_union_access_info_compute_flow); \
++ DYNSYM (isl_union_access_info_from_sink); \
++ DYNSYM (isl_union_access_info_set_may_source); \
++ DYNSYM (isl_union_access_info_set_must_source); \
++ DYNSYM (isl_union_access_info_set_schedule); \
++ DYNSYM (isl_union_flow_free); \
++ DYNSYM (isl_union_flow_get_may_dependence); \
++ DYNSYM (isl_union_flow_get_must_dependence); \
++ DYNSYM (isl_aff_var_on_domain); \
++ DYNSYM (isl_multi_aff_from_aff); \
++ DYNSYM (isl_schedule_get_ctx); \
++ DYNSYM (isl_multi_aff_set_tuple_id); \
++ DYNSYM (isl_multi_aff_dim); \
++ DYNSYM (isl_schedule_get_domain); \
++ DYNSYM (isl_union_set_is_empty); \
++ DYNSYM (isl_union_set_get_space); \
++ DYNSYM (isl_union_pw_multi_aff_empty); \
++ DYNSYM (isl_union_set_foreach_set); \
++ DYNSYM (isl_union_set_free); \
++ DYNSYM (isl_multi_union_pw_aff_from_union_pw_multi_aff); \
++ DYNSYM (isl_multi_union_pw_aff_apply_multi_aff); \
++ DYNSYM (isl_schedule_insert_partial_schedule); \
++ DYNSYM (isl_union_pw_multi_aff_free); \
++ DYNSYM (isl_pw_multi_aff_project_out_map); \
++ DYNSYM (isl_union_pw_multi_aff_add_pw_multi_aff); \
++ DYNSYM (isl_schedule_from_domain); \
++ DYNSYM (isl_schedule_sequence); \
++ DYNSYM (isl_ast_build_node_from_schedule); \
++ DYNSYM (isl_ast_node_mark_get_node); \
++ DYNSYM (isl_schedule_node_band_member_get_ast_loop_type); \
++ DYNSYM (isl_schedule_node_band_member_set_ast_loop_type); \
++ DYNSYM (isl_val_n_abs_num_chunks); \
++ DYNSYM (isl_val_get_abs_num_chunks); \
++ DYNSYM (isl_val_int_from_chunks); \
++ DYNSYM (isl_val_is_neg); \
++ DYNSYM (isl_version); \
++ DYNSYM (isl_options_get_on_error); \
++ DYNSYM (isl_ctx_reset_error);
++
++extern struct isl_pointers_s__
++{
++ bool inited;
++ void *h;
++#define DYNSYM(x) __typeof (x) *p_##x
++ DYNSYMS
++#undef DYNSYM
++} isl_pointers__;
++
++#define isl_aff_add_coefficient_si (*isl_pointers__.p_isl_aff_add_coefficient_si)
++#define isl_aff_free (*isl_pointers__.p_isl_aff_free)
++#define isl_aff_get_space (*isl_pointers__.p_isl_aff_get_space)
++#define isl_aff_set_coefficient_si (*isl_pointers__.p_isl_aff_set_coefficient_si)
++#define isl_aff_set_constant_si (*isl_pointers__.p_isl_aff_set_constant_si)
++#define isl_aff_zero_on_domain (*isl_pointers__.p_isl_aff_zero_on_domain)
++#define isl_band_free (*isl_pointers__.p_isl_band_free)
++#define isl_band_get_children (*isl_pointers__.p_isl_band_get_children)
++#define isl_band_get_partial_schedule (*isl_pointers__.p_isl_band_get_partial_schedule)
++#define isl_band_has_children (*isl_pointers__.p_isl_band_has_children)
++#define isl_band_list_free (*isl_pointers__.p_isl_band_list_free)
++#define isl_band_list_get_band (*isl_pointers__.p_isl_band_list_get_band)
++#define isl_band_list_get_ctx (*isl_pointers__.p_isl_band_list_get_ctx)
++#define isl_band_list_n_band (*isl_pointers__.p_isl_band_list_n_band)
++#define isl_band_n_member (*isl_pointers__.p_isl_band_n_member)
++#define isl_basic_map_add_constraint (*isl_pointers__.p_isl_basic_map_add_constraint)
++#define isl_basic_map_project_out (*isl_pointers__.p_isl_basic_map_project_out)
++#define isl_basic_map_universe (*isl_pointers__.p_isl_basic_map_universe)
++#define isl_constraint_set_coefficient_si (*isl_pointers__.p_isl_constraint_set_coefficient_si)
++#define isl_constraint_set_constant_si (*isl_pointers__.p_isl_constraint_set_constant_si)
++#define isl_ctx_alloc (*isl_pointers__.p_isl_ctx_alloc)
++#define isl_ctx_free (*isl_pointers__.p_isl_ctx_free)
++#define isl_equality_alloc (*isl_pointers__.p_isl_equality_alloc)
++#define isl_id_alloc (*isl_pointers__.p_isl_id_alloc)
++#define isl_id_copy (*isl_pointers__.p_isl_id_copy)
++#define isl_id_free (*isl_pointers__.p_isl_id_free)
++#define isl_inequality_alloc (*isl_pointers__.p_isl_inequality_alloc)
++#define isl_local_space_copy (*isl_pointers__.p_isl_local_space_copy)
++#define isl_local_space_free (*isl_pointers__.p_isl_local_space_free)
++#define isl_local_space_from_space (*isl_pointers__.p_isl_local_space_from_space)
++#define isl_local_space_range (*isl_pointers__.p_isl_local_space_range)
++#define isl_map_add_constraint (*isl_pointers__.p_isl_map_add_constraint)
++#define isl_map_add_dims (*isl_pointers__.p_isl_map_add_dims)
++#define isl_map_align_params (*isl_pointers__.p_isl_map_align_params)
++#define isl_map_apply_range (*isl_pointers__.p_isl_map_apply_range)
++#define isl_map_copy (*isl_pointers__.p_isl_map_copy)
++#define isl_map_dim (*isl_pointers__.p_isl_map_dim)
++#define isl_map_dump (*isl_pointers__.p_isl_map_dump)
++#define isl_map_equate (*isl_pointers__.p_isl_map_equate)
++#define isl_map_fix_si (*isl_pointers__.p_isl_map_fix_si)
++#define isl_map_flat_product (*isl_pointers__.p_isl_map_flat_product)
++#define isl_map_flat_range_product (*isl_pointers__.p_isl_map_flat_range_product)
++#define isl_map_free (*isl_pointers__.p_isl_map_free)
++#define isl_map_from_basic_map (*isl_pointers__.p_isl_map_from_basic_map)
++#define isl_map_from_pw_aff (*isl_pointers__.p_isl_map_from_pw_aff)
++#define isl_map_from_union_map (*isl_pointers__.p_isl_map_from_union_map)
++#define isl_map_get_ctx (*isl_pointers__.p_isl_map_get_ctx)
++#define isl_map_get_space (*isl_pointers__.p_isl_map_get_space)
++#define isl_map_get_tuple_id (*isl_pointers__.p_isl_map_get_tuple_id)
++#define isl_map_insert_dims (*isl_pointers__.p_isl_map_insert_dims)
++#define isl_map_intersect (*isl_pointers__.p_isl_map_intersect)
++#define isl_map_intersect_domain (*isl_pointers__.p_isl_map_intersect_domain)
++#define isl_map_intersect_range (*isl_pointers__.p_isl_map_intersect_range)
++#define isl_map_is_empty (*isl_pointers__.p_isl_map_is_empty)
++#define isl_map_lex_ge (*isl_pointers__.p_isl_map_lex_ge)
++#define isl_map_lex_le (*isl_pointers__.p_isl_map_lex_le)
++#define isl_map_n_out (*isl_pointers__.p_isl_map_n_out)
++#define isl_map_range (*isl_pointers__.p_isl_map_range)
++#define isl_map_set_tuple_id (*isl_pointers__.p_isl_map_set_tuple_id)
++#define isl_map_universe (*isl_pointers__.p_isl_map_universe)
++#define isl_options_set_on_error (*isl_pointers__.p_isl_options_set_on_error)
++#define isl_options_set_schedule_serialize_sccs (*isl_pointers__.p_isl_options_set_schedule_serialize_sccs)
++#define isl_printer_set_yaml_style (*isl_pointers__.p_isl_printer_set_yaml_style)
++#define isl_options_set_schedule_max_constant_term (*isl_pointers__.p_isl_options_set_schedule_max_constant_term)
++#define isl_options_set_schedule_maximize_band_depth (*isl_pointers__.p_isl_options_set_schedule_maximize_band_depth)
++#define isl_printer_free (*isl_pointers__.p_isl_printer_free)
++#define isl_printer_print_aff (*isl_pointers__.p_isl_printer_print_aff)
++#define isl_printer_print_constraint (*isl_pointers__.p_isl_printer_print_constraint)
++#define isl_printer_print_map (*isl_pointers__.p_isl_printer_print_map)
++#define isl_printer_print_set (*isl_pointers__.p_isl_printer_print_set)
++#define isl_printer_to_file (*isl_pointers__.p_isl_printer_to_file)
++#define isl_pw_aff_add (*isl_pointers__.p_isl_pw_aff_add)
++#define isl_pw_aff_alloc (*isl_pointers__.p_isl_pw_aff_alloc)
++#define isl_pw_aff_copy (*isl_pointers__.p_isl_pw_aff_copy)
++#define isl_pw_aff_eq_set (*isl_pointers__.p_isl_pw_aff_eq_set)
++#define isl_pw_aff_free (*isl_pointers__.p_isl_pw_aff_free)
++#define isl_pw_aff_from_aff (*isl_pointers__.p_isl_pw_aff_from_aff)
++#define isl_pw_aff_ge_set (*isl_pointers__.p_isl_pw_aff_ge_set)
++#define isl_pw_aff_gt_set (*isl_pointers__.p_isl_pw_aff_gt_set)
++#define isl_pw_aff_is_cst (*isl_pointers__.p_isl_pw_aff_is_cst)
++#define isl_pw_aff_le_set (*isl_pointers__.p_isl_pw_aff_le_set)
++#define isl_pw_aff_lt_set (*isl_pointers__.p_isl_pw_aff_lt_set)
++#define isl_pw_aff_mul (*isl_pointers__.p_isl_pw_aff_mul)
++#define isl_pw_aff_ne_set (*isl_pointers__.p_isl_pw_aff_ne_set)
++#define isl_pw_aff_nonneg_set (*isl_pointers__.p_isl_pw_aff_nonneg_set)
++#define isl_pw_aff_set_tuple_id (*isl_pointers__.p_isl_pw_aff_set_tuple_id)
++#define isl_pw_aff_sub (*isl_pointers__.p_isl_pw_aff_sub)
++#define isl_pw_aff_zero_set (*isl_pointers__.p_isl_pw_aff_zero_set)
++#define isl_schedule_free (*isl_pointers__.p_isl_schedule_free)
++#define isl_schedule_get_band_forest (*isl_pointers__.p_isl_schedule_get_band_forest)
++#define isl_set_add_constraint (*isl_pointers__.p_isl_set_add_constraint)
++#define isl_set_add_dims (*isl_pointers__.p_isl_set_add_dims)
++#define isl_set_apply (*isl_pointers__.p_isl_set_apply)
++#define isl_set_coalesce (*isl_pointers__.p_isl_set_coalesce)
++#define isl_set_copy (*isl_pointers__.p_isl_set_copy)
++#define isl_set_dim (*isl_pointers__.p_isl_set_dim)
++#define isl_set_fix_si (*isl_pointers__.p_isl_set_fix_si)
++#define isl_set_free (*isl_pointers__.p_isl_set_free)
++#define isl_set_get_space (*isl_pointers__.p_isl_set_get_space)
++#define isl_set_get_tuple_id (*isl_pointers__.p_isl_set_get_tuple_id)
++#define isl_set_intersect (*isl_pointers__.p_isl_set_intersect)
++#define isl_set_is_empty (*isl_pointers__.p_isl_set_is_empty)
++#define isl_set_n_dim (*isl_pointers__.p_isl_set_n_dim)
++#define isl_set_nat_universe (*isl_pointers__.p_isl_set_nat_universe)
++#define isl_set_project_out (*isl_pointers__.p_isl_set_project_out)
++#define isl_set_set_tuple_id (*isl_pointers__.p_isl_set_set_tuple_id)
++#define isl_set_universe (*isl_pointers__.p_isl_set_universe)
++#define isl_space_add_dims (*isl_pointers__.p_isl_space_add_dims)
++#define isl_space_alloc (*isl_pointers__.p_isl_space_alloc)
++#define isl_space_copy (*isl_pointers__.p_isl_space_copy)
++#define isl_space_dim (*isl_pointers__.p_isl_space_dim)
++#define isl_space_domain (*isl_pointers__.p_isl_space_domain)
++#define isl_space_find_dim_by_id (*isl_pointers__.p_isl_space_find_dim_by_id)
++#define isl_space_free (*isl_pointers__.p_isl_space_free)
++#define isl_space_from_domain (*isl_pointers__.p_isl_space_from_domain)
++#define isl_space_get_tuple_id (*isl_pointers__.p_isl_space_get_tuple_id)
++#define isl_space_params_alloc (*isl_pointers__.p_isl_space_params_alloc)
++#define isl_space_range (*isl_pointers__.p_isl_space_range)
++#define isl_space_set_alloc (*isl_pointers__.p_isl_space_set_alloc)
++#define isl_space_set_dim_id (*isl_pointers__.p_isl_space_set_dim_id)
++#define isl_space_set_tuple_id (*isl_pointers__.p_isl_space_set_tuple_id)
++#define isl_union_map_add_map (*isl_pointers__.p_isl_union_map_add_map)
++#define isl_union_map_align_params (*isl_pointers__.p_isl_union_map_align_params)
++#define isl_union_map_apply_domain (*isl_pointers__.p_isl_union_map_apply_domain)
++#define isl_union_map_apply_range (*isl_pointers__.p_isl_union_map_apply_range)
++#define isl_union_map_compute_flow (*isl_pointers__.p_isl_union_map_compute_flow)
++#define isl_union_map_copy (*isl_pointers__.p_isl_union_map_copy)
++#define isl_union_map_empty (*isl_pointers__.p_isl_union_map_empty)
++#define isl_union_map_flat_range_product (*isl_pointers__.p_isl_union_map_flat_range_product)
++#define isl_union_map_foreach_map (*isl_pointers__.p_isl_union_map_foreach_map)
++#define isl_union_map_free (*isl_pointers__.p_isl_union_map_free)
++#define isl_union_map_from_map (*isl_pointers__.p_isl_union_map_from_map)
++#define isl_union_map_get_ctx (*isl_pointers__.p_isl_union_map_get_ctx)
++#define isl_union_map_get_space (*isl_pointers__.p_isl_union_map_get_space)
++#define isl_union_map_gist_domain (*isl_pointers__.p_isl_union_map_gist_domain)
++#define isl_union_map_gist_range (*isl_pointers__.p_isl_union_map_gist_range)
++#define isl_union_map_intersect_domain (*isl_pointers__.p_isl_union_map_intersect_domain)
++#define isl_union_map_is_empty (*isl_pointers__.p_isl_union_map_is_empty)
++#define isl_union_map_subtract (*isl_pointers__.p_isl_union_map_subtract)
++#define isl_union_map_union (*isl_pointers__.p_isl_union_map_union)
++#define isl_union_set_add_set (*isl_pointers__.p_isl_union_set_add_set)
++#define isl_union_set_compute_schedule (*isl_pointers__.p_isl_union_set_compute_schedule)
++#define isl_union_set_copy (*isl_pointers__.p_isl_union_set_copy)
++#define isl_union_set_empty (*isl_pointers__.p_isl_union_set_empty)
++#define isl_union_set_from_set (*isl_pointers__.p_isl_union_set_from_set)
++#define isl_aff_add_constant_val (*isl_pointers__.p_isl_aff_add_constant_val)
++#define isl_aff_get_coefficient_val (*isl_pointers__.p_isl_aff_get_coefficient_val)
++#define isl_aff_get_ctx (*isl_pointers__.p_isl_aff_get_ctx)
++#define isl_aff_mod_val (*isl_pointers__.p_isl_aff_mod_val)
++#define isl_ast_build_ast_from_schedule (*isl_pointers__.p_isl_ast_build_ast_from_schedule)
++#define isl_ast_build_free (*isl_pointers__.p_isl_ast_build_free)
++#define isl_ast_build_from_context (*isl_pointers__.p_isl_ast_build_from_context)
++#define isl_ast_build_get_ctx (*isl_pointers__.p_isl_ast_build_get_ctx)
++#define isl_ast_build_get_schedule (*isl_pointers__.p_isl_ast_build_get_schedule)
++#define isl_ast_build_get_schedule_space (*isl_pointers__.p_isl_ast_build_get_schedule_space)
++#define isl_ast_build_set_before_each_for (*isl_pointers__.p_isl_ast_build_set_before_each_for)
++#define isl_ast_build_set_options (*isl_pointers__.p_isl_ast_build_set_options)
++#define isl_ast_expr_free (*isl_pointers__.p_isl_ast_expr_free)
++#define isl_ast_expr_from_val (*isl_pointers__.p_isl_ast_expr_from_val)
++#define isl_ast_expr_get_ctx (*isl_pointers__.p_isl_ast_expr_get_ctx)
++#define isl_ast_expr_get_id (*isl_pointers__.p_isl_ast_expr_get_id)
++#define isl_ast_expr_get_op_arg (*isl_pointers__.p_isl_ast_expr_get_op_arg)
++#define isl_ast_expr_get_op_n_arg (*isl_pointers__.p_isl_ast_expr_get_op_n_arg)
++#define isl_ast_expr_get_op_type (*isl_pointers__.p_isl_ast_expr_get_op_type)
++#define isl_ast_expr_get_type (*isl_pointers__.p_isl_ast_expr_get_type)
++#define isl_ast_expr_get_val (*isl_pointers__.p_isl_ast_expr_get_val)
++#define isl_ast_expr_sub (*isl_pointers__.p_isl_ast_expr_sub)
++#define isl_ast_node_block_get_children (*isl_pointers__.p_isl_ast_node_block_get_children)
++#define isl_ast_node_for_get_body (*isl_pointers__.p_isl_ast_node_for_get_body)
++#define isl_ast_node_for_get_cond (*isl_pointers__.p_isl_ast_node_for_get_cond)
++#define isl_ast_node_for_get_inc (*isl_pointers__.p_isl_ast_node_for_get_inc)
++#define isl_ast_node_for_get_init (*isl_pointers__.p_isl_ast_node_for_get_init)
++#define isl_ast_node_for_get_iterator (*isl_pointers__.p_isl_ast_node_for_get_iterator)
++#define isl_ast_node_free (*isl_pointers__.p_isl_ast_node_free)
++#define isl_ast_node_get_annotation (*isl_pointers__.p_isl_ast_node_get_annotation)
++#define isl_ast_node_get_type (*isl_pointers__.p_isl_ast_node_get_type)
++#define isl_ast_node_if_get_cond (*isl_pointers__.p_isl_ast_node_if_get_cond)
++#define isl_ast_node_if_get_else (*isl_pointers__.p_isl_ast_node_if_get_else)
++#define isl_ast_node_if_get_then (*isl_pointers__.p_isl_ast_node_if_get_then)
++#define isl_ast_node_list_free (*isl_pointers__.p_isl_ast_node_list_free)
++#define isl_ast_node_list_get_ast_node (*isl_pointers__.p_isl_ast_node_list_get_ast_node)
++#define isl_ast_node_list_n_ast_node (*isl_pointers__.p_isl_ast_node_list_n_ast_node)
++#define isl_ast_node_user_get_expr (*isl_pointers__.p_isl_ast_node_user_get_expr)
++#define isl_constraint_set_coefficient_val (*isl_pointers__.p_isl_constraint_set_coefficient_val)
++#define isl_constraint_set_constant_val (*isl_pointers__.p_isl_constraint_set_constant_val)
++#define isl_id_get_user (*isl_pointers__.p_isl_id_get_user)
++#define isl_local_space_get_ctx (*isl_pointers__.p_isl_local_space_get_ctx)
++#define isl_map_fix_val (*isl_pointers__.p_isl_map_fix_val)
++#define isl_options_set_ast_build_atomic_upper_bound (*isl_pointers__.p_isl_options_set_ast_build_atomic_upper_bound)
++#define isl_printer_print_ast_node (*isl_pointers__.p_isl_printer_print_ast_node)
++#define isl_printer_print_str (*isl_pointers__.p_isl_printer_print_str)
++#define isl_printer_set_output_format (*isl_pointers__.p_isl_printer_set_output_format)
++#define isl_pw_aff_mod_val (*isl_pointers__.p_isl_pw_aff_mod_val)
++#define isl_schedule_constraints_compute_schedule (*isl_pointers__.p_isl_schedule_constraints_compute_schedule)
++#define isl_schedule_constraints_on_domain (*isl_pointers__.p_isl_schedule_constraints_on_domain)
++#define isl_schedule_constraints_set_coincidence (*isl_pointers__.p_isl_schedule_constraints_set_coincidence)
++#define isl_schedule_constraints_set_proximity (*isl_pointers__.p_isl_schedule_constraints_set_proximity)
++#define isl_schedule_constraints_set_validity (*isl_pointers__.p_isl_schedule_constraints_set_validity)
++#define isl_set_get_dim_id (*isl_pointers__.p_isl_set_get_dim_id)
++#define isl_set_max_val (*isl_pointers__.p_isl_set_max_val)
++#define isl_set_min_val (*isl_pointers__.p_isl_set_min_val)
++#define isl_set_params (*isl_pointers__.p_isl_set_params)
++#define isl_space_align_params (*isl_pointers__.p_isl_space_align_params)
++#define isl_space_map_from_domain_and_range (*isl_pointers__.p_isl_space_map_from_domain_and_range)
++#define isl_space_set_tuple_name (*isl_pointers__.p_isl_space_set_tuple_name)
++#define isl_space_wrap (*isl_pointers__.p_isl_space_wrap)
++#define isl_union_map_from_domain_and_range (*isl_pointers__.p_isl_union_map_from_domain_and_range)
++#define isl_union_map_range (*isl_pointers__.p_isl_union_map_range)
++#define isl_union_set_union (*isl_pointers__.p_isl_union_set_union)
++#define isl_union_set_universe (*isl_pointers__.p_isl_union_set_universe)
++#define isl_val_2exp (*isl_pointers__.p_isl_val_2exp)
++#define isl_val_add_ui (*isl_pointers__.p_isl_val_add_ui)
++#define isl_val_copy (*isl_pointers__.p_isl_val_copy)
++#define isl_val_free (*isl_pointers__.p_isl_val_free)
++#define isl_val_int_from_si (*isl_pointers__.p_isl_val_int_from_si)
++#define isl_val_int_from_ui (*isl_pointers__.p_isl_val_int_from_ui)
++#define isl_val_mul (*isl_pointers__.p_isl_val_mul)
++#define isl_val_neg (*isl_pointers__.p_isl_val_neg)
++#define isl_val_sub (*isl_pointers__.p_isl_val_sub)
++#define isl_printer_print_union_map (*isl_pointers__.p_isl_printer_print_union_map)
++#define isl_pw_aff_get_ctx (*isl_pointers__.p_isl_pw_aff_get_ctx)
++#define isl_val_is_int (*isl_pointers__.p_isl_val_is_int)
++#define isl_ctx_get_max_operations (*isl_pointers__.p_isl_ctx_get_max_operations)
++#define isl_ctx_set_max_operations (*isl_pointers__.p_isl_ctx_set_max_operations)
++#define isl_ctx_last_error (*isl_pointers__.p_isl_ctx_last_error)
++#define isl_ctx_reset_operations (*isl_pointers__.p_isl_ctx_reset_operations)
++#define isl_map_coalesce (*isl_pointers__.p_isl_map_coalesce)
++#define isl_printer_print_schedule (*isl_pointers__.p_isl_printer_print_schedule)
++#define isl_set_set_dim_id (*isl_pointers__.p_isl_set_set_dim_id)
++#define isl_union_map_coalesce (*isl_pointers__.p_isl_union_map_coalesce)
++#define isl_multi_val_set_val (*isl_pointers__.p_isl_multi_val_set_val)
++#define isl_multi_val_zero (*isl_pointers__.p_isl_multi_val_zero)
++#define isl_options_set_schedule_max_coefficient (*isl_pointers__.p_isl_options_set_schedule_max_coefficient)
++#define isl_options_set_tile_scale_tile_loops (*isl_pointers__.p_isl_options_set_tile_scale_tile_loops)
++#define isl_schedule_copy (*isl_pointers__.p_isl_schedule_copy)
++#define isl_schedule_get_map (*isl_pointers__.p_isl_schedule_get_map)
++#define isl_schedule_map_schedule_node_bottom_up (*isl_pointers__.p_isl_schedule_map_schedule_node_bottom_up)
++#define isl_schedule_node_band_get_permutable (*isl_pointers__.p_isl_schedule_node_band_get_permutable)
++#define isl_schedule_node_band_get_space (*isl_pointers__.p_isl_schedule_node_band_get_space)
++#define isl_schedule_node_band_tile (*isl_pointers__.p_isl_schedule_node_band_tile)
++#define isl_schedule_node_child (*isl_pointers__.p_isl_schedule_node_child)
++#define isl_schedule_node_free (*isl_pointers__.p_isl_schedule_node_free)
++#define isl_schedule_node_get_child (*isl_pointers__.p_isl_schedule_node_get_child)
++#define isl_schedule_node_get_ctx (*isl_pointers__.p_isl_schedule_node_get_ctx)
++#define isl_schedule_node_get_type (*isl_pointers__.p_isl_schedule_node_get_type)
++#define isl_schedule_node_n_children (*isl_pointers__.p_isl_schedule_node_n_children)
++#define isl_union_map_is_equal (*isl_pointers__.p_isl_union_map_is_equal)
++#define isl_union_access_info_compute_flow (*isl_pointers__.p_isl_union_access_info_compute_flow)
++#define isl_union_access_info_from_sink (*isl_pointers__.p_isl_union_access_info_from_sink)
++#define isl_union_access_info_set_may_source (*isl_pointers__.p_isl_union_access_info_set_may_source)
++#define isl_union_access_info_set_must_source (*isl_pointers__.p_isl_union_access_info_set_must_source)
++#define isl_union_access_info_set_schedule (*isl_pointers__.p_isl_union_access_info_set_schedule)
++#define isl_union_flow_free (*isl_pointers__.p_isl_union_flow_free)
++#define isl_union_flow_get_may_dependence (*isl_pointers__.p_isl_union_flow_get_may_dependence)
++#define isl_union_flow_get_must_dependence (*isl_pointers__.p_isl_union_flow_get_must_dependence)
++#define isl_aff_var_on_domain (*isl_pointers__.p_isl_aff_var_on_domain)
++#define isl_multi_aff_from_aff (*isl_pointers__.p_isl_multi_aff_from_aff)
++#define isl_schedule_get_ctx (*isl_pointers__.p_isl_schedule_get_ctx)
++#define isl_multi_aff_set_tuple_id (*isl_pointers__.p_isl_multi_aff_set_tuple_id)
++#define isl_multi_aff_dim (*isl_pointers__.p_isl_multi_aff_dim)
++#define isl_schedule_get_domain (*isl_pointers__.p_isl_schedule_get_domain)
++#define isl_union_set_is_empty (*isl_pointers__.p_isl_union_set_is_empty)
++#define isl_union_set_get_space (*isl_pointers__.p_isl_union_set_get_space)
++#define isl_union_pw_multi_aff_empty (*isl_pointers__.p_isl_union_pw_multi_aff_empty)
++#define isl_union_set_foreach_set (*isl_pointers__.p_isl_union_set_foreach_set)
++#define isl_union_set_free (*isl_pointers__.p_isl_union_set_free)
++#define isl_multi_union_pw_aff_from_union_pw_multi_aff (*isl_pointers__.p_isl_multi_union_pw_aff_from_union_pw_multi_aff)
++#define isl_multi_union_pw_aff_apply_multi_aff (*isl_pointers__.p_isl_multi_union_pw_aff_apply_multi_aff)
++#define isl_schedule_insert_partial_schedule (*isl_pointers__.p_isl_schedule_insert_partial_schedule)
++#define isl_union_pw_multi_aff_free (*isl_pointers__.p_isl_union_pw_multi_aff_free)
++#define isl_pw_multi_aff_project_out_map (*isl_pointers__.p_isl_pw_multi_aff_project_out_map)
++#define isl_union_pw_multi_aff_add_pw_multi_aff (*isl_pointers__.p_isl_union_pw_multi_aff_add_pw_multi_aff)
++#define isl_schedule_from_domain (*isl_pointers__.p_isl_schedule_from_domain)
++#define isl_schedule_sequence (*isl_pointers__.p_isl_schedule_sequence)
++#define isl_ast_build_node_from_schedule (*isl_pointers__.p_isl_ast_build_node_from_schedule)
++#define isl_ast_node_mark_get_node (*isl_pointers__.p_isl_ast_node_mark_get_node)
++#define isl_schedule_node_band_member_get_ast_loop_type (*isl_pointers__.p_isl_schedule_node_band_member_get_ast_loop_type)
++#define isl_schedule_node_band_member_set_ast_loop_type (*isl_pointers__.p_isl_schedule_node_band_member_set_ast_loop_type)
++#define isl_val_n_abs_num_chunks (*isl_pointers__.p_isl_val_n_abs_num_chunks)
++#define isl_val_get_abs_num_chunks (*isl_pointers__.p_isl_val_get_abs_num_chunks)
++#define isl_val_int_from_chunks (*isl_pointers__.p_isl_val_int_from_chunks)
++#define isl_val_is_neg (*isl_pointers__.p_isl_val_is_neg)
++#define isl_version (*isl_pointers__.p_isl_version)
++#define isl_options_get_on_error (*isl_pointers__.p_isl_options_get_on_error)
++#define isl_ctx_reset_error (*isl_pointers__.p_isl_ctx_reset_error)
++
+ typedef struct poly_dr *poly_dr_p;
+
+ typedef struct poly_bb *poly_bb_p;
+@@ -448,5 +1033,6 @@ extern tree cached_scalar_evolution_in_r
+ extern void dot_all_sese (FILE *, vec &);
+ extern void dot_sese (sese_l &);
+ extern void dot_cfg ();
++extern const char *get_isl_version (bool);
+
+ #endif
+--- gcc/graphite.c.jj 2015-11-04 14:15:32.000000000 +0100
++++ gcc/graphite.c 2015-11-04 14:56:02.645536409 +0100
+@@ -60,6 +60,35 @@ along with GCC; see the file COPYING3.
+ #include "tree-into-ssa.h"
+ #include "graphite.h"
+
++__typeof (isl_pointers__) isl_pointers__;
++
++static bool
++init_isl_pointers (void)
++{
++ void *h;
++
++ if (isl_pointers__.inited)
++ return isl_pointers__.h != NULL;
++ h = dlopen ("libisl.so.15", RTLD_LAZY);
++ isl_pointers__.h = h;
++ if (h == NULL)
++ return false;
++#define DYNSYM(x) \
++ do \
++ { \
++ union { __typeof (isl_pointers__.p_##x) p; void *q; } u; \
++ u.q = dlsym (h, #x); \
++ if (u.q == NULL) \
++ return false; \
++ isl_pointers__.p_##x = u.p; \
++ } \
++ while (0)
++ DYNSYMS
++#undef DYNSYM
++ isl_pointers__.inited = true;
++ return true;
++}
++
+ /* Print global statistics to FILE. */
+
+ static void
+@@ -365,6 +394,15 @@ graphite_transform_loops (void)
+ if (parallelized_function_p (cfun->decl))
+ return;
+
++ if (number_of_loops (cfun) <= 1)
++ return;
++
++ if (!init_isl_pointers ())
++ {
++ sorry ("Graphite loop optimizations cannot be used");
++ return;
++ }
++
+ calculate_dominance_info (CDI_DOMINATORS);
+
+ /* We rely on post-dominators during merging of SESE regions so those
+@@ -455,6 +493,14 @@ graphite_transform_loops (void)
+ }
+ }
+
++const char *
++get_isl_version (bool force)
++{
++ if (force)
++ init_isl_pointers ();
++ return (isl_pointers__.inited && isl_version) ? isl_version () : "none";
++}
++
+ #else /* If isl is not available: #ifndef HAVE_isl. */
+
+ static void
+--- gcc/toplev.c.jj 2017-02-19 13:02:31.000000000 +0100
++++ gcc/toplev.c 2017-02-19 16:50:25.536301350 +0100
+@@ -94,6 +94,7 @@ along with GCC; see the file COPYING3.
+
+ #ifdef HAVE_isl
+ #include
++extern const char *get_isl_version (bool);
+ #endif
+
+ static void general_init (const char *, bool);
+@@ -683,7 +684,7 @@ print_version (FILE *file, const char *i
+ #ifndef HAVE_isl
+ "none"
+ #else
+- isl_version ()
++ get_isl_version (*indent == 0)
+ #endif
+ );
+ if (strcmp (GCC_GMP_STRINGIFY_VERSION, gmp_version))
diff --git a/SOURCES/gcc11-isl-dl2.patch b/SOURCES/gcc11-isl-dl2.patch
new file mode 100644
index 0000000..ac14ed3
--- /dev/null
+++ b/SOURCES/gcc11-isl-dl2.patch
@@ -0,0 +1,71 @@
+2011-04-04 Jakub Jelinek
+
+ * toplev.c (toplev_main_argv): New variable.
+ (toplev_main): Initialize it.
+ * graphite.c (init_isl_pointers): Load libisl.so.15 from gcc's private
+ directory.
+
+--- gcc/toplev.c.jj 2008-12-09 23:59:10.000000000 +0100
++++ gcc/toplev.c 2009-01-27 14:33:52.000000000 +0100
+@@ -117,6 +117,8 @@ static void compile_file (void);
+ /* True if we don't need a backend (e.g. preprocessing only). */
+ static bool no_backend;
+
++const char **toplev_main_argv;
++
+ /* Decoded options, and number of such options. */
+ struct cl_decoded_option *save_decoded_options;
+ unsigned int save_decoded_options_count;
+@@ -2287,6 +2289,8 @@ toplev::main (int argc, char **argv)
+
+ expandargv (&argc, &argv);
+
++ toplev_main_argv = CONST_CAST2 (const char **, char **, argv);
++
+ /* Initialization of GCC's environment, and diagnostics. */
+ general_init (argv[0], m_init_signals);
+
+--- gcc/graphite.c.jj 2010-12-01 10:24:32.000000000 -0500
++++ gcc/graphite.c 2010-12-01 11:46:07.832118193 -0500
+@@ -64,11 +64,39 @@ __typeof (isl_pointers__) isl_pointers__
+ static bool
+ init_isl_pointers (void)
+ {
+- void *h;
++ void *h = NULL;
++ extern const char **toplev_main_argv;
++ char *buf, *p;
++ size_t len;
+
+ if (isl_pointers__.inited)
+ return isl_pointers__.h != NULL;
+- h = dlopen ("libisl.so.15", RTLD_LAZY);
++ len = progname - toplev_main_argv[0];
++ buf = XALLOCAVAR (char, len + sizeof "libisl.so.15");
++ memcpy (buf, toplev_main_argv[0], len);
++ strcpy (buf + len, "libisl.so.15");
++ len += sizeof "libisl.so.15";
++ p = strstr (buf, "/libexec/");
++ if (p != NULL)
++ {
++ while (1)
++ {
++ char *q = strstr (p + 8, "/libexec/");
++ if (q == NULL)
++ break;
++ p = q;
++ }
++ memmove (p + 4, p + 8, len - (p + 8 - buf));
++ h = dlopen (buf, RTLD_LAZY);
++ if (h == NULL)
++ {
++ len = progname - toplev_main_argv[0];
++ memcpy (buf, toplev_main_argv[0], len);
++ strcpy (buf + len, "libisl.so.15");
++ }
++ }
++ if (h == NULL)
++ h = dlopen (buf, RTLD_LAZY);
+ isl_pointers__.h = h;
+ if (h == NULL)
+ return false;
diff --git a/SOURCES/gcc11-libgcc-link.patch b/SOURCES/gcc11-libgcc-link.patch
new file mode 100644
index 0000000..8551934
--- /dev/null
+++ b/SOURCES/gcc11-libgcc-link.patch
@@ -0,0 +1,57 @@
+libgcc: Honor LDFLAGS_FOR_TARGET when linking libgcc_s
+
+When building gcc with some specific LDFLAGS_FOR_TARGET, e.g.
+LDFLAGS_FOR_TARGET=-Wl,-z,relro,-z,now
+those flags propagate info linking of target shared libraries,
+e.g. lib{ubsan,tsan,stdc++,quadmath,objc,lsan,itm,gphobos,gdruntime,gomp,go,gfortran,atomic,asan}.so.*
+but there is one important exception, libgcc_s.so.* linking ignores it.
+
+The following patch fixes that.
+
+Bootstrapped/regtested on x86_64-linux with LDFLAGS_FOR_TARGET=-Wl,-z,relro,-z,now
+and verified that libgcc_s.so.* is BIND_NOW when it previously wasn't, and
+without any LDFLAGS_FOR_TARGET on x86_64-linux and i686-linux.
+There on x86_64-linux I've verified that the libgcc_s.so.1 linking command
+line for -m64 is identical except for whitespace to one without the patch,
+and for -m32 multilib $(LDFLAGS) actually do supply there an extra -m32
+that also repeats later in the @multilib_flags@, which should be harmless.
+
+2021-08-04 Jakub Jelinek
+
+ * config/t-slibgcc (SHLIB_LINK): Add $(LDFLAGS).
+ * config/t-slibgcc-darwin (SHLIB_LINK): Likewise.
+ * config/t-slibgcc-vms (SHLIB_LINK): Likewise.
+
+--- libgcc/config/t-slibgcc
++++ libgcc/config/t-slibgcc
+@@ -32,7 +32,7 @@ SHLIB_INSTALL_SOLINK = $(LN_S) $(SHLIB_SONAME) \
+ $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
+
+ SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
+- $(SHLIB_LDFLAGS) \
++ $(SHLIB_LDFLAGS) $(LDFLAGS) \
+ -o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ \
+ $(SHLIB_OBJS) $(SHLIB_LC) && \
+ rm -f $(SHLIB_DIR)/$(SHLIB_SOLINK) && \
+--- libgcc/config/t-slibgcc-darwin
++++ libgcc/config/t-slibgcc-darwin
+@@ -15,7 +15,7 @@ SHLIB_LC = -lc
+ # Note that this version is used for the loader, not the linker; the linker
+ # uses the stub versions named by the versioned members of $(INSTALL_FILES).
+
+-SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) -dynamiclib -nodefaultlibs \
++SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -dynamiclib -nodefaultlibs \
+ -install_name @shlib_slibdir@/$(SHLIB_INSTALL_NAME) \
+ -single_module -o $(SHLIB_DIR)/$(SHLIB_SONAME) \
+ -Wl,-exported_symbols_list,$(SHLIB_MAP) \
+--- libgcc/config/t-slibgcc-vms
++++ libgcc/config/t-slibgcc-vms
+@@ -22,7 +22,7 @@ SHLIB_LINK = \
+ objdump --syms $(SHLIB_OBJS) | \
+ $(SHLIB_SYMVEC) >> SYMVEC_$$$$.opt ; \
+ echo "case_sensitive=NO" >> SYMVEC_$$$$.opt; \
+- $(CC) $(LIBGCC2_CFLAGS) -nodefaultlibs \
++ $(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -nodefaultlibs \
+ -shared --for-linker=/noinform -o $(SHLIB_NAME) $(SHLIB_OBJS) \
+ --for-linker=SYMVEC_$$$$.opt \
+ --for-linker=gsmatch=equal,$(shlib_version)
diff --git a/SOURCES/gcc11-libgomp-omp_h-multilib.patch b/SOURCES/gcc11-libgomp-omp_h-multilib.patch
new file mode 100644
index 0000000..d0e98d1
--- /dev/null
+++ b/SOURCES/gcc11-libgomp-omp_h-multilib.patch
@@ -0,0 +1,17 @@
+2008-06-09 Jakub Jelinek
+
+ * omp.h.in (omp_nest_lock_t): Fix up for Linux multilibs.
+
+--- libgomp/omp.h.in.jj 2008-06-09 13:34:05.000000000 +0200
++++ libgomp/omp.h.in 2008-06-09 13:34:48.000000000 +0200
+@@ -42,8 +42,8 @@ typedef struct
+
+ typedef struct
+ {
+- unsigned char _x[@OMP_NEST_LOCK_SIZE@]
+- __attribute__((__aligned__(@OMP_NEST_LOCK_ALIGN@)));
++ unsigned char _x[8 + sizeof (void *)]
++ __attribute__((__aligned__(sizeof (void *))));
+ } omp_nest_lock_t;
+ #endif
+
diff --git a/SOURCES/gcc11-libsanitizer-pthread.patch b/SOURCES/gcc11-libsanitizer-pthread.patch
new file mode 100644
index 0000000..fc88d9e
--- /dev/null
+++ b/SOURCES/gcc11-libsanitizer-pthread.patch
@@ -0,0 +1,54 @@
+Backported from LLVM upstream:
+
+commit ef14b78d9a144ba81ba02083fe21eb286a88732b
+Author: Florian Weimer
+Date: Tue Feb 8 12:46:41 2022 -0800
+
+ [sanitizer] Use _thread_db_sizeof_pthread to obtain struct pthread size
+
+ This symbol has been exported (as an internal GLIBC_PRIVATE symbol) from libc.so.6 starting with glibc 2.34. glibc uses it internally for its libthread_db implementation to enable thread debugging on GDB, so it is unlikely to go away for now.
+
+ Fixes #52989.
+
+ Reviewed By: #sanitizers, MaskRay, vitalybuka
+
+ Differential Revision: https://reviews.llvm.org/D119007
+
+--- a/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cpp
++++ b/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cpp
+@@ -265,10 +265,8 @@ void InitTlsSize() { }
+ // sizeof(struct pthread) from glibc.
+ static atomic_uintptr_t thread_descriptor_size;
+
+-uptr ThreadDescriptorSize() {
+- uptr val = atomic_load_relaxed(&thread_descriptor_size);
+- if (val)
+- return val;
++static uptr ThreadDescriptorSizeFallback() {
++ uptr val = 0;
+ #if defined(__x86_64__) || defined(__i386__) || defined(__arm__)
+ int major;
+ int minor;
+@@ -323,8 +321,21 @@ uptr ThreadDescriptorSize() {
+ #elif defined(__s390__)
+ val = FIRST_32_SECOND_64(1152, 1776); // valid for glibc 2.22
+ #endif
++ return val;
++}
++
++uptr ThreadDescriptorSize() {
++ uptr val = atomic_load_relaxed(&thread_descriptor_size);
+ if (val)
+- atomic_store_relaxed(&thread_descriptor_size, val);
++ return val;
++ // _thread_db_sizeof_pthread is a GLIBC_PRIVATE symbol that is exported in
++ // glibc 2.34 and later.
++ if (unsigned *psizeof = static_cast(
++ dlsym(RTLD_DEFAULT, "_thread_db_sizeof_pthread")))
++ val = *psizeof;
++ if (!val)
++ val = ThreadDescriptorSizeFallback();
++ atomic_store_relaxed(&thread_descriptor_size, val);
+ return val;
+ }
+
diff --git a/SOURCES/gcc11-libstdc++-docs.patch b/SOURCES/gcc11-libstdc++-docs.patch
new file mode 100644
index 0000000..4b4f9f8
--- /dev/null
+++ b/SOURCES/gcc11-libstdc++-docs.patch
@@ -0,0 +1,24 @@
+--- libstdc++-v3/doc/html/index.html.jj 2011-01-03 12:53:21.282829010 +0100
++++ libstdc++-v3/doc/html/index.html 2011-01-04 18:06:28.999851145 +0100
+@@ -5,6 +5,8 @@
+ FSF
+
+
++ Release 11.2.1
++
+ Permission is granted to copy, distribute and/or modify this
+ document under the terms of the GNU Free Documentation
+ License, Version 1.2 or any later version published by the
+--- libstdc++-v3/doc/html/api.html.jj 2011-01-03 12:53:21.000000000 +0100
++++ libstdc++-v3/doc/html/api.html 2011-01-04 18:12:01.672757784 +0100
+@@ -20,7 +20,9 @@
+ member functions for the library classes, finding out what is in a
+ particular include file, looking at inheritance diagrams, etc.
+
+- The API documentation, rendered into HTML, can be viewed online
++ The API documentation, rendered into HTML, can be viewed locally
++ for the 11.2.1 release,
++ online
+ for each GCC release
+ and
+
diff --git a/SOURCES/gcc11-libtool-no-rpath.patch b/SOURCES/gcc11-libtool-no-rpath.patch
new file mode 100644
index 0000000..466c661
--- /dev/null
+++ b/SOURCES/gcc11-libtool-no-rpath.patch
@@ -0,0 +1,27 @@
+libtool sucks.
+--- ltmain.sh.jj 2007-12-07 14:53:21.000000000 +0100
++++ ltmain.sh 2008-09-05 21:51:48.000000000 +0200
+@@ -5394,6 +5394,7 @@ EOF
+ rpath="$finalize_rpath"
+ test "$mode" != relink && rpath="$compile_rpath$rpath"
+ for libdir in $rpath; do
++ case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+@@ -6071,6 +6072,7 @@ EOF
+ rpath=
+ hardcode_libdirs=
+ for libdir in $compile_rpath $finalize_rpath; do
++ case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+@@ -6120,6 +6122,7 @@ EOF
+ rpath=
+ hardcode_libdirs=
+ for libdir in $finalize_rpath; do
++ case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
diff --git a/SOURCES/gcc11-no-add-needed.patch b/SOURCES/gcc11-no-add-needed.patch
new file mode 100644
index 0000000..5817299
--- /dev/null
+++ b/SOURCES/gcc11-no-add-needed.patch
@@ -0,0 +1,37 @@
+2010-02-08 Roland McGrath
+
+ * config/gnu-user.h (LINK_EH_SPEC): Pass --no-add-needed to the linker.
+ * config/alpha/elf.h (LINK_EH_SPEC): Likewise.
+ * config/ia64/linux.h (LINK_EH_SPEC): Likewise.
+
+--- gcc/config/alpha/elf.h.jj 2011-01-03 12:52:31.118056764 +0100
++++ gcc/config/alpha/elf.h 2011-01-04 18:14:10.931874160 +0100
+@@ -168,5 +168,5 @@ extern int alpha_this_gpdisp_sequence_nu
+ I imagine that other systems will catch up. In the meantime, it
+ doesn't harm to make sure that the data exists to be used later. */
+ #if defined(HAVE_LD_EH_FRAME_HDR)
+-#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
++#define LINK_EH_SPEC "--no-add-needed %{!static|static-pie:--eh-frame-hdr} "
+ #endif
+--- gcc/config/ia64/linux.h.jj 2011-01-03 13:02:11.462994522 +0100
++++ gcc/config/ia64/linux.h 2011-01-04 18:14:10.931874160 +0100
+@@ -76,7 +76,7 @@ do { \
+ Signalize that because we have fde-glibc, we don't need all C shared libs
+ linked against -lgcc_s. */
+ #undef LINK_EH_SPEC
+-#define LINK_EH_SPEC ""
++#define LINK_EH_SPEC "--no-add-needed "
+
+ #undef TARGET_INIT_LIBFUNCS
+ #define TARGET_INIT_LIBFUNCS ia64_soft_fp_init_libfuncs
+--- gcc/config/gnu-user.h.jj 2011-01-03 12:53:03.739057299 +0100
++++ gcc/config/gnu-user.h 2011-01-04 18:14:10.932814884 +0100
+@@ -106,7 +106,7 @@ see the files COPYING3 and COPYING.RUNTI
+ #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
+
+ #if defined(HAVE_LD_EH_FRAME_HDR)
+-#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
++#define LINK_EH_SPEC "--no-add-needed %{!static|static-pie:--eh-frame-hdr} "
+ #endif
+
+ #define GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC \
diff --git a/SOURCES/gcc11-pie.patch b/SOURCES/gcc11-pie.patch
new file mode 100644
index 0000000..36ae11b
--- /dev/null
+++ b/SOURCES/gcc11-pie.patch
@@ -0,0 +1,886 @@
+From 088d8e322811394203220663c3b9c925980d57a2 Mon Sep 17 00:00:00 2001
+From: Marek Polacek
+Date: Tue, 1 Feb 2022 18:27:16 -0500
+Subject: [PATCH] configure: Implement --enable-host-pie
+
+This patch implements the --enable-host-pie configure option which
+makes the compiler executables PIE. This can be used to enhance
+protection against ROP attacks, and can be viewed as part of a wider
+trend to harden binaries.
+
+It is similar to the option --enable-host-shared, except that --e-h-s
+won't add -shared to the linker flags whereas --e-h-p will add -pie.
+It is different from --enable-default-pie because that option just
+adds an implicit -fPIE/-pie when the compiler is invoked, but the
+compiler itself isn't PIE.
+
+Since r12-5768-gfe7c3ecf, PCH works well with PIE, so there are no PCH
+regressions.
+
+I plan to add an option to link with -Wl,-z,now.
+
+c++tools/ChangeLog:
+
+ * Makefile.in: Rename PIEFLAG to PICFLAG. Set LD_PICFLAG. Use it.
+ Use pic/libiberty.a if PICFLAG is set.
+ * configure.ac (--enable-default-pie): Set PICFLAG instead of PIEFLAG.
+ (--enable-host-pie): New check.
+ * configure: Regenerate.
+
+gcc/ChangeLog:
+
+ * Makefile.in: Set LD_PICFLAG. Use it. Set enable_host_pie.
+ Remove NO_PIE_CFLAGS and NO_PIE_FLAG. Pass LD_PICFLAG to
+ ALL_LINKERFLAGS. Use the "pic" build of libiberty if --enable-host-pie.
+ * configure.ac (--enable-host-shared): Don't set PICFLAG here.
+ (--enable-host-pie): New check. Set PICFLAG and LD_PICFLAG after this
+ check.
+ * configure: Regenerate.
+ * doc/install.texi: Document --enable-host-pie.
+
+libcody/ChangeLog:
+
+ * Makefile.in: Pass LD_PICFLAG to LDFLAGS.
+ * configure.ac (--enable-host-shared): Don't set PICFLAG here.
+ (--enable-host-pie): New check. Set PICFLAG and LD_PICFLAG after this
+ check.
+ * configure: Regenerate.
+
+libcpp/ChangeLog:
+
+ * configure.ac (--enable-host-shared): Don't set PICFLAG here.
+ (--enable-host-pie): New check. Set PICFLAG after this check.
+ * configure: Regenerate.
+
+libdecnumber/ChangeLog:
+
+ * configure.ac (--enable-host-shared): Don't set PICFLAG here.
+ (--enable-host-pie): New check. Set PICFLAG after this check.
+ * configure: Regenerate.
+
+zlib/ChangeLog:
+
+ * configure.ac (--enable-host-shared): Don't set PICFLAG here.
+ (--enable-host-pie): New check. Set PICFLAG after this check.
+ * configure: Regenerate.
+---
+ c++tools/Makefile.in | 11 ++++++---
+ c++tools/configure | 17 +++++++++++---
+ c++tools/configure.ac | 11 +++++++--
+ gcc/Makefile.in | 29 ++++++++++++++----------
+ gcc/configure | 47 +++++++++++++++++++++++++++------------
+ gcc/configure.ac | 36 +++++++++++++++++++++---------
+ gcc/d/Make-lang.in | 2 +-
+ gcc/doc/install.texi | 16 +++++++++++--
+ libcody/Makefile.in | 2 +-
+ libcody/configure | 30 ++++++++++++++++++++++++-
+ libcody/configure.ac | 26 ++++++++++++++++++++--
+ libcpp/configure | 22 +++++++++++++++++-
+ libcpp/configure.ac | 19 ++++++++++++++--
+ libdecnumber/configure | 22 +++++++++++++++++-
+ libdecnumber/configure.ac | 19 ++++++++++++++--
+ zlib/configure | 30 ++++++++++++++++++++-----
+ zlib/configure.ac | 21 ++++++++++++++---
+ 17 files changed, 295 insertions(+), 65 deletions(-)
+
+diff --git a/c++tools/Makefile.in b/c++tools/Makefile.in
+index d6a33613732..4d5a5b0522b 100644
+--- a/c++tools/Makefile.in
++++ b/c++tools/Makefile.in
+@@ -28,8 +28,9 @@ AUTOCONF := @AUTOCONF@
+ AUTOHEADER := @AUTOHEADER@
+ CXX := @CXX@
+ CXXFLAGS := @CXXFLAGS@
+-PIEFLAG := @PIEFLAG@
+-CXXOPTS := $(CXXFLAGS) $(PIEFLAG) -fno-exceptions -fno-rtti
++PICFLAG := @PICFLAG@
++LD_PICFLAG := @LD_PICFLAG@
++CXXOPTS := $(CXXFLAGS) $(PICFLAG) -fno-exceptions -fno-rtti
+ LDFLAGS := @LDFLAGS@
+ exeext := @EXEEXT@
+ LIBIBERTY := ../libiberty/libiberty.a
+@@ -87,11 +88,15 @@ ifeq (@CXX_AUX_TOOLS@,yes)
+
+ all::g++-mapper-server$(exeext)
+
++ifneq ($(PICFLAG),)
++override LIBIBERTY := ../libiberty/pic/libiberty.a
++endif
++
+ MAPPER.O := server.o resolver.o
+ CODYLIB = ../libcody/libcody.a
+ CXXINC += -I$(srcdir)/../libcody -I$(srcdir)/../include -I$(srcdir)/../gcc -I.
+ g++-mapper-server$(exeext): $(MAPPER.O) $(CODYLIB)
+- +$(CXX) $(LDFLAGS) $(PIEFLAG) -o $@ $^ $(VERSION.O) $(LIBIBERTY) $(NETLIBS)
++ +$(CXX) $(LDFLAGS) $(PICFLAG) $(LD_PICFLAG) -o $@ $^ $(VERSION.O) $(LIBIBERTY) $(NETLIBS)
+
+ # copy to gcc dir so tests there can run
+ all::../gcc/g++-mapper-server$(exeext)
+diff --git a/c++tools/configure b/c++tools/configure
+index 742816e4253..88087009383 100755
+--- a/c++tools/configure
++++ b/c++tools/configure
+@@ -630,7 +630,8 @@ CPP
+ ac_ct_CC
+ CFLAGS
+ CC
+-PIEFLAG
++LD_PICFLAG
++PICFLAG
+ MAINTAINER
+ CXX_AUX_TOOLS
+ AUTOHEADER
+@@ -702,6 +703,7 @@ enable_option_checking
+ enable_c___tools
+ enable_maintainer_mode
+ enable_default_pie
++enable_host_pie
+ with_gcc_major_version_only
+ '
+ ac_precious_vars='build_alias
+@@ -1333,6 +1335,7 @@ Optional Features:
+ enable maintainer mode. Add rules to rebuild
+ configurey bits
+ --enable-default-pie enable Position Independent Executable as default
++ --enable-host-pie build host code as PIE
+
+ Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+@@ -2992,12 +2995,20 @@ test "$maintainer_mode" = yes && MAINTAI
+ # Check whether --enable-default-pie was given.
+ # Check whether --enable-default-pie was given.
+ if test "${enable_default_pie+set}" = set; then :
+- enableval=$enable_default_pie; PIEFLAG=-fPIE
++ enableval=$enable_default_pie; PICFLAG=-fPIE
+ else
+- PIEFLAG=
++ PICFLAG=
+ fi
+
+
++# Enable --enable-host-pie
++# Check whether --enable-host-pie was given.
++if test "${enable_host_pie+set}" = set; then :
++ enableval=$enable_host_pie; PICFLAG=-fPIE; LD_PICFLAG=-pie
++fi
++
++
++
+
+ # Check if O_CLOEXEC is defined by fcntl
+ ac_ext=c
+diff --git a/c++tools/configure.ac b/c++tools/configure.ac
+index 6662b5ad7c9..1e42689f2eb 100644
+--- a/c++tools/configure.ac
++++ b/c++tools/configure.ac
+@@ -102,8 +102,15 @@ fi
+ AC_ARG_ENABLE(default-pie,
+ [AS_HELP_STRING([--enable-default-pie],
+ [enable Position Independent Executable as default])],
+-[PIEFLAG=-fPIE], [PIEFLAG=])
+-AC_SUBST([PIEFLAG])
++[PICFLAG=-fPIE], [PICFLAG=])
++
++# Enable --enable-host-pie
++AC_ARG_ENABLE(host-pie,
++[AS_HELP_STRING([--enable-host-pie],
++ [build host code as PIE])],
++[PICFLAG=-fPIE; LD_PICFLAG=-pie], [])
++AC_SUBST(PICFLAG)
++AC_SUBST(LD_PICFLAG)
+
+ # Check if O_CLOEXEC is defined by fcntl
+ AC_CACHE_CHECK(for O_CLOEXEC, ac_cv_o_cloexec, [
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index 31ff95500c9..151dbfa54ec 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -155,6 +155,9 @@ LDFLAGS = @LDFLAGS@
+ # Should we build position-independent host code?
+ PICFLAG = @PICFLAG@
+
++# The linker flag for the above.
++LD_PICFLAG = @LD_PICFLAG@
++
+ # Flags to determine code coverage. When coverage is disabled, this will
+ # contain the optimization flags, as you normally want code coverage
+ # without optimization.
+@@ -263,18 +266,17 @@ LINKER = $(CC)
+ LINKER_FLAGS = $(CFLAGS)
+ endif
+
++enable_host_pie = @enable_host_pie@
++
+ # Enable Intel CET on Intel CET enabled host if needed.
+ CET_HOST_FLAGS = @CET_HOST_FLAGS@
+ COMPILER += $(CET_HOST_FLAGS)
+
+-NO_PIE_CFLAGS = @NO_PIE_CFLAGS@
+-NO_PIE_FLAG = @NO_PIE_FLAG@
+-
+-# We don't want to compile the compilers with -fPIE, it make PCH fail.
+-COMPILER += $(NO_PIE_CFLAGS)
++# Maybe compile the compilers with -fPIE or -fPIC.
++COMPILER += $(PICFLAG)
+
+-# Link with -no-pie since we compile the compiler with -fno-PIE.
+-LINKER += $(NO_PIE_FLAG)
++# Link with -pie, or -no-pie, depending on the above.
++LINKER += $(LD_PICFLAG)
+
+ # Like LINKER, but use a mutex for serializing front end links.
+ ifeq (@DO_LINK_MUTEX@,true)
+@@ -1057,18 +1059,21 @@ ALL_CPPFLAGS = $(INCLUDES) $(CPPFLAGS)
+ ALL_COMPILERFLAGS = $(ALL_CXXFLAGS)
+
+ # This is the variable to use when using $(LINKER).
+-ALL_LINKERFLAGS = $(ALL_CXXFLAGS)
++ALL_LINKERFLAGS = $(ALL_CXXFLAGS) $(LD_PICFLAG)
+
+ # Build and host support libraries.
+
+-# Use the "pic" build of libiberty if --enable-host-shared, unless we are
+-# building for mingw.
++# Use the "pic" build of libiberty if --enable-host-shared or --enable-host-pie,
++# unless we are building for mingw.
+ LIBIBERTY_PICDIR=$(if $(findstring mingw,$(target)),,pic)
+-ifeq ($(enable_host_shared),yes)
++ifneq ($(enable_host_shared)$(enable_host_pie),)
+ LIBIBERTY = ../libiberty/$(LIBIBERTY_PICDIR)/libiberty.a
+-BUILD_LIBIBERTY = $(build_libobjdir)/libiberty/$(LIBIBERTY_PICDIR)/libiberty.a
+ else
+ LIBIBERTY = ../libiberty/libiberty.a
++endif
++ifeq ($(enable_host_shared),yes)
++BUILD_LIBIBERTY = $(build_libobjdir)/libiberty/$(LIBIBERTY_PICDIR)/libiberty.a
++else
+ BUILD_LIBIBERTY = $(build_libobjdir)/libiberty/libiberty.a
+ endif
+
+diff --git a/gcc/configure b/gcc/configure
+index 258b17a226e..bd4fe1fd6ca 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -632,10 +632,10 @@ ac_includes_default="\
+ ac_subst_vars='LTLIBOBJS
+ LIBOBJS
+ CET_HOST_FLAGS
+-NO_PIE_FLAG
+-NO_PIE_CFLAGS
+-enable_default_pie
++LD_PICFLAG
+ PICFLAG
++enable_default_pie
++enable_host_pie
+ enable_host_shared
+ enable_plugin
+ pluginlibs
+@@ -1025,6 +1025,7 @@ enable_link_serialization
+ enable_version_specific_runtime_libs
+ enable_plugin
+ enable_host_shared
++enable_host_pie
+ enable_libquadmath_support
+ with_linker_hash_style
+ with_diagnostics_color
+@@ -1787,6 +1788,7 @@ Optional Features:
+ in a compiler-specific directory
+ --enable-plugin enable plugin support
+ --enable-host-shared build host code as shared libraries
++ --enable-host-pie build host code as PIE
+ --disable-libquadmath-support
+ disable libquadmath support for Fortran
+ --enable-default-pie enable Position Independent Executable as default
+@@ -19659,7 +19661,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 19395 "configure"
++#line 19409 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -19765,7 +19767,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 19501 "configure"
++#line 19515 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -32221,13 +32223,17 @@ fi
+ # Enable --enable-host-shared
+ # Check whether --enable-host-shared was given.
+ if test "${enable_host_shared+set}" = set; then :
+- enableval=$enable_host_shared; PICFLAG=-fPIC
+-else
+- PICFLAG=
++ enableval=$enable_host_shared;
+ fi
+
+
+
++# Enable --enable-host-pie
++# Check whether --enable-host-pie was given.
++if test "${enable_host_pie+set}" = set; then :
++ enableval=$enable_host_pie;
++fi
++
+
+
+ # Check whether --enable-libquadmath-support was given.
+@@ -32381,10 +32387,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_c_no_fpie" >&5
+ $as_echo "$gcc_cv_c_no_fpie" >&6; }
+-if test "$gcc_cv_c_no_fpie" = "yes"; then
+- NO_PIE_CFLAGS="-fno-PIE"
+-fi
+-
+
+ # Check if -no-pie works.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -no-pie option" >&5
+@@ -32409,11 +32411,28 @@ rm -f core conftest.err conftest.$ac_objext \
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_no_pie" >&5
+ $as_echo "$gcc_cv_no_pie" >&6; }
+-if test "$gcc_cv_no_pie" = "yes"; then
+- NO_PIE_FLAG="-no-pie"
++
++if test x$enable_host_shared = xyes; then
++ PICFLAG=-fPIC
++elif test x$enable_host_pie = xyes; then
++ PICFLAG=-fPIE
++elif test x$gcc_cv_c_no_fpie = xyes; then
++ PICFLAG=-fno-PIE
++else
++ PICFLAG=
++fi
++
++if test x$enable_host_pie = xyes; then
++ LD_PICFLAG=-pie
++elif test x$gcc_cv_no_pie = xyes; then
++ LD_PICFLAG=-no-pie
++else
++ LD_PICFLAG=
+ fi
+
+
++
++
+ # Enable Intel CET on Intel CET enabled host if jit is enabled.
+ # Check whether --enable-cet was given.
+ if test "${enable_cet+set}" = set; then :
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index 06750cee977..dca995aeec7 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -7488,11 +7488,14 @@ fi
+ # Enable --enable-host-shared
+ AC_ARG_ENABLE(host-shared,
+ [AS_HELP_STRING([--enable-host-shared],
+- [build host code as shared libraries])],
+-[PICFLAG=-fPIC], [PICFLAG=])
++ [build host code as shared libraries])])
+ AC_SUBST(enable_host_shared)
+-AC_SUBST(PICFLAG)
+
++# Enable --enable-host-pie
++AC_ARG_ENABLE(host-pie,
++[AS_HELP_STRING([--enable-host-pie],
++ [build host code as PIE])])
++AC_SUBST(enable_host_pie)
+
+ AC_ARG_ENABLE(libquadmath-support,
+ [AS_HELP_STRING([--disable-libquadmath-support],
+@@ -7614,10 +7617,6 @@ AC_CACHE_CHECK([for -fno-PIE option],
+ [gcc_cv_c_no_fpie=yes],
+ [gcc_cv_c_no_fpie=no])
+ CXXFLAGS="$saved_CXXFLAGS"])
+-if test "$gcc_cv_c_no_fpie" = "yes"; then
+- NO_PIE_CFLAGS="-fno-PIE"
+-fi
+-AC_SUBST([NO_PIE_CFLAGS])
+
+ # Check if -no-pie works.
+ AC_CACHE_CHECK([for -no-pie option],
+@@ -7628,10 +7627,27 @@ AC_CACHE_CHECK([for -no-pie option],
+ [gcc_cv_no_pie=yes],
+ [gcc_cv_no_pie=no])
+ LDFLAGS="$saved_LDFLAGS"])
+-if test "$gcc_cv_no_pie" = "yes"; then
+- NO_PIE_FLAG="-no-pie"
++
++if test x$enable_host_shared = xyes; then
++ PICFLAG=-fPIC
++elif test x$enable_host_pie = xyes; then
++ PICFLAG=-fPIE
++elif test x$gcc_cv_c_no_fpie = xyes; then
++ PICFLAG=-fno-PIE
++else
++ PICFLAG=
+ fi
+-AC_SUBST([NO_PIE_FLAG])
++
++if test x$enable_host_pie = xyes; then
++ LD_PICFLAG=-pie
++elif test x$gcc_cv_no_pie = xyes; then
++ LD_PICFLAG=-no-pie
++else
++ LD_PICFLAG=
++fi
++
++AC_SUBST([PICFLAG])
++AC_SUBST([LD_PICFLAG])
+
+ # Enable Intel CET on Intel CET enabled host if jit is enabled.
+ GCC_CET_HOST_FLAGS(CET_HOST_FLAGS)
+diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
+index 93eae1f2582..be6985646b2 100644
+--- a/gcc/doc/install.texi
++++ b/gcc/doc/install.texi
+@@ -1021,14 +1021,26 @@ code.
+
+ @item --enable-host-shared
+ Specify that the @emph{host} code should be built into position-independent
+-machine code (with -fPIC), allowing it to be used within shared libraries,
+-but yielding a slightly slower compiler.
++machine code (with @option{-fPIC}), allowing it to be used within shared
++libraries, but yielding a slightly slower compiler.
+
+ This option is required when building the libgccjit.so library.
+
+ Contrast with @option{--enable-shared}, which affects @emph{target}
+ libraries.
+
++@item --enable-host-pie
++Specify that the @emph{host} executables should be built into
++position-independent executables (with @option{-fPIE} and @option{-pie}),
++yielding a slightly slower compiler (but faster than
++@option{--enable-host-shared}). Position-independent executables are loaded
++at random addresses each time they are executed, therefore provide additional
++protection against Return Oriented Programming (ROP) attacks.
++
++@option{--enable-host-pie}) may be used with @option{--enable-host-shared}),
++in which case @option{-fPIC} is used when compiling, and @option{-pie} when
++linking.
++
+ @item @anchor{with-gnu-as}--with-gnu-as
+ Specify that the compiler should assume that the
+ assembler it finds is the GNU assembler. However, this does not modify
+diff --git a/libcody/Makefile.in b/libcody/Makefile.in
+index 7eaf8ace8ce..0ff1625a39f 100644
+--- a/libcody/Makefile.in
++++ b/libcody/Makefile.in
+@@ -31,7 +31,7 @@ endif
+ CXXOPTS += $(filter-out -DHAVE_CONFIG_H,@DEFS@) -include config.h
+
+ # Linker options
+-LDFLAGS := @LDFLAGS@
++LDFLAGS := @LDFLAGS@ @LD_PICFLAG@
+ LIBS := @LIBS@
+
+ # Per-source & per-directory compile flags (warning: recursive)
+diff --git a/libcody/configure b/libcody/configure
+index da52a5cfca5..0e536c0ccb0 100755
+--- a/libcody/configure
++++ b/libcody/configure
+@@ -591,7 +591,10 @@ configure_args
+ AR
+ RANLIB
+ EXCEPTIONS
++LD_PICFLAG
+ PICFLAG
++enable_host_pie
++enable_host_shared
+ OBJEXT
+ EXEEXT
+ ac_ct_CXX
+@@ -653,6 +656,7 @@ enable_maintainer_mode
+ with_compiler
+ enable_checking
+ enable_host_shared
++enable_host_pie
+ enable_exceptions
+ '
+ ac_precious_vars='build_alias
+@@ -1286,6 +1290,7 @@ Optional Features:
+ yes,no,all,none,release. Flags are: misc,valgrind or
+ other strings
+ --enable-host-shared build host code as shared libraries
++ --enable-host-pie build host code as PIE
+ --enable-exceptions enable exceptions & rtti
+
+ Optional Packages:
+@@ -2635,11 +2640,34 @@ fi
+ # Enable --enable-host-shared.
+ # Check whether --enable-host-shared was given.
+ if test "${enable_host_shared+set}" = set; then :
+- enableval=$enable_host_shared; PICFLAG=-fPIC
++ enableval=$enable_host_shared;
++fi
++
++
++
++# Enable --enable-host-pie.
++# Check whether --enable-host-pie was given.
++if test "${enable_host_pie+set}" = set; then :
++ enableval=$enable_host_pie;
++fi
++
++
++
++if test x$enable_host_shared = xyes; then
++ PICFLAG=-fPIC
++elif test x$enable_host_pie = xyes; then
++ PICFLAG=-fPIE
+ else
+ PICFLAG=
+ fi
+
++if test x$enable_host_pie = xyes; then
++ LD_PICFLAG=-pie
++else
++ LD_PICFLAG=
++fi
++
++
+
+
+ # Check whether --enable-exceptions was given.
+diff --git a/libcody/configure.ac b/libcody/configure.ac
+index 960191ecb72..14e8dd4a226 100644
+--- a/libcody/configure.ac
++++ b/libcody/configure.ac
+@@ -63,9 +63,31 @@ fi
+ # Enable --enable-host-shared.
+ AC_ARG_ENABLE(host-shared,
+ [AS_HELP_STRING([--enable-host-shared],
+- [build host code as shared libraries])],
+-[PICFLAG=-fPIC], [PICFLAG=])
++ [build host code as shared libraries])])
++AC_SUBST(enable_host_shared)
++
++# Enable --enable-host-pie.
++AC_ARG_ENABLE(host-pie,
++[AS_HELP_STRING([--enable-host-pie],
++ [build host code as PIE])])
++AC_SUBST(enable_host_pie)
++
++if test x$enable_host_shared = xyes; then
++ PICFLAG=-fPIC
++elif test x$enable_host_pie = xyes; then
++ PICFLAG=-fPIE
++else
++ PICFLAG=
++fi
++
++if test x$enable_host_pie = xyes; then
++ LD_PICFLAG=-pie
++else
++ LD_PICFLAG=
++fi
++
+ AC_SUBST(PICFLAG)
++AC_SUBST(LD_PICFLAG)
+
+ NMS_ENABLE_EXCEPTIONS
+
+diff --git a/libcpp/configure b/libcpp/configure
+index 75145390215..85168273cd1 100755
+--- a/libcpp/configure
++++ b/libcpp/configure
+@@ -625,6 +625,8 @@ ac_includes_default="\
+ ac_subst_vars='LTLIBOBJS
+ CET_HOST_FLAGS
+ PICFLAG
++enable_host_pie
++enable_host_shared
+ MAINT
+ USED_CATALOGS
+ PACKAGE
+@@ -738,6 +740,7 @@ enable_maintainer_mode
+ enable_checking
+ enable_canonical_system_headers
+ enable_host_shared
++enable_host_pie
+ enable_cet
+ enable_valgrind_annotations
+ '
+@@ -1379,6 +1382,7 @@ Optional Features:
+ --enable-canonical-system-headers
+ enable or disable system headers canonicalization
+ --enable-host-shared build host code as shared libraries
++ --enable-host-pie build host code as PIE
+ --enable-cet enable Intel CET in host libraries [default=auto]
+ --enable-valgrind-annotations
+ enable valgrind runtime interaction
+@@ -7605,7 +7609,23 @@ esac
+ # Enable --enable-host-shared.
+ # Check whether --enable-host-shared was given.
+ if test "${enable_host_shared+set}" = set; then :
+- enableval=$enable_host_shared; PICFLAG=-fPIC
++ enableval=$enable_host_shared;
++fi
++
++
++
++# Enable --enable-host-pie.
++# Check whether --enable-host-pie was given.
++if test "${enable_host_pie+set}" = set; then :
++ enableval=$enable_host_pie;
++fi
++
++
++
++if test x$enable_host_shared = xyes; then
++ PICFLAG=-fPIC
++elif test x$enable_host_pie = xyes; then
++ PICFLAG=-fPIE
+ else
+ PICFLAG=
+ fi
+diff --git a/libcpp/configure.ac b/libcpp/configure.ac
+index 9b6042518e5..d25bf5f414f 100644
+--- a/libcpp/configure.ac
++++ b/libcpp/configure.ac
+@@ -211,8 +211,23 @@ esac
+ # Enable --enable-host-shared.
+ AC_ARG_ENABLE(host-shared,
+ [AS_HELP_STRING([--enable-host-shared],
+- [build host code as shared libraries])],
+-[PICFLAG=-fPIC], [PICFLAG=])
++ [build host code as shared libraries])])
++AC_SUBST(enable_host_shared)
++
++# Enable --enable-host-pie.
++AC_ARG_ENABLE(host-pie,
++[AS_HELP_STRING([--enable-host-pie],
++ [build host code as PIE])])
++AC_SUBST(enable_host_pie)
++
++if test x$enable_host_shared = xyes; then
++ PICFLAG=-fPIC
++elif test x$enable_host_pie = xyes; then
++ PICFLAG=-fPIE
++else
++ PICFLAG=
++fi
++
+ AC_SUBST(PICFLAG)
+
+ # Enable Intel CET on Intel CET enabled host if jit is enabled.
+diff --git a/libdecnumber/configure b/libdecnumber/configure
+index da5302f9315..d805fdeab5a 100755
+--- a/libdecnumber/configure
++++ b/libdecnumber/configure
+@@ -626,6 +626,8 @@ ac_subst_vars='LTLIBOBJS
+ LIBOBJS
+ CET_HOST_FLAGS
+ PICFLAG
++enable_host_pie
++enable_host_shared
+ ADDITIONAL_OBJS
+ enable_decimal_float
+ target_os
+@@ -706,6 +708,7 @@ enable_werror_always
+ enable_maintainer_mode
+ enable_decimal_float
+ enable_host_shared
++enable_host_pie
+ enable_cet
+ '
+ ac_precious_vars='build_alias
+@@ -1338,6 +1341,7 @@ Optional Features:
+ or 'dpd' choses which decimal floating point format
+ to use
+ --enable-host-shared build host code as shared libraries
++ --enable-host-pie build host code as PIE
+ --enable-cet enable Intel CET in host libraries [default=auto]
+
+ Some influential environment variables:
+@@ -5185,7 +5189,23 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
+ # Enable --enable-host-shared.
+ # Check whether --enable-host-shared was given.
+ if test "${enable_host_shared+set}" = set; then :
+- enableval=$enable_host_shared; PICFLAG=-fPIC
++ enableval=$enable_host_shared;
++fi
++
++
++
++# Enable --enable-host-pie.
++# Check whether --enable-host-pie was given.
++if test "${enable_host_pie+set}" = set; then :
++ enableval=$enable_host_pie;
++fi
++
++
++
++if test x$enable_host_shared = xyes; then
++ PICFLAG=-fPIC
++elif test x$enable_host_pie = xyes; then
++ PICFLAG=-fPIE
+ else
+ PICFLAG=
+ fi
+diff --git a/libdecnumber/configure.ac b/libdecnumber/configure.ac
+index 0794031ec83..14f67f926d1 100644
+--- a/libdecnumber/configure.ac
++++ b/libdecnumber/configure.ac
+@@ -100,8 +100,23 @@ AC_C_BIGENDIAN
+ # Enable --enable-host-shared.
+ AC_ARG_ENABLE(host-shared,
+ [AS_HELP_STRING([--enable-host-shared],
+- [build host code as shared libraries])],
+-[PICFLAG=-fPIC], [PICFLAG=])
++ [build host code as shared libraries])])
++AC_SUBST(enable_host_shared)
++
++# Enable --enable-host-pie.
++AC_ARG_ENABLE(host-pie,
++[AS_HELP_STRING([--enable-host-pie],
++ [build host code as PIE])])
++AC_SUBST(enable_host_pie)
++
++if test x$enable_host_shared = xyes; then
++ PICFLAG=-fPIC
++elif test x$enable_host_pie = xyes; then
++ PICFLAG=-fPIE
++else
++ PICFLAG=
++fi
++
+ AC_SUBST(PICFLAG)
+
+ # Enable Intel CET on Intel CET enabled host if jit is enabled.
+diff --git a/zlib/configure b/zlib/configure
+index f489f31bc70..0dfc1982844 100755
+--- a/zlib/configure
++++ b/zlib/configure
+@@ -635,6 +635,8 @@ am__EXEEXT_TRUE
+ LTLIBOBJS
+ LIBOBJS
+ PICFLAG
++enable_host_pie
++enable_host_shared
+ TARGET_LIBRARY_FALSE
+ TARGET_LIBRARY_TRUE
+ toolexeclibdir
+@@ -778,6 +780,7 @@ with_gnu_ld
+ enable_libtool_lock
+ with_toolexeclibdir
+ enable_host_shared
++enable_host_pie
+ '
+ ac_precious_vars='build_alias
+ host_alias
+@@ -1420,6 +1423,7 @@ Optional Features:
+ optimize for fast installation [default=yes]
+ --disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-host-shared build host code as shared libraries
++ --enable-host-pie build host code as PIE
+
+ Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+@@ -4169,7 +4173,7 @@ case "$host" in
+ case "$enable_cet" in
+ auto)
+ # Check if target supports multi-byte NOPs
+- # and if assembler supports CET insn.
++ # and if compiler and assembler support CET insn.
+ cet_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fcf-protection"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+@@ -10735,7 +10739,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 10748 "configure"
++#line 10754 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -10841,7 +10845,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 10854 "configure"
++#line 10860 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -11524,15 +11528,31 @@ else
+ multilib_arg=
+ fi
+
++# Enable --enable-host-shared.
+ # Check whether --enable-host-shared was given.
+ if test "${enable_host_shared+set}" = set; then :
+- enableval=$enable_host_shared; PICFLAG=-fPIC
++ enableval=$enable_host_shared;
++fi
++
++
++
++# Enable --enable-host-pie.
++# Check whether --enable-host-pie was given.
++if test "${enable_host_pie+set}" = set; then :
++ enableval=$enable_host_pie;
++fi
++
++
++
++if test x$enable_host_shared = xyes; then
++ PICFLAG=-fPIC
++elif test x$enable_host_pie = xyes; then
++ PICFLAG=-fPIE
+ else
+ PICFLAG=
+ fi
+
+
+-
+ ac_config_files="$ac_config_files Makefile"
+
+ cat >confcache <<\_ACEOF
+diff --git a/zlib/configure.ac b/zlib/configure.ac
+index be1cfe29651..adf7aad4e51 100644
+--- a/zlib/configure.ac
++++ b/zlib/configure.ac
+@@ -122,11 +122,26 @@ else
+ multilib_arg=
+ fi
+
++# Enable --enable-host-shared.
+ AC_ARG_ENABLE(host-shared,
+ [AS_HELP_STRING([--enable-host-shared],
+- [build host code as shared libraries])],
+-[PICFLAG=-fPIC], [PICFLAG=])
+-AC_SUBST(PICFLAG)
++ [build host code as shared libraries])])
++AC_SUBST(enable_host_shared)
++
++# Enable --enable-host-pie.
++AC_ARG_ENABLE(host-pie,
++[AS_HELP_STRING([--enable-host-pie],
++ [build host code as PIE])])
++AC_SUBST(enable_host_pie)
++
++if test x$enable_host_shared = xyes; then
++ PICFLAG=-fPIC
++elif test x$enable_host_pie = xyes; then
++ PICFLAG=-fPIE
++else
++ PICFLAG=
++fi
+
++AC_SUBST(PICFLAG)
+ AC_CONFIG_FILES([Makefile])
+ AC_OUTPUT
+
+base-commit: ee50b4383a0dca88172c3a821418344bd7391956
+--
+2.34.1
+
diff --git a/SOURCES/gcc11-pr101786.patch b/SOURCES/gcc11-pr101786.patch
new file mode 100644
index 0000000..427c10a
--- /dev/null
+++ b/SOURCES/gcc11-pr101786.patch
@@ -0,0 +1,66 @@
+c++: Optimize constinit thread_local vars [PR101786]
+
+The paper that introduced constinit mentioned in rationale that constinit
+can be used on externs as well and that it can be used to avoid the
+thread_local initialization wrappers, because the standard requires that
+if constinit is present on any declaration, it is also present on the
+initialization declaration, even if it is in some other TU etc.
+
+There is a small problem though, we use the tls wrappers not just if
+the thread_local variable needs dynamic initialization, but also when
+it has static initialization, but non-trivial destructor, as the
+"dynamic initialization" in that case needs to register the destructor.
+
+So, the following patch optimizes constinit thread_local vars only
+if we can prove they will not have non-trivial destructors. That includes
+the case where we have incomplete type where we don't know and need to
+conservatively assume the type will have non-trivial destructor at the
+initializing declaration side.
+
+2021-08-11 Jakub Jelinek
+
+ PR c++/101786
+ * decl2.c (var_defined_without_dynamic_init): Return true for
+ DECL_DECLARED_CONSTINIT_P with complete type and trivial destructor.
+
+ * g++.dg/cpp2a/constinit16.C: New test.
+
+--- gcc/cp/decl2.c
++++ gcc/cp/decl2.c
+@@ -3447,6 +3447,12 @@ set_guard (tree guard)
+ static bool
+ var_defined_without_dynamic_init (tree var)
+ {
++ /* constinit vars are guaranteed to not have dynamic initializer,
++ but still registering the destructor counts as dynamic initialization. */
++ if (DECL_DECLARED_CONSTINIT_P (var)
++ && COMPLETE_TYPE_P (TREE_TYPE (var))
++ && !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (var)))
++ return true;
+ /* If it's defined in another TU, we can't tell. */
+ if (DECL_EXTERNAL (var))
+ return false;
+--- gcc/testsuite/g++.dg/cpp2a/constinit16.C
++++ gcc/testsuite/g++.dg/cpp2a/constinit16.C
+@@ -0,0 +1,21 @@
++// PR c++/101786
++// { dg-do compile { target c++20 } }
++// { dg-add-options tls }
++// { dg-require-alias "" }
++// { dg-require-effective-target tls_runtime }
++// { dg-final { scan-assembler-not "_ZTH17mythreadlocalvar1" } }
++// { dg-final { scan-assembler "_ZTH17mythreadlocalvar2" } }
++// { dg-final { scan-assembler-not "_ZTH17mythreadlocalvar3" } }
++// { dg-final { scan-assembler "_ZTH17mythreadlocalvar4" } }
++
++extern thread_local constinit int mythreadlocalvar1;
++struct S;
++extern thread_local constinit S mythreadlocalvar2;
++struct T { int t; };
++extern thread_local constinit T mythreadlocalvar3;
++struct U { int u; ~U (); };
++extern thread_local constinit U mythreadlocalvar4;
++int foo () { return mythreadlocalvar1; }
++S *bar () { return &mythreadlocalvar2; }
++T *baz () { return &mythreadlocalvar3; }
++U *qux () { return &mythreadlocalvar4; }
diff --git a/SOURCES/gcc11-relocatable-pch.patch b/SOURCES/gcc11-relocatable-pch.patch
new file mode 100644
index 0000000..16fb965
--- /dev/null
+++ b/SOURCES/gcc11-relocatable-pch.patch
@@ -0,0 +1,828 @@
+This patch backports support for PCH with PIE from upstream trunk.
+
+It squashes two commits:
+
+commit e4641191287ca613529d78a906afe4f029c1c3cd
+Author: Iain Sandoe
+Date: Sat Nov 13 12:26:16 2021 +0000
+
+ PCH: Make the save and restore diagnostics more robust.
+
+ When saving, if we cannot obtain a suitable memory segment there
+ is no point in continuing, so exit with an error.
+
+ When reading in the PCH, we have a situation that the read-in
+ data will replace the line tables used by the diagnostics output.
+ However, the state of the read-oin line tables is indeterminate
+ at some points where diagnostics might be needed.
+
+ To make this more robust, we save the existing line tables at
+ the start and, once we have read in the pointer to the new one,
+ put that to one side and restore the original table. This
+ avoids compiler hangs if the read or memory acquisition code
+ issues an assert, fatal_error, segv etc.
+
+ Once the read is complete, we swap in the new line table that
+ came from the PCH.
+
+ If the read-in PCH is corrupted then we still have a broken
+ compilation w.r.t any future diagnostics - but there is little
+ that can be done about that without more careful validation of
+ the file.
+
+and
+
+commit fe7c3ecff1f9c0520090a77fa824d8c5d9dbec12
+Author: Jakub Jelinek
+Date: Fri Dec 3 11:03:30 2021 +0100
+
+ pch: Add support for PCH for relocatable executables [PR71934]
+
+ So, if we want to make PCH work for PIEs, I'd say we can:
+ 1) add a new GTY option, say callback, which would act like
+ skip for non-PCH and for PCH would make us skip it but
+ remember for address bias translation
+ 2) drop the skip for tree_translation_unit_decl::language
+ 3) change get_unnamed_section to have const char * as
+ last argument instead of const void *, change
+ unnamed_section::data also to const char * and update
+ everything related to that
+ 4) maybe add a host hook whether it is ok to support binaries
+ changing addresses (the only thing I'm worried is if
+ some host that uses function descriptors allocates them
+ dynamically instead of having them somewhere in the
+ executable)
+ 5) maybe add a gengtype warning if it sees in GTY tracked
+ structure a function pointer without that new callback
+ option
+
+ Here is 1), 2), 3) implemented.
+
+ Note, on stdc++.h.gch/O2g.gch there are just those 10 relocations without
+ the second patch, with it a few more, but nothing huge. And for non-PIEs
+ there isn't really any extra work on the load side except freading two scalar
+ values and fseek.
+
+diff --git a/gcc/c-family/c-pch.c b/gcc/c-family/c-pch.c
+index fd94c3799ac..eebfa1df0bc 100644
+--- a/gcc/c-family/c-pch.c
++++ b/gcc/c-family/c-pch.c
+@@ -54,7 +54,6 @@ struct c_pch_validity
+ {
+ unsigned char debug_info_type;
+ signed char match[MATCH_SIZE];
+- void (*pch_init) (void);
+ size_t target_data_length;
+ };
+
+@@ -117,7 +116,6 @@ pch_init (void)
+ gcc_assert (v.match[i] == *pch_matching[i].flag_var);
+ }
+ }
+- v.pch_init = &pch_init;
+ target_validity = targetm.get_pch_validity (&v.target_data_length);
+
+ if (fwrite (partial_pch, IDENT_LENGTH, 1, f) != 1
+@@ -275,19 +273,6 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd)
+ }
+ }
+
+- /* If the text segment was not loaded at the same address as it was
+- when the PCH file was created, function pointers loaded from the
+- PCH will not be valid. We could in theory remap all the function
+- pointers, but no support for that exists at present.
+- Since we have the same executable, it should only be necessary to
+- check one function. */
+- if (v.pch_init != &pch_init)
+- {
+- cpp_warning (pfile, CPP_W_INVALID_PCH,
+- "%s: had text segment at different address", name);
+- return 2;
+- }
+-
+ /* Check the target-specific validity data. */
+ {
+ void *this_file_data = xmalloc (v.target_data_length);
+diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
+index 3a250dfb960..4d29e80dcc9 100644
+--- a/gcc/config/avr/avr.c
++++ b/gcc/config/avr/avr.c
+@@ -10221,10 +10221,9 @@ avr_output_bss_section_asm_op (const void *data)
+ /* Unnamed section callback for progmem*.data sections. */
+
+ static void
+-avr_output_progmem_section_asm_op (const void *data)
++avr_output_progmem_section_asm_op (const char *data)
+ {
+- fprintf (asm_out_file, "\t.section\t%s,\"a\",@progbits\n",
+- (const char*) data);
++ fprintf (asm_out_file, "\t.section\t%s,\"a\",@progbits\n", data);
+ }
+
+
+diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
+index 5d173919ee0..0c8aea148dc 100644
+--- a/gcc/config/darwin.c
++++ b/gcc/config/darwin.c
+@@ -128,7 +128,7 @@ int emit_aligned_common = false;
+ DIRECTIVE is as for output_section_asm_op. */
+
+ static void
+-output_objc_section_asm_op (const void *directive)
++output_objc_section_asm_op (const char *directive)
+ {
+ static bool been_here = false;
+
+diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
+index 341c5f0d765..8ac9c4b3a44 100644
+--- a/gcc/config/pa/pa.c
++++ b/gcc/config/pa/pa.c
+@@ -10011,7 +10011,7 @@ pa_arg_partial_bytes (cumulative_args_t cum_v, const function_arg_info &arg)
+ to the default text subspace. */
+
+ static void
+-som_output_text_section_asm_op (const void *data ATTRIBUTE_UNUSED)
++som_output_text_section_asm_op (const char *data ATTRIBUTE_UNUSED)
+ {
+ gcc_assert (TARGET_SOM);
+ if (TARGET_GAS)
+@@ -10055,7 +10055,7 @@ som_output_text_section_asm_op (const void *data ATTRIBUTE_UNUSED)
+ sections. This function is only used with SOM. */
+
+ static void
+-som_output_comdat_data_section_asm_op (const void *data)
++som_output_comdat_data_section_asm_op (const char *data)
+ {
+ in_section = NULL;
+ output_section_asm_op (data);
+diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
+index 9b1c3a8b5ea..fa245a8714c 100644
+--- a/gcc/config/rs6000/rs6000.c
++++ b/gcc/config/rs6000/rs6000.c
+@@ -20232,7 +20232,7 @@ rs6000_ms_bitfield_layout_p (const_tree record_type)
+ /* A get_unnamed_section callback, used for switching to toc_section. */
+
+ static void
+-rs6000_elf_output_toc_section_asm_op (const void *data ATTRIBUTE_UNUSED)
++rs6000_elf_output_toc_section_asm_op (const char *data ATTRIBUTE_UNUSED)
+ {
+ if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
+ && TARGET_MINIMAL_TOC)
+@@ -20936,35 +20936,39 @@ rs6000_xcoff_asm_globalize_label (FILE *stream, const char *name)
+ points to the section string variable. */
+
+ static void
+-rs6000_xcoff_output_readonly_section_asm_op (const void *directive)
++rs6000_xcoff_output_readonly_section_asm_op (const char *directive)
+ {
+ fprintf (asm_out_file, "\t.csect %s[RO],%s\n",
+- *(const char *const *) directive,
++ directive
++ ? xcoff_private_rodata_section_name
++ : xcoff_read_only_section_name,
+ XCOFF_CSECT_DEFAULT_ALIGNMENT_STR);
+ }
+
+ /* Likewise for read-write sections. */
+
+ static void
+-rs6000_xcoff_output_readwrite_section_asm_op (const void *directive)
++rs6000_xcoff_output_readwrite_section_asm_op (const char *)
+ {
+ fprintf (asm_out_file, "\t.csect %s[RW],%s\n",
+- *(const char *const *) directive,
++ xcoff_private_data_section_name,
+ XCOFF_CSECT_DEFAULT_ALIGNMENT_STR);
+ }
+
+ static void
+-rs6000_xcoff_output_tls_section_asm_op (const void *directive)
++rs6000_xcoff_output_tls_section_asm_op (const char *directive)
+ {
+ fprintf (asm_out_file, "\t.csect %s[TL],%s\n",
+- *(const char *const *) directive,
++ directive
++ ? xcoff_private_data_section_name
++ : xcoff_tls_data_section_name,
+ XCOFF_CSECT_DEFAULT_ALIGNMENT_STR);
+ }
+
+ /* A get_unnamed_section callback, used for switching to toc_section. */
+
+ static void
+-rs6000_xcoff_output_toc_section_asm_op (const void *data ATTRIBUTE_UNUSED)
++rs6000_xcoff_output_toc_section_asm_op (const char *data ATTRIBUTE_UNUSED)
+ {
+ if (TARGET_MINIMAL_TOC)
+ {
+@@ -20991,26 +20995,26 @@ rs6000_xcoff_asm_init_sections (void)
+ {
+ read_only_data_section
+ = get_unnamed_section (0, rs6000_xcoff_output_readonly_section_asm_op,
+- &xcoff_read_only_section_name);
++ NULL);
+
+ private_data_section
+ = get_unnamed_section (SECTION_WRITE,
+ rs6000_xcoff_output_readwrite_section_asm_op,
+- &xcoff_private_data_section_name);
++ NULL);
+
+ read_only_private_data_section
+ = get_unnamed_section (0, rs6000_xcoff_output_readonly_section_asm_op,
+- &xcoff_private_rodata_section_name);
++ "");
+
+ tls_data_section
+ = get_unnamed_section (SECTION_TLS,
+ rs6000_xcoff_output_tls_section_asm_op,
+- &xcoff_tls_data_section_name);
++ NULL);
+
+ tls_private_data_section
+ = get_unnamed_section (SECTION_TLS,
+ rs6000_xcoff_output_tls_section_asm_op,
+- &xcoff_private_data_section_name);
++ "");
+
+ toc_section
+ = get_unnamed_section (0, rs6000_xcoff_output_toc_section_asm_op, NULL);
+diff --git a/gcc/doc/gty.texi b/gcc/doc/gty.texi
+index aaf97ae9ad5..0154bd86fe9 100644
+--- a/gcc/doc/gty.texi
++++ b/gcc/doc/gty.texi
+@@ -197,6 +197,15 @@ If @code{skip} is applied to a field, the type machinery will ignore it.
+ This is somewhat dangerous; the only safe use is in a union when one
+ field really isn't ever used.
+
++@findex callback
++@item callback
++
++@code{callback} should be applied to fields with pointer to function type
++and causes the field to be ignored similarly to @code{skip}, except when
++writing PCH and the field is non-NULL it will remember the field's address
++for relocation purposes if the process writing PCH has different load base
++from a process reading PCH.
++
+ @findex for_user
+ @item for_user
+
+diff --git a/gcc/gengtype-state.c b/gcc/gengtype-state.c
+index 891f2e18a61..fb99729bc0e 100644
+--- a/gcc/gengtype-state.c
++++ b/gcc/gengtype-state.c
+@@ -57,6 +57,7 @@ type_lineloc (const_type_p ty)
+ case TYPE_STRING:
+ case TYPE_POINTER:
+ case TYPE_ARRAY:
++ case TYPE_CALLBACK:
+ return NULL;
+ default:
+ gcc_unreachable ();
+@@ -171,6 +172,7 @@ private:
+ void write_state_version (const char *version);
+ void write_state_scalar_type (type_p current);
+ void write_state_string_type (type_p current);
++ void write_state_callback_type (type_p current);
+ void write_state_undefined_type (type_p current);
+ void write_state_struct_union_type (type_p current, const char *kindstr);
+ void write_state_struct_type (type_p current);
+@@ -898,6 +900,20 @@ state_writer::write_state_string_type (type_p current)
+ fatal ("Unexpected type in write_state_string_type");
+ }
+
++/* Write the callback type. There is only one such thing! */
++void
++state_writer::write_state_callback_type (type_p current)
++{
++ if (current == &callback_type)
++ {
++ write_any_indent (0);
++ fprintf (state_file, "callback ");
++ write_state_common_type_content (current);
++ }
++ else
++ fatal ("Unexpected type in write_state_callback_type");
++}
++
+ /* Write an undefined type. */
+ void
+ state_writer::write_state_undefined_type (type_p current)
+@@ -1143,6 +1159,9 @@ state_writer::write_state_type (type_p current)
+ case TYPE_STRING:
+ write_state_string_type (current);
+ break;
++ case TYPE_CALLBACK:
++ write_state_callback_type (current);
++ break;
+ }
+ }
+
+@@ -1477,6 +1496,14 @@ read_state_string_type (type_p *type)
+ read_state_common_type_content (*type);
+ }
+
++/* Read the callback_type. */
++static void
++read_state_callback_type (type_p *type)
++{
++ *type = &callback_type;
++ read_state_common_type_content (*type);
++}
++
+
+ /* Read a lang_bitmap representing a set of GCC front-end languages. */
+ static void
+@@ -1834,6 +1861,11 @@ read_state_type (type_p *current)
+ next_state_tokens (1);
+ read_state_string_type (current);
+ }
++ else if (state_token_is_name (t0, "callback"))
++ {
++ next_state_tokens (1);
++ read_state_callback_type (current);
++ }
+ else if (state_token_is_name (t0, "undefined"))
+ {
+ *current = XCNEW (struct type);
+diff --git a/gcc/gengtype.c b/gcc/gengtype.c
+index 98d4626f87e..91eacc26932 100644
+--- a/gcc/gengtype.c
++++ b/gcc/gengtype.c
+@@ -167,6 +167,7 @@ dbgprint_count_type_at (const char *fil, int lin, const char *msg, type_p t)
+ int nb_struct = 0, nb_union = 0, nb_array = 0, nb_pointer = 0;
+ int nb_lang_struct = 0;
+ int nb_user_struct = 0, nb_undefined = 0;
++ int nb_callback = 0;
+ type_p p = NULL;
+ for (p = t; p; p = p->next)
+ {
+@@ -197,6 +198,9 @@ dbgprint_count_type_at (const char *fil, int lin, const char *msg, type_p t)
+ case TYPE_ARRAY:
+ nb_array++;
+ break;
++ case TYPE_CALLBACK:
++ nb_callback++;
++ break;
+ case TYPE_LANG_STRUCT:
+ nb_lang_struct++;
+ break;
+@@ -212,6 +216,8 @@ dbgprint_count_type_at (const char *fil, int lin, const char *msg, type_p t)
+ fprintf (stderr, "@@%%@@ %d structs, %d unions\n", nb_struct, nb_union);
+ if (nb_pointer > 0 || nb_array > 0)
+ fprintf (stderr, "@@%%@@ %d pointers, %d arrays\n", nb_pointer, nb_array);
++ if (nb_callback > 0)
++ fprintf (stderr, "@@%%@@ %d callbacks\n", nb_callback);
+ if (nb_lang_struct > 0)
+ fprintf (stderr, "@@%%@@ %d lang_structs\n", nb_lang_struct);
+ if (nb_user_struct > 0)
+@@ -490,6 +496,10 @@ struct type scalar_char = {
+ TYPE_SCALAR, 0, 0, 0, GC_USED, {0}
+ };
+
++struct type callback_type = {
++ TYPE_CALLBACK, 0, 0, 0, GC_USED, {0}
++};
++
+ /* Lists of various things. */
+
+ pair_p typedefs = NULL;
+@@ -1459,7 +1469,7 @@ static void set_gc_used (pair_p);
+
+ static void
+ process_gc_options (options_p opt, enum gc_used_enum level, int *maybe_undef,
+- int *length, int *skip, type_p *nested_ptr)
++ int *length, int *skip, int *callback, type_p *nested_ptr)
+ {
+ options_p o;
+ for (o = opt; o; o = o->next)
+@@ -1473,6 +1483,8 @@ process_gc_options (options_p opt, enum gc_used_enum level, int *maybe_undef,
+ *length = 1;
+ else if (strcmp (o->name, "skip") == 0)
+ *skip = 1;
++ else if (strcmp (o->name, "callback") == 0)
++ *callback = 1;
+ else if (strcmp (o->name, "nested_ptr") == 0
+ && o->kind == OPTION_NESTED)
+ *nested_ptr = ((const struct nested_ptr_data *) o->info.nested)->type;
+@@ -1521,7 +1533,7 @@ set_gc_used_type (type_p t, enum gc_used_enum level,
+ type_p dummy2;
+ bool allow_undefined_field_types = (t->kind == TYPE_USER_STRUCT);
+
+- process_gc_options (t->u.s.opt, level, &dummy, &dummy, &dummy,
++ process_gc_options (t->u.s.opt, level, &dummy, &dummy, &dummy, &dummy,
+ &dummy2);
+
+ if (t->u.s.base_class)
+@@ -1537,9 +1549,10 @@ set_gc_used_type (type_p t, enum gc_used_enum level,
+ int maybe_undef = 0;
+ int length = 0;
+ int skip = 0;
++ int callback = 0;
+ type_p nested_ptr = NULL;
+ process_gc_options (f->opt, level, &maybe_undef, &length, &skip,
+- &nested_ptr);
++ &callback, &nested_ptr);
+
+ if (nested_ptr && f->type->kind == TYPE_POINTER)
+ set_gc_used_type (nested_ptr, GC_POINTED_TO);
+@@ -1549,6 +1562,8 @@ set_gc_used_type (type_p t, enum gc_used_enum level,
+ set_gc_used_type (f->type->u.p, GC_MAYBE_POINTED_TO);
+ else if (skip)
+ ; /* target type is not used through this field */
++ else if (callback)
++ f->type = &callback_type;
+ else
+ set_gc_used_type (f->type, GC_USED, allow_undefined_field_types);
+ }
+@@ -2512,6 +2527,7 @@ output_mangled_typename (outf_p of, const_type_p t)
+ {
+ case TYPE_NONE:
+ case TYPE_UNDEFINED:
++ case TYPE_CALLBACK:
+ gcc_unreachable ();
+ break;
+ case TYPE_POINTER:
+@@ -2712,6 +2728,8 @@ walk_type (type_p t, struct walk_type_data *d)
+ ;
+ else if (strcmp (oo->name, "for_user") == 0)
+ ;
++ else if (strcmp (oo->name, "callback") == 0)
++ ;
+ else
+ error_at_line (d->line, "unknown option `%s'\n", oo->name);
+
+@@ -2737,6 +2755,7 @@ walk_type (type_p t, struct walk_type_data *d)
+ {
+ case TYPE_SCALAR:
+ case TYPE_STRING:
++ case TYPE_CALLBACK:
+ d->process_field (t, d);
+ break;
+
+@@ -3268,6 +3287,7 @@ write_types_process_field (type_p f, const struct walk_type_data *d)
+ break;
+
+ case TYPE_SCALAR:
++ case TYPE_CALLBACK:
+ break;
+
+ case TYPE_ARRAY:
+@@ -3813,6 +3833,7 @@ write_types_local_user_process_field (type_p f, const struct walk_type_data *d)
+ break;
+
+ case TYPE_SCALAR:
++ case TYPE_CALLBACK:
+ break;
+
+ case TYPE_ARRAY:
+@@ -3899,6 +3920,13 @@ write_types_local_process_field (type_p f, const struct walk_type_data *d)
+ case TYPE_SCALAR:
+ break;
+
++ case TYPE_CALLBACK:
++ oprintf (d->of, "%*sif ((void *)(%s) == this_obj)\n", d->indent, "",
++ d->prev_val[3]);
++ oprintf (d->of, "%*s gt_pch_note_callback (&(%s), this_obj);\n",
++ d->indent, "", d->val);
++ break;
++
+ case TYPE_ARRAY:
+ case TYPE_NONE:
+ case TYPE_UNDEFINED:
+@@ -4427,6 +4455,7 @@ write_root (outf_p f, pair_p v, type_p type, const char *name, int has_length,
+ case TYPE_UNDEFINED:
+ case TYPE_UNION:
+ case TYPE_LANG_STRUCT:
++ case TYPE_CALLBACK:
+ error_at_line (line, "global `%s' is unimplemented type", name);
+ }
+ }
+@@ -4721,6 +4750,9 @@ dump_typekind (int indent, enum typekind kind)
+ case TYPE_ARRAY:
+ printf ("TYPE_ARRAY");
+ break;
++ case TYPE_CALLBACK:
++ printf ("TYPE_CALLBACK");
++ break;
+ case TYPE_LANG_STRUCT:
+ printf ("TYPE_LANG_STRUCT");
+ break;
+@@ -4887,6 +4919,7 @@ dump_type (int indent, type_p t)
+ t->u.scalar_is_char ? "true" : "false");
+ break;
+ case TYPE_STRING:
++ case TYPE_CALLBACK:
+ break;
+ case TYPE_STRUCT:
+ case TYPE_UNION:
+diff --git a/gcc/gengtype.h b/gcc/gengtype.h
+index 4fe8f0f7232..c32faba2995 100644
+--- a/gcc/gengtype.h
++++ b/gcc/gengtype.h
+@@ -149,6 +149,9 @@ enum typekind {
+ TYPE_UNION, /* Type for GTY-ed discriminated unions. */
+ TYPE_POINTER, /* Pointer type to GTY-ed type. */
+ TYPE_ARRAY, /* Array of GTY-ed types. */
++ TYPE_CALLBACK, /* A function pointer that needs relocation if
++ the executable has been loaded at a different
++ address. */
+ TYPE_LANG_STRUCT, /* GCC front-end language specific structs.
+ Various languages may have homonymous but
+ different structs. */
+@@ -326,6 +329,9 @@ extern struct type string_type;
+ extern struct type scalar_nonchar;
+ extern struct type scalar_char;
+
++/* The one and only TYPE_CALLBACK. */
++extern struct type callback_type;
++
+ /* Test if a type is a union, either a plain one or a language
+ specific one. */
+ #define UNION_P(x) \
+diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
+index 357bda13f97..88e1af4ba4a 100644
+--- a/gcc/ggc-common.c
++++ b/gcc/ggc-common.c
+@@ -249,6 +249,7 @@ saving_hasher::equal (const ptr_data *p1, const void *p2)
+ }
+
+ static hash_table *saving_htab;
++static vec callback_vec;
+
+ /* Register an object in the hash table. */
+
+@@ -281,6 +282,23 @@ gt_pch_note_object (void *obj, void *note_ptr_cookie,
+ return 1;
+ }
+
++/* Register address of a callback pointer. */
++void
++gt_pch_note_callback (void *obj, void *base)
++{
++ void *ptr;
++ memcpy (&ptr, obj, sizeof (void *));
++ if (ptr != NULL)
++ {
++ struct ptr_data *data
++ = (struct ptr_data *)
++ saving_htab->find_with_hash (base, POINTER_HASH (base));
++ gcc_assert (data);
++ callback_vec.safe_push ((char *) data->new_addr
++ + ((char *) obj - (char *) base));
++ }
++}
++
+ /* Register an object in the hash table. */
+
+ void
+@@ -443,6 +461,10 @@ gt_pch_save (FILE *f)
+ (The extra work goes in HOST_HOOKS_GT_PCH_GET_ADDRESS and
+ HOST_HOOKS_GT_PCH_USE_ADDRESS.) */
+ mmi.preferred_base = host_hooks.gt_pch_get_address (mmi.size, fileno (f));
++ /* If the host cannot supply any suitable address for this, we are stuck. */
++ if (mmi.preferred_base == NULL)
++ fatal_error (input_location,
++ "cannot write PCH file: required memory segment unavailable");
+
+ ggc_pch_this_base (state.d, mmi.preferred_base);
+
+@@ -575,10 +597,20 @@ gt_pch_save (FILE *f)
+ ggc_pch_finish (state.d, state.f);
+ gt_pch_fixup_stringpool ();
+
++ unsigned num_callbacks = callback_vec.length ();
++ void (*pch_save) (FILE *) = >_pch_save;
++ if (fwrite (&pch_save, sizeof (pch_save), 1, f) != 1
++ || fwrite (&num_callbacks, sizeof (num_callbacks), 1, f) != 1
++ || (num_callbacks
++ && fwrite (callback_vec.address (), sizeof (void *), num_callbacks,
++ f) != num_callbacks))
++ fatal_error (input_location, "cannot write PCH file: %m");
++
+ XDELETE (state.ptrs);
+ XDELETE (this_object);
+ delete saving_htab;
+ saving_htab = NULL;
++ callback_vec.release ();
+ }
+
+ /* Read the state of the compiler back in from F. */
+@@ -592,6 +624,13 @@ gt_pch_restore (FILE *f)
+ struct mmap_info mmi;
+ int result;
+
++ /* We are about to reload the line maps along with the rest of the PCH
++ data, which means that the (loaded) ones cannot be guaranteed to be
++ in any valid state for reporting diagnostics that happen during the
++ load. Save the current table (and use it during the loading process
++ below). */
++ class line_maps *save_line_table = line_table;
++
+ /* Delete any deletable objects. This makes ggc_pch_read much
+ faster, as it can be sure that no GCable objects remain other
+ than the ones just read in. */
+@@ -606,20 +645,40 @@ gt_pch_restore (FILE *f)
+ fatal_error (input_location, "cannot read PCH file: %m");
+
+ /* Read in all the global pointers, in 6 easy loops. */
++ bool error_reading_pointers = false;
+ for (rt = gt_ggc_rtab; *rt; rt++)
+ for (rti = *rt; rti->base != NULL; rti++)
+ for (i = 0; i < rti->nelt; i++)
+ if (fread ((char *)rti->base + rti->stride * i,
+ sizeof (void *), 1, f) != 1)
+- fatal_error (input_location, "cannot read PCH file: %m");
++ error_reading_pointers = true;
++
++ /* Stash the newly read-in line table pointer - it does not point to
++ anything meaningful yet, so swap the old one back in. */
++ class line_maps *new_line_table = line_table;
++ line_table = save_line_table;
++ if (error_reading_pointers)
++ fatal_error (input_location, "cannot read PCH file: %m");
+
+ if (fread (&mmi, sizeof (mmi), 1, f) != 1)
+ fatal_error (input_location, "cannot read PCH file: %m");
+
+ result = host_hooks.gt_pch_use_address (mmi.preferred_base, mmi.size,
+ fileno (f), mmi.offset);
++
++ /* We could not mmap or otherwise allocate the required memory at the
++ address needed. */
+ if (result < 0)
+- fatal_error (input_location, "had to relocate PCH");
++ {
++ sorry_at (input_location, "PCH relocation is not yet supported");
++ /* There is no point in continuing from here, we will only end up
++ with a crashed (most likely hanging) compiler. */
++ exit (-1);
++ }
++
++ /* (0) We allocated memory, but did not mmap the file, so we need to read
++ the data in manually. (>0) Otherwise the mmap succeed for the address
++ we wanted. */
+ if (result == 0)
+ {
+ if (fseek (f, mmi.offset, SEEK_SET) != 0
+@@ -632,6 +691,34 @@ gt_pch_restore (FILE *f)
+ ggc_pch_read (f, mmi.preferred_base);
+
+ gt_pch_restore_stringpool ();
++
++ void (*pch_save) (FILE *);
++ unsigned num_callbacks;
++ if (fread (&pch_save, sizeof (pch_save), 1, f) != 1
++ || fread (&num_callbacks, sizeof (num_callbacks), 1, f) != 1)
++ fatal_error (input_location, "cannot read PCH file: %m");
++ if (pch_save != >_pch_save)
++ {
++ uintptr_t bias = (uintptr_t) >_pch_save - (uintptr_t) pch_save;
++ void **ptrs = XNEWVEC (void *, num_callbacks);
++ unsigned i;
++
++ if (fread (ptrs, sizeof (void *), num_callbacks, f) != num_callbacks)
++ fatal_error (input_location, "cannot read PCH file: %m");
++ for (i = 0; i < num_callbacks; ++i)
++ {
++ memcpy (&pch_save, ptrs[i], sizeof (pch_save));
++ pch_save = (void (*) (FILE *)) ((uintptr_t) pch_save + bias);
++ memcpy (ptrs[i], &pch_save, sizeof (pch_save));
++ }
++ XDELETE (ptrs);
++ }
++ else if (fseek (f, num_callbacks * sizeof (void *), SEEK_CUR) != 0)
++ fatal_error (input_location, "cannot read PCH file: %m");
++
++ /* Barring corruption of the PCH file, the restored line table should be
++ complete and usable. */
++ line_table = new_line_table;
+ }
+
+ /* Default version of HOST_HOOKS_GT_PCH_GET_ADDRESS when mmap is not present.
+diff --git a/gcc/ggc.h b/gcc/ggc.h
+index 65f6cb4d19d..3339394b547 100644
+--- a/gcc/ggc.h
++++ b/gcc/ggc.h
+@@ -46,6 +46,10 @@ typedef void (*gt_handle_reorder) (void *, void *, gt_pointer_operator,
+ /* Used by the gt_pch_n_* routines. Register an object in the hash table. */
+ extern int gt_pch_note_object (void *, void *, gt_note_pointers);
+
++/* Used by the gt_pch_p_* routines. Register address of a callback
++ pointer. */
++extern void gt_pch_note_callback (void *, void *);
++
+ /* Used by the gt_pch_n_* routines. Register that an object has a reorder
+ function. */
+ extern void gt_pch_note_reorder (void *, void *, gt_handle_reorder);
+diff --git a/gcc/output.h b/gcc/output.h
+index 2bfeed93c56..7412407c2c0 100644
+--- a/gcc/output.h
++++ b/gcc/output.h
+@@ -458,7 +458,7 @@ struct GTY(()) named_section {
+
+ /* A callback that writes the assembly code for switching to an unnamed
+ section. The argument provides callback-specific data. */
+-typedef void (*unnamed_section_callback) (const void *);
++typedef void (*unnamed_section_callback) (const char *);
+
+ /* Information about a SECTION_UNNAMED section. */
+ struct GTY(()) unnamed_section {
+@@ -466,8 +466,8 @@ struct GTY(()) unnamed_section {
+
+ /* The callback used to switch to the section, and the data that
+ should be passed to the callback. */
+- unnamed_section_callback GTY ((skip)) callback;
+- const void *GTY ((skip)) data;
++ unnamed_section_callback GTY ((callback)) callback;
++ const char *data;
+
+ /* The next entry in the chain of unnamed sections. */
+ section *next;
+@@ -491,7 +491,7 @@ struct GTY(()) noswitch_section {
+ struct section_common common;
+
+ /* The callback used to assemble decls in this section. */
+- noswitch_section_callback GTY ((skip)) callback;
++ noswitch_section_callback GTY ((callback)) callback;
+ };
+
+ /* Information about a section, which may be named or unnamed. */
+@@ -526,8 +526,8 @@ extern GTY(()) section *bss_noswitch_section;
+ extern GTY(()) section *in_section;
+ extern GTY(()) bool in_cold_section_p;
+
+-extern section *get_unnamed_section (unsigned int, void (*) (const void *),
+- const void *);
++extern section *get_unnamed_section (unsigned int, void (*) (const char *),
++ const char *);
+ extern section *get_section (const char *, unsigned int, tree,
+ bool not_existing = false);
+ extern section *get_named_section (tree, const char *, int);
+@@ -549,7 +549,7 @@ extern section *get_cdtor_priority_section (int, bool);
+
+ extern bool unlikely_text_section_p (section *);
+ extern void switch_to_section (section *, tree = nullptr);
+-extern void output_section_asm_op (const void *);
++extern void output_section_asm_op (const char *);
+
+ extern void record_tm_clone_pair (tree, tree);
+ extern void finish_tm_clone_pairs (void);
+diff --git a/gcc/tree-core.h b/gcc/tree-core.h
+index c31b8ebf249..e2fd2e67440 100644
+--- a/gcc/tree-core.h
++++ b/gcc/tree-core.h
+@@ -1927,7 +1927,7 @@ struct GTY(()) tree_function_decl {
+ struct GTY(()) tree_translation_unit_decl {
+ struct tree_decl_common common;
+ /* Source language of this translation unit. Used for DWARF output. */
+- const char * GTY((skip(""))) language;
++ const char *language;
+ /* TODO: Non-optimization used to build this translation unit. */
+ /* TODO: Root of a partial DWARF tree for global types and decls. */
+ };
+diff --git a/gcc/varasm.c b/gcc/varasm.c
+index a7ef9b8d9fe..baf9f1ba0e4 100644
+--- a/gcc/varasm.c
++++ b/gcc/varasm.c
+@@ -250,8 +250,8 @@ object_block_hasher::hash (object_block *old)
+ /* Return a new unnamed section with the given fields. */
+
+ section *
+-get_unnamed_section (unsigned int flags, void (*callback) (const void *),
+- const void *data)
++get_unnamed_section (unsigned int flags, void (*callback) (const char *),
++ const char *data)
+ {
+ section *sect;
+
+@@ -7753,9 +7753,9 @@ file_end_indicate_split_stack (void)
+ a get_unnamed_section callback. */
+
+ void
+-output_section_asm_op (const void *directive)
++output_section_asm_op (const char *directive)
+ {
+- fprintf (asm_out_file, "%s\n", (const char *) directive);
++ fprintf (asm_out_file, "%s\n", directive);
+ }
+
+ /* Emit assembly code to switch to section NEW_SECTION. Do nothing if
+diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h
+index 7d964172469..1073542681d 100644
+--- a/libcpp/include/line-map.h
++++ b/libcpp/include/line-map.h
+@@ -803,11 +803,11 @@ public:
+ unsigned int max_column_hint;
+
+ /* The allocator to use when resizing 'maps', defaults to xrealloc. */
+- line_map_realloc reallocator;
++ line_map_realloc GTY((callback)) reallocator;
+
+ /* The allocators' function used to know the actual size it
+ allocated, for a certain allocation size requested. */
+- line_map_round_alloc_size_func round_alloc_size;
++ line_map_round_alloc_size_func GTY((callback)) round_alloc_size;
+
+ struct location_adhoc_data_map location_adhoc_data_map;
+
diff --git a/SOURCES/gcc11-rh1574936.patch b/SOURCES/gcc11-rh1574936.patch
new file mode 100644
index 0000000..6b4be0c
--- /dev/null
+++ b/SOURCES/gcc11-rh1574936.patch
@@ -0,0 +1,30 @@
+crt files and statically linked libgcc objects cause false positives
+in annobin coverage, so we add the assembler flag to generate notes
+for them.
+
+The patch also adds notes to libgcc_s.so, but this is harmless because
+these notes only confer that there is no other annobin markup.
+
+2018-07-25 Florian Weimer
+
+ * Makefile.in (LIBGCC2_CFLAGS, CRTSTUFF_CFLAGS): Add
+ -Wa,--generate-missing-build-notes=yes.
+
+--- libgcc/Makefile.in 2018-01-13 13:05:41.000000000 +0100
++++ libgcc/Makefile.in 2018-07-25 13:15:02.036226940 +0200
+@@ -246,6 +246,7 @@ LIBGCC2_DEBUG_CFLAGS = -g
+ LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \
+ $(LIBGCC2_DEBUG_CFLAGS) -DIN_LIBGCC2 \
+ -fbuilding-libgcc -fno-stack-protector \
++ -Wa,--generate-missing-build-notes=yes \
+ $(INHIBIT_LIBC_CFLAGS)
+
+ # Additional options to use when compiling libgcc2.a.
+@@ -301,6 +302,7 @@ CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(IN
+ $(NO_PIE_CFLAGS) -finhibit-size-directive -fno-inline -fno-exceptions \
+ -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \
+ -fbuilding-libgcc -fno-stack-protector $(FORCE_EXPLICIT_EH_REGISTRY) \
++ -Wa,--generate-missing-build-notes=yes \
+ $(INHIBIT_LIBC_CFLAGS) $(USE_TM_CLONE_REGISTRY)
+
+ # Extra flags to use when compiling crt{begin,end}.o.
diff --git a/SOURCES/gcc11-sparc-config-detection.patch b/SOURCES/gcc11-sparc-config-detection.patch
new file mode 100644
index 0000000..bb06b35
--- /dev/null
+++ b/SOURCES/gcc11-sparc-config-detection.patch
@@ -0,0 +1,40 @@
+--- gcc/config.gcc.jj 2008-04-24 15:42:46.000000000 -0500
++++ gcc/config.gcc 2008-04-24 15:44:51.000000000 -0500
+@@ -2790,7 +2790,7 @@ sparc-*-rtems*)
+ tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/sp-elf.h sparc/rtemself.h rtems.h newlib-stdint.h"
+ tmake_file="${tmake_file} sparc/t-sparc sparc/t-rtems"
+ ;;
+-sparc-*-linux*)
++sparc-*-linux* | sparcv9-*-linux*)
+ tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h gnu-user.h linux.h glibc-stdint.h sparc/tso.h"
+ extra_options="${extra_options} sparc/long-double-switch.opt"
+ case ${target} in
+@@ -2844,7 +2844,7 @@ sparc64-*-rtems*)
+ extra_options="${extra_options}"
+ tmake_file="${tmake_file} sparc/t-sparc sparc/t-rtems-64"
+ ;;
+-sparc64-*-linux*)
++sparc64*-*-linux*)
+ tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h sparc/sysv4.h gnu-user.h linux.h glibc-stdint.h sparc/default64.h sparc/linux64.h sparc/tso.h"
+ extra_options="${extra_options} sparc/long-double-switch.opt"
+ tmake_file="${tmake_file} sparc/t-sparc sparc/t-linux64"
+--- libgcc/config.host.jj 2008-04-24 15:46:19.000000000 -0500
++++ libgcc/config.host 2008-04-24 15:46:49.000000000 -0500
+@@ -1002,7 +1002,7 @@ sparc-*-elf*)
+ tmake_file="${tmake_file} t-fdpbit t-crtfm"
+ extra_parts="$extra_parts crti.o crtn.o crtfastmath.o"
+ ;;
+-sparc-*-linux*) # SPARC's running GNU/Linux, libc6
++sparc-*-linux* | sparcv9-*-linux*) # SPARC's running GNU/Linux, libc6
+ tmake_file="${tmake_file} t-crtfm"
+ if test "${host_address}" = 64; then
+ tmake_file="$tmake_file sparc/t-linux64"
+@@ -1050,7 +1050,7 @@ sparc64-*-freebsd*|ultrasparc-*-freebsd*
+ tmake_file="$tmake_file t-crtfm"
+ extra_parts="$extra_parts crtfastmath.o"
+ ;;
+-sparc64-*-linux*) # 64-bit SPARC's running GNU/Linux
++sparc64*-*-linux*) # 64-bit SPARC's running GNU/Linux
+ extra_parts="$extra_parts crtfastmath.o"
+ tmake_file="${tmake_file} t-crtfm sparc/t-linux"
+ if test "${host_address}" = 64; then
diff --git a/SOURCES/gcc11-stringify-__VA_OPT__-2.patch b/SOURCES/gcc11-stringify-__VA_OPT__-2.patch
new file mode 100644
index 0000000..5874bc1
--- /dev/null
+++ b/SOURCES/gcc11-stringify-__VA_OPT__-2.patch
@@ -0,0 +1,197 @@
+libcpp: Fix up #__VA_OPT__ handling [PR103415]
+
+stringify_arg uses pfile->u_buff to create the string literal.
+Unfortunately, paste_tokens -> _cpp_lex_direct -> lex_number -> _cpp_unaligned_alloc
+can in some cases use pfile->u_buff too, which results in losing everything
+prepared for the string literal until the token pasting.
+
+The following patch fixes that by not calling paste_token during the
+construction of the string literal, but doing that before. All the tokens
+we are processing have been pushed into a token buffer using
+tokens_buff_add_token so it is fine if we paste some of them in that buffer
+(successful pasting creates a new token in that buffer), move following
+tokens if any to make it contiguous, pop (throw away) the extra tokens at
+the end and then do stringify_arg.
+
+Also, paste_tokens now copies over PREV_WHITE and PREV_FALLTHROUGH flags
+from the original lhs token to the replacement token. Copying that way
+the PREV_WHITE flag is needed for the #__VA_OPT__ handling and copying
+over PREV_FALLTHROUGH fixes the new Wimplicit-fallthrough-38.c test.
+
+2021-12-01 Jakub Jelinek
+
+ PR preprocessor/103415
+libcpp/
+ * macro.c (stringify_arg): Remove va_opt argument and va_opt handling.
+ (paste_tokens): On successful paste or in PREV_WHITE and
+ PREV_FALLTHROUGH flags from the *plhs token to the new token.
+ (replace_args): Adjust stringify_arg callers. For #__VA_OPT__,
+ perform token pasting in a separate loop before stringify_arg call.
+gcc/testsuite/
+ * c-c++-common/cpp/va-opt-8.c: New test.
+ * c-c++-common/Wimplicit-fallthrough-38.c: New test.
+
+--- libcpp/macro.c.jj
++++ libcpp/macro.c
+@@ -295,7 +295,7 @@ static cpp_context *next_context (cpp_re
+ static const cpp_token *padding_token (cpp_reader *, const cpp_token *);
+ static const cpp_token *new_string_token (cpp_reader *, uchar *, unsigned int);
+ static const cpp_token *stringify_arg (cpp_reader *, const cpp_token **,
+- unsigned int, bool);
++ unsigned int);
+ static void paste_all_tokens (cpp_reader *, const cpp_token *);
+ static bool paste_tokens (cpp_reader *, location_t,
+ const cpp_token **, const cpp_token *);
+@@ -826,8 +826,7 @@ cpp_quote_string (uchar *dest, const uch
+ /* Convert a token sequence FIRST to FIRST+COUNT-1 to a single string token
+ according to the rules of the ISO C #-operator. */
+ static const cpp_token *
+-stringify_arg (cpp_reader *pfile, const cpp_token **first, unsigned int count,
+- bool va_opt)
++stringify_arg (cpp_reader *pfile, const cpp_token **first, unsigned int count)
+ {
+ unsigned char *dest;
+ unsigned int i, escape_it, backslash_count = 0;
+@@ -844,24 +843,6 @@ stringify_arg (cpp_reader *pfile, const
+ {
+ const cpp_token *token = first[i];
+
+- if (va_opt && (token->flags & PASTE_LEFT))
+- {
+- location_t virt_loc = pfile->invocation_location;
+- const cpp_token *rhs;
+- do
+- {
+- if (i == count)
+- abort ();
+- rhs = first[++i];
+- if (!paste_tokens (pfile, virt_loc, &token, rhs))
+- {
+- --i;
+- break;
+- }
+- }
+- while (rhs->flags & PASTE_LEFT);
+- }
+-
+ if (token->type == CPP_PADDING)
+ {
+ if (source == NULL
+@@ -995,6 +976,7 @@ paste_tokens (cpp_reader *pfile, locatio
+ return false;
+ }
+
++ lhs->flags |= (*plhs)->flags & (PREV_WHITE | PREV_FALLTHROUGH);
+ *plhs = lhs;
+ _cpp_pop_buffer (pfile);
+ return true;
+@@ -1937,8 +1919,7 @@ replace_args (cpp_reader *pfile, cpp_has
+ if (src->flags & STRINGIFY_ARG)
+ {
+ if (!arg->stringified)
+- arg->stringified = stringify_arg (pfile, arg->first, arg->count,
+- false);
++ arg->stringified = stringify_arg (pfile, arg->first, arg->count);
+ }
+ else if ((src->flags & PASTE_LEFT)
+ || (src != macro->exp.tokens && (src[-1].flags & PASTE_LEFT)))
+@@ -2065,11 +2046,46 @@ replace_args (cpp_reader *pfile, cpp_has
+ {
+ unsigned int count
+ = start ? paste_flag - start : tokens_buff_count (buff);
+- const cpp_token *t
+- = stringify_arg (pfile,
+- start ? start + 1
+- : (const cpp_token **) (buff->base),
+- count, true);
++ const cpp_token **first
++ = start ? start + 1
++ : (const cpp_token **) (buff->base);
++ unsigned int i, j;
++
++ /* Paste any tokens that need to be pasted before calling
++ stringify_arg, because stringify_arg uses pfile->u_buff
++ which paste_tokens can use as well. */
++ for (i = 0, j = 0; i < count; i++, j++)
++ {
++ const cpp_token *token = first[i];
++
++ if (token->flags & PASTE_LEFT)
++ {
++ location_t virt_loc = pfile->invocation_location;
++ const cpp_token *rhs;
++ do
++ {
++ if (i == count)
++ abort ();
++ rhs = first[++i];
++ if (!paste_tokens (pfile, virt_loc, &token, rhs))
++ {
++ --i;
++ break;
++ }
++ }
++ while (rhs->flags & PASTE_LEFT);
++ }
++
++ first[j] = token;
++ }
++ if (j != i)
++ {
++ while (i-- != j)
++ tokens_buff_remove_last_token (buff);
++ count = j;
++ }
++
++ const cpp_token *t = stringify_arg (pfile, first, count);
+ while (count--)
+ tokens_buff_remove_last_token (buff);
+ if (src->flags & PASTE_LEFT)
+--- gcc/testsuite/c-c++-common/cpp/va-opt-8.c.jj
++++ gcc/testsuite/c-c++-common/cpp/va-opt-8.c
+@@ -0,0 +1,18 @@
++/* PR preprocessor/103415 */
++/* { dg-do run } */
++/* { dg-options "-std=gnu99" { target c } } */
++/* { dg-options "-std=c++20" { target c++ } } */
++
++#define n(x, ...) = #__VA_OPT__(x##3)
++#define o(x, ...) #__VA_OPT__(x##__VA_ARGS__##9)
++const char *c n(1 2, 4);
++const char *d = o(5 6, 7 8);
++
++int
++main ()
++{
++ if (__builtin_strcmp (c, "1 23")
++ || __builtin_strcmp (d, "5 67 89"))
++ __builtin_abort ();
++ return 0;
++}
+--- gcc/testsuite/c-c++-common/Wimplicit-fallthrough-38.c.jj
++++ gcc/testsuite/c-c++-common/Wimplicit-fallthrough-38.c
+@@ -0,0 +1,24 @@
++/* { dg-do compile } */
++/* { dg-options "-Wimplicit-fallthrough=3" } */
++
++#define FOO \
++int \
++foo (int a) \
++{ \
++ switch (a) \
++ { \
++ case 1: \
++ ++a; \
++ /* FALLTHRU */ \
++ case 2: \
++ ++a; \
++ /* FALLTHRU */ \
++ ca##se 3: \
++ ++a; \
++ default: \
++ break; \
++ } \
++ return a; \
++}
++
++FOO
diff --git a/SOURCES/gcc11-stringify-__VA_OPT__.patch b/SOURCES/gcc11-stringify-__VA_OPT__.patch
new file mode 100644
index 0000000..101b026
--- /dev/null
+++ b/SOURCES/gcc11-stringify-__VA_OPT__.patch
@@ -0,0 +1,307 @@
+c++: Add C++20 #__VA_OPT__ support
+
+The following patch implements C++20 # __VA_OPT__ (...) support.
+Testcases cover what I came up with myself and what LLVM has for #__VA_OPT__
+in its testsuite and the string literals are identical between the two
+compilers on the va-opt-5.c testcase.
+
+2021-08-17 Jakub Jelinek
+
+libcpp/
+ * macro.c (vaopt_state): Add m_stringify member.
+ (vaopt_state::vaopt_state): Initialize it.
+ (vaopt_state::update): Overwrite it.
+ (vaopt_state::stringify): New method.
+ (stringify_arg): Replace arg argument with first, count arguments
+ and add va_opt argument. Use first instead of arg->first and
+ count instead of arg->count, for va_opt add paste_tokens handling.
+ (paste_tokens): Fix up len calculation. Don't spell rhs twice,
+ instead use %.*s to supply lhs and rhs spelling lengths. Don't call
+ _cpp_backup_tokens here.
+ (paste_all_tokens): Call it here instead.
+ (replace_args): Adjust stringify_arg caller. For vaopt_state::END
+ if stringify is true handle __VA_OPT__ stringification.
+ (create_iso_definition): Handle # __VA_OPT__ similarly to # macro_arg.
+gcc/testsuite/
+ * c-c++-common/cpp/va-opt-5.c: New test.
+ * c-c++-common/cpp/va-opt-6.c: New test.
+
+--- libcpp/macro.c
++++ libcpp/macro.c
+@@ -118,6 +118,7 @@ class vaopt_state {
+ m_arg (arg),
+ m_variadic (is_variadic),
+ m_last_was_paste (false),
++ m_stringify (false),
+ m_state (0),
+ m_paste_location (0),
+ m_location (0),
+@@ -145,6 +146,7 @@ class vaopt_state {
+ }
+ ++m_state;
+ m_location = token->src_loc;
++ m_stringify = (token->flags & STRINGIFY_ARG) != 0;
+ return BEGIN;
+ }
+ else if (m_state == 1)
+@@ -234,6 +236,12 @@ class vaopt_state {
+ return m_state == 0;
+ }
+
++ /* Return true for # __VA_OPT__. */
++ bool stringify () const
++ {
++ return m_stringify;
++ }
++
+ private:
+
+ /* The cpp_reader. */
+@@ -247,6 +255,8 @@ class vaopt_state {
+ /* If true, the previous token was ##. This is used to detect when
+ a paste occurs at the end of the sequence. */
+ bool m_last_was_paste;
++ /* True for #__VA_OPT__. */
++ bool m_stringify;
+
+ /* The state variable:
+ 0 means not parsing
+@@ -284,7 +294,8 @@ static _cpp_buff *collect_args (cpp_read
+ static cpp_context *next_context (cpp_reader *);
+ static const cpp_token *padding_token (cpp_reader *, const cpp_token *);
+ static const cpp_token *new_string_token (cpp_reader *, uchar *, unsigned int);
+-static const cpp_token *stringify_arg (cpp_reader *, macro_arg *);
++static const cpp_token *stringify_arg (cpp_reader *, const cpp_token **,
++ unsigned int, bool);
+ static void paste_all_tokens (cpp_reader *, const cpp_token *);
+ static bool paste_tokens (cpp_reader *, location_t,
+ const cpp_token **, const cpp_token *);
+@@ -812,10 +823,11 @@ cpp_quote_string (uchar *dest, const uch
+ return dest;
+ }
+
+-/* Convert a token sequence ARG to a single string token according to
+- the rules of the ISO C #-operator. */
++/* Convert a token sequence FIRST to FIRST+COUNT-1 to a single string token
++ according to the rules of the ISO C #-operator. */
+ static const cpp_token *
+-stringify_arg (cpp_reader *pfile, macro_arg *arg)
++stringify_arg (cpp_reader *pfile, const cpp_token **first, unsigned int count,
++ bool va_opt)
+ {
+ unsigned char *dest;
+ unsigned int i, escape_it, backslash_count = 0;
+@@ -828,9 +840,27 @@ stringify_arg (cpp_reader *pfile, macro_
+ *dest++ = '"';
+
+ /* Loop, reading in the argument's tokens. */
+- for (i = 0; i < arg->count; i++)
++ for (i = 0; i < count; i++)
+ {
+- const cpp_token *token = arg->first[i];
++ const cpp_token *token = first[i];
++
++ if (va_opt && (token->flags & PASTE_LEFT))
++ {
++ location_t virt_loc = pfile->invocation_location;
++ const cpp_token *rhs;
++ do
++ {
++ if (i == count)
++ abort ();
++ rhs = first[++i];
++ if (!paste_tokens (pfile, virt_loc, &token, rhs))
++ {
++ --i;
++ break;
++ }
++ }
++ while (rhs->flags & PASTE_LEFT);
++ }
+
+ if (token->type == CPP_PADDING)
+ {
+@@ -917,7 +947,7 @@ paste_tokens (cpp_reader *pfile, locatio
+ cpp_token *lhs;
+ unsigned int len;
+
+- len = cpp_token_len (*plhs) + cpp_token_len (rhs) + 1;
++ len = cpp_token_len (*plhs) + cpp_token_len (rhs) + 2;
+ buf = (unsigned char *) alloca (len);
+ end = lhsend = cpp_spell_token (pfile, *plhs, buf, true);
+
+@@ -943,8 +973,10 @@ paste_tokens (cpp_reader *pfile, locatio
+ location_t saved_loc = lhs->src_loc;
+
+ _cpp_pop_buffer (pfile);
+- _cpp_backup_tokens (pfile, 1);
+- *lhsend = '\0';
++
++ unsigned char *rhsstart = lhsend;
++ if ((*plhs)->type == CPP_DIV && rhs->type != CPP_EQ)
++ rhsstart++;
+
+ /* We have to remove the PASTE_LEFT flag from the old lhs, but
+ we want to keep the new location. */
+@@ -956,8 +988,10 @@ paste_tokens (cpp_reader *pfile, locatio
+ /* Mandatory error for all apart from assembler. */
+ if (CPP_OPTION (pfile, lang) != CLK_ASM)
+ cpp_error_with_line (pfile, CPP_DL_ERROR, location, 0,
+- "pasting \"%s\" and \"%s\" does not give a valid preprocessing token",
+- buf, cpp_token_as_text (pfile, rhs));
++ "pasting \"%.*s\" and \"%.*s\" does not give "
++ "a valid preprocessing token",
++ (int) (lhsend - buf), buf,
++ (int) (end - rhsstart), rhsstart);
+ return false;
+ }
+
+@@ -1033,7 +1067,10 @@ paste_all_tokens (cpp_reader *pfile, con
+ abort ();
+ }
+ if (!paste_tokens (pfile, virt_loc, &lhs, rhs))
+- break;
++ {
++ _cpp_backup_tokens (pfile, 1);
++ break;
++ }
+ }
+ while (rhs->flags & PASTE_LEFT);
+
+@@ -1900,7 +1937,8 @@ replace_args (cpp_reader *pfile, cpp_has
+ if (src->flags & STRINGIFY_ARG)
+ {
+ if (!arg->stringified)
+- arg->stringified = stringify_arg (pfile, arg);
++ arg->stringified = stringify_arg (pfile, arg->first, arg->count,
++ false);
+ }
+ else if ((src->flags & PASTE_LEFT)
+ || (src != macro->exp.tokens && (src[-1].flags & PASTE_LEFT)))
+@@ -2023,6 +2061,24 @@ replace_args (cpp_reader *pfile, cpp_has
+ paste_flag = tokens_buff_last_token_ptr (buff);
+ }
+
++ if (vaopt_tracker.stringify ())
++ {
++ unsigned int count
++ = start ? paste_flag - start : tokens_buff_count (buff);
++ const cpp_token *t
++ = stringify_arg (pfile,
++ start ? start + 1
++ : (const cpp_token **) (buff->base),
++ count, true);
++ while (count--)
++ tokens_buff_remove_last_token (buff);
++ if (src->flags & PASTE_LEFT)
++ copy_paste_flag (pfile, &t, src);
++ tokens_buff_add_token (buff, virt_locs,
++ t, t->src_loc, t->src_loc,
++ NULL, 0);
++ continue;
++ }
+ if (start && paste_flag == start && (*start)->flags & PASTE_LEFT)
+ /* If __VA_OPT__ expands to nothing (either because __VA_ARGS__
+ is empty or because it is __VA_OPT__() ), drop PASTE_LEFT
+@@ -3584,7 +3640,10 @@ create_iso_definition (cpp_reader *pfile
+ function-like macros when lexing the subsequent token. */
+ if (macro->count > 1 && token[-1].type == CPP_HASH && macro->fun_like)
+ {
+- if (token->type == CPP_MACRO_ARG)
++ if (token->type == CPP_MACRO_ARG
++ || (macro->variadic
++ && token->type == CPP_NAME
++ && token->val.node.node == pfile->spec_nodes.n__VA_OPT__))
+ {
+ if (token->flags & PREV_WHITE)
+ token->flags |= SP_PREV_WHITE;
+--- gcc/testsuite/c-c++-common/cpp/va-opt-5.c
++++ gcc/testsuite/c-c++-common/cpp/va-opt-5.c
+@@ -0,0 +1,67 @@
++/* { dg-do run } */
++/* { dg-options "-std=gnu99" { target c } } */
++/* { dg-options "-std=c++20" { target c++ } } */
++
++#define lparen (
++#define a0 fooa0
++#define a1 fooa1 a0
++#define a2 fooa2 a1
++#define a3 fooa3 a2
++#define a() b lparen )
++#define b() c lparen )
++#define c() d lparen )
++#define g h
++#define i(j) j
++#define f(...) #__VA_OPT__(g i(0))
++#define k(x,...) # __VA_OPT__(x) #x #__VA_OPT__(__VA_ARGS__)
++#define l(x,...) #__VA_OPT__(a1 x)
++#define m(x,...) "a()" #__VA_OPT__(a3 __VA_ARGS__ x ## __VA_ARGS__ ## x ## c a3) "a()"
++#define n(x,...) = #__VA_OPT__(a3 __VA_ARGS__ x ## __VA_ARGS__ ## x ## c a3) #x #__VA_OPT__(a0 __VA_ARGS__ x ## __VA_ARGS__ ## x ## c a0) ;
++#define o(x, ...) #__VA_OPT__(x##x x##x)
++#define p(x, ...) #__VA_OPT__(_Pragma ("foobar"))
++#define q(...) #__VA_OPT__(/* foo */x/* bar */)
++const char *v1 = f();
++const char *v2 = f(123);
++const char *v3 = k(1);
++const char *v4 = k(1, 2, 3 );
++const char *v5 = l(a());
++const char *v6 = l(a1 a(), 1);
++const char *v7 = m();
++const char *v8 = m(,);
++const char *v9 = m(,a3);
++const char *v10 = m(a3,a(),a0);
++const char *v11 n()
++const char *v12 n(,)
++const char *v13 n(,a0)
++const char *v14 n(a0, a(),a0)
++const char *v15 = o(, 0);
++const char *v16 = p(0);
++const char *v17 = p(0, 1);
++const char *v18 = q();
++const char *v19 = q(1);
++
++int
++main ()
++{
++ if (__builtin_strcmp (v1, "")
++ || __builtin_strcmp (v2, "g i(0)")
++ || __builtin_strcmp (v3, "1")
++ || __builtin_strcmp (v4, "112, 3")
++ || __builtin_strcmp (v5, "")
++ || __builtin_strcmp (v6, "a1 fooa1 fooa0 b ( )")
++ || __builtin_strcmp (v7, "a()a()")
++ || __builtin_strcmp (v8, "a()a()")
++ || __builtin_strcmp (v9, "a()a3 fooa3 fooa2 fooa1 fooa0 a3c a3a()")
++ || __builtin_strcmp (v10, "a()a3 b ( ),fooa0 a3a(),a0a3c a3a()")
++ || __builtin_strcmp (v11, "")
++ || __builtin_strcmp (v12, "")
++ || __builtin_strcmp (v13, "a3 fooa0 a0c a3a0 fooa0 a0c a0")
++ || __builtin_strcmp (v14, "a3 b ( ),fooa0 a0a(),a0a0c a3a0a0 b ( ),fooa0 a0a(),a0a0c a0")
++ || __builtin_strcmp (v15, "")
++ || __builtin_strcmp (v16, "")
++ || __builtin_strcmp (v17, "_Pragma (\"foobar\")")
++ || __builtin_strcmp (v18, "")
++ || __builtin_strcmp (v19, "x"))
++ __builtin_abort ();
++ return 0;
++}
+--- gcc/testsuite/c-c++-common/cpp/va-opt-6.c
++++ gcc/testsuite/c-c++-common/cpp/va-opt-6.c
+@@ -0,0 +1,17 @@
++/* { dg-do preprocess } */
++/* { dg-options "-std=gnu99" { target c } } */
++/* { dg-options "-std=c++20" { target c++ } } */
++
++#define a ""
++#define b(...) a ## #__VA_OPT__(1) /* { dg-error "pasting \"a\" and \"\"\"\" does not give a valid preprocessing token" } */
++#define c(...) a ## #__VA_OPT__(1) /* { dg-error "pasting \"a\" and \"\"1\"\" does not give a valid preprocessing token" } */
++#define d(...) #__VA_OPT__(1) ## !
++#define e(...) #__VA_OPT__(1) ## !
++#define f(...) #__VA_OPT__(. ## !)
++#define g(...) #__VA_OPT__(. ## !)
++b()
++c(1)
++d( ) /* { dg-error "pasting \"\"\"\" and \"!\" does not give a valid preprocessing token" } */
++e( 1 ) /* { dg-error "pasting \"\"1\"\" and \"!\" does not give a valid preprocessing token" } */
++f()
++g(0) /* { dg-error "pasting \".\" and \"!\" does not give a valid preprocessing token" } */
diff --git a/SPECS/gcc.spec b/SPECS/gcc.spec
new file mode 100644
index 0000000..4fdcde7
--- /dev/null
+++ b/SPECS/gcc.spec
@@ -0,0 +1,3958 @@
+%global DATE 20220127
+%global gitrev 2fa6e5c54e782377faa4c9c1f0e0b16db27f266c
+%global gcc_version 11.2.1
+%global gcc_major 11
+# Note, gcc_release must be integer, if you want to add suffixes to
+# %%{release}, append them after %%{gcc_release} on Release: line.
+%global gcc_release 9
+%global nvptx_tools_gitrev 5f6f343a302d620b0868edab376c00b15741e39e
+%global newlib_cygwin_gitrev 50e2a63b04bdd018484605fbb954fd1bd5147fa0
+%global _unpackaged_files_terminate_build 0
+%if 0%{?fedora} > 27 || 0%{?rhel} > 7
+# Until annobin is fixed (#1519165).
+%undefine _annotated_build
+%endif
+# Strip will fail on nvptx-none *.a archives and the brp-* scripts will
+# fail randomly depending on what is stripped last.
+%if 0%{?__brp_strip_static_archive:1}
+%global __brp_strip_static_archive %{__brp_strip_static_archive} || :
+%endif
+%if 0%{?__brp_strip_lto:1}
+%global __brp_strip_lto %{__brp_strip_lto} || :
+%endif
+%if 0%{?fedora} < 32 && 0%{?rhel} < 8
+%global multilib_64_archs sparc64 ppc64 ppc64p7 s390x x86_64
+%else
+%global multilib_64_archs sparc64 ppc64 ppc64p7 x86_64
+%endif
+%if 0%{?rhel} > 7
+%global build_ada 0
+%global build_objc 0
+%global build_go 0
+%global build_d 0
+%else
+%ifarch %{ix86} x86_64 ia64 ppc %{power64} alpha s390x %{arm} aarch64 riscv64
+%global build_ada 1
+%else
+%global build_ada 0
+%endif
+%global build_objc 1
+%ifarch %{ix86} x86_64 ppc ppc64 ppc64le ppc64p7 s390 s390x %{arm} aarch64 %{mips} riscv64
+%global build_go 1
+%else
+%global build_go 0
+%endif
+%ifarch %{ix86} x86_64 %{arm} %{mips} s390 s390x riscv64
+%global build_d 1
+%else
+%global build_d 0
+%endif
+%endif
+%ifarch %{ix86} x86_64 ia64 ppc64le
+%global build_libquadmath 1
+%else
+%global build_libquadmath 0
+%endif
+%ifarch %{ix86} x86_64 ppc ppc64 ppc64le ppc64p7 s390 s390x %{arm} aarch64
+%global build_libasan 1
+%else
+%global build_libasan 0
+%endif
+%ifarch x86_64 ppc64 ppc64le aarch64
+%global build_libtsan 1
+%else
+%global build_libtsan 0
+%endif
+%ifarch x86_64 ppc64 ppc64le aarch64
+%global build_liblsan 1
+%else
+%global build_liblsan 0
+%endif
+%ifarch %{ix86} x86_64 ppc ppc64 ppc64le ppc64p7 s390 s390x %{arm} aarch64
+%global build_libubsan 1
+%else
+%global build_libubsan 0
+%endif
+%ifarch %{ix86} x86_64 ppc ppc64 ppc64le ppc64p7 s390 s390x %{arm} aarch64 %{mips} riscv64
+%global build_libatomic 1
+%else
+%global build_libatomic 0
+%endif
+%ifarch %{ix86} x86_64 %{arm} alpha ppc ppc64 ppc64le ppc64p7 s390 s390x aarch64
+%global build_libitm 1
+%else
+%global build_libitm 0
+%endif
+%if 0%{?rhel} > 8
+%global build_isl 0
+%else
+%global build_isl 1
+%endif
+%global build_libstdcxx_docs 1
+%ifarch %{ix86} x86_64 ppc ppc64 ppc64le ppc64p7 s390 s390x %{arm} aarch64 %{mips}
+%global attr_ifunc 1
+%else
+%global attr_ifunc 0
+%endif
+%ifarch x86_64 ppc64le
+%global build_offload_nvptx 1
+%else
+%global build_offload_nvptx 0
+%endif
+%if 0%{?fedora} < 32 && 0%{?rhel} < 8
+%ifarch s390x
+%global multilib_32_arch s390
+%endif
+%endif
+%ifarch sparc64
+%global multilib_32_arch sparcv9
+%endif
+%ifarch ppc64 ppc64p7
+%global multilib_32_arch ppc
+%endif
+%ifarch x86_64
+%global multilib_32_arch i686
+%endif
+Summary: Various compilers (C, C++, Objective-C, ...)
+Name: gcc
+Version: %{gcc_version}
+Release: %{gcc_release}.4%{?dist}
+# libgcc, libgfortran, libgomp, libstdc++ and crtstuff have
+# GCC Runtime Exception.
+License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
+# The source for this package was pulled from upstream's vcs.
+# %%{gitrev} is some commit from the
+# https://gcc.gnu.org/git/?p=gcc.git;h=refs/vendors/redhat/heads/gcc-%%{gcc_major}-branch
+# branch. Use the following commands to generate the tarball:
+# git clone --depth 1 git://gcc.gnu.org/git/gcc.git gcc-dir.tmp
+# git --git-dir=gcc-dir.tmp/.git fetch --depth 1 origin %%{gitrev}
+# git --git-dir=gcc-dir.tmp/.git archive --prefix=%%{name}-%%{version}-%%{DATE}/ %%{gitrev} | xz -9e > %%{name}-%%{version}-%%{DATE}.tar.xz
+# rm -rf gcc-dir.tmp
+Source0: gcc-%{version}-%{DATE}.tar.xz
+# The source for nvptx-tools package was pulled from upstream's vcs. Use the
+# following commands to generate the tarball:
+# git clone --depth 1 git://github.com/MentorEmbedded/nvptx-tools.git nvptx-tools-dir.tmp
+# git --git-dir=nvptx-tools-dir.tmp/.git fetch --depth 1 origin %%{nvptx_tools_gitrev}
+# git --git-dir=nvptx-tools-dir.tmp/.git archive --prefix=nvptx-tools-%%{nvptx_tools_gitrev}/ %%{nvptx_tools_gitrev} | xz -9e > nvptx-tools-%%{nvptx_tools_gitrev}.tar.xz
+# rm -rf nvptx-tools-dir.tmp
+Source1: nvptx-tools-%{nvptx_tools_gitrev}.tar.xz
+# The source for nvptx-newlib package was pulled from upstream's vcs. Use the
+# following commands to generate the tarball:
+# git clone git://sourceware.org/git/newlib-cygwin.git newlib-cygwin-dir.tmp
+# git --git-dir=newlib-cygwin-dir.tmp/.git archive --prefix=newlib-cygwin-%%{newlib_cygwin_gitrev}/ %%{newlib_cygwin_gitrev} ":(exclude)newlib/libc/sys/linux/include/rpc/*.[hx]" | xz -9e > newlib-cygwin-%%{newlib_cygwin_gitrev}.tar.xz
+# rm -rf newlib-cygwin-dir.tmp
+Source2: newlib-cygwin-%{newlib_cygwin_gitrev}.tar.xz
+%global isl_version 0.18
+Source3: https://gcc.gnu.org/pub/gcc/infrastructure/isl-%{isl_version}.tar.bz2
+URL: http://gcc.gnu.org
+# Need binutils with -pie support >= 2.14.90.0.4-4
+# Need binutils which can omit dot symbols and overlap .opd on ppc64 >= 2.15.91.0.2-4
+# Need binutils which handle -msecure-plt on ppc >= 2.16.91.0.2-2
+# Need binutils which support .weakref >= 2.16.91.0.3-1
+# Need binutils which support --hash-style=gnu >= 2.17.50.0.2-7
+# Need binutils which support mffgpr and mftgpr >= 2.17.50.0.2-8
+# Need binutils which support --build-id >= 2.17.50.0.17-3
+# Need binutils which support %%gnu_unique_object >= 2.19.51.0.14
+# Need binutils which support .cfi_sections >= 2.19.51.0.14-33
+# Need binutils which support --no-add-needed >= 2.20.51.0.2-12
+# Need binutils which support -plugin
+# Need binutils which support .loc view >= 2.30
+# Need binutils which support --generate-missing-build-notes=yes >= 2.31
+%if 0%{?fedora} >= 29 || 0%{?rhel} > 7
+BuildRequires: binutils >= 2.31
+%else
+BuildRequires: binutils >= 2.24
+%endif
+# While gcc doesn't include statically linked binaries, during testing
+# -static is used several times.
+BuildRequires: glibc-static
+BuildRequires: zlib-devel, gettext, dejagnu, bison, flex, sharutils
+BuildRequires: texinfo, texinfo-tex, /usr/bin/pod2man
+BuildRequires: systemtap-sdt-devel >= 1.3
+BuildRequires: gmp-devel >= 4.1.2-8, mpfr-devel >= 3.1.0, libmpc-devel >= 0.8.1
+BuildRequires: python3-devel, /usr/bin/python
+BuildRequires: gcc, gcc-c++, make
+%if %{build_go}
+BuildRequires: hostname, procps
+%endif
+# For VTA guality testing
+BuildRequires: gdb
+# Make sure pthread.h doesn't contain __thread tokens
+# Make sure glibc supports stack protector
+# Make sure glibc supports DT_GNU_HASH
+BuildRequires: glibc-devel >= 2.4.90-13
+BuildRequires: elfutils-devel >= 0.147
+BuildRequires: elfutils-libelf-devel >= 0.147
+BuildRequires: libzstd-devel
+%ifarch ppc ppc64 ppc64le ppc64p7 s390 s390x sparc sparcv9 alpha
+# Make sure glibc supports TFmode long double
+BuildRequires: glibc >= 2.3.90-35
+%endif
+%ifarch %{multilib_64_archs} sparcv9 ppc
+# Ensure glibc{,-devel} is installed for both multilib arches
+BuildRequires: /lib/libc.so.6 /usr/lib/libc.so /lib64/libc.so.6 /usr/lib64/libc.so
+%endif
+%if %{build_ada}
+# Ada requires Ada to build
+BuildRequires: gcc-gnat >= 3.1, libgnat >= 3.1
+%endif
+%ifarch ia64
+BuildRequires: libunwind >= 0.98
+%endif
+%if %{build_libstdcxx_docs}
+BuildRequires: doxygen >= 1.7.1
+BuildRequires: graphviz, dblatex, texlive-collection-latex, docbook5-style-xsl
+%endif
+Requires: cpp = %{version}-%{release}
+# Need .eh_frame ld optimizations
+# Need proper visibility support
+# Need -pie support
+# Need --as-needed/--no-as-needed support
+# On ppc64, need omit dot symbols support and --non-overlapping-opd
+# Need binutils that owns /usr/bin/c++filt
+# Need binutils that support .weakref
+# Need binutils that supports --hash-style=gnu
+# Need binutils that support mffgpr/mftgpr
+# Need binutils that support --build-id
+# Need binutils that support %%gnu_unique_object
+# Need binutils that support .cfi_sections
+# Need binutils that support --no-add-needed
+# Need binutils that support -plugin
+# Need binutils that support .loc view >= 2.30
+# Need binutils which support --generate-missing-build-notes=yes >= 2.31
+%if 0%{?fedora} >= 29 || 0%{?rhel} > 7
+Requires: binutils >= 2.31
+%else
+Requires: binutils >= 2.24
+%endif
+# Make sure gdb will understand DW_FORM_strp
+Conflicts: gdb < 5.1-2
+Requires: glibc-devel >= 2.2.90-12
+%ifarch ppc ppc64 ppc64le ppc64p7 s390 s390x sparc sparcv9 alpha
+# Make sure glibc supports TFmode long double
+Requires: glibc >= 2.3.90-35
+%endif
+%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
+%ifarch %{arm}
+Requires: glibc >= 2.16
+%endif
+%endif
+Requires: libgcc >= %{version}-%{release}
+Requires: libgomp = %{version}-%{release}
+# lto-wrapper invokes make
+Requires: make
+%if !%{build_ada}
+Obsoletes: gcc-gnat < %{version}-%{release}
+%endif
+Obsoletes: gcc-java < %{version}-%{release}
+AutoReq: true
+Provides: bundled(libiberty)
+Provides: bundled(libbacktrace)
+Provides: bundled(libffi)
+Provides: gcc(major) = %{gcc_major}
+
+Patch0: gcc11-hack.patch
+Patch2: gcc11-sparc-config-detection.patch
+Patch3: gcc11-libgomp-omp_h-multilib.patch
+Patch4: gcc11-libtool-no-rpath.patch
+Patch5: gcc11-isl-dl.patch
+Patch6: gcc11-isl-dl2.patch
+Patch7: gcc11-libstdc++-docs.patch
+Patch8: gcc11-no-add-needed.patch
+Patch9: gcc11-foffload-default.patch
+Patch10: gcc11-Wno-format-security.patch
+Patch11: gcc11-rh1574936.patch
+Patch12: gcc11-d-shared-libphobos.patch
+Patch14: gcc11-libgcc-link.patch
+Patch15: gcc11-pr101786.patch
+Patch16: gcc11-stringify-__VA_OPT__.patch
+Patch17: gcc11-stringify-__VA_OPT__-2.patch
+Patch18: gcc11-Wbidi-chars.patch
+Patch19: gcc11-dg-ice-fixes.patch
+Patch20: gcc11-relocatable-pch.patch
+Patch21: gcc11-dejagnu-multiline.patch
+Patch22: gcc11-libsanitizer-pthread.patch
+Patch23: gcc11-pie.patch
+Patch24: gcc11-bind-now.patch
+
+Patch100: gcc11-fortran-fdec-duplicates.patch
+Patch101: gcc11-fortran-flogical-as-integer.patch
+Patch102: gcc11-fortran-fdec-ichar.patch
+Patch103: gcc11-fortran-fdec-non-integer-index.patch
+Patch104: gcc11-fortran-fdec-old-init.patch
+Patch105: gcc11-fortran-fdec-override-kind.patch
+Patch106: gcc11-fortran-fdec-non-logical-if.patch
+Patch107: gcc11-fortran-fdec-promotion.patch
+Patch108: gcc11-fortran-fdec-sequence.patch
+Patch109: gcc11-fortran-fdec-add-missing-indexes.patch
+
+# On ARM EABI systems, we do want -gnueabi to be part of the
+# target triple.
+%ifnarch %{arm}
+%global _gnu %{nil}
+%else
+%global _gnu -gnueabi
+%endif
+%ifarch sparcv9
+%global gcc_target_platform sparc64-%{_vendor}-%{_target_os}
+%endif
+%ifarch ppc ppc64p7
+%global gcc_target_platform ppc64-%{_vendor}-%{_target_os}
+%endif
+%ifnarch sparcv9 ppc ppc64p7
+%global gcc_target_platform %{_target_platform}
+%endif
+
+%if %{build_go}
+# Avoid stripping these libraries and binaries.
+%global __os_install_post \
+chmod 644 %{buildroot}%{_prefix}/%{_lib}/libgo.so.19.* \
+chmod 644 %{buildroot}%{_prefix}/bin/go.gcc \
+chmod 644 %{buildroot}%{_prefix}/bin/gofmt.gcc \
+chmod 644 %{buildroot}%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/cgo \
+chmod 644 %{buildroot}%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/buildid \
+chmod 644 %{buildroot}%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/test2json \
+chmod 644 %{buildroot}%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/vet \
+%__os_install_post \
+chmod 755 %{buildroot}%{_prefix}/%{_lib}/libgo.so.19.* \
+chmod 755 %{buildroot}%{_prefix}/bin/go.gcc \
+chmod 755 %{buildroot}%{_prefix}/bin/gofmt.gcc \
+chmod 755 %{buildroot}%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/cgo \
+chmod 755 %{buildroot}%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/buildid \
+chmod 755 %{buildroot}%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/test2json \
+chmod 755 %{buildroot}%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/vet \
+%{nil}
+%endif
+
+%description
+The gcc package contains the GNU Compiler Collection version 11.
+You'll need this package in order to compile C code.
+
+%package -n libgcc
+Summary: GCC version 11 shared support library
+Autoreq: false
+%if !%{build_ada}
+Obsoletes: libgnat < %{version}-%{release}
+%endif
+Obsoletes: libmudflap
+Obsoletes: libmudflap-devel
+Obsoletes: libmudflap-static
+Obsoletes: libgcj < %{version}-%{release}
+Obsoletes: libgcj-devel < %{version}-%{release}
+Obsoletes: libgcj-src < %{version}-%{release}
+%ifarch %{ix86} x86_64
+Obsoletes: libcilkrts
+Obsoletes: libcilkrts-static
+Obsoletes: libmpx
+Obsoletes: libmpx-static
+%endif
+
+%description -n libgcc
+This package contains GCC shared support library which is needed
+e.g. for exception handling support.
+
+%package c++
+Summary: C++ support for GCC
+Requires: gcc = %{version}-%{release}
+Requires: libstdc++ = %{version}-%{release}
+Requires: libstdc++-devel = %{version}-%{release}
+Provides: gcc-g++ = %{version}-%{release}
+Provides: g++ = %{version}-%{release}
+Autoreq: true
+
+%description c++
+This package adds C++ support to the GNU Compiler Collection.
+It includes support for most of the current C++ specification,
+including templates and exception handling.
+
+%package -n libstdc++
+Summary: GNU Standard C++ Library
+Autoreq: true
+Requires: glibc >= 2.10.90-7
+
+%description -n libstdc++
+The libstdc++ package contains a rewritten standard compliant GCC Standard
+C++ Library.
+
+%package -n libstdc++-devel
+Summary: Header files and libraries for C++ development
+Requires: libstdc++%{?_isa} = %{version}-%{release}
+Autoreq: true
+
+%description -n libstdc++-devel
+This is the GNU implementation of the standard C++ libraries. This
+package includes the header files and libraries needed for C++
+development. This includes rewritten implementation of STL.
+
+%package -n libstdc++-static
+Summary: Static libraries for the GNU standard C++ library
+Requires: libstdc++-devel = %{version}-%{release}
+Autoreq: true
+
+%description -n libstdc++-static
+Static libraries for the GNU standard C++ library.
+
+%package -n libstdc++-docs
+Summary: Documentation for the GNU standard C++ library
+Autoreq: true
+
+%description -n libstdc++-docs
+Manual, doxygen generated API information and Frequently Asked Questions
+for the GNU standard C++ library.
+
+%package objc
+Summary: Objective-C support for GCC
+Requires: gcc = %{version}-%{release}
+Requires: libobjc = %{version}-%{release}
+Autoreq: true
+
+%description objc
+gcc-objc provides Objective-C support for the GCC.
+Mainly used on systems running NeXTSTEP, Objective-C is an
+object-oriented derivative of the C language.
+
+%package objc++
+Summary: Objective-C++ support for GCC
+Requires: gcc-c++ = %{version}-%{release}, gcc-objc = %{version}-%{release}
+Autoreq: true
+
+%description objc++
+gcc-objc++ package provides Objective-C++ support for the GCC.
+
+%package -n libobjc
+Summary: Objective-C runtime
+Autoreq: true
+
+%description -n libobjc
+This package contains Objective-C shared library which is needed to run
+Objective-C dynamically linked programs.
+
+%package gfortran
+Summary: Fortran support
+Requires: gcc = %{version}-%{release}
+Requires: libgfortran = %{version}-%{release}
+%if %{build_libquadmath}
+Requires: libquadmath = %{version}-%{release}
+Requires: libquadmath-devel = %{version}-%{release}
+%endif
+Provides: gcc-fortran = %{version}-%{release}
+Provides: gfortran = %{version}-%{release}
+Autoreq: true
+
+%description gfortran
+The gcc-gfortran package provides support for compiling Fortran
+programs with the GNU Compiler Collection.
+
+%package -n libgfortran
+Summary: Fortran runtime
+Autoreq: true
+%if %{build_libquadmath}
+Requires: libquadmath = %{version}-%{release}
+%endif
+
+%description -n libgfortran
+This package contains Fortran shared library which is needed to run
+Fortran dynamically linked programs.
+
+%package -n libgfortran-static
+Summary: Static Fortran libraries
+Requires: libgfortran = %{version}-%{release}
+Requires: gcc = %{version}-%{release}
+%if %{build_libquadmath}
+Requires: libquadmath-static = %{version}-%{release}
+%endif
+
+%description -n libgfortran-static
+This package contains static Fortran libraries.
+
+%package gdc
+Summary: D support
+Requires: gcc = %{version}-%{release}
+Requires: libgphobos = %{version}-%{release}
+Provides: gcc-d = %{version}-%{release}
+Provides: gdc = %{version}-%{release}
+Autoreq: true
+
+%description gdc
+The gcc-gdc package provides support for compiling D
+programs with the GNU Compiler Collection.
+
+%package -n libgphobos
+Summary: D runtime
+Autoreq: true
+
+%description -n libgphobos
+This package contains D shared library which is needed to run
+D dynamically linked programs.
+
+%package -n libgphobos-static
+Summary: Static D libraries
+Requires: libgphobos = %{version}-%{release}
+Requires: gcc-gdc = %{version}-%{release}
+
+%description -n libgphobos-static
+This package contains static D libraries.
+
+%package -n libgomp
+Summary: GCC OpenMP v4.5 shared support library
+
+%description -n libgomp
+This package contains GCC shared support library which is needed
+for OpenMP v4.5 support.
+
+%package -n libgomp-offload-nvptx
+Summary: GCC OpenMP v4.5 plugin for offloading to NVPTX
+Requires: libgomp = %{version}-%{release}
+
+%description -n libgomp-offload-nvptx
+This package contains libgomp plugin for offloading to NVidia
+PTX. The plugin needs libcuda.so.1 shared library that has to be
+installed separately.
+
+%package gdb-plugin
+Summary: GCC plugin for GDB
+Requires: gcc = %{version}-%{release}
+
+%description gdb-plugin
+This package contains GCC plugin for GDB C expression evaluation.
+
+%package -n libgccjit
+Summary: Library for embedding GCC inside programs and libraries
+Requires: gcc = %{version}-%{release}
+
+%description -n libgccjit
+This package contains shared library with GCC JIT front-end.
+
+%package -n libgccjit-devel
+Summary: Support for embedding GCC inside programs and libraries
+%if 0%{?fedora} > 27 || 0%{?rhel} > 7
+BuildRequires: python3-sphinx
+%else
+BuildRequires: python-sphinx
+%endif
+Requires: libgccjit = %{version}-%{release}
+
+%description -n libgccjit-devel
+This package contains header files and documentation for GCC JIT front-end.
+
+%package -n libquadmath
+Summary: GCC __float128 shared support library
+
+%description -n libquadmath
+This package contains GCC shared support library which is needed
+for __float128 math support and for Fortran REAL*16 support.
+
+%package -n libquadmath-devel
+Summary: GCC __float128 support
+Requires: libquadmath = %{version}-%{release}
+Requires: gcc = %{version}-%{release}
+
+%description -n libquadmath-devel
+This package contains headers for building Fortran programs using
+REAL*16 and programs using __float128 math.
+
+%package -n libquadmath-static
+Summary: Static libraries for __float128 support
+Requires: libquadmath-devel = %{version}-%{release}
+
+%description -n libquadmath-static
+This package contains static libraries for building Fortran programs
+using REAL*16 and programs using __float128 math.
+
+%package -n libitm
+Summary: The GNU Transactional Memory library
+
+%description -n libitm
+This package contains the GNU Transactional Memory library
+which is a GCC transactional memory support runtime library.
+
+%package -n libitm-devel
+Summary: The GNU Transactional Memory support
+Requires: libitm = %{version}-%{release}
+Requires: gcc = %{version}-%{release}
+
+%description -n libitm-devel
+This package contains headers and support files for the
+GNU Transactional Memory library.
+
+%package -n libitm-static
+Summary: The GNU Transactional Memory static library
+Requires: libitm-devel = %{version}-%{release}
+
+%description -n libitm-static
+This package contains GNU Transactional Memory static libraries.
+
+%package -n libatomic
+Summary: The GNU Atomic library
+
+%description -n libatomic
+This package contains the GNU Atomic library
+which is a GCC support runtime library for atomic operations not supported
+by hardware.
+
+%package -n libatomic-static
+Summary: The GNU Atomic static library
+Requires: libatomic = %{version}-%{release}
+
+%description -n libatomic-static
+This package contains GNU Atomic static libraries.
+
+%package -n libasan
+Summary: The Address Sanitizer runtime library
+
+%description -n libasan
+This package contains the Address Sanitizer library
+which is used for -fsanitize=address instrumented programs.
+
+%package -n libasan-static
+Summary: The Address Sanitizer static library
+Requires: libasan = %{version}-%{release}
+
+%description -n libasan-static
+This package contains Address Sanitizer static runtime library.
+
+%package -n libtsan
+Summary: The Thread Sanitizer runtime library
+
+%description -n libtsan
+This package contains the Thread Sanitizer library
+which is used for -fsanitize=thread instrumented programs.
+
+%package -n libtsan-static
+Summary: The Thread Sanitizer static library
+Requires: libtsan = %{version}-%{release}
+
+%description -n libtsan-static
+This package contains Thread Sanitizer static runtime library.
+
+%package -n libubsan
+Summary: The Undefined Behavior Sanitizer runtime library
+
+%description -n libubsan
+This package contains the Undefined Behavior Sanitizer library
+which is used for -fsanitize=undefined instrumented programs.
+
+%package -n libubsan-static
+Summary: The Undefined Behavior Sanitizer static library
+Requires: libubsan = %{version}-%{release}
+
+%description -n libubsan-static
+This package contains Undefined Behavior Sanitizer static runtime library.
+
+%package -n liblsan
+Summary: The Leak Sanitizer runtime library
+
+%description -n liblsan
+This package contains the Leak Sanitizer library
+which is used for -fsanitize=leak instrumented programs.
+
+%package -n liblsan-static
+Summary: The Leak Sanitizer static library
+Requires: liblsan = %{version}-%{release}
+
+%description -n liblsan-static
+This package contains Leak Sanitizer static runtime library.
+
+%package -n cpp
+Summary: The C Preprocessor
+Requires: filesystem >= 3
+Provides: /lib/cpp
+Autoreq: true
+
+%description -n cpp
+Cpp is the GNU C-Compatible Compiler Preprocessor.
+Cpp is a macro processor which is used automatically
+by the C compiler to transform your program before actual
+compilation. It is called a macro processor because it allows
+you to define macros, abbreviations for longer
+constructs.
+
+The C preprocessor provides four separate functionalities: the
+inclusion of header files (files of declarations that can be
+substituted into your program); macro expansion (you can define macros,
+and the C preprocessor will replace the macros with their definitions
+throughout the program); conditional compilation (using special
+preprocessing directives, you can include or exclude parts of the
+program according to various conditions); and line control (if you use
+a program to combine or rearrange source files into an intermediate
+file which is then compiled, you can use line control to inform the
+compiler about where each source line originated).
+
+You should install this package if you are a C programmer and you use
+macros.
+
+%package gnat
+Summary: Ada 83, 95, 2005 and 2012 support for GCC
+Requires: gcc = %{version}-%{release}
+Requires: libgnat = %{version}-%{release}, libgnat-devel = %{version}-%{release}
+Autoreq: true
+
+%description gnat
+GNAT is a GNU Ada 83, 95, 2005 and 2012 front-end to GCC. This package includes
+development tools, the documents and Ada compiler.
+
+%package -n libgnat
+Summary: GNU Ada 83, 95, 2005 and 2012 runtime shared libraries
+Autoreq: true
+
+%description -n libgnat
+GNAT is a GNU Ada 83, 95, 2005 and 2012 front-end to GCC. This package includes
+shared libraries, which are required to run programs compiled with the GNAT.
+
+%package -n libgnat-devel
+Summary: GNU Ada 83, 95, 2005 and 2012 libraries
+Autoreq: true
+
+%description -n libgnat-devel
+GNAT is a GNU Ada 83, 95, 2005 and 2012 front-end to GCC. This package includes
+libraries, which are required to compile with the GNAT.
+
+%package -n libgnat-static
+Summary: GNU Ada 83, 95, 2005 and 2012 static libraries
+Requires: libgnat-devel = %{version}-%{release}
+Autoreq: true
+
+%description -n libgnat-static
+GNAT is a GNU Ada 83, 95, 2005 and 2012 front-end to GCC. This package includes
+static libraries.
+
+%package go
+Summary: Go support
+Requires: gcc = %{version}-%{release}
+Requires: libgo = %{version}-%{release}
+Requires: libgo-devel = %{version}-%{release}
+Requires(post): %{_sbindir}/update-alternatives
+Requires(postun): %{_sbindir}/update-alternatives
+Provides: gccgo = %{version}-%{release}
+Autoreq: true
+
+%description go
+The gcc-go package provides support for compiling Go programs
+with the GNU Compiler Collection.
+
+%package -n libgo
+Summary: Go runtime
+Autoreq: true
+
+%description -n libgo
+This package contains Go shared library which is needed to run
+Go dynamically linked programs.
+
+%package -n libgo-devel
+Summary: Go development libraries
+Requires: libgo = %{version}-%{release}
+Autoreq: true
+
+%description -n libgo-devel
+This package includes libraries and support files for compiling
+Go programs.
+
+%package -n libgo-static
+Summary: Static Go libraries
+Requires: libgo = %{version}-%{release}
+Requires: gcc = %{version}-%{release}
+
+%description -n libgo-static
+This package contains static Go libraries.
+
+%package plugin-devel
+Summary: Support for compiling GCC plugins
+Requires: gcc = %{version}-%{release}
+Requires: gmp-devel >= 4.1.2-8, mpfr-devel >= 3.1.0, libmpc-devel >= 0.8.1
+
+%description plugin-devel
+This package contains header files and other support files
+for compiling GCC plugins. The GCC plugin ABI is currently
+not stable, so plugins must be rebuilt any time GCC is updated.
+
+%package offload-nvptx
+Summary: Offloading compiler to NVPTX
+Requires: gcc = %{version}-%{release}
+Requires: libgomp-offload-nvptx = %{version}-%{release}
+
+%description offload-nvptx
+The gcc-offload-nvptx package provides offloading support for
+NVidia PTX. OpenMP and OpenACC programs linked with -fopenmp will
+by default add PTX code into the binaries, which can be offloaded
+to NVidia PTX capable devices if available.
+
+%package plugin-annobin
+Summary: The annobin plugin for gcc, built by the installed version of gcc
+Requires: gcc = %{version}-%{release}
+# Starting with release 10.01 annobin fixed a bug in its configure scripts
+# which prevented them from working with a built but not installed compiler
+BuildRequires: annobin >= 10.01
+# Starting with release 9.93 annobin-plugin-gcc puts a copy of the sources
+# in /usr/src/annobin
+# FIXME: Currently the annobin-plugin-gcc subpackage only exists in Fedora.
+# For RHEL-9 the annobin package does everything.
+# BuildRequires: annobin-plugin-gcc
+# Needed in order to be able to decompress the annobin source tarball.
+BuildRequires: xz
+
+%description plugin-annobin
+This package adds a version of the annobin plugin for gcc. This version
+of the plugin is explicitly built by the same version of gcc that is installed
+so that there cannot be any synchronization problems.
+
+%prep
+%setup -q -n gcc-%{version}-%{DATE} -a 1 -a 2 -a 3
+%patch0 -p0 -b .hack~
+%patch2 -p0 -b .sparc-config-detection~
+%patch3 -p0 -b .libgomp-omp_h-multilib~
+%patch4 -p0 -b .libtool-no-rpath~
+%if %{build_isl}
+%patch5 -p0 -b .isl-dl~
+%patch6 -p0 -b .isl-dl2~
+%endif
+%if %{build_libstdcxx_docs}
+%patch7 -p0 -b .libstdc++-docs~
+%endif
+%patch8 -p0 -b .no-add-needed~
+%patch9 -p0 -b .foffload-default~
+%patch10 -p0 -b .Wno-format-security~
+%if 0%{?fedora} >= 29 || 0%{?rhel} > 7
+%patch11 -p0 -b .rh1574936~
+%endif
+%patch12 -p0 -b .d-shared-libphobos~
+%patch14 -p0 -b .libgcc-link~
+%patch15 -p0 -b .pr101786~
+%patch16 -p0 -b .stringify-__VA_OPT__~
+%patch17 -p0 -b .stringify-__VA_OPT__-2~
+%patch18 -p1 -b .bidi~
+%patch19 -p1 -b .ice~
+%patch20 -p1 -b .pch~
+%patch21 -p1 -b .dejagnu-multiline~
+%patch22 -p1 -b .libsanitizer-pthread~
+%patch23 -p1 -b .pie~
+%patch24 -p1 -b .now~
+
+%if 0%{?rhel} >= 9
+%patch100 -p1 -b .fortran-fdec-duplicates~
+%patch101 -p1 -b .fortran-flogical-as-integer~
+%patch102 -p1 -b .fortran-fdec-ichar~
+%patch103 -p1 -b .fortran-fdec-non-integer-index~
+%patch104 -p1 -b .fortran-fdec-old-init~
+%patch105 -p1 -b .fortran-fdec-override-kind~
+%patch106 -p1 -b .fortran-fdec-non-logical-if~
+%patch107 -p1 -b .fortran-fdec-promotion~
+%patch108 -p1 -b .fortran-fdec-sequence~
+%patch109 -p1 -b .fortran-fdec-add-missing-indexes~
+%endif
+
+%ifarch %{arm}
+rm -f gcc/testsuite/go.test/test/fixedbugs/issue19182.go
+%endif
+
+echo 'Red Hat %{version}-%{gcc_release}' > gcc/DEV-PHASE
+
+cp -a libstdc++-v3/config/cpu/i{4,3}86/atomicity.h
+
+./contrib/gcc_update --touch
+
+LC_ALL=C sed -i -e 's/\xa0/ /' gcc/doc/options.texi
+
+sed -i -e 's/Common Driver Var(flag_report_bug)/& Init(1)/' gcc/common.opt
+
+%ifarch ppc
+if [ -d libstdc++-v3/config/abi/post/powerpc64-linux-gnu ]; then
+ mkdir -p libstdc++-v3/config/abi/post/powerpc64-linux-gnu/64
+ mv libstdc++-v3/config/abi/post/powerpc64-linux-gnu/{,64/}baseline_symbols.txt
+ mv libstdc++-v3/config/abi/post/powerpc64-linux-gnu/{32/,}baseline_symbols.txt
+ rm -rf libstdc++-v3/config/abi/post/powerpc64-linux-gnu/32
+fi
+%endif
+%ifarch sparc
+if [ -d libstdc++-v3/config/abi/post/sparc64-linux-gnu ]; then
+ mkdir -p libstdc++-v3/config/abi/post/sparc64-linux-gnu/64
+ mv libstdc++-v3/config/abi/post/sparc64-linux-gnu/{,64/}baseline_symbols.txt
+ mv libstdc++-v3/config/abi/post/sparc64-linux-gnu/{32/,}baseline_symbols.txt
+ rm -rf libstdc++-v3/config/abi/post/sparc64-linux-gnu/32
+fi
+%endif
+
+# This test causes fork failures, because it spawns way too many threads
+rm -f gcc/testsuite/go.test/test/chan/goroutines.go
+
+# This test fails randomly.
+%ifarch ppc64le
+rm -f libstdc++-v3/testsuite/30_threads/future/members/poll.cc
+%endif
+
+%build
+
+# Undo the broken autoconf change in recent Fedora versions
+export CONFIG_SITE=NONE
+
+CC=gcc
+CXX=g++
+OPT_FLAGS=`echo %{optflags}|sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g'`
+OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-flto=auto//g;s/-flto//g;s/-ffat-lto-objects//g'`
+OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-m64//g;s/-m32//g;s/-m31//g'`
+OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-mfpmath=sse/-mfpmath=sse -msse2/g'`
+OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/ -pipe / /g'`
+OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-Werror=format-security/-Wformat-security/g'`
+%ifarch sparc
+OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-mcpu=ultrasparc/-mtune=ultrasparc/g;s/-mcpu=v[78]//g'`
+%endif
+%ifarch %{ix86}
+OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-march=i.86//g'`
+%endif
+OPT_FLAGS=`echo "$OPT_FLAGS" | sed -e 's/[[:blank:]]\+/ /g'`
+case "$OPT_FLAGS" in
+ *-fasynchronous-unwind-tables*)
+ sed -i -e 's/-fno-exceptions /-fno-exceptions -fno-asynchronous-unwind-tables /' \
+ libgcc/Makefile.in
+ ;;
+esac
+
+%if %{build_offload_nvptx}
+mkdir obji
+IROOT=`pwd`/obji
+cd nvptx-tools-%{nvptx_tools_gitrev}
+rm -rf obj-%{gcc_target_platform}
+mkdir obj-%{gcc_target_platform}
+cd obj-%{gcc_target_platform}
+CC="$CC" CXX="$CXX" CFLAGS="%{optflags} -fPIE" CXXFLAGS="%{optflags} -fPIE" LDFLAGS="-pie -Wl,-z,now" \
+../configure --prefix=%{_prefix}
+make %{?_smp_mflags}
+make install prefix=${IROOT}%{_prefix}
+cd ../..
+
+ln -sf newlib-cygwin-%{newlib_cygwin_gitrev}/newlib newlib
+rm -rf obj-offload-nvptx-none
+mkdir obj-offload-nvptx-none
+
+cd obj-offload-nvptx-none
+CC="$CC" CXX="$CXX" CFLAGS="$OPT_FLAGS" \
+ CXXFLAGS="`echo " $OPT_FLAGS " | sed 's/ -Wall / /g;s/ -fexceptions / /g' \
+ | sed 's/ -Wformat-security / -Wformat -Wformat-security /'`" \
+ XCFLAGS="$OPT_FLAGS" TCFLAGS="$OPT_FLAGS" \
+ ../configure --disable-bootstrap --disable-sjlj-exceptions \
+ --enable-newlib-io-long-long --with-build-time-tools=${IROOT}%{_prefix}/nvptx-none/bin \
+ --target nvptx-none --enable-as-accelerator-for=%{gcc_target_platform} \
+ --enable-languages=c,c++,fortran,lto \
+ --prefix=%{_prefix} --mandir=%{_mandir} --infodir=%{_infodir} \
+ --with-bugurl=http://bugzilla.redhat.com/bugzilla \
+ --enable-checking=release --with-system-zlib \
+ --with-gcc-major-version-only --without-isl --enable-host-pie --enable-host-bind-now
+make %{?_smp_mflags}
+cd ..
+rm -f newlib
+%endif
+
+rm -rf obj-%{gcc_target_platform}
+mkdir obj-%{gcc_target_platform}
+cd obj-%{gcc_target_platform}
+
+%if %{build_isl}
+mkdir isl-build isl-install
+%ifarch s390 s390x
+ISL_FLAG_PIC=-fPIC
+%else
+ISL_FLAG_PIC=-fpic
+%endif
+cd isl-build
+sed -i 's|libisl|libgcc11privateisl|g' \
+ ../../isl-%{isl_version}/Makefile.{am,in}
+../../isl-%{isl_version}/configure \
+ CC=/usr/bin/gcc CXX=/usr/bin/g++ \
+ CFLAGS="${CFLAGS:-%optflags} $ISL_FLAG_PIC" --prefix=`cd ..; pwd`/isl-install
+make %{?_smp_mflags}
+make install
+cd ../isl-install/lib
+rm libgcc11privateisl.so{,.15}
+mv libgcc11privateisl.so.15.3.0 libisl.so.15
+ln -sf libisl.so.15 libisl.so
+cd ../..
+%endif
+
+enablelgo=
+enablelada=
+enablelobjc=
+enableld=
+%if %{build_objc}
+enablelobjc=,objc,obj-c++
+%endif
+%if %{build_ada}
+enablelada=,ada
+%endif
+%if %{build_go}
+enablelgo=,go
+%endif
+%if %{build_d}
+enableld=,d
+%endif
+CONFIGURE_OPTS="\
+ --prefix=%{_prefix} --mandir=%{_mandir} --infodir=%{_infodir} \
+ --with-bugurl=http://bugzilla.redhat.com/bugzilla \
+ --enable-shared --enable-threads=posix --enable-checking=release \
+%ifarch ppc64le
+ --enable-targets=powerpcle-linux \
+%endif
+%ifarch ppc64le %{mips} s390x
+%ifarch s390x
+%if 0%{?fedora} < 32 && 0%{?rhel} < 8
+ --enable-multilib \
+%else
+ --disable-multilib \
+%endif
+%else
+ --disable-multilib \
+%endif
+%else
+ --enable-multilib \
+%endif
+ --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions \
+ --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only \
+%ifnarch %{mips}
+ --with-linker-hash-style=gnu \
+%endif
+ --enable-plugin --enable-initfini-array \
+%if %{build_isl}
+ --with-isl=`pwd`/isl-install \
+%else
+ --without-isl \
+%endif
+%if %{build_offload_nvptx}
+ --enable-offload-targets=nvptx-none \
+ --without-cuda-driver \
+%endif
+%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7
+%if %{attr_ifunc}
+ --enable-gnu-indirect-function \
+%endif
+%endif
+%ifarch %{arm}
+ --disable-sjlj-exceptions \
+%endif
+%ifarch ppc ppc64 ppc64le ppc64p7
+ --enable-secureplt \
+%endif
+%ifarch sparc sparcv9 sparc64 ppc ppc64 ppc64le ppc64p7 s390 s390x alpha
+ --with-long-double-128 \
+%endif
+%ifarch sparc
+ --disable-linux-futex \
+%endif
+%ifarch sparc64
+ --with-cpu=ultrasparc \
+%endif
+%ifarch sparc sparcv9
+ --host=%{gcc_target_platform} --build=%{gcc_target_platform} --target=%{gcc_target_platform} --with-cpu=v7
+%endif
+%ifarch ppc ppc64 ppc64p7
+%if 0%{?rhel} >= 7
+ --with-cpu-32=power7 --with-tune-32=power7 --with-cpu-64=power7 --with-tune-64=power7 \
+%endif
+%if 0%{?rhel} == 6
+ --with-cpu-32=power4 --with-tune-32=power6 --with-cpu-64=power4 --with-tune-64=power6 \
+%endif
+%endif
+%ifarch ppc64le
+%if 0%{?rhel} == 9
+ --with-cpu-32=power9 --with-tune-32=power9 --with-cpu-64=power9 --with-tune-64=power9 \
+%else
+ --with-cpu-32=power8 --with-tune-32=power8 --with-cpu-64=power8 --with-tune-64=power8 \
+%endif
+%endif
+%ifarch ppc
+ --build=%{gcc_target_platform} --target=%{gcc_target_platform} --with-cpu=default32
+%endif
+%ifarch %{ix86} x86_64
+ --enable-cet \
+ --with-tune=generic \
+%endif
+%if 0%{?rhel} >= 7
+%ifarch %{ix86}
+ --with-arch=x86-64 \
+%endif
+%ifarch x86_64
+%if 0%{?rhel} > 8
+ --with-arch_64=x86-64-v2 \
+%endif
+ --with-arch_32=x86-64 \
+%endif
+%else
+%ifarch %{ix86}
+ --with-arch=i686 \
+%endif
+%ifarch x86_64
+ --with-arch_32=i686 \
+%endif
+%endif
+%ifarch s390 s390x
+%if 0%{?rhel} >= 7
+%if 0%{?rhel} > 7
+%if 0%{?rhel} > 8
+%if 0%{?rhel} == 9
+ --with-arch=z14 --with-tune=z15 \
+%else
+ --with-arch=z13 --with-tune=arch13 \
+%endif
+%else
+ --with-arch=z13 --with-tune=z14 \
+%endif
+%else
+ --with-arch=z196 --with-tune=zEC12 \
+%endif
+%else
+%if 0%{?fedora} >= 26
+ --with-arch=zEC12 --with-tune=z13 \
+%else
+ --with-arch=z9-109 --with-tune=z10 \
+%endif
+%endif
+ --enable-decimal-float \
+%endif
+%ifarch armv7hl
+ --with-tune=generic-armv7-a --with-arch=armv7-a \
+ --with-float=hard --with-fpu=vfpv3-d16 --with-abi=aapcs-linux \
+%endif
+%ifarch mips mipsel
+ --with-arch=mips32r2 --with-fp-32=xx \
+%endif
+%ifarch mips64 mips64el
+ --with-arch=mips64r2 --with-abi=64 \
+%endif
+%ifarch riscv64
+ --with-arch=rv64gc --with-abi=lp64d --with-multilib-list=lp64d \
+%endif
+%ifnarch sparc sparcv9 ppc
+ --build=%{gcc_target_platform} \
+%endif
+%if 0%{?fedora} >= 35 || 0%{?rhel} >= 9
+%ifnarch %{arm}
+ --with-build-config=bootstrap-lto --enable-link-serialization=1 \
+%endif
+%endif
+ "
+
+CC="$CC" CXX="$CXX" CFLAGS="$OPT_FLAGS" \
+ CXXFLAGS="`echo " $OPT_FLAGS " | sed 's/ -Wall / /g;s/ -fexceptions / /g' \
+ | sed 's/ -Wformat-security / -Wformat -Wformat-security /'`" \
+ XCFLAGS="$OPT_FLAGS" TCFLAGS="$OPT_FLAGS" \
+ ../configure --enable-bootstrap --enable-host-pie --enable-host-bind-now \
+ --enable-languages=c,c++,fortran${enablelobjc}${enablelada}${enablelgo}${enableld},lto \
+ $CONFIGURE_OPTS
+
+%ifarch sparc sparcv9 sparc64
+make %{?_smp_mflags} BOOT_CFLAGS="$OPT_FLAGS" LDFLAGS_FOR_TARGET=-Wl,-z,relro,-z,now bootstrap
+%else
+make %{?_smp_mflags} BOOT_CFLAGS="$OPT_FLAGS" LDFLAGS_FOR_TARGET=-Wl,-z,relro,-z,now profiledbootstrap
+%endif
+
+CC="`%{gcc_target_platform}/libstdc++-v3/scripts/testsuite_flags --build-cc`"
+CXX="`%{gcc_target_platform}/libstdc++-v3/scripts/testsuite_flags --build-cxx` `%{gcc_target_platform}/libstdc++-v3/scripts/testsuite_flags --build-includes`"
+
+# Build libgccjit separately, so that normal compiler binaries aren't -fpic
+# unnecessarily.
+mkdir objlibgccjit
+cd objlibgccjit
+CC="$CC" CXX="$CXX" CFLAGS="$OPT_FLAGS" \
+ CXXFLAGS="`echo " $OPT_FLAGS " | sed 's/ -Wall / /g;s/ -fexceptions / /g' \
+ | sed 's/ -Wformat-security / -Wformat -Wformat-security /'`" \
+ XCFLAGS="$OPT_FLAGS" TCFLAGS="$OPT_FLAGS" \
+ ../../configure --disable-bootstrap --enable-host-shared --enable-host-bind-now \
+ --enable-languages=jit $CONFIGURE_OPTS
+make %{?_smp_mflags} BOOT_CFLAGS="$OPT_FLAGS" all-gcc
+cp -a gcc/libgccjit.so* ../gcc/
+cd ../gcc/
+ln -sf xgcc %{gcc_target_platform}-gcc-%{gcc_major}
+cp -a Makefile{,.orig}
+sed -i -e '/^CHECK_TARGETS/s/$/ check-jit/' Makefile
+touch -r Makefile.orig Makefile
+rm Makefile.orig
+make jit.sphinx.html
+make jit.sphinx.install-html jit_htmldir=`pwd`/../../rpm.doc/libgccjit-devel/html
+cd ..
+
+%if %{build_isl}
+cp -a isl-install/lib/libisl.so.15 gcc/
+%endif
+
+# Make generated man pages even if Pod::Man is not new enough
+perl -pi -e 's/head3/head2/' ../contrib/texi2pod.pl
+for i in ../gcc/doc/*.texi; do
+ cp -a $i $i.orig; sed 's/ftable/table/' $i.orig > $i
+done
+make -C gcc generated-manpages
+for i in ../gcc/doc/*.texi; do mv -f $i.orig $i; done
+
+# Make generated doxygen pages.
+%if %{build_libstdcxx_docs}
+cd %{gcc_target_platform}/libstdc++-v3
+make doc-html-doxygen
+make doc-man-doxygen
+cd ../..
+%endif
+
+# Copy various doc files here and there
+cd ..
+mkdir -p rpm.doc/gfortran rpm.doc/objc rpm.doc/gdc rpm.doc/libphobos
+mkdir -p rpm.doc/go rpm.doc/libgo rpm.doc/libquadmath rpm.doc/libitm
+mkdir -p rpm.doc/changelogs/{gcc/cp,gcc/ada,gcc/jit,libstdc++-v3,libobjc,libgomp,libcc1,libatomic,libsanitizer}
+
+for i in {gcc,gcc/cp,gcc/ada,gcc/jit,libstdc++-v3,libobjc,libgomp,libcc1,libatomic,libsanitizer}/ChangeLog*; do
+ cp -p $i rpm.doc/changelogs/$i
+done
+
+(cd gcc/fortran; for i in ChangeLog*; do
+ cp -p $i ../../rpm.doc/gfortran/$i
+done)
+(cd libgfortran; for i in ChangeLog*; do
+ cp -p $i ../rpm.doc/gfortran/$i.libgfortran
+done)
+%if %{build_objc}
+(cd libobjc; for i in README*; do
+ cp -p $i ../rpm.doc/objc/$i.libobjc
+done)
+%endif
+%if %{build_d}
+(cd gcc/d; for i in ChangeLog*; do
+ cp -p $i ../../rpm.doc/gdc/$i.gdc
+done)
+(cd libphobos; for i in ChangeLog*; do
+ cp -p $i ../rpm.doc/libphobos/$i.libphobos
+done
+cp -a src/LICENSE*.txt libdruntime/LICENSE ../rpm.doc/libphobos/)
+%endif
+%if %{build_libquadmath}
+(cd libquadmath; for i in ChangeLog* COPYING.LIB; do
+ cp -p $i ../rpm.doc/libquadmath/$i.libquadmath
+done)
+%endif
+%if %{build_libitm}
+(cd libitm; for i in ChangeLog*; do
+ cp -p $i ../rpm.doc/libitm/$i.libitm
+done)
+%endif
+%if %{build_go}
+(cd gcc/go; for i in README* ChangeLog*; do
+ cp -p $i ../../rpm.doc/go/$i
+done)
+(cd libgo; for i in LICENSE* PATENTS* README; do
+ cp -p $i ../rpm.doc/libgo/$i.libgo
+done)
+%endif
+
+rm -f rpm.doc/changelogs/gcc/ChangeLog.[1-9]
+find rpm.doc -name \*ChangeLog\* | xargs bzip2 -9
+
+# Get the annobin sources. Note these are not added to the rpm as SOURCE4
+# because if they were the build phase would try to include them as part of
+# gcc itself, and this causes problems. Instead we locate the sources in
+# the buildroot. They should have been put there when annobin was installed.
+
+pushd %{_builddir}
+
+%global annobin_source_dir %{_usrsrc}/annobin
+
+if [ -d %{annobin_source_dir} ]
+then
+ # Unpack the sources.
+ echo "Unpacking annobin sources"
+ rm -fr annobin-*
+ tar xvf %{annobin_source_dir}/latest-annobin.tar.xz
+
+ # Setting this as a local symbol because using %%global does not appear to work.
+ annobin_dir=$(find . -maxdepth 1 -type d -name "annobin*")
+
+ # Now build the annobin plugin using the just built compiler.
+ echo "annobin directory = ${annobin_dir}"
+ cd ${annobin_dir}
+
+ # Work out where this version of gcc stores its plugins.
+%global ANNOBIN_GCC_PLUGIN_DIR %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/plugin
+
+ CONFIG_ARGS="--quiet"
+ CONFIG_ARGS="$CONFIG_ARGS --with-gcc-plugin-dir=%{ANNOBIN_GCC_PLUGIN_DIR}"
+ CONFIG_ARGS="$CONFIG_ARGS --without-annocheck"
+ CONFIG_ARGS="$CONFIG_ARGS --without-tests"
+ CONFIG_ARGS="$CONFIG_ARGS --disable-rpath"
+
+ comp_dir="%{_builddir}/gcc-%{version}-%{DATE}/obj-%{gcc_target_platform}/gcc/"
+ ccompiler="%{_builddir}/gcc-%{version}-%{DATE}/obj-%{gcc_target_platform}/gcc/xgcc -B $comp_dir"
+ cxxcompiler="%{_builddir}/gcc-%{version}-%{DATE}/obj-%{gcc_target_platform}/gcc/xg++ -B $comp_dir"
+
+ comp_flags="%build_cflags"
+ comp_flags="$comp_flags -I %{_builddir}/gcc-%{version}-%{DATE}/gcc"
+ comp_flags="$comp_flags -I %{_builddir}/gcc-%{version}-%{DATE}/obj-%{gcc_target_platform}/gcc/"
+ comp_flags="$comp_flags -I %{_builddir}/gcc-%{version}-%{DATE}/obj-%{gcc_target_platform}/%{gcc_target_platform}/libstdc++-v3/include"
+ comp_flags="$comp_flags -I %{_builddir}/gcc-%{version}-%{DATE}/obj-%{gcc_target_platform}/%{gcc_target_platform}/libstdc++-v3/include/%{gcc_target_platform}"
+ comp_flags="$comp_flags -I %{_builddir}/gcc-%{version}-%{DATE}/libstdc++-v3/libsupc++"
+ comp_flags="$comp_flags -I %{_builddir}/gcc-%{version}-%{DATE}/include"
+ comp_flags="$comp_flags -I %{_builddir}/gcc-%{version}-%{DATE}/libcpp/include"
+
+ ld_flags="%build_ldflags"
+ ld_flags="$ld_flags -L%{_builddir}/gcc-%{version}-%{DATE}/obj-%{gcc_target_platform}/libstdc++-v3/.libs"
+ ld_flags="$ld_flags -L%{_builddir}/gcc-%{version}-%{DATE}/obj-%{gcc_target_platform}/%{gcc_target_platform}/libstdc++-v3/.libs"
+ ld_flags="$ld_flags -L%{_builddir}/gcc-%{version}-%{DATE}/obj-%{gcc_target_platform}/%{gcc_target_platform}/libstdc++-v3/src/.libs"
+ ld_flags="$ld_flags -L%{_builddir}/gcc-%{version}-%{DATE}/obj-%{gcc_target_platform}/libstdc++-v3/libsupc++/.libs"
+ ld_flags="$ld_flags -L%{_builddir}/gcc-%{version}-%{DATE}/obj-%{gcc_target_platform}/%{gcc_target_platform}/libstdc++-v3/libsupc++/.libs"
+ ld_flags="$ld_flags -L%{_builddir}/gcc-%{version}-%{DATE}/obj-%{gcc_target_platform}/%{gcc_target_platform}/libgcc/.libs"
+
+ # libtool works with CFLAGS but ignores LDFLAGS, so we have to combine them.
+ comp_flags="$comp_flags $ld_flags"
+
+ echo "Configuring the annobin plugin"
+ CC="${ccompiler}" CFLAGS="${comp_flags}" \
+ CXX="${cxxcompiler}" CXXFLAGS="${comp_flags}" \
+ LDFLAGS="${ld_flags}" \
+ ./configure ${CONFIG_ARGS} || cat config.log
+
+ echo "Building the annobin plugin"
+ make
+
+ echo "Annobin plugin build complete"
+else
+ echo "Unable to locate annobin sources (expected to find: %{annobin_source_dir}/latest-annobin.tar.xz)"
+ echo "These should be provided by installing the annobin package"
+ exit 1
+fi
+popd
+
+%install
+rm -rf %{buildroot}
+mkdir -p %{buildroot}
+
+# RISC-V ABI wants to install everything in /lib64/lp64d or /usr/lib64/lp64d.
+# Make these be symlinks to /lib64 or /usr/lib64 respectively. See:
+# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/DRHT5YTPK4WWVGL3GIN5BF2IKX2ODHZ3/
+%ifarch riscv64
+for d in %{buildroot}%{_libdir} %{buildroot}/%{_lib} \
+ %{buildroot}%{_datadir}/gdb/auto-load/%{_prefix}/%{_lib} \
+ %{buildroot}%{_prefix}/include/c++/%{gcc_major}/%{gcc_target_platform}/%{_lib}; do
+ mkdir -p $d
+ (cd $d && ln -sf . lp64d)
+done
+%endif
+
+%if %{build_offload_nvptx}
+cd nvptx-tools-%{nvptx_tools_gitrev}
+cd obj-%{gcc_target_platform}
+make install prefix=%{buildroot}%{_prefix}
+cd ../..
+
+ln -sf newlib-cygwin-%{newlib_cygwin_gitrev}/newlib newlib
+cd obj-offload-nvptx-none
+make prefix=%{buildroot}%{_prefix} mandir=%{buildroot}%{_mandir} \
+ infodir=%{buildroot}%{_infodir} install
+rm -rf %{buildroot}%{_prefix}/libexec/gcc/nvptx-none/%{gcc_major}/install-tools
+rm -rf %{buildroot}%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/accel/nvptx-none/{install-tools,plugin,cc1,cc1plus,f951}
+rm -rf %{buildroot}%{_infodir} %{buildroot}%{_mandir}/man7 %{buildroot}%{_prefix}/share/locale
+rm -rf %{buildroot}%{_prefix}/lib/gcc/nvptx-none/%{gcc_major}/{install-tools,plugin}
+rm -rf %{buildroot}%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/accel/nvptx-none/{install-tools,plugin,include-fixed}
+rm -rf %{buildroot}%{_prefix}/%{_lib}/libc[cp]1*
+mv -f %{buildroot}%{_prefix}/nvptx-none/lib/*.{a,spec} %{buildroot}%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/accel/nvptx-none/
+mv -f %{buildroot}%{_prefix}/nvptx-none/lib/mgomp/*.{a,spec} %{buildroot}%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/accel/nvptx-none/mgomp/
+mv -f %{buildroot}%{_prefix}/lib/gcc/nvptx-none/%{gcc_major}/*.a %{buildroot}%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/accel/nvptx-none/
+mv -f %{buildroot}%{_prefix}/lib/gcc/nvptx-none/%{gcc_major}/mgomp/*.a %{buildroot}%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/accel/nvptx-none/mgomp/
+find %{buildroot}%{_prefix}/lib/gcc/nvptx-none %{buildroot}%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/accel/nvptx-none \
+ %{buildroot}%{_prefix}/nvptx-none/lib -name \*.la | xargs rm
+cd ..
+rm -f newlib
+%endif
+
+cd obj-%{gcc_target_platform}
+
+TARGET_PLATFORM=%{gcc_target_platform}
+
+# There are some MP bugs in libstdc++ Makefiles
+make -C %{gcc_target_platform}/libstdc++-v3
+
+make prefix=%{buildroot}%{_prefix} mandir=%{buildroot}%{_mandir} \
+ infodir=%{buildroot}%{_infodir} install
+%if %{build_ada}
+chmod 644 %{buildroot}%{_infodir}/gnat*
+%endif
+
+FULLPATH=%{buildroot}%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+FULLEPATH=%{buildroot}%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}
+
+%if %{build_isl}
+cp -a isl-install/lib/libisl.so.15 $FULLPATH/
+%endif
+
+# fix some things
+ln -sf gcc %{buildroot}%{_prefix}/bin/cc
+rm -f %{buildroot}%{_prefix}/lib/cpp
+ln -sf ../bin/cpp %{buildroot}/%{_prefix}/lib/cpp
+ln -sf gfortran %{buildroot}%{_prefix}/bin/f95
+rm -f %{buildroot}%{_infodir}/dir
+gzip -9 %{buildroot}%{_infodir}/*.info*
+ln -sf gcc %{buildroot}%{_prefix}/bin/gnatgcc
+mkdir -p %{buildroot}%{_fmoddir}
+
+%if %{build_go}
+mv %{buildroot}%{_prefix}/bin/go{,.gcc}
+mv %{buildroot}%{_prefix}/bin/gofmt{,.gcc}
+ln -sf /etc/alternatives/go %{buildroot}%{_prefix}/bin/go
+ln -sf /etc/alternatives/gofmt %{buildroot}%{_prefix}/bin/gofmt
+%endif
+
+cxxconfig="`find %{gcc_target_platform}/libstdc++-v3/include -name c++config.h`"
+for i in `find %{gcc_target_platform}/[36]*/libstdc++-v3/include -name c++config.h 2>/dev/null`; do
+ if ! diff -up $cxxconfig $i; then
+ cat > %{buildroot}%{_prefix}/include/c++/%{gcc_major}/%{gcc_target_platform}/bits/c++config.h <
+#if __WORDSIZE == 32
+%ifarch %{multilib_64_archs}
+`cat $(find %{gcc_target_platform}/32/libstdc++-v3/include -name c++config.h)`
+%else
+`cat $(find %{gcc_target_platform}/libstdc++-v3/include -name c++config.h)`
+%endif
+#else
+%ifarch %{multilib_64_archs}
+`cat $(find %{gcc_target_platform}/libstdc++-v3/include -name c++config.h)`
+%else
+`cat $(find %{gcc_target_platform}/64/libstdc++-v3/include -name c++config.h)`
+%endif
+#endif
+#endif
+EOF
+ break
+ fi
+done
+
+for f in `find %{buildroot}%{_prefix}/include/c++/%{gcc_major}/%{gcc_target_platform}/ -name c++config.h`; do
+ for i in 1 2 4 8; do
+ sed -i -e 's/#define _GLIBCXX_ATOMIC_BUILTINS_'$i' 1/#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_'$i'\
+&\
+#endif/' $f
+ done
+done
+
+# Nuke bits/*.h.gch dirs
+# 1) there is no bits/*.h header installed, so when gch file can't be
+# used, compilation fails
+# 2) sometimes it is hard to match the exact options used for building
+# libstdc++-v3 or they aren't desirable
+# 3) there are multilib issues, conflicts etc. with this
+# 4) it is huge
+# People can always precompile on their own whatever they want, but
+# shipping this for everybody is unnecessary.
+rm -rf %{buildroot}%{_prefix}/include/c++/%{gcc_major}/%{gcc_target_platform}/bits/*.h.gch
+
+%if %{build_libstdcxx_docs}
+libstdcxx_doc_builddir=%{gcc_target_platform}/libstdc++-v3/doc/doxygen
+mkdir -p ../rpm.doc/libstdc++-v3
+cp -r -p ../libstdc++-v3/doc/html ../rpm.doc/libstdc++-v3/html
+cp -r -p $libstdcxx_doc_builddir/html ../rpm.doc/libstdc++-v3/html/api
+mkdir -p %{buildroot}%{_mandir}/man3
+cp -r -p $libstdcxx_doc_builddir/man/man3/* %{buildroot}%{_mandir}/man3/
+find ../rpm.doc/libstdc++-v3 -name \*~ | xargs rm
+%endif
+
+%ifarch sparcv9 sparc64
+ln -f %{buildroot}%{_prefix}/bin/%{gcc_target_platform}-gcc \
+ %{buildroot}%{_prefix}/bin/sparc-%{_vendor}-%{_target_os}-gcc
+%endif
+%ifarch ppc ppc64 ppc64p7
+ln -f %{buildroot}%{_prefix}/bin/%{gcc_target_platform}-gcc \
+ %{buildroot}%{_prefix}/bin/ppc-%{_vendor}-%{_target_os}-gcc
+%endif
+
+FULLLSUBDIR=
+%ifarch sparcv9 ppc
+FULLLSUBDIR=lib32
+%endif
+%ifarch sparc64 ppc64 ppc64p7
+FULLLSUBDIR=lib64
+%endif
+if [ -n "$FULLLSUBDIR" ]; then
+ FULLLPATH=$FULLPATH/$FULLLSUBDIR
+ mkdir -p $FULLLPATH
+else
+ FULLLPATH=$FULLPATH
+fi
+
+find %{buildroot} -name \*.la | xargs rm -f
+
+mv %{buildroot}%{_prefix}/%{_lib}/libgfortran.spec $FULLPATH/
+%if %{build_d}
+mv %{buildroot}%{_prefix}/%{_lib}/libgphobos.spec $FULLPATH/
+%endif
+%if %{build_libitm}
+mv %{buildroot}%{_prefix}/%{_lib}/libitm.spec $FULLPATH/
+%endif
+%if %{build_libasan}
+mv %{buildroot}%{_prefix}/%{_lib}/libsanitizer.spec $FULLPATH/
+%endif
+
+mkdir -p %{buildroot}/%{_lib}
+mv -f %{buildroot}%{_prefix}/%{_lib}/libgcc_s.so.1 %{buildroot}/%{_lib}/libgcc_s-%{gcc_major}-%{DATE}.so.1
+chmod 755 %{buildroot}/%{_lib}/libgcc_s-%{gcc_major}-%{DATE}.so.1
+ln -sf libgcc_s-%{gcc_major}-%{DATE}.so.1 %{buildroot}/%{_lib}/libgcc_s.so.1
+%ifarch %{ix86} x86_64 ppc ppc64 ppc64p7 ppc64le %{arm} aarch64 riscv64
+rm -f $FULLPATH/libgcc_s.so
+echo '/* GNU ld script
+ Use the shared library, but some functions are only in
+ the static library, so try that secondarily. */
+OUTPUT_FORMAT('`gcc -Wl,--print-output-format -nostdlib -r -o /dev/null`')
+GROUP ( /%{_lib}/libgcc_s.so.1 libgcc.a )' > $FULLPATH/libgcc_s.so
+%else
+ln -sf /%{_lib}/libgcc_s.so.1 $FULLPATH/libgcc_s.so
+%endif
+%ifarch sparcv9 ppc
+%ifarch ppc
+rm -f $FULLPATH/64/libgcc_s.so
+echo '/* GNU ld script
+ Use the shared library, but some functions are only in
+ the static library, so try that secondarily. */
+OUTPUT_FORMAT('`gcc -m64 -Wl,--print-output-format -nostdlib -r -o /dev/null`')
+GROUP ( /lib64/libgcc_s.so.1 libgcc.a )' > $FULLPATH/64/libgcc_s.so
+%else
+ln -sf /lib64/libgcc_s.so.1 $FULLPATH/64/libgcc_s.so
+%endif
+%endif
+%ifarch %{multilib_64_archs}
+%ifarch x86_64 ppc64 ppc64p7
+rm -f $FULLPATH/64/libgcc_s.so
+echo '/* GNU ld script
+ Use the shared library, but some functions are only in
+ the static library, so try that secondarily. */
+OUTPUT_FORMAT('`gcc -m32 -Wl,--print-output-format -nostdlib -r -o /dev/null`')
+GROUP ( /lib/libgcc_s.so.1 libgcc.a )' > $FULLPATH/32/libgcc_s.so
+%else
+ln -sf /lib/libgcc_s.so.1 $FULLPATH/32/libgcc_s.so
+%endif
+%endif
+
+mv -f %{buildroot}%{_prefix}/%{_lib}/libgomp.spec $FULLPATH/
+
+%if %{build_ada}
+mv -f $FULLPATH/adalib/libgnarl-*.so %{buildroot}%{_prefix}/%{_lib}/
+mv -f $FULLPATH/adalib/libgnat-*.so %{buildroot}%{_prefix}/%{_lib}/
+rm -f $FULLPATH/adalib/libgnarl.so* $FULLPATH/adalib/libgnat.so*
+%endif
+
+mkdir -p %{buildroot}%{_prefix}/libexec/getconf
+if gcc/xgcc -B gcc/ -E -P -dD -xc /dev/null | grep '__LONG_MAX__.*\(2147483647\|0x7fffffff\($\|[LU]\)\)'; then
+ ln -sf POSIX_V6_ILP32_OFF32 %{buildroot}%{_prefix}/libexec/getconf/default
+else
+ ln -sf POSIX_V6_LP64_OFF64 %{buildroot}%{_prefix}/libexec/getconf/default
+fi
+
+mkdir -p %{buildroot}%{_datadir}/gdb/auto-load/%{_prefix}/%{_lib}
+mv -f %{buildroot}%{_prefix}/%{_lib}/libstdc++*gdb.py* \
+ %{buildroot}%{_datadir}/gdb/auto-load/%{_prefix}/%{_lib}/
+pushd ../libstdc++-v3/python
+for i in `find . -name \*.py`; do
+ touch -r $i %{buildroot}%{_prefix}/share/gcc-%{gcc_major}/python/$i
+done
+touch -r hook.in %{buildroot}%{_datadir}/gdb/auto-load/%{_prefix}/%{_lib}/libstdc++*gdb.py
+popd
+for f in `find %{buildroot}%{_prefix}/share/gcc-%{gcc_major}/python/ \
+ %{buildroot}%{_datadir}/gdb/auto-load/%{_prefix}/%{_lib}/ -name \*.py`; do
+ r=${f/$RPM_BUILD_ROOT/}
+ %{__python3} -c 'import py_compile; py_compile.compile("'$f'", dfile="'$r'")'
+ %{__python3} -O -c 'import py_compile; py_compile.compile("'$f'", dfile="'$r'")'
+done
+
+rm -f $FULLEPATH/libgccjit.so
+cp -a objlibgccjit/gcc/libgccjit.so* %{buildroot}%{_prefix}/%{_lib}/
+cp -a ../gcc/jit/libgccjit*.h %{buildroot}%{_prefix}/include/
+/usr/bin/install -c -m 644 objlibgccjit/gcc/doc/libgccjit.info %{buildroot}/%{_infodir}/
+gzip -9 %{buildroot}/%{_infodir}/libgccjit.info
+
+pushd $FULLPATH
+if [ "%{_lib}" = "lib" ]; then
+%if %{build_objc}
+ln -sf ../../../libobjc.so.4 libobjc.so
+%endif
+ln -sf ../../../libstdc++.so.6.*[0-9] libstdc++.so
+ln -sf ../../../libgfortran.so.5.* libgfortran.so
+ln -sf ../../../libgomp.so.1.* libgomp.so
+%if %{build_go}
+ln -sf ../../../libgo.so.19.* libgo.so
+%endif
+%if %{build_libquadmath}
+ln -sf ../../../libquadmath.so.0.* libquadmath.so
+%endif
+%if %{build_d}
+ln -sf ../../../libgdruntime.so.2.* libgdruntime.so
+ln -sf ../../../libgphobos.so.2.* libgphobos.so
+%endif
+%if %{build_libitm}
+ln -sf ../../../libitm.so.1.* libitm.so
+%endif
+%if %{build_libatomic}
+ln -sf ../../../libatomic.so.1.* libatomic.so
+%endif
+%if %{build_libasan}
+ln -sf ../../../libasan.so.6.* libasan.so
+mv ../../../libasan_preinit.o libasan_preinit.o
+%endif
+%if %{build_libubsan}
+ln -sf ../../../libubsan.so.1.* libubsan.so
+%endif
+else
+%if %{build_objc}
+ln -sf ../../../../%{_lib}/libobjc.so.4 libobjc.so
+%endif
+ln -sf ../../../../%{_lib}/libstdc++.so.6.*[0-9] libstdc++.so
+ln -sf ../../../../%{_lib}/libgfortran.so.5.* libgfortran.so
+ln -sf ../../../../%{_lib}/libgomp.so.1.* libgomp.so
+%if %{build_go}
+ln -sf ../../../../%{_lib}/libgo.so.19.* libgo.so
+%endif
+%if %{build_libquadmath}
+ln -sf ../../../../%{_lib}/libquadmath.so.0.* libquadmath.so
+%endif
+%if %{build_d}
+ln -sf ../../../../%{_lib}/libgdruntime.so.2.* libgdruntime.so
+ln -sf ../../../../%{_lib}/libgphobos.so.2.* libgphobos.so
+%endif
+%if %{build_libitm}
+ln -sf ../../../../%{_lib}/libitm.so.1.* libitm.so
+%endif
+%if %{build_libatomic}
+ln -sf ../../../../%{_lib}/libatomic.so.1.* libatomic.so
+%endif
+%if %{build_libasan}
+ln -sf ../../../../%{_lib}/libasan.so.6.* libasan.so
+mv ../../../../%{_lib}/libasan_preinit.o libasan_preinit.o
+%endif
+%if %{build_libubsan}
+ln -sf ../../../../%{_lib}/libubsan.so.1.* libubsan.so
+%endif
+%if %{build_libtsan}
+rm -f libtsan.so
+echo 'INPUT ( %{_prefix}/%{_lib}/'`echo ../../../../%{_lib}/libtsan.so.0.* | sed 's,^.*libt,libt,'`' )' > libtsan.so
+mv ../../../../%{_lib}/libtsan_preinit.o libtsan_preinit.o
+%endif
+%if %{build_liblsan}
+rm -f liblsan.so
+echo 'INPUT ( %{_prefix}/%{_lib}/'`echo ../../../../%{_lib}/liblsan.so.0.* | sed 's,^.*libl,libl,'`' )' > liblsan.so
+mv ../../../../%{_lib}/liblsan_preinit.o liblsan_preinit.o
+%endif
+fi
+mv -f %{buildroot}%{_prefix}/%{_lib}/libstdc++.*a $FULLLPATH/
+mv -f %{buildroot}%{_prefix}/%{_lib}/libstdc++fs.*a $FULLLPATH/
+mv -f %{buildroot}%{_prefix}/%{_lib}/libsupc++.*a $FULLLPATH/
+mv -f %{buildroot}%{_prefix}/%{_lib}/libgfortran.*a $FULLLPATH/
+%if %{build_objc}
+mv -f %{buildroot}%{_prefix}/%{_lib}/libobjc.*a .
+%endif
+mv -f %{buildroot}%{_prefix}/%{_lib}/libgomp.*a .
+%if %{build_libquadmath}
+mv -f %{buildroot}%{_prefix}/%{_lib}/libquadmath.*a $FULLLPATH/
+%endif
+%if %{build_d}
+mv -f %{buildroot}%{_prefix}/%{_lib}/libgdruntime.*a $FULLLPATH/
+mv -f %{buildroot}%{_prefix}/%{_lib}/libgphobos.*a $FULLLPATH/
+%endif
+%if %{build_libitm}
+mv -f %{buildroot}%{_prefix}/%{_lib}/libitm.*a $FULLLPATH/
+%endif
+%if %{build_libatomic}
+mv -f %{buildroot}%{_prefix}/%{_lib}/libatomic.*a $FULLLPATH/
+%endif
+%if %{build_libasan}
+mv -f %{buildroot}%{_prefix}/%{_lib}/libasan.*a $FULLLPATH/
+%endif
+%if %{build_libubsan}
+mv -f %{buildroot}%{_prefix}/%{_lib}/libubsan.*a $FULLLPATH/
+%endif
+%if %{build_libtsan}
+mv -f %{buildroot}%{_prefix}/%{_lib}/libtsan.*a $FULLPATH/
+%endif
+%if %{build_liblsan}
+mv -f %{buildroot}%{_prefix}/%{_lib}/liblsan.*a $FULLPATH/
+%endif
+%if %{build_go}
+mv -f %{buildroot}%{_prefix}/%{_lib}/libgo.*a $FULLLPATH/
+mv -f %{buildroot}%{_prefix}/%{_lib}/libgobegin.*a $FULLLPATH/
+mv -f %{buildroot}%{_prefix}/%{_lib}/libgolibbegin.*a $FULLLPATH/
+%endif
+
+%if %{build_ada}
+%ifarch sparcv9 ppc
+rm -rf $FULLPATH/64/ada{include,lib}
+%endif
+%ifarch %{multilib_64_archs}
+rm -rf $FULLPATH/32/ada{include,lib}
+%endif
+if [ "$FULLPATH" != "$FULLLPATH" ]; then
+mv -f $FULLPATH/ada{include,lib} $FULLLPATH/
+pushd $FULLLPATH/adalib
+if [ "%{_lib}" = "lib" ]; then
+ln -sf ../../../../../libgnarl-*.so libgnarl.so
+ln -sf ../../../../../libgnarl-*.so libgnarl-11.so
+ln -sf ../../../../../libgnat-*.so libgnat.so
+ln -sf ../../../../../libgnat-*.so libgnat-11.so
+else
+ln -sf ../../../../../../%{_lib}/libgnarl-*.so libgnarl.so
+ln -sf ../../../../../../%{_lib}/libgnarl-*.so libgnarl-11.so
+ln -sf ../../../../../../%{_lib}/libgnat-*.so libgnat.so
+ln -sf ../../../../../../%{_lib}/libgnat-*.so libgnat-11.so
+fi
+popd
+else
+pushd $FULLPATH/adalib
+if [ "%{_lib}" = "lib" ]; then
+ln -sf ../../../../libgnarl-*.so libgnarl.so
+ln -sf ../../../../libgnarl-*.so libgnarl-11.so
+ln -sf ../../../../libgnat-*.so libgnat.so
+ln -sf ../../../../libgnat-*.so libgnat-11.so
+else
+ln -sf ../../../../../%{_lib}/libgnarl-*.so libgnarl.so
+ln -sf ../../../../../%{_lib}/libgnarl-*.so libgnarl-11.so
+ln -sf ../../../../../%{_lib}/libgnat-*.so libgnat.so
+ln -sf ../../../../../%{_lib}/libgnat-*.so libgnat-11.so
+fi
+popd
+fi
+%endif
+
+%ifarch sparcv9 ppc
+%if %{build_objc}
+ln -sf ../../../../../lib64/libobjc.so.4 64/libobjc.so
+%endif
+ln -sf ../`echo ../../../../lib/libstdc++.so.6.*[0-9] | sed s~/lib/~/lib64/~` 64/libstdc++.so
+ln -sf ../`echo ../../../../lib/libgfortran.so.5.* | sed s~/lib/~/lib64/~` 64/libgfortran.so
+ln -sf ../`echo ../../../../lib/libgomp.so.1.* | sed s~/lib/~/lib64/~` 64/libgomp.so
+%if %{build_go}
+rm -f libgo.so
+echo 'INPUT ( %{_prefix}/lib/'`echo ../../../../lib/libgo.so.19.* | sed 's,^.*libg,libg,'`' )' > libgo.so
+echo 'INPUT ( %{_prefix}/lib64/'`echo ../../../../lib/libgo.so.19.* | sed 's,^.*libg,libg,'`' )' > 64/libgo.so
+%endif
+%if %{build_libquadmath}
+rm -f libquadmath.so
+echo 'INPUT ( %{_prefix}/lib/'`echo ../../../../lib/libquadmath.so.0.* | sed 's,^.*libq,libq,'`' )' > libquadmath.so
+echo 'INPUT ( %{_prefix}/lib64/'`echo ../../../../lib/libquadmath.so.0.* | sed 's,^.*libq,libq,'`' )' > 64/libquadmath.so
+%endif
+%if %{build_d}
+rm -f libgdruntime.so libgphobos.so
+echo 'INPUT ( %{_prefix}/lib/'`echo ../../../../lib/libgdruntime.so.2.* | sed 's,^.*libg,libg,'`' )' > libgdruntime.so
+echo 'INPUT ( %{_prefix}/lib64/'`echo ../../../../lib/libgdruntime.so.2.* | sed 's,^.*libg,libg,'`' )' > 64/libgdruntime.so
+echo 'INPUT ( %{_prefix}/lib/'`echo ../../../../lib/libgphobos.so.2.* | sed 's,^.*libg,libg,'`' )' > libgphobos.so
+echo 'INPUT ( %{_prefix}/lib64/'`echo ../../../../lib/libgphobos.so.2.* | sed 's,^.*libg,libg,'`' )' > 64/libgphobos.so
+%endif
+%if %{build_libitm}
+rm -f libitm.so
+echo 'INPUT ( %{_prefix}/lib/'`echo ../../../../lib/libitm.so.1.* | sed 's,^.*libi,libi,'`' )' > libitm.so
+echo 'INPUT ( %{_prefix}/lib64/'`echo ../../../../lib/libitm.so.1.* | sed 's,^.*libi,libi,'`' )' > 64/libitm.so
+%endif
+%if %{build_libatomic}
+rm -f libatomic.so
+echo 'INPUT ( %{_prefix}/lib/'`echo ../../../../lib/libatomic.so.1.* | sed 's,^.*liba,liba,'`' )' > libatomic.so
+echo 'INPUT ( %{_prefix}/lib64/'`echo ../../../../lib/libatomic.so.1.* | sed 's,^.*liba,liba,'`' )' > 64/libatomic.so
+%endif
+%if %{build_libasan}
+rm -f libasan.so
+echo 'INPUT ( %{_prefix}/lib/'`echo ../../../../lib/libasan.so.6.* | sed 's,^.*liba,liba,'`' )' > libasan.so
+echo 'INPUT ( %{_prefix}/lib64/'`echo ../../../../lib/libasan.so.6.* | sed 's,^.*liba,liba,'`' )' > 64/libasan.so
+mv ../../../../lib64/libasan_preinit.o 64/libasan_preinit.o
+%endif
+%if %{build_libubsan}
+rm -f libubsan.so
+echo 'INPUT ( %{_prefix}/lib/'`echo ../../../../lib/libubsan.so.1.* | sed 's,^.*libu,libu,'`' )' > libubsan.so
+echo 'INPUT ( %{_prefix}/lib64/'`echo ../../../../lib/libubsan.so.1.* | sed 's,^.*libu,libu,'`' )' > 64/libubsan.so
+%endif
+ln -sf lib32/libgfortran.a libgfortran.a
+ln -sf ../lib64/libgfortran.a 64/libgfortran.a
+%if %{build_objc}
+mv -f %{buildroot}%{_prefix}/lib64/libobjc.*a 64/
+%endif
+mv -f %{buildroot}%{_prefix}/lib64/libgomp.*a 64/
+ln -sf lib32/libstdc++.a libstdc++.a
+ln -sf ../lib64/libstdc++.a 64/libstdc++.a
+ln -sf lib32/libstdc++fs.a libstdc++fs.a
+ln -sf ../lib64/libstdc++fs.a 64/libstdc++fs.a
+ln -sf lib32/libsupc++.a libsupc++.a
+ln -sf ../lib64/libsupc++.a 64/libsupc++.a
+%if %{build_libquadmath}
+ln -sf lib32/libquadmath.a libquadmath.a
+ln -sf ../lib64/libquadmath.a 64/libquadmath.a
+%endif
+%if %{build_d}
+ln -sf lib32/libgdruntime.a libgdruntime.a
+ln -sf ../lib64/libgdruntime.a 64/libgdruntime.a
+ln -sf lib32/libgphobos.a libgphobos.a
+ln -sf ../lib64/libgphobos.a 64/libgphobos.a
+%endif
+%if %{build_libitm}
+ln -sf lib32/libitm.a libitm.a
+ln -sf ../lib64/libitm.a 64/libitm.a
+%endif
+%if %{build_libatomic}
+ln -sf lib32/libatomic.a libatomic.a
+ln -sf ../lib64/libatomic.a 64/libatomic.a
+%endif
+%if %{build_libasan}
+ln -sf lib32/libasan.a libasan.a
+ln -sf ../lib64/libasan.a 64/libasan.a
+%endif
+%if %{build_libubsan}
+ln -sf lib32/libubsan.a libubsan.a
+ln -sf ../lib64/libubsan.a 64/libubsan.a
+%endif
+%if %{build_go}
+ln -sf lib32/libgo.a libgo.a
+ln -sf ../lib64/libgo.a 64/libgo.a
+ln -sf lib32/libgobegin.a libgobegin.a
+ln -sf ../lib64/libgobegin.a 64/libgobegin.a
+ln -sf lib32/libgolibbegin.a libgolibbegin.a
+ln -sf ../lib64/libgolibbegin.a 64/libgolibbegin.a
+%endif
+%if %{build_ada}
+ln -sf lib32/adainclude adainclude
+ln -sf ../lib64/adainclude 64/adainclude
+ln -sf lib32/adalib adalib
+ln -sf ../lib64/adalib 64/adalib
+%endif
+%endif
+%ifarch %{multilib_64_archs}
+mkdir -p 32
+%if %{build_objc}
+ln -sf ../../../../libobjc.so.4 32/libobjc.so
+%endif
+ln -sf ../`echo ../../../../lib64/libstdc++.so.6.*[0-9] | sed s~/../lib64/~/~` 32/libstdc++.so
+ln -sf ../`echo ../../../../lib64/libgfortran.so.5.* | sed s~/../lib64/~/~` 32/libgfortran.so
+ln -sf ../`echo ../../../../lib64/libgomp.so.1.* | sed s~/../lib64/~/~` 32/libgomp.so
+%if %{build_go}
+rm -f libgo.so
+echo 'INPUT ( %{_prefix}/lib64/'`echo ../../../../lib64/libgo.so.19.* | sed 's,^.*libg,libg,'`' )' > libgo.so
+echo 'INPUT ( %{_prefix}/lib/'`echo ../../../../lib64/libgo.so.19.* | sed 's,^.*libg,libg,'`' )' > 32/libgo.so
+%endif
+%if %{build_libquadmath}
+rm -f libquadmath.so
+echo 'INPUT ( %{_prefix}/lib64/'`echo ../../../../lib64/libquadmath.so.0.* | sed 's,^.*libq,libq,'`' )' > libquadmath.so
+echo 'INPUT ( %{_prefix}/lib/'`echo ../../../../lib64/libquadmath.so.0.* | sed 's,^.*libq,libq,'`' )' > 32/libquadmath.so
+%endif
+%if %{build_d}
+rm -f libgdruntime.so libgphobos.so
+echo 'INPUT ( %{_prefix}/lib64/'`echo ../../../../lib64/libgdruntime.so.2.* | sed 's,^.*libg,libg,'`' )' > libgdruntime.so
+echo 'INPUT ( %{_prefix}/lib/'`echo ../../../../lib64/libgdruntime.so.2.* | sed 's,^.*libg,libg,'`' )' > 32/libgdruntime.so
+echo 'INPUT ( %{_prefix}/lib64/'`echo ../../../../lib64/libgphobos.so.2.* | sed 's,^.*libg,libg,'`' )' > libgphobos.so
+echo 'INPUT ( %{_prefix}/lib/'`echo ../../../../lib64/libgphobos.so.2.* | sed 's,^.*libg,libg,'`' )' > 32/libgphobos.so
+%endif
+%if %{build_libitm}
+rm -f libitm.so
+echo 'INPUT ( %{_prefix}/lib64/'`echo ../../../../lib64/libitm.so.1.* | sed 's,^.*libi,libi,'`' )' > libitm.so
+echo 'INPUT ( %{_prefix}/lib/'`echo ../../../../lib64/libitm.so.1.* | sed 's,^.*libi,libi,'`' )' > 32/libitm.so
+%endif
+%if %{build_libatomic}
+rm -f libatomic.so
+echo 'INPUT ( %{_prefix}/lib64/'`echo ../../../../lib64/libatomic.so.1.* | sed 's,^.*liba,liba,'`' )' > libatomic.so
+echo 'INPUT ( %{_prefix}/lib/'`echo ../../../../lib64/libatomic.so.1.* | sed 's,^.*liba,liba,'`' )' > 32/libatomic.so
+%endif
+%if %{build_libasan}
+rm -f libasan.so
+echo 'INPUT ( %{_prefix}/lib64/'`echo ../../../../lib64/libasan.so.6.* | sed 's,^.*liba,liba,'`' )' > libasan.so
+echo 'INPUT ( %{_prefix}/lib/'`echo ../../../../lib64/libasan.so.6.* | sed 's,^.*liba,liba,'`' )' > 32/libasan.so
+mv ../../../../lib/libasan_preinit.o 32/libasan_preinit.o
+%endif
+%if %{build_libubsan}
+rm -f libubsan.so
+echo 'INPUT ( %{_prefix}/lib64/'`echo ../../../../lib64/libubsan.so.1.* | sed 's,^.*libu,libu,'`' )' > libubsan.so
+echo 'INPUT ( %{_prefix}/lib/'`echo ../../../../lib64/libubsan.so.1.* | sed 's,^.*libu,libu,'`' )' > 32/libubsan.so
+%endif
+%if %{build_objc}
+mv -f %{buildroot}%{_prefix}/lib/libobjc.*a 32/
+%endif
+mv -f %{buildroot}%{_prefix}/lib/libgomp.*a 32/
+%endif
+%ifarch sparc64 ppc64 ppc64p7
+ln -sf ../lib32/libgfortran.a 32/libgfortran.a
+ln -sf lib64/libgfortran.a libgfortran.a
+ln -sf ../lib32/libstdc++.a 32/libstdc++.a
+ln -sf lib64/libstdc++.a libstdc++.a
+ln -sf ../lib32/libstdc++fs.a 32/libstdc++fs.a
+ln -sf lib64/libstdc++fs.a libstdc++fs.a
+ln -sf ../lib32/libsupc++.a 32/libsupc++.a
+ln -sf lib64/libsupc++.a libsupc++.a
+%if %{build_libquadmath}
+ln -sf ../lib32/libquadmath.a 32/libquadmath.a
+ln -sf lib64/libquadmath.a libquadmath.a
+%endif
+%if %{build_d}
+ln -sf ../lib32/libgdruntime.a 32/libgdruntime.a
+ln -sf lib64/libgdruntime.a libgdruntime.a
+ln -sf ../lib32/libgphobos.a 32/libgphobos.a
+ln -sf lib64/libgphobos.a libgphobos.a
+%endif
+%if %{build_libitm}
+ln -sf ../lib32/libitm.a 32/libitm.a
+ln -sf lib64/libitm.a libitm.a
+%endif
+%if %{build_libatomic}
+ln -sf ../lib32/libatomic.a 32/libatomic.a
+ln -sf lib64/libatomic.a libatomic.a
+%endif
+%if %{build_libasan}
+ln -sf ../lib32/libasan.a 32/libasan.a
+ln -sf lib64/libasan.a libasan.a
+%endif
+%if %{build_libubsan}
+ln -sf ../lib32/libubsan.a 32/libubsan.a
+ln -sf lib64/libubsan.a libubsan.a
+%endif
+%if %{build_go}
+ln -sf ../lib32/libgo.a 32/libgo.a
+ln -sf lib64/libgo.a libgo.a
+ln -sf ../lib32/libgobegin.a 32/libgobegin.a
+ln -sf lib64/libgobegin.a libgobegin.a
+ln -sf ../lib32/libgolibbegin.a 32/libgolibbegin.a
+ln -sf lib64/libgolibbegin.a libgolibbegin.a
+%endif
+%if %{build_ada}
+ln -sf ../lib32/adainclude 32/adainclude
+ln -sf lib64/adainclude adainclude
+ln -sf ../lib32/adalib 32/adalib
+ln -sf lib64/adalib adalib
+%endif
+%else
+%ifarch %{multilib_64_archs}
+ln -sf ../../../%{multilib_32_arch}-%{_vendor}-%{_target_os}/%{gcc_major}/libgfortran.a 32/libgfortran.a
+ln -sf ../../../%{multilib_32_arch}-%{_vendor}-%{_target_os}/%{gcc_major}/libstdc++.a 32/libstdc++.a
+ln -sf ../../../%{multilib_32_arch}-%{_vendor}-%{_target_os}/%{gcc_major}/libstdc++fs.a 32/libstdc++fs.a
+ln -sf ../../../%{multilib_32_arch}-%{_vendor}-%{_target_os}/%{gcc_major}/libsupc++.a 32/libsupc++.a
+%if %{build_libquadmath}
+ln -sf ../../../%{multilib_32_arch}-%{_vendor}-%{_target_os}/%{gcc_major}/libquadmath.a 32/libquadmath.a
+%endif
+%if %{build_d}
+ln -sf ../../../%{multilib_32_arch}-%{_vendor}-%{_target_os}/%{gcc_major}/libgdruntime.a 32/libgdruntime.a
+ln -sf ../../../%{multilib_32_arch}-%{_vendor}-%{_target_os}/%{gcc_major}/libgphobos.a 32/libgphobos.a
+%endif
+%if %{build_libitm}
+ln -sf ../../../%{multilib_32_arch}-%{_vendor}-%{_target_os}/%{gcc_major}/libitm.a 32/libitm.a
+%endif
+%if %{build_libatomic}
+ln -sf ../../../%{multilib_32_arch}-%{_vendor}-%{_target_os}/%{gcc_major}/libatomic.a 32/libatomic.a
+%endif
+%if %{build_libasan}
+ln -sf ../../../%{multilib_32_arch}-%{_vendor}-%{_target_os}/%{gcc_major}/libasan.a 32/libasan.a
+%endif
+%if %{build_libubsan}
+ln -sf ../../../%{multilib_32_arch}-%{_vendor}-%{_target_os}/%{gcc_major}/libubsan.a 32/libubsan.a
+%endif
+%if %{build_go}
+ln -sf ../../../%{multilib_32_arch}-%{_vendor}-%{_target_os}/%{gcc_major}/libgo.a 32/libgo.a
+ln -sf ../../../%{multilib_32_arch}-%{_vendor}-%{_target_os}/%{gcc_major}/libgobegin.a 32/libgobegin.a
+ln -sf ../../../%{multilib_32_arch}-%{_vendor}-%{_target_os}/%{gcc_major}/libgolibbegin.a 32/libgolibbegin.a
+%endif
+%if %{build_ada}
+ln -sf ../../../%{multilib_32_arch}-%{_vendor}-%{_target_os}/%{gcc_major}/adainclude 32/adainclude
+ln -sf ../../../%{multilib_32_arch}-%{_vendor}-%{_target_os}/%{gcc_major}/adalib 32/adalib
+%endif
+%endif
+%endif
+
+# If we are building a debug package then copy all of the static archives
+# into the debug directory to keep them as unstripped copies.
+%if 0%{?_enable_debug_packages}
+for d in . $FULLLSUBDIR; do
+ mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/debug%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/$d
+ for f in `find $d -maxdepth 1 -a \
+ \( -name libasan.a -o -name libatomic.a \
+ -o -name libcaf_single.a \
+ -o -name libgcc.a -o -name libgcc_eh.a \
+ -o -name libgcov.a -o -name libgfortran.a \
+ -o -name libgo.a -o -name libgobegin.a \
+ -o -name libgolibbegin.a -o -name libgomp.a \
+ -o -name libitm.a -o -name liblsan.a \
+ -o -name libobjc.a -o -name libgdruntime.a -o -name libgphobos.a \
+ -o -name libquadmath.a -o -name libstdc++.a \
+ -o -name libstdc++fs.a -o -name libsupc++.a \
+ -o -name libtsan.a -o -name libubsan.a \) -a -type f`; do
+ cp -a $f $RPM_BUILD_ROOT%{_prefix}/lib/debug%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/$d/
+ done
+done
+%endif
+
+# Strip debug info from Fortran/ObjC/Java static libraries
+strip -g `find . \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \
+ -o -name libgcc.a -o -name libgcov.a -o -name libquadmath.a \
+ -o -name libgdruntime.a -o -name libgphobos.a \
+ -o -name libitm.a -o -name libgo.a -o -name libcaf\*.a \
+ -o -name libatomic.a -o -name libasan.a -o -name libtsan.a \
+ -o -name libubsan.a -o -name liblsan.a -o -name libcc1.a \) \
+ -a -type f`
+popd
+chmod 755 %{buildroot}%{_prefix}/%{_lib}/libgfortran.so.5.*
+chmod 755 %{buildroot}%{_prefix}/%{_lib}/libgomp.so.1.*
+chmod 755 %{buildroot}%{_prefix}/%{_lib}/libcc1.so.0.*
+%if %{build_libquadmath}
+chmod 755 %{buildroot}%{_prefix}/%{_lib}/libquadmath.so.0.*
+%endif
+%if %{build_d}
+chmod 755 %{buildroot}%{_prefix}/%{_lib}/libgdruntime.so.2.*
+chmod 755 %{buildroot}%{_prefix}/%{_lib}/libgphobos.so.2.*
+%endif
+%if %{build_libitm}
+chmod 755 %{buildroot}%{_prefix}/%{_lib}/libitm.so.1.*
+%endif
+%if %{build_libatomic}
+chmod 755 %{buildroot}%{_prefix}/%{_lib}/libatomic.so.1.*
+%endif
+%if %{build_libasan}
+chmod 755 %{buildroot}%{_prefix}/%{_lib}/libasan.so.6.*
+%endif
+%if %{build_libubsan}
+chmod 755 %{buildroot}%{_prefix}/%{_lib}/libubsan.so.1.*
+%endif
+%if %{build_libtsan}
+chmod 755 %{buildroot}%{_prefix}/%{_lib}/libtsan.so.0.*
+%endif
+%if %{build_liblsan}
+chmod 755 %{buildroot}%{_prefix}/%{_lib}/liblsan.so.0.*
+%endif
+%if %{build_go}
+# Avoid stripping these libraries and binaries.
+chmod 644 %{buildroot}%{_prefix}/%{_lib}/libgo.so.19.*
+chmod 644 %{buildroot}%{_prefix}/bin/go.gcc
+chmod 644 %{buildroot}%{_prefix}/bin/gofmt.gcc
+chmod 644 %{buildroot}%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/cgo
+chmod 644 %{buildroot}%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/buildid
+chmod 644 %{buildroot}%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/test2json
+chmod 644 %{buildroot}%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/vet
+%endif
+%if %{build_objc}
+chmod 755 %{buildroot}%{_prefix}/%{_lib}/libobjc.so.4.*
+%endif
+
+%if %{build_ada}
+chmod 755 %{buildroot}%{_prefix}/%{_lib}/libgnarl*so*
+chmod 755 %{buildroot}%{_prefix}/%{_lib}/libgnat*so*
+%endif
+
+mv $FULLPATH/include-fixed/syslimits.h $FULLPATH/include/syslimits.h
+mv $FULLPATH/include-fixed/limits.h $FULLPATH/include/limits.h
+for h in `find $FULLPATH/include -name \*.h`; do
+ if grep -q 'It has been auto-edited by fixincludes from' $h; then
+ rh=`grep -A2 'It has been auto-edited by fixincludes from' $h | tail -1 | sed 's|^.*"\(.*\)".*$|\1|'`
+ diff -up $rh $h || :
+ rm -f $h
+ fi
+done
+
+cat > %{buildroot}%{_prefix}/bin/c89 <<"EOF"
+#!/bin/sh
+fl="-std=c89"
+for opt; do
+ case "$opt" in
+ -ansi|-std=c89|-std=iso9899:1990) fl="";;
+ -std=*) echo "`basename $0` called with non ANSI/ISO C option $opt" >&2
+ exit 1;;
+ esac
+done
+exec gcc $fl ${1+"$@"}
+EOF
+cat > %{buildroot}%{_prefix}/bin/c99 <<"EOF"
+#!/bin/sh
+fl="-std=c99"
+for opt; do
+ case "$opt" in
+ -std=c99|-std=iso9899:1999) fl="";;
+ -std=*) echo "`basename $0` called with non ISO C99 option $opt" >&2
+ exit 1;;
+ esac
+done
+exec gcc $fl ${1+"$@"}
+EOF
+chmod 755 %{buildroot}%{_prefix}/bin/c?9
+
+cd ..
+%find_lang %{name}
+%find_lang cpplib
+
+# Remove binaries we will not be including, so that they don't end up in
+# gcc-debuginfo
+rm -f %{buildroot}%{_prefix}/%{_lib}/{libffi*,libiberty.a} || :
+rm -f $FULLEPATH/install-tools/{mkheaders,fixincl}
+rm -f %{buildroot}%{_prefix}/lib/{32,64}/libiberty.a
+rm -f %{buildroot}%{_prefix}/%{_lib}/libssp*
+rm -f %{buildroot}%{_prefix}/%{_lib}/libvtv* || :
+rm -f %{buildroot}%{_prefix}/bin/%{_target_platform}-gfortran || :
+rm -f %{buildroot}%{_prefix}/bin/%{_target_platform}-gccgo || :
+rm -f %{buildroot}%{_prefix}/bin/%{_target_platform}-gcj || :
+rm -f %{buildroot}%{_prefix}/bin/%{_target_platform}-gcc-ar || :
+rm -f %{buildroot}%{_prefix}/bin/%{_target_platform}-gcc-nm || :
+rm -f %{buildroot}%{_prefix}/bin/%{_target_platform}-gcc-ranlib || :
+rm -f %{buildroot}%{_prefix}/bin/%{_target_platform}-gdc || :
+
+%ifarch %{multilib_64_archs}
+# Remove libraries for the other arch on multilib arches
+rm -f %{buildroot}%{_prefix}/lib/lib*.so*
+rm -f %{buildroot}%{_prefix}/lib/lib*.a
+rm -f %{buildroot}/lib/libgcc_s*.so*
+%if %{build_go}
+rm -rf %{buildroot}%{_prefix}/lib/go/%{gcc_major}/%{gcc_target_platform}
+%ifnarch sparc64 ppc64 ppc64p7
+ln -sf %{multilib_32_arch}-%{_vendor}-%{_target_os} %{buildroot}%{_prefix}/lib/go/%{gcc_major}/%{gcc_target_platform}
+%endif
+%endif
+%else
+%ifarch sparcv9 ppc
+rm -f %{buildroot}%{_prefix}/lib64/lib*.so*
+rm -f %{buildroot}%{_prefix}/lib64/lib*.a
+rm -f %{buildroot}/lib64/libgcc_s*.so*
+%if %{build_go}
+rm -rf %{buildroot}%{_prefix}/lib64/go/%{gcc_major}/%{gcc_target_platform}
+%endif
+%endif
+%endif
+
+rm -f %{buildroot}%{mandir}/man3/ffi*
+
+# Help plugins find out nvra.
+echo gcc-%{version}-%{release}.%{_arch} > $FULLPATH/rpmver
+
+# Add symlink to lto plugin in the binutils plugin directory.
+%{__mkdir_p} %{buildroot}%{_libdir}/bfd-plugins/
+ln -s ../../libexec/gcc/%{gcc_target_platform}/%{gcc_major}/liblto_plugin.so \
+ %{buildroot}%{_libdir}/bfd-plugins/
+
+# Rename the annobin plugin to gcc-annobin.
+mkdir -p %{buildroot}%{ANNOBIN_GCC_PLUGIN_DIR}
+pushd %{buildroot}%{ANNOBIN_GCC_PLUGIN_DIR}
+
+annobin_dir=$(find %{_builddir} -maxdepth 1 -type d -name "annobin*")
+echo "annobin directory = ${annobin_dir}"
+
+cp ${annobin_dir}/gcc-plugin/.libs/annobin.so.0.0.0 gcc-annobin.so.0.0.0
+
+rm -f gcc-annobin.so.0 gcc-annobin.so
+ln -s gcc-annobin.so.0.0.0 gcc-annobin.so.0
+ln -s gcc-annobin.so.0.0.0 gcc-annobin.so
+popd
+
+%check
+cd obj-%{gcc_target_platform}
+
+# run the tests.
+LC_ALL=C make %{?_smp_mflags} -k check ALT_CC_UNDER_TEST=gcc ALT_CXX_UNDER_TEST=g++ \
+%if 0%{?fedora} >= 20 || 0%{?rhel} > 7
+ RUNTESTFLAGS="--target_board=unix/'{,-fstack-protector-strong}'" || :
+%else
+ RUNTESTFLAGS="--target_board=unix/'{,-fstack-protector}'" || :
+%endif
+if [ -f %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/plugin/annobin.so ]; then
+ # Test whether current annobin plugin won't fail miserably with the newly built gcc.
+ echo -e '#include \nint main () { printf ("Hello, world!\\n"); return 0; }' > annobin-test.c
+ echo -e '#include \nint main () { std::cout << "Hello, world!" << std::endl; return 0; }' > annobin-test.C
+ `%{gcc_target_platform}/libstdc++-v3/scripts/testsuite_flags --build-cc` \
+ -O2 -g -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS \
+ -fexceptions -fstack-protector-strong -grecord-gcc-switches -o annobin-test{c,.c} \
+ -Wl,-rpath,%{gcc_target_platform}/libgcc/ \
+ -fplugin=%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/plugin/annobin.so \
+ 2> ANNOBINOUT1 || echo Annobin test 1 FAIL > ANNOBINOUT2;
+ `%{gcc_target_platform}/libstdc++-v3/scripts/testsuite_flags --build-cxx` \
+ `%{gcc_target_platform}/libstdc++-v3/scripts/testsuite_flags --build-includes` \
+ -O2 -g -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS \
+ -fexceptions -fstack-protector-strong -grecord-gcc-switches -o annobin-test{C,.C} \
+ -Wl,-rpath,%{gcc_target_platform}/libgcc/:%{gcc_target_platform}/libstdc++-v3/src/.libs/ \
+ -fplugin=%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/plugin/annobin.so \
+ -B %{gcc_target_platform}/libstdc++-v3/src/.libs/ \
+ 2> ANNOBINOUT3 || echo Annobin test 2 FAIL > ANNOBINOUT4;
+ [ -f ./annobin-testc ] || echo Annobin test 1 MISSING > ANNOBINOUT5;
+ [ -f ./annobin-testc ] && \
+ ( ./annobin-testc > ANNOBINRES1 2>&1 || echo Annobin test 1 RUNFAIL > ANNOBINOUT6 );
+ [ -f ./annobin-testC ] || echo Annobin test 2 MISSING > ANNOBINOUT7;
+ [ -f ./annobin-testC ] && \
+ ( ./annobin-testC > ANNOBINRES2 2>&1 || echo Annobin test 2 RUNFAIL > ANNOBINOUT8 );
+ cat ANNOBINOUT[1-8] > ANNOBINOUT
+ touch ANNOBINRES1 ANNOBINRES2
+ [ -s ANNOBINOUT ] && echo Annobin testing FAILed > ANNOBINRES
+ cat ANNOBINOUT ANNOBINRES[12] >> ANNOBINRES
+ rm -f ANNOBINOUT* ANNOBINRES[12] annobin-test{c,C}
+fi
+echo ====================TESTING=========================
+( LC_ALL=C ../contrib/test_summary || : ) 2>&1 | sed -n '/^cat.*EOF/,/^EOF/{/^cat.*EOF/d;/^EOF/d;/^LAST_UPDATED:/d;p;}'
+[ -f ANNOBINRES ] && cat ANNOBINRES
+echo ====================TESTING END=====================
+mkdir testlogs-%{_target_platform}-%{version}-%{release}
+for i in `find . -name \*.log | grep -F testsuite/ | grep -v 'config.log\|acats.*/tests/'`; do
+ ln $i testlogs-%{_target_platform}-%{version}-%{release}/ || :
+done
+tar cf - testlogs-%{_target_platform}-%{version}-%{release} | xz -9e \
+ | uuencode testlogs-%{_target_platform}.tar.xz || :
+rm -rf testlogs-%{_target_platform}-%{version}-%{release}
+
+%post go
+%{_sbindir}/update-alternatives --install \
+ %{_prefix}/bin/go go %{_prefix}/bin/go.gcc 92 \
+ --slave %{_prefix}/bin/gofmt gofmt %{_prefix}/bin/gofmt.gcc
+
+%preun go
+if [ $1 = 0 ]; then
+ %{_sbindir}/update-alternatives --remove go %{_prefix}/bin/go.gcc
+fi
+
+# Because glibc Prereq's libgcc and /sbin/ldconfig
+# comes from glibc, it might not exist yet when
+# libgcc is installed
+%post -n libgcc -p
+if posix.access ("/sbin/ldconfig", "x") then
+ local pid = posix.fork ()
+ if pid == 0 then
+ posix.exec ("/sbin/ldconfig")
+ elseif pid ~= -1 then
+ posix.wait (pid)
+ end
+end
+
+%postun -n libgcc -p
+if posix.access ("/sbin/ldconfig", "x") then
+ local pid = posix.fork ()
+ if pid == 0 then
+ posix.exec ("/sbin/ldconfig")
+ elseif pid ~= -1 then
+ posix.wait (pid)
+ end
+end
+
+%ldconfig_scriptlets -n libstdc++
+
+%ldconfig_scriptlets -n libobjc
+
+%ldconfig_scriptlets -n libgfortran
+
+%ldconfig_scriptlets -n libgphobos
+
+%ldconfig_scriptlets -n libgnat
+
+%ldconfig_scriptlets -n libgomp
+
+%ldconfig_scriptlets gdb-plugin
+
+%ldconfig_scriptlets -n libgccjit
+
+%ldconfig_scriptlets -n libquadmath
+
+%ldconfig_scriptlets -n libitm
+
+%ldconfig_scriptlets -n libatomic
+
+%ldconfig_scriptlets -n libasan
+
+%ldconfig_scriptlets -n libubsan
+
+%ldconfig_scriptlets -n libtsan
+
+%ldconfig_scriptlets -n liblsan
+
+%ldconfig_scriptlets -n libgo
+
+%files -f %{name}.lang
+%{_prefix}/bin/cc
+%{_prefix}/bin/c89
+%{_prefix}/bin/c99
+%{_prefix}/bin/gcc
+%{_prefix}/bin/gcov
+%{_prefix}/bin/gcov-tool
+%{_prefix}/bin/gcov-dump
+%{_prefix}/bin/gcc-ar
+%{_prefix}/bin/gcc-nm
+%{_prefix}/bin/gcc-ranlib
+%{_prefix}/bin/lto-dump
+%ifarch ppc
+%{_prefix}/bin/%{_target_platform}-gcc
+%endif
+%ifarch sparc64 sparcv9
+%{_prefix}/bin/sparc-%{_vendor}-%{_target_os}-gcc
+%endif
+%ifarch ppc64 ppc64p7
+%{_prefix}/bin/ppc-%{_vendor}-%{_target_os}-gcc
+%endif
+%{_prefix}/bin/%{gcc_target_platform}-gcc
+%{_prefix}/bin/%{gcc_target_platform}-gcc-%{gcc_major}
+%{_mandir}/man1/gcc.1*
+%{_mandir}/man1/gcov.1*
+%{_mandir}/man1/gcov-tool.1*
+%{_mandir}/man1/gcov-dump.1*
+%{_mandir}/man1/lto-dump.1*
+%{_infodir}/gcc*
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%dir %{_prefix}/libexec/gcc
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include
+%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/lto1
+%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/lto-wrapper
+%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/liblto_plugin.so*
+%{_libdir}/bfd-plugins/liblto_plugin.so
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/rpmver
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/stddef.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/stdarg.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/stdfix.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/varargs.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/float.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/limits.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/stdbool.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/iso646.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/syslimits.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/unwind.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/omp.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/openacc.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/acc_prof.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/stdint.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/stdint-gcc.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/stdalign.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/stdnoreturn.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/stdatomic.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/gcov.h
+%ifarch %{ix86} x86_64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/mmintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/xmmintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/emmintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/pmmintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/tmmintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/ammintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/smmintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/nmmintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/bmmintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/wmmintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/immintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avxintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/x86intrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/fma4intrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/xopintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/lwpintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/popcntintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/bmiintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/tbmintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/ia32intrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx2intrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/bmi2intrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/f16cintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/fmaintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/lzcntintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/rtmintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/xtestintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/adxintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/prfchwintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/rdseedintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/fxsrintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/xsaveintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/xsaveoptintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512cdintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512erintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512fintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512pfintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/shaintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/mm_malloc.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/mm3dnow.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/cpuid.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/cross-stdarg.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512bwintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512dqintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512ifmaintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512ifmavlintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512vbmiintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512vbmivlintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512vlbwintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512vldqintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512vlintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/clflushoptintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/clwbintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/mwaitxintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/xsavecintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/xsavesintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/clzerointrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/pkuintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx5124fmapsintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx5124vnniwintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512vpopcntdqintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/sgxintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/gfniintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/cetintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/cet.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512vbmi2intrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512vbmi2vlintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512vnniintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512vnnivlintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/vaesintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/vpclmulqdqintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512vpopcntdqvlintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512bitalgintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/pconfigintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/wbnoinvdintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/movdirintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/waitpkgintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/cldemoteintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512bf16vlintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512bf16intrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/enqcmdintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512vp2intersectintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avx512vp2intersectvlintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/serializeintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/tsxldtrkintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/amxtileintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/amxint8intrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/amxbf16intrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/x86gprintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/uintrintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/hresetintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/keylockerintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/avxvnniintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/mwaitintrin.h
+%endif
+%ifarch ia64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/ia64intrin.h
+%endif
+%ifarch ppc ppc64 ppc64le ppc64p7
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/ppc-asm.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/altivec.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/ppu_intrinsics.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/si2vmx.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/spu2vmx.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/vec_types.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/htmintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/htmxlintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/bmi2intrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/bmiintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/xmmintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/mm_malloc.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/emmintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/mmintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/x86intrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/pmmintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/tmmintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/smmintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/amo.h
+%endif
+%ifarch %{arm}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/unwind-arm-common.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/mmintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/arm_neon.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/arm_acle.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/arm_cmse.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/arm_fp16.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/arm_bf16.h
+%endif
+%ifarch aarch64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/arm_neon.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/arm_acle.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/arm_fp16.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/arm_bf16.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/arm_sve.h
+%endif
+%ifarch sparc sparcv9 sparc64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/visintrin.h
+%endif
+%ifarch s390 s390x
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/s390intrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/htmintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/htmxlintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/vecintrin.h
+%endif
+%if %{build_libasan}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/sanitizer
+%endif
+%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/collect2
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/crt*.o
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgcc.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgcov.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgcc_eh.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgcc_s.so
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgomp.spec
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgomp.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgomp.so
+%if %{build_libitm}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libitm.spec
+%endif
+%if %{build_libasan}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libsanitizer.spec
+%endif
+%if %{build_isl}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libisl.so.*
+%endif
+%ifarch sparcv9 ppc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/crt*.o
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libgcc.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libgcov.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libgcc_eh.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libgcc_s.so
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libgomp.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libgomp.so
+%if %{build_libquadmath}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libquadmath.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libquadmath.so
+%endif
+%if %{build_libitm}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libitm.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libitm.so
+%endif
+%if %{build_libatomic}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libatomic.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libatomic.so
+%endif
+%if %{build_libasan}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libasan.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libasan.so
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libasan_preinit.o
+%endif
+%if %{build_libubsan}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libubsan.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libubsan.so
+%endif
+%endif
+%ifarch %{multilib_64_archs}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/crt*.o
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libgcc.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libgcov.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libgcc_eh.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libgcc_s.so
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libgomp.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libgomp.so
+%if %{build_libquadmath}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libquadmath.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libquadmath.so
+%endif
+%if %{build_libitm}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libitm.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libitm.so
+%endif
+%if %{build_libatomic}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libatomic.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libatomic.so
+%endif
+%if %{build_libasan}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libasan.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libasan.so
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libasan_preinit.o
+%endif
+%if %{build_libubsan}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libubsan.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libubsan.so
+%endif
+%endif
+%ifarch sparcv9 sparc64 ppc ppc64 ppc64p7
+%if %{build_libquadmath}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libquadmath.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libquadmath.so
+%endif
+%if %{build_libitm}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libitm.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libitm.so
+%endif
+%if %{build_libatomic}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libatomic.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libatomic.so
+%endif
+%if %{build_libasan}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libasan.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libasan.so
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libasan_preinit.o
+%endif
+%if %{build_libubsan}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libubsan.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libubsan.so
+%endif
+%else
+%if %{build_libatomic}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libatomic.so
+%endif
+%if %{build_libasan}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libasan.so
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libasan_preinit.o
+%endif
+%if %{build_libubsan}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libubsan.so
+%endif
+%endif
+%if %{build_libtsan}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libtsan.so
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libtsan_preinit.o
+%endif
+%if %{build_liblsan}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/liblsan.so
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/liblsan_preinit.o
+%endif
+%{_prefix}/libexec/getconf/default
+%doc gcc/README* rpm.doc/changelogs/gcc/ChangeLog*
+%{!?_licensedir:%global license %%doc}
+%license gcc/COPYING* COPYING.RUNTIME
+
+%files -n cpp -f cpplib.lang
+%{_prefix}/lib/cpp
+%{_prefix}/bin/cpp
+%{_mandir}/man1/cpp.1*
+%{_infodir}/cpp*
+%dir %{_prefix}/libexec/gcc
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}
+%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/cc1
+
+%files -n libgcc
+/%{_lib}/libgcc_s-%{gcc_major}-%{DATE}.so.1
+/%{_lib}/libgcc_s.so.1
+%{!?_licensedir:%global license %%doc}
+%license gcc/COPYING* COPYING.RUNTIME
+
+%files c++
+%{_prefix}/bin/%{gcc_target_platform}-*++
+%{_prefix}/bin/g++
+%{_prefix}/bin/c++
+%{_mandir}/man1/g++.1*
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%dir %{_prefix}/libexec/gcc
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}
+%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/cc1plus
+%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/g++-mapper-server
+%ifarch sparcv9 ppc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libstdc++.so
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libstdc++.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libstdc++fs.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libsupc++.a
+%endif
+%ifarch %{multilib_64_archs}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libstdc++.so
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libstdc++.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libstdc++fs.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libsupc++.a
+%endif
+%ifarch sparcv9 ppc %{multilib_64_archs}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libstdc++.so
+%endif
+%ifarch sparcv9 sparc64 ppc ppc64 ppc64p7
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libstdc++.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libstdc++fs.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libsupc++.a
+%endif
+%doc rpm.doc/changelogs/gcc/cp/ChangeLog*
+
+%files -n libstdc++
+%{_prefix}/%{_lib}/libstdc++.so.6*
+%dir %{_datadir}/gdb
+%dir %{_datadir}/gdb/auto-load
+%dir %{_datadir}/gdb/auto-load/%{_prefix}
+%dir %{_datadir}/gdb/auto-load/%{_prefix}/%{_lib}/
+# Package symlink to keep compatibility
+%ifarch riscv64
+%{_datadir}/gdb/auto-load/%{_prefix}/%{_lib}/lp64d
+%endif
+%{_datadir}/gdb/auto-load/%{_prefix}/%{_lib}/libstdc*gdb.py*
+%{_datadir}/gdb/auto-load/%{_prefix}/%{_lib}/__pycache__
+%dir %{_prefix}/share/gcc-%{gcc_major}
+%dir %{_prefix}/share/gcc-%{gcc_major}/python
+%{_prefix}/share/gcc-%{gcc_major}/python/libstdcxx
+
+%files -n libstdc++-devel
+%dir %{_prefix}/include/c++
+%{_prefix}/include/c++/%{gcc_major}
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%ifnarch sparcv9 ppc %{multilib_64_archs}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libstdc++.so
+%endif
+%ifarch sparcv9 ppc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32/libstdc++fs.a
+%endif
+%ifarch sparc64 ppc64 ppc64p7
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64/libstdc++fs.a
+%endif
+%ifnarch sparcv9 sparc64 ppc ppc64 ppc64p7
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libstdc++fs.a
+%endif
+%doc rpm.doc/changelogs/libstdc++-v3/ChangeLog* libstdc++-v3/README*
+
+%files -n libstdc++-static
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%ifarch sparcv9 ppc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32/libstdc++.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32/libsupc++.a
+%endif
+%ifarch sparc64 ppc64 ppc64p7
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64/libstdc++.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64/libsupc++.a
+%endif
+%ifnarch sparcv9 sparc64 ppc ppc64 ppc64p7
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libstdc++.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libsupc++.a
+%endif
+
+%if %{build_libstdcxx_docs}
+%files -n libstdc++-docs
+%{_mandir}/man3/*
+%doc rpm.doc/libstdc++-v3/html
+%endif
+
+%if %{build_objc}
+%files objc
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%dir %{_prefix}/libexec/gcc
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/objc
+%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/cc1obj
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libobjc.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libobjc.so
+%ifarch sparcv9 ppc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libobjc.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libobjc.so
+%endif
+%ifarch %{multilib_64_archs}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libobjc.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libobjc.so
+%endif
+%doc rpm.doc/objc/*
+%doc libobjc/THREADS* rpm.doc/changelogs/libobjc/ChangeLog*
+
+%files objc++
+%dir %{_prefix}/libexec/gcc
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}
+%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/cc1objplus
+
+%files -n libobjc
+%{_prefix}/%{_lib}/libobjc.so.4*
+%endif
+
+%files gfortran
+%{_prefix}/bin/gfortran
+%{_prefix}/bin/f95
+%{_mandir}/man1/gfortran.1*
+%{_infodir}/gfortran*
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%dir %{_prefix}/libexec/gcc
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/finclude
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/ISO_Fortran_binding.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/finclude/omp_lib.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/finclude/omp_lib.f90
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/finclude/omp_lib.mod
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/finclude/omp_lib_kinds.mod
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/finclude/openacc.f90
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/finclude/openacc.mod
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/finclude/openacc_kinds.mod
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/finclude/openacc_lib.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/finclude/ieee_arithmetic.mod
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/finclude/ieee_exceptions.mod
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/finclude/ieee_features.mod
+%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/f951
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgfortran.spec
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libcaf_single.a
+%ifarch sparcv9 sparc64 ppc ppc64 ppc64p7
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgfortran.a
+%endif
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgfortran.so
+%ifarch sparcv9 ppc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libcaf_single.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libgfortran.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libgfortran.so
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/finclude
+%endif
+%ifarch %{multilib_64_archs}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libcaf_single.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libgfortran.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libgfortran.so
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/finclude
+%endif
+%dir %{_fmoddir}
+%doc rpm.doc/gfortran/*
+
+%files -n libgfortran
+%{_prefix}/%{_lib}/libgfortran.so.5*
+
+%files -n libgfortran-static
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%ifarch sparcv9 ppc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32/libgfortran.a
+%endif
+%ifarch sparc64 ppc64 ppc64p7
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64/libgfortran.a
+%endif
+%ifnarch sparcv9 sparc64 ppc ppc64 ppc64p7
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgfortran.a
+%endif
+
+%if %{build_d}
+%files gdc
+%{_prefix}/bin/gdc
+%{_mandir}/man1/gdc.1*
+%{_infodir}/gdc*
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%dir %{_prefix}/libexec/gcc
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/d
+%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/d21
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgphobos.spec
+%ifarch sparcv9 sparc64 ppc ppc64 ppc64p7
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgdruntime.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgphobos.a
+%endif
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgdruntime.so
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgphobos.so
+%ifarch sparcv9 ppc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libgdruntime.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libgphobos.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libgdruntime.so
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libgphobos.so
+%endif
+%ifarch %{multilib_64_archs}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libgdruntime.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libgphobos.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libgdruntime.so
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libgphobos.so
+%endif
+%doc rpm.doc/gdc/*
+
+%files -n libgphobos
+%{_prefix}/%{_lib}/libgdruntime.so.2*
+%{_prefix}/%{_lib}/libgphobos.so.2*
+%doc rpm.doc/libphobos/*
+
+%files -n libgphobos-static
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%ifarch sparcv9 ppc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32/libgdruntime.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32/libgphobos.a
+%endif
+%ifarch sparc64 ppc64 ppc64p7
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64/libgdruntime.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64/libgphobos.a
+%endif
+%ifnarch sparcv9 sparc64 ppc ppc64 ppc64p7
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgdruntime.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgphobos.a
+%endif
+%endif
+
+%if %{build_ada}
+%files gnat
+%{_prefix}/bin/gnat
+%{_prefix}/bin/gnat[^i]*
+%{_infodir}/gnat*
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%dir %{_prefix}/libexec/gcc
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}
+%ifarch sparcv9 ppc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/adainclude
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/adalib
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/ada_target_properties
+%endif
+%ifarch %{multilib_64_archs}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/adainclude
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/adalib
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/ada_target_properties
+%endif
+%ifarch sparcv9 sparc64 ppc ppc64 ppc64p7
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/adainclude
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/adalib
+%endif
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/ada_target_properties
+%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/gnat1
+%doc rpm.doc/changelogs/gcc/ada/ChangeLog*
+
+%files -n libgnat
+%{_prefix}/%{_lib}/libgnat-*.so
+%{_prefix}/%{_lib}/libgnarl-*.so
+
+%files -n libgnat-devel
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%ifarch sparcv9 ppc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32/adainclude
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32/adalib
+%exclude %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32/adalib/libgnat.a
+%exclude %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32/adalib/libgnarl.a
+%endif
+%ifarch sparc64 ppc64 ppc64p7
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64/adainclude
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64/adalib
+%exclude %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64/adalib/libgnat.a
+%exclude %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64/adalib/libgnarl.a
+%endif
+%ifnarch sparcv9 sparc64 ppc ppc64 ppc64p7
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/adainclude
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/adalib
+%exclude %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/adalib/libgnat.a
+%exclude %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/adalib/libgnarl.a
+%endif
+
+%files -n libgnat-static
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%ifarch sparcv9 ppc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32/adalib
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32/adalib/libgnat.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32/adalib/libgnarl.a
+%endif
+%ifarch sparc64 ppc64 ppc64p7
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64/adalib
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64/adalib/libgnat.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64/adalib/libgnarl.a
+%endif
+%ifnarch sparcv9 sparc64 ppc ppc64 ppc64p7
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/adalib
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/adalib/libgnat.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/adalib/libgnarl.a
+%endif
+%endif
+
+%files -n libgomp
+%{_prefix}/%{_lib}/libgomp.so.1*
+%{_infodir}/libgomp.info*
+%doc rpm.doc/changelogs/libgomp/ChangeLog*
+
+%if %{build_libquadmath}
+%files -n libquadmath
+%{_prefix}/%{_lib}/libquadmath.so.0*
+%{_infodir}/libquadmath.info*
+%{!?_licensedir:%global license %%doc}
+%license rpm.doc/libquadmath/COPYING*
+
+%files -n libquadmath-devel
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/quadmath.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include/quadmath_weak.h
+%ifnarch sparcv9 sparc64 ppc ppc64 ppc64p7
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libquadmath.so
+%endif
+%doc rpm.doc/libquadmath/ChangeLog*
+
+%files -n libquadmath-static
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%ifarch sparcv9 ppc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32/libquadmath.a
+%endif
+%ifarch sparc64 ppc64 ppc64p7
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64/libquadmath.a
+%endif
+%ifnarch sparcv9 sparc64 ppc ppc64 ppc64p7
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libquadmath.a
+%endif
+%endif
+
+%if %{build_libitm}
+%files -n libitm
+%{_prefix}/%{_lib}/libitm.so.1*
+%{_infodir}/libitm.info*
+
+%files -n libitm-devel
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/include
+#%%{_prefix}/lib/gcc/%%{gcc_target_platform}/%%{gcc_major}/include/itm.h
+#%%{_prefix}/lib/gcc/%%{gcc_target_platform}/%%{gcc_major}/include/itm_weak.h
+%ifnarch sparcv9 sparc64 ppc ppc64 ppc64p7
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libitm.so
+%endif
+%doc rpm.doc/libitm/ChangeLog*
+
+%files -n libitm-static
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%ifarch sparcv9 ppc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32/libitm.a
+%endif
+%ifarch sparc64 ppc64 ppc64p7
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64/libitm.a
+%endif
+%ifnarch sparcv9 sparc64 ppc ppc64 ppc64p7
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libitm.a
+%endif
+%endif
+
+%if %{build_libatomic}
+%files -n libatomic
+%{_prefix}/%{_lib}/libatomic.so.1*
+
+%files -n libatomic-static
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%ifarch sparcv9 ppc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32/libatomic.a
+%endif
+%ifarch sparc64 ppc64 ppc64p7
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64/libatomic.a
+%endif
+%ifnarch sparcv9 sparc64 ppc ppc64 ppc64p7
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libatomic.a
+%endif
+%doc rpm.doc/changelogs/libatomic/ChangeLog*
+%endif
+
+%if %{build_libasan}
+%files -n libasan
+%{_prefix}/%{_lib}/libasan.so.6*
+
+%files -n libasan-static
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%ifarch sparcv9 ppc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32/libasan.a
+%endif
+%ifarch sparc64 ppc64 ppc64p7
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64/libasan.a
+%endif
+%ifnarch sparcv9 sparc64 ppc ppc64 ppc64p7
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libasan.a
+%endif
+%doc rpm.doc/changelogs/libsanitizer/ChangeLog*
+%{!?_licensedir:%global license %%doc}
+%license libsanitizer/LICENSE.TXT
+%endif
+
+%if %{build_libubsan}
+%files -n libubsan
+%{_prefix}/%{_lib}/libubsan.so.1*
+
+%files -n libubsan-static
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%ifarch sparcv9 ppc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32/libubsan.a
+%endif
+%ifarch sparc64 ppc64 ppc64p7
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64/libubsan.a
+%endif
+%ifnarch sparcv9 sparc64 ppc ppc64 ppc64p7
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libubsan.a
+%endif
+%doc rpm.doc/changelogs/libsanitizer/ChangeLog*
+%{!?_licensedir:%global license %%doc}
+%license libsanitizer/LICENSE.TXT
+%endif
+
+%if %{build_libtsan}
+%files -n libtsan
+%{_prefix}/%{_lib}/libtsan.so.0*
+
+%files -n libtsan-static
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libtsan.a
+%doc rpm.doc/changelogs/libsanitizer/ChangeLog*
+%{!?_licensedir:%global license %%doc}
+%license libsanitizer/LICENSE.TXT
+%endif
+
+%if %{build_liblsan}
+%files -n liblsan
+%{_prefix}/%{_lib}/liblsan.so.0*
+
+%files -n liblsan-static
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/liblsan.a
+%doc rpm.doc/changelogs/libsanitizer/ChangeLog*
+%{!?_licensedir:%global license %%doc}
+%license libsanitizer/LICENSE.TXT
+%endif
+
+%if %{build_go}
+%files go
+%ghost %{_prefix}/bin/go
+%attr(755,root,root) %{_prefix}/bin/go.gcc
+%{_prefix}/bin/gccgo
+%ghost %{_prefix}/bin/gofmt
+%attr(755,root,root) %{_prefix}/bin/gofmt.gcc
+%{_mandir}/man1/gccgo.1*
+%{_mandir}/man1/go.1*
+%{_mandir}/man1/gofmt.1*
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%dir %{_prefix}/libexec/gcc
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}
+%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/go1
+%attr(755,root,root) %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/cgo
+%attr(755,root,root) %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/buildid
+%attr(755,root,root) %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/test2json
+%attr(755,root,root) %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/vet
+%ifarch sparcv9 ppc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libgo.so
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libgo.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libgobegin.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libgolibbegin.a
+%endif
+%ifarch %{multilib_64_archs}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libgo.so
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libgo.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libgobegin.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/32/libgolibbegin.a
+%endif
+%ifarch sparcv9 ppc %{multilib_64_archs}
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgo.so
+%endif
+%ifarch sparcv9 sparc64 ppc ppc64 ppc64p7
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgo.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgobegin.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgolibbegin.a
+%endif
+%doc rpm.doc/go/*
+
+%files -n libgo
+%attr(755,root,root) %{_prefix}/%{_lib}/libgo.so.19*
+%doc rpm.doc/libgo/*
+
+%files -n libgo-devel
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%dir %{_prefix}/%{_lib}/go
+%dir %{_prefix}/%{_lib}/go/%{gcc_major}
+%{_prefix}/%{_lib}/go/%{gcc_major}/%{gcc_target_platform}
+%ifarch %{multilib_64_archs}
+%ifnarch sparc64 ppc64 ppc64p7
+%dir %{_prefix}/lib/go
+%dir %{_prefix}/lib/go/%{gcc_major}
+%{_prefix}/lib/go/%{gcc_major}/%{gcc_target_platform}
+%endif
+%endif
+%ifarch sparcv9 ppc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32/libgobegin.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32/libgolibbegin.a
+%endif
+%ifarch sparc64 ppc64 ppc64p7
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64/libgobegin.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64/libgolibbegin.a
+%endif
+%ifnarch sparcv9 sparc64 ppc ppc64 ppc64p7
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgobegin.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgolibbegin.a
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgo.so
+%endif
+
+%files -n libgo-static
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%ifarch sparcv9 ppc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib32/libgo.a
+%endif
+%ifarch sparc64 ppc64 ppc64p7
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/lib64/libgo.a
+%endif
+%ifnarch sparcv9 sparc64 ppc ppc64 ppc64p7
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libgo.a
+%endif
+%endif
+
+%files -n libgccjit
+%{_prefix}/%{_lib}/libgccjit.so.*
+%doc rpm.doc/changelogs/gcc/jit/ChangeLog*
+
+%files -n libgccjit-devel
+%{_prefix}/%{_lib}/libgccjit.so
+%{_prefix}/include/libgccjit*.h
+%{_infodir}/libgccjit.info*
+%doc rpm.doc/libgccjit-devel/*
+%doc gcc/jit/docs/examples
+
+%files plugin-devel
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/plugin
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/plugin/gtype.state
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/plugin/include
+%dir %{_prefix}/libexec/gcc
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}
+%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/plugin
+
+%files gdb-plugin
+%{_prefix}/%{_lib}/libcc1.so*
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/plugin
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/plugin/libcc1plugin.so*
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/plugin/libcp1plugin.so*
+%doc rpm.doc/changelogs/libcc1/ChangeLog*
+
+%if %{build_offload_nvptx}
+%files offload-nvptx
+%{_prefix}/bin/nvptx-none-*
+%{_prefix}/bin/%{gcc_target_platform}-accel-nvptx-none-gcc
+%{_prefix}/bin/%{gcc_target_platform}-accel-nvptx-none-lto-dump
+%dir %{_prefix}/lib/gcc
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/accel
+%dir %{_prefix}/libexec/gcc
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}
+%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/accel
+%{_prefix}/lib/gcc/nvptx-none
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/accel/nvptx-none
+%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/accel/nvptx-none
+%dir %{_prefix}/nvptx-none
+%{_prefix}/nvptx-none/bin
+%{_prefix}/nvptx-none/include
+
+%files -n libgomp-offload-nvptx
+%{_prefix}/%{_lib}/libgomp-plugin-nvptx.so.*
+%endif
+
+%files plugin-annobin
+%{ANNOBIN_GCC_PLUGIN_DIR}/gcc-annobin.so
+%{ANNOBIN_GCC_PLUGIN_DIR}/gcc-annobin.so.0
+%{ANNOBIN_GCC_PLUGIN_DIR}/gcc-annobin.so.0.0.0
+
+%changelog
+* Thu Feb 10 2022 Marek Polacek 11.2.1-9.4
+- add --enable-host-bind-now, use it (#2044917)
+
+* Tue Feb 8 2022 Marek Polacek 11.2.1-9.3
+- use _thread_db_sizeof_pthread to obtain struct pthread size (#2034494)
+- add --enable-host-pie, build the compilers as PIE (#2044917)
+
+* Mon Feb 7 2022 Marek Polacek 11.2.1-9.2
+- add support for relocation of the PCH data (pch/71934, #2044917)
+- remove 30_threads/future/members/poll.cc (#2050090)
+- avoid overly-greedy match in dejagnu regexp (#2050089)
+
+* Mon Jan 31 2022 Marek Polacek 11.2.1-9.1
+- don't set -Wl,-rpath when building annobin (#2047356)
+
+* Fri Jan 28 2022 Marek Polacek 11.2.1-9
+- update from releases/gcc-11-branch (#2047296)
+ - PRs fortran/104127, fortran/104212, fortran/104227, target/101529
+- fix up va-opt-6.c testcase
+
+* Fri Jan 28 2022 Marek Polacek 11.2.1-8
+- update from releases/gcc-11-branch (#2047296)
+ - PRs ada/103538, analyzer/101962, bootstrap/103688, c++/85846, c++/95009,
+ c++/98394, c++/99911, c++/100493, c++/101715, c++/102229, c++/102933,
+ c++/103012, c++/103198, c++/103480, c++/103703, c++/103714,
+ c++/103758, c++/103783, c++/103831, c++/103912, c++/104055, c/97548,
+ c/101289, c/101537, c/103587, c/103881, d/103604, debug/103838,
+ debug/103874, fortran/67804, fortran/83079, fortran/101329,
+ fortran/101762, fortran/102332, fortran/102717, fortran/102787,
+ fortran/103411, fortran/103412, fortran/103418, fortran/103473,
+ fortran/103505, fortran/103588, fortran/103591, fortran/103606,
+ fortran/103607, fortran/103609, fortran/103610, fortran/103692,
+ fortran/103717, fortran/103718, fortran/103719, fortran/103776,
+ fortran/103777, fortran/103778, fortran/103782, fortran/103789,
+ ipa/101354, jit/103562, libfortran/103634, libstdc++/100017,
+ libstdc++/102994, libstdc++/103453, libstdc++/103501,
+ libstdc++/103549, libstdc++/103877, libstdc++/103919,
+ middle-end/101751, middle-end/102860, middle-end/103813, objc/103639,
+ preprocessor/89971, preprocessor/102432, rtl-optimization/102478,
+ rtl-optimization/103837, rtl-optimization/103860,
+ rtl-optimization/103908, sanitizer/102911, target/102347,
+ target/103465, target/103661, target/104172, target/104188,
+ tree-optimization/101615, tree-optimization/103523,
+ tree-optimization/103603, tree-optimization/103995
+
+* Tue Jan 25 2022 Marek Polacek 11.2.1-7.7
+- do not undefine _hardened_build (#2044917)
+
+* Mon Jan 24 2022 Marek Polacek 11.2.1-7.6
+- update annobin plugin patch (#2030667)
+
+* Thu Jan 13 2022 Marek Polacek 11.2.1-7.5
+- update annobin plugin patch (#2030667)
+
+* Fri Jan 7 2022 Marek Polacek 11.2.1-7.4
+- update annobin plugin patch (#2030667)
+
+* Tue Jan 4 2022 Marek Polacek 11.2.1-7.3
+- fix dg-ice tests (#1996047)
+
+* Tue Jan 4 2022 Marek Polacek 11.2.1-7.2
+- update annobin plugin patch (#2030667)
+
+* Thu Dec 16 2021 Marek Polacek 11.2.1-7.1
+- build annobin plugin (patch by Nick Clifton) (#2030667)
+
+* Tue Dec 7 2021 Marek Polacek 11.2.1-7
+- update from releases/gcc-11-branch (#1996858)
+ - PRs ada/100486, c++/70796, c++/92746, c++/93286, c++/94490, c++/102642,
+ c++/102786, debug/101378, debug/103046, debug/103315, fortran/87711,
+ fortran/87851, fortran/97896, fortran/99061, fortran/99348,
+ fortran/102521, fortran/102685, fortran/102715, fortran/102745,
+ fortran/102816, fortran/102817, fortran/102917, fortran/103137,
+ fortran/103138, fortran/103392, gcov-profile/100520, ipa/102714,
+ ipa/102762, ipa/103052, ipa/103246, ipa/103267, libstdc++/96416,
+ libstdc++/98421, libstdc++/100117, libstdc++/100153, libstdc++/100748,
+ libstdc++/101571, libstdc++/101608, libstdc++/102894,
+ libstdc++/103022, libstdc++/103086, libstdc++/103133,
+ libstdc++/103240, libstdc++/103381, middle-end/64888,
+ middle-end/101480, middle-end/102431, middle-end/102518,
+ middle-end/103059, middle-end/103181, middle-end/103248,
+ middle-end/103384, preprocessor/103130, rtl-optimization/102356,
+ rtl-optimization/102842, target/101985, target/102976, target/102991,
+ target/103205, target/103274, target/103275, testsuite/102690,
+ tree-optimization/100393, tree-optimization/102139,
+ tree-optimization/102505, tree-optimization/102572,
+ tree-optimization/102788, tree-optimization/102789,
+ tree-optimization/102798, tree-optimization/102970,
+ tree-optimization/103192, tree-optimization/103204,
+ tree-optimization/103237, tree-optimization/103255,
+ tree-optimization/103435
+- fix up #__VA_OPT__ handling (PR preprocessor/103415)
+
+* Mon Nov 29 2021 Marek Polacek 11.2.1-6.1
+- add -Wbidi-chars patch (#2008393)
+
+* Wed Oct 27 2021 Marek Polacek 11.2.1-6
+- update from releases/gcc-11-branch (#1996858)
+- build target shared libraries with -Wl,-z,relro,-z,now
+- add mwaitintrin.h on x86 (#2013860)
+- improve generated code with extern thread_local constinit vars
+ with trivial dtors
+- add support for C++20 #__VA_OPT__
+- add bundled(libbacktrace) and bundled(libffi) provides (#1993932)
+
+* Thu Aug 12 2021 Marek Polacek 11.2.1-2.2
+- bootstrap with -Wl,-z,relro,-z,now, apply libgcc hardening patch (#1988450)
+- fix libsanitizer with non-constant SIGSTKSZ (#1992727)
+
+* Fri Jul 30 2021 Marek Polacek 11.2.1-2.1
+- enable LTO profiledbootstrap on all arches (#1986141)
+
+* Thu Jul 29 2021 Florian Weimer 11.2.1-2
+- Rebuild with changed aarch64 build flags (#1984652)
+
+* Wed Jul 28 2021 Marek Polacek 11.2.1-1
+- update from releases/gcc-11-branch (#1986836)
+ - GCC 11.2 release
+ - PRs middle-end/101586, rtl-optimization/101562
+- enable LTO profiledbootstrap on x86_64, i?86, ppc64le and s390x for rhel9
+ (#1986141)
+
+* Wed Jun 23 2021 David Malcolm 11.1.1-6.1
+- drop patch that retained broken std::call_once symbols
+ (#1937700, PR libstdc++/99341)
+
+* Wed Jun 23 2021 Jakub Jelinek 11.1.1-6
+- update from releases/gcc-11-branch
+ - PRs c++/100876, c++/100879, c++/101106, c/100619, c/100783, fortran/95501,
+ fortran/95502, fortran/100283, fortran/101123, inline-asm/100785,
+ libstdc++/91488, libstdc++/95833, libstdc++/100806, libstdc++/100940,
+ middle-end/100250, middle-end/100307, middle-end/100574,
+ middle-end/100684, middle-end/100732, middle-end/100876,
+ middle-end/101062, middle-end/101167, target/99842, target/99939,
+ target/100310, target/100777, target/100856, target/100871,
+ target/101016
+
+* Thu Jun 17 2021 Jakub Jelinek 11.1.1-5
+- update from releases/gcc-11-branch
+ - PRs bootstrap/100731, c++/91706, c++/91859, c++/95719, c++/100065,
+ c++/100102, c++/100580, c++/100666, c++/100796, c++/100797,
+ c++/100862, c++/100946, c++/100963, c++/101029, c++/101078, c/100902,
+ c/100920, d/100882, d/100935, d/100964, d/100967, d/100999,
+ debug/100852, fortran/82376, fortran/98301, fortran/99839,
+ fortran/100965, ipa/100791, libstdc++/98842, libstdc++/100475,
+ libstdc++/100577, libstdc++/100631, libstdc++/100639,
+ libstdc++/100676, libstdc++/100690, libstdc++/100768,
+ libstdc++/100770, libstdc++/100824, libstdc++/100833,
+ libstdc++/100889, libstdc++/100894, libstdc++/100900,
+ libstdc++/100982, libstdc++/101034, libstdc++/101055,
+ middle-end/100576, middle-end/100898, middle-end/101009,
+ preprocessor/100646, rtl-optimization/100342, rtl-optimization/100590,
+ rtl-optimization/101008, target/100333, target/100885, target/100887,
+ target/101046, testsuite/100750, tree-optimization/100934,
+ tree-optimization/100981
+
+* Mon Jun 14 2021 Florian Weimer 11.1.1-4
+- NVR bump to enable rebuild in side tag
+
+* Mon May 31 2021 Jakub Jelinek 11.1.1-3
+- update from releases/gcc-11-branch
+ - PRs bootstrap/100552, c++/100205, c++/100261, c++/100281, c++/100367,
+ c++/100372, c++/100489, c++/100502, c++/100634, c++/100644,
+ c++/100659, c/100550, fortran/98411, fortran/100551, fortran/100602,
+ fortran/100633, fortran/100656, ipa/100513, libstdc++/100361,
+ libstdc++/100479, libstdc++/100630, middle-end/100471,
+ middle-end/100508, middle-end/100509, preprocessor/100392,
+ target/94177, target/99725, target/99960, target/99977, target/100419,
+ target/100563, target/100626, target/100767, testsuite/96488,
+ tree-optimization/100492, tree-optimization/100519
+
+* Wed May 12 2021 Jakub Jelinek 11.1.1-2
+- update from releases/gcc-11-branch
+ - PRs c++/98032, c++/100319, c++/100362, c/100450, fortran/100274,
+ ipa/100308, libgomp/100352, libstdc++/99006, libstdc++/99453,
+ libstdc++/100259, libstdc++/100298, libstdc++/100384,
+ rtl-optimization/84878, rtl-optimization/100225,
+ rtl-optimization/100230, rtl-optimization/100263,
+ rtl-optimization/100411, target/99988, target/100217, target/100232,
+ target/100236, target/100270, target/100305, target/100311,
+ target/100375, target/100402, tree-optimization/96513,
+ tree-optimization/100253, tree-optimization/100278,
+ tree-optimization/100329, tree-optimization/100414
+- fix build with removed linux/cyclades.h header (PR sanitizer/100379)
+- fix up mausezahn miscompilation (#1958887, PR tree-optimization/100566)
+
+* Wed Apr 28 2021 Jakub Jelinek 11.1.1-1
+- update from releases/gcc-11-branch
+ - GCC 11.1 release
+ - PRs c++/93383, c++/95291, c++/96380, c++/99200, c++/99683, c++/100161,
+ debug/100255, fortran/100154, fortran/100218, libstdc++/100290,
+ rtl-optimization/100254, target/98952, target/100200,
+ tree-optimization/100239
+- fix ICE in aarch64_add_offset_1_temporaries (PR target/100302)
+
+* Fri Apr 23 2021 Jakub Jelinek 11.0.1-0.7
+- update from trunk and releases/gcc-11 branch
+ - GCC 11.1-rc2
+ - PRs libstdc++/100179, target/100182
+
+* Thu Apr 22 2021 Jakub Jelinek 11.0.1-0.6
+- update from trunk and releases/gcc-11 branch
+ - GCC 11.1-rc1
+ - PRs ada/99360, c++/97536, c/100143, d/98058, d/98457, d/98494, d/98584,
+ d/99794, demangler/100177, fortran/100110, libstdc++/95983,
+ libstdc++/100146, libstdc++/100164, preprocessor/100142,
+ rtl-optimization/99927, target/100108, testsuite/100176,
+ tree-optimization/100081
+- fix a cprop -fcompare-debug bug (PR rtl-optimization/100148)
+
+* Sun Apr 18 2021 Jakub Jelinek 11.0.1-0.5
+- update from trunk
+ - PRs analyzer/98599, analyzer/99042, analyzer/99212, analyzer/99774,
+ analyzer/99886, analyzer/99906, analyzer/100011, c++/41723, c++/49951,
+ c++/52202, c++/52625, c++/58123, c++/80456, c++/83476, c++/88742,
+ c++/90215, c++/90479, c++/90674, c++/91241, c++/91849, c++/91933,
+ c++/92918, c++/93085, c++/93295, c++/93314, c++/93867, c++/94529,
+ c++/95317, c++/95486, c++/95870, c++/96311, c++/96673, c++/96873,
+ c++/97121, c++/97134, c++/97679, c++/97974, c++/98440, c++/98800,
+ c++/98852, c++/99008, c++/99066, c++/99118, c++/99180, c++/99201,
+ c++/99380, c++/99478, c++/99700, c++/99803, c++/99806, c++/99833,
+ c++/99844, c++/99850, c++/99859, c++/99874, c++/99885, c++/99899,
+ c++/99901, c++/99961, c++/99994, c++/100006, c++/100032, c++/100054,
+ c++/100078, c++/100079, c++/100091, c++/100101, c++/100111, c/98852,
+ c/99420, c/99972, c/99990, d/99812, d/99914, d/99917, debug/99830,
+ fortran/63797, fortran/99307, fortran/99817, fortran/100018,
+ fortran/100094, jit/100096, libfortran/78314, libgomp/99984,
+ libstdc++/96657, libstdc++/99402, libstdc++/99433, libstdc++/99805,
+ libstdc++/99985, libstdc++/99995, libstdc++/100044, libstdc++/100060,
+ lto/98599, lto/99849, lto/99857, middle-end/55288, middle-end/84877,
+ middle-end/84991, middle-end/84992, middle-end/86058,
+ middle-end/90779, middle-end/98088, middle-end/99883,
+ middle-end/99989, preprocessor/99446, rtl-optimization/98601,
+ rtl-optimization/98689, rtl-optimization/99596,
+ rtl-optimization/99905, rtl-optimization/99929,
+ rtl-optimization/100066, sanitizer/99877, sanitizer/100114,
+ target/87763, target/99246, target/99647, target/99648, target/99748,
+ target/99767, target/99781, target/99872, target/100028,
+ target/100048, target/100056, target/100067, target/100075,
+ testsuite/99955, testsuite/100071, testsuite/100073,
+ tree-optimization/82800, tree-optimization/97513,
+ tree-optimization/98736, tree-optimization/99873,
+ tree-optimization/99880, tree-optimization/99924,
+ tree-optimization/99947, tree-optimization/99954,
+ tree-optimization/100053
+- for %%{rhel} == 9, default to -march=z14 -mtune=z15 on s390x and
+ to -mcpu=power9 -mtune=power9 on ppc64le
+
+* Fri Apr 9 2021 Marek Polacek 11.0.1-0.3.1
+- for %%{rhel} == 9, default to -march=z14 -mtune=z15 on s390x and
+ to -mcpu=power9 -mtune=power9 on ppc64le
+
+* Mon Apr 5 2021 Jakub Jelinek 11.0.1-0.4
+- update from trunk
+ - PRs ada/99802, analyzer/93695, analyzer/99044, analyzer/99716,
+ analyzer/99771, bootstrap/98860, c++/90664, c++/91217, c++/91416,
+ c++/94751, c++/97900, c++/97938, c++/98352, c++/99331, c++/99445,
+ c++/99565, c++/99583, c++/99584, c++/99586, c++/99643, c++/99672,
+ c++/99705, c++/99745, c++/99790, c++/99815, c++/99831, c++/99869,
+ d/91595, d/99691, debug/99334, fortran/99369, fortran/99602,
+ fortran/99651, fortran/99818, fortran/99840, ipa/98265, ipa/99122,
+ ipa/99466, ipa/99751, libstdc++/99533, lto/99447, middle-end/65182,
+ rtl-optimization/97141, rtl-optimization/98726,
+ rtl-optimization/99863, target/96974, target/97653, target/98119,
+ target/98136, target/98209, target/99037, target/99133, target/99216,
+ target/99555, target/99718, target/99724, target/99727, target/99744,
+ target/99753, target/99766, target/99773, target/99786, target/99808,
+ target/99813, target/99820, target/99822, testsuite/98125,
+ tree-optimization/48483, tree-optimization/55060,
+ tree-optimization/59970, tree-optimization/61112,
+ tree-optimization/61677, tree-optimization/61869,
+ tree-optimization/96573, tree-optimization/96974,
+ tree-optimization/97009, tree-optimization/98268,
+ tree-optimization/99726, tree-optimization/99746,
+ tree-optimization/99777, tree-optimization/99807,
+ tree-optimization/99824, tree-optimization/99825,
+ tree-optimization/99856, tree-optimization/99863,
+ tree-optimization/99882
+
+* Wed Mar 24 2021 Jakub Jelinek 11.0.1-0.3
+- update from trunk
+ - PRs analyzer/99614, c++/99239, c++/99283, c++/99318, c++/99425, c++/99456,
+ c++/99480, c++/99687, c/99588, fortran/93660, fortran/99688,
+ rtl-optimization/99680, target/97252, target/97926, target/98914,
+ target/99540, target/99581, target/99652, target/99660, target/99661,
+ target/99663, target/99679, target/99702, target/99704, target/99733,
+ tree-optimization/99296, tree-optimization/99656,
+ tree-optimization/99694, tree-optimization/99721
+
+* Fri Mar 19 2021 Jakub Jelinek 11.0.1-0.2
+- update from trunk
+ - PRs c++/90448, c++/96268, c++/96749, c++/97973, c++/98480, c++/98704,
+ c++/99047, c++/99108, c++/99238, c++/99248, c++/99285, c++/99423,
+ c++/99436, c++/99459, c++/99472, c++/99496, c++/99500, c++/99507,
+ c++/99508, c++/99509, c++/99528, c++/99601, c++/99613, c++/99617,
+ fortran/49278, fortran/96983, fortran/97927, fortran/98858,
+ fortran/99125, fortran/99205, fortran/99345, fortran/99514,
+ fortran/99545, ipa/99517, libstdc++/99172, libstdc++/99341,
+ libstdc++/99413, libstdc++/99536, libstdc++/99537, middle-end/97631,
+ middle-end/98266, middle-end/99502, middle-end/99641, objc++/49070,
+ sanitizer/98920, target/98092, target/98959, target/99070,
+ target/99094, target/99102, target/99422, target/99437, target/99454,
+ target/99463, target/99464, target/99492, target/99504, target/99542,
+ target/99563, target/99592, target/99600, testsuite/97680,
+ testsuite/98245, testsuite/99292, testsuite/99498, testsuite/99626,
+ testsuite/99636, tree-optimization/98834, tree-optimization/99305,
+ tree-optimization/99489, tree-optimization/99510,
+ tree-optimization/99523, tree-optimization/99544
+ - fix ARM ICE in neon_output_shift_immediate (#1922599, PR target/99593)
+- avoid false positive aarch64 -Wpsabi notes in some cases (PR target/91710)
+- fix a -fcompare-debug failure caused by C FE bug (PR debug/99230)
+- fix up -gdwarf-5 -gsplit-dwarf ranges handling (PR debug/99490)
+- fix up handling of > 64 bit constants in dwarf2out (PR debug/99562,
+ PR debug/66728)
+- reject invalid C++ structured bindings that need reference to void
+ (PR c++/99650)
+- include private isl 0.18 in the package instead of relying on old
+ distro version
+
+* Sun Mar 7 2021 Jakub Jelinek 11.0.1-0.1
+- update from trunk
+ - PRs ada/98996, ada/99020, ada/99095, ada/99264, analyzer/96374,
+ analyzer/99193, bootstrap/92002, bootstrap/98590, c++/82959,
+ c++/88146, c++/90333, c++/94521, c++/95451, c++/95615, c++/95616,
+ c++/95675, c++/95822, c++/96078, c++/96330, c++/96443, c++/96474,
+ c++/96960, c++/97034, c++/97587, c++/98118, c++/98318, c++/98810,
+ c++/98990, c++/99009, c++/99103, c++/99120, c++/99166, c++/99170,
+ c++/99176, c++/99213, c++/99245, c++/99251, c++/99287, c++/99294,
+ c++/99344, c++/99362, c++/99365, c++/99374, c++/99377, c++/99389,
+ c/99137, c/99275, c/99304, c/99323, c/99324, c/99325, c/99363,
+ d/99337, debug/66668, debug/99090, debug/99319, fortran/57871,
+ fortran/99300, fortran/99303, fortran/99355, gcov-profile/97461,
+ gcov-profile/99105, gcov-profile/99385, gcov-profile/99406, ipa/98078,
+ ipa/98338, libbacktrace/98818, libfortran/81986, libfortran/99218,
+ libgomp/98738, libstdc++/99265, libstdc++/99270, libstdc++/99301,
+ libstdc++/99382, libstdc++/99396, middle-end/93235, middle-end/94655,
+ middle-end/95757, middle-end/96963, middle-end/97172,
+ middle-end/97855, middle-end/99276, middle-end/99281,
+ middle-end/99295, middle-end/99322, other/99288,
+ rtl-optimization/99376, target/44107, target/48097, target/95798,
+ target/98996, target/99085, target/99234, target/99271, target/99279,
+ target/99313, target/99321, target/99381, testsuite/99233,
+ tree-optimization/80635, tree-optimization/99253
+- fix debug info for __fp16 constants (PR debug/99388)
+
+* Thu Feb 25 2021 Jakub Jelinek 11.0.0-0.20
+- update from trunk
+ - PRs analyzer/94596, analyzer/98969, analyzer/99196, c++/94034, c++/94546,
+ c++/95468, c++/95888, c++/96251, c++/96926, c++/97246, c++/97582,
+ c++/97742, c++/98718, c++/98741, c++/98988, c++/99023, c++/99030,
+ c++/99031, c++/99033, c++/99035, c++/99039, c++/99040, c++/99062,
+ c++/99063, c++/99071, c++/99072, c++/99074, c++/99116, c++/99132,
+ c++/99150, c++/99153, c++/99174, c++/99208, c/97172, c/99055, c/99136,
+ c/99224, debug/96997, debug/98755, fortran/98342, fortran/98686,
+ fortran/98897, fortran/98979, fortran/99010, fortran/99027,
+ fortran/99043, fortran/99060, fortran/99111, fortran/99124,
+ fortran/99146, fortran/99171, fortran/99206, fortran/99226,
+ inline-asm/98096, inline-asm/99123, ipa/97346, ipa/99003, ipa/99029,
+ ipa/99034, jit/99126, libfortran/95647, libfortran/98825,
+ libgcc/99236, libstdc++/88881, libstdc++/97549, libstdc++/98389,
+ libstdc++/99058, libstdc++/99077, libstdc++/99096, libstdc++/99181,
+ libstdc++/99261, middle-end/38474, middle-end/99007, middle-end/99109,
+ middle-end/99122, preprocessor/96391, rtl-optimization/96264,
+ rtl-optimization/98439, rtl-optimization/98791,
+ rtl-optimization/98872, rtl-optimization/99054, sanitizer/99106,
+ sanitizer/99168, target/85074, target/96166, target/97417,
+ target/98491, target/98657, target/98931, target/98998, target/99025,
+ target/99041, target/99100, target/99104, target/99113, target/99134,
+ target/99157, testsuite/99173, translation/99167,
+ tree-optimization/38474, tree-optimization/92879,
+ tree-optimization/98772, tree-optimization/99002,
+ tree-optimization/99024, tree-optimization/99026,
+ tree-optimization/99079, tree-optimization/99142,
+ tree-optimization/99149, tree-optimization/99165,
+ tree-optimization/99204, tree-optimization/99220,
+ tree-optimization/99225
+
+* Wed Feb 10 2021 Jakub Jelinek 11.0.0-0.19
+- update from trunk
+ - PRs analyzer/93355, analyzer/96374, analyzer/98575, analyzer/98918,
+ c++/20408, c++/84494, c++/90926, c++/95192, c++/96199, c++/96462,
+ c++/96905, c++/97804, c++/97878, c++/98295, c++/98326, c++/98355,
+ c++/98531, c++/98570, c++/98717, c++/98802, c++/98835, c++/98899,
+ c++/98926, c++/98929, c++/98944, c++/98947, c++/98951, c++/98994,
+ c/97882, c/97932, d/98910, d/98921, debug/98656, driver/98943,
+ fortran/91862, fortran/98913, libstdc++/70303, libstdc++/99021,
+ lto/96591, lto/98912, lto/98971, middle-end/97172, middle-end/97487,
+ middle-end/97971, middle-end/98465, middle-end/98974,
+ middle-end/99004, preprocessor/98882, rtl-optimization/96015,
+ target/97510, target/98172, target/98537, target/98743, target/98957,
+ testsuite/98243, testsuite/98325, tree-optimization/97960,
+ tree-optimization/98287, tree-optimization/98499,
+ tree-optimization/98848, tree-optimization/98855,
+ tree-optimization/98863, tree-optimization/98928,
+ tree-optimization/98937, tree-optimization/99017
+
+* Sat Jan 30 2021 Jakub Jelinek 11.0.0-0.18
+- update from trunk
+ - PRs ada/98228, bootstrap/98839, c++/33661, c++/88548, c++/94775,
+ c++/96137, c++/97474, c++/97566, c++/97874, c++/98463, c++/98646,
+ c++/98770, c++/98841, c++/98843, c++/98847, d/98806, debug/98331,
+ debug/98811, fortran/67539, fortran/70070, fortran/86470,
+ fortran/93924, fortran/93925, fortran/96843, fortran/98472,
+ fortran/98517, libstdc++/66414, lto/85574, middle-end/98726,
+ middle-end/98807, rtl-optimization/80960, rtl-optimization/97684,
+ rtl-optimization/98144, rtl-optimization/98863, sanitizer/98828,
+ target/97701, target/98730, target/98799, target/98827, target/98833,
+ target/98849, target/98853, testsuite/98771, testsuite/98870,
+ tree-optimization/97260, tree-optimization/97627,
+ tree-optimization/98854, tree-optimization/98866
+
+* Sat Jan 23 2021 Jakub Jelinek 11.0.0-0.17
+- update from trunk
+ - PRs ada/98740, c++/41437, c++/58993, c++/71879, c++/82613, c++/95434,
+ c++/96623, c++/97399, c++/97966, c++/98333, c++/98530, c++/98545,
+ c++/98624, c++/98659, c++/98744, fortran/96320, fortran/98476,
+ fortran/98565, fortran/98757, fortran/98763, gcov-profile/98739,
+ ipa/97673, ipa/98330, ipa/98690, middle-end/98664, middle-end/98773,
+ middle-end/98793, rtl-optimization/92294, rtl-optimization/98694,
+ rtl-optimization/98722, rtl-optimization/98777, sanitizer/95693,
+ target/79251, target/96372, target/96891, target/98065, target/98093,
+ target/98348, target/98636, testsuite/97301, testsuite/98241,
+ testsuite/98795, tree-optimization/47059, tree-optimization/90248,
+ tree-optimization/96674, tree-optimization/98255,
+ tree-optimization/98535, tree-optimization/98758,
+ tree-optimization/98766, tree-optimization/98786
+ - ensure for empty CUs -gdwarf-5 emits at least the required 0th directory
+ and filename entry in the .debug_line section (#1919243, PR debug/98796)
+- fix aarch64 bug where emitted ubfix insn can't be assembled
+ (PR target/98681)
+
+* Wed Jan 20 2021 Jakub Jelinek 11.0.0-0.16
+- fix DWARF5 -g -flto -ffat-lto-objects, so that LTO sections can be stripped
+ off later (PR debug/98765)
+- fix GOMP_task caller stack corruption on s390x
+- libgccjit DWARF5 fixes (PR debug/98751)
+
+* Tue Jan 19 2021 Jakub Jelinek 11.0.0-0.15
+- update from trunk
+ - PRs debug/98708, debug/98716, ipa/98222, libstdc++/98725, target/97847,
+ testsuite/97299, testsuite/97494, testsuite/97987,
+ tree-optimization/96271
+ - fix miscompilation of portable signed multiplication overflow check
+ (#1916576, PR tree-optimization/98727)
+ - switch to DWARF 5 by default
+- fix PRs c++/98672, c++/98687, c++/98742, middle-end/98638,
+ tree-optimization/98721
+
+* Sat Jan 16 2021 Jakub Jelinek 11.0.0-0.14
+- update from trunk
+ - PRs ada/98595, analyzer/98679, bootstrap/98696, c++/63707, c++/98231,
+ c++/98372, c++/98538, c++/98591, c++/98626, c++/98642, fortran/98661,
+ ipa/98652, jit/98586, libgomp/65099, libstdc++/98466, libstdc++/98471,
+ preprocessor/95253, target/70454, target/71233, target/88836,
+ target/95905, target/96938, target/98667, target/98671, target/98676,
+ testsuite/96098, testsuite/96147, tree-optimization/92645,
+ tree-optimization/96376, tree-optimization/96669,
+ tree-optimization/96681, tree-optimization/96688,
+ tree-optimization/96691, tree-optimization/98455,
+ tree-optimization/98597, tree-optimization/98640,
+ tree-optimization/98674, tree-optimization/98685
+ - fix up pmovzx permutation SSE4.1 patterns (#1916240, PR target/98670)
+
+* Wed Jan 13 2021 Jakub Jelinek 11.0.0-0.13
+- update from trunk
+ - PRs analyzer/98628, c++/97284, c++/98481, c++/98556, c++/98611, c++/98620,
+ c/98592, debug/97714, jit/98615, libstdc++/98613,
+ rtl-optimization/98603, target/97875, target/97969, target/98612,
+ testsuite/98225, testsuite/98602, tree-optimization/91403,
+ tree-optimization/95731, tree-optimization/95852,
+ tree-optimization/95867, tree-optimization/98526,
+ tree-optimization/98550, tree-optimization/98629
+ - fix ICEs in print_mem_ref (#1915400, #1915437, #1915781, PR c/98597)
+
+* Sat Jan 9 2021 Jakub Jelinek 11.0.0-0.12
+- update from trunk
+ - PRs analyzer/97072, analyzer/97074, analyzer/98073, analyzer/98223,
+ analyzer/98293, analyzer/98564, analyzer/98580, bootstrap/98324,
+ bootstrap/98506, c++/82099, c++/95768, c++/96045, c++/96504,
+ c++/97597, c++/98206, c++/98305, c++/98316, c++/98329, c++/98332,
+ c++/98353, c++/98413, c++/98441, c++/98469, c++/98515, c++/98551,
+ c/98029, d/98427, fortran/83118, fortran/93701, fortran/93794,
+ fortran/93833, fortran/97612, fortran/97694, fortran/97723,
+ fortran/98022, fortran/98458, libstdc++/98384, middle-end/98160,
+ middle-end/98578, other/98437, rtl-optimization/97144,
+ rtl-optimization/97978, rtl-optimization/98214,
+ rtl-optimization/98334, rtl-optimization/98403, target/89057,
+ target/96793, target/97269, target/98461, target/98482, target/98495,
+ target/98521, target/98522, target/98567, target/98585,
+ testsuite/98489, testsuite/98566, tree-optimization/56719,
+ tree-optimization/94785, tree-optimization/94802,
+ tree-optimization/94994, tree-optimization/95401,
+ tree-optimization/95582, tree-optimization/95771,
+ tree-optimization/96239, tree-optimization/96782,
+ tree-optimization/96928, tree-optimization/96930,
+ tree-optimization/98282, tree-optimization/98291,
+ tree-optimization/98302, tree-optimization/98308,
+ tree-optimization/98371, tree-optimization/98381,
+ tree-optimization/98393, tree-optimization/98428,
+ tree-optimization/98464, tree-optimization/98474,
+ tree-optimization/98513, tree-optimization/98514,
+ tree-optimization/98516, tree-optimization/98544,
+ tree-optimization/98560, tree-optimization/98568
+
+* Wed Dec 23 2020 Jakub Jelinek 11.0.0-0.11
+- update from trunk
+ - PRs bootstrap/98300, bootstrap/98380, bootstrap/98412, c++/67343,
+ c++/93480, c++/96840, c++/98340, c++/98343, c++/98353, c++/98383,
+ c/98047, c/98260, d/98067, fortran/83118, fortran/92587,
+ fortran/96012, fortran/98284, fortran/98307, go/98402,
+ libstdc++/46447, libstdc++/93151, libstdc++/96083, libstdc++/98319,
+ libstdc++/98344, libstdc++/98370, libstdc++/98374, libstdc++/98377,
+ middle-end/98366, other/98400, other/98409, rtl-optimization/98271,
+ rtl-optimization/98276, rtl-optimization/98289,
+ rtl-optimization/98347, sanitizer/97868, target/96793, target/98146,
+ target/98177, target/98280, tree-optimization/96239,
+ tree-optimization/97750, tree-optimization/98272,
+ tree-optimization/98279, tree-optimization/98378,
+ tree-optimization/98407
+
+* Thu Dec 17 2020 Jakub Jelinek 11.0.0-0.10
+- apply workaround for profiledbootstrap x86_64 failure
+- put g++-mapper-server into the right directory
+
+* Wed Dec 16 2020 Jakub Jelinek 11.0.0-0.8
+- update from trunk
+ - PRs ada/98230, bootstrap/98188, c++/57111, c++/59238, c++/68451,
+ c++/78173, c++/91506, c++/93083, c++/96299, c++/97093, c++/97517,
+ c++/98043, c++/98103, c++/98122, c++/98126, c++/98130, c++/98187,
+ c++/98193, c/97981, c/98200, d/98277, fortran/90207, fortran/98016,
+ fortran/98022, gcov-profile/98273, libstdc++/98108, libstdc++/98226,
+ lto/98275, middle-end/94600, middle-end/98160, middle-end/98166,
+ middle-end/98183, middle-end/98190, middle-end/98205,
+ middle-end/98264, rtl-optimization/97092, rtl-optimization/97421,
+ rtl-optimization/98212, rtl-optimization/98229, sanitizer/98204,
+ target/58901, target/66791, target/92469, target/94440, target/95294,
+ target/96226, target/96470, target/97865, target/97872, target/98100,
+ target/98147, target/98152, target/98161, target/98162, target/98219,
+ target/98274, testsuite/95900, testsuite/98123, testsuite/98156,
+ testsuite/98239, testsuite/98240, testsuite/98242, testsuite/98244,
+ tree-optimization/95582, tree-optimization/96094,
+ tree-optimization/96232, tree-optimization/96272,
+ tree-optimization/96344, tree-optimization/96685,
+ tree-optimization/97559, tree-optimization/97929,
+ tree-optimization/98069, tree-optimization/98113,
+ tree-optimization/98117, tree-optimization/98137,
+ tree-optimization/98169, tree-optimization/98174,
+ tree-optimization/98180, tree-optimization/98182,
+ tree-optimization/98191, tree-optimization/98192,
+ tree-optimization/98199, tree-optimization/98211,
+ tree-optimization/98213, tree-optimization/98235,
+ tree-optimization/98256
+ - C++20 modules support
+ - fix up __patchable_function_entries handling when gcc is configured
+ against recent binutils (#1907945)
+- fix up handling of non-memory VIEW_CONVERT_EXPRs in PRE
+ (PR tree-optimization/98282)
+
+* Fri Dec 4 2020 Jakub Jelinek 11.0.0-0.7
+- update from trunk
+ - PRs bootstrap/97983, c++/80780, c++/90629, c++/93093, c++/97187,
+ c++/97947, c++/97975, c++/97993, c++/98019, c++/98054, c++/98072,
+ c++/98104, c++/98107, c++/98115, c++/98116, c/65455, c/92935, c/97880,
+ c/98087, d/87788, d/87818, d/98025, debug/97989, fortran/95342,
+ fortran/98010, fortran/98011, fortran/98013, ipa/88702, ipa/98057,
+ ipa/98075, jit/97867, libgcc/97543, libgcc/97643, libstdc++/65480,
+ libstdc++/68735, libstdc++/93121, libstdc++/98001, libstdc++/98003,
+ middle-end/89428, middle-end/92936, middle-end/92940,
+ middle-end/93195, middle-end/93197, middle-end/94527,
+ middle-end/97373, middle-end/97595, middle-end/98070,
+ middle-end/98082, middle-end/98099, other/98027, plugins/98059,
+ preprocessor/97602, rtl-optimization/97459, rtl-optimization/97777,
+ rtl-optimization/97954, rtl-optimization/98037, target/96607,
+ target/96906, target/97642, target/97770, target/97939, target/98063,
+ target/98079, target/98086, testsuite/98002, testsuite/98036,
+ testsuite/98085, tree-optimization/14799, tree-optimization/88702,
+ tree-optimization/96679, tree-optimization/96708,
+ tree-optimization/97630, tree-optimization/97953,
+ tree-optimization/97979, tree-optimization/97997,
+ tree-optimization/98024, tree-optimization/98048,
+ tree-optimization/98064, tree-optimization/98066,
+ tree-optimization/98084
+
+* Thu Nov 26 2020 Jakub Jelinek 11.0.0-0.6
+- update from trunk
+ - PRs bootstrap/94982, bootstrap/97622, bootstrap/97933, c++/97899, c/97958,
+ fortran/85796, libstdc++/67791, libstdc++/97935, libstdc++/97936,
+ libstdc++/97944, middle-end/97943, middle-end/97956,
+ rtl-optimization/95862, target/91816, target/97534, target/97950,
+ tree-optimization/96929, tree-optimization/97849,
+ tree-optimization/97964
+
+* Tue Nov 24 2020 Jakub Jelinek 11.0.0-0.5
+- update from trunk
+ - PRs c++/94695, c++/97427, c++/97839, c++/97846, c++/97881, c++/97904,
+ c/95630, d/97889, libstdc++/97948, tree-optimization/95853
+
+* Sat Nov 21 2020 Jakub Jelinek 11.0.0-0.4
+- update from trunk
+ - PRs ada/97805, ada/97859, analyzer/97668, analyzer/97893, bootstrap/57076,
+ bootstrap/97666, bootstrap/97857, c++/25814, c++/52830, c++/63287,
+ c++/67453, c++/78209, c++/81660, c++/87765, c++/88115, c++/88982,
+ c++/89565, c++/90799, c++/91318, c++/93107, c++/93907, c++/95808,
+ c++/97388, c++/97412, c++/97453, c++/97479, c++/97518, c++/97523,
+ c++/97632, c++/97663, c++/97670, c++/97675, c++/97762, c++/97790,
+ c++/97871, c++/97877, c++/97895, c++/97905, c++/97918, c/90628,
+ c/97748, c/97860, d/97644, d/97842, d/97843, debug/97060, debug/97599,
+ debug/97718, driver/97574, fortran/90111, fortran/92793,
+ fortran/94358, fortran/95847, fortran/97652, fortran/97655,
+ fortran/97768, fortran/97782, ipa/97578, ipa/97660, ipa/97695,
+ ipa/97698, ipa/97816, jit/87291, libstdc++/55394, libstdc++/66146,
+ libstdc++/83938, libstdc++/84323, libstdc++/88101, libstdc++/92285,
+ libstdc++/92546, libstdc++/93421, libstdc++/93456, libstdc++/94971,
+ libstdc++/95989, libstdc++/96269, libstdc++/96958, libstdc++/97415,
+ libstdc++/97600, libstdc++/97613, libstdc++/97719, libstdc++/97729,
+ libstdc++/97731, libstdc++/97758, libstdc++/97798, libstdc++/97828,
+ libstdc++/97869, lto/97290, lto/97508, middle-end/85811,
+ middle-end/95673, middle-end/97267, middle-end/97556,
+ middle-end/97579, middle-end/97840, middle-end/97862,
+ middle-end/97879, objc/77404, objc/90707, objc/97854, other/97911,
+ pch/86674, pch/97593, preprocessor/97858, rtl-optimization/92180,
+ rtl-optimization/97705, sanitizer/95634, target/31799, target/85486,
+ target/91489, target/93449, target/96307, target/96770, target/96791,
+ target/96933, target/96967, target/96998, target/97140, target/97194,
+ target/97205, target/97326, target/97528, target/97532, target/97540,
+ target/97638, target/97682, target/97685, target/97715, target/97726,
+ target/97727, target/97730, target/97870, target/97873,
+ testsuite/80219, testsuite/85303, testsuite/97117, testsuite/97688,
+ testsuite/97788, testsuite/97797, testsuite/97803,
+ tree-optimization/80928, tree-optimization/83072,
+ tree-optimization/91029, tree-optimization/93781,
+ tree-optimization/94406, tree-optimization/96671,
+ tree-optimization/96789, tree-optimization/97223,
+ tree-optimization/97424, tree-optimization/97558,
+ tree-optimization/97609, tree-optimization/97623,
+ tree-optimization/97626, tree-optimization/97633,
+ tree-optimization/97650, tree-optimization/97678,
+ tree-optimization/97690, tree-optimization/97693,
+ tree-optimization/97706, tree-optimization/97709,
+ tree-optimization/97721, tree-optimization/97725,
+ tree-optimization/97732, tree-optimization/97733,
+ tree-optimization/97736, tree-optimization/97737,
+ tree-optimization/97741, tree-optimization/97746,
+ tree-optimization/97753, tree-optimization/97760,
+ tree-optimization/97761, tree-optimization/97764,
+ tree-optimization/97765, tree-optimization/97767,
+ tree-optimization/97769, tree-optimization/97780,
+ tree-optimization/97806, tree-optimization/97812,
+ tree-optimization/97830, tree-optimization/97835,
+ tree-optimization/97838, tree-optimization/97886,
+ tree-optimization/97888, tree-optimization/97897,
+ tree-optimization/97901
+- add BuildRequires: make and Requires: make, the latter for -flto reasons
+
+* Thu Oct 29 2020 Jakub Jelinek 11.0.0-0.3
+- update from trunk
+ - PRs ada/97504, analyzer/96608, analyzer/97489, analyzer/97514,
+ analyzer/97568, analyzer/97608, bootstrap/97451, c++/82239, c++/86773,
+ c++/91741, c++/94799, c++/95132, c++/96241, c++/96575, c++/96675,
+ c++/96742, c++/97328, c++/97438, c++/97511, c++/97573, c/94722,
+ c/97463, fortran/45516, fortran/97454, gcov-profile/97461, ipa/97445,
+ ipa/97576, ipa/97586, libstdc++/94268, libstdc++/95592,
+ libstdc++/95609, libstdc++/95917, libstdc++/96713, libstdc++/97512,
+ libstdc++/97570, lto/96680, lto/97524, middle-end/92942,
+ middle-end/97521, middle-end/97552, rtl-optimization/97249,
+ rtl-optimization/97439, rtl-optimization/97497, sanitizer/97414,
+ target/87767, target/95151, target/95458, target/97360, target/97502,
+ target/97506, target/97535, testsuite/81690, testsuite/97590,
+ tree-optimization/66552, tree-optimization/97164,
+ tree-optimization/97360, tree-optimization/97456,
+ tree-optimization/97457, tree-optimization/97466,
+ tree-optimization/97467, tree-optimization/97486,
+ tree-optimization/97488, tree-optimization/97496,
+ tree-optimization/97500, tree-optimization/97501,
+ tree-optimization/97503, tree-optimization/97505,
+ tree-optimization/97515, tree-optimization/97520,
+ tree-optimization/97538, tree-optimization/97539,
+ tree-optimization/97546, tree-optimization/97555,
+ tree-optimization/97560, tree-optimization/97567,
+ tree-optimization/97615
+- for ELN default to -march=x86-64-v2 for x86 64-bit compilation and
+ for s390x to -march=z13 -mtune=arch13
+
+* Mon Oct 19 2020 Jakub Jelinek 11.0.0-0.2
+- new package