Sign in Join

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

Mailing lists / fpc-devel / 2003-04

maybe a bug in the compiler (at least under BeOS)

8 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

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

Olivier Coursière

Hi all,

I think i have found a bug in fpc. With the joined souce code, i have this strange output.

The first time, i have this output :

$ fpc -S2 -g -gl test.pp
/boot/home/config/bin/ppc386;-S2 -g -gl test.pp
Free Pascal Compiler version 1.0.7 [2003/03/29] for i386 Copyright (c) 1993-2003 by Florian Klaempfl
Target OS: BeOS for i386
Compiling test.pp
Compiling menu.pp
menu.pp(25,17) Warning: An inherited method is hidden by TMENU.CREATE Assembling menu
Compiling menubar.pp
Assembling menubar
Assembling test
Linking test
128 Lines compiled, 0.0 sec
$ test
Bonjour
TMenuBar.Create
function TMenu.AddItem(menu : TMenu) : boolean;

Now, i start a second compile (i keep *.o and *.ppu files)

$ fpc -S2 -g -gl test.pp
/boot/home/config/bin/ppc386;-S2 -g -gl test.pp
Free Pascal Compiler version 1.0.7 [2003/03/29] for i386 Copyright (c) 1993-2003 by Florian Klaempfl
Target OS: BeOS for i386
Compiling test.pp
Assembling test
Linking test
32 Lines compiled, 0.0 sec
$ test
Bonjour
TMenuBar.Create
function TMenu.AddItem(menu : TMenu; frame : TRect) : boolean;

There is several AddItem functions in TMenu, but with different parameters. The first time, the right function is called, but in the second case, the last AddItem function is called.

When AddItem functions are not virtual, the right function is always called.

I used the BeOS version of fpc.

Reply by email

Yakov Sudeikin
to Olivier Coursière

Hi there

1)

I updated the RTL via cvs. But When I tried to build it my gnu make stoped on the lines like this:

<<<<<<< Makefile
=======

What does that mean? My GNu Make is too old and do not understand these directives? Or I have to run the Makefile thru some kind of utility first?

2)

What is: fpc_help_constructor() ?

Program received signal SIGBUS, Bus error.
0x80a06ab in fpc_help_constructor ()

Thanks,
Yakov

Reply by email

Yakov Sudeikin
to Olivier Coursière: I think i have found a bug in fpc. With the joined souce code, i have this strange output.

Let me explain my lame attempt to find and fix a bug in fpc11.

pp myproject -vu

Fatal: Internal error 200212142:618

(Unit to crash the compiler: mysqldb.pas)

cd fpc/cvs
grep 200212142 -R *

compiler/ncal.pas matches

function tcallnode.det_resulttype:tnode;
<SKIP>
              { add needed default parameters }
              if assigned(procdefinition) and
                 (paralength<procdefinition.maxparacount) then
               begin
                 currpara:=tparaitem(procdefinition.Para.first);
                 for i:=1 to paralength do
                   currpara:=tparaitem(currpara.next);
                 while assigned(currpara) do
                  begin
                    if not assigned(currpara.defaultvalue) then
line 1816 --->>   internalerror(200212142);
left:=ccallparanode.create(genconstsymtree(tconstsym(currpara.defaultvalue))
,left);
                    currpara:=tparaitem(currpara.next);
                  end;
               end;
           end;

=============================================

Okay now to my unit, I have strted removing lines until got a very minimalistic view that crashes the compiler.

{$mode delphi}
function  xx(a: array of string; b: byte = 1): string;
begin
end;
begin
  xx(['']);
end.

Okay what we do now? 2372 lines of code in ncal.pas... How long it will take for me to understand it :) Without ability to debug in it delphi I will have to use gdb and this will take even longer. Can anyone explain how to fix this, I mean not just fix but explain how just as an example. Btw I believe I reported this bug before.

Thanks,
Yakov

Reply by email

Jonas Maebe
to Yakov Sudeikin: Hi there 1) I updated the RTL via cvs. But When I tried to build it my gnu make stoped on…
Yakov Sudeikin wrote 12 lines
1) I updated the RTL via cvs. But When I tried to build it my gnu make stoped on the lines like this: <<<<<<< Makefile ======= What does that mean? My GNu Make is too old and do not understand these directives? Or I have to run the Makefile thru some kind of utility first?

It means that you modified your Makefile and that when updating, a conflict occurred. Simply delete the Makefile and update again.

2) What is: fpc_help_constructor() ?

It is an internal routine that is called whenever a TP-style object constructor is called. It allocates memory for a new object (if necessary), initializes it (vmt pointer) and returns the self pointer.

Program received signal SIGBUS, Bus error. 0x80a06ab in fpc_help_constructor ()

Recently, some things were changed regarding the object handling in 1.1, which indeed causes some problems. It also affects the IDE.

Jonas

Reply by email

Marco van de Voort
to Yakov Sudeikin: Let me explain my lame attempt to find and fix a bug in fpc11. pp myproject -vu Fatal:…
Show quoted text 18 lines
============================================= Okay now to my unit, I have strted removing lines until got a very minimalistic view that crashes the compiler. {$mode delphi} function xx(a: array of string; b: byte = 1): string; begin end; begin xx(['']); end. Okay what we do now? 2372 lines of code in ncal.pas... How long it will take for me to understand it :) Without ability to debug in it delphi I will have to use gdb and this will take even longer. Can anyone explain how to fix this, I mean not just fix but explain how just as an example. Btw I believe I reported this bug before.

This part of the compiler is currently intensively being worked on. (not visible hidden parameters with the new generic registerallocator).

Reply by email

Peter Vreman
to Yakov Sudeikin: Let me explain my lame attempt to find and fix a bug in fpc11. pp myproject -vu Fatal:…
Okay what we do now? 2372 lines of code in ncal.pas... How long it will take for me to understand it :) Without ability to debug in it delphi I will have

I wouldn't even recommend to start understanding the compiler in ncal.pas as it is one of the more complex parts of the compiler.

to use gdb and this will take even longer. Can anyone explain how to fix this, I mean not just fix but explain how just as an example. Btw I believe I reported this bug before.

The easiest way to debug the compiler is to use the IDE from 1.0.x. That way you can debug like you could do with bp7.

Then when debugging place a breakpoint at the offencing internalerror() call and run the program, when it hits the breakpoint you can investigate the variables and analyze what is wrong. When that is not enough the place a breakpoint earlier in the program flow and make the breakpoint conditional with the condition 'aktfilepos.line=<line where compilation aborts>'. Then you can step through the compiler to see what actually happends.

Peter

Reply by email

Yakov Sudeikin
to Peter Vreman

So that means I can compile FPC only with 1.0 branch compiler. This makes sense thank you. What is the recomended or maybe an "official" build of 1.0.x for this task? Do I stick with old good 1.0.4 or 1.0.7 is a better way to go?

At the moment I compiled fpc with fpc of the same version (the todays snapshot with yesteerdays snapshot) and it worked well :) Maybe I can find a binary for IDE 1.1 somewhere? I tried to find it on the ftp -- I do not remember the details but I know I failed.

Thank you,
Yakov

Earlier message 38 lines
----- Original Message ----- From: "Peter Vreman" To: Sent: Saturday, April 12, 2003 19 56 Subject: Re: [fpc-devel]Okay, another one > > >Okay what we do now? 2372 lines of code in ncal.pas... How long it will take > >for me to understand it :) Without ability to debug in it delphi I will have > > I wouldn't even recommend to start understanding the compiler in ncal.pas > as it is one of the more complex parts of the compiler. > > >to use gdb and this will take even longer. Can anyone explain how to fix > >this, I mean not just fix but explain how just as an example. Btw I believe > >I reported this bug before. > > The easiest way to debug the compiler is to use the IDE from 1.0.x. That > way you can debug like you could do with bp7. > > Then when debugging place a breakpoint at the offencing internalerror() > call and run the program, when it hits the breakpoint you can investigate > the variables and analyze what is wrong. When that is not enough the place > a breakpoint earlier in the program flow and make the breakpoint > conditional with the condition 'aktfilepos.line=<line where compilation > aborts>'. Then you can step through the compiler to see what actually happends. > > > Peter > > _______________________________________________ > fpc-devel maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Peter Vreman
to Yakov Sudeikin
Show quoted text 5 lines
So that means I can compile FPC only with 1.0 branch compiler. This makes sense thank you. What is the recomended or maybe an "official" build of 1.0.x for this task? Do I stick with old good 1.0.4 or 1.0.7 is a better way to go?

No, you can also use 1.1 to build the compiler. I'm only recommending using 1.0.x to build the compiler the generated code is more stable and it is easier because the required (RTL) units for building the compiler are not influenced by the development you are doing on the 1.1 compiler or RTL. To get such a setup working for the commandline compiler can be done by editing fpc.cfg:

#ifdef VER1_0
-Fu~/fpc10/rtl/$target
-Fu~/fpc10/fcl/$target
#else
-Fu~/fpc/rtl/$target
-Fu~/fpc/fcl/$target
#endif

Show quoted text 5 lines
At the moment I compiled fpc with fpc of the same version (the todays snapshot with yesteerdays snapshot) and it worked well :) Maybe I can find a binary for IDE 1.1 somewhere? I tried to find it on the ftp -- I do not remember the details but I know I failed.

The IDE for 1.1 does not work at the moment.

Reply by email