163906 Commits

Author SHA1 Message Date
Martin Sebor
e84bf0ef66 re PR middle-end/86714 (tree-ssa-forwprop.c confused by too long initializer)
PR tree-optimization/86714
	PR tree-optimization/86711
	* builtins.c (c_strlen): Add arguments to call to string_constant.
	* expr.c (string_constant): Add argument.  Detect missing nul
	terminator and outermost declaration it's missing in.
	* expr.h (string_constant): Add argument.
	* fold-const.c (read_from_constant_string): Add arguments to call to
	string_constant.
	(c_getstr): Likewise.
	* tree-ssa-forwprop.c (simplify_builtin_call): Likewise.
	to string_constant.
	* tree-ssa-strlen.c (get_stridx): Likewise.

	PR tree-optimization/86714
	PR tree-optimization/86711
	* gcc.c-torture/execute/memchr-1.c: New test.
	* gcc.c-torture/execute/pr86714.c: New test.
	* gcc.c-torture/execute/widechar-3.c: New test.
	* gcc.dg/strlenopt-58.c: New test.

Co-Authored-By: Bernd Edlinger <bernd.edlinger@hotmail.de>
Co-Authored-By: Jeff Law <law@redhat.com>

From-SVN: r263963
2018-08-29 11:17:08 -06:00
Jan Hubicka
b9a0baa9f9 tree-streamer-in.c (lto_input_ts_function_decl_tree_pointers): Do not stream DECL_VINDEX.
* tree-streamer-in.c (lto_input_ts_function_decl_tree_pointers):
	Do not stream DECL_VINDEX.
	* tree-streamer-out.c (write_ts_function_decl_tree_pointers): Likewise.
	* tree.c (free_lang_data_in_decl): Clear DECL_VINDEX.
	(decl_function_context): Use DECL_VIRTUAL_P rather than DECL_VINDEX.

From-SVN: r263962
2018-08-29 17:07:35 +00:00
Richard Biener
d176b500dc tree-ssa-sccvn.c (vuse_ssa_val): Return NULL for unvisited virtual operands that are not default defs to honor...
2018-08-29  Richard Biener  <rguenther@suse.de>

	* tree-ssa-sccvn.c (vuse_ssa_val): Return NULL for unvisited
	virtual operands that are not default defs to honor region
	boundaries.
	(rpo_vn_valueize): Remove ineffective code here.

From-SVN: r263960
2018-08-29 15:02:06 +00:00
Richard Biener
8f70fdc31a re PR tree-optimization/87132 (Gcc miscompiles at -O2 on valid code)
2018-08-29  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/87132
	* tree-ssa-alias.c (get_continuation_for_phi): Do not translate
	when skipping defs reachable over backedges.

	* gcc.dg/torture/pr87132.c: New testcase.

From-SVN: r263959
2018-08-29 14:13:20 +00:00
Richard Biener
6214d5c7e7 tree-core.h: Document use of deprecated_flag in SSA_NAME.
2018-08-29  Richard Biener  <rguenther@suse.de>

	* tree-core.h: Document use of deprecated_flag in SSA_NAME.
	* tree.h (SSA_NAME_POINTS_TO_READONLY_MEMORY): Define.
	* tree-into-ssa.c (pass_build_ssa::execute): Initialize
	function parameters SSA_NAME_POINTS_TO_READONLY_MEMORY from fnspec.
	* tree-ssa-sccvn.c (const_parms, init_const_parms): Remove.
	(vn_reference_lookup_3): Remove use of const_parms.
	(free_rpo_vn): Do not free const_parms.
	(do_rpo_vn): Do not call init_const_parms.
	* tree-ssa-alias.c (refs_may_alias_p_1): Honor
	SSA_NAME_POINTS_TO_READONLY_MEMORY.
	(call_may_clobber_ref_p_1): Likewise.

From-SVN: r263958
2018-08-29 14:12:25 +00:00
David Malcolm
66e5825973 C++: underline param in print_conversion_rejection (more PR c++/85110)
Consider this bogus code (from g++.dg/diagnostic/param-type-mismatch-2.C):

struct s4 { static int member_1 (int one, const char **two, float three); };

int test_4 (int first, const char *second, float third)
{
  return s4::member_1 (first, second, third);
}

Before this patch, g++ emits:

demo.cc: In function 'int test_4(int, const char*, float)':
demo.cc:5:44: error: no matching function for call to 's4::member_1(int&, const char*&, float&)'
5 |   return s4::member_1 (first, second, third);
  |                                            ^
demo.cc:1:24: note: candidate: 'static int s4::member_1(int, const char**, float)'
1 | struct s4 { static int member_1 (int one, const char **two, float three); };
  |                        ^~~~~~~~
demo.cc:1:24: note:   no known conversion for argument 2 from 'const char*' to 'const char**'

With this patch, it highlights the pertinent parameter in the
"no known conversion" note:

demo.cc: In function 'int test_4(int, const char*, float)':
demo.cc:5:44: error: no matching function for call to 's4::member_1(int&, const char*&, float&)'
5 |   return s4::member_1 (first, second, third);
  |                                            ^
demo.cc:1:24: note: candidate: 'static int s4::member_1(int, const char**, float)'
1 | struct s4 { static int member_1 (int one, const char **two, float three); };
  |                        ^~~~~~~~
demo.cc:1:56: note:   no known conversion for argument 2 from 'const char*' to 'const char**'
1 | struct s4 { static int member_1 (int one, const char **two, float three); };
  |                                           ~~~~~~~~~~~~~^~~

gcc/cp/ChangeLog:
	PR c++/85110
	* call.c (print_conversion_rejection): Add "fn" param and use it
	for "no known conversion" messages to underline the pertinent
	param.
	(print_z_candidate): Supply "fn" to the new param above.

gcc/testsuite/ChangeLog:
	PR c++/85110
	* g++.dg/diagnostic/param-type-mismatch-2.C: Update expected
	output to reflect underlining of pertinent parameter in decl
	for "no known conversion" messages.

From-SVN: r263957
2018-08-29 13:52:22 +00:00
Alexander Monakov
1ca7a4d457 doc: document -ftree-scev-cprop
PR other/86726
	* invoke.texi (Optimization Options): List -ftree-scev-cprop.
	(-O): Ditto.
	(-ftree-scev-cprop): Document.

From-SVN: r263955
2018-08-29 15:39:12 +03:00
Jakub Jelinek
f5b219ccc2 re PR c++/87122 (ICE in tsubst_decomp_names)
PR c++/87122
	* pt.c (tsubst_expr) <case RANGE_FOR_STMT>: If
	processing_template_decl and decl is structured binding decl, call
	cp_finish_decomp.

	* g++.dg/cpp1z/decomp47.C: New test.

From-SVN: r263953
2018-08-29 14:27:55 +02:00
Jan Hubicka
7a1ce63278 sreal.h (normalize, [...]): Add new_sig/new_exp parameters.
* sreal.h (normalize, normalize_up, normalize_down): Add new_sig/new_exp
	parameters.
	(sreal constructor): Update.
	* sreal.c (sreal:operator+, sreal:operator-, sreal:operator*,
	sreal:operator/): Update.

From-SVN: r263952
2018-08-29 12:21:28 +00:00
Martin Liska
9ed6dbeeb2 Fix thinko in lto.c (PR bootstrap/87130).
2018-08-29  Martin Liska  <mliska@suse.cz>

	PR bootstrap/87130
	* lto.c (read_cgraph_and_symbols): Fix thinko, revert
	to behavior before r263887.

From-SVN: r263950
2018-08-29 10:48:50 +00:00
Vlad Lazar
e8a0276ced MAINTAINERS (write after approval): Add myself.
2018-08-29  Vlad Lazar  <vlad.lazar@arm.com>

	* MAINTAINERS (write after approval): Add myself.

From-SVN: r263949
2018-08-29 10:24:46 +00:00
Jonathan Wakely
9111b08384 PR libstdc++/31413 fix test failure on Debian systems
Debian uses a different D_FMT string for the zh_TW.UTF-8 locale, which
caused this test to fail. Try to detect the Debian format and adjust
the input being tested.

	PR libstdc++/31413
	* testsuite/22_locale/time_get/get_date/wchar_t/4.cc: Check D_FMT
	string for alternative format.

From-SVN: r263948
2018-08-29 11:05:55 +01:00
Martin Liska
fb9cb5369d Strenghten assumption about gswitch statements.
2018-08-29  Martin Liska  <mliska@suse.cz>

	* tree-switch-conversion.c (switch_conversion::expand):
	Strenghten assumption about gswitch statements.

From-SVN: r263947
2018-08-29 08:35:09 +00:00
Matthew Malcomson
aac8c550c9 [AARCH64] Use stdint integers in vect_su_add_sub.c
2018-08-29  Matthew Malcomson  <matthew.malcomson@arm.com>

	* gcc.target/aarch64/simd/vect_su_add_sub.c: Use 32 and 64-bit types
	where appropriate.

From-SVN: r263946
2018-08-29 08:22:19 +00:00
Richard Biener
95f0c81630 re PR tree-optimization/87117 (ICE in eliminate_dom_walker::eliminate_cleanup(bool) at gcc/gcc/tree-ssa-sccvn.c:5431 since r263875)
2018-08-29  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/87117
	* tree-ssa-sccvn.c (eliminate_dom_walker::eliminate_stmt): Only
	re-value-number released SSA VDEFs.

	* gfortran.dg/pr87117.f90: New testcase.

From-SVN: r263945
2018-08-29 06:49:06 +00:00
Richard Biener
e37f7da9c4 re PR tree-optimization/87126 (ICE on valid code at -Os and above on x86_64-linux-gnu: in vn_reference_insert, at tree-ssa-sccvn.c:2698)
2018-08-29  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/87126
	* tree-ssa-sccvn.c (vn_reference_insert): Remove assert.

	* gcc.dg/tree-ssa/pr87126.c: New testcase.

From-SVN: r263944
2018-08-29 06:47:14 +00:00
Jim Wilson
efc601240c Rewrite pic.md to improve medany and pic code size.
gcc/
	* config/riscv/pic.md: Rewrite.
	* config/riscv/riscv.c (riscv_address_insns): Return cost of 3 for
	invalid address.
	* config/riscv/riscv.md (ZERO_EXTEND_LOAD): Delete.
	(SOFTF, default_load, softload, softstore): New.

From-SVN: r263943
2018-08-28 19:20:44 -07:00
Jason Merrill
37170829c2 remove utf-8 from comment
From-SVN: r263942
2018-08-28 21:14:21 -04:00
Ian Lance Taylor
347462bfee compiler, runtime: remove hmap field from maptypes
This is the gofrontend version of https://golang.org/cl/91796.
    
    This is part of that CL, just the compiler change and required runtime
    changes, in preparation for updating libgo to 1.11.
    
    Relevant part of original CL description:
    
        The hmap field in the maptype is only used by the runtime to check the sizes of
        the hmap structure created by the compiler and runtime agree.
    
        Comments are already present about the hmap structure definitions in the
        compiler and runtime needing to be in sync.
    
    Reviewed-on: https://go-review.googlesource.com/130976

From-SVN: r263941
2018-08-29 00:20:25 +00:00
GCC Administrator
d16c446e0b Daily bump.
From-SVN: r263940
2018-08-29 00:16:35 +00:00
Jeff Law
78e93935ef * fold-const.c (fold_binary_loc): Remove recently added assert.
From-SVN: r263936
2018-08-28 17:09:57 -06:00
Joern Rennecke
d0794d14de genpreds.c (write_predicate_subfunction): Also add ATTRIBUTE_UNUSED to OP parmeter of generated function.
* genpreds.c (write_predicate_subfunction): Also add ATTRIBUTE_UNUSED
        to OP parmeter of generated function.

From-SVN: r263934
2018-08-28 22:54:44 +01:00
MCC CS
fd8303a508 re PR middle-end/87009 (Can't find XOR pattern applying De Morgan sequentially)
PR tree-optimization/87009
	* match.pd: Add boolean optimizations.

	PR tree-optimization/87009
	* gcc.dg/pr87009.c: New test.

From-SVN: r263931
2018-08-28 14:23:05 -06:00
Martin Sebor
96c19db55b re PR middle-end/86631 (missing -Walloc-size-larger-than on ILP32 hosts)
gcc/testsuite/ChangeLog:

	PR middle-end/86631
	* g++.dg/Walloca1.C: Adjust.

From-SVN: r263930
2018-08-28 13:58:02 -06:00
Martin Sebor
0aaafa5e95 PR middle-end/86631 - missing -Walloc-size-larger-than on ILP32 hosts
gcc/ChangeLog:

	PR middle-end/86631
	* calls.c (alloc_max_size): Treat HOST_WIDE_INT special.
	* gimple-ssa-warn-alloca.c (adjusted_warn_limit): New function.
	(pass_walloca::gate): Use it.
	(alloca_call_type): Same.
	(pass_walloca::execute): Same.
	* stor-layout.c (layout_decl): Treat HOST_WIDE_INT special.

gcc/testsuite/ChangeLog:

	PR middle-end/86631
	* g++.dg/Walloca1.C: Adjust.

From-SVN: r263928
2018-08-28 13:09:38 -06:00
Jonathan Wakely
dd35da2cbe PR libstdc++/87116 fix path::lexically_normal() handling of dot-dot
Previously the logic that turned "a/b/c/../.." into "a/" failed to
preserve an empty path at the end of the iteration sequence, as required
by the trailing slash. That meant the result didn't meet the class
invariants, and that "a/b/c/d/../../.." would remove four components
instead of the three that "../../.." should remove.

	PR libstdc++/87116
	* src/filesystem/std-path.cc (path::lexically_normal): When handling
	a dot-dot filename, preserve an empty final component in the iteration
	sequence.
	[_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Use preferred-separator for
	root-directory.
	* testsuite/27_io/filesystem/path/generation/normal.cc: Add new tests
	for more than two adjacent dot-dot filenames.
	[_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Replace slashes with
	preferred-separator in expected normalized strings.

From-SVN: r263922
2018-08-28 16:33:53 +01:00
Paolo Carlini
f30bafb7fc re PR c++/86546 (ICE on invalid: tree_class_check_failed())
/cp
2018-08-28  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/86546
	* decl.c (finish_case_label): If the type is erroneous early
	return error_mark_node.

/testsuite
2018-08-28  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/86546
	* g++.dg/other/switch4.C: New.

From-SVN: r263921
2018-08-28 15:01:15 +00:00
David Malcolm
1978408086 Fix version check for ATTRIBUTE_GCC_DUMP_PRINTF
gcc/ChangeLog:
	* dumpfile.h (ATTRIBUTE_GCC_DUMP_PRINTF): Change version check on
	GCC_VERSION for usage of "__gcc_dump_printf__" format from
	>= 3005 to >= 9000.

From-SVN: r263920
2018-08-28 14:08:45 +00:00
Richard Biener
49aecbebe2 re PR tree-optimization/87124 (ICE have integer_cst in SSA_VAL, at tree-ssa-sccvn.c:462 while building 541.leela_r from SPEC2017)
2018-08-28  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/87124
	* tree-ssa-sccvn.c (vn_lookup_simplify_result): Guard against
	constants before looking up avail.

	* g++.dg/torture/pr87124.C: New testcase.

From-SVN: r263918
2018-08-28 13:36:49 +00:00
Paul Thomas
1312bb9023 re PR fortran/80477 ([OOP] Polymorphic function result generates memory leak)
2017-08-28  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/80477
	* trans-expr.c (gfc_conv_procedure_call): Allocatable class
	scalar results being passed to a derived type formal argument
	are finalized if possible. Otherwise, rely on existing code for
	deallocation. Make the deallocation of allocatable result
	components conditional on finalization not taking place. Make
	the freeing of data components after finalization conditional
	on the data being NULL.
	(gfc_trans_arrayfunc_assign): Change the gcc_assert to a
	condition to return NULL_TREE.
	(gfc_trans_assignment_1): If the assignment is class to class
	and the rhs expression must be finalized but the assignment
	is not marked as a polymorphic assignment, use the vptr copy
	function instead of gfc_trans_scalar_assign.

	PR fortran/86481
	* trans-expr.c (gfc_conv_expr_reference): Do not add the post
	block to the pre block if the expression is to be finalized.
	* trans-stmt.c (gfc_trans_allocate): If the expr3 must be
	finalized, load the post block into a finalization block and
	add it right at the end of the allocation block.

2017-08-28  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/80477
	* gfortran.dg/class_result_7.f90: New test.
	* gfortran.dg/class_result_8.f90: New test.
	* gfortran.dg/class_result_9.f90: New test.

	PR fortran/86481
	* gfortran.dg/allocate_with_source_25.f90: New test.

From-SVN: r263916
2018-08-28 11:35:52 +00:00
Jakub Jelinek
2c8861b750 re PR middle-end/87099 (internal compiler error: segmentation fault)
PR middle-end/87099
	* calls.c (maybe_warn_nonstring_arg): Punt early if
	warn_stringop_overflow is zero.  Don't call get_range_strlen
	on 3rd argument, keep iterating until lenrng[1] is INTEGER_CST.
	Swap comparison operands to have constants on rhs.  Only use
	lenrng[1] if non-NULL and INTEGER_CST.  Don't uselessly
	increment lenrng[0].

	* gcc.dg/pr87099.c: New test.

From-SVN: r263915
2018-08-28 13:13:04 +02:00
Richard Sandiford
4ec4324d0f Fix unguarded use of tree_to_shwi in tree-ssa-sccvn.c
Fixes many testsuite failures for SVE.

2018-08-28  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-ssa-sccvn.c (fully_constant_vn_reference_p): Fix unguarded
	use of tree_to_shwi.  Remove duplicated test for the size being
	a whole number of bytes.

From-SVN: r263914
2018-08-28 10:42:42 +00:00
Richard Sandiford
463a9e0d31 Add target selectors to slp-37.c (PR87078)
This test was failing for Power 7 due to the lack of hw support
for unaligned accesses.

2018-08-28  Richard Sandiford  <richard.sandiford@arm.com>

gcc/testsuite/
	PR testsuite/87078
	* gcc.dg/vect/slp-37.c: Restrict scan tests to vect_hw_misalign.

From-SVN: r263913
2018-08-28 10:42:30 +00:00
Richard Biener
8e8bf29209 re PR tree-optimization/87117 (ICE in eliminate_dom_walker::eliminate_cleanup(bool) at gcc/gcc/tree-ssa-sccvn.c:5431 since r263875)
2018-08-28  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/87117
	* tree-ssa-sccvn.c (eliminate_dom_walker::eliminate_cleanup):
	Handle removed stmt without LHS (GIMPLE_NOP).

From-SVN: r263912
2018-08-28 10:15:54 +00:00
Richard Biener
f2b0062c10 re PR tree-optimization/87117 (ICE in eliminate_dom_walker::eliminate_cleanup(bool) at gcc/gcc/tree-ssa-sccvn.c:5431 since r263875)
2018-08-28  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/87117
	* tree-ssa-sccvn.c (fully_constant_vn_reference_p): Exclude
	void which is is_gimple_reg_type by checking for COMPLETE_TYPE_P.

	* gcc.dg/pr87117-1.c: New testcase.

From-SVN: r263911
2018-08-28 10:14:45 +00:00
Richard Biener
7b3ca24435 re PR tree-optimization/87117 (ICE in eliminate_dom_walker::eliminate_cleanup(bool) at gcc/gcc/tree-ssa-sccvn.c:5431 since r263875)
2018-08-28  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/87117
	* tree-ssa-pre.c (compute_avail): Do not make expressions
	with predicated values available.
	(get_expr_value_id): Assert we do not run into predicated value
	expressions.

	* gcc.dg/pr87117-2.c: New testcase.

From-SVN: r263910
2018-08-28 10:13:18 +00:00
Richard Biener
6df46f59d3 re PR tree-optimization/87117 (ICE in eliminate_dom_walker::eliminate_cleanup(bool) at gcc/gcc/tree-ssa-sccvn.c:5431 since r263875)
2018-08-28  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/87117
	* tree-ssa-operands.c (add_stmt_operand): STRING_CST may
	get virtual operands.
	(get_expr_operands): Handle STRING_CST like other decls.

	* gcc.dg/lvalue-5.c: New testcase.

From-SVN: r263908
2018-08-28 09:33:16 +00:00
Martin Liska
36066262d9 Update documentation of fndecl_built_in_p.
2018-08-28  Martin Liska  <mliska@suse.cz>

	* tree.h: Update documentation of fndecl_built_in_p
	functions.

From-SVN: r263907
2018-08-28 07:23:12 +00:00
Jeff Law
a1ae0cbd96 re PR tree-optimization/87110 ([9 Regresssion] tree check fail in to_wide, at tree.h:5523)
PR tree-optimization/87110
	* tree-ssa-dse.c (compute_trims): Handle non-constant
	TYPE_SIZE_UNIT.

	PR tree-optimization/87110
	* gcc.c-torture/compile/pr87110.c: New test.

From-SVN: r263906
2018-08-27 22:02:11 -06:00
Martin Sebor
d1af2f668f PR tree-optimization/86914 - wrong code with strlen() of poor-man's flexible array member plus offset
gcc/ChangeLog:

	PR tree-optimization/86914
	* tree-ssa-strlen.c (maybe_set_strlen_range): Avoid MEM_REF.

gcc/testsuite/ChangeLog:

	PR tree-optimization/86914
	* gcc.dg/strlenopt-57.c: New test.

From-SVN: r263905
2018-08-27 18:25:50 -06:00
GCC Administrator
37223543da Daily bump.
From-SVN: r263904
2018-08-28 00:16:36 +00:00
Martin Sebor
1583124e4f PR tree-optimization/87112 - ICE in fold_binary_loc on strnlen of mixed integer types
gcc/ChangeLog:

	PR tree-optimization/87112
	* builtins.c (expand_builtin_strnlen): Convert c_strlen result to
	the type of the bound argument.

gcc/testsuite/ChangeLog:

	PR tree-optimization/87112
	* gcc.dg/pr87112.c: New test.

From-SVN: r263900
2018-08-27 18:10:46 -06:00
David Malcolm
bdd039843c C++: fix-it hint for missing "typename" (PR c++/63392)
This patch adds a fix-it hint to missing "typename" errors in the C++
frontend, suggesting the insertion of "typename ".

This addresses part of PR c++/63392; however it does not improve the
error-recovery for such cases.

gcc/cp/ChangeLog:
	PR c++/63392
	* parser.c (cp_parser_diagnose_invalid_type_name): Add fix-it
	hint.

gcc/testsuite/ChangeLog:
	PR c++/63392
	* g++.dg/diagnostic/missing-typename.C: New test.

From-SVN: r263899
2018-08-27 23:33:02 +00:00
Jeff Law
6a2a69287c tree-ssa-dse.c (compute_trims): Handle case where the reference's type does not have a TYPE_SIZE_UNIT.
* tree-ssa-dse.c (compute_trims): Handle case where the reference's
	type does not have a TYPE_SIZE_UNIT.

	* gcc.c-torture/compile/dse.c: New test.

From-SVN: r263896
2018-08-27 14:31:14 -06:00
Jakub Jelinek
d4714a1b5e re PR c++/86993 (assignment of read-only variable error reported at wrong location)
PR c++/86993
	* cp-tree.h (cxx_readonly_error): Add location_t argument.
	* typeck2.c (cxx_readonly_error): Add LOC argument, pass it to
	ERROR_FOR_ASSIGNMENT macro and readonly_error.  Add LOC argument
	to ERROR_FOR_ASSIGNMENT macro, use error_at instead of error and
	pass LOC to it.  Formatting fixes.
	* typeck.c (cp_build_unary_op): Pass location to cxx_readonly_error.
	(cp_build_modify_expr): Pass loc to cxx_readonly_error.
	* semantics.c (finish_asm_stmt): Pass input_location to
	cxx_readonly_error.

	* g++.dg/diagnostic/pr86993.C: New test.

From-SVN: r263891
2018-08-27 20:36:23 +02:00
Steve Ellcey
a9cf35bf3e aarch64-speculation.cc: Replace include of cfg.h with include of backend.h.
2018-08-27  Steve Ellcey  <sellcey@cavium.com>

	* config/aarch64/aarch64-speculation.cc: Replace include of cfg.h
	with include of backend.h.

From-SVN: r263890
2018-08-27 16:39:44 +00:00
Richard Biener
efc3a1a101 re PR tree-optimization/86927 (Gcc miscompiles at -O3 on valid code)
2018-08-27  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/86927
	* tree-vect-loop.c (vect_create_epilog_for_reduction): Properly
	use const cond reduction code.

	* gcc.dg/vect/pr86927.c: New testcase.

From-SVN: r263888
2018-08-27 14:17:03 +00:00
Alexander Monakov
de5b522863 match.pd: add single-use check for (x & y) ^ y -> ~x & y (PR 85758)
PR tree-optimization/85758
	* match.pd ((X & Y) ^ Y): Add :s qualifier to inner expression.

From-SVN: r263887
2018-08-27 17:08:50 +03:00
Martin Liska
92a285c1a7 Replace 8 spaces with a tabular in ChangeLog files.
From-SVN: r263886
2018-08-27 14:04:23 +00:00
David Malcolm
85204e23e2 Less verbose fix-it hints for missing header files (PR 87091)
This patch tweaks maybe_add_include_fixit so that if we're emitting a note
about adding the header file, the note's primary location will be replaced
by that of the fix-it hint, to avoid repeating a location we've already
emitted (or one close to it).

For example, this simplifies:

  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:27: error: msg 1
  87 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
     |                           ^~~~~~
  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:22: note: msg 2
   73 | # include <debug/vector>
  +++ |+#include <vector>
   74 | #endif
  ....
   87 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |                      ^~~

to:

  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:27: error: msg 1
  87 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
     |                           ^~~~~~
  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:74:1: note: msg 2
   73 | # include <debug/vector>
  +++ |+#include <vector>
   74 | #endif

eliminating the repetition of line 87 in the note.

Doing so requires converting show_caret_p to a tri-state, to avoid
meaninglessly printing a caret for the first column in the next line
(and colorizing it):

  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:74:1: note: msg 2
   73 | # include <debug/vector>
  +++ |+#include <vector>
   74 | #endif
      | ^

gcc/c-family/ChangeLog:
	PR 87091
	* c-common.c (c_cpp_error): Update for conversion of show_caret_p
	to a tri-state.
	(maybe_suggest_missing_token_insertion): Likewise.
	(maybe_add_include_fixit): Add param "override_location".  If set,
	and source-printing is enabled, then override the rich_location's
	primary location with that of the insertion point for the fix-it
	hint, marking it with SHOW_LINES_WITHOUT_RANGE.
	* c-common.h (extern void maybe_add_include_fixit): Add bool
	param.
	* c-format.c (selftest::test_type_mismatch_range_labels): Update
	for conversion of show_caret_p to a tri-state.
	* c-warn.c (warn_for_restrict): Likewise.
	* known-headers.cc
	(suggest_missing_header::~suggest_missing_header): Update call to
	maybe_add_include_fixit to suggest overriding the location, as it
	is for a note.

gcc/c/ChangeLog:
	PR 87091
	* c-decl.c (implicitly_declare): Update call to
	maybe_add_include_fixit to suggest overriding the location, as it
	is for a note.
	* c-objc-common.c (c_tree_printer): Update for conversion of
	show_caret_p to a tri-state.

gcc/cp/ChangeLog:
	PR 87091
	* decl.c (grokdeclarator): Update for conversion of show_caret_p
	to a tri-state.
	* error.c (cp_printer): Likewise.
	* name-lookup.c (maybe_suggest_missing_std_header): Update call to
	maybe_add_include_fixit to suggest overriding the location, as it
	is for a note.
	* parser.c (cp_parser_string_literal): Update for conversion of
	show_caret_p to a tri-state.
	(cp_parser_elaborated_type_specifier): Likewise.
	(set_and_check_decl_spec_loc): Likewise.
	* pt.c (listify): Update call to maybe_add_include_fixit to not
	override the location, as it is for an error.
	* rtti.c (typeid_ok_p): Likewise.

gcc/ChangeLog:
	PR 87091
	* diagnostic-show-locus.c (class layout_range): Update for
	conversion of show_caret_p to a tri-state.
	(layout_range::layout_range): Likewise.
	(make_range): Likewise.
	(layout::maybe_add_location_range): Likewise.
	(layout::should_print_annotation_line_p): Don't show annotation
	lines for ranges that are SHOW_LINES_WITHOUT_RANGE.
	(layout::get_state_at_point): Update for conversion of
	show_caret_p to a tri-state.  Bail out early for
	SHOW_LINES_WITHOUT_RANGE, so that such ranges don't affect
	underlining or source colorization.
	(gcc_rich_location::add_location_if_nearby): Update for conversion
	of show_caret_p to a tri-state.
	(selftest::test_one_liner_multiple_carets_and_ranges): Likewise.
	(selftest::test_one_liner_fixit_replace_equal_secondary_range):
	Likewise.
	(selftest::test_one_liner_labels): Likewise.
	* gcc-rich-location.c (gcc_rich_location::add_expr): Update for
	conversion of show_caret_p to a tri-state.
	* pretty-print.c (text_info::set_location): Likewise.
	* pretty-print.h (text_info::set_location): Likewise.
	* substring-locations.c (format_warning_n_va): Likewise.
	* tree-diagnostic.c (default_tree_printer): Likewise.
	* tree-pretty-print.c (newline_and_indent): Likewise.

gcc/fortran/ChangeLog:
	PR 87091
	* error.c (gfc_format_decoder): Update for conversion of
	show_caret_p to a tri-state.

gcc/testsuite/ChangeLog:
	PR 87091
	* gcc.dg/empty.h: New file.
	* gcc.dg/fixits-pr84852-1.c: Update for move of fix-it hint to
	top of file and removal of redundant second printing of warning
	location.
	* gcc.dg/fixits-pr84852-2.c: Likewise.
	* gcc.dg/missing-header-fixit-3.c: Likewise.
	* gcc.dg/missing-header-fixit-4.c: New test.
	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: Update for
	conversion of show_caret_p to a tri-state.

libcpp/ChangeLog:
	PR 87091
	* include/line-map.h (enum range_display_kind): New enum.
	(struct location_range): Replace field "m_show_caret_p" with
	"m_range_display_kind", converting from bool to the new enum.
	(class rich_location): Add example of line insertion fix-it hint.
	(rich_location::add_range): Convert param "show_caret_p" from bool
	to enum range_display_kind and rename to "range_display_kind",
	giving it a default of SHOW_RANGE_WITHOUT_CARET.
	(rich_location::set_range): Likewise, albeit without a default.
	* line-map.c (rich_location::rich_location): Update for conversion
	of show_caret_p to tri-state enum.
	(rich_location::add_range): Likewise.
	(rich_location::set_range): Likewise.

From-SVN: r263885
2018-08-27 14:02:05 +00:00