From e25bc116370a6221bf85184b240daaa213518641 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 19 Mar 2021 15:52:54 +0100 Subject: [PATCH] 11.0.1-0.2 --- .gitignore | 2 + gcc.spec | 125 +++++++--- gcc11-isl-dl2.patch | 71 ++++++ gcc11-pr91710.patch | 96 ++++++++ gcc11-pr99230.patch | 137 +++++++++++ gcc11-pr99378-revert.patch | 101 ++++++-- gcc11-pr99490.patch | 473 +++++++++++++++++++++++++++++++++++++ gcc11-pr99562.patch | 39 +++ gcc11-pr99650.patch | 44 ++++ sources | 3 +- 10 files changed, 1047 insertions(+), 44 deletions(-) create mode 100644 gcc11-isl-dl2.patch create mode 100644 gcc11-pr91710.patch create mode 100644 gcc11-pr99230.patch create mode 100644 gcc11-pr99490.patch create mode 100644 gcc11-pr99562.patch create mode 100644 gcc11-pr99650.patch diff --git a/.gitignore b/.gitignore index c33f299..1c11cc9 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,5 @@ /gcc-11.0.0-20210210.tar.xz /gcc-11.0.0-20210225.tar.xz /gcc-11.0.1-20210307.tar.xz +/gcc-11.0.1-20210319.tar.xz +/isl-0.18.tar.bz2 diff --git a/gcc.spec b/gcc.spec index 1dda96c..e7286c9 100644 --- a/gcc.spec +++ b/gcc.spec @@ -1,4 +1,4 @@ -%global DATE 20210307 +%global DATE 20210319 %global gitrev e13870b7c083e39ab17cc827bab5cb45387e8f19 %global gcc_version 11.0.1 %global gcc_major 11 @@ -145,7 +145,8 @@ Source1: nvptx-tools-%{nvptx_tools_gitrev}.tar.xz # 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.16.1 +%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 @@ -201,15 +202,6 @@ BuildRequires: gcc-gnat >= 3.1, libgnat >= 3.1 %ifarch ia64 BuildRequires: libunwind >= 0.98 %endif -%if %{build_isl} -BuildRequires: isl = %{isl_version} -BuildRequires: isl-devel = %{isl_version} -%if 0%{?__isa_bits} == 64 -Requires: libisl.so.15()(64bit) -%else -Requires: libisl.so.15 -%endif -%endif %if %{build_libstdcxx_docs} BuildRequires: doxygen >= 1.7.1 BuildRequires: graphviz, dblatex, texlive-collection-latex, docbook5-style-xsl @@ -265,14 +257,20 @@ 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-libstdc++-docs.patch -Patch7: gcc11-no-add-needed.patch -Patch8: gcc11-foffload-default.patch -Patch9: gcc11-Wno-format-security.patch -Patch10: gcc11-rh1574936.patch -Patch11: gcc11-d-shared-libphobos.patch -Patch12: gcc11-pr99378-revert.patch -Patch13: gcc11-pr99388.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 +Patch13: gcc11-pr99378-revert.patch +Patch14: gcc11-pr99388.patch +Patch15: gcc11-pr91710.patch +Patch16: gcc11-pr99230.patch +Patch17: gcc11-pr99490.patch +Patch18: gcc11-pr99562.patch +Patch19: gcc11-pr99650.patch Patch100: gcc11-fortran-fdec-duplicates.patch Patch101: gcc11-fortran-flogical-as-integer.patch @@ -776,26 +774,32 @@ by default add PTX code into the binaries, which can be offloaded to NVidia PTX capable devices if available. %prep -%setup -q -n gcc-%{version}-%{DATE} -a 1 -a 2 +%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} -%patch6 -p0 -b .libstdc++-docs~ +%patch7 -p0 -b .libstdc++-docs~ %endif -%patch7 -p0 -b .no-add-needed~ -%patch8 -p0 -b .foffload-default~ -%patch9 -p0 -b .Wno-format-security~ +%patch8 -p0 -b .no-add-needed~ +%patch9 -p0 -b .foffload-default~ +%patch10 -p0 -b .Wno-format-security~ %if 0%{?fedora} >= 29 || 0%{?rhel} > 7 -%patch10 -p0 -b .rh1574936~ +%patch11 -p0 -b .rh1574936~ %endif -%patch11 -p0 -b .d-shared-libphobos~ -%patch12 -p0 -b .pr99378-revert~ -%patch13 -p0 -b .pr99388~ +%patch12 -p0 -b .d-shared-libphobos~ +%patch13 -p0 -b .pr99378-revert~ +%patch14 -p0 -b .pr99388~ +%patch15 -p0 -b .pr91710~ +%patch16 -p0 -b .pr99230~ +%patch17 -p0 -b .pr99490~ +%patch18 -p0 -b .pr99562~ +%patch19 -p0 -b .pr99650~ %if 0%{?rhel} >= 9 %patch100 -p1 -b .fortran-fdec-duplicates~ @@ -910,6 +914,28 @@ 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= @@ -953,7 +979,7 @@ CONFIGURE_OPTS="\ %endif --enable-plugin --enable-initfini-array \ %if %{build_isl} - --with-isl \ + --with-isl=`pwd`/isl-install \ %else --without-isl \ %endif @@ -1097,6 +1123,10 @@ 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 @@ -1223,6 +1253,10 @@ chmod 644 %{buildroot}%{_infodir}/gnat* 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 @@ -2296,6 +2330,9 @@ end %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 @@ -3097,6 +3134,36 @@ end %endif %changelog +* 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, diff --git a/gcc11-isl-dl2.patch b/gcc11-isl-dl2.patch new file mode 100644 index 0000000..ac14ed3 --- /dev/null +++ b/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/gcc11-pr91710.patch b/gcc11-pr91710.patch new file mode 100644 index 0000000..fde604c --- /dev/null +++ b/gcc11-pr91710.patch @@ -0,0 +1,96 @@ +2021-03-18 Jakub Jelinek + + PR target/91710 + * config/aarch64/aarch64.c (aarch64_function_arg_alignment): Change + abi_break argument from bool * to unsigned *, store there the pre-GCC 9 + alignment. + (aarch64_layout_arg, aarch64_gimplify_va_arg_expr): Adjust callers. + (aarch64_function_arg_regno_p): Likewise. Only emit -Wpsabi note if + the old and new alignment after applying MIN/MAX to it is different. + + * gcc.target/aarch64/pr91710.c: New test. + +--- gcc/config/aarch64/aarch64.c.jj 2021-03-18 15:14:51.721425223 +0100 ++++ gcc/config/aarch64/aarch64.c 2021-03-18 16:35:04.437115447 +0100 +@@ -5938,9 +5938,9 @@ aarch64_vfp_is_call_candidate (cumulativ + + static unsigned int + aarch64_function_arg_alignment (machine_mode mode, const_tree type, +- bool *abi_break) ++ unsigned int *abi_break) + { +- *abi_break = false; ++ *abi_break = 0; + if (!type) + return GET_MODE_ALIGNMENT (mode); + +@@ -5982,7 +5982,7 @@ aarch64_function_arg_alignment (machine_ + + if (bitfield_alignment > alignment) + { +- *abi_break = true; ++ *abi_break = alignment; + return bitfield_alignment; + } + +@@ -6004,7 +6004,7 @@ aarch64_layout_arg (cumulative_args_t pc + int ncrn, nvrn, nregs; + bool allocate_ncrn, allocate_nvrn; + HOST_WIDE_INT size; +- bool abi_break; ++ unsigned int abi_break; + + /* We need to do this once per argument. */ + if (pcum->aapcs_arg_processed) +@@ -6322,14 +6322,19 @@ aarch64_function_arg_regno_p (unsigned r + static unsigned int + aarch64_function_arg_boundary (machine_mode mode, const_tree type) + { +- bool abi_break; ++ unsigned int abi_break; + unsigned int alignment = aarch64_function_arg_alignment (mode, type, + &abi_break); ++ alignment = MIN (MAX (alignment, PARM_BOUNDARY), STACK_BOUNDARY); + if (abi_break & warn_psabi) +- inform (input_location, "parameter passing for argument of type " +- "%qT changed in GCC 9.1", type); ++ { ++ abi_break = MIN (MAX (abi_break, PARM_BOUNDARY), STACK_BOUNDARY); ++ if (alignment != abi_break) ++ inform (input_location, "parameter passing for argument of type " ++ "%qT changed in GCC 9.1", type); ++ } + +- return MIN (MAX (alignment, PARM_BOUNDARY), STACK_BOUNDARY); ++ return alignment; + } + + /* Implement TARGET_GET_RAW_RESULT_MODE and TARGET_GET_RAW_ARG_MODE. */ +@@ -16616,7 +16621,7 @@ aarch64_gimplify_va_arg_expr (tree valis + f_stack, NULL_TREE); + size = int_size_in_bytes (type); + +- bool abi_break; ++ unsigned int abi_break; + align + = aarch64_function_arg_alignment (mode, type, &abi_break) / BITS_PER_UNIT; + +--- gcc/testsuite/gcc.target/aarch64/pr91710.c.jj 2021-03-18 16:42:33.529232710 +0100 ++++ gcc/testsuite/gcc.target/aarch64/pr91710.c 2021-03-18 16:42:07.271518121 +0100 +@@ -0,0 +1,16 @@ ++/* PR target/91710 */ ++/* { dg-do compile } */ ++ ++struct S { unsigned int i:4; }; ++ ++unsigned int test1(struct S s) { /* { dg-bogus "parameter passing for argument of type" } */ ++ return s.i; ++} ++ ++unsigned int test2(unsigned x, struct S s) { /* { dg-bogus "parameter passing for argument of type" } */ ++ return x - s.i; ++} ++ ++unsigned int test3(unsigned x, unsigned y, struct S s) { /* { dg-bogus "parameter passing for argument of type" } */ ++ return x - y - s.i; ++} diff --git a/gcc11-pr99230.patch b/gcc11-pr99230.patch new file mode 100644 index 0000000..75cf6d2 --- /dev/null +++ b/gcc11-pr99230.patch @@ -0,0 +1,137 @@ +2021-03-18 Jakub Jelinek + + PR debug/99230 + * c-gimplify.c (c_genericize_control_stmt): Handle STATEMENT_LIST. + + * cp-gimplify.c (cp_genericize_r) : Remove + special code, instead call c_genericize_control_stmt. + + * gcc.dg/pr99230.c: New test. + +--- gcc/c-family/c-gimplify.c.jj 2021-01-04 10:25:50.402102825 +0100 ++++ gcc/c-family/c-gimplify.c 2021-03-17 19:19:20.052702095 +0100 +@@ -497,6 +497,35 @@ c_genericize_control_stmt (tree *stmt_p, + genericize_omp_for_stmt (stmt_p, walk_subtrees, data, func, lh); + break; + ++ case STATEMENT_LIST: ++ if (TREE_SIDE_EFFECTS (stmt)) ++ { ++ tree_stmt_iterator i; ++ int nondebug_stmts = 0; ++ bool clear_side_effects = true; ++ /* Genericization can clear TREE_SIDE_EFFECTS, e.g. when ++ transforming an IF_STMT into COND_EXPR. If such stmt ++ appears in a STATEMENT_LIST that contains only that ++ stmt and some DEBUG_BEGIN_STMTs, without -g where the ++ STATEMENT_LIST wouldn't be present at all the resulting ++ expression wouldn't have TREE_SIDE_EFFECTS set, so make sure ++ to clear it even on the STATEMENT_LIST in such cases. */ ++ for (i = tsi_start (stmt); !tsi_end_p (i); tsi_next (&i)) ++ { ++ tree t = tsi_stmt (i); ++ if (TREE_CODE (t) != DEBUG_BEGIN_STMT && nondebug_stmts < 2) ++ nondebug_stmts++; ++ walk_tree_1 (tsi_stmt_ptr (i), func, data, NULL, lh); ++ if (TREE_CODE (t) != DEBUG_BEGIN_STMT ++ && (nondebug_stmts > 1 || TREE_SIDE_EFFECTS (tsi_stmt (i)))) ++ clear_side_effects = false; ++ } ++ if (clear_side_effects) ++ TREE_SIDE_EFFECTS (stmt) = 0; ++ *walk_subtrees = 0; ++ } ++ break; ++ + default: + break; + } +--- gcc/cp/cp-gimplify.c.jj 2021-03-04 09:42:27.602123905 +0100 ++++ gcc/cp/cp-gimplify.c 2021-03-17 19:38:42.743888589 +0100 +@@ -1464,35 +1464,6 @@ cp_genericize_r (tree *stmt_p, int *walk + walk_subtrees = 0; + break; + +- case STATEMENT_LIST: +- if (TREE_SIDE_EFFECTS (stmt)) +- { +- tree_stmt_iterator i; +- int nondebug_stmts = 0; +- bool clear_side_effects = true; +- /* Genericization can clear TREE_SIDE_EFFECTS, e.g. when +- transforming an IF_STMT into COND_EXPR. If such stmt +- appears in a STATEMENT_LIST that contains only that +- stmt and some DEBUG_BEGIN_STMTs, without -g where the +- STATEMENT_LIST wouldn't be present at all the resulting +- expression wouldn't have TREE_SIDE_EFFECTS set, so make sure +- to clear it even on the STATEMENT_LIST in such cases. */ +- for (i = tsi_start (stmt); !tsi_end_p (i); tsi_next (&i)) +- { +- tree t = tsi_stmt (i); +- if (TREE_CODE (t) != DEBUG_BEGIN_STMT && nondebug_stmts < 2) +- nondebug_stmts++; +- cp_walk_tree (tsi_stmt_ptr (i), cp_genericize_r, data, NULL); +- if (TREE_CODE (t) != DEBUG_BEGIN_STMT +- && (nondebug_stmts > 1 || TREE_SIDE_EFFECTS (tsi_stmt (i)))) +- clear_side_effects = false; +- } +- if (clear_side_effects) +- TREE_SIDE_EFFECTS (stmt) = 0; +- *walk_subtrees = 0; +- } +- break; +- + case OMP_DISTRIBUTE: + /* Need to explicitly instantiate copy ctors on class iterators of + composite distribute parallel for. */ +@@ -1566,6 +1537,7 @@ cp_genericize_r (tree *stmt_p, int *walk + case OMP_SIMD: + case OMP_LOOP: + case OACC_LOOP: ++ case STATEMENT_LIST: + /* These cases are handled by shared code. */ + c_genericize_control_stmt (stmt_p, walk_subtrees, data, + cp_genericize_r, cp_walk_subtrees); +--- gcc/testsuite/gcc.dg/pr99230.c.jj 2021-03-17 19:34:26.633711074 +0100 ++++ gcc/testsuite/gcc.dg/pr99230.c 2021-03-17 19:33:30.210332887 +0100 +@@ -0,0 +1,40 @@ ++/* PR debug/99230 */ ++/* { dg-do compile } */ ++/* { dg-options "-O2 --param logical-op-non-short-circuit=0 -fcompare-debug --param=jump-table-max-growth-ratio-for-speed=5000" } */ ++ ++extern void fn2 (void); ++extern void fn3 (int); ++int a, b; ++void ++fn1 (void) ++{ ++ int c; ++ short d; ++ switch (a) { ++ case 22000: ++ fn2 (); ++ case 22300: ++ b = 0; ++ case 22600: ++ case 22601: ++ case 22900: ++ fn3 (1); ++ case 20100: ++ fn3 (2); ++ case 20200: ++ fn3 (3); ++ case 20300: ++ fn3 (4); ++ case 20400: ++ fn3 (5); ++ case 20310: ++ fn3 (4); ++ case 20410: ++ fn3 (5); ++ } ++ if (d || c) { ++ do ++ ; ++ while (0); ++ } ++} diff --git a/gcc11-pr99378-revert.patch b/gcc11-pr99378-revert.patch index bd043cb..ea7f937 100644 --- a/gcc11-pr99378-revert.patch +++ b/gcc11-pr99378-revert.patch @@ -1,21 +1,94 @@ Revert: +2021-03-18 Vladimir N. Makarov + + PR target/99422 + * lra-constraints.c (process_address_1): Use lookup_constraint + only for a single constraint. + +2021-03-10 Vladimir N. Makarov + + PR target/99422 + * lra-constraints.c (process_address_1): Don't check unknown + constraint, use X for empty constraint. + +2021-03-09 Vladimir N. Makarov + + PR target/99454 + * lra-constraints.c (process_address_1): Process constraint 'g' + separately and digital constraints containing more one digit. + +2021-03-09 Vladimir N. Makarov + + PR target/99454 + * lra-constraints.c (process_address_1): Process 0..9 constraints + in process_address_1. + +2021-03-08 Vladimir N. Makarov + + PR target/99422 + * lra-constraints.c (skip_contraint_modifiers): New function. + (process_address_1): Use it before lookup_constraint call. + 2021-03-05 Vladimir N. Makarov PR target/99378 * lra-constraints.c (process_address_1): Skip decomposing address for asm insn operand with unknown constraint. ---- gcc/lra-constraints.c -+++ gcc/lra-constraints.c -@@ -3450,9 +3450,8 @@ process_address_1 (int nop, bool check_only_p, - i.e. bcst_mem_operand in i386 backend. */ - else if (MEM_P (mem) - && !(INSN_CODE (curr_insn) < 0 -- && (cn == CONSTRAINT__UNKNOWN -- || (get_constraint_type (cn) == CT_FIXED_FORM -- && constraint_satisfied_p (op, cn))))) -+ && get_constraint_type (cn) == CT_FIXED_FORM -+ && constraint_satisfied_p (op, cn))) - decompose_mem_address (&ad, mem); - else if (GET_CODE (op) == SUBREG - && MEM_P (SUBREG_REG (op))) +--- gcc/lra-constraints.c.jj 2021-03-19 13:53:38.094778251 +0100 ++++ gcc/lra-constraints.c 2021-03-19 14:23:16.017389900 +0100 +@@ -3392,21 +3392,6 @@ equiv_address_substitution (struct addre + return change_p; + } + +-/* Skip all modifiers and whitespaces in constraint STR and return the +- result. */ +-static const char * +-skip_contraint_modifiers (const char *str) +-{ +- for (;;str++) +- switch (*str) +- { +- case '+' : case '&' : case '=': case '*': case ' ': case '\t': +- case '$': case '^' : case '%': case '?': case '!': +- break; +- default: return str; +- } +-} +- + /* Major function to make reloads for an address in operand NOP or + check its correctness (If CHECK_ONLY_P is true). The supported + cases are: +@@ -3441,8 +3426,8 @@ process_address_1 (int nop, bool check_o + HOST_WIDE_INT scale; + rtx op = *curr_id->operand_loc[nop]; + rtx mem = extract_mem_from_operand (op); +- const char *constraint; +- enum constraint_num cn; ++ const char *constraint = curr_static_id->operand[nop].constraint; ++ enum constraint_num cn = lookup_constraint (constraint); + bool change_p = false; + + if (MEM_P (mem) +@@ -3450,21 +3435,6 @@ process_address_1 (int nop, bool check_o + && GET_CODE (XEXP (mem, 0)) == SCRATCH) + return false; + +- constraint +- = skip_contraint_modifiers (curr_static_id->operand[nop].constraint); +- if (IN_RANGE (constraint[0], '0', '9')) +- { +- char *end; +- unsigned long dup = strtoul (constraint, &end, 10); +- constraint +- = skip_contraint_modifiers (curr_static_id->operand[dup].constraint); +- } +- if (*skip_contraint_modifiers (constraint +- + CONSTRAINT_LEN (constraint[0], +- constraint)) != '\0') +- cn = CONSTRAINT__UNKNOWN; +- else +- cn = lookup_constraint (*constraint == '\0' ? "X" : constraint); + if (insn_extra_address_constraint (cn) + /* When we find an asm operand with an address constraint that + doesn't satisfy address_operand to begin with, we clear diff --git a/gcc11-pr99490.patch b/gcc11-pr99490.patch new file mode 100644 index 0000000..abda126 --- /dev/null +++ b/gcc11-pr99490.patch @@ -0,0 +1,473 @@ +2021-03-12 Jakub Jelinek + + PR debug/99490 + * dwarf2out.c (debug_ranges_dwo_section): New variable. + (DW_RANGES_IDX_SKELETON): Define. + (struct dw_ranges): Add begin_entry and end_entry members. + (DEBUG_DWO_RNGLISTS_SECTION): Define. + (add_ranges_num): Adjust r initializer for addition of *_entry + members. + (add_ranges_by_labels): For -gsplit-dwarf and force_direct, + set idx to DW_RANGES_IDX_SKELETON. + (index_rnglists): Don't set r->idx if it is equal to + DW_RANGES_IDX_SKELETON. Initialize r->begin_entry and + r->end_entry for -gsplit-dwarf if those will be needed by + output_rnglists. + (output_rnglists): Add DWO argument. If true, switch to + debug_ranges_dwo_section rather than debug_ranges_section. + Adjust l1/l2 label indexes. Only output the offset table when + dwo is true and don't include in there the skeleton range + entry if present. For -gsplit-dwarf, skip ranges that belong + to the other rnglists section. Change return type from void + to bool and return true if there are any range entries for + the other section. For dwarf_split_debug_info use + DW_RLE_startx_endx, DW_RLE_startx_length and DW_RLE_base_addressx + entries instead of DW_RLE_start_end, DW_RLE_start_length and + DW_RLE_base_address. + (init_sections_and_labels): Initialize debug_ranges_dwo_section + if -gsplit-dwarf and DWARF >= 5. Adjust ranges_section_label + and range_base_label indexes. + (dwarf2out_finish): Call index_rnglists earlier before finalizing + .debug_addr. Never emit DW_AT_rnglists_base attribute. For + -gsplit-dwarf and DWARF >= 5 call output_rnglists up to twice + with different dwo arguments. + (dwarf2out_c_finalize): Clear debug_ranges_dwo_section. + +--- gcc/dwarf2out.c.jj 2021-03-10 17:36:37.037537129 +0100 ++++ gcc/dwarf2out.c 2021-03-11 12:50:00.402418873 +0100 +@@ -171,6 +171,7 @@ static GTY(()) section *debug_line_str_s + static GTY(()) section *debug_str_dwo_section; + static GTY(()) section *debug_str_offsets_section; + static GTY(()) section *debug_ranges_section; ++static GTY(()) section *debug_ranges_dwo_section; + static GTY(()) section *debug_frame_section; + + /* Maximum size (in bytes) of an artificially generated label. */ +@@ -3152,11 +3153,17 @@ struct GTY(()) dw_ranges { + /* If this is positive, it's a block number, otherwise it's a + bitwise-negated index into dw_ranges_by_label. */ + int num; ++ /* If idx is equal to DW_RANGES_IDX_SKELETON, it should be emitted ++ into .debug_rnglists section rather than .debug_rnglists.dwo ++ for -gsplit-dwarf and DWARF >= 5. */ ++#define DW_RANGES_IDX_SKELETON ((1U << 31) - 1) + /* Index for the range list for DW_FORM_rnglistx. */ + unsigned int idx : 31; + /* True if this range might be possibly in a different section + from previous entry. */ + unsigned int maybe_new_sec : 1; ++ addr_table_entry *begin_entry; ++ addr_table_entry *end_entry; + }; + + /* A structure to hold a macinfo entry. */ +@@ -4099,6 +4106,9 @@ new_addr_loc_descr (rtx addr, enum dtpre + #ifndef DEBUG_RNGLISTS_SECTION + #define DEBUG_RNGLISTS_SECTION ".debug_rnglists" + #endif ++#ifndef DEBUG_DWO_RNGLISTS_SECTION ++#define DEBUG_DWO_RNGLISTS_SECTION ".debug_rnglists.dwo" ++#endif + #ifndef DEBUG_LINE_STR_SECTION + #define DEBUG_LINE_STR_SECTION ".debug_line_str" + #endif +@@ -11751,7 +11761,7 @@ output_aranges (void) + static unsigned int + add_ranges_num (int num, bool maybe_new_sec) + { +- dw_ranges r = { NULL, num, 0, maybe_new_sec }; ++ dw_ranges r = { NULL, num, 0, maybe_new_sec, NULL, NULL }; + vec_safe_push (ranges_table, r); + return vec_safe_length (ranges_table) - 1; + } +@@ -11796,6 +11806,8 @@ add_ranges_by_labels (dw_die_ref die, co + add_AT_range_list (die, DW_AT_ranges, offset, force_direct); + *added = true; + note_rnglist_head (offset); ++ if (dwarf_split_debug_info && force_direct) ++ (*ranges_table)[offset].idx = DW_RANGES_IDX_SKELETON; + } + } + +@@ -11921,23 +11933,87 @@ asm_outputs_debug_line_str (void) + } + + +-/* Assign .debug_rnglists indexes. */ ++/* Assign .debug_rnglists indexes and unique indexes into the debug_addr ++ section when needed. */ + + static void + index_rnglists (void) + { + unsigned i; + dw_ranges *r; ++ bool base = false; ++ unsigned int len = vec_safe_length (ranges_table); + + FOR_EACH_VEC_SAFE_ELT (ranges_table, i, r) +- if (r->label) +- r->idx = rnglist_idx++; ++ { ++ if (r->label && r->idx != DW_RANGES_IDX_SKELETON) ++ r->idx = rnglist_idx++; ++ ++ if (!have_multiple_function_sections) ++ continue; ++ int block_num = r->num; ++ if (HAVE_AS_LEB128 && (r->label || r->maybe_new_sec)) ++ base = false; ++ if (block_num > 0) ++ { ++ char blabel[MAX_ARTIFICIAL_LABEL_BYTES]; ++ char elabel[MAX_ARTIFICIAL_LABEL_BYTES]; ++ ++ ASM_GENERATE_INTERNAL_LABEL (blabel, BLOCK_BEGIN_LABEL, block_num); ++ ASM_GENERATE_INTERNAL_LABEL (elabel, BLOCK_END_LABEL, block_num); ++ ++ if (HAVE_AS_LEB128) ++ { ++ if (!base) ++ { ++ dw_ranges *r2 = NULL; ++ if (i < len - 1) ++ r2 = &(*ranges_table)[i + 1]; ++ if (r2 ++ && r2->num != 0 ++ && r2->label == NULL ++ && !r2->maybe_new_sec) ++ { ++ r->begin_entry ++ = add_addr_table_entry (xstrdup (blabel), ++ ate_kind_label); ++ base = true; ++ } ++ } ++ if (base) ++ continue; ++ r->begin_entry ++ = add_addr_table_entry (xstrdup (blabel), ate_kind_label); ++ } ++ else ++ { ++ r->begin_entry ++ = add_addr_table_entry (xstrdup (blabel), ate_kind_label); ++ r->end_entry ++ = add_addr_table_entry (xstrdup (elabel), ate_kind_label); ++ } ++ } ++ ++ /* Negative block_num stands for an index into ranges_by_label. */ ++ else if (block_num < 0) ++ { ++ int lab_idx = - block_num - 1; ++ const char *blabel = (*ranges_by_label)[lab_idx].begin; ++ const char *elabel = (*ranges_by_label)[lab_idx].end; ++ ++ r->begin_entry ++ = add_addr_table_entry (xstrdup (blabel), ate_kind_label); ++ if (!HAVE_AS_LEB128) ++ r->end_entry ++ = add_addr_table_entry (xstrdup (elabel), ate_kind_label); ++ } ++ } + } + +-/* Emit .debug_rnglists section. */ ++/* Emit .debug_rnglists or (when DWO is true) .debug_rnglists.dwo section. */ + +-static void +-output_rnglists (unsigned generation) ++static bool ++output_rnglists (unsigned generation, bool dwo) + { + unsigned i; + dw_ranges *r; +@@ -11945,14 +12021,19 @@ output_rnglists (unsigned generation) + char l2[MAX_ARTIFICIAL_LABEL_BYTES]; + char basebuf[MAX_ARTIFICIAL_LABEL_BYTES]; + +- switch_to_section (debug_ranges_section); +- ASM_OUTPUT_LABEL (asm_out_file, ranges_section_label); ++ if (dwo) ++ switch_to_section (debug_ranges_dwo_section); ++ else ++ { ++ switch_to_section (debug_ranges_section); ++ ASM_OUTPUT_LABEL (asm_out_file, ranges_section_label); ++ } + /* There are up to 4 unique ranges labels per generation. + See also init_sections_and_labels. */ + ASM_GENERATE_INTERNAL_LABEL (l1, DEBUG_RANGES_SECTION_LABEL, +- 2 + generation * 4); ++ 2 + 2 * dwo + generation * 6); + ASM_GENERATE_INTERNAL_LABEL (l2, DEBUG_RANGES_SECTION_LABEL, +- 3 + generation * 4); ++ 3 + 2 * dwo + generation * 6); + if (DWARF_INITIAL_LENGTH_SIZE - dwarf_offset_size == 4) + dw2_asm_output_data (4, 0xffffffff, + "Initial length escape value indicating " +@@ -11969,13 +12050,13 @@ output_rnglists (unsigned generation) + the offset table plus corresponding DW_FORM_rnglistx uleb128 indexes + into it are usually larger than just DW_FORM_sec_offset offsets + into the .debug_rnglists section. */ +- dw2_asm_output_data (4, dwarf_split_debug_info ? rnglist_idx : 0, ++ dw2_asm_output_data (4, dwo ? rnglist_idx : 0, + "Offset Entry Count"); +- if (dwarf_split_debug_info) ++ if (dwo) + { + ASM_OUTPUT_LABEL (asm_out_file, ranges_base_label); + FOR_EACH_VEC_SAFE_ELT (ranges_table, i, r) +- if (r->label) ++ if (r->label && r->idx != DW_RANGES_IDX_SKELETON) + dw2_asm_output_delta (dwarf_offset_size, r->label, + ranges_base_label, NULL); + } +@@ -11983,15 +12064,32 @@ output_rnglists (unsigned generation) + const char *lab = ""; + unsigned int len = vec_safe_length (ranges_table); + const char *base = NULL; ++ bool skipping = false; ++ bool ret = false; + FOR_EACH_VEC_SAFE_ELT (ranges_table, i, r) + { + int block_num = r->num; + + if (r->label) + { ++ if (dwarf_split_debug_info) ++ { ++ if ((r->idx == DW_RANGES_IDX_SKELETON) == dwo) ++ { ++ ret = true; ++ skipping = true; ++ continue; ++ } ++ } + ASM_OUTPUT_LABEL (asm_out_file, r->label); + lab = r->label; + } ++ if (skipping) ++ { ++ if (block_num == 0) ++ skipping = false; ++ continue; ++ } + if (HAVE_AS_LEB128 && (r->label || r->maybe_new_sec)) + base = NULL; + if (block_num > 0) +@@ -12027,10 +12125,23 @@ output_rnglists (unsigned generation) + && r2->label == NULL + && !r2->maybe_new_sec) + { +- dw2_asm_output_data (1, DW_RLE_base_address, +- "DW_RLE_base_address (%s)", lab); +- dw2_asm_output_addr (DWARF2_ADDR_SIZE, blabel, +- "Base address (%s)", lab); ++ if (dwarf_split_debug_info) ++ { ++ dw2_asm_output_data (1, DW_RLE_base_addressx, ++ "DW_RLE_base_addressx (%s)", ++ lab); ++ dw2_asm_output_data_uleb128 (r->begin_entry->index, ++ "Base address index " ++ "(%s)", blabel); ++ } ++ else ++ { ++ dw2_asm_output_data (1, DW_RLE_base_address, ++ "DW_RLE_base_address (%s)", ++ lab); ++ dw2_asm_output_addr (DWARF2_ADDR_SIZE, blabel, ++ "Base address (%s)", lab); ++ } + strcpy (basebuf, blabel); + base = basebuf; + } +@@ -12045,13 +12156,35 @@ output_rnglists (unsigned generation) + "Range end address (%s)", lab); + continue; + } +- dw2_asm_output_data (1, DW_RLE_start_length, +- "DW_RLE_start_length (%s)", lab); +- dw2_asm_output_addr (DWARF2_ADDR_SIZE, blabel, +- "Range begin address (%s)", lab); ++ if (dwarf_split_debug_info) ++ { ++ dw2_asm_output_data (1, DW_RLE_startx_length, ++ "DW_RLE_startx_length (%s)", lab); ++ dw2_asm_output_data_uleb128 (r->begin_entry->index, ++ "Range begin address index " ++ "(%s)", blabel); ++ } ++ else ++ { ++ dw2_asm_output_data (1, DW_RLE_start_length, ++ "DW_RLE_start_length (%s)", lab); ++ dw2_asm_output_addr (DWARF2_ADDR_SIZE, blabel, ++ "Range begin address (%s)", lab); ++ } + dw2_asm_output_delta_uleb128 (elabel, blabel, + "Range length (%s)", lab); + } ++ else if (dwarf_split_debug_info) ++ { ++ dw2_asm_output_data (1, DW_RLE_startx_endx, ++ "DW_RLE_startx_endx (%s)", lab); ++ dw2_asm_output_data_uleb128 (r->begin_entry->index, ++ "Range begin address index " ++ "(%s)", blabel); ++ dw2_asm_output_data_uleb128 (r->end_entry->index, ++ "Range end address index " ++ "(%s)", elabel); ++ } + else + { + dw2_asm_output_data (1, DW_RLE_start_end, +@@ -12074,13 +12207,35 @@ output_rnglists (unsigned generation) + gcc_unreachable (); + if (HAVE_AS_LEB128) + { +- dw2_asm_output_data (1, DW_RLE_start_length, +- "DW_RLE_start_length (%s)", lab); +- dw2_asm_output_addr (DWARF2_ADDR_SIZE, blabel, +- "Range begin address (%s)", lab); ++ if (dwarf_split_debug_info) ++ { ++ dw2_asm_output_data (1, DW_RLE_startx_length, ++ "DW_RLE_startx_length (%s)", lab); ++ dw2_asm_output_data_uleb128 (r->begin_entry->index, ++ "Range begin address index " ++ "(%s)", blabel); ++ } ++ else ++ { ++ dw2_asm_output_data (1, DW_RLE_start_length, ++ "DW_RLE_start_length (%s)", lab); ++ dw2_asm_output_addr (DWARF2_ADDR_SIZE, blabel, ++ "Range begin address (%s)", lab); ++ } + dw2_asm_output_delta_uleb128 (elabel, blabel, + "Range length (%s)", lab); + } ++ else if (dwarf_split_debug_info) ++ { ++ dw2_asm_output_data (1, DW_RLE_startx_endx, ++ "DW_RLE_startx_endx (%s)", lab); ++ dw2_asm_output_data_uleb128 (r->begin_entry->index, ++ "Range begin address index " ++ "(%s)", blabel); ++ dw2_asm_output_data_uleb128 (r->end_entry->index, ++ "Range end address index " ++ "(%s)", elabel); ++ } + else + { + dw2_asm_output_data (1, DW_RLE_start_end, +@@ -12096,6 +12251,7 @@ output_rnglists (unsigned generation) + "DW_RLE_end_of_list (%s)", lab); + } + ASM_OUTPUT_LABEL (asm_out_file, l2); ++ return ret; + } + + /* Data structure containing information about input files. */ +@@ -28823,6 +28979,10 @@ init_sections_and_labels (bool early_lto + debug_macinfo_section = get_section (debug_macinfo_section_name, + SECTION_DEBUG | SECTION_EXCLUDE, + NULL); ++ if (dwarf_version >= 5) ++ debug_ranges_dwo_section ++ = get_section (DEBUG_DWO_RNGLISTS_SECTION, ++ SECTION_DEBUG | SECTION_EXCLUDE, NULL); + } + debug_aranges_section = get_section (DEBUG_ARANGES_SECTION, + SECTION_DEBUG, NULL); +@@ -28857,15 +29017,15 @@ init_sections_and_labels (bool early_lto + ASM_GENERATE_INTERNAL_LABEL (debug_line_section_label, + DEBUG_LINE_SECTION_LABEL, + init_sections_and_labels_generation); +- /* There are up to 4 unique ranges labels per generation. ++ /* There are up to 6 unique ranges labels per generation. + See also output_rnglists. */ + ASM_GENERATE_INTERNAL_LABEL (ranges_section_label, + DEBUG_RANGES_SECTION_LABEL, +- init_sections_and_labels_generation * 4); ++ init_sections_and_labels_generation * 6); + if (dwarf_version >= 5 && dwarf_split_debug_info) + ASM_GENERATE_INTERNAL_LABEL (ranges_base_label, + DEBUG_RANGES_SECTION_LABEL, +- 1 + init_sections_and_labels_generation * 4); ++ 1 + init_sections_and_labels_generation * 6); + ASM_GENERATE_INTERNAL_LABEL (debug_addr_section_label, + DEBUG_ADDR_SECTION_LABEL, + init_sections_and_labels_generation); +@@ -31665,6 +31825,9 @@ dwarf2out_finish (const char *filename) + index_location_lists (comp_unit_die ()); + } + ++ if (dwarf_version >= 5 && !vec_safe_is_empty (ranges_table)) ++ index_rnglists (); ++ + if (addr_index_table != NULL) + { + unsigned int index = 0; +@@ -31730,9 +31893,6 @@ dwarf2out_finish (const char *filename) + int mark; + struct md5_ctx ctx; + +- if (dwarf_version >= 5 && !vec_safe_is_empty (ranges_table)) +- index_rnglists (); +- + /* Compute a checksum of the comp_unit to use as the dwo_id. */ + md5_init_ctx (&ctx); + mark = 0; +@@ -31752,10 +31912,7 @@ dwarf2out_finish (const char *filename) + comp-unit DIE. */ + if (!vec_safe_is_empty (ranges_table)) + { +- if (dwarf_version >= 5) +- add_AT_lineptr (main_comp_unit_die, DW_AT_rnglists_base, +- ranges_base_label); +- else ++ if (dwarf_version < 5) + add_AT_lineptr (main_comp_unit_die, DW_AT_GNU_ranges_base, + ranges_section_label); + } +@@ -31833,7 +31990,26 @@ dwarf2out_finish (const char *filename) + if (!vec_safe_is_empty (ranges_table)) + { + if (dwarf_version >= 5) +- output_rnglists (generation); ++ { ++ if (dwarf_split_debug_info) ++ { ++ /* We don't know right now whether there are any ++ ranges for .debug_rnglists and any for .debug_rnglists.dwo. ++ Depending on into which of those two belongs the first ++ ranges_table entry, emit that section first and that ++ output_rnglists call will return if the other kind of ++ ranges needs to be emitted as well. */ ++ if ((*ranges_table)[0].idx == DW_RANGES_IDX_SKELETON) ++ { ++ if (output_rnglists (generation, false)) ++ output_rnglists (generation, true); ++ } ++ else if (output_rnglists (generation, true)) ++ output_rnglists (generation, false); ++ } ++ else ++ output_rnglists (generation, false); ++ } + else + output_ranges (); + } +@@ -32457,6 +32633,7 @@ dwarf2out_c_finalize (void) + debug_str_dwo_section = NULL; + debug_str_offsets_section = NULL; + debug_ranges_section = NULL; ++ debug_ranges_dwo_section = NULL; + debug_frame_section = NULL; + fde_vec = NULL; + debug_str_hash = NULL; diff --git a/gcc11-pr99562.patch b/gcc11-pr99562.patch new file mode 100644 index 0000000..1ef63a6 --- /dev/null +++ b/gcc11-pr99562.patch @@ -0,0 +1,39 @@ +2021-03-13 Jakub Jelinek + + PR debug/99562 + PR debug/66728 + * dwarf2out.c (get_full_len): Use get_precision rather than + min_precision. + (add_const_value_attribute): Make sure add_AT_wide argument has + precision prec rather than some very wide one. + +--- gcc/dwarf2out.c.jj 2021-03-11 14:01:43.385194205 +0100 ++++ gcc/dwarf2out.c 2021-03-12 17:34:49.365207265 +0100 +@@ -385,13 +385,12 @@ dump_struct_debug (tree type, enum debug + #endif + + /* Get the number of HOST_WIDE_INTs needed to represent the precision +- of the number. Some constants have a large uniform precision, so +- we get the precision needed for the actual value of the number. */ ++ of the number. */ + + static unsigned int + get_full_len (const wide_int &op) + { +- int prec = wi::min_precision (op, UNSIGNED); ++ int prec = wi::get_precision (op); + return ((prec + HOST_BITS_PER_WIDE_INT - 1) + / HOST_BITS_PER_WIDE_INT); + } +@@ -19732,8 +19731,9 @@ add_const_value_attribute (dw_die_ref di + { + wide_int w1 = rtx_mode_t (rtl, MAX_MODE_INT); + unsigned int prec = MIN (wi::min_precision (w1, UNSIGNED), +- (unsigned int)CONST_WIDE_INT_NUNITS (rtl) * HOST_BITS_PER_WIDE_INT); +- wide_int w = wi::zext (w1, prec); ++ (unsigned int) CONST_WIDE_INT_NUNITS (rtl) ++ * HOST_BITS_PER_WIDE_INT); ++ wide_int w = wide_int::from (w1, prec, UNSIGNED); + add_AT_wide (die, DW_AT_const_value, w); + } + return true; diff --git a/gcc11-pr99650.patch b/gcc11-pr99650.patch new file mode 100644 index 0000000..031c272 --- /dev/null +++ b/gcc11-pr99650.patch @@ -0,0 +1,44 @@ +2021-03-18 Jakub Jelinek + + PR c++/99650 + * decl.c (cp_finish_decomp): Diagnose void initializers when + using tuple_element and get. + + * g++.dg/cpp1z/decomp55.C: New test. + +--- gcc/cp/decl.c.jj 2021-03-16 21:17:41.014498713 +0100 ++++ gcc/cp/decl.c 2021-03-18 19:31:22.430149523 +0100 +@@ -8629,6 +8629,11 @@ cp_finish_decomp (tree decl, tree first, + : get_tuple_element_type (type, i)); + input_location = sloc; + ++ if (VOID_TYPE_P (eltype)) ++ { ++ error ("forming reference to void"); ++ eltype = error_mark_node; ++ } + if (init == error_mark_node || eltype == error_mark_node) + { + inform (dloc, "in initialization of structured binding " +--- gcc/testsuite/g++.dg/cpp1z/decomp55.C.jj 2021-03-18 19:43:07.958457494 +0100 ++++ gcc/testsuite/g++.dg/cpp1z/decomp55.C 2021-03-18 19:42:35.099815746 +0100 +@@ -0,0 +1,19 @@ ++// PR c++/99650 ++// { dg-do compile { target c++17 } } ++ ++namespace std { ++ template struct tuple_size; ++ template struct tuple_element; ++} ++ ++struct A { ++ int i; ++ template void get() { } ++}; ++ ++template<> struct std::tuple_size { static const int value = 2; }; ++template struct std::tuple_element { using type = void; }; ++ ++A a = { 42 }; ++auto [ x, y ] = a; // { dg-error "forming reference to void" } ++// { dg-message "in initialization of structured binding variable 'x'" "" { target *-*-* } .-1 } diff --git a/sources b/sources index cd3423a..877c36e 100644 --- a/sources +++ b/sources @@ -1,3 +1,4 @@ -SHA512 (gcc-11.0.1-20210307.tar.xz) = 1efa50991f55de59270af6ff134fc1818ca23e30bdc064f79916e358e46daf301a8d2d3e1afcde58a00a521e8bc2136f8cc5f21c5e05ccd80fa8e5c7e9324e9b +SHA512 (gcc-11.0.1-20210319.tar.xz) = 5e8469f34601f9fd30439509129a738f61c61357f260cc6addffdea1a6b14eba0cf7030ad6e32dd000f08b0fbba13e90d6618e5d699658000675cdfe22c919f1 +SHA512 (isl-0.18.tar.bz2) = 85d0b40f4dbf14cb99d17aa07048cdcab2dc3eb527d2fbb1e84c41b2de5f351025370e57448b63b2b8a8cf8a0843a089c3263f9baee1542d5c2e1cb37ed39d94 SHA512 (newlib-cygwin-50e2a63b04bdd018484605fbb954fd1bd5147fa0.tar.xz) = 002a48a7b689a81abbf16161bcaec001a842e67dfbe372e9e109092703bfc666675f16198f60ca429370e8850d564547dc505df81bc3aaca4ce6defbc014ad6c SHA512 (nvptx-tools-5f6f343a302d620b0868edab376c00b15741e39e.tar.xz) = f6d10db94fa1570ae0f94df073fa3c73c8e5ee16d59070b53d94f7db0de8a031bc44d7f3f1852533da04b625ce758e022263855ed43cfc6867e0708d001e53c7