Commit Graph

177750 Commits

Author SHA1 Message Date
Eric Botcazou 906a759dcb [Ada] Further cleanup in constraint checking code for allocators
2020-06-19  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* exp_ch5.adb (Expand_N_Assignment_Statement): Do not apply
	range checks to allocators here.
2020-06-19 04:17:28 -04:00
Justin Squirek 82bcb33bcf [Ada] Crash on compiling project with multiple subunits per file
2020-06-19  Justin Squirek  <squirek@adacore.com>

gcc/ada/

	* lib.adb (Check_Same_Extended_Unit): Add check to determine if
	the body for the subunits exist in the same file as their
	specifications.
2020-06-19 04:17:27 -04:00
Eric Botcazou d0e9248d9b [Ada] Fix check for bounds in aggregate expansion of allocator
2020-06-19  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* exp_aggr.adb (In_Place_Assign_OK): In an allocator context,
	check the bounds of an array aggregate against those of the
	designated type, except if the latter is unconstrained.
2020-06-19 04:17:26 -04:00
Eric Botcazou ce716aaaa3 [Ada] Fix small fallout of previous change for Analyze_Selected_Component
2020-06-19  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* sem_ch3.adb (Is_Visible_Component): Reason only on the private
	status of the original type in an instance body.
2020-06-19 04:17:26 -04:00
Eric Botcazou 1e400f33e1 [Ada] Fix small fallout of previous change for allocator
2020-06-19  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* sem_res.adb (Resolve_Qualified_Expression): Do not override the
	type of the node when it is unconstrained if it is for an allocator.
2020-06-19 04:17:25 -04:00
Eric Botcazou e3c1f8dd05 [Ada] Plug small loophole in implementation of AI12-0100
2020-06-19  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* sem_res.adb (Resolve_Allocator): Call Resolve_Qualified_Expression
	on the qualified expression, if any, instead of doing an incomplete
	type resolution manually.
	(Resolve_Qualified_Expression): Apply predicate check to operand.
2020-06-19 04:17:24 -04:00
Eric Botcazou 92392296c1 [Ada] Fix internal error on component of class-wide parameter in instance body
2020-06-19  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* sem_ch4.adb (Analyze_Selected_Component): In an instance body,
	also invoke Find_Component_In_Instance on the parent subtype of
	a derived tagged type immediately visible.  Remove obsolete case.
2020-06-19 04:17:23 -04:00
Eric Botcazou c5c69d05a9 [Ada] Deal with enumeration types with very large size
2020-06-19  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* exp_attr.adb (Get_Integer_Type): Return the largest supported
	unsigned integer type if need be.
2020-06-19 04:17:22 -04:00
Justin Squirek 650abc2c93 [Ada] Spurious condition warning on type conversion in return
2020-06-19  Justin Squirek  <squirek@adacore.com>

gcc/ada/

	* sem_warn.adb (Warn_On_Known_Condition): Add general sanity
	check that asserts the original source node being checked
	contains an entity. If not, it could be the result of special
	case expansion for type conversions.
2020-06-19 04:17:22 -04:00
Ed Schonberg a6d7dfbbb2 [Ada] Spurious error on private type in ghost expression function
2020-06-19  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* sem_ch6.adb (Analyze_Expression_Function): Do not indicate
	that the function has a completion if it appears within a Ghost
	generic package.
2020-06-19 04:17:21 -04:00
Bob Duff 74d09f3ee9 [Ada] AI12-0293-1 Remove pragma Assert
2020-06-19  Bob Duff  <duff@adacore.com>

gcc/ada/

	* libgnat/a-ststbo.adb (Write): Replace pragma Assert with "if
	... raise Constraint_Error".
2020-06-19 04:17:20 -04:00
Justin Squirek b64bea1830 [Ada] Style checks on invalid UTF character cause crash
2020-06-19  Justin Squirek  <squirek@adacore.com>

gcc/ada/

	* widechar.adb, widechar.ads (Skip_Wide): Catch validity check
	failure when skipping over characters, and update comment to
	reflect Skip_Wide's usage in error printing.
2020-06-19 04:17:19 -04:00
Javier Miranda 7841c99268 [Ada] ACATS 4.1G - C760A02 - Near infinite finalization
2020-06-19  Javier Miranda  <miranda@adacore.com>

gcc/ada/

	* exp_ch3.ads (Ensure_Activation_Chain_And_Master): New
	subprogram.
	* exp_ch3.adb (Ensure_Activation_Chain_And_Master): New
	subprogram that factorizes code.
	(Expand_N_Object_Declaration): Call new subprogram.
	* sem_ch6.adb (Analyze_Function_Return): Returning a
	build-in-place unconstrained array type defer the full analysis
	of the returned object to avoid generating the corresponding
	constrained subtype; otherwise the bounds would be created in
	the stack and a dangling reference would be returned pointing to
	the bounds.
2020-06-19 04:17:18 -04:00
Arnaud Charlet b6c2ec4997 [Ada] AI12-0366 Changes to Big_Integer and Big_Real
2020-06-19  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

	* libgnat/a-nbnbin.adb, libgnat/a-nbnbin.ads,
	libgnat/a-nbnbin__gmp.adb, libgnat/a-nbnbre.adb,
	libgnat/a-nbnbre.ads: Update spec according to AI12-0366.
2020-06-19 04:17:18 -04:00
Piotr Trojanek 545ba471c1 [Ada] Minor remove extra whitespace in check suppression functions
2020-06-19  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* checks.ads: Remove excessive whitespace in declarations of
	functions for check suppression.
2020-06-19 04:17:17 -04:00
Eric Botcazou 6c89a5815a [Ada] Attempt to hide public entities in nested instance bodies
2020-06-19  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* sem_ch7.adb (Hide_Public_Entities): Split handling of objects
	and subprograms, and do not reject the latter upfront in nested
	instance specs if there are no referencer subprograms at all.
	(Analyze_Package_Body_Helper): Also call Hide_Public_Entities on
	nested generic instances.
2020-06-19 04:17:16 -04:00
Piotr Trojanek 4b58985f6c [Ada] Reject junk expressions in attribute Update
2020-06-19  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* sem_attr.adb (Analyze_Attribute): Reject illegal positional
	component associations; fix syntax in comment about named
	component associations.
2020-06-19 04:17:15 -04:00
Piotr Trojanek 484d58c5ba [Ada] Decorate record delta aggregate for GNATprove
2020-06-19  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* sem_aggr.adb (Resolve_Delta_Record_Aggregate): Modify a nested
	Get_Component_Type routine to return a component and not just
	its type; use this routine to decorate the identifier within the
	delta aggregate.
2020-06-19 04:17:14 -04:00
Arnaud Charlet 7a022cc933 [Ada] universal_access equality and 'Access attributes
2020-06-19  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

	* sem_ch4.adb (Find_Equality_Types.Check_Access_Attribute): New.
	(Find_Equality_Types): Move universal_access related checks at
	the end of the processing and add call to
	Check_Access_Attribute.
2020-06-19 04:17:14 -04:00
Eric Botcazou a5835f3044 [Ada] Remove second warning for convention C_Variadic_n
2020-06-19  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* sem_prag.adb (Process_Convention): Revert previous change.
2020-06-19 04:17:13 -04:00
Eric Botcazou ec170be1d0 [Ada] Small cleanup in Apply_Range_Check implementation
2020-06-19  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* checks.ads (Apply_Static_Length_Check): Move up.
	(Apply_Range_Check): Add parameter Insert_Node.
	* checks.adb (Apply_Selected_Range_Checks): Merge into...
	(Apply_Range_Check): ...this.  Add parameter Insert_Node,
	pass it as Warn_Node to Selected_Range_Checks and use it
	as insertion point for the checks.
	* sem_ch3.adb (Analyze_Subtype_Declaration): Rewrite block
	dealing with the range checks for the subtype indication.
	Use local variable and call Apply_Range_Check in both cases.
2020-06-19 04:17:12 -04:00
Piotr Trojanek d48bb126ea [Ada] Fix validity checks on attribute 'Old prefix
2020-06-19  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* exp_attr.adb (Expand_N_Attribute_Reference): Call Ensure_Valid
	on the expression of an object declaration that captures the
	value of 'Old prefix.
2020-06-19 04:17:11 -04:00
Piotr Trojanek d57f8e4043 [Ada] Add comments about attribute 'Valid_Scalars on private tagged types
2020-06-19  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* exp_attr.adb (Expand_N_Attribute_Reference): Add comment.
	* sem_attr.adb (Analyze_Attribute): Add ??? comment.
	* sem_util.ads (Valid_Scalars): This routine is only used for
	'Valid_Scalars and not for 'Valid.
2020-06-19 04:17:10 -04:00
Piotr Trojanek a4dafb8b92 [Ada] Simplify processing of 'Valid_Scalars on array types
2020-06-19  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* exp_attr.adb (Expand_N_Attribute_Reference): Do not call
	Scalar_Part_Present on the array component's type.
	(Build_Array_VS_Func): Remove Comp_Typ parameter, because it can
	be easily computed from the Array_Top parameter *and redundant
	parameters are confusing and error-prone).
2020-06-19 04:17:10 -04:00
Piotr Trojanek 66bd7af5cc [Ada] Fix validity checking for class-wide objects
2020-06-19  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* exp_attr.adb (Build_Record_VS_Func): Strip privacy and type
	derivation from the root type when 'Valid_Scalars is applied to
	a class-wide type.
2020-06-19 04:17:09 -04:00
Piotr Trojanek 5af0271f0e [Ada] Remove repeated testing of Check_Validity_Of_Parameters
2020-06-19  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* checks.adb (Apply_Parameter_Validity_Checks): Remove testing
	of Check_Validity_Of_Parameters for every formal parameter and
	function result.
2020-06-19 04:17:08 -04:00
Arnaud Charlet 75c44bc6a0 [Ada] Add missing warning tag for some overlapping actuals warnings
2020-06-19  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

	* sem_warn.adb (Warn_On_Overlapping_Actuals): Add missing
	warning tag.
2020-06-19 04:17:07 -04:00
GCC Administrator aae80e833d Daily bump. 2020-06-19 00:16:32 +00:00
Jason Merrill b56dc0fc6c c++: More P2002 operator<=> refinements.
* Disallow && references.
* Allow empty unions.
* Improve diagnostics for a subobject comparison with
  non-comparison-category type.

gcc/cp/ChangeLog:

	* method.c (early_check_defaulted_comparison): Check for &&.
	(build_comparison_op): Allow empty union.  Diagnose non-category
	type.
	(common_comparison_type): Remove handling for non-category type.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/spaceship-ref1.C: New test.
	* g++.dg/cpp2a/spaceship-synth-neg4.C: New test.
	* g++.dg/cpp2a/spaceship-union1.C: New test.
2020-06-18 16:00:30 -04:00
Fei Yang e54353a72a vect: Use vect_relevant_for_alignment_p consistently
Minor code refactorings in tree-vect-data-refs.c.  When trying loop peeling
to force alignment, call vect_relevant_for_alignment_p to filter out data
references in the loop whose alignment is irrelevant.

2020-06-18  Felix Yang  <felix.yang@huawei.com>

gcc/
	* tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Call
	vect_relevant_for_alignment_p to filter out data references in
	the loop whose alignment is irrelevant when trying loop peeling
	to force alignment.
2020-06-18 20:11:09 +01:00
Uros Bizjak e95395926a i386: Fix mode of ZERO_EXTRACT RTXes, remove ext_register_operand predicate.
The mode of ZERO_EXTRACT RTX should match the mode of its LOC register
operand.  The mode should be HI, SI or DImode to enable combine to synthesize
extractions from HImode and DImode operands, in addition to existing SImode.
Further, these changes tighten allowed modes for extv, extzv and insv
named patterns and finally enable removal of ext_register_operand
special predicate.

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

gcc/ChangeLog:

	* config/i386/i386.md (*cmpqi_ext<mode>_1): Use SWI248 mode
	iterator instead of SImode for ZERO_EXTRACT RTX.  Use SWI248
	mode iterator for the first operand of ZERO_EXTRACT RTX.
	Change ext_register_operand predicate to register_operand.
	Rename from *cmpqi_ext_1.
	(*cmpqi_ext<mode>_2): Ditto.  Rename from *cmpqi_ext_2.
	(*cmpqi_ext<mode>_3): Ditto.  Rename from *cmpqi_ext_3.
	(*cmpqi_ext<mode>_4): Ditto.  Rename from *cmpqi_ext_4.
	(cmpi_ext_3): Use HImode instead of SImode for ZERO_EXTRACT RTX.
	(*extv<mode>): Use SWI24 mode iterator for the first operand
	of ZERO_EXTRACT RTX.  Change ext_register_operand predicate
	to register_operand.
	(*extzv<mode>): Use SWI248 mode iterator for the first operand
	of ZERO_EXTRACT RTX.  Change ext_register_operand predicate
	to register_operand.
	(*extzvqi): Use SWI248 mode iterator instead of SImode for
	ZERO_EXTRACT RTX.  Use SWI248 mode iterator for the first operand
	of ZERO_EXTRACT RTX.  Change ext_register_operand predicate to
	register_operand.
	(*extzvqi_mem_rex64 and corresponding peephole2):  Use SWI248 mode
	iterator instead of SImode for ZERO_EXTRACT RTX.  Use SWI248
	mode iterator for the first operand of ZERO_EXTRACT RTX.
	Change ext_register_operand predicate to register_operand.
	(@insv<mode>_1): Use SWI248 mode iterator for the first operand
	of ZERO_EXTRACT RTX.  Change ext_register_operand predicate to
	register_operand.
	(*insvqi_1): Use SWI248 mode iterator instead of SImode
	for ZERO_EXTRACT RTX.  Use SWI248 mode iterator for the
	first operand of ZERO_EXTRACT RTX.  Change ext_register_operand
	predicate to register_operand.
	(*insvqi_2): Ditto.
	(*insvqi_3): Ditto.
	(*insvqi_1_mem_rex64 and corresponding peephole2):  Use SWI248 mode
	iterator instead of SImode for ZERO_EXTRACT RTX.  Use SWI248
	mode iterator for the first operand of ZERO_EXTRACT RTX.
	Change ext_register_operand predicate to register_operand.
	(addqi_ext_1): New expander.
	(*addqi_ext<mode>_1): Use SWI248 mode iterator instead of SImode
	for ZERO_EXTRACT RTX.  Use SWI248 mode iterator for the first
	operand of ZERO_EXTRACT RTX.  Change ext_register_operand predicate
	to register_operand.  Rename from *addqi_ext_1.
	(*addqi_ext<mode>_2): Ditto. Rename from *addqi_ext_2.
	(divmodqi4): Use HImode instead of SImode for ZERO_EXTRACT RTX.
	(udivmodqi4): Ditto.
	(testqi_ext_1): Use HImode instead of SImode for ZERO_EXTRACT RTX.
	(*testqi_ext<mode>_1): Use SWI248 mode iterator instead of SImode
	for ZERO_EXTRACT RTX.  Use SWI248 mode iterator for the first
	operand of ZERO_EXTRACT RTX.  Change ext_register_operand predicate
	to register_operand.  Rename from *testqi_ext_1.
	(*testqi_ext<mode>_2): Ditto.  Rename from *testqi_ext_2.
	(andqi_ext_1): New expander.
	(*andqi_ext<mode>_1): Use SWI248 mode iterator instead of SImode
	for ZERO_EXTRACT RTX.  Use SWI248 mode iterator for the first
	operand of ZERO_EXTRACT RTX.  Change ext_register_operand predicate
	to register_operand.  Rename from andqi_ext_1.
	(*andqi_ext<mode>_1_cc): Ditto.  Rename from *andqi_ext_1_cc.
	(*andqi_ext<mode>_2): Ditto.  Rename from *andqi_ext_2.
	(*<code>qi_ext<mode>_1): Ditto.  Rename from *<code>qi_ext_1.
	(*<code>qi_ext<mode>_2): Ditto.  Rename from *<code>qi_ext_2.
	(xorqi_ext_1_cc): Use HImode instead of SImode for ZERO_EXTRACT RTX.
	(*xorqi_ext<mode>_1_cc):  Use SWI248 mode iterator instead of SImode
	for ZERO_EXTRACT RTX.  Use SWI248 mode iterator for the first
	operand of ZERO_EXTRACT RTX.  Change ext_register_operand predicate
	to register_operand.  Rename from *xorqi_ext_1_cc.
	* config/i386/i386-expand.c (ix86_split_idivmod): Emit ZERO_EXTRACT
	in mode, matching its first operand.
	(promote_duplicated_reg): Update for renamed insv<mode>_1.
	* config/i386/predicates.md (ext_register_operand): Remove predicate.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr78904-1a.c: New test.
	* gcc.target/i386/pr78904-1b.c: Ditto.
	* gcc.target/i386/pr78904-2a.c: Ditto.
	* gcc.target/i386/pr78904-2b.c: Ditto.
	* gcc.target/i386/pr78904-3a.c: Ditto.
	* gcc.target/i386/pr78904-3b.c: Ditto.
	* gcc.target/i386/pr78904-4a.c: Ditto.
	* gcc.target/i386/pr78904-4b.c: Ditto.
	* gcc.target/i386/pr78904-5a.c: Ditto.
	* gcc.target/i386/pr78904-5b.c: Ditto.
	* gcc.target/i386/pr78904-6a.c: Ditto.
	* gcc.target/i386/pr78904-6b.c: Ditto.
	* gcc.target/i386/pr78967-1a.c: Ditto.
	* gcc.target/i386/pr78967-1b.c: Ditto.
	* gcc.target/i386/pr78967-2a.c: Ditto.
	* gcc.target/i386/pr78967-2b.c: Ditto.
2020-06-18 20:12:48 +02:00
Martin Sebor 5acc654e38 Avoid warning for memset writing over multiple members.
Resolves:
PR middle-end/95667 - unintended warning for memset writing across multiple members
PR middle-end/92814 - missing -Wstringop-overflow writing into a dynamically allocated flexible array member

gcc/ChangeLog:

	PR middle-end/95667
	PR middle-end/92814
	* builtins.c (compute_objsize): Remove call to
	compute_builtin_object_size and instead compute conservative sizes
	directly here.

gcc/testsuite/ChangeLog:

	PR middle-end/95667
	PR middle-end/92814
	* gcc.dg/Wstringop-overflow-25.c: Remove xfails.
	* gcc.dg/Wstringop-overflow-39.c: New test.
2020-06-18 12:00:36 -06:00
Marek Polacek 5421fae8b1 c++: ICE in requires-expressions with invalid args [PR95735]
This ICE-on-invalid goes back to GCC 6.  In finish_template_variable,
if coerce_innermost_template_parms returns error_mark_node, we pass
it down to constraints_satisfied_p and that error_mark_node flows
down to various satisfy_* functions and then to various tsubst_*
functions, where we crash.  diagnose_constraints also doesn't cope
with error arglist, so I think we should just return as in the
patch below.

gcc/cp/ChangeLog:

	PR c++/95735
	* pt.c (finish_template_variable): Return if
	coerce_innermost_template_parms return error_mark_node.

gcc/testsuite/ChangeLog:

	PR c++/95735
	* g++.dg/cpp2a/concepts-err2.C: New test.
2020-06-18 11:51:01 -04:00
Christophe Lyon 634e6f4910 Fix use of inaccessible member in pr94052.C
The recent PR41437 fix exposed a latent use of an inaccessible member in
the below testcase.

	gcc/testsuite/ChangeLog:

	* g++.target/aarch64/pr94052.C: Give z::ad public access.
2020-06-18 15:27:21 +00:00
Martin Liska 72cb486456
vectorizer: add _bb_vec_info::region_stmts and reverse_region_stmts
gcc/ChangeLog:

	* coretypes.h (struct iterator_range): New type.
	* tree-vect-patterns.c (vect_determine_precisions): Use
	range-based iterator.
	(vect_pattern_recog): Likewise.
	* tree-vect-slp.c (_bb_vec_info):  Likewise.
	(_bb_vec_info::~_bb_vec_info): Likewise.
	(vect_slp_check_for_constructors): Likewise.
	* tree-vectorizer.h:Add new iterators
	and functions that use it.
2020-06-18 16:58:27 +02:00
Jonathan Wakely bd0a89dcd8 Add missing PR number to ChangeLog (PR 95378)
gcc/c-family/ChangeLog:

	* ChangeLog:
2020-06-18 15:34:51 +01:00
Martin Liska e68cc3a8f8
rs6000: Fix creation of VEC_COND_EXPR
gcc/ChangeLog:

	* config/rs6000/rs6000-call.c (fold_build_vec_cmp):
	Since 502d63b6d6, first argument
	of a VEC_COND_EXPR cannot be tcc_comparison and so that
	a SSA_NAME needs to be created before we use it for the first
	argument of the VEC_COND_EXPR.
	(fold_compare_helper): Pass gsi to fold_build_vec_cmp.
2020-06-18 16:12:06 +02:00
Tobias Burnus ac70b20b10 OpenMP/Fortran: Reject allocatable components in map clause
gcc/fortran/ChangeLog:

	* openmp.c (resolve_omp_clauses): Reject vars with
	allocatable components in OpenMP map clauses.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/map-alloc-comp-1.f90: New test.
2020-06-18 15:27:30 +02:00
Richard Biener eccc3d4326 middle-end/95739 - fix vector condition IFN expansion
This fixes the omission of moving the expansion result to the
target.

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

	PR middle-end/95739
	* internal-fn.c (expand_vect_cond_optab_fn): Move the result
	to the target if necessary.
	(expand_vect_cond_mask_optab_fn): Likewise.
2020-06-18 14:47:34 +02:00
Martin Liska 9435fb9668
Fix typo in tree-ssa-reassoc.c.
gcc/ChangeLog:

	* tree-ssa-reassoc.c (ovce_extract_ops): Replace *vcond with
	vcond as we check for NULL pointer.
2020-06-18 14:46:02 +02:00
Martin Liska 9b4bdaf794
gcc-changelog: checkout & pull order
contrib/ChangeLog:

	* gcc-changelog/git_update_version.py: First checkout and then
	run git pull ---rebase.
2020-06-18 14:45:39 +02:00
Marek Polacek 81caacc273 c++: Fix tsubst ICE with invalid static_cast [PR95728]
Since r11-423 tsubst_copy_and_build/TREE_LIST uses tsubst_tree_list
instead of open coding it.  While the latter could return an error
node wrapped in a TREE_LIST, the former can return a naked error node.

That broke in tsubst_copy_and_build/NEW_EXPR:
  tree placement = RECUR (TREE_OPERAND (t, 0));
  // placement is now error_mark_node, so...
  for (; placement != NULL_TREE; placement = TREE_CHAIN (placement))
  // ... this crashes

If we just return, we avoid the ICE and improve the diagnostic a bit.

gcc/cp/ChangeLog:

	PR c++/95728
	* pt.c (tsubst_copy_and_build) <case NEW_EXPR>: Return error_mark_node
	if placement is erroneous.

gcc/testsuite/ChangeLog:

	PR c++/95728
	* g++.dg/template/cast6.C: New test.
2020-06-18 08:32:21 -04:00
Martin Liska 2c53566539
gcc-changelog: support merge commits in git_update_version
contrib/ChangeLog:

	* gcc-changelog/git_update_version.py: Support merge commits
	and walk only on the branch that is being merged and generate
	missing ChangeLog entries.
2020-06-18 14:30:47 +02:00
Tobias Burnus 3870268b27 silence empty-body warning
gcc/ChangeLog:

	* gimple-pretty-print.c (dump_binary_rhs): Use braces to
	silence empty-body warning with gcc_fallthrough.
2020-06-18 13:19:03 +02:00
Jakub Jelinek 2e0f4a18bc phiopt: Improve minmax optimization [PR95699]
As discussed in the PR, the
x < 0x80000000U to (int) x >= 0
optimization stands in the way of minmax_replacement optimization,
so for comparisons with most of the constants it works well, but when the
above mentioned optimization triggers, it is unable to do it.
The match.pd (cond (cmp (convert? x) c1) (op x c2) c3) -> (op (minmax x c1) c2)
optimization is able to look through that and this patch
teaches minmax_replacement about it too.

2020-06-18  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/95699
	* tree-ssa-phiopt.c (minmax_replacement): Treat (signed int)x < 0
	as x > INT_MAX and (signed int)x >= 0 as x <= INT_MAX.  Move variable
	declarations to the statements that set them where possible.

	* gcc.dg/tree-ssa/pr95699.c: New test.
2020-06-18 12:12:43 +02:00
Jakub Jelinek 9a875db43c forwprop: simplify_vector_constructor follow-up fix [PR95713]
As the following testcase shows, the exception for the aarch64
vec_pack_trunc_di is not sufficient on x86, the halfvectype
"vectors" have SImode but the x86 vec_pack_trunc_si meant for
the bool bitmasks combines 2x SImode into DImode, while in the
testcase the halfvectype is 1x SImode "vector" with SImode and
result is 2x HImode "vector" with SImode.

Richard Sandiford's reply:
FWIW, since the aarch64 case was only found by inspection and might
not be useful, personally I'd prefer to drop that case after all.

2020-06-18  Jakub Jelinek  <jakub@redhat.com>

	PR target/95713
	* tree-ssa-forwprop.c (simplify_vector_constructor): Don't allow
	scalar mode halfvectype other than vector boolean for
	VEC_PACK_TRUNC_EXPR.

	* gcc.dg/pr95713.c: New test.
2020-06-18 12:12:43 +02:00
Richard Biener 5553433d7b avoid early asm output
This avoids early assembler output via the gimplifier creating
new static CTORs.  The output machinery seems to be prepared to
output constants recursively and it's just a matter of
appropriately defering or not defering output.

This also has the advantage of not outputting .string for
optimized away local aggregate initializers containing string
references.

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

	* varasm.c (assemble_variable): Make sure to not
	defer output when outputting addressed constants.
	(output_constant_def_contents): Likewise.
	(add_constant_to_table): Take and pass on whether to
	defer output.
	(output_addressed_constants): Likewise.
	(output_constant_def): Pass on whether to defer output
	to add_constant_to_table.
	(tree_output_constant_def): Defer output of constants.
2020-06-18 12:11:44 +02:00
Richard Biener da2b7c7f0a remove SLP_TREE_TWO_OPERATORS, add SLP permutation node
This removes the SLP_TREE_TWO_OPERATORS hack in favor of having
explicit SLP nodes for both computations and the blend operation.
For this introduce a generic merge + select + permute SLP node
(with implementation limits).

Building upon earlier patches it adds vect_stmt_dominates_stmt_p
and the ability to compute a vector insertion place from
vectorized stmts (which now have UID zero) as needed for
the permute node.

2020-06-17  Richard Biener  <rguenther@suse.de>

	* tree-vectorizer.h (_slp_tree::two_operators): Remove.
	(_slp_tree::lane_permutation): New member.
	(_slp_tree::code): Likewise.
	(SLP_TREE_TWO_OPERATORS): Remove.
	(SLP_TREE_LANE_PERMUTATION): New.
	(SLP_TREE_CODE): Likewise.
	(vect_stmt_dominates_stmt_p): Declare.
	* tree-vectorizer.c (vect_stmt_dominates_stmt_p): New function.
	* tree-vect-stmts.c (vect_model_simple_cost): Remove
	SLP_TREE_TWO_OPERATORS handling.
	* tree-vect-slp.c (_slp_tree::_slp_tree): Amend.
	(_slp_tree::~_slp_tree): Likewise.
	(vect_two_operations_perm_ok_p): Remove.
	(vect_build_slp_tree_1): Remove verification of two-operator
	permutation here.
	(vect_build_slp_tree_2): When we have two different operators
	build two computation SLP nodes and a blend.
	(vect_print_slp_tree): Print the lane permutation if it exists.
	(slp_copy_subtree): Copy it.
	(vect_slp_rearrange_stmts): Re-arrange it.
	(vect_slp_analyze_node_operations_1): Handle SLP_TREE_CODE
	VEC_PERM_EXPR explicitely.
	(vect_schedule_slp_instance): Likewise.  Remove old
	SLP_TREE_TWO_OPERATORS code.
	(vectorizable_slp_permutation): New function.
2020-06-18 12:05:37 +02:00
Eric Botcazou 2ab42c70a6 [Ada] Fix small inefficiency in previous change to expander
2020-06-18  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* exp_ch4.adb (Get_Size_For_Range): Only make sure to return a
	size lower than that of the original type if possible.
	* libgnat/s-rannum.adb (Random_Discrete): Back out optimization
	added for 32-bit types.
2020-06-18 05:08:37 -04:00
Arnaud Charlet 424ce99fb5 [Ada] ACATS 4.1J - B854003 - Subtype conformance check missed
2020-06-18  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

	* sem_ch6.ads, sem_ch6.adb (Check_Formal_Conformance): New
	subprogram.
	(Check_Conformance): Move code to Check_Formal_Conformance.
	* sem_ch8.adb (Analyze_Subprogram_Renaming): Check for formal
	conformance when needed.
2020-06-18 05:08:36 -04:00