From: Pierre-Marie de Rodat Date: Thu, 9 Nov 2017 12:52:41 +0000 (+0000) Subject: [multiple changes] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=614bc51c3f2a933e694013e6c867dfdcd153017f;p=gcc.git [multiple changes] 2017-11-09 Ed Schonberg * sem_ch12.adb (Analyze_Subprogram_Instantiation): Correct use of uninitialized variable uncovered by Codepeer. 2017-11-09 Arnaud Charlet * namet.adb: Replace pragma Assume by pragma Assert to fix bootstrap. 2017-11-09 Javier Miranda * doc/gnat_rm/standard_and_implementation_defined_restrictions.rst: (Static_Dispatch_Tables): Minor rewording. * gnat_rm.texi: Regenerate. 2017-11-09 Justin Squirek * sem_ch8.adb (Analyze_Use_Package): Remove forced installation of use_clauses within instances. (Use_One_Package): Add condition to check for "hidden" open scopes to avoid skipping over packages that have not been properly installed even though they are visible. 2017-11-09 Ed Schonberg * sem_ch4.adb (Analyze_Selected_Component): Reject properly a call to a private operation of a protected type, when the type has no visible operations. From-SVN: r254578 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d2a48f73c0a..72d5844397f 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,32 @@ +2017-11-09 Ed Schonberg + + * sem_ch12.adb (Analyze_Subprogram_Instantiation): Correct use of + uninitialized variable uncovered by Codepeer. + +2017-11-09 Arnaud Charlet + + * namet.adb: Replace pragma Assume by pragma Assert to fix bootstrap. + +2017-11-09 Javier Miranda + + * doc/gnat_rm/standard_and_implementation_defined_restrictions.rst: + (Static_Dispatch_Tables): Minor rewording. + * gnat_rm.texi: Regenerate. + +2017-11-09 Justin Squirek + + * sem_ch8.adb (Analyze_Use_Package): Remove forced installation of + use_clauses within instances. + (Use_One_Package): Add condition to check for "hidden" open scopes to + avoid skipping over packages that have not been properly installed even + though they are visible. + +2017-11-09 Ed Schonberg + + * sem_ch4.adb (Analyze_Selected_Component): Reject properly a call to a + private operation of a protected type, when the type has no visible + operations. + 2017-11-09 Javier Miranda * rtsfind.ads (RE_Id, RE_Unit_Table): Add RE_HT_Link. diff --git a/gcc/ada/doc/gnat_rm/standard_and_implementation_defined_restrictions.rst b/gcc/ada/doc/gnat_rm/standard_and_implementation_defined_restrictions.rst index 2174636e4c5..1f56403f81a 100644 --- a/gcc/ada/doc/gnat_rm/standard_and_implementation_defined_restrictions.rst +++ b/gcc/ada/doc/gnat_rm/standard_and_implementation_defined_restrictions.rst @@ -992,7 +992,7 @@ Static_Dispatch_Tables ---------------------- .. index:: Static_Dispatch_Tables -[GNAT] This restriction ensures at compile time that all the artifacts +[GNAT] This restriction checks at compile time that all the artifacts associated with dispatch tables can be placed in read-only memory. SPARK_05 diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 21c195d21c1..0a2b151dffa 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -13141,7 +13141,7 @@ type @code{Character}). @geindex Static_Dispatch_Tables -[GNAT] This restriction ensures at compile time that all the artifacts +[GNAT] This restriction checks at compile time that all the artifacts associated with dispatch tables can be placed in read-only memory. @node SPARK_05,,Static_Dispatch_Tables,Program Unit Level Restrictions diff --git a/gcc/ada/namet.adb b/gcc/ada/namet.adb index 153c79b33c5..04e92dab55c 100644 --- a/gcc/ada/namet.adb +++ b/gcc/ada/namet.adb @@ -261,8 +261,10 @@ package body Namet is declare W2 : constant Word := Hex (2); begin - pragma Assume (W2 <= 255); - -- Add assumption to facilitate static analysis + pragma Assert (W2 <= 255); + -- Add assumption to facilitate static analysis. Note + -- that we cannot use pragma Assume for bootstrap + -- reasons. Insert_Character (Character'Val (W2)); end; end if; @@ -759,7 +761,7 @@ package body Namet is Write_Eol; Write_Str ("Average number of probes for lookup = "); - pragma Assume (Nsyms /= 0); + pragma Assert (Nsyms /= 0); -- Add assumption to facilitate static analysis. Here Nsyms cannot be -- zero because many symbols are added to the table by default. Probes := Probes / Nsyms; diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 6cdc9f3e21b..7aca1d9236f 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -5130,6 +5130,7 @@ package body Sem_Ch12 is is Loc : constant Source_Ptr := Sloc (N); Gen_Id : constant Node_Id := Name (N); + Errs : constant Nat := Serious_Errors_Detected; Anon_Id : constant Entity_Id := Make_Defining_Identifier (Sloc (Defining_Entity (N)), @@ -5723,7 +5724,9 @@ package body Sem_Ch12 is end if; <> - if Has_Aspects (N) then + -- Analyze aspects in declaration if no errors appear in the instance. + + if Has_Aspects (N) and then Serious_Errors_Detected = Errs then Analyze_Aspect_Specifications (N, Act_Decl_Id); end if; diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index f2d1acfdc08..d13140fb135 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -5043,10 +5043,13 @@ package body Sem_Ch4 is end if; end if; - Next_Entity (Comp); + -- Do not examine private operations if not within scope of + -- the synchronized type. + exit when not In_Scope and then Comp = First_Private_Entity (Base_Type (Prefix_Type)); + Next_Entity (Comp); end loop; -- If the scope is a current instance, the prefix cannot be an diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index aea9bf8b480..d8d5b7b5c04 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -3821,10 +3821,7 @@ package body Sem_Ch8 is Check_In_Previous_With_Clause (N, Name (N)); end if; - -- Force the use_clause when we are in a generic instance because the - -- scope of the package has changed and we must ensure visibility. - - Use_One_Package (N, Name (N), Force => In_Instance); + Use_One_Package (N, Name (N)); -- Capture the first Ghost package and the first living package @@ -9443,7 +9440,10 @@ package body Sem_Ch8 is -- Warn about detected redundant clauses - elsif In_Open_Scopes (P) and not Force then + elsif not Force + and then In_Open_Scopes (P) + and then not Is_Hidden_Open_Scope (P) + then if Warn_On_Redundant_Constructs and then P = Current_Scope then Error_Msg_NE -- CODEFIX ("& is already use-visible within itself?r?",