Jakub Jelinek [Tue, 28 Sep 2021 09:38:03 +0000 (11:38 +0200)]
openmp: Don't call omp_finish_clause on implicitly added private clauses on simd [PR102492]
The gimplifier adds implicit private clauses on SIMD constructs for local
variables in the SIMD body if they are addressable to make sure they use
the magic arrays with "omp simd array" attribute (such that each SIMD lane
has its own copy), but we actually don't need to default privatize etc. those,
the construction for them is done in the SIMD body and so is destruction.
omp_finish_clause for C++ now requires default constructor (and dtor) for private,
so that OpenMP 5.1 default(private) works, but that will never be needed on
SIMD. So, this patch just doesn't call omp_finish_clause for private on simd.
The C and Fortran langhooks don't do anything for private.
2021-09-28 Jakub Jelinek <jakub@redhat.com>
PR middle-end/102492
* gimplify.c (gimplify_adjust_omp_clauses_1): Don't call the
omp_finish_clause langhook on implicitly added OMP_CLAUSE_PRIVATE
clauses on SIMD constructs.
* g++.dg/gomp/simd-3.C: New test.
Aldy Hernandez [Tue, 28 Sep 2021 07:38:50 +0000 (09:38 +0200)]
Return VARYING in range_on_path_entry if nothing found.
The problem here is that the solver's code solving unknown SSAs on entry
to a path was returning UNDEFINED if there were no incoming edges to the
start of the path that were not the function entry block. This caused a
cascade of pain down stream.
Tested on x86-64 Linux.
PR tree-optimization/102511
gcc/ChangeLog:
* gimple-range-path.cc (path_range_query::range_on_path_entry):
Return VARYING when nothing found.
gcc/testsuite/ChangeLog:
* gcc.dg/pr102511.c: New test.
* gcc.dg/tree-ssa/ssa-dom-thread-14.c: Adjust.
Andrew Burgess [Wed, 22 Sep 2021 14:15:41 +0000 (15:15 +0100)]
top-level configure: setup target_configdirs based on repository
The top-level configure script is shared between the gcc repository
and the binutils-gdb repository.
The target_configdirs variable in the configure.ac script, defines
sub-directories that contain components that should be built for the
target using the target tools.
Some components, e.g. zlib, are built as both host and target
libraries.
This causes problems for binutils-gdb. If we run 'make all' in the
binutils-gdb repository we end up trying to build a target version of
the zlib library, which requires the target compiler be available.
Often the target compiler isn't immediately available, and so the
build fails.
The problem with zlib impacted a previous attempt to synchronise the
top-level configure scripts from gcc to binutils-gdb, see this thread:
https://sourceware.org/pipermail/binutils/2019-May/107094.html
And I'm in the process of importing libbacktrace in to binutils-gdb,
which is also a host and target library, and triggers the same issues.
I believe that for binutils-gdb, at least at the moment, there are no
target libraries that we need to build.
In the configure script we build three lists of things we want to
build, $configdirs, $build_configdirs, and $target_configdirs, we also
build two lists of things we don't want to build, $skipdirs and
$noconfigdirs. We then remove anything that is in the lists of things
not to build, from the list of things that should be built.
My proposal is to add everything in target_configdirs into skipdirs,
if the source tree doesn't contain a gcc/ sub-directory. The result
is that for binutils-gdb no target tools or libraries will be built,
while for the gcc repository, nothing should change.
If a user builds a unified source tree, then the target tools and
libraries should still be built as the gcc/ directory will be present.
I've tested a build of gcc on x86-64, and the same set of target
libraries still seem to get built. On binutils-gdb this change
resolves the issues with 'make all'.
ChangeLog:
* configure: Regenerate.
* configure.ac (skipdirs): Add the contents of target_configdirs if
we are not building gcc.
Hongyu Wang [Thu, 15 Jul 2021 05:31:24 +0000 (13:31 +0800)]
AVX512FP16: Support basic 64/32bit vector type and operation.
For 32bit target, V4HF vector is parsed same as __m64 type, V2HF
is parsed by stack and returned from GPR since it is not specified
by ABI.
gcc/ChangeLog:
PR target/102230
* config/i386/i386.h (VALID_AVX512FP16_REG_MODE): Add
V2HF mode check.
(VALID_SSE2_REG_VHF_MODE): Add V4HFmode and V2HFmode.
(VALID_MMX_REG_MODE): Add V4HFmode.
(SSE_REG_MODE_P): Replace VALID_AVX512FP16_REG_MODE with
vector mode condition.
* config/i386/i386.c (classify_argument): Parse V4HF/V2HF
via sse regs.
(function_arg_32): Add V4HFmode.
(function_arg_advance_32): Likewise.
* config/i386/i386.md (mode): Add V4HF/V2HF.
(MODE_SIZE): Likewise.
* config/i386/mmx.md (MMXMODE): Add V4HF mode.
(V_32): Add V2HF mode.
(VHF_32_64): New mode iterator.
(*mov<mode>_internal): Adjust sse alternatives to support
V4HF mode move.
(*mov<mode>_internal): Adjust sse alternatives to support
V2HF mode move.
(<insn><mode>3): New define_insn for add/sub/mul/div.
gcc/testsuite/ChangeLog:
PR target/102230
* gcc.target/i386/avx512fp16-floatvnhf.c: Remove xfail.
* gcc.target/i386/avx512fp16-trunc-extendvnhf.c: Ditto.
* gcc.target/i386/avx512fp16-truncvnhf.c: Ditto.
* gcc.target/i386/avx512fp16-64-32-vecop-1.c: New test.
* gcc.target/i386/avx512fp16-64-32-vecop-2.c: Ditto.
* gcc.target/i386/pr102230.c: Ditto.
Richard Biener [Tue, 28 Sep 2021 08:04:00 +0000 (10:04 +0200)]
Fix gcc.target/i386/vect-pr97352.c for -m32 -march=cascadelake
The easiest is to disable AVX2 and AVX512F explicitely.
2021-09-28 Richard Biener <rguenther@suse.de>
* gcc.target/i386/vect-pr97352.c: Pass -mno-avx2 -mno-avx512f.
Tobias Burnus [Tue, 28 Sep 2021 07:49:12 +0000 (09:49 +0200)]
gfortran.dg/include_15.f90: Add dg-prune-output [PR102500]
gcc/testsuite/
PR fortran/102500
* gfortran.dg/include_15.f90: Add 'dg-prune-output' to prune
-Wmissing-include-dirs output printed or not depending on
how the testsuite is run.
Richard Biener [Tue, 28 Sep 2021 06:59:49 +0000 (08:59 +0200)]
Fix gcc.dg/vect/bb-slp-pr65935.c FAIL with AVX after recent change
This avoids bigger than V2DF vectorization which disturbs the ability
to consistently check for the vectorization result after us now
also vectorizing the V2DF tail of a V4DF vectorization variant.
2021-09-28 Richard Biener <rguenther@suse.de>
* gcc.dg/vect/bb-slp-pr65935.c: Prefer 128bit vectorization
on x86.
Aldy Hernandez [Mon, 27 Sep 2021 14:41:01 +0000 (16:41 +0200)]
Control all jump threading passes with -fjump-threads.
Last year I mentioned that -fthread-jumps was being ignored by the
majority of our jump threading passes, and Jeff said he'd be in favor
of fixing this.
This patch remedies the situation, but it does change existing behavior.
Currently -fthread-jumps is only enabled for -O2, -O3, and -Os. This
means that even if we restricted all jump threading passes with
-fthread-jumps, DOM jump threading would still seep through since it
runs at -O1.
I propose this patch, but it does mean that DOM jump threading would
have to be explicitly enabled with -O1 -fthread-jumps.
gcc/ChangeLog:
* tree-ssa-threadbackward.c (pass_thread_jumps::gate): Check
flag_thread_jumps.
(pass_early_thread_jumps::gate): Same.
* tree-ssa-threadedge.c (jump_threader::thread_outgoing_edges):
Return if !flag_thread_jumps.
* tree-ssa-threadupdate.c
(jt_path_registry::register_jump_thread): Assert that
flag_thread_jumps is true.
gcc/testsuite/ChangeLog:
* gcc.dg/auto-init-uninit-1.c: Add -fthread-jumps.
* gcc.dg/auto-init-uninit-15.c: Same.
* gcc.dg/guality/example.c: Same.
* gcc.dg/loop-8.c: Same.
* gcc.dg/strlenopt-40.c: Same.
* gcc.dg/tree-ssa/pr18133-2.c: Same.
* gcc.dg/tree-ssa/pr18134.c: Same.
* gcc.dg/uninit-1.c: Same.
* gcc.dg/uninit-pr44547.c: Same.
* gcc.dg/uninit-pr59970.c: Same.
liuhongt [Fri, 10 Sep 2021 02:15:58 +0000 (10:15 +0800)]
Relax condition of (vec_concat:M(vec_select op0 idx0)(vec_select op0 idx1)) to allow different modes between op0 and M, but have same inner mode.
This will enable optimization for below pattern.
(set (reg:V2DF 87 [ xx ])
(vec_concat:V2DF (vec_select:DF (reg:V4DF 92)
(parallel [
(const_int 2 [0x2])
]))
(vec_select:DF (reg:V4DF 92)
(parallel [
(const_int 3 [0x3])
]))))
gcc/ChangeLog:
* simplify-rtx.c
(simplify_context::simplify_binary_operation_1): Relax
condition of simplifying (vec_concat:M (vec_select op0
index0)(vec_select op1 index1)) to allow different modes
between op0 and M, but have same inner mode.
gcc/testsuite/ChangeLog:
* gcc.target/i386/vect-rebuild.c: Adjust testcases.
* gcc.target/i386/avx512f-vect-rebuild.c: New test.
liuhongt [Mon, 27 Sep 2021 06:57:38 +0000 (14:57 +0800)]
Support 128/256/512-bit vector plus/smin/smax reduction for _Float16.
gcc/ChangeLog:
* config/i386/i386-expand.c (emit_reduc_half): Handle
V8HF/V16HF/V32HFmode.
* config/i386/sse.md (REDUC_SSE_PLUS_MODE): Add V8HF.
(REDUC_SSE_SMINMAX_MODE): Ditto.
(REDUC_PLUS_MODE): Add V16HF and V32HF.
(REDUC_SMINMAX_MODE): Ditto.
gcc/testsuite
* gcc.target/i386/avx512fp16-reduce-op-2.c: New test.
* gcc.target/i386/avx512fp16-reduce-op-3.c: New test.
GCC Administrator [Tue, 28 Sep 2021 00:16:21 +0000 (00:16 +0000)]
Daily bump.
Patrick Palka [Mon, 27 Sep 2021 20:01:10 +0000 (16:01 -0400)]
c++: deduction guides and ttp rewriting [PR102479]
The problem here is ultimately that rewrite_tparm_list when rewriting a
TEMPLATE_TEMPLATE_PARM introduces a tree cycle in the rewritten
ttp that structural_comptypes can't cope with. In particular the
DECL_TEMPLATE_PARMS of a ttp's TEMPLATE_DECL normally captures an empty
parameter list at its own level (and so the TEMPLATE_DECL doesn't appear
in its own DECL_TEMPLATE_PARMS), but rewrite_tparm_list ends up giving
it a complete parameter list. In the new testcase below, this causes
infinite recursion from structural_comptypes when comparing Tmpl<char>
with Tmpl<long> (where both 'Tmpl's are rewritten ttps).
This patch fixes this by making rewrite_template_parm give a rewritten
template template parm an empty parameter list at its own level, thereby
avoiding the tree cycle. Testing the alias CTAD case revealed that
we're not setting current_template_parms in alias_ctad_tweaks, which
this patch also fixes.
PR c++/102479
gcc/cp/ChangeLog:
* pt.c (rewrite_template_parm): Handle single-level tsubst_args.
Avoid a tree cycle when assigning the DECL_TEMPLATE_PARMS for a
rewritten ttp.
(alias_ctad_tweaks): Set current_template_parms accordingly.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/class-deduction12.C: Also test alias CTAD in the
same way.
* g++.dg/cpp1z/class-deduction99.C: New test.
Aldy Hernandez [Sat, 25 Sep 2021 07:28:10 +0000 (09:28 +0200)]
Minor cleanups to solver.
These are some minor cleanups and renames that surfaced after the
hybrid_threader work.
gcc/ChangeLog:
* gimple-range-path.cc
(path_range_query::precompute_ranges_in_block): Rename to...
(path_range_query::compute_ranges_in_block): ...this.
(path_range_query::precompute_ranges): Rename to...
(path_range_query::compute_ranges): ...this.
(path_range_query::precompute_relations): Rename to...
(path_range_query::compute_relations): ...this.
(path_range_query::precompute_phi_relations): Rename to...
(path_range_query::compute_phi_relations): ...this.
* gimple-range-path.h: Rename precompute* to compute*.
* tree-ssa-threadbackward.c
(back_threader::find_taken_edge_switch): Same.
(back_threader::find_taken_edge_cond): Same.
* tree-ssa-threadedge.c
(hybrid_jt_simplifier::compute_ranges_from_state): Same.
(hybrid_jt_state::register_equivs_stmt): Inline...
* tree-ssa-threadedge.h: ...here.
Aldy Hernandez [Fri, 24 Sep 2021 16:39:47 +0000 (18:39 +0200)]
Remove old VRP jump threader code.
There's a lot of code that melts away without the ASSERT_EXPR based jump
threader. Also, I cleaned up the include files as part of the process.
gcc/ChangeLog:
* tree-vrp.c (lhs_of_dominating_assert): Remove.
(class vrp_jt_state): Remove.
(class vrp_jt_simplifier): Remove.
(vrp_jt_simplifier::simplify): Remove.
(class vrp_jump_threader): Remove.
(vrp_jump_threader::vrp_jump_threader): Remove.
(vrp_jump_threader::~vrp_jump_threader): Remove.
(vrp_jump_threader::before_dom_children): Remove.
(vrp_jump_threader::after_dom_children): Remove.
Aldy Hernandez [Tue, 21 Sep 2021 08:27:53 +0000 (10:27 +0200)]
Replace VRP threader with a hybrid forward threader.
This patch implements the new hybrid forward threader and replaces the
embedded VRP threader with it.
With all the pieces that have gone in, the implementation of the hybrid
threader is straightforward: convert the current state into
SSA imports that the solver will understand, and let the path solver
precompute ranges and relations for the path. After this setup is done,
we can use the range_query API to solve gimple statements in the threader.
The forward threader is now engine agnostic so there are no changes to
the threader per se.
I have put the hybrid bits in tree-ssa-threadedge.*, instead of VRP,
because they will also be used in the evrp removal of the DOM/threader,
which is my next task.
Most of the patch, is actually test changes. I have gone through every
single one and verified that we're correct. Most were trivial dump
file name changes, but others required going through the IL an
certifying that the different IL was expected.
For example, in pr59597.c, we have one less thread because the
ASSERT_EXPR was getting in the way, and making it seem like things were
not crossing loops. The hybrid threader sees the correct representation
of the IL, and avoids threading this one case.
The final numbers are a 12.16% improvement in jump threads immediately
after VRP, and a 0.82% improvement in overall jump threads. The
performance drop is 0.6% (plus the 1.43% hit from moving the embedded
threader into its own pass). As I've said, I'd prefer to keep the
threader in its own pass, but if this is an issue, we can address this
with a shared ranger when VRP is replaced with an evrp instance
(upcoming).
Note, that these numbers are slightly different than what I originally
posted. A few correctness tweaks, plus restricting loop threads, made
the difference. That being said, I was aiming for par. A 12% gain is
just gravy ;-). When we merge the threaders, we should see even better
numbers-- and we'll have the benefit of an entire release stress testing
the solver.
As I mentioned in my introductory note, paths ending in MEM_REF
conditional are missing. In reality, this didn't make a difference, as
it was so rare. However, as a follow-up, I will distill a test and add
a suitable PR to keep us honest.
There is a one-line change to libgomp/team.c silencing a new used
uninitialized warning. As my previous work with the threaders has
shown, warnings flare up after each improvement to jump threading. I
expect this to be no different. I've promised Jakub to investigate
fully, so I will analyze and add the appropriate PR for the warning
experts.
Oh yeah, the new pass dump is called vrp-threader[12] to match each
VRP[12] pass. However, there's no reason for it to either be named
vrp-threader, or for it to live in tree-vrp.c.
Tested on x86-64 Linux.
OK?
p.s. "Did I say 5 weeks? My bad, I meant 5 months."
gcc/ChangeLog:
* passes.def (pass_vrp_threader): New.
* tree-pass.h (make_pass_vrp_threader): Add make_pass_vrp_threader.
* tree-ssa-threadedge.c (hybrid_jt_state::register_equivs_stmt): New.
(hybrid_jt_simplifier::hybrid_jt_simplifier): New.
(hybrid_jt_simplifier::simplify): New.
(hybrid_jt_simplifier::compute_ranges_from_state): New.
* tree-ssa-threadedge.h (class hybrid_jt_state): New.
(class hybrid_jt_simplifier): New.
* tree-vrp.c (execute_vrp): Remove ASSERT_EXPR based jump
threader.
(class hybrid_threader): New.
(hybrid_threader::hybrid_threader): New.
(hybrid_threader::~hybrid_threader): New.
(hybrid_threader::before_dom_children): New.
(hybrid_threader::after_dom_children): New.
(execute_vrp_threader): New.
(class pass_vrp_threader): New.
(make_pass_vrp_threader): New.
libgomp/ChangeLog:
* team.c: Initialize start_data.
* testsuite/libgomp.graphite/force-parallel-4.c: Adjust.
* testsuite/libgomp.graphite/force-parallel-8.c: Adjust.
gcc/testsuite/ChangeLog:
* gcc.dg/torture/pr55107.c: Adjust.
* gcc.dg/tree-ssa/phi_on_compare-1.c: Adjust.
* gcc.dg/tree-ssa/phi_on_compare-2.c: Adjust.
* gcc.dg/tree-ssa/phi_on_compare-3.c: Adjust.
* gcc.dg/tree-ssa/phi_on_compare-4.c: Adjust.
* gcc.dg/tree-ssa/pr21559.c: Adjust.
* gcc.dg/tree-ssa/pr59597.c: Adjust.
* gcc.dg/tree-ssa/pr61839_1.c: Adjust.
* gcc.dg/tree-ssa/pr61839_3.c: Adjust.
* gcc.dg/tree-ssa/pr71437.c: Adjust.
* gcc.dg/tree-ssa/ssa-dom-thread-11.c: Adjust.
* gcc.dg/tree-ssa/ssa-dom-thread-16.c: Adjust.
* gcc.dg/tree-ssa/ssa-dom-thread-18.c: Adjust.
* gcc.dg/tree-ssa/ssa-dom-thread-2a.c: Adjust.
* gcc.dg/tree-ssa/ssa-dom-thread-4.c: Adjust.
* gcc.dg/tree-ssa/ssa-thread-14.c: Adjust.
* gcc.dg/tree-ssa/ssa-vrp-thread-1.c: Adjust.
* gcc.dg/tree-ssa/vrp106.c: Adjust.
* gcc.dg/tree-ssa/vrp55.c: Adjust.
Martin Liska [Mon, 6 Sep 2021 15:40:16 +0000 (17:40 +0200)]
Come up with section_flag enum.
gcc/ChangeLog:
* output.h (enum section_flag): New.
(SECTION_FORGET): Remove.
(SECTION_ENTSIZE): Make it (1UL << 8) - 1.
(SECTION_STYLE_MASK): Define it based on other enum
values.
* varasm.c (switch_to_section): Remove unused handling of
SECTION_FORGET.
Martin Liska [Fri, 3 Sep 2021 08:53:00 +0000 (10:53 +0200)]
flag_complex_method: support optimize attribute
gcc/c-family/ChangeLog:
* c-opts.c (c_common_init_options_struct): Set also
x_flag_default_complex_method.
gcc/ChangeLog:
* common.opt: Add new variable flag_default_complex_method.
* opts.c (finish_options): Handle flags related to
x_flag_complex_method.
* toplev.c (process_options): Remove option handling related
to flag_complex_method.
gcc/go/ChangeLog:
* go-lang.c (go_langhook_init_options_struct): Set also
x_flag_default_complex_method.
gcc/lto/ChangeLog:
* lto-lang.c (lto_init_options_struct): Set also
x_flag_default_complex_method.
gcc/testsuite/ChangeLog:
* gcc.c-torture/compile/attr-complex-method-2.c: New test.
* gcc.c-torture/compile/attr-complex-method.c: New test.
Vincent Lefevre [Mon, 27 Sep 2021 14:56:14 +0000 (10:56 -0400)]
Update pathname for IBM long double description.
include/
* floatformat.h: Update pathname for IBM long double description.
Richard Biener [Mon, 27 Sep 2021 11:36:12 +0000 (13:36 +0200)]
middle-end/102450 - avoid type_for_size for non-existing modes
This avoids asking type_for_size for types with sizes for which
no scalar integer mode exists. Instead the following uses
int_mode_for_size to get the same result.
2021-09-27 Richard Biener <rguenther@suse.de>
PR middle-end/102450
* gimple-fold.c (gimple_fold_builtin_memory_op): Avoid using
type_for_size, instead use int_mode_for_size.
Tobias Burnus [Mon, 27 Sep 2021 12:33:39 +0000 (14:33 +0200)]
libgomp.oacc-fortran/privatized-ref-2.f90: Fix dg-note
In my last commit, r12-3897-g00f6de9c69119594f7dad3bd525937c94c8200d0,
which inlined array-size code, I had to update the expected output. However,
in doing so, I accidentally (copy'n'paste) changed dg-note into dg-message.
libgomp/
* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Change
dg-message back to dg-note.
Tobias Burnus [Mon, 27 Sep 2021 12:04:54 +0000 (14:04 +0200)]
Fortran: Fix assumed-size to assumed-rank passing [PR94070]
This code inlines the size0 and size1 libgfortran calls, the former is still
used by libgfortan itself (and by old code). Besides permitting more
optimizations, it also permits to handle assumed-rank dummies better: If the
dummy argument is a nonpointer/nonallocatable, an assumed-size actual arg is
repesented by having ubound == -1 for the last dimension. However, for
allocatable/pointers, this value can also exist. Hence, the dummy arg attr
has to be honored.
For that reason, when calling an assumed-rank procedure with nonpointer,
nonallocatable dummy arguments, the bounds have to be updated to avoid
the case ubound == -1 for the last dimension.
PR fortran/94070
gcc/fortran/ChangeLog:
* trans-array.c (gfc_tree_array_size): New function to
find size inline (whole array or one dimension).
(array_parameter_size): Use it, take stmt_block as arg.
(gfc_conv_array_parameter): Update call.
* trans-array.h (gfc_tree_array_size): Add prototype.
* trans-decl.c (gfor_fndecl_size0, gfor_fndecl_size1): Remove
these global vars.
(gfc_build_intrinsic_function_decls): Remove their initialization.
* trans-expr.c (gfc_conv_procedure_call): Update
bounds of pointer/allocatable actual args to nonallocatable/nonpointer
dummies to be one based.
* trans-intrinsic.c (gfc_conv_intrinsic_shape): Fix case for
assumed rank with allocatable/pointer dummy.
(gfc_conv_intrinsic_size): Update to use inline function.
* trans.h (gfor_fndecl_size0, gfor_fndecl_size1): Remove var decl.
libgfortran/ChangeLog:
* intrinsics/size.c (size0, size1): Comment that now not
used by newer compiler code.
libgomp/ChangeLog:
* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Update
expected dg-note output.
gcc/testsuite/ChangeLog:
* gfortran.dg/c-interop/cf-out-descriptor-6.f90: Remove xfail.
* gfortran.dg/c-interop/size.f90: Remove xfail.
* gfortran.dg/intrinsic_size_3.f90: Update scan-tree-dump-times.
* gfortran.dg/transpose_optimization_2.f90: Likewise.
* gfortran.dg/size_optional_dim_1.f90: Add scan-tree-dump-not.
* gfortran.dg/assumed_rank_22.f90: New test.
* gfortran.dg/assumed_rank_22_aux.c: New test.
Andrew Pinski [Sun, 26 Sep 2021 05:44:58 +0000 (05:44 +0000)]
Fix PR c/94726: ICE with __builtin_shuffle and changing of types
The problem here is __builtin_shuffle when called with two arguments
instead of 1, uses a SAVE_EXPR to put in for the 1st and 2nd operand
of VEC_PERM_EXPR and when we go and gimplify the SAVE_EXPR, the type
is now error_mark_node and that fails hard.
This fixes the problem by adding a simple check for type of operand
of SAVE_EXPR not to be error_mark_node.
OK? Bootstrapped and tested on aarch64-linux-gnu with no regressions.
gcc/ChangeLog:
PR c/94726
* gimplify.c (gimplify_save_expr): Return early
if the type of val is error_mark_node.
gcc/testsuite/ChangeLog:
PR c/94726
* gcc.dg/pr94726.c: New test.
Aldy Hernandez [Mon, 27 Sep 2021 07:20:56 +0000 (09:20 +0200)]
Use on-demand ranges in ssa_name_has_boolean_range before querying nonzero bits.
The function ssa_name_has_boolean_range looks at the nonzero bits stored
in SSA_NAME_RANGE_INFO. These are global in nature and are the result
of a previous evrp/VRP run (technically other passes can also set them).
However, we can do better if we use get_range_query. Doing so will use
a ranger if enabled in a pass, or global ranges otherwise. The call to
get_nonzero_bits remains, as there are passes that will set them
independently of the global range info.
Tested on x86-64 Linux with a regstrap as well as in a DOM environment
using an on-demand ranger instead of evrp.
gcc/ChangeLog:
* tree-ssanames.c (ssa_name_has_boolean_range): Use
get_range_query.
Aldy Hernandez [Sat, 25 Sep 2021 11:02:21 +0000 (13:02 +0200)]
Convert some evrp uses in DOM to the range_query API.
DOM is the last remaining user of the evrp engine. This patch converts
a few uses of the engine and vr-values into the new API.
There is one subtle change. The call to vr_value's
op_with_constant_singleton_value_range can theoretically return
non-constants, unlike the range_query API which only returns constants.
In this particular case it doesn't matter because the symbolic stuff will
have been handled by the const_and_copies/avail_exprs read in the
SSA_NAME_VALUE copy immediately before. I have verified this is the case
by asserting that all calls to op_with_constant_singleton_value_range at
this point return either NULL or an INTEGER_CST.
Tested on x86-64 Linux with a regstrap, as well as the aforementioned
assert.
gcc/ChangeLog:
* gimple-ssa-evrp-analyze.h (class evrp_range_analyzer): Remove
vrp_visit_cond_stmt.
* tree-ssa-dom.c (cprop_operand): Convert to range_query API.
(cprop_into_stmt): Same.
(dom_opt_dom_walker::optimize_stmt): Same.
Richard Biener [Wed, 18 Nov 2020 08:36:57 +0000 (09:36 +0100)]
Allow different vector types for stmt groups
This allows vectorization (in practice non-loop vectorization) to
have a stmt participate in different vector type vectorizations.
It allows us to remove vect_update_shared_vectype and replace it
by pushing/popping STMT_VINFO_VECTYPE from SLP_TREE_VECTYPE around
vect_analyze_stmt and vect_transform_stmt.
For data-ref the situation is a bit more complicated since we
analyze alignment info with a specific vector type in mind which
doesn't play well when that changes.
So the bulk of the change is passing down the actual vector type
used for a vectorized access to the various accessors of alignment
info, first and foremost dr_misalignment but also aligned_access_p,
known_alignment_for_access_p, vect_known_alignment_in_bytes and
vect_supportable_dr_alignment. I took the liberty to replace
ALL_CAPS macro accessors with the lower-case function invocations.
The actual changes to the behavior are in dr_misalignment which now
is the place factoring in the negative step adjustment as well as
handling alignment queries for a vector type with bigger alignment
requirements than what we can (or have) analyze(d).
vect_slp_analyze_node_alignment makes use of this and upon receiving
a vector type with a bigger alingment desire re-analyzes the DR
with respect to it but keeps an older more precise result if possible.
In this context it might be possible to do the analysis just once
but instead of analyzing with respect to a specific desired alignment
look for the biggest alignment we can compute a not unknown alignment.
The ChangeLog includes the functional changes but not the bulk due
to the alignment accessor API changes - I hope that's something good.
2021-09-17 Richard Biener <rguenther@suse.de>
PR tree-optimization/97351
PR tree-optimization/97352
PR tree-optimization/82426
* tree-vectorizer.h (dr_misalignment): Add vector type
argument.
(aligned_access_p): Likewise.
(known_alignment_for_access_p): Likewise.
(vect_supportable_dr_alignment): Likewise.
(vect_known_alignment_in_bytes): Likewise. Refactor.
(DR_MISALIGNMENT): Remove.
(vect_update_shared_vectype): Likewise.
* tree-vect-data-refs.c (dr_misalignment): Refactor, handle
a vector type with larger alignment requirement and apply
the negative step adjustment here.
(vect_calculate_target_alignment): Remove.
(vect_compute_data_ref_alignment): Get explicit vector type
argument, do not apply a negative step alignment adjustment
here.
(vect_slp_analyze_node_alignment): Re-analyze alignment
when we re-visit the DR with a bigger desired alignment but
keep more precise results from smaller alignments.
* tree-vect-slp.c (vect_update_shared_vectype): Remove.
(vect_slp_analyze_node_operations_1): Do not update the
shared vector type on stmts.
* tree-vect-stmts.c (vect_analyze_stmt): Push/pop the
vector type of an SLP node to the representative stmt-info.
(vect_transform_stmt): Likewise.
* gcc.target/i386/vect-pr82426.c: New testcase.
* gcc.target/i386/vect-pr97352.c: Likewise.
liuhongt [Mon, 27 Sep 2021 06:57:02 +0000 (14:57 +0800)]
Revert "Optimize v4sf reduction.".
This reverts commit
8f323c712ea76cc4506b03895e9b991e4e4b2baf.
PR target/102473
PR target/101059
GCC Administrator [Mon, 27 Sep 2021 00:16:16 +0000 (00:16 +0000)]
Daily bump.
Tobias Burnus [Sun, 26 Sep 2021 17:26:01 +0000 (19:26 +0200)]
Fortran: Fix associated intrinsic with assumed rank [PR101334]
ASSOCIATE (ptr, tgt) takes as first argument also an assumed-rank array;
however, using it together with a tgt (required to be non assumed rank)
had issues for both scalar and nonscalar tgt.
PR fortran/101334
gcc/fortran/ChangeLog:
* trans-intrinsic.c (gfc_conv_associated): Support assumed-rank
'pointer' with scalar/array 'target' argument.
libgfortran/ChangeLog:
* intrinsics/associated.c (associated): Also check for same rank.
gcc/testsuite/ChangeLog:
* gfortran.dg/associated_assumed_rank.f90: New test.
liuhongt [Fri, 24 Sep 2021 02:03:20 +0000 (10:03 +0800)]
Remove storage only description for _Float16 w/o avx512fp16.
gcc/ChangeLog:
* doc/extend.texi (Half-Precision): Remove storage only
description for _Float16 w/o avx512fp16.
GCC Administrator [Sun, 26 Sep 2021 00:16:16 +0000 (00:16 +0000)]
Daily bump.
Dimitar Dimitrov [Sun, 22 Aug 2021 15:49:31 +0000 (18:49 +0300)]
pru: Named address space for R30/R31 I/O access
The PRU architecture provides single-cycle access to GPIO pins via
special designated CPU registers - R30 and R31. These two registers can
of course be accessed in C code using inline assembly, but that can be
intimidating to users.
The TI proprietary compiler [1] can expose these I/O registers as global
volatile registers:
volatile register unsigned int __R31;
Consequently, accessing them in user programs is as straightforward as
using a regular global variable:
__R31 |= (1 << 2);
Unfortunately, global volatile registers are not supported by GCC [2].
I decided to implement convenient access to __R30 and __R31 using a new
named address space:
extern volatile __regio_symbol unsigned int __R30;
Unlike global registers, volatile global memory variables are well
supported in GCC. Memory writes and reads to the __regio_symbol address
space are converted to writes and reads to R30 and R31 CPU registers.
The declared variable name determines which of the two registers it is
representing.
With an ifdef for the __R30/__R31 declarations, user programs can now
be source-compatible with both TI and GCC toolchains.
[1] https://www.ti.com/lit/ug/spruhv7c/spruhv7c.pdf , "Global Register Variables"
[2] https://gcc.gnu.org/ml/gcc-patches/2015-01/msg02241.html
gcc/ChangeLog:
* config/pru/constraints.md (Rrio): New constraint.
* config/pru/predicates.md (regio_operand): New predicate.
* config/pru/pru-pragma.c (pru_register_pragmas): Register
the __regio_symbol address space.
* config/pru/pru-protos.h (pru_symref2ioregno): Declaration.
* config/pru/pru.c (pru_symref2ioregno): New helper function.
(pru_legitimate_address_p): Remove.
(pru_addr_space_legitimate_address_p): Use the address space
aware hook variant.
(pru_nongeneric_pointer_addrspace): New helper function.
(pru_insert_attributes): New function to validate __regio_symbol
usage.
(TARGET_INSERT_ATTRIBUTES): New macro.
(TARGET_LEGITIMATE_ADDRESS_P): Remove.
(TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P): New macro.
* config/pru/pru.h (enum reg_class): Add REGIO_REGS class.
* config/pru/pru.md (*regio_readsi): New pattern to read I/O
registers.
(*regio_nozext_writesi): New pattern to write to I/O registers.
(*regio_zext_write_r30<EQS0:mode>): Ditto.
* doc/extend.texi: Document the new PRU Named Address Space.
gcc/testsuite/ChangeLog:
* gcc.target/pru/regio-as-pointer.c: New negative test.
* gcc.target/pru/regio-as-pointer-2.c: New negative test.
* gcc.target/pru/regio-decl-2.c: New negative test.
* gcc.target/pru/regio-decl-3.c: New negative test.
* gcc.target/pru/regio-decl-4.c: New negative test.
* gcc.target/pru/regio-decl.c: New negative test.
* gcc.target/pru/regio-di.c: New negative test.
* gcc.target/pru/regio-hi.c: New negative test.
* gcc.target/pru/regio-qi.c: New negative test.
* gcc.target/pru/regio.c: New test.
* gcc.target/pru/regio.h: New helper header.
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
GCC Administrator [Sat, 25 Sep 2021 00:16:20 +0000 (00:16 +0000)]
Daily bump.
Andrew Burgess [Tue, 7 Sep 2021 14:46:31 +0000 (15:46 +0100)]
top-level: merge Makefile.def patches from binutils-gdb repository
This commit back-ports two patches to Makefile.def from the
binutils-gdb repository, these patches were committed over there
without first being merged in to the gcc repository.
These commits all relate to dependencies for binutils-gdb modules, so
should have no impact on gcc, I tested a gcc build/install on x86-64
GNU/Linux, and everything looked OK.
The two patches being backported are binutils-gdb commits:
commit
ba4d88ad892fe29c6ca7938c8861f8edef5f7a3f (gdb-gnulib-issues)
Date: Mon Oct 12 16:04:32 2020 +0100
gdb/gdbserver: add dependencies for distclean-gnulib
And
commit
755ba58ebef02e1be9fc6770d00243ba6ed0223c
Date: Thu Mar 18 12:37:52 2021 +0000
Add install dependencies for ld -> bfd and libctf -> bfd
2021-09-07 Andrew Burgess <andrew.burgess@embecosm.com>
* Makefile.def: Back-port commits
ba4d88ad892f and
755ba58ebef0 from binutils-gdb repository.
* Makefile.in: Regenerated.
Harald Anlauf [Fri, 24 Sep 2021 17:10:15 +0000 (19:10 +0200)]
Fortran - improve checking for intrinsics allowed in constant expressions
gcc/fortran/ChangeLog:
PR fortran/102458
* expr.c (is_non_constant_intrinsic): Check for intrinsics
excluded in constant expressions (F2018:10.1.2).
(gfc_is_constant_expr): Use that check.
gcc/testsuite/ChangeLog:
PR fortran/102458
* gfortran.dg/pr102458.f90: New test.
Sandra Loosemore [Thu, 23 Sep 2021 22:00:43 +0000 (15:00 -0700)]
Fortran: Add missing diagnostic for F2018 C711 (TS29113 C407c)
2021-09-24 Sandra Loosemore <sandra@codesourcery.com>
PR fortran/101333
gcc/fortran/
* interface.c (compare_parameter): Enforce F2018 C711.
gcc/testsuite/
* gfortran.dg/c-interop/c407c-1.f90: Remove xfails.
Patrick Palka [Fri, 24 Sep 2021 16:36:26 +0000 (12:36 -0400)]
real: fix encoding of negative IEEE double/quad values [PR98216]
In encode_ieee_double/quad, the assignment
unsigned long WORD = r->sign << 31;
is intended to set the 31st bit of WORD whenever the sign bit is set.
But on LP64 hosts it also unintentionally sets the upper 32 bits of WORD,
because r->sign gets promoted from unsigned:1 to int and then the result
of the shift (equal to INT_MIN) gets sign extended from int to long.
In the C++ frontend, this bug causes incorrect mangling of negative
floating point values because the output of real_to_target called from
write_real_cst unexpectedly has the upper 32 bits of this word set,
which the caller doesn't mask out.
This patch fixes this by avoiding the unwanted sign extension. Note
that r0-53976 fixed the same bug in encode_ieee_single long ago.
PR c++/98216
PR c++/91292
gcc/ChangeLog:
* real.c (encode_ieee_double): Avoid unwanted sign extension.
(encode_ieee_quad): Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/nontype-float2.C: New test.
Vladimir N. Makarov [Fri, 24 Sep 2021 14:06:45 +0000 (10:06 -0400)]
Make profitability calculation of RA conflict presentations independent of host compiler type sizes. [PR102147]
gcc/ChangeLog:
2021-09-24 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/102147
* ira-build.c (ira_conflict_vector_profitable_p): Make
profitability calculation independent of host compiler pointer and
IRA_INT_BITS sizes.
Aldy Hernandez [Fri, 24 Sep 2021 10:42:05 +0000 (12:42 +0200)]
path solver: Avoid further lookups when range is defined in block.
If an SSA is defined in the current block, there is no need to query
range_on_path_entry for additional information.
gcc/ChangeLog:
* gimple-range-path.cc (path_range_query::path_range_query):
Move debugging header...
(path_range_query::precompute_ranges): ...here.
(path_range_query::internal_range_of_expr): Do not call
range_on_path_entry if NAME is defined in the current block.
Jonathan Wakely [Fri, 24 Sep 2021 10:30:59 +0000 (11:30 +0100)]
libstdc++: Remove redundant 'inline' specifiers
These functions are constexpr, which means they are implicitly inline.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
* include/bits/range_access.h (cbegin, cend): Remove redundant
'inline' specifier.
Richard Biener [Fri, 24 Sep 2021 08:13:45 +0000 (10:13 +0200)]
Verify unallocated edge/BB flags are clear
This adds verification that unused auto_{edge,bb}_flag are not
remaining set but correctly cleared by consumers. The intent
is that those flags can be cheaply used on a smaller IL region
and thus afterwards clearing can be restricted to the same
small region as well.
2021-09-24 Richard Biener <rguenther@suse.de>
* cfghooks.c (verify_flow_info): Verify unallocated BB and
edge flags are not set.
Tobias Burnus [Fri, 24 Sep 2021 07:30:51 +0000 (09:30 +0200)]
Fortran: Improve file-reading error diagnostic [PR55534]
PR fortran/55534
gcc/fortran/ChangeLog:
* scanner.c (load_file): Return void, call (gfc_)fatal_error for
all errors.
(include_line, include_stmt, gfc_new_file): Remove exit call
for failed load_file run.
gcc/testsuite/ChangeLog:
* gfortran.dg/include_9.f90: Add dg-prune-output.
* gfortran.dg/include_23.f90: New test.
* gfortran.dg/include_24.f90: New test.
Aldy Hernandez [Thu, 23 Sep 2021 08:59:24 +0000 (10:59 +0200)]
Avoid invalid loop transformations in jump threading registry.
My upcoming improvements to the forward jump threader make it thread
more aggressively. In investigating some "regressions", I noticed
that it has always allowed threading through empty latches and across
loop boundaries. As we have discussed recently, this should be avoided
until after loop optimizations have run their course.
Note that this wasn't much of a problem before because DOM/VRP
couldn't find these opportunities, but with a smarter solver, we trip
over them more easily.
Because the forward threader doesn't have an independent localized cost
model like the new threader (profitable_path_p), it is difficult to
catch these things at discovery. However, we can catch them at
registration time, with the added benefit that all the threaders
(forward and backward) can share the handcuffs.
This patch is an adaptation of what we do in the backward threader, but
it is not meant to catch everything we do there, as some of the
restrictions there are due to limitations of the different block
copiers (for example, the generic copier does not re-use existing
threading paths).
We could ideally remove the now redundant bits in profitable_path_p, but
I would prefer not to for two reasons. First, the backward threader uses
profitable_path_p as it discovers paths to avoid discovering paths in
unprofitable directions. Second, I would like to merge all the forward
cost restrictions into the profitability class in the backward threader,
not the other way around. Alas, that reshuffling will have to wait for
the next release.
As usual, there are quite a few tests that needed adjustments. It seems
we were quite happily threading improper scenarios. With most of them,
as can be seen in pr77445-2.c, we're merely shifting the threading to
after loop optimizations.
Tested on x86-64 Linux.
gcc/ChangeLog:
* tree-ssa-threadupdate.c (jt_path_registry::cancel_invalid_paths):
New.
(jt_path_registry::register_jump_thread): Call
cancel_invalid_paths.
* tree-ssa-threadupdate.h (class jt_path_registry): Add
cancel_invalid_paths.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/
20030714-2.c: Adjust.
* gcc.dg/tree-ssa/pr66752-3.c: Adjust.
* gcc.dg/tree-ssa/pr77445-2.c: Adjust.
* gcc.dg/tree-ssa/ssa-dom-thread-18.c: Adjust.
* gcc.dg/tree-ssa/ssa-dom-thread-7.c: Adjust.
* gcc.dg/vect/bb-slp-16.c: Adjust.
Feng Xue [Thu, 23 Sep 2021 01:14:33 +0000 (09:14 +0800)]
Fix value uninitialization in vn_reference_insert_pieces [PR102400]
2021-09-23 Feng Xue <fxue@os.amperecomputing.com>
gcc/
PR tree-optimization/102400
* tree-ssa-sccvn.c (vn_reference_insert_pieces): Initialize
result_vdef to zero value.
Feng Xue [Thu, 23 Sep 2021 00:47:45 +0000 (08:47 +0800)]
Fix null-pointer dereference in delete_dead_or_redundant_call [PR102451]
2021-09-23 Feng Xue <fxue@os.amperecomputing.com>
gcc/
PR tree-optimization/102451
* tree-ssa-dse.c (delete_dead_or_redundant_call): Record bb of stmt
before removal.
Hongyu Wang [Wed, 8 Sep 2021 01:42:29 +0000 (09:42 +0800)]
AVX512FP16: Support cond_op for HFmode
gcc/ChangeLog:
* config/i386/sse.md (cond_<insn><mode>): Extend to support
vector HFmodes.
(cond_mul<mode>): Likewise.
(cond_div<mode>): Likewise.
(cond_<code><mode>): Likewise.
(cond_fma<mode>): Likewise.
(cond_fms<mode>): Likewise.
(cond_fnma<mode>): Likewise.
(cond_fnms<mode>): Likewise.
gcc/testsuite/ChangeLog:
* gcc.target/i386/cond_op_addsubmuldiv__Float16-1.c: New test.
* gcc.target/i386/cond_op_addsubmuldiv__Float16-2.c: Ditto.
* gcc.target/i386/cond_op_fma__Float16-1.c: Ditto.
* gcc.target/i386/cond_op_fma__Float16-2.c: Ditto.
* gcc.target/i386/cond_op_maxmin__Float16-1.c: Ditto.
* gcc.target/i386/cond_op_maxmin__Float16-2.c: Ditto.
GCC Administrator [Fri, 24 Sep 2021 00:16:23 +0000 (00:16 +0000)]
Daily bump.
Sandra Loosemore [Thu, 23 Sep 2021 15:03:52 +0000 (08:03 -0700)]
Fortran: Diagnose default-initialized pointer/allocatable dummies
TS29113 changed what was then C516 in the 2010 Fortran standard (now
C1557 in F2018) from disallowing all of pointer, allocatable, and
optional attributes on dummy arguments to BIND(C) functions, to
disallowing only pointer/allocatable with default-initialization.
gfortran was previously failing to diagnose violations of this
constraint.
2021-09-23 Sandra Loosemore <sandra@codesourcery.com>
PR fortran/101320
gcc/fortran/
* decl.c (gfc_verify_c_interop_param): Handle F2018 C1557,
aka TS29113 C516.
gcc/testsuite/
* gfortran.dg/c-interop/c516.f90: Remove xfails. Add more
tests.
Michel Morin [Tue, 21 Sep 2021 23:04:31 +0000 (08:04 +0900)]
c++: adjust the handling of RID_ATTRIBUTE.
gcc/cp/ChangeLog:
* parser.c (cp_keyword_starts_decl_specifier_p): Do not
handle RID_ATTRIBUTE.
(cp_parser_constructor_declarator_p): Remove now-redundant
checks.
(cp_parser_lambda_declarator_opt): Likewise.
Michel Morin [Thu, 16 Sep 2021 14:29:54 +0000 (23:29 +0900)]
c++: add spellcheck suggestions for typedef etc. [PR77565]
cp_keyword_starts_decl_specifier_p misses many keywords that can
start decl-specifiers. This patch adds support for those keywords.
PR c++/77565
gcc/cp/ChangeLog:
* parser.c (cp_keyword_starts_decl_specifier_p): Handle more
decl-specifiers (typedef/inline/cv/explicit/virtual/friend).
gcc/testsuite/ChangeLog:
* g++.dg/spellcheck-pr77565.C: New test.
Andrew MacLeod [Thu, 23 Sep 2021 13:32:00 +0000 (09:32 -0400)]
Look for a relation between operands only when possible.
Do not look for a relation between 2 operands if there is no range-ops handler.
gcc/
PR tree-optimization/102463
* gimple-range-fold.cc (fold_using_range::relation_fold_and_or): If
there is no range-ops handler, don't look for a relation.
gcc/testsuite/
* gcc.dg/pr102463.c: New.
Andrew MacLeod [Wed, 22 Sep 2021 20:58:22 +0000 (16:58 -0400)]
Create a ranger-local flag for non-executable edges.
Instead of repurposing EDGE_EXECUTABLE, ranger creates a local flag and
ultizes it throughout.
* gimple-range-cache.cc (ranger_cache::ranger_cache): Take
non-executable_edge flag as parameter.
* gimple-range-cache.h (ranger_cache): Adjust prototype.
* gimple-range-gori.cc (gori_compute::gori_compute): Take
non-executable_edge flag as parameter.
(gori_compute::outgoing_edge_range_p): Check new flag.
* gimple-range-gori.h (gori_compute): Adjust prototype.
* gimple-range.cc (gimple_ranger::gimple_ranger): Create new flag.
(gimple_ranger::range_on_edge): Check new flag.
* gimple-range.h (gimple_ranger::non_executable_edge_flag): New.
* gimple-ssa-evrp.c (rvrp_folder): Pass ranger flag to simplifer.
(hybrid_folder::hybrid_folder): Set ranger non-executable flag value.
(hybrid_folder::fold_stmt): Set flag value in the simplifer.
* vr-values.c (simplify_using_ranges::set_and_propagate_unexecutable):
Use not_executable flag if provided inmstead of EDGE_EXECUTABLE.
(simplify_using_ranges::simplify_switch_using_ranges): Clear
EDGE_EXECUTABLE like it originally did.
(simplify_using_ranges::cleanup_edges_and_switches): Clear any
NON_EXECUTABLE flags.
(simplify_using_ranges::simplify_using_ranges): Adjust.
* vr-values.h (class simplify_using_ranges): Adjust.
(simplify_using_ranges::set_range_query): Add non-executable flag param.
Tobias Burnus [Thu, 23 Sep 2021 16:47:45 +0000 (18:47 +0200)]
Fortran: Handle allocated() with coindexed scalars [PR93834]
While for an allocatable 'array', 'array(:)' and 'array(:)[1]' are
not allocatable, it is believed that not only 'scalar' but also
'scalar[1]' is allocatable. However, coarrays are collectively
established/allocated; thus, 'allocated(scalar[i])' is equivalent
to 'allocated(scalar)'. [At least when assuming that 'i' does not
refer to a failed image.]
2021-09-23 Harald Anlauf <anlauf@gmx.de>
Tobias Burnus <tobias@codesourcery.com>
PR fortran/93834
gcc/fortran/ChangeLog:
* trans-intrinsic.c (gfc_conv_allocated): Cleanup. Handle
coindexed scalar coarrays.
gcc/testsuite/ChangeLog:
* gfortran.dg/coarray/coarray_allocated.f90: New test.
Luís Ferreira [Thu, 23 Sep 2021 15:54:00 +0000 (11:54 -0400)]
libiberty: prevent null dereferencing on dlang_type
libiberty/
* d-demangle.c (dlang_Type): Validate MANGLED is nonnull.
* testsuite/d-demangle-expected: New test.
Luís Ferreira [Thu, 23 Sep 2021 15:33:47 +0000 (11:33 -0400)]
libiberty: prevent buffer overflow when decoding user input
libiberty/
* d-demangle.c (dlang_symbol_backref): Ensure strlen of
string is less than length computed by dlang_number.
Jonathan Wakely [Wed, 22 Sep 2021 17:15:24 +0000 (18:15 +0100)]
libstdc++: Remove c++20-specific dg-error directives in test
I added extra dg-error directives for C++20 to match the extra errors
caused by some of the call stack being constexpr in C++20. Since Jason's
changes to reduce those errors, those dg-error lines no longer match.
This removes them again.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
* testsuite/20_util/specialized_algorithms/memory_management_tools/destroy_neg.cc:
Remove dg-error lines for C++20-only errors.
Jonathan Wakely [Wed, 22 Sep 2021 13:11:54 +0000 (14:11 +0100)]
libstdc++: Disable PCH for test that depends on a macro being defined
This test tries to ensure that <system_error> can be included after
defining _XOPEN_SOURCE=600, which doesn't test anything if that header
is already included via the <bits/stdc++.h> PCH before the macro
definition. Disable PCH so that it behaves as intended.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
* testsuite/19_diagnostics/headers/system_error/93151.cc:
Disable PCH.
Jonathan Wakely [Wed, 10 Feb 2021 16:10:46 +0000 (16:10 +0000)]
libstdc++: Make std::system_category() recognize Windows error codes
The std::system_category error category should be used for
system-specific error codes, which means on Windows it should be used
for Windows error codes. Currently that category assumes that the error
numbers it deals with are errno numbers, which means that
ERROR_ACCESS_DENIED (which has value 0x5) gets treated as whichever
errno number happens to have that value (EIO on mingw32-w64).
This adds a mapping from known Windows error codes to generic errno
ones. This means we correctly treat ERROR_ACCESS_DENIED as corresponding
to EACCES.
Also make std::system_category().message(int) return the right message
for Windows errors, by using FormatMessage instead of strerror. The
output of FormatMessage includes ".\r\n" at the end, so we strip that
off to allow the message to be used in contexts where that would be
problematic.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
* src/c++11/system_error.cc (system_error_category) [_WIN32]:
Map Windows error codes to generic POSIX error numbers. Use
FormatMessage instead of strerror.
* testsuite/19_diagnostics/error_category/system_category.cc:
Adjust for new behaviour on Windows.
Jonathan Wakely [Wed, 22 Sep 2021 12:56:21 +0000 (13:56 +0100)]
libstdc++: Improvements to standard error category objects
This ensures that the objects returned by std::generic_category() and
std::system_category() are initialized before any code starts executing,
and are not destroyed at the end of the program. This means it is always
safe to access them, even during startup and termination. See LWG 2992
and P1195R0 for further discussion of this.
Additionally, make the types of those objects final, which might
potentially allow additional devirtualization opportunities. The types
are not visible to users, so there is no way they can derive from them,
so making them final has no semantic change.
Finally, add overrides for equivalent(int, const error_condition&) to
those types, to avoid the second virtual call that would be performed by
the base class definition of the function. Because we know what
default_error_condition(int) does for the derived type, we don't need to
make a virtual call.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
* src/c++11/system_error.cc (generic_error_category): Define
class and virtual functions as 'final'.
(generic_error_category::equivalent(int, const error_condition&)):
Override.
(system_error_category): Define class and virtual functions as
'final'.
(system_error_category::equivalent(int, const error_condition&)):
Override.
(generic_category_instance, system_category_instance): Use
constinit union to make the objects immortal.
Jonathan Wakely [Wed, 22 Sep 2021 10:58:20 +0000 (11:58 +0100)]
libstdc++: std::system_category should know meaning of zero [PR102425]
Although 0 is not an errno value, it should still be recognized as
corresponding to a value belonging to the generic_category().
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
PR libstdc++/102425
* src/c++11/system_error.cc
(system_error_category::default_error_condition): Add 0 to
switch.
* testsuite/19_diagnostics/error_category/102425.cc: New test.
Patrick Palka [Thu, 23 Sep 2021 13:36:14 +0000 (09:36 -0400)]
c++: improve tree dump for templated decls
gcc/cp/ChangeLog:
* ptree.c (cxx_print_decl): Dump the DECL_TEMPLATE_RESULT of
a TEMPLATE_DECL. Dump the DECL_TEMPLATE_INFO rather than just
printing its pointer value.
Eric Botcazou [Thu, 15 Jul 2021 20:42:26 +0000 (22:42 +0200)]
[Ada] Fix obsolete comment mentioning girder discriminants
gcc/ada/
* gcc-interface/decl.c (gnat_to_gnu_entity): Fix comment.
Richard Kenner [Sat, 31 Jul 2021 21:46:56 +0000 (17:46 -0400)]
[Ada] Add Subprogram_Body_Or_Type
gcc/ada/
* gen_il-gen-gen_entities.adb (Subprogram_Body_Or_Type): Add.
* gen_il-types.ads (Subprogram_Body_Or_Type): Likewise.
Richard Kenner [Sat, 31 Jul 2021 15:02:47 +0000 (11:02 -0400)]
[Ada] Add N_Has_Bounds and N_Is_Index
gcc/ada/
* einfo-utils.adb (Next_Index): Verify input and output are
N_Is_Index.
* gen_il-gen-gen_nodes.adb (N_Has_Bounds, N_Is_Index): Add.
* gen_il-types.ads (N_Has_Bounds, N_Is_Index): Likewise.
* sem_ch3.adb (Array_Type_Declaration): Use Next, not
Next_Index.
* sem_ch12.adb (Formal_Dimensions): Likewise.
* sem_util.adb (Is_Valid_Renaming): Likewise.
Eric Botcazou [Tue, 3 Aug 2021 10:37:38 +0000 (12:37 +0200)]
[Ada] Adjust documentation of gnatsymbolize
gcc/ada/
* doc/gnat_ugn/gnat_utility_programs.rst (gnatsymbolize):
Document new --load option and -g1 as minimal compilation
requirement.
Piotr Trojanek [Tue, 27 Jul 2021 13:00:39 +0000 (15:00 +0200)]
[Ada] Tune detection of internally generated positional aggregates
gcc/ada/
* sem_aggr.adb (Resolve_Array_Aggregate): Only keep the bounds
for internally generated attributes; otherwise, compute them
anew.
Javier Miranda [Mon, 26 Jul 2021 08:55:39 +0000 (04:55 -0400)]
[Ada] Wrappers of access-to-subprograms with pre/post conditions
gcc/ada/
* sem_ch3.adb (Build_Access_Subprogram_Wrapper): Decorate the
wrapper with attribute Is_Wrapper, and move its declaration to
the freezing actions of its type declaration; done to facilitate
identifying it at later stages to avoid handling it as a
primitive operation of a tagged type; otherwise it may be
handled as a dispatching operation and erroneously registered in
a dispatch table.
(Make_Index): Add missing decoration of field Parent.
* sem_disp.adb (Check_Dispatching_Operation): Complete
decoration of late-overriding dispatching primitives.
(Is_Access_To_Subprogram_Wrapper): New subprogram.
(Inherited_Subprograms): Prevent cascaded errors; adding missing
support for private types.
* sem_type.adb (Add_One_Interp): Add missing support for the
first interpretation of a primitive of an inmediate ancestor
interface.
* sem_util.adb (Check_Result_And_Post_State_In_Pragma): Do not
report missing reference in postcondition placed in internally
built wrappers.
* exp_disp.adb (Expand_Dispatching_Call): Adding assertion.
Ed Schonberg [Tue, 27 Jul 2021 14:55:07 +0000 (10:55 -0400)]
[Ada] Ada2022: implementation of AI12-0212 : iterator specs in array aggregates
gcc/ada/
* sem_aggr.adb (Resolve_Array_Aggregate): Check the validity of
an array aggregate all of whose components are iterated
component associations.
* exp_aggr.adb (Expand_Array_Aggregate,
Two_Pass_Aggregate_Expansion): implement two-pass algorithm and
replace original aggregate with resulting temporary, to ensure
that a proper length check is performed if context is
constrained. Use attributes Pos and Val to handle index types of
any discrete type.
Bob Duff [Fri, 30 Jul 2021 20:49:37 +0000 (16:49 -0400)]
[Ada] Follow-on efficiency improvements
gcc/ada/
* gen_il-gen.adb: Set the number of concrete nodes that have the
Homonym field to a higher number than any other field. This
isn't true, but it forces Homonym's offset to be chosen first,
so it will be at offset zero and hence slot zero.
Richard Kenner [Tue, 27 Jul 2021 16:23:23 +0000 (12:23 -0400)]
[Ada] If unnesting and relocating subprogram call, make new Parameter_Associations
gcc/ada/
* atree.adb (Relocate_Node): If relocating a subprgram call and
we're doing unnesting, make a new Parameter_Associations, if
any.
Piotr Trojanek [Wed, 28 Jul 2021 13:16:09 +0000 (15:16 +0200)]
[Ada] Remove Initializes contracts from Ada.Strings.Bounded
gcc/ada/
* libgnat/a-strbou.ads (Generic_Bounded_Length): Remove explicit
Initializes contract.
Bob Duff [Thu, 29 Jul 2021 15:15:46 +0000 (11:15 -0400)]
[Ada] Cleanup and efficiency improvements
gcc/ada/
* gen_il-gen.adb: Generate getters and setters with much of the
code inlined. Generate code for storing a few fields in the node
header, to avoid the extra level of indirection for those
fields. We generate the header type, so we don't have to
duplicate hand-written Ada and C code to depend on the number of
header fields. Declare constants for slot size. Use short names
because these are used all over. Remove
Put_Low_Level_Accessor_Instantiations, Put_Low_Level_C_Getter,
which are no longer needed. Rename
Put_High_Level_C_Getter-->Put_C_Getter.
* atree.ads, atree.adb: Take into account the header slots.
Take into account the single Node_Or_Entity_Field type. Remove
"pragma Assertion_Policy (Ignore);", because the routines in
this package are no longer efficiency critical.
* atree.h: Remove low-level getters, which are no longer used by
sinfo.h and einfo.h.
* einfo-utils.adb: Avoid crash in Known_Alignment.
* live.adb, sem_eval.adb: Remove code that prevents Node_Id from
having a predicate. We don't actually add a predicate to
Node_Id, but we want to be able to for temporary debugging.
* sinfo-utils.adb: Remove code that prevents Node_Id from having
a predicate. Take into account the single Node_Or_Entity_Field
type.
* sinfo-utils.ads: Minor.
* table.ads (Table_Type): Make the components aliased, because
low-level setters in Atree need to take 'Access.
* treepr.adb: Take into account the single Node_Or_Entity_Field
type. Make some code more robust, so we can print out
half-baked nodes.
* types.ads: Move types here for visibility purposes.
* gcc-interface/gigi.h, gcc-interface/trans.c: Take into account
the Node_Header change in the GNAT front end.
* gcc-interface/cuintp.c, gcc-interface/targtyps.c: Add because
gigi.h now refers to type Node_Header, which is in sinfo.h.
Yannick Moy [Mon, 26 Jul 2021 10:21:02 +0000 (12:21 +0200)]
[Ada] Minimize parts of Ada.Strings.Fixed marked SPARK_Mode => Off
gcc/ada/
* libgnat/a-strfix.adb (Delete, Insert, Overwrite,
Replace_Slice): Remove SPARK_Mode Off.
* libgnat/a-strfix.ads (Insert, Overwrite, Replace_Slice):
Strengthen precondition.
Piotr Trojanek [Wed, 28 Jul 2021 12:13:58 +0000 (14:13 +0200)]
[Ada] Remove global parameter in Global contracts of Ada.Strings.Bounded
gcc/ada/
* libgnat/a-strbou.ads (Generic_Bounded_Length): Remove non-null
Global contracts.
Steve Baird [Fri, 23 Jul 2021 18:09:05 +0000 (11:09 -0700)]
[Ada] Update "Implementation Defined Characteristics" documentation.
gcc/ada/
* doc/gnat_rm/implementation_defined_characteristics.rst: Update
this section to reflect the current version of Ada RM M.2.
* gnat_rm.texi: Regenerate.
Bill Schmidt [Thu, 23 Sep 2021 12:35:42 +0000 (07:35 -0500)]
rs6000: Add psabi diagnostic for C++ zero-width bit field ABI change
Previously zero-width bit fields were removed from structs, so that otherwise
homogeneous aggregates were treated as such and passed in FPRs and VSRs.
This was incorrect behavior per the ELFv2 ABI. Now that these fields are no
longer being removed, we generate the correct parameter passing code. Alert
the unwary user in the rare cases where this behavior changes.
2021-09-23 Bill Schmidt <wschmidt@linux.ibm.com>
gcc/
PR target/102024
* config/rs6000/rs6000-call.c (rs6000_aggregate_candidate): Detect
zero-width bit fields and return indicator.
(rs6000_discover_homogeneous_aggregate): Diagnose when the
presence of a zero-width bit field changes parameter passing in
GCC 12.
gcc/testsuite/
PR target/102024
* g++.target/powerpc/pr102024.C: New.
Aldy Hernandez [Thu, 23 Sep 2021 07:40:59 +0000 (09:40 +0200)]
Remove dominator check in fold_using_range::range_of_phi.
Revert the following patch, as it was an artifact of diagnostic code
being run with improper IL.
commit
64b80b8819f9ea74712625bceb0ec4388e25f67d
Author: Aldy Hernandez <aldyh@redhat.com>
Date: Tue Sep 21 08:28:28 2021 +0200
Do not query SCEV in range_of_phi unless dominators are available.
SCEV won't work without dominators and we can get called without
dominators from debug_ranger.
gcc/ChangeLog:
* gimple-range-fold.cc (fold_using_range::range_of_phi):
Remove dominator check.
Aldy Hernandez [Thu, 23 Sep 2021 07:37:00 +0000 (09:37 +0200)]
Hoist edge calculations in precompute_relations.
Tested on x86-64 Linux.
gcc/ChangeLog:
* gimple-range-path.cc (path_range_query::precompute_relations):
Hoist edge calculations before using EDGE_SUCC.
Jonathan Wakely [Thu, 23 Sep 2021 10:30:14 +0000 (11:30 +0100)]
configure: Update --help output for --with-multilib-list
The list of architectures that support the option is incomplete.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Jim Wilson <jimw@sifive.com>
gcc/ChangeLog:
* configure.ac: Fix --with-multilib-list description.
* configure: Regenerate.
Richard Biener [Thu, 23 Sep 2021 08:27:01 +0000 (10:27 +0200)]
tree-optimization/102448 - clear copied alignment info from vect
This fixes the previous change which removed setting alignment info
from the vectorizers idea of how a pointer is being used but left
in place the copied info from DR_PTR_INFO without realizing that this
is in fact _not_ the alignment of the access but the alignment of
a base pointer contained in it.
The following makes sure to not use that info.
2021-09-23 Richard Biener <rguenther@suse.de>
PR tree-optimization/102448
* tree-vect-data-refs.c (vect_duplicate_ssa_name_ptr_info):
Clear alignment info copied from DR_PTR_INFO.
Hongyu Wang [Fri, 16 Jul 2021 02:01:17 +0000 (10:01 +0800)]
AVX512FP16: Enable vec_cmpmn/vcondmn expanders for HF modes.
gcc/ChangeLog:
* config/i386/i386-expand.c (ix86_use_mask_cmp_p): Enable
HFmode mask_cmp.
* config/i386/sse.md (sseintvecmodelower): Add HF vector modes.
(<avx512>_store<mode>_mask): Extend to support HF vector modes.
(vec_cmp<mode><avx512fmaskmodelower>): Likewise.
(vcond_mask_<mode><avx512fmaskmodelower>): Likewise.
(vcond<mode><mode>): New expander.
(vcond<mode><sseintvecmodelower>): Likewise.
(vcond<sseintvecmodelower><mode>): Likewise.
(vcondu<mode><sseintvecmodelower>): Likewise.
gcc/testsuite/ChangeLog:
* g++.target/i386/avx512fp16-vcondmn-vec.C: New test.
* g++.target/i386/avx512fp16-vcondmn-minmax.C: Ditto.
* gcc.target/i386/avx512fp16-vcondmn-loop-1.c: Ditto.
* gcc.target/i386/avx512fp16-vcondmn-loop-2.c: Ditto.
* gcc.target/i386/avx512fp16-vec_cmpmn.c: Ditto.
Hongyu Wang [Mon, 12 Jul 2021 06:02:10 +0000 (14:02 +0800)]
AVX512FP16: add truncmn2/extendmn2 expanders
gcc/ChangeLog:
* config/i386/sse.md (extend<ssePHmodelower><mode>2):
New expander.
(extendv4hf<mode>2): Likewise.
(extendv2hfv2df2): Likewise.
(trunc<mode><ssePHmodelower>2): Likewise.
(avx512fp16_vcvt<castmode>2ph_<mode>): Rename to ...
(trunc<mode>v4hf2): ... this, and drop constraints.
(avx512fp16_vcvtpd2ph_v2df): Rename to ...
(truncv2dfv2hf2): ... this, and likewise.
gcc/testsuite/ChangeLog:
* gcc.target/i386/avx512fp16-trunc-extendvnhf.c: New test.
Hongyu Wang [Mon, 12 Jul 2021 01:45:33 +0000 (09:45 +0800)]
AVX512FP16: Add float(uns)?mn2 expander
gcc/ChangeLog:
* config/i386/sse.md (float<floatunssuffix><mode><ssePHmodelower>2):
New expander.
(avx512fp16_vcvt<floatsuffix><sseintconvert>2ph_<mode>):
Rename to ...
(float<floatunssuffix><mode>v4hf2): ... this, and drop constraints.
(avx512fp16_vcvt<floatsuffix>qq2ph_v2di): Rename to ...
(float<floatunssuffix>v2div2hf2): ... this, and likewise.
gcc/testsuite/ChangeLog:
* gcc.target/i386/avx512fp16-floatvnhf.c: New test.
Hongyu Wang [Thu, 1 Jul 2021 05:17:32 +0000 (13:17 +0800)]
AVX512FP16: Add fix(uns)?_truncmn2 for HF scalar and vector modes
NB: 64bit/32bit vectorize for HFmode is not supported for now, will
adjust this patch when V2HF/V4HF operations supported.
gcc/ChangeLog:
* config/i386/i386.md (fix<fixunssuffix>_trunchf<mode>2): New expander.
(fixuns_trunchfhi2): Likewise.
(*fixuns_trunchfsi2zext): New define_insn.
* config/i386/sse.md (ssePHmodelower): New mode_attr.
(fix<fixunssuffix>_trunc<ssePHmodelower><mode>2):
New expander for same element vector fix_truncate.
(fix<fixunssuffix>_trunc<ssePHmodelower><mode>2):
Likewise for V4HF to V4SI/V4DI fix_truncate.
(fix<fixunssuffix>_truncv2hfv2di2):
Likeise for V2HF to V2DI fix_truncate.
gcc/testsuite/ChangeLog:
* gcc.target/i386/avx512fp16-trunchf.c: New test.
* gcc.target/i386/avx512fp16-truncvnhf.c: Ditto.
Hongyu Wang [Sat, 18 Sep 2021 05:56:37 +0000 (13:56 +0800)]
AVX512FP16: Add expander for smin/maxhf3.
gcc/ChangeLog:
* config/i386/i386.md (<code>hf3): New expander.
gcc/testsuite/ChangeLog:
* gcc.target/i386/avx512fp16-builtin-minmax-1.c: New test.
liuhongt [Tue, 14 Jul 2020 06:45:32 +0000 (14:45 +0800)]
AVX512FP16: Add expander for fmahf4
gcc/ChangeLog:
* config/i386/sse.md (FMAMODEM): extend to handle FP16.
(VFH_SF_AVX512VL): Extend to handle HFmode.
(VF_SF_AVX512VL): Deleted.
gcc/testsuite/ChangeLog:
* gcc.target/i386/avx512fp16-fma-1.c: New test.
* gcc.target/i386/avx512fp16vl-fma-1.c: New test.
* gcc.target/i386/avx512fp16vl-fma-vectorize-1.c: New test.
liuhongt [Wed, 22 Sep 2021 07:03:36 +0000 (15:03 +0800)]
AVX512FP16: Add expander for rint/nearbyinthf2.
gcc/ChangeLog:
* config/i386/i386.md (rinthf2): New expander.
(nearbyinthf2): New expander.
gcc/testsuite/ChangeLog:
* gcc.target/i386/avx512fp16-builtin-round-1.c: Add new testcase.
Jakub Jelinek [Thu, 23 Sep 2021 08:07:49 +0000 (10:07 +0200)]
openmp: Diagnose omp::directive attribute without balanced token argument [PR102413]
If omp::directive attribute argument starting with the opening ( is not a balanced
token sequence, then cp_parser_skip_balanced_tokens (parser, 1) returns 1,
but the code was subtracting 2 from it and iterating until it was 0, so for the
non-balanced case it iterated from (size_t) -1 down to 0.
The following patch just diagnoses that as an error.
2021-09-23 Jakub Jelinek <jakub@redhat.com>
PR c++/102413
* parser.c (cp_parser_omp_directive_args): Diagnose if omp::directive
is not followed by a balanced token sequence starting with open paren.
* g++.dg/gomp/attrs-14.C: New test.
Aldy Hernandez [Wed, 22 Sep 2021 16:10:43 +0000 (18:10 +0200)]
Overhaul jump thread state in forward threader.
I've been pulling state from across the forward jump threader into the
jt_state class, but it it still didn't feel right. The ultimate goal
was to keep track of candidate threading paths so that the simplifier
could simplify statements with the path as context. This patch completes
the transition, while cleaning up a lot of things in the process.
I've revamped both state and the simplifier such that a base state class
contains only the blocks as they're registered, and any pass specific
knowledge is where it belongs... in the pass. This allows VRP to keep
its const and copies business, and DOM to keep this as well as its evrp
client. This makes the threader cleaner, as it will now have no knowledge
of either const/copies or evrp.
This also paves the wave for the upcoming hybrid threader, which will
just derive the state class and provide almost nothing, since the ranger
doesn't need to register any equivalences or ranges as it folds.
There is some code duplication in the simplifier, since both the DOM and
VRP clients use a vr_values based simplifier, but this is temporary as
the VRP client is about to be replaced with a hybrid ranger.
For a better view of what this patch achieves, here are the base
classes:
class jt_state
{
public:
virtual ~jt_state () { }
virtual void push (edge);
virtual void pop ();
virtual void register_equiv (tree dest, tree src, bool update_range =
false);
virtual void register_equivs_edge (edge e);
virtual void register_equivs_stmt (gimple *, basic_block,
class jt_simplifier *);
virtual void record_ranges_from_stmt (gimple *stmt, bool temporary);
void get_path (vec<basic_block> &);
void append_path (basic_block);
void dump (FILE *);
void debug ();
private:
auto_vec<basic_block> m_blocks;
};
class jt_simplifier
{
public:
virtual ~jt_simplifier () { }
virtual tree simplify (gimple *, gimple *, basic_block, jt_state *) =
0;
};
There are no functional changes.
gcc/ChangeLog:
* tree-ssa-dom.c (class dom_jump_threader_simplifier): Rename...
(class dom_jt_state): ...this and provide virtual overrides.
(dom_jt_state::register_equiv): New.
(class dom_jt_simplifier): Rename from
dom_jump_threader_simplifier.
(dom_jump_threader_simplifier::simplify): Rename...
(dom_jt_simplifier::simplify): ...to this.
(pass_dominator::execute): Use dom_jt_simplifier and
dom_jt_state.
* tree-ssa-threadedge.c (jump_threader::jump_threader):
Clean-up.
(jt_state::register_equivs_stmt): Abstract out...
(jump_threader::record_temporary_equivalences_from_stmts_at_dest):
...from here.
(jump_threader::thread_around_empty_blocks): Update state.
(jump_threader::thread_through_normal_block): Same.
(jt_state::jt_state): Remove.
(jt_state::push): Remove pass specific bits. Keep block vector
updated.
(jt_state::append_path): New.
(jt_state::pop): Remove pass specific bits.
(jt_state::register_equiv): Same.
(jt_state::record_ranges_from_stmt): Same.
(jt_state::register_equivs_on_edge): Same. Rename...
(jt_state::register_equivs_edge): ...to this.
(jt_state::dump): New.
(jt_state::debug): New.
(jump_threader_simplifier::simplify): Remove.
(jt_state::get_path): New.
* tree-ssa-threadedge.h (class jt_simplifier): Make into a base
class. Expose common functionality as virtual methods.
(class jump_threader_simplifier): Same. Rename...
(class jt_simplifier): ...to this.
* tree-vrp.c (class vrp_jump_threader_simplifier): Rename...
(class vrp_jt_simplifier): ...to this. Provide pass specific
overrides.
(class vrp_jt_state): New.
(vrp_jump_threader_simplifier::simplify): Rename...
(vrp_jt_simplifier::simplify): ...to this. Inline code from
what used to be the base class.
(vrp_jump_threader::vrp_jump_threader): Use vrp_jt_state and
vrp_jt_simplifier.
GCC Administrator [Thu, 23 Sep 2021 00:16:29 +0000 (00:16 +0000)]
Daily bump.
Sandra Loosemore [Wed, 22 Sep 2021 14:49:17 +0000 (07:49 -0700)]
Fortran: diagnostic for argument w/type parameters for assumed-type dummy
2021-09-22 Sandra Loosemore <sandra@codesourcery.com>
PR fortran/101319
gcc/fortran/
* interface.c (gfc_compare_actual_formal): Extend existing
assumed-type diagnostic to also check for argument with type
parameters.
gcc/testsuite/
* gfortran.dg/c-interop/assumed-type-dummy.f90: Remove xfail.
Sandra Loosemore [Mon, 20 Sep 2021 00:32:03 +0000 (17:32 -0700)]
Fortran: Fixes for F2018 C838 (PR fortran/101334)
The compiler was failing to diagnose the error required by F2018 C838
when passing an assumed-rank array argument to a non-assumed-rank dummy.
It was also incorrectly giving an error for calls to the 2-argument form
of the ASSOCIATED intrinsic, which is supposed to be permitted by C838.
2021-09-19 Sandra Loosemore <sandra@codesourcery.com>
PR fortran/101334
gcc/fortran/
* check.c (gfc_check_associated): Allow an assumed-rank
array for the pointer argument.
* interface.c (compare_parameter): Also give rank mismatch
error on assumed-rank array.
gcc/testsuite/
* gfortran.dg/c-interop/c535b-2.f90: Remove xfails.
* gfortran.dg/c-interop/c535b-3.f90: Likewise.
Sandra Loosemore [Mon, 20 Sep 2021 00:23:58 +0000 (17:23 -0700)]
Fortran: Fix testcases that violate C838, + revealed ICE
The three test cases fixed in this patch violated F2018 C838, which
only allows passing an assumed-rank argument to an assumed-rank dummy.
Wrapping the call in "select rank" revealed a null pointer dereference
which is fixed by guarding the use of the result of
GFC_DECL_SAVED_DESCRIPTOR similar to what is already done elsewhere.
2021-09-19 Sandra Loosemore <sandra@codesourcery.com>
gcc/fortran/
* trans-stmt.c (trans_associate_var): Check that result of
GFC_DECL_SAVED_DESCRIPTOR is not null before using it.
gcc/testsuite/
* gfortran.dg/assumed_rank_18.f90 (g): Wrap call to h in
select rank.
* gfortran.dg/assumed_type_10.f90 (test_array): Likewise for
call to test_lib.
* gfortran.dg/assumed_type_11.f90 (test_array): Likewise.
Tobias Burnus [Wed, 22 Sep 2021 18:58:35 +0000 (20:58 +0200)]
Fortran: Improve -Wmissing-include-dirs warnings [PR55534]
It turned out that enabling the -Wmissing-include-dirs for libcpp did output
too many warnings – at least as run with -B and similar options during the
GCC build and warning for internal include dirs like finclude, unlikely of
relevance to for a real-world user.
This patch now only warns for -I and -J by default but permits to get the
full warnings including libcpp ones with -Wmissing-include-dirs. It
additionally documents this in the manual.
With that change, the -Wno-missing-include-dirs could be removed
from libgfortran's configure and libgomp's testsuite always cflags.
This reverts those bits of the previous
commit r12-3722-g417ea5c02cef7f000e66d1af22b066c2c1cda047
Additionally, it turned out that all call to load_file called exit
explicitly - except for the main file via gfc_init -> gfc_new_file. The
latter also output a file not existing fatal error, such that two errors
where printed. Now exit is called in line with the other users of
load_file.
Finally, when compileing with "nonexisting/file.f90", first a warning that
"nonexisting" does not exist as include path was printed before the file
not found error was printed. Now the directory in which the physical file
is located is added silently, relying on the file-not-found diagnostic for
those.
PR fortran/55534
gcc/ChangeLog:
* doc/invoke.texi (-Wno-missing-include-dirs.): Document Fortran
behavior.
gcc/fortran/ChangeLog:
* cpp.c (gfc_cpp_register_include_paths, gfc_cpp_post_options):
Add new bool verbose_missing_dir_warn argument.
* cpp.h (gfc_cpp_post_options): Update prototype.
* f95-lang.c (gfc_init): Remove duplicated file-not found diag.
* gfortran.h (gfc_check_include_dirs): Takes bool
verbose_missing_dir_warn arg.
(gfc_new_file): Returns now void.
* options.c (gfc_post_options): Update to warn for -I and -J,
only, by default but for all when user requested.
* scanner.c (gfc_do_check_include_dir):
(gfc_do_check_include_dirs, gfc_check_include_dirs): Take bool
verbose warn arg and update to avoid printing the same message
twice or never.
(load_file): Fix indent.
(gfc_new_file): Return void and exit when load_file failed
as all other load_file users do.
libgfortran/ChangeLog:
* configure.ac (AM_FCFLAGS): Revert r12-3722 by removing
-Wno-missing-include-dirs.
* configure: Regenerate.
libgomp/ChangeLog:
* testsuite/libgomp.fortran/fortran.exp (ALWAYS_CFLAGS): Revert
r12-3722 by removing -Wno-missing-include-dirs.
* testsuite/libgomp.oacc-fortran/fortran.exp (ALWAYS_CFLAGS): Likewise.
gcc/testsuite/ChangeLog:
* gfortran.dg/include_14.f90: Add -J testcase and update dg-output.
* gfortran.dg/include_15.f90: Likewise.
* gfortran.dg/include_16.f90: Likewise.
* gfortran.dg/include_17.f90: Likewise.
* gfortran.dg/include_18.f90: Likewise.
* gfortran.dg/include_19.f90: Likewise.
Roger Sayle [Wed, 22 Sep 2021 18:17:49 +0000 (19:17 +0100)]
More NEGATE_EXPR folding in match.pd
As observed by Jakub in comment #2 of PR 98865, the expression -(a>>63)
is optimized in GENERIC but not in GIMPLE. Investigating further it
turns out that this is one of a few transformations performed by
fold_negate_expr in fold-const.c that aren't yet performed by match.pd.
This patch moves/duplicates them there, and should be relatively safe
as these transformations are already performed by the compiler, but
just in different passes.
This revised patch adds a Boolean simplify argument to tree-ssa-sccvn.c's
vn_nary_build_or_lookup_1 to control whether simplification should be
performed before value numbering, updating the callers, but then
avoiding simplification when constructing/value-numbering NEGATE_EXPR.
This avoids the regression of gcc.dg/tree-ssa/ssa-free-88.c, and enables
the new test case(s) to pass.
2021-09-22 Roger Sayle <roger@nextmovesoftware.com>
Richard Biener <rguenther@suse.de>
gcc/ChangeLog
* match.pd (negation simplifications): Implement some negation
folding transformations from fold-const.c's fold_negate_expr.
* tree-ssa-sccvn.c (vn_nary_build_or_lookup_1): Add a SIMPLIFY
argument, to control whether the op should be simplified prior
to looking up/assigning a value number.
(vn_nary_build_or_lookup): Update call to vn_nary_build_or_lookup_1.
(vn_nary_simplify): Likewise.
(visit_nary_op): Likewise, but when constructing a NEGATE_EXPR
now call vn_nary_build_or_lookup_1 disabling simplification.
gcc/testsuite/ChangeLog
* gcc.dg/fold-negate-1.c: New test case.
H.J. Lu [Mon, 20 Sep 2021 14:48:05 +0000 (07:48 -0700)]
x86: Clean up gcc.target/i386/auto-init-* tests
1. Replace ia32 with { ! lp64 } to enable ILP32 tests for -mx32.
2. Replace lp64 with { ! ia32 } to enable x86-64 ISA tests for -mx32.
3. For auto-init-3.c, add -msse and -mfpmath=387 for ia32.
* gcc.target/i386/auto-init-2.c: Replace ia32 with { ! lp64 }.
* gcc.target/i386/auto-init-3.c (dg-options): Add -msse.
(dg-additional-options): Add -mfpmath=387 for ia32.
Replace lp64 with { ! ia32 }. Add a space after ia32.
* gcc.target/i386/auto-init-4.c: Replace lp64 with { ! ia32 }.
* gcc.target/i386/auto-init-5.c: Likewise.
* gcc.target/i386/auto-init-padding-3.c: Likewise.
* gcc.target/i386/auto-init-padding-7.c: Likewise.
* gcc.target/i386/auto-init-padding-8.c: Likewise.
* gcc.target/i386/auto-init-padding-9.c: Likewise.
Patrick Palka [Wed, 22 Sep 2021 15:16:53 +0000 (11:16 -0400)]
c++: concept-ids and value-dependence [PR102412]
The problem here is that uses_template_parms returns true for all
concept-ids (even those with non-dependent arguments), so when a concept-id
is used as a default template argument then during deduction the default
argument is considered dependent even after substituting into it, which
leads to deduction failure (from type_unification_real).
This patch fixes this by implementing the resolution of CWG 2446 which
says a concept-id is dependent only if its arguments are.
DR 2446
PR c++/102412
gcc/cp/ChangeLog:
* constexpr.c (cxx_eval_constant_expression)
<case TEMPLATE_ID_EXPR>: Check value_dependent_expression_p
instead of processing_template_decl.
* pt.c (value_dependent_expression_p) <case TEMPLATE_ID_EXPR>:
Return true only if any_dependent_template_arguments_p.
(instantiation_dependent_r) <case CALL_EXPR>: Remove this case.
<case TEMPLATE_ID_EXPR>: Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-nondep2.C: New test.
* g++.dg/cpp2a/concepts-nondep3.C: New test.
Yannick Moy [Tue, 27 Jul 2021 13:57:04 +0000 (15:57 +0200)]
[Ada] Simplify contract of Ada.Strings.Fixed.Trim for proof
gcc/ada/
* libgnat/a-strfix.ads (Trim): Simplify contracts.
* libgnat/a-strfix.adb (Trim): Remove white space.
Piotr Trojanek [Mon, 26 Jul 2021 21:16:13 +0000 (23:16 +0200)]
[Ada] Reuse routines for detecting attributes Old and Result
gcc/ada/
* exp_ch4.adb (Expand_N_Op_Eq): Reuse Is_Attribute_Result.
* exp_prag.adb (Expand_Attributes): Reuse Is_Attribute_Old.
Yannick Moy [Tue, 27 Jul 2021 10:20:41 +0000 (12:20 +0200)]
[Ada] Spurious error on deferred constant with predicate
gcc/ada/
* sem_ch3.adb (Analyze_Object_Declaration): Do not insert a
predicate check after a deferred constant declaration.
Bob Duff [Mon, 26 Jul 2021 19:26:28 +0000 (15:26 -0400)]
[Ada] Fix conformance errors and erroneous code
gcc/ada/
* contracts.adb, einfo-utils.adb, einfo-utils.ads, exp_ch7.adb,
exp_ch9.adb, exp_disp.adb, exp_prag.adb, exp_smem.adb,
exp_util.adb, freeze.adb, sem_aggr.adb, sem_attr.adb,
sem_ch8.adb, sem_prag.ads, sem_util.adb, sem_util.ads: Fix
conformance errors.
* errout.adb, erroutc.adb: Remove pragmas Suppress.
* err_vars.ads: Initialize variables that were previously being
read uninitialized.