View Issue Details

IDProjectCategoryView StatusLast Update
0034996FPCDocumentationpublic2019-02-16 10:51
ReporterJ. Gareth MoretonAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformx86_64-win64OSMicrosoft WindowsOS Version10 Professional
Product Version3.0.4Product Buildx86_64-win64 
Target Version3.2.0Fixed in Version3.3.1 
Summary0034996: Declaring a public constant as the same name as an internal symbol causes silent error
DescriptionSorry for the long-winded name, but if you declare a constant with public visibility (either via using the "public" keyword or by declaring it in the "interface" section of a unit) and its name clashes with an internal symbol, the linker returns a silent error under Lazarus. All you see is "Fatal: Compilation aborted".

Now of course, this set-up is very contrived, especially as internal symbols start with "fpc_", but I needed to redeclare FPC_ABSMASK_DOUBLE as part of a test program, since I am unable to access internal functions and constants directly (feature request?).
Steps To ReproduceAttempt to compile the attached source file and observe the error, or attempt to reproduce with another internally-defined constant or procedure (e.g. fpc_int_real).
Additional InformationUnder Lazarus, there is no indication as to what the error is, which might confuse end users. When compiled from the command prompt, the error is clearer.

Free Pascal Compiler version 3.0.4 [2017/12/03] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Win64 for x64
Compiling clash.pp
Linking clash.exe
clash.pp(8,1) Error: Multiple defined symbol FPC_ABSMASK_DOUBLE
clash.pp(8,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: C:\lazarus64\fpc\3.0.4\bin\x86_64-win64\ppcx64.exe returned an error exitcode


The error disappears if the "public" modifier is removed.
Tagscompiler, linker
Fixed in Revision1558
FPCOldBugId0
FPCTarget
Attached Files
  • Clash.pp (156 bytes)
    program Clash;
    
    const
      fpc_int_real: array[0..1] of qword=($7fffffffffffffff,$7fffffffffffffff); public;
    
    begin
      WriteLn(fpc_int_real[0]);
    end.
    
    
    Clash.pp (156 bytes)

Relationships

related to 0033813 resolvedMattias Gaertner Lazarus Do not filter linker messages about missing libraries by default ? 

Activities

J. Gareth Moreton

2019-02-03 03:46

developer  

Clash.pp (156 bytes)
program Clash;

const
  fpc_int_real: array[0..1] of qword=($7fffffffffffffff,$7fffffffffffffff); public;

begin
  WriteLn(fpc_int_real[0]);
end.

Clash.pp (156 bytes)

J. Gareth Moreton

2019-02-03 03:47

developer   ~0113812

I would like to suggest that either the compiler catch the clash with the internal symbol at the compiler stage, or make the linker error messages visible under Lazarus.

Jonas Maebe

2019-02-03 13:40

manager   ~0113819

There is an open Lazarus issue about filtering linker messages: 0033813

The programmer's manual should mention that symbol names starting with FPC_ or fpc_ are reserved for use the by the compiler and RTL.

Jonas Maebe

2019-02-03 22:31

manager   ~0113841

Last edited: 2019-02-03 22:32

View 2 revisions

@Mattias: I think you wanted to resolve the related bug, not this one.

Michael Van Canneyt

2019-02-16 10:51

administrator   ~0114173

Adapted programmer (mangled names) and reference manual (public directive).

Issue History

Date Modified Username Field Change
2019-02-03 03:46 J. Gareth Moreton New Issue
2019-02-03 03:46 J. Gareth Moreton File Added: Clash.pp
2019-02-03 03:47 J. Gareth Moreton Note Added: 0113812
2019-02-03 03:47 J. Gareth Moreton Description Updated View Revisions
2019-02-03 03:48 J. Gareth Moreton Summary Declaring a public constant as the same name as an internal constant causes silent error => Declaring a public constant as the same name as an internal symbol causes silent error
2019-02-03 03:48 J. Gareth Moreton Description Updated View Revisions
2019-02-03 05:44 J. Gareth Moreton Tag Attached: compiler
2019-02-03 05:44 J. Gareth Moreton Tag Attached: linker
2019-02-03 13:39 Jonas Maebe Assigned To => Michael Van Canneyt
2019-02-03 13:39 Jonas Maebe Status new => assigned
2019-02-03 13:40 Jonas Maebe Note Added: 0113819
2019-02-03 13:41 Jonas Maebe Category Compiler => Documentation
2019-02-03 15:23 Mattias Gaertner Relationship added related to 0033813
2019-02-03 22:25 Mattias Gaertner Fixed in Revision => lazarus trunk 60320.
2019-02-03 22:25 Mattias Gaertner Status assigned => resolved
2019-02-03 22:25 Mattias Gaertner Resolution open => fixed
2019-02-03 22:25 Mattias Gaertner Assigned To Michael Van Canneyt => Mattias Gaertner
2019-02-03 22:31 Jonas Maebe Note Added: 0113841
2019-02-03 22:31 Jonas Maebe Assigned To Mattias Gaertner => Michael Van Canneyt
2019-02-03 22:31 Jonas Maebe Status resolved => assigned
2019-02-03 22:31 Jonas Maebe Resolution fixed => open
2019-02-03 22:32 Jonas Maebe Note Edited: 0113841 View Revisions
2019-02-16 10:51 Michael Van Canneyt Fixed in Revision lazarus trunk 60320. => 1558
2019-02-16 10:51 Michael Van Canneyt Note Added: 0114173
2019-02-16 10:51 Michael Van Canneyt Status assigned => resolved
2019-02-16 10:51 Michael Van Canneyt Fixed in Version => 3.3.1
2019-02-16 10:51 Michael Van Canneyt Resolution open => fixed
2019-02-16 10:51 Michael Van Canneyt Target Version 3.3.1 => 3.2.0