Sign in Join

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

Mailing lists / fpc-devel / 2000-12

Corrected, but is still a bug in Compiler: Bug 1222 continued ...

13 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

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

Michael Knapp

compiled with snapshot ppc386 go32v2 ver 1.1 [2000/12/16] asm source and comments see below

CONST
    c1=$80000000;
    c2=$80000001;
    c3=$80000002;
    c4=$80000003;
    cm=$80000007;
VAR v:dword;
BEGIN
  v:=c2;
  CASE (v AND cm) OF
    c1,c2:writeln('case c1,c2');
    c3,c4:writeln('case c3,c4');
    ELSE writeln('case failed, but it should not');
  END;
END.

{
.file "bug1222.pas"

.text
.balign 16
# [bug1222.pas]
# [13] BEGIN
.globl _main
_main:
.globl PASCALMAIN
PASCALMAIN:
.globl program_init
program_init:
pushl %ebp
movl %esp,%ebp
subl $4,%esp
call FPC_INITIALIZEUNITS
# [14] v:=c2;
movl $-2147483647,_V
# [15] CASE (v AND cm) OF

  movl  _V,%eax               EAX := 80000001
  xorl  %edx,%edx             EDX := 00000000
  andl  .L13,%eax             EAX := 80000001  .L13   = 80000007
  andl  .L13+4,%edx           EDX := 00000000  .L13+4 = 00000000
  cmpl  $-1,%edx              00000000 - (-1) = +1   EDX is always 0 in

that case
jl .L12 jumps not
jg .L14 jumps to .L14
cmpl $-2147483648,%eax
jb .L12
.L14:
cmpl $-1,%edx 00000000 - (-1) = +1
jl .L3 jumps not
jg .L15 jumps to .L15
cmpl $-2147483647,%eax
jbe .L3
.L15:
cmpl $-1,%edx 00000000 - (-1) = +1
jl .L6 jumps not
jg .L16 jumps to .L16
cmpl $-2147483645,%eax
jbe .L6
.L16:
jmp .L12 jumps to .L12
.L6:
.L17:
# [17] c3,c4:writeln('case c3,c4');
leal U_SYSTEM_OUTPUT,%edi
movl %edi,-4(%ebp)
pushl $.L20
pushl -4(%ebp)
pushl $0
call FPC_WRITE_TEXT_SHORTSTR
pushl -4(%ebp)
call FPC_WRITELN_END
pushl $.L17
call FPC_IOCHECK
jmp .L11
.L3:
.L21:
# [16] c1,c2:writeln('case c1,c2');
leal U_SYSTEM_OUTPUT,%edi
movl %edi,-4(%ebp)
pushl $.L24
pushl -4(%ebp)
pushl $0
call FPC_WRITE_TEXT_SHORTSTR
pushl -4(%ebp)
call FPC_WRITELN_END
pushl $.L21
call FPC_IOCHECK
jmp .L11
.L12:
.L25:
# [18] ELSE writeln('case failed, but it should not'); leal U_SYSTEM_OUTPUT,%edi
movl %edi,-4(%ebp)
pushl $.L28
pushl -4(%ebp)
pushl $0
call FPC_WRITE_TEXT_SHORTSTR
pushl -4(%ebp)
call FPC_WRITELN_END
pushl $.L25
call FPC_IOCHECK
.L11:
# [20] END.
call FPC_DO_EXIT
leave
ret
.balign 16

.data
.ascii "FPC 1.1 [2000/12/16] for i386 - GO32V2"
.balign 4
.globl FPC_RESOURCESTRINGTABLES
FPC_RESOURCESTRINGTABLES:
.long 0
.globl INITFINAL
INITFINAL:
.long 1,0
.long INIT$$SYSTEM
.long 0
.globl HEAPSIZE
HEAPSIZE:
.long 2097152
.globl __stklen
__stklen:
.long 16384

.data
.L13:
.long -2147483641,0
.L20:
.ascii "\012case c3,c4\000"
.L24:
.ascii "\012case c1,c2\000"
.L28:
.ascii "\036case failed, but it should not\000"

.data

.bss
# [11] VAR v:dword;
.lcomm _V,4
.comm HEAP,2097152

}

+--------------------------------------------------------------------+ | Michael Knapp - Mauerbach - Niederösterreich - Austria - Europe | | E-Mail: ICQ: 36542787 | +--------------------------------------------------------------------+ | G r a p h i X http://programmierer.freepage.de/graphix/ | | Graphics Library for Freepascal, Virtual Pascal and Borland Pascal | | http://graphix4pascal.cjb.net/ http://www.graphix4pascal.de.vu/ | +--------------------------------------------------------------------+

Reply by email

Jonas Maebe
compiled with snapshot ppc386 go32v2 ver 1.1 [2000/12/16] asm source and comments see below

It already works correctly with today's snapshot because of some fixes I did recently.

Jonas

Reply by email

Jonas Maebe
Show quoted text 5 lines
>compiled with snapshot ppc386 go32v2 ver 1.1 [2000/12/16] >asm source and comments see below It already works correctly with today's snapshot because of some fixes I did recently.

And the expression isn't evaluated in 64bit anymore either...

Jonas

Reply by email

Peter Vreman
Show quoted text 6 lines
>compiled with snapshot ppc386 go32v2 ver 1.1 [2000/12/16] >asm source and comments see below It already works correctly with today's snapshot because of some fixes I did recently.

Did you implement the cardinal <-> longint thing i proposed?

Reply by email

Jonas Maebe
Show quoted text 7 lines
> >compiled with snapshot ppc386 go32v2 ver 1.1 [2000/12/16] > >asm source and comments see below > > It already works correctly with today's snapshot because of some fixes I > did recently. Did you implement the cardinal <-> longint thing i proposed?

No. That doesn't have anything to do with this bug either, because both the constant and the variable are a cardinal here... The problem was twofold I think (the problem that symbolic constants weren't kept in 32bits if they were a cardinal and that only recently I finally replaced all helper routines for case with functions that return int64 values instead of longints).

For the others: Peter suggested that automatic typeconversions be done for cardinal constants (ie. constants in the range int64($80000000) and int64($ffffffff)) to longint because otherwise you need longint typecasts when using such constants as longints (at least when you have range checking turned on, otherwise you still get annoying warnings).

A problem I see with this is that you would at least have to defferentiate between hex/binary and decimal constants, because otherwise the following would become legal (no range check error/warning)

{$r+}
const
  maxcardinal = 4294967295;
var
  l: longint;
begin
  l := maxcardinal;
end.

It is certainly possible to do such a detection, but I'm not so sure whether it's desirable...

Jonas

Reply by email

Michael Knapp
to Jonas Maebe: It already works correctly with today's snapshot because of some fixes I did recently.…
Jonas Maebe wrote 6 lines
>compiled with snapshot ppc386 go32v2 ver 1.1 [2000/12/16] >asm source and comments see below It already works correctly with today's snapshot because of some fixes I did recently.

Now this snapshot seems to work with GraphiX :-)

Michael

+--------------------------------------------------------------------+ | Michael Knapp - Mauerbach - Niederösterreich - Austria - Europe | | E-Mail: ICQ: 36542787 | +--------------------------------------------------------------------+ | G r a p h i X http://programmierer.freepage.de/graphix/ | | Graphics Library for Freepascal, Virtual Pascal and Borland Pascal | | http://graphix4pascal.cjb.net/ http://www.graphix4pascal.de.vu/ | +--------------------------------------------------------------------+

Reply by email

Jonas Maebe
to Michael Knapp
Michael Knapp wrote 7 lines
> >compiled with snapshot ppc386 go32v2 ver 1.1 [2000/12/16] > >asm source and comments see below > > It already works correctly with today's snapshot because of some fixes I > did recently. Now this snapshot seems to work with GraphiX :-)

Cool! :) It was about time...

Jonas

Reply by email

Pavel V. Ozerski
to Michael Knapp: Now this snapshot seems to work with GraphiX :-) Michael…

Hello,
At Dec 2000 I sent some patches to code which is located between {$IFDEF PAVEL_LINKLIB}...{$ENDIF}. These patches include also improved fpimdef (in fact an implib clone which is able to generate interface static libraries for Win32 DLLs). As I found, they were not used in last (1.4) release. Are they finally rejected or are using in FPC development?

Sincerely, Pavel

Pavel V. Ozerski | Inst. of Evolutionary Physiology & Biochemistry, office +7 (812)552-6870(291)| Russian Academy of Sciences, FAX +7 (812)552-3012 | Thorez pr. 44, St.Petersburg, 194223, Russia home +7 (812)528-5576 | E-mail: |

Reply by email

Peter Vreman
Hello, At Dec 2000 I sent some patches to code which is located between {$IFDEF

PAVEL_LINKLIB}...{$ENDIF}.

These patches include also improved fpimdef (in fact an implib clone which is able to

generate interface static libraries

for Win32 DLLs). As I found, they were not used in last (1.4) release. Are they finally

rejected or are using in FPC development?

Tonight i'll take a look at your code, but that will be only in the main branch as we don't introduce new features in the 1.0.x branch

Reply by email

Pierre Muller
to Pavel V. Ozerski: At Dec 2000 I sent some patches to code which is located between {$IFDEF…

At 16:16 11/01/01 , vous avez écrit:

Show quoted text 7 lines
Hello, At Dec 2000 I sent some patches to code which is located between {$IFDEF PAVEL_LINKLIB}...{$ENDIF}. These patches include also improved fpimdef (in fact an implib clone which is able to generate interface static libraries for Win32 DLLs). As I found, they were not used in last (1.4) release. Are they finally rejected or are using in FPC

This is again my fault, Pavel!

Sorry, but I didn't have time to integrate your changes into the CVS tree :( As usual running too many horses at the same time is the main reason why I didn't do it.

I can't really tell you when I will be able to handle them, as I don't have much time for Free Pascal lately...

With my sincere apologies...

Reply by email

Peter Vreman
At 16:16 11/01/01 , vous avez �crit: >Hello, >At Dec 2000 I sent some patches to code which is located between
{$IFDEF>
>PAVEL_LINKLIB}...{$ENDIF}. >These patches include also improved fpimdef (in fact an implib clone

whi> ch

>is able to generate interface static libraries >for Win32 DLLs). As I found, they were not used in last (1.4) release.

A> re

Show quoted text 5 lines
>they finally rejected or are using in FPC This is again my fault, Pavel! Sorry, but I didn't have time to integrate your changes into the CVS

t> ree :(

Show quoted text 5 lines
As usual running too many horses at the same time is the main reason why I didn't do it. I can't really tell you when I will be able to handle them, as I don't have much time for Free Pascal lately...

I've received the patches also and will place them in the main branch compiler this weekend.

Reply by email

Alejandro Nestor Vargas
to Peter Vreman
> I can't really tell you when I will be able to handle them, > as I don't have much time for Free Pascal lately... I've received the patches also and will place them in the main branch

compiler this

weekend.

What about my patches for the ttyname function at the linux unit?

Reply by email

Peter Vreman
Show quoted text 8 lines
> > I can't really tell you when I will be able to handle them, > > as I don't have much time for Free Pascal lately... > > I've received the patches also and will place them in the main branch compiler this > weekend. What about my patches for the ttyname function at the linux unit?

From the linux.pp Log of the main branch:
Revision 1.6 2000/12/28 20:42:12 peter
* ttyname fix from the mailinglist (merged)

I don't have the fixes branch here so i can't show that one also..

Reply by email