Merged update from upstream sources

This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/gcc.git#2a97a4485a84bad8a4cbcc39a7ea535632d7b887
This commit is contained in:
DistroBaker 2021-01-23 19:57:57 +00:00
parent 6a24745675
commit 058986cf08
12 changed files with 77 additions and 738 deletions

1
.gitignore vendored
View File

@ -30,3 +30,4 @@
/gcc-11.0.0-20210113.tar.xz
/gcc-11.0.0-20210116.tar.xz
/gcc-11.0.0-20210119.tar.xz
/gcc-11.0.0-20210123.tar.xz

View File

@ -1,5 +1,5 @@
%global DATE 20210119
%global gitrev 4b9bffe2c626b87d403f11674a5bd63c6078c777
%global DATE 20210123
%global gitrev 6efa61bd94ae86200aaed7ec513de6b3726220bf
%global gcc_version 11.0.0
%global gcc_major 11
# Note, gcc_release must be integer, if you want to add suffixes to
@ -119,7 +119,7 @@
Summary: Various compilers (C, C++, Objective-C, ...)
Name: gcc
Version: %{gcc_version}
Release: %{gcc_release}.16%{?dist}
Release: %{gcc_release}.17%{?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
@ -272,14 +272,7 @@ Patch9: gcc11-Wno-format-security.patch
Patch10: gcc11-rh1574936.patch
Patch11: gcc11-d-shared-libphobos.patch
Patch12: gcc11-pr98338-workaround.patch
Patch13: gcc11-pr98672.patch
Patch14: gcc11-pr98687.patch
Patch15: gcc11-pr98721.patch
Patch16: gcc11-pr98742.patch
Patch17: gcc11-pr98638.patch
Patch18: gcc11-pr98765.patch
Patch19: gcc11-libgomp-task.patch
Patch20: gcc11-pr98751.patch
Patch13: gcc11-pr98681.patch
# On ARM EABI systems, we do want -gnueabi to be part of the
# target triple.
@ -791,14 +784,7 @@ to NVidia PTX capable devices if available.
%endif
%patch11 -p0 -b .d-shared-libphobos~
%patch12 -p0 -b .pr98338-workaround~
%patch13 -p0 -b .pr98672~
%patch14 -p0 -b .pr98687~
%patch15 -p0 -b .pr98721~
%patch16 -p0 -b .pr98742~
%patch17 -p0 -b .pr98638~
%patch18 -p0 -b .pr98765~
%patch19 -p0 -b .libgomp-task~
%patch20 -p0 -b .pr98751~
%patch13 -p0 -b .pr98681~
rm -f libgomp/testsuite/*/*task-detach*
@ -3085,9 +3071,29 @@ end
%endif
%changelog
* Sat Jan 23 2021 Jakub Jelinek <jakub@redhat.com> 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 <jakub@redhat.com> 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 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)

View File

@ -1,69 +0,0 @@
2021-01-20 Jakub Jelinek <jakub@redhat.com>
* task.c (GOMP_task): Rename priority argument to priority_arg,
add priority automatic variable and modify that variable. Instead of
clearing detach argument when GOMP_TASK_FLAG_DETACH bit is not set,
check flags for that bit.
--- libgomp/task.c.jj 2021-01-18 07:18:42.362339622 +0100
+++ libgomp/task.c 2021-01-20 17:23:36.973758174 +0100
@@ -354,10 +354,11 @@ task_fulfilled_p (struct gomp_task *task
void
GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
long arg_size, long arg_align, bool if_clause, unsigned flags,
- void **depend, int priority, void *detach)
+ void **depend, int priority_arg, void *detach)
{
struct gomp_thread *thr = gomp_thread ();
struct gomp_team *team = thr->ts.team;
+ int priority = 0;
#ifdef HAVE_BROKEN_POSIX_SEMAPHORES
/* If pthread_mutex_* is used for omp_*lock*, then each task must be
@@ -385,13 +386,12 @@ GOMP_task (void (*fn) (void *), void *da
}
}
- if ((flags & GOMP_TASK_FLAG_PRIORITY) == 0)
- priority = 0;
- else if (priority > gomp_max_task_priority_var)
- priority = gomp_max_task_priority_var;
-
- if ((flags & GOMP_TASK_FLAG_DETACH) == 0)
- detach = NULL;
+ if (__builtin_expect ((flags & GOMP_TASK_FLAG_PRIORITY) != 0, 0))
+ {
+ priority = priority_arg;
+ if (priority > gomp_max_task_priority_var)
+ priority = gomp_max_task_priority_var;
+ }
if (!if_clause || team == NULL
|| (thr->task && thr->task->final_task)
@@ -415,7 +415,7 @@ GOMP_task (void (*fn) (void *), void *da
|| (flags & GOMP_TASK_FLAG_FINAL);
task.priority = priority;
- if (detach)
+ if ((flags & GOMP_TASK_FLAG_DETACH) != 0)
{
task.detach = true;
gomp_sem_init (&task.completion_sem, 0);
@@ -443,7 +443,7 @@ GOMP_task (void (*fn) (void *), void *da
else
fn (data);
- if (detach && !task_fulfilled_p (&task))
+ if (task.detach && !task_fulfilled_p (&task))
gomp_sem_wait (&task.completion_sem);
/* Access to "children" is normally done inside a task_lock
@@ -484,7 +484,7 @@ GOMP_task (void (*fn) (void *), void *da
task->kind = GOMP_TASK_UNDEFERRED;
task->in_tied_task = parent->in_tied_task;
task->taskgroup = taskgroup;
- if (detach)
+ if ((flags & GOMP_TASK_FLAG_DETACH) != 0)
{
task->detach = true;
gomp_sem_init (&task->completion_sem, 0);

View File

@ -1,29 +0,0 @@
Since SSA names do leak into global tree data structures like
TYPE_SIZE or in this case GFC_DECL_SAVED_DESCRIPTOR because of
frontend bugs we have to be careful to wipe references to the
CFG when we deconstruct SSA form because we now do ggc_free that.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
2021-01-19 Richard Biener <rguenther@suse.de>
PR middle-end/98638
* tree-ssanames.c (fini_ssanames): Zero SSA_NAME_DEF_STMT.
--- gcc/tree-ssanames.c
+++ gcc/tree-ssanames.c
@@ -102,6 +102,14 @@ init_ssanames (struct function *fn, int size)
void
fini_ssanames (struct function *fn)
{
+ unsigned i;
+ tree name;
+ /* Some SSA names leak into global tree data structures so we can't simply
+ ggc_free them. But make sure to clear references to stmts since we now
+ ggc_free the CFG itself. */
+ FOR_EACH_VEC_SAFE_ELT (SSANAMES (fn), i, name)
+ if (name)
+ SSA_NAME_DEF_STMT (name) = NULL;
vec_free (SSANAMES (fn));
vec_free (FREE_SSANAMES (fn));
vec_free (FREE_SSANAMES_QUEUE (fn));

View File

@ -1,87 +0,0 @@
2021-01-15 Jakub Jelinek <jakub@redhat.com>
PR c++/98672
* constexpr.c (potential_constant_expression_1) <case FOR_STMT>,
<case WHILE_STMT>: If the condition isn't constant true, check if
the loop body can contain a return stmt.
* g++.dg/cpp1y/constexpr-98672.C: New test.
--- gcc/cp/constexpr.c.jj 2021-01-13 19:19:44.368469462 +0100
+++ gcc/cp/constexpr.c 2021-01-14 12:02:27.347042704 +0100
@@ -8190,7 +8190,17 @@ potential_constant_expression_1 (tree t,
/* If we couldn't evaluate the condition, it might not ever be
true. */
if (!integer_onep (tmp))
- return true;
+ {
+ /* Before returning true, check if the for body can contain
+ a return. */
+ hash_set<tree> pset;
+ check_for_return_continue_data data = { &pset, NULL_TREE };
+ if (tree ret_expr
+ = cp_walk_tree (&FOR_BODY (t), check_for_return_continue,
+ &data, &pset))
+ *jump_target = ret_expr;
+ return true;
+ }
}
if (!RECUR (FOR_EXPR (t), any))
return false;
@@ -8219,7 +8229,17 @@ potential_constant_expression_1 (tree t,
tmp = cxx_eval_outermost_constant_expr (tmp, true);
/* If we couldn't evaluate the condition, it might not ever be true. */
if (!integer_onep (tmp))
- return true;
+ {
+ /* Before returning true, check if the while body can contain
+ a return. */
+ hash_set<tree> pset;
+ check_for_return_continue_data data = { &pset, NULL_TREE };
+ if (tree ret_expr
+ = cp_walk_tree (&WHILE_BODY (t), check_for_return_continue,
+ &data, &pset))
+ *jump_target = ret_expr;
+ return true;
+ }
if (!RECUR (WHILE_BODY (t), any))
return false;
if (breaks (jump_target) || continues (jump_target))
--- gcc/testsuite/g++.dg/cpp1y/constexpr-98672.C.jj 2021-01-14 12:19:24.842438847 +0100
+++ gcc/testsuite/g++.dg/cpp1y/constexpr-98672.C 2021-01-14 12:07:33.935551155 +0100
@@ -0,0 +1,35 @@
+// PR c++/98672
+// { dg-do compile { target c++14 } }
+
+void
+foo ()
+{
+}
+
+constexpr int
+bar ()
+{
+ for (int i = 0; i < 5; ++i)
+ return i;
+ foo ();
+ return 0;
+}
+
+constexpr int
+baz ()
+{
+ int i = 0;
+ while (i < 5)
+ {
+ if (i == 3)
+ return i;
+ else
+ ++i;
+ }
+ foo ();
+ return 0;
+}
+
+constexpr int i = bar ();
+constexpr int j = baz ();
+static_assert (i == 0 && j == 3, "");

48
gcc11-pr98681.patch Normal file
View File

@ -0,0 +1,48 @@
2021-01-22 Jakub Jelinek <jakub@redhat.com>
PR target/98681
* config/aarch64/aarch64.c (aarch64_mask_and_shift_for_ubfiz_p):
Use UINTVAL (shft_amnt) and UINTVAL (mask) instead of INTVAL (shft_amnt)
and INTVAL (mask). Add && INTVAL (mask) > 0 condition.
* gcc.c-torture/execute/pr98681.c: New test.
--- gcc/config/aarch64/aarch64.c.jj 2021-01-13 11:36:27.069888393 +0100
+++ gcc/config/aarch64/aarch64.c 2021-01-22 18:53:18.611518461 +0100
@@ -12060,10 +12060,11 @@ aarch64_mask_and_shift_for_ubfiz_p (scal
rtx shft_amnt)
{
return CONST_INT_P (mask) && CONST_INT_P (shft_amnt)
- && INTVAL (shft_amnt) < GET_MODE_BITSIZE (mode)
- && exact_log2 ((INTVAL (mask) >> INTVAL (shft_amnt)) + 1) >= 0
- && (INTVAL (mask)
- & ((HOST_WIDE_INT_1U << INTVAL (shft_amnt)) - 1)) == 0;
+ && INTVAL (mask) > 0
+ && UINTVAL (shft_amnt) < GET_MODE_BITSIZE (mode)
+ && exact_log2 ((UINTVAL (mask) >> UINTVAL (shft_amnt)) + 1) >= 0
+ && (UINTVAL (mask)
+ & ((HOST_WIDE_INT_1U << UINTVAL (shft_amnt)) - 1)) == 0;
}
/* Return true if the masks and a shift amount from an RTX of the form
--- gcc/testsuite/gcc.c-torture/execute/pr98681.c.jj 2021-01-22 16:45:05.102070501 +0100
+++ gcc/testsuite/gcc.c-torture/execute/pr98681.c 2021-01-22 16:44:34.165416961 +0100
@@ -0,0 +1,18 @@
+/* PR target/98681 */
+
+__attribute__((noipa)) int
+foo (int x)
+{
+ if (x > 32)
+ return (x << -64) & 255;
+ else
+ return x;
+}
+
+int
+main ()
+{
+ if (foo (32) != 32 || foo (-150) != -150)
+ __builtin_abort ();
+ return 0;
+}

View File

@ -1,130 +0,0 @@
My recent patch that introduced push_using_decl_bindings didn't
handle USING_DECL redeclaration, therefore things broke. This
patch amends that. Note that I don't know if the other parts of
finish_nonmember_using_decl are needed (e.g. the binding->type
setting) -- I couldn't trigger it by any of my hand-made testcases.
Sorry for not thinking harder about redeclarations in the original
patch :(.
2021-01-15 Marek Polacek <polacek@redhat.com>
PR c++/98687
* name-lookup.c (push_using_decl_bindings): If we found an
existing local binding, update it if it's not identical.
* g++.dg/lookup/using64.C: New test.
* g++.dg/lookup/using65.C: New test.
--- gcc/cp/name-lookup.c
+++ gcc/cp/name-lookup.c
@@ -9285,8 +9285,24 @@ push_operator_bindings ()
void
push_using_decl_bindings (tree decl)
{
- push_local_binding (DECL_NAME (decl), USING_DECL_DECLS (decl),
- /*using*/true);
+ tree name = DECL_NAME (decl);
+ tree value = USING_DECL_DECLS (decl);
+
+ cxx_binding *binding = find_local_binding (current_binding_level, name);
+ if (binding)
+ {
+ if (value == binding->value)
+ /* Redeclaration of this USING_DECL. */;
+ else if (binding->value && TREE_CODE (value) == OVERLOAD)
+ {
+ /* We already have this binding, so replace it. */
+ update_local_overload (IDENTIFIER_BINDING (name), value);
+ IDENTIFIER_BINDING (name)->value = value;
+ }
+ }
+ else
+ /* Install the new binding. */
+ push_local_binding (DECL_NAME (decl), value, /*using*/true);
}
#include "gt-cp-name-lookup.h"
--- gcc/testsuite/g++.dg/lookup/using64.C
+++ gcc/testsuite/g++.dg/lookup/using64.C
@@ -0,0 +1,60 @@
+// PR c++/98687
+// { dg-do compile }
+
+struct S { };
+
+namespace N {
+ template <typename T>
+ bool operator==(T, int);
+
+ template <typename T>
+ void X(T);
+}
+
+namespace M {
+ template <typename T>
+ bool operator==(T, double);
+}
+
+template<typename T>
+bool fn1 (T t)
+{
+ using N::operator==;
+ return t == 1;
+}
+
+template<typename T>
+bool fn2 (T t)
+{
+ // Redeclaration.
+ using N::operator==;
+ using N::operator==;
+ return t == 1;
+}
+
+template<typename T>
+bool fn3 (T t)
+{
+ // Need update_local_overload.
+ using N::operator==;
+ using M::operator==;
+ return t == 1;
+}
+
+template<typename T>
+void fn4 (T t)
+{
+ struct X { };
+ using N::X;
+ X(1);
+}
+
+void
+g ()
+{
+ S s;
+ fn1 (s);
+ fn2 (s);
+ fn3 (s);
+ fn4 (s);
+}
--- gcc/testsuite/g++.dg/lookup/using65.C
+++ gcc/testsuite/g++.dg/lookup/using65.C
@@ -0,0 +1,17 @@
+// PR c++/98687
+// { dg-do compile }
+
+extern "C" namespace std {
+ double log1p(double);
+}
+namespace std_fallback {
+ template <typename> void log1p();
+}
+template <typename> struct log1p_impl {
+ static int run() {
+ using std::log1p;
+ using std_fallback::log1p;
+ return 0;
+ }
+};
+void log1p() { log1p_impl<int>::run(); }

View File

@ -1,91 +0,0 @@
2021-01-19 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/98721
* builtins.c (access_ref::inform_access): Don't assume
SSA_NAME_IDENTIFIER must be non-NULL. Print messages about
object whenever allocfn is NULL, rather than only when DECL_P
is true. Use %qE instead of %qD for that. Formatting fixes.
* gcc.dg/pr98721-1.c: New test.
* gcc.dg/pr98721-2.c: New test.
--- gcc/builtins.c.jj 2021-01-18 19:07:16.022895507 +0100
+++ gcc/builtins.c 2021-01-19 11:56:52.247070923 +0100
@@ -4414,8 +4414,8 @@ access_ref::inform_access (access_mode m
MAXREF on which the result is based. */
const offset_int orng[] =
{
- offrng[0] - maxref.offrng[0],
- wi::smax (offrng[1] - maxref.offrng[1], offrng[0]),
+ offrng[0] - maxref.offrng[0],
+ wi::smax (offrng[1] - maxref.offrng[1], offrng[0]),
};
/* Add the final PHI's offset to that of each of the arguments
@@ -4493,12 +4493,15 @@ access_ref::inform_access (access_mode m
/* Strip the SSA_NAME suffix from the variable name and
recreate an identifier with the VLA's original name. */
ref = gimple_call_lhs (stmt);
- ref = SSA_NAME_IDENTIFIER (ref);
- const char *id = IDENTIFIER_POINTER (ref);
- size_t len = strcspn (id, ".$");
- if (!len)
- len = strlen (id);
- ref = get_identifier_with_length (id, len);
+ if (SSA_NAME_IDENTIFIER (ref))
+ {
+ ref = SSA_NAME_IDENTIFIER (ref);
+ const char *id = IDENTIFIER_POINTER (ref);
+ size_t len = strcspn (id, ".$");
+ if (!len)
+ len = strlen (id);
+ ref = get_identifier_with_length (id, len);
+ }
}
else
{
@@ -4557,13 +4560,13 @@ access_ref::inform_access (access_mode m
return;
}
- if (DECL_P (ref))
+ if (allocfn == NULL_TREE)
{
if (*offstr)
- inform (loc, "at offset %s into source object %qD of size %s",
+ inform (loc, "at offset %s into source object %qE of size %s",
offstr, ref, sizestr);
else
- inform (loc, "source object %qD of size %s", ref, sizestr);
+ inform (loc, "source object %qE of size %s", ref, sizestr);
return;
}
--- gcc/testsuite/gcc.dg/pr98721-1.c.jj 2021-01-19 12:15:03.825600828 +0100
+++ gcc/testsuite/gcc.dg/pr98721-1.c 2021-01-19 12:14:24.730045488 +0100
@@ -0,0 +1,14 @@
+/* PR tree-optimization/98721 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+foo (int n)
+{
+ if (n <= 0)
+ {
+ char vla[n]; /* { dg-message "source object 'vla' of size 0" } */
+ return __builtin_strlen (vla); /* { dg-warning "'__builtin_strlen' reading 1 or more bytes from a region of size 0" } */
+ }
+ return -1;
+}
--- gcc/testsuite/gcc.dg/pr98721-2.c.jj 2021-01-19 12:00:16.005742548 +0100
+++ gcc/testsuite/gcc.dg/pr98721-2.c 2021-01-19 11:59:29.372275423 +0100
@@ -0,0 +1,8 @@
+/* PR tree-optimization/98721 */
+/* { dg-do compile } */
+
+int
+foo (void)
+{
+ return __builtin_strlen (__builtin_alloca_with_align (0, 16)); /* { dg-warning "'__builtin_strlen' reading 1 or more bytes from a region of size 0" } */
+} /* { dg-message "source object '<unknown>' of size 0" "" { target *-*-* } .-1 } */

View File

@ -1,42 +0,0 @@
2021-01-19 Jakub Jelinek <jakub@redhat.com>
PR c++/98742
* semantics.c (finish_omp_clauses) <case OMP_CLAUSE_DETACH>: If
error_operand_p, remove clause without further checking. Check
for non-NULL TYPE_NAME.
* c-c++-common/gomp/task-detach-2.c: New test.
--- gcc/cp/semantics.c.jj 2021-01-16 22:52:33.608413922 +0100
+++ gcc/cp/semantics.c 2021-01-19 10:53:07.979801786 +0100
@@ -7430,12 +7430,18 @@ finish_omp_clauses (tree clauses, enum c
remove = true;
break;
}
+ else if (error_operand_p (t))
+ {
+ remove = true;
+ break;
+ }
else
{
tree type = TYPE_MAIN_VARIANT (TREE_TYPE (t));
if (!type_dependent_expression_p (t)
&& (!INTEGRAL_TYPE_P (type)
|| TREE_CODE (type) != ENUMERAL_TYPE
+ || TYPE_NAME (type) == NULL_TREE
|| (DECL_NAME (TYPE_NAME (type))
!= get_identifier ("omp_event_handle_t"))))
{
--- gcc/testsuite/c-c++-common/gomp/task-detach-2.c.jj 2021-01-19 11:07:29.345948289 +0100
+++ gcc/testsuite/c-c++-common/gomp/task-detach-2.c 2021-01-19 11:06:57.090317518 +0100
@@ -0,0 +1,9 @@
+/* PR c++/98742 */
+/* { dg-do compile } */
+
+void
+foo ()
+{
+#pragma omp task detach(0) /* { dg-error "before numeric constant" } */
+ ;
+}

View File

@ -1,185 +0,0 @@
2021-01-19 David Malcolm <dmalcolm@redhat.com>
PR debug/98751
* dwarf2out.c (output_line_info): Rename static variable
"generation", moving it out of the function to...
(output_line_info_generation): New.
(init_sections_and_labels): Likewise, renaming the variable to...
(init_sections_and_labels_generation): New.
(dwarf2out_c_finalize): Reset the new variables.
--- gcc/dwarf2out.c
+++ gcc/dwarf2out.c
@@ -12709,22 +12709,27 @@ output_one_line_info_table (dw_line_info_table *table)
dw2_asm_output_data (1, DW_LNE_end_sequence, NULL);
}
+static unsigned int output_line_info_generation;
+
/* Output the source line number correspondence information. This
information goes into the .debug_line section. */
static void
output_line_info (bool prologue_only)
{
- static unsigned int generation;
char l1[MAX_ARTIFICIAL_LABEL_BYTES], l2[MAX_ARTIFICIAL_LABEL_BYTES];
char p1[MAX_ARTIFICIAL_LABEL_BYTES], p2[MAX_ARTIFICIAL_LABEL_BYTES];
bool saw_one = false;
int opc;
- ASM_GENERATE_INTERNAL_LABEL (l1, LINE_NUMBER_BEGIN_LABEL, generation);
- ASM_GENERATE_INTERNAL_LABEL (l2, LINE_NUMBER_END_LABEL, generation);
- ASM_GENERATE_INTERNAL_LABEL (p1, LN_PROLOG_AS_LABEL, generation);
- ASM_GENERATE_INTERNAL_LABEL (p2, LN_PROLOG_END_LABEL, generation++);
+ ASM_GENERATE_INTERNAL_LABEL (l1, LINE_NUMBER_BEGIN_LABEL,
+ output_line_info_generation);
+ ASM_GENERATE_INTERNAL_LABEL (l2, LINE_NUMBER_END_LABEL,
+ output_line_info_generation);
+ ASM_GENERATE_INTERNAL_LABEL (p1, LN_PROLOG_AS_LABEL,
+ output_line_info_generation);
+ ASM_GENERATE_INTERNAL_LABEL (p2, LN_PROLOG_END_LABEL,
+ output_line_info_generation++);
if (!XCOFF_DEBUGGING_INFO)
{
@@ -28589,6 +28594,10 @@ output_macinfo (const char *debug_line_label, bool early_lto_debug)
macinfo_label_base += macinfo_label_base_adj;
}
+/* As init_sections_and_labels may get called multiple times, have a
+ generation count for labels. */
+static unsigned init_sections_and_labels_generation;
+
/* Initialize the various sections and labels for dwarf output and prefix
them with PREFIX if non-NULL. Returns the generation (zero based
number of times function was called). */
@@ -28596,10 +28605,6 @@ output_macinfo (const char *debug_line_label, bool early_lto_debug)
static unsigned
init_sections_and_labels (bool early_lto_debug)
{
- /* As we may get called multiple times have a generation count for
- labels. */
- static unsigned generation = 0;
-
if (early_lto_debug)
{
if (!dwarf_split_debug_info)
@@ -28634,7 +28639,7 @@ init_sections_and_labels (bool early_lto_debug)
SECTION_DEBUG | SECTION_EXCLUDE, NULL);
ASM_GENERATE_INTERNAL_LABEL (debug_skeleton_abbrev_section_label,
DEBUG_SKELETON_ABBREV_SECTION_LABEL,
- generation);
+ init_sections_and_labels_generation);
/* Somewhat confusing detail: The skeleton_[abbrev|info] sections
stay in the main .o, but the skeleton_line goes into the split
@@ -28644,14 +28649,14 @@ init_sections_and_labels (bool early_lto_debug)
SECTION_DEBUG | SECTION_EXCLUDE, NULL);
ASM_GENERATE_INTERNAL_LABEL (debug_skeleton_line_section_label,
DEBUG_SKELETON_LINE_SECTION_LABEL,
- generation);
+ init_sections_and_labels_generation);
debug_str_offsets_section
= get_section (DEBUG_LTO_DWO_STR_OFFSETS_SECTION,
SECTION_DEBUG | SECTION_EXCLUDE,
NULL);
ASM_GENERATE_INTERNAL_LABEL (debug_skeleton_info_section_label,
DEBUG_SKELETON_INFO_SECTION_LABEL,
- generation);
+ init_sections_and_labels_generation);
debug_str_dwo_section = get_section (DEBUG_LTO_STR_DWO_SECTION,
DEBUG_STR_DWO_SECTION_FLAGS,
NULL);
@@ -28667,7 +28672,8 @@ init_sections_and_labels (bool early_lto_debug)
debug_line_section = get_section (DEBUG_LTO_LINE_SECTION,
SECTION_DEBUG | SECTION_EXCLUDE, NULL);
ASM_GENERATE_INTERNAL_LABEL (debug_line_section_label,
- DEBUG_LINE_SECTION_LABEL, generation);
+ DEBUG_LINE_SECTION_LABEL,
+ init_sections_and_labels_generation);
debug_str_section = get_section (DEBUG_LTO_STR_SECTION,
DEBUG_STR_SECTION_FLAGS
@@ -28711,7 +28717,7 @@ init_sections_and_labels (bool early_lto_debug)
SECTION_DEBUG, NULL);
ASM_GENERATE_INTERNAL_LABEL (debug_skeleton_abbrev_section_label,
DEBUG_SKELETON_ABBREV_SECTION_LABEL,
- generation);
+ init_sections_and_labels_generation);
/* Somewhat confusing detail: The skeleton_[abbrev|info] sections
stay in the main .o, but the skeleton_line goes into the
@@ -28721,13 +28727,13 @@ init_sections_and_labels (bool early_lto_debug)
SECTION_DEBUG | SECTION_EXCLUDE, NULL);
ASM_GENERATE_INTERNAL_LABEL (debug_skeleton_line_section_label,
DEBUG_SKELETON_LINE_SECTION_LABEL,
- generation);
+ init_sections_and_labels_generation);
debug_str_offsets_section
= get_section (DEBUG_DWO_STR_OFFSETS_SECTION,
SECTION_DEBUG | SECTION_EXCLUDE, NULL);
ASM_GENERATE_INTERNAL_LABEL (debug_skeleton_info_section_label,
DEBUG_SKELETON_INFO_SECTION_LABEL,
- generation);
+ init_sections_and_labels_generation);
debug_loc_section = get_section (dwarf_version >= 5
? DEBUG_DWO_LOCLISTS_SECTION
: DEBUG_DWO_LOC_SECTION,
@@ -28767,31 +28773,37 @@ init_sections_and_labels (bool early_lto_debug)
}
ASM_GENERATE_INTERNAL_LABEL (abbrev_section_label,
- DEBUG_ABBREV_SECTION_LABEL, generation);
+ DEBUG_ABBREV_SECTION_LABEL,
+ init_sections_and_labels_generation);
ASM_GENERATE_INTERNAL_LABEL (debug_info_section_label,
- DEBUG_INFO_SECTION_LABEL, generation);
+ DEBUG_INFO_SECTION_LABEL,
+ init_sections_and_labels_generation);
info_section_emitted = false;
ASM_GENERATE_INTERNAL_LABEL (debug_line_section_label,
- DEBUG_LINE_SECTION_LABEL, generation);
+ DEBUG_LINE_SECTION_LABEL,
+ init_sections_and_labels_generation);
/* There are up to 4 unique ranges labels per generation.
See also output_rnglists. */
ASM_GENERATE_INTERNAL_LABEL (ranges_section_label,
- DEBUG_RANGES_SECTION_LABEL, generation * 4);
+ DEBUG_RANGES_SECTION_LABEL,
+ init_sections_and_labels_generation * 4);
if (dwarf_version >= 5 && dwarf_split_debug_info)
ASM_GENERATE_INTERNAL_LABEL (ranges_base_label,
DEBUG_RANGES_SECTION_LABEL,
- 1 + generation * 4);
+ 1 + init_sections_and_labels_generation * 4);
ASM_GENERATE_INTERNAL_LABEL (debug_addr_section_label,
- DEBUG_ADDR_SECTION_LABEL, generation);
+ DEBUG_ADDR_SECTION_LABEL,
+ init_sections_and_labels_generation);
ASM_GENERATE_INTERNAL_LABEL (macinfo_section_label,
(dwarf_strict && dwarf_version < 5)
? DEBUG_MACINFO_SECTION_LABEL
- : DEBUG_MACRO_SECTION_LABEL, generation);
+ : DEBUG_MACRO_SECTION_LABEL,
+ init_sections_and_labels_generation);
ASM_GENERATE_INTERNAL_LABEL (loc_section_label, DEBUG_LOC_SECTION_LABEL,
- generation);
+ init_sections_and_labels_generation);
- ++generation;
- return generation - 1;
+ ++init_sections_and_labels_generation;
+ return init_sections_and_labels_generation - 1;
}
/* Set up for Dwarf output at the start of compilation. */
@@ -32379,6 +32391,8 @@ dwarf2out_c_finalize (void)
base_types.release ();
XDELETEVEC (producer_string);
producer_string = NULL;
+ output_line_info_generation = 0;
+ init_sections_and_labels_generation = 0;
}
#include "gt-dwarf2out.h"

View File

@ -1,83 +0,0 @@
2021-01-20 Jakub Jelinek <jakub@redhat.com>
PR debug/98765
* dwarf2out.c (reset_indirect_string): Also reset indirect strings
with DW_FORM_line_strp form.
(prune_unused_types_update_strings): Don't add into debug_str_hash
indirect strings with DW_FORM_line_strp form.
(adjust_name_comp_dir): New function.
(dwarf2out_finish): Call it on CU DIEs after resetting
debug_line_str_hash.
--- gcc/dwarf2out.c.jj 2021-01-20 08:32:09.612958930 +0100
+++ gcc/dwarf2out.c 2021-01-20 15:41:30.343417095 +0100
@@ -4733,7 +4733,9 @@ int
reset_indirect_string (indirect_string_node **h, void *)
{
struct indirect_string_node *node = *h;
- if (node->form == DW_FORM_strp || node->form == dwarf_FORM (DW_FORM_strx))
+ if (node->form == DW_FORM_strp
+ || node->form == DW_FORM_line_strp
+ || node->form == dwarf_FORM (DW_FORM_strx))
{
free (node->label);
node->label = NULL;
@@ -29477,8 +29479,9 @@ prune_unused_types_update_strings (dw_di
s->refcount++;
/* Avoid unnecessarily putting strings that are used less than
twice in the hash table. */
- if (s->refcount
- == ((DEBUG_STR_SECTION_FLAGS & SECTION_MERGE) ? 1 : 2))
+ if (s->form != DW_FORM_line_strp
+ && (s->refcount
+ == ((DEBUG_STR_SECTION_FLAGS & SECTION_MERGE) ? 1 : 2)))
{
indirect_string_node **slot
= debug_str_hash->find_slot_with_hash (s->str,
@@ -31325,6 +31328,33 @@ reset_dies (dw_die_ref die)
FOR_EACH_CHILD (die, c, reset_dies (c));
}
+/* reset_indirect_string removed the references coming from DW_AT_name
+ and DW_AT_comp_dir attributes on compilation unit DIEs. Readd them as
+ .debug_line_str strings again. */
+
+static void
+adjust_name_comp_dir (dw_die_ref die)
+{
+ for (int i = 0; i < 2; i++)
+ {
+ dwarf_attribute attr_kind = i ? DW_AT_comp_dir : DW_AT_name;
+ dw_attr_node *a = get_AT (die, attr_kind);
+ if (a == NULL || a->dw_attr_val.val_class != dw_val_class_str)
+ continue;
+
+ if (!debug_line_str_hash)
+ debug_line_str_hash
+ = hash_table<indirect_string_hasher>::create_ggc (10);
+
+ struct indirect_string_node *node
+ = find_AT_string_in_table (a->dw_attr_val.v.val_str->str,
+ debug_line_str_hash);
+ set_indirect_string (node);
+ node->form = DW_FORM_line_strp;
+ a->dw_attr_val.v.val_str = node;
+ }
+}
+
/* Output stuff that dwarf requires at the end of every file,
and generate the DWARF-2 debugging info. */
@@ -31398,6 +31428,12 @@ dwarf2out_finish (const char *filename)
{
debug_line_str_hash->traverse<void *, reset_indirect_string> (NULL);
debug_line_str_hash = NULL;
+ if (asm_outputs_debug_line_str ())
+ {
+ adjust_name_comp_dir (comp_unit_die ());
+ for (limbo_die_node *node = cu_die_list; node; node = node->next)
+ adjust_name_comp_dir (node->die);
+ }
}
}

View File

@ -1,3 +1,3 @@
SHA512 (gcc-11.0.0-20210119.tar.xz) = 67fc01799d7af841f5b2b63fe40fc5eac01fe25cb6bb0994de46babbdabe8aee384ea0fbd41b5ac7b53b32ce5724618cb0026ac2e1d3d2431751b225f8e96783
SHA512 (gcc-11.0.0-20210123.tar.xz) = 0c1ee7eab7ef8380c168e4841360667fe7f07d93df54c2f5c814d7830ec812f6087e0ded2761db5f316e1a16772fbc5c39c31a3b2862a3e455c44edc29eb624b
SHA512 (newlib-cygwin-50e2a63b04bdd018484605fbb954fd1bd5147fa0.tar.xz) = 002a48a7b689a81abbf16161bcaec001a842e67dfbe372e9e109092703bfc666675f16198f60ca429370e8850d564547dc505df81bc3aaca4ce6defbc014ad6c
SHA512 (nvptx-tools-5f6f343a302d620b0868edab376c00b15741e39e.tar.xz) = f6d10db94fa1570ae0f94df073fa3c73c8e5ee16d59070b53d94f7db0de8a031bc44d7f3f1852533da04b625ce758e022263855ed43cfc6867e0708d001e53c7