comp.lang.ada
 help / color / mirror / Atom feed
From: Rod Kay <rodakay5@gmail.com>
Subject: Is this a compiler bug ?
Date: Sun, 19 Mar 2023 17:17:20 +1100	[thread overview]
Message-ID: <tv69dh$2srvk$1@dont-email.me> (raw)

Hi all,

    Came across this during a port of the Box2D physics engine.

    It's a generic Stack package using 'ada.Containers.Vectors' to 
implement the stack.

    One generic parameter is the 'initial_Capacity' of the stack, used 
in the 'to_Stack' construction function, via the Vectors 
'reserve_Capacity' procedure.

    In the 'to_Stack' function, the Capacity is reserved correctly but 
in the test program when the stack is created and assigned to a 
variable, the capacity is 0.

    Here is the (very small) source code ...

    https://gist.github.com/charlie5/7b4d863227a510f834c2bfd781dd50ba


    The output I get with GCC 12.2.0 is ...

[rod@orth bug]$ ./stack_bug
to_Stack ~ Initial Capacity: 256
to_Stack ~ Before reserve:   0
to_Stack ~ After reserve:    256
stack_Bug ~ Actual Capacity: 0


Regards.

             reply	other threads:[~2023-03-19  6:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-19  6:17 Rod Kay [this message]
2023-03-19 10:33 ` Is this a compiler bug ? Jeffrey R.Carter
2023-03-20  2:24   ` Rod Kay
replies disabled

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