| 1 |
(* Copyright (C) 2009 Free Software Foundation, Inc. *) |
| 2 |
(* This file is part of GNU Modula-2. |
| 3 |
|
| 4 |
GNU Modula-2 is free software; you can redistribute it and/or modify it under |
| 5 |
the terms of the GNU General Public License as published by the Free |
| 6 |
Software Foundation; either version 2, or (at your option) any later |
| 7 |
version. |
| 8 |
|
| 9 |
GNU Modula-2 is distributed in the hope that it will be useful, but WITHOUT ANY |
| 10 |
WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 12 |
for more details. |
| 13 |
|
| 14 |
You should have received a copy of the GNU General Public License along |
| 15 |
with gm2; see the file COPYING. If not, write to the Free Software |
| 16 |
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *) |
| 17 |
|
| 18 |
MODULE forcheck ; |
| 19 |
|
| 20 |
FROM StrIO IMPORT WriteString, WriteLn ; |
| 21 |
FROM NumberIO IMPORT WriteCard ; |
| 22 |
|
| 23 |
|
| 24 |
PROCEDURE foo (init: CARDINAL); |
| 25 |
VAR |
| 26 |
j: CARDINAL; |
| 27 |
(* |
| 28 |
T21 : (* <!g> *) INTEGER ; |
| 29 |
T24 : (* <!g> *) INTEGER ; |
| 30 |
T25 : (* <!g> *) INTEGER ; |
| 31 |
T26 : (* <!g> *) INTEGER ; |
| 32 |
T27 : (* <!g> *) LONGINT ; |
| 33 |
*) |
| 34 |
BEGIN |
| 35 |
(* |
| 36 |
T21 := init - 1 ; |
| 37 |
j := T21 ; |
| 38 |
T24 := VAL ((* <!g> *) INTEGER, 1 - T21) ; |
| 39 |
T25 := -T24 ; |
| 40 |
T26 := -T25 ; |
| 41 |
T27 := VAL ((* <!g> *) LONGINT, T21 + T26) ; |
| 42 |
IF T27 < 0 |
| 43 |
THEN |
| 44 |
WriteString("ForLoopToException\n") ; WriteLn |
| 45 |
END ; |
| 46 |
IF T27 > 4294967295 |
| 47 |
THEN |
| 48 |
WriteString("ForLoopToException\n") ; WriteLn |
| 49 |
END ; |
| 50 |
*) |
| 51 |
FOR j:= init-1 TO 1 BY -1 DO |
| 52 |
WriteString('value of j ') ; WriteCard(j, 0) ; WriteLn |
| 53 |
END |
| 54 |
END foo ; |
| 55 |
|
| 56 |
|
| 57 |
BEGIN |
| 58 |
foo(3) |
| 59 |
END forcheck. |