Forum > General
Bug: cannot compile on Linux - when local types has same name
ydd:
simple code example:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit Unit1; interface type TCompileTest1 = class type T = (t1); const S1: array[T] of String = ('t1'); end; TCompileTest2 = class type T = (t2); const S2: array[T] of String = ('t2'); end; implementation end.
Compile log:
--- Quote ---Compile Project, Target: project1: Exit code 1, Errors: 2, Hints: 2
Hint: Start of reading config file /home/yd/Lazarus/trunk_210430/fpc/bin/x86_64-linux/fpc.cfg
Hint: End of reading config file /home/yd/Lazarus/trunk_210430/fpc/bin/x86_64-linux/fpc.cfg
Verbose: Free Pascal Compiler version 3.3.1-r49298 [2021/04/30] for x86_64
Verbose: Copyright (c) 1993-2021 by Florian Klaempfl and others
Verbose: Target OS: Linux for x86-64
Verbose: Compiling project1.lpr
Verbose: Compiling unit1.pas
Error: Asm: Duplicate label DBG_$UNIT1_$$_T
Error: Asm: Duplicate label DBGREF_$UNIT1_$$_T
Verbose: There were 2 errors compiling module, stopping
Verbose: Compilation aborted
Verbose: /home/yd/Lazarus/trunk_210430/fpc/bin/x86_64-linux/ppcx64 returned an error exitcode
--- End quote ---
on Windows I can compile without errors
Bart:
You must have different versions of the compiler on Windows vs Linux then.
Bart
howardpc:
It may be a bug on Windows to allow two distinct types to have the same name. I think at least {$mode objfpc} disallows this.
But your unit has no mode specified, so presumably it takes the default mode.
Nor is it clear whether the compiler should generate shortstrings or some other string type.
ydd:
--- Quote from: Bart on April 30, 2021, 06:03:20 pm ---You must have different versions of the compiler on Windows vs Linux then
--- End quote ---
I use latest trunk on both
ydd:
--- Quote from: howardpc on April 30, 2021, 06:12:49 pm ---It may be a bug on Windows to allow two distinct types to have the same name. I think at least {$mode objfpc} disallows this.
But your unit has no mode specified, so presumably it takes the default mode.
--- End quote ---
it is valid Pascal code, and it works everywhere else - Delphi, FPC for Windows & MacOS. {$mode objfpc} - does not matter.
Problem that in generated by compiler ASM code there are duplicate lines:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---.globl DBG_$UNIT1_$$_T
Navigation
[0] Message Index
[#] Next page