comp.lang.ada
 help / color / Atom feed
* Convention aspect stricter than before? - GNAT Community 2020
@ 2020-06-03 17:59 Jesper Quorning
  2020-06-03 18:35 ` Jeffrey R. Carter
  2020-08-04 13:31 ` Fabien Chouteau
  0 siblings, 2 replies; 13+ messages in thread
From: Jesper Quorning @ 2020-06-03 17:59 UTC (permalink / raw)



The specification below compiles with CE2019 and GPL2017 but is rejected by CE2020:

c_convention_records.ads:5:04: representation item must appear after type is fully defined

Is this expected behaviour?

CE2020 accepts the specification when pragma Convention is used as for Record_2.

Is there an Ada 2012 way to solve this without moving Private_Record out of private part or using a pragma?


/Jesper

--
package C_Convention_Records is

   type Private_Record is private;

   type Record_1 is record  --  Line 5
      Dummy : Integer;
      Priv  : Private_Record;
   end record
     with Convention => C;

   type Record_2 is record
      Dummy : Integer;
      Priv  : Private_Record;
   end record;
   pragma Convention (C, Record_2);

private

   type Private_Record is record
      Dummy : Integer;
   end record
     with Convention => C;

end C_Convention_Records;

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Convention aspect stricter than before? - GNAT Community 2020
  2020-06-03 17:59 Convention aspect stricter than before? - GNAT Community 2020 Jesper Quorning
@ 2020-06-03 18:35 ` Jeffrey R. Carter
  2020-08-04 13:31 ` Fabien Chouteau
  1 sibling, 0 replies; 13+ messages in thread
From: Jeffrey R. Carter @ 2020-06-03 18:35 UTC (permalink / raw)


On 6/3/20 7:59 PM, Jesper Quorning wrote:
> 
> CE2020 accepts the specification when pragma Convention is used as for Record_2.
> 
> Is there an Ada 2012 way to solve this without moving Private_Record out of private part or using a pragma?

The aspect and pragma are supposed to be equivalent, so this looks like a 
compiler error.

-- 
Jeff Carter
"Help! Help! I'm being repressed!"
Monty Python & the Holy Grail
67

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Convention aspect stricter than before? - GNAT Community 2020
  2020-06-03 17:59 Convention aspect stricter than before? - GNAT Community 2020 Jesper Quorning
  2020-06-03 18:35 ` Jeffrey R. Carter
@ 2020-08-04 13:31 ` Fabien Chouteau
  2020-08-08  3:29   ` Randy Brukardt
  1 sibling, 1 reply; 13+ messages in thread
From: Fabien Chouteau @ 2020-08-04 13:31 UTC (permalink / raw)


On Wednesday, June 3, 2020 at 7:59:04 PM UTC+2, Jesper Quorning wrote:
> The specification below compiles with CE2019 and GPL2017 but is rejected by > c_convention_records.ads:5:04: representation item must appear after type is fully defined
> 
> Is this expected behaviour?

TM 13.1 (9.1/3) : An operational item that directly specifies an aspect of an entity shall appear before the entity is frozen (see 13.14)

The pragma should be rejected as well actually.

http://www.ada-auth.org/standards/12rm/html/RM-13-1.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Convention aspect stricter than before? - GNAT Community 2020
  2020-08-04 13:31 ` Fabien Chouteau
@ 2020-08-08  3:29   ` Randy Brukardt
  2020-08-08  9:46     ` Luke A. Guest
  0 siblings, 1 reply; 13+ messages in thread
From: Randy Brukardt @ 2020-08-08  3:29 UTC (permalink / raw)


"Fabien Chouteau" <[email protected]> wrote in message 
news:[email protected]
> On Wednesday, June 3, 2020 at 7:59:04 PM UTC+2, Jesper Quorning wrote:
>> The specification below compiles with CE2019 and GPL2017 but is rejected 
>> by > c_convention_records.ads:5:04: representation item must appear after 
>> type is fully defined
>>
>> Is this expected behaviour?
>
> TM 13.1 (9.1/3) : An operational item that directly specifies an aspect of 
> an entity shall appear before the entity is frozen (see 13.14)
>
> The pragma should be rejected as well actually.

???

I don't see anything in this package specification that freezes any of these 
types (other than "end", but of course that's well after the aspects and 
pragmas are given). Occurrences in a type declaration don't freeze a type 
(if they did, you couldn't mention a private type as a component type at 
all, since a partial view cannot be frozen before it is completed).

In any case, the pragma and aspect should be the same, so there's clearly a 
bug.


                            Randy.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Convention aspect stricter than before? - GNAT Community 2020
  2020-08-08  3:29   ` Randy Brukardt
@ 2020-08-08  9:46     ` Luke A. Guest
  2020-08-10  0:15       ` Randy Brukardt
  0 siblings, 1 reply; 13+ messages in thread
From: Luke A. Guest @ 2020-08-08  9:46 UTC (permalink / raw)


On 08/08/2020 04:29, Randy Brukardt wrote:

> I don't see anything in this package specification that freezes any of these 
> types (other than "end", but of course that's well after the aspects and 
> pragmas are given). Occurrences in a type declaration don't freeze a type 
> (if they did, you couldn't mention a private type as a component type at 
> all, since a partial view cannot be frozen before it is completed).
> 
> In any case, the pragma and aspect should be the same, so there's clearly a 
> bug.

A bug in the compiler?


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Convention aspect stricter than before? - GNAT Community 2020
  2020-08-08  9:46     ` Luke A. Guest
@ 2020-08-10  0:15       ` Randy Brukardt
  2020-08-10  6:35         ` Luke A. Guest
  0 siblings, 1 reply; 13+ messages in thread
From: Randy Brukardt @ 2020-08-10  0:15 UTC (permalink / raw)


"Luke A. Guest" <[email protected]> wrote in message 
news:[email protected]
> On 08/08/2020 04:29, Randy Brukardt wrote:
>
>> I don't see anything in this package specification that freezes any of 
>> these
>> types (other than "end", but of course that's well after the aspects and
>> pragmas are given). Occurrences in a type declaration don't freeze a type
>> (if they did, you couldn't mention a private type as a component type at
>> all, since a partial view cannot be frozen before it is completed).
>>
>> In any case, the pragma and aspect should be the same, so there's clearly 
>> a
>> bug.
>
> A bug in the compiler?

Yes. Regardless of what the correct behavior is for a particular example, 
the pragma is equivalent to the aspect so the results should be the same. If 
they differ, then there certainly is a compiler bug. *Exactly* what that bug 
is might be debatable (although I think it is pretty clear in this case).

                           Randy.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Convention aspect stricter than before? - GNAT Community 2020
  2020-08-10  0:15       ` Randy Brukardt
@ 2020-08-10  6:35         ` Luke A. Guest
  2020-08-10  9:15           ` Simon Wright
  2020-08-11  7:18           ` Jesper Quorning
  0 siblings, 2 replies; 13+ messages in thread
From: Luke A. Guest @ 2020-08-10  6:35 UTC (permalink / raw)


On 10/08/2020 01:15, Randy Brukardt wrote:
>> A bug in the compiler?
> 
> Yes. Regardless of what the correct behavior is for a particular example, 
> the pragma is equivalent to the aspect so the results should be the same. If 
> they differ, then there certainly is a compiler bug. *Exactly* what that bug 
> is might be debatable (although I think it is pretty clear in this case).

This is actually a bug filed on my repository


https://github.com/Lucretia/sdlada/pull/50/commits/4e80af4ca4f22ee0637af5d6ac277c65c221dcef

This is to do with this private part record component:

https://github.com/Lucretia/sdlada/blob/master/src/sdl-video-pixel_formats.ads#L655

https://github.com/Lucretia/sdlada/blob/master/src/sdl-video-pixel_formats.ads#L756

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Convention aspect stricter than before? - GNAT Community 2020
  2020-08-10  6:35         ` Luke A. Guest
@ 2020-08-10  9:15           ` Simon Wright
  2020-08-10 14:53             ` Luke A. Guest
  2020-08-11  7:18           ` Jesper Quorning
  1 sibling, 1 reply; 13+ messages in thread
From: Simon Wright @ 2020-08-10  9:15 UTC (permalink / raw)


"Luke A. Guest" <[email protected]> writes:

> https://github.com/Lucretia/sdlada/blob/master/src/sdl-video-pixel_formats.ads#L756

Rred_Loss?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Convention aspect stricter than before? - GNAT Community 2020
  2020-08-10  9:15           ` Simon Wright
@ 2020-08-10 14:53             ` Luke A. Guest
  0 siblings, 0 replies; 13+ messages in thread
From: Luke A. Guest @ 2020-08-10 14:53 UTC (permalink / raw)


On 10/08/2020 10:15, Simon Wright wrote:
> "Luke A. Guest" <[email protected]> writes:
> 
>> https://github.com/Lucretia/sdlada/blob/master/src/sdl-video-pixel_formats.ads#L756
> 
> Rred_Loss?
> 

Oh, never noticed that.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Convention aspect stricter than before? - GNAT Community 2020
  2020-08-10  6:35         ` Luke A. Guest
  2020-08-10  9:15           ` Simon Wright
@ 2020-08-11  7:18           ` Jesper Quorning
  2020-08-11  7:34             ` Luke A. Guest
  1 sibling, 1 reply; 13+ messages in thread
From: Jesper Quorning @ 2020-08-11  7:18 UTC (permalink / raw)


Guess there is a design problem in the binding..

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Convention aspect stricter than before? - GNAT Community 2020
  2020-08-11  7:18           ` Jesper Quorning
@ 2020-08-11  7:34             ` Luke A. Guest
  2020-08-11 16:23               ` Jesper Quorning
  0 siblings, 1 reply; 13+ messages in thread
From: Luke A. Guest @ 2020-08-11  7:34 UTC (permalink / raw)


On 11/08/2020 08:18, Jesper Quorning wrote:
> Guess there is a design problem in the binding..
> 

No, it's all pointing at a compiler bug.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Convention aspect stricter than before? - GNAT Community 2020
  2020-08-11  7:34             ` Luke A. Guest
@ 2020-08-11 16:23               ` Jesper Quorning
  2020-08-11 19:23                 ` Luke A. Guest
  0 siblings, 1 reply; 13+ messages in thread
From: Jesper Quorning @ 2020-08-11 16:23 UTC (permalink / raw)


tirsdag den 11. august 2020 kl. 09.35.52 UTC+2 skrev Luke A. Guest:
> On 11/08/2020 08:18, Jesper Quorning wrote: 
> > Guess there is a design problem in the binding.. 
> >
> No, it's all pointing at a compiler bug.

Compiler bug and binding design problem I guess..

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Convention aspect stricter than before? - GNAT Community 2020
  2020-08-11 16:23               ` Jesper Quorning
@ 2020-08-11 19:23                 ` Luke A. Guest
  0 siblings, 0 replies; 13+ messages in thread
From: Luke A. Guest @ 2020-08-11 19:23 UTC (permalink / raw)


On 11/08/2020 17:23, Jesper Quorning wrote:
> tirsdag den 11. august 2020 kl. 09.35.52 UTC+2 skrev Luke A. Guest:
>> On 11/08/2020 08:18, Jesper Quorning wrote: 
>>> Guess there is a design problem in the binding.. 
>>>
>> No, it's all pointing at a compiler bug.
> 
> Compiler bug and binding design problem I guess..
> 
AFAICT from other responses, you're the only person who thinks this. The
binding is fine AFAIK. The only issue might be the that that the padding
record is private.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, back to index

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 17:59 Convention aspect stricter than before? - GNAT Community 2020 Jesper Quorning
2020-06-03 18:35 ` Jeffrey R. Carter
2020-08-04 13:31 ` Fabien Chouteau
2020-08-08  3:29   ` Randy Brukardt
2020-08-08  9:46     ` Luke A. Guest
2020-08-10  0:15       ` Randy Brukardt
2020-08-10  6:35         ` Luke A. Guest
2020-08-10  9:15           ` Simon Wright
2020-08-10 14:53             ` Luke A. Guest
2020-08-11  7:18           ` Jesper Quorning
2020-08-11  7:34             ` Luke A. Guest
2020-08-11 16:23               ` Jesper Quorning
2020-08-11 19:23                 ` Luke A. Guest

comp.lang.ada

Archives are clonable: git clone --mirror https://archive.legitdata.co/comp.lang.ada

Example config snippet for mirrors


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git