Open the account with a small amount. The problem stems from Ada83's laxity regarding the implementation of IN OUT parameters. The problem begins with account1 and account2 . The additional level of indirection will solve the aliasing problem by making anAccount , account1 and account2 all refer to an account pointer , rather than directly to an account record. Even relatively benign uses of these mode IN OUT parameters can still create havoc.
Some bank accounts.
In the process of opening an account, the Bank allocates an account record from the heap and assigns it to the Account variable. Depending upon the order of copying, Account1 will be left with either the initialized account or the uninitialized account. Thus, if a compiler always uses the same ordering for copy-out, then we are guaranteed that one or the other of the two calls will cause an initialized account record to be lost. We have claimed, above, that virtually every use of limited types protects a resource of some sort, and we now claim that virtually every resource protected by such a limited type can be compromised by the aliasing of IN OUT parameters , as in the examples given above. If the most obvious combination of a language's features is inherently unsafe, then something is terribly wrong with the language.