Skip to content
Snippets Groups Projects
  1. Nov 15, 2023
    • Xi Ruoyao's avatar
      LoongArch: Remove redundant barrier instructions before LL-SC loops · 4d86dc51
      Xi Ruoyao authored
      This is isomorphic to the LLVM changes [1-2].
      
      On LoongArch, the LL and SC instructions has memory barrier semantics:
      
      - LL: <memory-barrier> + <load-exclusive>
      - SC: <store-conditional> + <memory-barrier>
      
      But the compare and swap operation is allowed to fail, and if it fails
      the SC instruction is not executed, thus the guarantee of acquiring
      semantics cannot be ensured. Therefore, an acquire barrier needs to be
      generated when failure_memorder includes an acquire operation.
      
      On CPUs implementing LoongArch v1.10 or later, "dbar 0b10100" is an
      acquire barrier; on CPUs implementing LoongArch v1.00, it is a full
      barrier.  So it's always enough for acquire semantics.  OTOH if an
      acquire semantic is not needed, we still needs the "dbar 0x700" as the
      load-load barrier like all LL-SC loops.
      
      [1]:https://github.com/llvm/llvm-project/pull/67391
      [2]:https://github.com/llvm/llvm-project/pull/69339
      
      gcc/ChangeLog:
      
      	* config/loongarch/loongarch.cc
      	(loongarch_memmodel_needs_release_fence): Remove.
      	(loongarch_cas_failure_memorder_needs_acquire): New static
      	function.
      	(loongarch_print_operand): Redefine 'G' for the barrier on CAS
      	failure.
      	* config/loongarch/sync.md (atomic_cas_value_strong<mode>):
      	Remove the redundant barrier before the LL instruction, and
      	emit an acquire barrier on failure if needed by
      	failure_memorder.
      	(atomic_cas_value_cmp_and_7_<mode>): Likewise.
      	(atomic_cas_value_add_7_<mode>): Remove the unnecessary barrier
      	before the LL instruction.
      	(atomic_cas_value_sub_7_<mode>): Likewise.
      	(atomic_cas_value_and_7_<mode>): Likewise.
      	(atomic_cas_value_xor_7_<mode>): Likewise.
      	(atomic_cas_value_or_7_<mode>): Likewise.
      	(atomic_cas_value_nand_7_<mode>): Likewise.
      	(atomic_cas_value_exchange_7_<mode>): Likewise.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/loongarch/cas-acquire.c: New test.
      4d86dc51
    • Jonathan Wakely's avatar
      libstdc++: Fix std::deque::operator[] Xmethod [PR112491] · 452476db
      Jonathan Wakely authored
      The Xmethod for std::deque::operator[] has the same bug that I recently
      fixed for the std::deque::size() Xmethod. The first node might have
      unused capacity at the start, which needs to be accounted for when
      indexing into the deque.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/112491
      	* python/libstdcxx/v6/xmethods.py (DequeWorkerBase.index):
      	Correctly handle unused capacity at the start of the first node.
      	* testsuite/libstdc++-xmethods/deque.cc: Check index operator
      	when elements have been removed from the front.
      452476db
    • Jonathan Wakely's avatar
      libstdc++: std::stacktrace tweaks · cbd0fe22
      Jonathan Wakely authored
      Fix a typo in a string literal and make the new hash.cc test gracefully
      handle missing stacktrace data (see PR 112541).
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/stacktrace (basic_stacktrace::at): Fix class name
      	in exception message.
      	* testsuite/19_diagnostics/stacktrace/hash.cc: Do not fail if
      	current() returns a non-empty stacktrace.
      cbd0fe22
    • Richard Earnshaw's avatar
      arm: testsuite: fix test for armv6t2 hardware · 7c16f7a1
      Richard Earnshaw authored
      My previous patch series added a new function to check for armv6t2
      compatible hardware.  But the test was not correctly implemented and
      also did not follow the standard naming convention for Arm hw
      compatibility tests.  Fix both of these issues.
      
      gcc/testsuite:
      
      	* lib/target-supports.exp (check_effective_target_arm_arch_v6t2_hw_ok):
      	Rename to...
      	(check_effective_target_arm_arch_v6t2_hw): ... this.  Fix checks.
      	* gcc.target/arm/acle/data-intrinsics-armv6.c: Update pre-check.
      	* gcc.target/arm/acle/data-intrinsics-rbit.c: Likewise.
      7c16f7a1
    • Juzhe-Zhong's avatar
      RISC-V: Support trailing vec_init optimization · e9fc877f
      Juzhe-Zhong authored
      Add optimization when trailing elements > leading elements.
      
      Consider this following case:
      
      #include <stdint.h>
      
      typedef int64_t v16di __attribute__ ((vector_size (128)));
      
      __attribute__ ((noipa)) void
      f_v16di (int64_t a, int64_t b, int64_t c, int64_t d, int64_t *out)
      {
        v16di v = {a, b, c, d, d, d, d, d, d, d, d, d, d, d, d, d};
        *(v16di *) out = v;
      }
      
      https://godbolt.org/z/vWTjbrWGf
      
      Before this patch:
      
      f_v16di:
              vsetivli        zero,16,e64,m8,ta,ma
              vmv.v.x v8,a0
              vslide1down.vx  v8,v8,a1
              vslide1down.vx  v8,v8,a2
              vslide1down.vx  v8,v8,a3
              vslide1down.vx  v8,v8,a3
              vslide1down.vx  v8,v8,a3
              vslide1down.vx  v8,v8,a3
              vslide1down.vx  v8,v8,a3
              vslide1down.vx  v8,v8,a3
              vslide1down.vx  v8,v8,a3
              vslide1down.vx  v8,v8,a3
              vslide1down.vx  v8,v8,a3
              vslide1down.vx  v8,v8,a3
              vslide1down.vx  v8,v8,a3
              vslide1down.vx  v8,v8,a3
              vslide1down.vx  v8,v8,a3
              vse64.v v8,0(a4)
              ret
      
      After this patch:
      
      f_v16di:
      	vsetivli	zero,16,e64,m8,ta,ma
      	vmv.v.x	v16,a3
      	vslide1up.vx	v8,v16,a2
      	vslide1up.vx	v16,v8,a1
      	vslide1up.vx	v8,v16,a0
      	vse64.v	v8,0(a4)
      	ret
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-v.cc (expand_vector_init_trailing_same_elem): New function.
      	(expand_vec_init): Add trailing optimization.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/vls/def.h: Add trailing tests.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/trailing-1.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/trailing-2.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/trailing_run-1.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/trailing_run-2.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/trailing-1.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/trailing-2.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/trailing-3.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/trailing-4.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/trailing-5.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/trailing-6.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/trailing-7.c: New test.
      e9fc877f
    • Jakub Jelinek's avatar
      testsuite: Adjust gcc.dg/cpp/if-2.c for 16-bit targets · da36a438
      Jakub Jelinek authored
      Jeff reported this testcase newly FAILs on 16-bit targets, the following
      patch adjusts the expected diagnostics for that case.
      
      2023-11-15  Jakub Jelinek  <jakub@redhat.com>
      
      	* gcc.dg/cpp/if-2.c: Adjust expected diagnostics for 16-bit targets.
      da36a438
    • Pan Li's avatar
      RISC-V: Refine the mask generation for vec_init case 2 · 319bbb36
      Pan Li authored
      
      Update in v2:
      1. Add more test cases for fixed-vlmax.
      2, Add test cases for vls mode.
      
      Original log:
      
      We take vec_init element int mode when generate the mask for
      case 2. But actually we don't need as many bits as the element.
      The extra bigger mode may introduce some unnecessary insns.
      For example as below code:
      
      typedef int64_t v16di __attribute__ ((vector_size (16 * 8)));
      
      void __attribute__ ((noinline, noclone))
        foo (int64_t *out, int64_t x, int64_t y)
      {
        v16di v = {y, x, y, x, y, x, y, x, y, x, y, x, y, x, y, x};
        *(v16di *) out = v;
      }
      
      We will have VDImode when generate the 0b0101010101010101 mask but
      actually VHImode is good enough here. This patch would like to
      refine the mask generation to avoid:
      1. Unnecessary scalar to generate big constant mask.
      2. Unnecessary vector insn to v0 mask.
      
      Before this patch:
      foo:
        li      a5,-1431654400
        li      a4,-1431654400               <== unnecessary insn
        addi    a5,a5,-1365                  <== unnecessary insn
        addi    a4,a4,-1366
        slli    a5,a5,32                     <== unnecessary insn
        add     a5,a5,a4                     <== unnecessary insn
        vsetivli        zero,16,e64,m8,ta,ma
        vmv.v.x v8,a2
        vmv.s.x v16,a5
        vmv1r.v v0,v16                       <== unnecessary insn
        vmerge.vxm      v8,v8,a1,v0
        vse64.v v8,0(a0)
        ret
      
      After this patch:
      foo:
        li      a5,-20480
        addiw   a5,a5,-1366
        vsetivli        zero,16,e64,m8,ta,ma
        vmv.s.x v0,a5
        vmv.v.x v8,a2
        vmerge.vxm      v8,v8,a1,v0
        vs8r.v  v8,0(a0)
        ret
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-v.cc (rvv_builder::get_merge_scalar_mask):
      	Add inner_mode mask arg for mask int mode.
      	(get_repeating_sequence_dup_machine_mode): Add mask_bit_mode arg
      	to get the good enough vector int mode on precision.
      	(expand_vector_init_merge_repeating_sequence): Pass required args
      	to above func.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/init-repeat-sequence-10.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/init-repeat-sequence-11.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/init-repeat-sequence-12.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/init-repeat-sequence-13.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/init-repeat-sequence-14.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/init-repeat-sequence-15.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/init-repeat-sequence-6.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/init-repeat-sequence-7.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/init-repeat-sequence-8.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/init-repeat-sequence-9.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/init-repeat-sequence-0.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/init-repeat-sequence-1.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/init-repeat-sequence-2.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/init-repeat-sequence-3.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/init-repeat-sequence-4.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/init-repeat-sequence-5.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/init-repeat-sequence-6.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/init-repeat-sequence-7.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/init-repeat-sequence-8.c: New test.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      319bbb36
    • Juzhe-Zhong's avatar
      RISC-V: Disallow RVV mode address for any load/store[PR112535] · d85161a7
      Juzhe-Zhong authored
      This patch is quite obvious patch which disallow for load/store address register
      with RVV mode.
      
      	PR target/112535
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv.cc (riscv_legitimate_address_p): Disallow RVV modes base address.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/pr112535.c: New test.
      d85161a7
    • Jakub Jelinek's avatar
      c++: Implement C++26 P2864R2 - Remove Deprecated Arithmetic Conversion on Enumerations From C++26 · 5f580e24
      Jakub Jelinek authored
      The following patch implements C++26 P2864R2 by emitting pedwarn enabled by
      the same options as the C++20 and later warnings (i.e. -Wenum-compare,
      -Wdeprecated-enum-enum-conversion and -Wdeprecated-enum-float-conversion
      which are all enabled by default).  I think we still want to allow users
      some option workaround, so am not using directly error.  Additionally, for
      cxx_dialect >= cxx26 && (complain & tf_warning_or_error) == 0 it causes for
      these newly ill-formed constructs error_mark_node to be silently returned.
      
      2023-11-15  Jakub Jelinek  <jakub@redhat.com>
      
      gcc/cp/
      	* typeck.cc: Implement C++26 P2864R2 - Remove Deprecated Arithmetic
      	Conversion on Enumerations From C++26.
      	(do_warn_enum_conversions): Return bool rather than void, add COMPLAIN
      	argument.  Use pedwarn rather than warning_at for C++26 and remove
      	" is deprecated" part of the diagnostics in that case.  For SFINAE
      	in C++26 return true on newly erroneous cases.
      	(cp_build_binary_op): For C++26 call do_warn_enum_conversions
      	unconditionally, pass complain argument to it and if it returns true,
      	return error_mark_node.
      	* call.cc (build_conditional_expr): Use pedwarn rather than warning_at
      	for C++26 and remove " is deprecated" part of the diagnostics in that
      	case and check for complain & tf_warning_or_error.  Use emit_diagnostic
      	with cxx_dialect >= cxx26 ? DK_PEDWARN : DK_WARNING.  For SFINAE in
      	C++26 return error_mark_node on newly erroneous cases.
      	(build_new_op): Use emit_diagnostic with cxx_dialect >= cxx26
      	? DK_PEDWARN : DK_WARNING and complain & tf_warning_or_error check
      	for C++26.  For SFINAE in C++26 return error_mark_node on newly
      	erroneous cases.
      gcc/testsuite/
      	* g++.dg/cpp26/enum-conv1.C: New test.
      	* g++.dg/cpp2a/enum-conv1.C: Adjust expected diagnostics in C++26.
      	* g++.dg/diagnostic/enum3.C: Likewise.
      	* g++.dg/parse/attr3.C: Likewise.
      	* g++.dg/cpp0x/linkage2.C: Likewise.
      5f580e24
    • Alexandre Oliva's avatar
      Revert "libstdc++: bvector: undef always_inline macro" · 081fddbb
      Alexandre Oliva authored
      This reverts commit a1ad62ee.
      081fddbb
    • Alexandre Oliva's avatar
      testsuite: tsan: add fallback overload for pthread_cond_clockwait · f5d94999
      Alexandre Oliva authored
      LTS GNU/Linux distros from 2018, still in use, don't have
      pthread_cond_clockwait.  There's no trivial way to detect it so as to
      make the test conditional, but there's an easy enough way to silence
      the fail due to lack of the function in libc, and that has nothing to
      do with the false positive that this is testing against.
      
      
      for  gcc/testsuite/ChangeLog
      
      	* g++.dg/tsan/pthread_cond_clockwait.C: Add fallback overload.
      f5d94999
    • Alexandre Oliva's avatar
      testsuite: arg-pushing reqs -mno-accumulate-outgoing-args · a9a0daa3
      Alexandre Oliva authored
      gcc.target/i386/pr95126-m32-[34].c expect push instructions that are
      only present with -mno-accumulate-outgoing-args, so make that option
      explicit rather than dependent on tuning.
      
      
      for  gcc/testsuite/ChangeLog
      
      	* gcc.target/i386/pr95126-m32-3.c: Add
      	-mno-accumulate-outgoing-args.
      	* gcc.target/i386/pr95126-m32-4.c: Likewise.
      a9a0daa3
    • Alexandre Oliva's avatar
      libstdc++: bvector: undef always_inline macro · a1ad62ee
      Alexandre Oliva authored
      It's customary to undefine temporary internal macros at the end of the
      header that defines them, even such widely-usable ones as
      _GLIBCXX_ALWAYS_INLINE, so do so in the header where the define was
      recently introduced.
      
      
      for  libstdc++-v3/ChangeLog
      
      	* include/bits/stl_bvector.h (_GLIBCXX_ALWAYS_INLINE): Undef.
      a1ad62ee
    • David Malcolm's avatar
      json.cc: use SELFTEST_LOCATION in selftests · 2220263f
      David Malcolm authored
      
      gcc/ChangeLog:
      	* json.cc (selftest::assert_print_eq): Add "loc" param and use
      	ASSERT_STREQ_AT.
      	(ASSERT_PRINT_EQ): New macro.
      	(selftest::test_writing_objects): Use ASSERT_PRINT_EQ to capture
      	source location of assertion.
      	(selftest::test_writing_arrays): Likewise.
      	(selftest::test_writing_float_numbers): Likewise.
      	(selftest::test_writing_integer_numbers): Likewise.
      	(selftest::test_writing_strings): Likewise.
      	(selftest::test_writing_literals): Likewise.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      2220263f
    • GCC Administrator's avatar
      Daily bump. · eaedb56a
      GCC Administrator authored
      eaedb56a
  2. Nov 14, 2023
    • Lewis Hyatt's avatar
      c-family: Let libcpp know when the compilation is for a PCH [PR9471] · 9938645f
      Lewis Hyatt authored
      libcpp will generate diagnostics when it encounters things in the main file
      that only belong in a header file, such as `#pragma once' or `#pragma GCC
      system_header'. But sometimes the main file is a header file that is just
      being compiled separately, e.g. to produce a C++ module or a PCH, in which
      case such diagnostics should be suppressed. libcpp already has an interface
      to request that, so make use of it in the C frontends to prevent libcpp from
      issuing unwanted diagnostics when compiling a PCH.
      
      gcc/c-family/ChangeLog:
      
      	PR pch/9471
      	PR pch/47857
      	* c-opts.cc (c_common_post_options): Set cpp_opts->main_search
      	so libcpp knows it is compiling a header file separately.
      
      gcc/testsuite/ChangeLog:
      
      	PR pch/9471
      	PR pch/47857
      	* g++.dg/pch/main-file-warnings.C: New test.
      	* g++.dg/pch/main-file-warnings.Hs: New test.
      	* gcc.dg/pch/main-file-warnings.c: New test.
      	* gcc.dg/pch/main-file-warnings.hs: New test.
      9938645f
    • Cassio Neri's avatar
      libstdc++: Improve operator-(weekday x, weekday y) · f71352c7
      Cassio Neri authored
      The current implementation calls __detail::__modulo which is relatively
      expensive.
      
      A better implementation is possible if we assume that x.ok() && y.ok() == true,
      so that n = x.c_encoding() - y.c_encoding() is in [-6, 6]. In this case, it
      suffices to return n >= 0 ? n : n + 7.
      
      The above is allowed by [time.cal.wd.nonmembers]/5: the returned value is
      unspecified when x.ok() || y.ok() == false.
      
      The assembly emitted for x86-64 and ARM can be seen in:
      https://godbolt.org/z/nMdc5vv9n.
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/chrono (operator-(const weekday&, const weekday&)):
      	Optimize.
      f71352c7
    • Cassio Neri's avatar
      libstdc++: Fix UB in weekday::weekday(sys_days) and add test · f6ce081d
      Cassio Neri authored
      The following has undefined behaviour (signed overflow) [1]:
          weekday max{sys_days{days{numeric_limits<days::rep>::max()}}};
      
      The issue is in this line when __n is very large and __n + 4 overflows:
          return weekday(__n >= -4 ? (__n + 4) % 7 : (__n + 5) % 7 + 6);
      
      In addition to fixing this bug, the new implementation makes the compiler emit
      shorter and branchless code for x86-64 and ARM [2].
      
      [1] https://godbolt.org/z/1s5bv7KfT
      [2] https://godbolt.org/z/zKsabzrhs
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/chrono (weekday::_S_from_days): Fix UB.
      	* testsuite/std/time/weekday/1.cc: Add test for overflow.
      f6ce081d
    • Cassio Neri's avatar
      libstdc++: Simplify year::is_leap() · 86a0df1a
      Cassio Neri authored
      The current implementation returns
          (_M_y & (__is_multiple_of_100 ? 15 : 3)) == 0;
      where __is_multiple_of_100 is calculated using an obfuscated algorithm which
      saves one ror instruction when compared to _M_y % 100 == 0 [1].
      
      In leap years calculation, it's correct to replace the divisibility check by
      100 with the one by 25. It turns out that _M_y % 25 == 0 also saves the ror
      instruction [2]. Therefore, the obfuscation is not required.
      
      [1] https://godbolt.org/z/5PaEv6a6b
      [2] https://godbolt.org/z/55G8rn77e
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/chrono (year::is_leap): Clear code.
      86a0df1a
    • Cassio Neri's avatar
      libstdc++: Remove unnecessary "& 1" from year_month_day_last::day() · b0115354
      Cassio Neri authored
      When year_month_day_last::day() was implemented, Dr. Matthias Kretz realised
      that the operation "& 1" wasn't necessary but we did not patch it at that
      time. This patch removes the unnecessary operation.
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/chrono (year_month_day_last::day): Remove &1.
      b0115354
    • Jonathan Wakely's avatar
      libstdc++: Fix <charconv> uses of signed types with <bit> functions · 1c153033
      Jonathan Wakely authored
      In <charconv> we pass the int __base parameter to our internal versions
      of <bit> functions, __bit_width and __countr_zero. Those functions are
      only defined for unsigned types, so we need to convert the base to
      unsigned. The base must be in the range [2,36] so we can mask off the
      low bits and then convert that to unsigned, so that we don't need to
      care about negative values becoming large unsigned values.
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/charconv (__from_chars_pow2_base): Convert base to
      	unsigned for call to __countr_zero.
      	(__from_chars_alnum): Likewise for call to __bit_width.
      1c153033
    • Jonathan Wakely's avatar
      libstdc++: Fix std::hash<std::stacktrace> [PR112348] · 6f2fc42d
      Jonathan Wakely authored
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/112348
      	* include/std/stacktrace (hash<basic_stacktrace<Alloc>>): Fix
      	type of hash functio nfor entries.
      	* testsuite/19_diagnostics/stacktrace/hash.cc: New test.
      6f2fc42d
    • David Malcolm's avatar
      analyzer: enable taint state machine by default [PR103533] · cfaaa8b1
      David Malcolm authored
      
      gcc/analyzer/ChangeLog:
      	PR analyzer/103533
      	* sm-taint.cc: Remove "experimental" from comment.
      	* sm.cc (make_checkers): Always add taint state machine.
      
      gcc/ChangeLog:
      	PR analyzer/103533
      	* doc/invoke.texi (Static Analyzer Options): Add the six
      	-Wanalyzer-tainted-* warnings.  Update documentation of each
      	warning to reflect removed requirement to use
      	-fanalyzer-checker=taint.  Remove discussion of
      	-fanalyzer-checker=taint.
      
      gcc/testsuite/ChangeLog:
      	PR analyzer/103533
      	* c-c++-common/analyzer/attr-tainted_args-1.c: Remove use of
      	-fanalyzer-checker=taint.
      	* c-c++-common/analyzer/fread-1.c: Likewise.
      	* c-c++-common/analyzer/pr104029.c: Likewise.
      	* gcc.dg/analyzer/pr93032-mztools-signed-char.c: Add params to
      	work around state explosion.
      	* gcc.dg/analyzer/pr93032-mztools-unsigned-char.c: Likewise.
      	* gcc.dg/analyzer/pr93382.c: Remove use of
      	-fanalyzer-checker=taint.
      	* gcc.dg/analyzer/switch-enum-taint-1.c: Likewise.
      	* gcc.dg/analyzer/taint-CVE-2011-2210-1.c: Likewise.
      	* gcc.dg/analyzer/taint-CVE-2020-13143-1.c: Likewise.
      	* gcc.dg/analyzer/taint-CVE-2020-13143-2.c: Likewise.
      	* gcc.dg/analyzer/taint-CVE-2020-13143.h: Likewise.
      	* gcc.dg/analyzer/taint-alloc-1.c: Likewise.
      	* gcc.dg/analyzer/taint-alloc-2.c: Likewise.
      	* gcc.dg/analyzer/taint-alloc-3.c: Likewise.
      	* gcc.dg/analyzer/taint-alloc-4.c: Likewise.
      	* gcc.dg/analyzer/taint-alloc-5.c: Likewise.
      	* gcc.dg/analyzer/taint-assert-BUG_ON.c: Likewise.
      	* gcc.dg/analyzer/taint-assert-macro-expansion.c: Likewise.
      	* gcc.dg/analyzer/taint-assert-system-header.c: Likewise.
      	* gcc.dg/analyzer/taint-assert.c: Likewise.
      	* gcc.dg/analyzer/taint-divisor-1.c: Likewise.
      	* gcc.dg/analyzer/taint-divisor-2.c: Likewise.
      	* gcc.dg/analyzer/taint-merger.c: Likewise.
      	* gcc.dg/analyzer/taint-ops.c: Delete this test: it was a
      	duplicate of material in operations.c and data-model-1.c, with
      	-fanalyzer-checker=taint added.
      	* gcc.dg/analyzer/taint-read-index-1.c: Remove use of
      	-fanalyzer-checker=taint.
      	* gcc.dg/analyzer/taint-read-offset-1.c: Likewise.
      	* gcc.dg/analyzer/taint-realloc.c: Likewise.  Add missing
      	dg-warning for leak now that the malloc state machine is also
      	active.
      	* gcc.dg/analyzer/taint-size-1.c: Remove use of
      	-fanalyzer-checker=taint.
      	* gcc.dg/analyzer/taint-size-access-attr-1.c: Likewise.
      	* gcc.dg/analyzer/taint-write-index-1.c: Likewise.
      	* gcc.dg/analyzer/taint-write-offset-1.c: Likewise.
      	* gcc.dg/analyzer/torture/taint-read-index-2.c: Likewise.
      	* gcc.dg/analyzer/torture/taint-read-index-3.c: Likewise.
      	* gcc.dg/plugin/taint-CVE-2011-0521-1-fixed.c: Likewise.  Add
      	-Wno-pedantic.
      	* gcc.dg/plugin/taint-CVE-2011-0521-1.c: Likewise.
      	* gcc.dg/plugin/taint-CVE-2011-0521-2-fixed.c: Likewise.
      	* gcc.dg/plugin/taint-CVE-2011-0521-2.c: Likewise.
      	* gcc.dg/plugin/taint-CVE-2011-0521-3-fixed.c: Likewise.
      	* gcc.dg/plugin/taint-CVE-2011-0521-3.c: Likewise.  Fix C++-style
      	comment.
      	* gcc.dg/plugin/taint-CVE-2011-0521-4.c: Remove use of
      	-fanalyzer-checker=taint and add -Wno-pedantic. Remove xfail and
      	add missing dg-warning.
      	* gcc.dg/plugin/taint-CVE-2011-0521-5-fixed.c: Remove use of
      	-fanalyzer-checker=taint and add -Wno-pedantic.
      	* gcc.dg/plugin/taint-CVE-2011-0521-5.c: Likewise.
      	* gcc.dg/plugin/taint-CVE-2011-0521-6.c: Likewise.
      	* gcc.dg/plugin/taint-antipatterns-1.c: : Remove use of
      	-fanalyzer-checker=taint.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      cfaaa8b1
    • Jakub Jelinek's avatar
      Manually add ChangeLog entry for r14-5312-g040e5b0edbca861196d9e2ea2af5e805769c8d5d commit. · c6560525
      Jakub Jelinek authored
      This commit got ignored because ChangeLog update can't parse its log message.
      c6560525
    • Dimitar Dimitrov's avatar
      testsuite: Ignore warning for unsupported option · 3d8d443c
      Dimitar Dimitrov authored
      
      The -w option was used in gcc.dg/20020206-1.c to ignore warnings if the
      '-fprefetch-loop-arrays' option is not supported by target.
      
      When commit r14-5380-g5c432b0efab54e removed the -w option, some targets
      (arm-none-eabi, pru and possibly others) started failing the test:
      
        cc1: warning: '-fprefetch-loop-arrays' not supported for this target
        FAIL: gcc.dg/20020206-1.c (test for excess errors)
      
      Fix by instructing DejaGnu to prune the '-fprefetch-loop-arrays'
      warning.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/20020206-1.c: Prune warning that
      	-fprefetch-loop-arrays is not supported.
      
      Signed-off-by: default avatarDimitar Dimitrov <dimitar@dinux.eu>
      3d8d443c
    • Nathaniel Shead's avatar
      c++: Stream virtual dtor vtable indices · 14979dd3
      Nathaniel Shead authored
      
      Virtual cloned functions have distinct vtable indices, stream them
      explicitly.
      
      As such, this patch ensures that DECL_VINDEX is properly passed on for
      cloned functions as well to prevent this from causing issues.
      
      	PR c++/103499
      
      gcc/cp/ChangeLog:
      
      	* module.cc (trees_out::decl_node): Write DECL_VINDEX for
      	virtual clones.
      	(trees_in::tree_node): Read DECL_VINDEX for virtual clones.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/modules/pr103499_a.C: New test.
      	* g++.dg/modules/pr103499_b.C: New test.
      
      Signed-off-by: default avatarNathaniel Shead <nathanieloshead@gmail.com>
      Signed-off-by: default avatarNathan Sidwell <nathan@acm.org>
      14979dd3
    • Nathaniel Shead's avatar
      c++: Fix exported using decls of templates · 5b9ecce8
      Nathaniel Shead authored
      
      We need to look at DECL_TEMPLATE_RESULT to get the module attachment.
      
      	PR c++/106849
      
      gcc/cp/ChangeLog:
      
      	* name-lookup.cc (do_nonmember_using_decl): Handle
      	TEMPLATE_DECLs when checking module attachment.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/modules/using-9.C: New test.
      
      Signed-off-by: default avatarNathaniel Shead <nathanieloshead@gmail.com>
      Signed-off-by: default avatarNathan Sidwell <nathan@acm.org>
      5b9ecce8
    • David Malcolm's avatar
      diagnostics: make option-handling callbacks private · 353f146c
      David Malcolm authored
      
      No functional change intended.
      
      gcc/c-family/ChangeLog:
      	* c-warn.cc (conversion_warning): Update call to
      	global_dc->m_option_enabled to use option_enabled_p.
      
      gcc/cp/ChangeLog:
      	* decl.cc (finish_function): Update call to
      	global_dc->m_option_enabled to use option_enabled_p.
      
      gcc/ChangeLog:
      	* diagnostic-format-json.cc
      	(json_output_format::on_end_diagnostic): Update calls to m_context
      	callbacks to use member functions; tighten up scopes.
      	* diagnostic-format-sarif.cc (sarif_builder::make_result_object):
      	Likewise.
      	(sarif_builder::make_reporting_descriptor_object_for_warning):
      	Likewise.
      	* diagnostic.cc (diagnostic_context::initialize): Update for
      	callbacks being moved into m_option_callbacks and being renamed.
      	(diagnostic_context::set_option_hooks): New.
      	(diagnostic_option_classifier::classify_diagnostic): Update call
      	to global_dc->m_option_enabled to use option_enabled_p.
      	(diagnostic_context::print_option_information): Update calls to
      	m_context callbacks to use member functions; tighten up scopes.
      	(diagnostic_context::diagnostic_enabled): Likewise.
      	* diagnostic.h (diagnostic_option_enabled_cb): New typedef.
      	(diagnostic_make_option_name_cb): New typedef.
      	(diagnostic_make_option_url_cb): New typedef.
      	(diagnostic_context::option_enabled_p): New.
      	(diagnostic_context::make_option_name): New.
      	(diagnostic_context::make_option_url): New.
      	(diagnostic_context::set_option_hooks): New decl.
      	(diagnostic_context::m_option_enabled): Rename to
      	m_option_enabled_cb and move within m_option_callbacks, using
      	typedef.
      	(diagnostic_context::m_option_state): Move within
      	m_option_callbacks.
      	(diagnostic_context::m_option_name): Rename to
      	m_make_option_name_cb and move within m_option_callbacks, using
      	typedef.
      	(diagnostic_context::m_get_option_url): Likewise, renaming to
      	m_make_option_url_cb.
      	* lto-wrapper.cc (print_lto_docs_link): Update call to m_context
      	callback to use member function.
      	(main): Use diagnostic_context::set_option_hooks.
      	* opts-diagnostic.h (option_name): Make context param const.
      	(get_option_url): Likewise.
      	* opts.cc (option_name): Likewise.
      	(get_option_url): Likewise.
      	* toplev.cc (general_init): Use
      	diagnostic_context::set_option_hooks.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      353f146c
    • David Malcolm's avatar
      diagnostics: make m_text_callbacks private · 07e568d7
      David Malcolm authored
      
      No functional change intended.
      
      gcc/ChangeLog:
      	* diagnostic-show-locus.cc (diagnostic_context::show_locus):
      	Update for renaming of text callbacks fields.
      	* diagnostic.cc (diagnostic_context::initialize): Likewise.
      	* diagnostic.h (class diagnostic_context): Add "friend" for
      	accessors to m_text_callbacks.
      	(diagnostic_context::m_text_callbacks): Make private, and add an
      	"m_" prefix to field names.
      	(diagnostic_starter): Convert from macro to inline function.
      	(diagnostic_start_span): New.
      	(diagnostic_finalizer): Convert from macro to inline function.
      
      gcc/fortran/ChangeLog:
      	* error.cc (gfc_diagnostics_init): Use diagnostic_start_span.
      
      gcc/ChangeLog:
      	* selftest-diagnostic.cc
      	(test_diagnostic_context::test_diagnostic_context): Use
      	diagnostic_start_span.
      	* tree-diagnostic-path.cc (struct event_range): Likewise.
      
      gcc/testsuite:
      	* gcc.dg/plugin/diagnostic_group_plugin.c: Use
      	diagnostic_start_span.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      07e568d7
    • David Malcolm's avatar
      diagnostics: convert diagnostic_ready_p to an inline function · d0bfd6ba
      David Malcolm authored
      
      No functional change intended.
      
      gcc/ChangeLog:
      	* diagnostic.h (diagnostic_ready_p): Convert from macro to inline
      	function.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      d0bfd6ba
    • Uros Bizjak's avatar
      i386: Generate strict_low_part QImode insn with high input register · b42a09b2
      Uros Bizjak authored
      Following testcase:
      
      struct S1
      {
        unsigned char val;
        unsigned char pad1;
        unsigned short pad2;
      };
      
      struct S2
      {
        unsigned char pad1;
        unsigned char val;
        unsigned short pad2;
      };
      
      struct S1 test_and (struct S1 a, struct S2 b)
      {
        a.val &= b.val;
      
        return a;
      }
      
      compiles with -O2 to:
      
      	movl    %esi, %edx
      	movl    %edi, %eax
      	movzbl  %dh, %esi
      	andb    %sil, %al
      
      ANDB could use high register %dh instead of %sil:
      
      	movl    %edi, %eax
      	movl    %esi, %edx
      	andb    %dh, %al
      
      Patch introduces strict_low_part QImode insn patterns with one of
      its input arguments extracted from high register.
      
      	PR target/78904
      
      gcc/ChangeLog:
      
      	* config/i386/i386.md (*addqi_ext<mode>_1_slp):
      	New define_insn_and_split pattern.
      	(*subqi_ext<mode>_1_slp): Ditto.
      	(*<any_logic:code>qi_ext<mode>_1_slp): Ditto.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/i386/pr78904-7.c: New test.
      	* gcc.target/i386/pr78904-7a.c: New test.
      	* gcc.target/i386/pr78904-7b.c: New test.
      b42a09b2
    • Jakub Jelinek's avatar
      libcpp, contrib: Update to Unicode 15.1 · d64b7c82
      Jakub Jelinek authored
      The following patch (in plaintext just a pseudo-patch where I've left out
      the too big parts of either wget downloaded or regenerated files out with
      ..., full patch attached compressed) updates to Unicode 15.1 from 15.0
      we had last year.  Apparently Unicode forgot to add a new range to 4-8 Table
      we are using, but from the other files it is clear what should have been
      added; I've filed a bugreport against Unicode.
      
      2023-11-14  Jakub Jelinek  <jakub@redhat.com>
      
      contrib/
      	* unicode/README: Adjust glibc git commit hash, number of Unicode
      	data files to be updated and latest Unicode version.
      	* unicode/from_glibc/utf8_gen.py: Update from glibc.
      	* unicode/UnicodeData.txt: Update from Unicode 15.1.
      	* unicode/EastAsianWidth.txt: Likewise.
      	* unicode/DerivedNormalizationProps.txt: Likewise.
      	* unicode/NameAliases.txt: Likewise.
      	* unicode/DerivedCoreProperties.txt: Likewise.
      	* unicode/PropList.txt: Likewise.
      libcpp/
      	* makeucnid.cc (write_copyright): Update copyright year.
      	* makeuname2c.cc (write_copyright): Likewise.
      	(struct generated): Update latest Unicode version.
      	(generated_ranges): Add 2ebf0-2ee5d CJK UNIFIED IDEOGRAPH
      	range which was forgotten to be added to 4-8 table, but
      	clearly is expected to be there from the 15.1 additions.
      	* ucnid.h: Regenerated.
      	* uname2c.h: Regenerated.
      	* generated_cpp_wcwidth.h: Regenerated.
      d64b7c82
    • Jakub Jelinek's avatar
      c++: Implement C++26 P1854R4 - Making non-encodable string literals ill-formed [PR110341] · 194825f2
      Jakub Jelinek authored
      This paper voted in as DR makes some multi-character literals ill-formed.
      'abcd' stays valid, but e.g. 'á' is newly invalid in UTF-8 exec charset
      while valid e.g. in ISO-8859-1, because it is a single character which needs
      2 bytes to be encoded.
      
      The following patch does that by checking (only pedantically, especially
      because it is a DR) if we'd emit a -Wmultichar warning because character
      constant has more than one byte in it whether the number of source characters
      is equal to the number of bytes in the multichar string.
      If it is, it is normal multi-character literal constant
      and is diagnosed normally with -Wmultichar, otherwise at least one of the
      c-chars in the sequence was encoded as 2+ bytes.
      
      2023-11-14  Jakub Jelinek  <jakub@redhat.com>
      
      	PR c++/110341
      libcpp/
      	* charset.cc: Implement C++26 P1854R4 - Making non-encodable string
      	literals ill-formed.
      	(one_count_chars, convert_count_chars, count_source_chars): New
      	functions.
      	(narrow_str_to_charconst): Change last arg type from cpp_ttype to
      	const cpp_token *.  For C++ if pedantic and i > 1 in CPP_CHAR
      	interpret token also as CPP_STRING32 and if number of characters
      	in the CPP_STRING32 is larger than number of bytes in CPP_CHAR,
      	pedwarn on it.  Make the diagnostics more detailed.
      	(wide_str_to_charconst): Change last arg type from cpp_ttype to
      	const cpp_token *.  Make the diagnostics more detailed.
      	(cpp_interpret_charconst): Adjust narrow_str_to_charconst and
      	wide_str_to_charconst callers.
      gcc/testsuite/
      	* g++.dg/cpp26/literals1.C: New test.
      	* g++.dg/cpp26/literals2.C: New test.
      	* g++.dg/cpp23/wchar-multi1.C: Adjust expected diagnostic wordings.
      	* g++.dg/cpp23/wchar-multi2.C: Likewise.
      	* gcc.dg/c23-utf8char-3.c: Likewise.
      	* gcc.dg/cpp/charconst-4.c: Likewise.
      	* gcc.dg/cpp/charconst.c: Likewise.
      	* gcc.dg/cpp/if-2.c: Likewise.
      	* gcc.dg/utf16-4.c: Likewise.
      	* gcc.dg/utf32-4.c: Likewise.
      	* g++.dg/cpp1z/utf8-neg.C: Likewise.
      	* g++.dg/cpp2a/ucn2.C: Likewise.
      	* g++.dg/ext/utf16-4.C: Likewise.
      	* g++.dg/ext/utf32-4.C: Likewise.
      194825f2
    • Andrew Stubbs's avatar
      Fix ICE generating uniform vector masks · 948b8b6e
      Andrew Stubbs authored
      Most targets have an "and" instructions for their vector mask size, but RISC-V
      only has DImode "and".  Fixed by allowing wider instruction modes.
      
      gcc/ChangeLog:
      
      	PR target/112481
      	* expr.cc (store_constructor): Use OPTAB_WIDEN for mask adjustment.
      948b8b6e
    • David Malcolm's avatar
      input.h: eliminate implicit users of global_dc's file_cache · 1bdd665a
      David Malcolm authored
      
      This patch eliminates the following functions that implicitly used
      global_dc's file cache:
      
        extern char_span location_get_source_line (const char *file_path, int line);
        extern char_span get_source_file_content (const char *file_path);
        extern bool location_missing_trailing_newline (const char *file_path);
      
      in favor of explicitly using a specific file_cache throughout, and only
      using global_dc's file_cache in gcc-specific code.
      
      Rather than creating global_dc's file_cache the first time its needed,
      this patch simply creates one when a diagnostic_context is initialized,
      and eliminates diagnostic_file_cache_init.
      
      No functional change intended.
      
      gcc/c-family/ChangeLog:
      	* c-common.cc (c_get_substring_location): Use global_dc's
      	file_cache.
      	* c-format.cc (get_corrected_substring): Likewise.
      	* c-indentation.cc (get_visual_column): Add file_cache param.
      	(get_first_nws_vis_column): Likewise.
      	(detect_intervening_unindent): Likewise.
      	(should_warn_for_misleading_indentation): Use global_dc's
      	file_cache.
      	(assert_get_visual_column_succeeds): Add file_cache param.
      	(ASSERT_GET_VISUAL_COLUMN_SUCCEEDS): Likewise.
      	(assert_get_visual_column_fails): Likewise.
      	(define ASSERT_GET_VISUAL_COLUMN_FAILS): Likewise.
      	(selftest::test_get_visual_column): Create and use a temporary
      	file_cache.
      
      gcc/cp/ChangeLog:
      	* contracts.cc (build_comment): Use global_dc's file_cache.
      
      gcc/ChangeLog:
      	* diagnostic-format-sarif.cc (sarif_builder::get_sarif_column):
      	Use m_context's file_cache.
      	(sarif_builder::maybe_make_artifact_content_object): Likewise.
      	(sarif_builder::get_source_lines): Likewise.
      	* diagnostic-show-locus.cc
      	(exploc_with_display_col::exploc_with_display_col): Add file_cache
      	param.
      	(layout::m_file_cache): New field.
      	(make_range): Add file_cache param.
      	(selftest::test_layout_range_for_single_point): Create and use a
      	temporary file_cache.
      	(selftest::test_layout_range_for_single_line): Likewise.
      	(selftest::test_layout_range_for_multiple_lines): Likewise.
      	(layout::layout): Initialize m_file_cache from the context and use it.
      	(layout::maybe_add_location_range): Use m_file_cache.
      	(layout::calculate_x_offset_display): Likewise.
      	(get_affected_range): Add file_cache param.
      	(get_printed_columns): Likewise.
      	(line_corrections::line_corrections): Likewwise.
      	(line_corrections::m_file_cache): New field.
      	(source_line::source_line): Add file_cache param.
      	(line_corrections::add_hint): Use m_file_cache.
      	(layout::print_trailing_fixits): Likewise.
      	(layout::print_line): Likewise.
      	(selftest::test_layout_x_offset_display_utf8): Create and use a
      	temporary file_cache.
      	(selftest::test_layout_x_offset_display_tab): Likewise.
      	(selftest::test_diagnostic_show_locus_one_liner_utf8): Likewise.
      	(selftest::test_add_location_if_nearby): Pass global_dc's
      	file_cache to temp_source_file ctor.
      	(selftest::test_overlapped_fixit_printing): Create and use a
      	temporary file_cache.
      	(selftest::test_overlapped_fixit_printing_utf8): Likewise.
      	(selftest::test_overlapped_fixit_printing_2): Use dc's file_cache.
      	* diagnostic.cc (diagnostic_context::initialize): Always create a
      	file_cache.
      	(diagnostic_context::initialize_input_context): Assume
      	m_file_cache has already been created.
      	(diagnostic_context::create_edit_context): Pass m_file_cache to
      	edit_context.
      	(convert_column_unit): Add file_cache param.
      	(diagnostic_context::converted_column): Use context's file_cache.
      	(print_parseable_fixits): Add file_cache param.
      	(diagnostic_context::report_diagnostic): Use context's file_cache.
      	(selftest::test_print_parseable_fixits_none): Create and use a
      	temporary file_cache.
      	(selftest::test_print_parseable_fixits_insert): Likewise.
      	(selftest::test_print_parseable_fixits_remove): Likewise.
      	(selftest::test_print_parseable_fixits_replace): Likewise.
      	(selftest::test_print_parseable_fixits_bytes_vs_display_columns):
      	Likewise.
      	* diagnostic.h (diagnostic_context::file_cache_init): Delete.
      	(diagnostic_context::get_file_cache): Convert return type from
      	pointer to reference.
      	* edit-context.cc (edited_file::get_file_cache): New.
      	(edited_file::m_edit_context): New.
      	(edit_context::edit_context): Add file_cache param.
      	(edit_context::get_or_insert_file): Pass this to edited_file's
      	ctor.
      	(edited_file::edited_file): Add edit_context param.
      	(edited_file::print_content): Use get_file_cache.
      	(edited_file::print_diff_hunk): Likewise.
      	(edited_file::print_run_of_changed_lines): Likewise.
      	(edited_file::get_or_insert_line): Likewise.
      	(edited_file::get_num_lines): Likewise.
      	(edited_line::edited_line): Pass in file_cache and use it.
      	(selftest::test_get_content): Create and use a
      	temporary file_cache.
      	(selftest::test_applying_fixits_insert_before): Likewise.
      	(selftest::test_applying_fixits_insert_after): Likewise.
      	(selftest::test_applying_fixits_insert_after_at_line_end):
      	Likewise.
      	(selftest::test_applying_fixits_insert_after_failure): Likewise.
      	(selftest::test_applying_fixits_insert_containing_newline):
      	Likewise.
      	(selftest::test_applying_fixits_growing_replace): Likewise.
      	(selftest::test_applying_fixits_shrinking_replace): Likewise.
      	(selftest::test_applying_fixits_replace_containing_newline):
      	Likewise.
      	(selftest::test_applying_fixits_remove): Likewise.
      	(selftest::test_applying_fixits_multiple): Likewise.
      	(selftest::test_applying_fixits_multiple_lines): Likewise.
      	(selftest::test_applying_fixits_modernize_named_init): Likewise.
      	(selftest::test_applying_fixits_modernize_named_init): Likewise.
      	(selftest::test_applying_fixits_unreadable_file): Likewise.
      	(selftest::test_applying_fixits_line_out_of_range): Likewise.
      	(selftest::test_applying_fixits_column_validation): Likewise.
      	(selftest::test_applying_fixits_column_validation): Likewise.
      	(selftest::test_applying_fixits_column_validation): Likewise.
      	(selftest::test_applying_fixits_column_validation): Likewise.
      	* edit-context.h (edit_context::edit_context): Add file_cache
      	param.
      	(edit_context::get_file_cache): New.
      	(edit_context::m_file_cache): New.
      	* final.cc: Include "diagnostic.h".
      	(asm_show_source): Use global_dc's file_cache.
      	* gcc-rich-location.cc (blank_line_before_p): Add file_cache
      	param.
      	(use_new_line): Likewise.
      	(gcc_rich_location::add_fixit_insert_formatted): Use global dc's
      	file_cache.
      	* input.cc (diagnostic_file_cache_init): Delete.
      	(diagnostic_context::file_cache_init): Delete.
      	(diagnostics_file_cache_forcibly_evict_file): Delete.
      	(file_cache::missing_trailing_newline_p): New.
      	(file_cache::evicted_cache_tab_entry): Don't call
      	diagnostic_file_cache_init.
      	(location_get_source_line): Delete.
      	(get_source_text_between): Add file_cache param.
      	(get_source_file_content): Delete.
      	(location_missing_trailing_newline): Delete.
      	(location_compute_display_column): Add file_cache param.
      	(dump_location_info): Create and use temporary file_cache.
      	(get_substring_ranges_for_loc): Add file_cache param.
      	(get_location_within_string): Likewise.
      	(get_source_range_for_char): Likewise.
      	(get_num_source_ranges_for_substring): Likewise.
      	(selftest::test_reading_source_line): Create and use temporary
      	file_cache.
      	(selftest::lexer_test::m_file_cache): New field.
      	(selftest::assert_char_at_range): Use test.m_file_cache.
      	(selftest::assert_num_substring_ranges): Likewise.
      	(selftest::assert_has_no_substring_ranges): Likewise.
      	(selftest::test_lexer_string_locations_concatenation_2): Likewise.
      	* input.h (class file_cache): New forward decl.
      	(location_compute_display_column): Add file_cache param.
      	(location_get_source_line): Delete.
      	(get_source_text_between): Add file_cache param.
      	(get_source_file_content): Delete.
      	(location_missing_trailing_newline): Delete.
      	(file_cache::missing_trailing_newline_p): New decl.
      	(diagnostics_file_cache_forcibly_evict_file): Delete.
      	* selftest.cc (named_temp_file::named_temp_file): Add file_cache
      	param.
      	(named_temp_file::~named_temp_file): Optionally evict the file
      	from the given file_cache.
      	(temp_source_file::temp_source_file): Add file_cache param.
      	* selftest.h (class file_cache): New forward decl.
      	(named_temp_file::named_temp_file): Add file_cache param.
      	(named_temp_file::m_file_cache): New field.
      	(temp_source_file::temp_source_file): Add file_cache param.
      	* substring-locations.h (get_location_within_string): Add
      	file_cache param.
      
      gcc/testsuite/ChangeLog:
      	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: Use
      	global_dc's file cache.
      	* gcc.dg/plugin/expensive_selftests_plugin.c: Likewise.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      1bdd665a
    • David Malcolm's avatar
      json: reduce use of naked new in json-building code · 070944fd
      David Malcolm authored
      
      No functional change intended.
      
      gcc/ChangeLog:
      	* diagnostic-format-json.cc: Use type-specific "set_*" functions
      	of json::object to avoid naked new of json value subclasses.
      	* diagnostic-format-sarif.cc: Likewise.
      	* gcov.cc: Likewise.
      	* json.cc (object::set_string): New.
      	(object::set_integer): New.
      	(object::set_float): New.
      	(object::set_bool): New.
      	(selftest::test_writing_objects): Use object::set_string.
      	* json.h (object::set_string): New decl.
      	(object::set_integer): New decl.
      	(object::set_float): New decl.
      	(object::set_bool): New decl.
      	* optinfo-emit-json.cc: Use type-specific "set_*" functions of
      	json::object to avoid naked new of json value subclasses.
      	* timevar.cc: Likewise.
      	* tree-diagnostic-path.cc: Likewise.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      070944fd
    • Jonathan Wakely's avatar
      libstdc++: Fix std::deque::size() Xmethod [PR112491] · 4db82092
      Jonathan Wakely authored
      The Xmethod for std::deque::size() assumed that the first element would
      be at the start of the first node. That's only true if elements are only
      added at the back. If an element is inserted at the front, or removed
      from the front (or anywhere before the middle) then the first node will
      not be completely populated, and the Xmethod will give the wrong result.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/112491
      	* python/libstdcxx/v6/xmethods.py (DequeWorkerBase.size): Fix
      	calculation to use _M_start._M_cur.
      	* testsuite/libstdc++-xmethods/deque.cc: Check failing cases.
      4db82092
    • Andrew MacLeod's avatar
      Use case label type to create case range. · 8f331be4
      Andrew MacLeod authored
      Create a range from the label type, and cast it to the required type.
      
      	PR tree-optimization/112509
      	gcc/
      	* tree-vrp.cc (find_case_label_range): Create range from case labels.
      
      	gcc/testsuite/
      	* gcc.dg/pr112509.c: New.
      8f331be4
    • Stefan Schulze Frielinghaus's avatar
      s390: Fix vec_scatter_element for vectors of floats · 2c2fcd6d
      Stefan Schulze Frielinghaus authored
      The offset for vec_scatter_element of floats should be a vector of type
      UV4SI instead of V4SF.  Note, this is an incompatibility change.
      
      gcc/ChangeLog:
      
      	* config/s390/s390-builtin-types.def: Add/remove types.
      	* config/s390/s390-builtins.def (s390_vec_scatter_element_flt):
      	The type for the offset should be UV4SI instead of V4SF.
      2c2fcd6d
    • Saurabh Jha's avatar
      Add a REG_P check for inc and dec for Arm MVE · ddb479e7
      Saurabh Jha authored
      This patch tightens mve_vector_mem_operand to reject non-register operands inside {PRE,POST}_{INC,DEC} addresses by introducing a REG_P check.
      
      This patch fixes this ICE:https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112337
      
      gcc/ChangeLog:
      
      	PR target/112337
      	* config/arm/arm.cc (mve_vector_mem_operand): Add a REG_P check for INC
      	and DEC operations.
      
      gcc/testsuite/ChangeLog:
      
      	PR target/112337
      	* gcc.target/arm/mve/pr112337.c: Test for REG_P check for INC and DEC
      	operations.
      ddb479e7
Loading