]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
12 months agoBump BASE-VER. basepoints/gcc-14
Jakub Jelinek [Mon, 17 Apr 2023 11:52:56 +0000 (13:52 +0200)] 
Bump BASE-VER.

2023-04-17  Jakub Jelinek  <jakub@redhat.com>

* BASE-VER: Set to 14.0.0.

12 months agoipa: Fix double reference-count decrements for the same edge (PR 107769, PR 109318)
Martin Jambor [Mon, 17 Apr 2023 10:59:51 +0000 (12:59 +0200)] 
ipa: Fix double reference-count decrements for the same edge (PR 107769, PR 109318)

It turns out that since addition of the code that can identify globals
which are only read from, the code that keeps track of the references
can decrement their count for the same calls, once during IPA-CP and
then again during inlining.  Fixed by adding a special flag to the
pass-through variant and simply wiping out the reference to the
refdesc structure from the constant ones.

Moreover, during debugging of the issue I have discovered that the
code removing references could remove a reference associated with the
same statement but of a wrong type.  In all cases it wanted to remove
an IPA_REF_ADDR reference so removing a lesser one instead should do
no harm in practice, but we should try to be consistent and so this
patch extends symtab_node::find_reference so that it searches for a
reference of a given type only.

gcc/ChangeLog:

2023-04-14  Martin Jambor  <mjambor@suse.cz>

PR ipa/107769
PR ipa/109318
* cgraph.h (symtab_node::find_reference): Add parameter use_type.
* ipa-prop.h (ipa_pass_through_data): New flag refdesc_decremented.
(ipa_zap_jf_refdesc): New function.
(ipa_get_jf_pass_through_refdesc_decremented): Likewise.
(ipa_set_jf_pass_through_refdesc_decremented): Likewise.
* ipa-cp.cc (ipcp_discover_new_direct_edges): Provide a value for
the new parameter of find_reference.
(adjust_references_in_caller): Likewise. Make sure the constant jump
function is not used to decrement a refdec counter again.  Only
decrement refdesc counters when the pass_through jump function allows
it.  Added a detailed dump when decrementing refdesc counters.
* ipa-prop.cc (ipa_print_node_jump_functions_for_edge): Dump new flag.
(ipa_set_jf_simple_pass_through): Initialize the new flag.
(ipa_set_jf_unary_pass_through): Likewise.
(ipa_set_jf_arith_pass_through): Likewise.
(remove_described_reference): Provide a value for the new parameter of
find_reference.
(update_jump_functions_after_inlining): Zap refdesc of new jfunc if
the previous pass_through had a flag mandating that we do so.
(propagate_controlled_uses): Likewise.  Only decrement refdesc
counters when the pass_through jump function allows it.
(ipa_edge_args_sum_t::duplicate): Provide a value for the new
parameter of find_reference.
(ipa_write_jump_function): Assert the new flag does not have to be
streamed.
* symtab.cc (symtab_node::find_reference): Add parameter use_type, use
it in searching.

gcc/testsuite/ChangeLog:

2023-04-06  Martin Jambor  <mjambor@suse.cz>

PR ipa/107769
PR ipa/109318
* gcc.dg/ipa/pr109318.c: New test.
* gcc.dg/lto/pr107769_0.c: Likewise.

12 months agoaarch64: disable LDP via tuning structure for -mcpu=ampere1
Philipp Tomsich [Thu, 23 Mar 2023 18:47:57 +0000 (19:47 +0100)] 
aarch64: disable LDP via tuning structure for -mcpu=ampere1

AmpereOne (-mcpu=ampere1) breaks LDP instructions into two uops.
Given the chance that this causes instructions to slip into the next
decoding cycle and the additional overheads when handling
cacheline-crossing LDP instructions, we disable the generation of LDP
isntructions through the tuning structure from instruction combining
(such as in peephole2).

Given the code-density benefits in builtins and prologue/epilogue
expansion, we allow LDPs there.

This commit:
 * adds a new tuning option AARCH64_EXTRA_TUNE_NO_LDP_COMBINE
 * allows -moverride=tune=... to override this

These changes are benchmark-driven, yielding the following changes
(with a net-overall improvement):
   503.bwaves_r.      -0.88%
   507.cactuBSSN_r     0.35%
   508.namd_r          3.09%
   510.parest_r       -2.99%
   511.povray_r        5.54%
   519.lbm_r          15.83%
   521.wrf_r           0.56%
   526.blender_r       2.47%
   527.cam4_r          0.70%
   538.imagick_r       0.00%
   544.nab_r          -0.33%
   549.fotonik3d_r.   -0.42%
   554.roms_r          0.00%
   -------------------------
   = total             1.79%

Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Co-Authored-By: Di Zhao <di.zhao@amperecomputing.com>
gcc/ChangeLog:

* config/aarch64/aarch64-tuning-flags.def (AARCH64_EXTRA_TUNING_OPTION):
Add AARCH64_EXTRA_TUNE_NO_LDP_COMBINE.
* config/aarch64/aarch64.cc (aarch64_operands_ok_for_ldpstp):
Check for the above tuning option when processing loads.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/ampere1-no_ldp_combine.c: New test.

12 months agotestsuite: Fix up vect-simd-clone-1[678]f.c tests some more
Jakub Jelinek [Mon, 17 Apr 2023 09:45:53 +0000 (11:45 +0200)] 
testsuite: Fix up vect-simd-clone-1[678]f.c tests some more

With
make check-gcc check-g++ -j32 -k RUNTESTFLAGS='--target_board=unix\{-m32,-m32/-mavx,-m32/-mavx512f,-m32/-march=cascadelake,-m64,-m64/-mavx,-m64/-mavx512f,-m64/-march=cascadelake\}
+vect.exp=vect-simd-clone*'
the vect-simd-clone-1[678]f.c tests fail with -m32/-mavx512f and -m32/-march=cascadelake,
in that case there are zero matches rather than the 4 expected for ia32.
-m64/-mavx512f and -m64/-march=cascadelake works fine though (2 expected
matches).

So, the following patch just adds -mno-avx512f for x86 non-lp64.

2023-04-17  Jakub Jelinek  <jakub@redhat.com>

* gcc.dg/vect/vect-simd-clone-16f.c: Add -mno-avx512f for non-lp64 x86.
* gcc.dg/vect/vect-simd-clone-17f.c: Likewise.
* gcc.dg/vect/vect-simd-clone-18f.c: Likewise.

12 months agotree-optimization/109524 - ICE with VRP edge removal
Richard Biener [Mon, 17 Apr 2023 07:22:57 +0000 (09:22 +0200)] 
tree-optimization/109524 - ICE with VRP edge removal

VRP queues edges to process late for updating global ranges for
__builtin_unreachable.  But this interferes with edge removal
from substitute_and_fold.  The following deals with this by
looking up the edge with source/dest block indices which do not
become stale.

PR tree-optimization/109524
* tree-vrp.cc (remove_unreachable::m_list): Change to a
vector of pairs of block indices.
(remove_unreachable::maybe_register_block): Adjust.
(remove_unreachable::remove_and_update_globals): Likewise.
Deal with removed blocks.

* g++.dg/pr109524.C: New testcase.

12 months agotestsuite: update builtins-5-p9-runnable.c for BE
Jiufu Guo [Fri, 14 Apr 2023 02:50:28 +0000 (10:50 +0800)] 
testsuite: update builtins-5-p9-runnable.c for BE

Hi,

As PR108809 mentioned, vec_xl_len_r and vec_xst_len_r are tested
in gcc.target/powerpc/builtins-5-p9-runnable.c.
The vector operand of these two bifs are different from the view
of v16_int8 between BE and LE, even it is same from the view of
128bits(uint128/V1TI).

The test case gcc.target/powerpc/builtins-5-p9-runnable.c was
written for LE environment, this patch updates it for BE.

Tested on ppc64 BE and LE.
Is this ok for trunk?

BR,
Jeff (Jiufu)

gcc/testsuite/ChangeLog:

PR testsuite/108809
* gcc.target/powerpc/builtins-5-p9-runnable.c: Update for BE.

12 months agoRISC-V: Fix testsuite fail on RV32
Kito Cheng [Fri, 14 Apr 2023 07:34:40 +0000 (15:34 +0800)] 
RISC-V: Fix testsuite fail on RV32

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/scalar_move-2.c: Adjust include way
for riscv_vector.h
* gcc.target/riscv/rvv/base/spill-sp-adjust.c: Add missing
-mabi.

12 months agoRISC-V: Add test cases for the RVV mask insn shortcut.
Pan Li [Fri, 14 Apr 2023 03:25:11 +0000 (11:25 +0800)] 
RISC-V: Add test cases for the RVV mask insn shortcut.

There are sorts of shortcut codegen for the RVV mask insn. For
example.

vmxor vd, va, va => vmclr vd.

We would like to add more optimization like this but first of all
we must add the tests for the existing shortcut optimization, to
ensure we don't break existing optimization from underlying shortcut
optimization.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/mask_insn_shortcut.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
12 months agoDaily bump.
GCC Administrator [Mon, 17 Apr 2023 00:17:00 +0000 (00:17 +0000)] 
Daily bump.

12 months ago[committed] [PR target/109508] Adjust conditional move expansion for SFB
Jeff Law [Sun, 16 Apr 2023 15:55:32 +0000 (09:55 -0600)] 
[committed] [PR target/109508] Adjust conditional move expansion for SFB

Recently the conditional move expander's predicates were loosened for the
benefit of the THEAD processors.  In particular one operand that was
previously "register_operand" is now "reg_or_0_operand".  That's fine for
THEAD, but breaks for SFB which requires a register for that operand.

This results in an ICE when compiling the testcase an SFB target such as
the sifive s76.

This change adjusts the expansion code slightly to copy the value into
a register for SFB.

Bootstrapped and regression tested (c,c++,fortran only) with a toolchain
configured to enable SFB by default.

PR target/109508
gcc/

* config/riscv/riscv.cc (riscv_expand_conditional_move): For
TARGET_SFB_ALU, force the true arm into a register.

gcc/testsuite
* gcc.target/riscv/pr109508.c: New test.

12 months ago[Committed] New test case gcc.target/avr/pr54816.c
Roger Sayle [Sun, 16 Apr 2023 12:03:10 +0000 (13:03 +0100)] 
[Committed] New test case gcc.target/avr/pr54816.c

PR target/54816 is now fixed on mainline.  This adds a test case to
check that it doesn't regress in future.  Tested with a cross compiler
to avr-elf.  Committed as obvious.

2023-04-16  Roger Sayle  <roger@nextmovesoftware.com>

gcc/testsuite/ChangeLog
PR target/54816
* gcc.target/avr/pr54816.c: New test case.

12 months agoDaily bump.
GCC Administrator [Sun, 16 Apr 2023 00:16:26 +0000 (00:16 +0000)] 
Daily bump.

12 months agoFix fallout of previous change on x86/Linux
Eric Botcazou [Sat, 15 Apr 2023 17:35:02 +0000 (19:35 +0200)] 
Fix fallout of previous change on x86/Linux

gcc/ada/
PR bootstrap/109510
* gcc-interface/decl.cc (gnat_to_gnu_entity) <types>: Do not reset
align to zero in any case.  Set TYPE_USER_ALIGN on the type only if
it is an aggregate type, or else a type whose default alignment is
specifically capped on selected platforms.

13 months agoFix handling of large arguments passed by value.
John David Anglin [Sat, 15 Apr 2023 17:02:44 +0000 (17:02 +0000)] 
Fix handling of large arguments passed by value.

2023-04-15  John David Anglin  <danglin@gcc.gnu.org>

gcc/ChangeLog:

PR target/104989
* config/pa/pa-protos.h (pa_function_arg_size): Update prototype.
* config/pa/pa.cc (pa_function_arg): Return NULL_RTX if argument
size is zero.
(pa_arg_partial_bytes): Don't call pa_function_arg_size twice.
(pa_function_arg_size): Change return type to int.  Return zero
for arguments larger than 1 GB.  Update comments.

13 months agoc++: constexpr aggregate destruction [PR109357]
Jason Merrill [Sat, 15 Apr 2023 02:40:43 +0000 (22:40 -0400)] 
c++: constexpr aggregate destruction [PR109357]

We were assuming that the result of evaluation of TARGET_EXPR_INITIAL would
always be the new value of the temporary, but that's not necessarily true
when the initializer is complex (i.e. target_expr_needs_replace).  In that
case evaluating the initializer initializes the temporary as a side-effect.

PR c++/109357

gcc/cp/ChangeLog:

* constexpr.cc (cxx_eval_constant_expression) [TARGET_EXPR]:
Check for complex initializer.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/constexpr-dtor15.C: New test.

13 months agoif-conv: Small improvement for expansion of complex PHIs [PR109154]
Jakub Jelinek [Sat, 15 Apr 2023 10:08:45 +0000 (12:08 +0200)] 
if-conv: Small improvement for expansion of complex PHIs [PR109154]

The following patch is just a dumb improvement, gets rid of 2 unnecessary
instructions on both the PR's original testcase and on the two reduced ones,
both on -mcpu=neoverse-v1 and -mavx512f.

The thing is, if we have args_len (args_len >= 2) unique PHI arguments,
we need only args_len - 1 COND_EXPRs to expand the PHI, because first
COND_EXPR can merge 2 unique arguments and all the following ones merge
another unique argument with the previously merged arguments,
while the code for mysterious reasons was always emitting args_len
COND_EXPRs, where the first COND_EXPR merged the first and second unique
arguments, the second COND_EXPR merged the second unique argument with
result of merging the first and second unique arguments and the rest was
already expectable, nth COND_EXPR for n > 2 merged the nth unique argument
with result of merging the previous unique arguments.
Now, in my understanding, the bb_predicate for bb's predecessor need to
form a disjunct set which together creates the successor's bb_predicate,
so I don't see why we'd need to check all the bb_predicates, if we check
all but one then when all those other ones are false the last bb_predicate
is necessarily true.  Given that the code attempts to sort argument with
most occurrences (so likely most complex combined predicate) last, I chose
not to test that last argument's predicate.
So e.g. on the testcase from comment 47 in the PR:
void
foo (int *f, int d, int e)
{
  for (int i = 0; i < 1024; i++)
    {
      int a = f[i];
      int t;
      if (a < 0)
        t = 1;
      else if (a < e)
        t = 1 - a * d;
      else
        t = 0;
      f[i] = t;
    }
}
we used to emit:
  _7 = a_10 < 0;
  _21 = a_10 >= 0;
  _22 = a_10 < e_11(D);
  _23 = _21 & _22;
  _26 = a_10 >= e_11(D);
  _27 = _21 & _26;
  _ifc__42 = _7 ? 1 : t_13;
  _ifc__43 = _23 ? t_13 : _ifc__42;
  t_6 = _27 ? 0 : _ifc__43;
while the following patch changes it to:
  _7 = a_10 < 0;
  _21 = a_10 >= 0;
  _22 = a_10 < e_11(D);
  _23 = _21 & _22;
  _ifc__42 = _23 ? t_13 : 0;
  t_6 = _7 ? 1 : _ifc__42;
which I believe should be sufficient for a PHI <1, t_13, 0>.

I've gathered some statistics and on x86_64-linux and i686-linux
bootstraps/regtests, this code triggers:
     92 4 4
    112 2 4
    141 3 4
   4046 3 3
(where 2nd number is args_len and 3rd argument EDGE_COUNT (bb->preds)
and first argument count of those from sort | uniq -c | sort -n).
In all these cases the patch should squeze one extra COND_EXPR and
its associated predicate (the latter only if it wasn't used elsewhere).

Incrementally, I think we should try to perform some analysis on which
predicates depend on inverses of other predicates and if possible try
to sort the arguments better and omit testing unnecessary predicates.
So essentially for the above testcase deconstruct it back to:
  _7 = a_10 < 0;
  _22 = a_10 < e_11(D);
  _ifc__42 = _22 ? t_13 : 0;
  t_6 = _7 ? 1 : _ifc__42;
which is like what this patch produces, but with the & a_10 >= 0 part
removed, because the last predicate is a_10 < 0 and so testing a_10 >= 0
on what appears on the false branch doesn't make sense.
But I'm afraid that will take more work than is doable in stage4 right now.

2023-04-15  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/109154
* tree-if-conv.cc (predicate_scalar_phi): For complex PHIs, emit just
args_len - 1 COND_EXPRs rather than args_len.  Formatting fix.

13 months agors6000: don't expect __ibm128 with 64-bit long double [PR99708]
Alexandre Oliva [Sat, 15 Apr 2023 02:53:36 +0000 (23:53 -0300)] 
rs6000: don't expect __ibm128 with 64-bit long double [PR99708]

When long double is 64-bit wide, as on vxworks, the rs6000 backend
defines neither the __ibm128 type nor the __SIZEOF_IBM128__ macro, but
pr99708.c expected both to be always defined.  Adjust the test to
match the implementation.

Co-Authored-By: Kewen Lin <linkw@linux.ibm.com>
for  gcc/testsuite/ChangeLog

PR target/99708
* gcc.target/powerpc/pr99708.c: Accept lack of
__SIZEOF_IBM128__ when long double is 64-bit wide.

13 months ago-Wdangling-pointer: fix MEM_REF handling [PR109514]
Jason Merrill [Fri, 14 Apr 2023 17:37:16 +0000 (13:37 -0400)] 
-Wdangling-pointer: fix MEM_REF handling [PR109514]

Here we hit the MEM_REF case, with its arg an ADDR_EXPR, but had no handling
for that and wrongly assumed it would be a reference to a local variable.
This patch overhauls the logic for deciding whether the target is something
to warn about so that we only warn if we specifically recognize the target
as non-local.  None of the existing tests regress as a result.

PR c++/109514

gcc/ChangeLog:

* gimple-ssa-warn-access.cc (pass_waccess::check_dangling_stores):
Overhaul lhs_ref.ref analysis.

gcc/testsuite/ChangeLog:

* g++.dg/warn/Wdangling-pointer-6.C: New test.

13 months agoDaily bump.
GCC Administrator [Sat, 15 Apr 2023 00:16:36 +0000 (00:16 +0000)] 
Daily bump.

13 months agoFortran: fix compile-time simplification of SET_EXPONENT [PR109511]
Harald Anlauf [Fri, 14 Apr 2023 18:45:19 +0000 (20:45 +0200)] 
Fortran: fix compile-time simplification of SET_EXPONENT [PR109511]

gcc/fortran/ChangeLog:

PR fortran/109511
* simplify.cc (gfc_simplify_set_exponent): Fix implementation of
compile-time simplification of intrinsic SET_EXPONENT for argument
X < 1 and for I < 0.

gcc/testsuite/ChangeLog:

PR fortran/109511
* gfortran.dg/set_exponent_1.f90: New test.

13 months agoFix build failure of Ada runtime for Aarch64 targets
Eric Botcazou [Fri, 14 Apr 2023 18:14:07 +0000 (20:14 +0200)] 
Fix build failure of Ada runtime for Aarch64 targets

The Aarch64 back-end now asserts that the main variant of scalar types
has TYPE_USER_ALIGN cleared, and that's not the case for scalar types
declared with a confirming alignment clause in Ada.

gcc/ada/
PR bootstrap/109510
* gcc-interface/decl.cc (gnat_to_gnu_entity) <types>: Reset align
to zero if its value is equal to TYPE_ALIGN and the type is scalar.
Set TYPE_USER_ALIGN on the type only if align is positive.

13 months agolibstdc++: Implement P2278R4 "cbegin should always return a constant iterator"
Patrick Palka [Fri, 14 Apr 2023 14:32:12 +0000 (10:32 -0400)] 
libstdc++: Implement P2278R4 "cbegin should always return a constant iterator"

This also implements the approved follow-up LWG issues 3765, 3766, 3769,
3770, 3811, 3850, 3853, 3862 and 3872.

libstdc++-v3/ChangeLog:

* include/bits/ranges_base.h (const_iterator_t): Define for C++23.
(const_sentinel_t): Likewise.
(range_const_reference_t): Likewise.
(constant_range): Likewise.
(__cust_access::__possibly_const_range): Likewise, replacing ...
(__cust_access::__as_const): ... this.
(__cust_access::_CBegin::operator()): Redefine for C++23 as per P2278R4.
(__cust_access::_CEnd::operator()): Likewise.
(__cust_access::_CRBegin::operator()): Likewise.
(__cust_access::_CREnd::operator()): Likewise.
(__cust_access::_CData::operator()): Likewise.
* include/bits/ranges_util.h (ranges::__detail::__different_from):
Make it an alias of std::__detail::__different_from.
(view_interface::cbegin): Define for C++23.
(view_interface::cend): Likewise.
* include/bits/stl_iterator.h (__detail::__different_from): Define.
(iter_const_reference_t): Define for C++23.
(__detail::__constant_iterator): Likewise.
(__detail::__is_const_iterator): Likewise.
(__detail::__not_a_const_iterator): Likewise.
(__detail::__iter_const_rvalue_reference_t): Likewise.
(__detail::__basic_const_iter_cat):: Likewise.
(const_iterator): Likewise.
(__detail::__const_sentinel): Likewise.
(const_sentinel): Likewise.
(basic_const_iterator): Likewise.
(common_type<basic_const_iterator<_Tp>, _Up>): Likewise.
(common_type<_Up, basic_const_iterator<_Tp>>): Likewise.
(common_type<basic_const_iterator<_Tp>, basic_const_iterator<Up>>):
Likewise.
(make_const_iterator): Define for C++23.
(make_const_sentinel): Likewise.
* include/std/ranges (__cpp_lib_ranges_as_const): Likewise.
(as_const_view): Likewise.
(enable_borrowed_range<as_const_view>): Likewise.
(views::__detail::__is_ref_view): Likewise.
(views::__detail::__can_is_const_view): Likewise.
(views::_AsConst, views::as_const): Likewise.
* include/std/span (span::const_iterator): Likewise.
(span::const_reverse_iterator): Likewise.
(span::cbegin): Likewise.
(span::cend): Likewise.
(span::crbegin): Likewise.
(span::crend): Likewise.
* include/std/version (__cpp_lib_ranges_as_const): Likewise.
* testsuite/std/ranges/adaptors/join.cc (test06): Adjust to
behave independently of C++20 vs C++23.
* testsuite/std/ranges/version_c++23.cc: Verify value of
__cpp_lib_ranges_as_const macro.
* testsuite/24_iterators/const_iterator/1.cc: New test.
* testsuite/std/ranges/adaptors/as_const/1.cc: New test.

13 months agolibstdc++: Move down definitions of ranges::cbegin/cend/cetc
Patrick Palka [Fri, 14 Apr 2023 14:31:54 +0000 (10:31 -0400)] 
libstdc++: Move down definitions of ranges::cbegin/cend/cetc

This moves down the definitions of the range const-access CPOs to after
the definition of input_range in preparation for implementing P2278R4
which redefines these CPOs in a way that indirectly uses input_range.

libstdc++-v3/ChangeLog:

* include/bits/ranges_base.h (__cust_access::__as_const)
(__cust_access::_CBegin, __cust::cbegin)
(__cust_access::_CEnd, __cust::cend)
(__cust_access::_CRBegin, __cust::crbegin)
(__cust_access::_CREnd, __cust::crend)
(__cust_access::_CData, __cust::cdata): Move down definitions to
shortly after the definition of input_range.

13 months agolibstdc++: Implement ranges::fold_* from P2322R6
Patrick Palka [Fri, 14 Apr 2023 14:31:44 +0000 (10:31 -0400)] 
libstdc++: Implement ranges::fold_* from P2322R6

libstdc++-v3/ChangeLog:

* include/bits/ranges_algo.h: Include <optional> for C++23.
(__cpp_lib_fold): Define for C++23.
(in_value_result): Likewise.
(__detail::__flipped): Likewise.
(__detail::__indirectly_binary_left_foldable_impl): Likewise.
(__detail::__indirectly_binary_left_foldable): Likewise.
(___detail:__indirectly_binary_right_foldable): Likewise.
(fold_left_with_iter_result): Likewise.
(__fold_left_with_iter_fn, fold_left_with_iter): Likewise.
(__fold_left_fn, fold_left): Likewise.
(__fold_left_first_with_iter_fn, fold_left_first_with_iter):
Likewise.
(__fold_left_first_fn, fold_left_first): Likewise.
(__fold_right_fn, fold_right): Likewise.
(__fold_right_last_fn, fold_right_last): Likewise.
* include/std/version (__cpp_lib_fold): Likewise.
* testsuite/25_algorithms/fold_left/1.cc: New test.
* testsuite/25_algorithms/fold_right/1.cc: New test.

13 months agovect-simd-clone testcase adjustments
Richard Biener [Fri, 14 Apr 2023 11:31:04 +0000 (13:31 +0200)] 
vect-simd-clone testcase adjustments

The following reverts the s/avx_runtime/avx/ changes I've done,
they were wrong.

* gcc.dg/vect/vect-simd-clone-16e.c: Revert back to
checking avx_runtime in dump scanning.
* gcc.dg/vect/vect-simd-clone-17e.c: Likewise.
* gcc.dg/vect/vect-simd-clone-18e.c: Likewise.

13 months agolibstdc++: Improve diagnostics for invalid std::format calls
Jonathan Wakely [Thu, 13 Apr 2023 15:34:51 +0000 (16:34 +0100)] 
libstdc++: Improve diagnostics for invalid std::format calls

Add a static_assert and a comment so that calling std::format for
unformattable argument types will now show:

/home/jwakely/gcc/13/include/c++/13.0.1/format:3563:22: error: static assertion failed: std::formatter must be specialized for each format arg
 3563 |       static_assert((is_default_constructible_v<formatter<_Args, _CharT>> && ...),
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

and:

  140 |       formatter() = delete; // No std::formatter specialization for this type.

libstdc++-v3/ChangeLog:

* include/std/format (formatter): Add comment to deleted default
constructor of primary template.
(_Checking_scanner): Add static_assert.

13 months agoFortran: Fix an excess finalization during allocation [PR104272]
Paul Thomas [Fri, 14 Apr 2023 10:14:00 +0000 (11:14 +0100)] 
Fortran: Fix an excess finalization during allocation [PR104272]

2023-04-14  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/104272
* gfortran.h : Add expr3_not_explicit bit field to gfc_code.
* resolve.cc (resolve_allocate_expr): Set bit field when the
default initializer is applied to expr3.
* trans-stmt.cc (gfc_trans_allocate): If expr3_not_explicit is
set, do not deallocate expr3.

gcc/testsuite/
PR fortran/104272
* gfortran.dg/class_result_8.f90 : Number of builtin_frees down
from 6 to 5 without memory leaks.
* gfortran.dg/finalize_52.f90: New test

13 months agotree-optimization/109502 - vector conversion between mask and non-mask
Richard Biener [Fri, 14 Apr 2023 07:55:27 +0000 (09:55 +0200)] 
tree-optimization/109502 - vector conversion between mask and non-mask

The following fixes a check that should have rejected vectorizing
a conversion between a mask and non-mask type.  Those should be
done via pattern statements.

PR tree-optimization/109502
* tree-vect-stmts.cc (vectorizable_assignment): Fix
check for conversion between mask and non-mask types.

* gcc.dg/vect/pr109502.c: New testcase.

13 months agoFix vect-simd-clone testcase dump scanning
Richard Biener [Fri, 14 Apr 2023 09:35:58 +0000 (11:35 +0200)] 
Fix vect-simd-clone testcase dump scanning

This replaces i686*-*-* && { ! lp64 } with the appropriate
{ i?86-*-* x86_64-*-* } && { ! lp64 } for the testcases and
also amends the e variants checking last variant for avx.
I've used avx in the dump scanning, not avx_runtime, since
the dumps get produced when one would not execute but only
compile them.  The f varaints lack AVX checking, I didn't
rectify this with this patch.

* gcc.dg/vect/vect-simd-clone-16e.c: Fix x86 lp64 checking
and add missing avx guard.
* gcc.dg/vect/vect-simd-clone-17e.c: Likewise.
* gcc.dg/vect/vect-simd-clone-18e.c: Likewise.
* gcc.dg/vect/vect-simd-clone-16f.c: Fix x86 lp64 checking.
* gcc.dg/vect/vect-simd-clone-17f.c: Likewise.
* gcc.dg/vect/vect-simd-clone-18f.c: Likewise.

13 months agocombine: Fix AND handling for WORD_REGISTER_OPERATIONS targets [PR109040]
Jakub Jelinek [Fri, 14 Apr 2023 07:20:49 +0000 (09:20 +0200)] 
combine: Fix AND handling for WORD_REGISTER_OPERATIONS targets [PR109040]

The following testcase is miscompiled on riscv since the addition
of *mvconst_internal define_insn_and_split.
We have:
(insn 36 35 39 2 (set (mem/c:SI (plus:SI (reg/f:SI 65 frame)
                (const_int -64 [0xffffffffffffffc0])) [2  S4 A128])
        (reg:SI 166)) "pr109040.c":9:11 178 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 166)
        (nil)))
(insn 39 36 40 2 (set (reg:SI 171)
        (zero_extend:SI (mem/c:HI (plus:SI (reg/f:SI 65 frame)
                    (const_int -64 [0xffffffffffffffc0])) [0  S2 A128]))) "pr109040.c":9:11 111 {*zero_extendhisi2}
     (nil))
and RTL DSE's replace_read since r0-86337-g18b526e806ab6455 handles
even different modes like in the above case, and so it optimizes it into:
(insn 47 35 39 2 (set (reg:HI 175)
        (subreg:HI (reg:SI 166) 0)) "pr109040.c":9:11 179 {*movhi_internal}
     (expr_list:REG_DEAD (reg:SI 166)
        (nil)))
(insn 39 47 40 2 (set (reg:SI 171)
        (zero_extend:SI (reg:HI 175))) "pr109040.c":9:11 111 {*zero_extendhisi2}
     (expr_list:REG_DEAD (reg:HI 175)
        (nil)))
Pseudo 166 is result of AND with 0x8084c constant (forced into a register).
Combine attempts to combine the AND with the insn 47 above created by DSE,
and turns it because of WORD_REGISTER_OPERATIONS and its assumption that all
the subword operations are actually done on word mode into:
(set (subreg:SI (reg:HI 175) 0)
    (and:SI (reg:SI 167 [ m ])
        (reg:SI 168)))
and later on the ZERO_EXTEND is thrown away.

We then see
(and:SI (subreg:SI (reg:HI 175) 0) (const_int 0x84c))
and optimize that into
(subreg:SI (and:HI (reg:HI 175) (const_int 0x84c)) 0)
which is still fine, in WORD_REGISTER_OPERATIONS the AND in HImode
will set all upper bits up to BITS_PER_WORD to zeros.

But later on simplify_binary_operation_1 or simplify_and_const_int_1
sees that because nonzero_bits ((reg:HI 175), HImode) == 0x84c, we can
optimize the AND into (reg:HI 175).  That isn't correct, because while
the low 16 bits of that REG are known to have all bits but 0x84c cleared,
we don't know that all the upper 16 bits are all clear as well.
So, for WORD_REGISTER_OPERATIONS for integral modes smaller than word mode,
we need to check all bits from word_mode in nonzero_bits for the optimizations.

2023-04-14  Jeff Law  <jlaw@ventanamicro.com>
    Jakub Jelinek  <jakub@redhat.com>

PR target/108947
PR target/109040
* combine.cc (simplify_and_const_int_1): Compute nonzero_bits in
word_mode rather than mode if WORD_REGISTER_OPERATIONS and mode is
smaller than word_mode.
* simplify-rtx.cc (simplify_context::simplify_binary_operation_1)
<case AND>: Likewise.

* gcc.dg/pr108947.c: New test.
* gcc.c-torture/execute/pr109040.c: New test.

13 months agoloop-iv: Fix up bounds computation
Jakub Jelinek [Fri, 14 Apr 2023 07:19:25 +0000 (09:19 +0200)] 
loop-iv: Fix up bounds computation

On Thu, Apr 13, 2023 at 06:35:07AM -0600, Jeff Law wrote:
> Bootstrap was successful with v3, but there's hundreds of testsuite failures
> due to the simplify-rtx hunk.  compile/20070520-1.c for example when
> compiled with:  -O3 -funroll-loops -march=rv64gc -mabi=lp64d
>
> Thursdays are my hell day.  It's unlikely I'd be able to look at this at all
> today.

So, seems to me this is because loop-iv.cc asks for invalid RTL to be
simplified, it calls simplify_gen_binary (AND, SImode,
(subreg:SI (plus:DI (reg:DI 289 [ ivtmp_312 ])
        (const_int 4294967295 [0xffffffff])) 0),
(const_int 4294967295 [0xffffffff]))
but 0xffffffff is not valid SImode CONST_INT, and unlike previously
we no longer on WORD_REGISTER_OPERATIONS targets which have DImode
word_mode optimize that into the op0, so the invalid constant is emitted
into the IL and checking fails.

The following patch fixes that (and we optimize that & -1 away even earlier
with that).

2023-04-14  Jakub Jelinek  <jakub@redhat.com>

* loop-iv.cc (iv_number_of_iterations): Use gen_int_mode instead
of GEN_INT.

13 months agotestsuite: filter out warning noise for CWE-1341 test
Jiufu Guo [Wed, 12 Apr 2023 02:12:58 +0000 (10:12 +0800)] 
testsuite: filter out warning noise for CWE-1341 test

The case file-CWE-1341-example.c checkes [CWE-1341](`double-fclose`).
While on some systems, besides [CWE-1341], a message of [CWE-415] is
also reported. On those systems, attribute `malloc` may be attached on
fopen:
```
# 258 "/usr/include/stdio.h" 3 4
extern FILE *fopen (const char *__restrict __filename,
      const char *__restrict __modes)
  __attribute__ ((__malloc__)) __attribute__ ((__malloc__ (fclose, 1))) ;

or say: __attribute_malloc__ __attr_dealloc_fclose __wur;
```

See (PR analyzer/108722) for future fix in the analyzer.
This workaround patch adds -Wno-analyzer-double-free to this case.

gcc/testsuite/ChangeLog:

PR analyzer/108722
* gcc.dg/analyzer/file-CWE-1341-example.c: Update.

13 months agoDaily bump.
GCC Administrator [Fri, 14 Apr 2023 00:16:48 +0000 (00:16 +0000)] 
Daily bump.

13 months agoFortran: call of overloaded ‘abs(long long int&)’ is ambiguous [PR109492]
Harald Anlauf [Thu, 13 Apr 2023 20:42:23 +0000 (22:42 +0200)] 
Fortran: call of overloaded â€˜abs(long long int&)’ is ambiguous [PR109492]

gcc/fortran/ChangeLog:

PR fortran/109492
* trans-expr.cc (gfc_conv_power_op): Use absu_hwi and
unsigned HOST_WIDE_INT for portability.

13 months agoc++: 'typename T::X' vs 'struct T::X' lookup [PR109420]
Patrick Palka [Thu, 13 Apr 2023 20:02:21 +0000 (16:02 -0400)] 
c++: 'typename T::X' vs 'struct T::X' lookup [PR109420]

r13-6098-g46711ff8e60d64 made make_typename_type no longer ignore
non-types during the lookup, unless the TYPENAME_TYPE in question was
followed by the :: scope resolution operator.  But there is another
exception to this rule: we need to ignore non-types during the lookup
also if the TYPENAME_TYPE was named with a tag other than 'typename',
such as 'struct' or 'enum', since in that case we're dealing with an
elaborated-type-specifier and so [basic.lookup.elab] applies.  This
patch implements this additional exception.

PR c++/109420

gcc/cp/ChangeLog:

* decl.cc (make_typename_type): Also ignore non-types during the
lookup if tag_type corresponds to an elaborated-type-specifier.
* pt.cc (tsubst) <case TYPENAME_TYPE>: Pass class_type or
enum_type as tag_type to make_typename_type accordingly instead
of always passing typename_type.

gcc/testsuite/ChangeLog:

* g++.dg/template/typename27.C: New test.

13 months agoc++: make trait of incomplete type a permerror [PR109277]
Jason Merrill [Tue, 4 Apr 2023 03:20:13 +0000 (23:20 -0400)] 
c++: make trait of incomplete type a permerror [PR109277]

An incomplete type argument to several traits is specified to be undefined
behavior in the library; since it's a compile-time property, we diagnose
it.  But apparently some code was relying on the previous behavior of not
diagnosing.  So let's make it a permerror.

The assert in cxx_incomplete_type_diagnostic didn't like that, and I don't
see the point of having the assert, so let's just remove it.

PR c++/109277

gcc/cp/ChangeLog:

* semantics.cc (check_trait_type): Handle incomplete type directly.
* typeck2.cc (cxx_incomplete_type_diagnostic): Remove assert.

gcc/testsuite/ChangeLog:

* g++.dg/ext/is_convertible5.C: New test.

13 months agoc++: make cxx_incomplete_type_diagnostic return bool
Jason Merrill [Thu, 13 Apr 2023 06:11:22 +0000 (02:11 -0400)] 
c++: make cxx_incomplete_type_diagnostic return bool

Like other diagnostic functions that might be silenced by options, it should
return whether or not it actually emitted a diagnostic.

gcc/cp/ChangeLog:

* typeck2.cc (cxx_incomplete_type_diagnostic): Return bool.
* cp-tree.h (cxx_incomplete_type_diagnostic): Adjust.

13 months agoEnsure PHI equivalencies do not dominate the argument edge.
Andrew MacLeod [Wed, 12 Apr 2023 17:10:55 +0000 (13:10 -0400)] 
Ensure PHI equivalencies do not dominate the argument edge.

When we create an equivalency between a PHI definition and an argument,
ensure the definition does not dominate the incoming argument edge.

PR tree-optimization/108139
PR tree-optimization/109462
* gimple-range-cache.cc (ranger_cache::fill_block_cache): Remove
equivalency check for PHI nodes.
* gimple-range-fold.cc (fold_using_range::range_of_phi): Ensure def
does not dominate single-arg equivalency edges.

13 months agoPR modula2/109488 Typo in lang.opt: libraries maybe
Gaius Mulley [Thu, 13 Apr 2023 17:43:44 +0000 (18:43 +0100)] 
PR modula2/109488 Typo in lang.opt: libraries maybe

Correct spelling of "maybe" to "may be" in the modula-2 language
options.

gcc/m2/ChangeLog:

PR modula2/109488
* lang.opt: Fix typo "maybe" to "may be".

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
13 months agoPR modula2/109496 Fix constant char parameter passing to an array of char
Gaius Mulley [Thu, 13 Apr 2023 16:02:48 +0000 (17:02 +0100)] 
PR modula2/109496 Fix constant char parameter passing to an array of char

This patch fixes PR modula2/109496 and PR modula2/109497.  The fix for
PR modula2/109496 promotes a char constant to a string.  The PR
modula2/109497 allows for constant chars to be added to form a string.
The fixes for both PR's occur in M2GenGCC.mod and M2GCCDeclare.mod
after the resolving of constant declarations.

gcc/m2/ChangeLog:

* gm2-compiler/M2ALU.def (PopChar): New procedure function.
* gm2-compiler/M2ALU.mod (PopChar): New procedure function.
* gm2-compiler/M2GCCDeclare.mod (PromoteToString): Detect
a single constant char and build a C string.
* gm2-compiler/M2GenGCC.mod (IsConstStr): New procedure
function.
(GetStr): New procedure function.
(FoldAdd): Use IsConstStr.
* gm2-compiler/M2Quads.mod: Formatting changes.
* gm2-gcc/m2expr.cc (m2expr_GetCstInteger): New function.
* gm2-gcc/m2expr.def (GetCstInteger): New procedure function.
* gm2-gcc/m2expr.h (m2expr_GetCstInteger): New prototype.

gcc/testsuite/ChangeLog:

PR modula2/109497
* gm2/pim/run/pass/addcharconst.mod: New test.
PR modula2/109496
* gm2/pim/run/pass/singlechar.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
13 months agoaarch64: Don't trust TYPE_ALIGN for pointers [PR108910]
Richard Sandiford [Thu, 13 Apr 2023 15:57:57 +0000 (16:57 +0100)] 
aarch64: Don't trust TYPE_ALIGN for pointers [PR108910]

The aarch64 PCS rules ignore user alignment for scalars and
vectors and use the "natural" alignment of the type.  GCC tried
to calculate that natural alignment using:

  TYPE_ALIGN (TYPE_MAIN_VARIANT (type))

But as discussed in the PR, it's possible that the main variant
of a pointer type is an overaligned type (although that's usually
accidental).

This isn't known to be a problem for other types, so this patch
changes the bare minimum.  It might be that we need to ignore
TYPE_ALIGN in other cases too.

gcc/
PR target/108910
* config/aarch64/aarch64.cc (aarch64_function_arg_alignment): Do
not trust TYPE_ALIGN for pointer types; use POINTER_SIZE instead.

gcc/testsuite/
PR target/108910
* gcc.dg/torture/pr108910.c: New test.

13 months agotree-optimization/109491 - ICE in expressions_equal_p
Richard Biener [Thu, 13 Apr 2023 12:09:30 +0000 (14:09 +0200)] 
tree-optimization/109491 - ICE in expressions_equal_p

At some point I elided the NULL pointer check in expressions_equal_p
because it shouldn't be necessary not realizing that for example
TARGET_MEM_REF has optional operands we cannot substitute with
something non-NULL with the same semantics.  The following does the
simple thing and restore the check removed in r11-4982.

PR tree-optimization/109491
* tree-ssa-sccvn.cc (expressions_equal_p): Restore the
NULL operands test.

13 months agoDaily bump.
GCC Administrator [Thu, 13 Apr 2023 00:16:48 +0000 (00:16 +0000)] 
Daily bump.

13 months agolibstdc++: Document libstdc++exp.a library for -fcontracts
Jonathan Wakely [Wed, 12 Apr 2023 22:23:47 +0000 (23:23 +0100)] 
libstdc++: Document libstdc++exp.a library for -fcontracts

libstdc++-v3/ChangeLog:

* doc/xml/manual/using.xml: Document libstdc++exp.a library.
* doc/html/*: Regenerate.

13 months agolibstdc++: Fix some AIX test failures
Jonathan Wakely [Wed, 12 Apr 2023 21:14:05 +0000 (22:14 +0100)] 
libstdc++: Fix some AIX test failures

AIX <sys/thread.h> defines struct tstate with non-reserved names, so
adjust the 17_intro/names.cc test. It also defines struct user, which
conflicts with namespace user in some tests.

Replacing the global operator new doesn't work on AIX the same way as it
does for ELF, so skip some tests that depend on replacing it.

Add missing DG directives to synchronized_value test so it doesn't run
for the single-threaded AIX multilib.

libstdc++-v3/ChangeLog:

* testsuite/17_intro/names.cc [_AIX]: Do not define policy.
* testsuite/19_diagnostics/error_code/cons/lwg3629.cc: Rename
namespace to avoid clashing with libc struct.
* testsuite/19_diagnostics/error_condition/cons/lwg3629.cc:
Likewise.
* testsuite/23_containers/unordered_map/96088.cc: Skip on AIX.
* testsuite/23_containers/unordered_multimap/96088.cc: Likewise.
* testsuite/23_containers/unordered_multiset/96088.cc: Likewise.
* testsuite/23_containers/unordered_set/96088.cc: Likewise.
* testsuite/experimental/synchronized_value.cc: Require gthreads
and add missing option for pthreads targets.

13 months agoUpdate gcc de.po
Joseph Myers [Wed, 12 Apr 2023 21:07:51 +0000 (21:07 +0000)] 
Update gcc de.po

* de.po: Update.

13 months agolibstdc++: Implement ranges::enumerate_view from P2164R9
Patrick Palka [Wed, 12 Apr 2023 17:24:37 +0000 (13:24 -0400)] 
libstdc++: Implement ranges::enumerate_view from P2164R9

libstdc++-v3/ChangeLog:

* include/std/ranges (__cpp_lib_ranges_enumerate): Define
for C++23.
(__detail::__range_with_movable_reference): Likewise.
(enumerate_view): Likewise.
(enumerate_view::_Iterator): Likewise.
(enumerate_view::_Sentinel): Likewise.
(views::__detail::__can_enumerate_view): Likewise.
(views::_Enumerate, views::enumerate): Likewise.
* include/std/version (__cpp_lib_ranges_enumerate): Likewise.
* testsuite/std/ranges/version_c++23.cc: Verify value of
__cpp_lib_ranges_enumerate.
* testsuite/std/ranges/adaptors/enumerate/1.cc: New test.

13 months agolibstdc++: Implement LWG 3904 change to lazy_split_view's iterator
Patrick Palka [Wed, 12 Apr 2023 17:04:36 +0000 (13:04 -0400)] 
libstdc++: Implement LWG 3904 change to lazy_split_view's iterator

libstdc++-v3/ChangeLog:

* include/std/ranges (lazy_split_view::_OuterIter::_OuterIter):
Propagate _M_trailing_empty in the const-converting constructor
as per LWG 3904.
* testsuite/std/ranges/adaptors/adjacent/1.cc (test04): Correct
assertion.
* testsuite/std/ranges/adaptors/lazy_split.cc (test12): New test.

13 months agolibstdc++: Ensure headers used by fast_float are included
Patrick Palka [Wed, 12 Apr 2023 16:40:41 +0000 (12:40 -0400)] 
libstdc++: Ensure headers used by fast_float are included

This makes floating_from_chars.cc explicitly include all headers
that are used by the original fast_float amalgamation according to
r12-6647-gf5c8b82512f9d3, except:

  1. <cctype> since fast_float doesn't seem to use anything from it
  2. <cinttypes> since fast_float doesn't seem to use anything directly
     from it (this header also pulls in <cstdint>)
  3. <system_error> since std::errc is naturally already available
     from <charconv>

This avoids potential fast_float build failures on platforms for which
some required headers (in particular <cstdint>) end up not getting
transitively included from elsewhere.

libstdc++-v3/ChangeLog:

* src/c++17/floating_from_chars.cc: Include <algorithm>,
<iterator>, <limits> and <cstdint>.

13 months agoUpdate gcc .po files
Joseph Myers [Wed, 12 Apr 2023 16:18:32 +0000 (16:18 +0000)] 
Update gcc .po files

* be.po, da.po, de.po, el.po, es.po, fi.po, fr.po, hr.po, id.po,
ja.po, nl.po, ru.po, sr.po, sv.po, tr.po, uk.po, vi.po, zh_CN.po,
zh_TW.po: Update.

13 months agolibstdc++: Fix chunk_by_view when value_type& and reference differ [PR108291]
Patrick Palka [Wed, 12 Apr 2023 16:10:23 +0000 (12:10 -0400)] 
libstdc++: Fix chunk_by_view when value_type& and reference differ [PR108291]

PR libstdc++/108291

libstdc++-v3/ChangeLog:

* include/std/ranges (chunk_by_view::_M_find_next): Generalize
parameter types of the lambda wrapper passed to adjacent_find.
(chunk_by_view::_M_find_prev): Likewise.
* testsuite/std/ranges/adaptors/chunk_by/1.cc (test04, test05):
New tests.

13 months agoRISC-V: Fix supporting data type according to RVV ISA. [PR109479]
Ju-Zhe Zhong [Wed, 12 Apr 2023 13:56:05 +0000 (21:56 +0800)] 
RISC-V: Fix supporting data type according to RVV ISA. [PR109479]

For vint64m*_t, we should only allow them in zve64* instead of zve32*_zvl64b (>=64b).
Ideally, we should make error message more friendly like Clang.
https://godbolt.org/z/f9GMv4dMo to report the RVV type require extenstion name.
However, I failed to find a way to do that. So current GCC can only report "unknown" type.
And I added comments to remind us doing this in the future.

gcc/ChangeLog:

PR target/109479
* config/riscv/riscv-vector-builtins-types.def (vint8mf8_t): Fix predicate.
(vint16mf4_t): Ditto.
(vint32mf2_t): Ditto.
(vint64m1_t): Ditto.
(vint64m2_t): Ditto.
(vint64m4_t): Ditto.
(vint64m8_t): Ditto.
(vuint8mf8_t): Ditto.
(vuint16mf4_t): Ditto.
(vuint32mf2_t): Ditto.
(vuint64m1_t): Ditto.
(vuint64m2_t): Ditto.
(vuint64m4_t): Ditto.
(vuint64m8_t): Ditto.
(vfloat32mf2_t): Ditto.
(vbool64_t): Ditto.
* config/riscv/riscv-vector-builtins.cc (register_builtin_type): Add comments.
(register_vector_type): Ditto.
(check_required_extensions): Fix condition.
* config/riscv/riscv-vector-builtins.h (RVV_REQUIRE_ZVE64): Remove it.
(RVV_REQUIRE_ELEN_64): New define.
(RVV_REQUIRE_MIN_VLEN_64): Ditto.
* config/riscv/riscv-vector-switch.def (TARGET_VECTOR_FP32): Remove it.
(TARGET_VECTOR_FP64): Ditto.
(ENTRY): Fix predicate.
* config/riscv/vector-iterators.md: Fix predicate.

gcc/testsuite/ChangeLog:

PR target/109479
* gcc.target/riscv/rvv/base/pr109479-1.c: New test.
* gcc.target/riscv/rvv/base/pr109479-2.c: New test.
* gcc.target/riscv/rvv/base/pr109479-3.c: New test.
* gcc.target/riscv/rvv/base/pr109479-4.c: New test.
* gcc.target/riscv/rvv/base/pr109479-5.c: New test.
* gcc.target/riscv/rvv/base/pr109479-6.c: New test.

13 months agoreassoc: Fix up another ICE with returns_twice call [PR109410]
Jakub Jelinek [Wed, 12 Apr 2023 14:55:15 +0000 (16:55 +0200)] 
reassoc: Fix up another ICE with returns_twice call [PR109410]

The following testcase ICEs in reassoc, unlike the last case I've fixed
there here SSA_NAME_USED_IN_ABNORMAL_PHI is not the case anywhere.
build_and_add_sum places new statements after the later appearing definition
of an operand but if both operands are default defs or constants, we place
statement at the start of the function.

If the very first statement of a function is a call to returns_twice
function, this doesn't work though, because that call has to be the first
thing in its basic block, so the following patch splits the entry successor
edge such that the new statements are added into a different block from the
returns_twice call.

I think we should in stage1 reconsider such placements, I think it
unnecessarily enlarges the lifetime of the new lhs if its operand(s)
are used more than once in the function.  Unless something sinks those
again.  Would be nice to place it closer to the actual uses (or where
they will be placed).

2023-04-12  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/109410
* tree-ssa-reassoc.cc (build_and_add_sum): Split edge from entry
block if first statement of the function is a call to returns_twice
function.

* gcc.dg/pr109410.c: New test.

13 months agoi386: Fix up z operand modifier diagnostics on inline-asm [PR109458]
Jakub Jelinek [Wed, 12 Apr 2023 14:53:23 +0000 (16:53 +0200)] 
i386: Fix up z operand modifier diagnostics on inline-asm [PR109458]

On the following testcase, we emit weird diagnostics.
User used the z modifier, but diagnostics talks about Z instead.
This is because z is implemented by doing some stuff and then falling
through into the Z case.

The following patch adjusts the Z diagnostics, such that it prints whatever
modifier user actually uses in places which could happen with either
modifier.

Furthermore, in case of the non-integer operand used with operand code %<z%>
warning the warning location was incorrect (and of function), so I've used
warning_for_asm to get it a proper location in case it is a user inline-asm.

2023-04-12  Jakub Jelinek  <jakub@redhat.com>

PR target/109458
* config/i386/i386.cc: Include rtl-error.h.
(ix86_print_operand): For z modifier warning, use warning_for_asm
if this_is_asm_operands.  For Z modifier errors, use %c and code
instead of hardcoded Z.

* gcc.target/i386/pr109458.c: New test.

13 months agomingw: Support building with older gcc versions
Costas Argyris [Wed, 12 Apr 2023 07:48:18 +0000 (08:48 +0100)] 
mingw: Support building with older gcc versions

The $@ argument to the compiler is causing
only a warning in some gcc versions but an
error in others. In any case, $@ was never
necessary so remove it completely, just like
the rules in x-mingw32 where the object file
gets named after the source file.

This fixes both warnings and errors about
sym-mingw32.o appearing in the command line
unnecessarily.

The -nostdlib flag is required along with -r
for older gcc versions that don't apply it
automatically with -r, resulting in main
functions erroneously entering a partial link.

Signed-off-by: Jonathan Yong <10walls@gmail.com>
gcc/ChangeLog:

* config/i386/x-mingw32-utf8: Remove extrataneous $@

13 months agoc++: Fix Solaris bootstraps across midnight
Jakub Jelinek [Wed, 12 Apr 2023 14:22:28 +0000 (16:22 +0200)] 
c++: Fix Solaris bootstraps across midnight

When working on the PR109040 fix, I wanted to test it on some
WORD_REGISTER_OPERATIONS target and tried sparc-solaris on GCC Farm.
My bootstrap failed in comparison failure on cp/module.o, because
Solaris date doesn't support the -r option and one stage's cp/module.o
was built before midnight and next stage's cp/module.o after midnight,
so they had different -DMODULE_VERSION= value.

Now, I think the advice (don't bootstrap at midnight) is something
we shouldn't have, so the following patch stores the module version
(still generated through the same way, date -r cp/module.cc
if it works, otherwise just date) into a temporary file, makes sure
that temporary file is updated when cp/module.cc source is updated
and when date -r doesn't work copies file from previous stage
if it is newer than cp/module.cc.

2023-04-12  Jakub Jelinek  <jakub@redhat.com>

* Make-lang.in (s-cp-module-version): New target.
(cp/module.o): Depend on it.
(MODULE_VERSION): Remove variable.
(CFLAGS-cp/module.o): For -DMODULE_VERSION= argument just
cat s-cp-module-version.

13 months agotestsuite: Add testcase for recently fixed PR [PR109462]
Jakub Jelinek [Wed, 12 Apr 2023 13:16:31 +0000 (15:16 +0200)] 
testsuite: Add testcase for recently fixed PR [PR109462]

This adds a runtime testcase for just fixed PR.

2023-04-12  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/109462
* g++.dg/opt/pr109462.C: New test.

13 months agoDon't use ANY PHI equivalences in range-on-entry.
Andrew MacLeod [Tue, 11 Apr 2023 21:29:03 +0000 (17:29 -0400)] 
Don't use ANY PHI equivalences in range-on-entry.

PR 108139 dissallows PHI equivalencies in the on-entry calculator, but
it was only checking if the equivlaence was a PHI.  In this case, NAME
itself is a PHI with an equivlaence caused by an undefined value, so we
also need to check that case.  Unfortunately this un-fixes 101912.

PR tree-optimization/109462
gcc/
* gimple-range-cache.cc (ranger_cache::fill_block_cache): Don't
check for equivalences if NAME is a phi node.

gcc/testsuite/
* gcc.dg/uninit-pr101912.c: XFAIL the warning.

13 months agolibstdc++: Initialize all members of basic_endpoint union [PR109482]
Jonathan Wakely [Wed, 12 Apr 2023 10:55:24 +0000 (11:55 +0100)] 
libstdc++: Initialize all members of basic_endpoint union [PR109482]

On Solaris the in_addr struct contains a union and value-initializing it
does not make the s_addr member active. This means we can't access that
member later during constant evaluation.

Make the constructors explicitly set every member that we might want to
read later in constexpr member functions. This means even the default
constructor can only be constexpr for C++20, because we can't change the
active member of a union in older standards.

libstdc++-v3/ChangeLog:

PR libstdc++/109482
* include/experimental/internet (basic_endpoint::basic_endpoint()):
Ensure that the required union members are active. Only define
as constexpr for C++20 and later.
(basic_endpoint::basic_endpoint(const protocol_type&, port_type)):
Likewise.
* testsuite/experimental/net/internet/endpoint/cons.cc: Only
check constexpr default constructor for C++20 and later.
* testsuite/experimental/net/internet/endpoint/extensible.cc:
Likewise.

13 months agolibstdc++: Update tzdata to 2023c
Jonathan Wakely [Mon, 27 Mar 2023 12:51:25 +0000 (13:51 +0100)] 
libstdc++: Update tzdata to 2023c

Import the new 2023c tzdata.zi file.

libstdc++-v3/ChangeLog:

* src/c++20/tzdata.zi: Import new file from 2023c release.

13 months agotree-optimization/109473 - ICE with reduction epilog adjustment op
Richard Biener [Wed, 12 Apr 2023 08:22:08 +0000 (10:22 +0200)] 
tree-optimization/109473 - ICE with reduction epilog adjustment op

The following makes sure to carry out the reduction epilog adjustment
in the original computation type which for pointers is an unsigned
integer type.  There's a similar issue with signed vs. unsigned ops
and overflow which is fixed by this as well.

PR tree-optimization/109473
* tree-vect-loop.cc (vect_create_epilog_for_reduction):
Convert scalar result to the computation type before performing
the reduction adjustment.

* gcc.dg/vect/pr109473.c: New testcase.

13 months agoFortran: fix functions with entry and pointer/allocatable result [PR104312]
Harald Anlauf [Tue, 11 Apr 2023 19:44:20 +0000 (21:44 +0200)] 
Fortran: fix functions with entry and pointer/allocatable result [PR104312]

gcc/fortran/ChangeLog:

PR fortran/104312
* resolve.cc (resolve_entries): Handle functions with ENTRY and
ALLOCATABLE results.
* trans-expr.cc (gfc_conv_procedure_call): Functions with a result
with the POINTER or ALLOCATABLE attribute shall not get any special
treatment with -ff2c, as they cannot be written in Fortran 77.
* trans-types.cc (gfc_return_by_reference): Likewise.
(gfc_get_function_type): Likewise.

gcc/testsuite/ChangeLog:

PR fortran/104312
* gfortran.dg/entry_26.f90: New test.
* gfortran.dg/entry_27.f90: New test.

13 months agoFortran: resolve correct generic with TYPE(C_PTR) arguments [PR61615,PR99982]
Harald Anlauf [Tue, 11 Apr 2023 14:44:32 +0000 (16:44 +0200)] 
Fortran: resolve correct generic with TYPE(C_PTR) arguments [PR61615,PR99982]

gcc/fortran/ChangeLog:

PR fortran/61615
PR fortran/99982
* interface.cc (compare_parameter): Enable type and rank checks for
arguments of derived type from the intrinsic module ISO_C_BINDING.

gcc/testsuite/ChangeLog:

PR fortran/61615
PR fortran/99982
* gfortran.dg/interface_49.f90: New test.

13 months agotree-optimization/109469 - SLP with returns-twice region start
Richard Biener [Tue, 11 Apr 2023 14:06:12 +0000 (16:06 +0200)] 
tree-optimization/109469 - SLP with returns-twice region start

The following avoids an SLP region starting with a returns-twice
call where we cannot insert stmts at the head.

PR tree-optimization/109469
* tree-vect-slp.cc (vect_slp_function): Skip region starts with
a returns-twice call.

* gcc.dg/torture/pr109469.c: New testcase.

13 months agotree-optimization/109434 - bogus DSE of throwing call LHS
Richard Biener [Tue, 11 Apr 2023 13:06:59 +0000 (15:06 +0200)] 
tree-optimization/109434 - bogus DSE of throwing call LHS

The byte tracking of call LHS didn't properly handle possibly
throwing calls correctly which cases bogus DSE and in turn, for the
testcase a bogus uninit diagnostic and (unreliable) wrong-code.

PR tree-optimization/109434
* tree-ssa-dse.cc (initialize_ao_ref_for_dse): Properly
handle possibly throwing calls when processing the LHS
and may-defs are not OK.

* g++.dg/opt/pr109434.C: New testcase.

13 months agotestsuite: Adjust powerpc pr83677.c for BE [PR108815]
Kewen Lin [Wed, 12 Apr 2023 02:51:40 +0000 (21:51 -0500)] 
testsuite: Adjust powerpc pr83677.c for BE [PR108815]

The test case gcc.target/powerpc/pr83677.c was written for
LE environment, this patch is to make it work on BE as well.

PR testsuite/108815

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/pr83677.c (v_expand_u8, v_expand_u16,
v_load_deinterleave_f32, v_store_interleave_f32): Adjust some code by
considering BE.

13 months agoUpdate gcc sv.po
Joseph Myers [Wed, 12 Apr 2023 00:21:00 +0000 (00:21 +0000)] 
Update gcc sv.po

* sv.po: Update.

13 months agoDaily bump.
GCC Administrator [Wed, 12 Apr 2023 00:16:46 +0000 (00:16 +0000)] 
Daily bump.

13 months agoRISC-V: avoid splitting small constant in <or_optab>i<mode>_extrabit pattern
Lin Sinan [Tue, 11 Apr 2023 16:23:19 +0000 (10:23 -0600)] 
RISC-V: avoid splitting small constant in <or_optab>i<mode>_extrabit pattern

there is no need to split an xori/ori with an small constant. take the test
case `int foo(int idx) { return idx|3; }` as an example,

rv64im_zba generates:
        ori     a0,a0,3
        ret
but, rv64im_zba_zbs generates:
        ori     a0,a0,1
        ori     a0,a0,2
        ret

with this change, insn `ori r2,r1,3` will not be splitted in zbs.

gcc/
* config/riscv/predicates.md (uimm_extra_bit_or_twobits): Adjust
predicate to avoid splitting arith constants.

gcc/testsuite

* gcc.target/riscv/zbs-extra-bit-or-twobits.c: New test.

13 months agoRISC-V: Fix regression of -fzero-call-used-regs=all [PR109104]
Yanzhang Wang [Tue, 11 Apr 2023 11:37:48 +0000 (19:37 +0800)] 
RISC-V: Fix regression of -fzero-call-used-regs=all [PR109104]

This patch registers a riscv specific function to
TARGET_ZERO_CALL_USED_REGS instead of default in targhooks.cc. It will
clean gpr and vector relevant registers.

gcc/ChangeLog:

PR target/109104
* config/riscv/riscv-protos.h (emit_hard_vlmax_vsetvl): New.
* config/riscv/riscv-v.cc (emit_hard_vlmax_vsetvl): New.
(emit_vlmax_vsetvl): Use emit_hard_vlmax_vsetvl.
* config/riscv/riscv.cc (vector_zero_call_used_regs): New.
(riscv_zero_call_used_regs): New.
(TARGET_ZERO_CALL_USED_REGS): New.

gcc/testsuite/ChangeLog:

PR target/109104
* gcc.target/riscv/zero-scratch-regs-1.c: New test.
* gcc.target/riscv/zero-scratch-regs-2.c: New test.
* gcc.target/riscv/zero-scratch-regs-3.c: New test.

Signed-off-by: Yanzhang Wang <yanzhang.wang@intel.com>
Co-authored-by: Pan Li <pan2.li@intel.com>
Co-authored-by: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
Co-authored-by: Kito Cheng <kito.cheng@sifive.com>
13 months agogfortran.dg/gomp/affinity-clause-1.f90: Fix scan-tree-dump
Tobias Burnus [Tue, 11 Apr 2023 11:15:39 +0000 (13:15 +0200)] 
gfortran.dg/gomp/affinity-clause-1.f90: Fix scan-tree-dump

Commit r13-7120-g46fe32cb4d887d44a62f9c4ff2a72532d4eb5a19 added the
missing hyphen to 'dg-final', which exposed an -m32 pattern mismatch.

gcc/testsuite/

* gfortran.dg/gomp/affinity-clause-1.f90: Update scan-tree pattern
for -m32.

13 months agodriver: drop flag_var_tracking_assignments flag
Martin Liska [Fri, 31 Mar 2023 12:28:15 +0000 (14:28 +0200)] 
driver: drop flag_var_tracking_assignments flag

The revision r13-259-g76db543db88727 moved a condition from one
file to another, but now we do not drop x_flag_var_tracking_assignments
as it was done before the mentioned revision.

PR driver/108241

gcc/ChangeLog:

* opts.cc (finish_options): Drop also
x_flag_var_tracking_assignments.

gcc/testsuite/ChangeLog:

* gcc.dg/pr108241.c: New test.
* gcc.dg/pr79570.c: Add also -g option.

13 months agoif-conv: Restore MASK_CALL conversion [PR108888]
Andre Vieira [Tue, 11 Apr 2023 09:07:43 +0000 (10:07 +0100)] 
if-conv: Restore MASK_CALL conversion [PR108888]

The original patch to fix this PR broke the if-conversion of calls into
IFN_MASK_CALL.  This patch restores that original behaviour and makes sure the
tests added earlier specifically test inbranch SIMD clones.

gcc/ChangeLog:

PR tree-optimization/108888
* tree-if-conv.cc (predicate_statements): Fix gimple call check.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/vect-simd-clone-16.c: Make simd clone inbranch only.
* gcc.dg/vect/vect-simd-clone-17.c: Likewise.
* gcc.dg/vect/vect-simd-clone-18.c: Likewise.

13 months agors6000: correct vector sign extend builtins on Big Endian
Haochen Gui [Tue, 11 Apr 2023 00:55:56 +0000 (08:55 +0800)] 
rs6000: correct vector sign extend builtins on Big Endian

gcc/
PR target/108812
* config/rs6000/vsx.md (vsx_sign_extend_qi_<mode>): Rename to...
(vsx_sign_extend_v16qi_<mode>): ... this.
(vsx_sign_extend_hi_<mode>): Rename to...
(vsx_sign_extend_v8hi_<mode>): ... this.
(vsx_sign_extend_si_v2di): Rename to...
(vsx_sign_extend_v4si_v2di): ... this.
(vsignextend_qi_<mode>): Remove.
(vsignextend_hi_<mode>): Remove.
(vsignextend_si_v2di): Remove.
(vsignextend_v2di_v1ti): Remove.
(*xxspltib_<mode>_split): Replace gen_vsx_sign_extend_qi_v2di with
gen_vsx_sign_extend_v16qi_v2di and gen_vsx_sign_extend_qi_v4si
with gen_vsx_sign_extend_v16qi_v4si.
* config/rs6000/rs6000.md (split for DI constant generation):
Replace gen_vsx_sign_extend_qi_si with gen_vsx_sign_extend_v16qi_si.
(split for HSDI constant generation): Replace gen_vsx_sign_extend_qi_di
with gen_vsx_sign_extend_v16qi_di and gen_vsx_sign_extend_qi_si
with gen_vsx_sign_extend_v16qi_si.
* config/rs6000/rs6000-builtins.def (__builtin_altivec_vsignextsb2d):
Set bif-pattern to vsx_sign_extend_v16qi_v2di.
(__builtin_altivec_vsignextsb2w): Set bif-pattern to
vsx_sign_extend_v16qi_v4si.
(__builtin_altivec_visgnextsh2d): Set bif-pattern to
vsx_sign_extend_v8hi_v2di.
(__builtin_altivec_vsignextsh2w): Set bif-pattern to
vsx_sign_extend_v8hi_v4si.
(__builtin_altivec_vsignextsw2d): Set bif-pattern to
vsx_sign_extend_si_v2di.
(__builtin_altivec_vsignext): Set bif-pattern to
vsx_sign_extend_v2di_v1ti.
* config/rs6000/rs6000-builtin.cc (lxvrse_expand_builtin): Replace
gen_vsx_sign_extend_qi_v2di with gen_vsx_sign_extend_v16qi_v2di,
gen_vsx_sign_extend_hi_v2di with gen_vsx_sign_extend_v8hi_v2di and
gen_vsx_sign_extend_si_v2di with gen_vsx_sign_extend_v4si_v2di.

gcc/testsuite/
PR target/108812
* gcc.target/powerpc/p9-sign_extend-runnable.c: Set corresponding
expected vectors for Big Endian.
* gcc.target/powerpc/int_128bit-runnable.c: Likewise.

13 months agoDaily bump.
GCC Administrator [Tue, 11 Apr 2023 00:16:33 +0000 (00:16 +0000)] 
Daily bump.

13 months agoDo not generate vmaddfp and vnmsubfp
Michael Meissner [Mon, 10 Apr 2023 03:32:27 +0000 (23:32 -0400)] 
Do not generate vmaddfp and vnmsubfp

This is version 3 of the patch.  This is essentially version 1 with the removal
of changes to altivec.md, and cleanup of the comments.

Version 2 generated the vmaddfp and vnmsubfp instructions if -Ofast was used,
and those changes are deleted in this patch.

The Altivec instructions vmaddfp and vnmsubfp have different rounding behaviors
than the VSX xvmaddsp and xvnmsubsp instructions due to VSCR[NJ] and other
corner cases.  In particular, generating these instructions seems to break
Eigen on big endian systems.

2023-04-09   Michael Meissner  <meissner@linux.ibm.com>

gcc/

PR target/70243
* config/rs6000/vsx.md (vsx_fmav4sf4): Do not generate vmaddfp.
(vsx_nfmsv4sf4): Do not generate vnmsubfp.

gcc/testsuite/

PR target/70243
* gcc.target/powerpc/pr70243.c: New test.

13 months agoi386: Add AMX-COMPLEX to Granite Rapids
Haochen Jiang [Fri, 31 Mar 2023 02:49:14 +0000 (10:49 +0800)] 
i386: Add AMX-COMPLEX to Granite Rapids

gcc/Changelog:

* config/i386/i386.h (PTA_GRANITERAPIDS): Add PTA_AMX_COMPLEX.

13 months agoSupport Intel AMX-COMPLEX
Haochen Jiang [Wed, 31 May 2023 02:45:00 +0000 (10:45 +0800)] 
Support Intel AMX-COMPLEX

gcc/ChangeLog:

* common/config/i386/cpuinfo.h (get_available_features):
Detect AMX-COMPLEX.
* common/config/i386/i386-common.cc
(OPTION_MASK_ISA2_AMX_COMPLEX_SET,
OPTION_MASK_ISA2_AMX_COMPLEX_UNSET): New.
(ix86_handle_option): Handle -mamx-complex.
* common/config/i386/i386-cpuinfo.h (enum processor_features):
Add FEATURE_AMX_COMPLEX.
* common/config/i386/i386-isas.h: Add ISA_NAME_TABLE_ENTRY for
amx-complex.
* config.gcc: Add amxcomplexintrin.h.
* config/i386/cpuid.h (bit_AMX_COMPLEX): New.
* config/i386/i386-c.cc (ix86_target_macros_internal): Define
__AMX_COMPLEX__.
* config/i386/i386-isa.def (AMX_COMPLEX): Add DEF_PTA(AMX_COMPLEX).
* config/i386/i386-options.cc (ix86_valid_target_attribute_inner_p):
Handle amx-complex.
* config/i386/i386.opt: Add option -mamx-complex.
* config/i386/immintrin.h: Include amxcomplexintrin.h.
* doc/extend.texi: Document amx-complex.
* doc/invoke.texi: Document -mamx-complex.
* doc/sourcebuild.texi: Document target amx-complex.
* config/i386/amxcomplexintrin.h: New file.

gcc/testsuite/ChangeLog:

* g++.dg/other/i386-2.C: Add -mamx-complex.
* g++.dg/other/i386-3.C: Ditto.
* gcc.target/i386/amx-check.h: Add cpu check for AMX-COMPLEX.
* gcc.target/i386/amx-helper.h: Add amx-complex support.
* gcc.target/i386/funcspec-56.inc: Add new target attribute.
* gcc.target/i386/sse-12.c: Add -mamx-complex.
* gcc.target/i386/sse-13.c: Ditto.
* gcc.target/i386/sse-14.c: Ditto.
* gcc.target/i386/sse-22.c: Add amx-complex.
* gcc.target/i386/sse-23.c: Ditto.
* lib/target-supports.exp (check_effective_target_amx_complex): New.
* gcc.target/i386/amxcomplex-asmatt-1.c: New test.
* gcc.target/i386/amxcomplex-asmintel-1.c: Ditto.
* gcc.target/i386/amxcomplex-cmmimfp16ps-2.c: Ditto.
* gcc.target/i386/amxcomplex-cmmrlfp16ps-2.c: Ditto.

13 months agoDaily bump.
GCC Administrator [Mon, 10 Apr 2023 00:16:39 +0000 (00:16 +0000)] 
Daily bump.

13 months agoc++, coroutines: Fix block nests when the function has no top-level bind.
Iain Sandoe [Sat, 1 Apr 2023 16:23:51 +0000 (21:53 +0530)] 
c++, coroutines: Fix block nests when the function has no top-level bind.

When the function contains no local vars and also no nested scopes, there
is no top-level bind expression.  Because the rewritten coroutine body will
require both local vars and contain nested scopes, we add a bind expression
to such functions.  When this was done the necessary scope blocks were
omitted which leads to disconnected function content.

Fixed by adding a new block to the added bind expression.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/cp/ChangeLog:

* coroutines.cc (coro_rewrite_function_body): Ensure that added
bind expressions have scope blocks.

13 months agoDaily bump.
GCC Administrator [Sun, 9 Apr 2023 00:16:37 +0000 (00:16 +0000)] 
Daily bump.

13 months agoPR tree-optimization/109392
Jakub Jelinek [Sat, 8 Apr 2023 18:21:42 +0000 (12:21 -0600)] 
PR tree-optimization/109392

If we have an object with SSA_NAME_OCCURS_IN_ABNORMAL_PHI, then
maybe_push_res_to_seq may fail.  Directly build the extraction
for that case.

PR tree-optimization/109392

gcc/
* tree-vect-generic.cc (tree_vec_extract): Handle failure
of maybe_push_res_to_seq better.

gcc/testsuite/

* gcc.dg/pr109392.c: New test.

13 months agoxfail gcc.dg/long_branch.c on hppa.
John David Anglin [Sat, 8 Apr 2023 17:25:25 +0000 (17:25 +0000)] 
xfail gcc.dg/long_branch.c on hppa.

2023-04-08  John David Anglin  <danglin@gcc.gnu.org>

gcc/testsuite/ChangeLog:

* gcc.dg/pr84877.c: xfail on hppa*-*-*.

13 months agoFix gcc.dg/long_branch.c on hppa.
John David Anglin [Sat, 8 Apr 2023 16:01:26 +0000 (16:01 +0000)] 
Fix gcc.dg/long_branch.c on hppa.

2023-04-08  John David Anglin  <danglin@gcc.gnu.org>

gcc/testsuite/ChangeLog:

* gcc.dg/long_branch.c: Use timeout factor 2.0 on hppa*-*-*.

13 months agoPR target/109402: v850 (not v850e) variant of __muldi3() moves sp in reversed directi...
Tetsuma Hoshino [Sat, 8 Apr 2023 14:19:53 +0000 (08:19 -0600)] 
PR target/109402: v850 (not v850e) variant of __muldi3() moves sp in reversed direction [PR109402]

muldi3 will deallocate stack space after the call to __save_r26_r31,
then re-allocate the space a short while later.  If an interrupt
occurs in that window, it can clobber items on the stack.

PR target/109402

libgcc/
* config/v850/lib1funcs.S (___muldi3): Remove unnecessary
stack manipulations.

13 months agoriscv: Fix genrvv-type-indexer dependencies
Jakub Jelinek [Sat, 8 Apr 2023 10:05:04 +0000 (12:05 +0200)] 
riscv: Fix genrvv-type-indexer dependencies

I've noticed
make: Circular build/genrvv-type-indexer.o <- gtype-desc.h dependency dropped.

The following patch fixes that.  The RTL_BASE_H variable includes a lot of
headers which the generator doesn't include, including gtype-desc.h.
I've preprocessed it and checked all gcc/libiberty headers against what is
included in the other dependency variables and here is what I found:
1) coretypes.h includes align.h, poly-int.h and poly-int-types.h which
   weren't listed (most of dependencies are thankfully done automatically,
   so it isn't that big deal except for these generators and the like)
2) system.h includes filenames.h (already listed) but filenames.h includes
   hashtab.h; instead of adding FILENAMES_H I've just added the dependency
   to SYSTEM_H
3) $(RTL_BASE_H) wasn't really needed at all and insn-modes.h is already
   included in $(CORETYPES_H)

2023-04-08  Jakub Jelinek  <jakub@redhat.com>

* Makefile.in (CORETYPES_H): Depend on align.h, poly-int.h and
poly-int-types.h.
(SYSTEM_H): Depend on $(HASHTAB_H).
* config/riscv/t-riscv (build/genrvv-type-indexer.o): Remove unused
dependency on $(RTL_BASE_H), remove redundant dependency on
insn-modes.h.

13 months agoFortran: Fix some of the bugs in associate [PR87477]
Paul Thomas [Sat, 8 Apr 2023 08:04:13 +0000 (09:04 +0100)] 
Fortran: Fix some of the bugs in associate [PR87477]

2023-04-08  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/87477
* iresolve.cc (gfc_resolve_adjustl, gfc_resolve_adjustr): if
string length is deferred use the string typespec for result.
* resolve.cc (resolve_assoc_var): Handle parentheses around the
target expression.
(resolve_block_construct): Remove unnecessary static decls.
* trans-array.cc (gfc_conv_expr_descriptor): Guard string len
expression in condition. Improve handling of string length and
span, especially for substrings of the descriptor.
(duplicate_allocatable): Make element type more explicit with
'eltype'.
* trans-decl.cc (gfc_get_symbol_decl): Emit a fatal error with
appropriate message instead of ICE if symbol type is unknown.
(gfc_generate_function_code): Set current locus to proc_sym
declared_at.
* trans-expr.cc (gfc_get_expr_charlen): Retain last charlen in
'previous' and use if end expression in substring reference is
null.
(gfc_conv_string_length): Use gfc_conv_expr_descriptor if
'expr_flat' is an array. Add post block to catch deallocation
of temporaries.
(gfc_conv_procedure_call): Assign the parmse string length to
the expression string length, if it is deferred.
(gfc_trans_alloc_subarray_assign): If this is a deferred string
length component, store the string length in the hidden comp.
Update the typespec length accordingly. Generate a new type
spec for the call to gfc_duplicate-allocatable in this case.
* trans-io.cc (gfc_trans_transfer): Scalarize transfer of
deferred character array components.

gcc/testsuite/
PR fortran/87477
* gfortran.dg/associate_47.f90 : Enable substring test.
* gfortran.dg/associate_51.f90 : Update an error message.
* gfortran.dg/goacc/array-with-dt-2.f90 : Add span to
uninitialzed dg-warnings.

PR fortran/85686
PR fortran/88247
PR fortran/91941
PR fortran/92779
PR fortran/93339
PR fortran/93813
PR fortran/100948
PR fortran/102106
* gfortran.dg/associate_60.f90 : New test

PR fortran/98408
* gfortran.dg/pr98408.f90 : New test

PR fortran/105205
* gfortran.dg/pr105205.f90 : New test

PR fortran/106918
* gfortran.dg/pr106918.f90 : New test

13 months agoFortran: Fix dg directives and remove trailing whitespaces in testsuite
Paul Thomas [Sat, 8 Apr 2023 06:49:13 +0000 (07:49 +0100)] 
Fortran: Fix dg directives and remove trailing whitespaces in testsuite

2023-04-08   Paul Thomas  <pault@gcc.gnu.org>

* gfortran.dg/c-interop/allocatable-optional-pointer.f90 : Fix
dg directive and remove trailing whitespace.
* gfortran.dg/c-interop/c407a-1.f90 : ditto
* gfortran.dg/c-interop/c407b-1.f90 : ditto
* gfortran.dg/c-interop/c407b-2.f90 : ditto
* gfortran.dg/c-interop/c407c-1.f90 : ditto
* gfortran.dg/c-interop/c535a-1.f90 : ditto
* gfortran.dg/c-interop/c535a-2.f90 : ditto
* gfortran.dg/c-interop/c535b-1.f90 : ditto
* gfortran.dg/c-interop/c535b-2.f90 : ditto
* gfortran.dg/c-interop/c535b-3.f90 : ditto
* gfortran.dg/c-interop/c535c-1.f90 : ditto
* gfortran.dg/c-interop/c535c-2.f90 : ditto
* gfortran.dg/c-interop/deferred-character-1.f90 : ditto
* gfortran.dg/c-interop/removed-restrictions-1.f90 : ditto
* gfortran.dg/c-interop/removed-restrictions-2.f90 : ditto
* gfortran.dg/c-interop/removed-restrictions-4.f90 : ditto
* gfortran.dg/c-interop/tkr.f90 : ditto
* gfortran.dg/class_result_10.f90 : ditto
* gfortran.dg/dtio_35.f90 : ditto
* gfortran.dg/gomp/affinity-clause-1.f90 : ditto
* gfortran.dg/pr103258.f90 : ditto
* gfortran.dg/pr59107.f90 : ditto
* gfortran.dg/pr93835.f08 : ditto

13 months agoDaily bump.
GCC Administrator [Sat, 8 Apr 2023 00:16:33 +0000 (00:16 +0000)] 
Daily bump.

13 months agomime: remove test ordering dependency
Ian Lance Taylor [Fri, 7 Apr 2023 20:27:04 +0000 (13:27 -0700)] 
mime: remove test ordering dependency

Backport CL 421442 from upstream.

Original description:

Arrange for tests that call setMimeInit to fully restore the old values,
by clearing the sync.Once that controls initialization.

Once we've done that, call initMime in initMimeUnixTest because
otherwise the test types loaded there will be cleared by the call to
initMime that previously was not being done.

For golang/go#51648

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/483117

13 months ago[testsuite] [ppc] skip ppc-fortran if fortran is disabled
Alexandre Oliva [Fri, 7 Apr 2023 04:04:32 +0000 (01:04 -0300)] 
[testsuite] [ppc] skip ppc-fortran if fortran is disabled

Skip ppc-fortran.exp if a trivial fortran program cannot be compiled.

for  gcc/testsuite/ChangeLog

* gcc.target/powerpc/ppc-fortran/ppc-fortran.exp: Test for
fortran compiler, skip if missing.

13 months agoDaily bump.
GCC Administrator [Fri, 7 Apr 2023 00:17:36 +0000 (00:17 +0000)] 
Daily bump.

13 months agoarm: remove unused variables from test
Stam Markianos-Wright [Thu, 6 Apr 2023 17:57:08 +0000 (18:57 +0100)] 
arm: remove unused variables from test

This is just a minor issue I found with a previous test
of mine that caused it to fail in C++ mode due to these
unused const variables being uninitialised. I forgot to
remove these after removing some test cases that did use
them. I removed the test cases, because I came to the
conclusion that the const-ness of the immediate was
irrelevant to the test itself.
Removing the variables now makes the test PASS for C++.

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-fp.c: Remove unused variables.
* gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-int.c: Remove unused variables.

13 months agoarm: mve: fix auto-inc generation [PR107674]
Richard Earnshaw [Thu, 6 Apr 2023 13:44:30 +0000 (14:44 +0100)] 
arm: mve: fix auto-inc generation [PR107674]

My change r13-416-g485a0ae0982abe caused the compiler to stop
generating auto-inc operations on mve loads and stores.  The fix
is to check whether there is a replacement register available
when in strict mode and the register is still a pseudo.

gcc:

PR target/107674
* config/arm/arm.cc (arm_effective_regno): New function.
(mve_vector_mem_operand): Use it.

13 months agoCheck if dependency is valid before using in may_recompute_p.
Andrew MacLeod [Wed, 5 Apr 2023 19:59:38 +0000 (15:59 -0400)] 
Check if dependency is valid before using in may_recompute_p.

When the IL is rewritten after a statement has been processed and
dependencies cached, its possible that an ssa-name in the dependency
cache is no longer in the IL.  Check this before trying to recompute.

PR tree-optimization/109417
gcc/
* gimple-range-gori.cc (gori_compute::may_recompute_p): Check if
dependency is in SSA_NAME_FREE_LIST.

gcc/testsuite/
* gcc.dg/pr109417.c: New.

13 months agogccrs: Fix issue with parsing unsafe block expression statements
Owen Avery [Fri, 27 Jan 2023 03:59:49 +0000 (22:59 -0500)] 
gccrs: Fix issue with parsing unsafe block expression statements

gcc/rust/ChangeLog:

* parse/rust-parse-impl.h
(Parser::parse_stmt): Handle unsafe expression statements.

gcc/testsuite/ChangeLog:

* rust/compile/issue-1422.rs: New test.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
13 months agogccrs: Address unsafe with/without block handling ambiguity
Owen Avery [Fri, 27 Jan 2023 03:48:45 +0000 (22:48 -0500)] 
gccrs: Address unsafe with/without block handling ambiguity

gcc/rust/ChangeLog:

* parse/rust-parse-impl.h
(Parser::parse_expr_stmt): Remove hypothetical unsafe + expr_stmt_without_block handling.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
13 months agogccrs: Added AST Node AST::InlineAsm
M V V S Manoj Kumar [Fri, 17 Feb 2023 18:09:56 +0000 (23:39 +0530)] 
gccrs: Added AST Node AST::InlineAsm

Addresses #1567
Created a AST node InlineAsm similar to the one found in rustc.
As there is no Symbol struct/class in gccrs I have made every instance
of Symbol a string.

gcc/rust/ChangeLog:

* ast/rust-ast-full-decls.h (class InlineAsm):Added class declaration.
* ast/rust-expr.h (class InlineAsm):Added class definition.

Signed-off-by: M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
13 months agogccrs: diagnostic: Refactor Error class
Arthur Cohen [Wed, 15 Feb 2023 15:56:07 +0000 (16:56 +0100)] 
gccrs: diagnostic: Refactor Error class

The class now allows for more variants including a `Hint` one which
then gets emitted by calling `rust_inform`. This allows us to display
hints/tips/notes in backtracking contexts such as the parser.

gcc/rust/ChangeLog:

* rust-diagnostics.h (struct Error): Add new Kind enum and various new
static constructors to allow for hints as well.
* rust-diagnostics.cc (Error::Error): Use new `kind` field properly.
* checks/errors/privacy/rust-visibility-resolver.cc
(VisibilityResolver::resolve_module_path): Use new Error API.
* expand/rust-macro-builtins.cc (MacroBuiltin::include_handler): Likewise.
* expand/rust-macro-expand.cc (parse_many): Likewise.
(transcribe_type): Likewise.
* parse/rust-parse-impl.h (Parser::parse_crate): Likewise.
* rust-session-manager.cc (Session::handle_crate_name): Likewise.
* ast/rust-ast.cc (Module::load_items): Likewise.

13 months agogccrs: ast: Refactor TraitItem to keep Location info
Arthur Cohen [Wed, 15 Feb 2023 16:10:54 +0000 (17:10 +0100)] 
gccrs: ast: Refactor TraitItem to keep Location info

gcc/rust/ChangeLog:

* ast/rust-ast.h: Keep location in TraitItem base class
* ast/rust-item.h (class TraitItemFunc): Use base class location instead.
(class TraitItemMethod): Likewise.
(class TraitItemConst): Likewise.
(class TraitItemType): Likewise.
* ast/rust-macro.h: Likewise.