Commit Graph

186809 Commits

Author SHA1 Message Date
Iain Sandoe
237ab3ee49 coroutines: Adjust outlined function names [PR95520].
The mechanism used to date for uniquing the coroutine helper
functions (actor, destroy) was over-complicating things and
leading to the noted PR and also difficulties in setting
breakpoints on these functions (so this will help PR99215 as
well).

This implementation delegates the adjustment to the mangling
to write_encoding() which necessitates some book-keeping so
that it is possible to determine which of the coroutine
helper names is to be mangled.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

PR c++/95520 - [coroutines] __builtin_FUNCTION() returns mangled .actor instead of original function name

	PR c++/95520

gcc/cp/ChangeLog:

	* coroutines.cc (struct coroutine_info): Add fields for
	actor and destroy function decls.
	(to_ramp): New.
	(coro_get_ramp_function): New.
	(coro_get_actor_function): New.
	(coro_get_destroy_function): New.
	(act_des_fn): Set up mapping between ramp, actor and
	destroy functions.
	(morph_fn_to_coro): Adjust interface to the builder for
	helper function decls.
	* cp-tree.h (DECL_ACTOR_FN, DECL_DESTROY_FN, DECL_RAMP_FN,
	JOIN_STR): New.
	* mangle.c (write_encoding): Handle coroutine helpers.
	(write_unqualified_name): Handle lambda coroutine helpers.

gcc/testsuite/ChangeLog:

	* g++.dg/coroutines/pr95520.C: New test.
2021-07-19 21:10:29 +01:00
David Malcolm
a113b14398 analyzer: add svalue::can_have_associated_state_p [PR101503]
PR analyzer/101503 reports an assertion failure due to an unexpected
"UNKNOWN" value (due to using --param analyzer-max-svalue-depth=0).

This patch fixes this by rejecting attempts to purge state involving
unknown/poisoned svalues (in region_model::purge_state_involving),
as these svalues should not have state associated with them - they
are singletons w.r.t each type.

To be more systematic about this, the patch also introduces a new
svalue::can_have_associated_state_p which returns false for
unknown/poisoned svalues, so that we can reject adding constraints
or sm-state on them, or building various kinds of svalue in terms
of them (e.g. unary ops, binary ops, etc).

gcc/analyzer/ChangeLog:
	PR analyzer/101503
	* constraint-manager.cc (constraint_manager::add_constraint): Use
	can_have_associated_state_p rather than testing for unknown.
	(constraint_manager::get_or_add_equiv_class): Likewise.
	* program-state.cc (sm_state_map::set_state): Likewise.
	(sm_state_map::impl_set_state): Add assertion.
	* region-model-manager.cc
	(region_model_manager::maybe_fold_unaryop): Handle poisoned
	values.
	(region_model_manager::maybe_fold_binop): Move handling of unknown
	values...
	(region_model_manager::get_or_create_binop): ...to here, and
	generalize to use can_have_associated_state_p.
	(region_model_manager::maybe_fold_sub_svalue): Use
	can_have_associated_state_p rather than testing for unknown.
	(region_model_manager::maybe_fold_repeated_svalue): Use unknown
	when the size or repeated value is "unknown"/"poisoned".
	* region-model.cc (region_model::purge_state_involving): Reject
	attempts to purge unknown/poisoned svalues, as these svalues
	should not have state associated with them.
	* svalue.cc (sub_svalue::sub_svalue): Assert that we're building
	on top of an svalue with can_have_associated_state_p.
	(repeated_svalue::repeated_svalue): Likewise.
	(bits_within_svalue::bits_within_svalue): Likewise.
	* svalue.h (svalue::can_have_associated_state_p): New.
	(unknown_svalue::can_have_associated_state_p): New.
	(poisoned_svalue::can_have_associated_state_p): New.
	(unaryop_svalue::unaryop_svalue): Assert that we're building on
	top of an svalue with can_have_associated_state_p.
	(binop_svalue::binop_svalue): Likewise.
	(widening_svalue::widening_svalue): Likewise.

gcc/testsuite/ChangeLog:
	PR analyzer/101503
	* gcc.dg/analyzer/pr101503.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-07-19 15:44:02 -04:00
Indu Bhagat
f007a638a8 debug: Allow means for targets to opt out of CTF/BTF support
CTF/BTF debug formats can be safely enabled for all ELF-based targets by
default in GCC.

CTF/BTF debug formats now adopt a similar approach as taken for DWARF debug
format via the DWARF2_DEBUGGING_INFO.
  - By default, CTF/BTF formats can be enabled for all ELF-based targets.
  - By default, CTF/BTF formats can be disabled for all non ELF-based targets.
  - If the user passed a -gctf but CTF is not enabled for the target, GCC
  issues an error to the user (as is done currently with other debug formats) -
  "target system does not support the 'ctf' debug format". Analogous behavior
  for -gbtf command line option.

A previous commit disabled the CTF and BTF testcases on the AIX platform. This
is not necessary now that CTF and BTF debug formats are disabled by default on
all non-ELF targets. GCC emits an error message when -gctf/-gbtf is used on
such platforms and these tests will be skipped.

gcc/

	* config/elfos.h (CTF_DEBUGGING_INFO): New definition.
	(BTF_DEBUGGING_INFO): Likewise.
	* doc/tm.texi.in: Document the new macros.
	* doc/tm.texi: Regenerated.
	* toplev.c: Guard initialization of debug hooks.

gcc/testsuite/

	* gcc.dg/debug/btf/btf.exp: Do not run BTF testsuite if target does not
	support BTF format. Remove redundant check for AIX.
	* gcc.dg/debug/ctf/ctf.exp: Do not run CTF testsuite if target does not
	support CTF format. Remove redundant check for AIX.
	* lib/gcc-dg.exp: Remove redundant check for AIX.
2021-07-19 10:34:39 -07:00
Indu Bhagat
483dd64546 debug: Add new function ctf_debuginfo_p
gcc/

	* flags.h (ctf_debuginfo_p): New function declaration.
	* opts.c (ctf_debuginfo_p): New function definition.
2021-07-19 10:34:22 -07:00
Andrew Stubbs
aad32a00b7 amdgcn: Add -mxnack and -msram-ecc [PR 100208]
gcc/ChangeLog:

	PR target/100208
	* config/gcn/gcn-hsa.h (DRIVER_SELF_SPECS): New.
	(ASM_SPEC): Set -mattr for xnack and sram-ecc.
	* config/gcn/gcn-opts.h (enum sram_ecc_type): New.
	* config/gcn/gcn-valu.md: Add a warning comment.
	* config/gcn/gcn.c (gcn_option_override): Add "sorry" for -mxnack.
	(output_file_start): Add xnack and sram-ecc state to ".amdgcn_target".
	* config/gcn/gcn.md: Add a warning comment.
	* config/gcn/gcn.opt: Add -mxnack and -msram-ecc.
	* config/gcn/mkoffload.c (EF_AMDGPU_MACH_AMDGCN_GFX908): Remove
	SRAM-ECC flag.
	(EF_AMDGPU_XNACK): New.
	(EF_AMDGPU_SRAM_ECC): New.
	(elf_flags): New.
	(copy_early_debug_info): Use elf_flags.
	(main): Handle -mxnack and -msram-ecc options.
	* doc/invoke.texi: Document -mxnack and -msram-ecc.

gcc/testsuite/ChangeLog:

	PR target/100208
	* gcc.target/gcn/sram-ecc-1.c: New test.
	* gcc.target/gcn/sram-ecc-2.c: New test.
	* gcc.target/gcn/sram-ecc-3.c: New test.
	* gcc.target/gcn/sram-ecc-4.c: New test.
	* gcc.target/gcn/sram-ecc-5.c: New test.
	* gcc.target/gcn/sram-ecc-6.c: New test.
	* gcc.target/gcn/sram-ecc-7.c: New test.
	* gcc.target/gcn/sram-ecc-8.c: New test.
2021-07-19 17:34:21 +01:00
Andrew Pinski
db95ac7745 [AARCH64] Fix PR 101205: csinv does not have an zero_extend version
So the problem is even though there was a csneg with
a zero_extend in the front, there was not one for csinv.
This fixes it by extending that pattern.

OK? Bootstrapped and tested on aarch64-linux-gnu with no regressions.

gcc/ChangeLog:

	PR target/101205
	* config/aarch64/aarch64.md (csneg3_uxtw_insn): Rename to ...
	(*cs<neg_not_cs>3_uxtw_insn4): and extend to NEG_NOT.

gcc/testsuite/ChangeLog:

	PR target/101205
	* gcc.target/aarch64/csinv-neg-1.c: New test.
2021-07-19 08:52:56 -07:00
Marek Polacek
3522fe2a11 c++: Add test for DR 2126
DR 2126

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/constexpr-temp2.C: New test.
2021-07-19 10:16:52 -04:00
Richard Biener
8df3ee8f7d tree-optimization/101505 - properly determine stmt precision for PHIs
Loop vectorization pattern recog fails to walk PHIs when determining
stmt precisions.  This fails to recognize non-mask uses for bools
in PHIs and outer loop vectorization.

2021-07-19  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/101505
	* tree-vect-patterns.c (vect_determine_precisions): Walk
	PHIs also for loop vectorization.

	* gcc.dg/vect/pr101505.c: New testcase.
2021-07-19 14:21:42 +02:00
Thomas Schwinge
9f2bc5077d [gcn] Work-around libgomp 'error: array subscript 0 is outside array bounds of ‘__lds struct gomp_thread * __lds[0]’ [-Werror=array-bounds]' [PR101484]
... seen as of commit a110855667 "Correct
handling of variable offset minus constant in -Warray-bounds [PR100137]".

Awaiting a different solution, of course.

	libgomp/
	PR target/101484
	* config/gcn/team.c: Apply '-Werror=array-bounds' work-around.
	* libgomp.h [__AMDGCN__]: Likewise.
2021-07-19 10:26:12 +02:00
Richard Biener
3d7686a30f Remove gimple_expr_type
This removes the transitional gimple_expr_type API.

2021-07-16  Richard Biener  <rguenther@suse.de>

	* gimple.h (gimple_expr_type): Remove.
	* doc/gimple.texi: Remove gimple_expr_type documentation.
2021-07-19 10:02:14 +02:00
Richard Biener
3ce20b6be5 Remove last gimple_expr_type uses
This removes the last uses of gimple_expr_type.

2021-07-16  Richard Biener  <rguenther@suse.de>

	* tree-ssa-sccvn.c (vn_reference_eq): Handle NULL vr->type.
	(ao_ref_init_from_vn_reference): Likewise.
	(fully_constant_reference): Likewise.
	(vn_reference_lookup_call): Do not set vr->type to random
	values.
	* tree-ssa-pre.c (compute_avail): Do not try to PRE calls
	without a value.
	* tree-vect-generic.c (expand_vector_piecewise): Pass in
	whether we expanded parallel.
	(expand_vector_parallel): Adjust.
	(expand_vector_addition): Likewise.
	(expand_vector_comparison): Likewise.
	(expand_vector_operation): Likewise.
	(expand_vector_scalar_condition): Likewise.
	(expand_vector_conversion): Likewise.
2021-07-19 09:15:18 +02:00
Richard Biener
4a21a8c34a Remove gimple_expr_type uses from value-range code
This removes the last uses from value-range code.

2021-07-16  Richard Biener  <rguenther@suse.de>

	* tree-vrp.c (register_edge_assert_for_2): Use the
	type from the LHS.
	(vrp_folder::fold_predicate_in): Likewise.
	* vr-values.c (gimple_assign_nonzero_p): Likewise.
	(vr_values::extract_range_from_comparison): Likewise.
	(vr_values::extract_range_from_ubsan_builtin): Use the
	type of the first operand.
	(vr_values::extract_range_basic): Push down type
	computation, use the appropriate LHS.
	(vr_values::extract_range_from_assignment): Use the
	type of the LHS.
2021-07-19 07:59:43 +02:00
GCC Administrator
bdea84c4b5 Daily bump. 2021-07-19 00:16:24 +00:00
H.J. Lu
6ae8aac19c x86: Enable the GPR only instructions for -mgeneral-regs-only
For -mgeneral-regs-only, enable the GPR only instructions which are
enabled implicitly by SSE ISAs unless they have been disabled explicitly.

gcc/

	PR target/101492
	* common/config/i386/i386-common.c (ix86_handle_option): For
	-mgeneral-regs-only, enable the GPR only instructions which are
	enabled implicitly by SSE ISAs unless they have been disabled
	explicitly.

gcc/testsuite/

	PR target/101492
	* gcc.target/i386/pr101492-1.c: New test.
	* gcc.target/i386/pr101492-2.c: Likewise.
	* gcc.target/i386/pr101492-3.c: Likewise.
	* gcc.target/i386/pr101492-4.c: Likewise.
2021-07-18 12:37:48 -07:00
Harald Anlauf
f527b82334 Fortran: reject FORMAT tag of unknown type.
gcc/fortran/ChangeLog:

	PR fortran/101084
	* io.c (resolve_tag_format): Extend FORMAT check to unknown type.

gcc/testsuite/ChangeLog:

	PR fortran/101084
	* gfortran.dg/fmt_nonchar_3.f90: New test.
2021-07-18 21:35:53 +02:00
H.J. Lu
5586e7e85d x86: Don't issue vzeroupper if callee returns AVX register
Don't issue vzeroupper before function call if callee returns AVX
register since callee must be compiled with AVX.

gcc/

	PR target/101495
	* config/i386/i386.c (ix86_check_avx_upper_stores): Moved before
	ix86_avx_u128_mode_needed.
	(ix86_avx_u128_mode_needed): Return AVX_U128_DIRTY if callee
	returns AVX register.

gcc/testsuite/

	PR target/101495
	* gcc.target/i386/avx-vzeroupper-28.c: New test.
2021-07-18 12:21:24 -07:00
Antoni Boucher
5cca4131e4 libgccjit: Handle truncation and extension for casts [PR95498]
2021-07-18  Antoni Boucher  <bouanto@zoho.com>

gcc/jit/
	PR target/95498
	* jit-playback.c (convert): Add support to handle truncation and
	extension in the convert function.

gcc/testsuite/
	PR target/95498
	* jit.dg/all-non-failing-tests.h: New test.
	* jit.dg/test-cast.c: New test.

Signed-off-by: Antoni Boucher <bouanto@zoho.com>
2021-07-18 10:09:39 -04:00
GCC Administrator
853921378b Daily bump. 2021-07-18 00:16:23 +00:00
Jan Hubicka
0103d18dfc Support EAF_NOT_RETURNED in tree-ssa-structalias
gcc/ChangeLog:

2021-07-17  Jan Hubicka  <hubicka@ucw.cz>

	* tree-ssa-structalias.c (handle_rhs_call): Support EAF_NOT_RETURNED.
	(handle_const_call): Liekise
	(handle_pure_call): Liekise

gcc/testsuite/ChangeLog:

2021-07-17  Jan Hubicka  <hubicka@ucw.cz>

	* gcc.dg/tree-ssa/modref-6.c: New test.
2021-07-17 14:24:19 +02:00
Andrew MacLeod
704e8a825c Add wi_fold_in_parts.
range-ops uses wi_fold to individually fold subranges one at a time and
then combined them.  This patch first calls wi_fold_in_parts which checks if
one of the subranges is small, and if so, further splits that subrange
into constants.

	gcc/
	PR tree-optimization/96542
	* range-op.cc (range_operator::wi_fold_in_parts): New.
	(range_operator::fold_range): Call wi_fold_in_parts.
	(operator_lshift::wi_fold): Fix broken lshift by [0,0].
	* range-op.h (wi_fold_in_parts): Add prototype.

	gcc/testsuite
	* gcc.dg/pr96542.c: New.
2021-07-16 20:27:10 -04:00
GCC Administrator
87277b6a04 Daily bump. 2021-07-17 00:16:31 +00:00
Jonathan Wakely
3dbc7b809a libstdc++: Improve diagnostics for std::get with invalid tuple index
This adds a deleted overload of std::get<I>(const tuple<Types...>&).
Invalid calls with an out of range index will match the deleted overload
and give a single, clear error about calling a deleted function, instead
of overload resolution errors for every std::get overload in the
library.

This changes the current output of 15+ errors (plus notes and associated
header context) into just two errors (plus context):

error: static assertion failed: tuple index must be in range
error: use of deleted function 'constexpr std::__enable_if_t<(__i >= sizeof... (_Types))> std::get(const std::tuple<_Types ...>&) [with long unsigned int __i = 1; _Elements = {int}; std::__enable_if_t<(__i >= sizeof... (_Types))> = void]'

This seems like a nice improvement, although PR c++/66968 means that
"_Types" is printed in the signature rather than "_Elements".

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/std/tuple (get<I>): Add deleted overload for bad
	index.
	* testsuite/20_util/tuple/element_access/get_neg.cc: Adjust
	expected errors.
2021-07-16 22:24:34 +01:00
Patrick Palka
a8b3861496 c++: alias CTAD in unevaluated context [PR101233]
This is the alias CTAD version of the CTAD bug PR93248, and the fix is
the same: clear cp_unevaluated_operand so that the entire chain of
DECL_ARGUMENTS gets substituted.

	PR c++/101233

gcc/cp/ChangeLog:

	* pt.c (alias_ctad_tweaks): Clear cp_unevaluated_operand for
	substituting DECL_ARGUMENTS.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/class-deduction-alias10.C: New test.
2021-07-16 16:21:13 -04:00
Patrick Palka
d04b0c7579 c++: covariant reference return types [PR99664]
This implements the wording changes of CWG 960 which clarifies that two
reference types are covariant only if they're both lvalue references
or both rvalue references.

	DR 960
	PR c++/99664

gcc/cp/ChangeLog:

	* search.c (check_final_overrider): Compare TYPE_REF_IS_RVALUE
	when the return types are references.

gcc/testsuite/ChangeLog:

	* g++.dg/inherit/covariant23.C: New test.
2021-07-16 16:21:10 -04:00
David Malcolm
9faf834862 analyzer: add region_model::check_region_access
I've been experimenting with various new diagnostics that
require a common place for the analyzer to check the validity
of reads or writes to memory (e.g. buffer overflow).

As preliminary work, this patch adds new
  region_model::check_region_for_{read|write} functions
which are called anywhere that the analyzer "sees" memory being
read from or written to (via region_model::get_store_value and
region_model::set_value).

This takes over the hardcoded calls to check_for_writable_region
(allowing for other kinds of checks on writes); checking reads is
currently a no-op.

gcc/analyzer/ChangeLog:
	* analyzer.h (enum access_direction): New.
	* engine.cc (exploded_node::on_longjmp): Update for new param of
	get_store_value.
	* program-state.cc (program_state::prune_for_point): Likewise.
	* region-model-impl-calls.cc (region_model::impl_call_memcpy):
	Replace call to check_for_writable_region with call to
	check_region_for_write.
	(region_model::impl_call_memset): Likewise.
	(region_model::impl_call_strcpy): Likewise.
	* region-model-reachability.cc (reachable_regions::add): Update
	for new param of get_store_value.
	* region-model.cc (region_model::get_rvalue_1): Likewise, also for
	get_rvalue_for_bits.
	(region_model::get_store_value): Add ctxt param and use it to call
	check_region_for_read.
	(region_model::get_rvalue_for_bits): Add ctxt param and use it to
	call get_store_value.
	(region_model::check_region_access): New.
	(region_model::check_region_for_write): New.
	(region_model::check_region_for_read): New.
	(region_model::set_value): Update comment.  Replace call to
	check_for_writable_region with call to check_region_for_write.
	* region-model.h (region_model::get_rvalue_for_bits): Add ctxt
	param.
	(region_model::get_store_value): Add ctxt param.
	(region_model::check_region_access): New decl.
	(region_model::check_region_for_write): New decl.
	(region_model::check_region_for_read): New decl.
	* region.cc (region_model::copy_region): Update call to
	get_store_value.
	* svalue.cc (initial_svalue::implicitly_live_p): Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-07-16 15:49:17 -04:00
David Malcolm
9ea10c4805 analyzer: add __analyzer_dump_state
gcc/analyzer/ChangeLog:
	* engine.cc (exploded_node::on_stmt_pre): Handle
	__analyzer_dump_state.
	* program-state.cc (extrinsic_state::get_sm_idx_by_name): New.
	(program_state::impl_call_analyzer_dump_state): New.
	* program-state.h (extrinsic_state::get_sm_idx_by_name): New decl.
	(program_state::impl_call_analyzer_dump_state): New decl.
	* region-model-impl-calls.cc
	(call_details::get_arg_string_literal): New.
	* region-model.h (call_details::get_arg_string_literal): New decl.

gcc/ChangeLog:
	* doc/analyzer.texi: Add __analyzer_dump_state.

gcc/testsuite/ChangeLog:
	* gcc.dg/analyzer/analyzer-decls.h (__analyzer_dump_state): New.
	* gcc.dg/analyzer/dump-state.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-07-16 15:47:06 -04:00
David Malcolm
5932dd35ea analyzer: add svalue::maybe_get_region
gcc/analyzer/ChangeLog:
	* program-state.cc (program_state::detect_leaks): Simplify using
	svalue::maybe_get_region.
	* region-model-impl-calls.cc (region_model::impl_call_fgets): Likewise.
	(region_model::impl_call_fread): Likewise.
	(region_model::impl_call_free): Likewise.
	(region_model::impl_call_operator_delete): Likewise.
	* region-model.cc (selftest::test_stack_frames): Likewise.
	(selftest::test_state_merging): Likewise.
	* svalue.cc (svalue::maybe_get_region): New.
	* svalue.h (svalue::maybe_get_region): New decl.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-07-16 15:45:33 -04:00
Andrew Pinski
e06b1c5ac0 Fix PR 101453: ICE with optimize and large integer constant
The problem is the buffer is too small to hold "-O" and
the interger.  This fixes the problem by use the correct size
instead.

Changes since v1:
* v2: Use HOST_BITS_PER_LONG and just divide by 3 instead of
3.32.

OK? Bootstrapped and tested on x86_64-linux with no regressions.

gcc/c-family/ChangeLog:

	PR c/101453
	* c-common.c (parse_optimize_options): Use the correct
	size for buffer.
2021-07-16 11:51:35 -07:00
Martin Sebor
94ba897be8 PR testsuite/101468 - Wstringop-overflow tests failures
gcc/testsuite/ChangeLog:

	PR testsuite/101468
	* gcc.dg/Wstringop-overflow-41.c: Adjust to avoid target-specific
	failures.
	* gcc.dg/Wstringop-overflow-42.c: Same.
	* gcc.dg/Wstringop-overflow-68.c: Same.
	* gcc.dg/Wstringop-overflow-70.c: Same.
	* gcc.dg/Wstringop-overflow-71.c: Same.
	* gcc.dg/strlenopt-95.c: Fix typos.
2021-07-16 11:11:23 -06:00
Bill Schmidt
fa5f8b49e5 rs6000: Red-black tree implementation for balanced tree search
2021-06-08  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rbtree.c: New file.
	* config/rs6000/rbtree.h: New file.
2021-07-16 12:53:13 -04:00
Bill Schmidt
e11b02f172 rs6000: Add functions for matching types, part 3 of 3
2021-06-07  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-gen-builtins.c (restriction): New enum.
	(typeinfo): Add restr field.
	(match_bracketed_pair): New function.
	(match_const_restriction): Implement.
2021-07-16 12:53:03 -04:00
Bill Schmidt
81736934dd rs6000: Add functions for matching types, part 2 of 3
2021-04-02  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-gen-builtins.c (match_basetype): Implement.
2021-07-16 12:52:54 -04:00
Bill Schmidt
0d685dfbb6 rs6000: Add functions for matching types, part 1 of 3
2021-06-07  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-gen-builtins.c (void_status): New enum.
	(basetype): Likewise.
	(typeinfo): Likewise.
	(handle_pointer): New function.
	(match_basetype): New stub function.
	(match_const_restriction): Likewise.
	(match_type): New function.
2021-07-16 12:52:47 -04:00
Bill Schmidt
9abd2ac5a9 rs6000: Add helper functions for parsing
2021-07-16  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-gen-builtins.c (consume_whitespace): New
	function.
	(advance_line): Likewise.
	(safe_inc_pos): Likewise.
	(match_identifier): Likewise.
	(match_integer): Likewise.
	(match_to_right_bracket): Likewise.
2021-07-16 12:52:39 -04:00
Bill Schmidt
43fa306f1d rs6000: Add file support and functions for diagnostic support
2021-06-07  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-gen-builtins.c (bif_file): New variable.
	(ovld_file): Likewise.
	(header_file): Likewise.
	(init_file): Likewise.
	(defines_file): Likewise.
	(pgm_path): Likewise.
	(bif_path): Likewise.
	(ovld_path): Likewise.
	(header_path): Likewise.
	(init_path): Likewise.
	(defines_path): Likewise.
	(LINELEN): New macro.
	(linebuf): New variable.
	(line): Likewise.
	(pos): Likewise.
	(diag): Likewise.
	(bif_diag): New function.
	(ovld_diag): Likewise.
2021-07-16 12:52:31 -04:00
Bill Schmidt
4a720a9547 rs6000: Add initial input files
This patch adds a tiny subset of the built-in and overload descriptions.

2021-04-02  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-builtin-new.def: New.
	* config/rs6000/rs6000-overload.def: New.
2021-07-16 12:52:23 -04:00
Bill Schmidt
bd5b625228 rs6000: Initial create of rs6000-gen-builtins.c
2021-04-02  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-gen-builtins.c: New.
2021-07-16 12:52:05 -04:00
Bill Schmidt
27d16cb569 Support scanning of build-time GC roots in gengtype
Currently gengtype supports scanning target-specific files for GC roots,
but those files must exist in the source tree.  This patch extends the
support to include header files generated into the build directory.  It
also allows targets to specify build dependencies for s-gtype to ensure
the built headers are up to date prior to running gengtype.

2021-06-15  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* Makefile.in (EXTRA_GTYPE_DEPS): New variable.
	(s-gtype): Depend on EXTRA_GTYPE_DEPS.
	* gengtype-state.c (state_writer::write_state_file_list): Add a
	parameter to the fileslist expression for the number of build
	headers to scan.
	(read_state_files_list): Detect build headers and strip the
	initial "./" or ".\" from their names.
	* gengtype.c (build_headers): New global variable.
	(num_build_headers): Likewise.
	(open_base_files): Emit #include for each build header.
	(main): Detect and count build headers.
	* gengtype.h (build_headers): New extern variable.
	(num_build_headers): Likewise.
2021-07-16 12:51:46 -04:00
Tamar Christina
3bf6e1f89d testsuite: fix IL32 issues with usdot tests.
Fix tests when int == long by using long long instead.

gcc/testsuite/ChangeLog:

	PR middle-end/101457
	* gcc.dg/vect/vect-reduc-dot-19.c: Use long long.
	* gcc.dg/vect/vect-reduc-dot-20.c: Likewise.
	* gcc.dg/vect/vect-reduc-dot-21.c: Likewise.
	* gcc.dg/vect/vect-reduc-dot-22.c: Likewise.
2021-07-16 15:56:35 +01:00
Jonathan Wakely
7581559168 libstdc++: Fix ChangeLog entry for commit r12-2326 2021-07-16 15:03:04 +01:00
Jonathan Wakely
bfb0586ebd libstdc++: Simplify numeric_limits<__max_size_type>
If __int128 is supported then __int_traits<__int128> is guaranteed to be
specialized, so we can remove the preprocessor condition inside the
std::numeric_traits<__detail::__max_size_type> specialization. Simply
using __int_traits<_Sp::__rep> gives the right answer.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/max_size_type.h (numeric_limits<__max_size_type>):
	Use __int_traits unconditionally.
2021-07-16 15:03:03 +01:00
Jonathan Wakely
95891ca020 libstdc++: Modernize <bits/random.h> helpers
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/random.h (_Shift::__value): Use constexpr.
	(_Select_uint_least_t::type): Use using-declaration.
	(_Mod): Likewise.
	* testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error
	line number.
2021-07-16 15:03:03 +01:00
Jonathan Wakely
42167831ab libstdc++: Use __extension__ instead of diagnostic pragmas
This reverts c1676651b6 and uses the
__extension__ keyword to prevent pedantic warnings instead of diagnostic
pragmas.

This also adds the __extension__ keyword in <limits> and <bits/random.h>
where there are some more warnings that I missed in the previous commit.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/cpp_type_traits.h (__INT_N): Use __extension__
	instead of diagnostic pragmas.
	* include/bits/functional_hash.h: Likewise.
	* include/bits/iterator_concepts.h (__is_signed_int128)
	(__is_unsigned_int128): Likewise.
	* include/bits/max_size_type.h (__max_size_type): Likewise.
	(numeric_limits<__max_size_type>): Likewise.
	* include/bits/std_abs.h (abs): Likewise.
	* include/bits/stl_algobase.h (__size_to_integer): Likewise.
	* include/bits/uniform_int_dist.h (uniform_int_distribution):
	Likewise.
	* include/ext/numeric_traits.h (_GLIBCXX_INT_N_TRAITS):
	Likewise.
	* include/std/type_traits (__is_integral_helper<INT_N>)
	(__is_signed_integer, __is_unsigned_integer)
	(__make_unsigned<INT_N>, __make_signed<INT_N>): Likewise.
	* include/std/limits (__INT_N): Add __extension__ keyword.
	* include/bits/random.h (_Select_uint_least_t)
	(random_device): Likewise.
2021-07-16 15:03:03 +01:00
Patrick Palka
1af937eb62 libstdc++: invalid default init in _CachedPosition [PR101231]
The primary template for _CachedPosition is a dummy implementation for
non-forward ranges, the iterators for which generally can't be cached.
Because this implementation doesn't actually cache anything, _M_has_value
is defined to be false and so calls to _M_get (which are always guarded
by _M_has_value) are unreachable.

Still, to suppress a "control reaches end of non-void function" warning
I made _M_get return {}, but after P2325 input iterators are no longer
necessarily default constructible so this workaround now breaks valid
programs.

This patch fixes this by instead using __builtin_unreachable to squelch
the warning.

	PR libstdc++/101231

libstdc++-v3/ChangeLog:

	* include/std/ranges (_CachedPosition::_M_get): For non-forward
	ranges, just call __builtin_unreachable.
	* testsuite/std/ranges/istream_view.cc (test05): New test.
2021-07-16 09:44:42 -04:00
Patrick Palka
73464a472a libstdc++: Give split_view::_Sentinel a default ctor [PR101214]
This gives the new split_view's sentinel type a defaulted default
constructor, something which was overlooked in r12-1665.  This patch
also fixes a couple of other issues with the new split_view as reported
in the PR.

	PR libstdc++/101214

libstdc++-v3/ChangeLog:

	* include/std/ranges (split_view::split_view): Use std::move.
	(split_view::_Iterator::_Iterator): Remove redundant
	default_initializable constraint.
	(split_view::_Sentinel::_Sentinel): Declare.
	* testsuite/std/ranges/adaptors/split.cc (test02): New test.
2021-07-16 09:44:32 -04:00
Marek Polacek
e32234536f c++: Don't hide narrowing errors in system headers
Jonathan pointed me at this issue where

  constexpr unsigned f() { constexpr int n = -1; return unsigned{n}; }

is accepted in system headers, despite the narrowing conversion from
a constant.  I suspect that whereas narrowing warnings should be
disabled, ill-formed narrowing of constants should be a hard error
(which can still be disabled by -Wno-narrowing).

gcc/cp/ChangeLog:

	* typeck2.c (check_narrowing): Don't suppress the pedantic error
	in system headers.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Add
	dg-error.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1y/Wnarrowing2.C: New test.
	* g++.dg/cpp1y/Wnarrowing2.h: New test.
2021-07-16 09:28:37 -04:00
Richard Biener
650c70a9fe Remove more gimple_expr_type uses
This removes a few more uses.

2021-07-16  Richard Biener   <rguenther@suse.de>

	* gimple-ssa-store-merging.c (verify_symbolic_number_p): Use
	the type of the LHS.
	(find_bswap_or_nop_1): Likewise.
	(find_bswap_or_nop): Likewise.
	* tree-vectorizer.h (vect_get_smallest_scalar_type): Adjust
	prototype.
	* tree-vect-data-refs.c (vect_get_smallest_scalar_type):
	Remove unused parameters, pass in the scalar type.  Fix
	internal store function handling.
	* tree-vect-stmts.c (vect_analyze_stmt): Remove assert.
	(vect_get_vector_types_for_stmt): Move down check for
	existing vector stmt after we've determined a scalar type.
	Pass down the used scalar type to vect_get_smallest_scalar_type.
	* tree-vect-generic.c (expand_vector_condition): Use
	the type of the LHS.
	(expand_vector_scalar_condition): Likewise.
	(expand_vector_operations_1): Likewise.
	* tree-vect-patterns.c (vect_widened_op_tree): Likewise.
	(vect_recog_dot_prod_pattern): Likewise.
	(vect_recog_sad_pattern): Likewise.
	(vect_recog_widen_op_pattern): Likewise.
	(vect_recog_widen_sum_pattern): Likewise.
	(vect_recog_mixed_size_cond_pattern): Likewise.
2021-07-16 14:29:06 +02:00
Jan Hubicka
8da8ed435e Implement EAF_NOT_RETURNED tracking in ipa-modref
2021-07-16  Jan Hubicka  <hubicka@ucw.cz>

	* ipa-modref.c (struct escape_entry): Use eaf_fleags_t.
	(dump_eaf_flags): Dump EAF_NOT_RETURNED
	(eaf_flags_useful_p): Use eaf_fleags_t; handle const functions
	and EAF_NOT_RETURNED.
	(modref_summary::useful_p): Likewise.
	(modref_summary_lto::useful_p): Likewise.
	(struct) modref_summary_lto: Use eaf_fleags_t.
	(deref_flags): Handle EAF_NOT_RETURNED.
	(struct escape_point): Use min_flags.
	(modref_lattice::init): Add EAF_NOT_RETURNED.
	(merge_call_lhs_flags): Ignore EAF_NOT_RETURNED functions
	(analyze_ssa_name_flags): Clear EAF_NOT_RETURNED on return;
	handle call flags.
	(analyze_parms): Also analyze const functions; update conition on
	flags usefulness.
	(modref_write): Update streaming.
	(read_section): Update streaming.
	(remap_arg_flags): Use eaf_flags_t.
	(modref_merge_call_site_flags): Hanlde EAF_NOT_RETURNED.
	* ipa-modref.h: (eaf_flags_t): New typedef.
	(struct modref_summary): Use eaf_flags_t.
	* tree-core.h (EAF_NOT_RETURNED): New constant.
2021-07-16 14:21:29 +02:00
Richard Biener
ce777eaedf Get rid of some gimple_expr_type uses
This gets rid of a few gimple_expr_type uses.

2021-07-16  Richard Biener  <rguenther@suse.de>

	* gimple-fold.c (gimple_fold_stmt_to_constant_1): Use
	the type of the LHS.
	(gimple_assign_nonnegative_warnv_p): Likewise.
	(gimple_call_nonnegative_warnv_p): Likewise.  Return false
	if the call has no LHS.
	* gimple.c (gimple_could_trap_p_1): Use the type of the LHS.
	* tree-eh.c (stmt_could_throw_1_p): Likewise.
	* tree-inline.c (insert_init_stmt): Likewise.
	* tree-ssa-loop-niter.c (get_val_for): Likewise.
	* tree-outof-ssa.c (ssa_is_replaceable_p): Use the type of
	the def.
	* tree-ssa-sccvn.c (init_vn_nary_op_from_stmt): Take a
	gassign *.  Use the type of the lhs.
	(vn_nary_op_lookup_stmt): Adjust.
	(vn_nary_op_insert_stmt): Likewise.
2021-07-16 12:52:17 +02:00
Ilya Leoshkevich
0990d93dd8 IBM Z: Use @PLT symbols for local functions in 64-bit mode
This helps with generating code for kernel hotpatches, which contain
individual functions and are loaded more than 2G away from vmlinux.
This should not create performance regressions for the normal use
cases, because for local functions ld replaces @PLT calls with direct
calls.

gcc/ChangeLog:

	* config/s390/predicates.md (bras_sym_operand): Accept all
	functions in 64-bit mode, use UNSPEC_PLT31.
	(larl_operand): Use UNSPEC_PLT31.
	* config/s390/s390.c (s390_loadrelative_operand_p): Likewise.
	(legitimize_pic_address): Likewise.
	(s390_emit_tls_call_insn): Mark __tls_get_offset as function,
	use UNSPEC_PLT31.
	(s390_delegitimize_address): Use UNSPEC_PLT31.
	(s390_output_addr_const_extra): Likewise.
	(print_operand): Add @PLT to TLS calls, handle %K.
	(s390_function_profiler): Mark __fentry__/_mcount as function,
	use %K, use UNSPEC_PLT31.
	(s390_output_mi_thunk): Use only UNSPEC_GOT, use %K.
	(s390_emit_call): Use UNSPEC_PLT31.
	(s390_emit_tpf_eh_return): Mark __tpf_eh_return as function.
	* config/s390/s390.md (UNSPEC_PLT31): Rename from UNSPEC_PLT.
	(*movdi_64): Use %K.
	(reload_base_64): Likewise.
	(*sibcall_brc): Likewise.
	(*sibcall_brcl): Likewise.
	(*sibcall_value_brc): Likewise.
	(*sibcall_value_brcl): Likewise.
	(*bras): Likewise.
	(*brasl): Likewise.
	(*bras_r): Likewise.
	(*brasl_r): Likewise.
	(*bras_tls): Likewise.
	(*brasl_tls): Likewise.
	(main_base_64): Likewise.
	(reload_base_64): Likewise.
	(@split_stack_call<mode>): Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/visibility/noPLT.C: Skip on s390x.
	* g++.target/s390/mi-thunk.C: New test.
	* gcc.target/s390/nodatarel-1.c: Move foostatic to the new
	tests.
	* gcc.target/s390/pr80080-4.c: Allow @PLT suffix.
	* gcc.target/s390/risbg-ll-3.c: Likewise.
	* gcc.target/s390/call.h: Common code for the new tests.
	* gcc.target/s390/call-z10-pic-nodatarel.c: New test.
	* gcc.target/s390/call-z10-pic.c: New test.
	* gcc.target/s390/call-z10.c: New test.
	* gcc.target/s390/call-z9-pic-nodatarel.c: New test.
	* gcc.target/s390/call-z9-pic.c: New test.
	* gcc.target/s390/call-z9.c: New test.
	* gcc.target/s390/mfentry-m64-pic.c: New test.
	* gcc.target/s390/tls.h: Common code for the new TLS tests.
	* gcc.target/s390/tls-pic.c: New test.
	* gcc.target/s390/tls.c: New test.
2021-07-16 12:51:42 +02:00