Skip to content
Snippets Groups Projects
  1. Dec 16, 2024
    • Joseph Myers's avatar
      Update cpplib sr.po · 62597d19
      Joseph Myers authored
      	* sr.po: Update.
      62597d19
    • Uros Bizjak's avatar
      i386: Fix tabs vs. spaces in mmx.md · 56f1863a
      Uros Bizjak authored
      gcc/ChangeLog:
      
      	* config/i386/mmx.md: Fix tabs vs. spaces.
      56f1863a
    • Uros Bizjak's avatar
      i386: Add HImode to VALID_SSE2_REG_MODE · 9d96b03c
      Uros Bizjak authored
      Move explicit Himode handling for SSE2 XMM regnos from
      ix86_hard_regno_mode_ok to VALID_SSE2_REG_MODE.
      
      No functional change.
      
      gcc/ChangeLog:
      
      	* config/i386/i386.cc (ix86_hard_regno_mode_ok):
      	Remove explicit HImode handling for SSE2 XMM regnos.
      	* config/i386/i386.h (VALID_SSE2_REG_MODE): Add HImode.
      9d96b03c
    • Hans-Peter Nilsson's avatar
      testsuite: Force max-completely-peeled-insns=300 for CRIS, PR118055 · e5c84fd3
      Hans-Peter Nilsson authored
      This handles fallout from r15-6097-gee2f19b0937b5e.  A brief
      analysis shows that the metric used in that code is computed
      by estimate_move_cost, differentiating on the target macro
      MOVE_MAX_PIECES (which defaults to MOVE_MAX) which for most
      "32-bit targets" is 4 and for "64-bit targets" is 8.  There
      are some outliers, like pru, with MOVE_MAX set to 8 but
      counting as a 32-bit target.
      
      So, the main difference for this test-case, which is heavy
      on 64-bit moves (most targets have "double" mapped to IEEE
      64-bit), is between "32-bit" and "64-bit", with the cost up
      to twice for the former compared to the latter.  I see no
      effective_target_move_max_is_4 or equivalent, and this
      instance falls below the threshold of adding one, so I'm
      sticking to a list of targets.  For CRIS, it would suffice
      with 210, but there's no need to be this specific, and it
      would make the test even more brittle.
      
      	PR tree-optimization/118055
      	* gcc.dg/tree-ssa/pr83403-1.c, gcc.dg/tree-ssa/pr83403-2.c: Add
      	cris-*-* to targets passing --param=max-completely-peeled-insns=300.
      e5c84fd3
    • David Malcolm's avatar
      sarif-replay: handle embedded links (§3.11.6) · 7f4f4968
      David Malcolm authored
      
      Handle embedded links in plain text messages.  For now, merely
      use the link text and discard the destination.
      
      gcc/ChangeLog:
      	* libsarifreplay.cc (struct embedded_link): New.
      	(maybe_consume_embedded_link): New.
      	(sarif_replayer::make_plain_text_within_result_message): Handle
      	embedded links by using the link text, for now.
      
      gcc/testsuite/ChangeLog:
      	* sarif-replay.dg/2.1.0-valid/3.11.6-embedded-links.sarif: New test.
      	* sarif-replay.dg/2.1.0-valid/malloc-vs-local-4.c.sarif: Update
      	expected output for handling the embedded links.
      	* sarif-replay.dg/2.1.0-valid/spec-example-4.sarif: Likewise.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      7f4f4968
    • David Malcolm's avatar
      libgdiagnostics: consolidate logical locations · 2af54192
      David Malcolm authored
      
      This patch updates diagnostic_manager_new_logical_location so
      that repeated calls with the same input values yield the same
      instance of diagnostic_logical_location.
      
      Doing so allows the path-printing logic to properly consolidate runs of
      events, whereas previously it could treat each event as having a
      distinct logical location, and thus require them to be printed
      separately; this greatly improves the output of sarif-replay when
      displaying execution paths.
      
      gcc/ChangeLog:
      	* doc/libgdiagnostics/topics/logical-locations.rst
      	(diagnostic_manager_new_logical_location): Add note about repeated
      	calls.
      	* libgdiagnostics.cc: Define INCLUDE_MAP.
      	(class owned_nullable_string): Add copy ctor and move ctor.
      	(owned_nullable_string::operator<): New.
      	(diagnostic_logical_location::operator<): New.
      	(diagnostic_manager::new_logical_location): Use m_logical_locs to
      	"uniquify" instances, converting it to a std::map.
      	(diagnostic_manager::logical_locs_map_t): New typedef.
      	(diagnostic_manager::t m_logical_locs): Convert from a std::vector
      	to a std::map.
      	(diagnostic_execution_path::same_function_p): Update comment.
      
      gcc/testsuite/ChangeLog:
      	* libgdiagnostics.dg/test-logical-location.c: Include <assert.h>.
      	Verify that creating a diagnostic_logical_location with equal
      	values yields the same instance.
      	* sarif-replay.dg/2.1.0-valid/malloc-vs-local-4.c.sarif: New test.
      	* sarif-replay.dg/2.1.0-valid/signal-1.c.moved.sarif: Update
      	expected output to show logical location and for consolidation of
      	events into runs.
      	* sarif-replay.dg/2.1.0-valid/signal-1.c.sarif: Likewise.
      	* sarif-replay.dg/2.1.0-valid/spec-example-4.sarif: Likewise.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      2af54192
    • David Malcolm's avatar
      sarif-replay: quote source from artifact contents [PR117943] · 778336e0
      David Malcolm authored
      
      The diagnostic source-quoting machinery uses class file_cache
      implemented in gcc/input.cc for (re)reading the source when
      issuing diagnostics.
      
      When sarif-replay issues a saved diagnostic it might be running
      in a different path to where the .sarif file was captured, or
      on an entirely different machine.
      
      Previously such invocations would lead to the source-quoting
      silently failing, even if the content of the file is recorded
      in the .sarif file in the artifact "contents" property (which
      gcc populates when emitting .sarif output).
      
      This patch:
      - adds the ability for slots in file_cache to be populated from memory
      rather than from the filesystem
      - exposes it in libgdiagnostics via a new entrypoint
      - uses this in sarif-replay for any artifacts with a "contents"
      property, so that source-quoting uses that rather than trying to read
      from the path on the filesystem
      
      gcc/ChangeLog:
      	PR sarif-replay/117943
      	* doc/libgdiagnostics/topics/physical-locations.rst
      	(diagnostic_manager_new_file): Drop "const" from return type.
      	* doc/libgdiagnostics/tutorial/02-physical-locations.rst: Drop
      	"const" from "main_file" decl.
      	* input.cc (file_cache::add_buffered_content): New.
      	(file_cache_slot::set_content): New.
      	(file_cache_slot::dump): Use m_file_path being null rather than
      	m_fp to determine empty slots.  Dump m_fp.
      	(find_end_of_line): Drop "const" from return type and param.  Add
      	forward decl.
      	(file_cache_slot::get_next_line): Fix "const"-ness.
      	(selftest::test_reading_source_buffer): New.
      	(selftest::input_cc_tests): Call it.
      	* input.h (file_cache::add_buffered_content): New decl.
      	* libgdiagnostics++.h (class file): Drop const-ness from m_inner.
      	(file::set_buffered_content): New.
      	* libgdiagnostics.cc (class content_buffer): New.
      	(diagnostic_file::diagnostic_file): Add "mgr" param.
      	(diagnostic_file::get_content): New.
      	(diagnostic_file::set_buffered_content): New.
      	(diagnostic_file::m_mgr): New.
      	(diagnostic_file::m_content): New.
      	(diagnostic_manager::new_file): Drop const-ness.  Pass *this to
      	ctor.
      	(diagnostic_file::set_buffered_content): New.
      	(diagnostic_manager_new_file): Drop "const" from return type.
      	(diagnostic_file_set_buffered_content): New entrypoint.
      	(diagnostic_manager_debug_dump_file): Dump the content size,
      	if any.
      	* libgdiagnostics.h (diagnostic_manager_new_file): Drop "const"
      	from return type.
      	(diagnostic_file_set_buffered_content): New decl.
      	* libgdiagnostics.map (diagnostic_file_set_buffered_content): New
      	symbol.
      	* libsarifreplay.cc (sarif_replayer::m_artifacts_arr): Convert
      	from json::value to json::array.
      	(sarif_replayer::handle_run_obj): Call handle_artifact_obj
      	on all artifacts.
      	(sarif_replayer::handle_artifact_obj): New.
      
      gcc/testsuite/ChangeLog:
      	PR sarif-replay/117943
      	* sarif-replay.dg/2.1.0-valid/error-with-note.sarif: Update
      	expected output to include quoted source code and underlines.
      	* sarif-replay.dg/2.1.0-valid/signal-1.c.moved.sarif: New test.
      	* sarif-replay.dg/2.1.0-valid/signal-1.c.sarif: Update expected
      	output to include quoted source code and underlines.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      778336e0
    • David Malcolm's avatar
      diagnostics: move libgdiagnostics dc from sinks into diagnostic_manager · ea7da640
      David Malcolm authored
      
      libgdiagnostics was written before the fixes for PR other/116613 allowed
      a diagnostic_context to have multiple output sinks.
      
      Hence each libgdiagnostics sink had its own diagnostic_context with just
      one diagnostic_output_format.
      
      This wart is no longer necessary and makes it harder to move state
      into the manager/context; in particular for quoting source code
      from the .sarif file (PR sarif-replay/117943).
      
      Simplify, by making libgdiagnostics' implementation more similar to
      GCC's implementation, by moving the diagnostic_context from sink into
      diagnostic_manager.
      
      Doing so requires generalizing where the
      diagnostic_source_printing_options comes from in class
      diagnostic_text_output_format: for GCC we use
      the instance within the diagnostic_context, whereas for
      libgdiagnostics each diagnostic_text_sink has its own instance.
      
      No functional change intended.
      
      gcc/c-family/ChangeLog:
      	PR sarif-replay/117943
      	* c-format.cc (selftest::test_type_mismatch_range_labels): Use
      	dc.m_source_printing.
      	* c-opts.cc (c_diagnostic_text_finalizer): Use source-printing
      	options from text_output.
      
      gcc/cp/ChangeLog:
      	PR sarif-replay/117943
      	* error.cc (auto_context_line::~auto_context_line): Use
      	source-printing options from text_output.
      
      gcc/ChangeLog:
      	PR sarif-replay/117943
      	* diagnostic-format-text.cc
      	(diagnostic_text_output_format::append_note): Use source-printing
      	options from text_output.
      	(diagnostic_text_output_format::update_printer): Copy
      	source-printing options from dc.
      	(default_diagnostic_text_finalizer): Use source-printing
      	options from text_output.
      	* diagnostic-format-text.h
      	(diagnostic_text_output_format::diagnostic_text_output_format):
      	Add optional diagnostic_source_printing_options param, using
      	the context's if null.
      	(diagnostic_text_output_format::get_source_printing_options): New
      	accessor.
      	(diagnostic_text_output_format::m_source_printing): New field.
      	* diagnostic-path.cc (event_range::print): Use source-printing
      	options from text_output.
      	(selftest::test_interprocedural_path_1): Use source-printing
      	options from dc.
      	* diagnostic-show-locus.cc
      	(gcc_rich_location::add_location_if_nearby): Likewise.
      	(diagnostic_context::maybe_show_locus): Add "opts" param
      	and use in place of m_source_printing.  Pass it to source_policy
      	ctor.
      	(diagnostic_source_print_policy::diagnostic_source_print_policy):
      	Add overload taking a const diagnostic_source_printing_options &.
      	* diagnostic.cc (diagnostic_context::initialize): Pass nullptr
      	for source options when creating text sink, so that it uses
      	the dc's options.
      	(diagnostic_context::dump): Add an "output sinks:" heading and
      	print "(none)" if there aren't any.
      	(diagnostic_context::set_output_format): Split out code into...
      	(diagnostic_context::remove_all_output_sinks): ...this new
      	function.
      	* diagnostic.h
      	(diagnostic_source_print_policy::diagnostic_source_print_policy):
      	Add overload taking a const diagnostic_source_printing_options &.
      	(diagnostic_context::maybe_show_locus): Add "opts" param.
      	(diagnostic_context::remove_all_output_sinks): New decl.
      	(diagnostic_context::m_source_printing): New field.
      	(diagnostic_show_locus): Add "opts" param and pass to
      	maybe_show_locus.
      	* libgdiagnostics.cc (sink::~sink): Delete.
      	(sink::begin_group): Delete.
      	(sink::end_group): Delete.
      	(sink::emit): Delete.
      	(sink::m_dc): Drop field.
      	(diagnostic_text_sink::on_begin_text_diagnostic): Delete.
      	(diagnostic_text_sink::get_source_printing_options): Use
      	m_souece_printing.
      	(diagnostic_text_sink::m_current_logical_loc): Drop field.
      	(diagnostic_text_sink::m_inner_sink): New field.
      	(diagnostic_text_sink::m_source_printing): New field.
      	(diagnostic_manager::diagnostic_manager): Update for changes
      	to fields.  Initialize m_dc.
      	(diagnostic_manager::~diagnostic_manager): Call diagnostic_finish.
      	(diagnostic_manager::get_file_cache): Drop.
      	(diagnostic_manager::get_dc): New accessor.
      	(diagnostic_manager::begin_group): Reimplement.
      	(diagnostic_manager::end_group): Reimplement.
      	(diagnostic_manager::get_prev_diag_logical_loc): New accessor.
      	(diagnostic_manager::m_dc): New field.
      	(diagnostic_manager::m_file_cache): Drop field.
      	(diagnostic_manager::m_edit_context): Convert to a std::unique_ptr
      	so that object can be constructed after m_dc is initialized.
      	(diagnostic_manager::m_prev_diag_logical_loc): New field.
      	(diagnostic_text_sink::diagnostic_text_sink): Reimplement.
      	(get_color_rule): Delete.
      	(diagnostic_text_sink::set_colorize): Reimplement.
      	(diagnostic_text_sink::text_starter): New.
      	(sarif_sink::sarif_sink): Reimplement.
      	(diagnostic_manager::write_patch): Update for change to
      	m_edit_context.
      	(diagnostic_manager::emit): Update now that each sink has a
      	corresponding diagnostic_output_format object within m_dc.
      
      gcc/fortran/ChangeLog:
      	PR sarif-replay/117943
      	* error.cc (gfc_diagnostic_text_starter): Use source-printing
      	options from text_output.
      
      gcc/testsuite/ChangeLog:
      	PR sarif-replay/117943
      	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc
      	(custom_diagnostic_text_finalizer): Use source-printing options
      	from text_output.
      	* gcc.dg/plugin/diagnostic_plugin_xhtml_format.cc
      	(xhtml_builder::make_element_for_diagnostic): Use source-printing
      	options from diagnostic_context.
      	* gcc.dg/plugin/expensive_selftests_plugin.cc (test_richloc):
      	Likewise.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      ea7da640
    • David Malcolm's avatar
      diagnostics: implement file_cache::dump · e55cfebd
      David Malcolm authored
      
      This is purely for use when debugging.
      
      gcc/ChangeLog:
      	* diagnostic.cc (diagnostic_context::dump): Dump m_file_cache.
      	* input.cc (file_cache_slot::dump): New decls and implementations.
      	(file_cache::dump): New.
      	* input.h (file_cache::dump): New decl.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      e55cfebd
    • Dimitar Dimitrov's avatar
      testsuite: Require int32plus target for gcc.dg/pr117816.c · 450ad5d4
      Dimitar Dimitrov authored
      
      Memmove destination overflows if size of int is less than 3, resulting in
      spurious test failures.  Fix by adding a requirement for effective
      target int32plus.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/pr117816.c: Require effective target int32plus.
      
      Signed-off-by: default avatarDimitar Dimitrov <dimitar@dinux.eu>
      Unverified
      450ad5d4
    • Robin Dapp's avatar
      docs: Fix [us]abd pattern name. · 65c09538
      Robin Dapp authored
      The uabd and sabd optab name is missing a 3 suffix (for its three
      arguments).  This patch adds it.
      
      gcc/ChangeLog:
      
      	* doc/md.texi: Add "3" suffix.
      65c09538
    • Robin Dapp's avatar
      vect: Do not try to duplicate_and_interleave one-element mode. · 99eef0cf
      Robin Dapp authored
      PR112694 shows that we try to create sub-vectors of single-element
      vectors because can_duplicate_and_interleave_p returns true.
      The problem resurfaced in PR116611.
      
      This patch makes can_duplicate_and_interleave_p return false
      if count / nvectors > 0 and removes the corresponding check in the riscv
      backend.
      
      This partially gets rid of the FAIL in slp-19a.c.  At least when built
      with cost model we don't have LOAD_LANES anymore.  Without cost model,
      as in the test suite, we choose a different path and still end up with
      LOAD_LANES.
      
      Bootstrapped and regtested on x86 and power10, regtested on
      rv64gcv_zvfh_zvbb.  Still waiting for the aarch64 results.
      
      Regards
       Robin
      
      gcc/ChangeLog:
      
      	PR target/112694
      	PR target/116611.
      
      	* config/riscv/riscv-v.cc (expand_vec_perm_const): Remove early
      	return.
      	* tree-vect-slp.cc (can_duplicate_and_interleave_p): Return
      	false when we cannot create sub-elements.
      99eef0cf
    • Robin Dapp's avatar
      RISC-V: Fix compress shuffle pattern [PR117383]. · ec870d3b
      Robin Dapp authored
      This patch makes vcompress use the tail-undisturbed policy by default
      and also uses the proper VL.
      
      	PR target/117383
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-protos.h (enum insn_type): Use TU policy.
      	* config/riscv/riscv-v.cc (shuffle_compress_patterns): Set VL.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/binop/vcompress-avlprop-1.c:
      	Expect tu.
      	* gcc.target/riscv/rvv/autovec/pr117383.c: New test.
      ec870d3b
    • Robin Dapp's avatar
      RISC-V: Increase cost for vec_construct [PR118019]. · ce199a95
      Robin Dapp authored
      For a generic vec_construct from scalar elements we need to load each
      scalar element and move it over to a vector register.
      Right now we only use a cost of 1 per element.
      
      This patch uses register-move cost as well as scalar_to_vec and
      multiplies it with the number of elements in the vector instead.
      
      	PR target/118019
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv.cc (riscv_builtin_vectorization_cost):
      	Increase vec_construct cost.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/pr118019.c: New test.
      ce199a95
    • Jonathan Wakely's avatar
      libstdc++: Initialize all members of hashtable local iterators · f1309dbc
      Jonathan Wakely authored
      Currently the _M_bucket members are left uninitialized for
      default-initialized local iterators, and then copy construction copies
      indeterminate values. We should just ensure they're initialized on
      construction.
      
      Setting them to zero makes default-initialization consistent with
      value-initialization and avoids indeterminate values.
      
      For the _Local_iterator_base<..., false> specialization we preserve the
      existing behaviour of setting _M_bucket_count to -1 in the default
      constructor, as a sentinel value to indicate there's no hash object
      present.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/hashtable_policy.h (_Local_iterator_base): Use
      	default member-initializers.
      Unverified
      f1309dbc
    • Jonathan Wakely's avatar
      libstdc++: Use alias-declarations in bits/hashtable_policy,h · fdfd0640
      Jonathan Wakely authored
      This file is only for C++11 and later, so replace typedefs with
      alias-declarations for clarity. Also remove redundant std::
      qualification on size_t, ptrdiff_t etc.
      
      We can also remove the result_type, first_argument_type and
      second_argument_type typedefs from the range hashers. We don't need
      those types to follow the C++98 adaptable function object protocol.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/hashtable_policy.h: Replace typedefs with
      	alias-declarations. Remove redundant std:: qualification.
      	(_Mod_range_hashing, _Mask_range_hashing): Remove adaptable
      	function object typedefs.
      Unverified
      fdfd0640
    • Jonathan Wakely's avatar
      libstdc++: Simplify storage of hasher in local iterators · fa8475b9
      Jonathan Wakely authored
      The fix for PR libstdc++/56267 (relating to the lifetime of the hash
      object stored in a local iterator) has undefined behaviour, as it relies
      on being able to call a member function on an empty object that never
      started its lifetime. Although the member function probably doesn't care
      about the empty object's state, this is still technically undefined
      because there is no object of that type at that address. It's also
      possible that the hash object would have a stricter alignment than the
      _Hash_code_storage object, so that the reinterpret_cast would produce a
      misaligned pointer.
      
      This fix replaces _Local_iterator_base's _Hash_code_storage base-class
      with a new class template containing a potentially-overlapping (i.e.
      [[no_unique_address]]) union member.  This means that we always have
      storage of the correct type, and it can be initialized/destroyed when
      required. We no longer need a reinterpret_cast that gives us a pointer
      that we should not dereference.
      
      It would be nice if we could just use a union containing the _Hash
      object as a data member of _Local_iterator_base, but that would be an
      ABI change. The _Hash_code_storage that contains the _Hash object is the
      first base-class, before the _Node_iterator_base base-class. Making the
      union a data member of _Local_iterator_base would make it come after the
      _Node_iterator_base base instead of before it, altering the layout.
      
      Since we're changing _Hash_code_storage anyway, we can replace it with a
      new class template that stores the _Hash object itself in the union,
      rather than a _Hash_code_base that holds the _Hash. This removes an
      unnecessary level of indirection in the class hierarchy. This change
      requires the effects of _Hash_code_base::_M_bucket_index to be inlined
      into the _Local_iterator_base::_M_incr function, but that's easy.
      
      We don't need separate specializations of _Hash_obj_storage for an empty
      hash function and a non-empty one. Using [[no_unique_address]] gives us
      an empty base-class when possible.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/hashtable_policy.h (_Hash_code_storage): Remove.
      	(_Hash_obj_storage): New class template. Store the hash
      	function as a union member instead of using a byte buffer.
      	(_Local_iterator_base): Use _Hash_obj_storage instead of
      	_Hash_code_storage, adjust members that construct and destroy
      	the hash object.
      	(_Local_iterator_base::_M_incr): Calculate bucket index.
      Unverified
      fa8475b9
    • Jonathan Wakely's avatar
      libstdc++: Further simplify _Hashtable inheritance hierarchy · 689d4abc
      Jonathan Wakely authored
      The main change here is using [[no_unique_address]] instead of the Empty
      Base-class Optimization. Using the attribute allows us to use data
      members instead of base-classes. That simplifies the inheritance
      hierarchy, which means less work for the compiler. It also means that
      ADL has fewer associated classes and associated namespaces to consider,
      further reducing the work the compiler has to do.
      
      Reducing the differences between the _Hashtable_ebo_helper primary
      template and the partial specialization means we no longer need to use
      member functions to access the stored object, because it's now always a
      data member called _M_obj.  This means we can also remove a number of
      other helper functions that were using those member functions to access
      the object, for example we can swap the _Hash and _Equal objects
      directly in _Hashtable::swap instead of calling _Hashtable_base::_M_swap
      which then calls _Hash_code_base::_M_swap.
      
      Although [[no_unique_address]] would allow us to reduce the size for
      empty types that are also 'final', doing so would be an ABI break
      because those types were previously excluded from using the EBO. So we
      still need the _Hashtable_ebo_helper class template and a partial
      specialization, so that we only use the attribute under exactly the same
      conditions as we previously used the EBO. This could be avoided with a
      non-standard [[no_unique_address(expr)]] attribute that took a boolean
      condition, or with reflection and token sequence injection, but we don't
      have either of those things.
      
      Because _Hashtable_ebo_helper is no longer used as a base-class we don't
      need to disambiguate possible identical bases, so it doesn't need an
      integral non-type template parameter.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/hashtable.h (_Hashtable::swap): Swap hash
      	function and equality predicate here. Inline allocator swap
      	instead of using __alloc_on_swap.
      	* include/bits/hashtable_policy.h (_Hashtable_ebo_helper):
      	Replace EBO with no_unique_address attribute. Remove NTTP.
      	(_Hash_code_base): Replace base class with data member using
      	no_unique_address attribute.
      	(_Hash_code_base::_M_swap): Remove.
      	(_Hash_code_base::_M_hash): Remove.
      	(_Hashtable_base): Replace base class with data member using
      	no_unique_address attribute.
      	(_Hashtable_base::_M_swap): Remove.
      	(_Hashtable_alloc): Replace base class with data member using
      	no_unique_address attribute.
      Unverified
      689d4abc
    • Jonathan Wakely's avatar
      libstdc++: Fix fancy pointer support in linked lists [PR57272] · 2ce99c00
      Jonathan Wakely authored
      The union members I used in the new _Node types for fancy pointers only
      work for value types that are trivially default constructible. This
      change replaces the anonymous union with a named union so it can be
      given a default constructor and destructor, to leave the variant member
      uninitialized.
      
      This also fixes the incorrect macro names in the alloc_ptr_ignored.cc
      tests as pointed out by François, and fixes some std::list pointer
      confusions that the fixed alloc_ptr_ignored.cc test revealed.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/57272
      	* include/bits/forward_list.h (__fwd_list::_Node): Add
      	user-provided special member functions to union.
      	* include/bits/stl_list.h (__list::_Node): Likewise.
      	(_Node_base::_M_hook, _Node_base::swap): Use _M_base() instead
      	of std::pointer_traits::pointer_to.
      	(_Node_base::_M_transfer): Likewise. Add noexcept.
      	(_List_base::_M_put_node): Use 'if constexpr' to avoid using
      	pointer_traits::pointer_to when not necessary.
      	(_List_base::_M_destroy_node): Fix parameter to be the pointer
      	type used internally, not the allocator's pointer.
      	(list::_M_create_node): Likewise.
      	* testsuite/23_containers/forward_list/requirements/explicit_instantiation/alloc_ptr.cc:
      	Check explicit instantiation of non-trivial value type.
      	* testsuite/23_containers/list/requirements/explicit_instantiation/alloc_ptr.cc:
      	Likewise.
      	* testsuite/23_containers/forward_list/requirements/explicit_instantiation/alloc_ptr_ignored.cc:
      	Fix macro name.
      	* testsuite/23_containers/list/requirements/explicit_instantiation/alloc_ptr_ignored.cc:
      	Likewise.
      Unverified
      2ce99c00
    • Mark Harmstone's avatar
      Fix non-aligned CodeView symbols · a895642e
      Mark Harmstone authored
      CodeView symbols in PDB files are aligned to four-byte boundaries. It's
      not really clear what logic MSVC uses to enforce this; sometimes the
      symbols are padded in the object file, sometimes the linker seems to do
      the work.
      
      It makes more sense to do this in the compiler, so fix the two instances
      where we can write symbols with a non-aligned length. S_FRAMEPROC is
      unusually not a multiple of 4, so will always have 2 bytes padding.
      S_INLINESITE is followed by variable-length "binary annotations", so
      will also usually have padding.
      
      gcc/
      	* dwarf2codeview.cc (write_s_frameproc): Align output.
      	(write_s_inlinesite): Align output.
      a895642e
    • GCC Administrator's avatar
      Daily bump. · 43377649
      GCC Administrator authored
      43377649
  2. Dec 15, 2024
    • John David Anglin's avatar
      hppa: Implement TARGET_FRAME_POINTER_REQUIRED · 3e7ae868
      John David Anglin authored
      If a function receives nonlocal gotos, it needs to save the frame
      pointer in the argument save area.  This ensures that LRA sets
      frame_pointer_needed when it saves arguments in the save area.
      
      2024-12-15  John David Anglin  <danglin@gcc.gnu.org>
      
      gcc/ChangeLog:
      
      	PR target/118018
      	* config/pa/pa.cc (pa_frame_pointer_required): Declare and
      	implement.
      	(TARGET_FRAME_POINTER_REQUIRED): Define.
      3e7ae868
    • John David Anglin's avatar
      testsuite: Enable TImode tests on hppa64 · 9573fd7b
      John David Anglin authored
      2024-12-15  John David Anglin  <danglin@gcc.gnu.org>
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/tree-ssa/ivopts-1.c: Enable TImode tests on hppa64.
      9573fd7b
    • John David Anglin's avatar
      testsuite: xfail scan-assembler-times in c-c++-common/gomp/unroll-[45].c · acca546b
      John David Anglin authored
      Count differs on hppa*-*-hpux* due to hpux specific directives.
      
      2024-12-15  John David Anglin  <danglin@gcc.gnu.org>
      
      gcc/testsuite/ChangeLog:
      
      	* c-c++-common/gomp/unroll-4.c: xfail scan-assembler-times
      	"dummy" for hppa*-*-hpux*.
      	* c-c++-common/gomp/unroll-5.c: Likewise.
      acca546b
    • John David Anglin's avatar
      testsuite: Require lto in g++.dg/modules/enum-14.C · de0033ba
      John David Anglin authored
      2024-12-15  John David Anglin  <danglin@gcc.gnu.org>
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/modules/enum-14.C: Require lto.
      de0033ba
    • Iain Sandoe's avatar
      c++, coroutines: Use finish_if_stmt in a missed case. · fe545ea3
      Iain Sandoe authored
      
      Just shorter code.
      
      gcc/cp/ChangeLog:
      
      	* coroutines.cc
      	(cp_coroutine_transform::wrap_original_function_body): Use
      	finish_if_stmt instead of manually applying the same process.
      
      Signed-off-by: default avatarIain Sandoe <iain@sandoe.co.uk>
      fe545ea3
    • Iain Sandoe's avatar
      c++, coroutines: Make the resume index consistent for debug. · 3e4ca896
      Iain Sandoe authored
      
      At present, we only update the resume index when we actually are
      at the stage that the coroutine is considered suspended. This is
      on the basis that it is UB to resume or destroy a coroutines that
      is not suspended (and therefore we never need to access this value
      otherwise).  However, it is possible that someone could set a debug
      breakpoint on the resume which can be reached without suspending
      if await_ready() returns true.  In that case, the debugger would
      read an incorrect resume index.  Fixed by moving the update to
      just before the test for ready.
      
      gcc/cp/ChangeLog:
      
      	* coroutines.cc (expand_one_await_expression): Update the
      	resume index before checking if the coroutine is ready.
      
      Signed-off-by: default avatarIain Sandoe <iain@sandoe.co.uk>
      3e4ca896
    • Iain Sandoe's avatar
      c++, coroutines:Ensure bind exprs are visited once [PR98935]. · bd8c7e71
      Iain Sandoe authored
      
      Recent changes in the C++ FE and the coroutines implementation have
      exposed a latent issue in which a bind expression containing a var
      that we need to capture in the coroutine state gets visited twice.
      This causes an ICE (from a checking assert).  Fixed by adding a pset
      to the relevant tree walk.  Exit the callback early when the tree is
      not a BIND_EXPR.
      
      	PR c++/98935
      
      gcc/cp/ChangeLog:
      
      	* coroutines.cc (register_local_var_uses): Add a pset to the
      	tree walk to avoid visiting the same BIND_EXPR twice.  Make
      	an early exit for cases that the callback does not apply.
      	(cp_coroutine_transform::apply_transforms): Add a pset to the
      	tree walk for register_local_vars.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/coroutines/pr98935.C: New test.
      
      Signed-off-by: default avatarIain Sandoe <iain@sandoe.co.uk>
      bd8c7e71
    • Tamar Christina's avatar
      arm: fix bootstrap after MVE changes · 7b5599db
      Tamar Christina authored
      The recent commits for MVE on Saturday have broken armhf bootstrap due to a
      -Werror false positive:
      
          inlined from 'virtual rtx_def* {anonymous}::vstrq_scatter_base_impl::expand(arm_mve::function_expander&) const' at /gcc/config/arm/arm-mve-builtins-base.cc:352:17:
      ./genrtl.h:38:16: error: 'new_base' may be used uninitialized [-Werror=maybe-uninitialized]
         38 |   XEXP (rt, 1) = arg1;
      /gcc/config/arm/arm-mve-builtins-base.cc: In member function 'virtual rtx_def* {anonymous}::vstrq_scatter_base_impl::expand(arm_mve::function_expander&) const':
      /gcc/config/arm/arm-mve-builtins-base.cc:311:26: note: 'new_base' was declared here
        311 |     rtx insns, base_ptr, new_base;
            |                          ^~~~~~~~
      In function 'rtx_def* init_rtx_fmt_ee(rtx, machine_mode, rtx, rtx)',
          inlined from 'rtx_def* gen_rtx_fmt_ee_stat(rtx_code, machine_mode, rtx, rtx)' at ./genrtl.h:50:26,
          inlined from 'virtual rtx_def* {anonymous}::vldrq_gather_base_impl::expand(arm_mve::function_expander&) const' at /gcc/config/arm/arm-mve-builtins-base.cc:527:17:
      ./genrtl.h:38:16: error: 'new_base' may be used uninitialized [-Werror=maybe-uninitialized]
         38 |   XEXP (rt, 1) = arg1;
      /gcc/config/arm/arm-mve-builtins-base.cc: In member function 'virtual rtx_def* {anonymous}::vldrq_gather_base_impl::expand(arm_mve::function_expander&) const':
      /gcc/config/arm/arm-mve-builtins-base.cc:486:26: note: 'new_base' was declared here
        486 |     rtx insns, base_ptr, new_base;
      
      To fix it I just initialize the value.
      
      gcc/ChangeLog:
      
      	* config/arm/arm-mve-builtins-base.cc (expand): Initialize new_base.
      7b5599db
    • Jakub Jelinek's avatar
      Shrink back size of tree_exp from 40 bytes to 32 · f359fbb3
      Jakub Jelinek authored
      The following patch implements what I've mentioned in the 64-bit
      location_t thread.
      struct tree_exp had unsigned condition_uid member added for something
      rarely used (-fcondition-coverage) and even there used only on very small
      subset of trees only for the duration of the gimplification.
      
      The following patch uses a hash_map instead, which allows shrinking
      tree_exp to its previous size (32 bytes + (number of operands - 1) * sizeof
      (tree)).
      
      2024-12-15  Jakub Jelinek  <jakub@redhat.com>
      
      	* tree-core.h (struct tree_exp): Remove condition_uid member.
      	* tree.h (SET_EXPR_UID, EXPR_COND_UID): Remove.
      	* gimplify.cc (nextuid): Rename to ...
      	(nextconduid): ... this.
      	(cond_uids): New static variable.
      	(next_cond_uid, reset_cond_uid): Adjust for the renaming,
      	formatting fix.
      	(tree_associate_condition_with_expr): New function.
      	(shortcut_cond_r, tag_shortcut_cond, shortcut_cond_expr): Use it
      	instead of SET_EXPR_UID.
      	(gimplify_cond_expr): Look up cond_uid in cond_uids hash map if
      	non-NULL instead of using EXPR_COND_UID.
      	(gimplify_function_tree): Delete cond_uids and set it to NULL.
      f359fbb3
    • Paul Thomas's avatar
      Fortran: Pointer fcn results must not be finalized [PR117897] · a87bf1d2
      Paul Thomas authored
      2024-12-15  Paul Thomas  <pault@gcc.gnu.org>
      
      gcc/fortran
      	PR fortran/117897
      	* trans-expr.cc (gfc_trans_assignment_1): RHS pointer function
      	results must not be finalized.
      
      gcc/testsuite/
      	PR fortran/117897
      	* gfortran.dg/finalize_59.f90: New test.
      a87bf1d2
    • GCC Administrator's avatar
      Daily bump. · c5609a75
      GCC Administrator authored
      c5609a75
  3. Dec 14, 2024
    • Ian Lance Taylor's avatar
      libbacktrace: don't use ZSTD_CLEVEL_DEFAULT · 3e343ef7
      Ian Lance Taylor authored
      PR 117812 reports that testing GCC with zstd 1.3.4 fails because
      ZSTD_CLEVEL_DEFAULT is not defined, so avoid using it.
      
      	PR libbacktrace/117812
      	* zstdtest.c (test_large): Use 3 rather than ZSTD_CLEVEL_DEFAULT
      3e343ef7
    • Jovan Vukic's avatar
      [PATCH v3] match.pd: Add pattern to simplify `(a - 1) & -a` to `0` · ad519f46
      Jovan Vukic authored
      Thank you for the feedback. I have made the minor changes that were requested.
      Additionally, I extracted the repetitive code into a reusable helper function,
      match_plus_neg_pattern, making the code much more readable. Furthermore, the
      logic, code, and tests remain the same as in version 2 of the patch.
      
      gcc/ChangeLog:
      
      	* match.pd: New pattern.
      	* simplify-rtx.cc (match_plus_neg_pattern): New helper function.
      	(simplify_context::simplify_binary_operation_1): New
      	code to handle (a - 1) & -a, (a - 1) | -a and (a - 1) ^ -a.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/tree-ssa/bitops-11.c: New test.
      ad519f46
    • Jose E. Marchesi's avatar
      bpf: fix build adding new required arg to RESOLVE_OVERLOADED_BUILTIN · 6866547e
      Jose E. Marchesi authored
      gcc/ChangeLog
      
      	* config/bpf/bpf.cc (bpf_resolve_overloaded_builtin): Add argument
      	`complain'.
      6866547e
    • Heiko Eißfeldt's avatar
      doc: Fix typos for --enable-host-pie docs in install.texi · a7df4961
      Heiko Eißfeldt authored
      gcc/ChangeLog:
      
      	* doc/install.texi (Configuration): Fix typos in documentation
      	for --enable-host-pie.
      Unverified
      a7df4961
    • Jakub Jelinek's avatar
      gimple-fold: Fix the recent ifcombine optimization for _BitInt [PR118023] · 7f4e85a9
      Jakub Jelinek authored
      The BIT_FIELD_REF verifier has:
                if (INTEGRAL_TYPE_P (TREE_TYPE (op))
                    && !type_has_mode_precision_p (TREE_TYPE (op)))
                  {
                    error ("%qs of non-mode-precision operand", code_name);
                    return true;
                  }
      check among other things, so one can't extract something out of say
      _BitInt(63) or _BitInt(4096).
      The new ifcombine optimization happily creates such BIT_FIELD_REFs
      and ICEs during their verification.
      
      The following patch fixes that by rejecting those in decode_field_reference.
      
      2024-12-14  Jakub Jelinek  <jakub@redhat.com>
      
      	PR tree-optimization/118023
      	* gimple-fold.cc (decode_field_reference): Return NULL_TREE if
      	inner has non-type_has_mode_precision_p integral type.
      
      	* gcc.dg/bitint-119.c: New test.
      7f4e85a9
    • Jakub Jelinek's avatar
      warn-access: Fix up matching_alloc_calls_p [PR118024] · 9537ca5a
      Jakub Jelinek authored
      The following testcase ICEs because of a bug in matching_alloc_calls_p.
      The loop was apparently meant to be walking the two attribute chains
      in lock-step, but doesn't really do that.  If the first lookup_attribute
      returns non-NULL, the second one is not done, so rmats in that case can
      be some random unrelated attribute rather than "malloc" attribute; the
      body assumes even rmats if non-NULL is "malloc" attribute and relies
      on its argument to be a "malloc" argument and if it is some other
      attribute with incompatible attribute, it just crashes.
      
      Now, fixing that in the obvious way, instead of doing
      (amats = lookup_attribute ("malloc", amats))
       || (rmats = lookup_attribute ("malloc", rmats))
      in the condition do
      ((amats = lookup_attribute ("malloc", amats)),
       (rmats = lookup_attribute ("malloc", rmats)),
       (amats || rmats))
      fixes the testcase but regresses Wmismatched-dealloc-{2,3}.c tests.
      The problem is that walking the attribute lists in a lock-step is obviously
      a very bad idea, there is no requirement that the same deallocators are
      present in the same order on both decls, e.g. there could be an extra malloc
      attribute without argument in just one of the lists, or the order of say
      free/realloc could be swapped, etc.  We don't generally document nor enforce
      any particular ordering of attributes (even when for some attributes we just
      handle the first one rather than all).
      
      So, this patch instead simply splits it into two loops, the first one walks
      alloc_decl attributes, the second one walks dealloc_decl attributes.
      If the malloc attribute argument is a built-in, that doesn't change
      anything, and otherwise we have the chance to populate the whole
      common_deallocs hash_set in the first loop and then can check it in the
      second one (and don't need to use more expensive add method on it, can just
      check contains there).  Not to mention that it also fixes the case when
      the function would incorrectly return true if there wasn't a common
      deallocator between the two, but dealloc_decl had 2 malloc attributes with
      the same deallocator.
      
      2024-12-14  Jakub Jelinek  <jakub@redhat.com>
      
      	PR middle-end/118024
      	* gimple-ssa-warn-access.cc (matching_alloc_calls_p): Walk malloc
      	attributes of alloc_decl and dealloc_decl in separate loops rather
      	than in lock-step.  Use common_deallocs.contains rather than
      	common_deallocs.add in the second loop.
      
      	* gcc.dg/pr118024.c: New test.
      9537ca5a
    • Jakub Jelinek's avatar
      opts: Use OPTION_SET_P instead of magic value 2 for -fshort-enums default [PR118011] · 18f0b7d5
      Jakub Jelinek authored
      The magic values for default (usually -1 or sometimes 2) for some options
      are from times we haven't global_options_set, I think we should eventually
      get rid of all of those.
      
      The PR is about gcc -Q --help=optimizers reporting -fshort-enums as
      [enabled] when it is disabled.
      For this the following patch is just partial fix; with explicit
      gcc -Q --help=optimizers -fshort-enums
      or
      gcc -Q --help=optimizers -fno-short-enums
      it already worked correctly before, with this patch it will report
      even with just
      gcc -Q --help=optimizers
      correct value on most targets, except 32-bit arm with some options or
      defaults, so I think it is a step in the right direction.
      
      But, as I wrote in the PR, process_options isn't done before --help=
      and even shouldn't be in its current form where it warns on some option
      combinations or errors or emits sorry on others, so I think ideally
      process_options should have some bool argument whether it is done for
      --help= purposes or not, if yes, not emit warnings and just adjust the
      options, otherwise do what it currently does.
      
      2024-12-14  Jakub Jelinek  <jakub@redhat.com>
      
      	PR c/118011
      gcc/
      	* opts.cc (init_options_struct): Don't set opts->x_flag_short_enums to
      	2.
      	* toplev.cc (process_options): Test !OPTION_SET_P (flag_short_enums)
      	rather than flag_short_enums == 2.
      gcc/ada/
      	* gcc-interface/misc.cc (gnat_post_options): Test
      	!OPTION_SET_P (flag_short_enums) rather than flag_short_enums == 2.
      18f0b7d5
    • Nathaniel Shead's avatar
      c++: Disallow decomposition of lambda bases [PR90321] · a6a15bc5
      Nathaniel Shead authored
      
      Decomposition of lambda closure types is not allowed by
      [dcl.struct.bind] p6, since members of a closure have no name.
      
      r244909 made this an error, but missed the case where a lambda is used
      as a base.  This patch moves the check to find_decomp_class_base to
      handle this case.
      
      As a drive-by improvement, we also slightly improve the diagnostics to
      indicate why a base class was being inspected.  Ideally the diagnostic
      would point directly at the relevant base, but there doesn't seem to be
      an easy way to get this location just from the binfo so I don't worry
      about that here.
      
      	PR c++/90321
      
      gcc/cp/ChangeLog:
      
      	* decl.cc (find_decomp_class_base): Check for decomposing a
      	lambda closure type.  Report base class chains if needed.
      	(cp_finish_decomp): Remove no-longer-needed check.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp1z/decomp62.C: New test.
      
      Signed-off-by: default avatarNathaniel Shead <nathanieloshead@gmail.com>
      Reviewed-by: default avatarMarek Polacek <polacek@redhat.com>
      a6a15bc5
Loading