[fpc-devel] Understanding optimization switches

Yury Sidorov jura at cp-lab.com
Tue Jun 19 14:09:24 CEST 2007


From: "Stefan Berinde" <sberinde at math.ubbcluj.ro>
> 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: ¦? ?

Fixed in trunk in r7731. Will be merged to 2.2 branch.

Yury. 



More information about the fpc-devel mailing list