trange4.pp 379 B

123456789101112131415161718192021222324
  1. var x : byte;
  2. y : longint;
  3. procedure set_x;
  4. begin
  5. y:=345;
  6. {$R-}
  7. x:=y;
  8. {$R+}
  9. Writeln('x = ',x);
  10. {$R-}
  11. x:=y
  12. {$R+}
  13. end;
  14. { the bug comes from the fact that as there is no
  15. semicolon after x:=y the parser must read up to end; statement
  16. and thus change the range check mode before
  17. the assign node is created !! }
  18. begin
  19. set_x;
  20. Writeln('x = ',x);
  21. end.