Forum > General

FPC v3.2.2 internal error

<< < (2/2)

440bx:

--- Quote from: bytebites on November 08, 2025, 02:31:02 pm ---What do you expect; You can't compare pointer to integer

--- End quote ---
those constants are _not_ typed, therefore the expression result should be a plain integer, for that reason, I expect the comparison to work.

IOW, there is no type associated with the constant identifier, therefore the constant should be an integer constant, not a pointer constant.



--- Quote from: PascalDragon on November 08, 2025, 06:14:07 pm ---Please report a bug.

--- End quote ---
Done.

Ticket: 41487
Link: https://gitlab.com/freepascal.org/fpc/source/-/issues/41487


ETA:

forgot to mention that even casting the resulting constant to longint still causes the compiler to emit an internal error.


typecasting to longint does work (eliminate the internal error.)

Martin_fr:

--- Quote from: 440bx on November 08, 2025, 07:51:39 pm ---IOW, there is no type associated with the constant identifier, therefore the constant should be an integer constant, not a pointer constant.
--- End quote ---

The "@" returns a pointer, so the value is typed.


--- Quote ---forgot to mention that even casting the resulting constant to longint still causes the compiler to emit an internal error.

--- End quote ---

With the following, I can compile it without error (fpc 3.2.3)

--- 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";}};} ---      RECORD_FIRSTFIELD_OFFSET  = ptruint(@PRECORD(nil)^.FirstField);      RECORD_SECONDFIELD_OFFSET = ptruint(@PRECORD(nil)^.SecondField); 

440bx:

--- Quote from: Martin_fr on November 08, 2025, 08:28:16 pm ---The "@" returns a pointer, so the value is typed.

--- End quote ---
That sounds reasonable but the type assigned to constants does not seem to be very consistent but, you're right, in that case it is a pointer.


--- Quote from: Martin_fr on November 08, 2025, 08:28:16 pm ---With the following, I can compile it without error (fpc 3.2.3)

--- 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";}};} ---      RECORD_FIRSTFIELD_OFFSET  = ptruint(@PRECORD(nil)^.FirstField);      RECORD_SECONDFIELD_OFFSET = ptruint(@PRECORD(nil)^.SecondField); 
--- End quote ---
Yes, that works.  It does compile without errors.  Thank you Martin, I can use that.

PascalDragon:

--- Quote from: 440bx on November 08, 2025, 07:51:39 pm ---
--- Quote from: PascalDragon on November 08, 2025, 06:14:07 pm ---Please report a bug.

--- End quote ---
Done.

Ticket: 41487
Link: https://gitlab.com/freepascal.org/fpc/source/-/issues/41487
--- End quote ---

Thanks. Seems that fpk solved that rather quickly 😅

Navigation

[0] Message Index

[*] Previous page

Go to full version