Sign in Join

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

Mailing lists / fpc-pascal / 2002-02

Strange Compiler Bug

7 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Mattias Gaertner

Hi all,

I found a compiler bug, which I don't know how to report to the bug list. I can't give a simple example, so I will describe it. If I clean up and do a complete compile the compiler gives the following:

codetools]$ rm -f *.{o,ppu}; ppc386 allcodetoolunits.pp Free Pascal Compiler version 1.0.5 [2002/02/25] for i386 Copyright (c) 1993-2002 by Florian Klaempfl
Target OS: Linux for i386
Compiling allcodetoolunits.pp
Compiling memcheck.pas
Assembling memcheck
Compiling codetoolmanager.pas
Compiling codecompletiontool.pas
Compiling codetree.pas
Compiling basiccodetools.pas
Compiling sourcelog.pas
Assembling sourcelog
Compiling keywordfunclists.pas
Assembling keywordfunclists
Assembling basiccodetools
Compiling avl_tree.pas
Assembling avl_tree
Compiling codetoolmemmanager.pas
Assembling codetoolmemmanager
Assembling codetree
Compiling codeatom.pas
Compiling codecache.pas
Compiling linkscanner.pas
Compiling expreval.pas
Assembling expreval
Assembling linkscanner
Compiling fileprocs.pas
Assembling fileprocs
Assembling codecache
Assembling codeatom
Compiling pascalparsertool.pas
Compiling customcodetool.pas
Compiling sourcechanger.pas
Assembling sourcechanger
Assembling customcodetool
Assembling pascalparsertool
Compiling eventcodetool.pas
Compiling methodjumptool.pas
Compiling stdcodetools.pas
Compiling finddeclarationtool.pas
Compiling definetemplates.pas
Assembling definetemplates
Compiling finddeclarationcache.pas
Assembling finddeclarationcache
Assembling finddeclarationtool
Assembling stdcodetools
Assembling methodjumptool
Assembling eventcodetool
codecompletiontool.pas(881,29) Error: Method (variable) and Procedure (variable) are not compatible codecompletiontool.pas(881,29) Error: Method (variable) and Procedure (variable) are not compatible codecompletiontool.pas(1297) Fatal: There were 2 errors compiling module, stopping

But the the line is absolutely correct. Because if I repeat the compile, I get:

codetools]$ ppc386 allcodetoolunits.pp
Free Pascal Compiler version 1.0.5 [2002/02/25] for i386 Copyright (c) 1993-2002 by Florian Klaempfl
Target OS: Linux for i386
Compiling allcodetoolunits.pp
Compiling codetoolmanager.pas
Compiling codecompletiontool.pas
Assembling codecompletiontool
Assembling codetoolmanager
2923 Lines compiled, 0.8 sec

I tried the -vb option, but the compiler does not show anything.

The line (881) is the following:

;

where ClassProcs.OnCompare is

    property OnCompare: TListSortCompare read FOnCompare write SetOnCompare;

and CompareCodeTreeNodeExtWithPos is

function CompareCodeTreeNodeExtWithPos(NodeData1, NodeData2: pointer): integer;

I have committed the code to lazarus cvs, since everything seems to be correct, but the strange compiler bug.

The same bug also appears in uniteditor.pp (in the lazarus main dir) five times.

Any help is greatly appreciated.

Mattias Gaertner

Pierre Muller
to Mattias Gaertner

At 14:08 28/02/2002 , vous avez écrit:

Show quoted text 58 lines
Hi all, I found a compiler bug, which I don't know how to report to the bug list. I can't give a simple example, so I will describe it. If I clean up and do a complete compile the compiler gives the following: codetools]$ rm -f *.{o,ppu}; ppc386 allcodetoolunits.pp Free Pascal Compiler version 1.0.5 [2002/02/25] for i386 Copyright (c) 1993-2002 by Florian Klaempfl Target OS: Linux for i386 Compiling allcodetoolunits.pp Compiling memcheck.pas Assembling memcheck Compiling codetoolmanager.pas Compiling codecompletiontool.pas Compiling codetree.pas Compiling basiccodetools.pas Compiling sourcelog.pas Assembling sourcelog Compiling keywordfunclists.pas Assembling keywordfunclists Assembling basiccodetools Compiling avl_tree.pas Assembling avl_tree Compiling codetoolmemmanager.pas Assembling codetoolmemmanager Assembling codetree Compiling codeatom.pas Compiling codecache.pas Compiling linkscanner.pas Compiling expreval.pas Assembling expreval Assembling linkscanner Compiling fileprocs.pas Assembling fileprocs Assembling codecache Assembling codeatom Compiling pascalparsertool.pas Compiling customcodetool.pas Compiling sourcechanger.pas Assembling sourcechanger Assembling customcodetool Assembling pascalparsertool Compiling eventcodetool.pas Compiling methodjumptool.pas Compiling stdcodetools.pas Compiling finddeclarationtool.pas Compiling definetemplates.pas Assembling definetemplates Compiling finddeclarationcache.pas Assembling finddeclarationcache Assembling finddeclarationtool Assembling stdcodetools Assembling methodjumptool Assembling eventcodetool codecompletiontool.pas(881,29) Error: Method (variable) and Procedure (variable) are not compatible codecompletiontool.pas(881,29) Error: Method (variable) and Procedure (variable) are not compatible codecompletiontool.pas(1297) Fatal: There were 2 errors compiling module, stopping

This might be due to a problem with
the compilation mode :
do some of your units have {$mode xxx}
set ?

I am not sure that this modes are saved and resotred correctly when the program switches from one unit to another ... Even though I thought that I fixed that bug not long ago.... Maybe I forgot to commit the fix....

Mattias Gaertner
to Pierre Muller
Show quoted text 8 lines
>codecompletiontool.pas(881,29) Error: Method (variable) and Procedure (variable) are not compatible >codecompletiontool.pas(881,29) Error: Method (variable) and Procedure (variable) are not compatible >codecompletiontool.pas(1297) Fatal: There were 2 errors compiling module, stopping This might be due to a problem with the compilation mode : do some of your units have {$mode xxx} set ?

Yep, every single one has {$mode objfpc}.

I am not sure that this modes are saved and resotred correctly when the program switches from one unit to another ... Even though I thought that I fixed that bug not long ago.... Maybe I forgot to commit the fix....

fix, fix, ...

Mattias

Pierre Muller
to Mattias Gaertner

At 14:40 28/02/2002 , vous avez écrit:

Show quoted text 13 lines
On Thu, 28 Feb 2002 14:25:03 +0100 Pierre Muller wrote: > >codecompletiontool.pas(881,29) Error: Method (variable) and Procedure (variable) are not compatible > >codecompletiontool.pas(881,29) Error: Method (variable) and Procedure (variable) are not compatible > >codecompletiontool.pas(1297) Fatal: There were 2 errors compiling module, stopping > > This might be due to a problem with > the compilation mode : > do some of your units have {$mode xxx} > set ? Yep, every single one has {$mode objfpc}.

I didn't read the message correctly....

You have a conflict between a method and a function....

Are there several CompareCodeTreeNodeExtWithPos in your program? Maybe one function in some other unit
that is found before the method ??

Mattias Gaertner
to Pierre Muller
Show quoted text 21 lines
At 14:40 28/02/2002 , vous avez écrit: >On Thu, 28 Feb 2002 14:25:03 +0100 >Pierre Muller wrote: > > > >codecompletiontool.pas(881,29) Error: Method (variable) and Procedure (variable) are not compatible > > >codecompletiontool.pas(881,29) Error: Method (variable) and Procedure (variable) are not compatible > > >codecompletiontool.pas(1297) Fatal: There were 2 errors compiling module, stopping > > > > This might be due to a problem with > > the compilation mode : > > do some of your units have {$mode xxx} > > set ? > >Yep, every single one has {$mode objfpc}. I didn't read the message correctly.... You have a conflict between a method and a function.... Are there several CompareCodeTreeNodeExtWithPos in your program? Maybe one function in some other unit that is found before the method ??

Don't think so. I'm using quite long names to prevent such things. There is also another function CompareCodeTreeNodeExt with exactly the same declaration just in front of CompareCodeTreeNodeExtWithPos. But that would not explain this error.

Mattias

Pierre Muller
to Mattias Gaertner: I found a compiler bug, which I don't know how to report to the bug list. I can't give a…
you wrote 10 lines
Hi all, I found a compiler bug, which I don't know how to report to the bug list. I can't give a simple example, so I will describe it. If I clean up and do a complete compile the compiler gives the following: codetools]$ rm -f *.{o,ppu}; ppc386 allcodetoolunits.pp Free Pascal Compiler version 1.0.5 [2002/02/25] for i386 Assembling eventcodetool codecompletiontool.pas(881,29) Error: Method (variable) and Procedure

(variable) are not compatible

codecompletiontool.pas(881,29) Error: Method (variable) and Procedure

(variable) are not compatible

codecompletiontool.pas(1297) Fatal: There were 2 errors compiling module,

stopping

But the the line is absolutely correct. Because if I repeat the compile, I

get:

Show quoted text 26 lines
codetools]$ ppc386 allcodetoolunits.pp Free Pascal Compiler version 1.0.5 [2002/02/25] for i386 Copyright (c) 1993-2002 by Florian Klaempfl Target OS: Linux for i386 Compiling allcodetoolunits.pp Compiling codetoolmanager.pas Compiling codecompletiontool.pas Assembling codecompletiontool Assembling codetoolmanager 2923 Lines compiled, 0.8 sec I tried the -vb option, but the compiler does not show anything. The line (881) is the following: ; where ClassProcs.OnCompare is property OnCompare: TListSortCompare read FOnCompare write SetOnCompare; and CompareCodeTreeNodeExtWithPos is function CompareCodeTreeNodeExtWithPos(NodeData1, NodeData2: pointer):
integer;
I have committed the code to lazarus cvs, since everything seems to be

correct, but the strange compiler bug.

The same bug also appears in uniteditor.pp (in the lazarus main dir) five

times.

I found a bug in the compiler
and fixed it (normally the fix should be in 1.0.6)

Mattias Gaertner
to Pierre Muller
I found a bug in the compiler and fixed it (normally the fix should be in 1.0.6)

Where can I find it?
Is there a special cvs tag?

Mattias Gaertner