GNU Pascal Homepage - gpc - gpc-announce - gpc-de - gpc-doc
Diese Seite auf deutsch

Mail #9118

Back to main page of archive

Previous mail   Next mail   Unformatted/full headers
Overview  10 days   Subject   Date   Thread   Author  

From: Frank Heckenbach
Subject: range check test programs
Date: 30 Jul 2003, 04:28:35

Mirsad Todorovac wrote:

> Here is the point when I think I've done what I could. Let's go step by
> step with this list (I'm sorry if I'm repepating something that has been
> said already, but the list archive appears to be out :-(:

Perhaps a temporary server overload or something. They seem to be
working fine.

> > > > What's missing is a test where the formal discriminants are of a
> > > > subrange type and the actual discriminants (in `New' or a variable
> > > > declaration) are out of range.

This note was referring to `New' with schemata. I think that's still
missing.

> TEST    mir040a.pas:    gpc1: warnings being treated as errors
> ./mir040a.pas: In main program:
> ./mir040a.pas:34: warning: tag value must be a constant of ordinal type
> failed   (I think it could be the problem in GPC, since the code is precisely
>     the same, as with integer subrange bounds conformant arrays.)
>
> Am I allowed to suppress this specific warning, is it possible
> to do suppress it, or have I done something wrong?

Ah, no. The tag must be constant according to EP, so this actually
isn't a case for runtime range-checking, so we can forget about
variant records here. (Variant records are special in this regard --
I suppose that's to simplify work for compilers that allocate memory
based on the actual tag value.)

> > > > Initialization of types, variables and typed constants. (I.e.,
> > > > variables (or fields) or subrange type with an out-of-range
> > > > initializer; must be locally, otherwise GPC won't accept
> > > > non-constants initializers.)
> 
> Done. mir041[ceil][ul].pas

These are for variables. Please add a few (not all combinations) for
constants and type intializers.

> > > - `Pack', `Unpack' (the index parameter)
> 
> Done. mir03[56]*.pas

In fact, the ranges of the packed and unpacked array don't have to
be the same. (I think they could even be completely different types
such as integer vs. char etc., IIUC what EP says.) The index
parameter refers to the unpacked array (for both routines), and the
requirement is only that it can hold the number of elements the
packed array has, starting from that index. So there can be cases
where the array fits only partly etc.

> > > - 4th parameter of `BlockRead', `BlockWrite' (not obvious, but GPC
> > >   allows a subrange here which may be too small for the actual
> > >   result)
> 
> Done. mir039*.pas

I've changed the file name to `.dat' (the Makefile will remove those
files in the clean targets). I'm adding a note about this in the
test suite documentation.

> Q: What is the legal range for 3rd parm of Val?

It gives 0 for success and the position of the first invalid
character otherwise.

> > > - `and', `or', `xor', `shl', `shr' used as procedures, e.g., if a is
> > >   of type 1 .. 10: a := 5; or (a, 8) (whereas normal use as
> > >   operators will be covered by assignments or whatever is done with
> > >   them)
> 
> Done. mir03[0-3]*.pas

I've slightly modified some of them, so the 2nd parameter is still
in range, but the result is not.

I think I forgot to mention `not' (bitwise, procedure-like).

> > > - Conformant arrays (i.e., where the index type in the conformant
> > >   array in the formal parameter list is a subrange, and the actual
> > >   parameter's range is too big -- check both bounds)
> 
> Integer subrange Done. Problems with Char and enumerated subranges.
> I can confirm that it gives me this error:
> 
> TEST    mir038ea.pas:   ./mir038ea.pas: In main program:
> ./mir038ea.pas:29: invalid operands to binary `+'

This should be fixed in the next release.

There is, however, an error (and the next GPC will give a better
message). The formal array index is integer and the actual index is
enum.

Since I've made slight changes, please send me only new/updated
files next time.

> At my side they are of course all "failed". It would be reassuring
> if I get a confirmation that on range-checking compiler they
> all pass "OK".

I'll let you know if not when I'll have implemented range-checking.
(Otherwise you'll see for yourself, since the tests will then be in
the test suite, and a release will probably be done soon after.)

Frank

Previous mail   Next mail   Unformatted/full headers
Overview  10 days   Subject   Date   Thread   Author  


Replies

Author Subject Date
Peter N Lewis range check test programs 30 Jul 2003, 11:58:08
Mirsad Todorovac range check test programs 30 Jul 2003, 13:40:38
Frank Heckenbach range check test programs 30 Jul 2003, 16:29:27
Mirsad Todorovac range check test programs 30 Jul 2003, 18:00:21

In reply to

Author Subject Date
Mirsad Todorovac Range tests 29 Jul 2003, 14:07:40
Mirsad Todorovac range check test programs 29 Jul 2003, 19:38:50

Back to main page of archive


Note: This page contains information that does not originate from the owner of this web site, but from the authors of the mails archived. The owner of this web site is not responsible for the content of such information. Any use of that infomation requires the consent of the respective author.

Where WWW addresses (URLs) in the mails archived are marked as hyperlinks, this is only for the comfort of the reader. The content of the web pages linked to like this does not necessarily reflect the opinion of the owner of this web site or of the authors of the mails archived. The owner of this web site is not responsible for the content of such web pages. Those pages are explicitly not to be considered as part of the content of this page, but merely as references.


This page was created by Crystal 0.999 (Linux 2.4.27/i686).