comp.lang.ada
 help / color / mirror / Atom feed
* Possible bug?
@ 2015-07-10  9:46 Anatoly Chernyshev
  2015-07-10 10:06 ` J-P. Rosen
  0 siblings, 1 reply; 4+ messages in thread
From: Anatoly Chernyshev @ 2015-07-10  9:46 UTC (permalink / raw)


Hello everyone,

Here is a tiny program compiled in GNAT 2015, under Win 7:

procedure fail_arr is
n_d,n_f: constant integer:=10;
type tss is array (1..n_d,1..n_f) of float;
tser:tss:=(others=>(0.0,0.0));
begin
for i in tser'range(1) loop
for j in tser'range(2) loop
tser(i,j):=0.0;
end loop;
end loop;
end fail_arr;

From my understanding, in the declaration of tser, its first two columns must be populated with 0.0, and the rest is to be left uninitialized. But under no circumstances shall the array to have dimensions (n_d, 2). But that's exactly what happens in the program.

The compiler even gives me nice soft warning about this:

4:11 warning: too few elements for type "tss" defined at line 3
4:11 warning: "Constraint_Error" will be raised at run time

Even though it should abort the compilation with an error message. No?

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

end of thread, other threads:[~2015-07-11  0:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-10  9:46 Possible bug? Anatoly Chernyshev
2015-07-10 10:06 ` J-P. Rosen
2015-07-10 22:33   ` Randy Brukardt
2015-07-11  0:29     ` Anatoly Chernyshev

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