diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4a0e473afd73..cde4653c0304 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2020-03-25 Jakub Jelinek + PR c++/94223 + * langhooks.c (lhd_set_decl_assembler_name): Use a static ulong + counter instead of DECL_UID. + PR tree-optimization/94300 * tree-ssa-sccvn.c (vn_walk_cb_data::push_partial_def): If pd.offset is positive, make sure that off + size isn't larger than needed_len. diff --git a/gcc/langhooks.c b/gcc/langhooks.c index 640bd012d1c5..5e3216da6312 100644 --- a/gcc/langhooks.c +++ b/gcc/langhooks.c @@ -160,16 +160,17 @@ lhd_set_decl_assembler_name (tree decl) Can't use just the variable's own name for a variable whose scope is less than the whole compilation. Concatenate a distinguishing - number - we use the DECL_UID. */ + number. */ if (TREE_PUBLIC (decl) || DECL_FILE_SCOPE_P (decl)) id = targetm.mangle_decl_assembler_name (decl, DECL_NAME (decl)); else { const char *name = IDENTIFIER_POINTER (DECL_NAME (decl)); + static unsigned long num; char *label; - ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl)); + ASM_FORMAT_PRIVATE_NAME (label, name, num++); id = get_identifier (label); } diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 619a42d51423..4171a3dc4aed 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,9 @@ +2020-03-25 Jakub Jelinek + + PR c++/94223 + * lto-lang.c (lto_set_decl_assembler_name): Use a static ulong + counter instead of DECL_UID. + 2020-03-24 Tobias Burnus PR libgomp/81689 diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c index a5638e7a2a00..a3e841850edf 100644 --- a/gcc/lto/lto-lang.c +++ b/gcc/lto/lto-lang.c @@ -1179,8 +1179,9 @@ lto_set_decl_assembler_name (tree decl) { const char *name = IDENTIFIER_POINTER (DECL_NAME (decl)); char *label; + static unsigned long num; - ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl)); + ASM_FORMAT_PRIVATE_NAME (label, name, num++); id = get_identifier (label); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2a39af6feabd..048f830409e2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2020-03-25 Jakub Jelinek + PR c++/94223 + * g++.dg/opt/pr94223.C: New test. + PR tree-optimization/94300 * gcc.target/i386/avx512f-pr94300.c: New test. diff --git a/gcc/testsuite/g++.dg/opt/pr94223.C b/gcc/testsuite/g++.dg/opt/pr94223.C new file mode 100644 index 000000000000..0de012de5040 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr94223.C @@ -0,0 +1,5 @@ +// PR c++/94223 +// { dg-do compile } +// { dg-options "-O0 -std=c++2a -fcompare-debug" } + +#include "../cpp1z/init-statement6.C"