Paolo Carlini [Mon, 11 Jun 2018 21:13:41 +0000 (21:13 +0000)]
decl.c (grok_op_properties): Consistently use the location of the decl...
/cp
2018-06-11 Paolo Carlini <paolo.carlini@oracle.com>
* decl.c (grok_op_properties): Consistently use the location
of the decl; remove special casing of POSTINCREMENT_EXPR and
POSTDECREMENT_EXPR wrt default arguments.
/testsuite
2018-06-11 Paolo Carlini <paolo.carlini@oracle.com>
Paolo Carlini [Mon, 11 Jun 2018 21:13:19 +0000 (21:13 +0000)]
decl.c (grok_op_properties): Consistently use the location of the decl...
/cp
2018-06-11 Paolo Carlini <paolo.carlini@oracle.com>
* decl.c (grok_op_properties): Consistently use the location
of the decl; remove special casing of POSTINCREMENT_EXPR and
POSTDECREMENT_EXPR wrt default arguments.
/testsuite
2018-06-11 Paolo Carlini <paolo.carlini@oracle.com>
Carl Love [Mon, 11 Jun 2018 16:38:42 +0000 (16:38 +0000)]
altivec-7.c (main): Remove tests vec_unpackh(vecubi[0]) and vec_unpackl(vecubi[0]) returning long...
gcc/testsuite/ChangeLog:
2018-06-11 Carl Love <cel@us.ibm.com>
* gcc.target/powerpc/altivec-7.c (main): Remove tests
vec_unpackh(vecubi[0]) and vec_unpackl(vecubi[0]) returning
long long bool. Remove duplicate dg-final for xxlxor. Update
dg-final instruction counts.
* gcc.target/powerpc/altivec-37.c (main): New file for
tests vec_unpackh and vec_unpackl returning long long bool and
long long int.
rs6000: Put constraints on the correct operand in movdi (PR85755)
Some of the mov* patterns use ^ and $ constraint modifiers, which mean
give a penalty to this alternative if this operand needs a reload. They
are meant here to give a penalty if a register operand needs reloading
(because it needs to be in a different kind of register), not when a
memory operand needs reloading (which is easy and cheap to do).
This patch fixes the movdi patterns. This fixes PR85755.
The following are changed (name, old constraints, new constraints):
FPR store ^m := d m := ^d
FPR move ^d := d ^d := ^d
AVX store ^wY := wb wY := ^wb
AVX store $Z := wv Z := $wv
VSX move ^wi := wi ^wi := ^wi
PR target/85755
* config/rs6000/rs6000.md (*movdi_internal32): Put constraint modifiers
on the correct operand.
(*movdi_internal64): Ditto.
Eric Botcazou [Mon, 11 Jun 2018 09:19:51 +0000 (09:19 +0000)]
[Ada] Fix wrong code for initialization of fat pointer with -Og
2018-06-11 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Reuse the
existing fields of a dummy fat pointer type, if any. Clear the
TYPE_DECL_SUPPRESS_DEBUG on the fat pointer type after completing it.
* contracts.adb (Process_Body_Postconditions): Expand only checked
postconditions.
(Process_Contract_Cases_For): Expand only checked contract cases.
(Process_Inherited_Preconditions): Ignored class-wide preconditions are
partially expanded because some of their semantic checks are tied to
the expansion.
(Process_Preconditions_For): Expand only checked preconditions.
(Process_Spec_Postconditions): Expand only checked preconditions.
Ignored class-wide preconditions are partially expanded because some of
their semantic checks are tied to the expansion.
* exp_prag.adb (Expand_N_Pragma): Suppress the expansion of ignored
assertion pragmas.
* exp_util.adb (Add_Inherited_Invariants): Code clean up.
* sem_util.adb (Propagate_Invariant_Attributes): Code clean up.
gcc/testsuite/
* gnat.dg/assertion_policy1.adb, gnat.dg/assertion_policy1_pkg.adb,
gnat.dg/assertion_policy1_pkg.ads: New testcase.
[Ada] Double finalization of limited controlled result
This patch disables a build-in-place optimization when a function returns a
limited controlled result because the optimization may violate the semantics of
finalizable types by performing illegal calls to Finalize.
In general, the optimization causes the result object of a build-in-place
function to be allocated at the caller site, with a pointer to the object
passed to the function. The function then simply initializes the caller-
allocated object.
This mode of operation however violates semantics of finalizable types when
the context of the call is allocation. The act of allocating the controlled
object at the caller site will place it on the associated access type's
finalization master. If the function fails the initialization of the object,
the malformed object will still be finalized when the finalization master
goes out of scope. This is dangerous, and must not happen.
------------
-- Source --
------------
-- pack.ads
with Ada.Finalization; use Ada.Finalization;
package Pack is
type Lim_Ctrl is new Limited_Controlled with null record;
procedure Finalize (Obj : in out Lim_Ctrl);
type Lim_Ctrl_Ptr is access all Lim_Ctrl;
function Make_Lim_Ctrl_Bad_Init return Lim_Ctrl;
function Make_Lim_Ctrl_OK_Init return Lim_Ctrl;
end Pack;
-- pack.adb
with Ada.Text_IO; use Ada.Text_IO;
package body Pack is
procedure Finalize (Obj : in out Lim_Ctrl) is
begin
Put_Line (" Finalize");
end Finalize;
function Make_Lim_Ctrl_Bad_Init return Lim_Ctrl is
begin
return Result : Lim_Ctrl := raise Program_Error do
null;
end return;
end Make_Lim_Ctrl_Bad_Init;
function Make_Lim_Ctrl_OK_Init return Lim_Ctrl is
begin
return Result : Lim_Ctrl do
raise Program_Error;
end return;
end Make_Lim_Ctrl_OK_Init;
end Pack;
-- main.adb
with Ada.Text_IO; use Ada.Text_IO;
with Pack; use Pack;
procedure Main is
begin
begin
Put_Line ("1) Heap-allocated bad init");
declare
Obj : Lim_Ctrl_Ptr := new Lim_Ctrl'(Make_Lim_Ctrl_Bad_Init);
begin
Put_Line ("1) ERROR: Heap-allocated bad init: exception not raised");
end;
exception
when Program_Error =>
Put_Line ("1) Heap-allocated bad init: Program_Error raised");
when others =>
Put_Line ("1) ERROR: Heap-allocatd bad init: unexpected exception");
end;
begin
Put_Line ("2) Stack-allocated bad init");
declare
Obj : Lim_Ctrl := Make_Lim_Ctrl_Bad_Init;
begin
Put_Line ("2) ERROR: Stack-allocated bad init: exception not raised");
end;
exception
when Program_Error =>
Put_Line ("2) Stack-allocated bad init: Program_Error raised");
when others =>
Put_Line ("2) ERROR: Stack-allocated bad init: unexpected exception");
end;
begin
Put_Line ("3) Heap-allocated OK init");
declare
Obj : Lim_Ctrl_Ptr := new Lim_Ctrl'(Make_Lim_Ctrl_OK_Init);
begin
Put_Line ("3) ERROR: Heap-allocated OK init: exception not raised");
end;
exception
when Program_Error =>
Put_Line ("3) Heap-allocated OK init: Program_Error raised");
when others =>
Put_Line ("3) ERROR: Heap-allocatd OK init: unexpected exception");
end;
begin
Put_Line ("4) Stack-allocated OK init");
declare
Obj : Lim_Ctrl := Make_Lim_Ctrl_OK_Init;
begin
Put_Line ("4) ERROR: Stack-allocated OK init: exception not raised");
end;
exception
when Program_Error =>
Put_Line ("4) Stack-allocated OK init: Program_Error raised");
when others =>
Put_Line ("4) ERROR: Stack-allocated OK init: unexpected exception");
end;
end Main;
----------------------------
-- Compilation and output --
----------------------------
$ gnatmake -q main.adb
$ ./main
1) Heap-allocated bad init
1) Heap-allocated bad init: Program_Error raised
2) Stack-allocated bad init
2) Stack-allocated bad init: Program_Error raised
3) Heap-allocated OK init
Finalize
3) Heap-allocated OK init: Program_Error raised
4) Stack-allocated OK init
Finalize
4) Stack-allocated OK init: Program_Error raised
* exp_ch6.adb (Add_Unconstrained_Actuals_To_Build_In_Place_Call): Do
not add any actuals when the size of the object is known, and the
caller will allocate it.
(Build_Heap_Allocator): Rename to Build_Heap_Or_Pool_Allocator to
better illustrate its functionality. Update the comment on the
generated code. Generate a branch for the heap and pool cases where
the object is not necessarity controlled.
(Expand_N_Extended_Return_Statement): Expand the extended return
statement into four branches depending the requested mode if the caller
will not allocate the object on its side.
(Make_Build_In_Place_Call_In_Allocator): Do not allocate a controlled
object on the caller side because this will violate the semantics of
finalizable types. Instead notify the function to allocate the object
on the heap or a user-defined storage pool.
(Needs_BIP_Alloc_Form): A build-in-place function needs to be notified
which of the four modes to employ when returning a limited controlled
result.
* exp_util.adb (Build_Allocate_Deallocate_Proc): Remove a redundant
guard which is already covered in Needs_Finalization.
Olivier Hainque [Mon, 11 Jun 2018 09:19:22 +0000 (09:19 +0000)]
[Ada] Improve last exception info availability from C++ handlers
The Most_Recent_Exception service failed to provide accurate information on an
Ada exception caught by a C++ handler for foreign exceptions. The service
relies on updates of a "current exception buffer" from live exception objects
at various points of the propagation process and this update was not performed
early enough for the case of foreign exception handlers in non-Ada handlers.
The correction applied here consists in moving one of the updates earlier in
the raise process, just before unwinding starts, then refine the update API to
prevent a redundant copy during the unwinding search phase for the same
exception.
with Gnat.Most_Recent_Exception;
with Ada.Text_IO; use Ada.Text_IO;
package body EH is
procedure Ada_Trigger is
begin
raise Constraint_Error;
end;
procedure Ada_Occurrence_Info is
begin
Check_MRE ("CONSTRAINT_ERROR");
end;
function Pre_Check_MRE (Ename : String) return Exception_Id is
MROA : Exception_Occurrence_Access :=
GNAT.Most_Recent_Exception.Occurrence_Access;
begin
Put ("Checking Most_Recent_Exception for " & Ename & " ... ");
if MROA = null then
Put_Line ("Most recent exception occurrence access is NULL");
return Null_Id;
else
return Exception_Identity (MROA.all);
end if;
end;
procedure Diagnose_MRE (MRID : Exception_Id; Ok : Boolean) is
begin
if Ok then
Put_Line ("OK!");
else
Put_Line ("Err, Most_Recent_Exception was " & Exception_Name (MRID));
end if;
end;
procedure Check_MRE (Eid : Exception_Id) is
MRID : Exception_Id := Pre_Check_MRE (Ename => Exception_Name (Eid));
begin
Diagnose_MRE (MRID, Ok => Eid = MRID);
end;
procedure Check_MRE (Ename : String) is
MRID : Exception_Id := Pre_Check_MRE (Ename => Ename);
begin
Diagnose_MRE (MRID, Ok => Ename = Exception_Name (MRID));
end;
end;
-- eh.ads
with Ada.Exceptions; use Ada.Exceptions;
package EH is
procedure Ada_Trigger with
Export, Convention => C, External_Name => "_ada_trigger";
procedure Ada_Occurrence_Info with
Export, Convention => C, External_Name => "_ada_occurrence_info";
procedure Foo with Import, Convention => C, External_Name => "foo";
* libgnat/s-excmac*.ads: Factorize Unwind_Action definitions ...
* libgnat/a-exexpr.adb: ... Here, then add comments describing the
major datastructures associated with the current exception raised.
(Setup_Current_Excep): Accept a "Phase" argument conveying the
unwinding phase during which this subprogram is called. For an Ada
exception, don't update the current exception buffer from the raised
exception object during SEARCH_PHASE, as this is redundant with the
call now issued just before propagation starts.
(Propagate_GCC_Exception): Move call to Setup_Current_Excep ahead of
the unwinding start, conveying Phase 0.
(Unhandled_Except_Handler): Pass UA_CLEANUP_PHASE as the Phase value on
the call to Setup_Current_Excep.
* raise-gcc.c (personality_body): Pass uw_phases as the Phase argument
on calls to Setup_Current_Excep.
Ed Schonberg [Mon, 11 Jun 2018 09:19:17 +0000 (09:19 +0000)]
[Ada] Unnesting: refactor handling of uplevel refs. for unconstrained arrays
2018-06-11 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* exp_unst.ads, exp_unst.adb (Needs_Fat_Pointer,
Build_Access_Type_Decl): New subprograms to handle uplevel references
to formals of an unconstrained array type. The activation record
component for these is an access type, and the reference is rewritten
as an explicit derefenrence of that component.
Bob Duff [Mon, 11 Jun 2018 09:19:12 +0000 (09:19 +0000)]
[Ada] Dangling cursor checks in Element function
In Ada.Containers.Ordered_Maps, if a dangling cursor is passed to the Element
function, execution is erroneous. Therefore, the compiler is not obligated to
detect this error. However, this patch inserts code that will detect this error
in some cases, and raise Program_Error. The same applies to Ordered_Sets,
Ordered_Multisets, Indefinite_Ordered_Maps, Indefinite_Ordered_Sets, and
Indefinite_Ordered_Multisets. No test available for erroneous execution.
2018-06-11 Bob Duff <duff@adacore.com>
gcc/ada/
* libgnat/a-ciorma.adb, libgnat/a-ciormu.adb, libgnat/a-ciorse.adb,
libgnat/a-coorma.adb, libgnat/a-coormu.adb, libgnat/a-coorse.adb:
(Element): Add code to detect dangling cursors in some cases.
Yannick Moy [Mon, 11 Jun 2018 09:19:07 +0000 (09:19 +0000)]
[Ada] Mark parameters as coming from source for GNATprove
When building a separate subprogram declaration for possible inlining of
local subprograms in GNATprove mode, correctly mark subprogram parameters
as coming from source.
This has no impact on compilation.
2018-06-11 Yannick Moy <moy@adacore.com>
gcc/ada/
* sem_ch6.adb (Build_Subprogram_Declaration): Mark parameters as coming
from source.
Ed Schonberg [Mon, 11 Jun 2018 09:19:02 +0000 (09:19 +0000)]
[Ada] Missing predicate function body for derived type in nested package
This patch fixes a bug in the construction of predicate functions. For a
derived type, we must ensure that the parent type is already frozen so that its
predicate function has been constructed already. This is necessary if the
parent is declared in a nested package and its own freeze point has not been
reached when the derived type is frozen by a local object declaration.
2018-06-11 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch13.adb (Build_Predicate_Functions): For a derived type, ensure
that its parent is already frozen so that its predicate function, if
any, has already been constructed.
Eric Botcazou [Mon, 11 Jun 2018 09:18:49 +0000 (09:18 +0000)]
[Ada] Minor tweaks for Repinfo
2018-06-11 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* gnat1drv.adb: Remove use clause for Repinfo.
(Gnat1drv): Beef up comment about the interplay between -gnatc and
back-end annotations. Use full qualified name for List_Rep_Info.
Javier Miranda [Mon, 11 Jun 2018 09:18:33 +0000 (09:18 +0000)]
[Ada] Crash on protected type entry family
The compiler may blow up compiling a the body of a protected type that has a
family entry whose entry index specification contains a call to a function.
2018-06-11 Javier Miranda <miranda@adacore.com>
gcc/ada/
* exp_ch9.adb (Expand_N_Protected_Body): Add missing handling of
N_Call_Marker nodes.
Yannick Moy [Mon, 11 Jun 2018 09:18:12 +0000 (09:18 +0000)]
[Ada] Do not query the representation information in CodePeer/GNATprove
Representation information generated when user calls the compiler with -gnatR
switch is not available when running the frontend inside CodePeer or GNATprove.
Do not query such information in that case, as this leads to spurious messages
that it is not available.
There is no impact on compilation.
2018-06-11 Yannick Moy <moy@adacore.com>
gcc/ada/
* gnat1drv.adb: Do not check representation information in CodePeer and
GNATprove modes, as these modes call a special backend instead of gigi,
so do not have the information.
Yannick Moy [Mon, 11 Jun 2018 09:18:07 +0000 (09:18 +0000)]
[Ada] Mark extended return of unconstrained type as never inlined
Calls to subprograms whose body was an extended return of an unconstrained
type were marked as not inlined, while the subprogram itself was marked as
always inlined. This was inconsistent and could lead to crash in GNATprove.
Now such subprograms are marked as not candidates for inlining.
This mostly impacts GNATprove, as it relates to frontend inlining which is
not used anymore in normal compilation.
2018-06-11 Yannick Moy <moy@adacore.com>
gcc/ada/
* inline.adb (Build_Body_To_Inline): Consider case of extended return
of unconstrained type as one case where inlining is not supported.
(Expand_Inlined_Call): Remove special case for body as extended return
of unconstrained type.
Yannick Moy [Mon, 11 Jun 2018 09:18:01 +0000 (09:18 +0000)]
[Ada] Do not force Part_Of on generic units
This fixes the code checking SPARK RM 7.2.6(3) so that generic child units
are not forced to use Part_Of to relate their abstract state to the state
of their parent.
2018-06-11 Yannick Moy <moy@adacore.com>
gcc/ada/
* sem_prag.adb (Analyze_Part_Of): Only allow Part_Of on non-generic
unit.
(Check_Missing_Part_Of): Do not force Part_Of on generic unit.
gcc/testsuite/
* gnat.dg/part_of1-instantiation.adb,
gnat.dg/part_of1-instantiation.ads,
gnat.dg/part_of1-private_generic.adb,
gnat.dg/part_of1-private_generic.ads, gnat.dg/part_of1.ads: New
testcase.
Piotr Trojanek [Mon, 11 Jun 2018 09:17:56 +0000 (09:17 +0000)]
[Ada] Don't split AND THEN expressions in GNATprove_Mode
Splitting AND THEN expressions in contracts into separate pragma Check
is only useful for compilation when the error message points to a failed
conjunct. For proof it is of no use; for flow analysis it is annoying.
Also, it makes debugging harder. Now it is disabled in GNATprove_Mode.
Compilation is not affected, so no test provided.
2018-06-11 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* sem_ch13.adb (Analyze_Aspect_Specifications): Don't split AND THEN
expressions in Pre/Post contracts while in GNATprove_Mode.
Piotr Trojanek [Mon, 11 Jun 2018 09:17:51 +0000 (09:17 +0000)]
[Ada] Fix handling of Pre/Post contracts with AND THEN expressions
Pre- and postconditions with top-level AND THEN expressions are broken down
into checks of indivudial conjuncts for more precise error reporting. This
rewrite interfers with detection of potentially unevaluadted use of 'Old,
e.g. a contract like "Pre => Foo and then Bar" is rewritten into a two
pragmas Check, for expressions "Foo" and "Bar", but the latter remains
potentially unevaluted. This patch fixes detection of the AND THEN rewrite.
This fixes inlining in the GNATprove mode, i.e. the following testc case must
not emit a warning like:
contract1.adb:14:07: info:
no contextual analysis of "Foo" (in potentially unevaluated context)
2018-06-11 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* sem_util.adb (Is_Potentially_Unevaluated): Fix detection of contracts
with AND THEN expressions broken down into individual conjuncts.
Javier Miranda [Mon, 11 Jun 2018 09:17:29 +0000 (09:17 +0000)]
[Ada] Wrong code in array aggregates of Ada coextensions
The compiler generates wrong code when an array aggregate with an others choice
whose expression has nested object allocations (ie. others => new R (new S)) is
used to initialize an array of access to discriminated types whose discriminant
is an access type.
2018-06-11 Javier Miranda <miranda@adacore.com>
gcc/ada/
* sinfo.ads (Is_Dynamic_Coextension): Adding documentation.
(Is_Static_Coextension): Adding documentation.
* sinfo.adb (Is_Dynamic_Coextension): Extending the assertion.
(Is_Static_Coextension): Extending the assertion.
* sem_util.adb (Mark_Allocator): Clear Is_Static_Coextension when
setting flag Is_Dynamic_Coextension (and vice versa).
gcc/testsuite/
* gnat.dg/aggr23.adb, gnat.dg/aggr23_q.adb, gnat.dg/aggr23_tt.ads: New
testcase.
Ed Schonberg [Mon, 11 Jun 2018 09:17:24 +0000 (09:17 +0000)]
[Ada] Unnesting: fix handling of stubs
2018-06-11 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* exp_unst.adb (Search_Subprograms): Handle explicitly stubs at the top
level of a compilation unit, becuase they may contain nested
subprograms that need an activation record.
Ed Schonberg [Mon, 11 Jun 2018 09:17:04 +0000 (09:17 +0000)]
[Ada] Crash with Inline_Always on a function with an extended return
This patch fixes a crash on a unit with a function with the GNAT-specific
Inline_Always pragma whose body is an extended return statement, when compiling
with no optimization level specified.
2018-06-11 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* inline.adb (Expand_Inlined_Call): If no optimization level is
specified, the expansion of a call to an Inline_Always function is
fully performed in the front-end even on a target that support back-end
inlining.
This patch modifies the creation of markers for variable references in the
context of SPARK elaboration checks. Previously, prior to checking whether a
reference requires such a marker, the compiler performed a logarithmic look up
to determine whether the reference appears within a call. This action caused
the compiler to degrade when a source program contains multiple (100,000s)
references. Now, the compiler no longer performs the look up immediately.
* sem_ch8.adb (Find_Direct_Name): Mode the declaration of
Is_Assignment_LHS further in. Use predicate
Needs_Variable_Reference_Marker to determine whether to create a
variable marker.
(Find_Expanded_Name): Mode the declaration of Is_Assignment_LHS further
in. Use predicate Needs_Variable_Reference_Marker to determine whether
to create a variable marker.
* sem_elab.adb (Build_Variable_Reference_Marker): Remove the various
checks that determine whether the identifier or expanded name is a
suitable variable reference. The checks are now performed by
Needs_Variable_Reference_Marker.
* sem_res.adb (Resolve_Actuals): Use predicate
Needs_Variable_Reference_Marker to determine whether to create a
variable marker.
* sem_util.adb (Needs_Variable_Reference_Marker): New routine.
* sem_util.ads (Needs_Variable_Reference_Marker): New routine.
Ed Schonberg [Mon, 11 Jun 2018 09:16:43 +0000 (09:16 +0000)]
[Ada] Crash on instantiation of nested generic in private part
This patch fixes a compiler abort on an instantiation of a generic nested
within another instance, when the outer instance is declared in the visible
part of a package and the inner intance is in the private part of the same
package.
2018-06-11 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch12.adb (Install_Body): In order to determine the placement of
the freeze node for an instance of a generic nested within another
instance, take into account that the outer instance may be declared in
the visible part of a package and the inner intance may be in the
private part of the same package.
gcc/testsuite/
* gnat.dg/nested_generic2.adb, gnat.dg/nested_generic2.ads,
gnat.dg/nested_generic2_g1.adb, gnat.dg/nested_generic2_g1.ads,
gnat.dg/nested_generic2_g2.ads: New testcase.
Thomas Koenig [Sun, 10 Jun 2018 15:31:42 +0000 (15:31 +0000)]
gfortran.h (gfc_expr): Add no_bounds_check field.
2018-06-10 Thomas Koenig <tkoenig@gcc.gnu.org>
* gfortran.h (gfc_expr): Add no_bounds_check field.
* frontend-passes.c (get_array_inq_function): Set no_bounds_check
on function and function argument.
(inline_matmul_assign): Set no_bounds_check on zero expression
and on lhs of zero expression.
Also handle A1B2 case if realloc on assigment is active.
* trans-array.c (gfc_conv_array_ref): Don't do range checking
if expr has no_bounds_check set.
(gfc_conv_expr_descriptor): Set no_bounds_check on ss if expr
has it set.
* trans-expr.c (gfc_trans_assignment_1): Set no_bounds_check
on lss and lss if the corresponding expressions have it set.
Janus Weil [Sun, 10 Jun 2018 08:20:50 +0000 (10:20 +0200)]
re PR fortran/85088 (improve diagnostic for bad INTENT declaration ('Invalid character in name at'))
2018-06-10 Janus Weil <janus@gcc.gnu.org>
PR fortran/85088
* decl.c (match_attr_spec): Synchronize the DECL_* enum values with the
INTENT_* values from the enum 'sym_intent'. Call 'match_intent_spec'
and remove a TODO note.
* gfortran.h: Add a comment to sym_intent.
2018-06-10 Janus Weil <janus@gcc.gnu.org>
PR fortran/85088
* gfortran.dg/intent_decl_1.f90: New test case.
Thomas Koenig [Fri, 8 Jun 2018 22:04:11 +0000 (22:04 +0000)]
re PR fortran/85631 (Runtime error message array bound mismatch with nonzero optimization)
2018-06-08 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/85631
* trans.h (gfc_ss): Add field no_bounds_check.
* trans-array.c (gfc_conv_ss_startstride): If flag_realloc_lhs and
ss->no_bounds_check is set, do not use runtime checks.
* trans-expr.c (gfc_trans_assignment_1): Set lss->no_bounds_check
for reallocatable lhs.
2018-06-08 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/85631
* gfortran.dg/bounds_check_20.f90: New test.
Carl Love [Fri, 8 Jun 2018 20:09:46 +0000 (20:09 +0000)]
p8vector-builtin-3.c: Add vec_pack test.
gcc/testsuite/ChangeLog:
2018-06-08 Carl Love <cel@us.ibm.com>
* gcc.target/powerpc/p8vector-builtin-3.c: Add vec_pack test. Update
vpkudum counts.
* gcc.target/powerpc/p9-extract-3.c: Make second argument of
vec_extract a signed int.
* gcc.target/powerpc/vec-cmp.c: Add vec_cmple, vec_cmpge tests. Update,
vcmpgtsb, vcmpgtub, vcmpgtsh, vcmpgtuh, vcmpgtsw, vcmpgtsw, vcmpgtuw,
vcmpgtsd, vcmpgtud.
* gcc.target/powerpc/vsx-extract-4.c: Make second argument of
vec_extract a signed int.
* gcc.target/powerpc/vsx-extract-5.c: Make second argument of
vec_extract a signed int.
* gcc.target/powerpc/vsx-vector-7.c (foo): Add tests for vec_sel and
vec_xor builtins. Update xxsel, xxlxor counts.
Carl Love [Fri, 8 Jun 2018 15:22:31 +0000 (15:22 +0000)]
vsx-vector-6-be.p7.c: Rename this file to vsx-vector-6.p7.c.
gcc/testsuite/ChangeLog:
2018-06-08 Carl Love <cel@us.ibm.com>
* gcc.target/powerpc/vsx-vector-6-be.p7.c: Rename this file to
vsx-vector-6.p7.c.
* gcc.target/powerpc/vsx-vector-6-le.p9.c: Rename this file to
vsx-vector-6.p9.c.
* gcc.target/powerpc/vsx-vector-6-be.p8.c: Move instruction counts
for BE system that are different then for an LE system from this file
into vsx-vector-6-le.c using be target qualifier. Remove this file.
* gcc.target/powerpc/vsx-vector-6-le.c: Add le qualifiers as needed for
the various instruction counts. Rename file to vsx-vector-6.p8.c.
David Malcolm [Fri, 8 Jun 2018 12:50:19 +0000 (12:50 +0000)]
Convert dump and optgroup flags to enums
gcc/brig/ChangeLog:
* brigfrontend/brig-to-generic.cc
(brig_to_generic::write_globals): Use TDF_NONE rather than 0.
(dump_function): Likewise.
gcc/c-family/ChangeLog:
* c-pretty-print.c (c_pretty_printer::statement): Use TDF_NONE
rather than 0.
gcc/ChangeLog:
* cfg.c (debug): Use TDF_NONE rather than 0.
* cfghooks.c (debug): Likewise.
* dumpfile.c (DUMP_FILE_INFO): Likewise; also for OPTGROUP.
(struct dump_option_value_info): Convert to...
(struct kv_pair): ...this template type.
(dump_options): Convert to kv_pair<dump_flags_t>; use TDF_NONE
rather than 0.
(optinfo_verbosity_options): Likewise.
(optgroup_options): Convert to kv_pair<optgroup_flags_t>; use
OPTGROUP_NONE.
(gcc::dump_manager::dump_register): Use optgroup_flags_t rather
than int for "optgroup_flags" param.
(dump_generic_expr_loc): Use dump_flags_t rather than int for
"dump_kind" param.
(dump_dec): Likewise.
(dump_finish): Use TDF_NONE rather than 0.
(gcc::dump_manager::opt_info_enable_passes): Use optgroup_flags_t
rather than int for "optgroup_flags" param. Use TDF_NONE rather
than 0. Update for change to option_ptr.
(opt_info_switch_p_1): Convert "optgroup_flags" param from int *
to optgroup_flags_t *. Use TDF_NONE and OPTGROUP_NONE rather than
0. Update for changes to optinfo_verbosity_options and
optgroup_options.
(opt_info_switch_p): Convert optgroup_flags from int to
optgroup_flags_t.
(dump_basic_block): Use dump_flags_t rather than int
for "dump_kind" param.
* dumpfile.h (TDF_ADDRESS, TDF_SLIM, TDF_RAW, TDF_DETAILS,
TDF_STATS, TDF_BLOCKS, TDF_VOPS, TDF_LINENO, TDF_UID)
TDF_STMTADDR, TDF_GRAPH, TDF_MEMSYMS, TDF_RHS_ONLY, TDF_ASMNAME,
TDF_EH, TDF_NOUID, TDF_ALIAS, TDF_ENUMERATE_LOCALS, TDF_CSELIB,
TDF_SCEV, TDF_GIMPLE, TDF_FOLDING, MSG_OPTIMIZED_LOCATIONS,
MSG_MISSED_OPTIMIZATION, MSG_NOTE, MSG_ALL, TDF_COMPARE_DEBUG,
TDF_NONE): Convert from macros to...
(enum dump_flag): ...this new enum.
(dump_flags_t): Update to use enum.
(operator|, operator&, operator~, operator|=, operator&=):
Implement for dump_flags_t.
(OPTGROUP_NONE, OPTGROUP_IPA, OPTGROUP_LOOP, OPTGROUP_INLINE,
OPTGROUP_OMP, OPTGROUP_VEC, OPTGROUP_OTHER, OPTGROUP_ALL):
Convert from macros to...
(enum optgroup_flag): ...this new enum.
(optgroup_flags_t): New typedef.
(operator|, operator|=): Implement for optgroup_flags_t.
(struct dump_file_info): Convert field "alt_flags" to
dump_flags_t. Convert field "optgroup_flags" to
optgroup_flags_t.
(dump_basic_block): Use dump_flags_t rather than int for param.
(dump_generic_expr_loc): Likewise.
(dump_dec): Likewise.
(dump_register): Convert param "optgroup_flags" to
optgroup_flags_t.
(opt_info_enable_passes): Likewise.
* early-remat.c (early_remat::dump_edge_list): Use TDF_NONE rather
than 0.
* gimple-pretty-print.c (debug): Likewise.
* gimple-ssa-store-merging.c (bswap_replace): Likewise.
(merged_store_group::apply_stores): Likewise.
* gimple-ssa-strength-reduction.c (insert_initializers): Likewise.
* gimple.c (verify_gimple_pp): Likewise.
* graphite-poly.c (print_pbb_body): Likewise.
* passes.c (pass_manager::register_one_dump_file): Convert
local "optgroup_flags" to optgroup_flags_t.
* print-tree.c (print_node): Use TDF_NONE rather than 0.
(debug): Likewise.
(debug_body): Likewise.
* tree-pass.h (struct pass_data): Convert field "optgroup_flags"
to optgroup_flags_t.
* tree-pretty-print.c (print_struct_decl): Use TDF_NONE rather
than 0.
* tree-ssa-math-opts.c (convert_mult_to_fma_1): Likewise.
(convert_mult_to_fma): Likewise.
* tree-ssa-reassoc.c (undistribute_ops_list): Likewise.
* tree-ssa-sccvn.c (vn_eliminate): Likewise.
* tree-vect-data-refs.c (dump_lower_bound): Convert param
"dump_kind" to dump_flags_t.
Martin Liska [Fri, 8 Jun 2018 12:33:47 +0000 (14:33 +0200)]
Make cgraph_edge::uid really unique.
2018-06-08 Martin Liska <mliska@suse.cz>
* cgraph.c (symbol_table::create_edge): Always assign a new
unique number.
(symbol_table::free_edge): Do not recycle numbers.
* cgraph.h (cgraph_edge::get): New method.
* symbol-summary.h (symtab_removal): Use it.
(symtab_duplication): Likewise.
(call_summary::hashable_uid): Remove.
Martin Liska [Fri, 8 Jun 2018 12:29:44 +0000 (14:29 +0200)]
Port IPA CP to edge_clone_summaries.
2018-06-08 Martin Liska <mliska@suse.cz>
* ipa-cp.c (class edge_clone_summary): New summary.
(grow_edge_clone_vectors): Remove.
(ipcp_edge_duplication_hook): Remove.
(class edge_clone_summary_t): New call_summary class.
(ipcp_edge_removal_hook): Remove.
(edge_clone_summary_t::duplicate): New function.
(get_next_cgraph_edge_clone): Use edge_clone_summaries.
(create_specialized_node): Likewise.
(ipcp_driver): Initialize edge_clone_summaries and do not
register hooks.
Martin Liska [Fri, 8 Jun 2018 12:26:57 +0000 (14:26 +0200)]
Remove cgraph_node::summary_uid and make cgraph_node::uid really unique.
2018-06-08 Martin Liska <mliska@suse.cz>
* cgraph.c (cgraph_node::remove): Do not recycle uid.
* cgraph.h (symbol_table::release_symbol): Do not pass uid.
(symbol_table::allocate_cgraph_symbol): Do not set uid.
* passes.c (uid_hash_t): Record removed_nodes by their uids.
(remove_cgraph_node_from_order): Use the removed_nodes set.
(do_per_function_toporder): Likwise.
* symbol-summary.h (symtab_insertion): Use cgraph_node::uid
instead of summary_uid.
(symtab_removal): Likewise.
(symtab_duplication): Likewise.
2018-06-08 Martin Liska <mliska@suse.cz>
* lto-partition.c (lto_balanced_map): Use cgraph_node::uid
instead of summary_uid.
Martin Liska [Fri, 8 Jun 2018 12:16:18 +0000 (14:16 +0200)]
Covert ipa-pure-const.c to symbol_summary.
2018-06-08 Martin Liska <mliska@suse.cz>
* ipa-pure-const.c (struct funct_state_d): Do it class instead
of struct.
(class funct_state_summary_t): New function_summary class.
(has_function_state): Remove.
(get_function_state): Likewise.
(set_function_state): Likewise.
(add_new_function): Likewise.
(funct_state_summary_t::insert): New function.
(duplicate_node_data): Remove.
(remove_node_data): Remove.
(funct_state_summary_t::duplicate): New function.
(register_hooks): Create new funct_state_summaries.
(pure_const_generate_summary): Use it.
(pure_const_write_summary): Likewise.
(pure_const_read_summary): Likewise.
(propagate_pure_const): Likewise.
(propagate_nothrow): Likewise.
(dump_malloc_lattice): Likewise.
(propagate_malloc): Likewise.
(execute): Do not register hooks, just remove summary
instead.
(pass_ipa_pure_const::pass_ipa_pure_const): Simplify
constructor.
Martin Liska [Fri, 8 Jun 2018 12:14:57 +0000 (14:14 +0200)]
Use symtab_summary in ipa-reference.c.
2018-06-08 Martin Liska <mliska@suse.cz>
* ipa-reference.c (remove_node_data): Remove.
(duplicate_node_data): Likewise.
(class ipa_ref_var_info_summary_t): New class.
(class ipa_ref_opt_summary_t): Likewise.
(get_reference_vars_info): Use ipa_ref_var_info_summaries.
(get_reference_optimization_summary): Use
ipa_ref_opt_sum_summaries.
(set_reference_vars_info): Remove.
(set_reference_optimization_summary): Likewise.
(ipa_init): Create summaries.
(init_function_info): Use function summary.
(ipa_ref_opt_summary_t::duplicate): New function.
(ipa_ref_opt_summary_t::remove): New function.
(get_read_write_all_from_node): Fix GNU coding style.
(propagate): Use function summary.
(write_node_summary_p): Fix GNU coding style.
(stream_out_bitmap): Likewise.
(ipa_reference_read_optimization_summary): Use function summary.
(ipa_reference_c_finalize): Do not release hooks.