View Issue Details

IDProjectCategoryView StatusLast Update
0009591FPCCompilerpublic2019-07-18 21:13
ReporterProf. Harley FlandersAssigned To 
Status acknowledgedResolutionopen 
Product Version2.0.4Product Build 
Target VersionFixed in Version 
Summary0009591: Cannot redefine LongInt
DescriptionAs I understand pascal, and identifier can be redefined.

The following code fails to compile with Lazarus. It compiles with Delphi.
Please note error messages, included as comments.

unit Unit1;

{$mode objfpc}{$H+}


  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs;

  TForm1 = class(TForm)
    { private declarations }
    { public declarations }

  LongInt = array of Integer;

  Form1: TForm1;

function Equal(const A, B: LongInt): Boolean; overload;
function Equal(const A: LongInt; const N: Integer): Boolean; overload;


function Equal(const A, B: LongInt): Boolean; overload;

  var K: Integer;
  Result := (Length(A) = Length(B));
  if not Result then Exit;
  for K := 0 to Length(A) - 1 do
    Result := (A[K] = B[K]);
    if not Result then Break;

function Equal(const A: LongInt; const N: Integer): Boolean; overload;

  Result := (Length(A) = 1) and (A[0] = N);
(* Compiler Error Mesasages
Unit1.pas(18,13) Hint: Type "LongInt" redefinition
Unit1.pas(40,3) Error: Asm: Duplicate label UNIT1_EQUAL$LONGINT$LONGINT$$BOOLEAN
Unit1.pas(52,1) Fatal: There were 1 errors compiling module, stopping


{$I Unit1.lrs}

TagsNo tags attached.
Fixed in Revision
Attached Files


Marco van de Voort

2007-09-03 23:07

manager   ~0014477

Seems that delphi has unitnames in mangled names to avoid this. (.bpl's)

Peter Vreman

2007-09-04 08:02

administrator   ~0014486

FPC also has unit names in the the manglednames, but not for the types. The only clean solution i see is to generate manglednames where the parameters are replaced with a CRC value. But that makes the generated assembler code much harder to read.

IMHO this is a corner case searching for the limits and can be left unfixed as a known issue.

Marco van de Voort

2007-09-04 09:20

manager   ~0014489

Yes, I meant in typenames, with @'s inbetween. (and another @number at the end, but that is probably DLL related)

While I agree it is an corner case (since it took 10 years to be found), what is the exact problem of qualifying types with unit names? symbol length limits in older LD's?

Jonas Maebe

2007-09-04 09:37

manager   ~0014491

FPC itself has a built-in symbol length limit of 255 chars (it uses a pshortstring for that), that's why it falls back to CRC's when mangled names get too long. I don't know of any LD symbol length limit.

Issue History

Date Modified Username Field Change
2007-09-03 19:33 Prof. Harley Flanders New Issue
2007-09-03 19:33 Prof. Harley Flanders Widgetset => Win32
2007-09-03 20:44 Vincent Snijders Project Lazarus => FPC
2007-09-03 23:04 Jonas Maebe FPCOldBugId => 0
2007-09-03 23:04 Jonas Maebe FPCTarget => -
2007-09-03 23:04 Jonas Maebe Category IDE => Compiler
2007-09-03 23:04 Jonas Maebe Product Version 0.9.22 => 2.0.4
2007-09-03 23:07 Marco van de Voort Note Added: 0014477
2007-09-04 08:02 Peter Vreman Note Added: 0014486
2007-09-04 08:03 Peter Vreman Priority normal => low
2007-09-04 08:03 Peter Vreman Severity minor => feature
2007-09-04 08:03 Peter Vreman Status new => acknowledged
2007-09-04 09:20 Marco van de Voort Note Added: 0014489
2007-09-04 09:37 Jonas Maebe Note Added: 0014491