limitation for many constants, very little known bug lazarus / 21-General ---------------------------------------------------------------------- juanirias · 2022-11-19 17:12 Hi, I'm interested in overriding what appears to be a constraint on fpc, many programming languages ​​can pass the test, but fpc fails! The source codes are in https://github.com/gmiller123456/vsop87- multilang/tree/master/Languages/Pascal The bug can reproduce when trying to generate the UNIT vsop87_full.pas The mistake is: fpc "vsop87_full.pas" (in directory: /home/ji/wip/vsop87_pascal) Free Pascal Compiler version 3.2.0+dfsg-12 [2021/01/25] for x86_64 Copyright (c) 1993-2020 by Florian Klaempfl and others Target OS: Linux for x86-64 Compiling vsop87_full.pas vsop87_full.pas(62225,1) Fatal: Internal error 2012101204 Fatal: Compilation aborted Error: /usr/bin/ppcx64 returned an error exitcode Compilation failed. ---------------------------------------------------------------------- marcov · 2022-11-19 17:17 Please retest with the most recent release version. Preferably also with Trunk/main ---------------------------------------------------------------------- Zvoni · 2022-11-19 18:04 Nevermind, the fpc-version is one of those blasted repo-versions from Ubuntu/Debian ---------------------------------------------------------------------- juanirias · 2022-11-19 19:40 Dear Zvoni The UNIT can compile; but have another errors: fpc "Test_Validate.pas" (in directory: C:\Users\jj198\OneDrive\Documentos\vsop87) Free Pascal Compiler version 3.2.2 [2021/05/15] for i386 Copyright (c) 1993-2021 by Florian Klaempfl and others Target OS: Win32 for i386 Compiling Test_Validate.pas Compiling vsop87a_full.pas Compiling vsop87b_full.pas Compiling vsop87c_full.pas Compiling vsop87d_full.pas Compiling vsop87e_full.pas Compiling vsop87a_full_velocities.pas Compiling vsop87b_full_velocities.pas Compiling vsop87c_full_velocities.pas Compiling vsop87d_full_velocities.pas Compiling vsop87e_full_velocities.pas Linking Test_Validate.exe Test_Validate.pas(1916,1) Error: Undefined symbol: _$VSOP87_FULL$_Ld65281 Test_Validate.pas(1916,1) Error: Undefined symbol: _$VSOP87C_FULL$_Ld65378 Test_Validate.pas(1916,1) Error: Undefined symbol: _$VSOP87C_FULL_VELOCITIES$_Ld65357 Test_Validate.pas(1916,1) Fatal: There were 3 errors compiling module, stopping Fatal: Compilation aborted Error: C:\FPC\3.2.2\bin\i386-Win32\ppc386.exe returned an error exitcode Compilation failed. regards, Juan ---------------------------------------------------------------------- AlexTP · 2022-11-19 19:46 Please don't check on such old version: version 3.2.2 [2021/05/15]. Use 'main' Git version. ---------------------------------------------------------------------- juanirias · 2022-11-19 19:51 One remark, please use the new Test_Validate.pas Is using FULL version.... Please see the files at: https://www.filemail.com/d/hgcrpqpyxspjoru ---------------------------------------------------------------------- marcov · 2022-11-19 20:27 If you have extremely long procedures, please adjust your generator and break them up. The register allocator is limited to a maximum amount of certain aspects (labels, virtual registers). This is on purpose, for performance of the average case, and because such large code fragments (github refuses them) are always generated, and thus this can be resolved in the generator of such codes. ---------------------------------------------------------------------- juanirias · 2022-11-19 20:39 Thanks again! Some advice for the split? Regards Juan ---------------------------------------------------------------------- jamie · 2022-11-19 21:07 Looks like you are at the linking stage. Maybe you can use an External debug file so that it won't try to make the EXE so large.  It's just a thought at the moment but Marcov is most likely correct. ---------------------------------------------------------------------- juanirias · 2022-11-19 22:11 Thanks! Any help is welcome, apparently the problem is vsop87c***.pas and the *_full* regards, Juan ---------------------------------------------------------------------- juanirias · 2022-11-19 23:28 Hi! The files (are relative big) https://ufile.io/f/jqhf7 regards, Juan ---------------------------------------------------------------------- jamie · 2022-11-20 00:07 I just looked at that code, all I can say is WOW.. I've never seen so much redundant code Can't you create tables and just loop per table instead of all that code? The error maybe missleading, I think there is just too much code and constants in that single unit..  As said before, make multiple units to houses each function. ---------------------------------------------------------------------- juanirias · 2022-11-20 00:13 Dear Sir How I can make a split? I don't have idea. Regards Juan ---------------------------------------------------------------------- jamie · 2022-11-20 00:53 to start with you can try creating sub functions of each EXP of each planet. Personally, I would of create a table of those numbers and then simply looped the table with a simple counter to do your sums  The tables you can keep outside the procedure, just give it a name that matches the proper procedure it will get used in. you would need to make an array of a record type that can hold each group of numbers.  Or if you have a file with all these numbers already you can read them in at startup and do the math! But I would try first the copy and paste method to break these down to sub functions you can call for each starting at each EXP.  Do you have a file of these numbers formatted to be able to read them at startup? ---------------------------------------------------------------------- juanirias · 2022-11-20 01:01 OK, I take the idea... Thanks again Jamie ---------------------------------------------------------------------- juanirias · 2022-11-20 04:43 I can get working Thanks to all! regards, Juan ---------------------------------------------------------------------- PascalDragon · 2022-11-20 22:22 Quote from: juanirias on November 19, 2022, 06:12:14 pmThe mistake is: fpc "vsop87_full.pas" (in directory: /home/ji/wip/vsop87_pascal) Free Pascal Compiler version 3.2.0+dfsg-12 [2021/01/25] for x86_64 Copyright (c) 1993-2020 by Florian Klaempfl and others Target OS: Linux for x86-64 Compiling vsop87_full.pas vsop87_full.pas(62225,1) Fatal: Internal error 2012101204 Fatal: Compilation aborted Error: /usr/bin/ppcx64 returned an error exitcode Compilation failed. This issue also occurs with 3.3.1. Please report it. As a workaround you can use the option -Aas which instructs FPC to use the external assembler which doesn't show this issue. (Note: this will only solve the issue on Linux) Quote from: juanirias on November 19, 2022, 08:40:34 pmThe UNIT can compile; but have another errors: fpc "Test_Validate.pas" (in directory: C:\Users\jj198\OneDrive\Documentos\vsop87) Free Pascal Compiler version 3.2.2 [2021/05/15] for i386 Copyright (c) 1993-2021 by Florian Klaempfl and others Target OS: Win32 for i386 Compiling Test_Validate.pas Compiling vsop87a_full.pas Compiling vsop87b_full.pas Compiling vsop87c_full.pas Compiling vsop87d_full.pas Compiling vsop87e_full.pas Compiling vsop87a_full_velocities.pas Compiling vsop87b_full_velocities.pas Compiling vsop87c_full_velocities.pas Compiling vsop87d_full_velocities.pas Compiling vsop87e_full_velocities.pas Linking Test_Validate.exe Test_Validate.pas(1916,1) Error: Undefined symbol: _$VSOP87_FULL$_Ld65281 Test_Validate.pas(1916,1) Error: Undefined symbol: _$VSOP87C_FULL$_Ld65378 Test_Validate.pas(1916,1) Error: Undefined symbol: _$VSOP87C_FULL_VELOCITIES$_Ld65357 Test_Validate.pas(1916,1) Fatal: There were 3 errors compiling module, stopping Fatal: Compilation aborted Error: C:\FPC\3.2.2\bin\i386-Win32\ppc386.exe returned an error exitcode Compilation failed. I can reproduce this with 3.3.1 on i386-win32 as well. Please report. And just for completeness sake: on x86_64-win64 it will fail with procedure too complex which is interesting considering that it compiles on x86_64-linux... So that would be good to report as well.