From bd66c93feddcace24dcaf5983f5778cd5077435e Mon Sep 17 00:00:00 2001
From: CentOS Sources
Date: Tue, 27 Sep 2022 10:52:26 -0400
Subject: [PATCH] import gcc-11.3.1-2.1.el9
---
.gcc.metadata | 2 +-
.gitignore | 2 +-
SOURCES/gcc11-bind-now.patch | 36 ---
SOURCES/gcc11-libgcc-link.patch | 12 -
SOURCES/gcc11-libsanitizer-pthread.patch | 54 ----
SOURCES/gcc11-libstdc++-docs.patch | 4 +-
SOURCES/gcc11-pie.patch | 36 ---
SOURCES/gcc11-pr105331.patch | 33 ++
SOURCES/gcc11-rh2106262.patch | 388 +++++++++++++++++++++++
SPECS/gcc.spec | 94 +++++-
10 files changed, 512 insertions(+), 149 deletions(-)
delete mode 100644 SOURCES/gcc11-libsanitizer-pthread.patch
create mode 100644 SOURCES/gcc11-pr105331.patch
create mode 100644 SOURCES/gcc11-rh2106262.patch
diff --git a/.gcc.metadata b/.gcc.metadata
index 4f649ba..188c059 100644
--- a/.gcc.metadata
+++ b/.gcc.metadata
@@ -1,4 +1,4 @@
-54f8e112180f2cad6cf9459aab4681c7f157aca9 SOURCES/gcc-11.2.1-20220127.tar.xz
+7aa1aed2d17e955c7af83575c01a2decee22d46f SOURCES/gcc-11.3.1-20220421.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
index 316ddb7..9fb586a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-SOURCES/gcc-11.2.1-20220127.tar.xz
+SOURCES/gcc-11.3.1-20220421.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-bind-now.patch b/SOURCES/gcc11-bind-now.patch
index 8710490..e0b99a9 100644
--- a/SOURCES/gcc11-bind-now.patch
+++ b/SOURCES/gcc11-bind-now.patch
@@ -131,24 +131,6 @@ index 2ded5d4c50b..5671dc7dcf4 100755
--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
@@ -286,24 +268,6 @@ index baa84adbb6c..669ccaede52 100755
# 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
diff --git a/SOURCES/gcc11-libgcc-link.patch b/SOURCES/gcc11-libgcc-link.patch
index 8551934..1904c4b 100644
--- a/SOURCES/gcc11-libgcc-link.patch
+++ b/SOURCES/gcc11-libgcc-link.patch
@@ -19,7 +19,6 @@ 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
@@ -33,17 +32,6 @@ that also repeats later in the @multilib_flags@, which should be harmless.
-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 = \
diff --git a/SOURCES/gcc11-libsanitizer-pthread.patch b/SOURCES/gcc11-libsanitizer-pthread.patch
deleted file mode 100644
index fc88d9e..0000000
--- a/SOURCES/gcc11-libsanitizer-pthread.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-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
index 4b4f9f8..b044a4d 100644
--- a/SOURCES/gcc11-libstdc++-docs.patch
+++ b/SOURCES/gcc11-libstdc++-docs.patch
@@ -4,7 +4,7 @@
FSF
-+ Release 11.2.1
++ Release 11.3.1
+
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation
@@ -17,7 +17,7 @@
- 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,
++ for the 11.3.1 release,
+ online
for each GCC release
and
diff --git a/SOURCES/gcc11-pie.patch b/SOURCES/gcc11-pie.patch
index 36ae11b..728d048 100644
--- a/SOURCES/gcc11-pie.patch
+++ b/SOURCES/gcc11-pie.patch
@@ -291,24 +291,6 @@ index 258b17a226e..bd4fe1fd6ca 100755
--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.
@@ -793,24 +775,6 @@ index f489f31bc70..0dfc1982844 100755
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
diff --git a/SOURCES/gcc11-pr105331.patch b/SOURCES/gcc11-pr105331.patch
new file mode 100644
index 0000000..fa1a9d3
--- /dev/null
+++ b/SOURCES/gcc11-pr105331.patch
@@ -0,0 +1,33 @@
+2022-04-21 Jakub Jelinek
+
+ PR target/105331
+ * config/i386/i386.c (ix86_gimplify_va_arg): Mark va_arg_tmp
+ temporary TREE_ADDRESSABLE before trying to gimplify ADDR_EXPR
+ of it.
+
+ * gcc.dg/pr105331.c: New test.
+
+--- gcc/config/i386/i386.c.jj 2022-04-12 09:20:07.566662842 +0200
++++ gcc/config/i386/i386.c 2022-04-21 12:03:32.201951522 +0200
+@@ -4891,6 +4891,7 @@ ix86_gimplify_va_arg (tree valist, tree
+ {
+ int i, prev_size = 0;
+ tree temp = create_tmp_var (type, "va_arg_tmp");
++ TREE_ADDRESSABLE (temp) = 1;
+
+ /* addr = &temp; */
+ t = build1 (ADDR_EXPR, build_pointer_type (type), temp);
+--- gcc/testsuite/gcc.dg/pr105331.c.jj 2022-04-21 12:09:34.398906718 +0200
++++ gcc/testsuite/gcc.dg/pr105331.c 2022-04-21 12:09:07.304283903 +0200
+@@ -0,0 +1,11 @@
++/* PR target/105331 */
++/* { dg-do compile } */
++/* { dg-options "-O -Wuninitialized" } */
++
++#include
++
++int
++foo (va_list *va)
++{
++ return va_arg (*va, double _Complex); /* { dg-bogus "may be used uninitialized" } */
++}
diff --git a/SOURCES/gcc11-rh2106262.patch b/SOURCES/gcc11-rh2106262.patch
new file mode 100644
index 0000000..34e9c5b
--- /dev/null
+++ b/SOURCES/gcc11-rh2106262.patch
@@ -0,0 +1,388 @@
+commit c725028a8bb9478ec84332641147ad12b9236922
+Author: Jonathan Wakely
+Date: Tue Dec 14 14:32:35 2021 +0000
+
+ libstdc++: Fix handling of invalid ranges in std::regex [PR102447]
+
+ std::regex currently allows invalid bracket ranges such as [\w-a] which
+ are only allowed by ECMAScript when in web browser compatibility mode.
+ It should be an error, because the start of the range is a character
+ class, not a single character. The current implementation of
+ _Compiler::_M_expression_term does not provide a way to reject this,
+ because we only remember a previous character, not whether we just
+ processed a character class (or collating symbol etc.)
+
+ This patch replaces the pair used to emulate
+ optional with a custom class closer to pair. That
+ allows us to track three states, so that we can tell when we've just
+ seen a character class.
+
+ With this additional state the code in _M_expression_term for processing
+ the _S_token_bracket_dash can be improved to correctly reject the [\w-a]
+ case, without regressing for valid cases such as [\w-] and [----].
+
+ libstdc++-v3/ChangeLog:
+
+ PR libstdc++/102447
+ * include/bits/regex_compiler.h (_Compiler::_BracketState): New
+ class.
+ (_Compiler::_BrackeyMatcher): New alias template.
+ (_Compiler::_M_expression_term): Change pair
+ parameter to _BracketState. Process first character for
+ ECMAScript syntax as well as POSIX.
+ * include/bits/regex_compiler.tcc
+ (_Compiler::_M_insert_bracket_matcher): Pass _BracketState.
+ (_Compiler::_M_expression_term): Use _BracketState to store
+ state between calls. Improve handling of dashes in ranges.
+ * testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc:
+ Add more tests for ranges containing dashes. Check invalid
+ ranges with character class at the beginning.
+
+ (cherry picked from commit 7ce3c230edf6e498e125c805a6dd313bf87dc439)
+
+diff --git a/libstdc++-v3/include/bits/regex_compiler.h b/libstdc++-v3/include/bits/regex_compiler.h
+index f224fcb06e0..aa19df2bf9a 100644
+--- a/libstdc++-v3/include/bits/regex_compiler.h
++++ b/libstdc++-v3/include/bits/regex_compiler.h
+@@ -122,13 +122,45 @@ namespace __detail
+ void
+ _M_insert_bracket_matcher(bool __neg);
+
+- // Returns true if successfully matched one term and should continue.
++ // Cache of the last atom seen in a bracketed range expression.
++ struct _BracketState
++ {
++ enum class _Type : char { _None, _Char, _Class } _M_type = _Type::_None;
++ _CharT _M_char;
++
++ void
++ set(_CharT __c) noexcept { _M_type = _Type::_Char; _M_char = __c; }
++
++ _GLIBCXX_NODISCARD _CharT
++ get() const noexcept { return _M_char; }
++
++ void
++ reset(_Type __t = _Type::_None) noexcept { _M_type = __t; }
++
++ explicit operator bool() const noexcept
++ { return _M_type != _Type::_None; }
++
++ // Previous token was a single character.
++ _GLIBCXX_NODISCARD bool
++ _M_is_char() const noexcept { return _M_type == _Type::_Char; }
++
++ // Previous token was a character class, equivalent class,
++ // collating symbol etc.
++ _GLIBCXX_NODISCARD bool
++ _M_is_class() const noexcept { return _M_type == _Type::_Class; }
++ };
++
++ template
++ using _BracketMatcher
++ = std::__detail::_BracketMatcher<_TraitsT, __icase, __collate>;
++
++ // Returns true if successfully parsed one term and should continue
++ // compiling a bracket expression.
+ // Returns false if the compiler should move on.
+ template
+ bool
+- _M_expression_term(pair& __last_char,
+- _BracketMatcher<_TraitsT, __icase, __collate>&
+- __matcher);
++ _M_expression_term(_BracketState& __last_char,
++ _BracketMatcher<__icase, __collate>& __matcher);
+
+ int
+ _M_cur_int_value(int __radix);
+diff --git a/libstdc++-v3/include/bits/regex_compiler.tcc b/libstdc++-v3/include/bits/regex_compiler.tcc
+index ea07bc2428e..7769a9e63a3 100644
+--- a/libstdc++-v3/include/bits/regex_compiler.tcc
++++ b/libstdc++-v3/include/bits/regex_compiler.tcc
+@@ -403,7 +403,7 @@ namespace __detail
+ _M_insert_character_class_matcher()
+ {
+ __glibcxx_assert(_M_value.size() == 1);
+- _BracketMatcher<_TraitsT, __icase, __collate> __matcher
++ _BracketMatcher<__icase, __collate> __matcher
+ (_M_ctype.is(_CtypeT::upper, _M_value[0]), _M_traits);
+ __matcher._M_add_character_class(_M_value, false);
+ __matcher._M_ready();
+@@ -424,25 +424,17 @@ namespace __detail
+ _Compiler<_TraitsT>::
+ _M_insert_bracket_matcher(bool __neg)
+ {
+- _BracketMatcher<_TraitsT, __icase, __collate> __matcher(__neg, _M_traits);
+- pair __last_char; // Optional<_CharT>
+- __last_char.first = false;
+- if (!(_M_flags & regex_constants::ECMAScript))
+- {
+- if (_M_try_char())
+- {
+- __last_char.first = true;
+- __last_char.second = _M_value[0];
+- }
+- else if (_M_match_token(_ScannerT::_S_token_bracket_dash))
+- {
+- __last_char.first = true;
+- __last_char.second = '-';
+- }
+- }
+- while (_M_expression_term(__last_char, __matcher));
+- if (__last_char.first)
+- __matcher._M_add_char(__last_char.second);
++ _BracketMatcher<__icase, __collate> __matcher(__neg, _M_traits);
++ _BracketState __last_char;
++ if (_M_try_char())
++ __last_char.set(_M_value[0]);
++ else if (_M_match_token(_ScannerT::_S_token_bracket_dash))
++ // Dash as first character is a normal character.
++ __last_char.set('-');
++ while (_M_expression_term(__last_char, __matcher))
++ ;
++ if (__last_char._M_is_char())
++ __matcher._M_add_char(__last_char.get());
+ __matcher._M_ready();
+ _M_stack.push(_StateSeqT(
+ *_M_nfa,
+@@ -447,27 +438,27 @@ namespace __detail
+ template
+ bool
+ _Compiler<_TraitsT>::
+- _M_expression_term(pair& __last_char,
+- _BracketMatcher<_TraitsT, __icase, __collate>& __matcher)
++ _M_expression_term(_BracketState& __last_char,
++ _BracketMatcher<__icase, __collate>& __matcher)
+ {
+ if (_M_match_token(_ScannerT::_S_token_bracket_end))
+ return false;
+
++ // Add any previously cached char into the matcher and update cache.
+ const auto __push_char = [&](_CharT __ch)
+ {
+- if (__last_char.first)
+- __matcher._M_add_char(__last_char.second);
+- else
+- __last_char.first = true;
+- __last_char.second = __ch;
++ if (__last_char._M_is_char())
++ __matcher._M_add_char(__last_char.get());
++ __last_char.set(__ch);
+ };
+- const auto __flush = [&]
++ // Add any previously cached char into the matcher and update cache.
++ const auto __push_class = [&]
+ {
+- if (__last_char.first)
+- {
+- __matcher._M_add_char(__last_char.second);
+- __last_char.first = false;
+- }
++ if (__last_char._M_is_char())
++ __matcher._M_add_char(__last_char.get());
++ // We don't cache anything here, just record that the last thing
++ // processed was a character class (or similar).
++ __last_char.reset(_BracketState::_Type::_Class);
+ };
+
+ if (_M_match_token(_ScannerT::_S_token_collsymbol))
+@@ -476,16 +467,16 @@ namespace __detail
+ if (__symbol.size() == 1)
+ __push_char(__symbol[0]);
+ else
+- __flush();
++ __push_class();
+ }
+ else if (_M_match_token(_ScannerT::_S_token_equiv_class_name))
+ {
+- __flush();
++ __push_class();
+ __matcher._M_add_equivalence_class(_M_value);
+ }
+ else if (_M_match_token(_ScannerT::_S_token_char_class_name))
+ {
+- __flush();
++ __push_class();
+ __matcher._M_add_character_class(_M_value, false);
+ }
+ else if (_M_try_char())
+@@ -502,49 +493,50 @@ namespace __detail
+ // It turns out that no one reads BNFs ;)
+ else if (_M_match_token(_ScannerT::_S_token_bracket_dash))
+ {
+- if (!__last_char.first)
++ if (_M_match_token(_ScannerT::_S_token_bracket_end))
+ {
+- if (!(_M_flags & regex_constants::ECMAScript))
+- {
+- if (_M_match_token(_ScannerT::_S_token_bracket_end))
+- {
+- __push_char('-');
+- return false;
+- }
+- __throw_regex_error(
+- regex_constants::error_range,
+- "Unexpected dash in bracket expression. For POSIX syntax, "
+- "a dash is not treated literally only when it is at "
+- "beginning or end.");
+- }
++ // For "-]" the dash is a literal character.
+ __push_char('-');
++ return false;
+ }
+- else
++ else if (__last_char._M_is_class())
++ {
++ // "\\w-" is invalid, start of range must be a single char.
++ __throw_regex_error(regex_constants::error_range,
++ "Invalid start of range in bracket expression.");
++ }
++ else if (__last_char._M_is_char())
+ {
+ if (_M_try_char())
+ {
+- __matcher._M_make_range(__last_char.second, _M_value[0]);
+- __last_char.first = false;
++ // "x-y"
++ __matcher._M_make_range(__last_char.get(), _M_value[0]);
++ __last_char.reset();
+ }
+ else if (_M_match_token(_ScannerT::_S_token_bracket_dash))
+ {
+- __matcher._M_make_range(__last_char.second, '-');
+- __last_char.first = false;
++ // "x--"
++ __matcher._M_make_range(__last_char.get(), '-');
++ __last_char.reset();
+ }
+ else
+- {
+- if (_M_scanner._M_get_token()
+- != _ScannerT::_S_token_bracket_end)
+- __throw_regex_error(
+- regex_constants::error_range,
+- "Character is expected after a dash.");
+- __push_char('-');
+- }
++ __throw_regex_error(regex_constants::error_range,
++ "Invalid end of range in bracket expression.");
+ }
++ else if (_M_flags & regex_constants::ECMAScript)
++ {
++ // A dash that is not part of an existing range. Might be the
++ // start of a new range, or might just be a literal '-' char.
++ // Only ECMAScript allows that in the middle of a bracket expr.
++ __push_char('-');
++ }
++ else
++ __throw_regex_error(regex_constants::error_range,
++ "Invalid dash in bracket expression.");
+ }
+ else if (_M_match_token(_ScannerT::_S_token_quoted_class))
+ {
+- __flush();
++ __push_class();
+ __matcher._M_add_character_class(_M_value,
+ _M_ctype.is(_CtypeT::upper,
+ _M_value[0]));
+diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc
+index 7df70604ea6..0d76e63da7b 100644
+--- a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc
++++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc
+@@ -69,6 +69,16 @@ test01()
+ void
+ test02()
+ {
++ VERIFY(regex_match("-", regex("[-]", regex_constants::ECMAScript)));
++ VERIFY(regex_match("-", regex("[--]", regex_constants::ECMAScript)));
++ VERIFY(regex_match("-", regex("[---]", regex_constants::ECMAScript)));
++ VERIFY(regex_match("-", regex("[----]", regex_constants::ECMAScript)));
++ VERIFY(regex_match("-", regex("[-----]", regex_constants::ECMAScript)));
++
++ VERIFY(regex_match("-", regex("[-]", regex_constants::extended)));
++ VERIFY(regex_match("-", regex("[--]", regex_constants::extended)));
++ VERIFY(regex_match("-", regex("[---]", regex_constants::extended)));
++ VERIFY(regex_match("-", regex("[----]", regex_constants::extended)));
+ try
+ {
+ std::regex re("[-----]", std::regex::extended);
+@@ -78,7 +88,6 @@ test02()
+ {
+ VERIFY(e.code() == std::regex_constants::error_range);
+ }
+- std::regex re("[-----]", std::regex::ECMAScript);
+
+ VERIFY(!regex_match("b", regex("[-ac]", regex_constants::extended)));
+ VERIFY(!regex_match("b", regex("[ac-]", regex_constants::extended)));
+@@ -93,7 +102,27 @@ test02()
+ }
+ catch (const std::regex_error& e)
+ {
++ VERIFY(e.code() == std::regex_constants::error_range);
++ }
++ try
++ {
++ regex("[@--]", regex_constants::extended);
++ VERIFY(false);
+ }
++ catch (const std::regex_error& e)
++ {
++ VERIFY(e.code() == std::regex_constants::error_range);
++ }
++ try
++ {
++ regex("[--%]", regex_constants::extended);
++ VERIFY(false);
++ }
++ catch (const std::regex_error& e)
++ {
++ VERIFY(e.code() == std::regex_constants::error_range);
++ }
++
+ VERIFY(regex_match("].", regex("[][.hyphen.]-0]*", regex_constants::extended)));
+ }
+
+@@ -158,6 +187,36 @@ test06()
+ VERIFY(regex_match("a-", debian_cron_namespace_ok));
+ }
+
++// libstdc++/102447
++void
++test07()
++{
++ VERIFY(regex_match("-", std::regex("[\\w-]", std::regex::ECMAScript)));
++ VERIFY(regex_match("a", std::regex("[\\w-]", std::regex::ECMAScript)));
++ VERIFY(regex_match("-", std::regex("[a-]", std::regex::ECMAScript)));
++ VERIFY(regex_match("a", std::regex("[a-]", std::regex::ECMAScript)));
++
++ try
++ {
++ std::regex re("[\\w-a]", std::regex::ECMAScript);
++ VERIFY(false);
++ }
++ catch (const std::regex_error& e)
++ {
++ VERIFY(e.code() == std::regex_constants::error_range);
++ }
++
++ try
++ {
++ std::regex re("[\\w--]", std::regex::ECMAScript);
++ VERIFY(false);
++ }
++ catch (const std::regex_error& e)
++ {
++ VERIFY(e.code() == std::regex_constants::error_range);
++ }
++}
++
+ int
+ main()
+ {
+@@ -167,6 +226,7 @@ main()
+ test04();
+ test05();
+ test06();
++ test07();
+
+ return 0;
+ }
diff --git a/SPECS/gcc.spec b/SPECS/gcc.spec
index 4fdcde7..0fbbd36 100644
--- a/SPECS/gcc.spec
+++ b/SPECS/gcc.spec
@@ -1,10 +1,10 @@
-%global DATE 20220127
-%global gitrev 2fa6e5c54e782377faa4c9c1f0e0b16db27f266c
-%global gcc_version 11.2.1
+%global DATE 20220421
+%global gitrev 1d3172725999deb0dca93ac70393ed9a0ad0da3f
+%global gcc_version 11.3.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 gcc_release 2
%global nvptx_tools_gitrev 5f6f343a302d620b0868edab376c00b15741e39e
%global newlib_cygwin_gitrev 50e2a63b04bdd018484605fbb954fd1bd5147fa0
%global _unpackaged_files_terminate_build 0
@@ -116,7 +116,7 @@
Summary: Various compilers (C, C++, Objective-C, ...)
Name: gcc
Version: %{gcc_version}
-Release: %{gcc_release}.4%{?dist}
+Release: %{gcc_release}.1%{?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
@@ -271,9 +271,11 @@ 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
+Patch25: gcc11-pr105331.patch
+# This can go once we rebase from GCC 11.
+Patch26: gcc11-rh2106262.patch
Patch100: gcc11-fortran-fdec-duplicates.patch
Patch101: gcc11-fortran-flogical-as-integer.patch
@@ -823,9 +825,10 @@ so that there cannot be any synchronization problems.
%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~
+%patch25 -p0 -b .pr105331~
+%patch26 -p1 -b .rh2106262~
%if 0%{?rhel} >= 9
%patch100 -p1 -b .fortran-fdec-duplicates~
@@ -3271,6 +3274,83 @@ end
%{ANNOBIN_GCC_PLUGIN_DIR}/gcc-annobin.so.0.0.0
%changelog
+* Tue Jul 12 2022 Marek Polacek 11.3.1-2.1
+- fix handling of invalid ranges in std::regex (#2106262)
+
+* Thu Apr 21 2022 Jakub Jelinek 11.3.1-2
+- update from releases/gcc-11-branch (#2077536)
+ - GCC 11.3 release
+ - PRs c++/98249, c++/99893, c++/100608, c++/101051, c++/101532, c++/101677,
+ c++/101717, c++/101894, c++/102869, c++/103105, c++/103328,
+ c++/103341, c++/103455, c++/103706, c++/103885, c++/103943,
+ c++/104008, c++/104079, c++/104225, c++/104507, c++/104565,
+ c++/105003, c++/105064, c++/105143, c++/105186, c++/105256, c/101585,
+ debug/105203, fortran/102992, fortran/104210, fortran/104228,
+ fortran/104570, fortran/105138, gcov-profile/105282, ipa/103083,
+ ipa/103432, jit/100613, libstdc++/90943, libstdc++/100516,
+ libstdc++/103630, libstdc++/103638, libstdc++/103650,
+ libstdc++/103955, libstdc++/104098, libstdc++/104301,
+ libstdc++/104542, libstdc++/104859, libstdc++/105021,
+ libstdc++/105027, middle-end/104497, middle-end/105165,
+ rtl-optimization/104985, rtl-optimization/105028,
+ rtl-optimization/105211, target/80556, target/100106, target/104117,
+ target/104474, target/104853, target/104894, target/105214,
+ target/105257, tree-optimization/99121, tree-optimization/104880,
+ tree-optimization/105053, tree-optimization/105070,
+ tree-optimization/105189, tree-optimization/105198,
+ tree-optimization/105226, tree-optimization/105232,
+ tree-optimization/105235
+- fix bogus -Wuninitialized warning on va_arg with complex types on x86_64
+ (PR target/105331)
+- remove bogus assertion in std::from_chars (PR libstdc++/105324)
+
+* Mon Apr 4 2022 David Malcolm - 11.2.1-10
+- update from releases/gcc-11-branch (#2063255)
+ - PRs ada/98724, ada/104258, ada/104767, ada/104861, c++/58646, c++/59950,
+ c++/61611, c++/95036, c++/100468, c++/101030, c++/101095, c++/101371,
+ c++/101515, c++/101767, c++/102045, c++/102123, c++/102538,
+ c++/102740, c++/102990, c++/103057, c++/103186, c++/103291,
+ c++/103299, c++/103337, c++/103711, c++/103769, c++/103968,
+ c++/104107, c++/104108, c++/104284, c++/104410, c++/104472,
+ c++/104513, c++/104568, c++/104667, c++/104806, c++/104847,
+ c++/104944, c++/104994, c++/105035, c++/105061, c/82283, c/84685,
+ c/104510, c/104711, d/104659, d/105004, debug/104337, debug/104517,
+ debug/104557, fortran/66193, fortran/99585, fortran/100337,
+ fortran/103790, fortran/104211, fortran/104311, fortran/104331,
+ fortran/104430, fortran/104619, fortran/104811, go/100537,
+ libgomp/104385, libstdc++/101231, libstdc++/102358, libstdc++/103904,
+ libstdc++/104442, lto/104237, lto/104333, lto/104617,
+ middle-end/95115, middle-end/99578, middle-end/100464,
+ middle-end/100680, middle-end/100775, middle-end/100786,
+ middle-end/104307, middle-end/104402, middle-end/104446,
+ middle-end/104786, middle-end/104971, middle-end/105032,
+ preprocessor/104147, rtl-optimization/104544, rtl-optimization/104589,
+ rtl-optimization/104777, rtl-optimization/104814, sanitizer/102656,
+ sanitizer/104449, sanitizer/105093, target/79754, target/87496,
+ target/99708, target/99754, target/100784, target/101324,
+ target/102140, target/102952, target/102957, target/103307,
+ target/103627, target/103925, target/104090, target/104208,
+ target/104219, target/104253, target/104362, target/104448,
+ target/104451, target/104453, target/104458, target/104462,
+ target/104469, target/104502, target/104674, target/104681,
+ target/104688, target/104775, target/104890, target/104910,
+ target/104923, target/104963, target/104998, target/105000,
+ target/105052, target/105058, target/105068, testsuite/103556,
+ testsuite/103586, testsuite/104730, testsuite/104759,
+ testsuite/105055, tree-optimization/45178, tree-optimization/100834,
+ tree-optimization/101636, tree-optimization/102819,
+ tree-optimization/102893, tree-optimization/103169,
+ tree-optimization/103361, tree-optimization/103489,
+ tree-optimization/103544, tree-optimization/103596,
+ tree-optimization/103641, tree-optimization/103864,
+ tree-optimization/104263, tree-optimization/104288,
+ tree-optimization/104511, tree-optimization/104601,
+ tree-optimization/104675, tree-optimization/104782,
+ tree-optimization/104931, tree-optimization/105094
+- fix x86 vector initialization expansion fallback (PR target/105123)
+- drop patch 22 (gcc11-libsanitizer-pthread.patch;
+ upstreamed as r11-9607-ga8dd74bfb921ed)
+
* Thu Feb 10 2022 Marek Polacek 11.2.1-9.4
- add --enable-host-bind-now, use it (#2044917)