gcc.git
4 years ago[Ada] Nested subprograms in protected subprograms improperly handled in GNAT-LLVM
Gary Dismukes [Fri, 17 Apr 2020 20:56:58 +0000 (16:56 -0400)]
[Ada] Nested subprograms in protected subprograms improperly handled in GNAT-LLVM

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

gcc/ada/

* exp_ch9.adb (Build_Protected_Subp_Specification): Add ???
comment about the flag Has_Nested_Subprogram not being set here.
(Expand_N_Protected_Body): If the original body for a protected
subprogram has the flag Has_Nested_Subprogram set, then set that
flag on the new unprotected subprogram body that's created for
it, and reset the Scope fields of its top level declarations,
which have been effectively taken from the original protected
subprogram body. Add ??? comment about unclear testing of
Corresponding_Spec.

4 years ago[Ada] Ada2020: AI12-0279 more dispatching points with aspect Yield
Javier Miranda [Fri, 17 Apr 2020 18:41:58 +0000 (14:41 -0400)]
[Ada] Ada2020: AI12-0279 more dispatching points with aspect Yield

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

gcc/ada/

* aspects.ads (type Aspect_Id): Add Aspect_Yield as a Boolean
aspect, and update the Is_Representation_Aspect, Aspect_Names,
and Aspect_Delay arrays.
* einfo.ads, einfo.adb (Has_Yield_Aspect, Yield_Aspect): New
subprograms.
* exp_ch6.adb (Add_Return, Expand_Non_Function_Return,
Expand_Simple_Function_Return): Add calls to Yield.
* exp_ch9.adb (Build_Accept_Body, Expand_N_Accept_Statement):
Add calls to Yield.
* rtsfind.ads (RE_Yield): Adding support to generate calls to
the runtime service Ada.Dispatching.Yield
* sem_ch13.adb (Analyze_Aspect_Yield): New subprogram.
* sem_ch3.adb (Derive_Subprogram): Inherit attribute
Has_Yield_Aspect.
* sem_ch8.adb (Analyze_Subprogram_Renaming): Check consistency
of Has_Yield in the actual subprogram of a generic
instantiation.
* sem_disp.adb (Check_Dispatching_Operation): Check that if the
Yield aspect is specified for a dispatching subprogram that
inherits the aspect, the specified value shall be confirming.
* sem_prag.adb (Analyze_Pragma [Pragma_Implemented]): Check that
the implementation kind By_Protected_Procedure cannot be applied
to a procedure that has aspect Yield.

4 years ago[Ada] Fix incorrect operand sharing after expansion
Eric Botcazou [Thu, 16 Apr 2020 21:42:13 +0000 (23:42 +0200)]
[Ada] Fix incorrect operand sharing after expansion

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

gcc/ada/

* exp_ch4.adb (Expand_N_Op_Expon): Replace all occurrences of
the original right operand with the relocated version.

4 years ago[Ada] Crash in tagged type constructor with task components
Javier Miranda [Thu, 16 Apr 2020 15:06:31 +0000 (11:06 -0400)]
[Ada] Crash in tagged type constructor with task components

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

gcc/ada/

* exp_ch6.adb (Has_BIP_Extra_Formal): New subprogram.
(Needs_BIP_Task_Actuals): Add support for the subprogram type
internally generated for dispatching calls.
* exp_disp.adb (Expand_Dispatching_Call): Adding code to
explicitly duplicate the extra formals of the target subprogram.
* freeze.adb (Check_Extra_Formals): New subprogram.
(Freeze_Subprogram): Fix decoration of Extra_Formals.
* sem_ch3.adb (Derive_Subprogram): Fix decoration of
Extra_Formals.

4 years ago[Ada] Do not give "bad indentation" error inside a declare_expression
Bob Duff [Thu, 16 Apr 2020 15:19:48 +0000 (11:19 -0400)]
[Ada] Do not give "bad indentation" error inside a declare_expression

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

gcc/ada/

* par.adb (P_Basic_Declarative_Items): Update comment about
Declare_Expression.
* par-ch3.adb (P_Declarative_Items): Pass in Declare_Expression
flag, and if True, skip the call to Style.Check_Indentation.
* par-ch4.adb (P_Declare_Expression): Fix incorrect comment.

4 years ago[Ada] Improve error message on anonymous access parameter conversion
Arnaud Charlet [Thu, 16 Apr 2020 12:37:56 +0000 (08:37 -0400)]
[Ada] Improve error message on anonymous access parameter conversion

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

gcc/ada/

* sem_res.adb (Valid_Conversion): Change error message to make
it more user-friendly.

4 years ago[Ada] Do not generate useless length check for array initialization
Eric Botcazou [Wed, 15 Apr 2020 19:11:17 +0000 (21:11 +0200)]
[Ada] Do not generate useless length check for array initialization

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

gcc/ada/

* checks.ads (Apply_Length_Check_On_Assignment): Declare.
* checks.adb (Apply_Length_Check_On_Assignment): New procedure
to apply a length check to an expression in an assignment.
* exp_ch5.adb (Expand_Assign_Array): Call it instead of calling
Apply_Length_Check to generate a length check.
* sem_ch5.adb (Analyze_Assignment): Likewise.

4 years ago[Ada] Support aspect Relaxed_Initialization on private types and constants
Piotr Trojanek [Tue, 14 Apr 2020 13:10:52 +0000 (15:10 +0200)]
[Ada] Support aspect Relaxed_Initialization on private types and constants

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

gcc/ada/

* einfo.adb (Is_Relaxed_Initialization_State): Add reference to
SPARK RM.
* sem_attr.adb (Analyze_Attribute_Old_Result): Likewise.
* sem_ch13.adb (Analyze_Aspect_Relaxed_Initialization): Reject
aspect on completions of private types and deferred constants.
* sem_util.ads, sem_util.adb (Has_Relaxed_Initialization):
Adjust comments; support queries for constants.

4 years ago[Ada] Small cleanup throughout CStand body
Eric Botcazou [Wed, 15 Apr 2020 08:42:05 +0000 (10:42 +0200)]
[Ada] Small cleanup throughout CStand body

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

gcc/ada/

* cstand.adb (Stloc): Change to a renaming.
(Staloc): Likewise.
(Build_Unsigned_Integer_Type): Remove Nam parameter, use local
constants and do not call Make_Name.
(Make_Dummy_Index): Use local constants.
(Create_Standard): Pass the name of entities as parameter in
calls to New_Standard_Entity and remove calls to Make_Name.
Adjust calls to Build_Unsigned_Integer_Type.
(Identifier_For): Use local constant.
(Make_Component): Pass the name of the component as parameter
in call to New_Standard_Entity and remove call to Make_Name.
(Make_Formal): Likewise.  Rename Formal_Name parameter into
Nam and use local constant.
(Make_Name): Delete.
(New_Operator): Use local constant.
(New_Standard_Entity): Rename S parameter into Nam and build
the name here.  Remove call to Make_Name.
(Register_Float_Type): Pass the name of the type as parameter
in call to New_Standard_Entity and remove call to Make_Name.

4 years ago[Ada] Remove new problematic condition for LLVM
Eric Botcazou [Tue, 14 Apr 2020 21:49:22 +0000 (23:49 +0200)]
[Ada] Remove new problematic condition for LLVM

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

gcc/ada/

* exp_attr.adb (Expand_N_Attribute_Reference) <Attribute_First>:
Remove condition added for scalar types.

4 years ago[Ada] Various typo corrections plus minor reformatting
Gary Dismukes [Tue, 14 Apr 2020 18:13:47 +0000 (14:13 -0400)]
[Ada] Various typo corrections plus minor reformatting

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

gcc/ada/

* exp_ch3.ads (Build_Access_Subprogram_Wrapper_Body): Adjust
colon columns; reformat comment.
* exp_ch3.adb
(Build_Access_Subprogram_Wrapper_Body): Likewise.
* sem_ch3.adb (Build_Access_Subprogram_Wrapper): Reformat spec
comment and reformat comment in body.
(Analyze_Full_Type_Declaration): Reformat comment.
(Replace_Type_Name): Fixed three typos, plus reformatting of
comment.
* sem_prag.adb (Analyze_Pre_Post_Condition): Fix typos.
* sem_warn.adb (Warn_On_Overlapping_Actuals): Edit comments:
remove hyphen, add missing word.

4 years ago[Ada] Ada2020: AI12-0110 Tampering checks are performed first
Bob Duff [Fri, 10 Apr 2020 22:23:15 +0000 (18:23 -0400)]
[Ada] Ada2020: AI12-0110 Tampering checks are performed first

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

gcc/ada/

* libgnat/a-cbdlli.adb, libgnat/a-cbhama.adb,
libgnat/a-cbhase.adb, libgnat/a-cbmutr.adb,
libgnat/a-cborma.adb, libgnat/a-cborse.adb,
libgnat/a-cdlili.adb, libgnat/a-chtgbk.adb,
libgnat/a-chtgke.adb, libgnat/a-cidlli.adb,
libgnat/a-cihama.adb, libgnat/a-cihase.adb,
libgnat/a-cimutr.adb, libgnat/a-ciorma.adb,
libgnat/a-ciorse.adb, libgnat/a-cobove.adb,
libgnat/a-cohama.adb, libgnat/a-cohase.adb,
libgnat/a-coinve.adb, libgnat/a-comutr.adb,
libgnat/a-convec.adb, libgnat/a-coorma.adb,
libgnat/a-coorse.adb, libgnat/a-crbtgk.adb,
libgnat/a-crbtgo.adb, libgnat/a-rbtgso.adb: Move tampering
checks earlier.

4 years ago[Ada] Couple of small tweaks related to integer conversions
Eric Botcazou [Tue, 14 Apr 2020 09:20:18 +0000 (11:20 +0200)]
[Ada] Couple of small tweaks related to integer conversions

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

gcc/ada/

* exp_attr.adb (Get_Integer_Type): Use standard types without
a specific size.
* sem_res.adb (Resolve_Unchecked_Type_Conversion): Remove a
redundant intermediate conversion to Universal_Integer.

4 years ago[Ada] Fix comment of Get_Iterable_Type_Primitive
Piotr Trojanek [Sat, 11 Apr 2020 11:04:31 +0000 (13:04 +0200)]
[Ada] Fix comment of Get_Iterable_Type_Primitive

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

gcc/ada/

* sem_util.ads, sem_util.adb (Get_Iterable_Type_Primitive): Fix
comment and enforce it with an assertion in the body.

4 years ago[Ada] Ada_2020 AI12-0220 Pre/Postconditions on Access_To_Subprogram types
Ed Schonberg [Sun, 12 Apr 2020 14:34:46 +0000 (10:34 -0400)]
[Ada] Ada_2020 AI12-0220 Pre/Postconditions on Access_To_Subprogram types

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

gcc/ada/

* sem_ch3.adb (Analyze_Full_Type_Declaration): For an
access_to_subprogram declaration that has aspect specifications,
call Build_Access_ Subprogram_Wrapper at once, so that pre- and
postcondition aspects are analyzed in the context of a
subprogram declaration.
(Build_Access_Subprogram_Wrapper): Examine aspect specifications
of an Access_To_Subprogram declaration. If pre- or
postconditions are declared for it, create declaration for
subprogram wrapper and add the corresponding aspect
specifications to it. Replace occurrences of the type name by
that of the generated subprogram, so that attributes 'Old and
'Result can appear in a postcondition.
* exp_ch3.adb (Build_Access_Subprogram_Wrapper_Body): Moved
here from sem_prag.adb.
* exp_ch3.ads (Build_Access_Subprogram_Wrapper_Body): Visible
subprogram.
* sem_prag.adb (Build_Access_Subprogram_Wrapper / _Body): Moved
to sem_ch3.adb and exp_ch3.adb.

4 years ago[Ada] Add assertions to Preserve_Comes_From_Source and reuse it
Piotr Trojanek [Sat, 11 Apr 2020 10:38:06 +0000 (12:38 +0200)]
[Ada] Add assertions to Preserve_Comes_From_Source and reuse it

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

gcc/ada/

* atree.adb (Preserve_Comes_From_Source): Rewrite using
Set_Comes_From_Source and Comes_From_Source, which enforce that
the parameters are valid.
* exp_ch4.adb, exp_ch5.adb, sem_ch12.adb, sem_ch6.adb,
sem_res.adb: Rewrite using Preserve_Comes_From_Source.

4 years ago[Ada] Remove obsolete comments in Big_Numbers
Arnaud Charlet [Thu, 9 Apr 2020 07:33:20 +0000 (03:33 -0400)]
[Ada] Remove obsolete comments in Big_Numbers

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

gcc/ada/

* libgnat/a-nbnbin.ads, libgnat/a-nbnbre.ads: Remove obsolete
comments.

4 years ago[Ada] Implement static expression functions for Ada 202x (AI12-0075)
Gary Dismukes [Tue, 7 Apr 2020 05:14:26 +0000 (01:14 -0400)]
[Ada] Implement static expression functions for Ada 202x (AI12-0075)

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

gcc/ada/

* aspects.ads (type Aspect_Id): Add Aspect_Static as a Boolean
aspect, and update the Is_Representation_Aspect, Aspect_Names,
and Aspect_Delay arrays.
* exp_ch6.adb (Expand_Simple_Function_Return): In the case of a
return for a static expression function, capture a copy of the
expression of the return statement before it's expanded and
reset its Analyzed flags. Then, just before leaving this
procedure, if the expression was rewritten, set the
Original_Node of the rewritten expression to the new copy and
also set the Expression of the associated static expression
function to designate that copy. This ensures that later copies
of the expression made via New_Copy_Tree will fully copy all
nodes of the expression tree.
* inline.ads (Inline_Static_Expression_Function_Call): New
procedure to evaluate and produce the result of a static call to
a static expression function.
* inline.adb: Add with and use for Sem_Res.
(Establish_Actual_Mapping_For_Inlined_Call): New procedure
extracted from code in Expand_Inlined_Call that traverses the
actuals and formals of an inlined call and in some cases creates
temporaries for holding the actuals, plus establishes an
association between formals and actuals (via the Renamed_Object
fields of the formals).
(Formal_Is_Used_Once): Function removed from Expand_Inlined_Call
and now nested in the above procedure.
(Expand_Inlined_Call): Code for doing the formal/actual
traversal is moved to Create_Actual_Temporaries and replaced
with a call to that new procedure.
(Inline_Static_Expression_Function_Call): New procedure to
evaluate a static call to a static expression function,
substituting actuals for their corresponding formals and
producing a fully folded and static result expression. The
function has subsidiary functions Replace_Formal and Reset_Sloc
that take care of doing the mapping of formals to actuals and
resetting the Slocs of subnodes of the mapped expression to that
of the call so errors will be flagged on the call rather than
function.
* sem_ch6.adb (Analyze_Expression_Function): In the case of a
static expression function, perform an additional preanalysis of
the function's expression to ensure that it's a potentially
static expression (according to the requirements of
6.8(3.2/5-3.4/5)), and issue an error if it's not. The global
flag Checking_Potentially_Static_Expression is set and unset
around this checking.
* sem_ch13.adb (Analyze_Aspect_Static): New procedure to enforce
selected requirements of the new aspect Static on expression
functions, including checking that the language version is
Ada_2020 and that the entity to which it applies is an
expression function whose formal parameters are of a static
subtype and have mode 'in', its result subtype is a static
subtype, and it has no pre- or postcondition aspects. A ???
comment is added to indicate the need for adding checking that
type invariants don't apply to the result type if the function
is a boundary entity.
(Analyze_One_Aspect): Call Analyze_Aspect_Static for aspect
Static.
* sem_elab.adb (Build_Call_Marker): Return without creating a
call marker when the subprogram is a static expression function,
since no ABE checking is needed for such functions.
* sem_eval.ads (Checking_Potentially_Static_Expression): New
function to return whether the checking for potentially static
expressions is enabled.
(Set_Checking_Potentially_Static_Expression): New procedure to
enable or disable checking of potentially static expressions.
* sem_eval.adb (Checking_For_Potentially_Static_Expression): New
global flag for determining whether preanalysis of potentially
static expression is being done, which affects the behavior of
certain static evaluation routines.
(Checking_Potentially_Static_Expression): New function to return
whether the checking for potentially static expressions is
enabled.
(Eval_Call): When evaluating a call within a static expression
function with checking of potentially static expression
functions enabled, substitutes a static value in place of the
call to allow folding of the expression.
(Eval_Entity_Name): When evaluating a formal parameter of a
static expression function with checking of potentially static
expression functions enabled, substitutes a static value in
place of the reference to the formal to allow folding of the
expression.
(Set_Checking_Potentially_Static_Expression): New procedure to
enable or disable checking of potentially static expressions.
* sem_res.adb (Resolve_Call): Test for a recursive call
occurring within a static expression function and issue an error
for such a call. Prevent the establishment of a transient scope
in the case this is a call to a (string-returning) static
expression function. When calling a static expression function,
if no error has been posted on the function, call
Inline_Static_Expression_Function_Call to convert the call into
its equivalent static value.
* sem_util.ads (Is_Static_Expression_Function): New function
returning whether the subprogram entity passed to it is a static
expression function.
(Is_Static_Expression_Function_Call): New function to determine
whether the call node passed to it is a static call to a static
expression function.
* sem_util.adb (Compile_Time_Constraint_Error): Suppress
compile-time Constraint_Error reporting when checking for a
potentially static expression.
(Is_Static_Expression_Function): New function returning whether
the subprogram entity passed to it is a static expression
function by testing for the presence of aspect Static.
(Has_All_Static_Actuals): New function in
Is_Static_Expression_Function_Call that traverses the actual
parameters of a function call and returns True only when all of
the actuals are given by static expressions. In the case of a
string-returning function, we call Resolve on each actual to
ensure that their Is_Static_Expression flag properly reflects
whether they're static, to allow suppressing creation of a
transient scope within Resolve_Call. A prominent ??? comment is
added to explain this rather unconventional call to Resolve.
(Is_Static_Expression_Function_Call): New function that
determines whether a node passed to it is a call to a static
expression function all of whose actual parameters are given by
static expressions.

4 years ago[Ada] Deal with second specific superflat case in Optimize_Length_Comparison
Eric Botcazou [Mon, 13 Apr 2020 07:16:18 +0000 (09:16 +0200)]
[Ada] Deal with second specific superflat case in Optimize_Length_Comparison

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

gcc/ada/

* exp_ch4.adb (Optimize_Length_Comparison): New local variable to
record whether this may be a dynamic superflat case.
(Is_Optimizable): Accept 0 as lower bound and set it in this case,
but return false if the operand is not a length too.
(Rewrite_For_Equal_Lengths): New procedure.
Optimize the comparison of two lengths in the superflat case when
the arrays have the same bounds.

4 years ago[Ada] Adjust documentation of 'Bit and 'Descriptor_Size attributes
Eric Botcazou [Mon, 13 Apr 2020 09:10:43 +0000 (11:10 +0200)]
[Ada] Adjust documentation of 'Bit and 'Descriptor_Size attributes

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

gcc/ada/

* doc/gnat_rm/implementation_defined_attributes.rst (Bit): Sharpen
the comparison with System.Storage_Unit.
(Descriptor_Size): Clear confusion about alignment and padding.
* gnat_rm.texi: Regenerate.

4 years ago[Ada] Work around problematic interaction with public symbol generation
Eric Botcazou [Sat, 11 Apr 2020 16:28:49 +0000 (18:28 +0200)]
[Ada] Work around problematic interaction with public symbol generation

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

gcc/ada/

* exp_attr.adb (Expand_N_Attribute_Reference) <Attribute_First>:
Do not replace the bound for an array type if it is public.

4 years ago[Ada] Fix small oversight in change to Optimize_Length_Comparison
Eric Botcazou [Sat, 11 Apr 2020 13:40:24 +0000 (15:40 +0200)]
[Ada] Fix small oversight in change to Optimize_Length_Comparison

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

gcc/ada/

* exp_ch4.adb (Optimize_Length_Comparison): Make sure the base
types are the same when comparing Y'Last and X'Last directly.

4 years ago[Ada] Optimize length checks generated for slice assignments
Eric Botcazou [Fri, 10 Apr 2020 21:03:18 +0000 (23:03 +0200)]
[Ada] Optimize length checks generated for slice assignments

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

gcc/ada/

* exp_attr.adb (Expand_N_Attribute_Reference) <Attribute_First>:
Replace it with a direct reference to an entity which is not a
discriminant for constrained array types.  Add same condition
for scalar types.
<Attribute_Last>: Merge with above implementation.
* exp_ch4.adb (Optimize_Length_Comparison): Be prepared for a
second entity whose length is compared.  Rename Prepare_64 to
Convert_To_Long_Long_Integer.  If the second entity is present,
compute the difference of the 'First attributes and compare the
sum of 'Last of the second entity with this difference against
'Last of the first entity.  Add a special case when the 'First
attributes are equal.  Suppress overflow checks in all cases.

4 years ago[Ada] Fix casing from GNATProve to GNATprove
Piotr Trojanek [Fri, 10 Apr 2020 17:33:44 +0000 (19:33 +0200)]
[Ada] Fix casing from GNATProve to GNATprove

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

gcc/ada/

* doc/gnat_rm/implementation_defined_pragmas.rst, lib-writ.ads,
par-prag.adb, sem_ch12.adb, sem_ch8.adb, sem_prag.adb: Fix
casing of GNATprove.
* gnat_rm.texi: Regenerate.

4 years ago[Ada] Remove unnecessary special-casing of GNATprove expansion
Piotr Trojanek [Fri, 10 Apr 2020 17:30:13 +0000 (19:30 +0200)]
[Ada] Remove unnecessary special-casing of GNATprove expansion

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

gcc/ada/

* checks.adb (Generate_Range_Check): Simplify redundant
condition.
* sem_ch3.adb (Check_Initialization, Process_Discriminants):
Likewise.
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Likewise.

4 years ago[Ada] Fix small fallout of change for 'Pos and 'Val attributes
Eric Botcazou [Fri, 10 Apr 2020 09:20:55 +0000 (11:20 +0200)]
[Ada] Fix small fallout of change for 'Pos and 'Val attributes

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

gcc/ada/

* exp_fixd.adb (Build_Conversion): Also preserve the
Conversion_OK flag of an inner conversion.

4 years ago[Ada] Fix expansion of "for X of Y loop" in GNATprove
Piotr Trojanek [Wed, 8 Apr 2020 21:38:51 +0000 (23:38 +0200)]
[Ada] Fix expansion of "for X of Y loop" in GNATprove

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

gcc/ada/

* sem_ch5.adb (Analyze_Iterator_Specification): Enable expansion
that creates a renaming that removes side effects from the
iterated object in the GNATprove mode; then analyze reference to
this renaming (it is required for GNATprove and harmless for
GNAT).

4 years agoOptimize V16QI/V32QI/V64QI shift by constant.
liuhongt [Mon, 15 Jun 2020 05:48:45 +0000 (13:48 +0800)]
Optimize V16QI/V32QI/V64QI shift by constant.

gcc/ChangeLog:
PR target/95524
* config/i386/i386-expand.c
(ix86_expand_vec_shift_qihi_constant): New function.
* config/i386/i386-protos.h
(ix86_expand_vec_shift_qihi_constant): Declare.
* config/i386/sse.md (<shift_insn><mode>3): Optimize shift
V*QImode by constant.

gcc/testsuite/ChangeLog:
* gcc.target/i386/avx2-shiftqihi-constant-1.c: New test.
* gcc.target/i386/avx2-shiftqihi-constant-2.c: Ditto.
* gcc.target/i386/avx512bw-shiftqihi-constant-1.c: Ditto.
* gcc.target/i386/avx512bw-shiftqihi-constant-2.c: Ditto.
* gcc.target/i386/sse2-shiftqihi-constant-1.c: Ditto.
* gcc.target/i386/sse2-shiftqihi-constant-2.c: Ditto.

4 years agogcov: fix gcov-tool merge for TOPN counters
Martin Liska [Tue, 16 Jun 2020 12:14:03 +0000 (14:14 +0200)]
gcov: fix gcov-tool merge for TOPN counters

libgcc/ChangeLog:

* libgcov-util.c (read_gcda_finalize): Remove const operator.
(merge_wrapper): Add both counts and use them properly.
(topn_to_memory_representation): New function.
(gcov_merge): Covert on disk representation to in memory
representation.
* libgcov.h: Remove const operator.

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

4 years agomiddle-end: Add another testcase for PR 95493
Jonathan Wakely [Tue, 16 Jun 2020 22:14:23 +0000 (23:14 +0100)]
middle-end: Add another testcase for PR 95493

This was reported on the gcc-help mailing list. The regression started
with r10-589 and was fixed by r11-963.

gcc/testsuite/ChangeLog:

* g++.dg/torture/pr95493-1.C: New test.

4 years agod: Remove names of unused function parameters.
Iain Buclaw [Thu, 14 May 2020 20:29:48 +0000 (22:29 +0200)]
d: Remove names of unused function parameters.

gcc/d/ChangeLog:

* d-attribs.cc (handle_noreturn_attribute): Remove names of unused
function parameters.
(handle_leaf_attribute): Likewise.
(handle_const_attribute): Likewise.
(handle_malloc_attribute): Likewise.
(handle_pure_attribute): Likewise.
(handle_novops_attribute): Likewise.
(handle_nonnull_attribute): Likewise.
(handle_nothrow_attribute): Likewise.
(handle_type_generic_attribute): Likewise.
(handle_transaction_pure_attribute): Likewise.
(handle_returns_twice_attribute): Likewise.
(handle_fnspec_attribute): Likewise.
(handle_always_inline_attribute): Likewise.
(d_handle_noinline_attribute): Likewise.
(d_handle_forceinline_attribute): Likewise.
(d_handle_flatten_attribute): Likewise.
(d_handle_noclone_attribute): Likewise.
(d_handle_section_attribute): Likewise.
(d_handle_alias_attribute): Likewise.
(d_handle_weak_attribute): Likewise.

4 years agod: Update code formatting in a consistent style.
Iain Buclaw [Tue, 16 Jun 2020 14:23:44 +0000 (16:23 +0200)]
d: Update code formatting in a consistent style.

gcc/d/ChangeLog:

* d-attribs.cc: Update code formatting in a consistant style.
* d-builtins.cc: Likewise.
* d-codegen.cc: Likewise.
* d-compiler.cc: Likewise.
* d-convert.cc: Likewise.
* d-diagnostic.cc: Likewise.
* d-frontend.cc: Likewise.
* d-lang.cc: Likewise.
* d-longdouble.cc: Likewise.
* d-port.cc: Likewise.
* d-spec.cc: Likewise.
* d-tree.h: Likewise.
* decl.cc: Likewise.
* expr.cc: Likewise.
* longdouble.h: Likewise.
* modules.cc: Likewise.
* toir.cc: Likewise.
* typeinfo.cc: Likewise.

4 years agod: Consistently format quotations in comments.
Iain Buclaw [Tue, 16 Jun 2020 13:57:58 +0000 (15:57 +0200)]
d: Consistently format quotations in comments.

gcc/d/ChangeLog:

* d-builtins.cc: Update quotation formatting of comments.
* d-codegen.cc: Likewise.
* d-lang.cc: Likewise.
* decl.cc: Likewise.
* expr.cc: Likewise.
* imports.cc: Likewise.
* runtime.cc: Likewise.
* toir.cc: Likewise.
* typeinfo.cc: Likewise.
* types.cc: Likewise.

4 years agod: Remove dependency on front-end OutBuffer for diagnostic and deps file generation.
Iain Buclaw [Tue, 16 Jun 2020 13:42:23 +0000 (15:42 +0200)]
d: Remove dependency on front-end OutBuffer for diagnostic and deps file generation.

gcc/d/ChangeLog:

* d-diagnostic.cc (expand_d_format): Replace OutBuffer with obstack.
(d_diagnostic_report_diagnostic): Don't free xformat.
* d-lang.cc (struct d_option_data): Change deps_target type from
OutBuffer to vec <const char *>.
(deps_add_target): Update to push each target to deps_target.
(deps_write_string): New function.
(deps_write): Change buffer type to obstack* and remove colmax.
(d_init_options): Update initialization of deps_target.
(d_parse_file): Replace OutBuffer with obstack.

4 years agod: Remove dependency on front-end File type for json and deps file generation.
Iain Buclaw [Tue, 16 Jun 2020 08:27:52 +0000 (10:27 +0200)]
d: Remove dependency on front-end File type for json and deps file generation.

gcc/d/ChangeLog:

* d-lang.cc (d_parse_file): Replace uses of File with FILE.

4 years agod: Move generation of array bounds error to own function.
Iain Buclaw [Tue, 16 Jun 2020 08:11:07 +0000 (10:11 +0200)]
d: Move generation of array bounds error to own function.

gcc/d/ChangeLog:

* d-codegen.cc (build_array_bounds_call): New function.
(build_bounds_condition): Use build_array_bounds_call.
* d-lang.cc (d_init_options): Explicitly set default check action to
CHECKACTION_D.
(d_post_options): Set check action to CHECKACTION_C if the flag
-fno-druntime was seen.
* d-tree.h (build_array_bounds_call): Declare.
* expr.cc (ExprVisitor::visit (AssertExp *)): Use
build_array_bounds_call.

4 years agolibstdc++: Strip cv-qualifiers in std::atomic<FP> (PR 95282)
Jonathan Wakely [Tue, 16 Jun 2020 21:34:55 +0000 (22:34 +0100)]
libstdc++: Strip cv-qualifiers in std::atomic<FP> (PR 95282)

This improves the previous fix for PR 95282, and extends it to also
apply to the exchange function (which has a similar problem and would
become ill-formed with my proposed fix for PR 95378).

PR libstdc++/95282
* include/bits/atomic_base.h (__atomic_impl::load): Use the _Val
alias instead of deducing _Tp as an unqualified type.
(__atomic_impl::exchange): Use the _Val alias to remove volatile
from the reinterpret_cast result type.

4 years agolibstdc++: Enforce copyable/movable checks in std::atomic
Jonathan Wakely [Tue, 16 Jun 2020 21:34:55 +0000 (22:34 +0100)]
libstdc++: Enforce copyable/movable checks in std::atomic

C++20 adds some new preconditions to std::atomic, which weren't
previously checked by our implementation.

* include/std/atomic (atomic): Add static assertions.
* testsuite/29_atomics/atomic/requirements/types_neg.cc: New test.

4 years agod: Use toStringExp instead of explicit cast
Iain Buclaw [Mon, 15 Jun 2020 15:43:31 +0000 (17:43 +0200)]
d: Use toStringExp instead of explicit cast

gcc/d/ChangeLog:

* d-attribs.cc (build_attributes): Use toStringExp instead of cast.
* toir.cc (IRVisitor::visit): Likewise.

4 years agod: Use new isXxxxExp helpers where possible
Iain Buclaw [Mon, 15 Jun 2020 15:39:12 +0000 (17:39 +0200)]
d: Use new isXxxxExp helpers where possible

gcc/d/ChangeLog:

* d-attribs.cc (build_attributes): Use isXxxxExp helpers instead of
explicit casts.
* d-codegen.cc (d_build_call): Likewise.
* d-compiler.cc (Compiler::paintAsType): Likewise.
* decl.cc (ExprVisitor::visit): Likewise.
(layout_class_initializer): Likewise.
* expr.cc (ExprVisitor::lvalue_p): Likewise
(ExprVisitor::visit): Likewise.
* types.cc (layout_aggregate_members): Likewise.

4 years agod: Use toTypeFunction instead of explicit cast
Iain Buclaw [Mon, 15 Jun 2020 14:56:02 +0000 (16:56 +0200)]
d: Use toTypeFunction instead of explicit cast

gcc/d/ChangeLog:

* d-frontend.cc (eval_builtin): Use toTypeFunction instead of cast.
* decl.cc (DeclVisitor::visit): Likewise.
* toir.cc (IRVisitor::visit): Likewise.
* typeinfo.cc (TypeInfoVisitor::visit): Likewise.

4 years agod: Use new isTypeXxxx helpers where possible.
Iain Buclaw [Wed, 3 Jun 2020 13:26:25 +0000 (15:26 +0200)]
d: Use new isTypeXxxx helpers where possible.

gcc/d/ChangeLog:

* d-builtins.cc (d_eval_constant_expression): Use isTypeXxxx helpers
instead of explicit casts.
(d_build_builtins_module): Likewise.
* d-codegen.cc (get_array_length): Likewise.
(identity_compare_p): Likewise.
(lower_struct_comparison): Likewise.
(build_array_from_val): Likewise.
(array_bounds_check): Likewise.
(get_function_type): Likewise.
(d_build_call): Likewise.
* d-compiler.cc (Compiler::paintAsType): Likewise.
* d-convert.cc (convert_expr): Likewise.
(convert_for_assignment): Likewise.
* d-lang.cc (d_classify_record): Likewise.
(d_build_eh_runtime_type): Likewise.
* decl.cc (DeclVisitor::visit): Likewise.
* expr.cc (ExprVisitor::needs_postblit): Likewise.
(ExprVisitor::needs_dtor): Likewise.
(ExprVisitor::visit): Likewise.
* imports.cc (ImportVisitor::visit): Likewise.
* typeinfo.cc (get_typeinfo_kind): Likewise.
(TypeInfoVisitor::visit): Likewise.
(TypeDeclInfoVisitor::visit): Likewise.
* types.cc (merge_aggregate_types): Likewise.
(TypeVisitor::visit): Likewise.

4 years agoFix pasto in the substitute_and_fold_engine merge with evrp.
Aldy Hernandez [Tue, 16 Jun 2020 11:43:57 +0000 (13:43 +0200)]
Fix pasto in the substitute_and_fold_engine merge with evrp.

The original code only propagated into PHI arguments if the value was
a constant.  This behavior was lost in the conversion, allowing
any value (SSAs for instance) to be propagated into PHIs.

gcc/ChangeLog:

PR tree-optimization/95649
* tree-ssa-propagate.c (propagate_into_phi_args): Do not propagate unless
value is a constant.

gcc/testsuite/ChangeLog:

* g++.dg/tree-ssa/pr95649.C: New test.
* gcc.dg/tree-ssa/pr95649.c: New test.

4 years agoOpenACC/Fortran: permit 'routine' inside PURE
Tobias Burnus [Tue, 16 Jun 2020 18:18:31 +0000 (20:18 +0200)]
OpenACC/Fortran: permit 'routine' inside PURE

gcc/fortran/ChangeLog

* parse.c (decode_oacc_directive): Permit 'acc routine' also
inside pure procedures.
* openmp.c (gfc_match_oacc_routine): Inside pure procedures
do not permit gang, worker or vector clauses.

libgomp/ChangeLog:

* testsuite/libgomp.oacc-fortran/routine-10.f90: New test.

gcc/testsuite/ChangeLog:

* gfortran.dg/goacc/pure-elemental-procedures-2.f90: New test.

Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>
4 years agoOpenMP/Fortran: Permit impure ELEMENTAL in omp directives
Tobias Burnus [Tue, 16 Jun 2020 18:17:20 +0000 (20:17 +0200)]
OpenMP/Fortran: Permit impure ELEMENTAL in omp directives

OpenMP since 4.5 permits IMPURE ELEMENTAL in directives and
the code already only checked for PURE. â€“ Followup for
-fopenmp-simd.

gcc/fortran/ChangeLog:

* parse.c (decode_omp_directive): Remove "or ELEMENTAL"
from "in PURE" error message also for -fopenmp-simd.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/pr79154-simd.f90: New test.

4 years agoc++: Don't allow designated initializers with non-aggregates [PR95369]
Marek Polacek [Mon, 15 Jun 2020 19:31:32 +0000 (15:31 -0400)]
c++: Don't allow designated initializers with non-aggregates [PR95369]

Another part of 95369 is that we accept designated initializers with
non-aggregate types.  That seems to be wrong since they're part of
aggregate initialization.  clang/icc also reject it.

There are multiple contexts where we can use designated initializers:
function-like casts, member list initializers, NTTP, etc.  I've adjusted
add_list_candidates and implicit_conversion_error in order to to detect
this case.

gcc/cp/ChangeLog:

PR c++/95369
* call.c (add_list_candidates): Return if a designated initializer
is used with a non-aggregate.
(implicit_conversion_error): Give an error for the case above.

gcc/testsuite/ChangeLog:

PR c++/95369
* g++.dg/cpp2a/desig11.C: Adjust dg-error.
* g++.dg/cpp2a/desig16.C: New test.

4 years agoc++: Fix ICE in check_local_shadow with enum [PR95560]
Marek Polacek [Tue, 16 Jun 2020 17:02:23 +0000 (13:02 -0400)]
c++: Fix ICE in check_local_shadow with enum [PR95560]

Another indication that perhaps this warning is emitted too early.  We
crash because same_type_p gets a null type: we have an enumerator
without a fixed underlying type and finish_enum_value_list hasn't yet
run.  So check if the type is null before calling same_type_p.

PR c++/95560
* name-lookup.c (check_local_shadow): Check if types are
non-null before calling same_type_p.

* g++.dg/warn/Wshadow-local-3.C: New test.

4 years agotestsuite: Make sure the *san/inline* tests aren't UNRESOLVED with LTO
Jakub Jelinek [Tue, 16 Jun 2020 16:19:44 +0000 (18:19 +0200)]
testsuite: Make sure the *san/inline* tests aren't UNRESOLVED with LTO

These tests are UNRESOLVED because -fdump-tree-optimized can't be scanned
with slim LTO.  Other *san/ tests deal with this by adding -ffat-lto-objects.

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

* c-c++-common/asan/inline.c: Add -ffat-lto-objects to dg-options.
* c-c++-common/asan/inline-kernel.c: Likewise.
* c-c++-common/ubsan/inline.c: Likewise.

4 years agoS/390: Emit vector alignment hints for z13 if AS accepts them
Stefan Schulze Frielinghaus [Thu, 4 Jun 2020 11:50:49 +0000 (13:50 +0200)]
S/390: Emit vector alignment hints for z13 if AS accepts them

Since 87cb9423add vector alignment hints are emitted for target z13,
too.  This patch changes this behaviour in the sense that alignment
hints are only emitted for target z13 if the assembler accepts them.

gcc/ChangeLog:

* config.in: Regenerate.
* config/s390/s390.c (print_operand): Emit vector alignment hints
for target z13, if AS accepts them.  For other targets the logic
stays the same.
* config/s390/s390.h (TARGET_VECTOR_LOADSTORE_ALIGNMENT_HINTS): Define
macro.
* configure: Regenerate.
* configure.ac: Check HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS_ON_Z13.

4 years ago[PATCH][GCC] arm: Fix the MVE ACLE vaddq_m polymorphic variants.
Srinath Parvathaneni [Tue, 16 Jun 2020 14:58:07 +0000 (15:58 +0100)]
[PATCH][GCC] arm: Fix the MVE ACLE vaddq_m polymorphic variants.

Hello,

This patch fixes the MVE ACLE vaddq_m polymorphic variants by modifying the corresponding
intrinsic parameters and vaddq_m polymorphic variant's _Generic case entries in "arm_mve.h"
header file.

2020-06-04  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

gcc/
* config/arm/arm_mve.h (__arm_vaddq_m_n_s8): Correct the intrinsic
arguments.
(__arm_vaddq_m_n_s32): Likewise.
(__arm_vaddq_m_n_s16): Likewise.
(__arm_vaddq_m_n_u8): Likewise.
(__arm_vaddq_m_n_u32): Likewise.
(__arm_vaddq_m_n_u16): Likewise.
(__arm_vaddq_m): Modify polymorphic variant.

gcc/testsuite/
* gcc.target/arm/mve/intrinsics/mve_vaddq_m.c: New test.

4 years ago[PATCH][GCC] arm: Fix MVE scalar shift intrinsics code-gen.
Srinath Parvathaneni [Tue, 16 Jun 2020 14:55:55 +0000 (15:55 +0100)]
[PATCH][GCC] arm: Fix MVE scalar shift intrinsics code-gen.

This patch modifies the MVE scalar shift RTL patterns. The current patterns
have wrong constraints and predicates due to which the values returned from
MVE scalar shift instructions are overwritten in the code-gen.

example:
$ cat x.c
int32_t  foo(int64_t acc, int shift)
{
  return sqrshrl_sat48 (acc, shift);
}

Code-gen before applying this patch:
$ arm-none-eabi-gcc -march=armv8.1-m.main+mve -mfloat-abi=hard -O2 -S
$  cat x.s
foo:
   push    {r4, r5}
   sqrshrl r0, r1, #48, r2   ----> (a)
   mov     r0, r4  ----> (b)
   pop     {r4, r5}
   bx      lr

Code-gen after applying this patch:
foo:
   sqrshrl r0, r1, #48, r2
   bx      lr

In the current compiler the return value (r0) from sqrshrl (a) is getting
overwritten by the mov statement (b).
This patch fixes above issue.

2020-06-12  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

gcc/
* config/arm/mve.md (mve_uqrshll_sat<supf>_di): Correct the predicate
and constraint of all the operands.
(mve_sqrshrl_sat<supf>_di): Likewise.
(mve_uqrshl_si): Likewise.
(mve_sqrshr_si): Likewise.
(mve_uqshll_di): Likewise.
(mve_urshrl_di): Likewise.
(mve_uqshl_si): Likewise.
(mve_urshr_si): Likewise.
(mve_sqshl_si): Likewise.
(mve_srshr_si): Likewise.
(mve_srshrl_di): Likewise.
(mve_sqshll_di): Likewise.
* config/arm/predicates.md (arm_low_register_operand): Define.

gcc/testsuite/
* gcc.target/arm/mve/intrinsics/mve_scalar_shifts1.c: New test.
* gcc.target/arm/mve/intrinsics/mve_scalar_shifts2.c: Likewise.
* gcc.target/arm/mve/intrinsics/mve_scalar_shifts3.c: Likewise.
* gcc.target/arm/mve/intrinsics/mve_scalar_shifts4.c: Likewise.

4 years agoopenmp: Initial part of OpenMP 5.0 non-rectangular loop support
Jakub Jelinek [Tue, 16 Jun 2020 14:31:13 +0000 (16:31 +0200)]
openmp: Initial part of OpenMP 5.0 non-rectangular loop support

OpenMP 5.0 adds support for non-rectangular loop collapses, e.g.
triangular and more complex.

This patch deals just with the diagnostics so that they aren't rejected
immediately as before.  As the spec generally requires as before that the
iteration variable initializer and bound in the comparison as invariant
vs. the outermost loop, and just add some exceptional forms that can violate
that, we need to avoid folding the expressions until we can detect them and
in order to avoid folding it later on, I chose to use a TREE_VEC in those
expressions to hold the var_outer * expr1 + expr2 triplet, the patch adds
pretty-printing of that, gimplification etc. and just sorry_at during
omp expansion for now.

The next step will be to implement the different cases of that one by one.

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

gcc/
* tree.h (OMP_FOR_NON_RECTANGULAR): Define.
* gimplify.c (gimplify_omp_for): Diagnose schedule, ordered
or dist_schedule clause on non-rectangular loops.  Handle
gimplification of non-rectangular lb/b expressions.  When changing
iteration variable, adjust also non-rectangular lb/b expressions
referencing that.
* omp-general.h (struct omp_for_data_loop): Add m1, m2 and outer
members.
(struct omp_for_data): Add non_rect member.
* omp-general.c (omp_extract_for_data): Handle non-rectangular
loops.  Fill in non_rect, m1, m2 and outer.
* omp-low.c (lower_omp_for): Handle non-rectangular lb/b expressions.
* omp-expand.c (expand_omp_for): Emit sorry_at for unsupported
non-rectangular loop cases and assert for cases that can't be
non-rectangular.
* tree-pretty-print.c (dump_mem_ref): Formatting fix.
(dump_omp_loop_non_rect_expr): New function.
(dump_generic_node): Handle non-rectangular OpenMP loops.
* tree-pretty-print.h (dump_omp_loop_non_rect_expr): Declare.
* gimple-pretty-print.c (dump_gimple_omp_for): Handle non-rectangular
OpenMP loops.
gcc/c-family/
* c-common.h (c_omp_check_loop_iv_exprs): Add an int argument.
* c-omp.c (struct c_omp_check_loop_iv_data): Add maybe_nonrect and
idx members.
(c_omp_is_loop_iterator): New function.
(c_omp_check_loop_iv_r): Use it.  Add support for silent scanning
if outer loop iterator is present.  Perform duplicate checking through
hash_set in the function rather than expecting caller to do that.
Pass NULL instead of d->ppset to walk_tree_1.
(c_omp_check_nonrect_loop_iv): New function.
(c_omp_check_loop_iv): Use it.  Fill in new members, allow
non-rectangular loop forms, diagnose multiple associated loops with
the same iterator.  Pass NULL instead of &pset to walk_tree_1.
(c_omp_check_loop_iv_exprs): Likewise.
gcc/c/
* c-parser.c (c_parser_expr_no_commas): Save, clear and restore
c_in_omp_for.
(c_parser_omp_for_loop): Set c_in_omp_for around some calls to avoid
premature c_fully_fold.  Defer explicit c_fully_fold calls to after
c_finish_omp_for.
* c-tree.h (c_in_omp_for): Declare.
* c-typeck.c (c_in_omp_for): Define.
(build_modify_expr): Avoid c_fully_fold if c_in_omp_for.
(digest_init): Likewise.
(build_binary_op): Likewise.
gcc/cp/
* semantics.c (handle_omp_for_class_iterator): Adjust
c_omp_check_loop_iv_exprs caller.
(finish_omp_for): Likewise.  Don't call fold_build_cleanup_point_expr
before calling c_finish_omp_for and c_omp_check_loop_iv, move it
after those calls.
* pt.c (tsubst_omp_for_iterator): Handle non-rectangular loops.
gcc/testsuite/
* c-c++-common/gomp/loop-6.c: New test.
* gcc.dg/gomp/loop-1.c: Don't expect diagnostics on valid
non-rectangular loops.
* gcc.dg/gomp/loop-2.c: New test.
* g++.dg/gomp/loop-1.C: Don't expect diagnostics on valid
non-rectangular loops.
* g++.dg/gomp/loop-2.C: Likewise.
* g++.dg/gomp/loop-5.C: New test.
* g++.dg/gomp/loop-6.C: New test.

4 years agoopenmp: Diagnose invalid OpenMP schedule(simd, static)
Jakub Jelinek [Tue, 16 Jun 2020 14:30:05 +0000 (16:30 +0200)]
openmp: Diagnose invalid OpenMP schedule(simd, static)

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

gcc/c/
* c-parser.c (c_parser_omp_clause_schedule): Reject modifier separated
from kind by comma rather than colon.
gcc/cp/
* parser.c (cp_parser_omp_clause_schedule): Reject modifier separated
from kind by comma rather than colon.
gcc/testsuite/
* c-c++-common/gomp/schedule-modifiers-2.c: New test.

4 years agotestsuite: Add offloading_enabled check and use it for xfail (PR95622)
Tobias Burnus [Tue, 16 Jun 2020 13:14:13 +0000 (15:14 +0200)]
testsuite: Add offloading_enabled check and use it for xfail (PR95622)

gcc/testsuite/ChangeLog:

PR middle-end/95622
* lib/target-supports.exp (check_effective_target_offloading_enabled):
New.
* c-c++-common/goacc/kernels-alias-ipa-pta-2.c: Use it for xfail.
* c-c++-common/goacc/kernels-alias-ipa-pta-4.c: Likewise.
* c-c++-common/goacc/kernels-alias-ipa-pta.c: Likewise.

Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>
4 years agoOpenMP/Fortran: Permit impure ELEMENTAL in omp directives
Tobias Burnus [Tue, 16 Jun 2020 13:11:12 +0000 (15:11 +0200)]
OpenMP/Fortran: Permit impure ELEMENTAL in omp directives

OpenMP since 4.5 permits IMPURE ELEMENTAL in directives and
the code already only checked for PURE.

gcc/fortran/ChangeLog:

* parse.c (decode_omp_directive): Remove "or ELEMENTAL"
from "in PURE" error message.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/pr79154-1.f90: Update dg-*;
add an impure elemental example.
* gfortran.dg/gomp/pr79154-2.f90: Likewise.

4 years ago[Ada] Expand 'Pos and 'Val for enumeration types with standard representation
Eric Botcazou [Thu, 9 Apr 2020 09:42:22 +0000 (11:42 +0200)]
[Ada] Expand 'Pos and 'Val for enumeration types with standard representation

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

gcc/ada/

* sinfo.ads (Conversion_OK): Document use for 'Pos and 'Val.
* exp_attr.adb (Get_Integer_Type): New function returning a
small integer type appropriate for an enumeration type.
(Expand_N_Attribute_Reference) <Attribute_Enum_Rep>: Call it.
<Attribute_Pos>: For an enumeration type with a standard
representation, expand to a conversion with Conversion_OK.
<Attribute_Val>: Likewise.
* exp_ch4.adb (Expand_N_Type_Conversion): Do not expand when
the target is an enumeration type and Conversion_OK is set.

4 years ago[Ada] Fix spurious error on derived private type with predicate
Eric Botcazou [Thu, 9 Apr 2020 10:56:01 +0000 (12:56 +0200)]
[Ada] Fix spurious error on derived private type with predicate

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

gcc/ada/

* sem_ch4.adb (Common_Type): Go to Underlying_Full_View, if any.

4 years ago[Ada] Change how we detect internal protected subprograms
Richard Kenner [Tue, 7 Apr 2020 20:15:59 +0000 (16:15 -0400)]
[Ada] Change how we detect internal protected subprograms

2020-06-16  Richard Kenner  <kenner@adacore.com>

gcc/ada/

* exp_unst.adb (Subp_Index): Change way we detect internal
protected subprograms.

4 years ago[Ada] Improve bug box customer language
Richard Kenner [Tue, 7 Apr 2020 20:12:29 +0000 (16:12 -0400)]
[Ada] Improve bug box customer language

2020-06-16  Richard Kenner  <kenner@adacore.com>

gcc/ada/

* comperr.adb (Compiler_Abort): Clarify message displayed to
customers.

4 years ago[Ada] Minor casing of " The " after a comma in docs and comments
Piotr Trojanek [Wed, 8 Apr 2020 21:01:13 +0000 (23:01 +0200)]
[Ada] Minor casing of " The " after a comma in docs and comments

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

gcc/ada/

* checks.adb, doc/gnat_ugn/the_gnat_compilation_model.rst,
einfo.ads, exp_ch5.adb, exp_ch7.adb, lib-xref.ads,
libgnat/g-spitbo.ads, make.adb, sem_aux.adb, sem_ch3.adb,
sem_ch4.adb, sem_ch5.adb, urealp.adb: Fix wrong casing.
* gnat_ugn.texi: Regenerate.

4 years ago[Ada] Reuse Is_Object where possible
Piotr Trojanek [Fri, 3 Apr 2020 15:23:03 +0000 (17:23 +0200)]
[Ada] Reuse Is_Object where possible

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

gcc/ada/

* einfo.adb, exp_spark.adb, exp_util.adb, sem_eval.adb: Replace
"Ekind ... in Object_Kind" with "Is_Object (...)".

4 years ago[Ada] Fix typo in comment about overlapping actuals
Piotr Trojanek [Wed, 8 Apr 2020 08:56:44 +0000 (10:56 +0200)]
[Ada] Fix typo in comment about overlapping actuals

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

gcc/ada/

* sem_warn.adb (Warn_On_Overlapping_Actuals): Fix typo in
comment.

4 years ago[Ada] Force evaluation of qualified aggregates
Piotr Trojanek [Sun, 5 Apr 2020 15:07:00 +0000 (17:07 +0200)]
[Ada] Force evaluation of qualified aggregates

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

gcc/ada/

* exp_util.adb (Evaluate_Name): Force evaluation of aggregates;
recursively evaluate expression of a qualified expression; fix
location of the comment for an attribute referenced and an
indexed component.

4 years ago[Ada] Couple of formatting and stylistic fixes
Eric Botcazou [Wed, 8 Apr 2020 07:49:01 +0000 (09:49 +0200)]
[Ada] Couple of formatting and stylistic fixes

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

gcc/ada/

* freeze.adb (Freeze_Expression): Use consistent style and
formatting in a couple of cases.

4 years ago[Ada] Enable literal aspect specifications in Big_Numbers specs
Steve Baird [Tue, 7 Apr 2020 23:03:52 +0000 (16:03 -0700)]
[Ada] Enable literal aspect specifications in Big_Numbers specs

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

gcc/ada/

* libgnat/a-nbnbin.ads, libgnat/a-nbnbre.ads: Uncomment the
commented-out Integer_Literal aspect specification for type
Big_Integer.

4 years ago[Ada] Crash in tagged type constructor with task components
Javier Miranda [Wed, 8 Apr 2020 13:43:58 +0000 (09:43 -0400)]
[Ada] Crash in tagged type constructor with task components

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

gcc/ada/

* exp_ch6.adb (BIP_Suffix_Kind, Check_BIP_Actuals,
Is_Build_In_Place_Entity): New subprograms.
(Make_Build_In_Place_Call_In_Allocator,
Make_Build_In_Place_Call_In_Anonymous_Context,
Make_Build_In_Place_Call_In_Assignment,
Make_Build_In_Place_Call_In_Object_Declaration): Add assertions.
(Needs_BIP_Task_Actuals): Add missing support for thunks.
(Expand_Actuals): Ensure that the BIP call has available an
activation chain and the _master variable.
* exp_ch9.adb (Find_Enclosing_Context): Initialize the list of
declarations of empty blocks when the _master variable must be
declared and the list was not available.

4 years ago[Ada] Declare expressions
Bob Duff [Mon, 6 Apr 2020 20:35:31 +0000 (16:35 -0400)]
[Ada] Declare expressions

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

gcc/ada/

* par-ch4.adb (P_Case_Expression): Move to be local.
(P_Declare_Expression): New parsing routine.
(P_Unparen_Cond_Expr_Etc): New name for
P_Unparen_Cond_Case_Quant_Expression which was missing one case
in its name (iterated component association), and we're adding a
new case (declare expression), so lets use "Etc" instead of
trying to pack all those things into the name.  Add call to
P_Declare_Expression, and check for missing parens.
(P_Expression_If_OK, P_Expression_Or_Range_Attribute_If_OK): Add
Tok_Declare.
* par.adb (P_Basic_Declarative_Items): Add parameter
Declare_Expression so we can tailor the error message about
incorrect bodies.
(P_Case_Expression): Move to body.
* par-ch3.adb (P_Basic_Declarative_Items): Tailor the error
message about incorrect bodies.
* par-ch7.adb (P_Package): Pass Declare_Expression => False to
P_Basic_Declarative_Items.
* sem.ads (In_Declare_Expr): Counter used to determine whether
we are analyzing a declare_expression. Needed to give errors
about things that are not allowed in declare_expression, such as
the 'Access attribute.
* sem.adb (Do_Analyze): Save/restore In_Declare_Expr.
* sem_ch4.adb (Analyze_Expression_With_Actions): Give this node
its own scope.  That seems better in general, but it is
necessary for declare_expressions.  For example, an identifier
declared in a declare_expression should not clash with the same
identifier in an outer scope.  If this is a declare_expression,
indicated by Comes_From_Source, then check legality rules, and
incr/decr In_Declare_Expr.
* sem_aggr.adb (Resolve_Aggregate): Allow an applicable index
constraint for a declare_expression, so if its expression is an
array aggregate, it can have "others => ...".
* sem_attr.adb (Analyze_Access_Attribute): Disallow these
attributes in declare_expressions. Add comment to make it clear
that Unrestricted_Access is included.
* sinfo.ads, sinfo.adb, atree.ads, atree.adb: Remove the
now-incorrect comment in sinfo.ads that says
N_Expression_With_Actions has no proper scope.  Add 17-parameter
versions of Nkind_In.  Remove the 16-parameter versions of
Nkind_In.

4 years ago[Ada] ACATS C452005/C452006 memberships use wrong equality operation
Arnaud Charlet [Tue, 7 Apr 2020 15:05:59 +0000 (11:05 -0400)]
[Ada] ACATS C452005/C452006 memberships use wrong equality operation

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

gcc/ada/

* sem_aux.ads, sem_aux.adb (Is_Record_Or_Limited_Type): New
function.
* exp_ch4.adb, sem_ch4.adb (Analyze_Membership_Op,
Expand_Set_Membership.Make_Cond): Choose between primitive and
predefined equality for membership tests.

4 years ago[Ada] Implement AI12-0216 on restricting overlap errors in calls
Ed Schonberg [Tue, 7 Apr 2020 18:16:14 +0000 (14:16 -0400)]
[Ada] Implement AI12-0216 on restricting overlap errors in calls

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

gcc/ada/

* sem_warn.adb (Warn_On_Overlapping_Actuals): Simplify code and
implement AI12-0216 which clarifies the conditions under which
overlapping actuals in a call are illegal. If proper warnings
are enabled, GNAT also emits warnings in legal cases of
overlopping actuals.

4 years ago[Ada] Fix premature freezing of artificial array subtype
Eric Botcazou [Tue, 7 Apr 2020 07:39:06 +0000 (09:39 +0200)]
[Ada] Fix premature freezing of artificial array subtype

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

gcc/ada/

* freeze.adb (Freeze_Expression): Stop climbing the parent chain
at a N_{Case,If}_Expression node for a type or an entity that
does not come from source.

4 years ago[Ada] Implement AI12-0249, AI12-0295 (user-defined numeric & string literals)
Steve Baird [Sat, 4 Apr 2020 00:34:38 +0000 (17:34 -0700)]
[Ada] Implement AI12-0249, AI12-0295 (user-defined numeric & string literals)

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

gcc/ada/

* snames.ads-tmpl: Define names of the three new aspects.
* aspects.ads: Define the three new aspects.
* sem_util.ads, sem_util.adb, sem_dim.adb: Move the function
String_From_Numeric_Literal from being declared in the body of
package Sem_Dim to being declared in the visible part of package
Sem_Util.
* sem_ch13.ads, sem_ch13.adb: Declare new visible procedure
Validate_Literal_Aspect. This is where most of the legality
checking occurs for an aspect specification for one of the three
new aspects, as well as resolution of the subprogram named in
the aspect specification. Follow example of other aspects (e.g.,
Validate_Literal_Aspect is called in much the same way as
Validate_Iterable_Aspect in Analyze_Aspects_At_Freeze_Point; a
small amount of legality checking is performed in
Analyze_One_Aspect in much the same way as for Default_Value or
Default_Component_Value aspects). Most of the work is done in
Validate_Literal_Aspect.
* contracts.adb (Add_Contract_Item): Call
Validate_Literal_Aspect in much the same way that
Validate_Iterable_Aspect was already being called.
* sem_res.adb (Resolve): Rewrite a literal as a call if it is a
user-defined literal.  This is where the dynamic semantics of
the 3 new aspects are implemented.
* sem_ch6.adb (Fully_Conformant_Expressions): Two numeric
literals that have different text but the same value (e.g.,
12345 and 12_345) do not conform if they are user-defined
literals. Introduce a new function
User_Defined_Numeric_Literal_Mismatch to avoid duplication in
making this check.
* sem_type.adb (Has_Compatible_Type): A numeric literal can be
compatible with a non-numeric type (and a string literal can be
compatible with a non-string type) if it can be interpreted as a
user-defined literal.

4 years ago[Ada] ACATS 4.1P - C432003 - Errors missed on extension aggregates
Arnaud Charlet [Tue, 7 Apr 2020 09:22:52 +0000 (05:22 -0400)]
[Ada] ACATS 4.1P - C432003 - Errors missed on extension aggregates

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

gcc/ada/

* sem_aggr.adb (Resolve_Extension_Aggregate): Fix implementation
of AI05-0115 by checking the correct type.

4 years ago[Ada] ACATS 4.1P - BC55001 - Error missed
Arnaud Charlet [Mon, 6 Apr 2020 12:33:13 +0000 (08:33 -0400)]
[Ada] ACATS 4.1P - BC55001 - Error missed

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

gcc/ada/

* sem_ch6.adb (Analyze_Subprogram_Specification): Generate error
message for functions returning interfaces.

4 years ago[Ada] Fix assertion failure on qualified type names in predicates
Piotr Trojanek [Mon, 6 Apr 2020 12:52:27 +0000 (14:52 +0200)]
[Ada] Fix assertion failure on qualified type names in predicates

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

gcc/ada/

* sem_ch13.adb (Membership_Entry): Relax assertion to also
recognize qualified identifiers.

4 years ago[Ada] Force evaluation of operator calls in renamings
Piotr Trojanek [Sun, 5 Apr 2020 21:37:18 +0000 (23:37 +0200)]
[Ada] Force evaluation of operator calls in renamings

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

gcc/ada/

* exp_util.adb (Evaluate_Name): Force evaluation of operators.

4 years ago[Ada] ACATS 4.1K - B452001 - No errors detected
Arnaud Charlet [Fri, 3 Apr 2020 10:10:22 +0000 (06:10 -0400)]
[Ada] ACATS 4.1K - B452001 - No errors detected

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

gcc/ada/

* sem_ch4.adb (Analyze_Membership_Op): Reset entity of equality
nodes for membership tests with singletons.
(Analyze_User_Defined_Binary_Op): Always perform the analysis
since nodes coming from the expander also may refer to non
standard operators as part of membership expansion.
* exp_ch4.adb (Expand_Set_Membership.Make_Cond): Reset entity of
equality node.
* sem_type.ads: Fix typo in comment.

4 years ago[Ada] Check if attribute Passed_By_Reference is called on incomplete types
Ghjuvan Lacambre [Fri, 3 Apr 2020 14:57:40 +0000 (16:57 +0200)]
[Ada] Check if attribute Passed_By_Reference is called on incomplete types

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

gcc/ada/

* sem_attr.adb (Analyze_Attribute): Add
Check_Not_Incomplete_Type call.

4 years ago[Ada] Fix two typos
Gary Dismukes [Fri, 3 Apr 2020 18:19:43 +0000 (14:19 -0400)]
[Ada] Fix two typos

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

gcc/ada/

* sem_ch6.adb: Add closing paren in a comment.
* sem_util.adb: Correct comment typo (aggreate => aggregate).

4 years ago[Ada] Crash in tagged type constructor with task components
Javier Miranda [Sat, 4 Apr 2020 18:21:40 +0000 (14:21 -0400)]
[Ada] Crash in tagged type constructor with task components

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

gcc/ada/

* sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings):
Code cleanup.

4 years ago[Ada] Fix small fallout of freezing change for expression functions
Eric Botcazou [Sun, 5 Apr 2020 08:25:44 +0000 (10:25 +0200)]
[Ada] Fix small fallout of freezing change for expression functions

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

gcc/ada/

* freeze.adb (In_Expanded_Body): Remove unreachable code.
(Freeze_Expression): Rename a couple of local variables.
In the case of an expanded body, also freeze locally the
entities declared in a nested block.

4 years ago[Ada] Fix spurious error on implicit dereference for private type
Eric Botcazou [Fri, 3 Apr 2020 21:34:07 +0000 (23:34 +0200)]
[Ada] Fix spurious error on implicit dereference for private type

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

gcc/ada/

* sem_ch4.adb (Transform_Object_Operation): Document that it
may be partially destructive for the parent of the node.
(Try_Object_Operation): Undo the changes made above on failure.

4 years ago[Ada] Crash in tagged type constructor with task components
Javier Miranda [Fri, 3 Apr 2020 21:29:48 +0000 (17:29 -0400)]
[Ada] Crash in tagged type constructor with task components

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

gcc/ada/

* restrict.adb (Global_No_Tasking): Adding
Targparm.Restrictions_On_Target Fixes regressions with zfp.

4 years ago[Ada] Spurious undefined symbol with nested call to expression function
Ed Schonberg [Thu, 2 Apr 2020 20:47:17 +0000 (16:47 -0400)]
[Ada] Spurious undefined symbol with nested call to expression function

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

gcc/ada/

* freeze.adb: (Freeze_Expression, In_Expanded_Body): Treat the
generated body of an expression function like other bodies
generated during expansion (e.g. stream subprograms) so that
those bodies are not treated as freezing points. Handle properly
other global references in such completions.

4 years ago[Ada] Accept renamings of folded string aggregates
Piotr Trojanek [Fri, 3 Apr 2020 09:36:55 +0000 (11:36 +0200)]
[Ada] Accept renamings of folded string aggregates

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

gcc/ada/

* sem_ch8.adb (Analyze_Object_Renaming): Remove trivially
useless initialization of Is_Object_Reference.
* sem_util.adb (Is_Object_Reference): Simplify detection of
binary and unary operators; literally implement rules about
aggregates and qualified expressions; recognize string literals
as object references.

4 years ago[Ada] Implement AI12-0351 Matching for actuals for formal derived types
Eric Botcazou [Fri, 3 Apr 2020 10:37:45 +0000 (12:37 +0200)]
[Ada] Implement AI12-0351 Matching for actuals for formal derived types

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

gcc/ada/

* sem_ch12.adb (Validate_Derived_Type_Instance): Reword error
message for 12.5.1(8) subclause and add secondary message if
the incompatibility comes from the predicates.
* sem_ch3.adb (Check_Constraining_Discriminant): New procedure
to give the error required by the 3.7(15) subclause.  Mention
"statically" in the error message and add secondary message
if the incompatibility comes from the predicates.
(Build_Derived_Concurrent_Type): Call it when a new discriminant
constrains an old one.
(Build_Derived_Record_Type): Likewise.
* sem_eval.ads (Predicates_Compatible): Declare.
* sem_eval.adb (Predicates_Compatible): New function to implement
the compatibility of predicates specified by the 4.9.1 clause.
(Subtypes_Statically_Compatible): Call it.

4 years agoc++: TI_DEFERRED_ACCESS_CHECKS and dependent decls
Patrick Palka [Tue, 16 Jun 2020 12:51:34 +0000 (08:51 -0400)]
c++: TI_DEFERRED_ACCESS_CHECKS and dependent decls

This adds an assert to enforce_access to verify that we don't defer
access checks of dependent decls -- we should instead be rechecking the
access of such a decl after tsubst'ing into the user of the decl.

gcc/cp/ChangeLog:

* pt.c (perform_instantiation_time_access_checks): No need to
tsubst into decl.
* semantics.c (enforce_access): Verify that decl is not
dependent.

4 years agoc++: Clean up previous change [PR41437]
Patrick Palka [Tue, 16 Jun 2020 12:21:36 +0000 (08:21 -0400)]
c++: Clean up previous change [PR41437]

The previous patch mostly avoided making any changes that had no
functional impact, such as adjusting now-outdated comments and
performing renamings.  Such changes have been consolidated to this
followup patch for easier review.

The main change here is that we now reuse struct deferred_access_check
as the element type of the vector TI_TYPEDEFS_NEEDING_ACCESS_CHECKING
(now renamed to TI_DEFERRED_ACCESS_CHECKS, since it may contain any kind
of access check).

gcc/cp/ChangeLog:

PR c++/41437
PR c++/47346
* cp-tree.h (qualified_typedef_usage_s): Delete.
(qualified_typedef_usage_t): Delete.
(deferred_access_check): Move up in file.
(tree_template_info::typedefs_needing_access_checking): Delete.
(tree_template_info::deferred_access_checks): New field.
(TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Rename to ...
(TI_DEFERRED_ACCESS_CHECKS): ... this, and adjust accordingly.
* pt.c (perform_typedefs_access_check): Rename to ...
(perform_instantiation_time_access_checks): ... this, and adjust
accordingly.  Remove unnecessary tree tests.
(instantiate_class_template_1): Adjust accordingly.
(instantiate_decl): Likewise.
* semantics.c (enforce_access): Likewise.

4 years agoc++: Improve access checking inside templates [PR41437]
Patrick Palka [Tue, 16 Jun 2020 12:21:33 +0000 (08:21 -0400)]
c++: Improve access checking inside templates [PR41437]

This patch generalizes our existing functionality for deferring access
checking of typedefs when parsing a function or class template to now
defer all kinds of access checks until template instantiation time,
including member function and member object accesses.

Since all access checks eventually go through enforce_access, the main
component of this patch is new handling inside enforce_access to defer
the current access check if we're inside a template.  The bulk of the
rest of the patch consists of removing now-unneeded code pertaining to
suppressing access checks inside templates or pertaining to
typedef-specific access handling.  Renamings and other changes with no
functional impact have been split off into the followup patch.

gcc/cp/ChangeLog:

PR c++/41437
PR c++/47346
* call.c (enforce_access): Move to semantics.c.
* cp-tree.h (enforce_access): Delete.
(get_types_needing_access_check): Delete.
(add_typedef_to_current_template_for_access_check): Delete.
* decl.c (make_typename_type): Adjust accordingly.  Use
check_accessibility_of_qualified_id instead of directly using
perform_or_defer_access_check.
* parser.c (cp_parser_template_declaration_after_parameters):
Don't push a dk_no_check access state when parsing a template.
* pt.c (get_types_needing_access_check): Delete.
(append_type_to_template_for_access_check_1): Delete.
(perform_typedefs_access_check): Adjust.  If type_decl is a
FIELD_DECL, also check its DECL_CONTEXT for dependence. Use
tsubst_copy instead of tsubst to substitute into type_decl so
that we substitute into the DECL_CONTEXT of a FIELD_DECL.
(append_type_to_template_for_access_check): Delete.
* search.c (accessible_p): Remove the processing_template_decl
early exit.
* semantics.c (enforce_access): Moved from call.c.  If we're
parsing a template and the access check failed, add the check to
TI_TYPEDEFS_NEEDING_ACCESS_CHECKING.
(perform_or_defer_access_check): Adjust comment.
(add_typedef_to_current_template_for_access_check): Delete.
(check_accessibility_of_qualified_id):  Adjust accordingly.
Exit early if the scope is dependent.

gcc/testsuite/ChangeLog:

PR c++/41437
PR c++/47346
* g++.dg/cpp2a/concepts-using2.C: Adjust.
* g++.dg/lto/20081219_1.C: Adjust.
* g++.dg/lto/20091002-1_0.C: Adjust.
* g++.dg/lto/pr65475c_0.C: Adjust.
* g++.dg/opt/dump1.C: Adjust.
* g++.dg/other/pr53574.C: Adjust.
* g++.dg/template/access30.C: New test.
* g++.dg/template/access31.C: New test.
* g++.dg/wrappers/wrapper-around-type-pack-expansion.C: Adjust.

libstdc++-v3/ChangeLog:

PR libstdc++/94003
* testsuite/20_util/is_constructible/94003.cc: New test.

4 years agomiddle-end/95690 - avoid MEM_EXPRs for constants
Richard Biener [Tue, 16 Jun 2020 07:36:09 +0000 (09:36 +0200)]
middle-end/95690 - avoid MEM_EXPRs for constants

The following avoids calling set_mem_attributes on the
DECL_INITIAL of a CONST_DECL which seems pointless since there
cannot be a sensible MEM_EXPR derived from that.  We're overwriting
both other possibly useful info, alias-set and alignment immediately
so the following patch simply removes the call instead of making
the function deal with even more (unexpected) trees that are not
memory accesses.

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

PR middle-end/95690
* varasm.c (build_constant_desc): Remove set_mem_attributes call.

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

4 years agoUn-XFAIL 'gcc.dg/graphite/pr80906.c'
Thomas Schwinge [Sat, 6 Jun 2020 16:23:28 +0000 (18:23 +0200)]
Un-XFAIL 'gcc.dg/graphite/pr80906.c'

The recent commit b6ff3ddecfa93d53867afaaa078f85fc848abbbd
"tree-optimization/94988 - enhance SM some more" fixed this.

gcc/testsuite/
PR tree-optimization/94988
* gcc.dg/graphite/pr80906.c: Un-XFAIL.

4 years agoFurther adjust 'dg-lto-options' in 'gcc.dg/lto/pr52634'
Thomas Schwinge [Sat, 6 Jun 2020 11:50:24 +0000 (13:50 +0200)]
Further adjust 'dg-lto-options' in 'gcc.dg/lto/pr52634'

The recent commit f8a4141bae53f9125d374e5873dcda3f75392f1f "Fix various dg
directives" corrected the imbalanced curly braces in 'dg-lto-options', which
changes the testing as follows:

    -PASS: gcc.dg/lto/pr52634 c_lto_pr52634_0.o assemble, -O0 -flto -flto-partition=none -fuse-linker-plugin
    -PASS: gcc.dg/lto/pr52634 c_lto_pr52634_1.o assemble, -O0 -flto -flto-partition=none -fuse-linker-plugin
    -PASS: gcc.dg/lto/pr52634 c_lto_pr52634_0.o-c_lto_pr52634_1.o link, -O0 -flto -flto-partition=none -fuse-linker-plugin
    -PASS: gcc.dg/lto/pr52634 c_lto_pr52634_0.o assemble, -O2 -flto -flto-partition=none -fuse-linker-plugin -fno-fat-lto-objects
    -PASS: gcc.dg/lto/pr52634 c_lto_pr52634_1.o assemble, -O2 -flto -flto-partition=none -fuse-linker-plugin -fno-fat-lto-objects
    -PASS: gcc.dg/lto/pr52634 c_lto_pr52634_0.o-c_lto_pr52634_1.o link, -O2 -flto -flto-partition=none -fuse-linker-plugin -fno-fat-lto-objects
    -PASS: gcc.dg/lto/pr52634 c_lto_pr52634_0.o assemble, -O0 -flto -flto-partition=1to1 -fno-use-linker-plugin
    -PASS: gcc.dg/lto/pr52634 c_lto_pr52634_1.o assemble, -O0 -flto -flto-partition=1to1 -fno-use-linker-plugin
    -PASS: gcc.dg/lto/pr52634 c_lto_pr52634_0.o-c_lto_pr52634_1.o link, -O0 -flto -flto-partition=1to1 -fno-use-linker-plugin
    -PASS: gcc.dg/lto/pr52634 c_lto_pr52634_0.o assemble, -O2 -flto -flto-partition=1to1 -fno-use-linker-plugin
    -PASS: gcc.dg/lto/pr52634 c_lto_pr52634_1.o assemble, -O2 -flto -flto-partition=1to1 -fno-use-linker-plugin
    -PASS: gcc.dg/lto/pr52634 c_lto_pr52634_0.o-c_lto_pr52634_1.o link, -O2 -flto -flto-partition=1to1 -fno-use-linker-plugin
    -PASS: gcc.dg/lto/pr52634 c_lto_pr52634_0.o assemble, -O0 -flto -fuse-linker-plugin -fno-fat-lto-objects
    -PASS: gcc.dg/lto/pr52634 c_lto_pr52634_1.o assemble, -O0 -flto -fuse-linker-plugin -fno-fat-lto-objects
    -PASS: gcc.dg/lto/pr52634 c_lto_pr52634_0.o-c_lto_pr52634_1.o link, -O0 -flto -fuse-linker-plugin -fno-fat-lto-objects
    -PASS: gcc.dg/lto/pr52634 c_lto_pr52634_0.o assemble, -O2 -flto -fuse-linker-plugin
    -PASS: gcc.dg/lto/pr52634 c_lto_pr52634_1.o assemble, -O2 -flto -fuse-linker-plugin
    -PASS: gcc.dg/lto/pr52634 c_lto_pr52634_0.o-c_lto_pr52634_1.o link, -O2 -flto -fuse-linker-plugin
    +PASS: gcc.dg/lto/pr52634 c_lto_pr52634_0.o assemble, -flto
    +PASS: gcc.dg/lto/pr52634 c_lto_pr52634_1.o assemble, -flto
    +PASS: gcc.dg/lto/pr52634 c_lto_pr52634_0.o-c_lto_pr52634_1.o link, -flto
    +PASS: gcc.dg/lto/pr52634 c_lto_pr52634_0.o assemble, -r
    +PASS: gcc.dg/lto/pr52634 c_lto_pr52634_1.o assemble, -r
    +PASS: gcc.dg/lto/pr52634 c_lto_pr52634_0.o-c_lto_pr52634_1.o link, -r
    +PASS: gcc.dg/lto/pr52634 c_lto_pr52634_0.o assemble, -flto-partition=1to1
    +PASS: gcc.dg/lto/pr52634 c_lto_pr52634_1.o assemble, -flto-partition=1to1
    +PASS: gcc.dg/lto/pr52634 c_lto_pr52634_0.o-c_lto_pr52634_1.o link, -flto-partition=1to1

I however assume the original idea however has not been to run variants
'-flto', '-r', '-flto-partition=1to1' individually, but rather to run one
variant '-flto -r -flto-partition=1to1'.

gcc/testsuite/
* gcc.dg/lto/pr52634_0.c: Further adjust 'dg-lto-options'.

4 years agoRISC-V: Fix ICE on riscv_gpr_save_operation_p [PR95683]
Kito Cheng [Tue, 16 Jun 2020 02:14:13 +0000 (10:14 +0800)]
RISC-V: Fix ICE on riscv_gpr_save_operation_p [PR95683]

 - riscv_gpr_save_operation_p might try to match parallel on other
   patterns like inline asm pattern, and then it might trigger ther
   assertion checking there, so we could trun it into a early exit check.

gcc/ChangeLog:

PR target/95683
* config/riscv/riscv.c (riscv_gpr_save_operation_p): Remove
assertion and turn it into a early exit check.

gcc/testsuite/ChangeLog

PR target/95683
* gcc.target/riscv/pr95683.c: New.

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

4 years agogcc/jit: Rename libgccjit.dll to libgccjit-0.dll.
Nicolas Bertolo [Tue, 9 Jun 2020 14:37:51 +0000 (11:37 -0300)]
gcc/jit: Rename libgccjit.dll to libgccjit-0.dll.

2020-06-09  Nicolas BĂ©rtolo  <nicolasbertolo@gmail.com>

* Make-lang.in: Always define version, minor and release
numbers. Create the Windows shared library as
libgccjit-$(LIBGCCJIT_VERSION_NUM).dll.

4 years agolibgo: update x/sys/cpu to add all GOARCHes supported by gccgo
Tobias Klauser [Mon, 15 Jun 2020 19:49:13 +0000 (21:49 +0200)]
libgo: update x/sys/cpu to add all GOARCHes supported by gccgo

CL 237897 added additional GOARCHes supported by gccgo to x/sys/cpu.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/238038

4 years agointernal/syscall/unix: use getrandom_linux_generic.go on riscv
Tobias Klauser [Mon, 15 Jun 2020 11:57:39 +0000 (13:57 +0200)]
internal/syscall/unix: use getrandom_linux_generic.go on riscv

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/237899

4 years agoOptimize assignment to volatile aggregate variable
Eric Botcazou [Mon, 15 Jun 2020 17:56:00 +0000 (19:56 +0200)]
Optimize assignment to volatile aggregate variable

gimplify_modify_expr_rhs has an optimization whereby the assignment to
an aggregate variable from a read-only object with a DECL_INITIAL is
optimized into the direct assignment of the DECL_INITIAL, provided that
no temporary is created in the process.

The optimization is blocked if the read-only object is volatile, which
is OK as per the semantics of volatile, but also if the target variable
is volatile, on the grounds that the modified assignment might end up
being done on a per field basis, which is also OK.  But this latter
restriction is enforced a priori and there are cases where the modified
assignment would be OK, for example if there is only one field or the
DECL_INITIAL is equivalent to the empty CONSTRUCTOR, i.e. all zeros.

So, in the latter case, the patch changes gimplify_modify_expr_rhs to ask
gimplify_init_constructor whether the assignment would be done as a block,
which is easy because gimplify_init_constructor knows that it must create
a temporary if the LHS is volatile and this would not be the case, so it's
just a matter of completing the NOTIFY_TEMP_CREATION mechanism.

gcc/ChangeLog
* gimplify.c (gimplify_init_constructor) <AGGREGATE_TYPE>: Declare
new ENSURE_SINGLE_ACCESS constant and move variables down.  If it is
true and all elements are zero, then always clear.  Return GS_ERROR
if a temporary would be created for it and NOTIFY_TEMP_CREATION set.
(gimplify_modify_expr_rhs) <VAR_DECL>: If the target is volatile but
the type is aggregate non-addressable, ask gimplify_init_constructor
whether it can generate a single access to the target.

gcc/testsuite/ChangeLog
* gnat.dg/aggr30.ads, gnat.dg/aggr30.adb: New test.

4 years agoFix ICE in verify_sra_access_forest
Eric Botcazou [Mon, 15 Jun 2020 17:42:11 +0000 (19:42 +0200)]
Fix ICE in verify_sra_access_forest

This fixes an issue with reverse storage order in SRA, which is caught
by the built-in verifier in verify_sra_access_forest.  The problem is
that propagate_subaccesses_from_rhs changes the type of an access
from aggregate to scalar and, as discussed elsewhere, this must be
done with extra care in the presence of reverse storage order.

gcc/ChangeLog
* tree-sra.c (propagate_subaccesses_from_rhs): When a non-scalar
access on the LHS is replaced with a scalar access, propagate the
TYPE_REVERSE_STORAGE_ORDER flag of the type of the original access.

gcc/testsuite/ChangeLog
* gnat.dg/opt85.ads, gnat.dg/opt85.adb: New test.

4 years agolibstdc++: Update value of __cpp_lib_constexpr_char_traits for C++20
Jonathan Wakely [Mon, 15 Jun 2020 13:31:26 +0000 (14:31 +0100)]
libstdc++: Update value of __cpp_lib_constexpr_char_traits for C++20

Although not required by SD-6 or the C++20 draft, we define the macro
__cpp_lib_constexpr_char_traits to indicate support for P0432R1. This
updates the value in C++20 mode for the P1032R1 changes to char_traits.

* include/bits/char_traits.h (__cpp_lib_constexpr_char_traits):
Update value for C++20.
* include/std/version (__cpp_lib_constexpr_char_traits): Likewise.
* testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc:
Update expected value.
* testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc:
Likewise.