gcc.git
4 years agoTestsuite: Mark check_effective_target_exceptions_enabled test as C++ test input.
Tamar Christina [Thu, 11 Jun 2020 17:19:44 +0000 (18:19 +0100)]
Testsuite: Mark check_effective_target_exceptions_enabled test as C++ test input.

The test in check_effective_target_exceptions_enabled uses a C++ keyword `throw`
and the test fails with a syntax error on any non-g++ test.  I now tell the
testsuite driver that this is a C++ input file so it runs it as such in all the
drivers.

gcc/testsuite/ChangeLog:

* lib/target-supports.exp (check_effective_target_exceptions_enabled):
Mark as C++ test input.

4 years agoPR fortran/95503 - Fix ICE in gfc_is_simply_contiguous, at fortran/expr.c:5844
Harald Anlauf [Thu, 11 Jun 2020 13:48:56 +0000 (15:48 +0200)]
PR fortran/95503 - Fix ICE in gfc_is_simply_contiguous, at fortran/expr.c:5844

The check for assigning a pointer that cannot be determined to be simply
contiguous at compile time to a contiguous pointer does not need to be
invoked if the lhs of the assignment is known to have conflicting attributes.

2020-06-11  Harald Anlauf  <anlauf@gmx.de>

gcc/fortran/
PR fortran/95503
* expr.c (gfc_check_pointer_assign): Skip contiguity check of rhs
of pointer assignment if lhs cannot be simply contiguous.

gcc/testsuite/
PR fortran/95503
* gfortran.dg/pr95503.f90: New test.

4 years agoPR95331 - Unlimited polymorphic arrays have wrong bounds.
José Rui Faustino de Sousa [Thu, 11 Jun 2020 13:15:25 +0000 (15:15 +0200)]
PR95331 - Unlimited polymorphic arrays have wrong bounds.

When iterating over a class array use the bounds provided by the
transformed descriptor (in sym->backend_decl) instead of the original
bounds of the array (in the descriptor passed in the class _data)
which are passed in se->expr.

The patch partially depends on the patch for PR52351 and PR85868, but
does not seems to break anything by itself.

gcc/fortran/ChangeLog:

2020-06-11  José Rui Faustino de Sousa  <jrfsousa@gmail.com>

PR fortran/95331
* trans-array.c (gfc_conv_array_ref): For class array dummy
arguments use the transformed descriptor in sym->backend_decl
instead of the original descriptor.

gcc/testsuite/ChangeLog:

2020-06-11  José Rui Faustino de Sousa  <jrfsousa@gmail.com>

PR fortran/95331
* gfortran.dg/PR95331.f90: New test.

4 years agoaix: xfail pure-virtual1.C expects weak __cxa_pure_virtual
David Edelsohn [Sat, 16 May 2020 15:40:21 +0000 (11:40 -0400)]
aix: xfail pure-virtual1.C expects weak __cxa_pure_virtual

The testcase expects __cxa_pure_virtual to be weak to avoid an
implicit dependency.  This does not occur on AIX, so expect this testcase
to fail on AIX.

gcc/testsuite/ChangeLog

2020-06-11  David Edelsohn  <dje.gcc@gmail.com>

* g++.dg/abi/pure-virtual1.C: XFAIL AIX.

4 years agoFix formatting in rs6000.c.
Martin Liska [Thu, 11 Jun 2020 12:59:47 +0000 (14:59 +0200)]
Fix formatting in rs6000.c.

gcc/ChangeLog:

* config/rs6000/rs6000.c (rs6000_density_test): Fix GNU coding
style.

4 years agoaix: Don't implicitly include inttypes.h
David Edelsohn [Wed, 10 Jun 2020 12:14:39 +0000 (08:14 -0400)]
aix: Don't implicitly include inttypes.h

AIX stdio.h implicitly includes inttypes.h, which explicitly conflicts
with the purpose of this testcase.  This patch conditionally adds a macro
definition that inhibits the implicit inclusion.

gcc/testsuite/ChangeLog

2020-06-11  David Edelsohn  <dje.gcc@gmail.com>

* gcc.dg/spellcheck-inttypes.c: Don't include inttypes.h on AIX.

4 years agors6000: skip debug info statements
Martin Liska [Thu, 11 Jun 2020 09:24:20 +0000 (11:24 +0200)]
rs6000: skip debug info statements

gcc/ChangeLog:

PR target/95627
* config/rs6000/rs6000.c (rs6000_density_test): Skip debug
statements.

4 years agoWrong array section bounds when passing to an intent-in pointer dummy.
José Rui Faustino de Sousa [Thu, 11 Jun 2020 12:14:30 +0000 (14:14 +0200)]
Wrong array section bounds when passing to an intent-in pointer dummy.

Add code to allow for the creation a new descriptor for array
sections with the correct one based indexing.

Rework the generated descriptors indexing (hopefully) fixing the
wrong offsets generated.

gcc/fortran/ChangeLog:

2020-06-11  José Rui Faustino de Sousa  <jrfsousa@gmail.com>

PR fortran/52351
PR fortran/85868
* trans-array.c (gfc_conv_expr_descriptor): Enable the
creation of a new descriptor with the correct one based
indexing for array sections.  Rework array descriptor
indexing offset calculation.

gcc/testsuite/ChangeLog:

2020-06-11  José Rui Faustino de Sousa  <jrfsousa@gmail.com>

PR fortran/52351
PR fortran/85868
* gfortran.dg/coarray_lib_comm_1.f90: Adjust match test for
the newly generated descriptor.
* gfortran.dg/PR85868A.f90: New test.
* gfortran.dg/PR85868B.f90: New test.

4 years agogit_update_version: add --current argument.
Martin Liska [Thu, 11 Jun 2020 11:34:53 +0000 (13:34 +0200)]
git_update_version: add --current argument.

The argument can be useful to update arbitrary branch, the changes
are added to git index and user is supposed to make a commit.

contrib/ChangeLog:

* gcc-changelog/git_update_version.py: Add --curent argument.

4 years agoPatch to Bug 94022 - Array slices of assumed-size arrays.
José Rui Faustino de Sousa [Thu, 11 Jun 2020 11:24:55 +0000 (13:24 +0200)]
Patch to Bug 94022 - Array slices of assumed-size arrays.

Make sure that when passing array sections of assumed-size arrays to
procedures expecting an assumed-rank array the upper bound of the
last dimension of the array section does not get improperly reset
to -1 to mark it has an assumed size array.

gcc/fortran/ChangeLog:

2020-06-11  José Rui Faustino de Sousa  <jrfsousa@gmail.com>

PR fortran/94022
* trans-expr.c (gfc_conv_procedure_call): In the case of
assumed-size arrays ensure that the reference is to a full array.

gcc/testsuite/ChangeLog:

2020-06-11  José Rui Faustino de Sousa  <jrfsousa@gmail.com>

PR fortran/94022
* gfortran.dg/PR94022.f90: New test.

4 years ago[Ada] Fix missing insertion of explicit dereference in instance
Eric Botcazou [Thu, 19 Mar 2020 13:50:32 +0000 (14:50 +0100)]
[Ada] Fix missing insertion of explicit dereference in instance

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

gcc/ada/

* sem_res.adb (Resolve_Implicit_Dereference): In an instance,
reset the type of the prefix if it is private before building
the dereference.

4 years ago[Ada] Fix assertion failure on entry call through unchecked conversion
Eric Botcazou [Thu, 19 Mar 2020 10:41:37 +0000 (11:41 +0100)]
[Ada] Fix assertion failure on entry call through unchecked conversion

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

gcc/ada/

* exp_util.adb (Safe_Unchecked_Type_Conversion): Add missing
Is_Type guard before calling Has_Discriminants on Etype.

4 years ago[Ada] Make libgnat/a-nbnbin__gmp.adb compile
Bob Duff [Wed, 18 Mar 2020 19:26:53 +0000 (15:26 -0400)]
[Ada] Make libgnat/a-nbnbin__gmp.adb compile

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

gcc/ada/

* libgnat/a-nbnbin__gmp.adb: There's no Optional_Big_Integer
anymore.  Invalid_Big_Integer is not used.
Greatest_Common_Divisor returns Big_Positive.

4 years ago[Ada] Refine type of a routine parameter from Node_Id to Entity_Id
Piotr Trojanek [Wed, 18 Mar 2020 23:08:36 +0000 (00:08 +0100)]
[Ada] Refine type of a routine parameter from Node_Id to Entity_Id

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

gcc/ada/

* sem_aggr.adb (Get_Value): Refine type of the Compon parameter.

4 years ago[Ada] Refine type of a counter-like variable
Piotr Trojanek [Wed, 18 Mar 2020 23:04:43 +0000 (00:04 +0100)]
[Ada] Refine type of a counter-like variable

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

gcc/ada/

* sem_aggr.adb (Resolve_Record_Aggregate): Refine type of
Others_Box.

4 years ago[Ada] Iterate with procedural version of Next routine where possible
Piotr Trojanek [Wed, 18 Mar 2020 22:57:10 +0000 (23:57 +0100)]
[Ada] Iterate with procedural version of Next routine where possible

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

gcc/ada/

* checks.adb, exp_ch7.adb, exp_ch9.adb, exp_smem.adb, lib.adb,
nlists.adb, sem.adb, sem_aggr.adb, sem_ch3.adb, sem_ch6.adb,
sem_ch8.adb, sem_dim.adb, sem_res.adb, sem_util.adb,
sem_warn.adb: Replace uses of Next function with procedure.

4 years ago[Ada] Fix wrong access to large bit-packed arrays with reverse SSO
Eric Botcazou [Tue, 17 Mar 2020 20:26:43 +0000 (21:26 +0100)]
[Ada] Fix wrong access to large bit-packed arrays with reverse SSO

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

gcc/ada/

* exp_pakd.ads: Add paragraph about scalar storage order.
* exp_pakd.adb (Install_PAT): Do not set the scalar storage
order of the PAT here but...
(Set_PB_Type): ...here instead and...
(Create_Packed_Array_Impl_Type): ...here as well.
* rtsfind.ads (RE_Id): Add RE_Rev_Packed_Bytes{1,2,4}.
(RE_Unit_Table): Likewise.
* libgnat/s-unstyp.ads (Rev_Packed_Bytes1): New derived type.
(Rev_Packed_Bytes2): Likewise.
(Rev_Packed_Bytes4): Likewise.

4 years ago[Ada] Update SPARK RM rule numbers after removing a redundant rule
Piotr Trojanek [Tue, 17 Mar 2020 20:10:18 +0000 (21:10 +0100)]
[Ada] Update SPARK RM rule numbers after removing a redundant rule

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

gcc/ada/

* sem_ch4.adb, sem_ch6.adb, sem_res.adb, sem_util.ads: Fix
references to SPARK RM 7.1.3 rule numbers.

4 years ago[Ada] Additional warnings on overlapping actuals of composite types
Ed Schonberg [Mon, 16 Mar 2020 15:25:14 +0000 (11:25 -0400)]
[Ada] Additional warnings on overlapping actuals of composite types

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

gcc/ada/

* sem_warn.adb (Warn_On_Overlapping_Actuals): Simplify code,
remove inner predicate Is_Covered_Formal, preserve warning for
two overlapping composite types when only one is writable, and
for two overlapping and writable elementary types.

4 years ago[Ada] Allow specifying volatility refinement aspects for types
Steve Baird [Fri, 31 Jan 2020 19:36:51 +0000 (11:36 -0800)]
[Ada] Allow specifying volatility refinement aspects for types

2020-06-11  Steve Baird  <baird@adacore.com>

gcc/ada/

* contracts.adb (Add_Contract_Item): Support specifying
volatility refinement aspects for types.
(Analyze_Contracts): Add call to Analyze_Type_Contract in the
case of a contract for a type.
(Freeze_Contracts): Add call to Analyze_Type_Contract in the
case of a contract for a type.
(Check_Type_Or_Object_External_Properties): A new procedure
which performs the work that needs to be done for both object
declarations and types.
(Analyze_Object_Contract): Add a call to
Check_Type_Or_Object_External_Properties and remove the code in
this procedure which did much of the work that is now performed
by that call.
(Analyze_Type_Contract): Implement this new routine as nothing
more than a call to Check_Type_Or_Object_External_Properties.
* contracts.ads: Update comment for Add_Contract_To_Item because
types can have contracts.  Follow (questionable) precedent and
declare new routine Analyze_Type_Contract as visible (following
example of Analyze_Object_Contract), despite the fact that it is
never called from outside of the package where it is declared.
* einfo.adb (Contract, Set_Contract): Id argument can be a type;
support this case.
(Write_Field34_Name): Field name is "contract" for a type.
* einfo.ads: Update comment describing Contract attribute.
* sem_ch3.adb (Build_Derived_Numeric_Type): Is_Volatile should
return same answer for all subtypes of a given type. Thus, when
building the base type for something like type Volatile_1_To_10
is range 1 .. 10 with Volatile; that basetype should be marked
as being volatile.
(Access_Type_Declaration): Add SPARK-specific legality check
that the designated type of an access type shall be compatible
with respect to volatility with the access type.
* sem_ch12.adb (Check_Shared_Variable_Control_Aspects): Add
SPARK-specific legality check that an actual type parameter in
an instantiation shall be compatible with respect to volatility
with the corresponding formal type.
* sem_ch13.adb (Analyze_Aspect_Specifications): Perform checks
for aspect specs for the 4 volatility refinement aspects that
were already being performed for all language-defined aspects.
* sem_prag.adb (Analyze_External_Property_In_Decl_Part,
Analyze_Pragma): External properties (other than No_Caching) may
be specified for a type, including a generic formal type.
* sem_util.ads: Declare new subprograms - Async_Readers_Enabled,
Async_Writers_Enabled, Effective_Reads, Effective_Writes, and
Check_Volatility_Compatibility.
* sem_util.adb (Async_Readers_Enabled, Async_Writers_Enabled,
Effective_Reads, Effective_Writes): Initial implementation of
new functions for querying aspect values.
(Check_Volatility_Compatibility): New procedure intended for use
in checking all SPARK legality rules of the form "<> shall be
compatible with respect to volatility with <>".
(Has_Enabled_Property): Update comment because Item_Id can be a
type.  Change name of nested Variable_Has_Enabled_Property
function to Type_Or_Variable_Has_Enabled_Property; add a
parameter to that function because recursion may be needed,
e.g., in the case of a derived typ).  Cope with the case where
the argument to Has_Enabled_Property is a type.

4 years ago[Ada] Avoid "others => <>" association in resolved record aggregates
Piotr Trojanek [Tue, 17 Mar 2020 15:58:24 +0000 (16:58 +0100)]
[Ada] Avoid "others => <>" association in resolved record aggregates

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

gcc/ada/

* sem_aggr.adb (Add_Association): Add assertion about the formal
parameters.
(Propagate_Discriminants): Always add an explicit component
association, so that an "others => <>" association is never
needed.

4 years ago[Ada] Put_Image attribute
Bob Duff [Mon, 16 Mar 2020 19:22:25 +0000 (15:22 -0400)]
[Ada] Put_Image attribute

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

gcc/ada/

* exp_put_image.adb (Build_Elementary_Put_Image_Call): If the
underlying type is real, call Put_Image_Unknown.
(Build_Unknown_Put_Image_Call): Pass the type name to
Put_Image_Unknown.
* libgnat/s-putima.ads, libgnat/s-putima.adb
(Put_Image_Unknown): Add Type_Name parameter.  Remove
overly-detailed documentation of what it does; better to leave
it open.

4 years ago[Ada] Skip unnecessary iterations over constraint expressions
Piotr Trojanek [Fri, 13 Mar 2020 20:07:56 +0000 (21:07 +0100)]
[Ada] Skip unnecessary iterations over constraint expressions

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

gcc/ada/

* sem_ch3.adb (Build_Constrained_Array_Type,
Build_Constrained_Discriminated_Type): Skip unnecessary loop
iterations.

4 years ago[Ada] Move duplicated routines for building itypes to Sem_Util
Piotr Trojanek [Tue, 17 Mar 2020 13:16:28 +0000 (14:16 +0100)]
[Ada] Move duplicated routines for building itypes to Sem_Util

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

gcc/ada/

* sem_aggr.adb (Build_Constrained_Itype): Move to Sem_Util.
* sem_ch3.adb (Build_Subtype, Inherit_Predicate_Flags): Move...
* sem_util.adb (Build_Subtype): Here.  Add parameters for
references to objects previously declared in enclosing scopes.
(Inherit_Predicate_Flags): And here, because it is called by
Build_Subtype.
* sem_util.ads (Build_Overriding_Spec): Reorder alphabetically.
(Build_Subtype): Moved from Sem_Ch3; comments updated.
(Build_Constrained_Itype): Moved from Sem_Aggr; comments
updated.

4 years ago[Ada] Refine type for sorting case-choices tables
Piotr Trojanek [Tue, 17 Mar 2020 11:37:08 +0000 (12:37 +0100)]
[Ada] Refine type for sorting case-choices tables

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

gcc/ada/

* sem_aggr.adb (Case_Table_Type): Change index type from Nat to
Pos.

4 years ago[Ada] Create constrained itypes for nested record aggregates
Piotr Trojanek [Sat, 7 Mar 2020 21:59:24 +0000 (22:59 +0100)]
[Ada] Create constrained itypes for nested record aggregates

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

gcc/ada/

* sem_aggr.adb (Build_Constrained_Itype): Previously a declare
block, now a separate procedure; the only change is that now
New_Assoc_List might include components and an others clause,
which we ignore (while we deal with discriminants exactly as we
did before); extend a ??? comment about how this routine is
different from the Build_Subtype
(Resolve_Record_Aggregate): Create a constrained itype not just
for the outermost record aggregate, but for its inner record
aggregates as well.

4 years ago[Ada] Consolidate handling of implicit dereferences into semantic analysis
Eric Botcazou [Mon, 16 Mar 2020 18:28:47 +0000 (19:28 +0100)]
[Ada] Consolidate handling of implicit dereferences into semantic analysis

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

gcc/ada/

* checks.adb (Build_Discriminant_Checks): Build an explicit
dereference when the type is an access type.
* exp_atag.adb (Build_CW_Membership): Add explicit dereferences.
(Build_Get_Access_Level): Likewise.
(Build_Get_Alignment): Likewise.
(Build_Inherit_Prims): Likewise.
(Build_Get_Transportable): Likewise.
(Build_Set_Size_Function): Likewise.
* exp_ch3.adb (Build_Offset_To_Top_Function): Likewise.
* exp_ch4.adb (Expand_Allocator_Expression): Likewise.
(Expand_N_Indexed_Component ): Remove code dealing with implicit
dereferences.
(Expand_N_Selected_Component): Likewise.
(Expand_N_Slice): Likewise.
* exp_ch9.adb (Add_Formal_Renamings): Add explicit dereference.
(Expand_Accept_Declarations): Likewise.
(Build_Simple_Entry_Call): Remove code dealing with implicit
dereferences.
(Expand_N_Requeue_Statement): Likewise.
* exp_disp.adb (Expand_Dispatching_Call): Build an explicit
dereference when the controlling type is an access type.
* exp_spark.adb (Expand_SPARK_N_Selected_Component): Delete.
(Expand_SPARK_N_Slice_Or_Indexed_Component): Likewise.
(Expand_SPARK): Do not call them.
* sem_ch4.adb (Process_Implicit_Dereference_Prefix): Delete.
(Process_Indexed_Component): Call Implicitly_Designated_Type
to get the designated type for an implicit dereference.
(Analyze_Overloaded_Selected_Component): Do not insert an
explicit dereference here.
(Analyze_Selected_Component): Likewise.
(Analyze_Slice): Call Implicitly_Designated_Type to get the
designated type for an implicit dereference.
* sem_ch8.adb (Has_Components): New predicate extracted from...
(Is_Appropriate_For_Record): ...this.  Delete.
(Is_Appropriate_For_Entry_Prefix): Likewise.
(Analyze_Renamed_Entry): Deal with implicit dereferences.
(Find_Selected_Component): Do not insert an explicit dereference
here.  Call Implicitly_Designated_Type to get the designated type
for an implicit dereference.  Call Has_Components, Is_Task_Type
and Is_Protected_Type directly.  Adjust test for error.
* sem_res.adb (Resolve_Implicit_Dereference): New procedure.
(Resolve_Call): Call Resolve_Indexed_Component last.
(Resolve_Entry): Call Resolve_Implicit_Dereference on the prefix.
(Resolve_Indexed_Component): Call Implicitly_Designated_Type to
get the designated type for an implicit dereference and
Resolve_Implicit_Dereference on the prefix at the end.
(Resolve_Selected_Component): Likewise.
(Resolve_Slice): Likewise.  Do not apply access checks here.
* sem_util.ads (Implicitly_Designated_Type): Declare.
* sem_util.adb (Copy_And_Maybe_Dereference): Simplify.
(Implicitly_Designated_Type): New function.
(Object_Access_Level): Fix typo.
* sem_warn.adb (Check_Unset_Reference): Test Comes_From_Source
on the original node.

4 years ago[Ada] Remove a dubious optimization for Object Specific Data dispatching
Piotr Trojanek [Mon, 16 Mar 2020 20:29:27 +0000 (21:29 +0100)]
[Ada] Remove a dubious optimization for Object Specific Data dispatching

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

gcc/ada/

* exp_disp.adb: Minor reformatting.
* exp_aggr.adb (Is_Static_Dispatch_Table_Aggregate): Recognize
aggregates of the Ada.Tags.Object_Specific_Data type as static.
* sem_aggr.adb (Check_Static_Discriminated_Subtype): Deconstruct
and do not call it from Build_Constrained_Itype.

4 years ago[Ada] Make Object Specific Dispatch tables constant
Piotr Trojanek [Mon, 16 Mar 2020 21:54:13 +0000 (22:54 +0100)]
[Ada] Make Object Specific Dispatch tables constant

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

gcc/ada/

* exp_disp.adb (Make_Secondary_DT): Internally generated OSD
tables are now constant.

4 years ago[Ada] Remove useless code in Backend_Processing_Possible
Piotr Trojanek [Sat, 14 Mar 2020 21:56:16 +0000 (22:56 +0100)]
[Ada] Remove useless code in Backend_Processing_Possible

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

gcc/ada/

* exp_aggr.adb (Backend_Processing_Possible): Remove useless
call.

4 years ago[Ada] Fix punctuation in comment of Building_Static_Dispatch_Tables
Piotr Trojanek [Sat, 14 Mar 2020 21:48:40 +0000 (22:48 +0100)]
[Ada] Fix punctuation in comment of Building_Static_Dispatch_Tables

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

gcc/ada/

* opt.ads (Building_Static_Dispatch_Tables): Fix punctuation in
comment.

4 years ago[Ada] AI12-0356 Root_Storage_Pool_With_Subpools & Preelaborable_Init
Arnaud Charlet [Sun, 15 Mar 2020 10:23:26 +0000 (06:23 -0400)]
[Ada] AI12-0356 Root_Storage_Pool_With_Subpools & Preelaborable_Init

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

gcc/ada/

* libgnat/s-stposu.ads (Root_Storage_Pool_With_Subpools,
Root_Subpool): Mark with Preelaborable_Initialization.

4 years ago[Ada] Crash on dispatching conditional entry call
Javier Miranda [Wed, 4 Mar 2020 19:22:44 +0000 (14:22 -0500)]
[Ada] Crash on dispatching conditional entry call

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

gcc/ada/

* exp_ch9.adb (Expand_N_Conditional_Entry_Call): Replace call to
New_Copy_List by calls to the new routine
New_Copy_Separate_List.
* sem_util.ads (New_Copy_Separate_List, New_Copy_Separate_Tree):
New routines.

* sem_util.adb (New_Copy_Separate_List, New_Copy_Separate_Tree):
New routines.
(New_Copy_Tree): Extend the machinery that detects syntactic
nodes to handle lists of indentifiers with field More_Ids;
otherwise such nodes are erroneously handled as semantic nodes.
Copy aspect specifications attached to nodes.
* sem_ch12.adb (Copy_Generic_Node): Protect reading attribute
Etype.

4 years ago[Ada] Fix unnesting crash with Predicate_Failure/no pred
Bob Duff [Sat, 14 Mar 2020 18:32:31 +0000 (14:32 -0400)]
[Ada] Fix unnesting crash with Predicate_Failure/no pred

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

gcc/ada/

* sem_ch13.adb (Analyze_Aspect_Specifications): Do not set the
Has_Predicates flag when the Predicate_Failure aspect is seen.
It is legal (but pointless) to use this aspect without a
predicate.  If we set the flag, we generate a half-baked
Predicate procedure, and if that procedure is nested, it causes
unnesting to crash.

4 years ago[Ada] Put_Image attribute
Bob Duff [Fri, 13 Mar 2020 17:05:13 +0000 (13:05 -0400)]
[Ada] Put_Image attribute

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

gcc/ada/

* exp_put_image.adb (Build_Record_Put_Image_Procedure): Remove
special processing of protected types, because those are handled
by Build_Protected_Put_Image_Call.
(Enable_Put_Image): Use the switch -gnatd_z to control enabling
of Put_Image. Disable Put_Image for types in Remote_Types
packages.
* debug.adb: Document -gnatd_z switch.
* exp_imgv.adb, libgnat/a-stteou.ads, opt.ads: Minor cleanups.

4 years ago[Ada] Simplify iteration over formal parameters for aliasing error
Piotr Trojanek [Fri, 13 Mar 2020 14:43:54 +0000 (15:43 +0100)]
[Ada] Simplify iteration over formal parameters for aliasing error

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

gcc/ada/

* sem_warn.adb (Warn_On_Overlapping_Actuals): Add label to the
outer loop and use it in the exit statement.

4 years ago[Ada] Generate predicate checks for on assignments in records
Ghjuvan Lacambre [Thu, 12 Mar 2020 13:12:53 +0000 (14:12 +0100)]
[Ada] Generate predicate checks for on assignments in records

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

gcc/ada/

* exp_ch3.adb (Build_Assignment): Generate predicate check if
subtype mark has predicate.

4 years ago[Ada] Missing accessibility error on object in type conversion
Justin Squirek [Thu, 12 Mar 2020 15:36:33 +0000 (11:36 -0400)]
[Ada] Missing accessibility error on object in type conversion

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

gcc/ada/

* sem_util.adb (Expand_N_Attribute_Reference): Use original
nodes where required to avoid looking at the expanded tree.

4 years ago[Ada] Remove aspects that were commented out
Arnaud Charlet [Thu, 12 Mar 2020 19:08:27 +0000 (15:08 -0400)]
[Ada] Remove aspects that were commented out

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

gcc/ada/

* libgnat/a-catizo.ads, libgnat/a-nbnbin.ads,
libgnat/a-nbnbre.ads, libgnat/a-nubinu.ads,
libgnat/s-aoinar.ads, libgnat/s-aomoar.ads,
libgnat/s-aotase.ads, libgnat/s-stopoo.ads: Remove aspects that
we will not implement.

4 years ago[Ada] Add fallback on Integer_Arithmetic
Arnaud Charlet [Thu, 12 Mar 2020 17:16:05 +0000 (13:16 -0400)]
[Ada] Add fallback on Integer_Arithmetic

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

gcc/ada/

* libgnat/s-aoinar.adb (Atomic_Fetch_And_Add,
Atomic_Fetch_And_Subtract): Add fallback using
compare-and-exchange, in case the integer type does not map to a
machine type.

4 years agoasan: fix RTX emission for ilp32
Martin Liska [Thu, 11 Jun 2020 07:34:41 +0000 (09:34 +0200)]
asan: fix RTX emission for ilp32

gcc/ChangeLog:

PR sanitizer/95634
* asan.c (asan_emit_stack_protection): Fix emission for ilp32
by using Pmode instead of ptr_mode.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
4 years agovect: Rename things related to rgroup_masks
Kewen Lin [Thu, 4 Jun 2020 05:57:19 +0000 (13:57 +0800)]
vect: Rename things related to rgroup_masks

Power supports vector memory access with length (in bytes) instructions.
Like existing fully masking for SVE, it is another approach to vectorize
the loop using partially-populated vectors.

As Richard Sandiford pointed out, we can rename the rgroup struct
rgroup_masks to rgroup_controls, rename its members mask_type to type,
masks to controls to be more generic.

Besides, this patch also renames some functions like vect_set_loop_mask
to vect_set_loop_control, release_vec_loop_masks to
release_vec_loop_controls, vect_set_loop_masks_directly to
vect_set_loop_controls_directly.

Bootstrapped/regtested on aarch64-linux-gnu.

gcc/ChangeLog:

* tree-vect-loop-manip.c (vect_set_loop_mask): Renamed to ...
(vect_set_loop_control): ... this.
(vect_maybe_permute_loop_masks): Rename rgroup_masks related things.
(vect_set_loop_masks_directly): Renamed to ...
(vect_set_loop_controls_directly): ... this.  Also rename some
variables with ctrl instead of mask.  Rename vect_set_loop_mask to
vect_set_loop_control.
(vect_set_loop_condition_masked): Rename rgroup_masks related things.
Also rename some variables with ctrl instead of mask.
* tree-vect-loop.c (release_vec_loop_masks): Renamed to ...
(release_vec_loop_controls): ... this.  Rename rgroup_masks related
things.
(_loop_vec_info::~_loop_vec_info): Rename release_vec_loop_masks to
release_vec_loop_controls.
(can_produce_all_loop_masks_p): Rename rgroup_masks related things.
(vect_get_max_nscalars_per_iter): Likewise.
(vect_estimate_min_profitable_iters): Likewise.
(vect_record_loop_mask): Likewise.
(vect_get_loop_mask): Likewise.
* tree-vectorizer.h (struct rgroup_masks): Renamed to ...
(struct rgroup_controls): ... this.  Also rename mask_type
to type and rename masks to controls.

4 years agovect: Rename fully_masked_p to using_partial_vectors_p
Kewen Lin [Thu, 4 Jun 2020 02:09:01 +0000 (10:09 +0800)]
vect: Rename fully_masked_p to using_partial_vectors_p

Power supports vector memory access with length (in bytes) instructions.
Like existing fully masking for SVE, it is another approach to vectorize
the loop using partially-populated vectors.

As Richard Sandiford suggested, this patch is to update the existing
fully_masked_p field to using_partial_vectors_p.  Introduce one macro
LOOP_VINFO_USING_PARTIAL_VECTORS_P for partial vectorization checking
usage, update the LOOP_VINFO_FULLY_MASKED_P with
LOOP_VINFO_USING_PARTIAL_VECTORS_P && !masks.is_empty() and still use
it for mask-based partial vectors approach specific checks.

Bootstrapped/regtested on aarch64-linux-gnu.

gcc/ChangeLog:

* tree-vect-loop-manip.c (vect_set_loop_condition): Rename
LOOP_VINFO_FULLY_MASKED_P to LOOP_VINFO_USING_PARTIAL_VECTORS_P.
(vect_gen_vector_loop_niters): Likewise.
(vect_do_peeling): Likewise.
* tree-vect-loop.c (_loop_vec_info::_loop_vec_info): Rename
fully_masked_p to using_partial_vectors_p.
(vect_analyze_loop_costing): Rename LOOP_VINFO_FULLY_MASKED_P to
LOOP_VINFO_USING_PARTIAL_VECTORS_P.
(determine_peel_for_niter): Likewise.
(vect_estimate_min_profitable_iters): Likewise.
(vect_transform_loop): Likewise.
* tree-vectorizer.h (LOOP_VINFO_FULLY_MASKED_P): Updated.
(LOOP_VINFO_USING_PARTIAL_VECTORS_P): New macro.

4 years agovect: Rename can_fully_mask_p to can_use_partial_vectors_p
Kewen Lin [Wed, 3 Jun 2020 09:15:14 +0000 (17:15 +0800)]
vect: Rename can_fully_mask_p to can_use_partial_vectors_p

Power supports vector memory access with length (in bytes) instructions.
Like existing fully masking for SVE, it is another approach to vectorize
the loop using partially-populated vectors.

As Richard Sandiford pointed out, we should extend the existing flag
can_fully_mask_p to be more generic, to indicate whether we have
any chances with partial vectors for this loop.  So this patch
is to rename this flag to can_use_partial_vectors_p to be more
meaningful, also rename the macro LOOP_VINFO_CAN_FULLY_MASK_P
to LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P.

Bootstrapped/regtested on aarch64-linux-gnu.

gcc/ChangeLog:

* tree-vect-loop.c (_loop_vec_info::_loop_vec_info): Rename
can_fully_mask_p to can_use_partial_vectors_p.
(vect_analyze_loop_2): Rename LOOP_VINFO_CAN_FULLY_MASK_P to
LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P.  Rename saved_can_fully_mask_p
to saved_can_use_partial_vectors_p.
(vectorizable_reduction): Rename LOOP_VINFO_CAN_FULLY_MASK_P to
LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P.
(vectorizable_live_operation): Likewise.
* tree-vect-stmts.c (permute_vec_elements): Likewise.
(check_load_store_masking): Likewise.
(vectorizable_operation): Likewise.
(vectorizable_store): Likewise.
(vectorizable_load): Likewise.
(vectorizable_condition): Likewise.
* tree-vectorizer.h (LOOP_VINFO_CAN_FULLY_MASK_P): Renamed to ...
(LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P): ... this.
(_loop_vec_info): Rename can_fully_mask_p to can_use_partial_vectors_p.

4 years agoprepare-commit-hook: Use gcc-config.diff-file.
Martin Liska [Thu, 11 Jun 2020 08:02:26 +0000 (10:02 +0200)]
prepare-commit-hook: Use gcc-config.diff-file.

contrib/ChangeLog:

* prepare-commit-msg: Replace ENV variable with a git config
value.

4 years agocontrib: Avoid redundant 'git diff' in prepare-commit-msg hook
Jonathan Wakely [Thu, 11 Jun 2020 07:57:58 +0000 (09:57 +0200)]
contrib: Avoid redundant 'git diff' in prepare-commit-msg hook

contrib/ChangeLog:

* prepare-commit-msg: Use 'tee' to save the diff to a file
instead of running 'git diff' twice.

4 years agoFix -Wformat-diag in options-save.c
Martin Liska [Thu, 11 Jun 2020 07:12:25 +0000 (09:12 +0200)]
Fix -Wformat-diag in options-save.c

The patch removes bunch of warnings:

options-save.c:12004:29: warning: unquoted identifier or keyword ‘global_options’ in format [-Wformat-diag]
12004 |     internal_error ("Error: global_options are modified in local context\n");

gcc/ChangeLog:

* optc-save-gen.awk: Quote error string.

4 years agoslim up mem exprs to avoid line breaks in -fverbose-asm
Alexandre Oliva [Thu, 11 Jun 2020 02:58:23 +0000 (23:58 -0300)]
slim up mem exprs to avoid line breaks in -fverbose-asm

An asm operand with a "VIEW_CONVERT_EXPR<struct {
  [...]
}>" will output the definition of the struct as asm code.  Oops.

Enable TDF_SLIM in print_mem_expr to avoid such line breaks.

for  gcc/ChangeLog

* print-rtl.c (print_mem_expr): Enable TDF_SLIM in dump_flags.

4 years agoRISC-V: Unify the output asm pattern between gpr_save and gpr_restore pattern.
Kito Cheng [Thu, 11 Jun 2020 02:41:06 +0000 (19:41 -0700)]
RISC-V: Unify the output asm pattern between gpr_save and gpr_restore pattern.

gcc/ChangeLog:

* config/riscv/riscv-protos.h (riscv_output_gpr_save): Remove.
* config/riscv/riscv-sr.c (riscv_sr_match_prologue): Update
value.
* config/riscv/riscv.c (riscv_output_gpr_save): Remove.
* config/riscv/riscv.md (gpr_save): Update output asm pattern.

4 years agoRISC-V: Describe correct USEs for gpr_save pattern [PR95252]
Kito Cheng [Thu, 11 Jun 2020 02:40:59 +0000 (19:40 -0700)]
RISC-V: Describe correct USEs for gpr_save pattern [PR95252]

 - Verified on rv32emc/rv32gc/rv64gc bare-metal target and rv32gc/rv64gc
   linux target with qemu.

gcc/ChangeLog:

* config/riscv/predicates.md (gpr_save_operation): New.
* config/riscv/riscv-protos.h (riscv_gen_gpr_save_insn): New.
(riscv_gpr_save_operation_p): Ditto.
* config/riscv/riscv-sr.c (riscv_remove_unneeded_save_restore_calls):
Ignore USEs for gpr_save patter.
* config/riscv/riscv.c (gpr_save_reg_order): New.
(riscv_expand_prologue): Use riscv_gen_gpr_save_insn to gen gpr_save.
(riscv_gen_gpr_save_insn): New.
(riscv_gpr_save_operation_p): Ditto.
* config/riscv/riscv.md (S3_REGNUM): New.
(S4_REGNUM): Ditto.
(S5_REGNUM): Ditto.
(S6_REGNUM): Ditto.
(S7_REGNUM): Ditto.
(S8_REGNUM): Ditto.
(S9_REGNUM): Ditto.
(S10_REGNUM): Ditto.
(S11_REGNUM): Ditto.
(gpr_save): Model USEs correctly.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/pr95252.c: New.

4 years agoDaily bump.
GCC Administrator [Thu, 11 Jun 2020 00:16:45 +0000 (00:16 +0000)]
Daily bump.

4 years agolibstdc++: Fix some ranges algos optimizations [PR95578]
Patrick Palka [Wed, 10 Jun 2020 21:37:53 +0000 (17:37 -0400)]
libstdc++: Fix some ranges algos optimizations [PR95578]

ranges::copy and a number of other ranges algorithms have unwrapping
optimizations for iterators of type __normal_iterator, move_iterator and
reverse_iterator.  But in the checks that guard these optimizations we
currently only test that the iterator of the iterator/sentinel pair has
the appropriate type before proceeding with the corresponding
optimization, and do not also test the sentinel type.

This breaks the testcase in this PR because this testcase constructs via
range adaptors a range whose begin() is a __normal_iterator and whose
end() is a custom sentinel type, and then performs ranges::copy on it.
From there we bogusly perform the __normal_iterator unwrapping
optimization on this iterator/sentinel pair, which immediately leads to
a constraint failure since the custom sentinel type does not model
sentinel_for<int*>.

This patch fixes this issue by refining each of the problematic checks
to also test that the iterator and sentinel types are the same before
applying the corresponding unwrapping optimization.  Along the way, some
code simplifications are made.

libstdc++-v3/ChangeLog:

PR libstdc++/95578
* include/bits/ranges_algo.h (__lexicographical_compare_fn):
Also check that the iterator and sentinel have the same type before
applying the unwrapping optimization for __normal_iterator.
Split the check into two, one for the first iterator/sentinel
pair and another for second iterator/sentinel pair.  Remove uses
of __niter_base, and remove uses of std::move on a
__normal_iterator.
* include/bits/ranges_algobase.h (__equal_fn): Likewise.
(__copy_or_move): Likewise.  Perform similar adjustments for
the reverse_iterator and move_iterator optimizations.  Inline
the checks into the if-constexprs, and use using-declarations to
make them less visually noisy.  Remove uses of __niter_wrap.
(__copy_or_move_backward): Likewise.
* testsuite/25_algorithms/copy/95578.cc: New test.
* testsuite/25_algorithms/copy_backward/95578.cc: New test.
* testsuite/25_algorithms/equal/95578.cc: New test.
* testsuite/25_algorithms/lexicographical_compare/95578.cc: New test.
* testsuite/25_algorithms/move/95578.cc: New test.
* testsuite/25_algorithms/move_backward/95578.cc: New test.

4 years ago[PR51447] restore the global reg var before returning from main
Alexandre Oliva [Wed, 10 Jun 2020 20:56:36 +0000 (17:56 -0300)]
[PR51447] restore the global reg var before returning from main

A runtime system might legitimately hold in rbx a value expected to be
preserved across the call to main, but its use as a global register
variable stops main from preserving it.

for  gcc/testsuite/ChangeLog

PR rtl-optimization/51447
* gcc.c-torture/execute/pr51447.c (main): Preserve call-saved
register.

4 years agocoroutines: Make call argument handling more robust [PR95440]
Iain Sandoe [Tue, 9 Jun 2020 23:15:28 +0000 (00:15 +0100)]
coroutines: Make call argument handling more robust [PR95440]

build_new_method_call is supposed to be able to handle a null
arguments list pointer (when the method has no parms).  There
were a couple of places where uses of the argument list pointer
were not defended against NULL.

gcc/cp/ChangeLog:

PR c++/95440
* call.c (add_candidates): Use vec_safe_length() for
testing the arguments list.
(build_new_method_call_1): Use vec_safe_is_empty() when
checking for an empty args list.

gcc/testsuite/ChangeLog:

PR c++/95440
* g++.dg/coroutines/pr95440.C: New test.

4 years agoPR middle-end/95353 - spurious -Wstringop-overflow writing to a trailing array plus...
Martin Sebor [Wed, 10 Jun 2020 18:00:08 +0000 (12:00 -0600)]
PR middle-end/95353 - spurious -Wstringop-overflow writing to a trailing array plus offset

Also resolves:
PR middle-end/92939 - missing -Wstringop-overflow on negative index from the end of array

gcc/ChangeLog:

PR middle-end/95353
PR middle-end/92939
* builtins.c (inform_access): New function.
(check_access): Call it.  Add argument.
(addr_decl_size): Remove.
(get_range): New function.
(compute_objsize): New overload.  Only use compute_builtin_object_size
with raw memory function.
(check_memop_access): Pass new argument to compute_objsize and
check_access.
(expand_builtin_memchr, expand_builtin_strcat): Same.
(expand_builtin_strcpy, expand_builtin_stpcpy_1): Same.
(expand_builtin_stpncpy, check_strncat_sizes): Same.
(expand_builtin_strncat, expand_builtin_strncpy): Same.
(expand_builtin_memcmp): Same.
* builtins.h (check_nul_terminated_array): Declare extern.
(check_access): Add argument.
(struct access_ref, struct access_data): New structs.
* gimple-ssa-warn-restrict.c (clamp_offset): New helper.
(builtin_access::overlap): Call it.
* tree-object-size.c (decl_init_size): Declare extern.
(addr_object_size): Correct offset computation.
* tree-object-size.h (decl_init_size): Declare.
* tree-ssa-strlen.c (handle_integral_assign): Remove a call
to maybe_warn_overflow when assigning to an SSA_NAME.

gcc/testsuite/ChangeLog:

PR middle-end/95353
PR middle-end/92939
* c-c++-common/Wstringop-truncation.c: Remove an xfail.
* gcc.dg/Warray-bounds-46.c: Remove a bogus warning.
* gcc.dg/Wrestrict-9.c: Disable -Wstringop-overflow.
* gcc.dg/Wstringop-overflow-12.c: Remove xfails.
* gcc.dg/Wstringop-overflow-28.c: Same.
* gcc.dg/builtin-stringop-chk-4.c: Same.
* gcc.dg/builtin-stringop-chk-5.c: Same.
* gcc.dg/builtin-stringop-chk-8.c: Same.
* gcc.dg/strlenopt-74.c: Avoid buffer overflow.
* gcc.dg/Wstringop-overflow-34.c: New test.
* gcc.dg/Wstringop-overflow-35.c: New test.
* gcc.dg/Wstringop-overflow-36.c: New test.
* gcc.dg/Wstringop-overflow-37.c: New test.
* gcc.dg/Wstringop-overflow-38.c: New test.

4 years agolibstdc++: Extend memcmp optimization in std::lexicographical_compare
François Dumont [Wed, 10 Jun 2020 16:48:46 +0000 (17:48 +0100)]
libstdc++: Extend memcmp optimization in std::lexicographical_compare

Make the memcmp optimization work for std::deque iterators and safe
iterators.

Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

2020-06-08  François Dumont  <fdumont@gcc.gnu.org>
    Jonathan Wakely  <jwakely@redhat.com>

* include/bits/deque.tcc (__lex_cmp_dit): New.
(__lexicographical_compare_aux1): Define overloads for deque
iterators.
* include/bits/stl_algobase.h (__lexicographical_compare::__3way):
New static member function.
(__lexicographical_compare<true>::__3way): Likewise.
(__lexicographical_compare<true>::__lc): Use __3way.
(__lexicographical_compare_aux): Rename to
__lexicographical_compare_aux1 and declare overloads for deque
iterators.
(__lexicographical_compare_aux): Define new forwarding function
that calls __lexicographical_compare_aux1 and declare new overloads
for safe iterators.
(lexicographical_compare): Do not use __niter_base on
parameters.
* include/debug/safe_iterator.tcc
(__lexicographical_compare_aux): Define overloads for safe
iterators.
* testsuite/25_algorithms/lexicographical_compare/1.cc: Add
checks with random access iterators.
* testsuite/25_algorithms/lexicographical_compare/deque_iterators/1.cc:
New test.

4 years agoavoid stmt-info allocation for debug stmts
Richard Biener [Wed, 10 Jun 2020 16:07:37 +0000 (18:07 +0200)]
avoid stmt-info allocation for debug stmts

The following avoids allocating stmt info structs for debug stmts.

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

* tree-vect-loop.c (vect_determine_vectorization_factor):
Skip debug stmts.
(_loop_vec_info::_loop_vec_info): Likewise.
(vect_update_vf_for_slp): Likewise.
(vect_analyze_loop_operations): Likewise.
(update_epilogue_loop_vinfo): Likewise.
* tree-vect-patterns.c (vect_determine_precisions): Likewise.
(vect_pattern_recog): Likewise.
* tree-vect-slp.c (vect_detect_hybrid_slp): Likewise.
(_bb_vec_info::_bb_vec_info): Likewise.
* tree-vect-stmts.c (vect_mark_stmts_to_be_vectorized):
Likewise.

4 years agotree-optimization/95576 - fix compare-debug issue with SLP vectorization
Richard Biener [Wed, 10 Jun 2020 13:16:23 +0000 (15:16 +0200)]
tree-optimization/95576 - fix compare-debug issue with SLP vectorization

The following avoids leading debug stmts in BB vectorizer regions.

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

PR tree-optimization/95576
* tree-vect-slp.c (vect_slp_bb): Skip leading debug stmts.

* g++.dg/vect/pr95576.cc: New testcase.

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.