Kito Cheng [Tue, 27 Oct 2020 06:38:07 +0000 (14:38 +0800)]
RISC-V: Refine riscv_parse_arch_string
- Generalize logic for translating arch to internal flags, this patch
is infrastructure for supporing sub-extension parsing.
gcc/ChangeLog
* common/config/riscv/riscv-common.c (opt_var_ref_t): New.
(riscv_ext_flag_table_t): New.
(riscv_ext_flag_table): New.
(riscv_parse_arch_string): Pass gcc_options* instead of
&opts->x_target_flags only, and using riscv_arch_option_table to
setup flags.
(riscv_handle_option): Update argument for riscv_parse_arch_string.
(riscv_expand_arch): Ditto.
(riscv_expand_arch_from_cpu): Ditto.
Jan Hubicka [Tue, 27 Oct 2020 08:03:45 +0000 (09:03 +0100)]
Use EAF_RETURN_ARG in tree-ssa-ccp.c
* tree-ssa-ccp.c (evaluate_stmt): Use EAF_RETURN_ARG; do not handle
string buitings specially.
Jan Hubicka [Tue, 27 Oct 2020 08:02:22 +0000 (09:02 +0100)]
Fix builtin decls generated in tree.c
* tree.c (set_call_expr_flags): Fix string for ECF_RET1.
(build_common_builtin_nodes): Do not set ECF_RET1 for memcpy, memmove,
and memset. They are handled by builtin_fnspec.
Jan Hubicka [Tue, 27 Oct 2020 08:01:41 +0000 (09:01 +0100)]
Add string builtins to builtin_fnspec
* builtins.c (builtin_fnspec): Add bzero, memcmp, memcmp_eq, bcmp,
strncmp, strncmp_eq, strncasecmp, rindex, strlen, strlnen, strcasecmp,
strcspn, strspn, strcmp, strcmp_eq.
Richard Biener [Mon, 26 Oct 2020 15:47:17 +0000 (16:47 +0100)]
Move SLP nodes to an alloc-pool
This introduces a global alloc-pool for SLP nodes to reduce overhead
on SLP allocation churn which will get worse and to eventually release
SLP cycles which will retain a refcount of one and thus are never
freed at the moment.
2020-10-26 Richard Biener <rguenther@suse.de>
* tree-vectorizer.h (slp_tree_pool): Declare.
(_slp_tree::operator new): Likewise.
(_slp_tree::operator delete): Likewise.
* tree-vectorizer.c (vectorize_loops): Allocate and free the
slp_tree_pool.
(pass_slp_vectorize::execute): Likewise.
* tree-vect-slp.c (slp_tree_pool): Define.
(_slp_tree::operator new): Likewise.
(_slp_tree::operator delete): Likewise.
Martin Liska [Mon, 26 Oct 2020 17:56:52 +0000 (18:56 +0100)]
lto: no sub-make when --jobserver-auth= is missing
We newly correctly detect that a job server is not active for
a LTO linking:
lto-wrapper: warning: jobserver is not available: '--jobserver-auth=' is not present in 'MAKEFLAGS'
In that situation we should not call make -f abc.mk as it can leed
to N^2 LTRANS units.
gcc/ChangeLog:
* lto-wrapper.c (run_gcc): Do not use sub-make when jobserver is
not detected properly.
Martin Liska [Mon, 26 Oct 2020 14:24:28 +0000 (15:24 +0100)]
call_summary: move hooks to base.
gcc/ChangeLog:
* symbol-summary.h (call_summary_base): Pass symtab hooks to
base and register (or unregister) hooks directly.
Martin Liska [Mon, 26 Oct 2020 14:11:59 +0000 (15:11 +0100)]
call_summary: modify cgraph hooks.
gcc/ChangeLog:
* symbol-summary.h (function_summary_base::unregister_hooks):
Call disable_insertion_hook and disable_duplication_hook.
(function_summary_base::symtab_insertion): New field.
(function_summary_base::symtab_removal): Likewise.
(function_summary_base::symtab_duplication): Likewise.
Register hooks in function_summary_base and directly register
(or unregister) hooks.
Aldy Hernandez [Tue, 27 Oct 2020 06:29:42 +0000 (07:29 +0100)]
Add test for pr97560.
gcc/testsuite/ChangeLog:
PR tree-optimization/97560
* g++.dg/pr97560.C: New test.
Alan Modra [Tue, 27 Oct 2020 00:46:48 +0000 (11:16 +1030)]
[RS6000] Separate dg-require-effective-target options
* gcc.target/powerpc/vsx_mask-count-runnable.c: Separate options
passed to dg-require-effective-target.
* gcc.target/powerpc/vsx_mask-expand-runnable.c: Likewise.
* gcc.target/powerpc/vsx_mask-extract-runnable.c: Likewise.
* gcc.target/powerpc/vsx_mask-move-runnable.c: Likewise.
GCC Administrator [Tue, 27 Oct 2020 00:16:28 +0000 (00:16 +0000)]
Daily bump.
Alan Modra [Sat, 24 Oct 2020 09:21:01 +0000 (19:51 +1030)]
[RS6000] Remove -mpcrel from tests
When running with -m32
FAIL: gcc.target/powerpc/pr94740.c (test for excess errors)
Excess errors:
cc1: error: '-mpcrel' requires '-mcmodel=medium'
The others don't run for -m32, but remove the unnecessary -mpcrel
anyway.
* gcc.target/powerpc/localentry-1.c: Remove -mpcrel from options.
* gcc.target/powerpc/notoc-direct-1.c: Likewise.
* gcc.target/powerpc/pr94740.c: Likewise.
Alan Modra [Sat, 24 Oct 2020 09:31:17 +0000 (20:01 +1030)]
[RS6000] biarch test fail
* gcc.target/powerpc/bswap64-4.c: Comment.
Alan Modra [Mon, 26 Oct 2020 11:21:31 +0000 (21:51 +1030)]
[RS6000] Replace -mcpu with -mdejagnu-cpu
* gcc.target/powerpc/pr93122.c: Replace -mcpu with -mdejagnu-cpu.
* gcc.target/powerpc/vsx_mask-count-runnable.c: Likewise.
* gcc.target/powerpc/vsx_mask-expand-runnable.c: Likewise.
* gcc.target/powerpc/vsx_mask-extract-runnable.c: Likewise.
* gcc.target/powerpc/vsx_mask-move-runnable.c: Likewise.
Alan Modra [Sat, 24 Oct 2020 05:37:02 +0000 (16:07 +1030)]
[RS6000] Tests that use int128_t and -m32
All these tests fail with -m32 due to lack of int128 support, in some
cases with what I thought was not the best error message. For example
vsx_mask-move-runnable.c:34:3: error: unknown type name 'vector'
is misleading. The problem isn't "vector" but "vector __uint128_t".
* gcc.target/powerpc/vsx-load-element-extend-char.c: Require int128.
* gcc.target/powerpc/vsx-load-element-extend-int.c: Likewise.
* gcc.target/powerpc/vsx-load-element-extend-longlong.c: Likewise.
* gcc.target/powerpc/vsx-load-element-extend-short.c: Likewise.
* gcc.target/powerpc/vsx-store-element-truncate-char.c: Likewise.
* gcc.target/powerpc/vsx-store-element-truncate-int.c: Likewise.
* gcc.target/powerpc/vsx-store-element-truncate-longlong.c: Likewise.
* gcc.target/powerpc/vsx-store-element-truncate-short.c: Likewise.
* gcc.target/powerpc/vsx_mask-count-runnable.c: Likewise.
* gcc.target/powerpc/vsx_mask-expand-runnable.c: Likewise.
* gcc.target/powerpc/vsx_mask-extract-runnable.c: Likewise.
* gcc.target/powerpc/vsx_mask-move-runnable.c: Likewise.
Alan Modra [Thu, 22 Oct 2020 00:15:23 +0000 (10:45 +1030)]
[RS6000] Link power10 testcases
Running the assembler and linker catches more errors.
* gcc.target/powerpc/cfuged-1.c,
gcc.target/powerpc/cntlzdm-1.c,
gcc.target/powerpc/cnttzdm-1.c,
gcc.target/powerpc/dg-future-1.c,
gcc.target/powerpc/lsbb-runnable.c,
gcc.target/powerpc/mma-double-test.c,
gcc.target/powerpc/mma-single-test.c,
gcc.target/powerpc/p10-arch31.c,
gcc.target/powerpc/p10-identify.c,
gcc.target/powerpc/pdep-1.c,
gcc.target/powerpc/pextd-1.c,
gcc.target/powerpc/pr96787-2.c,
gcc.target/powerpc/vec-blend-runnable.c,
gcc.target/powerpc/vec-cfuged-1.c,
gcc.target/powerpc/vec-clrl-1.c,
gcc.target/powerpc/vec-clrl-3.c,
gcc.target/powerpc/vec-clrr-1.c,
gcc.target/powerpc/vec-clrr-3.c,
gcc.target/powerpc/vec-cntlzm-1.c,
gcc.target/powerpc/vec-cnttzm-1.c,
gcc.target/powerpc/vec-extracth-1.c,
gcc.target/powerpc/vec-extracth-3.c,
gcc.target/powerpc/vec-extracth-5.c,
gcc.target/powerpc/vec-extracth-7.c,
gcc.target/powerpc/vec-extractl-1.c,
gcc.target/powerpc/vec-extractl-3.c,
gcc.target/powerpc/vec-extractl-5.c,
gcc.target/powerpc/vec-extractl-7.c,
gcc.target/powerpc/vec-gnb-1.c,
gcc.target/powerpc/vec-insert-word-runnable.c,
gcc.target/powerpc/vec-pdep-1.c,
gcc.target/powerpc/vec-permute-ext-runnable.c,
gcc.target/powerpc/vec-pext-1.c,
gcc.target/powerpc/vec-replace-word-runnable.c,
gcc.target/powerpc/vec-shift-double-runnable.c,
gcc.target/powerpc/vec-splati-runnable.c,
gcc.target/powerpc/vec-stril-1.c,
gcc.target/powerpc/vec-stril-16.c,
gcc.target/powerpc/vec-stril-17.c,
gcc.target/powerpc/vec-stril-18.c,
gcc.target/powerpc/vec-stril-19.c,
gcc.target/powerpc/vec-stril-20.c,
gcc.target/powerpc/vec-stril-21.c,
gcc.target/powerpc/vec-stril-22.c,
gcc.target/powerpc/vec-stril-23.c,
gcc.target/powerpc/vec-stril-3.c,
gcc.target/powerpc/vec-stril-5.c,
gcc.target/powerpc/vec-stril-7.c,
gcc.target/powerpc/vec-stril_p-1.c,
gcc.target/powerpc/vec-stril_p-3.c,
gcc.target/powerpc/vec-stril_p-5.c,
gcc.target/powerpc/vec-stril_p-7.c,
gcc.target/powerpc/vec-strir-1.c,
gcc.target/powerpc/vec-strir-16.c,
gcc.target/powerpc/vec-strir-17.c,
gcc.target/powerpc/vec-strir-18.c,
gcc.target/powerpc/vec-strir-19.c,
gcc.target/powerpc/vec-strir-20.c,
gcc.target/powerpc/vec-strir-21.c,
gcc.target/powerpc/vec-strir-22.c,
gcc.target/powerpc/vec-strir-23.c,
gcc.target/powerpc/vec-strir-3.c,
gcc.target/powerpc/vec-strir-5.c,
gcc.target/powerpc/vec-strir-7.c,
gcc.target/powerpc/vec-strir_p-1.c,
gcc.target/powerpc/vec-strir_p-3.c,
gcc.target/powerpc/vec-strir_p-5.c,
gcc.target/powerpc/vec-strir_p-7.c,
gcc.target/powerpc/vec-ternarylogic-1.c,
gcc.target/powerpc/vec-ternarylogic-3.c,
gcc.target/powerpc/vec-ternarylogic-5.c,
gcc.target/powerpc/vec-ternarylogic-7.c,
gcc.target/powerpc/vec-ternarylogic-9.c,
gcc.target/powerpc/vsx_mask-count-runnable.c,
gcc.target/powerpc/vsx_mask-expand-runnable.c,
gcc.target/powerpc/vsx_mask-extract-runnable.c,
gcc.target/powerpc/vsx_mask-move-runnable.c,
gcc.target/powerpc/xxgenpc-runnable.c: Link testcase when it
can't be run.
Alan Modra [Thu, 22 Oct 2020 02:12:36 +0000 (12:42 +1030)]
[RS6000] dimode_off.c test
This tests behaviour near the limit of 16-bit signed offsets. If
power10 prefix instructions are enabled, no such testing occurs.
* gcc.target/powerpc/dimode_off.c: Add -mno-prefixed to options.
Alan Modra [Thu, 22 Oct 2020 01:57:31 +0000 (12:27 +1030)]
[RS6000] Non-pcrel tests when power10
These tests require -mno-pcrel because they are testing features
of the non-pcrel ABI.
* gcc.target/powerpc/cprophard.c: Add -mno-pcrel to options.
* gcc.target/powerpc/float128-hw3.c: Likewise.
* gcc.target/powerpc/pr79439-1.c: Likewise.
* gcc.target/powerpc/pr79439-2.c: Likewise.
* gcc.target/powerpc/r2_shrink-wrap.c: Likewise.
Nikhil Benesch [Mon, 26 Oct 2020 17:48:32 +0000 (17:48 +0000)]
syscall: import additional BSD-specific syscall wrappers
Import additional code from upstream for handing system
calls on BSD systems. This makes the syscall package on
NetBSD complete enough to compile the standard library.
Updates golang/go#38538.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/265123
Andrew MacLeod [Mon, 26 Oct 2020 18:55:00 +0000 (14:55 -0400)]
Combine logical OR ranges properly.
When combining logical OR operands with a FALSE result, union the false
ranges for operand1 and operand2... not intersection.
gcc/
PR tree-optimization/97567
* gimple-range-gori.cc (gori_compute::logical_combine): Union the
ranges of operand1 and operand2, not intersect.
gcc/testsuite/
* gcc.dg/pr97567.c: New.
Jonathan Wakely [Mon, 26 Oct 2020 21:00:06 +0000 (21:00 +0000)]
libstdc++: Fix error in experimental::strand
libstdc++-v3/ChangeLog:
* include/experimental/executor (strand::_State): Fix thinko.
Jan Hubicka [Mon, 26 Oct 2020 19:19:33 +0000 (20:19 +0100)]
Extend builtin fnspecs
* attr-fnspec.h: Update toplevel comment.
(attr_fnspec::attr_fnspec): New constructor.
(attr_fnspec::arg_read_p,
attr_fnspec::arg_written_p,
attr_fnspec::arg_access_size_given_by_arg_p,
attr_fnspec::arg_single_access_p
attr_fnspec::loads_known_p
attr_fnspec::stores_known_p,
attr_fnspec::clobbers_errno_p): New member functions.
(gimple_call_fnspec): Declare.
(builtin_fnspec): Declare.
* builtins.c: Include attr-fnspec.h
(builtin_fnspec): New function.
* builtins.def (BUILT_IN_MEMCPY): Do not specify RET1 fnspec.
(BUILT_IN_MEMMOVE): Do not specify RET1 fnspec.
(BUILT_IN_MEMSET): Do not specify RET1 fnspec.
(BUILT_IN_STRCAT): Do not specify RET1 fnspec.
(BUILT_IN_STRCPY): Do not specify RET1 fnspec.
(BUILT_IN_STRNCAT): Do not specify RET1 fnspec.
(BUILT_IN_STRNCPY): Do not specify RET1 fnspec.
(BUILT_IN_MEMCPY_CHK): Do not specify RET1 fnspec.
(BUILT_IN_MEMMOVE_CHK): Do not specify RET1 fnspec.
(BUILT_IN_MEMSET_CHK): Do not specify RET1 fnspec.
(BUILT_IN_STRCAT_CHK): Do not specify RET1 fnspec.
(BUILT_IN_STRCPY_CHK): Do not specify RET1 fnspec.
(BUILT_IN_STRNCAT_CHK): Do not specify RET1 fnspec.
(BUILT_IN_STRNCPY_CHK): Do not specify RET1 fnspec.
* gimple.c (gimple_call_fnspec): Return attr_fnspec.
(gimple_call_arg_flags): Update.
(gimple_call_return_flags): Update.
* tree-ssa-alias.c (check_fnspec): New function.
(ref_maybe_used_by_call_p_1): Use fnspec for builtin handling.
(call_may_clobber_ref_p_1): Likewise.
(attr_fnspec::verify): Update verifier.
* calls.c (decl_fnspec): New function.
(decl_return_flags): Use it.
Aldy Hernandez [Mon, 26 Oct 2020 16:50:37 +0000 (17:50 +0100)]
Handle signed 1-bit ranges in irange::invert.
The problem here is we are trying to add 1 to a -1 in a signed 1-bit
field and coming up with UNDEFINED because of the overflow.
Signed 1-bits are annoying because you can't really add or subtract
one, because the one is unrepresentable. For invert() we have a
special subtract_one() function that handles 1-bit signed fields.
This patch implements the analogous add_one() function so that invert
works.
gcc/ChangeLog:
PR tree-optimization/97555
* range-op.cc (range_tests): Test 1-bit signed invert.
* value-range.cc (subtract_one): Adjust comment.
(add_one): New.
(irange::invert): Call add_one.
gcc/testsuite/ChangeLog:
* gcc.dg/pr97555.c: New test.
Jan Hubicka [Mon, 26 Oct 2020 17:19:48 +0000 (18:19 +0100)]
Implement three-level optimize_for_size predicates
this patch implements thre two-state optimize_for_size predicates, so with -Os
and with profile feedback for never executed code it returns OPTIMIZE_SIZE_MAX
while in cases we decide to optimize for size based on branch prediction logic
it return OPTIMIZE_SIZE_BALLANCED.
The idea is that for places where we guess that code is unlikely we do not
want to do extreme optimizations for size that leads to many fold slowdowns
(using idiv rather than few shigts or using rep based inlined stringops).
I will update RTL handling code to also support this with BB granuality (which
we don't currently). LLVM has -Os and -Oz levels where -Oz is our -Os and
LLVM's -Os would ocrrespond to OPTIMIZE_SIZE_BALLANCED. I wonder if we want
to export this to command line somehow? For me it would be definitly useful
to test things, I am not sure how "weaker" -Os is desired in practice.
gcc/ChangeLog:
* cgraph.h (cgraph_node::optimize_for_size_p): Return
optimize_size_level.
(cgraph_node::optimize_for_size_p): Update.
* coretypes.h (enum optimize_size_level): New enum.
* predict.c (unlikely_executed_edge_p): Microoptimize.
(optimize_function_for_size_p): Return optimize_size_level.
(optimize_bb_for_size_p): Likewise.
(optimize_edge_for_size_p): Likewise.
(optimize_insn_for_size_p): Likewise.
(optimize_loop_nest_for_size_p): Likewise.
* predict.h (optimize_function_for_size_p): Update declaration.
(optimize_bb_for_size_p): Update declaration.
(optimize_edge_for_size_p): Update declaration.
(optimize_insn_for_size_p): Update declaration.
(optimize_loop_for_size_p): Update declaration.
(optimize_loop_nest_for_size_p): Update declaration.
Richard Biener [Mon, 26 Oct 2020 14:58:29 +0000 (15:58 +0100)]
Refactor SLP instance analysis
This refactors the toplevel entry to analyze an SLP instance to
expose a worker analyzing from a vector of stmts and an SLP entry
kind.
2020-10-26 Richard Biener <rguenther@suse.de>
* tree-vect-slp.c (enum slp_instance_kind): New.
(vect_build_slp_instance): Split out from...
(vect_analyze_slp_instance): ... this.
Andrew MacLeod [Mon, 26 Oct 2020 14:13:58 +0000 (10:13 -0400)]
Re: error: ‘EVRP_MODE_DEBUG’ was not declared – was: [PUSHED] Ranger classes.
Initialize zerov to match vr-values.c.
* gimple-range.cc (range_of_builtin_call): Initialize zerov to 0.
Ville Voutilainen [Mon, 26 Oct 2020 13:36:24 +0000 (15:36 +0200)]
c++: Implement __is_nothrow_constructible and __is_nothrow_assignable
gcc/c-family/ChangeLog:
* c-common.c (__is_nothrow_assignable): New.
(__is_nothrow_constructible): Likewise.
* c-common.h (RID_IS_NOTHROW_ASSIGNABLE): New.
(RID_IS_NOTHROW_CONSTRUCTIBLE): Likewise.
gcc/cp/ChangeLog:
* cp-tree.h (CPTK_IS_NOTHROW_ASSIGNABLE): New.
(CPTK_IS_NOTHROW_CONSTRUCTIBLE): Likewise.
(is_nothrow_xible): Likewise.
* method.c (is_nothrow_xible): New.
(is_trivially_xible): Tweak.
* parser.c (cp_parser_primary_expression): Handle the new RID_*.
(cp_parser_trait_expr): Likewise.
* semantics.c (trait_expr_value): Handle the new RID_*.
(finish_trait_expr): Likewise.
libstdc++-v3/ChangeLog:
* include/std/type_traits (__is_nt_constructible_impl): Remove.
(__is_nothrow_constructible_impl): Adjust.
(is_nothrow_default_constructible): Likewise.
(__is_nt_assignable_impl): Remove.
(__is_nothrow_assignable_impl): Adjust.
Jan Hubicka [Mon, 26 Oct 2020 13:10:45 +0000 (14:10 +0100)]
Fix simdclones
gcc/ChangeLog:
PR ipa/97576
* cgraphclones.c (cgraph_node::materialize_clone): Clear stmt
references.
* cgraphunit.c (mark_functions_to_output): Do not clear them here.
* ipa-inline-transform.c (inline_transform): Clear stmt references.
* symtab.c (symtab_node::clear_stmts_in_references): Make recursive
for clones.
* tree-ssa-structalias.c (ipa_pta_execute): Do not clear references.
gcc/testsuite/ChangeLog:
PR ipa/97576
* gcc.c-torture/compile/pr97576.c: New test.
zhengnannan [Mon, 26 Oct 2020 13:02:18 +0000 (13:02 +0000)]
AArch64: Add FLAG for store intrinsics [PR94442]
2020-10-26 Zhiheng Xie <xiezhiheng@huawei.com>
Nannan Zheng <zhengnannan@huawei.com>
gcc/ChangeLog:
* config/aarch64/aarch64-builtins.c: Add FLAG STORE.
* config/aarch64/aarch64-simd-builtins.def: Add proper FLAG
for store intrinsics.
Jonathan Wakely [Mon, 26 Oct 2020 12:02:50 +0000 (12:02 +0000)]
libstdc++: Fix declarations of memalign etc. for freestanding [PR 97570]
libstdc++-v3/ChangeLog:
PR libstdc++/97570
* libsupc++/new_opa.cc: Declare size_t in global namespace.
Remove unused header.
Kyrylo Tkachov [Mon, 26 Oct 2020 11:42:18 +0000 (11:42 +0000)]
PR tree-optimization/97546 Bail out of find_bswap_or_nop on non-INTEGER_CST sizes
This patch fixes the ICE in the PR by bailing out of find_bswap_or_nop
on poly_int sizes.
I don't think it intends to handle them and from my reading of the code
it's the most appropriate place to reject them
here rather than in the callers.
Bootstrapped and tested on aarch64-none-linux-gnu.
gcc/
PR tree-optimization/97546
* gimple-ssa-store-merging.c (find_bswap_or_nop): Return NULL if
type is not INTEGER_CST.
gcc/testsuite/
PR tree-optimization/97546
* gcc.target/aarch64/sve/acle/general/pr97546.c: New test.
Richard Biener [Fri, 23 Oct 2020 06:40:15 +0000 (08:40 +0200)]
middle-end/97521 - always use single-bit bools in mask vector types
This makes us always use a single-bit boolean type component type
for integer mode mask VECTOR_BOOLEAN_TYPE_P to match the RTL and target
representation. This aovids the need for magic translation and
the inconsistencies from the translation requirement now that
we expose temporaries of those types on the GIMPLE level.
2020-10-23 Richard Biener <rguenther@suse.de>
PR middle-end/97521
* expr.c (const_scalar_mask_from_tree): Remove.
(expand_expr_real_1): Always VIEW_CONVERT integer mode
vector constants to an integer type.
* tree.c (build_truth_vector_type_for_mode): Use a single-bit
boolean component type for non-vector-mode mask_mode.
* gcc.target/i386/pr97521.c: New testcase.
H.J. Lu [Wed, 15 Jul 2020 17:34:54 +0000 (10:34 -0700)]
x86: Inline strncmp only with -minline-all-stringops
Expand strncmp to "repz cmpsb" only with -minline-all-stringops since
"repz cmpsb" can be much slower than strncmp function implemented with
vector instructions, see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
gcc/
PR target/95458
* config/i386/i386-expand.c (ix86_expand_cmpstrn_or_cmpmem):
Return false for -mno-inline-all-stringops.
gcc/testsuite/
PR target/95458
* gcc.target/i386/pr95458-1.c: New test.
* gcc.target/i386/pr95458-2.c: Likewise.
H.J. Lu [Thu, 14 May 2020 20:06:23 +0000 (13:06 -0700)]
x86: Add cmpmemsi for -minline-all-stringops
We used to expand memcmp to "repz cmpsb" via cmpstrnsi. It was changed
by
commit
9b0f6f5e511ca512e4faeabc81d2fd3abad9b02f
Author: Nick Clifton <nickc@redhat.com>
Date: Fri Aug 12 16:26:11 2011 +0000
builtins.c (expand_builtin_memcmp): Do not use cmpstrnsi pattern.
* builtins.c (expand_builtin_memcmp): Do not use cmpstrnsi
pattern.
* doc/md.texi (cmpstrn): Note that the comparison stops if both
fetched bytes are zero.
(cmpstr): Likewise.
(cmpmem): Note that the comparison does not stop if both of the
fetched bytes are zero.
Duplicate the cmpstrn pattern for cmpmem. The only difference is that
the length argument of cmpmem is guaranteed to be less than or equal to
lengths of 2 memory areas. Since "repz cmpsb" can be much slower than
memcmp function implemented with vector instruction, see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
expand cmpmem to "repz cmpsb" only for -minline-all-stringops.
gcc/
PR target/95151
* config/i386/i386-expand.c (ix86_expand_cmpstrn_or_cmpmem): New
function.
* config/i386/i386-protos.h (ix86_expand_cmpstrn_or_cmpmem): New
prototype.
* config/i386/i386.md (cmpmemsi): New pattern.
gcc/testsuite/
PR target/95151
* gcc.target/i386/pr95151-1.c: New test.
* gcc.target/i386/pr95151-2.c: Likewise.
* gcc.target/i386/pr95151-3.c: Likewise.
* gcc.target/i386/pr95151-4.c: Likewise.
Andreas Krebbel [Mon, 26 Oct 2020 10:41:55 +0000 (11:41 +0100)]
IBM Z: Add vcond_mask expander
After adding vec_cmp expanders we have seen various performance
related regression in the testsuite. These appear to be caused by a
missing vcond_mask definition in the backend. Fixed with this patch.
The patch fixes the following testsuite fails:
FAIL: gcc.dg/vect/vect-21.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorized 3 loops" 1
FAIL: gcc.dg/vect/vect-21.c scan-tree-dump-times vect "vectorized 3 loops" 1
FAIL: gcc.dg/vect/vect-23.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorized 3 loops" 1
FAIL: gcc.dg/vect/vect-23.c scan-tree-dump-times vect "vectorized 3 loops" 1
FAIL: gcc.dg/vect/vect-24.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorized 3 loops" 1
FAIL: gcc.dg/vect/vect-24.c scan-tree-dump-times vect "vectorized 3 loops" 1
FAIL: gcc.dg/vect/vect-live-6.c -flto -ffat-lto-objects scan-tree-dump vect "vectorized 1 loops"
FAIL: gcc.dg/vect/vect-live-6.c scan-tree-dump vect "vectorized 1 loops"
FAIL: gcc.target/s390/vector/vcond-shift.c scan-assembler-times vesrab\\t%v.?,%v.?,7 6
FAIL: gcc.target/s390/vector/vcond-shift.c scan-assembler-times vesraf\\t%v.?,%v.?,31 6
FAIL: gcc.target/s390/vector/vcond-shift.c scan-assembler-times vesrah\\t%v.?,%v.?,15 6
FAIL: gcc.target/s390/vector/vcond-shift.c scan-assembler-times vesrlb\\t%v.?,%v.?,7 4
FAIL: gcc.target/s390/vector/vcond-shift.c scan-assembler-times vesrlf\\t%v.?,%v.?,31 4
FAIL: gcc.target/s390/vector/vcond-shift.c scan-assembler-times vesrlh\\t%v.?,%v.?,15 4
FAIL: gcc.dg/vect/vect-21.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorized 3 loops" 1
FAIL: gcc.dg/vect/vect-21.c scan-tree-dump-times vect "vectorized 3 loops" 1
FAIL: gcc.dg/vect/vect-23.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorized 3 loops" 1
FAIL: gcc.dg/vect/vect-23.c scan-tree-dump-times vect "vectorized 3 loops" 1
FAIL: gcc.dg/vect/vect-24.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorized 3 loops" 1
FAIL: gcc.dg/vect/vect-24.c scan-tree-dump-times vect "vectorized 3 loops" 1
FAIL: gcc.dg/vect/vect-live-6.c -flto -ffat-lto-objects scan-tree-dump vect "vectorized 1 loops"
FAIL: gcc.dg/vect/vect-live-6.c scan-tree-dump vect "vectorized 1 loops"
FAIL: gcc.target/s390/vector/vcond-shift.c scan-assembler-times vesrab\\t%v.?,%v.?,7 6
FAIL: gcc.target/s390/vector/vcond-shift.c scan-assembler-times vesraf\\t%v.?,%v.?,31 6
FAIL: gcc.target/s390/vector/vcond-shift.c scan-assembler-times vesrah\\t%v.?,%v.?,15 6
FAIL: gcc.target/s390/vector/vcond-shift.c scan-assembler-times vesrlb\\t%v.?,%v.?,7 4
FAIL: gcc.target/s390/vector/vcond-shift.c scan-assembler-times vesrlf\\t%v.?,%v.?,31 4
FAIL: gcc.target/s390/vector/vcond-shift.c scan-assembler-times vesrlh\\t%v.?,%v.?,15 4
gcc/ChangeLog:
* config/s390/vector.md ("vcond_mask_<mode><mode>"): New expander.
Richard Biener [Mon, 26 Oct 2020 09:10:46 +0000 (10:10 +0100)]
middle-end/97554 - avoid overflow in alloc size compute
This avoids overflow in the allocation size computations in
sbitmap_vector_alloc when the result exceeds 2GB.
2020-10-26 Richard Biener <rguenther@suse.de>
* sbitmap.c (sbitmap_vector_alloc): Use size_t for byte
quantities to avoid overflow.
Richard Biener [Mon, 26 Oct 2020 09:08:38 +0000 (10:08 +0100)]
tree-optimization/97539 - reset out-of-loop debug uses before peeling
This makes sure to reset out-of-loop debug uses before vectorizer
loop peeling as we cannot make sure to retain the use-def dominance
relationship when there are no LC SSA nodes.
2020-10-26 Richard Biener <rguenther@suse.de>
PR tree-optimization/97539
* tree-vect-loop-manip.c (vect_do_peeling): Reset out-of-loop
debug uses before peeling.
* gcc.dg/pr97539.c: New testcase.
Jan Hubicka [Mon, 26 Oct 2020 10:24:33 +0000 (11:24 +0100)]
Make default duplicate and insert methods of summaries abort; fix fallout
the default duplicate and insert methods of sumaries produce empty
summary that is not useful for anything and makes it easy to introduce
bugs.
This patch makes the default hooks to abort and summaries that do not
need dupicaito/insertion disable the corresponding hooks. I also
implemented missing insertion hook for ipa-sra which forced me to move
analysis out of anonymous namespace.
2020-10-23 Jan Hubicka <hubicka@ucw.cz>
* cgraph.h (struct cgraph_node): Make ipa_transforms_to_apply vl_ptr.
* ipa-inline-analysis.c (initialize_growth_caches): Disable insertion
and duplication hooks.
* ipa-inline-transform.c (clone_inlined_nodes): Clear
ipa_transforms_to_apply.
(save_inline_function_body): Disable insertion hoook for
ipa_saved_clone_sources.
* ipa-prop.c (ipcp_transformation_initialize): Disable insertion hook.
* ipa-prop.h (ipa_node_params_t): Disable insertion hook.
* ipa-reference.c (propagate): Disable insertion hoook.
* ipa-sra.c (ipa_sra_summarize_function): Move out of anonymous
namespace.
(ipa_sra_function_summaries::insert): New virtual function.
* passes.c (execute_one_pass): Do not add transforms to inline clones.
* symbol-summary.h (function_summary_base): Make insert and duplicate
hooks fail instead of silently producing empty summaries; add way to
disable duplication hooks
(call_summary_base): Likewise.
* tree-nested.c (nested_function_info::get_create): Disable insertion
hooks
(maybe_record_nested_function): Likewise.
Stephan Bergmann [Mon, 26 Oct 2020 10:11:50 +0000 (10:11 +0000)]
libstdc++: Add missing exception-specifications in shared_ptr
libstdc++-v3/ChangeLog:
* include/bits/shared_ptr_base.h
(_Sp_counted_base::_M_add_ref_lock_nothrow(): Add noexcept to
definitions to match declaration.
(__shared_count(const __weak_count&, nothrow_t)): Add noexcept
to declaration to match definition.
Ed Schonberg [Mon, 21 Sep 2020 15:54:09 +0000 (11:54 -0400)]
[Ada] Handle Iterated_Component_Association with Others_Choice
gcc/ada/
* exp_aggr.adb (Build_Array_Aggr_Code): If the aggregate
includes an Others_Choice in an association that is an
Iterated_Component_Association, generate a proper loop for it.
Eric Botcazou [Mon, 21 Sep 2020 19:09:29 +0000 (21:09 +0200)]
[Ada] Further small edition to documentation of Ada.Text_IO.Fixed_IO
gcc/ada/
* libgnat/a-tifiio.adb: Add missing sign in documentation.
* libgnat/s-imgrea.ads: Minor fixes in commentary.
Pat Rogers [Mon, 21 Sep 2020 18:23:44 +0000 (13:23 -0500)]
[Ada] Replace GNAT_Extended_Ravenscar profile name
gcc/ada/
* doc/gnat_rm/implementation_defined_pragmas.rst: Include
"Jorvik" in pragma Profile description.
* gnat_rm.texi: Regenerate.
Bob Duff [Mon, 21 Sep 2020 10:26:17 +0000 (06:26 -0400)]
[Ada] Avoid crash on use of Ada 2020 feature
gcc/ada/
* sem_attr.adb (Check_Image_Type): Remove "|", so the compiler
will not crash.
* errout.ads: Improve comment. This has nothing to do with
-gnatQ.
Eric Botcazou [Sun, 20 Sep 2020 19:06:12 +0000 (21:06 +0200)]
[Ada] Further small edition to documentation of Ada.Text_IO.Fixed_IO
gcc/ada/
* libgnat/a-tifiio.adb: Minor editions to documentation.
Piotr Trojanek [Thu, 17 Sep 2020 14:11:56 +0000 (16:11 +0200)]
[Ada] Fix freezing of previous contracts
gcc/ada/
* contracts.adb (Causes_Contract_Freezing): Extend condition to
match the one in Analyze_Subprogram_Body_Helper. This routine is
used both as an assertion at the very start of
Freeze_Previous_Contracts and to detect previous declaration for
which Freeze_Previous_Contracts has been executed.
Eric Botcazou [Sat, 19 Sep 2020 08:42:51 +0000 (10:42 +0200)]
[Ada] Another small edition to documentation of Ada.Text_IO.Fixed_IO
gcc/ada/
* libgnat/a-tifiio.adb: Move around documentaton paragraph.
Piotr Trojanek [Fri, 18 Sep 2020 12:45:51 +0000 (14:45 +0200)]
[Ada] Fix harmless assertion failure in GNATprove mode
gcc/ada/
* inline.adb (Establish_Actual_Mapping_For_Inlined_Call): Add
guard for a call to Set_Last_Assignment with the same condition
as the assertion in that routine and explain why this guard
fails in GNATprove mode.
Eric Botcazou [Fri, 18 Sep 2020 07:04:12 +0000 (09:04 +0200)]
[Ada] Document characteristics of ordinary fixed point types
gcc/ada/
* doc/gnat_rm/implementation_defined_characteristics.rst: Adjust
the entries of 3.5.9(8) and 3.5.9(10).
* gnat_rm.texi: Regenerate.
Eric Botcazou [Thu, 17 Sep 2020 22:32:34 +0000 (00:32 +0200)]
[Ada] Relax assertion on Small in Ada.Text_IO.Fixed_IO
gcc/ada/
* libgnat/a-tifiio.adb: Change the range of supported Small
values.
(E0, E1, E2): Adjust factors.
(Exact): Return false if the Small does not fit in 64 bits.
Dmitriy Anisimkov [Wed, 16 Sep 2020 12:33:51 +0000 (18:33 +0600)]
[Ada] Fix Accept_Socket and Connect_Socket timeout support
gcc/ada/
* libgnat/g-socket.adb (Wait_On_Socket): Boolean parameter
For_Read changed to Event parameter of type
GNAT.Sockets.Poll.Wait_Event_Set. Implementation is simplified
and based on call to GNAT.Sockets.Poll.Wait now.
Eric Botcazou [Wed, 16 Sep 2020 08:51:40 +0000 (10:51 +0200)]
[Ada] Minor editions to documentation of Ada.Text_IO.Fixed_IO
gcc/ada/
* libgnat/a-tifiio.adb: Minor editions to documentation.
Yannick Moy [Tue, 15 Sep 2020 13:28:51 +0000 (15:28 +0200)]
[Ada] Fix GNATprove crash on generics with access types
gcc/ada/
* sem_ch12.adb (Restore_Private_Views): Do not lose the
information provided by Is_Generic_Actual_Type in GNATprove
mode.
Arnaud Charlet [Tue, 15 Sep 2020 12:56:31 +0000 (08:56 -0400)]
[Ada] Suppress warnings on unreferenced parameters of dispatching ops
gcc/ada/
* sem_warn.adb (Warn_On_Unreferenced_Entity): Suppress warning
on formal parameters of all dispatching operations.
gcc/testsuite/
* gnat.dg/warn14.adb: Update expectations.
Piotr Trojanek [Tue, 8 Sep 2020 21:19:36 +0000 (23:19 +0200)]
[Ada] Fix typos in error message for array delta aggregates
gcc/ada/
* sem_aggr.adb (Resolve_Delta_Array_Aggregate): Fix typos in
error message.
Olivier Hainque [Wed, 2 Sep 2020 17:10:59 +0000 (19:10 +0200)]
[Ada] Restore hex addresses and improve symbolic backtraces
gcc/ada/
* libgnat/s-dwalin.adb (Symbolic_Traceback): Always emit the hex
address at the beginning of an entry if suppression is not
requested. Consistently output a "???" for the subprogram name
when it is unknown.
Doug Rupp [Thu, 10 Sep 2020 18:00:32 +0000 (11:00 -0700)]
[Ada] x86-lynx178elf - gcc build fails
gcc/ada/
* s-oscons-tmplt.c (_nfds_t): Use sizeof (unsigned long int).
Piotr Trojanek [Wed, 9 Sep 2020 20:55:36 +0000 (22:55 +0200)]
[Ada] Fix interference between iterated element-and-component association
gcc/ada/
* par-ch4.adb (P_Iterated_Component_Association): Move code for
iterated_element_association to
Build_Iterated_Element_Association.
Yannick Moy [Thu, 10 Sep 2020 15:25:35 +0000 (17:25 +0200)]
[Ada] Do not instantiate generic bodies outside of main unit in GNATprove
gcc/ada/
* sem_ch12.adb (Needs_Body_Instantiated): In GNATprove mode, do
not instantiate bodies outside of the main unit.
Ed Schonberg [Thu, 10 Sep 2020 19:57:06 +0000 (15:57 -0400)]
[Ada] Spurious error on Old attribute reference in delta aggregate
gcc/ada/
* sem_aggr.adb (Resolve_Delta_Array_Aggregate): For an
association that is an iterated component association, attach
the copy of the expression to the tree prior to analysis, in
order to preserve its context. This is needed when verifying
static semantic rules that depend on context, for example that a
use of 'Old appears only within a postcondition.
Bob Duff [Thu, 10 Sep 2020 20:27:14 +0000 (16:27 -0400)]
[Ada] gnatpp: Document that --no-comments-fill is now the default
gcc/ada/
* doc/gnat_ugn/gnat_utility_programs.rst: Document that
--no-comments-fill is now the default.
Gary Dismukes [Thu, 10 Sep 2020 19:12:32 +0000 (15:12 -0400)]
[Ada] Missing errors on extension aggregates with unknown discriminants
gcc/ada/
* sem_aggr.adb (Resolve_Extension_Aggregate): When testing for
an aggregate that is illegal due to having an ancestor type that
has unknown discriminants, add an "or else" condition testing
whether the aggregate type has unknown discriminants and that
Partial_View_Has_Unknown_Discr is also set on the ancestor type.
Extend the comment, including adding ??? about a possible
simpler test.
Bob Duff [Thu, 10 Sep 2020 15:49:50 +0000 (11:49 -0400)]
[Ada] Delete: set Position to No_Element
gcc/ada/
* libgnat/a-cihama.adb, libgnat/a-cohama.adb,
libgnat/a-cohase.adb (Delete): Set Position.Position, and
assert.
Arnaud Charlet [Tue, 8 Sep 2020 20:09:16 +0000 (16:09 -0400)]
[Ada] Improve error on missing with clause
gcc/ada/
* sem_ch8.adb (Find_Direct_Name.Undefined): Handle known unit
names with 3 selectors.
Piotr Trojanek [Wed, 9 Sep 2020 22:01:44 +0000 (00:01 +0200)]
[Ada] Fix SPARK expansion of iterated_component_assoc in delta aggregate
gcc/ada/
* exp_spark.adb (Expand_SPARK_Delta_Or_Update): Add missing call
to Enter_Name, just like it is called for
iterated_component_association in Expand_SPARK_N_Aggregate.
Piotr Trojanek [Wed, 9 Sep 2020 21:55:55 +0000 (23:55 +0200)]
[Ada] Cleanup SPARK expansion of aggregates with iterated_component_assoc
gcc/ada/
* exp_spark.adb (Expand_SPARK_Delta_Or_Update): Reuse local
constant Expr and the Choice_List routine.
(Expand_SPARK_N_Aggregate): Reuse local constant Expr.
Piotr Trojanek [Wed, 9 Sep 2020 19:45:39 +0000 (21:45 +0200)]
[Ada] Fix typos in comments about parsing iterated_component_association
gcc/ada/
* par-ch4.adb (P_Iterated_Component_Association): Fix typos in
comments.
Arnaud Charlet [Fri, 4 Sep 2020 08:08:58 +0000 (04:08 -0400)]
[Ada] AI12-0395: Allow aspect_specifications on formal parameters
gcc/ada/
* par-ch6.adb (P_Formal_Part): Ada 2020 supports scanning
aspects on formal parameters.
* doc/gnat_rm/implementation_defined_aspects.rst (Aspect
Unreferenced): Update documentation.
* gnat_rm.texi: Regenerate.
Ed Schonberg [Wed, 9 Sep 2020 12:40:25 +0000 (08:40 -0400)]
[Ada] Crash on membership test in expression function
gcc/ada/
* freeze.adb (Freeze_Type_Refs): When an entity in an expression
function is a type, freeze the entity and not just its type,
which would be incomplete when the type is derived and/or
tagged.
Piotr Trojanek [Tue, 8 Sep 2020 21:04:13 +0000 (23:04 +0200)]
[Ada] Handle subtype_indication in 'Update for arrays
gcc/ada/
* exp_attr.adb (Expand_Update_Attribute): Handle
subtype_indication just like in Expand_Delta_Array_Aggregate.
Xionghu Luo [Mon, 26 Oct 2020 07:52:39 +0000 (02:52 -0500)]
Add overloaded debug_bb and debug_bb_n with dump flags
Add overloads that accept a flags argument so we can print
debug_bb_n (5, TDF_DETAILS) in gdb, also the debug_bb_slim
variant would then be just a forwarder.
gcc/ChangeLog:
2020-10-26 Xionghu Luo <luoxhu@linux.ibm.com>
* cfg.c (debug_bb): New overloaded function.
(debug_bb_n): New overloaded function.
* cfg.h (debug_bb): New declaration.
(debug_bb_n): New declaration.
* print-rtl.c (debug_bb_slim): Call debug_bb with flags.
GCC Administrator [Mon, 26 Oct 2020 00:16:21 +0000 (00:16 +0000)]
Daily bump.
Iain Sandoe [Sun, 25 Oct 2020 10:11:27 +0000 (10:11 +0000)]
Ada, Darwin, PowerPC : Fix bootstrap after 128 int changes.
The GNATRTL_128BIT_PAIRS/OBJS need to be added for 64bit
multilibs on powerpc-darwin, and for powerpc64-darwin.
gcc/ada/ChangeLog:
* Makefile.rtl: Add GNATRTL_128BIT_PAIRS/OBJS for 64bit
PowerPC Darwin cases.
Thomas Koenig [Sun, 25 Oct 2020 12:16:16 +0000 (13:16 +0100)]
Correct decls for functions which do not pass actual arguments.
A wrong decl for findloc caused segfaults at runtime on
Darwin for ARM; however, this is only a symptom of a larger
disease: The declarations for our library functions are often
inconsistent. This patch solves that problem for the functions
specifically for the functions for which we do not pass optional
arguments, i.e. findloc and (min|max)loc.
It works by saving the symbols of the specific functions in
gfc_intrinsic_namespace and by generating the formal argument
lists from the actual argument lists. Because symbols are
re-used, so are the backend decls.
gcc/fortran/ChangeLog:
PR fortran/97454
* gfortran.h (gfc_symbol): Add pass_as_value flag.
(gfc_copy_formal_args_intr): Add optional argument
copy_type.
(gfc_get_intrinsic_function_symbol): Add prototype.
(gfc_find_intrinsic_symbol): Add prototype.
* intrinsic.c (gfc_get_intrinsic_function_symbol): New function.
(gfc_find_intrinsic_symbol): New function.
* symbol.c (gfc_copy_formal_args_intr): Add argument. Handle case
where the type needs to be copied from the actual argument.
* trans-intrinsic.c (remove_empty_actual_arguments): New function.
(specific_intrinsic_symbol): New function.
(gfc_conv_intrinsic_funcall): Use it.
(strip_kind_from_actual): Adjust so that the expression pointer
is set to NULL.
(gfc_conv_intrinsic_minmaxloc): Likewise.
(gfc_conv_intrinsic_minmaxval): Adjust removal of dim.
* trans-types.c (gfc_sym_type): If sym->pass_as_value is set, do
not pass by reference.
GCC Administrator [Sun, 25 Oct 2020 00:16:26 +0000 (00:16 +0000)]
Daily bump.
H.J. Lu [Fri, 16 Oct 2020 12:59:51 +0000 (05:59 -0700)]
Update check for working assembler --gdwarf-4 option
Rename HAVE_AS_WORKING_DWARF_4_FLAG to HAVE_AS_WORKING_DWARF_N_FLAG
Don't set HAVE_AS_WORKING_DWARF_N_FLAG if --gdwarf-5/--gdwarf-4 generate
an extra assembly input file in debug info from compiler generated
.debug_line or fail with the APP marker:
https://sourceware.org/bugzilla/show_bug.cgi?id=25878
https://sourceware.org/bugzilla/show_bug.cgi?id=26740
https://sourceware.org/bugzilla/show_bug.cgi?id=26778
Also replace success with dwarf4_success in the 32-bit --gdwarf-4 check.
PR bootstrap/97451
* configure.ac (HAVE_AS_WORKING_DWARF_4_FLAG): Renamed to ...
(HAVE_AS_WORKING_DWARF_N_FLAG): This. Don't define if there is
an extra assembly input file in debug info. Replace success
with dwarf4_success in the 32-bit --gdwarf-4 check.
* dwarf2out.c (asm_outputs_debug_line_str): Check
HAVE_AS_WORKING_DWARF_N_FLAG instead of
HAVE_AS_WORKING_DWARF_4_FLAG.
* gcc.c (ASM_DEBUG_SPEC): Likewise.
(ASM_DEBUG_OPTION_SPEC): Likewise.
* config.in: Regenerated.
* configure: Likewise.
Marek Polacek [Thu, 15 Oct 2020 20:10:45 +0000 (16:10 -0400)]
c++: Fix verify_ctor_sanity ICE [PR96241]
The code added in r10-6437 caused us to create a CONSTRUCTOR when we're
{}-initializing an aggregate. Then we pass this new CONSTRUCTOR down to
cxx_eval_constant_expression which, if the CONSTRUCTOR isn't TREE_CONSTANT
or reduced_constant_expression_p, calls cxx_eval_bare_aggregate. In
this case the CONSTRUCTOR wasn't reduced_constant_expression_p because
for r_c_e_p a CONST_DECL isn't good enough so it returns false. So we
go to cxx_eval_bare_aggregate where we crash, because ctx->ctor wasn't
set up properly. So my fix is to do so. Since we're value-initializing,
I'm not setting CONSTRUCTOR_NO_CLEARING. To avoid keeping a garbage
constructor around, I call free_constructor in case the evaluation did
not use it.
gcc/cp/ChangeLog:
PR c++/96241
* constexpr.c (cxx_eval_array_reference): Set up ctx->ctor if we
are initializing an aggregate. Call free_constructor on the new
CONSTRUCTOR if it isn't returned from cxx_eval_constant_expression.
gcc/testsuite/ChangeLog:
PR c++/96241
* g++.dg/cpp0x/constexpr-96241.C: New test.
* g++.dg/cpp1y/constexpr-96241.C: New test.
Aldy Hernandez [Fri, 23 Oct 2020 13:54:58 +0000 (15:54 +0200)]
Handle undefined ranges in get_size_range.
An undefined range was leaking through to the end of this function,
which leads us to use an uninitialized wide_int.
gcc/ChangeLog:
PR tree-optimization/97538
* calls.c (get_size_range): Handle undefined ranges.
gcc/testsuite/ChangeLog:
* g++.dg/pr97538.C: New test.
Martin Liska [Sat, 24 Oct 2020 06:41:16 +0000 (08:41 +0200)]
cgraph: move former_thunk_p out of CHECKING_P macro.
This fixes the following failure:
ld: cgraph.o: in function `cgraph_edge::verify_corresponds_to_fndecl(tree_node*)':
gcc/cgraph.c:3067: undefined reference to `cgraph_node::former_thunk_p()'
ld: cgraph.o: in function `clone_of_p':
gcc/ChangeLog:
* cgraph.c (cgraph_node::former_thunk_p): Move out of CHECKING_P
macro.
Alan Modra [Fri, 23 Oct 2020 01:41:15 +0000 (12:11 +1030)]
[RS6000] altivec style lvx/stvx addresses vs power10
gcc.target/powerpc/fold-vec-st-pixel.c and other testcases fail on
power10, generating
addi 9,5,12
rldicr 9,9,0,59
stxv 34,0(9)
rather than
addi 5,5,12
stvx 2,0,5
for an altivec lvx/stvx style address.
The problem starts with fwprop creating
(insn 9 4 0 2 (set (mem:V8HI (and:DI (plus:DI (reg/v/f:DI 121 [ vpp ])
(const_int 12 [0xc]))
(const_int -16 [0xfffffffffffffff0])) [0 MEM <vector(8) short int> [(void *)_4 & -16B]+0 S16 A128])
(reg/v:V8HI 120 [ vp1 ])) "pixel.c":6:10 1237 {vsx_movv8hi_64bit}
which is finally thrown out as invalid by lra. lra of course does that
by reloading the entire address.
fwprop creates the invalid address due to rs6000_legitimate_address_p
trimming off the outer AND of altivec style addresses before applying
other predicates. address_is_prefixed then allows the inner address.
Now at the time the AND stripping was added (git commit
850e8d3d56d),
rs6000_legitimate_address looked a lot simpler. This patch allows
through just those addresses that were legitimate in those simpler
days.
* config/rs6000/rs6000.c (rs6000_legitimate_address_p): Limit
AND addressing to just lvx/stvx style addresses.
Alan Modra [Thu, 22 Oct 2020 00:13:09 +0000 (10:43 +1030)]
[RS6000] Power10 ICE running gcc.target/powerpc/ppc-ne0-1.c
* config/rs6000/rs6000.md (cstore<mode>4): Don't call
rs6000_emit_int_cmove for power10 when -mno-isel.
GCC Administrator [Sat, 24 Oct 2020 00:16:29 +0000 (00:16 +0000)]
Daily bump.
Nikhil Benesch [Wed, 21 Oct 2020 07:00:04 +0000 (03:00 -0400)]
net/http/cgi: merge upstream changes to default env vars
Incorporate upstream modifications to the cgi package's set of rules
about which environment variables should be inherited by child processes
by default on each platform. In particular this permits tests to pass on
NetBSD by preserving the value of the LD_LIBRARY_PATH environment
variable.
This is a partial backport of the following upstream CLs:
https://golang.org/cl/263802
https://golang.org/cl/263577
https://golang.org/cl/254740
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/264097
Marek Polacek [Fri, 23 Oct 2020 23:26:43 +0000 (19:26 -0400)]
testsuite: Fix -Wsizeof-array-div tests.
gcc/testsuite/ChangeLog:
* c-c++-common/Wsizeof-array-div1.c: Expect certain warnings on
lp64 targets only.
* g++.dg/warn/Wsizeof-array-div2.C: Only run on lp64 targets.
Jan Hubicka [Fri, 23 Oct 2020 19:44:23 +0000 (21:44 +0200)]
Move thunks out of cgraph_node
this patch moves thunk_info out of cgraph_node into a symbol summary.
I also moved it to separate hearder file since cgraph.h became really too
fat. I plan to contiue with similar breakup in order to cleanup interfaces
and reduce WPA memory footprint (symbol table now consumes more memory than
trees)
gcc/ChangeLog:
2020-10-23 Jan Hubicka <hubicka@ucw.cz>
* Makefile.in: Add symtab-thunks.o
(GTFILES): Add symtab-thunks.h and symtab-thunks.cc; remove cgraphunit.c
* cgraph.c: Include symtab-thunks.h.
(cgraph_node::create_thunk): Update
(symbol_table::create_edge): Update
(cgraph_node::dump): Update
(cgraph_node::call_for_symbol_thunks_and_aliases): Update
(set_nothrow_flag_1): Update
(set_malloc_flag_1): Update
(set_const_flag_1): Update
(collect_callers_of_node_1): Update
(clone_of_p): Update
(cgraph_node::verify_node): Update
(cgraph_node::function_symbol): Update
(cgraph_c_finalize): Call thunk_info::release.
(cgraph_node::has_thunk_p): Update
(cgraph_node::former_thunk_p): Move here from cgraph.h; reimplement.
* cgraph.h (struct cgraph_thunk_info): Rename to symtab-thunks.h.
(cgraph_node): Remove thunk field; add thunk bitfield.
(cgraph_node::expand_thunk): Move to symtab-thunks.h
(symtab_thunks_cc_finalize): Declare.
(cgraph_node::has_gimple_body_p): Update.
(cgraph_node::former_thunk_p): Update.
* cgraphclones.c: Include symtab-thunks.h.
(duplicate_thunk_for_node): Update.
(cgraph_edge::redirect_callee_duplicating_thunks): Update.
(cgraph_node::expand_all_artificial_thunks): Update.
(cgraph_node::create_edge_including_clones): Update.
* cgraphunit.c: Include symtab-thunks.h.
(vtable_entry_type): Move to symtab-thunks.c.
(cgraph_node::analyze): Update.
(analyze_functions): Update.
(mark_functions_to_output): Update.
(thunk_adjust): Move to symtab-thunks.c
(cgraph_node::expand_thunk): Move to symtab-thunks.c
(cgraph_node::assemble_thunks_and_aliases): Update.
(output_in_order): Update.
(cgraphunit_c_finalize): Do not clear vtable_entry_type.
(cgraph_node::create_wrapper): Update.
* gengtype.c (open_base_files): Add symtab-thunks.h
* ipa-comdats.c (propagate_comdat_group): UPdate.
(ipa_comdats): Update.
* ipa-cp.c (determine_versionability): UPdate.
(gather_caller_stats): Update.
(count_callers): Update
(set_single_call_flag): Update
(initialize_node_lattices): Update
(call_passes_through_thunk_p): Update
(call_passes_through_thunk): Update
(propagate_constants_across_call): Update
(find_more_scalar_values_for_callers_subset): Update
(has_undead_caller_from_outside_scc_p): Update
* ipa-fnsummary.c (evaluate_properties_for_edge): Update.
(compute_fn_summary): Update.
(inline_analyze_function): Update.
* ipa-icf.c: Include symtab-thunks.h.
(sem_function::equals_wpa): Update.
(redirect_all_callers): Update.
(sem_function::init): Update.
(sem_function::parse): Update.
* ipa-inline-transform.c: Include symtab-thunks.h.
(inline_call): Update.
(save_inline_function_body): Update.
(preserve_function_body_p): Update.
* ipa-inline.c (inline_small_functions): Update.
* ipa-polymorphic-call.c: Include alloc-pool.h, symbol-summary.h,
symtab-thunks.h
(ipa_polymorphic_call_context::ipa_polymorphic_call_context): Update.
* ipa-pure-const.c: Include symtab-thunks.h.
(analyze_function): Update.
* ipa-sra.c (check_for_caller_issues): Update.
* ipa-utils.c (ipa_reverse_postorder): Update.
(ipa_merge_profiles): Update.
* ipa-visibility.c (non_local_p): Update.
(cgraph_node::local_p): Update.
(function_and_variable_visibility): Update.
* ipa.c (symbol_table::remove_unreachable_nodes): Update.
* lto-cgraph.c: Include alloc-pool.h, symbol-summary.h and
symtab-thunks.h
(lto_output_edge): Update.
(lto_output_node): Update.
(compute_ltrans_boundary): Update.
(output_symtab): Update.
(verify_node_partition): Update.
(input_overwrite_node): Update.
(input_node): Update.
* lto-streamer-in.c (fixup_call_stmt_edges): Update.
* symtab-thunks.cc: New file.
* symtab-thunks.h: New file.
* toplev.c (toplev::finalize): Call symtab_thunks_cc_finalize.
* trans-mem.c (ipa_tm_mayenterirr_function): Update.
(ipa_tm_execute): Update.
* tree-inline.c (expand_call_inline): Update.
* tree-nested.c (create_nesting_tree): Update.
(convert_all_function_calls): Update.
(gimplify_all_functions): Update.
* tree-profile.c (tree_profiling): Update.
* tree-ssa-structalias.c (associate_varinfo_to_alias): Update.
* tree.c (free_lang_data_in_decl): Update.
* value-prof.c (init_node_map): Update.
gcc/c-family/ChangeLog:
2020-10-23 Jan Hubicka <hubicka@ucw.cz>
* c-common.c (c_common_finalize_early_debug): Update for new thunk api.
gcc/d/ChangeLog:
2020-10-23 Jan Hubicka <hubicka@ucw.cz>
* decl.cc (finish_thunk): Update for new thunk api.
gcc/lto/ChangeLog:
2020-10-23 Jan Hubicka <hubicka@ucw.cz>
* lto-partition.c (add_symbol_to_partition_1): Update for new thunk
api.
Marek Polacek [Fri, 11 Sep 2020 20:19:08 +0000 (16:19 -0400)]
c, c++: Implement -Wsizeof-array-div [PR91741]
This patch implements a new warning, -Wsizeof-array-div. It warns about
code like
int arr[10];
sizeof (arr) / sizeof (short);
where we have a division of two sizeof expressions, where the first
argument is an array, and the second sizeof does not equal the size
of the array element. See e.g. <https://www.viva64.com/en/examples/v706/>.
Clang makes it possible to suppress the warning by parenthesizing the
second sizeof like this:
sizeof (arr) / (sizeof (short));
so I followed suit. In the C++ FE this was rather easy, because
finish_parenthesized_expr already set TREE_NO_WARNING. In the C FE
I've added a new tree code, PAREN_SIZEOF_EXPR, to discern between the
non-() and () versions.
This warning is enabled by -Wall. An example of the output:
x.c:5:23: warning: expression does not compute the number of elements in this array; element type is ‘int’, not ‘short int’ [-Wsizeof-array-div]
5 | return sizeof (arr) / sizeof (short);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
x.c:5:25: note: add parentheses around ‘sizeof (short int)’ to silence this warning
5 | return sizeof (arr) / sizeof (short);
| ^~~~~~~~~~~~~~
| ( )
x.c:4:7: note: array ‘arr’ declared here
4 | int arr[10];
| ^~~
gcc/c-family/ChangeLog:
PR c++/91741
* c-common.c (verify_tree): Handle PAREN_SIZEOF_EXPR.
(c_common_init_ts): Likewise.
* c-common.def (PAREN_SIZEOF_EXPR): New tree code.
* c-common.h (maybe_warn_sizeof_array_div): Declare.
* c-warn.c (sizeof_pointer_memaccess_warning): Unwrap NOP_EXPRs.
(maybe_warn_sizeof_array_div): New function.
* c.opt (Wsizeof-array-div): New option.
gcc/c/ChangeLog:
PR c++/91741
* c-parser.c (c_parser_binary_expression): Implement -Wsizeof-array-div.
(c_parser_postfix_expression): Set PAREN_SIZEOF_EXPR.
(c_parser_expr_list): Handle PAREN_SIZEOF_EXPR like SIZEOF_EXPR.
* c-tree.h (char_type_p): Declare.
* c-typeck.c (char_type_p): No longer static.
gcc/cp/ChangeLog:
PR c++/91741
* typeck.c (cp_build_binary_op): Implement -Wsizeof-array-div.
gcc/ChangeLog:
PR c++/91741
* doc/invoke.texi: Document -Wsizeof-array-div.
gcc/testsuite/ChangeLog:
PR c++/91741
* c-c++-common/Wsizeof-pointer-div.c: Add dg-warning.
* c-c++-common/Wsizeof-array-div1.c: New test.
* g++.dg/warn/Wsizeof-array-div1.C: New test.
* g++.dg/warn/Wsizeof-array-div2.C: New test.
Martin Sebor [Fri, 23 Oct 2020 18:37:38 +0000 (12:37 -0600)]
PR middle-end/97552 - missing waning passing null to a VLA argument declared [static]
gcc/ChangeLog:
PR middle-end/97552
* attribs.c (init_attr_rdwr_indices): Handle static VLA parameters.
gcc/c/ChangeLog:
PR middle-end/97552
* c-decl.c (get_parm_array_spec): Handle static VLA parameters.
gcc/testsuite/ChangeLog:
PR middle-end/97552
* gcc.dg/Wvla-parameter-2.c: Adjust text of expected warning.
* gcc.dg/Wnonnull-5.c: New test.
Martin Sebor [Fri, 23 Oct 2020 18:30:20 +0000 (12:30 -0600)]
PR c/97463 - ICE in warn_parm_ptrarray_mismatch on an incompatible function redeclaration
gcc/c-family/ChangeLog:
PR c/97463
* c-warn.c (warn_parm_ptrarray_mismatch): Move null test earlier.
gcc/testsuite/ChangeLog:
PR c/97463
* gcc.dg/pr97463.c: New test.
Iain Sandoe [Thu, 22 Oct 2020 17:12:25 +0000 (18:12 +0100)]
Darwin, Ada : Fix bootstrap after stat entry changes.
Darwin struct stat has timeval entry fields for file access and
modification times but they are named differently from those
on Linux.
As a workaround define the field names to the Darwin equivalent.
gcc/ada/ChangeLog:
* adaint.c: On Darwin platforms, define st_atim to
st_atimespec. Likwise st_mtim to st_mtimespec.
Eric Botcazou [Fri, 23 Oct 2020 17:19:19 +0000 (19:19 +0200)]
Fix typo in recent change to Makefile.rtl (bis)
gcc/ada/ChangeLog:
* Makefile.rtl (EXTRA_GNATRTL_NONTASKING_OBJS) [IA64/Linux]: Fix typo.
Eric Botcazou [Fri, 23 Oct 2020 16:16:58 +0000 (18:16 +0200)]
Fix typo in recent change to Makefile.rtl
gcc/ada/ChangeLog:
* Makefile.rtl (EXTRA_GNATRTL_NONTASKING_OBJS) [IA64/Linux]: Fix typo.
Douglas Rupp [Mon, 13 Apr 2020 17:52:39 +0000 (10:52 -0700)]
Link with the configured net lib on vxworks7
The net library is configurable on vxworks7. Pick the library
to include in link closures in accordance with the availability
of a revealing header file, using the recently introduced
if-exist-then-else spec builtin function.
2021-10-23 Douglas Rupp <rupp@adacore.com>
gcc/
* config/vxworks.h (VXWORKS_NET_LIBS_RTP): Use -lrtnet if
rtnetStackLib.h is available,fallback to -lnet otherwise.
David Edelsohn [Fri, 23 Oct 2020 15:21:49 +0000 (11:21 -0400)]
testsuite: Correct vec-rlmi-rlnm.c testsuite expected result
gcc/testsuite/ChangeLog:
* gcc.target/powerpc/vec-rlmi-rlnm.c: Update xxlor expect.
Rasmus Villemoes [Fri, 23 Oct 2020 09:09:05 +0000 (09:09 +0000)]
Fix overzealous gthread support inhibition for vxworks
The tests for macros possibly defined in gthr.h needs to
be performed after the corresponding #include. This was tested
together with the previous updates to gthr-vxworks-thread.c
and gthr-vxworks-cond.c and was meant to be squashed with them.
2010-10-23 Rasmus Villemoes <rv@rasmusvillemoes.dk>
libgcc/
* config/gthr-vxworks-thread.c: #include gthr.h before
testing the guard defined there.
* config/gthr-vxworks-cond.c: Likewise.
Douglas Rupp [Tue, 7 Apr 2020 21:05:57 +0000 (14:05 -0700)]
Add a if-exists-then-else built-in spec function
This patch adds an if-exists-then-else
builtin spec function, which tests for the existence of
a file and returns one or the other of the following
arguments depending on the result of the test.
This differs from the existing if-exists or
if-exists-else function which return the name of the
tested file if it exists.
This new function is of help to a forthcoming change for
VxWorks where we check for the presence of a specific header
file to decide the name of a library to include in the link
closure.
2020-10-23 Douglas Rupp <rupp@adacore.com>
gcc/
* gcc.c (if-exists-then-else): New built-in spec function.
* doc/invoke.texi: Document it.
Tulio Magno Quites Machado Filho via Gcc-patches [Wed, 19 Aug 2020 19:03:31 +0000 (16:03 -0300)]
rs6000: Fix extraneous characters in the documentation
Replace them with a whitespace in order to avoid artifacts in the HTML
document.
2020-08-19 Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
gcc/
* doc/extend.texi (PowerPC Built-in Functions): Replace
extraneous characters with whitespace.
Martin Liska [Fri, 23 Oct 2020 14:20:53 +0000 (16:20 +0200)]
gcov: fix reading of zero sections.
I noticed that during coverage build of binutils.
gcc/ChangeLog:
* gcov.c (read_count_file): Never call gcov_sync with a negative
value.
Jonathan Wakely [Fri, 23 Oct 2020 14:03:38 +0000 (15:03 +0100)]
testsuite: Add noexcept(false) to throwing destructor
I think this test is intended to check this property of the C++
standard:
"If a destructor directly invoked by stack unwinding exits via an
exception, std::terminate is invoked." [except.throw]
Since C++11 any exception escaping a destructor will call
std::terminate, so the test would terminate even if the unwinding
behaviour was wrong.
Give the destructor a potentially-throwing exception specification,
so that we know that terminate was called for the right reason.
gcc/testsuite/ChangeLog:
* g++.dg/compat/eh/filter2_y.C: Add noexcept(false) to
destructor.
Patrick Palka [Fri, 23 Oct 2020 13:03:25 +0000 (09:03 -0400)]
libstdc++: Apply proposed resolutions for LWG 3428, 3447
libstdc++-v3/ChangeLog:
* include/std/ranges (single_view::single_view): Mark the
in place constructor explicit as per LWG 3428.
(take_view): Remove the constraint on the deduction guide's
template parameter as per LWG 3447.
Alexandre Oliva [Fri, 23 Oct 2020 09:37:07 +0000 (06:37 -0300)]
more wraplf for aux long long float: s390, sparc and powerpc
The wraplf version of Ada.Numerics.Aux_Long_Long_Float is needed on
s390* as well. Also add it to sparc*-linux-gnu and powerpc-darwin,
that were missed when adding it for sparc and ppc targets.
for gcc/ada/ChangeLog
PR ada/97504
* Makefile.rtl (LIBGNAT_TARGET_PAIRS): Select wraplf version
of Aux_Long_Long_Float for s390 and remaining sparc and
powerpc targets.
Dmitriy Anisimkov [Sat, 8 Aug 2020 12:49:27 +0000 (18:49 +0600)]
[Ada] Sockets.Poll implementation
gcc/ada/
* Makefile.rtl (GNATRTL_SOCKETS_OBJS): New object
g-socpol$(objext) New source files noted: g-socpol.adb,
g-socpol.ads, g-socpol__dummy.adb, g-socpol__dummy.ads,
g-sopowa.adb, g-sopowa__posix.adb, g-sopowa__mingw.adb,
g-spogwa.adb, g-spogwa.ads.
* impunit.adb (Non_Imp_File_Names_95): New base filename
g-socpol in "GNAT Library Units" section for GNAT.Sockets.Poll
unit.
* libgnat/g-socket.ads, libgnat/g-socket.adb:
(Raise_Socket_Error): Moved from body to private part of
specification to use in GNAT.Sockets.Poll.
* libgnat/g-socpol.ads, libgnat/g-socpol.adb: Main unit of the
implementation.
* libgnat/g-socpol__dummy.ads, libgnat/g-socpol__dummy.adb:
Empty unit for the systems without sockets support.
* libgnat/g-spogwa.ads, libgnat/g-spogwa.adb: Generic unit
implementing sockets poll on top of select system call.
* libgnat/g-sopowa.adb (Wait): Separate implementation for
operation systems with poll system call support.
* libgnat/g-sopowa__posix.adb (Wait): Separate implementation
for POSIX select system call.
* libgnat/g-sopowa__mingw.adb (Wait): Separate implementation
for Windows select system call.
* gsocket.h (_WIN32_WINNT): Increase to 0x0600 for winsock2.h to
allow WSAPoll related definitions.
* s-oscons-tmplt.c: Fix comment next to #endif for
#if defined (__linux__) || defined (__ANDROID__) line. Include
<poll.h> for all except VxWorks and Windows.
(SIZEOF_nfds_t): New definition.
(SIZEOF_fd_type): New definition.
(SIZEOF_pollfd_events): New definition.
(POLLIN, POLLPRI, POLLOUT, POLLERR, POLLHUP, POLLNVAL): New
definitions for VxWorks to be able to emulate poll on top of
select in it. Define POLLPRI as zero on Windows as it is not
supported there.
(Poll_Linkname): New definition, because the poll system call
has different name in Windows and POSIX.