estiloinfo / clip-itk

4 stars 2 forks source link

po code too large at line XX #3

Open tavinus opened 1 month ago

tavinus commented 1 month ago

Hi again! It's been some time.

I have been testing this again, and I am getting the error "po code too large at line X" in a few of our programs. The error always points to the last line of the .prg file with the error (which does not help).

image

At first, I thought our code had functions that were too big, but now I am really not sure at all. Maybe that crazy big array in the .c code is too big? Really not sure.

I found the check for that error in the file clip/node.c. There are two places that it could be happening. Lines 703 or 719. Both checks are in the definitions of the function setshort, which depends on #ifdef FORCEALIGN. EDIT: I tried to use ./configure -a to enable FORCEALIGN, but it didn't run that block of code (I changed the yyerror messages to check which one was executing). Configure added the FORCEALIGN=4 entries to the Makefiles, but it didn't matter in runtime.

image

Do you have any idea on what could be happening or how I could debug this problem better? Are .po files generated automatically? Can I preserve them on compilation somehow? (to inspect them)

Seems like .po files are for localization, but we don't use that at all. I am running it on a server that is in Brazilian Portuguese with ISO-8859-1 encoding. Not sure if it is relevant, but the .prg files are also in ISO-8859-1.

I tried this on Debian 10 and 12. 32 and 64 bit. They all give me this error.

The programs have many .prg files, most quite big.

Any ideas would be welcome, I am a bit stuck on this.

EDIT: Another very weird thing is that the same code compiles and runs fine in an old 32-bit server running Amazon Linux 1 and Clip 1.1.16 vanilla.

tavinus commented 1 month ago

UPDATE

Seems like the problem is smaller in 32bit systems (both for the old v1.1.16 and your version). In 32 bit systems only one .prg file gives me problems. Weirdly enough, on 1.1.16 it fails on a first compile, but if you compile again (without make clean) it will compile without problems. On 1.2.9 that file always fails with the mentioned error.

But then in 64 bit systems I have 4 or more files giving that same error. I made a bunch of tests and was able to make one of the files compile just by commenting out a block of the code (making it smaller). I was able to make it compile by commenting different parts of the code, so I don't think it is the code itself, seems to be its size. It is a big block of code into a single function. I will try to split it into a few functions when I have the time. But again, not easy. That block is referencing and using several DBFs and variables (which will not be visible inside another function) and the comments in the code are a bit poor.

I will keep testing. Seems like I will need to optimize the code a bit, but that is not easy. The person that coded all of it passed away and he was coding it for 40 years.

Still, I really really would like to understand why I am getting this error.

PS: I wish there was a way to disable the localization functionality in clip. I was able to find the .pot files in /usr/local/clip/locale.pot/prg. But the failed file never gets saved there, so I could not inspect it. The val/lval values really are coming bigger than they should ( > 32767 || < -32767), but I am not sure how that is generated and why it is getting so high.

PS2: This is the .pot file that is failing in 1.2.9 and that compiled in 1.1.16. It is not big at all, but the indexes do increment a lot at the end.

$ cat /usr/local/clip/locale.pot/prg/migpedl.pot
#: migpedl.prg:46
msgid " CONSULTAS             "
msgstr ""

#: migpedl.prg:46
msgid " Mens:  Consulta veiculo/Periodo/Fatura          "
msgstr ""

#: migpedl.prg:47
msgid " CAPTURA  PEDAGIOS     "
msgstr ""

#: migpedl.prg:47
msgid " Mens:  Captura dados do arq .EXP do SemParar    "
msgstr ""

#: migpedl.prg:48
msgid " CAPTURA  CONCES/PRACA "
msgstr ""

#: migpedl.prg:48
msgid " Mens:  Captura dados de Pracas  do SemParar    "
msgstr ""

#: migpedl.prg:49
msgid "<EDITA    CONCES/PRACA>"
msgstr ""

#: migpedl.prg:49
msgid " Mens:  Edita Cadastro   Pracas  do SemParar    "
msgstr ""

#: migpedl.prg:116
msgid "Importacao Arqs Pracas e Concessionarias do SemParar"
msgstr ""

#: migpedl.prg:129
msgid "Nao possui arquivos"
msgstr ""

#: migpedl.prg:324
msgid "Importacao Arqs Passagens no SemParar"
msgstr ""

#: migpedl.prg:339
msgid "Importacao Arqs Passagens no SemParar"
msgstr ""

#: migpedl.prg:352
msgid "Nao possui arquivos"
msgstr ""

#: migpedl.prg:814
msgid "@R 99:99"
msgstr ""

#: migpedl.prg:814
msgid "@R 99:99"
msgstr ""
estiloinfo commented 1 month ago

Hello, I do not use .pot translation files in my systems, if you give me an example to test it I can try to debug it. You can try LANG=C clip -P prtfatvei.prg > prtfatvei.ppo and share part of the .ppo file if it is generated

tavinus commented 1 month ago

We also don't use it, the compiler generates it automatically. Is there a way to tell the compiler not to do it?

I was able to pre-process the file that is more problematic. It is a bit big to post here, I would also prefer not to open this one publicly. Do you have an email that I can send it to you?

estiloinfo commented 1 month ago

Hi, can send me to soporte@estilo.com.ar Regards