Generics + const + sizeof = Invalid Expression, (((sometimes))) lazarus / 64-FPC development ---------------------------------------------------------------------- Plutonium Zepellin · 2025-09-29 16:54 Hi. I've found a bug in fpc related to SizeOf in generic record const expressions (fpc version is stable; 3.2.2 - obtained by following the link from freepascal.org website a month or so ago). Reported it here: https://gitlab.com/freepascal.org/fpc/source/-/issues/41419 Issue status is marked as "Confidential" - should I may be do something else in addition to that? I've tried searching the issue list before posting, my case seems to be unique. May be retest it using the development version of the compiler? Thanks, ... ---------------------------------------------------------------------- bytebites · 2025-09-29 17:24 Confidential? Are you kidding? ---------------------------------------------------------------------- Martin_fr · 2025-09-29 17:42 I don't think it needs to be confidential. Even if you found that while working under NDA or at work, the code sample does not seem to contain any real word info. But you can check that with whomever you believe to owe liability. As for the report, the code works in 3.3.1. But it does not in my copy of 3.2.3 (about 2 month old). So it likely also isn't (yet?) fixed in the upcoming 3.2.4. (I have not tested the RC). ---------------------------------------------------------------------- PascalDragon · 2025-09-29 18:46 Quote from: Plutonium Zepellin on September 29, 2025, 06:54:34 pmIssue status is marked as "Confidential" - should I may be do something else in addition to that? I've disabled the confidentiality. There isn't really anything in that report that would warrant that. Quote from: Plutonium Zepellin on September 29, 2025, 06:54:34 pmMay be retest it using the development version of the compiler? That is usually the best. ---------------------------------------------------------------------- Plutonium Zepellin · 2025-10-01 15:53 Quote from: bytebites on September 29, 2025, 07:24:53 pmConfidential? Are you kidding? Well, apparently that's the default tag for the issues and I could not do anything about that, sadly. Also, I've found Internal Error 2007-something-something while compiling code with generic (generics, again) pairs. Although it's just compiler dying after (rightly) emitting the warning/error list. QuoteThat is usually the best. Ok. I'll probably have to look for the way of switching between compilers if I'll want the dev version or run into something I won't be able to circumwent somehow. Thanks, ... ---------------------------------------------------------------------- Thaddy · 2025-10-02 10:15 QuoteAlso, I've found Internal Error 2007-something-something while compiling code with generic (generics, again) pairs.@Plutonium Zepellin Can you specify "2007 something" as the full internal error so we can report it? You should always report internal errors (with replicable code): internal error numbers are inserted by the compiler developers so they can trace code paths that are not supposed to happen inside the compiler and therefor it is very important to report them so they can be fixed. It is kind of a last resort to debug the compiler itself. They are also rare to surface. It should look like this, but probably a bit different: 2007010210, so like 2007 (although I picked a real internal error example, so by chance it could be yours, it is traditionally a date in yyyymmdd notation + sequence number, I believe) You did not report it in your bug report - fixed in trunk -, but here you refer to it. You can grep the compiler sources to find where it happens. Also note that if it is related to your bug report about 3.2.2 it won't be fixed in 3.2.2, it is fixed in trunk and maybe back-ported to 3.2.4  but I can only tell if we know the exact internal error. ---------------------------------------------------------------------- Plutonium Zepellin · 2025-10-03 16:22 @Thaddy QuoteCan you specify "2007 something" as the full internal error so we can report it? Ah, it was another generics-related error. I have the code sample saved, although I did not scoop the bug tracker for the lookalikes yet. I can probably prepare another bug report, but it'll again be for the fpc stable (3.2.2) from the debian amd64 perspective. Alternatively, I can compile development version of the compiler myself, but it'll take some time. PS. Also, I've found some possible vandalism in the "Pascal Programming Language" wikibook. (Upside-down text & code, see the screenshot is in the attachments). Where do I report THAT? ---------------------------------------------------------------------- Thaddy · 2025-10-03 16:44 It is the same text as the last paragraph, just remove it if you have enough credits to edit the wiki. I can do that for you - if it is in our own wiki, can't find it - if you want? I suspect an accident, maybe a joke,  and no malicious intend. And I still see no full internal error? ---------------------------------------------------------------------- Plutonium Zepellin · 2025-10-03 18:18 @Thaddy No, it's fullscale vandalism - just checkout the print version here: https://en.wikibooks.org/wiki/Pascal_Programming/Print_Version As for Internal Error 20XX - I need to get to my PC for that. It'll happen, eventually  As far as I can remember it now it happens when I try to overload assignment/multiplication operators inside generic pair record types. Something like that: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$modeswitch advancedrecords} type generic TPair = record  a: TFirst;  b: TSecond;   { := overload for: TScalar := TPair   (sum)  }  { := overload for: TPair   := TScalar (fill) }   { *  overload for: TPair   *  TPair   (returning) TPair   // element-wise product    }  { *  overload for: TPair   *  TScalar (returning) TPair   // upscaling / downscaling }   { Adding the overload below triggers internal error after emitting the warning & error logs }  { Basically, compiler tells me what's wrong and then internal errorly dies                  }   { *  overload for: TPair   *  TPair   (returning) TScalar // dot product }end; TScalar1 = double;TPair2   = specialize TPair ;TPair3   = specialize TPair ;TPair5   = specialize TPair ;TPair6   = specialize TPair ; { ... }   That's as best as I can remember it for now. Got to go; I'll post the full details when I'll get closer to the codebase on my PC. Then again, it's probably already been fixed in the development version. Thanks, ... ---------------------------------------------------------------------- Thaddy · 2025-10-05 09:03 From what I can see, provided you use the TPair from generics.collections, you won't get internal errors:Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$ifdef fpc}{$mode objfpc}{$endif}uses   generics.collections; // for TPair type  TScalar1 = double;  TPair2   = specialize TPair ;  TPair3   = specialize TPair ;  TPair5   = specialize TPair ;  TPair6   = specialize TPair ; begin  writeln('TPair4 is missing..');end. ---------------------------------------------------------------------- Plutonium Zepellin · 2025-10-05 15:27 @Thaddy, I was not asking how to get this code working; What I was asking was: "Whether I should report this as an another bug in the compiler, because it generates an Internal Error during compilation" and "Whether I should retest this using the most recent (development/unstable) version of the compiler". As far as my current internal judgement goes the first question is still standing, the second one is resolved somewhat. That and the question where I should report wikisource book vandalism. Thanks, ... ---------------------------------------------------------------------- PascalDragon · 2025-10-06 12:30 Quote from: Plutonium Zepellin on October 01, 2025, 05:53:10 pmQuote from: bytebites on September 29, 2025, 07:24:53 pmConfidential? Are you kidding? Well, apparently that's the default tag for the issues and I could not do anything about that, sadly. It's not default. Quote from: Plutonium Zepellin on October 05, 2025, 05:27:33 pmWhat I was asking was: "Whether I should report this as an another bug in the compiler, because it generates an Internal Error during compilation" and "Whether I should retest this using the most recent (development/unstable) version of the compiler". If you're able to test with a development version: - if you can verify the issue with the development version then you should report it - if you can't verify the issue with the development version then you should not report it If you're not able to test with a development version: - just report it, someone else will probably test with a development version then Always include the used compiler version, source and target CPU and OS and the used option together with a self contained example, please, so that we don't have to guess. ---------------------------------------------------------------------- Plutonium Zepellin · 2025-10-10 16:40 @PascalDragon I was not able to find anything in the gitlab UI to remove the "Confidential" tag that was automatically added when I've created the issue. Probably an access control thing or me being silly, or aliens. As for testing using the dev version: https://packages.debian.org/sear ch?suite=sid&searchon=names&keywords=fpc says that even in unstable fpc is still version 3.2.2. That means that in the absence of fresh *.debs I'll probably have to compile it myself. Owie. It's doable, but I'll probably have to concoct a chroot + build environment for that, etc etc. Also, in addition to the error mentioned in the Thread Starting Post I've already stubled upon 2 different "Internal Errors" and an "Illegal Expression" problem with default multi-dimensional array properties (and, yes, generics are involved in ALL of them) - all in stable, obviously. They are probably not that critical (syntax sugar/syntax preference/exploratory programming mostly), although the last one is annoying. So, I've elected to report them at my leasure, for now at least. Then again, if you want to speed things up just send me a PM/leave a message here in the thread. Thanks, ... ---------------------------------------------------------------------- PascalDragon · 2025-10-11 16:39 Quote from: Plutonium Zepellin on October 10, 2025, 06:40:22 pm@PascalDragon I was not able to find anything in the gitlab UI to remove the "Confidential" tag that was automatically added when I've created the issue. Probably an access control thing or me being silly, or aliens. I don't know if a normal user can remove the flag afterwards, but when you start a new issue it isn't the default. Quote from: Plutonium Zepellin on October 10, 2025, 06:40:22 pmAs for testing using the dev version: https://packages.debian.org/search?suit e=sid&searchon=names&keywords=fpc says that even in unstable fpc is still version 3.2.2. That means that in the absence of fresh *.debs I'll probably have to compile it myself. Owie. It's doable, but I'll probably have to concoct a chroot + build environment for that, etc etc. There are no debs for the development version. You need to build/install manually. Quote from: Plutonium Zepellin on October 10, 2025, 06:40:22 pmAlso, in addition to the error mentioned in the Thread Starting Post I've already stubled upon 2 different "Internal Errors" and an "Illegal Expression" problem with default multi-dimensional array properties (and, yes, generics are involved in ALL of them) - all in stable, obviously. They are probably not that critical (syntax sugar/syntax preference/exploratory programming mostly), although the last one is annoying. Even if they are not critical for you, it would be good to know them nevertheless. As said, you can also report them for the release version and someone else will hopefully find the time to verify whether the bug still exists. ---------------------------------------------------------------------- Plutonium Zepellin · 2025-10-12 16:55 QuoteI don't know if a normal user can remove the flag afterwards, but when you start a new issue it isn't the default It is, or at least it was, in my case. As I said - probably the matter of access control or something like that. QuoteThere are no debs for the development version. You need to build/install manually Well, I was mostly interested in build automation scripts; seems like they are also all for 3.2.2. It's probably just a matter of updating a version number and url though, probably. QuoteEven if they are not critical for you, it would be good to know them nevertheless. As said, you can also report them for the release version and someone else will hopefully find the time to verify whether the bug still exists I think I may have to update to dev/trunk anyway, since it may have better support for generics. Thanks, ...