Skip to content
Snippets Groups Projects
  1. Sep 27, 2024
  2. Sep 26, 2024
    • Jonathan Wakely's avatar
      libstdc++: Add missing 'inline' to always_inline function · 48e1b89f
      Jonathan Wakely authored
      This fixes a -Wattributes warning for the COW std::string which was
      previously suppressed due to being in a system header.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/cow_string.h (__resize_for_overwrite): Add
      	inline keyword to function with always_inline attribute.
      48e1b89f
    • Nathaniel Shead's avatar
      libgcc, libstdc++: Make declarations no longer TU-local [PR115126] · 6a4d1c37
      Nathaniel Shead authored
      
      In C++20, modules streaming check for exposures of TU-local entities.
      In general exposing internal linkage functions in a header is liable to
      cause ODR violations in C++, and this is now detected in a module
      context.
      
      This patch goes through and removes 'static' from many declarations
      exposed through libstdc++ to prevent code like the following from
      failing:
      
        export module M;
        extern "C++" {
          #include <bits/stdc++.h>
        }
      
      Since gthreads is used from C as well, we need to choose whether to use
      'inline' or 'static inline' depending on whether we're compiling for C
      or C++ (since the semantics of 'inline' are different between the
      languages).  Additionally we need to remove static global variables, so
      we migrate these to function-local statics to avoid the ODR issues.
      
      There doesn't seem to be a good workaround for weakrefs, so I've left
      them as-is and will work around it in the modules streaming code to
      consider them as not TU-local.
      
      The same issue occurs in the objective-C specific parts of gthreads, but
      I'm not familiar with the surrounding context and we don't currently
      test modules with Objective C++ anyway so I've left it as-is.
      
      	PR libstdc++/115126
      
      libgcc/ChangeLog:
      
      	* gthr-posix.h (__GTHREAD_ALWAYS_INLINE): New macro.
      	(__GTHREAD_INLINE): New macro.
      	(__gthread_active): Convert from variable to (hidden) function.
      	(__gthread_active_p): Mark as __GTHREAD_INLINE instead of
      	static; make visibility("hidden") when it has a static local
      	variable.
      	(__gthread_trigger): Mark as __GTHREAD_INLINE instead of static.
      	(__gthread_create): Likewise.
      	(__gthread_join): Likewise.
      	(__gthread_detach): Likewise.
      	(__gthread_equal): Likewise.
      	(__gthread_self): Likewise.
      	(__gthread_yield): Likewise.
      	(__gthread_once): Likewise.
      	(__gthread_key_create): Likewise.
      	(__gthread_key_delete): Likewise.
      	(__gthread_getspecific): Likewise.
      	(__gthread_setspecific): Likewise.
      	(__gthread_mutex_init_function): Likewise.
      	(__gthread_mutex_destroy): Likewise.
      	(__gthread_mutex_lock): Likewise.
      	(__gthread_mutex_trylock): Likewise.
      	(__gthread_mutex_timedlock): Likewise.
      	(__gthread_mutex_unlock): Likewise.
      	(__gthread_recursive_mutex_init_function): Likewise.
      	(__gthread_recursive_mutex_lock): Likewise.
      	(__gthread_recursive_mutex_trylock): Likewise.
      	(__gthread_recursive_mutex_timedlock): Likewise.
      	(__gthread_recursive_mutex_unlock): Likewise.
      	(__gthread_recursive_mutex_destroy): Likewise.
      	(__gthread_cond_init_function): Likewise.
      	(__gthread_cond_broadcast): Likewise.
      	(__gthread_cond_signal): Likewise.
      	(__gthread_cond_wait): Likewise.
      	(__gthread_cond_timedwait): Likewise.
      	(__gthread_cond_wait_recursive): Likewise.
      	(__gthread_cond_destroy): Likewise.
      	(__gthread_rwlock_rdlock): Likewise.
      	(__gthread_rwlock_tryrdlock): Likewise.
      	(__gthread_rwlock_wrlock): Likewise.
      	(__gthread_rwlock_trywrlock): Likewise.
      	(__gthread_rwlock_unlock): Likewise.
      	* gthr-single.h: (__GTHREAD_ALWAYS_INLINE): New macro.
      	(__GTHREAD_INLINE): New macro.
      	(__gthread_active_p): Mark as __GTHREAD_INLINE instead of static.
      	(__gthread_once): Likewise.
      	(__gthread_key_create): Likewise.
      	(__gthread_key_delete): Likewise.
      	(__gthread_getspecific): Likewise.
      	(__gthread_setspecific): Likewise.
      	(__gthread_mutex_destroy): Likewise.
      	(__gthread_mutex_lock): Likewise.
      	(__gthread_mutex_trylock): Likewise.
      	(__gthread_mutex_unlock): Likewise.
      	(__gthread_recursive_mutex_lock): Likewise.
      	(__gthread_recursive_mutex_trylock): Likewise.
      	(__gthread_recursive_mutex_unlock): Likewise.
      	(__gthread_recursive_mutex_destroy): Likewise.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/shared_ptr.h (std::__is_shared_ptr): Remove
      	unnecessary 'static'.
      	* include/bits/unique_ptr.h (std::__is_unique_ptr): Likewise.
      	* include/std/future (std::__create_task_state): Likewise.
      	* include/std/shared_mutex (_GLIBCXX_GTRHW): Likewise.
      	(__glibcxx_rwlock_init): Likewise.
      	(__glibcxx_rwlock_timedrdlock): Likewise.
      	(__glibcxx_rwlock_timedwrlock): Likewise.
      	(__glibcxx_rwlock_rdlock): Likewise.
      	(__glibcxx_rwlock_tryrdlock): Likewise.
      	(__glibcxx_rwlock_wrlock): Likewise.
      	(__glibcxx_rwlock_trywrlock): Likewise.
      	(__glibcxx_rwlock_unlock): Likewise.
      	(__glibcxx_rwlock_destroy): Likewise.
      	(__glibcxx_rwlock_init): Likewise.
      	* include/pstl/algorithm_impl.h
      	(__pstl::__internal::__set_algo_cut_off): Mark inline.
      	* include/pstl/unseq_backend_simd.h
      	(__pstl::__unseq_backend::__lane_size): Mark inline.
      
      Signed-off-by: default avatarNathaniel Shead <nathanieloshead@gmail.com>
      Reviewed-by: default avatarJonathan Wakely <jwakely@redhat.com>
      Reviewed-by: default avatarJakub Jelinek <jakub@redhat.com>
      6a4d1c37
    • Marek Polacek's avatar
      c++: tweak for -Wrange-loop-construct [PR116731] · 6ac4e2f4
      Marek Polacek authored
      This PR reports that the warning would be better off using a check
      for trivially constructible rather than trivially copyable.
      
      LLVM accepted a similar fix:
      https://github.com/llvm/llvm-project/issues/47355
      
      
      
      	PR c++/116731
      
      gcc/cp/ChangeLog:
      
      	* parser.cc (warn_for_range_copy): Check if TYPE is trivially
      	constructible, not copyable.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/warn/Wrange-loop-construct3.C: New test.
      
      Reviewed-by: default avatarJason Merrill <jason@redhat.com>
      6ac4e2f4
    • Jakub Jelinek's avatar
      libstdc++: Fix freebsd/dragonfly build [PR116859] · e23e5370
      Jakub Jelinek authored
      As reported in the PR, the system headers libstdc++ changes result in
      -Werror=expansion-to-defined errors on FreeBSD and supposedly on DragonFly
      too.
      
      The following patch fixes those by performing the preprocessor test right
      away, rather than using defined in the macro definitions.
      
      I think neither __ISO_C_VISIBLE nor __LONG_LONG_SUPPORTED should normally
      change during compilation.
      
      2024-09-26  Jakub Jelinek  <jakub@redhat.com>
      
      	PR libstdc++/116859
      	* config/os/bsd/freebsd/os_defines.h
      	(_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC,
      	_GLIBCXX_USE_C99_FLOAT_TRANSCENDENTALS_DYNAMIC): Avoid
      	-Wexpansion-to-defined warnings.
      	* config/os/bsd/dragonfly/os_defines.h
      	(_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC): Likewise.
      e23e5370
    • Jonathan Wakely's avatar
      libstdc++: Preserve signbit of nan when converting float to double [PR113578] · ee9f0060
      Jonathan Wakely authored
      
      LWG 117 specifies that inserting a float into an ostream should cast it
      to double, because there's no std::num_put::put member that takes a
      float. However, on RISC-V converting a NaN float to double loses the
      sign, which means that negative NaN floats are printed as positive.
      
      This has been reported as LWG 4101 and there is good support for fixing
      the standard to preserve the sign bit when printing negative NaN values.
      
      This change uses copysign((double)f, (double)std::bit_cast<int>(f)) to
      get a double that preserves the sign. The bit_cast gives us an integer
      with the same signbit, and casting that to the target type preserves
      the signbit. We don't care about the value, as copysign only uses the
      signbit.
      
      The inserters for extended floating-point types need the same treatment,
      so add a new _S_cast_flt helper to do the signbit-preserving conversion
      generically.
      
      So far only RISC-V has been confirmed to need this treatment, but we
      might need to extend it to other targets later.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/113578
      	* include/std/ostream (_S_cast_flt): New static member function
      	to restore signbit after casting to double or long double.
      	(operator<<(float), operator<<(_Float16), operator<<(_Float32))
      	(operator<<(_Float64), operator(_Float128))
      	(operator<<(__bfloat16_t)): Use _S_cast_flt.
      	testsuite/27_io/basic_ostream/inserters_arithmetic/lwg4101.cc:
      	New test.
      
      Co-authored-by: default avatarAndrew Waterman <andrew@sifive.com>
      ee9f0060
    • Jonathan Wakely's avatar
      libstdc++: Fix comments in <sstream> tests that mention basic_filebuf · 5ad6ff2b
      Jonathan Wakely authored
      libstdc++-v3/ChangeLog:
      
      	* testsuite/27_io/basic_istringstream/cons/2020.cc: Fix comment
      	referring to basic_filebuf.
      	* testsuite/27_io/basic_istringstream/requirements/base_classes.cc:
      	Likewise.
      	* testsuite/27_io/basic_ostringstream/cons/2020.cc: Likewise.
      	* testsuite/27_io/basic_ostringstream/requirements/base_classes.cc:
      	Likewise.
      	* testsuite/27_io/basic_stringbuf/cons/2020.cc: Likewise.
      	* testsuite/27_io/basic_stringbuf/requirements/explicit_instantiation/2.cc:
      	Likewise.
      	* testsuite/27_io/basic_stringbuf/requirements/explicit_instantiation/4.cc:
      	Likewise.
      	* testsuite/27_io/basic_stringstream/cons/2020.cc: Likewise.
      	* testsuite/27_io/basic_stringstream/requirements/base_classes.cc:
      	Likewise.
      5ad6ff2b
    • Jonathan Wakely's avatar
      libstdc++: Add [[nodiscard]] to iostream members · 240285eb
      Jonathan Wakely authored
      These are all pure functions and MSVC also marks all of these as
      nodiscard except for std::basic_ios::tie() const, but that's been
      confirmed as an accidental omission.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/basic_ios.h (basic_ios::operator bool()):
      	Add [[nodiscard]] attribute.
      	(basic_ios::operator!(), basic_ios::rdstate())
      	(basic_ios::good(), basic_ios::eof(), basic_ios::fail())
      	(basic_ios::bad(), basic_ios::exceptions(), basic_ios::tie())
      	(basic_ios::rdbuf(), basic_ios::fill()): Likewise.
      	* include/bits/ios_base.h (ios_base::flags()): Likewise.
      	(ios_base::precision(), ios_base::width(), ios_base::getloc()):
      	Likewise.
      	* include/std/fstream (basic_filebuf::is_open)
      	(basic_ifstream::rdbuf(), basic_ifstream::is_open)
      	(basic_ofstream::rdbuf(), basic_ofstream::is_open)
      	(basic_fstream::rdbuf(), basic_fstream::is_open): Likewise.
      	* include/std/spanstream (basic_spanbuf::span())
      	(basic_ispanstream::span(), basic_ispanstream::rdbuf())
      	(basic_ospanstream::span(), basic_ospanstream::rdbuf())
      	(basic_spanstream::span(), basic_spanstream::rdbuf()):
      	Likewise.
      	* include/std/sstream (basic_stringbuf::str())
      	(basic_istringstream::rdbuf(), basic_istringstream::str())
      	(basic_ostringstream::rdbuf(), basic_ostringstream::str())
      	(basic_stringstream::rdbuf(), basic_stringstream::str()):
      	Likewise.
      	* testsuite/27_io/basic_istream/extractors_arithmetic/char/01.cc:
      	Suppress -Wunused-result warnings.
      	* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/01.cc:
      	Likewise.
      240285eb
    • Tobias Burnus's avatar
      libgomp.texi: Fix deprecation note for omp_{get,set}_nested + OMP_NESTED · 9ec258bf
      Tobias Burnus authored
      libgomp/ChangeLog:
      
      	* libgomp.texi (omp_get_nested,omp_set_nested, OMP_NESTED): Fix
      	note about deprecation - correct is 5.0 not 5.2.
      9ec258bf
    • Sam James's avatar
      testsuite: XFAIL gfortran.dg/initialization_25.f90 properly · 819098dc
      Sam James authored
      The test was disabled/XFAIL'd informally in r0-100012-gcdc6637d7c78ec,
      but r15-3890-g34bf6aa41ba539 didn't realize this, causing a FAIL.
      
      Fix that by marking it as XFAIL per the original intent.
      
      gcc/testsuite/ChangeLog:
      	PR fortran/35779
      	PR fortran/116858
      
      	* gfortran.dg/initialization_25.f90: Mark as XFAIL.
      819098dc
    • Mikael Morin's avatar
      doc: Remove index reference to removed documentation in fortran manual · e9f34142
      Mikael Morin authored
      Fortran option -M used to be an alias for -J.  After some deprecation time,
      it was reused for another purpose at revision
      r0-100725-gd8ddea4044ee8212d5fe305e8e2a547700cd7b8f.
      That revision removed the documentation parts of -J mentioning -M, but left
      a reference to -M in the index.
      
      This change removes the remaining reference.
      
      gcc/fortran/ChangeLog:
      
      	* invoke.texi (-M): Remove index reference to removed documentation.
      e9f34142
    • Owen Avery's avatar
      Add virtual destructor to AbstractExpr · 6f76ce80
      Owen Avery authored
      
      gcc/rust/ChangeLog:
      
      	* checks/errors/borrowck/rust-bir.h
      	(class AbstractExpr): Add virtual destructor.
      
      Signed-off-by: default avatarOwen Avery <powerboat9.gamer@gmail.com>
      6f76ce80
    • Richard Biener's avatar
      tree-optimization/114855 - speed up dom_oracle::register_transitives · 942bbb23
      Richard Biener authored
      dom_oracle::register_transitives contains an unbound dominator walk
      which for the testcase in PR114855 dominates the profile.  The following
      fixes the unbound work done by assigning a constant work budget to the
      loop, bounding the number of dominators visited but also the number of
      relations processed.  This gets both dom_oracle::register_transitives and
      get_immediate_dominator off the profile.
      
      I'll note that we're still doing an unbound dominator walk via
      equiv_set in find_equiv_dom at the start of the function and when
      we register a relation that also looks up the same way.  At least
      for the testcase at hand this isn't an issue.
      
      I've also amended the guard to register_transitives with the
      per-basic-block limit for the number of relations registered not
      being exhausted.
      
      	PR tree-optimization/114855
      	* params.opt (--param transitive-relations-work-bound): New.
      	* doc/invoke.texi (--param transitive-relations-work-bound):
      	Document.
      	* value-relation.cc (dom_oracle::register_transitives):
      	Assing an overall work budget, bounding the dominator walk and
      	the number of relations processed.
      	(dom_oracle::record): Only register_transitives when the
      	number of already registered relations does not yet exceed
      	the per-BB limit.
      942bbb23
    • Tobias Burnus's avatar
      Fortran/OpenMP: Middle-end support for mapping of DT with allocatable components · e4a58b6f
      Tobias Burnus authored
      gcc/ChangeLog:
      
      	* langhooks-def.h (lhd_omp_deep_mapping_p,
      	lhd_omp_deep_mapping_cnt, lhd_omp_deep_mapping): New.
      	(LANG_HOOKS_OMP_DEEP_MAPPING_P, LANG_HOOKS_OMP_DEEP_MAPPING_CNT,
      	LANG_HOOKS_OMP_DEEP_MAPPING): Define.
      	(LANG_HOOKS_DECLS): Use it.
      	* langhooks.cc (lhd_omp_deep_mapping_p, lhd_omp_deep_mapping_cnt,
      	lhd_omp_deep_mapping): New stubs.
      	* langhooks.h (struct lang_hooks_for_decls): Add new hooks
      	* omp-expand.cc (expand_omp_target): Handle dynamic-size
      	addr/sizes/kinds arrays.
      	* omp-low.cc (build_sender_ref, fixup_child_record_type,
      	scan_sharing_clauses, lower_omp_target): Update to handle
      	new hooks and dynamic-size addr/sizes/kinds arrays.
      e4a58b6f
    • Iain Sandoe's avatar
      libstdc++: Suppress an attribute suggestion warning [PR116853]. · d797202c
      Iain Sandoe authored
      
      This warning is triggering during the build and breaking bootstrap on
      at least two targets.  The warning appears valid, but the final fix for
      it is not yet clear.
      
      In the meantime, to restore bootstrap, the following patch ignores the
      warning in the relevant code section.
      
      	PR libstdc++/116853
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/basic_string.h: Ignore suggest-attribute=format
      	warning when using posix vsnprintf in to_string() implementations.
      
      Signed-off-by: default avatarIain Sandoe <iain@sandoe.co.uk>
      d797202c
    • Jonathan Wakely's avatar
      libstdc++: Fix std::basic_stracktrace to not assume allocators throw std::bad_alloc · c45844eb
      Jonathan Wakely authored
      The standard allows allocators to throw any kind of exception, not only
      something that can be caught as std::bad_alloc. std::basic_stracktrace
      was assuming std::bad_alloc.
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/stacktrace (basic_stacktrace::_Impl::_M_allocate):
      	Do not assume allocators only throw std::bad_alloc.
      c45844eb
    • Jonathan Wakely's avatar
      libstdc++: Remove noexcept-specifier from MCF __cxa_guard_acquire [PR116857] · efdda203
      Jonathan Wakely authored
      This function definition should not be marked as non-throwing, because
      the declaration in <cxxabi.h> is potentially throwing.
      
      Also fix whitespace.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/116857
      	* libsupc++/guard.cc (__cxa_guard_acquire): Remove
      	_GLIBCXX_NOTHROW to match declaration in <cxxabi.h>.
      efdda203
    • Jakub Jelinek's avatar
      pretty-print: Fix up allocate_object · 9dc1ab90
      Jakub Jelinek authored
      On Thu, Aug 29, 2024 at 06:58:12PM -0400, David Malcolm wrote:
      > The following patch rewrites the internals of pp_format.
      
      > The tokens and token lists are allocated on the chunk_obstack, and so
      > there's no additional heap activity required, with the memory reclaimed
      > when the chunk_obstack is freed after phase 3 of formatting.
      
      > +static void *
      > +allocate_object (size_t sz, obstack &s)
      > +{
      > +  /* We must not be half-way through an object.  */
      > +  gcc_assert (obstack_base (&s) == obstack_next_free (&s));
      > +
      > +  obstack_grow (&s, obstack_base (&s), sz);
      > +  void *buf = obstack_finish (&s);
      > +  return buf;
      >  }
      
      I think this is wrong.  I hoped it would be the reason of the
      unexpected libstdc++ warnings on certain architectures after
      seeing
      ==4027220== Source and destination overlap in memcpy(0x4627154, 0x4627154, 12)
      ==4027220==    at 0x404B93E: memcpy (vg_replace_strmem.c:1123)
      ==4027220==    by 0xAAD5618: allocate_object(unsigned int, obstack&) (pretty-print.cc:1183)
      ==4027220==    by 0xAAD8C0E: operator new (pretty-print.cc:1210)
      ==4027220==    by 0xAAD8C0E: make (pretty-print-format-impl.h:305)
      ==4027220==    by 0xAAD8C0E: format_phase_1 (pretty-print.cc:1659)
      ==4027220==    by 0xAAD8C0E: pretty_printer::format(text_info&) (pretty-print.cc:1618)
      ==4027220==    by 0xAAA840E: pp_format (pretty-print.h:583)
      ==4027220==    by 0xAAA840E: diagnostic_context::report_diagnostic(diagnostic_info*) (diagnostic.cc:1260)
      ==4027220==    by 0xAAA8703: diagnostic_context::diagnostic_impl(rich_location*, diagnostic_metadata const*, diagnostic_option_id, char const*, char**, diagnostic_t) (diagnostic.cc:1404)
      ==4027220==    by 0xAAB8682: warning(diagnostic_option_id, char const*, ...) (diagnostic-global-context.cc:166)
      ==4027220==    by 0x97725F5: warn_deprecated_use(tree_node*, tree_node*) (tree.cc:12485)
      ==4027220==    by 0x8B6694B: mark_used(tree_node*, int) (decl2.cc:6121)
      ==4027220==    by 0x8C9E25E: tsubst_expr(tree_node*, tree_node*, int, tree_node*) [clone .part.0] (pt.cc:21626)
      ==4027220==    by 0x8C9E5E6: tsubst_expr(tree_node*, tree_node*, int, tree_node*) [clone .part.0] (pt.cc:20935)
      ==4027220==    by 0x8C9E1D7: tsubst_expr(tree_node*, tree_node*, int, tree_node*) [clone .part.0] (pt.cc:20424)
      ==4027220==    by 0x8C9DF2E: tsubst_expr(tree_node*, tree_node*, int, tree_node*) [clone .part.0] (pt.cc:20496)
      ==4027220==
      etc. valgrind warnings, unfortunately it is not, but still
      I think this is a bug.
      If the obstack has enough space in it, i.e. if obstack_room (&s) >= sz,
      then obstack_grow from obstack_base will copy uninitialized bytes
      through memcpy (obstack_base (&s), obstack_base (&s), sz);
      (which pedantically isn't valid due to the overlap, and so
      the reason why valgrind complains, but in reality I think most
      implementations can handle it fine, after all, we also use it for
      structure assignments which could have full or no overlap but never
      partial).
      If obstack_room (&s) < sz, then obstack_grow will first
      _obstack_newchunk (&s, sz); which will allocate new memory and
      copy the existing data of the object (but the above assertion
      guartantees it will copy 0 bytes) and then the memcpy copies
      sz bytes from the old base to the new (if unlucky, that could crash
      as there could be end of page and unmapped next page in between).
      
      I think we should use obstack_blank instead of obstack_grow, which
      does everything obstack_grow does, except for the memcpy of the
      uninitialized data.
      
      2024-09-25  Jakub Jelinek  <jakub@redhat.com>
      
      	* pretty-print.cc (allocate_object): Use obstack_blank rather than
      	obstack_grow.
      9dc1ab90
    • Sam James's avatar
      testsuite: fix hyphen typos · 34bf6aa4
      Sam James authored
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/modules/reparent-1_c.C: Fix whitespace around '-' in dg directive.
      	* gfortran.dg/initialization_25.f90: Ditto.
      34bf6aa4
    • Sam James's avatar
      testsuite: fix comment-only directive typos · 98aac7c6
      Sam James authored
      Doing this to avoid FPs from grepping but also to avoid the potential
      for people learning bad habits.
      
      gcc/testsuite/ChangeLog:
      
      	* gfortran.dg/coarray/caf.exp: Fix 'dg-do-run' typo.
      	* lib/gfortran-dg.exp: Ditto.
      	* lib/gm2-dg.exp: Ditto.
      	* lib/go-dg.exp: Ditto.
      98aac7c6
    • Gerald Pfeifer's avatar
      doc: Remove MinGW note on binutils 2.16 · 27003e5d
      Gerald Pfeifer authored
      Binutils 2.16 is 13 years old; no need to specifically refer to it as a
      requirement.
      
      gcc:
      	PR target/69374
      	* doc/install.texi (Specific) <*-*-mingw32>: Remove note regarding
      	binutils 2.16.
      27003e5d
    • Kugan Vivekanandarajah's avatar
      [match.pd] Handle abs pattern with convert · 454371d8
      Kugan Vivekanandarajah authored
      
      gcc/ChangeLog:
      
      	* match.pd: Extend A CMP 0 ? A : -A into (type)A CMP 0 ? A : -A.
      	Extend A CMP 0 ? A : -A into (type) A CMP 0 ? A : -A.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/absvect.C: New test.
      	* gcc.dg/tree-ssa/absfloat16.c: New test.
      
      Signed-off-by: default avatarKugan Vivekanandarajah <kvivekananda@nvidia.com>
      454371d8
    • Levy Hsu's avatar
      x86: Extend AVX512 Vectorization for Popcount in Various Modes · 85910e65
      Levy Hsu authored
      This patch enables vectorization of the popcount operation for V2QI, V4QI,
      V8QI, V2HI, V4HI, and V2SI modes.
      
      gcc/ChangeLog:
      
      	* config/i386/mmx.md:
      	(VQI_16_32_64): New mode iterator for 8-byte, 4-byte, and 2-byte QImode.
      	(popcount<mode>2): New pattern for popcount of V2QI/V4QI/V8QI mode.
      	(popcount<mode>2): New pattern for popcount of V2HI/V4HI mode.
      	(popcountv2si2): New pattern for popcount of V2SI mode.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/i386/part-vect-popcount-1.c: New test.
      85910e65
    • liuhongt's avatar
      Define VECTOR_STORE_FLAG_VALUE · 78eef891
      liuhongt authored
      gcc/ChangeLog:
      
      	* config/i386/i386.h (VECTOR_STORE_FLAG_VALUE): New macro.
      
      gcc/testsuite/ChangeLog:
      	* gcc.dg/rtl/x86_64/vector_eq.c: New test.
      78eef891
    • Nathaniel Shead's avatar
      testsuite: Fix testcase g++.dg/modules/indirect-1_b.C [PR116846] · 064d5c67
      Nathaniel Shead authored
      
      r15-3878 exposed a mistake in the testcase, probably from an older
      version of the dumping logic.
      
      Apart from the slightly different syntax for the dump line, also check
      for importing the type_decl rather than the const_decl (we need the type
      anyway and importing the type also brings along the enumerators so it
      would be unnecessary to seed an import for them as well).
      
      	PR c++/116846
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/modules/indirect-1_b.C: Fix testcase.
      
      Signed-off-by: default avatarNathaniel Shead <nathanieloshead@gmail.com>
      064d5c67
    • Pan Li's avatar
      RISC-V: Add testcases for form 3 of signed vector SAT_ADD · 12c8cb8f
      Pan Li authored
      
      Form 3:
        #define DEF_VEC_SAT_S_ADD_FMT_3(T, UT, MIN, MAX)                     \
        void __attribute__((noinline))                                       \
        vec_sat_s_add_##T##_fmt_3 (T *out, T *op_1, T *op_2, unsigned limit) \
        {                                                                    \
          unsigned i;                                                        \
          for (i = 0; i < limit; i++)                                        \
            {                                                                \
              T x = op_1[i];                                                 \
              T y = op_2[i];                                                 \
              T sum;                                                         \
              bool overflow = __builtin_add_overflow (x, y, &sum);           \
              out[i] = overflow ? x < 0 ? MIN : MAX : sum;                   \
            }                                                                \
        }
      
      DEF_VEC_SAT_S_ADD_FMT_3 (int8_t, uint8_t, INT8_MIN, INT8_MAX)
      
      The below test are passed for this patch.
      * The rv64gcv fully regression test.
      
      It is test only patch and obvious up to a point, will commit it
      directly if no comments in next 48H.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/vec_sat_arith.h: Add test helper macros.
      	* gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-10.c: New test.
      	* gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-11.c: New test.
      	* gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-12.c: New test.
      	* gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-9.c: New test.
      	* gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-run-10.c: New test.
      	* gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-run-11.c: New test.
      	* gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-run-12.c: New test.
      	* gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-run-9.c: New test.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      12c8cb8f
    • Pan Li's avatar
      Match: Support form 3 for vector signed integer .SAT_ADD · 342221f3
      Pan Li authored
      
      This patch would like to support the form 3 of the vector signed
      integer .SAT_ADD.  Aka below example:
      
      Form 3:
        #define DEF_VEC_SAT_S_ADD_FMT_3(T, UT, MIN, MAX)                     \
        void __attribute__((noinline))                                       \
        vec_sat_s_add_##T##_fmt_3 (T *out, T *op_1, T *op_2, unsigned limit) \
        {                                                                    \
          unsigned i;                                                        \
          for (i = 0; i < limit; i++)                                        \
            {                                                                \
              T x = op_1[i];                                                 \
              T y = op_2[i];                                                 \
              T sum;                                                         \
              bool overflow = __builtin_add_overflow (x, y, &sum);           \
              out[i] = overflow ? x < 0 ? MIN : MAX : sum;                   \
            }                                                                \
        }
      
      DEF_VEC_SAT_S_ADD_FMT_3(int8_t, uint8_t, INT8_MIN, INT8_MAX)
      
      Before this patch:
        40   │   # ivtmp.7_34 = PHI <0(3), ivtmp.7_30(7)>
        41   │   _26 = op_1_12(D) + ivtmp.7_34;
        42   │   x_29 = MEM[(int8_t *)_26];
        43   │   _1 = op_2_14(D) + ivtmp.7_34;
        44   │   y_24 = MEM[(int8_t *)_1];
        45   │   _9 = .ADD_OVERFLOW (y_24, x_29);
        46   │   _7 = IMAGPART_EXPR <_9>;
        47   │   if (_7 != 0)
        48   │     goto <bb 6>; [50.00%]
        49   │   else
        50   │     goto <bb 5>; [50.00%]
        51   │ ;;    succ:       6
        52   │ ;;                5
        53   │
        54   │ ;;   basic block 5, loop depth 1
        55   │ ;;    pred:       4
        56   │   _42 = REALPART_EXPR <_9>;
        57   │   _2 = out_17(D) + ivtmp.7_34;
        58   │   MEM[(int8_t *)_2] = _42;
        59   │   ivtmp.7_27 = ivtmp.7_34 + 1;
        60   │   if (_13 != ivtmp.7_27)
        61   │     goto <bb 7>; [89.00%]
        62   │   else
        63   │     goto <bb 8>; [11.00%]
        64   │ ;;    succ:       7
        65   │ ;;                8
        66   │
        67   │ ;;   basic block 6, loop depth 1
        68   │ ;;    pred:       4
        69   │   _38 = x_29 < 0;
        70   │   _39 = (signed char) _38;
        71   │   _40 = -_39;
        72   │   _41 = _40 ^ 127;
        73   │   _33 = out_17(D) + ivtmp.7_34;
        74   │   MEM[(int8_t *)_33] = _41;
        75   │   ivtmp.7_25 = ivtmp.7_34 + 1;
        76   │   if (_13 != ivtmp.7_25)
      
      After this patch:
        77   │   _94 = .SELECT_VL (ivtmp_92, POLY_INT_CST [16, 16]);
        78   │   vect_x_13.9_81 = .MASK_LEN_LOAD (vectp_op_1.7_79, 8B, { -1, ... }, _94, 0);
        79   │   vect_y_15.12_85 = .MASK_LEN_LOAD (vectp_op_2.10_83, 8B, { -1, ... }, _94, 0);
        80   │   vect_patt_49.13_86 = .SAT_ADD (vect_x_13.9_81, vect_y_15.12_85);
        81   │   .MASK_LEN_STORE (vectp_out.14_88, 8B, { -1, ... }, _94, 0, vect_patt_49.13_86);
        82   │   vectp_op_1.7_80 = vectp_op_1.7_79 + _94;
        83   │   vectp_op_2.10_84 = vectp_op_2.10_83 + _94;
        84   │   vectp_out.14_89 = vectp_out.14_88 + _94;
        85   │   ivtmp_93 = ivtmp_92 - _94;
      
      The below test suites are passed for this patch.
      * The rv64gcv fully regression test.
      * The x86 bootstrap test.
      * The x86 fully regression test.
      
      gcc/ChangeLog:
      
      	* match.pd: Add optional nop_convert for signed SAT_ADD case 4.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      342221f3
    • GCC Administrator's avatar
      Daily bump. · 9d76276b
      GCC Administrator authored
      9d76276b
  3. Sep 25, 2024
    • Hans-Peter Nilsson's avatar
      gfortran testsuite: Remove unit-files in files having open-statements, PR116701 · 14cd1081
      Hans-Peter Nilsson authored
      PR testsuite/116701 shows that left-behind files from
      unnamed gfortran open statements (named unit.N, where N =
      unit number) can interfere with the result of a subsequent
      run.  While that's unlikely to happen for a "real" fortran
      target or a test with a deleting close-statement, test-cases
      should not rely on previous test-cases passing and not
      execute along different execution paths depending on earlier
      runs, even if the difference is benevolent.
      
      Most but not all fortran test-cases go through
      gfortran-dg-runtest (gfortran.dg) or fortran-torture-execute
      (gfortran.fortran-torture).  However, the exceptions, with
      more complex framework and call-chains, either don't run or
      don't have open-statements, so a more complex solution
      doesn't seem worthwhile.  If test-cases with open-statements
      are added later to those parts of the test-suite, calls to
      fortran-delete-unit-files at the right spot may be added or
      worst case, "manual" cleanup-calls added, like:
      ! { dg-final { remote_file target delete "fort.10" } }
      Put the new proc in fortran-modules.exp since that's where other
      common fortran-testsuite dejagnu-library functions are located.
      
      	PR testsuite/116701
      	* lib/fortran-modules.exp (fortran-delete-unit-files): New proc.
      	* lib/gfortran-dg.exp (gfortran-dg-runtest): Call
      	fortran-delete-unit-files after executing test.
      	* lib/fortran-torture.exp (fortran-torture-execute): Ditto.
      14cd1081
    • Sam James's avatar
      testsuite: XFAIL g++.dg/modules/indirect-1_b.C · 6fee826b
      Sam James authored
      Mark the newly typo-fixed dg-final bits as XFAIL until investigated.
      
      gcc/testsuite/ChangeLog:
      	PR c++/116846
      
      	* g++.dg/modules/indirect-1_b.C: Add XFAIL.
      6fee826b
    • Sam James's avatar
      testsuite: fix dejagnu typos with underscores · d5864b95
      Sam James authored
      Fix typos in dejagnu 'dg-*' directives with erroneous underscores like
      'dg_'.
      
      gcc/testsuite/ChangeLog:
      	PR debug/30161
      	PR c++/91826
      	PR c++/116846
      
      	* g++.dg/debug/dwarf2/template-func-params-7.C: Fix errant underscore.
      	Cleanup whitespace in directives too.
      	* g++.dg/lookup/pr91826.C: Fix errant underscore.
      	* g++.dg/modules/indirect-1_b.C: Ditto.
      	* gcc.target/powerpc/vsx-builtin-msum.c: Ditto.
      d5864b95
    • Mikael Morin's avatar
      doc: Remove @code wrapping of fortran option names [PR116801] · 0b953ce8
      Mikael Morin authored
      The documentation of gfortran options uses @code wrappings for arguments
      to @opindex.  This is superfluous, as 'op' index is a texinfo 'code' index,
      that is it already implicitly formats its arguments as if in a @code block.
      The superfluous wrapping has the effect of creating a nested
      <code class="..."> tag inside the regular automatic <code> tag, in the
      option index HTML page, preventing the recognition of the corresponding
      option by the option URL generation script.
      
      This change removes those superfluous @code wrappings.  Additionally,
      variables appearing as separate argument in index are removed, permitting
      a few more URL recognition.  Finally, the URL files are regenerated with the
      new URLs recognized on the updated HTML files.
      
      By the way, a spurious 'option' is removed from the label of the std= option
      in the index, without any effect on URL recognition.
      
      	PR other/116801
      
      gcc/fortran/ChangeLog:
      
      	* invoke.texi: Remove @code wrapping in arguments to @opindex.
      	(std=): Remove spurious 'option' in index.
      	(idirafter, imultilib, iprefix, isysroot, iquote, isystem,
      	fintrinsic-modules-path): Remove variable from index.
      	* lang.opt.urls: Regenerate.
      
      gcc/ada/ChangeLog:
      
      	* gcc-interface/lang.opt.urls: Regenerate.
      
      gcc/c-family/ChangeLog:
      
      	* c.opt.urls: Regenerate.
      
      gcc/ChangeLog:
      
      	* common.opt.urls: Regenerate.
      
      gcc/d/ChangeLog:
      
      	* lang.opt.urls: Regenerate.
      
      gcc/go/ChangeLog:
      
      	* lang.opt.urls: Regenerate.
      
      gcc/m2/ChangeLog:
      
      	* lang.opt.urls: Regenerate.
      
      gcc/rust/ChangeLog:
      
      	* lang.opt.urls: Regenerate.
      0b953ce8
    • Jakub Jelinek's avatar
      i386: Add GENERIC and GIMPLE folders of __builtin_ia32_{min,max}* [PR116738] · cc40795d
      Jakub Jelinek authored
      The following patch adds GENERIC and GIMPLE folders for various
      x86 min/max builtins.
      As discussed, these builtins have effectively x < y ? x : y
      (or x > y ? x : y) behavior.
      The GENERIC folding is done if all the (relevant) arguments are
      constants (such as VECTOR_CST for vectors) and is done because
      the GIMPLE folding can't easily handle masking, rounding and the
      ss/sd cases (in a way that it would be pattern recognized back to the
      corresponding instructions).  The GIMPLE folding is also done just
      for TARGET_SSE4 or later when optimizing, otherwise it is apparently
      not matched back.
      
      2024-09-25  Jakub Jelinek  <jakub@redhat.com>
      
      	PR target/116738
      	* config/i386/i386.cc (ix86_fold_builtin): Handle
      	IX86_BUILTIN_M{IN,AX}{S,P}{S,H,D}*.
      	(ix86_gimple_fold_builtin): Handle IX86_BUILTIN_M{IN,AX}P{S,H,D}*.
      
      	* gcc.target/i386/avx512f-pr116738-1.c: New test.
      	* gcc.target/i386/avx512f-pr116738-2.c: New test.
      cc40795d
    • H.J. Lu's avatar
      x86: Don't use address override with segment regsiter · c79cc308
      H.J. Lu authored
      
      Address override only applies to the (reg32) part in the thread address
      fs:(reg32).  Don't rewrite thread address like
      
      (set (reg:CCZ 17 flags)
          (compare:CCZ (reg:SI 98 [ __gmpfr_emax.0_1 ])
              (mem/c:SI (plus:SI (plus:SI (unspec:SI [
                                  (const_int 0 [0])
                              ] UNSPEC_TP)
                          (reg:SI 107))
                      (const:SI (unspec:SI [
                                  (symbol_ref:SI ("previous_emax") [flags 0x1a] <var_decl 0x7fffe9a11cf0 previous_emax>)
                              ] UNSPEC_DTPOFF))) [1 previous_emax+0 S4 A32])))
      
      if address override is used to avoid the invalid memory operand like
      
      	cmpl	%fs:previous_emax@dtpoff(%eax), %r12d
      
      gcc/
      
      	PR target/116839
      	* config/i386/i386.cc (ix86_rewrite_tls_address_1): Make it
      	static.  Return if TLS address is thread register plus an integer
      	register.
      
      gcc/testsuite/
      
      	PR target/116839
      	* gcc.target/i386/pr116839.c: New file.
      
      Signed-off-by: default avatarH.J. Lu <hjl.tools@gmail.com>
      c79cc308
    • Sam James's avatar
      ltmain.sh: allow more flags at link-time · ed6dccd0
      Sam James authored
      libtool defaults to filtering flags passed at link-time.
      
      This brings the filtering in GCC's 'fork' of libtool into sync with
      upstream libtool commit 22a7e547e9857fc94fe5bc7c921d9a4b49c09f8e.
      
      In particular, this now allows some harmless diagnostic flags (especially
      useful for things like -Werror=odr), more optimization flags, and some
      Clang-specific options.
      
      GCC's -flto documentation mentions:
      > To use the link-time optimizer, -flto and optimization options should be
      > specified at compile time and during the final link. It is recommended
      > that you compile all the files participating in the same link with the
      > same options and also specify those options at link time.
      
      This allows compliance with that.
      
      	* ltmain.sh (func_mode_link): Allow various flags through filter.
      ed6dccd0
    • Sam James's avatar
      libstdc++: testsuite: fix dg-bogus directive syntax · 82d97278
      Sam James authored
      These dg-bogus directives were bogus as they missed a closing brace.
      
      ```
      +PASS: 23_containers/array/capacity/empty.cc  -std=gnu++17  (test for bogus messages, line 54)
       PASS: 23_containers/array/capacity/empty.cc  -std=gnu++17 (test for excess errors)
       PASS: 23_containers/array/capacity/empty.cc  -std=gnu++17 execution test
      +PASS: 23_containers/array/capacity/max_size.cc  -std=gnu++17  (test for bogus messages, line 54)
       PASS: 23_containers/array/capacity/max_size.cc  -std=gnu++17 (test for excess errors)
       PASS: 23_containers/array/capacity/max_size.cc  -std=gnu++17 execution test
      +PASS: 23_containers/array/capacity/size.cc  -std=gnu++17  (test for bogus messages, line 54)
      ```
      
      libstdc++-v3/ChangeLog:
      	PR libstdc++/101831
      
      	* testsuite/23_containers/array/capacity/empty.cc: Add missing brace.
      	* testsuite/23_containers/array/capacity/max_size.cc: Ditto.
      	* testsuite/23_containers/array/capacity/size.cc: Ditto.
      82d97278
    • Thomas Koenig's avatar
      Fix testsuite failure on 32-bit targets. · 3308e824
      Thomas Koenig authored
      gcc/testsuite/ChangeLog:
      
      	* gfortran.dg/unsigned_25.f90: Change KIND=16 to KIND=8.
      3308e824
    • Andrew Pinski's avatar
      Add an alternative testcase for PR 70740 · d1e7f3a6
      Andrew Pinski authored
      
      While looking into improving phiprop, I noticed that
      the current pr70740.c testcase was being optimized almost
      all the way before phiprop because the addresses were considered
      the same; the arrays were all zero in size.
      
      This adds an alternative testcase which changes the array sizes to be 1
      and phiprop can and will act on this testcase now and the fix which was
      being tested is actually tested now.
      
      Tested on x86_64-linux-gnu.
      
      	PR tree-optimization/70740
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/torture/pr70740-1.c: New test.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      d1e7f3a6
    • Andrew Pinski's avatar
      match: Fix `a != 0 ? a * b : 0` patterns for things that trap [PR116772] · 6c5543d3
      Andrew Pinski authored
      
      For generic, `a != 0 ? a * b : 0` would match where `b` would be an expression
      which trap (in the case of the testcase, it was an integer division but it could be any).
      
      This adds a new helper function, expr_no_side_effects_p which tests if there is no side effects
      and the expression is not trapping which might be used in other locations.
      
      Changes since v1:
      * v2: Add move check to helper function instead of inlining it.
      
      	PR middle-end/116772
      
      gcc/ChangeLog:
      
      	* generic-match-head.cc (expr_no_side_effects_p): New function
      	* gimple-match-head.cc (expr_no_side_effects_p): New function
      	* match.pd (`a != 0 ? a / b : 0`): Check expr_no_side_effects_p.
      	(`a != 0 ? a * b : 0`, `a != 0 ? a & b : 0`): Likewise.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/torture/pr116772-1.c: New test.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      6c5543d3
    • Jakub Jelinek's avatar
      c++: Add testcase for DR 2874 · 7cf85d13
      Jakub Jelinek authored
      Seems we already allow the partial specializations the way the DR clarifies,
      so this patch just adds a testcase which verifies that.
      
      2024-09-25  Jakub Jelinek  <jakub@redhat.com>
      
      	* g++.dg/DRs/dr2874.C: New test.
      7cf85d13
Loading