[fpc-devel] Understanding optimization switches

Stefan Berinde sberinde at math.ubbcluj.ro
Tue Jun 12 22:55:16 CEST 2007


Hi,

Can somebody, please, explain me why the following program
does not run as expected when -OoSTACKFRAME switch is used?
(look at the output bellow)

Stefan



program test;

procedure Proc;
var s:shortstring;
begin
 s:='test';
 writeln('the string is: ',Copy(s,1,4));
end;

begin
 Proc;
end.
===================

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

D:\Research\Coding\bug>fpc.exe -OoSTACKFRAME test.pas
Free Pascal Compiler version 2.1.4 [2007/05/11] for i386
Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Win32 for i386
Compiling test.pas
Linking test.exe
12 lines compiled, 0.1 sec, 22848 bytes code, 1176 bytes data

D:\Research\Coding\bug>test.exe
the string is: ¦? ?





More information about the fpc-devel mailing list