From: Dmitry A. Kazakov on
On Tue, 13 Jul 2010 20:20:00 +0100, Simon Wright wrote:

> "Dmitry A. Kazakov" <mailbox(a)dmitry-kazakov.de> writes:
>
>> On Tue, 13 Jul 2010 05:45:11 -0700 (PDT), Ludovic Brenta wrote:
>
>>>> P.S. In any case in order to use the persistent layer of Simple Components,
>>>> the gcc 4.4 must be fixed first. The current version has controlled types
>>>> broken and some other severe issues.
>>>
>>> Wow, that's a pretty grave problem; if what you say is true, a fix in
>>> the stable GCC 4.4 branch is justified. What is the bugzilla number
>>> for this bug?
>>
>> There are several. For example this one:
>
> With GCC 4.5.0 and with GNAT GPL 2010 (both on Mac OS X Snow Leopard)
> this program produces
>
> $ ./controlled_array
> Count 1
> Successful finalization
> Successful finalization
> Successful finalization

This is how it should be.

Debian's or Fedora's gcc 4.4 spits:

Count 2
Illegal count in finalization 1

raised PROGRAM_ERROR : adjust/finalize raised PROGRAM_ERROR:
controlled_array.adb:18 explicit raise

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
From: Ludovic Brenta on
Dmitry A. Kazakov wrote on comp.lang.ada:
> On Tue, 13 Jul 2010 20:20:00 +0100, Simon Wright wrote:
>> "Dmitry A. Kazakov" <mail...(a)dmitry-kazakov.de> writes:
>>> On Tue, 13 Jul 2010 05:45:11 -0700 (PDT), Ludovic Brenta wrote:
>>>>> P.S. In any case in order to use the persistent layer of Simple Components,
>>>>> the gcc 4.4 must be fixed first. The current version has controlled types
>>>>> broken and some other severe issues.
>>>>
>>>> Wow, that's a pretty grave problem; if what you say is true, a fix in
>>>> the stable GCC 4.4 branch is justified. What is the bugzilla number
>>>> for this bug?
>>>
>>> There are several. For example this one:
>>
>> With GCC 4.5.0 and with GNAT GPL 2010 (both on Mac OS X Snow Leopard)
>> this program produces
>>
>>    $ ./controlled_array
>>    Count 1
>>    Successful finalization
>>    Successful finalization
>>    Successful finalization
>
> This is how it should be.
>
> Debian's or Fedora's gcc 4.4 spits:
>
> Count 2
> Illegal count in finalization 1
>
> raised PROGRAM_ERROR : adjust/finalize raised PROGRAM_ERROR:
> controlled_array.adb:18 explicit raise


Looks like this might be the patch that corrects this bug:

2009-04-17 Thomas Quinot <quinot(a)adacore.com>

* exp_ch7.adb (Expand_Ctrl_Function_Call): Remove incorrect special
case for the case of an aggregate component, the attach call for the
result is actually needed.

* exp_aggr.adb (Backend_Processing_Possible): Backend processing for
an array aggregate must be disabled if the component type requires
controlled actions.

* exp_ch3.adb: Minor reformatting

I'll add a backport of this patch to my long TODO list.

--
Ludovic Brenta.