a-tasatt.adb, [...] (Fast_Path): Rewritten to avoid reading potentially uninitialized memory.
2016-04-21 Arnaud Charlet <charlet@adacore.com> * a-tasatt.adb, a-tasatt.ads (Fast_Path): Rewritten to avoid reading potentially uninitialized memory. * sem_ch3.adb: Minor style fix in comment. From-SVN: r235329
This commit is contained in:
parent
c25f170d2d
commit
150346bd8d
4 changed files with 23 additions and 8 deletions
|
@ -1,3 +1,9 @@
|
|||
2016-04-21 Arnaud Charlet <charlet@adacore.com>
|
||||
|
||||
* a-tasatt.adb, a-tasatt.ads (Fast_Path): Rewritten to avoid reading
|
||||
potentially uninitialized memory.
|
||||
* sem_ch3.adb: Minor style fix in comment.
|
||||
|
||||
2016-04-21 Arnaud Charlet <charlet@adacore.com>
|
||||
|
||||
* gnat_rm.texi, gnat_ugn.texi,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
-- --
|
||||
-- B o d y --
|
||||
-- --
|
||||
-- Copyright (C) 2014, Free Software Foundation, Inc. --
|
||||
-- Copyright (C) 2014-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- --
|
||||
|
@ -93,6 +93,11 @@ package body Ada.Task_Attributes is
|
|||
function To_Attribute is new
|
||||
Ada.Unchecked_Conversion (Atomic_Address, Attribute);
|
||||
|
||||
function To_Address is new
|
||||
Ada.Unchecked_Conversion (Attribute, System.Address);
|
||||
function To_Int is new
|
||||
Ada.Unchecked_Conversion (Attribute, Integer);
|
||||
|
||||
pragma Warnings (On);
|
||||
|
||||
function To_Address is new
|
||||
|
@ -114,9 +119,12 @@ package body Ada.Task_Attributes is
|
|||
Ada.Unchecked_Deallocation (Real_Attribute, Real_Attribute_Access);
|
||||
|
||||
Fast_Path : constant Boolean :=
|
||||
Attribute'Size <= Atomic_Address'Size
|
||||
(Attribute'Size = Integer'Size
|
||||
and then Attribute'Alignment <= Atomic_Address'Alignment
|
||||
and then To_Address (Initial_Value) = 0;
|
||||
and then To_Int (Initial_Value) = 0)
|
||||
or else (Attribute'Size = System.Address'Size
|
||||
and then Attribute'Alignment <= Atomic_Address'Alignment
|
||||
and then To_Address (Initial_Value) = System.Null_Address);
|
||||
-- If the attribute fits in an Atomic_Address (both size and alignment)
|
||||
-- and Initial_Value is 0 (or null), then we will map the attribute
|
||||
-- directly into ATCB.Attributes (Index), otherwise we will create
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
-- --
|
||||
-- S p e c --
|
||||
-- --
|
||||
-- Copyright (C) 2014, Free Software Foundation, Inc. --
|
||||
-- Copyright (C) 2014-2016, Free Software Foundation, Inc. --
|
||||
-- --
|
||||
-- This specification is derived from the Ada Reference Manual for use with --
|
||||
-- GNAT. The copyright notice above, and the license provisions that follow --
|
||||
|
@ -42,8 +42,9 @@ generic
|
|||
package Ada.Task_Attributes is
|
||||
|
||||
-- Note that this package will use an efficient implementation with no
|
||||
-- locks and no extra dynamic memory allocation if Attribute can fit in a
|
||||
-- System.Address type, and Initial_Value is 0 (null for an access type).
|
||||
-- locks and no extra dynamic memory allocation if Attribute is the size
|
||||
-- of either Integer or System.Address, and Initial_Value is 0 (null for
|
||||
-- an access type).
|
||||
|
||||
-- Other types and initial values are supported, but will require
|
||||
-- the use of locking and a level of indirection (meaning extra dynamic
|
||||
|
|
|
@ -3423,7 +3423,7 @@ package body Sem_Ch3 is
|
|||
|
||||
if Error_Posted (N) then
|
||||
|
||||
-- Type mismatch or illegal redeclaration, Do not analyze
|
||||
-- Type mismatch or illegal redeclaration; do not analyze
|
||||
-- expression to avoid cascaded errors.
|
||||
|
||||
T := Find_Type_Of_Object (Object_Definition (N), N);
|
||||
|
@ -3460,7 +3460,7 @@ package body Sem_Ch3 is
|
|||
end if;
|
||||
|
||||
-- Ada 2005 (AI-231): Propagate the null-excluding attribute and carry
|
||||
-- out some static checks
|
||||
-- out some static checks.
|
||||
|
||||
if Ada_Version >= Ada_2005 and then Can_Never_Be_Null (T) then
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue