Commit Graph

186832 Commits

Author SHA1 Message Date
H.J. Lu
90e46074e6 libsanitizer: Merge with upstream
Merged revision: 7704fedfff6ef5676adb6415f3be0ac927d1a746
2021-07-20 14:21:51 -07:00
Martin Sebor
8bf5b49ebd Correct stpcpy offset computation for -Warray-bounds et al. [PR101397].
Resolves:
PR middle-end/101397 - spurious warning writing to the result of stpcpy minus 1

gcc/ChangeLog:

	PR middle-end/101397
	* builtins.c (gimple_call_return_array): Add argument.  Correct
	offsets for memchr, mempcpy, stpcpy, and stpncpy.
	(compute_objsize_r): Adjust offset computation for argument returning
	built-ins.

gcc/testsuite/ChangeLog:

	PR middle-end/101397
	* gcc.dg/Warray-bounds-80.c: New test.
	* gcc.dg/Warray-bounds-81.c: New test.
	* gcc.dg/Warray-bounds-82.c: New test.
	* gcc.dg/Warray-bounds-83.c: New test.
	* gcc.dg/Warray-bounds-84.c: New test.
	* gcc.dg/Wstringop-overflow-46.c: Adjust expected output.
2021-07-20 13:50:16 -06:00
Jonathan Wakely
124eaa50e0 libstdc++: Fix create_directories to resolve symlinks [PR101510]
When filesystem__create_directories checks to see if the path already
exists and resovles to a directory, it uses filesystem::symlink_status,
which means it reports an error if the path is a symlink. It should use
filesystem::status, so that the target directory is detected, and no
error is reported.

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

libstdc++-v3/ChangeLog:

	PR libstdc++/101510
	* src/c++17/fs_ops.cc (fs::create_directories): Use status
	instead of symlink_status.
	* src/filesystem/ops.cc (fs::create_directories): Likewise.
	* testsuite/27_io/filesystem/operations/create_directories.cc:
	* testsuite/27_io/filesystem/operations/create_directory.cc: Do
	not test with symlinks on Windows.
	* testsuite/experimental/filesystem/operations/create_directories.cc:
	* testsuite/experimental/filesystem/operations/create_directory.cc:
	Do not test with symlinks on Windows.
2021-07-20 20:34:47 +01:00
Martin Sebor
e07d30fdca Handle all UBSAN built-ins in -Wuninitialized [PR101300].
Resolves:
PR middle-end/101300 - -fsanitize=undefined suppresses -Wuninitialized for a VLA read at -O0

gcc/ChangeLog:
	PR middle-end/101300
	* tree-ssa-uninit.c (check_defs): Handle UBSAN built-ins.

gcc/testsuite/ChangeLog:
	PR middle-end/101300
	* gcc.dg/uninit-pr101300.c: New test.
2021-07-20 13:10:11 -06:00
Jeff Law
818203714e Attach MEM_EXPR information when flushing BLKmode args to the stack - V2
gcc/
	* function.c (assign_parm_setup_block): Use adjust_address instead
	of change_address to preserve MEM_EXPR and friends.
2021-07-20 14:54:15 -04:00
Martin Sebor
00dcc88a0e Adjust by-value function vec arguments to by-reference.
gcc/c-family/ChangeLog:

	* c-common.c (c_build_shufflevector): Adjust by-value argument to
	by-const-reference.
	* c-common.h (c_build_shufflevector): Same.

gcc/c/ChangeLog:

	* c-tree.h (c_build_function_call_vec): Adjust by-value argument to
	by-const-reference.
	* c-typeck.c (c_build_function_call_vec): Same.

gcc/ChangeLog:

	* cfgloop.h (single_likely_exit): Adjust by-value argument to
	by-const-reference.
	* cfgloopanal.c (single_likely_exit): Same.
	* cgraph.h (struct cgraph_node): Same.
	* cgraphclones.c (cgraph_node::create_virtual_clone): Same.
	* genautomata.c (merge_states): Same.
	* genextract.c (VEC_char_to_string): Same.
	* genmatch.c (dt_node::gen_kids_1): Same.
	(walk_captures): Adjust by-value argument to by-reference.
	* gimple-ssa-store-merging.c (check_no_overlap): Adjust by-value argument
	to by-const-reference.
	* gimple.c (gimple_build_call_vec): Same.
	(gimple_build_call_internal_vec): Same.
	(gimple_build_switch): Same.
	(sort_case_labels): Same.
	(preprocess_case_label_vec_for_gimple): Adjust by-value argument to
	by-reference.
	* gimple.h (gimple_build_call_vec): Adjust by-value argument to
	by-const-reference.
	(gimple_build_call_internal_vec): Same.
	(gimple_build_switch): Same.
	(sort_case_labels): Same.
	(preprocess_case_label_vec_for_gimple): Adjust by-value argument to
	by-reference.
	* haifa-sched.c (calc_priorities): Adjust by-value argument to
	by-const-reference.
	(sched_init_luids): Same.
	(haifa_init_h_i_d): Same.
	* ipa-cp.c (ipa_get_indirect_edge_target_1): Same.
	(adjust_callers_for_value_intersection): Adjust by-value argument to
	by-reference.
	(find_more_scalar_values_for_callers_subset): Adjust by-value argument to
	by-const-reference.
	(find_more_contexts_for_caller_subset): Same.
	(find_aggregate_values_for_callers_subset): Same.
	(copy_useful_known_contexts): Same.
	* ipa-fnsummary.c (remap_edge_summaries): Same.
	(remap_freqcounting_predicate): Same.
	* ipa-inline.c (add_new_edges_to_heap): Adjust by-value argument to
	by-reference.
	* ipa-predicate.c (predicate::remap_after_inlining): Adjust by-value argument
	to by-const-reference.
	* ipa-predicate.h (predicate::remap_after_inlining): Same.
	* ipa-prop.c (ipa_find_agg_cst_for_param): Same.
	* ipa-prop.h (ipa_find_agg_cst_for_param): Same.
	* ira-build.c (ira_loop_tree_body_rev_postorder): Same.
	* read-rtl.c (add_overload_instance): Same.
	* rtl.h (native_decode_rtx): Same.
	(native_decode_vector_rtx): Same.
	* sched-int.h (sched_init_luids): Same.
	(haifa_init_h_i_d): Same.
	* simplify-rtx.c (native_decode_vector_rtx): Same.
	(native_decode_rtx): Same.
	* tree-call-cdce.c (gen_shrink_wrap_conditions): Same.
	(shrink_wrap_one_built_in_call_with_conds): Same.
	(shrink_wrap_conditional_dead_built_in_calls): Same.
	* tree-data-ref.c (create_runtime_alias_checks): Same.
	(compute_all_dependences): Same.
	* tree-data-ref.h (compute_all_dependences): Same.
	(create_runtime_alias_checks): Same.
	(index_in_loop_nest): Same.
	* tree-if-conv.c (mask_exists): Same.
	* tree-loop-distribution.c (class loop_distribution): Same.
	(loop_distribution::create_rdg_vertices): Same.
	(dump_rdg_partitions): Same.
	(debug_rdg_partitions): Same.
	(partition_contains_all_rw): Same.
	(loop_distribution::distribute_loop): Same.
	* tree-parloops.c (oacc_entry_exit_ok_1): Same.
	(oacc_entry_exit_single_gang): Same.
	* tree-ssa-loop-im.c (hoist_memory_references): Same.
	(loop_suitable_for_sm): Same.
	* tree-ssa-loop-niter.c (bound_index): Same.
	* tree-ssa-reassoc.c (update_ops): Same.
	(swap_ops_for_binary_stmt): Same.
	(rewrite_expr_tree): Same.
	(rewrite_expr_tree_parallel): Same.
	* tree-ssa-sccvn.c (ao_ref_init_from_vn_reference): Same.
	* tree-ssa-sccvn.h (ao_ref_init_from_vn_reference): Same.
	* tree-ssa-structalias.c (process_all_all_constraints): Same.
	(make_constraints_to): Same.
	(handle_lhs_call): Same.
	(find_func_aliases_for_builtin_call): Same.
	(sort_fieldstack): Same.
	(check_for_overlaps): Same.
	* tree-vect-loop-manip.c (vect_create_cond_for_align_checks): Same.
	(vect_create_cond_for_unequal_addrs): Same.
	(vect_create_cond_for_lower_bounds): Same.
	(vect_create_cond_for_alias_checks): Same.
	* tree-vect-slp-patterns.c (vect_validate_multiplication): Same.
	* tree-vect-slp.c (vect_analyze_slp_instance): Same.
	(vect_make_slp_decision): Same.
	(vect_slp_bbs): Same.
	(duplicate_and_interleave): Same.
	(vect_transform_slp_perm_load): Same.
	(vect_schedule_slp): Same.
	* tree-vectorizer.h (vect_transform_slp_perm_load): Same.
	(vect_schedule_slp): Same.
	(duplicate_and_interleave): Same.
	* tree.c (build_vector_from_ctor): Same.
	(build_vector): Same.
	(check_vector_cst): Same.
	(check_vector_cst_duplicate): Same.
	(check_vector_cst_fill): Same.
	(check_vector_cst_stepped): Same.
	* tree.h (build_vector_from_ctor): Same.
2021-07-20 11:16:08 -06:00
Michael Meissner
7fcb33455c PR 100167: Fix vector long long multiply/divide tests on power10.
This patch updates the vector long long multiply and divide tests to
supply the correct code information if power10 code generation is used.

2021-06-18  Michael Meissner  <meissner@linux.ibm.com>

gcc/testsuite/
	PR testsuite/100167
	* gcc.target/powerpc/fold-vec-div-longlong.c: Fix expected code
	generation on power10.
	* gcc.target/powerpc/fold-vec-mult-longlong.c: Likewise.
2021-07-20 12:56:19 -04:00
Jakub Jelinek
e0e82856d5 rs6000: Fix up easy_vector_constant_msb handling [PR101384]
The following gcc.dg/pr101384.c testcase is miscompiled on
powerpc64le-linux.
easy_altivec_constant has code to try construct vector constants with
different element sizes, perhaps different from CONST_VECTOR's mode.  But as
written, that works fine for vspltis[bhw] cases, but not for the vspltisw
x,-1; vsl[bhw] x,x,x case, because that creates always a V16QImode, V8HImode
or V4SImode constant containing broadcasted constant with just the MSB set.
The vspltis_constant function etc. expects the vspltis[bhw] instructions
where the small [-16..15] or even [-32..30] constant is sign-extended to the
remaining step bytes, but that is not the case for the 0x80...00 constants,
with step > 1 we can't handle e.g.
{ 0x80, 0xff, 0xff, 0xff, 0x80, 0xff, 0xff, 0xff, 0x80, 0xff, 0xff, 0xff, 0x80, 0xff, 0xff, 0xff }
vectors but do want to handle e.g.
{ 0, 0, 0, 0x80, 0, 0, 0, 0x80, 0, 0, 0, 0x80, 0, 0, 0, 0x80 }
and similarly with copies > 1 we do want to handle e.g.
{ 0x80808080, 0x80808080, 0x80808080, 0x80808080 }.

2021-07-20  Jakub Jelinek  <jakub@redhat.com>

	PR target/101384
	* config/rs6000/rs6000-protos.h (easy_altivec_constant): Change return
	type from bool to int.
	* config/rs6000/rs6000.c (vspltis_constant): Fix up handling the
	EASY_VECTOR_MSB case if either step or copies is not 1.
	(vspltis_shifted): Fix comment typo.
	(easy_altivec_constant): Change return type from bool to int, instead
	of returning true return byte size of the element mode that should be
	used to synthetize the constant.
	* config/rs6000/predicates.md (easy_vector_constant_msb): Require
	that vspltis_shifted is 0, handle the case where easy_altivec_constant
	assumes using different vector mode from CONST_VECTOR's mode.
	* config/rs6000/altivec.md (easy_vector_constant_msb splitter): Use
	easy_altivec_constant to determine mode in which -1 >> -1 should be
	performed, use rs6000_expand_vector_init instead of gen_vec_initv4sisi.

	* gcc.dg/pr101384.c: New test.
	* gcc.target/powerpc/pr101384-1.c: New test.
	* gcc.target/powerpc/pr101384-2.c: New test.
2021-07-20 17:28:19 +02:00
Jonathan Wakely
89ec3b67db libstdc++: fix is_default_constructible for hash containers [PR 100863]
The recent change to _Hashtable_ebo_helper for this PR broke the
is_default_constructible trait for a hash container with a non-default
constructible allocator. That happens because the constructor needs to
be user-provided in order to initialize the member, and so is not
defined as deleted when the type is not default constructible.

By making _Hashtable derive from _Enable_special_members we can ensure
that the default constructor for the std::unordered_xxx containers is
deleted when it would be ill-formed. This makes the trait give the
correct answer.

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

libstdc++-v3/ChangeLog:

	PR libstdc++/100863
	* include/bits/hashtable.h (_Hashtable): Conditionally delete
	default constructor by deriving from _Enable_special_members.
	* testsuite/23_containers/unordered_map/cons/default.cc: New test.
	* testsuite/23_containers/unordered_set/cons/default.cc: New test.
2021-07-20 16:22:26 +01:00
Richard Sandiford
1ef9b13579 aarch64: Tweak old vect-* tests to avoid new FAILs
I'm not sure what these test were originally designed to test.
vaddv and vmaxv seem to be testing for vectorisation, with associated
scan-assembler tests.  But they use arm_neon.h functions to test
the results, which would presumably also trip many of the scans.
That was probably what the split into vect-fmax-fmin.c and
vect-fmaxv-fminv-compile.c was supposed to avoid.

Anyway, the tests started failing after the recent change to allow
staged reductions for epilogue loops.  And epilogues came into play
because the reduction loops iterate LANES-1 rather than LANES times.
(vmaxv was trying to iterate LANES times, but the gimple optimisers
outsmarted it.  The other two explicitly had a count of LANES-1.)

Just suppressing epilogues causes other issues for vaddv and vmaxv.
The easiest fix therefore seemed to be to use an asm to hide the
initial value of the vmaxv loop (so that it really does iterate
LANES times) and then make the others match that style.

gcc/testsuite/
	PR testsuite/101506
	* gcc.target/aarch64/vect-vmaxv.c: Use an asm to hide the
	true initial value of the reduction from the vectorizer.
	* gcc.target/aarch64/vect-vaddv.c: Likewise.  Make the vector
	loop operate on exactly LANES (rather than LANES-1) iterations.
	* gcc.target/aarch64/vect-fmaxv-fminv.x: Likewise.
2021-07-20 15:42:02 +01:00
Jonathan Wakely
0c4ae4ff46 libstdc++: Add more tests for filesystem::create_directory [PR101510]
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/101510
	* src/c++17/fs_ops.cc (create_dir): Adjust whitespace.
	* testsuite/27_io/filesystem/operations/create_directory.cc:
	Test creating directory with name of existing symlink to
	directory.
	* testsuite/experimental/filesystem/operations/create_directory.cc:
	Likewise.
2021-07-20 12:54:30 +01:00
Richard Biener
7cc2df084b debug/101473 - apply debug prefix maps before checksumming DIEs
The following makes sure to apply the debug prefix maps to filenames
before checksumming DIEs to create the global symbol for the CU DIE
used by LTO to link the late debug to the early debug.  This avoids
binary differences (in said symbol) when compiling with toolchains
installed under a different path and that compensated with appropriate
-fdebug-prefix-map options.

The easiest and most scalable way is to record both the unmapped
and the remapped filename in the dwarf_file_data so the remapping
process takes place at a single point and only once (otherwise it
creates GC garbage at each point doing that).

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

	PR debug/101473
	* dwarf2out.h (dwarf_file_data): Add key member.
	* dwarf2out.c (dwarf_file_hasher::equal): Compare key.
	(dwarf_file_hasher::hash): Hash key.
	(lookup_filename): Remap the filename and store it in the
	filename member of dwarf_file_data when creating a new
	dwarf_file_data.
	(file_name_acquire): Do not remap the filename again.
	(maybe_emit_file): Likewise.
2021-07-20 12:49:59 +02:00
Richard Earnshaw
6f79c7845c dir-locals: Use https for bug references
We've been using https for web references for some time now.

ChangeLog:

	* .dir-locals.el (bug-reference-url-format): Use https.
2021-07-20 11:40:34 +01:00
Richard Earnshaw
b51de13d81 Limit fill-column to 79
The current line-length limit is set to 80, but that allows a
character to appear in the 80th column, and that causes emacs to
display a line-wrap followed by a blank line when the display/window
width is 80 columns.  Furthermore, this seems to contradict the
coding-style rules on the wiki which suggest that the line limit
should be 79.

So reduce the line width in both the emacs control file and the
contrib vimrc file to 79 characters.

ChangeLog:

	* .dir-locals.el (c-mode): Change fill-column to 79.

contrib/ChangeLog:

	* vimrc (textwidth): Change non-gitcommit length to 79.
2021-07-20 11:14:18 +01:00
Jonathan Wright
b7e450c973 aarch64: Refactor TBL/TBX RTL patterns
Rename two-source-register TBL/TBX RTL patterns so that their names
better reflect what they do, rather than confusing them with tbl3 or
tbx4 patterns. Also use the correct "neon_tbl2" type attribute for
both patterns.

Rename single-source-register TBL/TBX patterns for consistency.

gcc/ChangeLog:

2021-07-08  Jonathan Wright  <jonathan.wright@arm.com>

	* config/aarch64/aarch64-simd-builtins.def: Use two variant
	generators for all TBL/TBX intrinsics and rename to
	consistent forms: qtbl[1234] or qtbx[1234].
	* config/aarch64/aarch64-simd.md (aarch64_tbl1<mode>):
	Rename to...
	(aarch64_qtbl1<mode>): This.
	(aarch64_tbx1<mode>): Rename to...
	(aarch64_qtbx1<mode>): This.
	(aarch64_tbl2v16qi): Delete.
	(aarch64_tbl3<mode>): Rename to...
	(aarch64_qtbl2<mode>): This.
	(aarch64_tbx4<mode>): Rename to...
	(aarch64_qtbx2<mode>): This.
	* config/aarch64/aarch64.c (aarch64_expand_vec_perm_1): Use
	renamed qtbl1 and qtbl2 RTL patterns.
	* config/aarch64/arm_neon.h (vqtbl1_p8): Use renamed qtbl1
	RTL pattern.
	(vqtbl1_s8): Likewise.
	(vqtbl1_u8): Likewise.
	(vqtbl1q_p8): Likewise.
	(vqtbl1q_s8): Likewise.
	(vqtbl1q_u8): Likewise.
	(vqtbx1_s8): Use renamed qtbx1 RTL pattern.
	(vqtbx1_u8): Likewise.
	(vqtbx1_p8): Likewise.
	(vqtbx1q_s8): Likewise.
	(vqtbx1q_u8): Likewise.
	(vqtbx1q_p8): Likewise.
	(vtbl1_s8): Use renamed qtbl1 RTL pattern.
	(vtbl1_u8): Likewise.
	(vtbl1_p8): Likewise.
	(vtbl2_s8): Likewise
	(vtbl2_u8): Likewise.
	(vtbl2_p8): Likewise.
	(vtbl3_s8): Use renamed qtbl2 RTL pattern.
	(vtbl3_u8): Likewise.
	(vtbl3_p8): Likewise.
	(vtbl4_s8): Likewise.
	(vtbl4_u8): Likewise.
	(vtbl4_p8): Likewise.
	(vtbx2_s8): Use renamed qtbx2 RTL pattern.
	(vtbx2_u8): Likewise.
	(vtbx2_p8): Likewise.
	(vqtbl2_s8): Use renamed qtbl2 RTL pattern.
	(vqtbl2_u8): Likewise.
	(vqtbl2_p8): Likewise.
	(vqtbl2q_s8): Likewise.
	(vqtbl2q_u8): Likewise.
	(vqtbl2q_p8): Likewise.
	(vqtbx2_s8): Use renamed qtbx2 RTL pattern.
	(vqtbx2_u8): Likewise.
	(vqtbx2_p8): Likewise.
	(vqtbx2q_s8): Likewise.
	(vqtbx2q_u8): Likewise.
	(vqtbx2q_p8): Likewise.
	(vtbx4_s8): Likewise.
	(vtbx4_u8): Likewise.
	(vtbx4_p8): Likewise.
2021-07-20 10:02:41 +01:00
Thomas Schwinge
8168338684 [gcn] Work-around libgomp 'error: array subscript 0 is outside array bounds of ‘__lds struct gomp_thread * __lds[0]’ [-Werror=array-bounds]' some more [PR101484]
With yesterday's commit 9f2bc5077d "[gcn]
Work-around libgomp 'error: array subscript 0 is outside array bounds of
‘__lds struct gomp_thread * __lds[0]’ [-Werror=array-bounds]' [PR101484]",
I did defuse the "unexpected" '-Werror=array-bounds' diagnostics that we see
as of commit a110855667 "Correct handling of
variable offset minus constant in -Warray-bounds [PR100137]".  However, these
'#pragma GCC diagnostic [...]' directives cause some code generation changes
(that seems unexpected, problematic!), which results in a lot (ten thousands)
of 'GCN team arena exhausted' run-time diagnostics, also leading to a few
FAILs:

    PASS: libgomp.c/../libgomp.c-c++-common/for-11.c (test for excess errors)
    [-PASS:-]{+FAIL:+} libgomp.c/../libgomp.c-c++-common/for-11.c execution test

    PASS: libgomp.c/../libgomp.c-c++-common/for-12.c (test for excess errors)
    [-PASS:-]{+FAIL:+} libgomp.c/../libgomp.c-c++-common/for-12.c execution test

    PASS: libgomp.c/../libgomp.c-c++-common/for-3.c (test for excess errors)
    [-PASS:-]{+FAIL:+} libgomp.c/../libgomp.c-c++-common/for-3.c execution test

    PASS: libgomp.c/../libgomp.c-c++-common/for-5.c (test for excess errors)
    [-PASS:-]{+FAIL:+} libgomp.c/../libgomp.c-c++-common/for-5.c execution test

    PASS: libgomp.c/../libgomp.c-c++-common/for-6.c (test for excess errors)
    [-PASS:-]{+FAIL:+} libgomp.c/../libgomp.c-c++-common/for-6.c execution test

    PASS: libgomp.c/../libgomp.c-c++-common/for-9.c (test for excess errors)
    [-PASS:-]{+FAIL:+} libgomp.c/../libgomp.c-c++-common/for-9.c execution test

Same for 'libgomp.c++'.

It remains to be analyzed how '#pragma GCC diagnostic [...]' directives can
cause code generation changes; for now I'm working around the "unexpected"
'-Werror=array-bounds' diagnostics differently.

Overall, still awaiting a different solution, of course.

	libgomp/
	PR target/101484
	* configure.tgt [amdgcn*-*-*] (XCFLAGS): Add
	'-Wno-error=array-bounds'.
	* config/gcn/team.c: Remove '-Werror=array-bounds' work-around.
	* libgomp.h [__AMDGCN__]: Likewise.
2021-07-20 09:14:28 +02:00
Uros Bizjak
6d4da4aeef i386: Remove atomic_storedi_fpu and atomic_loaddi_fpu peepholes [PR100182]
These patterns result in non-atomic sequence.

2021-07-21  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
	PR target/100182
	* config/i386/sync.md (define_peephole2 atomic_storedi_fpu):
	Remove.
	(define_peephole2 atomic_loaddi_fpu): Ditto.

gcc/testsuite/
	PR target/100182
	* gcc.target/i386/pr71245-1.c: Remove.
	* gcc.target/i386/pr71245-2.c: Ditto.
2021-07-20 06:22:56 +02:00
Kito Cheng
e695f0101a RISC-V: Detect python and pick best one for calling multilib-generator
gcc/

	* config.gcc (riscv*-*-*): Detect which python is available.
2021-07-20 11:24:39 +08:00
Kewen Lin
1c0d49b9ce rs6000: Support [u]mul<mode>3_highpart for vector
This patch is to make Power10 newly introduced vector
multiply high (part) instructions exploited in vectorized
loops, it renames existing define_insns as standard pattern
names.  It depends on that patch which enables vectorizer
to recog mul_highpart.

gcc/ChangeLog:

	* config/rs6000/vsx.md (mulhs_<mode>): Rename to...
	(smul<mode>3_highpart): ... this.
	(mulhu_<mode>): Rename to...
	(umul<mode>3_highpart): ... this.
	* config/rs6000/rs6000-builtin.def (MULHS_V2DI, MULHS_V4SI,
	MULHU_V2DI, MULHU_V4SI): Adjust.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/mul-vectorize-3.c: New test.
	* gcc.target/powerpc/mul-vectorize-4.c: New test.
2021-07-19 20:50:13 -05:00
Kewen Lin
a1d2756077 vect: Recog mul_highpart pattern [PR100696]
This patch is to extend the existing pattern mulhs handlings
to cover normal multiply highpart pattern recognization, it
introduces one new internal function IFN_MULH for 1:1 map to
[su]mul_highpart optab.  Since it covers MULT_HIGHPART_EXPR
with optab support, i386 part change is to ensure it follows
the consistent costing path.

Bootstrapped & regtested on powerpc64le-linux-gnu P9,
x86_64-redhat-linux and aarch64-linux-gnu.

gcc/ChangeLog:

	PR tree-optimization/100696
	* internal-fn.c (first_commutative_argument): Add info for IFN_MULH.
	* internal-fn.def (IFN_MULH): New internal function.
	* tree-vect-patterns.c (vect_recog_mulhs_pattern): Add support to
	recog normal multiply highpart as IFN_MULH.
	* config/i386/i386.c (ix86_add_stmt_cost): Adjust for combined
	function CFN_MULH.

gcc/testsuite/ChangeLog:

	PR tree-optimization/100696
	* gcc.target/i386/pr100637-3w.c: Adjust for mul_highpart recog.
2021-07-19 20:49:17 -05:00
GCC Administrator
21ea2f9320 Daily bump. 2021-07-20 00:16:38 +00:00
Ian Lance Taylor
476242fa5c compiler: avoid aliases in receiver types
If a package declares a method on an alias type, the alias would be
used in the export data.  This would then trigger a compiler
assertion on import: we should not be adding methods to aliases.

Fix the problem by ensuring that receiver types do not use alias types.
This seems preferable to consistently avoiding aliases in export data,
as aliases can cross packages.  And it's painful to try to patch this
while writing the export data, as at that point all the types are known.

Test case is https://golang.org/cl/335172.

Fixes golang/go#47131

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/335729
2021-07-19 16:47:40 -07:00
Martin Sebor
4e2fa18262 PR testsuite 101520 - gcc.target/powerpc/pr93658.c has excess errors
gcc/testsuite/ChangeLog:
	* gcc.target/powerpc/pr93658.c: Suppress valid warnings.
2021-07-19 16:45:10 -06:00
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