1. 09 Jul, 2019 36 commits
    • Document and test __builtin_expect_with_probability. · b52db158
      2019-07-09  Martin Liska  <mliska@suse.cz>
      
      	* doc/extend.texi: Document influence on loop
      	optimizers.
      2019-07-09  Martin Liska  <mliska@suse.cz>
      
      	* gcc.dg/predict-17.c: Test loop optimizer assumption
      	about loop iterations.
      
      From-SVN: r273295
      Martin Liska committed
    • tree-ssa-sccvn.c (struct vn_walk_cb_data): Add orig_ref member. · c2851dc2
      2019-07-09  Richard Biener  <rguenther@suse.de>
      
      	* 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.
      
      	* gcc.dg/tree-ssa/alias-access-path-1.c: Scan fre1 dump.
      	* gcc.dg/tree-ssa/alias-access-path-2.c: Likewise.
      	* gcc.dg/tree-ssa/alias-access-path-8.c: Likewise.
      
      From-SVN: r273294
      Richard Biener committed
    • [Ada] Access to uninitialized memory by predicate check · 5e0f7ab2
      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.
      
      From-SVN: r273293
      Ed Schonberg committed
    • [Ada] Crash on 'Img attribute · 924e3532
      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.
      
      gcc/testsuite/
      
      	* gnat.dg/image1.adb: New testcase.
      
      From-SVN: r273292
      Justin Squirek committed
    • [Ada] System.OS_Interface: fix Critical_Section.SpinCount type · 18934a8d
      2019-07-09  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* libgnarl/s-osinte__mingw.ads (CRITICAL_SECTION): Use proper
      	type for SpinCount component.
      
      From-SVN: r273291
      Eric Botcazou committed
    • [Ada] Warning needed on anonymous access type allocators · b3889fff
      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;
      
      -----------------
      -- Compilation --
      -----------------
      
      $ 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
      
      raised PROGRAM_ERROR : main.adb:12 accessibility check failed
      
      2019-07-09  Justin Squirek  <squirek@adacore.com>
      
      gcc/ada/
      
      	* 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.
      
      From-SVN: r273290
      Justin Squirek committed
    • [Ada] Crash/infinite loop on program with multiple visibility errors · a9e47028
      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.
      
      From-SVN: r273289
      Ed Schonberg committed
    • [Ada] Elaboration order v4.0 and generic instantiations · f0bfd1f9
      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;
      
      -----------------
      -- Compilation --
      -----------------
      
      $ gnatmake -q main1.adb
      
      2019-07-09  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* 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.
      
      From-SVN: r273288
      Hristian Kirtchev committed
    • [Ada] Reformat comments · 64ac53f4
      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".
      
      2019-07-09  Piotr Trojanek  <trojanek@adacore.com>
      
      gcc/ada/
      
      	* ali.ads, bindo-graphs.adb, bindo-validators.adb, clean.adb,
      	doc/gnat_ugn/elaboration_order_handling_in_gnat.rst, einfo.ads,
      	exp_aggr.adb, exp_ch13.adb, exp_ch4.adb, exp_ch5.adb,
      	exp_ch6.adb, exp_ch7.adb, exp_ch9.adb, exp_pakd.adb,
      	fname-uf.ads, gnatlink.adb, inline.adb, lib.ads, make.adb,
      	namet.ads, opt.ads, par-ch4.adb, par-ch6.adb, par-labl.adb,
      	prep.adb, sem_aggr.adb, sem_ch13.adb, sem_ch4.adb, sem_ch5.adb,
      	sem_ch6.adb, sem_ch6.ads, sem_ch7.adb, sem_ch8.adb, sem_dim.adb,
      	sem_disp.adb, sem_prag.adb, sem_res.adb, sem_warn.adb,
      	sinfo.ads: Replace ".  " with ". ". Minor reformatting and typo
      	corrections.
      	* gnat_ugn.texi: Generate.
      
      From-SVN: r273287
      Piotr Trojanek committed
    • [Ada] Task-related circularities in Elaboration order v4.0 · 75cfda8b
      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).
      
      ------------
      -- Source --
      ------------
      
      --  no_entry_calls.txt
      
      pragma Restrictions (No_Entry_Calls_In_Elaboration_Code);
      
      --  a.ads
      
      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.
      
      2019-07-09  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* 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.
      
      From-SVN: r273286
      Hristian Kirtchev committed
    • [Ada] Exp_Util: minor refactoring · 727e4d37
      2019-07-09  Piotr Trojanek  <trojanek@adacore.com>
      
      gcc/ada/
      
      	* exp_util.adb (Containing_Package_With_Ext_Axioms): Replace
      	low-level Ekind test with a high-level wrapper.
      
      From-SVN: r273285
      Piotr Trojanek committed
    • [Ada] Disable calls to Abort defer/undefer when ZCX_By_Default · 00243155
      2019-07-09  Arnaud Charlet  <charlet@adacore.com>
      
      gcc/ada/
      
      	* libgnat/s-memory.adb: Disable calls to Abort defer/undefer
      	when ZCX_By_Default.
      
      From-SVN: r273284
      Arnaud Charlet committed
    • [Ada] Missing error on generic type with representation clause · c7854dbd
      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.
      
      gcc/testsuite/
      
      	* gnat.dg/rep_clause8.adb: New testcase.
      
      From-SVN: r273283
      Javier Miranda committed
    • [Ada] Minor reformatting · 134f52b9
      2019-07-09  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* exp_ch9.adb, exp_util.adb, repinfo.adb, sem_ch12.adb,
      	sem_prag.adb, sem_res.adb, sem_spark.adb, sem_util.adb: Minor
      	reformatting.
      
      From-SVN: r273282
      Hristian Kirtchev committed
    • [Ada] Wrong resolution of equality operator with overloaded operand · 0ce85831
      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.
      
      From-SVN: r273281
      Ed Schonberg committed
    • [Ada] Elaboration order v4.0 activation · 16cc65b6
      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.
      
      2019-07-09  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* 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.
      
      From-SVN: r273280
      Hristian Kirtchev committed
    • [Ada] Missing escape of the double quote in JSON output · fb95bfcc
      In Ada, the name of operators contains a pair of double quotes, which
      need to be properly escaped when the name appears in the JSON output of
      -gnatR.
      
      The change also ensures that formal parameters are not listed in the
      layout information, since this information is not back-annotated for
      them.
      
      2019-07-09  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* repinfo.adb (List_Entities): Disregard formals altogether.
      	(List_Name): Properly escape the double quote in the JSON
      	output.
      
      From-SVN: r273279
      Eric Botcazou committed
    • [Ada] Missing runtime range checks with -gnatVa · 5da54433
      Under validity checking mode the compiler may silently skip generating
      code to perform runtime range checks.
      
      2019-07-09  Javier Miranda  <miranda@adacore.com>
      
      gcc/ada/
      
      	* exp_util.adb (Remove_Side_Effects): Preserve the
      	Do_Range_Check flag.
      
      gcc/testsuite/
      
      	* gnat.dg/range_check3.adb, gnat.dg/range_check3_pkg.adb,
      	gnat.dg/range_check3_pkg.ads: New testcase.
      
      From-SVN: r273278
      Javier Miranda committed
    • [Ada] Sinfo: refine comment for Do_Range_Check · ff606db0
      2019-07-09  Yannick Moy  <moy@adacore.com>
      
      gcc/ada/
      
      	* sinfo.ads: Refine comment for Do_Range_Check.
      
      From-SVN: r273277
      Yannick Moy committed
    • [Ada] Expand Enum_Rep attribute reference in GNATprove mode · dd9290ec
      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.
      
      From-SVN: r273276
      Yannick Moy committed
    • [Ada] Spurious error when instance of generic is used as formal package · a74d1bf6
      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.
      
      gcc/testsuite/
      
      	* gnat.dg/generic_inst5.adb, gnat.dg/generic_inst6.adb,
      	gnat.dg/generic_inst6_g1-c.adb, gnat.dg/generic_inst6_g1-c.ads,
      	gnat.dg/generic_inst6_g1.ads, gnat.dg/generic_inst6_i1.ads,
      	gnat.dg/generic_inst6_i2.ads, gnat.dg/generic_inst6_x.ads: New
      	testcases.
      
      From-SVN: r273275
      Ed Schonberg committed
    • [Ada] Prevent inconsistent state for inlining in GNATprove · 554a9844
      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.
      
      From-SVN: r273274
      Yannick Moy committed
    • [Ada] Expand type of static expressions in GNATprove mode · 5dd63272
      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.
      
      From-SVN: r273273
      Yannick Moy committed
    • [Ada] Reword "wild card" to "wildcard" · a569f219
      2019-07-09  Piotr Trojanek  <trojanek@adacore.com>
      
      gcc/ada/
      
      	* doc/gnat_rm/the_gnat_library.rst,
      	doc/gnat_ugn/building_executable_programs_with_gnat.rst,
      	erroutc.adb, libgnat/g-comlin.adb, libgnat/g-comlin.ads,
      	libgnat/g-regexp.ads, libgnat/g-regpat.ads,
      	libgnat/g-spipat.ads, libgnat/s-os_lib.ads,
      	libgnat/s-regexp.ads: Reword "wild card" to "wildcard".
      	* gnat_rm.texi, gnat_ugn.texi: Regenerate.
      
      From-SVN: r273272
      Piotr Trojanek committed
    • [Ada] Handle implicit moves in SPARK ownership pointer support · 995d28c7
      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.
      
      From-SVN: r273271
      Yannick Moy committed
    • [Ada] Einfo: fix a typo · 578d5941
      2019-07-09  Piotr Trojanek  <trojanek@adacore.com>
      
      gcc/ada/
      
      	* einfo.ads: Fix a typo.
      
      From-SVN: r273270
      Piotr Trojanek committed
    • [Ada] Fix scopes for local variables in task/protected bodies · 93ba65d5
      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.
      
      From-SVN: r273269
      Ed Schonberg committed
    • [Ada] Set Dynamic_Elaboration_Checks to True in CodePeer mode · 9ae497cb
      2019-07-09  Arnaud Charlet  <charlet@adacore.com>
      
      gcc/ada/
      
      	* gnat1drv.adb (Adjust_Global_Switches): Set
      	Dynamic_Elaboration_Checks to True in CodePeer mode.
      
      From-SVN: r273268
      Arnaud Charlet committed
    • [Ada] Issue error on illegal ownership in SPARK · e5ce97d2
      Check for declaration of global variables prior to use in the ownership
      checking for SPARK.
      
      There is no impact on compilation.
      
      2019-07-09  Yannick Moy  <moy@adacore.com>
      
      gcc/ada/
      
      	* sem_spark.adb (Get_Perm_Or_Tree): Issue an error when
      	encountering unknown global variable.
      
      From-SVN: r273267
      Yannick Moy committed
    • [Ada] Fix ownership checking for pointers in SPARK · e0201d82
      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.
      
      From-SVN: r273266
      Yannick Moy committed
    • [Ada] Make -gnatRj output strictly conforming JSON · b5d3d113
      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.
      
      From-SVN: r273265
      Eric Botcazou committed
    • [Ada] Update -fdump-ada-spec documentation · 0cb51ac7
      2019-07-09  Arnaud Charlet  <charlet@adacore.com>
      
      gcc/ada/
      
      	* doc/gnat_ugn/the_gnat_compilation_model.rst: Update doc on
      	-fdump-ada-spec now that we generate Ada 2012.
      	* gnat_ugn.texi: Regenerate.
      
      From-SVN: r273264
      Arnaud Charlet committed
    • Remove usage of ZSTD_CLEVEL_DEFAULT define. · 7a26ff04
      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.
      
      From-SVN: r273263
      Martin Liska committed
    • Enhance documentation of -fprofile-note option. · 64865fe0
      2019-07-09  Martin Liska  <mliska@suse.cz>
      
      	* doc/invoke.texi: Add link from -fprofile-dir option.
      	Use better wording for 'gcno filename'.
      
      From-SVN: r273262
      Martin Liska committed
    • PR middle-end/71924 - missing -Wreturn-local-addr returning alloca result · aac9480d
      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
      
      gcc/ChangeLog:
      
      	PR middle-end/71924
      	PR middle-end/90549
      	* gimple-ssa-isolate-paths.c (isolate_path): Add attribute.  Update
      	comment.
      	(args_loc_t): New type.
      	(args_loc_t, locmap_t): same.
      	(diag_returned_locals): New function.
      	(is_addr_local): Same.
      	(handle_return_addr_local_phi_arg, warn_return_addr_local): Same.
      	(find_implicit_erroneous_behavior): Call warn_return_addr_local_phi_arg.
      	(find_explicit_erroneous_behavior): Call warn_return_addr_local.
      
      gcc/testsuite/ChangeLog:
      
      	PR middle-end/71924
      	PR middle-end/90549
      	* gcc.c-torture/execute/return-addr.c: New test.
      	* gcc.dg/Wreturn-local-addr-2.c: New test.
      	* gcc.dg/Wreturn-local-addr-4.c: New test.
      	* gcc.dg/Wreturn-local-addr-5.c: New test.
      	* gcc.dg/Wreturn-local-addr-6.c: New test.
      	* gcc.dg/Wreturn-local-addr-7.c: New test.
      	* gcc.dg/Wreturn-local-addr-8.c: New test.
      	* gcc.dg/Wreturn-local-addr-9.c: New test.
      	* gcc.dg/Wreturn-local-addr-10.c: New test.
      	* gcc.dg/Walloca-4.c: Handle expected warnings.
      	* gcc.dg/pr41551.c: Same.
      	* gcc.dg/pr59523.c: Same.
      	* gcc.dg/tree-ssa/pr88775-2.c: Same.
      	* gcc.dg/tree-ssa/alias-37.c: Same.
      	* gcc.dg/winline-7.c: Same.
      
      From-SVN: r273261
      Martin Sebor committed
    • Daily bump. · 7d64aec4
      From-SVN: r273260
      GCC Administrator committed
  2. 08 Jul, 2019 4 commits
    • tree-vect-stmts.c (scan_operand_equal_p): Look through MEM_REF with SSA_NAME… · 6cda84b5
      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.
      
      From-SVN: r273249
      Jakub Jelinek committed
    • re PR c++/91110 (ICE: tree check: expected class 'type', have 'exceptional'… · 9c6e2f82
      re PR c++/91110 (ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in cp_omp_mappable_type_1, at cp/decl2.c:1421)
      
      	PR c++/91110
      	* decl2.c (cp_omp_mappable_type_1): Don't emit any note for
      	error_mark_node type.
      
      	* g++.dg/gomp/pr91110.C: New test.
      
      From-SVN: r273248
      Jakub Jelinek committed
    • emit-rtl.c (set_insn_locations): New function moved from... · 079e0f61
      	* 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.
      
      From-SVN: r273247
      Eric Botcazou committed
    • rs6000: Ignore GFXOPT (and GPOPT) for choosing machine · c83faba1
      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.
      
      From-SVN: r273246
      Segher Boessenkool committed