* Why does this happen?
@ 2002-10-15 22:12 svesse
2002-10-16 0:46 ` Dennis Lee Bieber
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: svesse @ 2002-10-15 22:12 UTC (permalink / raw)
Hello,
I got a question regarding the enclosed code
which compiles on Rational Apex and on old
GNAT versions (at least on 3.11p). However
in GNAT 3.14p the following error message is
shown :
gnatmake test.adb
gcc -c test.adb
test.ads: In function `test__proc':
test.ads:6: prior parameter's size depends on `ns'
test.ads:6: prior parameter's size depends on `ns'
test.ads:6: prior parameter's size depends on `ns'
test.ads:6: prior parameter's size depends on `ns'
test.ads:6: prior parameter's size depends on `ns'
test.ads:6: prior parameter's size depends on `ns'
test.ads:6: prior parameter's size depends on `ns'
test.ads:6: prior parameter's size depends on `ns'
gnatmake: "test.adb" compilation error
if any of the two commented lines are used instead
it also compiles on GNAT 3.14p
Can someone explain why this would be illegal ?
---- test.ads ---
package test is
Type Mtr_Type is array (Positive range <>,
Positive range <>) of integer;
type T_typ (Ns : Positive) is record
M : Mtr_Type (1..2, 1 .. ns); -- does not compile
-- M : Mtr_Type (1..Ns, 1..Ns); -- compiles
-- M : Mtr_Type (1..Ns, 1..2); -- compiles
end record;
function Func (Left : Mtr_Type) return Mtr_Type;
procedure Proc (T : in out T_Typ);
end test;
----------
---- test.adb ----
package body test is
function Func (Left : Mtr_Type) return Mtr_Type is
begin
return Left;
end Func;
procedure Proc(T : in out T_Typ) is
begin
T.M := Func(T.M);
end Proc;
end test;
-------
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Why does this happen?
2002-10-15 22:12 Why does this happen? svesse
@ 2002-10-16 0:46 ` Dennis Lee Bieber
2002-10-16 2:25 ` tmoran
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: Dennis Lee Bieber @ 2002-10-16 0:46 UTC (permalink / raw)
svesse fed this fish to the penguins on Tuesday 15 October 2002 03:12
pm:
>
> Can someone explain why this would be illegal ?
>
> ---- test.ads ---
> package test is
>
> Type Mtr_Type is array (Positive range <>,
> Positive range <>) of integer;
>
> type T_typ (Ns : Positive) is record
> M : Mtr_Type (1..2, 1 .. ns); -- does not compile
I know Ada is supposed to be case insensitive, but if this is a direct
cut&paste from your file... You have "Ns" in the descriminant (hope I
have the proper term), but "ns" in the array dimension. You /also/ have
spaces surrounding the "..". Neither of these differences show in the
following two lines.
> -- M : Mtr_Type (1..Ns, 1..Ns); -- compiles
> -- M : Mtr_Type (1..Ns, 1..2); -- compiles
The only other idea is that the calculation of offsets for "1..2" can
not be done immediately -- it may be that the parsing requires variable
ranges to be leftmost in the subscript order.
--
> ============================================================== <
> wlfraed@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
> wulfraed@dm.net | Bestiaria Support Staff <
> ============================================================== <
> Bestiaria Home Page: http://www.beastie.dm.net/ <
> Home Page: http://www.dm.net/~wulfraed/ <
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Why does this happen?
2002-10-15 22:12 Why does this happen? svesse
2002-10-16 0:46 ` Dennis Lee Bieber
@ 2002-10-16 2:25 ` tmoran
2002-10-16 6:02 ` Anders Wirzenius
2002-10-16 5:36 ` Simon Wright
2002-10-16 19:56 ` Gautier
3 siblings, 1 reply; 11+ messages in thread
From: tmoran @ 2002-10-16 2:25 UTC (permalink / raw)
> Type Mtr_Type is array (Positive range <>,
> Positive range <>) of integer;
>
> type T_typ (Ns : Positive) is record
> M : Mtr_Type (1..2, 1 .. ns); -- does not compile
> end record;
Gnat 3.14 on my Windows system compiles those lines without complaint.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Why does this happen?
2002-10-15 22:12 Why does this happen? svesse
2002-10-16 0:46 ` Dennis Lee Bieber
2002-10-16 2:25 ` tmoran
@ 2002-10-16 5:36 ` Simon Wright
2002-10-16 15:53 ` Jerry van Dijk
2002-10-16 19:56 ` Gautier
3 siblings, 1 reply; 11+ messages in thread
From: Simon Wright @ 2002-10-16 5:36 UTC (permalink / raw)
svesse <svesse@linux.nu> writes:
> Can someone explain why this would be illegal ?
I suspect it isn't illegal, rather looks like a compiler bug; 3.15a1
gives similar results to yours (only 4 lines of complaint!) whereas
GCC-3.2 (and 3.1, 3.3) give bombs:
smaug[21]$ gnatgcc -c test.adb
+===========================GNAT BUG DETECTED==============================+
| 3.2 20020814 (release) (i686-pc-linux-gnu) GCC error: |
| Internal compiler error in make_decl_rtl, at varasm.c:835 |
| Error detected at test.adb:14:13 |
| Please submit a bug report, see http://gcc.gnu.org/bugs.html. |
| 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). |
+==========================================================================+
Please include these source files with error report
test.adb
test.ads
compilation abandoned
I think this is worth a PR, shall I do it?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Why does this happen?
2002-10-16 2:25 ` tmoran
@ 2002-10-16 6:02 ` Anders Wirzenius
2002-10-16 7:32 ` tmoran
0 siblings, 1 reply; 11+ messages in thread
From: Anders Wirzenius @ 2002-10-16 6:02 UTC (permalink / raw)
<tmoran@acm.org> wrote in message news:D64r9.59604$rz6.10428@sccrnsc02...
> > Type Mtr_Type is array (Positive range <>,
> > Positive range <>) of integer;
> >
> > type T_typ (Ns : Positive) is record
> > M : Mtr_Type (1..2, 1 .. ns); -- does not compile
> > end record;
>
> Gnat 3.14 on my Windows system compiles those lines without complaint.
... but not on my Gnat 3.14, Windows NT.
I get the same error message as OP.
instead
M : Mtr_Type (-1..ns, -1..ns);
compiles without errors.
Could it be a question of elaboration, because a compilation, having
M : Mtr_Type (-1..ns, -1..ns);
in test.ads,
of a test_test.adb
with test;
with Ada.Text_IO;
procedure test_test is
A: test.T_typ(2);
begin
null;
end;
gives the warning
test.ads:7:22: warning: static value out of range of type
"Standard.positive"
test.ads:7:22: warning: "constraint_error" will be raised at run time
Anders Wirzenius
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Why does this happen?
2002-10-16 6:02 ` Anders Wirzenius
@ 2002-10-16 7:32 ` tmoran
2002-10-16 13:44 ` Frank J. Lhota
0 siblings, 1 reply; 11+ messages in thread
From: tmoran @ 2002-10-16 7:32 UTC (permalink / raw)
> > Gnat 3.14 on my Windows system compiles those lines without complaint.
>
> ... but not on my Gnat 3.14, Windows NT.
> I get the same error message as OP.
Interesting. The declarations compile OK. An assignment to T.M
in the body causes the error message to appear in the spec. Dropping
Func, the body:
package body test is
junk:mtr_type(1 .. 2, 1 .. 2);
procedure Proc(T : in out T_Typ) is
-- junk : mtr_type := T.M;
begin
T.M := junk;
end Proc;
end test;
causes the error message, but if you switch which "junk" is commented out,
Gnat gives its "I crashed" message. Clearly a confused compiler.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Why does this happen?
2002-10-16 7:32 ` tmoran
@ 2002-10-16 13:44 ` Frank J. Lhota
0 siblings, 0 replies; 11+ messages in thread
From: Frank J. Lhota @ 2002-10-16 13:44 UTC (permalink / raw)
With GNAT 3.14p under NT, I get the same problem, even after adjusting the
case of "Ns" and the white space. ObjectAda seems to handle this just fine,
however. Just a weird compiler bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Why does this happen?
2002-10-16 5:36 ` Simon Wright
@ 2002-10-16 15:53 ` Jerry van Dijk
2002-10-17 9:50 ` Colin Paul Gloster
0 siblings, 1 reply; 11+ messages in thread
From: Jerry van Dijk @ 2002-10-16 15:53 UTC (permalink / raw)
Simon Wright <simon@pushface.org> writes:
> I suspect it isn't illegal, rather looks like a compiler bug; 3.15a1
> gives similar results to yours (only 4 lines of complaint!) whereas
> GCC-3.2 (and 3.1, 3.3) give bombs:
Yes, the gcc GNAT 3.1 and 3.2 that come with the mingw system are not very
useful. However, after the freezing of the gcc 3.2 sources, a big update was
done to gcc GNAT, and it is now a LOT better.
If you want to try for yourself, goto
http://prdownloads.sf.net/mingw
and download
gnatgcc-3.3-exp-20021006-notes.txt.gz
gnatgcc-3.3-exp-20021006.tar.gz
(and gnatgcc-3.3-exp-20021006.tar.gz if you need the sources)
and follow the instructions in the notes file. REALLY as it is not installed
under the current mingw distribution.
Note: the is currently no such thing as an gcc 3.3, and this is strictly
an experimental build. Although it is, IMO, much better then the 3.2 GNAT
version on Mingw, an ACVC run still shows some problems.
--
-- Jerry van Dijk | email: jvandyk@attglobal.net
-- Leiden, Holland | web: users.ncrvnet.nl/gmvdijk
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Why does this happen?
2002-10-15 22:12 Why does this happen? svesse
` (2 preceding siblings ...)
2002-10-16 5:36 ` Simon Wright
@ 2002-10-16 19:56 ` Gautier
3 siblings, 0 replies; 11+ messages in thread
From: Gautier @ 2002-10-16 19:56 UTC (permalink / raw)
> Hello,
> I got a question regarding the enclosed code
> which compiles on Rational Apex and on old
> GNAT versions (at least on 3.11p). However
> in GNAT 3.14p the following error message is
> shown :
[...]
You found a nice bug!
It compiles with ObjectAda 7.2.1 SE, GNAT/DOS 3.10p
and also an Ada 83 compiler.
________________________________________________________
Gautier -- http://www.mysunrise.ch/users/gdm/gsoft.htm
NB: For a direct answer, address on the Web site!
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Why does this happen?
2002-10-16 15:53 ` Jerry van Dijk
@ 2002-10-17 9:50 ` Colin Paul Gloster
2002-10-17 12:08 ` Jerry van Dijk
0 siblings, 1 reply; 11+ messages in thread
From: Colin Paul Gloster @ 2002-10-17 9:50 UTC (permalink / raw)
In article <ur8eqwfb9.fsf@attglobal.net>, Jerry van Dijk wrote:
"Yes, the gcc GNAT 3.1 and 3.2 that come with the mingw system are not very
useful. However, after the freezing of the gcc 3.2 sources, a big update was
done to gcc GNAT, and it is now a LOT better.
If you want to try for yourself, goto
http://prdownloads.sf.net/mingw
and download
gnatgcc-3.3-exp-20021006-notes.txt.gz
gnatgcc-3.3-exp-20021006.tar.gz
(and gnatgcc-3.3-exp-20021006.tar.gz if you need the sources)
[..] Although it is, IMO, much better then the 3.2 GNAT
version on Mingw, an ACVC run still shows some problems."
Does the -gnat83 switch still allow non-Ada83 programs with -1 .. 100
literal loop constraints pass without any warnings?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Why does this happen?
2002-10-17 9:50 ` Colin Paul Gloster
@ 2002-10-17 12:08 ` Jerry van Dijk
0 siblings, 0 replies; 11+ messages in thread
From: Jerry van Dijk @ 2002-10-17 12:08 UTC (permalink / raw)
Colin_Paul_Gloster@ACM.org (Colin Paul Gloster) writes:
> Does the -gnat83 switch still allow non-Ada83 programs with -1 .. 100
> literal loop constraints pass without any warnings?
If it does in the current compiler, than it probably still does.
Note that by better, I mean that it functions better on Windows (less
blowups), not that there are additional frontend bugs resolved. 3.14p is,
IMHO, still the better compiler.
--
-- Jerry van Dijk | email: jvandyk@attglobal.net
-- Leiden, Holland | web: users.ncrvnet.nl/gmvdijk
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2002-10-17 12:08 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-15 22:12 Why does this happen? svesse
2002-10-16 0:46 ` Dennis Lee Bieber
2002-10-16 2:25 ` tmoran
2002-10-16 6:02 ` Anders Wirzenius
2002-10-16 7:32 ` tmoran
2002-10-16 13:44 ` Frank J. Lhota
2002-10-16 5:36 ` Simon Wright
2002-10-16 15:53 ` Jerry van Dijk
2002-10-17 9:50 ` Colin Paul Gloster
2002-10-17 12:08 ` Jerry van Dijk
2002-10-16 19:56 ` Gautier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox