1. 24 May, 2018 39 commits
    • [AArch64, Falkor] Falkor address costs tuning · 8d39ea2f
      Switch from using generic address costs to using Falkor-specific ones, which
      give Falkor better results overall.
      
      gcc/ChangeLog:
      
      2018-05-24  Luis Machado  <luis.machado@linaro.org>
      
      	* config/aarch64/aarch64.c (qdf24xx_addrcost_table): New static
      	global.
      	(qdf24xx_tunings) <addr_costs>: Set to qdf24xx_addrcost_table.
      
      From-SVN: r260675
      Luis Machado committed
    • PR c++/85864 - literal template and default template arg. · 1268ecc2
      	* pt.c (instantiation_dependent_r): Handle NONTYPE_ARGUMENT_PACK.
      
      From-SVN: r260672
      Jason Merrill committed
    • re PR c++/85847 (unexpected expression of kind template_id_expr) · ea219e6e
      	PR c++/85847
      	* init.c (build_new_1): Use fold_non_dependent_expr.  Use a dedicated
      	variable for its result.  Fix a condition.
      	(build_new): Use fold_non_dependent_expr.  Tweak a condition.
      
      	* g++.dg/cpp0x/new3.C: New test.
      
      From-SVN: r260671
      Marek Polacek committed
    • [Ada] Simplify routines with a local Result variable · 672dfc39
      Local variable Result that is modified inside IF statements makes a seemingly
      trivial code slightly hard to understand. This patch rewrites such a pattern.
      
      Semantics unaffected.
      
      2018-05-24  Piotr Trojanek  <trojanek@adacore.com>
      
      gcc/ada/
      
      	* sem_elab.adb (Non_Private_View): Simplify by removing a local Result
      	variable.
      	* sem_prag.adb (Get_Base_Subprogram): Same as above.
      
      From-SVN: r260670
      Piotr Trojanek committed
    • [Ada] Fix irregular output with -gnatR3 · 63a329f8
      This fixes a long-standing quirk present in the layout information for record
      types displayed by the -gnatR3 switch: when a component has a variable
      (starting) position, its corresponding line in the output has an irregular and
      awkward format.  After this change, the format is the same as in all the other
      cases.
      
      For the following record:
      
          type R (m : natural) is record
              s : string (1 .. m);
              r : natural;
              b : boolean;
          end record;
          for R'alignment use 4;
          pragma Pack (R);
      
      the output of -gnatR3 used to be:
      
      for R'Object_Size use 17179869248;
      for R'Value_Size use ((#1 + 8) * 8);
      for R'Alignment use 4;
      for R use record
         m at  0 range  0 .. 30;
         s at  4 range  0 .. ((#1 * 8)) - 1;
         r at bit offset (((#1 + 4) * 8)) size in bits = 31
         b at bit offset ((((#1 + 7) * 8) + 7)) size in bits = 1
      end record;
      
      and is changed into:
      
      for R'Object_Size use 17179869248;
      for R'Value_Size use ((#1 + 8) * 8);
      for R'Alignment use 4;
      for R use record
         m at  0 range  0 .. 30;
         s at  4 range  0 .. ((#1 * 8)) - 1;
         r at (#1 + 4) range  0 .. 30;
         b at (#1 + 7) range  7 ..  7;
      end record;
      
      2018-05-24  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* fe.h (Set_Normalized_First_Bit): Declare.
      	(Set_Normalized_Position): Likewise.
      	* repinfo.adb (List_Record_Layout): Do not use irregular output for a
      	variable position.  Fix minor spacing issue.
      	* gcc-interface/decl.c (annotate_rep): If a field has a variable
      	offset, compute the normalized position and annotate it in addition to
      	the bit offset.
      
      From-SVN: r260669
      Eric Botcazou committed
    • [Ada] Minor clean-ups in gigi · 736e16ef
      2018-05-24  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* gcc-interface/trans.c (Handled_Sequence_Of_Statements_to_gnu):
      	Constify and rename variables.  Fix formatting.
      	(gnat_to_gnu) <N_Exception_Handler>: Minor tweak.
      	<N_Raise_Statement>: Likewise.
      
      From-SVN: r260668
      Eric Botcazou committed
    • [Ada] Wrong renaming of variant record equality · 01243764
      For a renaming of the equality operator of a variant record the compiler
      erroneously generates code that compares all the record component (thus
      computing wrong results).
      
      After this patch the following test provides the correct results.
      
      package Types is
         type Data (Bool : Boolean := False) is record
            case Bool is
               when False =>
                  null;
      
               when True =>
                  Val1 : Integer range 0 .. 2 ** 23 - 1;
                  Val2 : Float;
            end case;
         end record;
      
         function IsEqual (Left, Right : Data) return Boolean renames "=";
      end Types;
      
      with Types;
      with Ada.Text_IO;
      procedure Main is
         A : Types.Data := Types.Data'(Bool => True,
                                       Val1 => 16#05A5A5#,
                                       Val2 => 999999999.0);
      
         B : Types.Data := Types.Data'(Bool => True,
                                       Val1 => 16#0A5A5A#,
                                       Val2 => 6666666666.0);
         use type Types.Data;
      begin
         A := (Bool => False);             --  Test
         B := (Bool => False);             --  Test
      
         if Types.IsEqual (A, B) then      --  Test
            Ada.Text_IO.Put_Line ("OK");
         else
            Ada.Text_IO.Put_Line ("ERROR");
         end if;
      end Main;
      
      Command: gnatmake main; ./main
       Output: OK
      
      2018-05-24  Javier Miranda  <miranda@adacore.com>
      
      gcc/ada/
      
      	* exp_ch8.adb (Build_Body_For_Renaming): Adding support to build the
      	body of a variant record equality renaming.
      	(Expand_N_Subprogram_Renaming_Declaration): Adapt the code to the new
      	implementation of Build_Body_For_Renaming.
      	* exp_ch3.ads (Build_Variant_Record_Equality): New library level
      	function that factorizes the functionality needed by
      	Build_Body_For_Renaming and Expand_Freeze_Record_Type to build the body
      	of a variant record equality subprogram.
      	* exp_ch3.adb (Build_Variant_Record_Equality): New subprogram.
      	(Build_Variant_Record_Equality): New local procedure of
      	Expand_Freeze_Record_Type containing all the code specific for freezing
      	the record type that cannot be place in the new library level function.
      
      From-SVN: r260667
      Javier Miranda committed
    • [Ada] Add a new Is_Activation_Record flag on IN parameters · 7037d2bb
      2018-05-24  Ed Schonberg  <schonberg@adacore.com>
      
      gcc/ada/
      
      	* einfo.ads, einfo.adb (Is_Activation_Record): New flag on
      	in_parameters, used when unesting subprograms for LLVM, to indicate
      	that a generated parameter carries the activation record from the
      	enclosing subprogram.
      	* exp_unst.adb (Check_Static_Type): Handle array attributes of types
      	whose bounds may contain up-level references that need to be added to
      	an activation recoord.
      	(Add_Extra_Formal): Set Is_Activation_Record on new formal.
      
      From-SVN: r260666
      Ed Schonberg committed
    • [Ada] Improve GNATprove messages on unproved checks · d72ba19f
      GNATprove messages may point out to part of an assertion as not being proved,
      and in such a case it displays the sub-expression. This code relies on
      Pprint.Expression_Image, which is improved here to display better some kinds of
      expressions.
      
      There is no impact on compilation.
      
      2018-05-24  Yannick Moy  <moy@adacore.com>
      
      gcc/ada/
      
      	* pprint.adb (Expression_Image): Improve the printing of expressions,
      	by taking more cases into account, in particular qualified expressions
      	and aggregates.  Also count more the number of parentheses to close
      	after the expression.
      
      From-SVN: r260665
      Yannick Moy committed
    • [Ada] Missing error on illegal access to discriminant · 24e95966
      The compiler does not report an error on the illegal access to a renamed
      discriminant when the actual object is a parameter of a subprogram.
      
      2018-05-24  Javier Miranda  <miranda@adacore.com>
      
      gcc/ada/
      
      	* sem_ch3.adb (Is_Visible_Component): For untagged types add missing
      	check for renamed discriminants.
      	* sem_ch4.adb (Analyze_Overloaded_Selected_Component,
      	Analyze_Selected_Component, Check_Misspelled_Selector): For calls to
      	Is_Visible_Component pass the associated selector node to allow
      	checking renamed discriminants on untagged types.
      
      gcc/testsuite/
      
      	* gnat.dg/discr52.adb: New testcase.
      
      From-SVN: r260664
      Javier Miranda committed
    • [Ada] Infinite loop in the compiler when warning on redundant constructs · 5a5925ee
      This patch fixes an infinite loop in the compiler when warnings on redundant
      constructs are enabled (-gnatwr) and the constructs are use_type clauses
      that appear (redundantly) in a parent unit and a child unit.
      
      The following command:
      
         gcc -c -gnatwr root-child.ads
      
      must yield:
      
         root-child.ads:2:01: warning: "Pack.Typ" is already use-visible through
         previous use_type_clause at root.ads:2
      
      The following must compile quietly:
      
         gcc -c -gnatwr root-child-grand.ads
      
      ----
      package Pack is
        type Typ is new Integer;
      end Pack;
      ----
      with Pack;
      use type Pack.Typ;
      package Root is
        Thing1 : Pack.Typ;
      end Root;
      ----
      with pack;
      use type pack.typ;
      package Root.Child is
        Thing2 : Pack.Typ := Root.Thing1 * 3;
      end;
      ----
      with Pack;
      use type Pack.Typ;
      package Root.Child.Grand is
        Thing3 : Pack.Typ := Thing1 + Thing2;
      end;
      
      2018-05-24  Ed Schonberg  <schonberg@adacore.com>
      
      gcc/ada/
      
      	* sem_ch8.adb (Analyze_Use_Type): Do not assign the Prev_Use_Clause
      	link to a use_type clause if this would cause an infinite loop in the
      	machinery that detects redundant use clauses. This may happen when the
      	redundant clauses appear in the context of a child unit and the context
      	of its parent.
      
      From-SVN: r260663
      Ed Schonberg committed
    • [Ada] Minor fix grammar in comment of N_Defining_Identifier · e15bbd5f
      2018-05-24  Piotr Trojanek  <trojanek@adacore.com>
      
      gcc/ada/
      
      	* sinfo.ads: Fix grammar in comment.
      
      From-SVN: r260662
      Piotr Trojanek committed
    • [Ada] Quadratic compile time with tagged types · 3f6d1daa
      This patch is an incremental commit which focuses on the optimization of entity
      chain navigation by adding an additional field (Prev_Entity) to all nodes in
      order to greaty speed up compilation of sources making heavy use of tagged
      derivations by effectly making the entity chain from a singly-linked list into
      a doubly-linked one.
      
      This is only a performance improvement: no compilation result change
      expected.
      
      2018-05-24  Justin Squirek  <squirek@adacore.com>
      
      gcc/ada/
      
      	* einfo.ads, einfo.adb (Append_Entity): Modified to use Link_Entities
      	and manage doubly-linked entity chain.
      	(Nested_Scenarios): Removed entity field used for optimization during
      	 elaboration to make room for the new field Prev_Entity.
      	(Link_Entities): Added to replace redundant calls to Set_Next_Entity
      	and Set_Prev_Entity as well as centralize changes to the entity chain.
      	(Predicated_Parent): Modified to use Node38.
      	(Prev_Entity): Added to fetch new node field Prev_Entity in all entity
      	types.
      	(Remove_Entity): Moved from sem_util.
      	(Set_Nested_Scenarios): Deleted.
      	(Set_Predicated_Parent): Modified to use Node38.
      	(Set_Prev_Entity): Added to set Prev_Entity field.
      	(Set_Validated_Object): Modified to use Node38.
      	(Unlink_Next_Entity): Added to process Prev_Entity when an unlinking
      	action is required.
      	(Validated_Object): Modified to use Node38.
      	(Write_Field36_Name): Remove Nested_Scenarios, Validated_Object, and
      	predicated parent cases.
      	(Write_Field38_Name): Add predicated parent and Validated_Object cases.
      	* sem_ch3.adb (Process_Subtype): Add guard to protect against
      	inappropriate marking of Predicated_Parent to non-itype subtypes.
      	(Make_Class_Wide_Type): Preserve Prev_Entity field and set in new type.
      	(Copy_And_Swap): Add setting of Prev_Entity.
      	(Build_derived_Record_Type): Replace Set_Next_Entity w/ Link_Entities.
      	* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Replace Set_Next_Entity
      	w/ Link_Entities.
      	(New_Overloaded_Entity): Remove block created to search for previous
      	entities in the entity chain with relevant calls to Prev_Entity as well
      	as replace duplicated code from Remove_Entity_And_Homonym with a call
      	to that subprogram.
      	* sem_ch7.adb (Exchange_Declarations): Replace Set_Next_Entity w/
      	Link_Entities.
      	* sem_elab.adb (Find_And_Process_Nested_Scenarios): Remove global and
      	initial subprogram declarations related to Nested_Scenarios.
      	(Process_Nested_Scenarios): Deleted.
      	(Save_Scenario): Deleted.
      	(Traverse_Body): Remove optimization for Nested_Scenarios so as to free
      	node space in the entity tree.
      	* sem_util.adb, sem_util.ads (Remove_Entity): Moved to einfo.
      	(Remove_Entity_And_Homonym): Added to separate functionality of
      	Remove_Entity from the homonym chain directly.
      	* exp_attr.adb (Expand_N_Attribute_Reference): Replace Set_Next_Entity
      	w/ Link_Entities and Unlink_Next_Entity.
      	* exp_ch3.adb (Expand_N_Object_Declaration): Replace Set_Next_Entity w/
      	Link_Entities.
      	* exp_ch6.adb (Replace_Renaming_Declaration_Id): Replace
      	Set_Next_Entity w/ Link_Entities.
      	* exp_disp.adb (Expand_Dispatching_Call): Replace Set_Next_Entity w/
      	Link_Entities and Unlink_Next_Entity.
      	* exp_spark.adb (Expand_SPARK_N_Object_Renaming_Declaration): Replace
      	call to Remove_Entity with its new incarnation.
      	* exp_util.adb (New_Class_Wide_Subtype): Add setting of Prev_Entity.
      	* freeze.adb (Freeze_Record_Type): Replace Set_Next_Entity w/
      	Link_Entities.
      
      From-SVN: r260661
      Justin Squirek committed
    • [Ada] Spurious error due to lingering limited view · dc59bed2
      This patch modifies the mechanism which manages [private] with clauses to
      uninstall a limited with clause if a non-limited with clause is given for
      the same package.
      
      The management of with clauses already prevents the installation of a limited
      with clause if the related package is already withed though a non-limited with
      clause. The timing of parent unit with clause processing is such that the non-
      limited clauses of the child unit are first installed, followed by the clauses
      of the parent. This order prevents a limited with clause from "overriding" a
      non-limited with clause.
      
      Private with clauses however break this model because they are processed when
      the private part of a package is entered. Since private with clauses are non-
      limited with clauses, they must "override" the effects of any limited clauses
      which import the same packages. This effect is now correctly achieved by
      uninstalling the limited with clauses when private with clauses are activated.
      
      ------------
      -- Source --
      ------------
      
      --  server.ads
      
      package Server is
         type Root is tagged private;
      private
         type Root is tagged null record;
      end Server;
      
      --  parent.ads
      
      limited with Server;
      
      package Parent is end Parent;
      
      --  parent-client.ads
      
      private with Server;
      
      package Parent.Client is
         type Deriv is tagged private;
      private
         type Deriv is new Server.Root with null record;
      end Parent.Client;
      
      -----------------
      -- Compilation --
      -----------------
      
      $ gcc -c parent-client.ads
      
      2018-05-24  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* sem_ch10.adb (Expand_Limited_With_Clause): Update the call to
      	Install_Limited_Withed_Unit.
      	(Expand_With_Clause): Update the call to Install_Withed_Unit.
      	(Implicit_With_On_Parent): Update the call to Install_Withed_Unit.
      	(Install_Context_Clauses): Update the call to Install_Withed_Unit.
      	(Install_Limited_Context_Clauses): Update the calls to
      	 Install_Limited_Withed_Unit.
      	(Install_Limited_Withed_Unit): Renamed to better illustrate its
      	purpose.
      	(Install_Private_With_Clauses): Update the calls to Install_Withed_Unit
      	and Install_Limited_Withed_Unit.
      	(Install_With_Clause): Uninstall a limited with clause if a [private]
      	with clause is given for the same package.
      	(Install_Withed_Unit): Renamed to better illustrate its purpose.
      	(Remove_Limited_With_Unit): New routine.
      
      From-SVN: r260660
      Hristian Kirtchev committed
    • [Ada] Handle version 2 of Windows unwinding information structures · 45c6d784
      2018-05-24  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* raise-gcc.c (__gnat_SEH_error_handler): Remove prototype.
      	(__gnat_personality_seh0): Adjust and beef up comments, and
      	fix formatting throughout.
      	(__gnat_adjust_context): Deal minimally with version 2.
      	* seh_init.c (__gnat_map_SEH): Fix formatting.
      	(_gnat_SEH_error_handler): Adjust comments.
      	(__gnat_install_SEH_handler): Fix formatting.
      
      From-SVN: r260659
      Eric Botcazou committed
    • [Ada] Minor reformatting · b6784d90
      2018-05-24  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* exp_ch7.adb, sem_ch3.adb, sem_res.adb: Minor reformatting.
      
      From-SVN: r260658
      Hristian Kirtchev committed
    • [Ada] Add warning on redundant others_clause in array aggregate · 861e589e
      This patch adds a warning on a redundant others_clause in an array aggregate
      when all index positions are already specified in previous positional or named
      associations. The warning is emitted when Warn_On_Redundant_Constructs is
      enabled.
      
      2018-05-24  Ed Schonberg  <schonberg@adacore.com>
      
      gcc/ada/
      
      	* exp_aggr.adb (Flatten): Add a warning on an others clause in an array
      	aggregate with static bounds when named associations cover all index
      	positions and the others clause is redundant.
      
      gcc/testsuite/
      
      	* gnat.dg/others1.adb: New testcase.
      
      From-SVN: r260657
      Ed Schonberg committed
    • [Ada] Update Ada.Containers.Hashed_Maps documentation with Ada RM doc. · 0347c01b
      2018-05-24  Raphael Amiard  <amiard@adacore.com>
      
      gcc/ada/
      
      	* libgnat/a-cohama.ads: Add documentation.
      
      From-SVN: r260656
      Raphael Amiard committed
    • [Ada] Add documentation from the Ada RM to Ada.Containers.Vector · 8f1b88f8
      2018-05-24  Raphael Amiard  <amiard@adacore.com>
      
      gcc/ada/
      
      	* libgnat/a-convec.ads: Add documentation.
      
      From-SVN: r260655
      Raphael Amiard committed
    • [Ada] Crash on return of raise expression · c06a59be
      This patch fixes an issue whereby the compiler regarded assignments to limited
      that consisted of raise expressions to be a compile-time error during
      expansion.
      
      2018-05-24  Justin Squirek  <squirek@adacore.com>
      
      gcc/ada/
      
      	* exp_ch3.adb (Expand_N_Object_Declaration): Ignore raising an error in
      	expansion for limited tagged types when the node to be expanded is a
      	raise expression due to it not representing a valid object.
      	* exp_ch5.adb (Expand_N_Assignment_Statement): Add exception to error
      	message regarding assignments to limited types to ignore genereated
      	code.
      
      gcc/testsuite/
      
      	* gnat.dg/raise_expr.adb: New testcase.
      
      From-SVN: r260654
      Justin Squirek committed
    • [Ada] Crash on function in Ghost subunit · fa3717c1
      This patch modifies the creation of class-wide subtypes to preserve vital
      attributes related to Ghost code. The subtype is created by copying the
      contents of a class-wide type into a newly created itype. When the itype
      is created within a Ghost region, the act of copying destroys Ghost code
      related attributes. As a result, if the now living class-wide subtype is
      frozen within an ignored Ghost region, its freeze node is hoisted prior
      to the start of the region, howeve the subtype is still eliminated from
      the tree.
      
      ------------
      -- Source --
      ------------
      
      --  pack.ads
      
      with Ada.Finalization; use Ada.Finalization;
      
      package Pack is
         type Ctrl is new Controlled with null record;
         function Make_Ctrl return Ctrl;
      
         package Nested with Ghost is
            procedure Proc;
         end Nested;
      end Pack;
      
      --  pack.adb
      
      package body Pack is
         function Make_Ctrl return Ctrl is
         begin
            return Result : Ctrl;
         end Make_Ctrl;
      
         package body Nested is separate;
      end Pack;
      
      --  pack-nested.adb
      
      separate (Pack)
      
      package body Nested is
         procedure Proc is
            Res : constant Ctrl'Class := Make_Ctrl;
         begin null; end Proc;
      end Nested;
      
      -----------------
      -- Compilation --
      -----------------
      
      $ gcc -c pack.adb
      
      2018-05-24  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* exp_util.adb (New_Class_Wide_Subtype): Capture and restore relevant
      	Ghost-related attributes of the class-wide subtype because the copy
      	clobbers them.
      
      From-SVN: r260653
      Hristian Kirtchev committed
    • [Ada] Ineffective use warning is suppressed when performing verification · 36e7d49f
      This patch fixes an issue whereby the compiler incorrectly marked use clauses
      as effective due to code generated for verification referencing certain types
      leading to missing use clause warnings.
      
      No reasonably small testcase available.
      
      2018-05-24  Justin Squirek  <squirek@adacore.com>
      
      gcc/ada/
      
      	* sem_res.adb (Resolve_Entity_Name): Add guard to protect against
      	marking use clauses as effective when the reference appears within
      	generated code.
      
      From-SVN: r260652
      Justin Squirek committed
    • [Ada] Fix typos in documentation · 37a104ea
      2018-05-24  Cyrille Comar  <comar@adacore.com>
      
      gcc/ada/
      
      	* doc/gnat_rm/the_gnat_library.rst: Fix typos.
      	* gnat_rm.texi: Regenerate.
      
      From-SVN: r260651
      Cyrille Comar committed
    • [Ada] Memory leak mixing limited and nonlimited functions · 9a975bfc
      This patch fixes a memory leak. If a build-in-place function with a result
      whose size is not known at the call site is called, and that function calls a
      non-build-in-place function that allocates on the secondary stack, the
      secondary stack was not necessarily cleaned up, which caused a memory leak.
      
      The following program should print:
      "Current allocated space :  0 bytes"
      (among other things) in the loop.
      
      ./bip_leak-main > log
      grep 'Current allocated' log
        Current allocated space :  0 bytes
        Current allocated space :  0 bytes
        Current allocated space :  0 bytes
      
      with Ada.Finalization;
      package BIP_Leak is
         subtype Limited_Controlled is Ada.Finalization.Limited_Controlled;
      
         type Nonlim_Controlled is new Ada.Finalization.Controlled with null record;
         type Needs_Fin is record
            X : Nonlim_Controlled;
         end record;
      
         type Lim_Controlled is new Limited_Controlled with null record;
      
         function Return_Lim_Controlled (Source : Boolean)
                             return Lim_Controlled;
      
         procedure Dump_SS;
      
      end BIP_Leak;
      
      with Ada.Text_IO;
      pragma Warnings (Off);
      with System.Secondary_Stack;
      pragma Warnings (On);
      package body BIP_Leak is
         function Transform (X : Needs_Fin) return Lim_Controlled is
         begin
            return (Limited_Controlled with null record);
         end;
      
         function Return_Needs_Fin (I : Boolean) return Needs_Fin is
           THR : Needs_Fin;
         begin
            return THR;
         end;
      
         function Return_Lim_Controlled (Source : Boolean)
                             return Lim_Controlled is
         begin
            return Transform (Return_Needs_Fin (Source));
         end Return_Lim_Controlled;
      
         procedure Dump_SS_Instance is
           new System.Secondary_Stack.SS_Info (Ada.Text_IO.Put_Line);
         procedure Dump_SS renames Dump_SS_Instance;
      
      end BIP_Leak;
      
      procedure BIP_Leak.Main is
      begin
         for Count in 1 .. 350_000 loop
            declare
               Msg : constant Lim_Controlled := Return_Lim_Controlled (True);
            begin
               if Count mod 100_000 = 0 then
                  Dump_SS;
               end if;
            end;
         end loop;
      end BIP_Leak.Main;
      
      2018-05-24  Bob Duff  <duff@adacore.com>
      
      gcc/ada/
      
      	* exp_ch7.adb (Expand_Cleanup_Actions): Create a mark unconditionally
      	for build-in-place functions with a caller-unknown-size result.
      	(Create_Finalizer): For build-in-place functions with a
      	caller-unknown-size result, check at run time whether we need to
      	release the secondary stack.
      
      From-SVN: r260650
      Bob Duff committed
    • [Ada] Spurious error on pragma Independent_Components · d2bb0bbf
      This patch modifies the analysis of pragma Independent_Components to account
      for a side effect from handling of self-referential records which render the
      pragma illegal.
      
      ------------
      -- Source --
      ------------
      
      --  pack.ads
      
      package Pack is
         type OK is record
            Comp_1 : Integer;
            Comp_2 : access OK;
         end record;
         pragma Independent_Components (OK);
      
         type Error;
         pragma Independent_Components (Error);
         type Error is record
            Comp : Integer;
         end record;
      end Pack;
      
      ----------------------------
      -- Compilation and output --
      ----------------------------
      
      $ gcc -c pack.ads
      pack.ads:9:04: representation item must be after full type declaration
      
      2018-05-24  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* sem_prag.adb (Analyze_Pragma): Use the full view of an internally
      	generated incomplete type.
      
      From-SVN: r260649
      Hristian Kirtchev committed
    • [Ada] Fix crash on formal containers · 9057bd6a
      This patch modifies several mechanisms in the compiler:
      
      1) The handling of Ghost regions now records the start of the outermost ignored
         Ghost region which is currently in effect.
      
      2) Generation of freeze actions for an arbitrary entity now inserts the actions
         prior to the start of the outermost ignored Ghost region when the freezing
         takes effect within an ignored Ghost region, but the entity being frozen is
         "living". This ensures that any freeze actions associated with the living
         entity will not be eliminated from the tree once ignored Ghost code is
         stripped away.
      
      3) The Default_Initial_Condition and Invariant procedures are not treated as
         primitives even when they apply to tagged types. These procedures already
         employ class-wide precondition-like semantics to handle inheritance and
         overriding. In addition, the procedures cannot be invoked from source and
         should not be targets of dispatching calls.
      
      2018-05-24  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* expander.adb (Expand): Update the save and restore of the Ghost
      	region.
      	* exp_ch3.adb (Freeze_Type): Likewise.
      	* exp_disp.adb (Make_DT): Likewise.
      	* exp_util.adb (Build_DIC_Procedure_Body): Likewise.
      	(Build_DIC_Procedure_Declaration): Likewise.
      	(Build_Invariant_Procedure_Body): Likewise.
      	(Build_Invariant_Procedure_Declaration): Likewise.
      	(Make_Predicate_Call): Likewise.
      	* freeze.adb (Add_To_Result): Insert the freeze action of a living
      	entity prior to the start of the enclosing ignored Ghost region.
      	(Freeze_Entity): Update the save and restore of the Ghost region.
      	* ghost.adb (Install_Ghost_Mode): Reimplemented.
      	(Install_Ghost_Region): New routine.
      	(Mark_And_Set_Ghost_Assignment): Install a region rather than a mode.
      	(Mark_And_Set_Ghost_Body): Likewise.
      	(Mark_And_Set_Ghost_Completion): Likewise.
      	(Mark_And_Set_Ghost_Declaration): Likewise.
      	(Mark_And_Set_Ghost_Instantiation): Likewise.
      	(Mark_And_Set_Ghost_Procedure_Call): Likewise.
      	(Name_To_Ghost_Mode): New routine.
      	(Restore_Ghost_Region): New routine.
      	* ghost.ads (Install_Ghost_Region): New routine.
      	(Restore_Ghost_Region): New routine.
      	* opt.ads: Add new global variable Ignored_Ghost_Region.
      	* rtsfind.adb (Load_RTU): Update the save and restore of the Ghost
      	region. Install a clean region.
      	* sem.adb (Analyze): Likewise.
      	(Do_Analyze): Likewise.
      	* sem_ch3.adb (Analyze_Object_Declaration): Likewise
      	(Derive_Progenitor_Subprograms): Use local variable Iface_Alias to
      	capture the ultimate alias of the current primitive.
      	(Process_Full_View): Update the save and restore of the Ghost region.
      	Do not inherit DIC and invariant procedures.
      	* sem_ch5.adb (Analyze_Assignment): Update the save and restore of the
      	Ghost region.
      	* sem_ch6.adb (Analyze_Procedure_Call): Likewise.
      	(Analyze_Subprogram_Body_Helper): Likewise.
      	* sem_ch7.adb (Analyze_Package_Body_Helper): Likewise.
      	* sem_ch12.adb (Analyze_Package_Instantiation): Likewise.
      	(Analyze_Subprogram_Instantiation): Likewise.
      	(Instantiate_Package_Body): Likewise.
      	(Instantiate_Subprogram_Body): Likewise.
      	* sem_ch13.adb (Build_Predicate_Functions): Likewise.
      	(Build_Predicate_Function_Declaration): Likewise.
      	* sem_disp.adb
      	(Add_Dispatching_Operation): Do not consider DIC and invariant
      	procedures.
      	(Check_Dispatching_Operation): Use Add_Dispatching_Operation to collect
      	a dispatching subprogram.
      	(Check_Operation_From_Private_View): Likewise.
      	(Override_Dispatching_Operation): Likewise.
      	* sem_prag.adb (Analyze_Contract_Cases_In_Decl_Part): Update the save
      	and restore of the Ghost region.
      	(Analyze_Initial_Condition_In_Decl_Part): Likewise.
      	(Analyze_Pragma): Update the save and restore of the Ghost region.
      	(Analyze_Pre_Post_Condition_In_Decl_Part): Likewise.
      	* sem_util.adb (Is_Suitable_Primitive): New routine.
      	* sem_util.ads (Is_Suitable_Primitive): New routine.
      	* sinfo.ads: Update the section of Ghost regions.
      
      gcc/testsuite/
      
      	* gnat.dg/formal_containers.adb: New testcase.
      
      From-SVN: r260648
      Hristian Kirtchev committed
    • [Ada] Fix inconsistent documentation for the Contract_Cases pragma · 883ccddf
      This patch propagates the renaming from "condition" to "case guard" in the
      contract grammar to the paragraphs that describe the pragma semantics.
      
      2018-05-24  Piotr Trojanek  <trojanek@adacore.com>
      
      gcc/ada/
      
      	* doc/gnat_rm/implementation_defined_pragmas.rst (Contract_Cases):
      	Change "condition" to "case guard" after renaming in the contract
      	grammar.
      	* gnat_rm.texi: Regenerate.
      
      From-SVN: r260647
      Piotr Trojanek committed
    • [Ada] Expansion of discrete choices · ebea257e
      This patch does some minor bookkeeping to avoid a potential double expansion
      of discrete choices where at least one of them is a subtype with predicates.
      No change in behavior, no need for a test.
      
      2018-05-24  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* exp_util.adb (Expand_Static_Predicates_In_Choices): Indicate that the
      	construct with discrete choices no longer contains a subtype with
      	predicates since the expansion already handled this case.
      
      From-SVN: r260646
      Hristian Kirtchev committed
    • [Ada] Spurious error on imported subprogram with precondition · d72099eb
      This patch modifies the generation of wrappers for imported subprograms which
      are subject to contracts. In the case of an imported function, the original
      function is relocated within the wrapper, and the wrapper simply invokes the
      imported subprogram, returning its value. When the result type of the imported
      subprogram is anonymous access, the relocation creates a new anonymous access
      type, but with a different accessibility level. Since both return types are
      essentially the same type, eliminate the accessibility level inconsistency by
      unchecked converting the result of calling the imported function to the return
      type.
      
      ------------
      -- Source --
      ------------
      
      --  pack.ads
      
      package Pack is
         type Integer_Ptr is access all Integer;
         type Typ is null record;
      
         function Predicate (Val : Typ) return Boolean is (True);
      
         function Imported_1 (Val : Typ) return access Integer
           with Pre => Predicate (Val), Import;
      
         function Imported_2 (Val : Typ) return Integer_Ptr
           with Pre => Predicate (Val), Import;
      end Pack;
      
      -----------------
      -- Compilation --
      -----------------
      
      $ gcc -c pack.ads
      
      2018-05-24  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* freeze.adb (Wrap_Imported_Subprogram): Generate an unchecked
      	conversion to the return type to avoid a side effect where an imported
      	relocated function generates a new anonymous access type, whose
      	accessibility level does not agree with with that of the wrapper.
      
      From-SVN: r260645
      Hristian Kirtchev committed
    • [Ada] Spurious error on private task derivation · 0b5252ac
      The compiler reports a spurious error notifying a missing constraint in the
      declaration of a private type with discriminants whose full view is a
      derivation of a task type.
      
      After this patch the following test compiles without errors.
      
      package Types1 is
         type Parent (Discr1 : Boolean) is limited private;
      private
         task type Parent (Discr1 : Boolean);
      end Types1;
      
      with Types1; use Types1;
      package Types2 is
         type Child (Discr2 : Boolean) is limited private;
      private
         type Child (Discr2 : Boolean) is       -- Test
           new Parent (Discr1 => Discr2);
      end Types2;
      
      Command: gcc -c types2.ads
      
      2018-05-24  Javier Miranda  <miranda@adacore.com>
      
      gcc/ada/
      
      	* sem_util.adb (Abstract_Interface_List): Add missing support for
      	private types whose full view is a synchronized type.
      	* sem_ch3.adb (Build_Derived_Private_Type): Skip building the full
      	derivation of a private type parent type is a task type with
      	discriminants as gigi does not use such type directly.
      
      From-SVN: r260644
      Javier Miranda committed
    • [Ada] Crash on compilation unit instance · 7dcac7d1
      Do not generate a variable marker for a reference which appears within the
      formal part of an instantiation which acts as a compilation unit because
      there is no suitable insertion context.
      
      ------------
      -- Source --
      ------------
      
      --  gnat.adc
      
      pragma SPARK_Mode (On);
      
      --  gen.ads
      
      generic
         Val_1 : Integer;
         Val_2 : Integer;
      package Gen is
      end Gen;
      
      --  pack.ads
      
      package Pack is
         Val : Integer := 123;
      
         function Get_Val return Integer;
      end Pack;
      
      --  inst.ads
      
      with Gen;
      with Pack; use Pack;
      
      package Inst is new Gen (Val, Get_Val);
      
      --  proc.adb
      
      with Pack; use Pack;
      
      procedure Proc (Val_1 : Integer := Val; Val_2 : Integer := Get_Val) is
      begin null; end Proc;
      
      -----------------
      -- Compilation --
      -----------------
      
      $ gcc -c inst.ads
      $ gcc -c inst.ads -gnatd.F
      $ gcc -c proc.adb
      $ gcc -c proc.adb -gnatd.F
      
      2018-05-24  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* sem_elab.adb (Build_Variable_Reference_Marker): Do not create a
      	variable marker when the reference appears in the formal part of a
      	compilation unit instance because there is no place to insert it.
      	(In_Compilation_Instance_Formal_Part): New routine.
      
      From-SVN: r260643
      Hristian Kirtchev committed
    • [Ada] Fix references to Backend_Layout configuration parameter · 443ee956
      Apparently the Backend_Layout target configuration parameter was renamed to
      Frontend_Layout a long time ago (and their meanings are opposite). However,
      some comments were still referencing the no longer existing Backend_Layout.
      This patch fixes such references.
      
      No test provided, because only comments has been modified.
      
      2018-05-24  Piotr Trojanek  <trojanek@adacore.com>
      
      gcc/ada/
      
      	* layout.ads, repinfo.ads: Fix references to renamed Backend_Layout
      	configuration parameter.
      
      From-SVN: r260642
      Piotr Trojanek committed
    • [Ada] Initial port of x86-lynx178elf runtimes · 3cac09db
      2018-05-24  Doug Rupp  <rupp@adacore.com>
      
      gcc/ada/
      
      	* argv-lynxos178-raven-cert.c: New file.
      	* libgnat/system-lynxos178-x86.ads: New file.
      
      From-SVN: r260641
      Doug Rupp committed
    • Require ifunc support in gcc.target/i386/pr85345.c · 2e9e8789
      	* gcc.target/i386/pr85345.c: Require ifunc support.
      
      From-SVN: r260640
      Rainer Orth committed
    • Use canonicalize_math_after_vectorization_p for FMA folds · c453ccc2
      The folds in r260348 kicked in before vectorisation, which hurts
      for two reasons:
      
      (1) the current suboptimal handling of nothrow meant that we could
          drop the flag early and so prevent if-conversion
      
      (2) some architectures provide more scalar forms than vector forms
          (true for Advanced SIMD)
      
      (1) is a bug in itself that needs to be fixed eventually, but delaying
      the folds is still needed for (2).
      
      2018-05-24  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* match.pd: Delay FMA folds until after vectorization.
      
      gcc/testsuite/
      	* gcc.dg/vect/vect-fma-1.c: New test.
      
      From-SVN: r260639
      Richard Sandiford committed
    • Fix dumpfile name in gcc.dg/tree-prof/update-loopch.c · 0c08e1f8
      	* gcc.dg/tree-prof/update-loopch.c: Fix dumpfile name in
      	scan-tree-dump*.
      
      From-SVN: r260638
      Rainer Orth committed
    • PR target/83009: Relax strict address checking for store pair lanes · ac025fd6
      The operand constraint for the memory address of store/load pair lanes was
      enforcing strictly hardware registers be allowed as memory addresses.  We want
      to relax that such that these patterns can be used by combine.  During register
      allocation the register constraint will enforce the correct register is chosen.
      
      gcc
      2018-05-24  Andre Vieira  <andre.simoesdiasvieira@arm.com>
      
      	PR target/83009
      	* config/aarch64/predicates.md (aarch64_mem_pair_lanes_operand): Make
      	address check not strict.
      
      gcc/testsuite
      2018-05-24  Andre Vieira  <andre.simoesdiasvieira@arm.com>
      
      	PR target/83009
      	* gcc/target/aarch64/store_v2vec_lanes.c: Add extra tests.
      
      From-SVN: r260635
      Andre Vieira committed
    • Add a class to represent a gimple match result · 5d75ad95
      Gimple match results are represented by a code_helper for the operation,
      a tree for the type, and an array of three trees for the operands.
      This patch wraps them up in a class so that they don't need to be
      passed around individually.
      
      The main reason for doing this is to make it easier to increase the
      number of operands (for calls) or to support more complicated kinds
      of operation.  But passing around fewer operands also helps to reduce
      the size of gimple-match.o (about 7% for development builds and 4% for
      release builds).
      
      2018-05-24  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* gimple-match.h (gimple_match_op): New class.
      	(mprts_hook): Replace parameters with a gimple_match_op *.
      	(maybe_build_generic_op): Likewise.
      	(gimple_simplified_result_is_gimple_val): Replace parameters with
      	a const gimple_match_op *.
      	(gimple_simplify): Replace code_helper * and tree * parameters with
      	a gimple_match_op * parameter.
      	(gimple_resimplify1): Replace code_helper *, tree and tree *
      	parameters with a gimple_match_op * parameter.
      	(gimple_resimplify2): Likewise.
      	(gimple_resimplify3): Likewise.
      	(maybe_push_res_to_seq): Replace code_helper, tree and tree *
      	parameters with a gimple_match_op * parameter.
      	* gimple-match-head.c (gimple_simplify): Change prototypes of
      	auto-generated functions to take a gimple_match_op * instead of
      	separate code_helper * and tree * parameters.  Make the same
      	change in the top-level overload and update calls to the
      	gimple_resimplify routines.  Update calls to the auto-generated
      	functions and to maybe_push_res_to_seq in the publicly-facing
      	operation-specific gimple_simplify overloads.
      	(gimple_match_op::MAX_NUM_OPS): Define.
      	(gimple_resimplify1): Replace rcode and ops with a single res_op
      	parameter.  Update call to gimple_simplify.
      	(gimple_resimplify2): Likewise.
      	(gimple_resimplify3): Likewise.
      	(mprts_hook): Replace parameters with a gimple_match_op *.
      	(maybe_build_generic_op): Likewise.
      	(build_call_internal): Replace type, nargs and ops with
      	a gimple_match_op *.
      	(maybe_push_res_to_seq): Replace res_code, type and ops parameters
      	with a single gimple_match_op *.  Update calls to mprts_hook,
      	build_call_internal and gimple_simplified_result_is_gimple_val.
      	Factor out code that is common to the tree_code and combined_fn cases.
      	* genmatch.c (expr::gen_transform): Replace tem_code and
      	tem_ops with a gimple_match_op called tem_op.  Update calls
      	to the gimple_resimplify functions and maybe_push_res_to_seq.
      	(dt_simplify::gen_1): Manipulate res_op instead of res_code and
      	res_ops.  Update call to the gimple_resimplify functions.
      	(dt_simplify::gen): Pass res_op instead of res_code and res_ops.
      	(decision_tree::gen): Make the functions take a gimple_match_op *
      	called res_op instead of separate res_code and res_ops parameters.
      	Update call accordingly.
      	* gimple-fold.c (replace_stmt_with_simplification): Replace rcode
      	and ops with a single res_op parameter.  Update calls to
      	maybe_build_generic_op and maybe_push_res_to_seq.
      	(fold_stmt_1): Update calls to gimple_simplify and
      	replace_stmt_with_simplification.
      	(gimple_fold_stmt_to_constant_1): Update calls to gimple_simplify
      	and gimple_simplified_result_is_gimple_val.
      	* tree-cfgcleanup.c (cleanup_control_expr_graph): Update call to
      	gimple_simplify.
      	* tree-ssa-sccvn.c (vn_lookup_simplify_result): Replace parameters
      	with a gimple_match_op *.
      	(vn_nary_build_or_lookup): Likewise.  Update call to
      	vn_nary_build_or_lookup_1.
      	(vn_nary_build_or_lookup_1): Replace rcode, type and ops with a
      	gimple_match_op *.  Update calls to the gimple_resimplify routines
      	and to gimple_simplified_result_is_gimple_val.
      	(vn_nary_simplify): Update call to vn_nary_build_or_lookup_1.
      	Use gimple_match_op::MAX_NUM_OPS instead of a hard-coded 3.
      	(vn_reference_lookup_3): Update call to vn_nary_build_or_lookup.
      	(visit_nary_op): Likewise.
      	(visit_reference_op_load): Likewise.
      
      From-SVN: r260634
      Richard Sandiford committed
    • Daily bump. · e29ea483
      From-SVN: r260633
      GCC Administrator committed
  2. 23 May, 2018 1 commit