comp.lang.ada
 help / color / mirror / Atom feed
* GNAT crunch (suspected bug with types derived from unchecked union)
@ 2009-07-13 10:49 Hibou57 (Yannick Duchêne)
  2009-07-13 12:51 ` Hibou57 (Yannick Duchêne)
  0 siblings, 1 reply; 5+ messages in thread
From: Hibou57 (Yannick Duchêne) @ 2009-07-13 10:49 UTC (permalink / raw)


Hello,

Surprisingly, GNAT persist in crashing when compiling a little project
(surprisingly beceause it is known all over the place to be stable).

It ask me to send a report by mail, but request me to send some
temporary files which I cannot find any where (it gives paths, but no
files found for these paths).

As I'm not a GNAT Pro client, do you think it is useful if I send a
report, even with some missing files ?

What are they doing with these files ? (the message aks for source
files as well)

I will keep an archive of the project in its actual state, to test it
on Janus as soon as I will get it (while don't know when).

The crash seems to be caused by the usage of an uncheched record.

1) I have an uncheched record defined in a root package.
2) A child package makes a derived new type from this record.
3) This new type is part of another record which has a full
representation clause.
4) The compiler first complained the size requested by the
representation was too small.
5) So I added an unchecked pragma to the derived type as well.
6) Then when I wanted to compile the project, it crashs (I've tried
many time after clean up, but it insist on)

I've already meet steps 1 to 5 in this project, but after I've added
the pragma to the derived type, it was compiling without a trouble.
There it is not.

I will have to check the ARM about this pragma, beceause as it is
considered a reprensentation clause, I was thinking it was inherited
by derived types. But messages from the compiler seems to tell it is
not (I do not know if the buf start there, so I will check for it
first).



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

* Re: GNAT crunch (suspected bug with types derived from unchecked union)
  2009-07-13 10:49 GNAT crunch (suspected bug with types derived from unchecked union) Hibou57 (Yannick Duchêne)
@ 2009-07-13 12:51 ` Hibou57 (Yannick Duchêne)
  2009-07-13 15:27   ` Hibou57 (Yannick Duchêne)
  0 siblings, 1 reply; 5+ messages in thread
From: Hibou57 (Yannick Duchêne) @ 2009-07-13 12:51 UTC (permalink / raw)


More info :

The derived type has its full declaration in the private part of a
package specification. The public part introduce the type as a private
type with an unknown discriminant part (I want all instances of this
type, to always be initialized).

If I remove the unknown discrimiant part, it compiles without a crash.

It does not crash while compiling the package (specification and
body), but only when compiling the body of a package which withs this
package and declare an instance of the incriminated type (with an
unknown discriminant) in the locals of a procedure.



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

* Re: GNAT crunch (suspected bug with types derived from unchecked union)
  2009-07-13 12:51 ` Hibou57 (Yannick Duchêne)
@ 2009-07-13 15:27   ` Hibou57 (Yannick Duchêne)
  2009-07-13 21:59     ` sjw
  0 siblings, 1 reply; 5+ messages in thread
From: Hibou57 (Yannick Duchêne) @ 2009-07-13 15:27 UTC (permalink / raw)


Isolated version of the bug (posted here for people with interest,
will be submitted to AdaCore latter in the day):


-- File p.ads

| package P is
|
|    type Derived (<>) is private;
|
|    function Return_Derived return Derived;
|
| private
|
|    type Discriminant_Kinds is (Choice);
|
|    type Base (Discriminant : Discriminant_Kinds := Choice)
|    is
|       record
|          case Discriminant is
|             when Choice =>
|                Component  : Natural;
|          end case;
|       end record;
|
|    pragma Unchecked_Union (Base);
|
|    type Derived is new Base;
|
|    pragma Unchecked_Union (Derived);
|
| end P;


-- File p.adb

| package body P is
|
|    function Return_Derived return Derived is
|    begin
|       return Derived'(Discriminant => Choice, Component => 0);
|    end Return_Derived;
|
| end P;


-- File client.adb

| with P;
|
| procedure Client is
|    Instance : P.Derived := P.Return_Derived;
| begin
|    null;
| end Client;


-- The message I got from the compiler

> gnatmake -ws -c -u -PC:\\Ada\\gnat-bug-pragma-unchecked\\bug.gpr client.adb -s -q
> +===========================GNAT BUG DETECTED==============================+
> | GPL 2009 (20090519) (i686-pc-mingw32) Program_Error EXCEPTION_ACCESS_VIOLATION|
> | Error detected at system.ads:200:5                                       |
> | Please submit a bug report by email to report@adacore.com.               |
> | GAP members can alternatively use GNAT Tracker:                          |
> | http://www.adacore.com/ section 'send a report'.                         |
> | See gnatinfo.txt for full info on procedure for submitting bugs.         |
> | Use a subject line meaningful to you and us to track the bug.            |
> | Include the entire contents of this bug box in the report.               |
> | Include the exact gcc or gnatmake command that you entered.              |
> | Also include sources listed below in gnatchop format                     |
> | (concatenated together with no headers between files).                   |
> | Use plain ASCII or MIME attachment.                                      |
> +==========================================================================+
>
> Please include these source files with error report
> Note that list may not be accurate in some cases,
> so please double check that the problem can still
> be reproduced with the set of files listed.
> Consider also -gnatd.n switch (see debug.adb).
>
> C:\Ada\gnat-bug-pragma-unchecked\client.adb
> C:\ada\gnat-bug-pragma-unchecked\binaries\GNAT-TEMP-000001.TMP
> C:\ada\gnat-bug-pragma-unchecked\binaries\GNAT-TEMP-000002.TMP
> c:\ada\gnat-bug-pragma-unchecked\p.ads
>
> compilation abandoned
> gnatmake: "c:\ada\gnat-bug-pragma-unchecked\client.adb" compilation error



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

* Re: GNAT crunch (suspected bug with types derived from unchecked union)
  2009-07-13 15:27   ` Hibou57 (Yannick Duchêne)
@ 2009-07-13 21:59     ` sjw
  2009-07-13 23:59       ` Hibou57 (Yannick Duchêne)
  0 siblings, 1 reply; 5+ messages in thread
From: sjw @ 2009-07-13 21:59 UTC (permalink / raw)


On Jul 13, 4:27 pm, Hibou57 (Yannick Duchêne)
<yannick_duch...@yahoo.fr> wrote:
> Isolated version of the bug (posted here for people with interest,
> will be submitted to AdaCore latter in the day):
>
> -- File p.ads
>
> | package P is
> |
> |    type Derived (<>) is private;

Yannick,

It's a lot more convenient for people to work on code examples if you
_don't_ prefix each line with a vertical bar! Just the code, please!
(or are you stuck with a newsreader that trashes source code unless
you prefix it like this?)

NB, gnatchop is quite happy to split the source code up for us into
the appropriate files, no need to include comments to delimit the
units.



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

* Re: GNAT crunch (suspected bug with types derived from unchecked union)
  2009-07-13 21:59     ` sjw
@ 2009-07-13 23:59       ` Hibou57 (Yannick Duchêne)
  0 siblings, 0 replies; 5+ messages in thread
From: Hibou57 (Yannick Duchêne) @ 2009-07-13 23:59 UTC (permalink / raw)


On 13 juil, 23:59, sjw <simon.j.wri...@mac.com> wrote:
> It's a lot more convenient for people to work on code examples if you
> _don't_ prefix each line with a vertical bar! Just the code, please!
> (or are you stuck with a newsreader that trashes source code unless
> you prefix it like this?)

That's near to that. It removes empty lines, and I feel it makes it
sometime less readable.

> NB, gnatchop is quite happy to split the source code up for us into
> the appropriate files, no need to include comments to delimit the
> units.
I've send it today to the report@adacore.com addresse, but without
these prefixs (I'm sorry for the prefixes added here).




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

end of thread, other threads:[~2009-07-13 23:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-13 10:49 GNAT crunch (suspected bug with types derived from unchecked union) Hibou57 (Yannick Duchêne)
2009-07-13 12:51 ` Hibou57 (Yannick Duchêne)
2009-07-13 15:27   ` Hibou57 (Yannick Duchêne)
2009-07-13 21:59     ` sjw
2009-07-13 23:59       ` Hibou57 (Yannick Duchêne)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox