aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/async.h
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2018-08-21 14:46:49 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-08-21 14:46:49 +0000
commitd2a60e59111707eb51430cd741eefccc77e1653b (patch)
tree80601006a85d4cf8561d94abfe5040a34c154df1 /libgfortran/io/async.h
parent1ab1c4ee18d7866249fb99bcc9d073fcb475dc9d (diff)
downloadgcc-d2a60e59111707eb51430cd741eefccc77e1653b.zip
gcc-d2a60e59111707eb51430cd741eefccc77e1653b.tar.gz
gcc-d2a60e59111707eb51430cd741eefccc77e1653b.tar.bz2
[Ada] Improper copying of limited arrays with default initialization
This patch fixes an improper expansion of aggregates for limited array types in an object declaration. Prior to this patch, The presence of the aggregate (which can only consist of box initializations) would create a temporary that was then assigned to the object in the declaration. Apart from a violation of the semantics of build-in-place limited objects, this can also lead to out-of-scope access in LLVM. Executing the following; gcc -c -gnatDG nocopy.adb grep quintet nocopy.adb.dg | wc -l must yield: 5 ---- procedure NoCopy is -- Task used in this example to test that the limited component -- is properly initialized. task type T_Task (Disc : Natural); task body T_Task is begin null; end T_Task; type My_Rec (D : Natural := 9999) is record -- Components initialized by means of the current value -- of the record discriminant T : T_Task (D); end record; type TR is array (1 .. 5) of My_Rec; Quintet : TR := (others => (others => <>)); begin null; end NoCopy; 2018-08-21 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * exp_aggr.adb (Expand_Array_Aggregate): If the component type is limited, the array must be constructed in place, so set flag In_Place_Assign_OK_For_Declaration accordingly. This prevents improper copying of an array of tasks during initialization. From-SVN: r263719
Diffstat (limited to 'libgfortran/io/async.h')
0 files changed, 0 insertions, 0 deletions