Yesterday I posted:-
-----Original Message----- From: gpc-owner@gnu.de [mailto:gpc-owner@gnu.de]On Behalf Of Martin G C Davies Sent: 07 August 2002 19:20 To: gpc@gnu.de Subject: GPC 2.1 (GCC 2.95.2) optimization.
Hi,
What is the status as far as using optimization is concerned? Is it supposed to be usable? If so I have a problem...
I reported that problem on Solaris but I now have an even simpler source that shows a problem on Win2000 (I was trying to check if my problems are with Solaris or gpc in general). The source is:-
module opt;
type mylupage = record datadisp : packed 0..31 end ; mylopage = ^mylupage;
function lichkp1( mypage : mylopage ) : integer ; begin if ( mypage^.datadisp < 21 ) or ( mypage^.datadisp > 25 ) then lichkp1 := 100 else lichkp1 := 200 ; end ;
end.
and gpc -v shows
Reading specs from c:/dev_gpc/lib/gcc-lib/mingw32/2.95.3-6/specs gpc version 2.1 (20020510), based on 2.95.3-6 (mingw special)
and when I compile with
gpc -O opt4.pas -S
the contents of opt4.s is:-
.file "opt4.pas" gcc2_compiled.: ___gnu_compiled_pascal: .text .align 4 .def _Lichkp1; .scl 3; .type 32; .ende _Lichkp1: pushl %ebp movl %esp,%ebp movl $100,%eax leave ret .data _ctor_run_condition_0.4: .byte 1 .def __p_atexit; .scl 2; .type 32; .ende .text .align 4 .globl _init_Opt .def _init_Opt; .scl 2; .type 32; .ende _init_Opt: pushl %ebp movl %esp,%ebp subl $8,%esp cmpb $0,_ctor_run_condition_0.4 je L6 movb $0,_ctor_run_condition_0.4 addl $-12,%esp pushl $_fini_Opt call __p_atexit L6: leave ret .align 4 .def _fini_Opt; .scl 3; .type 32; .ende _fini_Opt: pushl %ebp movl %esp,%ebp leave ret
So, as you can see, lichp1 will return 100 whatever the input. Should I just give up with trying to use optimization?
Cheers, Martin G C Davies