comp.lang.ada
 help / color / mirror / Atom feed
* Is this a bug?
@ 2019-12-30 15:44 reinert
  2019-12-30 17:51 ` Anh Vo
  0 siblings, 1 reply; 34+ messages in thread
From: reinert @ 2019-12-30 15:44 UTC (permalink / raw)


Hello,

assume the following Ada procedure:
------------------------------------------------------------------------------
with Text_IO;
procedure test1 is
package test_package is
 type rec1_t is tagged record
   a : integer := 2;  
-- b : integer := 2;
 end record;
 function a(x : rec1_t) return integer is (3);
 rec1 : rec1_t;
end test_package;
begin
  Text_IO.Put(" test_package.rec1: " & integer'image(test_package.rec1.a));
end test1;
-------------------------------------------------------------------------------

It gives (for mye computer): 

test_package.rec1:  2

If I change the statement 

"a : integer := 2;"

to

"b : integer := 2;"

then I get:

test_package.rec1:  3

Is this reasonable?  Bug?

reinert




^ permalink raw reply	[flat|nested] 34+ messages in thread
* Is this a bug?
@ 2004-09-23  0:52 Wojtek Narczynski
  2004-09-23  8:35 ` Wojtek Narczynski
  2004-09-23 11:27 ` Jeff C r e e.m
  0 siblings, 2 replies; 34+ messages in thread
From: Wojtek Narczynski @ 2004-09-23  0:52 UTC (permalink / raw)


Hello,

GNAT 3.4.2 linux. If I uncomment the Current declaration, and replace
all occurrences of Current_Hook.all with it, the code does not work
anymore. Complete runnable testcase available upon request. Is this a
bug?

Regards,
Wojtek


procedure Put_Last
  (Queue : in out Queue_Type;
   Bucket : out Bucket_Access;
   Element : in Queue_Element_Access;
   Priority : Integer)
is
   Current_Hook : Bucket_Access_Access :=
     Queue.Anchor'Unchecked_Access;
   --  Current : Bucket_Access renames Current_Hook.all;
   --  XXX Uncommented and used - breaks the code
begin
   loop
      if Current_Hook.all = null then
         --  Reached end of list, append bucket
         Current_Hook.all := new Bucket_Type;
         Current_Hook.all.Priority := Priority;
         exit;
      elsif Current_Hook.all.Priority > Priority then
         --  Traverse to the next bucket
         Current_Hook := Current_Hook.all.Down'Unchecked_Access;
      elsif Current_Hook.all.Priority = Priority then
         --  Found bucket with desired pririty
         exit;
      elsif Current_Hook.all.Priority < Priority then
         --  Insert a bucket before current
         declare
            Bucket_New : Bucket_Access := new Bucket_Type;
         begin
            Bucket_New.Down := Current_Hook.all;
            Current_Hook.all := Bucket_New;
            Current_Hook.all.Priority := Priority;
            exit;
         end;
      end if;
   end loop;
   --  Here we are at bucket with correct priority
   Bucket := Current_Hook.all;
   Put_Last (Bucket.all, Element);
end Put_Last;



^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2020-01-17 22:14 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-30 15:44 Is this a bug? reinert
2019-12-30 17:51 ` Anh Vo
2019-12-30 18:41   ` Niklas Holsti
2019-12-30 19:50     ` reinert
2019-12-30 20:11       ` Dmitry A. Kazakov
2019-12-30 23:16     ` Randy Brukardt
2019-12-31 19:40       ` Optikos
2019-12-31 21:50         ` Randy Brukardt
2020-01-02  9:34           ` Dmitry A. Kazakov
2020-01-03  7:26             ` reinert
2020-01-03  7:35             ` reinert
2020-01-03  8:37               ` Dmitry A. Kazakov
2020-01-04  0:42                 ` Randy Brukardt
2020-01-05 13:32                   ` reinert
2020-01-06 10:43                     ` J-P. Rosen
2020-01-06 12:19                       ` Tero Koskinen
2020-01-17  9:54                 ` reinert
2020-01-17 10:08                   ` Dmitry A. Kazakov
2020-01-17 22:14                   ` Randy Brukardt
2019-12-31  6:08     ` J-P. Rosen
  -- strict thread matches above, loose matches on Subject: below --
2004-09-23  0:52 Wojtek Narczynski
2004-09-23  8:35 ` Wojtek Narczynski
2004-09-23 14:52   ` Nick Roberts
2004-09-23 22:26     ` Brian May
2004-09-24  0:28       ` Stephen Leake
2004-09-24  0:57         ` Jeffrey Carter
2004-09-24 12:47         ` Wojtek Narczynski
2004-09-25  0:17           ` Brian May
2004-09-24 12:37       ` Wojtek Narczynski
2004-09-23 11:27 ` Jeff C r e e.m
2004-09-24  0:30   ` Stephen Leake
2004-09-24  1:49     ` Jeff C r e e.m
2004-09-25 12:59       ` Stephen Leake
2004-10-04 16:36         ` Warren W. Gay VE3WWG

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox