This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Tested under i686-linux, commited on mainline.
AI-216 defines various conditions in which use of an unchecked union type
must raise program_error. Among those are some cases of equality, and
stream operations. When an unchecked union is a component of a tagged type,
calls to any of these predefined operations will raise program_error.
GNAT incorrectly inserted the raise statement before the body of the
equality operation, rather than within it.
The following example must execute quietly:
--
procedure p is
type Unc (Disc : Boolean := False) is record
case Disc is
when True => V1 : Long_Integer;
when False => V2 : Float;
end case;
end record;
pragma Unchecked_Union (Unc);
type Wrapper is tagged record Thing : Unc; end record;
Obj : Wrapper;
begin
null;
end;
2005-02-09 Ed Schonberg <schonberg@adacore.com>
* exp_ch4.adb (Expand_Composite_Equality): If a component is an
unchecked union with no inferable discriminants, return a
Raise_Program_Error node, rather than inserting it at the point the
type is frozen.
(Expand_Record_Equality, Component_Equality): Handle properly the case
where some subcomponent is an unchecked union whose generated equality
code raises program error.
Attachment:
difs.9
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |