Recent

Author Topic: Panic (1002) Target OS: Linux for x86 ppcx64 can't be executed  (Read 608 times)

quantumfoam

  • New Member
  • *
  • Posts: 23
Panic (1002) Target OS: Linux for x86 ppcx64 can't be executed
« on: November 26, 2022, 12:20:28 am »
I'm reporting what looks like compiler bug.

Code: Pascal  [Select][+][-]
  1. program Project1;
  2.  
  3. type
  4.   PA_Node = ^TA_Node;
  5.   TA_Node = array[0..3] of PA_Node;
  6.  
  7.   var n1,n2:PA_Node;
  8. begin
  9.   n2 := nil;
  10.   n1[3] := n2; // Panic (1002) Target OS: Linux for x86 ppcx64 can't be executed; error code -139
  11. //   n1^[3] := n2; // this of course works, I would just expect less panic for just forgotten caret
  12. end.
  13.  
  14.  

EDIT:
@MarkMLl
OS: Linux Mint 21 Cinnamon, 64 bit, Linux Kernel: 5.15.0-53-generic
PC: AMD Athlon 200GE with Radeon Vega Graphic x 2, 8GB RAM
Lazarus: ver. 2.2.4 Date: 2022-01-03 FPC version 3.2.2 x86_64-linux-gtk2
Installers: fpc-laz_3.2.2-210709_amd64.deb, fpc-src_3.2.2-210709_amd64.deb, lazarus-project_2.2.4-0_amd64.deb

@Thaddy
It does not compile. This is just simplified example. In my real code it was way harder to find.
« Last Edit: November 26, 2022, 10:54:03 am by quantumfoam »

ccrause

  • Hero Member
  • *****
  • Posts: 688
Re: Panic (1002) Target OS: Linux for x86 ppcx64 can't be executed
« Reply #1 on: November 26, 2022, 05:34:35 am »
Indeed, seems like the compiler falls into an endless loop between compared_defs_ext and equal_defs trying to find a suitable type conversion for your example.  This ends in a SIGSEGV, due to the eventual stack overflow.

MarkMLl

  • Hero Member
  • *****
  • Posts: 5864
Re: Panic (1002) Target OS: Linux for x86 ppcx64 can't be executed
« Reply #2 on: November 26, 2022, 08:36:03 am »
I'm reporting what looks like compiler bug.

In which case you need to say what version of the compiler you're running, and precisely what your execution environment is.

I would suggest editing your original message to include that so that all the important info is in one place. Please do not rely on putting it in your signature, since as soon as you change your sig all the context information in older postings will be lost.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Thaddy

  • Hero Member
  • *****
  • Posts: 12623
Re: Panic (1002) Target OS: Linux for x86 ppcx64 can't be executed
« Reply #3 on: November 26, 2022, 09:54:14 am »
As far as I can see that code should always result in runerror 216 in all modes and all supported targets.
That is not a compiler error, but programmer error.
I have to test it, though, but I am quite sure.
I expect the code to compile, but raise an error at runtime. Today no compiler at hand until afternoon.
« Last Edit: November 26, 2022, 10:00:45 am by Thaddy »
The only thing I can say about Putin - born st Petersburg- is that he is indeed Russian, as opposed to Stalin, who was Georgian. Depending of historical time frame they could both be Lithuanian or Polish...even German. Shut him up!

MarkMLl

  • Hero Member
  • *****
  • Posts: 5864
Re: Panic (1002) Target OS: Linux for x86 ppcx64 can't be executed
« Reply #4 on: November 26, 2022, 12:10:18 pm »
Is n1[3] := n2 valid though? n1 is a classical pointer rather than (a pointer to) an (instance of) a class or some maintained type where I'd expect a missing dereference to be tolerated.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Thaddy

  • Hero Member
  • *****
  • Posts: 12623
Re: Panic (1002) Target OS: Linux for x86 ppcx64 can't be executed
« Reply #5 on: November 26, 2022, 12:12:32 pm »
Is n1[3] := n2 valid though? n1 is a classical pointer rather than (a pointer to) an (instance of) a class or some maintained type where I'd expect a missing dereference to be tolerated.

MarkMLl
It also depends on mode.
The only thing I can say about Putin - born st Petersburg- is that he is indeed Russian, as opposed to Stalin, who was Georgian. Depending of historical time frame they could both be Lithuanian or Polish...even German. Shut him up!

Thaddy

  • Hero Member
  • *****
  • Posts: 12623
Re: Panic (1002) Target OS: Linux for x86 ppcx64 can't be executed
« Reply #6 on: November 26, 2022, 03:56:56 pm »
Now have been able to test it for mode fpc, objpas and delphi: as I suspected, well, expected, runerror 216, access violation. Linux and Windows. That code is plain wrong. It will always fail (well, almost always if for some reason you have luck).
@MarkMLI in Mode Delphi, automatic deferencering is always on, so both forms should work (and do compile). But BOTH forms of the code crash as I expected....
Note I can not reproduce a kernel panic or crash, just the access violation. (all user mode)
(And at OP: the code does compile, you will just get a runtime error 216 as I predicted. My brain compiler from this morning is error prone, but not in this case and after testing with the real Freepascal compilers)
« Last Edit: November 26, 2022, 04:49:54 pm by Thaddy »
The only thing I can say about Putin - born st Petersburg- is that he is indeed Russian, as opposed to Stalin, who was Georgian. Depending of historical time frame they could both be Lithuanian or Polish...even German. Shut him up!

MarkMLl

  • Hero Member
  • *****
  • Posts: 5864
Re: Panic (1002) Target OS: Linux for x86 ppcx64 can't be executed
« Reply #7 on: November 26, 2022, 05:40:26 pm »
@MarkMLI in Mode Delphi, automatic deferencering is always on, so both forms should work (and do compile). But BOTH forms of the code crash as I expected....

In the general case, I'd not expect automatic dereferencing to apply to an ordinary array type i.e. with a declared number of parameters. If FPC does that... well, I'd much rather not get into yet another fight about whether it departs unduly from the spirit of Pascal as a simple strongly-typed language :-/

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 10492
  • FPC developer.
Re: Panic (1002) Target OS: Linux for x86 ppcx64 can't be executed
« Reply #8 on: November 26, 2022, 05:54:37 pm »
quantumfoam:

A compiler crash (GPF/runtime error, internal error) is always a bug, no matter how nonsensical the code is. Please report it with the reproducing piece of code in the bugtracker (which you already have).

If the example is extremely contrived (and IMHO this is not it), it just might take longer to resolve as it will not be high on the priority lists. But it is still a bug.

Thaddy

  • Hero Member
  • *****
  • Posts: 12623
Re: Panic (1002) Target OS: Linux for x86 ppcx64 can't be executed
« Reply #9 on: November 26, 2022, 06:06:22 pm »
Marco, it is not a compiler crash.
The only thing I can say about Putin - born st Petersburg- is that he is indeed Russian, as opposed to Stalin, who was Georgian. Depending of historical time frame they could both be Lithuanian or Polish...even German. Shut him up!

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 10492
  • FPC developer.
Re: Panic (1002) Target OS: Linux for x86 ppcx64 can't be executed
« Reply #10 on: November 26, 2022, 10:07:35 pm »
Marco, it is not a compiler crash.

Quote
marcov@minerva:~$ ppcx64 test
Hint: End of reading config file /home/marcov/.fpc.cfg
Target OS: Linux for x86-64
Compiling test.pp
test.pp(10,3) Warning: Variable "n1" does not seem to be initialized
Segmentation fault

So what do you call a segmentation fault then? An "oopsie"?

 

TinyPortal © 2005-2018