Richard Sandiford [Wed, 23 Sep 2020 18:21:56 +0000 (19:21 +0100)]
aarch64: Add a couple of extra stack-protector tests
These tests were inspired by corresponding arm ones. They already pass.
gcc/testsuite/
* gcc.target/aarch64/stack-protector-3.c: New test.
* gcc.target/aarch64/stack-protector-4.c: Likewise.
David Malcolm [Wed, 23 Sep 2020 15:18:43 +0000 (11:18 -0400)]
analyzer: fix member call on null seen with ubsan [PR97178]
gcc/analyzer/ChangeLog:
PR analyzer/97178
* engine.cc (impl_run_checkers): Update for change to ext_state
ctor.
* program-state.cc (selftest::test_sm_state_map): Pass an engine
instance to ext_state ctor.
(selftest::test_program_state_1): Likewise.
(selftest::test_program_state_2): Likewise.
(selftest::test_program_state_merging): Likewise.
(selftest::test_program_state_merging_2): Likewise.
* program-state.h (extrinsic_state::extrinsic_state): Remove NULL
default value for "eng" param.
Kyrylo Tkachov [Wed, 23 Sep 2020 16:37:58 +0000 (17:37 +0100)]
AArch64: Implement missing p128<->f64 reinterpret intrinsics
This patch implements the missing reinterprets to and from poly128_t and
float64x2_t.
I've plugged in the appropriate testing in the advsimd-intrinsics.exp
too.
Bootstrapped and tested on aarch64-none-linux-gnu.
Tested advsimd-intrinsics.exp on arm-none-eabi too to make sure arm
testing isn't affected.
gcc/
PR target/71233
* config/aarch64/arm_neon.h (vreinterpretq_f64_p128,
vreinterpretq_p128_f64): Define.
gcc/testsuite/
PR target/71233
* gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h
(clean_results): Add float64x2_t cleanup.
(DECL_VARIABLE_128BITS_VARIANTS): Add float64x2_t variable.
* gcc.target/aarch64/advsimd-intrinsics/vreinterpret_p128.c: Add
testing of vreinterpretq_f64_p128, vreinterpretq_p128_f64.
Nathan Sidwell [Wed, 23 Sep 2020 15:13:25 +0000 (08:13 -0700)]
c++: Remove some gratuitous typedefing
This is C++, we don't need 'typedef struct foo foo;'. Oh, and bool
bitfields are a thing.
gcc/cp/
* name-lookup.h (typedef cxx_binding): Delete tdef.
(typedef cp_binding_level): Likewise.
(struct cxx_binding): Flags are bools.
Alex Coplan [Wed, 23 Sep 2020 14:21:00 +0000 (15:21 +0100)]
arm: Add support for Neoverse V1 CPU
This adds support for Arm's Neoverse V1 CPU to the AArch32 backend.
---
gcc/ChangeLog:
* config/arm/arm-cpus.in (neoverse-v1): New.
* config/arm/arm-tables.opt: Regenerate.
* config/arm/arm-tune.md: Regenerate.
* doc/invoke.texi: Document support for Neoverse V1.
Alex Coplan [Wed, 23 Sep 2020 14:20:19 +0000 (15:20 +0100)]
aarch64: Add support for Neoverse V1 CPU
This adds support for Arm's Neoverse V1 CPU to the AArch64 backend.
---
gcc/ChangeLog:
* config/aarch64/aarch64-cores.def: Add Neoverse V1.
* config/aarch64/aarch64-tune.md: Regenerate.
* doc/invoke.texi: Document support for Neoverse V1.
Nathan Sidwell [Wed, 23 Sep 2020 14:01:10 +0000 (07:01 -0700)]
c++: dependent local extern decl ICE [PR97171]
I'd missed the piece of substutution for the uses of a local extern
decl. Just grab the local specialization. We need to do this
regardless of dependentness because we always cloned the local extern.
PR c++/97171
gcc/cp/
* pt.c (tsubst_copy) [FUNCTION_DECL,VAR_DECL]: Retrieve local
specialization for DECL_LOCAL_P decls.
gcc/testsuite/
* g++.dg/template/local10.C: New.
Marek Polacek [Sun, 20 Sep 2020 20:11:00 +0000 (16:11 -0400)]
c: Fix -Wduplicated-branches ICE [PR97125]
We crash here because since r11-3302 the C FE uses codes like SWITCH_STMT
in the else branches in the attached test, and inchash::add_expr in
do_warn_duplicated_branches doesn't handle these front-end codes. In
the C++ FE this works because by the time we get to do_warn_duplicated_branches
we've already cp_genericize'd the SWITCH_STMT tree into a SWITCH_EXPR.
The fix is to call do_warn_duplicated_branches_r only after loops and other
structured control constructs have been lowered.
gcc/c-family/ChangeLog:
PR c/97125
* c-gimplify.c (c_genericize): Only call do_warn_duplicated_branches_r
after loops and other structured control constructs have been lowered.
gcc/testsuite/ChangeLog:
PR c/97125
* c-c++-common/Wduplicated-branches-15.c: New test.
Richard Biener [Wed, 23 Sep 2020 13:03:31 +0000 (15:03 +0200)]
middle-end/96453 - relax gimple_expand_vec_cond_expr
This relaxes the condition under which we also try NE_EXPR
for a fake generated compare in addition to LT_EXPR given
the fact the verification ICEd when it failed but obviously
was only implemented for constants. Thus the patch removes
the verification and the restriction to constant operands.
2020-09-23 Richard Biener <rguenther@suse.de>
PR middle-end/96453
* gimple-isel.cc (gimple_expand_vec_cond_expr): Remove
LT_EXPR -> NE_EXPR verification and also apply it for
non-constant masks.
* gcc.dg/pr96453.c: New testcase.
Jan Hubicka [Wed, 23 Sep 2020 13:12:18 +0000 (15:12 +0200)]
Minor modref optimization and statistics fix
this patch fixes bug in tracking memory stats and also I have noticed that while
the pass takes care to stop traking things when things are obviously out of hand
it still keeps summaries that have no useful info for loads or stores and also
many summaries are just copying const/pure attributes. This patch thus also
adds logic to detect if summary is useful and drop it early otherwise. This
reduces number of queries to the oracle and saves memory/lto streaming.
For cc1plus LTO build (configured with --disable-plugin
--enable-checking=release --with-build-config=lto) I now get:
Alias oracle query stats:
refs_may_alias_p:
62488734 disambiguations,
72660949 queries
ref_maybe_used_by_call_p: 128863 disambiguations,
63393551 queries
call_may_clobber_ref_p: 16013 disambiguations, 21776 queries
nonoverlapping_component_refs_p: 0 disambiguations, 37628 queries
nonoverlapping_refs_since_match_p: 19397 disambiguations, 55370 must overlaps, 75516 queries
aliasing_component_refs_p: 54741 disambiguations, 752198 queries
TBAA oracle:
21632692 disambiguations
52565147 queries
15656420 are in alias set 0
10108172 queries asked about the same object
124 queries asked about the same alias set
0 access volatile
3640460 are dependent in the DAG
1527279 are aritificially in conflict with void *
Modref stats:
modref use: 5712 disambiguations, 31221 queries
modref clobber: 684316 disambiguations,
1010000 queries
1779717 tbaa queries (1.762096 per modref query)
PTA query stats:
pt_solution_includes: 947334 disambiguations,
13601373 queries
pt_solutions_intersect:
1011662 disambiguations,
13139565 queries
The number of queries should change, but the number of disambiguations should
not. However comparing with stats here
https://gcc.gnu.org/pipermail/gcc-patches/2020-September/554309.html
I see about 50% drop in clobber disambiguations. There is however same drop in
other alias oracle stats. I suppose someting changed in meanwhile on mainline
because I was basing that on older tree. I tried to proofread changes between
mainline and branch and they seem all quite obvious.
This is consistent with what I get on tramp3d:
Alias oracle query stats:
refs_may_alias_p:
2051320 disambiguations,
2312132 queries
ref_maybe_used_by_call_p: 7058 disambiguations,
2088222 queries
call_may_clobber_ref_p: 232 disambiguations, 232 queries
nonoverlapping_component_refs_p: 0 disambiguations, 4339 queries
nonoverlapping_refs_since_match_p: 329 disambiguations, 10200 must overlaps, 10616 queries
aliasing_component_refs_p: 857 disambiguations, 34639 queries
TBAA oracle: 886768 disambiguations
1670635 queries
131572 are in alias set 0
461689 queries asked about the same object
0 queries asked about the same alias set
0 access volatile
190291 are dependent in the DAG
315 are aritificially in conflict with void *
Modref stats:
modref use: 430 disambiguations, 1885 queries
modref clobber: 9657 disambiguations, 16076 queries
19027 tbaa queries (1.183566 per modref query)
PTA query stats:
pt_solution_includes: 311756 disambiguations, 524179 queries
pt_solutions_intersect: 129689 disambiguations, 415878 queries
In both cases the number of disambiguations should be same (queries are not
comparable).
Bootstrapped/regtested x86_64-linux, comitted.
gcc/ChangeLog:
2020-09-23 Jan Hubicka <hubicka@ucw.cz>
* ipa-modref.c (modref_summary::lto_useful_p): New member function.
(modref_summary::useful_p): New member function.
(analyze_function): Drop useless summaries.
(modref_write): Skip useless summaries.
(pass_ipa_modref::execute): Drop useless summaries.
* ipa-modref.h (struct GTY): Declare useful_p and lto_useful_p.
* tree-ssa-alias.c (dump_alias_stats): Fix.
(modref_may_conflict): Fix stats.
Richard Biener [Wed, 23 Sep 2020 12:20:44 +0000 (14:20 +0200)]
middle-end/96466 - fix VEC_COND isel/expansion issue
We need to avoid forcing BLKmode for truth vectors, instead do as
other code and use VOIDmode so layout_type can pick a suitable and
consistent mode. RTL expansion of vect_cond_mask also needs to deal
with CONST_INT operands which means passing the mode explicitely.
2020-09-23 Richard Biener <rguenther@suse.de>
PR middle-end/96466
* internal-fn.c (expand_vect_cond_mask_optab_fn): Use
appropriate mode for force_reg.
* tree.c (build_truth_vector_type_for): Pass VOIDmode to
make_vector_type.
* gcc.dg/pr96466.c: New testcase.
Richard Sandiford [Wed, 23 Sep 2020 11:29:40 +0000 (12:29 +0100)]
vect: Fix epilogue loop handling of partial vectors
This patch fixes the fallout that Kewen reported on Power after
the recent change to avoid unnecessary use of partial vectors.
As Kewen said, the problem is that vect_analyze_loop_2 doesn't
know how many epilogue iterations there will be, and so it
cannot make a final decision about whether the number of
iterations forces an epilogue loop to use partial vectors.
This is similar to the current situation for peeling: we don't know
during initial analysis whether an epilogue loop will itself require
peeling. Instead we decide that during vect_do_peeling, where the
final number of epilogue loop iterations is known.
The patch takes a similar approach for the decision about whether
to use partial vectors. As the comments in the patch say, the
idea is that vect_analyze_loop_2 should make peeling and partial-
vector decisions based on the assumption that the loop_vinfo will
be used as the main loop, while vect_do_peeling should make them
in the knowledge that the loop_vinfo will be used as an epilogue loop.
This allows the same analysis to be used for both cases, which we
rely on for implementing VECT_COMPARE_COSTS; see the big comment
in vect_analyze_loop for details.
I hope the patch makes the (mostly preexisting) structure a bit
more obvious. It isn't what anyone would design from scratch,
but that's the nature of working with a mature vector framework.
Arranging things this way means that vect_verify_full_masking
and vect_verify_loop_lens now become part of the “can” rather
than “will” test for partial vectors.
Also, while splitting out the logic that handles epilogues with
constant iterations, I added a check to make sure that we don't
try to use partial vectors to vectorise a single-scalar loop.
This required some changes to the Power tests.
gcc/
* tree-vectorizer.h (determine_peel_for_niter): Delete in favor of...
(vect_determine_partial_vectors_and_peeling): ...this new function.
* tree-vect-loop-manip.c (vect_update_epilogue_niters): New function.
Reject using vector epilogue loops for single iterations. Install
the constant number of epilogue loop iterations in the associated
loop_vinfo. Rely on vect_determine_partial_vectors_and_peeling
to do the main part of the test.
(vect_do_peeling): Use vect_update_epilogue_niters to handle
epilogue loops with a known number of iterations. Skip recomputing
the number of iterations later in that case. Otherwise, use
vect_determine_partial_vectors_and_peeling to decide whether the
epilogue loop needs to use partial vectors or peeling.
* tree-vect-loop.c (_loop_vec_info::_loop_vec_info): Set the
default can_use_partial_vectors_p to false if partial-vector-usage=0.
(determine_peel_for_niter): Remove in favor of...
(vect_determine_partial_vectors_and_peeling): ...this new function,
split out from...
(vect_analyze_loop_2): ...here. Reflect the vect_verify_full_masking
and vect_verify_loop_lens results in CAN_USE_PARTIAL_VECTORS_P
rather than USING_PARTIAL_VECTORS_P.
gcc/testsuite/
* gcc.target/powerpc/p9-vec-length-epil-1.c: Do not expect the
single-iteration epilogues of the 64-bit loops to be vectorized.
* gcc.target/powerpc/p9-vec-length-epil-7.c: Likewise.
* gcc.target/powerpc/p9-vec-length-epil-8.c: Likewise.
Kyrylo Tkachov [Wed, 23 Sep 2020 11:02:29 +0000 (12:02 +0100)]
AArch64: Implement missing vrndns_f32 intrinsic
This patch implements the missing vrndns_f32 intrinsic. This operates on a scalar float32_t value.
It can be mapped down to a __builtin_aarch64_frintnsf builtin.
This patch does that.
Bootstrapped and tested on aarch64-none-linux-gnu.
gcc/
PR target/71233
* config/aarch64/aarch64-simd-builtins.def (frintn): Use BUILTIN_VHSDF_HSDF
for modes. Remove explicit hf instantiation.
* config/aarch64/arm_neon.h (vrndns_f32): Define.
gcc/testsuite/
PR target/71233
* gcc.target/aarch64/simd/vrndns_f32_1.c: New test.
Richard Biener [Wed, 23 Sep 2020 08:42:48 +0000 (10:42 +0200)]
tree-optimization/97173 - extend assert in vectorizable_live_operation
The condition we're expecting to eventually run into isn't fully
captured by checking for CTORs, instead we can also run into the
CTOR element conversion.
2020-09-23 Richard Biener <rguenther@suse.de>
PR tree-optimization/97173
* tree-vect-loop.c (vectorizable_live_operation): Extend
assert to also conver element conversions.
* gcc.dg/vect/pr97173.c: New testcase.
Kyrylo Tkachov [Wed, 23 Sep 2020 10:07:50 +0000 (11:07 +0100)]
AArch64: Implement missing _p64 intrinsics for vector permutes
This patch implements some missing vector permute intrinsics operating on poly64x2_t types.
They are implemented identically to their uint64x2_t brethren.
Bootstrapped and tested on aarch64-none-linux-gnu.
gcc/
PR target/71233
* config/aarch64/arm_neon.h (vtrn1q_p64, vtrn2q_p64, vuzp1q_p64,
vuzp2q_p64, vzip1q_p64, vzip2q_p64): Define.
gcc/testsuite/
PR target/71233
* gcc.target/aarch64/simd/trn_zip_p64_1.c: New test.
Kyrylo Tkachov [Wed, 23 Sep 2020 09:32:42 +0000 (10:32 +0100)]
AArch64: Implement vldrq_p128 intrinsic
This patch implements the missing vldrq_p128 intrinsic that just loads from the appropriate pointer.
Bootstrapped and tested on aarch64-none-linux-gnu.
gcc/
PR target/71233
* config/aarch64/arm_neon.h (vldrq_p128): Define.
gcc/testsuite/
PR target/71233
* gcc.target/aarch64/simd/vldrq_p128_1.c: New test.
Kyrylo Tkachov [Wed, 23 Sep 2020 09:29:17 +0000 (10:29 +0100)]
AArch64: Implement vstrq_p128 intrinsic
This patch implements the missing vstrq_p128 intrinsic.
It just performs a store of the poly128_t argument to a memory location.
Bootstrapped and tested on aarch64-none-linux-gnu.
gcc/
PR target/71233
* config/aarch64/arm_neon.h (vstrq_p128): Define.
gcc/testsuite/
PR target/71233
* gcc.target/aarch64/simd/vstrq_p128_1.c: New test.
Tobias Burnus [Wed, 23 Sep 2020 09:07:40 +0000 (11:07 +0200)]
gcc/analyzer: Silence -Wpragma warns with GCC < 10
gcc/analyzer/ChangeLog:
* analyzer-logging.cc: Guard '#pragma ... ignored "-Wformat-diag"'
by '#if __GNUC__ >= 10'
* analyzer.h: Likewise.
* call-string.cc: Likewise.
Richard Biener [Wed, 23 Sep 2020 08:11:03 +0000 (10:11 +0200)]
tree-optimization/97151 - improve PTA for C++ operator delete
C++ operator delete, when DECL_IS_REPLACEABLE_OPERATOR_DELETE_P,
does not cause the deleted object to be escaped. It also has no
other interesting side-effects for PTA so skip it like we do
for BUILT_IN_FREE.
2020-09-23 Richard Biener <rguenther@suse.de>
PR tree-optimization/97151
* tree-ssa-structalias.c (find_func_aliases_for_call):
DECL_IS_REPLACEABLE_OPERATOR_DELETE_P has no effect on
arguments.
* g++.dg/cpp1y/new1.C: Adjust for two more handled transforms.
Richard Biener [Wed, 23 Sep 2020 08:07:37 +0000 (10:07 +0200)]
middle-end/97162 - fix ICE when building gamess
This appropriately guards the check for a hard register in
compare_base_decls which otherwise ICEs when passed a CONST_DECL.
2020-09-23 Richard Biener <rguenther@suse.de>
PR middle-end/97162
* alias.c (compare_base_decls): Use DECL_HARD_REGISTER
and guard with VAR_P.
Martin Liska [Mon, 21 Sep 2020 14:26:10 +0000 (16:26 +0200)]
gcov: fix streaming corruption
gcc/ChangeLog:
PR gcov-profile/97069
* profile.c (branch_prob): Line number must be at least 1.
gcc/testsuite/ChangeLog:
PR gcov-profile/97069
* g++.dg/gcov/pr97069.C: New test.
Tom de Vries [Tue, 22 Sep 2020 11:16:39 +0000 (13:16 +0200)]
[nvptx] Handle move from DF subreg to DF reg in nvptx_output_mov_insn
When compiling test-case gcc.dg/atomic/c11-atomic-exec-1.c, we run into
these ptxas errors:
...
line 100; error: Rounding modifier required for instruction 'cvt'
line 105; error: Rounding modifier required for instruction 'cvt'
...
The problem is that this move:
...
//(insn 13 11 14 2
// (set (reg:DF 28 [ _9 ])
// (subreg:DF (reg:TI 22 [ _1 ]) 0)) 9 {*movdf_insn}
// (nil))
cvt.f64.u64 %r28, %r22$0;
...
is emitted as cvt.f64.u64, while it should be a mov.b64 instead.
Fix this by handling this case in nvptx_output_mov_insn.
Tested on nvptx.
gcc/ChangeLog:
PR target/97158
* config/nvptx/nvptx.c (nvptx_output_mov_insn): Handle move from
DF subreg to DF reg.
Tom de Vries [Wed, 23 Sep 2020 07:16:17 +0000 (09:16 +0200)]
[testsuite] Add missing require-effective-target alloca
Add missing require-effect-target alloca directives.
Tested on nvptx.
gcc/testsuite/ChangeLog:
* gcc.dg/Warray-bounds-63.c: Add require-effective-target alloca.
* gcc.dg/Warray-bounds-66.c: Same.
* gcc.dg/atomic/stdatomic-vm.c: Same.
Clément Chigot [Fri, 3 May 2019 14:53:13 +0000 (16:53 +0200)]
syscall: fix TestForeground for AIX
Syscall function can't be used on AIX. Therefore, Ioctl in
TestForeground must call raw_ioctl.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/175080
Clément Chigot [Tue, 7 May 2019 11:57:40 +0000 (13:57 +0200)]
syscall: remove ptrace syscall on ppc64
ptrace is available only for 32 bits programs.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/252558
David Malcolm [Tue, 22 Sep 2020 21:42:27 +0000 (17:42 -0400)]
Add $(ZLIBINC) to CFLAGS-analyzer/engine.o
gcc/ChangeLog:
* Makefile.in: Add $(ZLIBINC) to CFLAGS-analyzer/engine.o.
David Malcolm [Tue, 22 Sep 2020 15:29:02 +0000 (11:29 -0400)]
analyzer: use switch in exploded_node::on_stmt
This patch replaces a sequence of dyn_cast to different gimple stmt
types in exploded_node::on_stmt with a switch on the gimple_code. This
makes clearer which kinds of stmt are currently treated as no-ops, as a
precursor to handling them properly.
No functional change intended.
gcc/analyzer/ChangeLog:
* engine.cc (exploded_node::on_stmt): Replace sequence of dyn_cast
with switch.
Clément Chigot [Tue, 26 May 2020 09:31:37 +0000 (11:31 +0200)]
runtime, net: fix build errors on AIX
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/235158
Ian Lance Taylor [Wed, 23 Sep 2020 00:27:46 +0000 (17:27 -0700)]
libbacktrace: handle pc == low correctly
* dwarf.c (report_inlined_functions): Handle PC == -1 and PC ==
p->low.
(dwarf_lookup_pc): Likewise.
GCC Administrator [Wed, 23 Sep 2020 00:16:27 +0000 (00:16 +0000)]
Daily bump.
Ian Lance Taylor [Tue, 22 Sep 2020 23:36:02 +0000 (16:36 -0700)]
go.test: update issue4458.go for recent change
Jan Hubicka [Tue, 22 Sep 2020 20:36:01 +0000 (22:36 +0200)]
Ignore clobbers in modref
* ipa-modref.c (analyze_stmt): Ignore gimple clobber.
Patrick Palka [Tue, 22 Sep 2020 20:26:52 +0000 (16:26 -0400)]
c++: Return only in-scope tparms in keep_template_parm [PR95310]
In the testcase below, the dependent specializations iter_reference_t<F>
and iter_reference_t<Out> share the same tree due to specialization
caching. So when find_template_parameters walks through the
requires-expression (as part of normalization), it sees and includes the
out-of-scope template parameter F in the list of template parameters
it found within the requires-expression (along with Out and N).
From a correctness perspective this is harmless since the parameter mapping
routines only care about the level and index of each parameter, so F is
no different from Out in that sense. And it's also harmless that two
parameters in the parameter mapping have the same level and index.
But having both Out and F in the parameter mapping means extra work for
hash_atomic_constrant, tsubst_parameter_mapping and get_mapped_args; and
it also means we print this irrelevant template parameter in the
testcase's diagnostics (via pp_cxx_parameter_mapping):
in requirements with ‘Out o’ [with N = (const int&)&a; F = const int*; Out = const int*]
This patch makes keep_template_parm return only in-scope template
parameters by looking into ctx_parms for the corresponding in-scope
one, through a new helper function corresponding_template_parameter.
(That we sometimes print irrelevant template parameters in diagnostics
is also the subject of PR99 and PR66968, so the above diagnostic issue
could likely be fixed in a more general way, but this targeted fix to
keep_template_parm is perhaps worthwhile on its own.)
gcc/cp/ChangeLog:
PR c++/95310
* pt.c (corresponding_template_parameter): Define.
(keep_template_parm): Use it to adjust the given template
parameter to the corresponding in-scope one from ctx_parms.
gcc/testsuite/ChangeLog:
PR c++/95310
* g++.dg/concepts/diagnostic15.C: New test.
Patrick Palka [Tue, 22 Sep 2020 20:26:49 +0000 (16:26 -0400)]
c++: Add test for PR96652
Fixed by r11-3361.
gcc/testsuite/ChangeLog:
PR c++/96652
* g++.dg/cpp0x/decltype-96652.C: New test.
Jan Hubicka [Tue, 22 Sep 2020 20:16:00 +0000 (22:16 +0200)]
Fix ipa-modref selftest and destructor
* ipa-modref-tree.c: Add namespace selftest.
(modref_tree_c_tests): Rename to ...
(ipa_modref_tree_c_tests): ... this.
* ipa-modref.c (pass_modref): Remove destructor.
(ipa_modref_c_finalize): New function.
* ipa-modref.h (ipa_modref_c_finalize): Declare.
* selftest-run-tests.c (selftest::run_tests): Call
ipa_modref_c_finalize.
* selftest.h (ipa_modref_tree_c_tests): Declare.
* toplev.c: Include ipa-modref-tree.h and ipa-modref.h
(toplev::finalize): Call ipa_modref_c_finalize.
Nathan Sidwell [Tue, 22 Sep 2020 19:21:13 +0000 (12:21 -0700)]
c++: Remove a broken error-recovery path
The remaining use of xref_tag_from_type was also suspicious. It turns
out to be an error path. At parse time we diagnose that a class
definition cannot appear, but we swallow the definition. This code
was attempting to push it into the global scope (or find a conflict).
This seems needless, just return error_mark_node. This was the
simpler fix than going through the parser and figuring out how to get
it to put in error_mark_node at the right point.
gcc/cp/
* cp-tree.h (xref_tag_from_type): Don't declare.
* decl.c (xref_tag_from_type): Delete.
* pt.c (lookup_template_class_1): Erroneously located class
definitions just give error_mark, don't try and inject it into the
namespace.
Jakub Jelinek [Tue, 22 Sep 2020 19:06:32 +0000 (21:06 +0200)]
c++: Ignore __sanitizer_ptr_{sub,cmp} builtin calls during constant expression evaluation [PR97145]
These two builtin calls are added already during parsing before pointer
subtractions or comparisons, normally they perform runtime verification
of whether the pointers point to the same object or different objects,
but during constant expressione valuation we don't really need those
builtins for anything.
2020-09-22 Jakub Jelinek <jakub@redhat.com>
PR c++/97145
* constexpr.c (cxx_eval_builtin_function_call): Return void_node for
calls to __sanitize_ptr_{sub,cmp} builtins.
* g++.dg/asan/pr97145.C: New test.
Jonathan Wakely [Tue, 22 Sep 2020 19:02:58 +0000 (20:02 +0100)]
libstdc++: Fix out-of-bounds string_view access in filesystem::path [PR 97167]
libstdc++-v3/ChangeLog:
PR libstdc++/97167
* src/c++17/fs_path.cc (path::_Parser::root_path()): Check
for empty string before inspecting the first character.
* testsuite/27_io/filesystem/path/append/source.cc: Append
empty string_view to path.
David Malcolm [Fri, 18 Sep 2020 17:59:21 +0000 (13:59 -0400)]
analyzer: add -fdump-analyzer-json
I've found this useful for debugging state explosions in the analyzer.
gcc/analyzer/ChangeLog:
* analysis-plan.cc: Include "json.h".
* analyzer.opt (fdump-analyzer-json): New.
* call-string.cc: Include "json.h".
(call_string::to_json): New.
* call-string.h (call_string::to_json): New decl.
* checker-path.cc: Include "json.h".
* constraint-manager.cc: Include "json.h".
(equiv_class::to_json): New.
(constraint::to_json): New.
(constraint_manager::to_json): New.
* constraint-manager.h (equiv_class::to_json): New decl.
(constraint::to_json): New decl.
(constraint_manager::to_json): New decl.
* diagnostic-manager.cc: Include "json.h".
(saved_diagnostic::to_json): New.
(diagnostic_manager::to_json): New.
* diagnostic-manager.h (saved_diagnostic::to_json): New decl.
(diagnostic_manager::to_json): New decl.
* engine.cc: Include "json.h", <zlib.h>.
(exploded_node::status_to_str): New.
(exploded_node::to_json): New.
(exploded_edge::to_json): New.
(exploded_graph::to_json): New.
(dump_analyzer_json): New.
(impl_run_checkers): Call it.
* exploded-graph.h (exploded_node::status_to_str): New decl.
(exploded_node::to_json): New.
(exploded_edge::to_json): New.
(exploded_graph::to_json): New.
* pending-diagnostic.cc: Include "json.h".
* program-point.cc: Include "json.h".
(program_point::to_json): New.
* program-point.h (program_point::to_json): New decl.
* program-state.cc: Include "json.h".
(extrinsic_state::to_json): New.
(sm_state_map::to_json): New.
(program_state::to_json): New.
* program-state.h (extrinsic_state::to_json): New decl.
(sm_state_map::to_json): New decl.
(program_state::to_json): New decl.
* region-model-impl-calls.cc: Include "json.h".
* region-model-manager.cc: Include "json.h".
* region-model-reachability.cc: Include "json.h".
* region-model.cc: Include "json.h".
* region-model.h (svalue::to_json): New decl.
(region::to_json): New decl.
* region.cc: Include "json.h".
(region::to_json: New.
* sm-file.cc: Include "json.h".
* sm-malloc.cc: Include "json.h".
* sm-pattern-test.cc: Include "json.h".
* sm-sensitive.cc: Include "json.h".
* sm-signal.cc: Include "json.h".
(signal_delivery_edge_info_t::to_json): New.
* sm-taint.cc: Include "json.h".
* sm.cc: Include "diagnostic.h", "tree-diagnostic.h", and
"json.h".
(state_machine::state::to_json): New.
(state_machine::to_json): New.
* sm.h (state_machine::state::to_json): New.
(state_machine::to_json): New.
* state-purge.cc: Include "json.h".
* store.cc: Include "json.h".
(binding_key::get_desc): New.
(binding_map::to_json): New.
(binding_cluster::to_json): New.
(store::to_json): New.
* store.h (binding_key::get_desc): New decl.
(binding_map::to_json): New decl.
(binding_cluster::to_json): New decl.
(store::to_json): New decl.
* supergraph.cc: Include "json.h".
(supergraph::to_json): New.
(supernode::to_json): New.
(superedge::to_json): New.
* supergraph.h (supergraph::to_json): New decl.
(supernode::to_json): New decl.
(superedge::to_json): New decl.
* svalue.cc: Include "json.h".
(svalue::to_json): New.
gcc/ChangeLog:
* doc/analyzer.texi (Other Debugging Techniques): Mention
-fdump-analyzer-json.
* doc/invoke.texi (Static Analyzer Options): Add
-fdump-analyzer-json.
David Faust [Tue, 22 Sep 2020 18:31:35 +0000 (20:31 +0200)]
bpf: use xBPF signed div, mod insns when available
The 'mod' and 'div' operators in eBPF are unsigned, with no signed
counterpart. xBPF adds two new ALU operations, sdiv and smod, for
signed division and modulus, respectively. Update bpf.md with
'define_insn' blocks for signed div and mod to use them when targetting
xBPF, and add new tests to ensure they are used appropriately.
2020-09-17 David Faust <david.faust@oracle.com>
gcc/
* config/bpf/bpf.md: Add defines for signed div and mod operators.
gcc/testsuite/
* gcc.target/bpf/diag-sdiv.c: New test.
* gcc.target/bpf/diag-smod.c: New test.
* gcc.target/bpf/xbpf-sdiv-1.c: New test.
* gcc.target/bpf/xbpf-smod-1.c: New test.
Clément Chigot [Wed, 16 Sep 2020 12:03:10 +0000 (14:03 +0200)]
compiler: call runtime.eqtype for non-interface type switch on aix
All type switch clauses must call runtime.eqtype if the linker isn't
able to merge type descriptors pointers. Previously, only interface-type
clauses were doing it.
Updates golang/go#39276
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/255202
Tobias Burnus [Tue, 22 Sep 2020 17:15:44 +0000 (19:15 +0200)]
libgomp.fortran/pr66199-5.f90: Make stop codes unique
libgomp/ChangeLog:
PR fortran/95654
* testsuite/libgomp.fortran/pr66199-5.f90: Make stop codes unique.
Glen Joseph Fernandes [Tue, 22 Sep 2020 16:49:48 +0000 (17:49 +0100)]
libstdc++: Fix overflow handling in std::align
libstdc++-v3/ChangeLog:
* include/bits/align.h (align): Fix overflow handling.
* testsuite/20_util/align/3.cc: New test.
Nathan Sidwell [Tue, 22 Sep 2020 16:00:20 +0000 (09:00 -0700)]
c++: fix injected friend of template class
In working on fixing hiddenness, I discovered some suspicious code in
template instantiation. I suspect it dates from when we didn't do the
hidden friend injection thing at all. The xreftag finds the same
class, but makes it visible to name lookup. Which is wrong.
hurrah, fixing a bug by deleting code!
gcc/cp/
* pt.c (instantiate_class_template_1): Do not repush and unhide
injected friend.
gcc/testsuite/
* g++.old-deja/g++.pt/friend34.C: Check injected friend is still
invisible.
Jonathan Wakely [Tue, 22 Sep 2020 14:45:54 +0000 (15:45 +0100)]
libstdc++: Introduce new headers for C++20 ranges components
This introduces two new headers:
<bits/ranges_base.h> defines the minimal components needed
for using C++20 ranges (customization point objects such as
std::ranges::begin, concepts such as std::ranges::range, etc.)
<bits/ranges_util.h> includes <bits/ranges_base.h> and additionally
defines subrange, which is needed by <bits/ranges_algo.h>.
Most of the content of <bits/ranges_base.h> was previously defined in
<bits/range_access.h>, but a few pieces were only defined in <ranges>.
This meant the entire <ranges> header was needed in <algorithm> and
<memory>, even though they don't use all the range adaptors.
By moving the ranges components out of <bits/range_access.h> that file
is left defining just the contents of [iterator.range] i.e. std::begin,
std::end, std::size etc. and not C++20 ranges components.
For consistency with other C++20 ranges headers, <bits/range_cmp.h> is
renamed to <bits/ranges_cmp.h>.
libstdc++-v3/ChangeLog:
* include/Makefile.am: Add new headers and adjust for renamed
header.
* include/Makefile.in: Regenerate.
* include/bits/iterator_concepts.h: Adjust for renamed header.
* include/bits/range_access.h (ranges::*): Move to new
<bits/ranges_base.h> header.
* include/bits/ranges_algobase.h: Include new <bits/ranges_base.h>
header instead of <ranges>.
* include/bits/ranges_algo.h: Include new <bits/ranges_util.h>
header.
* include/bits/range_cmp.h: Moved to...
* include/bits/ranges_cmp.h: ...here.
* include/bits/ranges_base.h: New header.
* include/bits/ranges_util.h: New header.
* include/experimental/string_view: Include new
<bits/ranges_base.h> header.
* include/std/functional: Adjust for renamed header.
* include/std/ranges (ranges::view_base, ranges::enable_view)
(ranges::dangling, ranges::borrowed_iterator_t): Move to new
<bits/ranges_base.h> header.
(ranges::view_interface, ranges::subrange)
(ranges::borrowed_subrange_t): Move to new <bits/ranges_util.h>
header.
* include/std/span: Include new <bits/ranges_base.h> header.
* include/std/string_view: Likewise.
* testsuite/24_iterators/back_insert_iterator/pr93884.cc: Add
missing <ranges> header.
* testsuite/24_iterators/front_insert_iterator/pr93884.cc:
Likewise.
Marek Polacek [Tue, 22 Sep 2020 13:25:35 +0000 (09:25 -0400)]
testsuite: Prune more output in timevar1.C.
gcc/testsuite/ChangeLog:
* g++.dg/ext/timevar1.C: Also prune N%.
Marek Polacek [Mon, 21 Sep 2020 19:39:53 +0000 (15:39 -0400)]
testsuite: Prune more output in timevar2.C.
gcc/testsuite/ChangeLog:
* g++.dg/ext/timevar2.C: Also prune N%.
Martin Liska [Tue, 22 Sep 2020 10:23:35 +0000 (12:23 +0200)]
switch lowering: limit number of cluster attemps
gcc/ChangeLog:
PR tree-optimization/96979
* doc/invoke.texi: Document new param max-switch-clustering-attempts.
* params.opt: Add new parameter.
* tree-switch-conversion.c (jump_table_cluster::find_jump_tables):
Limit number of attempts.
(bit_test_cluster::find_bit_tests): Likewise.
gcc/testsuite/ChangeLog:
PR tree-optimization/96979
* g++.dg/tree-ssa/pr96979.C: New test.
Stefan Schulze Frielinghaus [Fri, 18 Sep 2020 07:10:19 +0000 (09:10 +0200)]
IBM Z: Try to make use of load-and-test instructions
This patch enables a peephole2 optimization which transforms a load of
constant zero into a temporary register which is then finally used to
compare against a floating-point register of interest into a single load
and test instruction. However, the optimization is only applied if both
registers are dead afterwards and if we test for (in)equality only.
This is relaxed in case of fast math.
This is a follow up to PR88856.
gcc/ChangeLog:
* config/s390/s390.md ("*cmp<mode>_ccs_0", "*cmp<mode>_ccz_0",
"*cmp<mode>_ccs_0_fastmath"): Basically change "*cmp<mode>_ccs_0" into
"*cmp<mode>_ccz_0" and for fast math add "*cmp<mode>_ccs_0_fastmath".
gcc/testsuite/ChangeLog:
* gcc.target/s390/load-and-test-fp-1.c: Change test to include all
possible combinations of dead/live registers and comparisons (equality,
relational).
* gcc.target/s390/load-and-test-fp-2.c: Same as load-and-test-fp-1.c
but for fast math.
* gcc.target/s390/load-and-test-fp.h: New test included by
load-and-test-fp-{1,2}.c.
Tom de Vries [Tue, 22 Sep 2020 05:51:58 +0000 (07:51 +0200)]
[libgomp, nvptx] Print error log for link error
By running libgomp test-case libgomp.c/target-28.c with GOMP_NVPTX_PTXRW=w
(using a maintenance patch that adds support for this env var), we dump the
ptx in target-28.exe to file. By editing one ptx file to rename
gomp_nvptx_main to gomp_nvptx_main2 in both declaration and call, and
running with GOMP_NVPTX_PTXRW=r, we trigger a link error:
...
$ GOMP_NVPTX_PTXRW=r ./target-28.exe
libgomp: cuLinkComplete error: unknown error
...
The error is somewhat uninformative.
Fix this by dumping the error log returned by the failing cuda call, such
that we have instead:
...
$ GOMP_NVPTX_PTXRW=r ./target-28.exe
libgomp: Link error log error : \
Undefined reference to 'gomp_nvptx_main2' in ''
libgomp: cuLinkComplete error: unknown error
...
Build on x86_64 with nvptx accelerator, tested libgomp.
libgomp/ChangeLog:
* plugin/plugin-nvptx.c (link_ptx): Print elog if cuLinkComplete call
fails.
Kyrylo Tkachov [Tue, 22 Sep 2020 11:03:49 +0000 (12:03 +0100)]
AArch64: Implement missing vcls intrinsics on unsigned types
This patch implements some missing intrinsics that perform a CLS on unsigned SIMD types.
Bootstrapped and tested on aarch64-none-linux-gnu.
gcc/
PR target/71233
* config/aarch64/arm_neon.h (vcls_u8, vcls_u16, vcls_u32,
vclsq_u8, vclsq_u16, vclsq_u32): Define.
gcc/testsuite/
PR target/71233
* gcc.target/aarch64/simd/vcls_unsigned_1.c: New test.
Kyrylo Tkachov [Tue, 22 Sep 2020 11:00:38 +0000 (12:00 +0100)]
AArch64: Implement missing vceq*_p* intrinsics
This patch implements some missing vceq* intrinsics on poly types.
The behaviour is to produce the appropriate CMEQ instruction as for the unsigned types.
Bootstrapped and tested on aarch64-none-linux-gnu.
gcc/
PR target/71233
* config/aarch64/arm_neon.h (vceqq_p64, vceqz_p64, vceqzq_p64): Define.
gcc/testsuite/
PR target/71233
* gcc.target/aarch64/simd/vceq_poly_1.c: New test.
Kyrylo Tkachov [Tue, 22 Sep 2020 10:58:36 +0000 (11:58 +0100)]
AArch64: Implement poly-type vadd intrinsics
This implements the vadd[p]_p* intrinsics.
In terms of functionality they are aliases of veor operations on the relevant unsigned types.
Bootstrapped and tested on aarch64-none-linux-gnu.
gcc/
PR target/71233
* config/aarch64/arm_neon.h (vadd_p8, vadd_p16, vadd_p64, vaddq_p8,
vaddq_p16, vaddq_p64, vaddq_p128): Define.
gcc/testsuite/
PR target/71233
* gcc.target/aarch64/simd/vadd_poly_1.c: New test.
Sergei Trofimovich [Sun, 6 Sep 2020 11:13:54 +0000 (12:13 +0100)]
gcov: fix TOPN streaming from shared libraries
Before the change gcc did not stream correctly TOPN counters
if counters belonged to a non-local shared object.
As a result zero-section optimization generated TOPN sections
in a form not recognizable by '__gcov_merge_topn'.
The problem happens because in a case of multiple shared objects
'__gcov_merge_topn' function is present in address space multiple
times (once per each object).
The fix is to never rely on function address and predicate on TOPN
counter types.
libgcc/ChangeLog:
PR gcov-profile/96913
* libgcov-driver.c (write_one_data): Avoid function pointer
comparison in TOP streaming decision.
Jakub Jelinek [Tue, 22 Sep 2020 08:45:06 +0000 (10:45 +0200)]
Fix some typos
2020-09-22 Jakub Jelinek <jakub@redhat.com>
gcc/
* params.opt (--param=modref-max-tests=): Fix typo in help text:
perofmed -> performed.
* common.opt: Fix typo: incrmeental -> incremental.
* ipa-modref.c: Fix typos: recroding -> recording, becaue -> because,
analsis -> analysis.
(class modref_summaries): Fix typo: betweehn -> between.
(analyze_call): Fix typo: calle -> callee.
(read_modref_records): Fix typo: expcted -> expected.
(pass_ipa_modref::execute): Fix typo: calle -> callee.
gcc/c-family/
* c.opt (Wbuiltin-declaration-mismatch): Fix typo in variable name:
warn_builtin_declaraion_mismatch -> warn_builtin_declaration_mismatch.
Jakub Jelinek [Tue, 22 Sep 2020 08:02:47 +0000 (10:02 +0200)]
ipa: Fix up ipa modref option help texts
This fixes
FAIL: compiler driver --help=common option(s): "^ +-.*[^:.]$" absent from output: " --param=modref-max-tests= Maximum number of tests perofmed by modref query"
FAIL: compiler driver --help=optimizers option(s): "^ +-.*[^:.]$" absent from output: " -fipa-modref Perform interprocedural modref analysis"
2020-09-22 Jakub Jelinek <jakub@redhat.com>
* common.opt (-fipa-modref): Add dot at the end of option help.
* params.opt (--param=modref-max-tests=): Likewise.
Jonathan Wakely [Tue, 22 Sep 2020 07:42:18 +0000 (08:42 +0100)]
libstdc++: Use correct argument type for __use_alloc, again [PR 96803]
While backporting
5494edae83ad33c769bd1ebc98f0c492453a6417 I noticed
that it's still not correct. I made the allocator-extended constructor
use the right type for the uses-allocator construction detection, but I
used an rvalue when it should be a const lvalue.
This should fix it properly this time.
libstdc++-v3/ChangeLog:
PR libstdc++/96803
* include/std/tuple
(_Tuple_impl(allocator_arg_t, Alloc, const _Tuple_impl<U...>&)):
Use correct value category in __use_alloc call.
* testsuite/20_util/tuple/cons/96803.cc: Check with constructors
that require correct value category to be used.
Jan Hubicka [Tue, 22 Sep 2020 07:24:40 +0000 (09:24 +0200)]
Add no strict aliasing to m128-check.h
* gcc.target/i386/m128-check.h: Add no-strict-aliasing
Patrick Palka [Tue, 22 Sep 2020 00:53:17 +0000 (20:53 -0400)]
libstdc++: Remove overzealous static_asserts from std::span
For a span with statically empty extent, we currently model the
preconditions of front(), back(), and operator[] as if they are
mandates, by using a static_assert to verify that extent != 0. This
causes us to reject valid programs that would instantiate these member
functions and at runtime never call them.
Since they are already followed by more general runtime asserts, this
patch just removes these static_asserts altogether,
libstdc++-v3/ChangeLog:
* include/std/span (span::front): Remove static_assert.
(span::back): Likewise.
(span::operator[]): Likewise.
* testsuite/23_containers/span/back_neg.cc: Rewrite to verify
that we check the preconditions of back() only when it's called.
* testsuite/23_containers/span/front_neg.cc: Likewise for
front().
* testsuite/23_containers/span/index_op_neg.cc: Likewise for
operator[].
Patrick Palka [Tue, 22 Sep 2020 00:48:23 +0000 (20:48 -0400)]
libstdc++: Fix division by zero in std::sample
This fixes a division by zero in the selection-sampling std::__sample
overload when the input range is empty (and hence __unsampled_sz is 0).
libstdc++-v3/ChangeLog:
* include/bits/stl_algo.h (__sample): Exit early when the
input range is empty.
* testsuite/25_algorithms/sample/3.cc: New test.
Patrick Palka [Tue, 22 Sep 2020 00:48:17 +0000 (20:48 -0400)]
libstdc++: Mark some more algorithms constexpr for C++20
As per P0202.
libstdc++-v3/ChangeLog:
* include/bits/stl_algo.h (for_each_n): Mark constexpr for C++20.
(search): Likewise for the overload that takes a searcher.
* testsuite/25_algorithms/for_each/constexpr.cc: Test constexpr
std::for_each_n.
* testsuite/25_algorithms/search/constexpr.cc: Test constexpr
std::search overload that takes a searcher.
GCC Administrator [Tue, 22 Sep 2020 00:16:31 +0000 (00:16 +0000)]
Daily bump.
Ian Lance Taylor [Fri, 28 Aug 2020 05:18:45 +0000 (22:18 -0700)]
compiler: finalize methods for type aliases of struct types
Previously we would finalize the methods of the alias type itself, but
since its a type alias we really need to finalize the methods of the
aliased type.
Also, handle method expressions of unnamed struct types.
Test case is https://golang.org/cl/251168.
Fixes golang/go#38125
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/251279
David Malcolm [Mon, 21 Sep 2020 15:59:26 +0000 (11:59 -0400)]
analyzer: fix ICE on bogus decl of memset [PR97130]
Verify that arguments are pointers before calling handling code
that calls deref_rvalue on them.
gcc/analyzer/ChangeLog:
PR analyzer/97130
* region-model-impl-calls.cc (call_details::get_arg_type): New.
* region-model.cc (region_model::on_call_pre): Check that the
initial arg is a pointer before calling impl_call_memset and
impl_call_strlen.
* region-model.h (call_details::get_arg_type): New decl.
gcc/testsuite/ChangeLog:
PR analyzer/97130
* gcc.dg/analyzer/pr97130.c: New test.
David Malcolm [Fri, 18 Sep 2020 21:34:50 +0000 (17:34 -0400)]
analyzer: decls are not on the heap
Whilst debugging the remaining state explosion in PR analyzer/93355
I noticed that half of the states at an exploding program point had:
'malloc': {'&buf': 'non-heap'}
whereas the other half didn't, presumably depending on whether the path
to each enode had used this local buffer:
char buf[400];
This patch tweaks malloc_state_machine::get_default_state to be smarter
about this, so that we can implicitly treat pointers to decls as
non-heap, preventing pointless differences between sm_state_map
instances. With that, all of the states in question have equal (empty)
malloc sm-state - though the state explosion continues for other reasons.
gcc/analyzer/ChangeLog:
PR analyzer/93355
* sm-malloc.cc (malloc_state_machine::get_default_state): Look at
the base region when considering pointers. Treat pointers to
decls as being non-heap.
Jonathan Wakely [Mon, 21 Sep 2020 22:43:25 +0000 (23:43 +0100)]
libstdc++: Use __builtin_expect in __glibcxx_assert
libstdc++-v3/ChangeLog:
* include/bits/c++config (__replacement_assert): Add noreturn
attribute.
(__glibcxx_assert_impl): Use __builtin_expect to hint that the
assertion is expected to pass.
Jonathan Wakely [Mon, 21 Sep 2020 22:43:25 +0000 (23:43 +0100)]
libstdc++: Fix constraints for drop_view::begin() const [LWG 3482]
libstdc++-v3/ChangeLog:
* include/std/ranges (drop_view::begin()): Adjust constraints
to match the correct condition for O(1) ranges::next (LWG 3482).
* testsuite/std/ranges/adaptors/drop.cc: Check that iterator is
cached for non-sized_range.
Clément Chigot [Wed, 16 Sep 2020 11:58:17 +0000 (13:58 +0200)]
go/internal/gccgoimporter: recognize aixbigafMagic archives
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/255201
Marek Polacek [Mon, 21 Sep 2020 17:24:25 +0000 (13:24 -0400)]
c++: DR 1722: Make lambda to function pointer conv noexcept [PR90583]
DR 1722 clarifies that the conversion function from lambda to pointer to
function should be noexcept(true).
gcc/cp/ChangeLog:
PR c++/90583
DR 1722
* lambda.c (maybe_add_lambda_conv_op): Mark the conversion function
as noexcept.
gcc/testsuite/ChangeLog:
PR c++/90583
DR 1722
* g++.dg/cpp0x/lambda/lambda-conv14.C: New test.
Marek Polacek [Sat, 19 Sep 2020 20:17:42 +0000 (16:17 -0400)]
c++: Implement -Wctad-maybe-unsupported.
I noticed that clang++ has this CTAD warning and thought that it might
be useful to have it. From clang++: "Some style guides want to allow
using CTAD only on types that "opt-in"; i.e. on types that are designed
to support it and not just types that *happen* to work with it."
So this warning warns when CTAD deduced a type, but the type does not
define any deduction guides. In that case CTAD worked only because the
compiler synthesized the implicit deduction guides. That might not be
intended.
It can be suppressed by adding a deduction guide that will never be
considered:
struct allow_ctad_t;
template <typename T> struct S { S(T) {} };
S(allow_ctad_t) -> S<void>;
This warning is off by default. It doesn't warn when the type comes
from a system header unless -Wsystem-headers.
gcc/c-family/ChangeLog:
* c.opt (Wctad-maybe-unsupported): New option.
gcc/cp/ChangeLog:
* pt.c (deduction_guides_for): Add a bool parameter. Set it.
(do_class_deduction): Warn when CTAD succeeds but the type doesn't
have any explicit deduction guides.
gcc/ChangeLog:
* doc/invoke.texi: Document -Wctad-maybe-unsupported.
gcc/testsuite/ChangeLog:
* g++.dg/warn/Wctad-maybe-unsupported.C: New test.
* g++.dg/warn/Wctad-maybe-unsupported2.C: New test.
* g++.dg/warn/Wctad-maybe-unsupported3.C: New test.
* g++.dg/warn/Wctad-maybe-unsupported.h: New file.
Ian Lance Taylor [Mon, 21 Sep 2020 19:45:43 +0000 (12:45 -0700)]
libgo: don't put golang.org packages in zstdpkglist.go
This ensures that internal/goroot.IsStandardPackage does not treat
golang.org packages as being in the standard library.
For golang/go#41368
Fixes golang/go#41499
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/256319
Martin Sebor [Mon, 21 Sep 2020 20:33:29 +0000 (14:33 -0600)]
Avoid incidental failures due to implicit attribute access.
gcc/testsuite/ChangeLog:
PR c/50584
* gcc.dg/ipa/ipa-sra-1.c: Use a plain pointer for argv instead of array.
* gcc.dg/ipa/ipa-sra-12.c: Same.
* gcc.dg/ipa/ipa-sra-13.c: Same.
* gcc.dg/ipa/ipa-sra-14.c: Same.
* gcc.dg/ipa/ipa-sra-15.c: Same.
Harald Anlauf [Mon, 21 Sep 2020 19:50:36 +0000 (21:50 +0200)]
PR fortran/90903 [part2] - Add runtime checking for the MVBITS intrinsic
Implement inline expansion of the intrinsic elemental subroutine MVBITS
with optional runtime checks for valid argument range.
gcc/fortran/ChangeLog:
* iresolve.c (gfc_resolve_mvbits): Remove unneeded conversion of
FROMPOS, LEN and TOPOS arguments to fit a C int.
* trans-intrinsic.c (gfc_conv_intrinsic_mvbits): Add inline
expansion of MVBITS intrinsic elemental subroutine and add code
for runtime argument checking.
(gfc_conv_intrinsic_subroutine): Recognise MVBITS intrinsic, but
defer handling to gfc_trans_call.
* trans-stmt.c (replace_ss):
(gfc_trans_call): Adjust to handle inline expansion, scalarization
of intrinsic subroutine MVBITS in gfc_conv_intrinsic_mvbits.
* trans.h (gfc_conv_intrinsic_mvbits): Add prototype for
gfc_conv_intrinsic_mvbits.
gcc/testsuite/ChangeLog:
* gfortran.dg/check_bits_2.f90: New test.
Co-authored-by: Paul Thomas <pault@gcc.gnu.org>
Ian Lance Taylor [Mon, 21 Sep 2020 19:02:59 +0000 (12:02 -0700)]
libsanitizer: rename new libbacktrace symbols
* libbacktrace/backtrace-rename.h (backtrace_uncompress_lzma):
Define.
(backtrace_syminfo_to_full_callback): Define.
(backtrace_syminfo_to_full_error_callback): Define.
Nathan Sidwell [Mon, 21 Sep 2020 15:55:15 +0000 (08:55 -0700)]
c++: ts_lambda is not needed
We don't need ts_lambda, as IDENTIFIER_LAMBDA_P is sufficient. Killed thusly.
gcc/cp/
* decl.c (xref_tag_1): Use IDENTIFIER_LAMBDA_P to detect lambdas.
* lambda.c (begin_lambda_type): Use ts_current to push the tag.
* name-lookup.h (enum tag_scope): Drop ts_lambda.
Iain Sandoe [Sat, 19 Sep 2020 13:35:58 +0000 (14:35 +0100)]
Darwin, testsuite : Skip a test that requires ELF.
The symver support is only available to ELF targets.
gcc/testsuite/ChangeLog:
* gcc.dg/ipa/symver1.c: Skip for Darwin.
Christophe Lyon [Mon, 21 Sep 2020 15:51:48 +0000 (15:51 +0000)]
[arm] gcc.target/arm/cs*: Use dg-add-options arm_arch_v8_1m_main
These testcases need thumb mode, which may not be the default.
Using dg-add-options arm_arch_v8_1m_main ensures that -mthumb is used
and makes the test pass in more configurations.
2020-09-21 Christophe Lyon <christophe.lyon@linaro.org>
gcc/testsuite/
* gcc.target/arm/csinc-1.c: Use dg-add-options
arm_arch_v8_1m_main.
* gcc.target/arm/csinv-1.c: Likewise.
* gcc.target/arm/csneg.c: Likewise.
Richard Biener [Mon, 21 Sep 2020 14:51:33 +0000 (16:51 +0200)]
tree-optimization/97139 - fix BB SLP live lane extraction
This fixes SLP live lane extraction with pattern stmts.
2020-09-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/97139
* tree-vect-slp.c (vect_bb_slp_mark_live_stmts): Only mark the
pattern root, track visited vectorized stmts.
* gcc.dg/vect/pr97139.c: New testcase.
Marek Polacek [Fri, 18 Sep 2020 23:37:05 +0000 (19:37 -0400)]
c++: Detect deduction guide redeclaration [PR97099]
[temp.deduct.guide]p3: Two deduction guide declarations in the same
translation unit for the same class template shall not have equivalent
parameter-declaration-clauses.
So let's detect that.
gcc/cp/ChangeLog:
PR c++/97099
* decl.c (redeclaration_error_message): Detect a redeclaration of
deduction guides.
gcc/testsuite/ChangeLog:
PR c++/97099
* g++.dg/cpp1z/class-deduction74.C: New test.
Jonathan Wakely [Mon, 21 Sep 2020 13:30:38 +0000 (14:30 +0100)]
libstdc++: Relax constraints on transform_view and elements_view iterators
libstdc++-v3/ChangeLog:
* include/std/ranges (transform_view, elements_view): Relax
constraints on operator- for iterators, as per LWG 3483.
* testsuite/std/ranges/adaptors/elements.cc: Check that we
can take the difference of two iterators from a non-random
access range.
* testsuite/std/ranges/adaptors/transform.cc: Likewise.
Jonathan Wakely [Mon, 21 Sep 2020 13:28:58 +0000 (14:28 +0100)]
libstdc++: Make std::assume_aligned a constexpr function [PR 97132]
The cast from void* to T* in std::assume_aligned is not valid in a
constexpr function. The optimization hint is redundant during constant
evaluation anyway (the compiler can see the object and knows its
alignment). Simply return the original pointer without applying the
__builtin_assume_aligned hint to it when doing constant evaluation.
This change also removes the preprocessor branch that works around
uintptr_t not being available. We already assume that type is present
elsewhere in the library.
libstdc++-v3/ChangeLog:
PR libstdc++/97132
* include/bits/align.h (align) [!_GLIBCXX_USE_C99_STDINT_TR1]:
Remove unused code.
(assume_aligned): Do not use __builtin_assume_aligned during
constant evaluation.
* testsuite/20_util/assume_aligned/1.cc: Improve test.
* testsuite/20_util/assume_aligned/97132.cc: New test.
Jakub Jelinek [Mon, 21 Sep 2020 12:20:05 +0000 (14:20 +0200)]
Fix fallout from Support new mallinfo2 function.
2020-09-21 Jakub Jelinek <jakub@redhat.com>
* configure.ac: Use mallinfo mallinfo2 as first operand of
gcc_AC_CHECK_DECLS rather than [mallinfo, mallinfo2].
* configure: Regenerated.
* config.in: Regenerated.
Andrea Corallo [Thu, 17 Sep 2020 16:17:52 +0000 (17:17 +0100)]
aarch64: Do not alter value on a force_reg returned rtx expanding __jcvt
2020-09-17 Andrea Corallo <andrea.corallo@arm.com>
* config/aarch64/aarch64-builtins.c
(aarch64_general_expand_builtin): Use expand machinery not to
alter the value of an rtx returned by force_reg.
Richard Biener [Mon, 21 Sep 2020 12:04:25 +0000 (14:04 +0200)]
tree-optimization/97135 - fix dependence check in store-motion
The following fixes a dependence check where in the particular place
we cannot ignore self-dependences.
2020-09-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/97135
* tree-ssa-loop-im.c (sm_seq_push_down): Do not ignore
self-dependences.
* gcc.dg/torture/pr97135.c: New testcase.
Martin Liska [Mon, 21 Sep 2020 10:50:37 +0000 (12:50 +0200)]
Fix ICE in tree-switch-conversion.
With SVE we can end up with:
switch (POLY_INT_CST [2, 2]) <default: <L2> [INV], case 2: <L3> [INV], case 4: <L3> [INV]>
which is fine to expand and we can remove the assert.
gcc/ChangeLog:
PR tree-optimization/96915
* tree-switch-conversion.c (switch_conversion::expand): Accept
also integer constants.
gcc/testsuite/ChangeLog:
PR tree-optimization/96915
* gcc.target/aarch64/sve/pr96915.c: New test.
Martin Liska [Mon, 21 Sep 2020 10:46:00 +0000 (12:46 +0200)]
POLY_INT_CST: remove extra space in dump
gcc/ChangeLog:
* print-tree.c (print_node): Remove extra space.
Tobias Burnus [Mon, 21 Sep 2020 09:22:49 +0000 (11:22 +0200)]
mklog.py: Parse first 10 lines for PR/DR number
contrib/ChangeLog:
* mklog.py: Parse first 10 lines for PR/DR number
not only the first line.
Andrea Corallo [Mon, 14 Sep 2020 13:47:24 +0000 (14:47 +0100)]
aarch64: Fix ICE on fpsr fpcr getters [PR96968]
gcc/ChangeLog
2020-09-14 Andrea Corallo <andrea.corallo@arm.com>
PR target/96968
* config/aarch64/aarch64-builtins.c
(aarch64_expand_fpsr_fpcr_setter): Fix comment nit.
(aarch64_expand_fpsr_fpcr_getter): New function, expand these
getters using expand_insn machinery.
(aarch64_general_expand_builtin): Make use of.
gcc/testsuite/ChangeLog
2020-09-14 Andrea Corallo <andrea.corallo@arm.com>
PR target/96968
* gcc.target/aarch64/pr96968.c: New test.
Martin Liska [Wed, 2 Sep 2020 12:34:21 +0000 (14:34 +0200)]
Use ONE_? macros.
gcc/ChangeLog:
* ggc-common.c (ggc_rlimit_bound): Use ONE_? macro.
(ggc_min_expand_heuristic): Likewise.
(ggc_min_heapsize_heuristic): Likewise.
* ggc-page.c (ggc_collect): Likewise.
* system.h (ONE_G): Likewise.
Martin Liska [Wed, 2 Sep 2020 12:30:16 +0000 (14:30 +0200)]
Use SIZE_AMOUNT macro for GGC memory allocation numbers.
gcc/ChangeLog:
* ggc-common.c (ggc_prune_overhead_list): Use SIZE_AMOUNT.
* ggc-page.c (release_pages): Likewise.
(ggc_collect): Likewise.
(ggc_trim): Likewise.
(ggc_grow): Likewise.
* timevar.c (timer::print): Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/ext/timevar1.C: Prune more possible number values.
* g++.dg/ext/timevar2.C: Likewise.
Martin Liska [Tue, 1 Sep 2020 12:14:45 +0000 (14:14 +0200)]
Support new mallinfo2 function.
gcc/ChangeLog:
* config.in: Regenerate.
* configure: Likewise.
* configure.ac: Detect for mallinfo2.
* ggc-common.c (defined): Use it.
* system.h: Handle also HAVE_MALLINFO2.
GCC Administrator [Mon, 21 Sep 2020 00:16:24 +0000 (00:16 +0000)]
Daily bump.
Jonathan Wakely [Sun, 20 Sep 2020 23:17:02 +0000 (00:17 +0100)]
libstdc++: Fix noexcept-specifier for std::bind_front [PR 97101]
libstdc++-v3/ChangeLog:
PR libstdc++/97101
* include/std/functional (bind_front): Fix order of parameters
in is_nothrow_constructible_v specialization.
* testsuite/20_util/function_objects/bind_front/97101.cc: New test.
John David Anglin [Sun, 20 Sep 2020 19:37:17 +0000 (19:37 +0000)]
Fix linkage with -nodefaultlibs option.
2020-09-20 John David Anglin < danglin@gcc.gnu.org>
gcc/ChangeLog
* config/pa/pa-hpux11.h (LINK_GCC_C_SEQUENCE_SPEC): Delete.
* config/pa/pa64-hpux.h (LINK_GCC_C_SEQUENCE_SPEC): Likewise.
(ENDFILE_SPEC): Link with libgcc_stub.a and mill.a.
* config/pa/pa32-linux.h (ENDFILE_SPEC): Link with libgcc.a.
Marek Polacek [Sun, 20 Sep 2020 19:25:55 +0000 (15:25 -0400)]
c++: Add test for PR90199.
Fixed by r11-2998, which fixed this ICE too.
gcc/testsuite/ChangeLog:
PR c++/90199
* g++.dg/cpp1y/constexpr-90199.C: New test.
Jan Hubicka [Sun, 20 Sep 2020 06:19:56 +0000 (08:19 +0200)]
Fix ICE during dumping in ipa-modref.
2020-09-20 Jan Hubicka <hubicka@ucw.cz>
* ipa-modref.c (dump_lto_records): Fix ICE.
Jan Hubicka [Sun, 20 Sep 2020 05:25:16 +0000 (07:25 +0200)]
New modref/ipa_modref optimization passes
2020-09-19 David Cepelik <d@dcepelik.cz>
Jan Hubicka <hubicka@ucw.cz>
* Makefile.in: Add ipa-modref.c and ipa-modref-tree.c.
* alias.c: (reference_alias_ptr_type_1): Export.
* alias.h (reference_alias_ptr_type_1): Declare.
* common.opt (fipa-modref): New.
* gengtype.c (open_base_files): Add ipa-modref-tree.h and ipa-modref.h
* ipa-modref-tree.c: New file.
* ipa-modref-tree.h: New file.
* ipa-modref.c: New file.
* ipa-modref.h: New file.
* lto-section-in.c (lto_section_name): Add ipa_modref.
* lto-streamer.h (enum lto_section_type): Add LTO_section_ipa_modref.
* opts.c (default_options_table): Enable ipa-modref at -O1+.
* params.opt (-param=modref-max-bases, -param=modref-max-refs,
-param=modref-max-tests): New params.
* passes.def: Schedule pass_modref and pass_ipa_modref.
* timevar.def (TV_IPA_MODREF): New timevar.
(TV_TREE_MODREF): New timevar.
* tree-pass.h (make_pass_modref): Declare.
(make_pass_ipa_modref): Declare.
* tree-ssa-alias.c (dump_alias_stats): Include ipa-modref-tree.h
and ipa-modref.h
(alias_stats): Add modref_use_may_alias, modref_use_no_alias,
modref_clobber_may_alias, modref_clobber_no_alias, modref_tests.
(dump_alias_stats): Dump new stats.
(nonoverlapping_array_refs_p): Fix formating.
(modref_may_conflict): New function.
(ref_maybe_used_by_call_p_1): Use it.
(call_may_clobber_ref_p_1): Use it.
(call_may_clobber_ref_p): Update.
(stmt_may_clobber_ref_p_1): Update.
* tree-ssa-alias.h (call_may_clobber_ref_p_1): Update.
GCC Administrator [Sun, 20 Sep 2020 00:16:23 +0000 (00:16 +0000)]
Daily bump.
Martin Sebor [Sat, 19 Sep 2020 23:47:29 +0000 (17:47 -0600)]
Extend -Warray-bounds to detect out-of-bounds accesses to array parameters.
gcc/ChangeLog:
PR middle-end/82608
PR middle-end/94195
PR c/50584
PR middle-end/84051
* gimple-array-bounds.cc (get_base_decl): New function.
(get_ref_size): New function.
(trailing_array): New function.
(array_bounds_checker::check_array_ref): Call them. Handle arrays
declared in function parameters.
(array_bounds_checker::check_mem_ref): Same. Handle references to
dynamically allocated arrays.
gcc/testsuite/ChangeLog:
PR middle-end/82608
PR middle-end/94195
PR c/50584
PR middle-end/84051
* c-c++-common/Warray-bounds.c: Adjust.
* gcc.dg/Wbuiltin-declaration-mismatch-9.c: Adjust.
* gcc.dg/Warray-bounds-63.c: New test.
* gcc.dg/Warray-bounds-64.c: New test.
* gcc.dg/Warray-bounds-65.c: New test.
* gcc.dg/Warray-bounds-66.c: New test.
* gcc.dg/Warray-bounds-67.c: New test.
Martin Sebor [Sat, 19 Sep 2020 23:37:05 +0000 (17:37 -0600)]
Extend -Wstringop-overflow to detect out-of-bounds accesses to array parameters.
gcc/ChangeLog:
PR c/50584
* builtins.c (warn_for_access): Add argument. Distinguish between
reads and writes.
(check_access): Add argument. Distinguish between reads and writes.
(gimple_call_alloc_size): Set range even on failure.
(gimple_parm_array_size): New function.
(compute_objsize): Call it.
(check_memop_access): Pass check_access an additional argument.
(expand_builtin_memchr, expand_builtin_strcat): Same.
(expand_builtin_strcpy, expand_builtin_stpcpy_1): Same.
(expand_builtin_stpncpy, check_strncat_sizes): Same.
(expand_builtin_strncat, expand_builtin_strncpy): Same.
(expand_builtin_memcmp): Same.
* builtins.h (compute_objsize): Declare a new overload.
(gimple_parm_array_size): Declare.
(check_access): Add argument.
* calls.c (append_attrname): Simplify.
(maybe_warn_rdwr_sizes): Handle internal attribute access.
* tree-ssa-uninit.c (maybe_warn_pass_by_reference): Avoid adding
quotes.
gcc/testsuite/ChangeLog:
PR c/50584
* c-c++-common/Wsizeof-pointer-memaccess1.c: Disable new expected
warnings.
* g++.dg/ext/attr-access.C: Update text of expected warnings.
* gcc.dg/Wstringop-overflow-23.c: Same.
* gcc.dg/Wstringop-overflow-24.c: Same.
* gcc.dg/attr-access-none.c: Same.
* gcc.dg/dfp/composite-type.c: Prune expected warnings.
* gcc.dg/torture/pr57147-1.c: Add a member to an otherwise empty
struct to avoid a warning.
* gcc.dg/torture/pr57147-3.c: Same.
* gcc.dg/Warray-bounds-30.c: Adjust.
* gcc.dg/attr-access-none.c: Same.
* gcc.dg/Wstringop-overflow-40.c: New test.
* gcc.dg/attr-access-2.c: New test.