- backport from 11.3.1-2: update from releases/gcc-11-branch (#2077536)
- backport from 11.3.1-2: fix bogus -Wuninitialized warning on va_arg with complex types on x86_64 (PR target/105331) - backport from 11.3.1-2: remove bogus assertion in std::from_chars (PR libstdc++/105324) - backport from 11.2.1-10: update from releases/gcc-11-branch (#2063255) - backport from 11.2.1-10: fix x86 vector initialization expansion fallback - backport from 11.2.1-10: drop patch 22 (gcc11-libsanitizer-pthread.patch; upstreamed as r11-9607-ga8dd74bfb921ed)epel9
parent
f6d78532af
commit
fc14369b2e
@ -1,54 +0,0 @@
|
|||||||
Backported from LLVM upstream:
|
|
||||||
|
|
||||||
commit ef14b78d9a144ba81ba02083fe21eb286a88732b
|
|
||||||
Author: Florian Weimer <fweimer@redhat.com>
|
|
||||||
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<unsigned *>(
|
|
||||||
+ dlsym(RTLD_DEFAULT, "_thread_db_sizeof_pthread")))
|
|
||||||
+ val = *psizeof;
|
|
||||||
+ if (!val)
|
|
||||||
+ val = ThreadDescriptorSizeFallback();
|
|
||||||
+ atomic_store_relaxed(&thread_descriptor_size, val);
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
|||||||
|
2022-04-21 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
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 <stdarg.h>
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+foo (va_list *va)
|
||||||
|
+{
|
||||||
|
+ return va_arg (*va, double _Complex); /* { dg-bogus "may be used uninitialized" } */
|
||||||
|
+}
|
Loading…
Reference in new issue