Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2007-06

Understanding optimization switches

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Stefan Berinde

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: ¦? ?

Reply by email

Yury Sidorov
to Stefan Berinde

From: "Stefan Berinde"

Show quoted text 35 lines
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.

Reply by email