Skip to content
Snippets Groups Projects
  1. Jul 18, 2023
    • Ju-Zhe Zhong's avatar
      RISC-V: Bugfix for riscv-vsetvl pass. · a1322d76
      Ju-Zhe Zhong authored
      This patch comes from part of below change, which locate one bug of rvv
      vsetvel pass when auto-vectorization.
      
      https://gcc.gnu.org/pipermail/gcc-patches/2023-July/624523.html
      
      
      
      Unforunately, It is not easy to reproduce this bug by intrinsic APIs
      but it is worth to backport to GCC 13.
      
      Signed-off-by: default avatarJu-Zhe Zhong <juzhe.zhong@rivai.ai>
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vsetvl.cc (gen_vsetvl_pat): Add vl parameter.
      	(change_vsetvl_insn): Ditto.
      	(change_insn): Add validate change as well as assert.
      	(pass_vsetvl::backward_demand_fusion): Allow forward.
      a1322d76
    • Jonathan Wakely's avatar
      libstdc++: Fix std::__uninitialized_default_n for constant evaluation [PR110542] · a32d4a34
      Jonathan Wakely authored
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/110542
      	* include/bits/stl_uninitialized.h (__uninitialized_default_n):
      	Do not use std::fill_n during constant evaluation.
      
      (cherry picked from commit 83cae6c4)
      a32d4a34
    • Jonathan Wakely's avatar
      libstdc++: Implement P2538R1 ADL-proof std::projected · d96e4962
      Jonathan Wakely authored
      This was recently approved for C++26, but there's no harm in
      implementing it unconditionally for C++20 and C++23. As it says in the
      paper, it doesn't change the meaning of any valid code. It only enables
      things that were previously ill-formed for questionable reasons.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/iterator_concepts.h (projected): Replace class
      	template with alias template denoting an ADL-proofed helper.
      	(incremental_traits<projected<Iter, Proj>>): Remove.
      	* testsuite/24_iterators/indirect_callable/projected-adl.cc:
      	New test.
      
      (cherry picked from commit 6eafdfc7)
      d96e4962
    • Jonathan Wakely's avatar
      libstdc++: Fix --enable-cstdio=stdio_pure [PR110574] · 5342e3cc
      Jonathan Wakely authored
      When configured with --enable-cstdio=stdio_pure we need to consistently
      use fseek and not mix seeks on the file descriptor with reads and writes
      on the FILE stream.
      
      There are also a number of bugs related to error handling and return
      values, because fread and fwrite return 0 on error, not -1, and fseek
      returns 0 on success, not the file offset.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/110574
      	* acinclude.m4 (GLIBCXX_CHECK_LFS): Check for fseeko and ftello
      	and define _GLIBCXX_USE_FSEEKO_FTELLO.
      	* config.h.in: Regenerate.
      	* configure: Regenerate.
      	* config/io/basic_file_stdio.cc (xwrite) [_GLIBCXX_USE_STDIO_PURE]:
      	Check for fwrite error correctly.
      	(__basic_file<char>::xsgetn) [_GLIBCXX_USE_STDIO_PURE]: Check for
      	fread error correctly.
      	(get_file_offset): New function.
      	(__basic_file<char>::seekoff) [_GLIBCXX_USE_STDIO_PURE]: Use
      	fseeko if available. Use get_file_offset instead of return value
      	of fseek.
      	(__basic_file<char>::showmanyc): Use get_file_offset.
      
      (cherry picked from commit 2f6bbc9a)
      5342e3cc
    • Tianqiang Shuai's avatar
      libstdc++: Fix fwrite error parameter · c9da7491
      Tianqiang Shuai authored
      The first parameter of fwrite should be the const char* __s which want
      write to FILE *__file, rather than the FILE *__file write to the FILE
      *__file.
      
      libstdc++-v3/ChangeLog:
      
      	* config/io/basic_file_stdio.cc (xwrite) [USE_STDIO_PURE]: Fix
      	first argument.
      
      (cherry picked from commit bb4f8f14)
      c9da7491
    • Jonathan Wakely's avatar
      libstdc++: Disable std::forward_list tests for C++98 mode · 813722fb
      Jonathan Wakely authored
      These tests fail with -std=gnu++98/-D_GLIBCXX_DEBUG in the runtest
      flags. They should require the c++11 effective target.
      
      libstdc++-v3/ChangeLog:
      
      	* testsuite/23_containers/forward_list/debug/iterator1_neg.cc:
      	Skip as UNSUPPORTED for C++98 mode.
      	* testsuite/23_containers/forward_list/debug/iterator3_neg.cc:
      	Likewise.
      
      (cherry picked from commit cd9964b7)
      813722fb
    • Jonathan Wakely's avatar
      libstdc++: Fix <iosfwd> synopsis test · d2c737c4
      Jonathan Wakely authored
      The <syncstream> header is only supported for the cxx11 ABI. The
      declarations of basic_syncbuf, basic_osyncstream, syncbuf and
      osyncstream were already correctly guarded by a check for
      _GLIBCXX_USE_CXX11_ABI, but the wsyncbuf and wosyncstream declarations
      were not.
      
      libstdc++-v3/ChangeLog:
      
      	* testsuite/27_io/headers/iosfwd/synopsis.cc: Make wsyncbuf and
      	wosyncstream depend on _GLIBCXX_USE_CXX11_ABI.
      
      (cherry picked from commit f9f05e48)
      d2c737c4
    • Jonathan Wakely's avatar
      libstdc++: Fix src/c++20/tzdb.cc for non-constexpr std::mutex · c17539d7
      Jonathan Wakely authored
      Building libstdc++ reportedly fails for targets without lock-free
      std::atomic<T*> which don't define __GTHREAD_MUTEX_INIT:
      
      src/c++20/tzdb.cc:110:21: error: 'constinit' variable 'std::chrono::{anonymous}::list_mutex' does not have a constant initializer
      src/c++20/tzdb.cc:110:21: error: call to non-'constexpr' function 'std::mutex::mutex()'
      
      The solution implemented by this commit is to use a local static mutex
      when it can't be constinit, so that it's constructed on first use.
      
      With this change, we can also simplify the preprocessor logic for
      defining USE_ATOMIC_SHARED_PTR. It now depends on the same conditions as
      USE_ATOMIC_LIST_HEAD, so in theory we could have a single macro. Keeping
      them separate would allow us to replace the use of atomic<shared_ptr<T>>
      with a mutex if that performs better, without having to give up on the
      lock-free cache for fast access to the list head.
      
      libstdc++-v3/ChangeLog:
      
      	* src/c++20/tzdb.cc (USE_ATOMIC_SHARED_PTR): Define consistently
      	with USE_ATOMIC_LIST_HEAD.
      	(list_mutex): Replace global object with function. Use local
      	static object when std::mutex constructor isn't constexpr.
      
      (cherry picked from commit 5dfdf0ae)
      c17539d7
    • Jonathan Wakely's avatar
      libstdc++: Qualify calls to std::_Destroy and _Destroy_aux · dae96358
      Jonathan Wakely authored
      These calls should be qualified to prevent ADL, which can cause errors
      for incomplete types that are associated classes.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/alloc_traits.h (_Destroy): Qualify call.
      	* include/bits/stl_construct.h (_Destroy, _Destroy_n): Likewise.
      	* testsuite/23_containers/vector/cons/destroy-adl.cc: New test.
      
      (cherry picked from commit 33245d6b)
      dae96358
    • Jonathan Wakely's avatar
      libstdc++: Qualify calls to debug mode helpers · 5439234b
      Jonathan Wakely authored
      These functions should be qualified to disable unwanted ADL.
      
      The overload of __check_singular_aux for safe iterators was previously
      being found by ADL, because it wasn't declared before __check_singular.
      Add a declaration so that it can be found by qualified lookup.
      
      libstdc++-v3/ChangeLog:
      
      	* include/debug/helper_functions.h (__get_distance)
      	(__check_singular, __valid_range_aux, __valid_range): Qualify
      	calls to disable ADL.
      	(__check_singular_aux(const _Safe_iterator_base*)): Declare
      	overload that was previously found via ADL.
      
      (cherry picked from commit fa98bc42)
      5439234b
    • GCC Administrator's avatar
      Daily bump. · 2b4ca304
      GCC Administrator authored
      2b4ca304
  2. Jul 17, 2023
    • Patrick Palka's avatar
      c++: mangling template-id of unknown template [PR110524] · 04e88088
      Patrick Palka authored
      This fixes a crash when mangling an ADL-enabled call to a template-id
      naming an unknown template (as per P0846R0).
      
      	PR c++/110524
      
      gcc/cp/ChangeLog:
      
      	* mangle.cc (write_expression): Handle TEMPLATE_ID_EXPR
      	whose template is already an IDENTIFIER_NODE.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp2a/fn-template26.C: New test.
      
      (cherry picked from commit 97ceaa11)
      04e88088
    • Richard Biener's avatar
      tree-optimization/110669 - bogus matching of loop bitop · b8a15313
      Richard Biener authored
      The matching code lacked a check that we end up with a PHI node
      in the loop header.  This caused us to match a random PHI argument
      now catched by the extra PHI_ARG_DEF_FROM_EDGE checking.
      
      	PR tree-optimization/110669
      	* tree-scalar-evolution.cc (analyze_and_compute_bitop_with_inv_effect):
      	Check we matched a header PHI.
      
      	* gcc.dg/torture/pr110669.c: New testcase.
      b8a15313
    • GCC Administrator's avatar
      Daily bump. · 95338c0d
      GCC Administrator authored
      95338c0d
  3. Jul 16, 2023
  4. Jul 15, 2023
  5. Jul 14, 2023
    • Uros Bizjak's avatar
      cprop: Do not set REG_EQUAL note when simplifying paradoxical subreg [PR110206] · bef95ba0
      Uros Bizjak authored
      cprop1 pass does not consider paradoxical subreg and for (insn 22) claims
      that it equals 8 elements of HImodeby setting REG_EQUAL note:
      
      (insn 21 19 22 4 (set (reg:V4QI 98)
              (mem/u/c:V4QI (symbol_ref/u:DI ("*.LC1") [flags 0x2]) [0  S4 A32])) "pr110206.c":12:42 1530 {*movv4qi_internal}
           (expr_list:REG_EQUAL (const_vector:V4QI [
                      (const_int -52 [0xffffffffffffffcc]) repeated x4
                  ])
              (nil)))
      (insn 22 21 23 4 (set (reg:V8HI 100)
              (zero_extend:V8HI (vec_select:V8QI (subreg:V16QI (reg:V4QI 98) 0)
                      (parallel [
                              (const_int 0 [0])
                              (const_int 1 [0x1])
                              (const_int 2 [0x2])
                              (const_int 3 [0x3])
                              (const_int 4 [0x4])
                              (const_int 5 [0x5])
                              (const_int 6 [0x6])
                              (const_int 7 [0x7])
                          ])))) "pr110206.c":12:42 7471 {sse4_1_zero_extendv8qiv8hi2}
           (expr_list:REG_EQUAL (const_vector:V8HI [
                      (const_int 204 [0xcc]) repeated x8
                  ])
              (expr_list:REG_DEAD (reg:V4QI 98)
                  (nil))))
      
      We rely on the "undefined" vals to have a specific value (from the earlier
      REG_EQUAL note) but actual code generation doesn't ensure this (it doesn't
      need to).  That said, the issue isn't the constant folding per-se but that
      we do not actually constant fold but register an equality that doesn't hold.
      
      	PR target/110206
      
      gcc/ChangeLog:
      
      	* fwprop.cc (contains_paradoxical_subreg_p): Move to ...
      	* rtlanal.cc (contains_paradoxical_subreg_p): ... here.
      	* rtlanal.h (contains_paradoxical_subreg_p): Add prototype.
      	* cprop.cc (try_replace_reg): Do not set REG_EQUAL note
      	when the original source contains a paradoxical subreg.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/i386/pr110206.c: New test.
      
      (cherry picked from commit 1815e313)
      bef95ba0
    • Harald Anlauf's avatar
      Fortran: formal symbol attributes for intrinsic procedures [PR110288] · 447dd292
      Harald Anlauf authored
      gcc/fortran/ChangeLog:
      
      	PR fortran/110288
      	* symbol.cc (gfc_copy_formal_args_intr): When deriving the formal
      	argument attributes from the actual ones for intrinsic procedure
      	calls, take special care of CHARACTER arguments that we do not
      	wrongly treat them formally as deferred-length.
      
      gcc/testsuite/ChangeLog:
      
      	PR fortran/110288
      	* gfortran.dg/findloc_10.f90: New test.
      
      (cherry picked from commit 3b2c523a)
      447dd292
    • Oleg Endo's avatar
      SH: Fix PR101469 peephole bug · ef4b6d29
      Oleg Endo authored
      gcc/ChangeLog:
      
      	PR target/101469
      	* config/sh/sh.md (peephole2): Handle case where eliminated reg
      	is also	used by the address of the following memory operand.
      ef4b6d29
    • GCC Administrator's avatar
      Daily bump. · e365ddcd
      GCC Administrator authored
      e365ddcd
  6. Jul 13, 2023
  7. Jul 12, 2023
    • Jonathan Wakely's avatar
      libstdc++: Check conversion from filesystem::path to wide strings [PR95048] · db179779
      Jonathan Wakely authored
      The testcase added for this bug only checks conversion from wide strings
      on construction, but the fix also covered conversion to wide strings via
      path::wstring(). Add checks for that, and u16string() and u32string().
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/95048
      	* testsuite/27_io/filesystem/path/construct/95048.cc: Check
      	conversions to wide strings.
      	* testsuite/experimental/filesystem/path/construct/95048.cc:
      	Likewise.
      
      (cherry picked from commit d6384ad1)
      db179779
    • Mo, Zewei's avatar
      Initial Granite Rapids D Support · 037907c1
      Mo, Zewei authored
      gcc/ChangeLog:
      
      	* common/config/i386/cpuinfo.h
      	(get_intel_cpu): Handle Granite Rapids D.
      	* common/config/i386/i386-common.cc:
      	(processor_alias_table): Add graniterapids-d.
      	* common/config/i386/i386-cpuinfo.h
      	(enum processor_subtypes): Add INTEL_COREI7_GRANITERAPIDS_D.
      	* config.gcc: Add -march=graniterapids-d.
      	* config/i386/driver-i386.cc (host_detect_local_cpu):
      	Handle graniterapids-d.
      	* config/i386/i386.h: (PTA_GRANITERAPIDS_D): New.
      	* doc/extend.texi: Add graniterapids-d.
      	* doc/invoke.texi: Ditto.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.target/i386/mv16.C: Add graniterapids-d.
      	* gcc.target/i386/funcspec-56.inc: Handle new march.
      037907c1
    • GCC Administrator's avatar
      Daily bump. · c1584003
      GCC Administrator authored
      c1584003
  8. Jul 11, 2023
  9. Jul 10, 2023
    • Xi Ruoyao's avatar
      vect: Fix vectorized BIT_FIELD_REF for signed bit-fields [PR110557] · 1e6a948c
      Xi Ruoyao authored
      If a bit-field is signed and it's wider than the output type, we must
      ensure the extracted result sign-extended.  But this was not handled
      correctly.
      
      For example:
      
          int x : 8;
          long y : 55;
          bool z : 1;
      
      The vectorized extraction of y was:
      
          vect__ifc__49.29_110 =
            MEM <vector(2) long unsigned int> [(struct Item *)vectp_a.27_108];
          vect_patt_38.30_112 =
            vect__ifc__49.29_110 & { 9223372036854775552, 9223372036854775552 };
          vect_patt_39.31_113 = vect_patt_38.30_112 >> 8;
          vect_patt_40.32_114 =
            VIEW_CONVERT_EXPR<vector(2) long int>(vect_patt_39.31_113);
      
      This is obviously incorrect.  This pach has implemented it as:
      
          vect__ifc__25.16_62 =
            MEM <vector(2) long unsigned int> [(struct Item *)vectp_a.14_60];
          vect_patt_31.17_63 =
            VIEW_CONVERT_EXPR<vector(2) long int>(vect__ifc__25.16_62);
          vect_patt_32.18_64 = vect_patt_31.17_63 << 1;
          vect_patt_33.19_65 = vect_patt_32.18_64 >> 9;
      
      gcc/ChangeLog:
      
      	PR tree-optimization/110557
      	* tree-vect-patterns.cc (vect_recog_bitfield_ref_pattern):
      	Ensure the output sign-extended if necessary.
      
      gcc/testsuite/ChangeLog:
      
      	PR tree-optimization/110557
      	* g++.dg/vect/pr110557.cc: New test.
      
      (cherry picked from commit 63ae6bc6)
      1e6a948c
    • GCC Administrator's avatar
      Daily bump. · f9781fcf
      GCC Administrator authored
      f9781fcf
  10. Jul 09, 2023
  11. Jul 08, 2023
  12. Jul 07, 2023
    • Iain Buclaw's avatar
      d: Fix PR 108842: Cannot use enum array with -fno-druntime · acd679a7
      Iain Buclaw authored
      Restrict the generating of CONST_DECLs for D manifest constants to just
      scalars without pointers.  It shouldn't happen that a reference to a
      manifest constant has not been expanded within a function body during
      codegen, but it has been found to occur in older versions of the D
      front-end (PR98277), so if the decl of a non-scalar constant is
      requested, just return its initializer as an expression.
      
      	PR d/108842
      
      gcc/d/ChangeLog:
      
      	* decl.cc (DeclVisitor::visit (VarDeclaration *)): Only emit scalar
      	manifest constants.
      	(get_symbol_decl): Don't generate CONST_DECL for non-scalar manifest
      	constants.
      	* imports.cc (ImportVisitor::visit (VarDeclaration *)): New method.
      
      gcc/testsuite/ChangeLog:
      
      	* gdc.dg/pr98277.d: Add more tests.
      	* gdc.dg/pr108842.d: New test.
      
      (cherry picked from commit f934c575)
      acd679a7
    • Richard Biener's avatar
      tree-optimization/110556 - tail merging still pre-tuples · 45e950b5
      Richard Biener authored
      The stmt comparison function for GIMPLE_ASSIGNs for tail merging
      still looks like it deals with pre-tuples IL.  The following
      attempts to fix this, not only comparing the first operand (sic!)
      of stmts but all of them plus also compare the operation code.
      
      	PR tree-optimization/110556
      	* tree-ssa-tail-merge.cc (gimple_equal_p): Check
      	assign code and all operands of non-stores.
      
      	* gcc.dg/torture/pr110556.c: New testcase.
      
      (cherry picked from commit 7b16686e)
      45e950b5
    • Richard Biener's avatar
      tree-optimization/110515 - wrong code with LIM + PRE · 0d20f9db
      Richard Biener authored
      In this PR we face the issue that LIM speculates a load when
      hoisting it out of the loop (since it knows it cannot trap).
      Unfortunately this exposes undefined behavior when the load
      accesses memory with the wrong dynamic type.  This later
      makes PRE use that representation instead of the original
      which accesses the same memory location but using a different
      dynamic type leading to a wrong disambiguation of that
      original access against another and thus a wrong-code transform.
      
      Fortunately there already is code in PRE dealing with a similar
      situation for code hoisting but that left a small gap which
      when fixed also fixes the wrong-code transform in this bug even
      if it doesn't address the underlying issue of LIM speculating
      that load.
      
      The upside is this fix is trivially safe to backport and chances
      of code generation regressions are very low.
      
      	PR tree-optimization/110515
      	* tree-ssa-pre.cc (compute_avail): Make code dealing
      	with hoisting loads with different alias-sets more
      	robust.
      
      	* g++.dg/opt/pr110515.C: New testcase.
      
      (cherry picked from commit 9f4f8334)
      0d20f9db
    • Richard Biener's avatar
      tree-optimization/110392 - ICE with predicate analysis · 980666fb
      Richard Biener authored
      Feeding not optimized IL can result in predicate normalization
      to simplify things so a predicate can get true or false.  The
      following re-orders the early exit in that case to come after
      simplification and normalization to take care of that.
      
      	PR tree-optimization/110392
      	* gimple-predicate-analysis.cc (uninit_analysis::is_use_guarded):
      	Do early exits on true/false predicate only after normalization.
      
      (cherry picked from commit ab6eac20)
      980666fb
    • Richard Biener's avatar
      tree-optimization/110381 - preserve SLP permutation with in-order reductions · 32c7f05f
      Richard Biener authored
      The following fixes a bug that manifests itself during fold-left
      reduction transform in picking not the last scalar def to replace
      and thus double-counting some elements.  But the underlying issue
      is that we merge a load permutation into the in-order reduction
      which is of course wrong.
      
      Now, reduction analysis has not yet been performend when optimizing
      permutations so we have to resort to check that ourselves.
      
      	PR tree-optimization/110381
      	* tree-vect-slp.cc (vect_optimize_slp_pass::start_choosing_layouts):
      	Materialize permutes before fold-left reductions.
      
      	* gcc.dg/vect/pr110381.c: New testcase.
      
      (cherry picked from commit 53d6f57c)
      32c7f05f
    • Li Xu's avatar
      RISC-V: Fix local_eliminate_vsetvl_insn bug in VSETVL PASS[PR target/110560] · 857d763e
      Li Xu authored
      This patch fixes this issue happens on GCC-13.
      https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110560
      
      This patch should be backported to GCC-13.
      GCC-14 has rewritten this function, so there is no issue.
      
      gcc/ChangeLog:
      
      	PR target/110560
      	* config/riscv/riscv-vsetvl.cc (local_eliminate_vsetvl_insn): Fix bug.
      857d763e
Loading