> From: "Martin C. Carlisle" <[log in to unmask]> > X-To: "\"\\\\\"\\\\'[\\\\\"[log in to unmask]\\\\\" > <[log in to unmask]>'\\\\ > Servers[\\\\[log in to unmask]\\\\\\\"\\\" ]" > <[log in to unmask]> > > I've done some experiments on this. This is the behavior I detect on GNAT > 3.11p (Windows 98). > > If I initialize both the Unbounded_String(s) to Null_Unbounded_String and > explicitly override Swap in Car with the exact same code, then it works > fine. > > Perhaps someone else can enlighten as to why this behavior occurs (may be a > bug?-- consider sending to [log in to unmask]). I added a dummy e1 package > below. On Linux, with 3.11p i486-pc-linux-gnulibc1 I get pogner$ e1-main raised PROGRAM_ERROR : stack overflow (or erroneous memory access) The debugger says we've stopped at Program received signal SIGSEGV, Segmentation fault. 0x805668a in ada__tags__get_prim_op_address () Current language: auto; currently c (gdb) bt #0 0x805668a in ada__tags__get_prim_op_address () #1 0x8057f11 in system__finalization_implementation__finalize_list () #2 0x8049c60 in <e1__vehicle__swap___clean> () at e1-vehicle.adb:3 #3 0x804a161 in e1.vehicle.swap (l=@0xbffff5f0, r=@0xbffff42c) at e1-vehicle.adb:9 ... (gdb) fr 3 #3 0x804a161 in e1.vehicle.swap (l=@0xbffff5f0, r=@0xbffff42c) at e1-vehicle.adb:9 9 R := Temp; I think the trouble is that Swap is only handling the Vehicle.Object view and not the full Car.Object view. I don't know if this is a bug or not. You can certainly avoid the crash by providing Car.Swap (with the same implementation). You can also win by making Vehicle.Swap take classwide parameters procedure Swap (L,R : in out Object'Class); in which case you might want to add a check in the body that both parameters are of the same actual class.