From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b7566e485e23e171 X-Google-Attributes: gid103376,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: Changing discriminants at run-time: erroneous execution? Date: 1996/08/07 Message-ID: #1/1 X-Deja-AN: 172762892 references: organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-08-07T00:00:00+00:00 List-Id: Andre asks about the program with Ada.Text_IO; use Ada.Text_IO; procedure Example is type Buffer (Size : Natural := 3) is record Value : String (1..Size); end record; Message : Buffer; X : Integer; begin Message := (5, "abcde"); Put_Line (Message.Value); -- prints "abcde" X := 1; Put_Line (Message.Value); -- prints "abcd" end Example; The warning should not be ignored. Creating of a value of type Buffer requires 4 gigabytes of storage. This might work on some 64 bit machines, but will surely not work on a 32-bit machine. So why don't you get the storage error -- that's easily explained, you are using one of the versions of GNAT that does not yet support stack checking, and so of course this object overflowed the stack. This behavior is not justified by the RM! This is a simply a matter of a (documented) missing feature in some implementations of GNAT (we are gradually adding stack checking to additional verisons of GNAT, it's one of the hard things to do for a highly portable technology like this, because stack checking tends to be extremely target dependent). Always read the file "features" to find out what is implemented and what is not!