Lazarus

Programming => General => Topic started by: zoltanleo on September 30, 2022, 10:43:26 am

Title: Сompilation floating error
Post by: zoltanleo on September 30, 2022, 10:43:26 am
Preamble: I hesitated to create this topic for a long time, but too often a mistake makes me do it.

So, for about 1 year now, I've been seeing a project build error that always points to the same module. She appears from time to time. When rebuilding an unmodified project, the error does not appear and the project starts without errors. As the project grows, the error shows up more often.

The error appears regardless of whether I first build the project (Shift + F9) or immediately run with debugging (F9).

I get this error on any platform I run the project on (Win x64/Debian 11 (gtk2/qt5)/Darwin (Monterey))

I ask the main maintainers to look at what is the likely cause of the bug. Not sure if I can reproduce this error in a test project. Therefore, I am ready to give the maintainers full access to the source code in a private repository.

I hope for your attention.

I use:
FPC revision: git_start-3099-g8c9a07a3e8
Lazarus revision: main-2_3-2276-g1c7122b6ca

Title: Re: Сompilation floating error
Post by: MarkMLl on September 30, 2022, 10:58:43 am
One question, one suggestion.

When you have the error, are a Run -> Compile and Run -> Build consistent? What happens if you do a File -> Clean Directory... first? There is an extremely elusive problem that some of us have seen but is similarly difficult to track down, possibly related to having pathnames in compiler options and/or uses clauses.

Please edit your message to put the compiler version etc. in the body, not in your signature. Having it in your sig is the worst possible place, since when you change your sig there will no longer be an indication in this thread of what version you're using which makes it worse than useless when Google or the forum's search facility brings somebody else here.

MarkMLl
Title: Re: Сompilation floating error
Post by: zoltanleo on September 30, 2022, 12:20:45 pm
Hi MarkMLl.

Thanks for the hints.  I will correct the first post and add new details a bit later. I am currently away from my PC
Title: Re: Сompilation floating error
Post by: Warfley on September 30, 2022, 01:48:25 pm
From my experience, when you are working a lot with generics, the "compilation raised exception internally" is something you encounter regularly as soon as the project grows large enough. But on the bright side you get used to. Often the "fix" is just to move a few things around in different units, make un-nest things, move functions from your class into class helpers, etc.
With a bit trial and error you can get around this
Title: Re: Сompilation floating error
Post by: zoltanleo on September 30, 2022, 09:27:15 pm
Please edit your message to put the compiler version etc.

Done
Title: Re: Сompilation floating error
Post by: zoltanleo on September 30, 2022, 09:30:46 pm
From my experience, when you are working a lot with generics, the "compilation raised exception internally" is something you encounter regularly as soon as the project grows large enough. But on the bright side you get used to.
Hi Warfley.

I do use generics quite often in my project. And I also had some hunches about generics. But I don't use generics in the exact unit where I get the error.
Title: Re: Сompilation floating error
Post by: Thaddy on September 30, 2022, 09:31:10 pm
1. provide compilable code
2. if that is not possible provide code that does not compile but you expect to compile.
3. No code, no answers.
Title: Re: Сompilation floating error
Post by: zoltanleo on September 30, 2022, 10:12:48 pm
Hi Thaddy

In the initial post, I wrote that the project is private and I would not like to post it to the public. I'm not sure if I can reproduce the issue on a test project. But I can link to it for just about anyone who wants to look at the code.

I sent you a link to the archive with the project in the PM
Title: Re: Сompilation floating error
Post by: Josh on September 30, 2022, 10:58:19 pm
could it be ptrint , using negative numbers,
https://www.freepascal.org/docs-html/rtl/system/ptrint.html
Title: Re: Сompilation floating error
Post by: zoltanleo on September 30, 2022, 11:59:25 pm
could it be ptrint , using negative numbers,
https://www.freepascal.org/docs-html/rtl/system/ptrint.html
Hi Josh

Thanks for the idea. I have made some corrections in the code. So far no errors have appeared. But I will be watching for some time.

Upd: I have to report that the errors are still repeated.  :'(
Title: Re: Сompilation floating error
Post by: zamtmn on October 01, 2022, 12:50:42 am
Build fpc with debug information and give the error stack. Also you need make a minimal example reproducing the bug
Title: Re: Сompilation floating error
Post by: Josh on October 01, 2022, 09:19:11 am
Is the error there when compiled with all optimization levels?
Any particular compiler options used, that could be causing the issue.
Title: Re: Сompilation floating error
Post by: zoltanleo on October 01, 2022, 09:53:42 am
Hi Josh.

I answered to PM
TinyPortal © 2005-2018