platform/upstream/gcc.git
4 years agoaarch64: Fix an ICE in register_tuple_type [PR95523]
z00219097 [Wed, 10 Jun 2020 15:58:51 +0000 (16:58 +0100)]
aarch64: Fix an ICE in register_tuple_type [PR95523]

When registering the tuple type in register_tuple_type, the
TYPE_ALIGN (tuple_type) will be changed by -fpack-struct=n. We need to
maintain natural alignment in handle_arm_sve_h.

2020-06-10  Haijian Zhang  <z.zhanghaijian@huawei.com>

gcc/
PR target/95523
* config/aarch64/aarch64-sve-builtins.h
(sve_switcher::m_old_maximum_field_alignment): New member.
* config/aarch64/aarch64-sve-builtins.cc
(sve_switcher::sve_switcher): Save maximum_field_alignment in
m_old_maximum_field_alignment and clear maximum_field_alignment.
(sve_switcher::~sve_switcher): Restore maximum_field_alignment.

gcc/testsuite/
PR target/95523
* gcc.target/aarch64/sve/pr95523.c: New test.

4 years ago[Ada] AI12-0364 Add a modular atomic arithmetic package
Arnaud Charlet [Thu, 12 Mar 2020 13:46:55 +0000 (09:46 -0400)]
[Ada] AI12-0364 Add a modular atomic arithmetic package

2020-06-10  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* libgnat/s-aomoar.ads, libgnat/s-aomoar.adb: New files.
* libgnat/s-atopar.ads: Move...
* libgnat/s-aoinar.ads: Here.
* libgnat/s-atopar.adb: Move...
* libgnat/s-aoinar.adb: Here.
* impunit.adb: Update list of runtime files.
* Makefile.rtl (GNATRTL_NONTASKING_OBJS=): Adjust.

4 years agogcc-changelog: fix parse_git_name_status for renames.
Martin Liska [Wed, 10 Jun 2020 14:07:10 +0000 (16:07 +0200)]
gcc-changelog: fix parse_git_name_status for renames.

Renamed files are listed in the following format:

M gcc/ada/Makefile.rtl
M gcc/ada/impunit.adb
R097 gcc/ada/libgnat/s-atopar.adb gcc/ada/libgnat/s-aoinar.adb
R095 gcc/ada/libgnat/s-atopar.ads gcc/ada/libgnat/s-aoinar.ads
A gcc/ada/libgnat/s-aomoar.adb
A gcc/ada/libgnat/s-aomoar.ads

So 'R' is followed by a percentage number.

contrib/ChangeLog:

* gcc-changelog/git_commit.py: Fix renamed files in
parse_git_name_status.
* gcc-changelog/test_email.py: Add test for it.

4 years agoc++: Fix ICE with delayed parsing of noexcept-specifier [PR95562]
Marek Polacek [Tue, 9 Jun 2020 22:08:45 +0000 (18:08 -0400)]
c++: Fix ICE with delayed parsing of noexcept-specifier [PR95562]

Here we ICE because a DEFERRED_PARSE expression leaked to tsubst_copy.
We create these expressions for deferred noexcept-specifiers in
cp_parser_save_noexcept; they are supposed to be re-parsed in
cp_parser_late_noexcept_specifier.  In this case we never got around
to re-parsing it because the noexcept-specifier was attached to a
pointer to a function, not to a function declaration.  But we should
not have delayed the parsing here in the first place; we already
avoid delaying the parsing for alias-decls, typedefs, and friend
function declarations.  (Clang++ also doesn't delay the parsing
for pointers to function.)

gcc/cp/ChangeLog:

PR c++/95562
* parser.c (cp_parser_direct_declarator): Clear
CP_PARSER_FLAGS_DELAY_NOEXCEPT if the declarator kind is not
cdk_id.

gcc/testsuite/ChangeLog:

PR c++/95562
* g++.dg/cpp0x/noexcept60.C: New test.

4 years ago[Ada] AI12-0311 New checks for language-defined units
Arnaud Charlet [Wed, 11 Mar 2020 11:56:34 +0000 (07:56 -0400)]
[Ada] AI12-0311 New checks for language-defined units

2020-06-10  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* snames.ads-tmpl (Name_Characters_Assertion_Check,
Name_Containers_Assertion_Check,
Name_Interfaces_Assertion_Check, Name_IO_Assertion_Check,
Name_Numerics_Assertion_Check, Name_Strings_Assertion_Check,
Name_System_Assertion_Check): New constants.
* types.ads (Characters_Assertion_Check,
Containers_Assertion_Check, Interfaces_Assertion_Check,
IO_Assertion_Check, Numerics_Assertion_Check,
Strings_Assertion_Check, System_Assertion_Check): New constants.
(All_Checks): Update accordingly.

4 years ago[Ada] Don't build equivalent record aggregate if type has predicates
Ghjuvan Lacambre [Wed, 11 Mar 2020 07:55:56 +0000 (08:55 +0100)]
[Ada] Don't build equivalent record aggregate if type has predicates

2020-06-10  Ghjuvan Lacambre  <lacambre@adacore.com>

gcc/ada/

* exp_ch3.adb (Build_Equivalent_Record_Aggregate): Return Empty
if Etype of record component has predicates.

4 years ago[Ada] Ada 202x AI12-0192 "requires late initialization"
Arnaud Charlet [Sat, 7 Mar 2020 15:05:11 +0000 (10:05 -0500)]
[Ada] Ada 202x AI12-0192 "requires late initialization"

2020-06-10  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* exp_ch3.adb (Build_Init_Statements): Implement the notion of
"require late initialization".

4 years ago[Ada] Add missing Sloc on new explicit dereferences
Eric Botcazou [Tue, 10 Mar 2020 11:14:49 +0000 (12:14 +0100)]
[Ada] Add missing Sloc on new explicit dereferences

2020-06-10  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* sem_util.adb (Copy_And_Maybe_Dereference): Temporarily copy
the parent node of the original tree when dereferencing.

4 years ago[Ada] Additional warnings on overlapping actuals of composite types
Ed Schonberg [Mon, 9 Mar 2020 20:36:55 +0000 (16:36 -0400)]
[Ada] Additional warnings on overlapping actuals of composite types

2020-06-10  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_warn.adb (Warn_On_Overlapping_Actuals): Add a warning when
two actuals in a call overlap, both are composite types that may
be passed by reference, and only one of them is writable.

4 years ago[Ada] Implement AI12-0162 Memberships and Unchecked_Unions
Eric Botcazou [Tue, 10 Mar 2020 08:09:25 +0000 (09:09 +0100)]
[Ada] Implement AI12-0162 Memberships and Unchecked_Unions

2020-06-10  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* exp_ch4.adb (Expand_N_In): Use an expression with actions to
insert the PE raise statement for the Unchecked_Union case.

4 years ago[Ada] Remove obsolete code in Resolve_Call
Eric Botcazou [Mon, 9 Mar 2020 09:14:53 +0000 (10:14 +0100)]
[Ada] Remove obsolete code in Resolve_Call

2020-06-10  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* sem_ch4.adb (Analyze_Call): Use idiomatic condition.
* sem_res.adb (Resolve_Call): Remove obsolete code.

4 years ago[Ada] Insert explicit dereferences when building actual subtype
Eric Botcazou [Sun, 8 Mar 2020 18:25:51 +0000 (19:25 +0100)]
[Ada] Insert explicit dereferences when building actual subtype

2020-06-10  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* sem_util.adb (Copy_And_Maybe_Dereference): New function.
(Build_Access_Record_Constraint): Use it to copy the prefix.
(Build_Actual_Array_Constraint): Likewise.
(Build_Actual_Record_Constraint): Likewise.

4 years ago[Ada] Disable unwanted warnings in Assertion_Policy(Ignore) mode
Bob Duff [Sun, 8 Mar 2020 21:50:49 +0000 (17:50 -0400)]
[Ada] Disable unwanted warnings in Assertion_Policy(Ignore) mode

2020-06-10  Bob Duff  <duff@adacore.com>

gcc/ada/

* sem_prag.adb (Invariant): Remove the pragma removing code.  It
doesn't work to remove the pragma, because various flags are set
during Build_Invariant_Procedure_Declaration and
Build_Invariant_Procedure_Body that need to be set to avoid the
spurious warnings.
* exp_util.adb (Make_Invariant_Call): Avoid calling the
invariant-checking procedure if the body is empty. This is an
optimization.

4 years ago[Ada] Fix gnatmetric switches description
Vasiliy Fofanov [Mon, 9 Mar 2020 10:22:17 +0000 (11:22 +0100)]
[Ada] Fix gnatmetric switches description

2020-06-10  Vasiliy Fofanov  <fofanov@adacore.com>

gcc/ada/

* doc/gnat_ugn/gnat_utility_programs.rst: Fix gnatmetric
switches description.

4 years ago[Ada] Update headers
Arnaud Charlet [Sat, 7 Mar 2020 20:20:04 +0000 (15:20 -0500)]
[Ada] Update headers

2020-06-10  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* repinfo-input.ads, repinfo-input.adb, repinfo.adb,
repinfo.ads: Update header.

4 years ago[Ada] Improve code generated for dynamic discriminated aggregate
Eric Botcazou [Fri, 6 Mar 2020 20:58:39 +0000 (21:58 +0100)]
[Ada] Improve code generated for dynamic discriminated aggregate

2020-06-10  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* exp_aggr.adb (In_Place_Assign_OK): Do not necessarily return
false for a type with discriminants.
(Convert_To_Assignments): Use Parent_Node and Parent_Kind more
consistently.  In the in-place assignment case, first apply a
discriminant check if need be, and be prepared for a rewritten
aggregate as a result.

4 years ago[Ada] Remove more references to ASIS
Arnaud Charlet [Fri, 6 Mar 2020 10:33:41 +0000 (05:33 -0500)]
[Ada] Remove more references to ASIS

2020-06-10  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* atree.adb, contracts.adb, debug.adb, freeze.adb,
repinfo-input.adb, repinfo.adb, sem_attr.adb, sem_ch10.adb,
sem_ch13.adb, sem_ch3.adb, sem_ch5.adb, sem_ch6.adb,
sem_ch8.adb, sem_ch9.adb, sem_disp.adb, sem_eval.adb,
sem_prag.adb: Remove more references to ASIS.

4 years ago[Ada] Fix typo in exception message
Arnaud Charlet [Fri, 6 Mar 2020 11:13:36 +0000 (06:13 -0500)]
[Ada] Fix typo in exception message

2020-06-10  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* libgnat/s-secsta.adb (Round_Up): Fix typo in exception
message.

4 years ago[Ada] Fix minor typo in comment of membership choice parsing
Piotr Trojanek [Fri, 6 Mar 2020 09:32:15 +0000 (10:32 +0100)]
[Ada] Fix minor typo in comment of membership choice parsing

2020-06-10  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* par-ch4.adb (P_Membership_Test): Fix typo in a grammar rule.

4 years ago[Ada] Revert workaround for expansion of Enum_Rep in GNATprove mode
Piotr Trojanek [Thu, 5 Mar 2020 10:57:50 +0000 (11:57 +0100)]
[Ada] Revert workaround for expansion of Enum_Rep in GNATprove mode

2020-06-10  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* exp_spark.adb (Expand_SPARK_N_Attribute_Reference): Remove
expansion of First and Last attributes.

4 years ago[Ada] Fold Enum_Rep attribute in evaluation and not in expansion
Piotr Trojanek [Thu, 5 Mar 2020 10:46:59 +0000 (11:46 +0100)]
[Ada] Fold Enum_Rep attribute in evaluation and not in expansion

2020-06-10  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* exp_attr.adb (Expand_N_Attribute_Reference): Remove folding
for Enum_Rep attribute.
* exp_spark.adb (Expand_SPARK_N_Attribute_Reference): Remove
duplicated code for folding Enum_Rep attribute.
* sem_attr.adb (Eval_Attribute): Relax condition for folding
Enum_Rep attribute; previously dead code is now executed when
the attribute prefix is an enumeration literal; refine type in
processing of Enum_Val.

4 years ago[Ada] Classwide controlled obj not dispatching
Javier Miranda [Tue, 3 Mar 2020 19:27:18 +0000 (14:27 -0500)]
[Ada] Classwide controlled obj not dispatching

2020-06-10  Javier Miranda  <miranda@adacore.com>

gcc/ada/

* sem_ch3.adb (Analyze_Declarations): Adjust the machinery that
takes care of late body overriding of initialize, adjust,
finalize.  Remove ASIS mode code.

4 years ago[Ada] Ada_2020 AI12-0220: Pre/Postconditions on Access_To_Subprogram types
Ed Schonberg [Mon, 2 Mar 2020 19:58:59 +0000 (14:58 -0500)]
[Ada] Ada_2020 AI12-0220: Pre/Postconditions on Access_To_Subprogram types

2020-06-10  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* einfo.ads (Access_Subprogram_Wrapper): New attribute of
Subprogram_Type entities. Denotes subprogram constructed for
Access_To_Subprogram types that include pre- and postconditions.
* einfo.adb: Subprogram bodies for Access_Subprogram_Wrapper.
* exp_ch6.adb (Expand_Call): An indirect call through an
Access_To_subprogram that includes contracts is rewritten as a
call to the corresponding Access_ ubprogram_Wrapper. Handle
derived types that inherit contract from parent.
* sem_prag.adb (Build_Access_Subprogram_Wrapper): Build
subprogram declaration for subprogram that incorporates the
contracts of an Access_To_Subprogram type declaration. Build
corresponding body and attach it to freeze actions for type.
* sem_util.ads, sem_util.adb (Is_Access_Subprogram_Wrapper):
Utility that uses signature of the subprogram to determine
whether it is a generated wrapper for an Access_To_Subprogram
type.

4 years ago[Ada] Fix assertion failure on functions with contracts
Ghjuvan Lacambre [Wed, 4 Mar 2020 13:40:01 +0000 (14:40 +0100)]
[Ada] Fix assertion failure on functions with contracts

2020-06-10  Ghjuvan Lacambre  <lacambre@adacore.com>

gcc/ada/

* par-ch6.adb (P_Subprogram): Make sure the specification
belongs to a procedure.

4 years ago[Ada] Simplify detection of static membership choices
Piotr Trojanek [Thu, 20 Feb 2020 11:10:53 +0000 (12:10 +0100)]
[Ada] Simplify detection of static membership choices

2020-06-10  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* sem_ch13.adb (All_Membership_Choices_Static): Assert an AST
property documented in sinfo.ads and simplify an excessive
condition.

4 years ago[Ada] Minor fix style and typos in comments
Piotr Trojanek [Wed, 4 Mar 2020 12:28:14 +0000 (13:28 +0100)]
[Ada] Minor fix style and typos in comments

2020-06-10  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* exp_attr.adb (Expand_N_Attribute_Reference): Fix a copy-paste
mistake in comment.
* sem_res.adb (Flag_Effectively_Volatile_Objects): Fix a type in
the SPARK RM rule number.
* exp_ch4.adb, sem_util.adb: Fix style in single line comments.

4 years ago[Ada] Remove unreferenced GNATprove utility routine Get_Low_Bound
Piotr Trojanek [Thu, 27 Feb 2020 16:48:42 +0000 (17:48 +0100)]
[Ada] Remove unreferenced GNATprove utility routine Get_Low_Bound

2020-06-10  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* sem_aux.ads, sem_aux.adb (Get_Low_Bound): Remove.

4 years ago[Ada] Remove Determine_License
Arnaud Charlet [Tue, 3 Mar 2020 16:48:54 +0000 (11:48 -0500)]
[Ada] Remove Determine_License

2020-06-10  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* scn.adb (Determine_License): Remove.

4 years ago[Ada] Incorrect accessibility checks on functions calls
Justin Squirek [Wed, 4 Mar 2020 10:32:57 +0000 (05:32 -0500)]
[Ada] Incorrect accessibility checks on functions calls

2020-06-10  Justin Squirek  <squirek@adacore.com>

gcc/ada/

* exp_ch3.adb (Expand_N_Object_Declaration): Add condition to
handle processing of objects initialized by a call to a function
return an anonymous access type.
* exp_ch6.adb, exp_ch6.ads
(Has_Unconstrained_Access_Discriminants): Moved to sem_util.adb
(Needs_Result_Accessibility_Level): Moved to sem_util.adb
* sem_util.adb, sem_util.ads
(Has_Unconstrained_Access_Discriminants): Moved from exp_ch6.adb
(Needs_Result_Accessibility_Level): Moved from exp_ch6.adb
* sem_res.adb (Valid_Conversion): Add condition for the special
case where the operand of a conversion is the result of an
anonymous access type

4 years ago[Ada] Reject illegal bodies for null procedures
Ghjuvan Lacambre [Mon, 2 Mar 2020 11:41:52 +0000 (12:41 +0100)]
[Ada] Reject illegal bodies for null procedures

2020-06-10  Ghjuvan Lacambre  <lacambre@adacore.com>

gcc/ada/

* par-ch6.adb (P_Subprogram): Reject duplicate subprogram
declarations.

4 years ago[Ada] Fix incorrect insertion of post-call actions in if-expression
Eric Botcazou [Wed, 4 Mar 2020 08:32:03 +0000 (09:32 +0100)]
[Ada] Fix incorrect insertion of post-call actions in if-expression

2020-06-10  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* exp_ch6.adb (Insert_Post_Call_Actions): Deal with the context
of an if-expression and with a call written in prefixed notation.

4 years ago[Ada] Minor reformatting and some typo fixes
Gary Dismukes [Tue, 3 Mar 2020 00:13:33 +0000 (19:13 -0500)]
[Ada] Minor reformatting and some typo fixes

2020-06-10  Gary Dismukes  <dismukes@adacore.com>

gcc/ada/

* einfo.ads: Minor reformatting of a comment.
* exp_aggr.adb: Minor reformatting and a grammar correction.
* exp_attr.adb: Minor reformatting and a typo fix in some
comments.
* sem_ch12.adb: Fix three typos in comments.

4 years agoMake {SLP_TREE,STMT_VINFO}_VEC_STMTS a vector of gimple *
Richard Biener [Wed, 10 Jun 2020 11:47:12 +0000 (13:47 +0200)]
Make {SLP_TREE,STMT_VINFO}_VEC_STMTS a vector of gimple *

This makes {SLP_TREE,STMT_VINFO}_VEC_STMTS a vector of gimple * and
not allocate a stmt_vec_info for vectorizer generated stmts since
this is now possible after removing the only use which was chaining
of vector stmts via STMT_VINFO_RELATED_STMT.

This also removes all stmt_vec_info allocations done for vector
stmts, the remaining ones are for stmts in the scalar IL and for
patterns which are not part of the IL.  Thus after this the stmt
UIDs inside a basic-block are suitable for dominance checking
if you ignore (or lazy-fill) UIDs of zero of the vector stmts
inserted during transform.  This property is ensured by a new
flag set when pattern analysis is complete.

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

* tree-vectorizer.h (_slp_tree::vec_stmts): Make it a vector
of gimple * stmts.
(_stmt_vec_info::vec_stmts): Likewise.
(vec_info::stmt_vec_info_ro): New flag.
(vect_finish_replace_stmt): Adjust declaration.
(vect_finish_stmt_generation): Likewise.
(vectorizable_induction): Likewise.
(vect_transform_reduction): Likewise.
(vectorizable_lc_phi): Likewise.
* tree-vect-data-refs.c (vect_create_data_ref_ptr): Do not
allocate stmt infos for increments.
(vect_record_grouped_load_vectors): Adjust.
* tree-vect-loop.c (vect_create_epilog_for_reduction): Likewise.
(vectorize_fold_left_reduction): Likewise.
(vect_transform_reduction): Likewise.
(vect_transform_cycle_phi): Likewise.
(vectorizable_lc_phi): Likewise.
(vectorizable_induction): Likewise.
(vectorizable_live_operation): Likewise.
(vect_transform_loop): Likewise.
* tree-vect-patterns.c (vect_pattern_recog): Set stmt_vec_info_ro.
* tree-vect-slp.c (vect_get_slp_vect_def): Adjust.
(vect_get_slp_defs): Likewise.
(vect_transform_slp_perm_load): Likewise.
(vect_schedule_slp_instance): Likewise.
(vectorize_slp_instance_root_stmt): Likewise.
* tree-vect-stmts.c (vect_get_vec_defs_for_operand): Likewise.
(vect_finish_stmt_generation_1): Do not allocate a stmt info.
(vect_finish_replace_stmt): Do not return anything.
(vect_finish_stmt_generation): Likewise.
(vect_build_gather_load_calls): Adjust.
(vectorizable_bswap): Likewise.
(vectorizable_call): Likewise.
(vectorizable_simd_clone_call): Likewise.
(vect_create_vectorized_demotion_stmts): Likewise.
(vectorizable_conversion): Likewise.
(vectorizable_assignment): Likewise.
(vectorizable_shift): Likewise.
(vectorizable_operation): Likewise.
(vectorizable_scan_store): Likewise.
(vectorizable_store): Likewise.
(vectorizable_load): Likewise.
(vectorizable_condition): Likewise.
(vectorizable_comparison): Likewise.
(vect_transform_stmt): Likewise.
* tree-vectorizer.c (vec_info::vec_info): Initialize
stmt_vec_info_ro.
(vec_info::replace_stmt): Copy over stmt UID rather than
unsetting/setting a stmt info allocating a new UID.
(vec_info::set_vinfo_for_stmt): Assert !stmt_vec_info_ro.

4 years agoMerge evrp uses of substitute_and_fold_engine into the engine itself.
Aldy Hernandez [Tue, 5 May 2020 11:45:39 +0000 (13:45 +0200)]
Merge evrp uses of substitute_and_fold_engine into the engine itself.

This patch merges the evrp uses of the substitute and fold engine into
the engine itself, at least the parts that can be re-used by other
engine uses.  It also adds a context parameter to get_value() for
further use.

gcc/
* gimple-loop-versioning.cc (loop_versioning::name_prop::get_value):
Add stmt parameter.
* gimple-ssa-evrp.c (class evrp_folder): New.
(class evrp_dom_walker): Remove.
(execute_early_vrp): Use evrp_folder instead of evrp_dom_walker.
* tree-ssa-ccp.c (ccp_folder::get_value): Add stmt parameter.
* tree-ssa-copy.c (copy_folder::get_value): Same.
* tree-ssa-propagate.c (substitute_and_fold_engine::replace_uses_in):
Pass stmt to get_value.
(substitute_and_fold_engine::replace_phi_args_in): Same.
(substitute_and_fold_dom_walker::after_dom_children): Call
post_fold_bb.
(substitute_and_fold_dom_walker::foreach_new_stmt_in_bb): New.
(substitute_and_fold_dom_walker::propagate_into_phi_args): New.
(substitute_and_fold_dom_walker::before_dom_children): Adjust to
call virtual functions for folding, pre_folding, and post folding.
Call get_value with PHI.  Tweak dump.
* tree-ssa-propagate.h (class substitute_and_fold_engine):
New argument to get_value.
New virtual function pre_fold_bb.
New virtual function post_fold_bb.
New virtual function pre_fold_stmt.
New virtual function post_new_stmt.
New function propagate_into_phi_args.
* tree-vrp.c (vrp_folder::get_value): Add stmt argument.
* vr-values.c (vr_values::extract_range_from_stmt): Adjust dump
output.
(vr_values::fold_cond): New.
(vr_values::simplify_cond_using_ranges_1): Call fold_cond.
* vr-values.h (class vr_values): Add
simplify_cond_using_ranges_when_edge_is_known.
gcc/testsuite/
* gcc.dg/tree-ssa/ssa-dse-30.c: Adjust test for folding of
memmove happening later.

4 years agoAdd missing store in emission of asan_stack_free.
Martin Liska [Tue, 19 May 2020 14:57:56 +0000 (16:57 +0200)]
Add missing store in emission of asan_stack_free.

gcc/ChangeLog:

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

PR sanitizer/94910
* asan.c (asan_emit_stack_protection): Emit
also **SavedFlagPtr(FakeStack, class_id) = 0 in order to release
a stack frame.

4 years agoAArch64: Adjust costing of by element MUL to be the same as SAME3 MUL.
Tamar Christina [Wed, 10 Jun 2020 10:55:46 +0000 (11:55 +0100)]
AArch64: Adjust costing of by element MUL to be the same as SAME3 MUL.

The cost model is currently treating multiplication by element as being more
expensive than 3 same multiplication.  This means that if the value is on the
SIMD side we add an unneeded DUP.  If the value is on the genreg side we use the
more expensive DUP instead of fmov.

This patch corrects the costs such that the two multiplies are costed the same
which allows us to generate

        fmul    v3.4s, v3.4s, v0.s[0]

instead of

        dup     v0.4s, v0.s[0]
        fmul    v3.4s, v3.4s, v0.4s

gcc/ChangeLog:

* config/aarch64/aarch64.c (aarch64_rtx_mult_cost): Adjust costs for mul.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/asimd-mull-elem.c: New test.

4 years agoIntroduce STMT_VINFO_VEC_STMTS
Richard Biener [Tue, 9 Jun 2020 14:07:45 +0000 (16:07 +0200)]
Introduce STMT_VINFO_VEC_STMTS

This gets rid of the linked list of STMT_VINFO_VECT_STMT and
STMT_VINFO_RELATED_STMT in preparation for vectorized stmts no
longer needing a stmt_vec_info (just for this chaining).  This
has ripple-down effects in all places we gather vectorized
defs.  For this new interfaces are introduced and used
throughout vectorization, simplifying code in a lot of places
and merging it with the SLP way of gathering vectorized
operands.  There is vect_get_vec_defs as the new recommended
unified interface and vect_get_vec_defs_for_operand as one
for non-SLP operation.  I've resorted to keep the structure
of the code the same where using vect_get_vec_defs would have
been too disruptive for this already large patch.

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

* tree-vect-data-refs.c (vect_vfa_access_size): Adjust.
(vect_record_grouped_load_vectors): Likewise.
* tree-vect-loop.c (vect_create_epilog_for_reduction): Likewise.
(vectorize_fold_left_reduction): Likewise.
(vect_transform_reduction): Likewise.
(vect_transform_cycle_phi): Likewise.
(vectorizable_lc_phi): Likewise.
(vectorizable_induction): Likewise.
(vectorizable_live_operation): Likewise.
(vect_transform_loop): Likewise.
* tree-vect-slp.c (vect_get_slp_defs): New function, split out
from overload.
* tree-vect-stmts.c (vect_get_vec_def_for_operand_1): Remove.
(vect_get_vec_def_for_operand): Likewise.
(vect_get_vec_def_for_stmt_copy): Likewise.
(vect_get_vec_defs_for_stmt_copy): Likewise.
(vect_get_vec_defs_for_operand): New function.
(vect_get_vec_defs): Likewise.
(vect_build_gather_load_calls): Adjust.
(vect_get_gather_scatter_ops): Likewise.
(vectorizable_bswap): Likewise.
(vectorizable_call): Likewise.
(vectorizable_simd_clone_call): Likewise.
(vect_get_loop_based_defs): Remove.
(vect_create_vectorized_demotion_stmts): Adjust.
(vectorizable_conversion): Likewise.
(vectorizable_assignment): Likewise.
(vectorizable_shift): Likewise.
(vectorizable_operation): Likewise.
(vectorizable_scan_store): Likewise.
(vectorizable_store): Likewise.
(vectorizable_load): Likewise.
(vectorizable_condition): Likewise.
(vectorizable_comparison): Likewise.
(vect_transform_stmt): Adjust and remove no longer applicable
sanity checks.
* tree-vectorizer.c (vec_info::new_stmt_vec_info): Initialize
STMT_VINFO_VEC_STMTS.
(vec_info::free_stmt_vec_info): Relase it.
* tree-vectorizer.h (_stmt_vec_info::vectorized_stmt): Remove.
(_stmt_vec_info::vec_stmts): Add.
(STMT_VINFO_VEC_STMT): Remove.
(STMT_VINFO_VEC_STMTS): New.
(vect_get_vec_def_for_operand_1): Remove.
(vect_get_vec_def_for_operand): Likewise.
(vect_get_vec_defs_for_stmt_copy): Likewise.
(vect_get_vec_def_for_stmt_copy): Likewise.
(vect_get_vec_defs): New overloads.
(vect_get_vec_defs_for_operand): New.
(vect_get_slp_defs): Declare.

4 years agotmmark: verify_ssa failed [PR95569]
Qian Chao [Wed, 10 Jun 2020 08:46:56 +0000 (04:46 -0400)]
tmmark: verify_ssa failed [PR95569]

This patch fixes a latent bug exposed by eb72dc663e9070b281be83a80f6f838a3a878822.
See the discussion on the bug for details.

Bootstrapped and regtested on aarch64-linux-gnu. No new fails introduced.

2020-06-10  Qian Chao  <qianchao9@huawei.com>

gcc/ChangeLog:

PR tree-optimization/95569
* trans-mem.c (expand_assign_tm): Ensure that rtmp is marked TREE_ADDRESSABLE.

gcc/testsuite/ChangeLog:

PR tree-optimization/95569
* gcc.dg/tm/pr95569.c: New test.

4 years agoAdd gcc_assert that &global_options are not dirty modified.
Martin Liska [Tue, 10 Dec 2019 18:41:08 +0000 (19:41 +0100)]
Add gcc_assert that &global_options are not dirty modified.

gcc/ChangeLog:

2020-03-20  Martin Liska  <mliska@suse.cz>

PR tree-optimization/92860
* optc-save-gen.awk: Generate new function cl_optimization_compare.
* opth-gen.awk: Generate declaration of the function.

gcc/c-family/ChangeLog:

2020-03-20  Martin Liska  <mliska@suse.cz>

PR tree-optimization/92860
* c-attribs.c (handle_optimize_attribute):
Save global options and compare it after parsing of function
attribute.
* c-pragma.c (opt_stack::saved_global_options): New field.
(handle_pragma_push_options): Save global_options.
(handle_pragma_pop_options): Compare them after pop.

4 years agogcc-changelog: add more Review by prefixes.
Martin Liska [Wed, 10 Jun 2020 07:57:51 +0000 (09:57 +0200)]
gcc-changelog: add more Review by prefixes.

contrib/ChangeLog:

* gcc-changelog/git_commit.py: Add more supported prefixes.
* gcc-changelog/test_email.py: Fix one flake8 error.
* gcc-changelog/test_patches.txt: Add tested for newly
supported prefixes.

4 years agogcc-changelog: Improve git_commit.py diagnostics
Jonathan Wakely [Wed, 10 Jun 2020 07:36:34 +0000 (09:36 +0200)]
gcc-changelog: Improve git_commit.py diagnostics

This changes some error messages to be more self-consistent and to fix
some grammar.

contrib/ChangeLog:

* gcc-changelog/git_commit.py (GitCommit.parse_changelog):
Improve error strings.
* gcc-changelog/test_email.py: Update expected errors.

4 years agoDaily bump.
GCC Administrator [Wed, 10 Jun 2020 00:16:47 +0000 (00:16 +0000)]
Daily bump.

4 years agolibstdc++: Define converting assignment operator for std::move_iterator
Jonathan Wakely [Tue, 9 Jun 2020 21:16:24 +0000 (22:16 +0100)]
libstdc++: Define converting assignment operator for std::move_iterator

As clarified by LWG 3265, std::move_iterator is supposed to have an
assignment operator that converts from a different specialization of
std::move_iterator, which performs an assignment. That has always been
missing from libstdc++, so assigning a different type actually performs
a converting construction, then an assignment. This is non-conforming
for the (fairly contrived) case where the converting assignment is
well-formed but the converting construction is not.

* include/bits/stl_iterator.h (move_iterator::operator=): Define.
* testsuite/24_iterators/move_iterator/dr3265.cc: New test.

4 years agolibstdc++: Define std::bad_optional_access constructor as defaulted
Jonathan Wakely [Tue, 9 Jun 2020 21:13:37 +0000 (22:13 +0100)]
libstdc++: Define std::bad_optional_access constructor as defaulted

The standard requires that std::bad_optional_access' default
constructor has a non-throwing exception specification.

* include/std/optional (bad_optional_access): Define default
constructor and destructor as defaulted.
* testsuite/20_util/optional/bad_access.cc: New test.

4 years agoPowerPC: Add future hwcap2 bits
Michael Meissner [Tue, 9 Jun 2020 20:35:43 +0000 (15:35 -0500)]
PowerPC: Add future hwcap2 bits

This patch adds support for the two new HWCAP2 fields used by the
__builtin_cpu_supports function.  It adds support in the target_clones
attribute for -mcpu=future.

The two new __builtin_cpu_supports tests are:
__builtin_cpu_supports ("isa_3_1")
__builtin_cpu_supports ("mma")

The bits used are the bits that the Linux kernel engineers will be using for
these new features.

gcc/
2020-06-09  Michael Meissner  <meissner@linux.ibm.com>

* config/rs6000/ppc-auxv.h (PPC_PLATFORM_FUTURE): Allocate
'future' PowerPC platform.
(PPC_FEATURE2_ARCH_3_1): New HWCAP2 bit for ISA 3.1.
(PPC_FEATURE2_MMA): New HWCAP2 bit for MMA.
* config/rs6000/rs6000-call.c (cpu_supports_info): Add ISA 3.1 and
MMA HWCAP2 bits.
* config/rs6000/rs6000.c (CLONE_ISA_3_1): New clone support.
(rs6000_clone_map): Add 'future' system target_clones support.

testsuite/
2020-06-09  Michael Meissner  <meissner@linux.ibm.com>

* gcc.target/powerpc/clone3.c: New test for using 'future' with
the target_clones attribute.

4 years agoPowerPC: Add future hwcap2 bits
Michael Meissner [Tue, 9 Jun 2020 20:32:52 +0000 (15:32 -0500)]
PowerPC: Add future hwcap2 bits

This patch adds support for the two new HWCAP2 fields used by the
__builtin_cpu_supports function.  It adds support in the target_clones
attribute for -mcpu=future.

The two new __builtin_cpu_supports tests are:
__builtin_cpu_supports ("isa_3_1")
__builtin_cpu_supports ("mma")

The bits used are the bits that the Linux kernel engineers will be using for
these new features.

testsuite/
2020-06-05  Michael Meissner  <meissner@linux.ibm.com>

* gcc.target/powerpc/clone3.c: New test for using 'future' with
the target_clones attribute.

4 years agoPowerPC: Add future hwcap2 bits
Michael Meissner [Tue, 9 Jun 2020 20:32:02 +0000 (15:32 -0500)]
PowerPC: Add future hwcap2 bits

This patch adds support for the two new HWCAP2 fields used by the
__builtin_cpu_supports function.  It adds support in the target_clones
attribute for -mcpu=future.

The two new __builtin_cpu_supports tests are:
__builtin_cpu_supports ("isa_3_1")
__builtin_cpu_supports ("mma")

The bits used are the bits that the Linux kernel engineers will be using for
these new features.

gcc/
2020-06-05  Michael Meissner  <meissner@linux.ibm.com>

* config/rs6000/ppc-auxv.h (PPC_PLATFORM_FUTURE): Allocate
'future' PowerPC platform.
(PPC_FEATURE2_ARCH_3_1): New HWCAP2 bit for ISA 3.1.
(PPC_FEATURE2_MMA): New HWCAP2 bit for MMA.
* config/rs6000/rs6000-call.c (cpu_supports_info): Add ISA 3.1 and
MMA HWCAP2 bits.
* config/rs6000/rs6000.c (CLONE_ISA_3_1): New clone support.
(rs6000_clone_map): Add 'future' system target_clones support.

4 years agoPowerPC: Add pcrel/prefixed target supports.
Michael Meissner [Tue, 9 Jun 2020 20:17:12 +0000 (15:17 -0500)]
PowerPC: Add pcrel/prefixed target supports.

2020-06-09  Michael Meissner  <meissner@linux.ibm.com>

* lib/target-supports.exp (check_effective_target_powerpc_pcrel):
New.
(check_effective_target_powerpc_prefixed_addr): New.

4 years agoWhen specifying a non-system prefix with --with-zstd, the build fails because the...
Michael Kuhn [Tue, 9 Jun 2020 20:05:07 +0000 (14:05 -0600)]
When specifying a non-system prefix with --with-zstd, the build fails because the header and library cannot be found (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95005).

The attached patch fixes the problem and is what we use in Spack to
make GCC build with zstd support.

gcc/
* Makefile.in (ZSTD_INC): Define.
(ZSTD_LIB): Include ZSTD_LDFLAGS.
(CFLAGS-lto-compress.o): Add ZSTD_INC.
* configure.ac (ZSTD_CPPFLAGS, ZSTD_LDFLAGS): New variables for
AC_SUBST.
* configure: Rebuilt.

4 years agoasan: fix wrong options for a test-case.
Martin Liska [Tue, 9 Jun 2020 19:54:35 +0000 (21:54 +0200)]
asan: fix wrong options for a test-case.

gcc/testsuite/ChangeLog:

* c-c++-common/asan/inline-kernel.c: Add missing
-fno-sanitize-address option.

4 years agocoroutines: Ensure distinct DTOR trees [PR95137].
Iain Sandoe [Tue, 9 Jun 2020 18:17:14 +0000 (19:17 +0100)]
coroutines: Ensure distinct DTOR trees [PR95137].

Part of the PR notes that there are UBSAN fails for the coroutines
test suite.  These are primarily related to the use of the same DTOR
tree in the two edges from the await block.  Fixed by building a new
tree for each.

gcc/cp/ChangeLog:

PR c++/95137
* coroutines.cc (expand_one_await_expression): Build separate
DTOR trees for the awaitable object on the destroy and resume
paths.

4 years agogcc-changelog: Use non-zero exit status on error
Jonathan Wakely [Tue, 9 Jun 2020 19:39:39 +0000 (20:39 +0100)]
gcc-changelog: Use non-zero exit status on error

Also add comment explaining what the script does.

contrib/ChangeLog:

* gcc-changelog/git_email.py: Set exit status on error.

4 years agotree-inline: Fix VLA handling [PR95552]
Jason Merrill [Fri, 5 Jun 2020 20:36:27 +0000 (16:36 -0400)]
tree-inline: Fix VLA handling [PR95552]

The problem in this testcase comes from cloning the constructor into
complete and base variants.  When we clone the body the first time,
walk_tree_1 calls copy_tree_body_r on the type of the artificial TYPE_DECL
we made for the VLA type without calling it on the decl itself, so we
overwrite the type of the TYPE_DECL without copying the decl first.

This has been broken since we started inserting a TYPE_DECL for anonymous
VLAs in r7-457.

This patch fixes walk_tree_1 to call the function on the TYPE_DECL, as we do
for other decls of a DECL_EXPR.

gcc/ChangeLog:

PR c++/95552
* tree.c (walk_tree_1): Call func on the TYPE_DECL of a DECL_EXPR.

gcc/testsuite/ChangeLog:

PR c++/95552
* g++.dg/ext/vla23.C: New test.

4 years agotsan: Add optional support for distinguishing volatiles
Marco Elver [Tue, 9 Jun 2020 13:15:39 +0000 (15:15 +0200)]
tsan: Add optional support for distinguishing volatiles

Add support to optionally emit different instrumentation for accesses to
volatile variables. While the default TSAN runtime likely will never
require this feature, other runtimes for different environments that
have subtly different memory models or assumptions may require
distinguishing volatiles.

One such environment are OS kernels, where volatile is still used in
various places, and often declare volatile to be appropriate even in
multi-threaded contexts. One such example is the Linux kernel, which
implements various synchronization primitives using volatile
(READ_ONCE(), WRITE_ONCE()).

Here the Kernel Concurrency Sanitizer (KCSAN), is a runtime that uses
TSAN instrumentation but otherwise implements a very different approach
to race detection from TSAN:

https://github.com/google/ktsan/wiki/KCSAN

Due to recent changes in requirements by the Linux kernel, KCSAN
requires that the compiler supports tsan-distinguish-volatile (among
several new requirements):

https://lore.kernel.org/lkml/20200521142047.169334-7-elver@google.com/

gcc/
* params.opt: Define --param=tsan-distinguish-volatile=[0,1].
* sanitizer.def (BUILT_IN_TSAN_VOLATILE_READ1): Define new
builtin for volatile instrumentation of reads/writes.
(BUILT_IN_TSAN_VOLATILE_READ2): Likewise.
(BUILT_IN_TSAN_VOLATILE_READ4): Likewise.
(BUILT_IN_TSAN_VOLATILE_READ8): Likewise.
(BUILT_IN_TSAN_VOLATILE_READ16): Likewise.
(BUILT_IN_TSAN_VOLATILE_WRITE1): Likewise.
(BUILT_IN_TSAN_VOLATILE_WRITE2): Likewise.
(BUILT_IN_TSAN_VOLATILE_WRITE4): Likewise.
(BUILT_IN_TSAN_VOLATILE_WRITE8): Likewise.
(BUILT_IN_TSAN_VOLATILE_WRITE16): Likewise.
* tsan.c (get_memory_access_decl): Argument if access is
volatile. If param tsan-distinguish-volatile is non-zero, and
access if volatile, return volatile instrumentation decl.
(instrument_expr): Check if access is volatile.

gcc/testsuite/
* c-c++-common/tsan/volatile.c: New test.

4 years agoPowerPC: PowerPC tests: Add prefixed/pcrel tests.
Michael Meissner [Tue, 9 Jun 2020 18:48:24 +0000 (14:48 -0400)]
PowerPC: PowerPC tests: Add prefixed/pcrel tests.

testsuite/
2020-06-09  Michael Meissner  <meissner@linux.ibm.com>

* lib/target-supports.exp (check_effective_target_powerpc_pcrel):
New.
(check_effective_target_powerpc_prefixed_addr): New.

4 years agoRemove dead code
Richard Biener [Tue, 9 Jun 2020 16:23:22 +0000 (18:23 +0200)]
Remove dead code

This removes dead code left over from the reduction vectorization
refactoring last year.

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

* tree-vect-loop.c (vectorizable_induction): Remove dead code.

4 years agod: Merge upstream dmd 13d67c575.
Iain Buclaw [Tue, 9 Jun 2020 16:56:52 +0000 (18:56 +0200)]
d: Merge upstream dmd 13d67c575.

Reviewed-on: https://github.com/dlang/dmd/pull/11224

gcc/d/ChangeLog:

* dmd/MERGE: Merge upstream dmd 13d67c575.
* d-builtins.cc (build_frontend_type): Update call to
TypeVector::create.
* d-frontend.cc (Global::_init): Move setting of errorLimit to ...
* d-lang.cc (d_init_options): ... here.  Update for new field
location of errorLimit.
(d_post_options): Likewise.
* d-port.cc (Port::readwordLE): Update signature.
(Port::readwordBE): Likewise.
(Port::readlongLE): Likewise.
(Port::readlongBE): Likewise.
* decl.cc (get_symbol_decl): Update for new field types.

4 years agoc++: Tweak predeclare_vla.
Jason Merrill [Sat, 6 Jun 2020 04:07:21 +0000 (00:07 -0400)]
c++: Tweak predeclare_vla.

We only need to predeclare a VLA type if it's wrapped in a pointer type;
otherwise gimplify_type_sizes will handle it.

gcc/cp/ChangeLog:

PR c++/95552
* cp-gimplify.c (predeclare_vla): Only predeclare a VLA if it's
wrapped in a pointer type.

4 years agoopenmp: ensure variables in offload table are streamed out (PRs 94848 + 95551)
Tobias Burnus [Tue, 9 Jun 2020 14:31:22 +0000 (16:31 +0200)]
openmp: ensure variables in offload table are streamed out (PRs 94848 + 95551)

gcc/ChangeLog:

* omp-offload.c (add_decls_addresses_to_decl_constructor,
omp_finish_file): With in_lto_p, stream out all offload-table
items even if the symtab_node does not exist.

4 years agoRemove dead code
Richard Biener [Tue, 9 Jun 2020 14:00:43 +0000 (16:00 +0200)]
Remove dead code

This removes dead code that was left over from the reduction
vectorization refactoring last year.

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

* tree-vect-stmts.c (vect_transform_stmt): Remove dead code.

4 years agoFix some ChangeLog entries
Patrick Palka [Tue, 9 Jun 2020 13:57:25 +0000 (09:57 -0400)]
Fix some ChangeLog entries

4 years agogcov-dump: fix --help spacing
Martin Liska [Tue, 9 Jun 2020 12:39:26 +0000 (14:39 +0200)]
gcov-dump: fix --help spacing

Pushed to master.

gcc/ChangeLog:

* gcov-dump.c (print_usage): Fix spacing for --raw option
in --help.

4 years agosanitizer: do not inline no-sanitize into sanitizer fn
Martin Liska [Tue, 9 Jun 2020 11:03:55 +0000 (13:03 +0200)]
sanitizer: do not inline no-sanitize into sanitizer fn

gcc/ChangeLog:

* cif-code.def (ATTRIBUTE_MISMATCH): Rename to...
(SANITIZE_ATTRIBUTE_MISMATCH): ...this.
* ipa-inline.c (sanitize_attrs_match_for_inline_p):
Handle all sanitizer options.
(can_inline_edge_p): Use renamed CIF_* enum value.

gcc/testsuite/ChangeLog:

* c-c++-common/asan/inline.c: New test.
* c-c++-common/asan/inline-kernel.c: New test.
* c-c++-common/tsan/inline.c: New test.
* c-c++-common/ubsan/inline.c: New test.

4 years agoAArch64+SVE: Add support for unpacked unary ops and BIC
Joe Ramsay [Tue, 9 Jun 2020 11:23:56 +0000 (12:23 +0100)]
AArch64+SVE: Add support for unpacked unary ops and BIC

MD patterns extended for unary ops ABS, CLS, CLZ, CNT, NEG and NOT
to support unpacked vectors. Also extended patterns for BIC to
support unpacked vectors where input elements are of the same width.

gcc/ChangeLog:

2020-06-09  Joe Ramsay  <joe.ramsay@arm.com>

* config/aarch64/aarch64-sve.md (<optab><mode>2): Add support for
unpacked vectors.
(@aarch64_pred_<optab><mode>): Add support for unpacked vectors.
(@aarch64_bic<mode>): Enable unpacked BIC.
(*bic<mode>3): Enable unpacked BIC.

gcc/testsuite/ChangeLog:

2020-06-09  Joe Ramsay  <joe.ramsay@arm.com>

* gcc.target/aarch64/sve/logical_unpacked_abs.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_bic_1.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_bic_2.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_bic_3.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_bic_4.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_neg.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_not.c: New test.

4 years agogcov: improve --coverage small example
Martin Liska [Tue, 9 Jun 2020 11:14:57 +0000 (13:14 +0200)]
gcov: improve --coverage small example

Pushed to master.

gcc/ChangeLog:

PR gcov-profile/95365
* doc/gcov.texi: Compile and link one example in 2 steps.

4 years agolibgcov: fix TOPN type casting
Martin Liska [Mon, 8 Jun 2020 18:07:08 +0000 (20:07 +0200)]
libgcov: fix TOPN type casting

The patch fixes tree-prof.exp tests on solaris11 and i686-linux-gnu,
problem was that sizeof of a pointer is different from sizeof gcov_type.

I'm going to install it if there are no objections.
Thanks,
Martin

libgcc/ChangeLog:

PR gcov-profile/95494
* libgcov-driver.c (write_top_counters): Cast first to
intptr_t as sizeof(*) != sizeof(gcov_type).
* libgcov.h (gcov_counter_set_if_null): Remove.
(gcov_topn_add_value): Cast first to intptr_t and update
linked list directly.

4 years ago[Ada] Missing check on private overriding of dispatching primitive
Javier Miranda [Sun, 1 Mar 2020 19:04:48 +0000 (14:04 -0500)]
[Ada] Missing check on private overriding of dispatching primitive

2020-06-09  Javier Miranda  <miranda@adacore.com>

gcc/ada/

* sem_ch6.adb (New_Overloaded_Entity): Add missing call to check
subtype conformance of overriding dispatching primitive.
* sem_eval.adb (Subtypes_Statically_Match): Handle derivations
of private subtypes.
* libgnat/g-exptty.adb, libgnat/g-exptty.ads
(Set_Up_Communications): Fix the profile since null-exclusion is
missing in the access type formals.
* sem_disp.ads (Check_Operation_From_Private_View): Adding
documentation.

4 years ago[Ada] Small enhancement in XEinfo utility
Eric Botcazou [Tue, 3 Mar 2020 15:13:20 +0000 (16:13 +0100)]
[Ada] Small enhancement in XEinfo utility

2020-06-09  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* einfo.ads (XEINFO section): Update format description.
(Is_Subprogram_Or_Entry): Move pragma to regular section.
(Is_Subprogram_Or_Generic_Subprogram): Likewise.
* xeinfo.adb (Get_B4): Rename to...
(Get_B0): ...this.
(Translate_Expr): New procedure extracted from...
(XEinfo): ...here.  Try to apply Get_B0 first and then
call Translate_Expr to translate supported constructs.

4 years ago[Ada] Implement AI12-0028: Import of variadic C functions
Eric Botcazou [Tue, 3 Mar 2020 11:44:18 +0000 (12:44 +0100)]
[Ada] Implement AI12-0028: Import of variadic C functions

2020-06-09  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* exp_ch6.adb (Freeze_Subprogram): Deal with convention C_Family.
* freeze.adb (Freeze_Profile): Likewise.  Add missing guard.
* sem_mech.adb (Set_Mechanisms): Likewise.
* lib-xref.adb (Output_Import_Export_Info): Ditto for C_Variadic.
* repinfo.adb (List_Subprogram_Info): Likewise.
* sem_prag.adb (Set_Convention_From_Pragma): Move main checks for
Stdcall to...
(Process_Convention): ...here.  Add checks for C_Variadic.
* snames.ads-tmpl: Add Name_C_Variadic_0 .. Name_C_Variadic_16.
Use consistent format for subtype declarations.
(Convention_Id): Add Convention_C_Variadic_0 .. C_Variadic_16
and move Convention_CPP up.
(Convention_C_Family): New subtype of Convention_Id.
(Convention_C_Variadic): Likewise.
(Foreign_Convention): Use explicit upper bound.
Add pragma Inline for Is_Configuration_Pragma_Name,
Is_Function_Attribute_Name, Is_Internal_Attribute_Name
and Is_Procedure_Attribute_Name.
* snames.adb-tmpl (Get_Convention_Id): Deal with Name_Variadic_n.
(Get_Convention_Name): Deal with Convention_Variadic_n.
* types.h (Convention_Id): New typedef.
* xsnamest.adb (Name2): New variable.
(Is_Conv): New pattern.
(Get_Subt1): Likewise.
(Get_Subt2): Likewise.
Output subtypes of Convention_Id into the C header file.

4 years ago[Ada] Code clean ups and comments updates
Arnaud Charlet [Tue, 3 Mar 2020 16:51:49 +0000 (11:51 -0500)]
[Ada] Code clean ups and comments updates

2020-06-09  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* exp_ch3.adb, exp_ch4.adb, exp_ch6.adb, exp_ch9.adb,
exp_disp.adb, exp_util.adb: Add comments related to errors that
should be moved to semantic analysis. Also replace "?" with "??"
in warning messages.

4 years ago[Ada] Improve handling of null unbounded strings
Arnaud Charlet [Sun, 1 Mar 2020 15:07:11 +0000 (10:07 -0500)]
[Ada] Improve handling of null unbounded strings

2020-06-09  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* libgnat/a-strunb__shared.ads, libgnat/a-strunb__shared.adb
(Reference, Unreference): No-op for Empty_Shared_String.
Remove unneeded calls to Reference.

4 years ago[Ada] Remove kludge for AI05-0087
Arnaud Charlet [Mon, 2 Mar 2020 11:58:01 +0000 (06:58 -0500)]
[Ada] Remove kludge for AI05-0087

2020-06-09  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* exp_ch5.adb (Expand_N_Assignment): Remove kludge for
AI05-0087.
* sem_ch12.adb (Validate_Derived_Type_Instance): Implement
AI05-0087 retroactively since it's a binding interpretation.

4 years ago[Ada] Small cleanup in Einfo unit
Eric Botcazou [Mon, 2 Mar 2020 11:46:14 +0000 (12:46 +0100)]
[Ada] Small cleanup in Einfo unit

2020-06-09  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* einfo.ads (Has_Foreign_Convention): Fix description.
(Component_Alignment): Move around.
(Has_DIC): Likewise.
(Has_Interrupt_Handler): Likewise.
(Has_Invariants): Likewise.
(Is_Atomic_Or_VFA): Likewise.
(Next_Index): Likewise.
(Scope_Depth): Likewise.
(Init_Component_Size): Likewise.
(Init_Component_Location): Likewise.
(Init_Size): Likewise.
(Inline Pragmas for functions): Add Corresponding_Function,
Corresponding_Procedure, Entry_Max_Queue_Lengths_Array,
Finalize_Storage_Only, Has_DIC, Has_Invariants,
Initialization_Statements, Is_Anonymous_Access_Type,
Next_Stored_Discriminant, Address_Clause, Alignment_Clause,
Float_Rep, Has_Foreign_Convention, Has_Non_Limited_View,
Is_Constant_Object, Is_Discriminal, Is_Finalizer, Is_Null_State,
Is_Prival, Is_Protected_Component, Is_Protected_Record_Type,
Is_Subprogram_Or_Entry, Is_Task_Record_Type, Size_Clause,
Stream_Size_Clause, Type_High_Bound, Type_Low_Bound, Known_*,
Unknown_*.
(Inline Pragmas for procedures): Add Set_Corresponding_Function,
Set_Corresponding_Procedure, Set_Finalize_Storage_Only,
Set_Float_Rep, Set_Initialization_Statements,
Init_Normalized_First_Bit, Init_Normalized_Position,
Init_Normalized_Position_Max.
* einfo.adb (Was_Hidden): Move around.
(Is_Packed_Array): Likewise.
(Model_Emin_Value): Likewise.
(Model_Epsilon_Value): Likewise.
(Model_Mantissa_Value): Likewise.
(Model_Small_Value): Likewise.

4 years ago[Ada] Ada2020 AI12-0282: Shared variable control aspects in generics
Ed Schonberg [Fri, 28 Feb 2020 19:26:02 +0000 (14:26 -0500)]
[Ada] Ada2020 AI12-0282: Shared variable control aspects in generics

2020-06-09  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_ch12.adb (Check_Shared_Variable_Control_Aspects): Require
exact match between formal and actual for aspects Atomic and
Volatile only for formal derived types.

4 years ago[Ada] Improve handling of aggregates in Side_Effect_Free
Arnaud Charlet [Mon, 2 Mar 2020 08:58:02 +0000 (03:58 -0500)]
[Ada] Improve handling of aggregates in Side_Effect_Free

2020-06-09  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* exp_util.adb (Side_Effect_Free): Improve handling of
N_Aggregate.

4 years ago[Ada] Fix wrong type being used for range check generation
Ghjuvan Lacambre [Fri, 28 Feb 2020 13:56:31 +0000 (14:56 +0100)]
[Ada] Fix wrong type being used for range check generation

2020-06-09  Ghjuvan Lacambre  <lacambre@adacore.com>

gcc/ada/

* sem_res.adb (Resolve_Qualified_Expression): Use Subtype_Mark
type.

4 years ago[Ada] Expand more others aggregates statically
Arnaud Charlet [Sun, 1 Mar 2020 16:12:11 +0000 (11:12 -0500)]
[Ada] Expand more others aggregates statically

2020-06-09  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* exp_aggr.adb (Max_Aggregate_Size): New function to factorize
code.
(Convert_To_Positional, Aggr_Size_OK): Use Max_Aggregate_Size.

4 years ago[Ada] Code refactoring on calls to Set_Debug_Info_Needed
Arnaud Charlet [Sun, 1 Mar 2020 11:59:11 +0000 (06:59 -0500)]
[Ada] Code refactoring on calls to Set_Debug_Info_Needed

2020-06-09  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* sem_util.ads, sem_util.adb (Set_Debug_Info_Defining_Id): New.
* exp_ch3.adb, exp_ch8.adb: Call Set_Debug_Info_Defining_Id when
relevant.

4 years ago[Ada] Missing documentation for Returns_By_Ref
Justin Squirek [Sun, 1 Mar 2020 09:18:57 +0000 (04:18 -0500)]
[Ada] Missing documentation for Returns_By_Ref

2020-06-09  Justin Squirek  <squirek@adacore.com>

gcc/ada/

* einfo.ads (Returns_By_Ref): Modify documentation to reflect
that Returns_By_Ref can be applied to E_Subprogram_Type
entities.

4 years ago[Ada] Spurious overlap error on zero-sized arrays with -gnateV
Justin Squirek [Fri, 28 Feb 2020 21:21:59 +0000 (16:21 -0500)]
[Ada] Spurious overlap error on zero-sized arrays with -gnateV

2020-06-09  Justin Squirek  <squirek@adacore.com>

gcc/ada/

* exp_attr.adb (Expand_N_Attribute_Reference): Modify expansion
of 'Overlaps_Storage to take into account zero sized arrays.

4 years ago[Ada] Write_Invocation_Graph_Vertex: include lib item name
Bob Duff [Fri, 28 Feb 2020 18:50:49 +0000 (13:50 -0500)]
[Ada] Write_Invocation_Graph_Vertex: include lib item name

2020-06-09  Bob Duff  <duff@adacore.com>

gcc/ada/

* bindo-graphs.adb, bindo-graphs.ads: For each invocation graph,
record the corresponding library graph.
* bindo-writers.adb (Write_Invocation_Graph_Vertex): Print the
lib item name. Remove library graph parameters.
* bindo-augmentors.adb, bindo-augmentors.ads,
bindo-builders.adb, bindo-diagnostics.adb,
bindo-diagnostics.ads, bindo-elaborators.adb: Remove library
graph parameters.

4 years ago[Ada] Propagate DIC, Invariant and Predicate attributes to views
Eric Botcazou [Fri, 28 Feb 2020 11:46:58 +0000 (12:46 +0100)]
[Ada] Propagate DIC, Invariant and Predicate attributes to views

2020-06-09  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* checks.adb (Apply_Predicate_Check): Extend trick used for
aggregates to qualified aggregates and object declarations
* einfo.ads (Has_Own_DIC): Mention the underlying full view.
(Has_Own_Invariants): Likewise.
(Has_Predicates): Likewise.
* exp_util.adb (Build_DIC_Procedure_Declaration): Do not deal
with base types explicitly but with underlying full views.
(Build_Invariant_Procedure_Declaration): Likewise.
* sem_ch13.adb (Build_Predicate_Functions): Do not deal with
the full view manually but call Propagate_Predicate_Attributes
to propagate attributes to views.
(Build_Predicate_Function_Declaration): Likewise.
* sem_ch3.adb (Build_Assertion_Bodies_For_Type): Build bodies
for private full views with an underlying full view.
(Build_Derived_Private_Type): Small comment tweak.
(Complete_Private_Subtype): Call Propagate_Predicate_Attributes.
(Process_Full_View): Do not deal with base types explicitly for
DIC and Invariant attributes.  Deal with underlying full views
for them.  Call Propagate_Predicate_Attributes and deal with
underlying full views for them.
* sem_ch7.adb (Preserve_Full_Attributes): Do not cross propagate
DIC and Invariant attributes between full type and its base type.
Propagate Predicate attributes from the full to the private view.
* sem_ch9.adb (Analyze_Protected_Type_Declaration): Likewise.
(Analyze_Task_Type_Declaration): Likewise.
* sem_util.ads (Get_Views): Remove Full_Base parameter and add
UFull_Typ parameter.
(Propagate_Predicate_Attributes): New procedure.
* sem_util.adb (Get_Views): Remove Full_Base parameter and add
UFull_Typ parameter.  Retrieve the Corresponding_Record_Type
from the underlying full view, if any.
(Propagate_DIC_Attributes): Remove useless tests.
(Propagate_Invariant_Attributes): Likewise.
(Propagate_Predicate_Attributes): New procedure.

4 years ago[Ada] Crash on exit statement within predicated loop
Justin Squirek [Fri, 28 Feb 2020 15:21:38 +0000 (10:21 -0500)]
[Ada] Crash on exit statement within predicated loop

2020-06-09  Justin Squirek  <squirek@adacore.com>

gcc/ada/

* exp_ch5.adb (Expand_Predicated_Loop): Perserve the original
loop identifier within the expansion.

4 years ago[Ada] gnatbind: Correct assertions in Add_Edge_Kind_Check
Bob Duff [Fri, 28 Feb 2020 14:46:07 +0000 (09:46 -0500)]
[Ada] gnatbind: Correct assertions in Add_Edge_Kind_Check

2020-06-09  Bob Duff  <duff@adacore.com>

gcc/ada/

* bindo-graphs.ads (Library_Graph_Edge_Kind): Reorder enumerals
to reflect the order of adding edges. Clarify comments.
* bindo-graphs.adb (Add_Edge_Kind_Check): Correct the
assertions.  Reorder the "when"s to match the order of adding
edges, and therefore the order of enumerals in type
Library_Graph_Edge_Kind.  Change names to "Old_" and "New_" to
clarify what's what.  Combine Invocation_Edge into the "<="
test.  Fix the "raise Program_Error" message, which was
backwards.

4 years ago[Ada] Add debugging message
Bob Duff [Thu, 27 Feb 2020 15:49:47 +0000 (10:49 -0500)]
[Ada] Add debugging message

2020-06-09  Bob Duff  <duff@adacore.com>

gcc/ada/

* bindo-graphs.adb (Add_Edge_Kind_Check): Add the Image of the
old and new Kinds to the raise Program_Error message.

4 years ago[Ada] Remove bypass for instance bodies from Is_Visible_Component
Eric Botcazou [Thu, 27 Feb 2020 16:02:14 +0000 (17:02 +0100)]
[Ada] Remove bypass for instance bodies from Is_Visible_Component

2020-06-09  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* sem_ch3.adb (Is_Visible_Component): Do not special-case
bodies of instances.

4 years ago[Ada] Membership test against a non-excluding subtype
Arnaud Charlet [Thu, 27 Feb 2020 09:28:04 +0000 (04:28 -0500)]
[Ada] Membership test against a non-excluding subtype

2020-06-09  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* exp_ch4.adb (Expand_N_In): Fix handling of null exclusion.

4 years ago[Ada] Ada2020 AI12-0282: Shared variable control aspects in generics
Ed Schonberg [Tue, 25 Feb 2020 21:58:06 +0000 (16:58 -0500)]
[Ada] Ada2020 AI12-0282: Shared variable control aspects in generics

2020-06-09  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_ch12.adb (Check_Shared_Variable_Control_Aspects): Require
exact match between formal and actual for aspects Atomic,
Atomic_Component, Volatile, and Volatile_Components.

4 years ago[Ada] gnatpp: documentation for --no-separate-return switch
Bob Duff [Wed, 26 Feb 2020 14:51:56 +0000 (09:51 -0500)]
[Ada] gnatpp: documentation for --no-separate-return switch

2020-06-09  Bob Duff  <duff@adacore.com>

gcc/ada/

* doc/gnat_ugn/gnat_utility_programs.rst: Add documentation for
the --no-separate-return switch of gnatpp.

4 years ago[Ada] Add missing tag with -gnatw.d
Arnaud Charlet [Wed, 26 Feb 2020 10:01:53 +0000 (05:01 -0500)]
[Ada] Add missing tag with -gnatw.d

2020-06-09  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* sem_warn.adb (Warn_On_Constant_Valid_Condition): Add proper
warning tag.

4 years ago[Ada] Refine implementation of AI05-0149 missing conversion checks
Arnaud Charlet [Fri, 21 Feb 2020 16:36:40 +0000 (11:36 -0500)]
[Ada] Refine implementation of AI05-0149 missing conversion checks

2020-06-09  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* sem_type.adb (Covers): Fix implementation of AI05-0149.
* sem_res.adb: Fix typo.

4 years ago[Ada] Spurious error on instantiations with Taft_Amendment types and tasks
Ed Schonberg [Mon, 24 Feb 2020 18:37:58 +0000 (13:37 -0500)]
[Ada] Spurious error on instantiations with Taft_Amendment types and tasks

2020-06-09  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* exp_ch9.adb (Build_Master_Renaming): Make name in renaming
declaration unique by adding a numeric suffix, to prevent
accidental name conflict when several instantiations of a
package containing an access_to_incomplete type that designate
tasks appear in the same scope.

4 years ago[Ada] Annotate Ada.Synchronous_Barriers with SPARK_Mode => Off
Piotr Trojanek [Tue, 25 Feb 2020 12:58:04 +0000 (13:58 +0100)]
[Ada] Annotate Ada.Synchronous_Barriers with SPARK_Mode => Off

2020-06-09  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* libgnarl/a-synbar.ads, libgnarl/a-synbar.adb,
libgnarl/a-synbar__posix.ads, libgnarl/a-synbar__posix.adb
(Ada.Synchronous_Barriers): Annotate with SPARK_Mode => Off.

4 years ago[Ada] AI1-0201 Relational operators of static string types are now static
Arnaud Charlet [Mon, 24 Feb 2020 20:35:12 +0000 (15:35 -0500)]
[Ada] AI1-0201 Relational operators of static string types are now static

2020-06-09  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* sem_eval.adb (Eval_Relational_Op, Eval_String_Literal,
Eval_Type_Conversion): Relax rules on relational operators and
type conversions of static string types.

4 years ago[Ada] Ada2020: AI12-0301 Predicates and Default_Value
Arnaud Charlet [Sun, 23 Feb 2020 18:50:18 +0000 (13:50 -0500)]
[Ada] Ada2020: AI12-0301 Predicates and Default_Value

2020-06-09  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* sem_util.ads, sem_util.adb (Is_Partially_Initialized_Type):
Take Default_Value and Default_Component_Value into account.
* sem_ch3.adb (Analyze_Object_Declaration): Update comment.

4 years ago[Ada] Disable assertion regarding Body_Before_Spec_Edge
Bob Duff [Tue, 25 Feb 2020 00:22:56 +0000 (19:22 -0500)]
[Ada] Disable assertion regarding Body_Before_Spec_Edge

2020-06-09  Bob Duff  <duff@adacore.com>

gcc/ada/

* bindo-graphs.adb (Add_Edge_Kind_Check): Disable failing part
of the assertion.

4 years agolibsanitizer: use gnu++14
Martin Liska [Mon, 8 Jun 2020 14:04:31 +0000 (16:04 +0200)]
libsanitizer: use gnu++14

libsanitizer/ChangeLog:

* asan/Makefile.am: Replace gnu++11 with gnu++14.
* interception/Makefile.am: Likewise.
* libbacktrace/Makefile.am: Likewise.
* lsan/Makefile.am: Likewise.
* sanitizer_common/Makefile.am: Likewise.
* tsan/Makefile.am: Likewise.
* ubsan/Makefile.am: Likewise.
* asan/Makefile.in: Regenerate.
* interception/Makefile.in: Likewise.
* libbacktrace/Makefile.in: Likewise.
* lsan/Makefile.in: Likewise.
* sanitizer_common/Makefile.in: Likewise.
* tsan/Makefile.in: Likewise.
* ubsan/Makefile.in: Likewise.

4 years agogcc-changelog: fix deduction for root ChangeLog
Martin Liska [Tue, 9 Jun 2020 08:01:05 +0000 (10:01 +0200)]
gcc-changelog: fix deduction for root ChangeLog

contrib/ChangeLog:

* gcc-changelog/git_commit.py: Fix ChangeLog regex in order to
match the top-level ChangeLog.
* gcc-changelog/test_email.py: Add test.
* gcc-changelog/test_patches.txt: Likewise.

4 years agoc-family: Fix up MEM_REF printing [PR95580]
Jakub Jelinek [Tue, 9 Jun 2020 06:39:36 +0000 (08:39 +0200)]
c-family: Fix up MEM_REF printing [PR95580]

The C FE in the MEM_REF printing ICEs if the type of the first argument
(which due to useless pointer conversions can be an arbitrary type) is a
pointer to an incomplete type.  The code just wants to avoid printing a cast
if it is a pointer to single byte elements.

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

PR c/95580
* c-pretty-print.c (c_pretty_printer::unary_expression): Handle the
case when MEM_REF's first argument has type pointer to incomplete type.

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

4 years agomatch.pd: Optimize ffs comparisons against constants [PR95527]
Jakub Jelinek [Tue, 9 Jun 2020 06:38:19 +0000 (08:38 +0200)]
match.pd: Optimize ffs comparisons against constants [PR95527]

The following patch implements various optimizations of __builtin_ffs*
against constants.

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

PR tree-optimization/95527
* match.pd (__builtin_ffs (X) cmp CST): New optimizations.

* gcc.dg/tree-ssa/pr95527.c: New test.