Clyde Meli wrote:
I'm compiling a PASCAL program under Solaris with gpc version 19991030 based on gcc 2.95.2.
gpc --automake sgamain.pas generate.pas: In function `Prescale': generate.pas:33: Internal compiler error in `emit_library_call_value', at gcc-2. 95.2/gcc/calls.c:3198 Please submit a full bug report. See URL:http://www.gnu.org/software/gcc/faq.html#bugreport for instructions. gpc1: gpc exited with status 1 report.pas:9: module/unit `generate' could not be compiled
The code which caused the problem looks like:
Procedure Prescale(umax,uavg,umin:real;VAR a,b:real); { Calculate scaling coefficients for linear scaling } CONST fmultiple = 2.0; { fitness multiple is 2 } VAR delta:real; { divisor } Begin if umin > (fmultiple * uavg - umax) / (fmultiple - 1.0) { Non-Negative Test }
then Begin { Normal Scaling } Delta:=umax-uavg; a:=(fmultiple - 1.0) * uavg / delta; b:=uavg * (umax - real(2) {fmultiple} * uavg) / delta; End else
I fixed the problem termporarily by commenting out (fmultiple - 1.0) as it is equal to 1.0 currently, and by replacing fmultiple in the other assignment (b:=uavg*(umax- etc.) by real(2) instead. It seems writing the constant there triggered a problem with the compiler.
Indeed, this was a GPC bug that has been fixed meanwhile. According to the `Fixed Bugs' section in the To-Do list http://agnes.dida.physik.uni-essen.de/~gnu-pascal/todo.html:
20000503: Sparc: division by reals (fjf237.pas, matt1.pas) or `Round (real_constant)' (chaput1.pas) make the compiler crash <199911040915.KAA11168@@humulus.daimi.au.dk>
Unfortunately, there's been no GPC release since 2000-05-03, so please either wait for the next release, or use the type-casting workaround in the first assignment as well (this should work, I think -- can't verify it, since my development compiler doesn't have this bug anymore):
a:= (Real (fmultiple) - 1.0) * uavg / delta;
Frank