[gnat] -- patch for PR 11090 (Variant Record Initialization)

Laurent GUERBY guerby@acm.org
Sun Sep 14 07:56:00 GMT 2003


On Sun, 2003-09-14 at 03:25, bud davis wrote:
> Below patch corrects problem described in PR 11090.  
> 
> "acats4gnat" (from http://perso.wanadoo.fr/guerby/)
> has no additional failures caused by this patch.

The interesting thing is that there is no additional success :).

> no testcase provided (ada appears to have none). the example 
> program provided with the PR does give the correct output.
> 
> "make bootstrap" runs to completion on i686-pc-linux-gnu.

I tried the code with the latest GCC 3.2.x based GNAT Pro (5.01a), and
it looks like the bug is fixed there:

<<
Initializing rec1
  Note: inc_int is unexpectedly called more than once
        when initializing the var3 field
   int_cnt was :  0 : is :  1 :
Done initializing rec1

Initializing rec2
  Note: inc_int is unexpectedly called more than once
        when initializing the var3 field
   int_cnt was :  1 : is :  2 :
Done initializing rec2

Printing var3 field in rec1 and then rec2.
   Note: This is not what was expected.
         Only expected inc_int to be called once,
         with returned values of 1 and 2.
rec1.var_rec_1.var3:  1
rec2.var_rec_1.var3:  2
>>

I could not find the patch you provided in the ACT sources
so I guess the bug was fixed another way. 

The bug is also fixed if you build a combined GCC + GNAT HEAD, but
there are many ACATS problems with this compiler.

Laurent




More information about the Gcc-patches mailing list