Apologies for the limited code detail earlier. It appears the offending bit is the use of a constant array index. Here is a short program which reproduces the bug:
PROGRAM arr_test(input,output); TYPE arrtype = ARRAY [-10..10] OF double; VAR test : arrtype;
PROCEDURE init(VAR arr: arrtype); VAR i : integer; BEGIN FOR i:= -10 TO 10 DO arr[i]:= i*2.0; i:= 0; arr[i]:= 1.0; { This is OK, using i for the index } arr[0]:= 1.0; { This causes an arithmetical error at compile time } END;
BEGIN init(test); END.
-----Original Message----- From: Waldek Hebisch [mailto:hebisch@math.uni.wroc.pl] Sent: 19 February 2005 04:50 To: Wood David Subject: Re: Compile prob. with gpc20050217
I'm getting a new compile time error (error: arithmetical overflow )
with
this previously ok bit of code:
FOR I := -Clutter_max_width TO Clutter_max_width DO Spectral_purity[I] := Spec_purity_level / (1 + (SQR(I) /
Width_sqrd));
Spectral_purity[0] := 1;
All the variables and arrays use type double, except i which is an
integer.
The error is reported at the last code line, but I guess it may stem
from
the previous line.
I don't understand why gpc should report an arithmetic overflow error at compile-time. This is normally a run-time error!
That is too little detail to reproduce the problem. gpc computes many constant expressions at compile-time and signals error in case of overflow. So in particular values of your constants are crucial. In general you should make sure that you give a _complete_ program which reproduces the problem.
-- Waldek Hebisch hebisch@math.uni.wroc.pl
The Information contained in this E-Mail and any subsequent correspondence is private and is intended solely for the intended recipient(s). For those other than the recipient any disclosure, copying, distribution, or any action taken or omitted to be taken in reliance on such information is prohibited and may be unlawful.
Emails and other electronic communication with QinetiQ may be monitored. Calls to QinetiQ may be recorded for quality control, regulatory and monitoring purposes.