]> gcc.gnu.org Git - gcc.git/log
gcc.git
2 months ago[committed] [RISC-V] Skip zbs-ext-2.c for -Oz as well
Jeff Law [Sat, 22 Jun 2024 16:39:51 +0000 (10:39 -0600)]
[committed] [RISC-V] Skip zbs-ext-2.c for -Oz as well

> the test should probably also be skipped on -Oz:
>
>                  === gcc: Unexpected fails for rv64imafdc lp64d medlow  ===
> FAIL: gcc.target/riscv/zbs-ext-2.c  -Oz   scan-assembler-times andi\t 1
> FAIL: gcc.target/riscv/zbs-ext-2.c  -Oz   scan-assembler-times andn\t 1
> FAIL: gcc.target/riscv/zbs-ext-2.c  -Oz   scan-assembler-times li\t 1
Yea.  Just re-ran thing and sure enough we need to skip -Oz as well.  So
committing the obvious change....

gcc/testsuite/

* gcc.target/riscv/zbs-ext-2.c: Also skip for -Oz.

2 months agolibstdc++: Move gcc.gnu.org and sourceware.org links to https
Gerald Pfeifer [Sat, 22 Jun 2024 12:44:11 +0000 (14:44 +0200)]
libstdc++: Move gcc.gnu.org and sourceware.org links to https

libstdc++-v3:
* doc/xml/manual/debug.xml: Move gcc.gnu.org link to https.
Ditto for sourceware.org links.
* doc/html/manual/debug.html: Regenerate.

2 months agoDaily bump.
GCC Administrator [Sat, 22 Jun 2024 00:18:44 +0000 (00:18 +0000)]
Daily bump.

2 months agodiagnostics: remove duplicate copies of diagnostic_kind_text
David Malcolm [Fri, 21 Jun 2024 22:20:38 +0000 (18:20 -0400)]
diagnostics: remove duplicate copies of diagnostic_kind_text

No functional change intended.

gcc/ChangeLog:
* diagnostic-format-json.cc
(json_output_format::on_end_diagnostic): Use
get_diagnostic_kind_text rather than embedding a duplicate copy of
the table.
* diagnostic-format-sarif.cc
(make_rule_id_for_diagnostic_kind): Likewise.
* diagnostic.cc (get_diagnostic_kind_text): New.
* diagnostic.h (get_diagnostic_kind_text): New decl.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2 months agodiagnostics: move diagnostic_{event,path} functions to diagnostic-path.cc
David Malcolm [Fri, 21 Jun 2024 22:20:38 +0000 (18:20 -0400)]
diagnostics: move diagnostic_{event,path} functions to diagnostic-path.cc

No functional change intended.

gcc/ChangeLog:
* diagnostic-path.cc (diagnostic_event::meaning::dump_to_pp): Move
here from diagnostic.cc.
(diagnostic_event::meaning::maybe_get_verb_str): Likewise.
(diagnostic_event::meaning::maybe_get_noun_str): Likewise.
(diagnostic_event::meaning::maybe_get_property_str): Likewise.
(diagnostic_path::get_first_event_in_a_function): Likewise.
(diagnostic_path::interprocedural_p): Likewise.
(debug): Likewise for diagnostic_path * overload.
* diagnostic.cc (diagnostic_event::meaning::dump_to_pp): Move from
here to diagnostic-path.cc.
(diagnostic_event::meaning::maybe_get_verb_str): Likewise.
(diagnostic_event::meaning::maybe_get_noun_str): Likewise.
(diagnostic_event::meaning::maybe_get_property_str): Likewise.
(diagnostic_path::get_first_event_in_a_function): Likewise.
(diagnostic_path::interprocedural_p): Likewise.
(debug): Likewise for diagnostic_path * overload.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2 months ago[committed] Fix testsuite fallout on stormy16 after IOR->PLUS change
Jeff Law [Fri, 21 Jun 2024 21:58:12 +0000 (15:58 -0600)]
[committed] Fix testsuite fallout on stormy16 after IOR->PLUS change

More minor fallout from the IOR->PLUS change a little while ago.  This time on
xstormy16.

The pattern to swap nibbles actually tries to handle all the cases of IOR, XOR
and PLUS.  But when we generate PLUS earlier in the pipeline, the
simplifications/canonicalizations are slightly different resulting in the
pattern not matching.

This patch adds an alternate pattern which matches what we get now.  Basically
it looks like QImode rotate by 4, zero extended to HI.

Run in my tester to verify the regression was fixed.  Pushing to the trunk.

gcc/
* config/stormy16/stormy16.md (swpn_zext): New pattern.

2 months agolibstdc++: Remove std::__is_pointer and std::__is_scalar [PR115497]
Jonathan Wakely [Wed, 19 Jun 2024 16:26:37 +0000 (17:26 +0100)]
libstdc++: Remove std::__is_pointer and std::__is_scalar [PR115497]

This removes the std::__is_pointer and std::__is_scalar traits, as they
conflicts with a Clang built-in.

Although Clang has a hack to make the class templates work despite using
reserved names, removing these class templates will allow that hack to
be dropped at some future date.

libstdc++-v3/ChangeLog:

PR libstdc++/115497
* include/bits/cpp_type_traits.h (__is_pointer, __is_scalar):
Remove.
(__is_arithmetic): Do not use __is_pointer in the primary
template. Add partial specialization for pointers.

2 months agolibstdc++: Remove std::__is_void class template [PR115497]
Jonathan Wakely [Wed, 19 Jun 2024 10:19:58 +0000 (11:19 +0100)]
libstdc++: Remove std::__is_void class template [PR115497]

This removes the std::__is_void trait, as it conflicts with a Clang
built-in. There is only one use of the trait, which can easily be
replaced by simpler code.

Although Clang has a hack to make the class template work despite using
a reserved name, removing std::__is_void will allow that hack to be
dropped at some future date.

libstdc++-v3/ChangeLog:

PR libstdc++/115497
* include/bits/cpp_type_traits.h (__is_void): Remove.
* include/debug/helper_functions.h (_Distance_traits):
Adjust partial specialization to match void directly, instead of
using __is_void<T>::__type and matching __true_type.

2 months agolibstdc++: Stop using std::__is_pointer in <deque> and <algorithm> [PR115497]
Jonathan Wakely [Wed, 19 Jun 2024 16:21:16 +0000 (17:21 +0100)]
libstdc++: Stop using std::__is_pointer in <deque> and <algorithm> [PR115497]

This replaces all uses of the std::__is_pointer type trait with uses of
the new __is_pointer built-in. Since the class template was only used to
enable some performance optimizations for algorithms, we can use the
built-in when __has_builtin(__is_pointer) is true (which is the case for
GCC trunk and for current versions of Clang) and just forego the
optimization otherwise.

Removing the uses of std::__is_pointer means it can be removed from
<bits/cpp_type_traits.h>, which is another step towards fixing PR
115497.

libstdc++-v3/ChangeLog:

PR libstdc++/115497
* include/bits/deque.tcc (__lex_cmp_dit): Replace __is_pointer
class template with __is_pointer(T) built-in.
(__lexicographical_compare_aux1): Likewise.
* include/bits/stl_algobase.h (__equal_aux1): Likewise.
(__lexicographical_compare_aux1): Likewise.

2 months agolibstdc++: Don't use std::__is_scalar in std::valarray initialization [PR115497]
Jonathan Wakely [Wed, 19 Jun 2024 10:19:58 +0000 (11:19 +0100)]
libstdc++: Don't use std::__is_scalar in std::valarray initialization [PR115497]

This removes the use of the std::__is_scalar trait from <valarray>,
where it can be replaced by __is_trivial. It's used to decide whether we
can use memset to value-initialize valarray elements, but memset is
suitable for any trivial types, because value-initializing them is
equivalent to filling them with zeros.

This is another step towards removing the class templates in
<bits/cpp_type_traits.h> that conflict with Clang built-in names.

libstdc++-v3/ChangeLog:

PR libstdc++/115497
* include/bits/valarray_array.h (__valarray_default_construct):
Use __is_trivial(_Tp). instead of __is_scalar<_Tp>.

2 months agolibstdc++: Fix std::fill and std::fill_n optimizations [PR109150]
Jonathan Wakely [Wed, 19 Jun 2024 15:14:56 +0000 (16:14 +0100)]
libstdc++: Fix std::fill and std::fill_n optimizations [PR109150]

As noted in the PR, the optimization used for scalar types in std::fill
and std::fill_n is non-conforming, because it doesn't consider that
assigning a scalar type might have non-trivial side effects which are
affected by the optimization.

By changing the condition under which the optimization is done we ensure
it's only performed when safe to do so, and we also enable it for
additional types, which was the original subject of the PR.

Instead of two overloads using __enable_if<__is_scalar<T>::__value, R>
we can combine them into one and create a local variable which is either
a local copy of __value or another reference to it, depending on whether
the optimization is allowed.

This removes a use of std::__is_scalar, which is a step towards fixing
PR 115497 by removing std::__is_pointer from <bits/cpp_type_traits.h>

libstdc++-v3/ChangeLog:

PR libstdc++/109150
* include/bits/stl_algobase.h (__fill_a1): Combine the
!__is_scalar and __is_scalar overloads into one and rewrite the
condition used to decide whether to perform the load outside the
loop.
* testsuite/25_algorithms/fill/109150.cc: New test.
* testsuite/25_algorithms/fill_n/109150.cc: New test.

2 months agolibstdc++: Fix test on x86_64 and non-simd targets
Matthias Kretz [Fri, 21 Jun 2024 14:22:22 +0000 (16:22 +0200)]
libstdc++: Fix test on x86_64 and non-simd targets

* Running a test compiled with AVX512 instructions requires
avx512f_runtime not just avx512f.

* The 'reduce2' test violated an invariant of fixed_size_simd_mask and
thus failed on all targets without 16-Byte vector builtins enabled (in
bits/simd.h).

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:

PR libstdc++/115575
* testsuite/experimental/simd/pr115454_find_last_set.cc: Require
avx512f_runtime. Don't memcpy fixed_size masks.

2 months agoxstormy16: Fix xs_hi_nonmemory_operand
Richard Sandiford [Fri, 21 Jun 2024 14:40:11 +0000 (15:40 +0100)]
xstormy16: Fix xs_hi_nonmemory_operand

All uses of xs_hi_nonmemory_operand allow constraint "i",
which means that they allow consts, symbol_refs and label_refs.
The definition of xs_hi_nonmemory_operand accounted for consts,
but not for symbol_refs and label_refs.

gcc/
* config/stormy16/predicates.md (xs_hi_nonmemory_operand): Handle
symbol_ref and label_ref.

2 months agoiq2000: Fix test and branch instructions
Richard Sandiford [Fri, 21 Jun 2024 14:40:10 +0000 (15:40 +0100)]
iq2000: Fix test and branch instructions

The iq2000 test and branch instructions had patterns like:

  [(set (pc)
(if_then_else
 (eq (and:SI (match_operand:SI 0 "register_operand" "r")
     (match_operand:SI 1 "power_of_2_operand" "I"))
      (const_int 0))
 (match_operand 2 "pc_or_label_operand" "")
 (match_operand 3 "pc_or_label_operand" "")))]

power_of_2_operand allows any 32-bit power of 2, whereas "I" only
accepts 16-bit signed constants.  This meant that any power of 2
greater than 32768 would cause an "insn does not satisfy its
constraints" ICE.

Also, the %p operand modifier barfed on 1<<31, which is sign-
rather than zero-extended to 64 bits.  The code is inherently
limited to 32-bit operands -- power_of_2_operand contains a test
involving "unsigned" -- so this patch just ands with 0xffffffff.

gcc/
* config/iq2000/iq2000.cc (iq2000_print_operand): Make %p handle 1<<31.
* config/iq2000/iq2000.md: Remove "I" constraints on
power_of_2_operands.

2 months agortl-ssa: Don't cost no-op moves
Richard Sandiford [Fri, 21 Jun 2024 14:40:10 +0000 (15:40 +0100)]
rtl-ssa: Don't cost no-op moves

No-op moves are given the code NOOP_MOVE_INSN_CODE if we plan
to delete them later.  Such insns shouldn't be costed, partly
because they're going to disappear, and partly because targets
won't recognise the insn code.

gcc/
* rtl-ssa/changes.cc (rtl_ssa::changes_are_worthwhile): Don't
cost no-op moves.
* rtl-ssa/insns.cc (insn_info::calculate_cost): Likewise.

2 months agoPrint "Global Exported" to dump_file from set_range_info.
Andrew MacLeod [Mon, 17 Jun 2024 20:07:16 +0000 (16:07 -0400)]
Print "Global Exported" to dump_file from set_range_info.

* gimple-range.cc (gimple_ranger::register_inferred_ranges): Do not
dump global range info after set_range_info.
(gimple_ranger::register_transitive_inferred_ranges): Likewise.
(dom_ranger::range_of_stmt): Likewise.
* tree-ssanames.cc (set_range_info): If global range info
changes, maybe print new range to dump_file.
* tree-vrp.cc (remove_unreachable::handle_early): Do not
dump global range info after set_range_info.
(remove_unreachable::remove): Likewise.
(remove_unreachable::remove_and_update_globals): Likewise.
(pass_assumptions::execute): Likewise.

2 months agoChange fast VRP algorithm
Andrew MacLeod [Mon, 17 Jun 2024 15:32:51 +0000 (11:32 -0400)]
Change fast VRP algorithm

Change the fast VRP algorithm to track contextual ranges active within
each basic block.

* gimple-range.cc (dom_ranger::dom_ranger): Create a block
vector.
(dom_ranger::~dom_ranger): Dispose of the block vector.
(dom_ranger::edge_range): Delete.
(dom_ranger::range_on_edge): Combine range in src BB with any
range gori_nme_on_edge returns.
(dom_ranger::range_in_bb): Combine global range with any active
contextual range for an ssa-name.
(dom_ranger::range_of_stmt): Fix non-ssa LHS case, use
fur_depend for folding so relations can be registered.
(dom_ranger::maybe_push_edge): Delete.
(dom_ranger::pre_bb): Create incoming contextual range vector.
(dom_ranger::post_bb): Free contextual range vector.
* gimple-range.h (dom_ranger::edge_range): Delete.
(dom_ranger::m_e0): Delete.
(dom_ranger::m_e1): Delete.
(dom_ranger::m_bb): New.
(dom_ranger::m_pop_list): Delete.
* tree-vrp.cc (execute_fast_vrp): Enable relation oracle.

2 months agoAdd builtin_unreachable processing for fast_vrp.
Andrew MacLeod [Mon, 17 Jun 2024 15:23:12 +0000 (11:23 -0400)]
Add builtin_unreachable processing for fast_vrp.

Add a remove_unreachable object to fast vrp, and honor the final_p flag.

* tree-vrp.cc (remove_unreachable::remove): Export global range
if builtin_unreachable dominates all uses.
(remove_unreachable::remove_and_update_globals): Do not reset SCEV.
(execute_ranger_vrp): Reset SCEV here instead.
(fvrp_folder::fvrp_folder): Take final pass flag
and create a remove_unreachable object when specified.
(fvrp_folder::pre_fold_stmt): Register GIMPLE_CONDs with
the remove_unreachcable object.
(fvrp_folder::m_unreachable): New.
(execute_fast_vrp): Process remove_unreachable object.
(pass_vrp::execute): Add final_p flag to execute_fast_vrp.

2 months agotestsuite: check that generated .sarif files validate against the SARIF schema [PR109360]
David Malcolm [Fri, 21 Jun 2024 12:46:14 +0000 (08:46 -0400)]
testsuite: check that generated .sarif files validate against the SARIF schema [PR109360]

This patch extends the dg directive verify-sarif-file so that if
the "jsonschema" tool is available, it will be used to validate the
generated .sarif file.

Tested with jsonschema 3.2 with Python 3.8

gcc/ChangeLog:
PR testsuite/109360
* doc/install.texi: Mention optional usage of "jsonschema" tool.

gcc/testsuite/ChangeLog:
PR testsuite/109360
* lib/sarif-schema-2.1.0.json: New file, downloaded from
https://docs.oasis-open.org/sarif/sarif/v2.1.0/os/schemas/sarif-schema-2.1.0.json
Licensing information can be seen at
https://github.com/oasis-tcs/sarif-spec/issues/583
which states "They are free to incorporate it into their
implementation. No need for special permission or paperwork from
OASIS."
* lib/scansarif.exp (verify-sarif-file): If "jsonschema" is
available, use it to verify that the .sarif file complies with the
SARIF schema.
* lib/target-supports.exp (check_effective_target_jsonschema):
New.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2 months agodiagnostics: fixes to SARIF output [PR109360]
David Malcolm [Fri, 21 Jun 2024 12:46:13 +0000 (08:46 -0400)]
diagnostics: fixes to SARIF output [PR109360]

When adding validation of .sarif files against the schema
(PR testsuite/109360) I discovered various issues where we were
generating invalid .sarif files.

Specifically, in
  c-c++-common/diagnostic-format-sarif-file-bad-utf8-pr109098-1.c
the relatedLocations for the "note" diagnostics were missing column
numbers, leading to validation failure due to non-unique elements,
such as multiple:
"message": {"text": "invalid UTF-8 character <bf>"}},
on line 25 with no column information.

Root cause is that for some diagnostics in libcpp we have a location_t
representing the line as a whole, setting a column_override on the
rich_location (since the line hasn't been fully read yet).  We were
handling this column override for plain text output, but not for .sarif
output.

Similarly, in diagnostic-format-sarif-file-pr111700.c there is a warning
emitted on "line 0" of the file, whereas SARIF requires line numbers to
be positive.

We also use column == 0 internally to mean "the line as a whole",
whereas SARIF required column numbers to be positive.

This patch fixes these various issues.

gcc/ChangeLog:
PR testsuite/109360
* diagnostic-format-sarif.cc
(sarif_builder::make_location_object): Pass any column override
from rich_loc to maybe_make_physical_location_object.
(sarif_builder::maybe_make_physical_location_object): Add
"column_override" param and pass it to maybe_make_region_object.
(sarif_builder::maybe_make_region_object): Add "column_override"
param and use it when the location has 0 for a column.  Don't
add "startLine", "startColumn", "endLine", or "endColumn" if
the values aren't positive.
(sarif_builder::maybe_make_region_object_for_context): Don't
add "startLine" or "endLine" if the values aren't positive.

libcpp/ChangeLog:
PR testsuite/109360
* include/rich-location.h (rich_location::get_column_override):
New accessor.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2 months agolibstdc++: Qualify calls in <bits/stl_uninitialized.h> to prevent ADL
Jonathan Wakely [Thu, 20 Jun 2024 23:25:32 +0000 (00:25 +0100)]
libstdc++: Qualify calls in <bits/stl_uninitialized.h> to prevent ADL

libstdc++-v3/ChangeLog:

* include/bits/stl_uninitialized.h (uninitialized_default_construct)
(uninitialized_default_construct_n, uninitialized_value_construct)
(uninitialized_value_construct_n): Qualify calls to prevent ADL.

2 months agolibstdc++: Make std::any_cast<void> ill-formed (LWG 3305)
Jonathan Wakely [Tue, 18 Jun 2024 15:59:52 +0000 (16:59 +0100)]
libstdc++: Make std::any_cast<void> ill-formed (LWG 3305)

LWG 3305 was approved earlier this year in Tokyo. We need to give an
error if using std::any_cast<void>, but std::any_cast<void()> is valid
(but always returns null).

libstdc++-v3/ChangeLog:

* include/std/any (any_cast(any*), any_cast(const any*)): Add
static assertion to reject void types, as per LWG 3305.
* testsuite/20_util/any/misc/lwg3305.cc: New test.

2 months agolibstdc++: Undeprecate std::pmr::polymorphic_allocator::destroy (P2875R4)
Jonathan Wakely [Tue, 18 Jun 2024 15:09:08 +0000 (16:09 +0100)]
libstdc++: Undeprecate std::pmr::polymorphic_allocator::destroy (P2875R4)

This member function was previously deprecated, but that was reverted by
P2875R4, approved earlier this year in Tokyo. Since it's not going to be
deprecated in C++26, and so presumably not removed, there is no point in
giving deprecated warnings for C++23 mode.

libstdc++-v3/ChangeLog:

* include/bits/memory_resource.h (polymorphic_allocator::destroy):
Remove deprecated attribute.

2 months agolibstdc++: Add deprecation warnings to <strstream> types
Jonathan Wakely [Sun, 7 Apr 2024 13:12:25 +0000 (14:12 +0100)]
libstdc++: Add deprecation warnings to <strstream> types

libstdc++-v3/ChangeLog:

* include/backward/backward_warning.h: Adjust comments to
suggest <spanstream> as another alternative to <strstream>.
* include/backward/strstream (strstreambuf, istrstream)
(ostrstream, strstream): Add deprecated attribute.

2 months agolibstdc++: Add [[deprecated]] to std::wstring_convert and std::wbuffer_convert
Jonathan Wakely [Fri, 22 Mar 2024 13:19:09 +0000 (13:19 +0000)]
libstdc++: Add [[deprecated]] to std::wstring_convert and std::wbuffer_convert

These were deprecated in C++17 and std::wstring_convert is planned for
removal in C++26.

libstdc++-v3/ChangeLog:

* include/bits/locale_conv.h (wstring_convert): Add deprecated
attribute for C++17 and later.
(wbuffer_convert): Likewise.
* testsuite/22_locale/codecvt/codecvt_utf16/79980.cc: Disable
deprecated warnings.
* testsuite/22_locale/codecvt/codecvt_utf8/79980.cc: Likewise.
* testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc:
Likewise.
* testsuite/22_locale/conversions/buffer/1.cc: Add dg-warning.
* testsuite/22_locale/conversions/buffer/2.cc: Likewise.
* testsuite/22_locale/conversions/buffer/3.cc: Likewise.
* testsuite/22_locale/conversions/buffer/requirements/typedefs.cc:
Likewise.
* testsuite/22_locale/conversions/string/1.cc: Likewise.
* testsuite/22_locale/conversions/string/2.cc: Likewise.
* testsuite/22_locale/conversions/string/3.cc: Likewise.
* testsuite/22_locale/conversions/string/66441.cc: Likewise.
* testsuite/22_locale/conversions/string/requirements/typedefs-2.cc:
Likewise.
* testsuite/22_locale/conversions/string/requirements/typedefs.cc:
Likewise.

2 months agolibstdc++: Fix __cpp_lib_chrono for old std::string ABI
Jonathan Wakely [Thu, 20 Jun 2024 12:28:08 +0000 (13:28 +0100)]
libstdc++: Fix __cpp_lib_chrono for old std::string ABI

The <chrono> header is incomplete for the old std::string ABI, because
std::chrono::tzdb is only defined for the new ABI. The feature test
macro advertising full C++20 support should not be defined for the old
ABI.

libstdc++-v3/ChangeLog:

* include/bits/version.def (chrono): Add cxx11abi = yes.
* include/bits/version.h: Regenerate.
* testsuite/std/time/syn_c++20.cc: Adjust expected value for
the feature test macro.

2 months agolibstdc++: Fix std::to_array for trivial-ish types [PR115522]
Jonathan Wakely [Tue, 18 Jun 2024 12:27:02 +0000 (13:27 +0100)]
libstdc++: Fix std::to_array for trivial-ish types [PR115522]

Due to PR c++/85723 the std::is_trivial trait is true for types with a
deleted default constructor, so the use of std::is_trivial in
std::to_array is not sufficient to ensure the type can be trivially
default constructed then filled using memcpy.

I also forgot that a type with a deleted assignment operator can still
be trivial, so we also need to check that it's assignable because the
is_constant_evaluated() path can't use memcpy.

Replace the uses of std::is_trivial with std::is_trivially_copyable
(needed for memcpy), std::is_trivially_default_constructible (needed so
that the default construction is valid and does no work) and
std::is_copy_assignable (needed for the constant evaluation case).

libstdc++-v3/ChangeLog:

PR libstdc++/115522
* include/std/array (to_array): Workaround the fact that
std::is_trivial is not sufficient to check that a type is
trivially default constructible and assignable.
* testsuite/23_containers/array/creation/115522.cc: New test.

2 months agolibstdc++: Initialize base in test allocator's constructor
Jonathan Wakely [Thu, 20 Jun 2024 15:13:10 +0000 (16:13 +0100)]
libstdc++: Initialize base in test allocator's constructor

This fixes a warning from one of the test allocators:
warning: base class 'class std::allocator<__gnu_test::copy_tracker>' should be explicitly initialized in the copy constructor [-Wextra]

libstdc++-v3/ChangeLog:

* testsuite/util/testsuite_allocator.h (tracker_allocator):
Initialize base class in copy constructor.

2 months agosh: Make *minus_plus_one work after RA
Richard Sandiford [Fri, 21 Jun 2024 08:52:42 +0000 (09:52 +0100)]
sh: Make *minus_plus_one work after RA

*minus_plus_one had no constraints, which meant that it could be
matched after RA with operands 0, 1 and 2 all being different.
The associated split instead requires operand 0 to be tied to
operand 1.

gcc/
* config/sh/sh.md (*minus_plus_one): Add constraints.

2 months agoada: Fix internal error on protected type with -gnatc -gnatR
Eric Botcazou [Tue, 28 May 2024 11:03:19 +0000 (13:03 +0200)]
ada: Fix internal error on protected type with -gnatc -gnatR

It occurs when the body of a protected subprogram is processed, because the
references to the components of the type have not been properly expanded.

gcc/ada/

* gcc-interface/trans.cc (Subprogram_Body_to_gnu): Also return early
for a protected subprogram in -gnatc mode.

2 months agoada: Fix bogus Address Sanitizer stack-buffer-overflow on packed array copy
Eric Botcazou [Mon, 27 May 2024 14:46:03 +0000 (16:46 +0200)]
ada: Fix bogus Address Sanitizer stack-buffer-overflow on packed array copy

The Address Sanitizer considers that the padding at the end of a justified
modular type may be accessed through the object, but it is never accessed
and therefore can always be reused.

gcc/ada/

* gcc-interface/decl.cc (gnat_to_gnu_entity) <discrete_type>: Set
the TYPE_JUSTIFIED_MODULAR_P flag earlier.
* gcc-interface/misc.cc (gnat_unit_size_without_reusable_padding):
New function.
(LANG_HOOKS_UNIT_SIZE_WITHOUT_REUSABLE_PADDING): Redefine to above
function.

2 months agoada: Fix bogus Address Sanitizer stack-buffer-overflow on packed record equality
Eric Botcazou [Mon, 27 May 2024 14:31:20 +0000 (16:31 +0200)]
ada: Fix bogus Address Sanitizer stack-buffer-overflow on packed record equality

We set DECL_BIT_FIELD optimistically during the translation of record types
and clear it afterward if needed, but fail to clear other attributes in the
latter case, which fools the logic of the Address Sanitizer.

gcc/ada/

* gcc-interface/utils.cc (clear_decl_bit_field): New function.
(finish_record_type): Call clear_decl_bit_field instead of clearing
DECL_BIT_FIELD manually.

2 months agoada: Implement fast modulo reduction for nonbinary modular multiplication
Eric Botcazou [Sat, 20 Apr 2024 10:26:52 +0000 (12:26 +0200)]
ada: Implement fast modulo reduction for nonbinary modular multiplication

This adds the missing guard to prevent the reduction from being used when
the target does not provide or cannot synthesize a high-part multiply.

gcc/ada/

* gcc-interface/trans.cc (gnat_to_gnu) <N_Op_Mod>: Fix formatting.
* gcc-interface/utils2.cc: Include optabs-query.h.
(fast_modulo_reduction): Call can_mult_highpart_p on the TYPE_MODE
before generating a high-part multiply.  Fix formatting.

2 months agoada: Implement fast modulo reduction for nonbinary modular multiplication
Eric Botcazou [Fri, 5 Apr 2024 18:47:34 +0000 (20:47 +0200)]
ada: Implement fast modulo reduction for nonbinary modular multiplication

This implements modulo reduction for nonbinary modular multiplication with
small moduli by means of the standard division-free algorithm also used in
the optimizer, but with fewer constraints and therefore better results.

For the sake of consistency, it is also used for the 'Mod attribute of the
same modular types and, more generally, for the Mod (and Rem) operators of
unsigned types if the second operand is static and not a power of two.

gcc/ada/

* gcc-interface/gigi.h (fast_modulo_reduction): Declare.
* gcc-interface/trans.cc (gnat_to_gnu) <N_Op_Mod>: In the unsigned
case, call fast_modulo_reduction for {FLOOR,TRUNC}_MOD_EXPR if the
RHS is a constant and not a power of two, and the precision is not
larger than the word size.
* gcc-interface/utils2.cc: Include expmed.h.
(fast_modulo_reduction): New function.
(nonbinary_modular_operation): Call fast_modulo_reduction for the
multiplication if the precision is not larger than the word size.

2 months agoada: Reject ambiguous function calls in interpolated string expressions
Javier Miranda [Thu, 6 Jun 2024 12:06:53 +0000 (12:06 +0000)]
ada: Reject ambiguous function calls in interpolated string expressions

When the interpolated expression is a call to an ambiguous call
the frontend does not reject it; erroneously accepts the call
and generates code that calls to one of them.

gcc/ada/

* sem_ch2.adb (Analyze_Interpolated_String_Literal): Reject
ambiguous function calls.

2 months agoada: Apply fixes to Examine_Array_Bounds
Ronan Desplanques [Thu, 6 Jun 2024 07:40:54 +0000 (09:40 +0200)]
ada: Apply fixes to Examine_Array_Bounds

gcc/ada/

* sem_util.adb (Examine_Array_Bounds): Add missing return
statements. Fix criterion for a string literal being empty.

2 months agoada: Fix crash in GNATbind during error reporting
Eric Botcazou [Wed, 5 Jun 2024 08:40:35 +0000 (10:40 +0200)]
ada: Fix crash in GNATbind during error reporting

This is the minimal fix to avoid the crash.

gcc/ada/

* bcheck.adb (Check_Consistency_Of_Sdep): Guard against path to ALI
file not found.

2 months agoada: Crash when using user defined string literals
Javier Miranda [Thu, 6 Jun 2024 11:20:14 +0000 (11:20 +0000)]
ada: Crash when using user defined string literals

When a non-overridable aspect is explicitly specified for a
non-tagged derived type, the compiler blows up processing an
object declaration of an object of such type.

gcc/ada/

* sem_ch13.adb (Analyze_One_Aspect): Fix code locating the entity
of the parent type.

2 months agoada: Change error message on invalid RTS path
Marc Poulhiès [Tue, 4 Jun 2024 12:37:17 +0000 (14:37 +0200)]
ada: Change error message on invalid RTS path

Include the invalid path in the error message.

gcc/ada/

* make.adb (Scan_Make_Arg): Adjust error message.
* gnatls.adb (Search_RTS): Likewise.
* switch-b.adb (Scan_Debug_Switches): Likewise.

2 months agoada: Small cleanup in processing of primitive operations
Eric Botcazou [Tue, 4 Jun 2024 19:33:28 +0000 (21:33 +0200)]
ada: Small cleanup in processing of primitive operations

The processing of primitive operations is now always uniform for tagged and
untagged types, but the code contains left-overs from the time where it was
specific to tagged types, in particular for the handling of subtypes.

gcc/ada/

* einfo.ads (Direct_Primitive_Operations): Mention concurrent types
as well as GNAT extensions instead of implementation details.
(Primitive_Operations): Document that Direct_Primitive_Operations is
also used for concurrent types as a fallback.
* einfo-utils.adb (Primitive_Operations): Tweak formatting.
* exp_util.ads (Find_Prim_Op): Adjust description.
* exp_util.adb (Make_Subtype_From_Expr): In the private case with
unknown discriminants, always copy Direct_Primitive_Operations and
do not overwrite the Class_Wide_Type of the expression's base type.
* sem_ch3.adb (Analyze_Incomplete_Type_Decl): Tweak comment.
(Analyze_Subtype_Declaration): Remove older and now dead calls to
Set_Direct_Primitive_Operations.  Tweak comment.
(Build_Derived_Private_Type): Likewise.
(Build_Derived_Record_Type): Likewise.
(Build_Discriminated_Subtype): Set Direct_Primitive_Operations in
all cases instead of just for tagged types.
(Complete_Private_Subtype): Likewise.
(Derived_Type_Declaration): Tweak comment.
* sem_ch4.ads (Try_Object_Operation): Adjust description.

2 months agoada: Revert conditional installation of signal handlers on VxWorks
Doug Rupp [Tue, 4 Jun 2024 17:17:57 +0000 (10:17 -0700)]
ada: Revert conditional installation of signal handlers on VxWorks

The conditional installation resulted in a semantic change, and
although it is likely what is ultimately wanted (since HW interrupts
are being reworked on VxWorks). However it must be done in concert
with other modifications for the new formulation of HW interrupts and
not in isolation.

gcc/ada/

* init.c [vxworks] (__gnat_install_handler): Revert to
installing signal handlers without regard to interrupt_state.

2 months agoada: Cannot override inherited function with controlling result
Javier Miranda [Thu, 30 May 2024 11:24:54 +0000 (11:24 +0000)]
ada: Cannot override inherited function with controlling result

When a package has the declaration of a derived tagged
type T with private null extension that inherits a public
function F with controlling result, and a derivation of T
is declared in the public part of another package, overriding
function F may be rejected by the compiler.

gcc/ada/

* sem_disp.adb (Find_Hidden_Overridden_Primitive): Check
public dispatching primitives of ancestors; previously,
only immediately-visible primitives were checked.

2 months agoada: Fix missing index check with declare expression
Eric Botcazou [Thu, 30 May 2024 10:46:57 +0000 (12:46 +0200)]
ada: Fix missing index check with declare expression

The Do_Range_Check flag is properly set on the Expression of the EWA node
built for the declare expression, so this instructs Generate_Index_Checks
to look into this Expression.

gcc/ada/

* checks.adb (Generate_Index_Checks): Add specific treatment for
index expressions that are N_Expression_With_Actions nodes.

2 months agoada: Fix internal error on case expression used as index of array component
Eric Botcazou [Tue, 28 May 2024 21:08:32 +0000 (23:08 +0200)]
ada: Fix internal error on case expression used as index of array component

This occurs when the bounds of the array component depend on a discriminant
and the component reference is not nested, that is to say the component is
not (referenced as) a subcomponent of a larger record.

In this case, Analyze_Selected_Component does not build the actual subtype
for the component, but it turns out to be required for constructs generated
during the analysis of the case expression.

The change causes this actual subtype to be built, and also renames a local
variable used to hold the prefix of the selected component.

gcc/ada/

* sem_ch4.adb (Analyze_Selected_Component): Rename Name into Pref
and use Sel local variable consistently.
(Is_Simple_Indexed_Component): New predicate.
Call Is_Simple_Indexed_Component to determine whether to build an
actual subtype for the component.

2 months agoada: Fix incorrect handling of packed array with aliased composite components
Eric Botcazou [Thu, 30 May 2024 22:13:44 +0000 (00:13 +0200)]
ada: Fix incorrect handling of packed array with aliased composite components

The problem is that the handling of the interaction between packing and
aliased/atomic/independent components of an array type is tied to that of
the interaction between a component clause and aliased/atomic/independent
components, although the semantics are different: packing is a best effort
thing, whereas a component clause must be honored or else an error be given.

This decouples the two handlings, but retrofits the separate processing of
independent components done in both cases into the common code and changes
the error message from "minimum allowed is" to "minimum allowed value is"
for the sake of consistency with the aliased/atomic processing.

gcc/ada/

* freeze.adb (Freeze_Array_Type): Decouple the handling of the
interaction between packing and aliased/atomic components from
that of the interaction between a component clause and aliased/
atomic components, and retrofit the processing of the interaction
between the two characteristics and independent components into
the common processing.

gcc/testsuite/ChangeLog:

* gnat.dg/atomic10.adb: Adjust.

2 months agoada: Generic formal/actual matching -- misc cleanup
Bob Duff [Thu, 30 May 2024 19:16:47 +0000 (15:16 -0400)]
ada: Generic formal/actual matching -- misc cleanup

The only substantive change is to remove Activation_Chain_Entity
from N_Generic_Package_Declaration. The comment in sinfo.ads suggesting
this change was written in 1993!

Various pieces of missing documentation are added to Sinfo and Einfo.

Also other minor cleanups.

gcc/ada/

* gen_il-gen-gen_nodes.adb
(N_Generic_Package_Declaration): Remove Activation_Chain_Entity.
* sinfo.ads: Comment improvements. Add missing doc.
Remove obsolete comment about Activation_Chain_Entity.
* einfo.ads: Comment improvements. Add missing doc.
* einfo-utils.adb (Base_Type): Add Assert (disabled for now).
(Next_Index): Minor cleanup.
* aspects.ads: Minor comment fix.
* exp_ch6.adb: Likewise.
* sem_ch3.adb: Likewise.

2 months agoada: Fix gnatcheck violation reported after a recent cleanup
Piotr Trojanek [Wed, 17 Apr 2024 12:58:24 +0000 (14:58 +0200)]
ada: Fix gnatcheck violation reported after a recent cleanup

Code cleanup; semantics is unaffected.

gcc/ada/

* sem_ch3.adb (Add_Interface_Tag_Components): Simplify with No.

2 months agoada: Predefined arithmetic operators incorrectly treated as directly visible
Steve Baird [Fri, 24 May 2024 00:11:42 +0000 (17:11 -0700)]
ada: Predefined arithmetic operators incorrectly treated as directly visible

In some cases, a predefined operator (e.g., the "+" operator for an
integer type) is incorrectly treated as being directly visible when
it is not. This can lead to both accepting operator uses that should
be rejected and also to incorrectly rejecting legal constructs as ambiguous
(for example, an expression "Foo + 1" where Foo is an overloaded function and
the "+" operator is directly visible for the result type of only one of
the possible callees).

gcc/ada/

* sem_ch4.adb (Is_Effectively_Visible_Operator): A new function.
(Check_Arithmetic_Pair): In paths where Add_One_Interp was
previously called unconditionally, instead call only if
Is_Effectively_Visible_Operator returns True.
(Check_Boolean_Pair): Likewise.
(Find_Unary_Types): Likewise.

2 months agoada: Fix assertion failure on predicate involving access parameter
Eric Botcazou [Tue, 21 May 2024 17:49:32 +0000 (19:49 +0200)]
ada: Fix assertion failure on predicate involving access parameter

The assertion fails because the Original_Node of the expression has no Etype
since its an unanalyzed identifier.

gcc/ada/

* accessibility.adb (Accessibility_Level): Apply the processing to
Expr when its Original_Node is an unanalyzed identifier.

2 months agoada: Fix for Default_Component_Value with declare expressions
Piotr Trojanek [Thu, 16 May 2024 08:59:31 +0000 (10:59 +0200)]
ada: Fix for Default_Component_Value with declare expressions

When the expression of aspect Default_Component_Value includes a declare
expression with current type instance, we attempted to recursively froze
that type, which itself caused an infinite recursion, because we didn't
properly manage the scope of declare expression.

This patch fixes both the detection of the current type instance and
analysis of the expression that caused recursive freezing.

gcc/ada/

* sem_attr.adb (In_Aspect_Specification): Use the standard
condition that works correctly with declare expressions.
* sem_ch13.adb (Analyze_Aspects_At_Freeze_Point): Replace
ordinary analysis with preanalysis of spec expressions.

2 months agoada: Spurious style error with mutiple square brackets
Justin Squirek [Thu, 9 May 2024 20:16:24 +0000 (20:16 +0000)]
ada: Spurious style error with mutiple square brackets

This patch fixes a spurious error in the compiler when checking for style for
token separation where two square brackets are next to each other.

gcc/ada/

* csets.ads (Identifier_Char): New function - replacing table.
* csets.adb (Identifier_Char): Rename and move table for static values.
(Initialize): Remove dynamic calculations.
(Identifier_Char): New function to calculate dynamic values.
* opt.adb (Set_Config_Switches): Remove setting of Identifier_Char.

2 months agocomplex-lowering: Better handling of PAREN_EXPR [PR68855]
Andrew Pinski [Thu, 20 Jun 2024 22:52:05 +0000 (15:52 -0700)]
complex-lowering: Better handling of PAREN_EXPR [PR68855]

When PAREN_EXPR tree code was added in r0-85884-gdedd42d511b6e4,
a simplified handling was added to complex lowering. Which means
we would get:
```
  _9 = COMPLEX_EXPR <_15, _14>;
  _11 = ((_9));
  _19 = REALPART_EXPR <_11>;
  _20 = IMAGPART_EXPR <_11>;
```

In many cases instead of just simply:
```
  _19 = ((_15));
  _20 = ((_14));
```

So this adds full support for PAREN_EXPR to complex lowering.
It is handled very similar as NEGATE_EXPR; except creating PAREN_EXPR
instead of NEGATE_EXPR for the real/imag parts. This allows for
more optimizations including vectorization, especially with
-ffast-math.
gfortran.dg/vect/pr68855.f90 is an example where this could show up.
It also shows up in SPEC CPU 2006's 465.tonto; though I have not done
any benchmarking there.

Bootstrapped and tested on x86_64-linux-gnu with no regressions.

gcc/ChangeLog:

PR tree-optimization/68855
* tree-complex.cc (init_dont_simulate_again): Handle PAREN_EXPR
like NEGATE_EXPR.
(complex_propagate::visit_stmt): Likewise.
(expand_complex_move): Don't handle PAREN_EXPR.
(expand_complex_paren): New function.
(expand_complex_operations_1): Handle PAREN_EXPR like
NEGATE_EXPR. And call expand_complex_paren for PAREN_EXPR.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/pr68855.c: New test.
* gfortran.dg/vect/pr68855.f90: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2 months agoRemove outdated info from passes.texi
Richard Biener [Fri, 21 Jun 2024 06:05:22 +0000 (08:05 +0200)]
Remove outdated info from passes.texi

This applies some maintainance to passes.texi by removing references
to no longer existing passes.  It also fixes a few minor things but
doesn't fill the gaps that meanwhile exist.

* doc/passes.texi: Remove references to no longer existing
passes.

2 months agoBuild: Set gcc_cv_as_mips_explicit_relocs if gcc_cv_as_mips_explicit_relocs_pcrel
YunQiang Su [Thu, 20 Jun 2024 02:37:39 +0000 (10:37 +0800)]
Build: Set gcc_cv_as_mips_explicit_relocs if gcc_cv_as_mips_explicit_relocs_pcrel

We check gcc_cv_as_mips_explicit_relocs if gcc_cv_as_mips_explicit_relocs_pcrel
only, while gcc_cv_as_mips_explicit_relocs is used by later code.

Maybe, it is time for use to set gcc_cv_as_mips_explicit_relocs always now,
as it has been in Binutils for more than 20 years.

gcc
* configure.ac: Set gcc_cv_as_mips_explicit_relocs if
gcc_cv_as_mips_explicit_relocs_pcrel.
* configure: Regenerate.

2 months agoMIPS: Set condmove cost to SET(REG, REG)
YunQiang Su [Tue, 18 Jun 2024 09:03:51 +0000 (17:03 +0800)]
MIPS: Set condmove cost to SET(REG, REG)

On most uarch, the cost condmove is same as other noraml integer,
and it should be COSTS_N_INSNS(1).

In GCC12 or previous, the condmove is always enabled, and from
GCC13, we start to compare the cost.

The generic rtx_cost give the result of COSTS_N_INSN(2).
Let's define it to COSTS_N_INSN(1) in mips_rtx_costs.

gcc
* config/mips/mips.cc(mips_rtx_costs): Set condmove cost.
* config/mips/mips.md(mov<GPR:mode>_on_<MOVECC:mode>,
mov<GPR:mode>_on_<MOVECC:mode>_mips16e2,
mov<GPR:mode>_on_<GPR2:mode>_ne
mov<GPR:mode>_on_<GPR2:mode>_ne_mips16e2): Define name by
remove starting *, so that we can use CODE_FOR_.

gcc/testsuite
* gcc.target/mips/movcc-2.c: Add k?100:1000 test.

2 months agors6000: Fix wrong RTL patterns for vector merge high/low word on LE
Kewen Lin [Fri, 21 Jun 2024 01:23:56 +0000 (20:23 -0500)]
rs6000: Fix wrong RTL patterns for vector merge high/low word on LE

Commit r12-4496 changes some define_expands and define_insns
for vector merge high/low word, which are altivec_vmrg[hl]w,
vsx_xxmrg[hl]w_<VSX_W:mode>.  These defines are mainly for
built-in function vec_merge{h,l}, __builtin_vsx_xxmrghw,
__builtin_vsx_xxmrghw_4si and some internal gen function
needs.  These functions should consider endianness, taking
vec_mergeh as example, as PVIPR defines, vec_mergeh "Merges
the first halves (in element order) of two vectors", it does
note it's in element order.  So it's mapped into vmrghw on
BE while vmrglw on LE respectively.  Although the mapped
insns are different, as the discussion in PR106069, the RTL
pattern should be still the same, it is conformed before
commit r12-4496, define_expand altivec_vmrghw got expanded
into:

  (vec_select:VSX_W
     (vec_concat:<VS_double>
        (match_operand:VSX_W 1 "register_operand" "wa,v")
        (match_operand:VSX_W 2 "register_operand" "wa,v"))
        (parallel [(const_int 0) (const_int 4)
                   (const_int 1) (const_int 5)])))]

on both BE and LE then.  But commit r12-4496 changed it to
expand into:

  (vec_select:VSX_W
     (vec_concat:<VS_double>
        (match_operand:VSX_W 1 "register_operand" "wa,v")
        (match_operand:VSX_W 2 "register_operand" "wa,v"))
        (parallel [(const_int 0) (const_int 4)
                   (const_int 1) (const_int 5)])))]

on BE, and

  (vec_select:VSX_W
     (vec_concat:<VS_double>
        (match_operand:VSX_W 1 "register_operand" "wa,v")
        (match_operand:VSX_W 2 "register_operand" "wa,v"))
        (parallel [(const_int 2) (const_int 6)
                   (const_int 3) (const_int 7)])))]

on LE, although the mapped insn are still vmrghw on BE and
vmrglw on LE, the associated RTL pattern is completely
wrong and inconsistent with the mapped insn.  If optimization
passes leave this pattern alone, even if its pattern doesn't
represent its mapped insn, it's still fine, that's why simple
testing on bif doesn't expose this issue.  But once some
optimization pass such as combine does some changes basing
on this wrong pattern, because the pattern doesn't match the
semantics that the expanded insn is intended to represent,
it would cause the unexpected result.

So this patch is to fix the wrong RTL pattern, ensure the
associated RTL patterns become the same as before which can
have the same semantic as their mapped insns.  With the
proposed patch, the expanders like altivec_vmrghw expands
into altivec_vmrghb_direct_be or altivec_vmrglb_direct_le
depending on endianness, "direct" can easily show which
insn would be generated, _be and _le are mainly for the
different RTL patterns as endianness.

Co-authored-by: Xionghu Luo <xionghuluo@tencent.com>
PR target/106069
PR target/115355

gcc/ChangeLog:

* config/rs6000/altivec.md (altivec_vmrghw_direct_<VSX_W:mode>): Rename
to ...
(altivec_vmrghw_direct_<VSX_W:mode>_be): ... this.  Add the condition
BYTES_BIG_ENDIAN.
(altivec_vmrghw_direct_<VSX_W:mode>_le): New define_insn.
(altivec_vmrglw_direct_<VSX_W:mode>): Rename to ...
(altivec_vmrglw_direct_<VSX_W:mode>_be): ... this.  Add the condition
BYTES_BIG_ENDIAN.
(altivec_vmrglw_direct_<VSX_W:mode>_le): New define_insn.
(altivec_vmrghw): Adjust by calling gen_altivec_vmrghw_direct_v4si_be
for BE and gen_altivec_vmrglw_direct_v4si_le for LE.
(altivec_vmrglw): Adjust by calling gen_altivec_vmrglw_direct_v4si_be
for BE and gen_altivec_vmrghw_direct_v4si_le for LE.
(vec_widen_umult_hi_v8hi): Adjust the call to
gen_altivec_vmrghw_direct_v4si by gen_altivec_vmrghw for BE
and by gen_altivec_vmrglw for LE.
(vec_widen_smult_hi_v8hi): Likewise.
(vec_widen_umult_lo_v8hi): Adjust the call to
gen_altivec_vmrglw_direct_v4si by gen_altivec_vmrglw for BE
and by gen_altivec_vmrghw for LE
(vec_widen_smult_lo_v8hi): Likewise.
* config/rs6000/rs6000.cc (altivec_expand_vec_perm_const): Replace
CODE_FOR_altivec_vmrghw_direct_v4si by
CODE_FOR_altivec_vmrghw_direct_v4si_be for BE and
CODE_FOR_altivec_vmrghw_direct_v4si_le for LE.  And replace
CODE_FOR_altivec_vmrglw_direct_v4si by
CODE_FOR_altivec_vmrglw_direct_v4si_be for BE and
CODE_FOR_altivec_vmrglw_direct_v4si_le for LE.
* config/rs6000/vsx.md (vsx_xxmrghw_<VSX_W:mode>): Adjust by calling
gen_altivec_vmrghw_direct_v4si_be for BE and
gen_altivec_vmrglw_direct_v4si_le for LE.
(vsx_xxmrglw_<VSX_W:mode>): Adjust by calling
gen_altivec_vmrglw_direct_v4si_be for BE and
gen_altivec_vmrghw_direct_v4si_le for LE.

gcc/testsuite/ChangeLog:

* g++.target/powerpc/pr106069.C: New test.
* gcc.target/powerpc/pr115355.c: New test.

2 months agoDaily bump.
GCC Administrator [Fri, 21 Jun 2024 00:17:08 +0000 (00:17 +0000)]
Daily bump.

2 months agoi386: Allow all register_operand SUBREGs in x86_ternlog_idx.
Roger Sayle [Thu, 20 Jun 2024 15:30:15 +0000 (16:30 +0100)]
i386: Allow all register_operand SUBREGs in x86_ternlog_idx.

This patch tweaks ix86_ternlog_idx to allow any SUBREG that matches
the register_operand predicate, and is split out as an independent
piece of a patch that I have to clean-up redundant ternlog patterns
in sse.md.  It turns out that some of these patterns aren't (yet)
sufficiently redundant to be obsolete.  The problem is that the
"new" ternlog pattern has the restriction that it allows SUBREGs,
but only those where the inner and outer modes are the same size,
where regular patterns use "register_operand" which allows arbitrary
including paradoxical SUBREGs.

A motivating example is f2 in gcc.target/i386/avx512dq-abs-copysign-1.c

void f2 (float x, float y)
{
  register float a __asm ("xmm16"), b __asm ("xmm17");
  a = x;
  b = y;
  asm volatile ("" : "+v" (a), "+v" (b));
  a = __builtin_copysignf (a, b);
  asm volatile ("" : "+v" (a));
}

for which combine tries:

(set (subreg:V4SF (reg:SF 100 [ _3 ]) 0)
    (ior:V4SF (and:V4SF (not:V4SF (reg:V4SF 104))
            (subreg:V4SF (reg:SF 110) 0))
        (reg:V4SF 106)))

where the SUBREG is paradoxical, with inner mode SF and outer mode V4SF.
This patch allows the recently added ternlog_operand to accept this case.

2024-06-20  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
* config/i386/i386-expand.cc (ix86_ternlog_idx): Allow any SUBREG
that matches register_operand.  Use rtx_equal_p to compare REG
or SUBREG "leaf" operands.

2 months ago[RISC-V] Minor cleanup/improvement to bset/binv patterns
Jeff Law [Thu, 20 Jun 2024 14:43:37 +0000 (08:43 -0600)]
[RISC-V] Minor cleanup/improvement to bset/binv patterns

  Changes since V1:
   Whitespace fixes noted by the linter
   Missed using the iterator for the output template in
<bit_optab><mode>_mask pattern!

--

This patch introduces a bit_optab iterator that maps IOR/XOR to bset and
binv (and one day bclr if we need it).  That allows us to combine some
patterns that only differed in the RTL opcode (IOR vs XOR) and in the
name/assembly (bset vs binv).

Additionally this also allow us to use the iterator in the
bset<mode>mask and bsetidisi patterns thus potentially fixing a missed
optimization.

This has gone through my tester.  I'll wait for a verdict from
pre-commit CI before moving forward.

gcc/
* config/riscv/bitmanip.md (<bit_optab><mode>): New unified
pattern for bset/binv using a code iterator.
(<bit_optab>i<mode>): Likewise.
(<bit_optab><mode>_mask): Likewise.  Support XOR via any_or.
(<bit_optab>isidi): Likewise.
* config/riscv/iterators.md (bit_optab): New iterator.

2 months agolibstdc++: Fix find_last_set(simd_mask) to ignore padding bits
Matthias Kretz [Fri, 14 Jun 2024 13:11:25 +0000 (15:11 +0200)]
libstdc++: Fix find_last_set(simd_mask) to ignore padding bits

With the change to the AVX512 find_last_set implementation, the change
to AVX512 operator!= is unnecessary. However, the latter was not
producing optimal code and unnecessarily set the padding bits. In
theory, the compiler could determine that with the new !=
implementation, the bit operation for clearing the padding bits is a
no-op and can be elided.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:

PR libstdc++/115454
* include/experimental/bits/simd_x86.h (_S_not_equal_to): Use
neq comparison instead of bitwise negation after eq.
(_S_find_last_set): Clear unused high bits before computing
bit_width.
* testsuite/experimental/simd/pr115454_find_last_set.cc: New
test.

2 months agoada: Reference to nonexistent operator in reduction expression accepted
Steve Baird [Thu, 16 May 2024 21:49:17 +0000 (14:49 -0700)]
ada: Reference to nonexistent operator in reduction expression accepted

In some cases, a reduction expression that references the (nonexistent)
"+" operator of a generic formal private type is incorrectly accepted.

gcc/ada/

* sem_attr.adb (Resolve_Attribute.Proper_Op): When resolving the
name of the reducer subprogram in a reduction expression,
Proper_Op treats references to operators defined in Standard
specially. Disable this special treatment if the type of the
reduction expression is not the right class of type for the
operator, or if a new Boolean parameter (named "Strict") is True.
(Resolve_Attribute): In the overloaded case, iterate over the
reducer subprogram candidates twice. First with Strict => True and
then, if no good intepretation is found, with Strict => False.

2 months agoada: Fix checking of SPARK RM on ghost with concurrent part
Yannick Moy [Mon, 27 May 2024 10:06:47 +0000 (12:06 +0200)]
ada: Fix checking of SPARK RM on ghost with concurrent part

SPARK RM 6.9(21) forbids a ghost type to have concurrent parts.
This was not enforced, instead only the type itself was checked to
be concurrent. Now fixed.

gcc/ada/

* ghost.adb (Check_Ghost_Type): Fix checking.

2 months agoada: Rewrite generic formal/actual matching
Bob Duff [Tue, 28 May 2024 16:19:51 +0000 (12:19 -0400)]
ada: Rewrite generic formal/actual matching

...in preparation for implementing type inference for generic
parameters.

The main change is to do the "matching" computation early, and produce a
*constant* data structure (Gen_Assocs_Rec) to represent the matching
between each triple of unanalyzed formal, analyzed formal, and
corresponding actual. This will allow us to look at that data structure
more than once, which will be necessary for type inference.
Matching_Actual is removed; Match_Assocs is added.

Other changes include removal of global variables, splitting out
processing into subprograms, adding assertions, comment corrections,
and other general cleanups.

gcc/ada/

* expander.ads: Minor comment fixes.
* nlists.ads: Misc comment improvements.
* sem_aux.ads (First_Discriminant): Improve comment.
* sem_ch12.adb: Misc cleanups.
(Associations): New package containing type Gen_Assocs_Rec
to represent matchings, and function Match_Assocs to create the
Gen_Assocs_Rec constant.
(Analyze_Associations): Call Match_Assocs, and other major
changes related to that.
* sem_ch12.ads: Minor comment fixes.
* sem_ch3.adb: Minor comment fixes.

2 months agoada: Replace "All" argument to Extensions_Allowed pragma with "All_Extensions"
Steve Baird [Fri, 24 May 2024 21:14:03 +0000 (14:14 -0700)]
ada: Replace "All" argument to Extensions_Allowed pragma with "All_Extensions"

The argument to pragma Extensions_Allowed to enable all extensions is
no longer "All", but instead "All_Extensions".

gcc/ada/

* doc/gnat_rm/gnat_language_extensions.rst: Update documentation.
* doc/gnat_rm/implementation_defined_pragmas.rst: Update
documentation.
* errout.adb
(Error_Msg_GNAT_Extension): Update error message text.
* par-prag.adb: Update pragma parsing. This includes changing the
the name of the Check_Arg_Is_On_Or_Off formal parameter All_OK_Too
to All_Extensions_OK_Too.
* sem_prag.adb (Analyze_Pragma): In analyzing an
Extensions_Allowed pragma, replace uses of Name_All with
Name_All_Extensions; update a comment to reflect this.
* snames.ads-tmpl: Add Name_All_Extensions declaration.
* gnat_rm.texi: Regenerate.

2 months agoada: Crash on selected component of formal derived type in generic instance
Gary Dismukes [Thu, 23 May 2024 22:06:21 +0000 (22:06 +0000)]
ada: Crash on selected component of formal derived type in generic instance

The compiler crashes on an instantiation of a generic child unit G1.GC
that has a formal private extension P_Ext of a private type P declared
in the parent G1 whose full type has a component C, when analyzing a
selected component ACC.C whose prefix is of an access type coming from
an instantiation of another generic G2 where the designated type is
the formal type P_Ext (coming in from a formal type of G2).

gcc/ada/

* sem_ch4.adb (Try_Selected_Component_In_Instance): Reverse if_statement
clauses so that the testing for the special case of extensions of private
types in instance bodies is done first, followed by the testing for the case
of a parent type that's a generic actual type. In the extension case, apply
Base_Type to the type actual in the test of Used_As_Generic_Actual, and add
a test of Present (Parent_Subtype (Typ)).

2 months agoada: Fix inlining of fixed-lower-bound array for GNATprove
Yannick Moy [Thu, 23 May 2024 12:39:19 +0000 (14:39 +0200)]
ada: Fix inlining of fixed-lower-bound array for GNATprove

Inlining in GNATprove may fail on a call to a subprogram with a formal
of an array type with fixed lower bound (a GNAT extension), because the
appropriate conversion is not used. Fix it.

Also fix the function that inserts an unchecked conversion, in cases where
it could skip sliding due to the target type having fixed lower bound.

gcc/ada/

* inline.adb (Establish_Actual_Mapping_For_Inlined_Call): In the
case of formal with a fixed lower bounds, insert appropriate
conversion like in the case of a constrained type.
* tbuild.adb (Unchecked_Convert_To): Do not skip the conversion
when it may involve sliding due to a type with fixed lower bound.

2 months agoada: Fix assertion failure during analysis of instantiation of formal package
Eric Botcazou [Fri, 24 May 2024 07:44:10 +0000 (09:44 +0200)]
ada: Fix assertion failure during analysis of instantiation of formal package

It's an assertion on the name of an instance of a generic child unit and
it needs to cope with a renaming of the unit.

gcc/ada/

* sem_ch12.adb (Instantiate_Formal_Package): Accept renamings of a
generic parent that is a child unit for the abbreviated instance.

2 months agoada: Fix composition of primitive equality for untagged records with variant part
Eric Botcazou [Tue, 21 May 2024 06:40:06 +0000 (08:40 +0200)]
ada: Fix composition of primitive equality for untagged records with variant part

In Ada 2012, primitive equality operators of untagged record types compose
like those of tagged record types, but this has never been implemented for
untagged record types with a variant part.

gcc/ada/

* exp_ch4.adb (Expand_Composite_Equality): In the untagged record
case, always look for a user-defined equality operator in Ada 2012.

2 months agoada: New pragma to default all interrupts to system.
Doug Rupp [Sat, 3 Feb 2024 12:18:51 +0000 (04:18 -0800)]
ada: New pragma to default all interrupts to system.

New pragma Interrupts_System_By_Default defaults all interrupts/signals
to system (which will inhibit the installation of default signal handlers).
Note this changes the ALI format: it optionally adds an identifier to
the 'P' line (similar to pragma Unreserve_All_Interrupts). As per comment
in lib-writ spec regarding new modifiers, adding modifiers to the P line
is always safe. Also note this does not introduce a bootstrap problem
because the compiler and binder do not set the underlying _gl global nor
do they use this pragma.

gcc/ada/

* ali.ads (Interrupts_Default_To_System): New boolean.
(Interrupts_Default_To_System_Specified): New boolean.
* ali.adb (Interrupts_Default_To_System_Specified): Initialize.
(Interrupts_Default_To_System): Initialize.
(Scan_ALI): Processing for "ID".
* bindgen.adb: Coallesce comments on interrupt settings to ...
(Gen_Adainit): Import Interrupts_Default_To_System flag and set if
pragma specified.
(Gen_Output_File_Ada): Generate Local_Interrupt_States according
to pragma.
* init.c: ... here.
[vxworks] (__gnat_install_handler): Test for interrupt_state.
(__gl_interrupts_default_to_system): New global flag.
(__gnat_get_interrupt_State): return interrupt state according to
new global flag.
* lib-writ.ads: Document "ID".
* lib-writ.adb: Write out "ID".
* opt.ads (Interrupts_System_By_Default): New boolean, defaulted
to False.
* par-prag.adb (Pragma_Interrupts_System_By_Default): New.
* sem_prag.adb (Pragma_Interrupts_System_By_Default): Handle it.
(Pragma_Interrupts_System_By_Default): Default it.
* snames.ads-tmpl (Name_Interrupts_System_By_Default): New name.
(Pragma_Interrupts_System_By_Default): New
* libgnarl/s-intman__posix.adb (Initialize): Ensure the
Keep_Unmasked signal is sigset-able.
* doc/gnat_rm/implementation_defined_pragmas.rst: Document pragma
Interrupts_System_By_Default.
* doc/gnat_ugn/the_gnat_compilation_model.rst (Configuration
pragmas): Add Interrupts_System_By_Default. (Partition-Wide
Settings): Mention pragma Interrupts_System_By_Default.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.

2 months agoada: Fix bogus error with "=" operator on array of private unchecked union
Eric Botcazou [Mon, 20 May 2024 16:08:07 +0000 (18:08 +0200)]
ada: Fix bogus error with "=" operator on array of private unchecked union

The code is legal and, therefore, must be accepted by the compiler, but it
must raise Program_Error at run time due to operands not having inferable
discriminants and a warning be given at compile time (RM B.3.3(22-23)).

gcc/ada/

* exp_ch4.adb (Expand_Array_Equality.Component_Equality): Copy the
Comes_From_Source flag from the original test to the new one, and
remove obsolete code dealing with unchecked unions.
* sem_util.adb (Has_Inferable_Discriminants): Return False for an
incomplete or private nominal subtype.

2 months agoada: Fix crash on real literal in declare expression of expression function
Eric Botcazou [Mon, 20 May 2024 12:33:14 +0000 (14:33 +0200)]
ada: Fix crash on real literal in declare expression of expression function

The problem is that the freeze node of the type to which the real literal
is resolved is placed inside the expression function instead of outside.

gcc/ada/

* freeze.adb (Freeze_Expression): Also attach pending freeze nodes
to the parent in the case of an internal block in a spec expression.

2 months agoada: Enforce strict alignment for array types with aliased component
Eric Botcazou [Sun, 19 May 2024 13:45:34 +0000 (15:45 +0200)]
ada: Enforce strict alignment for array types with aliased component

This was initially implemented as part of AI12-001 but immediately disabled
because it breaks Florist on 32-bit platforms.  However, it is possible to
reenable it in almost all cases without affecting Florist, and the -gnatd_l
switch can now be used to disable it again.

gcc/ada/
* debug.adb (d_l): Document new usage for the compiler.
* freeze.adb (Check_Strict_Alignment): Set the Strict_Alignment
flag on array types with aliased component, except if the
component size is equal to the storage unit or the -gnatd_l switch
is specified.

2 months agoada: Update Bit Ordering references in GNAT Reference Manual
Eric Botcazou [Fri, 17 May 2024 08:13:05 +0000 (10:13 +0200)]
ada: Update Bit Ordering references in GNAT Reference Manual

They are still tailored to Ada 95 while the level of recommended support for
Bit Ordering was changed in Ada 2005.

gcc/ada/

* doc/gnat_rm/implementation_advice.rst (Representation Clauses):
Remove >> marker and add end of sentence after code-block directive.
(RM 13.5.3(7-8)): Update to Ada 2005 wording.
* doc/gnat_rm/implementation_defined_characteristics.rst
(RM 13.5.3(5)): Likewise.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.

2 months agoada: Add documentation for Subprogram_Variant aspect and pragma
Piotr Trojanek [Thu, 16 May 2024 20:13:38 +0000 (22:13 +0200)]
ada: Add documentation for Subprogram_Variant aspect and pragma

For completeness, the GNAT Reference Manual should document aspects and
pragmas that are specific to SPARK and described in the SPARK User's
Guide.

gcc/ada/

* doc/gnat_rm/implementation_defined_aspects.rst
(Aspect Subprogram_Variant): Refer to SPARK User's Guide.
* doc/gnat_rm/implementation_defined_pragmas.rst
(Pragma Subprogram_Variant): Document syntax to satisfy the
convention; refer to SPARK User's Guide for semantics.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.

2 months agoada: Streamline propagation of controlled flags on types
Eric Botcazou [Wed, 15 May 2024 21:56:44 +0000 (23:56 +0200)]
ada: Streamline propagation of controlled flags on types

The front-end maintains a set of 4 flags on (base) types that are used to
parameterize the implementation of controlled operations, and these flags
need to be propagated through composition and derivation.  This is done
on a per-flag basis in the current implementation with a few loopholes.

This introduces a Propagate_Controlled_Flags routine to that effect, which
is modeled on the existing Propagate_Concurrent_Flags routine, and is used
in most cases to do the propagation.  This also removes the handling of the
Finalize_Storage_Only flag from Inherit_Aspects_At_Freeze_Point, since the
associated aspect does not exist (only the pragma does).

gcc/ada/

* freeze.adb (Freeze_Array_Type): Call Propagate_Controlled_Flags
to propagate the controlled flags from the component to the array.
(Freeze_Record_Type): Propagate the Finalize_Storage_Only flag
from the components to the record.
* sem_ch3.adb (Analyze_Private_Extension_Declaration): Do not call
Propagate_Concurrent_Flags here but...
(Array_Type_Declaration): Tidy and call Propagate_Controlled_Flags
to propagate the controlled flags from the component to the array.
(Build_Derived_Private_Type): Do not propagate the controlled flags
manually here but...
(Build_Derived_Record_Type): ...call Propagate_Controlled_Flags to
propagate the controlled flags from parent to derived type.
(Build_Derived_Type): Likewise.
(Copy_Array_Base_Type_Attributes): Call Propagate_Controlled_Flags
to copy the controlled flags.
(Record_Type_Definition): Streamline the propagation of the
Finalize_Storage_Only flag from the components to the record.
* sem_ch7.adb (Preserve_Full_Attributes): Use Full_Base and call
Propagate_Controlled_Flags to copy the controlled flags.
* sem_ch9.adb (Analyze_Protected_Definition): Use canonical idiom
to compute Has_Controlled_Component.
(Analyze_Protected_Type_Declaration): Minor tweak.
* sem_ch13.adb (Inherit_Aspects_At_Freeze_Point): Do not deal with
Finalize_Storage_Only here.
* sem_util.ads (Propagate_Controlled_Flags): New declaration.
* sem_util.adb (Propagate_Controlled_Flags): New procedure.

2 months agoada: Remove redundant conditions from freezing code
Piotr Trojanek [Wed, 15 May 2024 08:58:33 +0000 (10:58 +0200)]
ada: Remove redundant conditions from freezing code

Code cleanup; behavior is unaffected.

gcc/ada/

* freeze.adb (Check_Current_Instance): This routine is only called
with parameter E being a type entity, so there is no need to check
for types just before the equality with E.
* sem_ch13.adb (Analyze_Aspect_Specifications): Regroup condition
to avoid unnecessary evaluation.
(Check_Aspect_At_End_Of_Declarations): If In_Instance is true,
then the routine exits early.

2 months agoada: Fix style in freezing code
Piotr Trojanek [Wed, 15 May 2024 08:58:04 +0000 (10:58 +0200)]
ada: Fix style in freezing code

Code cleanup; semantics is unaffected.

gcc/ada/

* freeze.adb (Find_Aspect_No_Parts): Tune whitespace.
* sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): Fix style.

2 months agoada: Remove Max_Entry_Queue_Depth pragma/aspect
Eric Botcazou [Thu, 16 May 2024 13:24:11 +0000 (15:24 +0200)]
ada: Remove Max_Entry_Queue_Depth pragma/aspect

It was implemented apparently because a very early version of AI12-0164
that standardizes GNAT's Max_Queue_Length opted for the subtly different
moniker, but later versions of the AI use Max_Entry_Queue_Length instead.

gcc/ada/

* aspects.ads (Aspect_Id): Remove Aspect_Max_Entry_Queue_Depth.
(global arrays): Remove entry for it.
* exp_ch9.adb (Expand_N_Protected_Type_Declaration): Remove
reference to pragma Max_Entry_Queue_Depth in comment.
* par-prag.adb (Prag): Remove handling of
Pragma_Max_Entry_Queue_Depth.
* sem_ch13.adb (Analyze_Aspect_Specifications): Remove reference
to aspect Max_Entry_Queue_Depth in comment.
(Analyze_Aspect_Specifications): Remove processing of aspect
Max_Entry_Queue_Depth.
(Check_Aspect_At_Freeze_Point): Likewise.
* sem_prag.ads (Find_Related_Declaration_Or_Body): Remove
reference to pragma Max_Entry_Queue_Depth in comment.
* sem_prag.adb (Analyze_Pragma): Remove processing of pragma
Max_Entry_Queue_Depth.
(Sig_Flags): Remove entry for Pragma_Max_Entry_Queue_Depth.
* sem_util.adb (Get_Max_Queue_Length): Remove handling of pragma
Max_Entry_Queue_Depth.
(Has_Max_Queue_Length): Likewise.
* snames.ads-tmpl (Name_Max_Entry_Queue_Depth): Move back from
pragmas section to others section.
(Pragma_Id): Remove Pragma_Max_Entry_Queue_Depth.

2 months agoada: Couple of minor fixes in GNAT Reference Manual
Eric Botcazou [Thu, 16 May 2024 08:28:13 +0000 (10:28 +0200)]
ada: Couple of minor fixes in GNAT Reference Manual

The Storage_Model pragma no longer exists.

gcc/ada/

* doc/gnat_rm/gnat_language_extensions.rst (Pragma Storage_Model):
Rename to Storage Model.
* doc/gnat_rm/implementation_defined_aspects.rst: Alphabetize.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.

2 months agoada: Add Dump_Buffers hooks for code coverage
Ronan Desplanques [Wed, 15 May 2024 12:35:59 +0000 (14:35 +0200)]
ada: Add Dump_Buffers hooks for code coverage

The purpose of this patch is to make it possible to set up code
coverage for the GNAT front end in gnat1 using GNATcoverage. It is
not obvious how to have GNATcoverage instrument gnat1's main function,
and since the front end has a clear entry point (Gnat1drv), we add
manual instrumentation annotations there.

gcc/ada/

* gnat1drv.adb (Gnat1drv): Add coverage instrumentation
annotations.

2 months agoada: Do not compute Has_Controlled_Component twice during freezing
Eric Botcazou [Tue, 14 May 2024 20:06:17 +0000 (22:06 +0200)]
ada: Do not compute Has_Controlled_Component twice during freezing

The Has_Controlled_Component flag is computed twice during freezing when
expansion is enabled: in Freeze_Array_Type and Expand_Freeze_Array_Type
for array types, and in Freeze_Record_Type and Expand_Freeze_Record_Type
for record types.

This removes the latter computation in both cases, as well as moves the
computation of concurrent flags from the latter to the former places, which
happens to plug a loophole in the detection of errors when the No_Task_Parts
aspect is specified on peculiar types.

gcc/ada/

* exp_ch3.adb (Expand_Freeze_Array_Type): Do not propagate the
concurrent flags and the Has_Controlled_Component flag here.
(Expand_Freeze_Record_Type): Likewise.
* freeze.adb (Freeze_Array_Type): Propagate the concurrent flags.
(Freeze_Record_Type): Likewise.
* sem_util.adb (Has_Some_Controlled_Component): Adjust comment.

2 months agoada: Fix minor issues in comments
Eric Botcazou [Fri, 10 May 2024 23:14:38 +0000 (01:14 +0200)]
ada: Fix minor issues in comments

gcc/ada/

* mutably_tagged.ads: Fix minor issues in comments throughout.

2 months agoada: Document -gnatd_w for CCG
Richard Kenner [Wed, 15 May 2024 16:50:58 +0000 (12:50 -0400)]
ada: Document -gnatd_w for CCG

gcc/ada/

* debug.adb: Add documentation for -gnatd_w.

2 months agoada: Change messages for -gnatw.v to warnings
Viljar Indus [Mon, 13 May 2024 08:53:45 +0000 (11:53 +0300)]
ada: Change messages for -gnatw.v to warnings

Previously this switch was emitting only info messages
which was both confusing in terms of the name of the
switch that was used internally and externally.

gcc/ada/

* doc/gnat_ugn/building_executable_programs_with_gnat.rst: Update
documentation for -gnatw.v.
* sem_ch13.adb: Convert all -gnatw.v related messages to warnings.
* gnat_ugn.texi: Regenerate.

2 months agoada: Convert -gnatw.n messages to warnings
Viljar Indus [Fri, 10 May 2024 11:52:58 +0000 (14:52 +0300)]
ada: Convert -gnatw.n messages to warnings

Previously the messages produced by this warning switch
were info messages that were suppressed with the same
methods as regular warnings. Since info messages are now
separated as a completely different class of messages then
these messages should be converted back to warnings in order
for the previous pragma based suppression methods to work.

gcc/ada/

* doc/gnat_ugn/building_executable_programs_with_gnat.rst: Update
documentation for -gnatw.n switch.
* exp_util.adb: Convert info messages into warnings.
* gnat_ugn.texi: Regenerate.

2 months agoada: Add switch for suppressing info messages
Viljar Indus [Tue, 7 May 2024 13:35:30 +0000 (16:35 +0300)]
ada: Add switch for suppressing info messages

Add a separate switch -gnatis to suppress info messages
separately from warning messages that are controlled by
-gnatws.

gcc/ada/

* doc/gnat_ugn/building_executable_programs_with_gnat.rst: Add
entry for -gnatis.
* errout.adb (Error_Msg_Internal): Stop printing info messages if
-gnatis was used.
* opt.ads: Add Info_Suppressed flag to track whether info messages
should be suppressed.
* switch-c.adb: Add parsing for -gnatis.
* gnat_ugn.texi: Regenerate.

2 months agoada: Treat Info-Warnings as Info messages
Viljar Indus [Mon, 6 May 2024 12:17:27 +0000 (15:17 +0300)]
ada: Treat Info-Warnings as Info messages

There was a general concept of info messages being a subset of
warnings. However that is no longer the case. Messages with an
info insertion character should be treated just as info messages.

gcc/ada/

* atree.ads: Remove Warning_Info_Messages.
* errout.adb: Remove various places where Warning_Info_Messages
was used.
* erroutc.adb: Remove various places where Warning_Info_Messages
was used. Create Error_Msg_Object objects with only an info
attribute if the message contained both info and warning insertion
characters. New method Has_Switch_Tag for detecting if a message
should have an error tag.
* errutil.adb: Create Error_Msg_Object objects with only an info
attribute if the message contained both info and warning insertion
characters.

2 months agoada: Update documentation for 'Super
Justin Squirek [Thu, 9 May 2024 19:50:01 +0000 (19:50 +0000)]
ada: Update documentation for 'Super

This patch moves the documentation for 'Super from gnat language extensions to
experimental language extensions.

gcc/ada/

* doc/gnat_rm/gnat_language_extensions.rst: Add entry for 'Super.
* doc/gnat_rm/implementation_defined_attributes.rst: Remove entry
for 'Super.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.

2 months agoada: Improve preprocessor error handling.
Steve Baird [Fri, 10 May 2024 22:03:37 +0000 (15:03 -0700)]
ada: Improve preprocessor error handling.

In some cases, gnatprep would correctly emit an error message and then
incorrectly exit with a return code of zero, indicating success.
In some cases, a correct message about an error detected by the integrated
preprocessor would be accompanied by an incorrect message indicating that
a source file could not be found.

gcc/ada/

* gprep.adb (Process_Files.Process_One_File): When calling OS_Exit in an error
path, pass in a Status parameter of 1 instead of 0 (because 0
indicates success).
* lib-load.adb (Load_Main_Source): Do not emit a message about a missing source file
if other error messages were generated by calling Load_Source_File;
the file isn't missing - it failed preprocessing.

2 months agoada: Fix list of attributes defined by Ada 2022
Piotr Trojanek [Thu, 1 Feb 2024 12:15:27 +0000 (13:15 +0100)]
ada: Fix list of attributes defined by Ada 2022

Recognize references to attributes Put_Image and Object_Size as
language-defined in Ada 2022 and implementation-defined in earlier
versions of Ada. Other attributes listed in Ada 2022 RM, K.2 and
currently implemented in GNAT are correctly categorized.

This change only affects code with restriction
No_Implementation_Attributes.

gcc/ada/

* sem_attr.adb (Attribute_22): Add Put_Image and Object_Size.
* sem_attr.ads (Attribute_Impl_Def): Remove Object_Size.

2 months agoi386: Fix some ISA bit test in option_override
Hongyu Wang [Mon, 17 Jun 2024 02:34:01 +0000 (10:34 +0800)]
i386: Fix some ISA bit test in option_override

Adjust several new feature check in ix86_option_override_interal that
directly use TARGET_* instead of TARGET_*_P (opts->ix86_isa_flags)
to avoid cmdline option overrides target_attribute isa flag.

gcc/ChangeLog:

* config/i386/i386-options.cc (ix86_option_override_internal):
Use TARGET_*_P (opts->x_ix86_isa_flags*) instead of TARGET_*
for UINTR, LAM and APX_F.

gcc/testsuite/ChangeLog:

* gcc.target/i386/apx-ccmp-2.c: Remove -mno-apxf in option.
* gcc.target/i386/funcspec-56.inc: Drop uintr tests.
* gcc.target/i386/funcspec-6.c: Add uintr tests.

2 months agoFortran: Auto array allocation with function dependencies [PR59104]
Paul Thomas [Thu, 20 Jun 2024 07:01:36 +0000 (08:01 +0100)]
Fortran: Auto array allocation with function dependencies [PR59104]

2024-06-20  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/59104
* dependency.cc (dependency_fcn, gfc_function_dependency): New
functions to detect dependency in array bounds and character
lengths on old style function results.
* dependency.h : Add prototype for gfc_function_dependency.
* error.cc (error_print): Remove trailing space.
* gfortran.h : Remove dummy_order and add fn_result_spec.
* symbol.cc : Remove declaration of next_dummy_order..
(gfc_set_sym_referenced): remove setting of symbol dummy order.
* trans-array.cc (gfc_trans_auto_array_allocation): Detect
non-dummy symbols with function dependencies and put the
allocation at the end of the initialization code.
* trans-decl.cc : Include dependency.h.
(decl_order): New function that determines uses the location
field of the symbol 'declared_at' to determine the order of two
declarations.
(gfc_defer_symbol_init): Call gfc_function_dependency to put
dependent symbols in the right part of the tlink chain. Use
the location field of the symbol declared_at to determine the
order of declarations.
(gfc_trans_auto_character_variable): Put character length
initialization of dependent symbols at the end of the chain.
* trans.cc (gfc_add_init_cleanup): Add boolean argument with
default false that determines whther an expression is placed at
the back or the front of the initialization chain.
* trans.h : Update the prototype for gfc_add_init_cleanup.

gcc/testsuite/
PR fortran/59104
* gfortran.dg/dependent_decls_2.f90: New test.

2 months agotree-optimization/114413 - SLP CSE after permute optimization
Richard Biener [Wed, 19 Jun 2024 10:57:27 +0000 (12:57 +0200)]
tree-optimization/114413 - SLP CSE after permute optimization

We currently fail to re-CSE SLP nodes after optimizing permutes
which results in off cost estimates.  For gcc.dg/vect/bb-slp-32.c
this shows in not re-using the SLP node with the load and arithmetic
for both the store and the reduction.  The following implements
CSE by re-bst-mapping nodes as finalization part of vect_optimize_slp.

I've tried to make the CSE part of permute materialization but it
isn't a very good fit there.  I've not bothered to implement something
more complete, also handling external defs or defs without
SLP_TREE_SCALAR_STMTS.

I realize this might result in more BB SLP which in turn might slow
down code given costing for BB SLP is difficult (even that we now
vectorize gcc.dg/vect/bb-slp-32.c on x86_64 might be not a good idea).
This is nevertheless feeding more accurate info to costing which is
good.

PR tree-optimization/114413
* tree-vect-slp.cc (release_scalar_stmts_to_slp_tree_map):
New function, split out from ...
(vect_analyze_slp): ... here.  Call it.
(vect_cse_slp_nodes): New function.
(vect_optimize_slp): Call it.

* gcc.dg/vect/bb-slp-32.c: Expect CSE and vectorization on x86.

2 months agobuild: Fix missing variable quotes and typo
Collin Funk [Wed, 19 Jun 2024 23:36:50 +0000 (16:36 -0700)]
build: Fix missing variable quotes and typo

When dlopen and pthread_create are in libc the variable is
set to "none required", therefore running configure will show
the following errors:

./configure: line 8997: test: too many arguments
./configure: line 8999: test: too many arguments
./configure: line 9003: test: too many arguments
./configure: line 9005: test: =: unary operator expected

ChangeLog:

PR bootstrap/115453
* configure.ac: Quote variable result of AC_SEARCH_LIBS.  Fix
typo ac_cv_search_pthread_crate.
* configure: Regenerate.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
2 months agovect: Tighten an assertion for lane-reducing in transform
Feng Xue [Sun, 16 Jun 2024 05:33:52 +0000 (13:33 +0800)]
vect: Tighten an assertion for lane-reducing in transform

According to logic of code nearby the assertion, all lane-reducing operations
should not appear, not just DOT_PROD_EXPR. Since "use_mask_by_cond_expr_p"
treats SAD_EXPR same as DOT_PROD_EXPR, and WIDEN_SUM_EXPR should not be allowed
by the following assertion "gcc_assert (commutative_binary_op_p (...))", so
tighten the assertion.

2024-06-16 Feng Xue <fxue@os.amperecomputing.com>

gcc/
* tree-vect-loop.cc (vect_transform_reduction): Change assertion to
cover all lane-reducing ops.

2 months agovect: Use an array to replace 3 relevant variables
Feng Xue [Sun, 16 Jun 2024 05:21:13 +0000 (13:21 +0800)]
vect: Use an array to replace 3 relevant variables

It's better to place 3 relevant independent variables into array, since we
have requirement to access them via an index in the following patch. At the
same time, this change may get some duplicated code be more compact.

2024-06-16 Feng Xue <fxue@os.amperecomputing.com>

gcc/
* tree-vect-loop.cc (vect_transform_reduction): Replace vec_oprnds0/1/2
with one new array variable vec_oprnds[3].

2 months agovect: Use one reduction_type local variable
Feng Xue [Sun, 16 Jun 2024 04:17:26 +0000 (12:17 +0800)]
vect: Use one reduction_type local variable

Two local variables were defined to refer same STMT_VINFO_REDUC_TYPE, better
to keep only one.

2024-06-16 Feng Xue <fxue@os.amperecomputing.com>

gcc/
* tree-vect-loop.cc (vectorizable_reduction): Remove v_reduc_type, and
replace it to another local variable reduction_type.

2 months agovect: Remove duplicated check on reduction operand
Feng Xue [Sun, 16 Jun 2024 04:08:56 +0000 (12:08 +0800)]
vect: Remove duplicated check on reduction operand

In vectorizable_reduction, one check on a reduction operand via index could be
contained by another one check via pointer, so remove the former.

2024-06-16 Feng Xue <fxue@os.amperecomputing.com>

gcc/
* tree-vect-loop.cc (vectorizable_reduction): Remove the duplicated
check.

2 months agovect: Add a function to check lane-reducing stmt
Feng Xue [Sat, 15 Jun 2024 15:17:10 +0000 (23:17 +0800)]
vect: Add a function to check lane-reducing stmt

Add a utility function to check if a statement is lane-reducing operation,
which could simplify some existing code.

2024-06-16 Feng Xue <fxue@os.amperecomputing.com>

gcc/
* tree-vectorizer.h (lane_reducing_stmt_p): New function.
* tree-vect-slp.cc (vect_analyze_slp): Use new function
lane_reducing_stmt_p to check statement.

2 months agoDaily bump.
GCC Administrator [Thu, 20 Jun 2024 00:17:14 +0000 (00:17 +0000)]
Daily bump.

This page took 0.120281 seconds and 5 git commands to generate.