From: Arnaud Charlet Date: Tue, 25 Apr 2017 10:11:06 +0000 (+0200) Subject: [multiple changes] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b0cd50fdc3c2c8a0221a1c7d8379f4c7e15e623f;p=gcc.git [multiple changes] 2017-04-25 Hristian Kirtchev * checks.adb (Insert_Valid_Check): Do not generate a validity check when inside a generic. 2017-04-25 Yannick Moy * sem_res.adb (Resolve_Type_Conversion): Fix bad logic. 2017-04-25 Arnaud Charlet * snames.ads-tmpl (Snames): More names for detecting predefined potentially blocking subprograms. 2017-04-25 Ed Schonberg * sem_prag.adb (Analyze_Pre_Post_Condition): The rules concerning inheritance of class-wide preconditions do not apply to postconditions. 2017-04-25 Bob Duff * s-ficobl.ads: Minor comment fix. From-SVN: r247174 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 0a7a78246ee..a3ceadb3204 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,27 @@ +2017-04-25 Hristian Kirtchev + + * checks.adb (Insert_Valid_Check): Do not generate + a validity check when inside a generic. + +2017-04-25 Yannick Moy + + * sem_res.adb (Resolve_Type_Conversion): Fix bad logic. + +2017-04-25 Arnaud Charlet + + * snames.ads-tmpl (Snames): More names for detecting predefined + potentially blocking subprograms. + +2017-04-25 Ed Schonberg + + * sem_prag.adb (Analyze_Pre_Post_Condition): The rules + concerning inheritance of class-wide preconditions do not apply + to postconditions. + +2017-04-25 Bob Duff + + * s-ficobl.ads: Minor comment fix. + 2017-04-25 Yannick Moy * checks.adb (Apply_Scalar_Range_Check): Analyze precisely diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index a057cf3d165..61fb006f1ff 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -7233,27 +7233,31 @@ package body Checks is or else Expr_Known_Valid (Expr) then return; - end if; -- Do not insert checks within a predicate function. This will arise -- if the current unit and the predicate function are being compiled -- with validity checks enabled. - if Present (Predicate_Function (Typ)) + elsif Present (Predicate_Function (Typ)) and then Current_Scope = Predicate_Function (Typ) then return; - end if; -- If the expression is a packed component of a modular type of the -- right size, the data is always valid. - if Nkind (Expr) = N_Selected_Component + elsif Nkind (Expr) = N_Selected_Component and then Present (Component_Clause (Entity (Selector_Name (Expr)))) and then Is_Modular_Integer_Type (Typ) and then Modulus (Typ) = 2 ** Esize (Entity (Selector_Name (Expr))) then return; + + -- Do not generate a validity check when inside a generic unit as this + -- is an expansion activity. + + elsif Inside_A_Generic then + return; end if; -- If we have a checked conversion, then validity check applies to diff --git a/gcc/ada/s-ficobl.ads b/gcc/ada/s-ficobl.ads index 047bacac570..a95c0392419 100644 --- a/gcc/ada/s-ficobl.ads +++ b/gcc/ada/s-ficobl.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -89,7 +89,7 @@ package System.File_Control_Block is Name : Pstring; -- A pointer to the file name. The file name is null for temporary -- files, and also for standard files (stdin, stdout, stderr). The - -- name is always null-terminated if it is non-null. + -- name is always NUL-terminated if it is non-null. Encoding : System.CRTL.Filename_Encoding; -- Encoding used to specified the filename diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index fee1bb321d6..f549198c126 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -4417,6 +4417,7 @@ package body Sem_Prag is begin if Class_Present (N) + and then Pragma_Name (N) = Name_Precondition and then Present (Overridden_Operation (E)) and then not Inherits_Class_Wide_Pre (E) then diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 70e0c281413..b3e2c285e49 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -11055,17 +11055,17 @@ package body Sem_Res is -- If at this stage we have a real to integer conversion, make sure that -- the Do_Range_Check flag is set, because such conversions in general - -- need a range check. We only need this if expansion is off, or we are - -- in GNATprove mode and the conversion if from fixed-point to integer + -- need a range check. We only need this if expansion is off. + -- In GNATprove mode, we only do that when converting from fixed-point -- (as floating-point to integer conversions are now handled in -- GNATprove mode). if Nkind (N) = N_Type_Conversion and then not Expander_Active and then Is_Integer_Type (Target_Typ) - and then (Is_Real_Type (Operand_Typ) - or else (GNATprove_Mode - and then Is_Fixed_Point_Type (Operand_Typ))) + and then (Is_Fixed_Point_Type (Operand_Typ) + or else (not GNATprove_Mode + and then Is_Floating_Point_Type (Operand_Typ))) then Set_Do_Range_Check (Operand); end if; diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl index 33ba6a57c41..bfa5e30311d 100644 --- a/gcc/ada/snames.ads-tmpl +++ b/gcc/ada/snames.ads-tmpl @@ -275,14 +275,18 @@ package Snames is Name_EDF : constant Name_Id := N + $; Name_Reset_Standard_Files : constant Name_Id := N + $; Name_Sequential_IO : constant Name_Id := N + $; + Name_Strings : constant Name_Id := N + $; Name_Streams : constant Name_Id := N + $; Name_Suspend_Until_True : constant Name_Id := N + $; Name_Suspend_Until_True_And_Set_Deadline : constant Name_Id := N + $; Name_Synchronous_Barriers : constant Name_Id := N + $; Name_Task_Identification : constant Name_Id := N + $; Name_Text_Streams : constant Name_Id := N + $; + Name_Unbounded : constant Name_Id := N + $; Name_Unbounded_IO : constant Name_Id := N + $; Name_Wait_For_Release : constant Name_Id := N + $; + Name_Wide_Unbounded : constant Name_Id := N + $; + Name_Wide_Wide_Unbounded : constant Name_Id := N + $; Name_Yield : constant Name_Id := N + $; -- Names of implementations of the distributed systems annex