computes unexpected result
Original Reporter info from Mantis: helbig
-
Reporter name: Wolfgang Helbig
Original Reporter info from Mantis: helbig
- Reporter name: Wolfgang Helbig
Description:
Compile and run the program below and wonder why.
$ cat overflow.p
{$MODE ISO}
{$Q+}
program ov(output);
begin
writeln('maxint+1: ', maxint+1);
writeln('(maxint+1)*(maxint+1): ', (maxint+1)*(maxint+1));
end.
$ fpc overflow.p
$ overflow
maxint+1: 2147483648
(maxint+1)*(maxint+1): 46116860184
Obviously, the integer range is overflowed, which is not reported by the run time system. According to section 8.2.1 of the Pascal User Manual and Report, the runtime system must report this arithmetic error.
Mantis conversion info:
- Mantis ID: 37816
- OS: mac os x
- OS Build: 10.11
- Platform: imac
- Version: 3.2.0
- Monitored by: » helbig (Wolfgang Helbig), » Vincent (Vincent Snijders)