Commit Graph

176653 Commits

Author SHA1 Message Date
Martin Liska 25c284f148
Use REST API for bug titles in mklog.
* mklog.py: Use REST API for bug title downloading.
2020-05-19 21:17:09 +02:00
Martin Liska 4a5d072ad9
Use commit timestamp in git_update_version.py.
* gcc-changelog/git_commit.py: Add param use_commit_ts
	for to_changelog_entries.
	* gcc-changelog/git_update_version.py: Se use_commit_ts to True.
2020-05-19 21:17:09 +02:00
Martin Sebor c0d8623ce5 PR c++/94923 - False positive -Wclass-memaccess with trivially copyable std::optional
gcc/cp/ChangeLog:

	PR c++/94923
	* call.c ((maybe_warn_class_memaccess): Use is_byte_access_type.
	* cp-tree.h (is_dummy_object): Return bool.
	(is_byte_access_type): Declare new function.
	* tree.c (is_dummy_object): Return bool.
	(is_byte_access_type): Define new function.

gcc/testsuite/ChangeLog:

	PR c++/94923
	* g++.dg/Wclass-memaccess.C: Add tests for std::byte.
2020-05-19 13:08:38 -06:00
Nathan Sidwell ed63c387aa preprocessor: Reimplement raw string lexing [pr95149]
pr95149 is a false positive static analysis checker.  But it
encouranged me to fix raw string lexing, which does contain a
complicated macro and pointers to local variables.  The
reimplementation does away with that macro.  Part of the complication
is we need to undo some of the fresh line processing -- trigraph notes
and escaped line continuations.  But the undone characters need to go
through the raw string processing, as they can legitimately be part of
the prefix marker.  however, in this reformulation we only process one
line marker at a time[*], so there's a limited number of undone
characters.  We can arrange the buffering to make sure we don't split
such an append sequence, and then simply take the characters from the
append buffer.

The prefix scanner had a switch statement, which I discovered was not
optimized as well as an if of a bunch of explicit comparisons (pr
95208 filed).

Finally I adjusted the failure mode.  When we get a bad prefix, we lex
up until the next '"', thus often swallowing the whole raw string.
Previously we'd bail and then the lexer would usually generate stupid
tokens, particularly when meeting the ending '"'.

	libcpp/
	* lex.c (struct lit_accum): New.
	(bufring_append): Replace by lit_accum::append.
	(lex_raw_string): Reimplement, using fragments of the old version.
	(lex_string): Adjust lex_raw_string call.

	gcc/testsuite/
	* c-c++-common/raw-string-14.c: Adjust errors.
	* c-c++-common/raw-string-16.c: Likewise.
	* c-c++-common/raw-string-5.c: Likewise.
2020-05-19 11:39:15 -07:00
Richard Biener 6e7ae154dc Fix FAIL: gcc.target/i386/pr92645-4.c
This adjusts the testcase for the introduced vector promotion/demotion
support.

2020-05-19  Richard Biener  <rguenther@suse.de>

	* gcc.target/i386/pr92645-4.c: Adjust expected pattern.
2020-05-19 20:36:31 +02:00
Nathan Sidwell a641d6d3e6 preprocessor: Fix ICE with EOF in macro args [pr95182]
This was another latent case of us losing an EOF token, but succeeding
anyway.  Since my patch to make us pay more attention to EOFs it came
to light.  We also need to keep the EOF if we fall off the end of the
main file.  Forced includes look like regular nested includes at this
point.

	PR preprocessor/95182
	libcpp/
	* macro.c (collect_args): Preserve EOFif we fell out of the main
	file.
	(cpp_get_token_1): Reformat a couple of short lines.
2020-05-19 06:19:31 -07:00
Jozef Lawrynowicz 92ea8e1bcc TESTSUITE: Fix tests for 16-bit targets
gcc/ChangeLog:

2020-05-19  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* doc/sourcebuild.texi: Document new short_eq_int, ptr_eq_short,
	msp430_small, msp430_large and size24plus DejaGNU effective
	targets.
	Improve grammar in descriptions for size20plus and size32plus effective
	targets.

gcc/testsuite/ChangeLog:

2020-05-19  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* c-c++-common/builtin-has-attribute-7.c: Require size24plus.
	* c-c++-common/cpp/pr63831-1.c: Store result in _has_cpp_attribute in a
	long.
	* c-c++-common/pr81376.c: Skip scan-tree-dump for short_eq_int. Extend
	test for short_eq_int.
	* g++.dg/abi/scoped1.C: Skip dg-warning tests for short_eq_int.
	* g++.dg/cpp0x/constexpr-70001-1.C: Require size24plus.
	* g++.dg/cpp0x/constexpr-bitfield3.C: Require int32plus.
	* g++.dg/cpp0x/enum13.C: Skip dg-warning for short_eq_int.
	* g++.dg/cpp0x/initlist5.C: Add dg-error for short_eq_int.
	* g++.dg/cpp0x/initlist7.C: Add dg-warning for !int32plus.
	* g++.dg/cpp0x/nullptr04.C: Skip dg-error for ptr_eq_short.
	* g++.dg/cpp0x/variadic-value1.C: Add typedef for int32_t.
	* g++.dg/cpp1y/constexpr-arith-overflow.C: Fix test for
	sizeof(int) == sizeof(short).
	* g++.dg/cpp1y/digit-sep-neg.C: Add typedef for int32_t.
	* g++.dg/cpp1y/pr57644.C: Add typedef for uint32_t.
	* g++.dg/cpp1y/pr77321.C: Require size24plus.
	* g++.dg/cpp1y/var-templ4.C: Add typedef for int32_t.
	* g++.dg/cpp1z/direct-enum-init1.C: Skip dg-error for short_eq_int.
	* g++.dg/delayedfold/fwrapv1.C: Skip for int16.
	* g++.dg/expr/bitfield9.C: Add typedef for int32_t.
	* g++.dg/ext/attribute-test-1.C: Add typedef for uint32_t.
	* g++.dg/ext/bitfield1.C: Add typedef for int32_t.
	* g++.dg/ext/flexary13.C: Add typedef for int32_t.
	* g++.dg/ext/utf-cvt.C: Adjust dg-warning for int16.
	* g++.dg/ext/vector28.C: Add typedef for int32_t.
	* g++.dg/ext/vla15.C: Add typedef for int32_t.
	* g++.dg/init/array11.C: Require size32plus.
	* g++.dg/init/array15.C: Require size24plus.
	* g++.dg/init/array4.C: Require size20plus.
	* g++.dg/init/const7.C: Skip dg-message for ptr_eq_short.
	* g++.dg/init/new38.C: Relax regex in dg-error.
	* g++.dg/init/new44.C: Skip dg-error for msp430_small.
	Adjust test for 16-bit size_t.
	Add special case for msp430 -mlarge.
	* g++.dg/init/value9.C: Add typedef for int32_t.
	* g++.dg/ipa/pr77333.C: Add typedef for int32_t.
	* g++.dg/lto/20080908-1_0.C: Add typedef for int32_t.
	* g++.dg/opt/pr55717.C: Add typedef for uint32_t.
	* g++.dg/opt/pr60597.C: Add typedef for int32_t.
	* g++.dg/opt/pr81715.C: Require size20plus.
	* g++.dg/opt/reload3.C: Add typedef for uint32_t.
	* g++.dg/opt/temp2.C: Require size20plus.
	* g++.dg/opt/thunk1.C: Likewise.
	* g++.dg/other/error23.C: Dont assume __SIZEOF_INT__ == 4.
	* g++.dg/other/pr31078.C: Adjust typedef for 32-bit int.
	* g++.dg/parse/concat1.C: Skip dg-error for size20plus.
	* g++.dg/parse/defarg5.C: Add typedef for int32_t and uint32_t.
	* g++.dg/pr48484.C: Add typedef for int32_t.
	* g++.dg/pr53037-2.C: Likewise.
	* g++.dg/pr53037-3.C: Likewise.
	* g++.dg/pr66655.C: Use int32_t.
	* g++.dg/pr66655.h: Add typedef for int32_t.
	* g++.dg/pr66655_1.cc: Use int32_t.
	* g++.dg/pr67351.C: Define 32-bit uint.
	* g++.dg/template/array30.C: Add typedef for int32_t.
	* g++.dg/template/constant1.C: Extend test for 8-bit and 16-bit int.
	* g++.dg/template/constant2.C: Likewise.
	* g++.dg/template/friend18.C: Add typedef for int32_t.
	* g++.dg/template/pr68978.C: Likewise.
	* g++.dg/torture/pr37421.C: Require int_eq_float.
	* g++.dg/torture/pr88861.C: Handle 16-bit int.
	* g++.dg/tree-ssa/pr19807.C: Likewise.
	* g++.dg/tree-ssa/pr27291.C: Fix typedef for uint32_t.
	* g++.dg/tree-ssa/pr49516.C: Fix typedefs for int{16,32}_t and
	uint{32,64}_t.
	* g++.dg/warn/Wconversion-integer.C: Add typedefs for {u,}int32_t.
	* g++.dg/warn/Wconversion-null-2.C: Adjust g() declaration.
	* g++.dg/warn/Wconversion-null.C: Likewise.
	* g++.dg/warn/Wconversion3.C: Skip dg-warning for short_eq_int.
	* g++.dg/warn/Wduplicated-branches1.C: Add dg-warning for short_eq_int.
	* g++.dg/warn/Wplacement-new-size-5.C: Add typedef for int32_t.
	* g++.dg/warn/Wplacement-new-size.C: Likewise.
	* g++.dg/warn/Wstrict-aliasing-5.C: Add typedef for uint32_t.
	* g++.dg/warn/Wstrict-aliasing-bogus-signed-unsigned.C: Add typedef for
	{u,}int32_t.
	* g++.dg/warn/Wtype-limits-Wextra.C: Adjust dg-warning for
	short_eq_int.
	* g++.dg/warn/Wtype-limits.C: Likewise.
	* g++.old-deja/g++.brendan/enum11.C: Add typedef for uint32_t.
	* g++.old-deja/g++.bugs/900227_01.C: Skip dg-error for ptr_eq_short.
	* g++.old-deja/g++.mike/ns15.C: Require size20plus.
	* g++.old-deja/g++.other/exprstmt1.C: Add typedef for uint32_t.
	* g++.old-deja/g++.other/inline12.C: Adjust udword typedef.
	* g++.old-deja/g++.other/new6.C: Add typedef for int32_t.
	* g++.old-deja/g++.pt/crash16.C: Skip for int16.
	* g++.old-deja/g++.robertl/eb76.C: Likewise.
	* g++.old-deja/g++.warn/flow1.C: Add typedef for int32_t.
	* gcc.dg/Walloca-14.c: Adjust -Walloca-larger-than= parameter for
	!ptr32plus.
	* gcc.dg/Warray-bounds-32.c: Adjust dg-warning for size20plus.
	* gcc.dg/Wbuiltin-declaration-mismatch-4.c: Adjust dg-warning for
	short_eq_int.
	Handle case where ptrdiff_t/size_t is __int20.
	* gcc.dg/concat2.c: Skip dg-error for size20plus.
	* gcc.dg/fold-convmaxconv-1.c: Add typedef for {u,}int32_t.
	* gcc.dg/fold-convminconv-1.c: Likewise.
	* gcc.dg/graphite/scop-4.c: Require size20plus.
	* gcc.dg/loop-versioning-1.c: Adjust test for small size_t.
	* gcc.dg/loop-versioning-2.c: Require size20plus.
	* gcc.dg/lto/20081210-1_0.c: Adjust typedef for uintptr_t.
	* gcc.dg/lto/pr85870_0.c: Add typedef for uint32_t.
	* gcc.dg/lto/pr85870_1.c: Likewise.
	* gcc.dg/pr36227.c: Adjust typedef for ptrcast.
	* gcc.dg/pr42611.c: First check for size_t equality with void *
	before trying other types.
	* gcc.dg/pr59963-2.c: Skip dg-warning for int16 instead of
	xfail.
	* gcc.dg/pr68317.c: Add typedef for int32_t.
	* gcc.dg/pr78973.c: Adjust dg-warning for int16.
	* gcc.dg/pr85859.c: Cast using __INTPTR_TYPE__ instead of long.
	* gcc.dg/pr86179.c: Add typedef for {u,}int32_t.
	* gcc.dg/torture/20181024-1.c: Require size32plus.
	* gcc.dg/torture/pr71598-2.c: Skip for short_eq_int.
	* gcc.dg/torture/pr86034.c: Add typedef for int32_t.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-3.c: Adjust dg-warning
	for int16 and msp430 -mlarge.
	* gcc.dg/tree-ssa/integer-addr.c: Use __INTPTR_MAX__ for a large
	constant that is a valid address.
	* gcc.dg/tree-ssa/loop-interchange-10.c: Add typedef for
	int32_t.
	* gcc.dg/tree-ssa/pr84436-3.c: Adjust dg-final for int16.
	* gcc.dg/tree-ssa/pr84648.c: Add typedef for uint32_t.
	* gcc.dg/tree-ssa/scev-8.c: Cast to char if sizeof(int) ==
	sizeof(short).
	* gcc.dg/tree-ssa/ssa-dom-thread-8.c: Adjust test for msp430 -mlarge.
	* lib/target-supports.exp (check_effective_target_size24plus): New.
	(check_effective_target_short_eq_int): New.
	(check_effective_target_ptr_eq_short): New.
	(check_effective_target_msp430_small): New.
	(check_effective_target_msp430_large): New.
2020-05-19 13:15:13 +01:00
Jakub Jelinek e107157171 openmp: Add basic library allocator support.
This patch adds very basic allocator support (omp_{init,destroy}_allocator,
omp_{alloc,free}, omp_[sg]et_default_allocator).
The plan is to use memkind (likely dlopened) for high bandwidth memory, but
that part isn't implemented yet, probably mlock for pinned memory and see
what other options there are for other kinds of memory.
For offloading targets, we need to decide if we want to support the
dynamic allocators (and on which targets), or if e.g. all we do is at compile
time replace omp_alloc/omp_free calls with constexpr predefined allocators
with something special.

And allocate directive and allocator/uses_allocators clauses are future work
too.

2020-05-19  Jakub Jelinek  <jakub@redhat.com>

	* allocator.c: New file.
2020-05-19 14:08:11 +02:00
Martin Liska 4f85a52c94
mklog.py: improve parsing of struct names (ignore GTY).
* mklog.py: Skip GTY for struct names.  Make flake8 happy.
	* test_mklog.py: Add test for GTY.
2020-05-19 12:33:46 +02:00
Martin Liska 53cc8cf9f0
Add missing changelog entry. 2020-05-19 12:03:42 +02:00
Martin Liska 2114f78a95
Fill up entries in reverse order.
contrib/ChangeLog:

	* gcc-changelog/git_update_version.py:
	Fill up entries in reverse order.
2020-05-19 12:01:41 +02:00
Jose E. Marchesi 98456a64b0 bpf: do not save/restore callee-saved registers in function prolog/epilog
BPF considers that every call to a function allocates a fresh set of
registers that are available to the callee, of which the first five
may have bee initialized with the function arguments.  This is
implemented by both interpreter and JIT in the Linux kernel.

This is enforced by the kernel BPF verifier, which will reject any
code in which non-initialized registers are accessed before being
written.  Consequently, the spill instructions generated in function
prologue were causing the verifier to reject our compiled programs.

This patch makes GCC to not save/restore callee-saved registers in
function prologue/epilogue, unless xBPF mode is enabled.

2020-05-19  Jose E. Marchesi  <jose.marchesi@oracle.com>

gcc/
	* config/bpf/bpf.c (bpf_compute_frame_layout): Include space for
	callee saved registers only in xBPF.
	(bpf_expand_prologue): Save callee saved registers only in xBPF.
	(bpf_expand_epilogue): Likewise for restoring.
	* doc/invoke.texi (eBPF Options): Document this is activated by
	-mxbpf.

gcc/testsuite/
	* gcc.target/bpf/xbpf-callee-saved-regs-1.c: New test.
	* gcc.target/bpf/xbpf-callee-saved-regs-2.c: Likewise.
2020-05-19 11:46:40 +02:00
Jose E. Marchesi 51e10276d6 bpf: add support for the -mxbpf option
This patch adds support for a new option -mxbpf.  This tells GCC to
generate code for an expanded version of BPF that relaxes some of the
restrictions imposed by BPF.

2020-05-19  Jose E. Marchesi  <jose.marchesi@oracle.com>

gcc/
	* config/bpf/bpf.opt (mxbpf): New option.
	* doc/invoke.texi (Option Summary): Add -mxbpf.
	(eBPF Options): Document -mxbbpf.
2020-05-19 11:46:06 +02:00
Martin Liska 00243d9a64
New mklog script.
contrib/ChangeLog:

2020-05-15  Martin Liska  <mliska@suse.cz>

	* gcc-git-customization.sh: Add
	alias.gcc-mklog new hook.
	* mklog.py: New file.
	* test_mklog.py: New file.
2020-05-19 11:40:55 +02:00
Martin Liska e576ed7a9d
Move 2 mklog scripts to legacy subfolder.
contrib/ChangeLog:

	* legacy/mklog: Moved from mklog.
	* legacy/mklog.pl: Moved from mklog.pl.
2020-05-19 11:39:58 +02:00
Uros Bizjak 8389e89bd9 Add missing ChangeLog entries. 2020-05-19 11:28:42 +02:00
Uros Bizjak f6e40195ec i386: Add missing vector zero/sign extend expanders [PR92658]
2020-05-19  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:
	PR target/92658
	* config/i386/sse.md (<code>v16qiv16hi2): New expander.
	(<code>v32qiv32hi2): Ditto.
	(<code>v8qiv8hi2): Ditto.
	(<code>v16qiv16si2): Ditto.
	(<code>v8qiv8si2): Ditto.
	(<code>v4qiv4si2): Ditto.
	(<code>v16hiv16si2): Ditto.
	(<code>v8hiv8si2): Ditto.
	(<code>v4hiv4si2): Ditto.
	(<code>v8qiv8di2): Ditto.
	(<code>v4qiv4di2): Ditto.
	(<code>v2qiv2di2): Ditto.
	(<code>v8hiv8di2): Ditto.
	(<code>v4hiv4di2): Ditto.
	(<code>v2hiv2di2): Ditto.
	(<code>v8siv8di2): Ditto.
	(<code>v4siv4di2): Ditto.
	(<code>v2siv2di2): Ditto.

gcc/testsuite/ChangeLog:
	PR target/92658
	* gcc.target/i386/pr92658-sse4.c: New test.
	* gcc.target/i386/pr92658-avx2.c: New test.
	* gcc.target/i386/pr92658-avx512bw.c: New test.
2020-05-19 11:25:46 +02:00
Martin Liska 8f66f175ff
Add missing ChangeLog entry. 2020-05-19 11:12:52 +02:00
Martin Liska 53b663f90a
Fix typo in c-parser.c.
gcc/c/ChangeLog:

	* c-parser.c: Fix typo.
2020-05-19 11:11:47 +02:00
Jakub Jelinek 800bcc8c00 openmp: Add basic library allocator support.
This patch adds very basic allocator support (omp_{init,destroy}_allocator,
omp_{alloc,free}, omp_[sg]et_default_allocator).
The plan is to use memkind (likely dlopened) for high bandwidth memory, but
that part isn't implemented yet, probably mlock for pinned memory and see
what other options there are for other kinds of memory.
For offloading targets, we need to decide if we want to support the
dynamic allocators (and on which targets), or if e.g. all we do is at compile
time replace omp_alloc/omp_free calls with constexpr predefined allocators
with something special.

And allocate directive and allocator/uses_allocators clauses are future work
too.

2020-05-19  Jakub Jelinek  <jakub@redhat.com>

	* omp.h.in (omp_uintptr_t): New typedef.
	(__GOMP_UINTPTR_T_ENUM): Define.
	(omp_memspace_handle_t, omp_allocator_handle_t, omp_alloctrait_key_t,
	omp_alloctrait_value_t, omp_alloctrait_t): New typedefs.
	(__GOMP_DEFAULT_NULL_ALLOCATOR): Define.
	(omp_init_allocator, omp_destroy_allocator, omp_set_default_allocator,
	omp_get_default_allocator, omp_alloc, omp_free): Declare.
	* libgomp.h (struct gomp_team_state): Add def_allocator field.
	(gomp_def_allocator): Declare.
	* libgomp.map (OMP_5.0.1): Export omp_set_default_allocator,
	omp_get_default_allocator, omp_init_allocator, omp_destroy_allocator,
	omp_alloc and omp_free.
	* team.c (gomp_team_start): Copy over ts.def_allocator.
	* env.c (gomp_def_allocator): New variable.
	(parse_wait_policy): Adjust function comment.
	(parse_allocator): New function.
	(handle_omp_display_env): Print OMP_ALLOCATOR.
	(initialize_env): Call parse_allocator.
	* Makefile.am (libgomp_la_SOURCES): Add allocator.c.
	* allocator.c: New file.
	* icv.c (omp_set_default_allocator, omp_get_default_allocator): New
	functions.
	* testsuite/libgomp.c-c++-common/alloc-1.c: New test.
	* testsuite/libgomp.c-c++-common/alloc-2.c: New test.
	* testsuite/libgomp.c-c++-common/alloc-3.c: New test.
	* Makefile.in: Regenerated.
2020-05-19 10:11:01 +02:00
Martin Liska c3b44e3408
Add gcc-verify alias.
* gcc-git-customization.sh: Add gcc-verify alias
	that uses contrib/gcc-changelog/git_check_commit.py.
2020-05-19 09:19:18 +02:00
Kito Cheng f908b69cfd RISC-V: Handle implied extension for -march parser.
- Implied rule are introduced into latest RISC-V ISA spec.

  - Only implemented D implied F-extension. Zicsr and Zifence are not
    implement yet, so the rule not included in this patch.

  - Pass preprocessed arch string to arch.

  - Verified with binutils 2.30 and 2.34.

gcc/ChangeLog

	* common/config/riscv/riscv-common.c (riscv_implied_info_t): New.
	(riscv_implied_info): New.
	(riscv_subset_list): Add handle_implied_ext.
	(riscv_subset_list::to_string): New parameter version_p to
	control output format.
	(riscv_subset_list::handle_implied_ext): New.
	(riscv_subset_list::parse_std_ext): Call handle_implied_ext.
	(riscv_arch_str): New parameter version_p to control output format.
	(riscv_expand_arch): New.
	* config/riscv/riscv-protos.h (riscv_arch_str): New parameter,
	version_p.
	* config/riscv/riscv.h (riscv_expand_arch): New,
	(EXTRA_SPEC_FUNCTIONS): Define.
	(ASM_SPEC): Transform -march= via riscv_expand_arch.

gcc/testsuite/ChangeLog

	* gcc.target/riscv/arch-6.c: New.
	* gcc.target/riscv/attribute-11.c: New.
	* gcc.target/riscv/attribute-12.c: New.
2020-05-19 14:31:58 +08:00
Kito Cheng ca1a9763a1 RISC-V: Update march parser
- The arch string rule has changed in latest spec, it introduced new
   multi-letter extension prefix with 'h' and 'z', and drop `sx`. also
   adjust parsing order for 's' and 'x'.

gcc/ChangeLog

	* riscv-common.c (parse_sv_or_non_std_ext): Rename to
	parse_multiletter_ext.
	(parse_multiletter_ext): Add parsing `h` and `z`, drop `sx`,
	adjust parsing order for 's' and 'x'.

gcc/testsuite/ChangeLog

	* gcc.target/riscv/arch-3.c: Adjust option.
	* gcc.target/riscv/arch-5.c: New.
	* gcc.target/riscv/attribute-9.c: Adjust option and test
	condition.
2020-05-19 14:31:56 +08:00
Richard Biener a4b48fc47c cost invariant nodes from vect_slp_analyze_node_operations SLP walk
2020-05-19  Richard Biener  <rguenther@suse.de>

	* tree-vectorizer.h (_slp_tree::vectype): Add field.
	(SLP_TREE_VECTYPE): New.
	* tree-vect-slp.c (vect_create_new_slp_node): Initialize
	SLP_TREE_VECTYPE.
	(vect_create_new_slp_node): Likewise.
	(vect_prologue_cost_for_slp): Move here from tree-vect-stmts.c
	and simplify.
	(vect_slp_analyze_node_operations): Walk nodes children for
	invariant costing.
	(vect_get_constant_vectors): Use local scope op variable.
	* tree-vect-stmts.c (vect_prologue_cost_for_slp_op): Remove here.
	(vect_model_simple_cost): Adjust.
	(vect_model_store_cost): Likewise.
	(vectorizable_store): Likewise.
2020-05-19 07:59:51 +02:00
Patrick Palka 573e5f0500 c++: Enable spec_hasher table sanitization [PR87847]
It looks like hash table sanitization is now safe to enable for the
decl_specializations and type_specializations tables, probably ever
since PR94454 was fixed.

gcc/cp/ChangeLog:

	PR c++/87847
	* pt.c (init_template_processing): Enable sanitization for
	decl_specializations and type_specializations.
2020-05-18 23:50:32 -04:00
Patrick Palka 864fed4a49 c++: Explain fn template argument type/value mismatches [PR66439]
In fn_type_unifcation, we are passing NULL_TREE as the 'in_decl'
parameter to coerce_template_parms, and this is causing template
type/value mismatch error messages to get suppressed regardless of the
value of 'complain'.

This means that when substitution into a function template fails due to
a type/value mismatch between a template parameter and the provided
template argument, we just say "template argument deduction/substitution
failed:" without a followup explanation of the failure.

Fix this by passing 'fn' instead of NULL_TREE to coerce_template_parms.

gcc/cp/ChangeLog:

	PR c++/66439
	* pt.c (fn_type_unification): Pass 'fn' instead of NULL_TREE as
	the 'in_decl' parameter to coerce_template_parms.

gcc/testsuite/ChangeLog:

	PR c++/66439
	* g++.dg/cpp2a/concepts-ts4.C: Expect a "type/value mismatch"
	diagnostic.
	* g++.dg/cpp2a/concepts-ts6.C: Likewise.
	* g++.dg/template/error56.C: Likewise.
	* g++.dg/template/error59.C: New test.

libstdc++-v3/ChangeLog:

	PR c++/66439
	* testsuite/20_util/pair/astuple/get_neg.cc: Prune "type/value
	mismatch" messages.
	* testsuite/20_util/tuple/element_access/get_neg.cc: Likewise.
2020-05-18 23:50:14 -04:00
GCC Administrator 489fb00b14 Daily bump. 2020-05-19 00:16:28 +00:00
Marek Polacek 2d4e1e144c c++: ICE when shortening right shift [PR94955]
Since r10-6527 fold_for_warn calls maybe_constant_value, which means it
can fold more than it previously could.  In this testcase it means that
cp_build_binary_op/RSHIFT_EXPR set short_shift because now we were able
to fold op1 to an INTEGER_CST.  But then when actually performing the
shortening we crashed because cp_fold_rvalue wasn't able to fold as much
as f_f_w and so tree_int_cst_sgn crashed on a NOP_EXPR.  Therefore the
calls should probably match.

	PR c++/94955
	* typeck.c (cp_build_binary_op): Use fold_for_warn instead of
	cp_fold_rvalue.

	* g++.dg/cpp0x/constexpr-shift2.C: New test.
2020-05-18 19:01:54 -04:00
Marek Polacek bf732686c0 c++: ICE with -Wall and constexpr if [PR94937]
An ICE arises here because we call cp_get_callee_fndecl_nofold in a
template, and we've got a CALL_EXPR whose CALL_EXPR_FN is a BASELINK.
This tickles the INDIRECT_TYPE_P assert in cp_get_fndecl_from_callee.

Fixed by turning the assert into a condition and returning NULL_TREE
in that case.

	PR c++/94937
	* cvt.c (cp_get_fndecl_from_callee): Return NULL_TREE if the function
	type is not INDIRECT_TYPE_P.
	* decl.c (omp_declare_variant_finalize_one): Call
	cp_get_callee_fndecl_nofold instead of looking for the function decl
	manually.

	* g++.dg/cpp1z/constexpr-if34.C: New test.
	* g++.dg/cpp2a/is-constant-evaluated10.C: New test.
2020-05-18 18:53:38 -04:00
Martin Sebor 8edf0adb66 PR middle-end/92815 - spurious -Wstringop-overflow writing into a flexible array of an extern struct
Adjust test to avoid failures in ILP32 mode.

gcc/testsuite/ChangeLog:

	PR middle-end/92815
	* gcc.dg/builtin-object-size-20.c: Adjust to avoid failures in
	ILP32 mode.
2020-05-18 16:31:13 -06:00
Marek Polacek 5d2246a32c c++: Sorry about type-dependent arg for __builtin_has_attribute [PR90915]
Until 92104 is fixed, let's sorry rather than crash.

	PR c++/90915
	* parser.c (cp_parser_has_attribute_expression): Sorry on a
	type-dependent argument.

	* g++.dg/ext/builtin-has-attribute.C: New test.
2020-05-18 18:07:18 -04:00
Martin Sebor 7a41fcde6c PR middle-end/92815 - spurious -Wstringop-overflow writing into a flexible array of an extern struct
gcc/ChangeLog:

	PR middle-end/92815
	* tree-object-size.c (decl_init_size): New function.
	(addr_object_size): Call it.
	* tree.h (last_field): Declare.
	(first_field): Add attribute nonnull.

gcc/testsuite/ChangeLog:

	PR middle-end/92815
	* gcc.dg/Warray-bounds-56.c: Remove xfails.
	* gcc.dg/builtin-object-size-20.c: New test.
	* gcc.dg/builtin-object-size-21.c: New test.
2020-05-18 15:24:12 -06:00
Martin Sebor 3956244c58 PR middle-end/94940 - spurious -Warray-bounds for a zero length array member of union
gcc/testsuite/ChangeLog:

	PR middle-end/94940
	* gcc.dg/Warray-bounds-61.c: New test.

gcc/ChangeLog:

	PR middle-end/94940
	* tree-vrp.c (vrp_prop::check_mem_ref): Remove unreachable code.
	* tree.c (component_ref_size): Correct the handling or array members
	of unions.
	Drop a pointless test.
	Rename a local variable.
2020-05-18 15:07:48 -06:00
Joseph Myers 628bb80408 Update gcc sv.po.
* sv.po: Update.
2020-05-18 20:50:35 +00:00
Marek Polacek ae8ed736ad c++: Implement DR 1512, Pointer comparison vs qual convs [PR87699]
This patch resolves DR 1512 (and, by turn, DR 583).  This entails:

1) Relational pointer comparisons against null pointer constants have
   been made ill-formed:

   void f(char *p) {
      if (p > 0)
	// ...
   }

   was always invalid in C but was -- accidentally -- allowed in C++.

2) This was ill-formed:

   bool foo(int** x, const int** y) {
     return x < y;
   }

   because 'int**' couldn't be converted to 'const int**'.  This was
   fixed by re-defining a generic composite pointer type.  The composite
   type of these two pointers will be 'const int *const *', to which
   both pointers can be converted.

3) The overload descriptions for built-in operators were adjusted,
   because objects of type std::nullptr_t cannot be used with relational
   operators any more.

I fixed 1) by adjusting cp_build_binary_op; we already had a warning
for it so made it a hard error now.

Then 2) required tweaking composite_pointer_type_r.  [expr.type] defines
the composite pointer type by using the "cv-combined type."  We didn't
implement the [conv.qual]/3.3 part; previously the composite type of
'int**' and 'const int**' was 'const int**', so this didn't compile:

    void f(const int **p, int **q) {
      true ? p : q;
    }

I wrote a more extensive test for this which uses decltype and some
template magic to check the composite type, see composite-ptr-type.C.
We still don't handle everything that [expr.type] requires us to,
but it's pretty close.

And finally 3) was handled in add_builtin_candidate.  Turned out we
weren't creating built-in operator candidates when the type was
std::nullptr_t at all.  We should, for == and !=.  Tested in builtin4.C.
In passing, I'm fixing some of the comments too.

	DR 1512
	PR c++/87699
	* call.c (add_builtin_candidate) <case EQ_EXPR>: Create candidate
	operator functions when type is std::nullptr_t for ==/!=.
	* typeck.c (composite_pointer_type_r): Add bool a * parameter.  Use it
	to maybe add "const" to the pointer type.
	(composite_pointer_type): Update the call to composite_pointer_type_r.
	(cp_build_binary_op): Turn two warning_at into error_at.  Print the
	types.

	* g++.dg/cpp0x/constexpr-array-ptr10.C: Change dg-warning to dg-error
	and adjust the expected messages in dg-error.
	* g++.dg/expr/composite-ptr-type.C: New test.
	* g++.dg/expr/ptr-comp1.C: New test.
	* g++.dg/expr/ptr-comp2.C: New test.
	* g++.dg/expr/ptr-comp3.C: New test.
	* g++.dg/overload/builtin4.C: New test.
	* g++.dg/warn/Wextra-3.C: Change dg-warning to dg-error.
2020-05-18 16:26:06 -04:00
Jason Merrill 295790712f c++: Create fewer SAVE_EXPR.
In a couple of places in build_over_call we were calling
cp_stabilize_reference but only using the result once, so it isn't needed.

gcc/cp/ChangeLog
2020-05-18  Jason Merrill  <jason@redhat.com>

	* call.c (build_over_call): Remove unnecessary
	cp_stabilize_reference.
2020-05-18 16:17:59 -04:00
Marek Polacek 100fdb1f09 c++: Don't add built-in operator for ++ on bool.
This feels extremely obscure but at least it's an opportunity to fix the
comments.  P0002R1 removed deprecated operator++(bool) in C++17 so let's
avoid adding a builtin overload candidate for ++ when the type is bool.

	* call.c (add_builtin_candidate): Don't create a builtin overload
	candidate for ++ when type is bool in C++17.

	* g++.dg/overload/builtin5.C: New test.
2020-05-18 15:50:12 -04:00
Marek Polacek 642dc602f8 c++: Regenerate cp/cfns.h.
Current cfns.h includes register-qualified variables and that wouldn't
play well when bootstrapping with GCC that uses the C++17 dialect,
because 'register' was removed in C++17.  Regenerating it using the
command specified in cfns.h luckily cleaned this up.

	* cfns.h: Regenerated.
2020-05-18 15:47:30 -04:00
Douglas Rupp c917584aa9 Require powerpc_vsx_ok in gcc.target/powerpc/pr71763.c
We're getting an error when running this test on PowerPC VxWorks 7,
due to an unexpected warning:

    | Excess errors:
    | cc1: warning: '-mvsx' and '-mno-altivec' are incompatible

The warning comes from a combination of factors:
  - The test itself uses -mvsx explicitly via the following directive:
       // { dg-options "-O1 -mvsx" }
  - Our toolchain was configured so as to make -mno-altivec
    the default;
  - These two options are mutually exclusive.

This commit adds a powerpc_vsx_ok dg-require-effective-target directive
to that test, and thus making it UNSUPPORTED instead.

Tested on PowerPC VxWorks 7. Also tested on PowerPC ELF as well,
a platform where we do not make -mno-altivec the default, to verify
that the test continues to run as usual in that case.

gcc/testsuite/

        * gcc.target/powerpc/pr71763.c: Require powerpc_vsx_ok.
2020-05-18 11:43:48 -07:00
Jason Merrill 5329b59a2e bootstrap: Update requirement to C++11.
There was general agreement last November that we would move to allowing
C++11 features to be used in GCC 11; this patch implements that direction.

ChangeLog
2020-05-18  Jason Merrill  <jason@redhat.com>

	* configure.ac: Update bootstrap dialect to -std=c++11.

config/ChangeLog
2020-05-18  Jason Merrill  <jason@redhat.com>

	* ax_cxx_compile_stdcxx.m4: Import from autoconf archive with
	an adjustment to try the default mode.

gcc/ChangeLog
2020-05-18  Jason Merrill  <jason@redhat.com>

	* aclocal.m4: Add ax_cxx_compile_stdcxx.m4.
	* configure.ac: Use AX_CXX_COMPILE_STDCXX(11).
2020-05-18 14:29:18 -04:00
Harald Anlauf e5abd1cb91 PR fortran/95053 - division by zero constants
Partially revert the fix for PR93499.  Replace by checks for valid
	expressions in the declaration of array shape and PDT KIND and LEN
	expressions at a later stage.

gcc/fortran/

2020-05-18  Harald Anlauf  <anlauf@gmx.de>

	PR fortran/95053
	* arith.c (gfc_divide): Revert hunk introduced by patch for
	PR93499.
	* decl.c (variable_decl): Generate error for array shape not being
	an INTEGER constant.
	(gfc_get_pdt_instance): Generate error if KIND or LEN expressions
	in declaration of a PDT instance do not simplify to INTEGER
	constants.

gcc/testsuite/

2020-05-18  Harald Anlauf  <anlauf@gmx.de>

	PR fortran/95053
	* gfortran.dg/dec_structure_23.f90: Adjust to new error messages.
	* gfortran.dg/pr93499.f90: Adjust to new error messages.
	* gfortran.dg/pr95053_2.f90: New test.
	* gfortran.dg/pr95053_3.f90: New test.
2020-05-18 20:27:29 +02:00
Stefan Schulze Frielinghaus 2c832ffedf tree-optimization: Fix use of uninitialized variables warnings [PR94952]
While bootstrapping GCC on S/390 with --enable-checking=release several
warnings about use of uninitialized variables bitpos, bitregion_start, and
bitregion_end of function pass_store_merging::process_store are raised.
According to PR94952 these seem to be false positives which are silenced by
initialising the mentioned variables.

Bootstrapped on S/390.  Ok for master and releases/gcc-10 assuming that
regtest succeeds (still running but I don't see a reason why it
should fail)?

gcc/ChangeLog:

2020-05-18  Stefan Schulze Frielinghaus  <stefansf@linux.ibm.com>

	PR tree-optimization/94952
	* gimple-ssa-store-merging.c (pass_store_merging::process_store):
	Initialize variables bitpos, bitregion_start, and bitregion_end in
	order to silence warnings about use of uninitialized variables.
2020-05-18 20:04:25 +02:00
Marek Polacek be464161b4 c++: Add test for c++/95143
Already fixed by r10-8124-gceae6a13366d9646e172fc943fe8e221b70f0920.

	PR c++/95143
	* g++.dg/cpp0x/sfinae66.C: New test.
2020-05-18 13:50:39 -04:00
Carl Love 24f68831d2 pr94833, fix vec_first_match_index for nulls
gcc/ChangeLog

2020-04-30  Carl Love  <cel@us.ibm.com>

	PR target/94833
	* config/rs6000/vsx.md (define_expand): Fix instruction generation for
	first_match_index_<mode>.
	* testsuite/gcc.target/powerpc/builtins-8-p9-runnable.c (main): Add
	additional test cases with zero vector elements.
2020-05-18 12:14:40 -05:00
Uros Bizjak 8f17461bdf i386: Avoid reversing a non-trapping comparison to a trapping one [PR95169]
gcc/ChangeLog:

	PR target/95169
	* config/i386/i386-expand.c (ix86_expand_int_movcc):
	 Avoid reversing a non-trapping comparison to a trapping one.

testsuite/ChangeLog:

	PR target/95169
	* gcc.target/i386/pr95169.c: New test.
2020-05-18 17:52:14 +02:00
Alex Coplan 8b8f311726 [arm] Don't generate invalid LDRD insns
This fixes a bug in the arm backend where GCC generates invalid LDRD
instructions. The LDRD instruction requires the first transfer register to be
even, but GCC attempts to use odd registers here. For example, with the
following C code:

    struct c {
      double a;
    } __attribute((aligned)) __attribute((packed));
    struct c d;
    struct c f(struct c);
    void e() { f(d); }

The struct d is passed in registers r1 and r2 to the function f, and GCC
attempted to do this with a LDRD instruction when compiling with -march=armv7-a
on a soft float toolchain.

The fix is analogous to the corresponding one for STRD in the same function:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=52057dc4ac5295caebf83147f688d769c93cbc8d

2020-05-18  Alex Coplan  <alex.coplan@arm.com>

gcc/:
	* config/arm/arm.c (output_move_double): Fix codegen when loading into
	a register pair with an odd base register.

gcc/testsuite/:
	* gcc.c-torture/compile/packed-aligned-1.c: New test.
	* gcc.c-torture/execute/packed-aligned.c: New test.
2020-05-18 16:31:43 +01:00
Uros Bizjak 94f687bd9a i386: Improve vector mode and TFmode ABS and NEG patterns
gcc/ChangeLog:

2020-05-18  Uroš Bizjak  <ubizjak@gmail.com>

	* config/i386/i386-expand.c (ix86_expand_fp_absneg_operator):
	Do not emit FLAGS_REG clobber for TFmode.
	* config/i386/i386.md (*<code>tf2_1): Rewrite as
	define_insn_and_split.  Mark operands 1 and 2 commutative.
	(*nabstf2_1): Ditto.
	(absneg SSE splitter): Use MODEF mode iterator instead of SSEMODEF.
	Do not swap memory operands.  Simplify RTX generation.
	(neg abs SSE splitter): Ditto.
	* config/i386/sse.md (*<code><mode>2): Mark operands 1 and 2
	commutative.  Do not swap operands.  Simplify RTX generation.
	(*nabs<mode>2): Ditto.
2020-05-18 17:25:39 +02:00
Richard Biener cfaf0edbb1 fixup BB vectorization constant generation place
This adjusts the way we compute the stmt insert location for
invariants in BB vectorization context to deal with eventually
sharing invariant SLP nodes for multiple uses.  We can no longer
use a single use stmt location then but there's a simple way out.

2020-05-18  Richard Biener  <rguenther@suse.de>

	* tree-vect-slp.c (vect_slp_bb): Start after labels.
	(vect_get_constant_vectors): Really place init stmt after scalar defs.
	* tree-vect-stmts.c (vect_init_vector_1): Insert before
	region begin.
2020-05-18 15:31:05 +02:00
H.J. Lu d83e28f47f x86: Update Intel processor detection
Add cpu model numbers for Intel Airmont, Tremont, Comet Lake, Ice Lake
and Tiger Lake processor families.

	* config/i386/driver-i386.c (host_detect_local_cpu): Support
	Intel Airmont, Tremont, Comet Lake, Ice Lake and Tiger Lake
	processor families.
2020-05-18 05:35:56 -07:00
Alex Coplan 9a4a0a5b0e MAINTAINERS: Add myself for write after approval.
2020-05-18  Alex Coplan  <alex.coplan@arm.com>

* MAINTAINERS (Write After Approval): Add myself.
2020-05-18 12:21:17 +01:00