aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-streamer-in.c
diff options
context:
space:
mode:
authorHristian Kirtchev <kirtchev@adacore.com>2018-05-24 13:05:26 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-05-24 13:05:26 +0000
commitfa3717c173192eb04440734a3ee110982f31e592 (patch)
treecc31ee41442c6c152781125628426dd0b51a799e /gcc/tree-streamer-in.c
parent36e7d49f8afc9bde0ef5691fc5a3ce4330fd3063 (diff)
downloadgcc-fa3717c173192eb04440734a3ee110982f31e592.zip
gcc-fa3717c173192eb04440734a3ee110982f31e592.tar.gz
gcc-fa3717c173192eb04440734a3ee110982f31e592.tar.bz2
[Ada] Crash on function in Ghost subunit
This patch modifies the creation of class-wide subtypes to preserve vital attributes related to Ghost code. The subtype is created by copying the contents of a class-wide type into a newly created itype. When the itype is created within a Ghost region, the act of copying destroys Ghost code related attributes. As a result, if the now living class-wide subtype is frozen within an ignored Ghost region, its freeze node is hoisted prior to the start of the region, howeve the subtype is still eliminated from the tree. ------------ -- Source -- ------------ -- pack.ads with Ada.Finalization; use Ada.Finalization; package Pack is type Ctrl is new Controlled with null record; function Make_Ctrl return Ctrl; package Nested with Ghost is procedure Proc; end Nested; end Pack; -- pack.adb package body Pack is function Make_Ctrl return Ctrl is begin return Result : Ctrl; end Make_Ctrl; package body Nested is separate; end Pack; -- pack-nested.adb separate (Pack) package body Nested is procedure Proc is Res : constant Ctrl'Class := Make_Ctrl; begin null; end Proc; end Nested; ----------------- -- Compilation -- ----------------- $ gcc -c pack.adb 2018-05-24 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * exp_util.adb (New_Class_Wide_Subtype): Capture and restore relevant Ghost-related attributes of the class-wide subtype because the copy clobbers them. From-SVN: r260653
Diffstat (limited to 'gcc/tree-streamer-in.c')
0 files changed, 0 insertions, 0 deletions