comp.lang.ada
 help / color / mirror / Atom feed
* GNAT bug in the GNAT GPL 2014 compiler?
@ 2015-03-24 19:19 gorgelo
  2015-03-24 21:56 ` Anh Vo
  0 siblings, 1 reply; 8+ messages in thread
From: gorgelo @ 2015-03-24 19:19 UTC (permalink / raw)


Dear all,

I wasn't going to share the code for the mock code generator I've been working on before completion, but I've run in to some strange compilation error and would like to get a second opinion about it. The code that doesn't compile can be found at github:

https://github.com/joakim-strandberg/amock

amock depends upon ASIS (GNAT GPL 2014) and:

https://github.com/joakim-strandberg/aida

The compilation error is: amock-main_application.adb:170:61: missing "with Ada.Characters;"

That file contains "with Ada.Characters.Conversions;" among the with-statements. Why does the compiler complain? If one comments out the line 170, the code compiles just fine.

When writing the code for amock I've refrained from using access types in anticipation for the coming release of SPARK GPL in May 2015. I think it will be cool to be able to formally verify code that contains tagged types (Of course, I don't know if SPARK GPL 2015 will support it, maybe that functionality will only exist in a PRO version). Anyways, amock has been written in anticipation of it.

Best regards,
Joakim Strandberg

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

* Re: GNAT bug in the GNAT GPL 2014 compiler?
  2015-03-24 19:19 GNAT bug in the GNAT GPL 2014 compiler? gorgelo
@ 2015-03-24 21:56 ` Anh Vo
  2015-03-25  7:35   ` gorgelo
  0 siblings, 1 reply; 8+ messages in thread
From: Anh Vo @ 2015-03-24 21:56 UTC (permalink / raw)


On Tuesday, March 24, 2015 at 12:19:30 PM UTC-7, gor...@hotmail.com wrote:
> 
> The compilation error is: amock-main_application.adb:170:61: missing "with Ada.Characters;"
> 
> That file contains "with Ada.Characters.Conversions;" among the with-statements. Why does the compiler complain? If one comments out the line 170, the code compiles just fine.
> 
Line 170 looks perfectly fine. Could you post the exact compilation error message. I am curious about this also.

Anh Vo

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

* Re: GNAT bug in the GNAT GPL 2014 compiler?
  2015-03-24 21:56 ` Anh Vo
@ 2015-03-25  7:35   ` gorgelo
  2015-03-25  8:39     ` Simon Wright
  2015-03-25  8:41     ` Georg Bauhaus
  0 siblings, 2 replies; 8+ messages in thread
From: gorgelo @ 2015-03-25  7:35 UTC (permalink / raw)


Den tisdag 24 mars 2015 kl. 22:56:36 UTC+1 skrev Anh Vo:
> On Tuesday, March 24, 2015 at 12:19:30 PM UTC-7, gor...@hotmail.com wrote:
> > 
> > The compilation error is: amock-main_application.adb:170:61: missing "with Ada.Characters;"
> > 
> > That file contains "with Ada.Characters.Conversions;" among the with-statements. Why does the compiler complain? If one comments out the line 170, the code compiles just fine.
> > 
> Line 170 looks perfectly fine. Could you post the exact compilation error message. I am curious about this also.
> 
> Anh Vo

Here is the exact compilation error message: 

joakimstrandberg$ gprbuild -P amock.gpr 
gcc -c -gnat12 amock-main_application.adb
amock-main_application.adb:170:61: missing "with Ada.Characters;"
gprbuild: *** compilation phase failed

It's not only the package Ada.Characters that the compiler complains about. It does not allow usage of Ada.Text_IO nor Ada.Wide_Text_IO. It seems that any usage of a subprogram in any of the child packages of the Ada package is forbidden in the body of the Amock.Main_Application package. I can't imagine it can be anything but a GNAT compiler bug. I am hoping to be proven wrong and that I've done some obvious mistake.

Joakim Strandberg

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

* Re: GNAT bug in the GNAT GPL 2014 compiler?
  2015-03-25  7:35   ` gorgelo
@ 2015-03-25  8:39     ` Simon Wright
  2015-03-25  8:41     ` Georg Bauhaus
  1 sibling, 0 replies; 8+ messages in thread
From: Simon Wright @ 2015-03-25  8:39 UTC (permalink / raw)


gorgelo@hotmail.com writes:

> Den tisdag 24 mars 2015 kl. 22:56:36 UTC+1 skrev Anh Vo:
>> On Tuesday, March 24, 2015 at 12:19:30 PM UTC-7, gor...@hotmail.com wrote:
>> >
>> > The compilation error is: amock-main_application.adb:170:61:
>> > missing "with Ada.Characters;"
>> >
>> > That file contains "with Ada.Characters.Conversions;" among the
>> > with-statements. Why does the compiler complain? If one comments
>> > out the line 170, the code compiles just fine.
>> >
>> Line 170 looks perfectly fine. Could you post the exact compilation
>> error message. I am curious about this also.
>>
>> Anh Vo
>
> Here is the exact compilation error message:
>
> joakimstrandberg$ gprbuild -P amock.gpr
> gcc -c -gnat12 amock-main_application.adb
> amock-main_application.adb:170:61: missing "with Ada.Characters;"
> gprbuild: *** compilation phase failed
>
> It's not only the package Ada.Characters that the compiler complains
> about. It does not allow usage of Ada.Text_IO nor Ada.Wide_Text_IO. It
> seems that any usage of a subprogram in any of the child packages of
> the Ada package is forbidden in the body of the Amock.Main_Application
> package. I can't imagine it can be anything but a GNAT compiler bug. I
> am hoping to be proven wrong and that I've done some obvious mistake.

I get the same behaviour with GCC 4.9.1 (I would have tried GCC 5.0.0
also but I don't have ASIS built for it).

Compiling with -gnatwa (all standard warnings) and commenting out the
"not referenced" packages and using pragma Unreferenced on the Control
parameters of Pre and Post made the error go away. Not much help for
your full code, of course.

Looks like a compiler bug to me.

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

* Re: GNAT bug in the GNAT GPL 2014 compiler?
  2015-03-25  7:35   ` gorgelo
  2015-03-25  8:39     ` Simon Wright
@ 2015-03-25  8:41     ` Georg Bauhaus
  2015-03-25  9:13       ` Egil H H
  1 sibling, 1 reply; 8+ messages in thread
From: Georg Bauhaus @ 2015-03-25  8:41 UTC (permalink / raw)


On 25.03.15 08:35, gorgelo@hotmail.com wrote:
> Den tisdag 24 mars 2015 kl. 22:56:36 UTC+1 skrev Anh Vo:
>> On Tuesday, March 24, 2015 at 12:19:30 PM UTC-7, gor...@hotmail.com wrote:
>>>
>>> The compilation error is: amock-main_application.adb:170:61: missing "with Ada.Characters;"
>>>
>>> That file contains "with Ada.Characters.Conversions;" among the with-statements. Why does the compiler complain? If one comments out the line 170, the code compiles just fine.
>>>
>> Line 170 looks perfectly fine. Could you post the exact compilation error message. I am curious about this also.
>>
>> Anh Vo
>
> Here is the exact compilation error message:
>
> joakimstrandberg$ gprbuild -P amock.gpr
> gcc -c -gnat12 amock-main_application.adb
> amock-main_application.adb:170:61: missing "with Ada.Characters;"
> gprbuild: *** compilation phase failed
>
> It's not only the package Ada.Characters that the compiler complains about. It does not allow usage of Ada.Text_IO nor Ada.Wide_Text_IO. It seems that any usage of a subprogram in any of the child packages of the Ada package is forbidden in the body of the Amock.Main_Application package. I can't imagine it can be anything but a GNAT compiler bug. I am hoping to be proven wrong and that I've done some obvious mistake.

FWIW, the compiler accepts line 170 if the prefix "Standard" is
added to the expression assigned. Not sure what is going on,
but I'd suspect same naming overload.

diff --git a/source_files/amock-main_application.adb b/source_files/amock-main_application.adb
index 8cda6f5..93784b1 100644
--- a/source_files/amock-main_application.adb
+++ b/source_files/amock-main_application.adb
@@ -167,7 +167,7 @@ package body Amock.Main_Application is
           Input_Package             : Asis.Compilation_Unit;
           Input_Package_Declaration : Asis.Declaration;
  
-         Input_Package_Name_As_Wide_String : Wide_String := Ada.Characters.Conversions.To_Wide_String (Input_Package_Name);
+         Input_Package_Name_As_Wide_String : Wide_String := Standard.Ada.Characters.Conversions.To_Wide_String (Input_Package_Name);
        begin
           Asis.Implementation.Initialize ("-ws");
           Asis.Ada_Environments.Associate (My_Context, "My Asis Context", "-C1 .amock/command_line.adt");



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

* Re: GNAT bug in the GNAT GPL 2014 compiler?
  2015-03-25  8:41     ` Georg Bauhaus
@ 2015-03-25  9:13       ` Egil H H
  2015-03-25 14:16         ` Bob Duff
  0 siblings, 1 reply; 8+ messages in thread
From: Egil H H @ 2015-03-25  9:13 UTC (permalink / raw)


On Wednesday, March 25, 2015 at 9:41:01 AM UTC+1, Georg Bauhaus wrote:
> but I'd suspect same naming overload.

Exactly.

"package Amock.Main_Application" implicitly "use" Amock.
So when there is a child package called "Amock.Ada"
(implicilty included by "with Amock.Ada.Fields;" and 
"with Amock.Ada.Types;")any references to "Ada" in the 
code will be resolved to this child package. 

Either "Amock.Ada" should be renamed, or the ambiguity
should be resolved by prefixing with Standard, as
suggested.

-- 
~egilhh

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

* Re: GNAT bug in the GNAT GPL 2014 compiler?
  2015-03-25  9:13       ` Egil H H
@ 2015-03-25 14:16         ` Bob Duff
  2015-03-25 19:46           ` gorgelo
  0 siblings, 1 reply; 8+ messages in thread
From: Bob Duff @ 2015-03-25 14:16 UTC (permalink / raw)


Egil H H <ehh.public@gmail.com> writes:

> On Wednesday, March 25, 2015 at 9:41:01 AM UTC+1, Georg Bauhaus wrote:
>> but I'd suspect same naming overload.
>
> Exactly.
>
> "package Amock.Main_Application" implicitly "use" Amock.

Amock is directly visible within Amock.Main_Application, but there is
not implicit "use".  The visibility is as if Main_Application were
physically nested in Amock.  So Amok.Ada hides Standard.Ada.
If it were "use" visibility, then they would both be hidden
(which would be an improvement to the language).

My spell checker wants it to be "Amok".

> So when there is a child package called "Amock.Ada"
> (implicilty included by "with Amock.Ada.Fields;" and 
> "with Amock.Ada.Types;")any references to "Ada" in the 
> code will be resolved to this child package. 
>
> Either "Amock.Ada" should be renamed, or the ambiguity
> should be resolved by prefixing with Standard, as
> suggested.

Right.

- Bob


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

* Re: GNAT bug in the GNAT GPL 2014 compiler?
  2015-03-25 14:16         ` Bob Duff
@ 2015-03-25 19:46           ` gorgelo
  0 siblings, 0 replies; 8+ messages in thread
From: gorgelo @ 2015-03-25 19:46 UTC (permalink / raw)


Thanks Anh Vo, Simon Wright, Georg Bauhaus, Egil H and Bob Duff for taking a look at the code I had written. I did not think about that package Amock.Main_Application" implicitly "use" Amock. I've renamed the package Amock.Ada to Amock.Ada_Concepts.

Thanks for restoring my belief in the GNAT compiler. I was worried for a while there.

Joakim Strandberg

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

end of thread, other threads:[~2015-03-25 19:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-24 19:19 GNAT bug in the GNAT GPL 2014 compiler? gorgelo
2015-03-24 21:56 ` Anh Vo
2015-03-25  7:35   ` gorgelo
2015-03-25  8:39     ` Simon Wright
2015-03-25  8:41     ` Georg Bauhaus
2015-03-25  9:13       ` Egil H H
2015-03-25 14:16         ` Bob Duff
2015-03-25 19:46           ` gorgelo

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