- May 11, 2023
-
-
Jonathan Wakely authored
This is a backport of r14-739-gc62e945492afbb to keep the exported symbol list consistent between trunk and gcc-13. The new assertions from that commit are not part of this backport. libstdc++-v3/ChangeLog: * config/abi/pre/gnu.ver: Export basic_string::_S_allocate. * include/bits/basic_string.h: (basic_string::_Alloc_traits_impl): Remove class template. (basic_string::_S_allocate): New static member function. (basic_string::assign): Use _S_allocate. * include/bits/basic_string.tcc (basic_string::_M_create) (basic_string::reserve, basic_string::_M_replace): Likewise. (cherry picked from commit c62e9454)
-
Ian Lance Taylor authored
As of https://go.dev/cl/476695 golang.org/x/sys/unix can call syscall.prlimit, so we need such a function in libgo.
-
Richard Sandiford authored
The trunk patch for this PR corrected the ABI for enums that have a defined underlying type. We shouldn't change the ABI on the branches though, so this patch just removes the assertions that highlighed the problem. I think the same approach makes sense longer-term: keep the assertions at maximum strength in trunk, and in any new branches that get cut. Then, if the assertions trip an ABI problem, fix the problem in trunk and remove the assertions from active branches. The tests are the same as for the trunk version, but with all Wpsabi message and expected output checks removed. gcc/ PR target/109661 * config/aarch64/aarch64.cc (aarch64_function_arg_alignment): Remove assertion. (aarch64_layout_arg): Likewise. gcc/testsuite/ PR target/109661 * g++.target/aarch64/pr109661-1.C: New test. * g++.target/aarch64/pr109661-2.C: Likewise. * g++.target/aarch64/pr109661-3.C: Likewise. * g++.target/aarch64/pr109661-4.C: Likewise. * gcc.target/aarch64/pr109661-1.c: Likewise.
-
GCC Administrator authored
-
- May 10, 2023
-
-
Richard Biener authored
The following forces the g++.dg/torture/pr106922.C testcase to use the C++11 libstdc++ ABI and checks whether that worked. gcc/testsuite/ * g++.dg/torture/pr106922.C: Force _GLIBCXX_USE_CXX11_ABI to 1. (cherry picked from commit a056a986)
-
GCC Administrator authored
-
- May 09, 2023
-
-
Joseph Myers authored
* ru.po: Update.
-
Joseph Myers authored
* hr.po: Update.
-
Jakub Jelinek authored
http://eel.is/c++draft/dcl.attr#grammar-4 says "In an attribute-list, an ellipsis may appear only if that attribute's specification permits it." and doesn't explicitly permit it on any standard attribute. The https://wg21.link/p1774r8 paper which introduced assume attribute says "We could therefore hypothetically permit the assume attribute to directly support pack expansion: template <int... args> void f() { [[assume(args >= 0)...]]; } However, we do not propose this. It would require substantial additional work for a very rare use case. Note that this can instead be expressed with a fold expression, which is equivalent to the above and works out of the box without any extra effort: template <int... args> void f() { [[assume(((args >= 0) && ...))]]; } ", but as the testcase shows, GCC 13+ ICEs on assume attribute followed by ... if it contains packs. The following patch rejects those instead of ICE and for C++17 or later suggests using fold expressions instead (it doesn't make sense to suggest it for C++14 and earlier when we'd error on the fold expressions). 2023-05-09 Jakub Jelinek <jakub@redhat.com> PR c++/109756 * cp-gimplify.cc (process_stmt_assume_attribute): Diagnose pack expansion of assume attribute. * g++.dg/cpp23/attr-assume11.C: New test. (cherry picked from commit 2499540e)
-
Jakub Jelinek authored
I came up with a testcase which reproduces all the way to r10-7469. LTO to avoid early inlining it, so that ccp handles rotates and not shifts before they are turned into rotates. 2023-05-09 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/109778 * gcc.dg/lto/pr109778_0.c: New test. * gcc.dg/lto/pr109778_1.c: New file. (cherry picked from commit c2cf2dc9)
-
Jakub Jelinek authored
The following testcase is miscompiled, because bitwise ccp2 handles a rotate with a signed type incorrectly. Seems tree-ssa-ccp.cc has the only callers of wi::[lr]rotate with 3 arguments, all other callers just rotate in the right precision and I think work correctly. ccp works with widest_ints and so rotations by the excessive precision certainly don't match what it wants when it sees a rotate in some specific bitsize. Still, if it is unsigned rotate and the widest_int is zero extended from width, the functions perform left shift and logical right shift on the value and then at the end zero extend the result of left shift and uselessly also the result of logical right shift and return | of that. On the testcase we the signed char rrotate by 4 argument is CONSTANT -75 i.e. 0xffffffff....fffffb5 with mask 2. The mask is correctly rotated to 0x20, but because the 8-bit constant is sign extended to 192-bit one, the logical right shift by 4 doesn't yield expected 0xb, but gives 0xfffffffffff....ffffb, and then return wi::zext (left, width) | wi::zext (right, width); where left is 0xfffffff....fb50, so we return 0xfb instead of the expected 0x5b. The following patch fixes that by doing the zero extension in case of the right variable before doing wi::lrshift rather than after it. Also, wi::[lr]rotate widht width < precision always zero extends the result. I'm afraid it can't do better because it doesn't know if it is done for an unsigned or signed type, but the caller in this case knows that very well, so I've done the extension based on sgn in the caller. E.g. 0x5b rotated right (or left) by 4 with width 8 previously gave 0xb5, but sgn == SIGNED in widest_int it should be 0xffffffff....fffb5 instead. 2023-05-09 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/109778 * wide-int.h (wi::lrotate, wi::rrotate): Call wi::lrshift on wi::zext (x, width) rather than x if width != precision, rather than using wi::zext (right, width) after the shift. * tree-ssa-ccp.cc (bit_value_binop): Call wi::ext on the results of wi::lrotate or wi::rrotate. * gcc.c-torture/execute/pr109778.c: New test. (cherry picked from commit a8302d2a)
-
Kewen Lin authored
__builtin_vsx_scalar_cmp_exp_qp_{eq,gt,lt,unordered} used to be guarded with condition TARGET_P9_VECTOR before new bif framework was introduced (r12-5752-gd08236359eb229), since r12-5752 they are placed under stanza ieee128-hw, that is to check condition TARGET_FLOAT128_HW, it caused test case float128-cmp2-runnable.c to fail at -m32 as the condition TARGET_FLOAT128_HW isn't satisified with -m32. By checking the commit history, I didn't see any notes on why this condition change on them was made, so this patch is to move these bifs from stanza ieee128-hw to stanza power9-vector as before. PR target/108758 gcc/ChangeLog: * config/rs6000/rs6000-builtins.def (__builtin_vsx_scalar_cmp_exp_qp_eq, __builtin_vsx_scalar_cmp_exp_qp_gt __builtin_vsx_scalar_cmp_exp_qp_lt, __builtin_vsx_scalar_cmp_exp_qp_unordered): Move from stanza ieee128-hw to power9-vector. (cherry picked from commit 33a44e3a)
-
Kewen Lin authored
As PR109069 shows, commit r12-6537-g080a06fcb076b3 which introduces define_insn_and_split sldoi_to_mov adopts easy_vector_constant for const vector of interest, but it's wrong since predicate easy_vector_constant doesn't guarantee each byte in the const vector is the same. One counter example is the const vector in pr109069-1.c. This patch is to introduce new predicate const_vector_each_byte_same to ensure all bytes in the given const vector are the same by considering both int and float, meanwhile for the constants which don't meet easy_vector_constant we need to gen a move instead of just a set, and uses VECTOR_MEM_ALTIVEC_OR_VSX_P rather than VECTOR_UNIT_ALTIVEC_OR_VSX_P for V2DImode support under VSX since vector long long type of vec_sld is guarded under stanza vsx. PR target/109069 gcc/ChangeLog: * config/rs6000/altivec.md (sldoi_to_mov<mode>): Replace predicate easy_vector_constant with const_vector_each_byte_same, add handlings in preparation for !easy_vector_constant, and update VECTOR_UNIT_ALTIVEC_OR_VSX_P with VECTOR_MEM_ALTIVEC_OR_VSX_P. * config/rs6000/predicates.md (const_vector_each_byte_same): New predicate. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr109069-1.c: New test. * gcc.target/powerpc/pr109069-2-run.c: New test. * gcc.target/powerpc/pr109069-2.c: New test. * gcc.target/powerpc/pr109069-2.h: New test. (cherry picked from commit fd75f6ae)
-
GCC Administrator authored
-
- May 08, 2023
-
-
Tobias Burnus authored
Seemingly, the ptx JIT of CUDA <= 10.2 replaces function pointers in global variables by NULL if a translation does not contain any executable code. It works with CUDA 11.1. The code of this commit is about reverse offload; having NULL values disables the side of reverse offload during image load. Solution is the same as found by Thomas for a related issue: Adding a dummy procedure. Cf. the PR of this issue and Thomas' patch "nvptx: Support global constructors/destructors via 'collect2'" https://gcc.gnu.org/pipermail/gcc-patches/2022-December/607749.html As that approach also works here: Co-authored-by:
Thomas Schwinge <thomas@codesourcery.com> gcc/ PR libgomp/108098 * config/nvptx/mkoffload.cc (process): Emit dummy procedure alongside reverse-offload function table to prevent NULL values of the function addresses. (cherry picked from commit 4359724c)
-
GCC Administrator authored
-
- May 07, 2023
-
-
Andrew Pinski authored
aarch64_isa_flags (and aarch64_asm_isa_flags) are both aarch64_feature_flags (uint64_t) but since r12-8000-g14814e20161d, they are saved/restored as unsigned long. This does not make a difference for LP64 targets but on ILP32 and LLP64IL32 targets, it means it does not get restored correctly. This patch changes over to use aarch64_feature_flags instead of unsigned long. Committed as obvious to gcc 13 branch after a bootstrap/test. gcc/ChangeLog: PR target/109762 * config/aarch64/aarch64-builtins.cc (aarch64_simd_switcher::aarch64_simd_switcher): Change argument type to aarch64_feature_flags. * config/aarch64/aarch64-protos.h (aarch64_simd_switcher): Change constructor argument type to aarch64_feature_flags. Change m_old_asm_isa_flags to be aarch64_feature_flags. (cherry picked from commit a1a9ce24)
-
GCC Administrator authored
-
- May 06, 2023
-
-
Dan Horák authored
If there is a homogeneous struct with float128 members, they should be copied to vector register save area. The current code incorrectly copies only the value of the first member, not increasing the pointer with each iteration. Fix this. Merged from upstream libffi commit: 464b4b66e3cf3b5489e730c1466ee1bf825560e0 2023-05-03 Dan Horák <dan@danny.cz> libffi/ PR libffi/109447 * src/powerpc/ffi_linux64.c (ffi_prep_args64): Update arg.f128 pointer. (cherry picked from commit 043550bc)
-
GCC Administrator authored
-
- May 05, 2023
-
-
Patrick Palka authored
The PR109666 fix r14-386-g07c52d1eec967 incidentally also fixes this PR. PR c++/109506 gcc/testsuite/ChangeLog: * g++.dg/cpp0x/nsdmi-template26.C: New test. (cherry picked from commit 9a9840ce)
-
Julian Brown authored
This patch moves several tests introduced by the following patch: https://gcc.gnu.org/pipermail/gcc-patches/2023-April/616939.html commit r14-325-gcacf65d74463600815773255e8b82b4043432bd7 into the proper location for OpenACC testing (thanks to Thomas for spotting my mistake!), and also fixes a few additional problems -- missing diagnostics for non-pointer attaches, and a case where a pointer was incorrectly dereferenced. Tests are also adjusted for vector-length warnings on nvidia accelerators. 2023-04-29 Julian Brown <julian@codesourcery.com> PR fortran/109622 gcc/fortran/ * openmp.cc (resolve_omp_clauses): Add diagnostic for non-pointer/non-allocatable attach/detach. * trans-openmp.cc (gfc_trans_omp_clauses): Remove dereference for pointer-to-scalar derived type component attach/detach. Fix attach/detach handling for descriptors. gcc/testsuite/ * gfortran.dg/goacc/pr109622-5.f90: New test. * gfortran.dg/goacc/pr109622-6.f90: New test. libgomp/ * testsuite/libgomp.fortran/pr109622.f90: Move test... * testsuite/libgomp.oacc-fortran/pr109622.f90: ...to here. Ignore vector length warning. * testsuite/libgomp.fortran/pr109622-2.f90: Move test... * testsuite/libgomp.oacc-fortran/pr109622-2.f90: ...to here. Add missing copyin/copyout variable. Ignore vector length warnings. * testsuite/libgomp.fortran/pr109622-3.f90: Move test... * testsuite/libgomp.oacc-fortran/pr109622-3.f90: ...to here. Ignore vector length warnings. * testsuite/libgomp.oacc-fortran/pr109622-4.f90: New test. (cherry picked from commit 0a26a42b)
-
Julian Brown authored
This patch fixes several cases where multiple attach or detach mapping nodes were being created for stand-alone attach or detach clauses in Fortran. After the introduction of stricter checking later during compilation, these extra nodes could cause ICEs, as seen in the PR. The patch also fixes cases that "happened to work" previously where the user attaches/detaches a pointer to array using a descriptor, and (I think!) the "_data" field has offset zero, hence the same address as the descriptor as a whole. 2023-04-27 Julian Brown <julian@codesourcery.com> PR fortran/109622 gcc/fortran/ * trans-openmp.cc (gfc_trans_omp_clauses): Attach/detach clause fixes. gcc/testsuite/ * gfortran.dg/goacc/attach-descriptor.f90: Adjust expected output. libgomp/ * testsuite/libgomp.fortran/pr109622.f90: New test. * testsuite/libgomp.fortran/pr109622-2.f90: New test. * testsuite/libgomp.fortran/pr109622-3.f90: New test. (cherry picked from commit cacf65d7)
-
Alexandre Oliva authored
When long double is wider than double, but from_chars is implemented in terms of double, tests that involve the full precision of long double are expected to fail. Mark them as such on aarch64-*-vxworks. for libstdc++-v3/ChangeLog * testsuite/20_util/from_chars/4.cc: Skip long double test06 on aarch64-vxworks. * testsuite/20_util/to_chars/long_double.cc: Xfail run on aarch64-vxworks. (cherry picked from commit e383fc69)
-
GCC Administrator authored
-
- May 04, 2023
-
-
Jonathan Wakely authored
libstdc++-v3/ChangeLog: * doc/xml/manual/abi.xml (abi.versioning.history): Document libstdc++.so.6.0.32 and GLIBCXX_3.4.32 version. * doc/html/manual/abi.html: Regenerate. (cherry picked from commit 2eadfb5c)
-
Florian Weimer authored
GCC_11.0 is an aarch64-specific outlier. libstdc++-v3/ChangeLog: * doc/xml/manual/abi.xml (abi.versioning.history): Add GCC_7.0.0, GCC_9.0.0, GCC_11.0, GCC_12.0.0, GCC_13.0.0 for libgcc_s. (cherry picked from commit 9cb3f254)
-
Richard Biener authored
The following adds a testcase for PR109724 which was caused by backporting r13-2375-gbe1b42de9c151d and fixed by r11-199-g2b42509f8b7bdf. PR tree-optimization/109724 * g++.dg/torture/pr109724.C: New testcase. (cherry picked from commit ee99aaae)
-
Jakub Jelinek authored
The following testcase ICEs because STV replaces there (debug_insn 114 47 51 8 (var_location:TI D#3 (reg:TI 91 [ p ])) -1 (nil)) with (debug_insn 114 47 51 8 (var_location:TI D#3 (reg:V1TI 91 [ p ])) -1 (nil)) which is invalid because of the mode mismatch. STV has fix_debug_reg_uses function which is supposed to fix this up and adjust such debug insns into (debug_insn 114 47 51 8 (var_location:TI D#3 (subreg:TI (reg:V1TI 91 [ p ]) 0)) -1 (nil)) but it doesn't trigger here. The IL before stv1 has: (debug_insn 114 47 51 8 (var_location:TI D#3 (reg:TI 91 [ p ])) -1 (nil)) ... (insn 63 62 64 8 (set (mem/c:TI (reg/f:DI 89 [ .result_ptr ]) [0 <retval>.mStorage+0 S16 A32]) (reg:TI 91 [ p ])) "pr109676.C":4:48 87 {*movti_internal} (expr_list:REG_DEAD (reg:TI 91 [ p ]) (nil))) in bb 8 and (insn 97 96 98 9 (set (reg:TI 91 [ p ]) (mem/c:TI (plus:DI (reg/f:DI 19 frame) (const_int -32 [0xffffffffffffffe0])) [0 p+0 S16 A128])) "pr109676.C":26:12 87 {*movti_internal} (nil)) (insn 98 97 99 9 (set (mem/c:TI (plus:DI (reg/f:DI 19 frame) (const_int -64 [0xffffffffffffffc0])) [0 tmp+0 S16 A128]) (reg:TI 91 [ p ])) "pr109676.C":26:12 87 {*movti_internal} (nil)) in bb9. PUT_MODE on a REG is done in two spots in timode_scalar_chain::convert_insn, one is: switch (GET_CODE (dst)) { case REG: if (GET_MODE (dst) == TImode) { PUT_MODE (dst, V1TImode); fix_debug_reg_uses (dst); } if (GET_MODE (dst) == V1TImode) when seeing the REG in SET_DEST and another one the hunk the patch adjusts. Because bb 8 comes first in the order the pass walks the bbs, we first notice the TImode pseudo on insn 63 where it is SET_SRC, use PUT_MODE there unconditionally, so for a shared REG it changes all other uses in the IL, and then don't call fix_debug_reg_uses because DF_REG_DEF_CHAIN (REGNO (src)) is non-NULL - the REG is set in insn 97 but we haven't processed it yet. Later on we process insn 97, but because the REG in SET_DEST already has V1TImode, we don't do anything, even when the src handling code earlier relied on it being done. The following patch fixes this by using similar code for both dst and src, in particular calling fix_debug_reg_uses once when we actually change REG mode from TImode to V1TImode, and not later on. 2023-05-04 Jakub Jelinek <jakub@redhat.com> PR debug/109676 * config/i386/i386-features.cc (timode_scalar_chain::convert_insn): If src is REG, change its mode to V1TImode and call fix_debug_reg_uses for it only if it still has TImode. Don't decide whether to call fix_debug_reg_uses based on whether SRC is ever set or not. * g++.target/i386/pr109676.C: New test. (cherry picked from commit 3a715d3e)
-
Jakub Jelinek authored
This is an ABI problem on powerpc64le-linux, introduced in 13.1. When libstdc++ is configured against old glibc, the _ZSt10from_charsPKcS0_RDF128_St12chars_format@@GLIBCXX_3.4.31 _ZSt8to_charsPcS_DF128_@@GLIBCXX_3.4.31 _ZSt8to_charsPcS_DF128_St12chars_format@@GLIBCXX_3.4.31 _ZSt8to_charsPcS_DF128_St12chars_formati@@GLIBCXX_3.4.31 symbols are exported from the library, while when it is configured against new enough glibc, those symbols aren't exported and we export instead _ZSt10from_charsPKcS0_Ru9__ieee128St12chars_format@@GLIBCXX_IEEE128_3.4.29 _ZSt8to_charsPcS_u9__ieee128@@GLIBCXX_IEEE128_3.4.29 _ZSt8to_charsPcS_u9__ieee128St12chars_format@@GLIBCXX_IEEE128_3.4.29 _ZSt8to_charsPcS_u9__ieee128St12chars_formati@@GLIBCXX_IEEE128_3.4.29 together with various other @@GLIBCXX_IEEE128_3.4.{29,30,31} and @@CXXABI_IEEE128_1.3.13 symbols. The idea was that those *IEEE128* symbol versions (similarly to *LDBL* symbol versions) are optional (but if it appears, all symbols from it up to the version of the library appears), but the base appears always. My _Float128 from_chars/to_chars changes unfortunately broke this. I believe nothing really uses those symbols if libstdc++ has been configured against old glibc, so if 13.1 wasn't already released, it might be best to make sure they aren't exported on powerpc64le-linux. But as they were exported, I think the best resolution for this ABI difference is to add those 4 symbols as aliases to the GLIBCXX_IEEE128_3.4.29 *u9__ieee128* symbols, which the following patch does. 2023-05-03 Jakub Jelinek <jakub@redhat.com> * src/c++17/floating_from_chars.cc (_ZSt10from_charsPKcS0_RDF128_St12chars_format): New alias to _ZSt10from_charsPKcS0_Ru9__ieee128St12chars_format. * src/c++17/floating_to_chars.cc (_ZSt8to_charsPcS_DF128_): New alias to _ZSt8to_charsPcS_u9__ieee128. (_ZSt8to_charsPcS_DF128_St12chars_format): New alias to _ZSt8to_charsPcS_u9__ieee128St12chars_format. (_ZSt8to_charsPcS_DF128_St12chars_formati): New alias to _ZSt8to_charsPcS_u9__ieee128St12chars_formati. * config/abi/post/powerpc64le-linux-gnu/baseline_symbols.txt: Updated. (cherry picked from commit b51e2fd6)
-
Jakub Jelinek authored
As discussed on IRC, my _Float128/_Float64x support changes broke abi.exp testing on powerpc64-linux. The _ZTIDF128_@@CXXABI_1.3.14 _ZTIDF64x@@CXXABI_1.3.14 _ZTIPDF128_@@CXXABI_1.3.14 _ZTIPDF64x@@CXXABI_1.3.14 _ZTIPKDF128_@@CXXABI_1.3.14 _ZTIPKDF64x@@CXXABI_1.3.14 symbols only appear on powerpc64le-linux (both when building against very old glibcs as well as contemporary glibcs), while they don't appear on powerpc64-linux, because the latter never has _Float128 or _Float64x support. But we were using the same baseline_symbols.txt file for both powerpc64-linux and powerpc64le-linux, even when it contained quite a lot of stuff specific to the latter; but that was just the IEEE128 related stuff that appears only when configured against not very old glibc. The following patch keeps those exports as is and just splits the config/abi/post/ files, copies the current one to powerpc64le-linux unmodified and removes the above mentioned symbols plus all GLIBCXX_IEEE128_3.4.{29,30,31} and CXXABI_IEEE128_1.3.13 symbols from the powerpc64-linux version. 2023-05-03 Jakub Jelinek <jakub@redhat.com> * configure.host (abi_baseline_pair): Use powerpc64le-linux-gnu rather than powerpc64-linux-gnu for powerpc64le*-linux*. * config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt: Remove _ZTI*DF128_, _ZTI*DF64x symbols and symbols in GLIBCXX_IEEE128_3.4.{29,30,31} and CXXABI_IEEE128_1.3.13 symbol versions. * config/abi/post/powerpc64le-linux-gnu/baseline_symbols.txt: New file. (cherry picked from commit a13ea34c)
-
Jakub Jelinek authored
The following patch regenerates the ABI files (I've only changed the Linux files which were updated recently (last month)). 2023-05-02 Jakub Jelinek <jakub@redhat.com> * config/abi/post/aarch64-linux-gnu/baseline_symbols.txt: Update. * config/abi/post/i486-linux-gnu/baseline_symbols.txt: Update. * config/abi/post/m68k-linux-gnu/baseline_symbols.txt: Update. * config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt: Update. * config/abi/post/riscv64-linux-gnu/baseline_symbols.txt: Update. * config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Update. * config/abi/post/x86_64-linux-gnu/32/baseline_symbols.txt: Update. * config/abi/post/x86_64-linux-gnu/baseline_symbols.txt: Update. (cherry picked from commit 1d003da7)
-
Jakub Jelinek authored
I've followed what other files do, using attribute alias with not really matching function type (after all, it isn't really possible when it is a constructor), but seems I've missed it warns: ../../../../../libstdc++-v3/src/c++98/ios_init.cc:203:8: warning: ‘void std::ios_base_library_init()’ alias between functions of incompatible types ‘void()’ and ‘void +(std::ios_base::Init::)()’ [-Wattribute-alias=] 203 | void ios_base_library_init (void) | ^~~~~~~~~~~~~~~~~~~~~ ../../../../../libstdc++-v3/src/c++98/ios_init.cc:78:3: note: aliased declaration here 78 | ios_base::Init::Init() | ^~~~~~~~ The PR talks about clang++ warning there (which I think isn't really supported, libstdc++ sources ought to be built by GCC), but it warns when built with GCC too. The following patch fixes it by doing what other libstdc++ sources do in those cases. 2023-05-02 Jakub Jelinek <jakub@redhat.com> PR libstdc++/109694 * src/c++98/ios_init.cc: Add #pragma GCC diagnostic ignored for -Wattribute-alias. (cherry picked from commit 87de39e4)
-
Jakub Jelinek authored
libstdc++: Another attempt to ensure g++ 13+ compiled programs enforce gcc 13.2+ libstdc++.so.6 [PR108969] GCC used to emit an instance of an empty ios_base::Init class in every TU which included <iostream> to ensure it is std::cout etc. is initialized, but thanks to Patrick work on some targets (which have init_priority attribute support) it is now initialized only inside of libstdc++.so.6/libstdc++.a. This causes a problem if people do something that has never been supported, try to run GCC 13 compiled C++ code against GCC 12 or earlier libstdc++.so.6 - std::cout etc. are then never initialized because code including <iostream> expects the library to initialize it and the library expects code including <iostream> to do that. The following patch is second attempt to make this work cheaply as the earlier attempt of aliasing the std::cout etc. symbols with another symbol version didn't work out due to copy relocation breaking the aliases appart. The patch forces just a _ZSt21ios_base_library_initv undefined symbol into all *.o files which include <iostream> and while there is no runtime relocation against that, it seems to enforce the right version of libstdc++.so.6. /home/jakub/src/gcc/obj08i/usr/local/ is the install directory of trunk patched with this patch, /home/jakub/src/gcc/obj06/ is builddir of trunk without this patch, system g++ is GCC 12.1.1. $ cat /tmp/hw.C #include <iostream> int main () { std::cout << "Hello, world!" << std::endl; } $ cd /home/jakub/src/gcc/obj08i/usr/local/bin $ ./g++ -o /tmp/hw /tmp/hw.C $ readelf -Wa /tmp/hw 2>/dev/null | grep initv 4: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _ZSt21ios_base_library_initv@GLIBCXX_3.4.32 (4) 71: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _ZSt21ios_base_library_initv@GLIBCXX_3.4.32 $ /tmp/hw /tmp/hw: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.32' not found (required by /tmp/hw) $ LD_LIBRARY_PATH=/home/jakub/src/gcc/obj08i/usr/local/lib64/ /tmp/hw Hello, world! $ LD_LIBRARY_PATH=/home/jakub/src/gcc/obj06/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/ /tmp/hw /tmp/hw: /home/jakub/src/gcc/obj06/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6: version `GLIBCXX_3.4.32' not found (required by /tmp/hw) $ g++ -o /tmp/hw /tmp/hw.C $ /tmp/hw Hello, world! $ LD_LIBRARY_PATH=/home/jakub/src/gcc/obj06/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/ /tmp/hw Hello, world! $ LD_LIBRARY_PATH=/home/jakub/src/gcc/obj08i/usr/local/lib64/ /tmp/hw Hello, world! On sparc-sun-solaris2.11 one I've actually checked a version which had defined(_GLIBCXX_SYMVER_SUN) next to defined(_GLIBCXX_SYMVER_GNU), but init_priority attribute doesn't seem to be supported there and so I couldn't actually test how this works there. Using gas and Sun ld, Rainer, does one need to use gas + gld for init_priority or something else? 2023-04-28 Jakub Jelinek <jakub@redhat.com> PR libstdc++/108969 * config/abi/pre/gnu.ver (GLIBCXX_3.4.32): Export _ZSt21ios_base_library_initv. * testsuite/util/testsuite_abi.cc (check_version): Add GLIBCXX_3.4.32 symver and make it the latestp. * src/c++98/ios_init.cc (ios_base_library_init): New alias. * acinclude.m4 (libtool_VERSION): Change to 6:32:0. * include/std/iostream: If init_priority attribute is supported and _GLIBCXX_SYMVER_GNU, force undefined _ZSt21ios_base_library_initv symbol into the object. * configure: Regenerated. (cherry picked from commit 9a41d2cd)
-
Kito Cheng authored
`vr`, `vm` and `vd` constarint for vector register constarint, those 3 constarint has implemented on LLVM as well. gcc/ChangeLog: * doc/md.texi (RISC-V): Add vr, vm, vd constarint. (cherry picked from commit e8511cbb)
-
Ju-Zhe Zhong authored
count_occurrences will conly count same RTX (same code and same mode), but what we want to track is the occurrence of a register, a register might appeared in the insn with different mode or contain in SUBREG. Testcase coming from Kito. gcc/ChangeLog: PR target/109535 * config/riscv/riscv-vsetvl.cc (count_regno_occurrences): New function. (pass_vsetvl::cleanup_insns): Fix bug. gcc/testsuite/ChangeLog: PR target/109535 * g++.target/riscv/rvv/base/pr109535.C: New test. * gcc.target/riscv/rvv/base/pr109535.c: New test. Signed-off-by:
Ju-Zhe Zhong <juzhe.zhong@rivai.ai> Co-authored-by:
kito-cheng <kito.cheng@sifive.com> (cherry picked from commit a2d12abe)
-
GCC Administrator authored
-
- May 03, 2023
-
-
Jason Merrill authored
This patch was just a cleanup after the actual bugfix, so let's revert it on the branch. PR c++/109649 This reverts commit e9d2adc1.
-
Kefu Chai authored
This always sets _M_string_length in the constructor for ranges of input iterators, such as stream iterators. We copy from the source range to the local buffer, and then repeatedly reallocate a larger one if necessary. When disposing the old buffer, _M_is_local() is used to tell if the buffer is the local one or not (and so must be deallocated). In addition to comparing the buffer address with the local buffer, _M_is_local() has an optimization hint so that the compiler knows that for a string using the local buffer, there is an invariant that _M_string_length <= _S_local_capacity (added for PR109299 via r13-6915-gbf78b43873b0b7). But we failed to set _M_string_length in the constructor taking a pair of iterators, so the invariant might not hold, and __builtin_unreachable() is reached. This causes UBsan errors, and potentially misoptimization. To ensure the invariant holds, _M_string_length is initialized to zero before doing anything else, so that _M_is_local() doesn't see an uninitialized value. This issue only surfaces when constructing a string with a range of input iterator, and the uninitialized _M_string_length happens to be greater than _S_local_capacity, i.e., 15 for the std::string specialization. libstdc++-v3/ChangeLog: PR libstdc++/109703 * include/bits/basic_string.h (basic_string(Iter, Iter, Alloc)): Initialize _M_string_length. Signed-off-by:
Kefu Chai <kefu.chai@scylladb.com> Co-authored-by:
Jonathan Wakely <jwakely@redhat.com> (cherry picked from commit cbf6c7a1)
-
Jakub Jelinek authored
During patch backporting, I've noticed that while most cp_walk_tree calls with cp_fold_r callback callers were changed from &pset to cp_fold_data &data, the VEC_INIT_EXPR gimplifications has not, so it still passes just address of a hash_set<tree> and so if during the folding we ever touch data->flags, we use uninitialized data there. The following patch changes it to do the same thing as cp_fold_function because the VEC_INIT_EXPR gimplifications will happen on function bodies only. 2023-05-03 Jakub Jelinek <jakub@redhat.com> * cp-gimplify.cc (cp_fold_data): Move definition earlier. (cp_gimplify_expr): Pass address of ff_genericize | ff_mce_false constructed data rather than &pset to cp_walk_tree with cp_fold_r. (cherry picked from commit 8d193b12)
-