2019-07-09 Michael Meissner <meissner@linux.ibm.com>
* config/rs6000/rs6000-internal.h (create_TOC_reference): Delete.
* config/rs6000/rs6000-logue.c (create_TOC_reference): Move
function from rs6000-logue.c back to rs6000.c.
* config/rs6000/rs6000.c (create_TOC_reference): Likewise.
Martin Sebor [Tue, 9 Jul 2019 16:36:00 +0000 (16:36 +0000)]
PR c++/61339 - add mismatch between struct and class [-Wmismatched-tags] to non-bugs
gcc/c/ChangeLog:
PR c++/61339
* c-decl.c: Change class-key from class to struct and vice versa
to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod.
* gimple-parser.c: Same.
gcc/c-family/ChangeLog:
PR c++/61339
* c-format.c (check_argument_type): Change class-key from class to
struct and vice versa to match convention and avoid -Wclass-is-pod
and -Wstruct-no-pod.
* c-pretty-print.h: Same.
gcc/cp/ChangeLog:
PR c++/61339
* constexpr.c (cxx_eval_call_expression): Change class-key from class
to struct and vice versa to match convention and avoid -Wclass-is-pod
and -Wstruct-no-pod.
* constraint.cc (get_concept_definition): Same.
* cp-tree.h: Same.
* cxx-pretty-print.h: Same.
* error.c: Same.
* logic.cc (term_list::replace): Same.
* name-lookup.c (find_local_binding): Same.
* pt.c (tsubst_binary_right_fold): Same.
* search.c (field_accessor_p): Same.
* semantics.c (expand_or_defer_fn): Same.
gcc/lto/ChangeLog:
PR c++/61339
* lto-dump.c: Change class-key from classi to struct and vice versa
to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod.
Sylvia Taylor [Tue, 9 Jul 2019 12:51:55 +0000 (12:51 +0000)]
[aarch64]: redefine aes patterns
This first patch removes aarch64 usage of the aese/aesmc and aesd/aesimc
fusions (i.e. aes fusion) implemented in the scheduler due to unpredictable
behaviour observed in cases such as:
- when register allocation goes bad (e.g. extra movs)
- aes operations with xor and zeroed keys among interleaved operations
A more stable version should be provided by instead doing the aes fusion
during the combine pass. Since the aese and aesd patterns have been
rewritten as encapsulating a xor operation, the existing combine fusion
patterns have also been updated. The purpose is to simplify the need of
having additional combine patterns for cases like the ones below:
For AESE (though it also applies to AESD as both have a xor operation):
data = data ^ key;
data = vaeseq_u8(data, zero);
---
eor v1.16b, v0.16b, v1.16b
aese v1.16b, v2.16b
Should mean and generate the same as:
data = vaeseq_u8(data, key);
---
aese v1.16b, v0.16b
2019-07-09 Sylvia Taylor <sylvia.taylor@arm.com>
* config/aarch64/aarch64-simd.md
(aarch64_crypto_aes<aes_op>v16qi): Redefine pattern with xor.
(aarch64_crypto_aes<aesmc_op>v16qi): Remove attribute enabled.
(*aarch64_crypto_aes<aes_op>v16qi_xor_combine): Remove both.
(*aarch64_crypto_aese_fused,
*aarch64_crypto_aesd_fused): Update to new definition.
* config/aarch64/aarch64.c
(aarch_macro_fusion_pair_p): Remove aese/aesmc fusion check.
* gcc.target/aarch64/crypto-fuse-1.c: Remove.
* gcc.target/aarch64/crypto-fuse-2.c: Remove.
* gcc.target/aarch64/aes-fuse-1.c: New testcase.
* gcc.target/aarch64/aes-fuse-2.c: New testcase.
Sylvia Taylor [Tue, 9 Jul 2019 09:28:09 +0000 (09:28 +0000)]
[arm]: redefine aes patterns
This patch removes the arch-common aese/aesmc and aesd/aesimc fusions
(i.e. aes fusion) implemented in the scheduling phase through the
aarch_crypto_can_dual function. The reason is due to observing
undesired behaviour in cases such as:
- when register allocation goes bad (e.g. extra movs)
- aes operations with xor and zeroed keys among interleaved operations
A more stable version should be provided by instead doing the aes fusion
during the combine pass. As such, new combine patterns have been added to
enable this.
The second change is the aese and aesd patterns have been rewritten as
encapsulating a xor operation. The purpose is to simplify the need of
having additional combine patterns for cases like the ones below:
For AESE (though it also applies to AESD as both have a xor operation):
data = data ^ key;
data = vaeseq_u8(data, zero);
---
veor q1, q0, q1
aese.8 q1, q9
* tree-ssa-sccvn.c (struct vn_walk_cb_data): Add orig_ref member.
(vn_reference_lookup_3): If the main ref has no access path recorded
but orig_ref has use it to do access-path based disambiguation.
(vn_reference_lookup_pieces): Adjust.
(vn_reference_lookup): Pass down original ref if we valueized.
Ed Schonberg [Tue, 9 Jul 2019 07:55:38 +0000 (07:55 +0000)]
[Ada] Access to uninitialized memory by predicate check
This patch fixes an exception or erroneous execution, when the
declaration for an object of a composite type that has a dynanic
predicate is initialized with an aggregate that requires expansion into
individual components. Prior to this patch the predicate check for the
object appeared before intialization was performed, thus accessing
uninitialized memory.
2019-07-09 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch3.adb (Analyze_Object_Declaration): If the object type
is a composite type that has a dynamic predicate and, the
expression in the declaration is an aggregate, the generated
predicate check must appear after the expanded code for the
aggregate, which will appear after the rewritten object
declarastion.
gcc/testsuite/
* gnat.dg/predicate10.adb, gnat.dg/predicate10_pkg.adb,
gnat.dg/predicate10_pkg.ads: New testcase.
This patch fixes and issue whereby applying 'Img to a constant
enumerated character type would result in a compiler crash when
assertions are enabled and infinite recursion when they are not.
2019-07-09 Justin Squirek <squirek@adacore.com>
gcc/ada/
* sem_eval.adb (Expr_Value_E): Add conditional to correctly
handle constant enumerated character types.
[Ada] Warning needed on anonymous access type allocators
This patch enhances the compiler to add an optional warning for
allocators of anonymous access types due to the somewhat confusing
runtime accessibility checks that they generate. For more details see RM
3.10.2 sections 14/3, 14.1/3, and 14.2/3.
These warnings can now be enabled with -gnatw_a, disabled with -gnatw_A
and are part of the "all warnings" flag -gnatwa.
------------
-- Source --
------------
-- main.adb
procedure Main is
type Int_Ptr is access all Integer;
Ptr_Obj : Int_Ptr;
Ptr_Not_Null_Obj : not null Int_Ptr := new Integer;
Ptr_Anon_Acc_Obj : not null access Integer :=
new Integer; -- WARNING
procedure Update_Ptr (Item : access Integer) is
begin
Ptr_Obj := Int_Ptr (Item); -- RUNTIME ERROR
end;
procedure Update_Ptr_With_Anonymous_Allocator is
Item : access Integer := new Integer;
begin
Update_Ptr (Item);
end;
type Rec_With_Coextension_A (Disc : access Integer)
is null record;
type Rec_With_Coextension_B (Disc : access Integer) is record
Comp : Integer;
end record;
Obj : Rec_With_Coextension_A :=
(Disc => new Integer'(32)); -- WARNING
procedure Test_Param (Param : access Integer) is
begin
null;
end;
function Test_Simple_Return return access Integer is
begin
return new Integer; -- WARNING
end;
function Test_Coextension_Return_A return Rec_With_Coextension_A is
begin
return (Disc => new Integer); -- WARNING
end;
function Test_Coextension_Return_B return Rec_With_Coextension_B is
begin
return (new Integer, 32); -- WARNING
end;
begin
Test_Param (new Integer); -- WARNING
Test_Param (Param => new Integer); -- WARNING
Update_Ptr_With_Anonymous_Allocator;
end;
$ gnatmake -q -gnatw_a main.adb
$ rm *.ali
$ gnatmake -q -gnatwa -gnatw_A main.adb
$ rm *.ali
$ gnatmake -q -gnatwa main.adb
$ main
main.adb:8:06: warning: use of an anonymous access type allocator
main.adb:16:32: warning: use of an anonymous access type allocator
main.adb:29:15: warning: use of an anonymous access type allocator
main.adb:38:14: warning: use of an anonymous access type allocator
main.adb:43:23: warning: coextension will not be deallocated when
its associated owner is deallocated
main.adb:43:23: warning: use of an anonymous access type allocator
main.adb:48:15: warning: coextension will not be deallocated when
its associated owner is deallocated
main.adb:48:15: warning: use of an anonymous access type allocator
main.adb:52:16: warning: use of an anonymous access type allocator
main.adb:53:25: warning: use of an anonymous access type allocator
main.adb:5:04: warning: variable "Ptr_Obj" is assigned but never read
main.adb:6:04: warning: variable "Ptr_Not_Null_Obj" is not referenced
main.adb:7:04: warning: variable "Ptr_Anon_Acc_Obj" is not referenced
main.adb:16:07: warning: "Item" is not modified, could be declared constant
main.adb:28:04: warning: variable "Obj" is not referenced
main.adb:36:13: warning: function "Test_Simple_Return" is not referenced
main.adb:41:13: warning: function "Test_Coextension_Return_A" is not referenced
main.adb:43:23: warning: coextension will not be deallocated when its
associated owner is deallocated
main.adb:46:13: warning: function "Test_Coextension_Return_B" is not referenced
main.adb:48:15: warning: coextension will not be deallocated when its
associated owner is deallocated
main.adb:5:04: warning: variable "Ptr_Obj" is assigned but never read
main.adb:6:04: warning: variable "Ptr_Not_Null_Obj" is not referenced
main.adb:7:04: warning: variable "Ptr_Anon_Acc_Obj" is not referenced
main.adb:8:06: warning: use of an anonymous access type allocator
main.adb:16:07: warning: "Item" is not modified, could be declared constant
main.adb:16:32: warning: use of an anonymous access type allocator
main.adb:28:04: warning: variable "Obj" is not referenced
main.adb:29:15: warning: use of an anonymous access type allocator
main.adb:36:13: warning: function "Test_Simple_Return" is not referenced
main.adb:38:14: warning: use of an anonymous access type allocator
main.adb:41:13: warning: function "Test_Coextension_Return_A" is not referenced
main.adb:43:23: warning: coextension will not be deallocated when its
associated owner is deallocated
main.adb:43:23: warning: use of an anonymous access type allocator
main.adb:46:13: warning: function "Test_Coextension_Return_B" is not referenced
main.adb:48:15: warning: coextension will not be deallocated when its
associated owner is deallocated
main.adb:48:15: warning: use of an anonymous access type allocator
main.adb:52:16: warning: use of an anonymous access type allocator
main.adb:53:25: warning: use of an anonymous access type allocator
* exp_ch4.adb (Expand_N_Allocator): Add conditional to detect
the presence of anoymous access type allocators and issue a
warning if the appropriate warning flag is enabled.
* warnsw.ads: Add new warning flag for anonymous allocators
* warnsw.adb (All_Warnings, Restore_Warnings, Save_Warnings,
Set_Underscore_Warning_Switch): Register new flags.
(WA_Warnings): Register new flag as an "all warnings" switch
* usage.adb,
doc/gnat_ugn/building_executable_programs_with_gnat.rst:
Document new warning switches -gnatw_a and -gnatw_A.
* gnat_ugn.texi: Regenerate.
Ed Schonberg [Tue, 9 Jul 2019 07:55:17 +0000 (07:55 +0000)]
[Ada] Crash/infinite loop on program with multiple visibility errors
This patch fixes the behavior of the compiler on a program with multiple
visibility errors. Previous to this fix the compiler would either crash
or enter an infinite loop on a declaration for the formal in a
subprogram declaration, when the parameter type was given by a selected
component that does not denote an entity. This patch also specializes
the error message when a local overloadable name has a homonym that is a
child package, which may containt an otherwise hidden interpreatation.
No simple reproducer.
2019-07-09 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch4.adb (Diagnose_Call): Improve error recovery when a
local subprogram name hides a possible candidate name declared
in a child package in the context of the current unit.
* sem_ch6.adb (Process_Formals): Protect against malformed
formal types when the parameter type does not denote an entity.
[Ada] Elaboration order v4.0 and generic instantiations
This patch updates the library graph augmentation mechanism of the
elaboration order v4.0 to emulate a particular behavior of the v3.0
scheme involving generic instantiations. If a unit without any
elaboration code instantiates a generic without any elaboration code,
the invocation edge from the instance to the generic body is not
considered for library graph augmentation.
------------
-- Source --
------------
-- gen_pack1.ads
generic
type Element_Type is private;
package Gen_Pack1 is
procedure Read;
end Gen_Pack1;
-- gen_pack1.adb
with Types1;
package body Gen_Pack1 is
procedure Read is null;
end Gen_Pack1;
-- types1.ads
with Gen_Pack1;
package Types1 is
procedure Read;
package Optional_Numbers is new Gen_Pack1 (Positive);
end Types1;
-- main1.adb
with Types1;
procedure Main1 is
begin
Types1.Optional_Numbers.Read;
end Main1;
* bindo-augmentors.adb (Visit_Elaboration_Root): Do not start a
DFS from an elaboration root whose corresponding unit lacks
elaboration code. This behavior mimics that of the old
elaboration order mechanism.
* bindo-graphs.adb (Find_All_Cycles_Through_Vertex): Move the
vertex tracing within the functional branches of the routine.
This prevents spurious trace output.
(Has_No_Elaboration_Code): New routine.
(Trace_Cycle, Trace_Edge): Update the various Ids to use the
"standard" trace format.
* bindo-graphs.ads (Has_No_Elaboration_Code): New routine.
* bindo-units.ads, bindo-units.adb (Has_No_Elaboration_Code):
New routine.
Piotr Trojanek [Tue, 9 Jul 2019 07:55:06 +0000 (07:55 +0000)]
[Ada] Reformat comments
Replace ". " (i.e. a period followed by two spaces) with ". "; this is
meant to avoid distraction when reading comments, except for the license
section, where apparently this makes the formating nicer. Some comments
have been refilled, in particular those that could fit into fewer lines.
Also, some occurences of this patter in code has also been removed, e.g.
in "J in 1 .. 3".
[Ada] Task-related circularities in Elaboration order v4.0
This patch adds another suggestion to the elaboration order diagnostics.
An elaboration circularity involving a task activation may be resolved
through pragma Restrictions (No_Entry_Calls_In_Elaboration_Code).
package A is
task type Task_Typ is
entry Start;
end Task_Typ;
procedure Proc;
end A;
-- a.adb
with B;
package body A is
task body Task_Typ is
begin
accept Start;
B.Proc;
end Task_Typ;
Elab : Task_Typ;
procedure Proc is null;
end A;
-- b.ads
package B is
procedure Proc;
end B;
-- b.adb
with A;
package body B is
procedure Proc is
begin
A.Proc;
end Proc;
end B;
-- main.adb
with A;
-- +--> A spec B spec
-- | ^ ^ ^
-- | | with | |
-- | sbb | +----------------+ | sbb
-- | | | |
-- | | | Invocation |
-- | A body ------------> B body
-- | ^ | |
-- | | Invocation | |
-- | +------------------+ |
-- | |
-- | Invocation |
-- +---------------------------+
--
-- The cycle is:
--
-- A body --> A body
procedure Main is begin null; end Main;
----------------------------
-- Compilation and output --
----------------------------
$ gnatmake -f -q main.adb -gnatd_F
$ gnatmake -f -q main.adb -gnatec=no_entry_calls.txt
error: Elaboration circularity detected
info:
info: Reason:
info:
info: unit "a (body)" depends on its own elaboration
info:
info: Circularity:
info:
info: unit "a (body)" invokes a construct of unit "a (body)" at
elaboration time
info: path 1:
info: elaboration of unit "a (body)"
info: activation of local task declared at "a.ads":2:14
info: call to subprogram "proc" declared at "b.ads":2:14
info: call to subprogram "proc" declared at "a.ads":6:14
info:
info: Suggestions:
info:
info: use pragma Restrictions (No_Entry_Calls_In_Elaboration_Code)
info: use the dynamic elaboration model (compiler switch -gnatE)
info:
gnatmake: *** bind failed.
* bindo.ads: Move type Precedence_Kind from the private to the
visible part of the unit.
* bindo-augmentors.adb: Remove the use of global data as it is
bad practice.
(Augment_Library_Graph): Update the parameter profile.
(Is_Visited, Set_Is_Visited): Remove.
(Visit_Elaboration_Root, Visit_Elaboration_Roots): Update the
parameter profile and comment on usage.
(Visit_Vertex): Likewise. Also keep track of which invocation
edge activates a task.
* bindo-augmentors.ads (Augment_Library_Graph): Update the
parameter profile and comment on usage.
* bindo-builders.adb (Create_Forced_Edge,
Create_Spec_And_Body_Edge, Create_With_Edge): Update the call to
Add_Edge.
* bindo-diagnostics.adb: Add with end use clauses for Restrict
and Rident.
(Output_Dynamic_Model_Suggestions): Remove.
(Output_Invocation_Related_Suggestions): New routine.
(Output_Suggestions): Output all invocation-related suggestions
together.
* bindo-elaborators.adb: Remove types Comparator_Ptr and
Predicate_Ptr.
(Find_Best_Vertex): Update the parameter profile.
* bindo-graphs.adb (Activates_Task): New routine.
(Add_Body_Before_Spec_Edge): Update the call to
Add_Edge_With_Return.
(Add_Edge): Update the parameter profile and the call to
Add_Edge_With_Return.
(Add_Edge_With_Return): Update the parameter profile and comment
on usage.
(At_Least_One_Edge_Satisfies): New routine.
(Contains_Elaborate_All_Edge): Reimplement.
(Contains_Static_Successor_Edge, Contains_Task_Activation): New
routine.
(Contains_Weak_Static_Successor): Remove.
(Is_Static_Successor_Edge): New routine.
* bindo-graphs.ads: Add types LGE_Predicate_Ptr,
LGV_Comparator_Ptr, and LGV_Predicate_Ptr. Update type
Library_Graph_Edge_Attributes to capture whether an invocation
edge activates a task. Update the value of
No_Library_Graph_Edge_Attributes.
(Activates_Task): Update the parameter profile and comment on
usage.
(Contains_Static_Successor_Edge, Contains_Task_Activation): New
routines.
(Contains_Weak_Static_Successor): Remove.
* doc/gnat_ugn/elaboration_order_handling_in_gnat.rst:
Update the documentation to reflect the new task-related advice.
* gnat_ugn.texi: Regenerate.
Javier Miranda [Tue, 9 Jul 2019 07:54:45 +0000 (07:54 +0000)]
[Ada] Missing error on generic type with representation clause
The compiler does not report an error on a generic type that has a
representation clause when its ultimate parent is not a generic formal.
2019-07-09 Javier Miranda <miranda@adacore.com>
gcc/ada/
* sem_ch13.adb (Rep_Item_Too_Early): Representation clauses are
not allowed for a derivation of a generic type. Extend the
current test to check that none of the parents is a generic
type.
Ed Schonberg [Tue, 9 Jul 2019 07:54:35 +0000 (07:54 +0000)]
[Ada] Wrong resolution of equality operator with overloaded operand
This patch fixes a code generation error on an equality operation one of
whose operands is an overloaded call, and several equality operators are
visible. The resolution would succes but in some cases the wrong entity
was lwfton the equality node, leading to expansion with the wrong
interpretation. If the equality operation is the operand of a negation,
the resolution of the negation must make direct use of the equality
resolution,
2019-07-09 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_res.adb (Resolve_Equality_Op): If the node was overloaded,
set properly the entity to which the node has been resolved. The
original entity is the first one found during analysis, and is
not necessarily the resolved one.
(Resolve_Op_Not): If the argument of negation is an overloaded
equality operation, call its resolution directly given that the
context type does not participate in overload resolution.
gcc/testsuite/
* gnat.dg/equal7.adb, gnat.dg/equal7_pkg.adb,
gnat.dg/equal7_pkg.ads: New testcase.
This patch enables the elaboration order v4.0 as the default elaboration
order in GNATbind. The previous v3.0 elaboration order is now referred
to as the "legacy elaboration order mechanism" and is available using
binder switch -H.
* bindo.adb: Remove with and use clauses for Debug. Add with
and use clauses for Opt.
(Find_Elaboration_Order): Enable the v4.0 elaboration order. The
v3.0 mechanism is now available under binder switch -H.
* bindusg.adb (Display): Enable switch -H.
* debug.adb: Free compiler switch -gnatd_G. Free binder switch
-d_N.
* sem_elab.adb: Update the section on switches to remove
-gnatd_G.
(Invocation_Graph_Recording_OK): The invocation graph is now
unconditionally recorded in ALI files.
* switch-b.adb (Scan_Binder_Switches): Scan switch -H.
* doc/gnat_ugn/building_executable_programs_with_gnat.rst:
Update the documentation on compiler switches related to
elaboration. Update the documentation on binder switches to
include switch -H.
* doc/gnat_ugn/elaboration_order_handling_in_gnat.rst: Update
the documentation on elaboration order handling in GNAT.
* gnat_ugn.texi: Regenerate.
[Ada] Expand Enum_Rep attribute reference in GNATprove mode
In the special GNATprove mode for proof of programs, expand the Enum_Rep
attribute reference so that a suitable static integer is in the AST
where required by the rest of analysis.
There is no impact on compilation.
2019-07-09 Yannick Moy <moy@adacore.com>
gcc/ada/
* exp_spark.adb (Expand_SPARK_N_Attribute_Reference): Expand
attribute reference on Enum_Rep.
Ed Schonberg [Tue, 9 Jul 2019 07:54:05 +0000 (07:54 +0000)]
[Ada] Spurious error when instance of generic is used as formal package
This patch removes a spurious bug on the use of the current instance of
a generic package G as the actual in a nested instantiation of a generic
unit GU that has a formal package whose generic_package name is G. This
is only legal if G has no generic formal part, and the formal package
declaration is declared with a box or without a formal_paxkage_actual
part.
2019-07-09 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch12.adb (Instantiate_Formal_Package): Handle properly the
case where the actual for a formal package in an instance is the
current instance of an enclosing generic package.
(Check_Formal_Packages): If the formal package declaration is
box-initialized or lacks associations altogether, no internal
instance was created to verify conformance, and there is no
validating package to remove from tree.
[Ada] Prevent inconsistent state for inlining in GNATprove
In GNATprove mode, subprograms with a body to inline should have been
filtered in Analyze_Subprogram_Body_Helper to match the conditions for
inlining subprograms in GNATprove. Prevent a call to Set_Body_To_Inline
in GNATprove mode that did not go through this filtering.
There is no impact on compilation.
2019-07-09 Yannick Moy <moy@adacore.com>
gcc/ada/
* freeze.adb (Build_Renamed_Body): Do not set body to inline in
GNATprove mode.
[Ada] Expand type of static expressions in GNATprove mode
In the special mode for GNATprove, expand the type of static expressions
like done during compilation, to both get suitable legality checks and
increase the precision of the formal analysis.
There is no impact on compilation.
2019-07-09 Yannick Moy <moy@adacore.com>
gcc/ada/
* exp_util.adb (Expand_Subtype_From_Expr): Still expand the type
of static expressions in GNATprove_Mode.
* sem_ch3.adb (Analyze_Object_Declaration): Remove obsolete
special case for GNATprove_Mode.
[Ada] Handle implicit moves in SPARK ownership pointer support
Allocator expressions and sub-expressions of (extension) aggregates are
implicitly the source of assignments in Ada. Thus, they should be moved
when of a deep type when checking ownership rules in SPARK.
There is no impact on compilation.
2019-07-09 Yannick Moy <moy@adacore.com>
gcc/ada/
* sem_spark.adb (Check_Expression): Handle correctly implicit
assignments as part of allocators and (extension) aggregates.
(Get_Root_Object): Adapt for new path expressions.
(Is_Path_Expression): Return True for (extension) aggregate.
Ed Schonberg [Tue, 9 Jul 2019 07:53:35 +0000 (07:53 +0000)]
[Ada] Fix scopes for local variables in task/protected bodies
No impact on compilation with GCC.
2019-07-09 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_util.adb (Scope_Within_Or_Same): Handle properly task
bodies and protected bodies, so that local variables within have
their proper scopes after these constructs have been rewritten
during expansion. This patch resembles but is not identical to
the code in Scope_Within.
[Ada] Fix ownership checking for pointers in SPARK
Checking of the readable status of sub-expressions occurring in the
target path of an assignment should occur before the right-hand-side is
moved or borrowed or observed.
There is no impact on compilation.
2019-07-09 Yannick Moy <moy@adacore.com>
gcc/ada/
* sem_spark.adb (Check_Expression): Change signature to take an
Extended_Checking_Mode, for handling read permission checking of
sub-expressions in an assignment.
(Check_Parameter_Or_Global): Adapt to new behavior of
Check_Expression for mode Assign.
(Check_Safe_Pointers): Do not analyze generic bodies.
(Check_Assignment): Separate checking of the target of an
assignment.
Eric Botcazou [Tue, 9 Jul 2019 07:53:16 +0000 (07:53 +0000)]
[Ada] Make -gnatRj output strictly conforming JSON
This changes the -gnatRj output from a concatenation of entities to an
array of entities, thus making it strictly conforming JSON and easier to
be parsed by means of GNATColl or Python.
2019-07-09 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* repinfo.ads (JSON format): Adjust.
* repinfo.adb (Need_Blank_Line): Rename to...
(Need_Separator): ...this.
(Blank_Line): Rename to...
(Write_Separator): ...this and add JSON specific handling.
(List_Array_Info): Adjust to above renaming.
(List_Object_Info): Likewise.
(List_Record_Info): Likewise.
(List_Subprogram_Info): Likewise.
(List_Type_Info): Likewise.
(List_Entities): Do not set Need_Blank_Line.
(List_Rep_Info): Set Need_Separator and add JSON specific
handling. Output a single JSON stream in the normal case.
Martin Liska [Tue, 9 Jul 2019 07:41:39 +0000 (09:41 +0200)]
Remove usage of ZSTD_CLEVEL_DEFAULT define.
2019-07-09 Martin Liska <mliska@suse.cz>
* lto-compress.c (lto_normalized_zstd_level): Do not use
ZSTD_CLEVEL_DEFAULT as it is not default in old releases
of libzstd. One can use 0 as a default compression level.
Martin Sebor [Tue, 9 Jul 2019 04:15:42 +0000 (04:15 +0000)]
PR middle-end/71924 - missing -Wreturn-local-addr returning alloca result
PR middle-end/71924 - missing -Wreturn-local-addr returning alloca result
PR middle-end/90549 - missing -Wreturn-local-addr maybe returning an address of a local array plus offset
Jakub Jelinek [Mon, 8 Jul 2019 22:11:59 +0000 (00:11 +0200)]
tree-vect-stmts.c (scan_operand_equal_p): Look through MEM_REF with SSA_NAME address of POINTER_PLUS_EXPR.
* tree-vect-stmts.c (scan_operand_equal_p): Look through MEM_REF
with SSA_NAME address of POINTER_PLUS_EXPR. Handle MULT_EXPR
and casts in offset when different, both through gimple stmts
and through trees. Rewritten using loops to minimize code duplication
for each operand.
* g++.dg/vect/simd-6.cc: Replace xfail with target x86.
* g++.dg/vect/simd-9.cc: Likewise.
* testsuite/libgomp.c++/scan-13.C: Replace xfail with target x86.
* testsuite/libgomp.c++/scan-16.C: Likewise.
Eric Botcazou [Mon, 8 Jul 2019 21:37:33 +0000 (21:37 +0000)]
emit-rtl.c (set_insn_locations): New function moved from...
* emit-rtl.c (set_insn_locations): New function moved from...
* function.c (set_insn_locations): ...here.
* ira-emit.c (emit_moves): Propagate location of the first instruction
to the inserted move instructions.
* reg-stack.c (compensate_edge): Set the location if the sequence is
inserted on the edge.
* rtl.h (set_insn_locations): Declare.
rs6000: Ignore GFXOPT (and GPOPT) for choosing machine
The function rs6000_machine_from_flags chooses what .machine string to
used based on the rs6000_isa_flags flags. For that it checks for each
ISA level if something for its ISA_*_MASKS is selected.
This does not work for GFXOPT and GPOPT: these are set as flags in
ISA_2_5_MASKS_SERVER, but they aren't actually new there, they just
are not selected by default for older ISAs (they were optional).
This patch makes OPTION_MASK_PPC_GFXOPT and OPTION_MASK_PPC_GPOPT not
influence the .machine selection.
* config/rs6000/rs6000.c (rs6000_machine_from_flags): Ignore
OPTION_MASK_PPC_GFXOPT and OPTION_MASK_PPC_GPOPT for selecting the
.machine string.
Currently the second lower-subreg pass is run right before RA. This
is much too late to be very useful. At least for targets that do not
have RTL patterns for operations on multi-register modes it is a lot
better to split patterns earlier, before combine and all related
passes.
This adds an option -fsplit-wide-types-early that does that, and
enables it by default for rs6000.
PR rtl-optimization/88233
* common.opt (fsplit-wide-types-early): New option.
* common/config/rs6000/rs6000-common.c
(rs6000_option_optimization_table): Add OPT_fsplit_wide_types_early for
OPT_LEVELS_ALL.
* doc/invoke.texi (Optimization Options): Add -fsplit-wide-types-early.
* lower-subreg.c (pass_lower_subreg2::gate): Add test for
flag_split_wide_types_early.
(pass_data_lower_subreg3): New.
(pass_lower_subreg3): New.
(make_pass_lower_subreg3): New.
* passes.def (pass_lower_subreg2): Move after the loop passes.
(pass_lower_subreg3): New, inserted where pass_lower_subreg2 was.
* tree-pass.h (make_pass_lower_subreg2): Move up, to its new place in
the pass pipeline; its previous place is taken by ...
(make_pass_lower_subreg3): ... this.
The gcc.c-torture/execute/builtins/lib directory contains a reimplementation
of many C library string functions, which causes non-trivial register allocation
bugs with LTO and static linked libraries. To fix this long-standing test
issue, turn off ipa-ra which avoids the register corruption across calls. All
builtin torture tests now pass on aarch64-none-elf. Committed as obvious.
Robin Dapp [Mon, 8 Jul 2019 14:40:48 +0000 (14:40 +0000)]
S/390: Rework shift count handling.
Add s390_valid_shift_count to determine the validity of a
shift-count operand. This is used to replace increasingly
complex substitutions that should have allowed address-style
shift-count handling, an and mask as well as no-op subregs
on the operand.
gcc/ChangeLog:
2019-07-08 Robin Dapp <rdapp@linux.ibm.com>
* config/s390/constraints.md: Add new jsc constraint.
* config/s390/predicates.md: New predicates.
* config/s390/s390-protos.h (s390_valid_shift_count): New function.
* config/s390/s390.c (s390_valid_shift_count): New function.
(print_shift_count_operand): Use s390_valid_shift_count.
(print_operand): Likewise.
* config/s390/s390.md: Use new predicate.
* config/s390/subst.md: Remove addr_style_op and masked_op substs.
* config/s390/vector.md: Use new predicate.
2019-07-08 Robin Dapp <rdapp@linux.ibm.com>
* gcc.target/s390/combine-rotate-modulo.c: New test.
* gcc.target/s390/combine-shift-rotate-add-mod.c: New test.
* gcc.target/s390/vector/combine-shift-vec.c: New test.
Richard Biener [Mon, 8 Jul 2019 11:46:26 +0000 (11:46 +0000)]
re PR tree-optimization/91108 (Fails to pun through unions)
2019-07-08 Richard Biener <rguenther@suse.de>
PR tree-optimization/91108
* tree-ssa-sccvn.c: Include builtins.h.
(vn_reference_lookup_3): Use only alignment constraints to
verify same-valued store disambiguation.
* gcc.dg/tree-ssa/ssa-fre-61.c: Adjust back.
* gcc.dg/tree-ssa/ssa-fre-78.c: New testcase.
Jim Wilson [Mon, 8 Jul 2019 10:47:42 +0000 (03:47 -0700)]
RISC-V: Fix splitter for 32-bit AND on 64-bit target.
Fixes github.com/riscv/riscv-gcc issue #161. We were accidentally using
BITS_PER_WORD to compute shift counts when we should have been using the
bitsize of the operand modes. This was wrong when we had an SImode shift
and a 64-bit target.
Andrew Waterman <andrew@sifive.com>
gcc/
* config/riscv/riscv.md (lshrsi3_zero_extend_3+1): Use operands[1]
bitsize instead of BITS_PER_WORD.
gcc/testsuite/
* gcc.target/riscv/shift-shift-2.c: Add one more test.
Eric Botcazou [Mon, 8 Jul 2019 08:15:05 +0000 (08:15 +0000)]
[Ada] Small overhaul in Repinfo unit
This creates a List_Type_Info procedure to deal with type entities other
than arrays and records at top level and a List_Common_Type_Info
procedure to handle the common part between them. No functional
changes.
2019-07-08 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* repinfo.adb (List_Common_Type_Info): New procedure extracted
from...
(List_Type_Info): ...here. Call it for the common information,
start with a blank line and output the linker section at the
end, if any.
(List_Mechanisms): Rename to...
(List_Subprogram_Info): ...this.
(List_Array_Info): Call List_Common_Type_Info.
(List_Entities): Adjust to above change and renaming.
(List_Record_Info): Call List_Common_Type_Info.
* libgnat/g-sercom.ads
(Serial_Port_Descriptor): New type.
(Serial_Port): Add a comment, make it hold a
Serial_Port_Descriptor.
(To_Ada, To_C): New procedures.
(Port_Data, Port_Data_Access): Remove types.
* libgnat/g-sercom.adb (To_Ada): New stub.
* libgnat/g-sercom__linux.adb, libgnat/g-sercom__mingw.adb:
Update implementations accordingly.
* s-oscons-tmplt.c: Bind Serial_Port_Descriptor to
System.Win32.HANDLE on Windows, and to Interfaces.C.int on
Linux. Add "Interfaces.C." prefix for other basic integer type
bindings.
* xoscons.adb (Output_Info): Remove the "Interfaces.C." prefix
for subtypes generation.
Javier Miranda [Mon, 8 Jul 2019 08:14:32 +0000 (08:14 +0000)]
[Ada] Wrong evaluation of membership test
The code generated by the compiler erroneously evaluates to True
membership tests when their left operand is a a class-wide interface
object and the right operand is a tagged type that implements such
interface type.
2019-07-08 Javier Miranda <miranda@adacore.com>
gcc/ada/
* exp_ch4.adb (Tagged_Membership): Fix regression silently
introduced in r260738 that erroneouslusy causes the evaluation
to True of the membership test when the left operand of the
membership test is a class-wide interface object and the right
operand is a type that implements such interface type.
This patch adds a missing case to the output of cycle diagnostics here a
transition from an Elaborate_Body pair may reach a destination which is
in the context of an active Elaborate_All.
* bindo-diagnostics.adb (Diagnose_Cycle): Capture the presence
of an Elaborate_All edge before iterating over the edges of the
cycle.
(Output_Elaborate_Body_Transition): Update the parameter profile
and the comment on usage. Add a missing case where the edge is
within the context of an Elaborate_All.
(Output_Transition): Update the call to
Output_Elaborate_Body_Transition.
* bindo-graphs.ads, bindo-graphs.adb
(Contains_Elaborate_All_Edge): New routine.
Piotr Trojanek [Mon, 8 Jul 2019 08:14:15 +0000 (08:14 +0000)]
[Ada] Set dummy Etype for the fake __HEAP entity in GNATprove
GNATprove represents reads and writes via pointers as operations on a
fake __HEAP entity. This entity already had various properties set to
dummy values (e.g. Scope set to Standard_Standard), so that it can be
processed like other entities without crashing and not special-cased
everywhere. Now it also has a dummy Etype, so it can be processed with
Is_Single_Concurrent_Object.
The modified code is only executed by GNATprove; frontend is not
affected.
2019-07-08 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* lib-xref-spark_specific.adb (Create_Heap): Set dummy Etype for
the fake __HEAP entity.
Nicolas Roche [Mon, 8 Jul 2019 08:14:06 +0000 (08:14 +0000)]
[Ada] Remove dependency on Win32 GDI (Graphical Interface)
CommandLineToArgvW drags a dependency on SHELL32.DLL and thus GDI32.DLL.
By loading GDI32.DLL some default GDI objects are allocated. On some
Windows versions this cause the use of a lock on the graphical interface
during process termination. This can impact parallelism significantly as
termination of processes is serialized.
2019-07-08 Nicolas Roche <roche@adacore.com>
gcc/ada/
* rtinit.c (__gnat_runtime_initialize): Remove dependency on
CommandLineToArgvW.
Ed Schonberg [Mon, 8 Jul 2019 08:13:48 +0000 (08:13 +0000)]
[Ada] Crash on timed entry call with a delay given by a type conversion
This patch fixes a compiler crash in the compiler on a timed entry call
whose delay expression is a type conversion, when FLoat_Overflow checks
are enabled.
2019-07-08 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* exp_ch9.adb (Expand_N_Timed_Entry_Call): Do not insert twice
the assignment statement that computes the delay value, to
prevent improper tree sharing when the value is a type
conversion and Float_Overflow checks are enabled.
gcc/testsuite/
* gnat.dg/entry1.adb, gnat.dg/entry1.ads: New testcase.
This patch introduces several changes to the new elaboration order
mechanism:
* The concept of "strong" and "weak" edges is introduced. Strong
edges are the byproduct of language-defined relations between
units, such as with clauses. Weak edges are the byproduct of
specilative invocations at elaboration time, which may or may not
take place depending on control flow.
* The elaboration order algorithm has been heavily modified to make
use of the strong and weak edges, and operate on units compiled
with different elaboration models.
* The elaboration order algorithm employs the following logic:
- Maintain two sets of vertices, one for all elaborable
vertices, and one for all waiting vertices.
- Pick the best elaborable vertex, and elaborate its component.
- If no such elaborable vertex is available, pick the best
weakly elaborable vertex whose unit has been compiled with the
dynamic model, and elaborate its component.
- If no such weakly elaborable vertex is available, then either
all vertices were already elaborated, or the graph contains a
cycle.
The elaboration of a component employs the same logic, with an
added step where all successors of some predecessor currently being
elaborated are notified that they have one fewer predecessor to
wait on. This may cause certain successors to become elaborable, in
which case they are moved from the set of waiting vertices to the
set of elaborable vertices.
* Three new GNATbind debug switches are introduced, -d_a, -d_b, and
-d_e, to eliminate the effects of pragmas Elaborate_All,
Elaborate_Body, and Elaborate respectively.
* The section on terminology is updated to include new entries.
* bindo.adb: Update the section on terminology to include new
concepts. Update the section on switches to include new
entries.
* bindo.ads: Add type Precedence_Kind.
* bindo-builders.adb: Add with and use clauses for Debug and
Bindo.Validators. Add use clauses for
Bindo.Validators.Invocation_Graph_Validators and
Bindo.Validators.Library_Graph_Validators.
(Build_Invocation_Graph): Validate the graph immediately after
it was built.
(Build_Library_Graph): Update the parameter profile. The
creation of the graph is now elaboration model-agnostic.
Validate the graph immediately after it was built.
(Create_With_Edge): Create regular with edges for Elaborate and
Elaborate_All edges when the appropriate debug switches are in
effect.
* bindo-builders.ads (Build_Library_Graph): Update the parameter
profile.
* bindo-diagnostics.adb (Diagnose_Cycle): Track the presence of
an Elaborate_All edge throughout the inspection of the cycle's
edges.
(Output_Dynamic_Model_Suggestions): Output the suggestion only
when the cycle contains at least one weak edge where the
successor was statically elaborated.
(Output_Elaborate_Body_Transition, Output_Forced_Transition,
Output_With_Transition): Update the assertions.
* bindo-elaborators.adb: Remove use clauses for
Bindo.Validators.Invocation_Graph_Validators and
Bindo.Validators.Library_Graph_Validators. Remove strings
Add_To_All_Candidates_Msg and Add_To_Comp_Candidates_Msg.
Remove type String_Ptr.
(Add_Vertex, Add_Vertex_If_Elaborable, Create_All_Candidates_Set
Create_Component_Candidates_Set): Remove.
(Create_Component_Vertex_Sets, Create_Vertex_Sets): New routine.
(Elaborate_Component): Update the parameter profile and the
comment on usage. Reimplement the elaboration of a component.
The algorithm will now attempt to elaborate as many vertices
possible. If this is not possible, and a weakly elaborable
vertex is available use unit was compiled using the dynamic
model, the algorithm will elaborate it.
(Elaborate_Library_Graph): Reimplement the elaboration of the
graph. The algorithm will now attempt to elaborate as many
vertices along with their components as possible. If this is not
possible, and a weakly elaborable vertex is available use unit
was compiled using the dynamic model, the algorithm will
elaborate it along with its component.
(Elaborate_Units): Merge with the functionality of
Elaborate_Units_Common.
(Elaborate_Units_Common, Elaborate_Units_Dynamic,
Elaborate_Units_Static): Remove.
(Elaborate_Vertex): Update the parameter profile and the comment
on usage. Reimplemented.
(Find_Best_Candidate): Remove.
(Find_Best_Elaborable_Vertex, Find_Best_Vertex,
Find_Best_Weakly_Elaborable_Vertex, Has_Elaborable_Body,
Insert_Elaborable_Successor, Insert_Vertex): New routines.
(Is_Better_Candidate): Remove.
(Is_Better_Elaborable_Vertex,
Is_Better_Weakly_Elaborable_Vertex,
Is_Suitable_Elaborable_Vertex,
Is_Suitable_Weakly_Elaborable_Vertex): New routines.
(Trace_Candidate_Vertices): Remove.
(Trace_Component): Output the number of strong and weak
predecessors.
(Trace_Unelaborated_Vertices): Remove.
(Trace_Vertex): Output the number of strong and weak
predecessors.
(Trace_Vertices): New routine.
(Update_Successor, Update_Successors): Update the parameter
profile and the comment on usage.
* bindo-graphs.adb: Remove type Precedence_Kind.
(Add_Edge_With_Return): Update the increment of pending
predecessors.
(Add_Vertex): Provide default values for strong and weak
predecessors.
(Complementary_Vertex): Move the initial declaration to the
spec. Update the parameter profile and the comment on usage.
(Contains_Weak_Static_Successor): New routine.
(Create): Update the parameter profile. The creation of the
graph is now elaboration model-agnostic.
(Decrement_Pending_Predecessors): Update the parameter profile
and the comment on usage. Reimplemented.
(Delete_Edge): Update the decrement of pending predecesors.
(Has_Elaborate_Body): Do not treat a vertex as being subject to
Elaborate_Body when a debug switch is in effect.
(Increment_Pending_Predecessors): Update the parameter profile
and the comment on usage. Reimplemented.
(Is_Elaborable_Component): Reimplemented.
(Is_Elaborable_Vertex): Move the initial declaration to the
spec. Reimplemented.
(Is_Elaborate_Body_Pair): New routine.
(Is_Dynamically_Elaborated): Update the parameter profile.
Reimplemented.
(Is_Weakly_Elaborable_Vertex): New routine.
(Pending_Predecessors): Removed.
(Pending_Predecessors_For_Elaboration,
Pending_Strong_Predecessors, Pending_Weak_Predecessors,
Update_Pending_Predecessors): New routines.
(Update_Pending_Predecessors_Of_Components): Update the
increment of pending predecessors.
* bindo-graphs.ads: Update the components of type
Component_Attributes. Update the components of type
Library_Graph_Attributes. Update the components of type
Library_Graph_Vertex_Attributes. Update the initialization of
No_Component_Attributes. Update the initialization of
No_Library_Graph_Vertex_Attributes.
(Complementary_Vertex, Contains_Weak_Static_Successor): New
routines.
(Create): Update the parameter profile and the comment on usage.
(Decrement_Pending_Predecessors, Is_Dynamically_Elaborated):
Update the parameter profile and the comment on usage.
(Is_Elaborate_Body_Pair, Is_Weakly_Elaborable_Vertex): New
routines.
(Pending_Predecessors): Removed.
(Pending_Predecessors_For_Elaboration,
Pending_Strong_Predecessors, Pending_Weak_Predecessors): New
routines.
* bindo-writers.adb (Write_Components): Moved from the spec.
(Write_Component): Output the strong and weak predecessors.
(Write_Library_Graph): Output the components as part of the
graph.
(Write_Library_Graph_Vertex): Output the strong and weak
predecessors.
* bindo-writers.ads (Write_Components): Moved to the body.
* debug.adb: Add and document new GNATbind switches -d_a, -d_b,
-d_e.
* bindo-validators.adb: Minor reformattings.
[Ada] Arrange not to set DECL_ARTIFICIAL on elab procs
Unlike, say, clones created internally by the compiler, elab procs
materialize specific user code and flagging them artificial now takes
elab code away from gcov's analysis, a regression compared to previous
releases.
On the testcase below:
package Gcov_Q is
function F (X : Integer) return Integer is (X + 1);
end;
with Gcov_Q;
package Gcov_P is
Y : Integer := Gcov_Q.F (X => 1);
end;
with Gcov_P;
procedure Gcov_Test is
begin
if Gcov_P.Y /= 2 then
raise Program_Error;
end if;
end;
Eric Botcazou [Mon, 8 Jul 2019 08:13:30 +0000 (08:13 +0000)]
[Ada] Fix crash on extension of private type with -gnatRj
This fixes a crash (or an assertion failure) during the processing done
for -gnatRj on the declaration of an extension of a private type.
Generally speaking, extension declarations are delicate in this context
because the front-end does not duplicate the structure of the parent
type, so the processing required to output the structural layout needs
to go up to the declaration of the parent type, which may or may not be
available or usable.
The change also makes the processing more robust by falling back to the
flat layout if the declaration of the parent type cannot be processed.
2019-07-08 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* repinfo.adb (List_Record_Info): Declare Incomplete_Layout and
Not_In_Extended_Main local exceptions.
(List_Structural_Record_Layout): For an extension, raise the
former if the parent subtype has not been built and the latter
if it is not declared in the main source unit. Fall back to the
flat layout if either exception has been raised.
Ed Schonberg [Mon, 8 Jul 2019 08:13:25 +0000 (08:13 +0000)]
[Ada] Semantics of Delete for fixed strings
This patch corrects a bug in the implementation of Delete in an unusual
boundary case: the RM describes the semantics of Delete as equivalent to
that of Replace_String with a null argument. As a result, deleting a
null string that starts past the end of its argument is a noop and must
not raise Index_Error.
2019-07-08 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* libgnat/a-strfix.adb (Delete): The RM describes the semantics
of Delete as equivalent to that of Replace_String with a null
argument. As a result, deleting a null string that starts past
the end of its argument is a noop and must not raise
Index_Error.
Javier Miranda [Mon, 8 Jul 2019 08:13:20 +0000 (08:13 +0000)]
[Ada] Crash in interface derivation with null primitive
The frontend crashes processing the derivation of a tagged type whose
ultimate ancestor is an interface type I1 that has a null primitive,
implements another interface I2 derived from I2, and does not override
the null primitive.
2019-07-08 Javier Miranda <miranda@adacore.com>
gcc/ada/
* exp_disp.adb (Register_Primitive): When registering a
primitive in the secondary dispatch table, handle primitive
inherited through several levels of type derivation (required to
properly handle inherited 'null' primitive).
gcc/testsuite/
* gnat.dg/interface9.adb, gnat.dg/interface9_root-child.ads,
gnat.dg/interface9_root.ads: New testcase.
Javier Miranda [Mon, 8 Jul 2019 08:13:11 +0000 (08:13 +0000)]
[Ada] Code reorganization
This patch performs a code reorganization of the implementation of
pragma Compile_Time_Error. No functional change.
No test required.
2019-07-08 Javier Miranda <miranda@adacore.com>
gcc/ada/
* gnat1drv.adb (Post_Compilation_Validation_Checks:
Validate_Compile_Time_Warning_Errors is now located in sem_prag
(instead of sem_ch13).
* sem_ch13.ads (Validate_Compile_Time_Warning_Error,
Validate_Compile_Time_Warning_Errors): Move to sem_prag.
* sem_ch13.adb
(Compile_Time_Warnings_Errors): Move to sem_prag.
(Initialize): Remove initialization of table
Compile_Time_Warning_Errors.
(Validate_Compile_Time_Warning_Error,
Validate_Compile_Time_Warning_Errors): Move to sem_prag.
* sem_prag.ads (Validate_Compile_Time_Warning_Errors): New
procedure.
* sem_prag.adb (Initialize): Initialize table
Compile_Time_Warning_Errors.
Ed Schonberg [Mon, 8 Jul 2019 08:13:04 +0000 (08:13 +0000)]
[Ada] Crash on named actual in postcondition for generic subprogram
This patch fixes a crash on compiling the postcondtion for a generic
subprogram, when the postcondition is a call with both positional and
named parameter associations.
2019-07-08 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch13.adb (Analyze_Aspect_Specifications): For a
pre/postcondition of a generic subprogram declaration, do not
use Relocate_Node on the aspect expression to construct the
corresponding attribute specification, to prevent tree anomalies
when the expression is a call with named actual parameters.
Javier Miranda [Mon, 8 Jul 2019 08:13:00 +0000 (08:13 +0000)]
[Ada] Spurious error reported by pragma Compile_Time_Error
The compiler may trigger spurious errors on pragmas Compile_Time_Error
and Compile_Time_Warning when their boolean expression computes the size
of a type. After this patch the following test compiles fine.
with Interfaces; use Interfaces;
package Types is
type Arr is array (1 .. 6) of Unsigned_8
with Size => 48,
Alignment => 1;
type Rec is record
Comp_1 : Unsigned_32;
Comp_2 : Unsigned_16;
end record
with Size => 48,
Alignment => 1;
end Types;
with Types; use Types;
package Main is
pragma Compile_Time_Error
(Arr'Size = 12, "ERROR: Arr'Size is 48, not 12");
pragma Compile_Time_Error
(Arr'Size = 48, "OK: Arr");
pragma Compile_Time_Error
(Arr'Size /= 48, "ERROR: Arr'Size is 48");
pragma Compile_Time_Error
(Rec'Size = 34, "ERROR: Rec'Size is 48, not 34");
pragma Compile_Time_Error
(Rec'Size = 48, "OK: Rec");
pragma Compile_Time_Error
(Rec'Size /= 48, "ERROR: Rec'Size is 48");
end Main;
* sem_attr.adb (Analyze_Attribute [Attribute_Size]): For pragmas
used to report user defined compile time warning or errors
handle 'Size for types with known static RM size.
This patch fixes an issue whereby the creation of an enumeration within
package where Default_Scalar_Storage_Order is in effect may lead to a
crash when the attributes Image or Value are applied to objects of said
type or the type directly.
2019-07-08 Justin Squirek <squirek@adacore.com>
gcc/ada/
* exp_imgv.adb (Build_Enumeration_Image_Tables): Default SSO for
the building of image tables.
(Expand_Image_Attribute): Minor cleanup.
* libgnat/g-socket.ads, libgnat/g-socket.adb: Improve
documentation.
(Get_Socket_Option, Set_Socket_Option): Remove default value for
the Level formal.
Ed Schonberg [Mon, 8 Jul 2019 08:12:46 +0000 (08:12 +0000)]
[Ada] Spurious visibility error on dynamic_predicate aspect in generic
This patch fixes a spurious error when verifying that the visibility of
the expression of an aspect has not changed between the freeze point of
the entity to which it applies, and the end of the enclosing declarative
part. If the entity is a composite type its components must be made
directly visible for the analysis of the expression. In a generic
context this must be done explicitly at the end of the declarative part.
2019-07-08 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): For an
unanalized aspect in a generic context that has not been
analyzed yet, if the aspect applies to a type, place the type on
the scope stack to make its components visible, before checking
conformance with the version of the expression analyzed at the
freeze point.
gcc/testsuite/
* gnat.dg/predicate8.adb, gnat.dg/predicate8_pkg.adb,
gnat.dg/predicate8_pkg.ads: New testcase.
Richard Biener [Mon, 8 Jul 2019 07:09:24 +0000 (07:09 +0000)]
re PR tree-optimization/83518 (Missing optimization: useless instructions should be dropped)
2019-07-08 Richard Biener <rguenther@suse.de>
PR tree-optimization/83518
* tree-ssa-sccvn.c: Include splay-tree.h.
(struct pd_range, struct pd_data): New.
(struct vn_walk_cb_data): Add data to track partial definitions.
(vn_walk_cb_data::~vn_walk_cb_data): New.
(vn_walk_cb_data::push_partial_def): New.
(pd_tree_alloc, pd_tree_dealloc, pd_range_compare): New.
(vn_reference_lookup_2): When partial defs are registered give up.
(vn_reference_lookup_3): Track partial defs for memset and
constructor zeroing and for defs from constants.
guality.exp is silently skipped on Linux systems with
kernel.yama.ptrace_scope=1 because gdb fails to attach to the
sanity check test. This patch uses PR_SET_PTRACER (where available)
to avoid this.
prctl was apparently added in Linux 2.1.57, so I don't think we
need any tests other than __linux for the #include.
2019-07-08 Richard Sandiford <richard.sandiford@arm.com>
gcc/testsuite/
* gcc.dg/guality/guality.h: Include <sys/prctl.h> on Linux targets.
(main): Use PR_SET_PTRACER where available.