Recent

Author Topic: Fatal: Internal error 2012010601  (Read 4377 times)

joho

  • Jr. Member
  • **
  • Posts: 69
  • Joaquim Homrighausen
    • ~/JoHo
Fatal: Internal error 2012010601
« on: September 25, 2017, 11:34:57 pm »
What does "Fatal: Internal error 2012010601" mean?



marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11455
  • FPC developer.
Re: Fatal: Internal error 2012010601
« Reply #1 on: September 25, 2017, 11:42:32 pm »
Something heaptrc related (-gh)

Code: Pascal  [Select][+][-]
  1.          if (cs_use_heaptrc in current_settings.globalswitches) and
  2.             (cs_checkpointer in current_settings.localswitches) and
  3.             not(cs_compilesystem in current_settings.moduleswitches) and
  4.             tpointerdef(left.resultdef).compatible_with_pointerdef_size(tpointerdef(voidpointertype)) and
  5.             not(nf_no_checkpointer in flags) and
  6.             { can be NR_NO in case of LOC_CONSTANT }
  7.             (location.reference.base<>NR_NO) then
  8.           begin
  9.             if not searchsym_in_named_module('HEAPTRC','CHECKPOINTER',sym,st) or
  10.                (sym.typ<>procsym) then
  11.               internalerror(2012010601);
  12.             pd:=tprocdef(tprocsym(sym).ProcdefList[0]);
  13.             paraloc1.init;
  14.             paramanager.getintparaloc(current_asmdata.CurrAsmList,pd,1,paraloc1);
  15.             hlcg.a_loadaddr_ref_cgpara(current_asmdata.CurrAsmList,left.resultdef,location.reference,paraloc1);
  16.             paramanager.freecgpara(current_asmdata.CurrAsmList,paraloc1);
  17.             paraloc1.done;
  18.             hlcg.allocallcpuregisters(current_asmdata.CurrAsmList);
  19.             hlcg.a_call_name(current_asmdata.CurrAsmList,pd,'FPC_CHECKPOINTER',[@paraloc1],nil,false);
  20.             hlcg.deallocallcpuregisters(current_asmdata.CurrAsmList);
  21.             include(current_settings.moduleswitches,cs_checkpointer_called);
  22.           end;
  23.       end;
  24.  

So either checkpointer is not defined for the current architecture, or it is called on a symbol that is not a procedure?

joho

  • Jr. Member
  • **
  • Posts: 69
  • Joaquim Homrighausen
    • ~/JoHo
Re: Fatal: Internal error 2012010601
« Reply #2 on: September 26, 2017, 02:21:27 am »
Thanks!

Hmm ... I was getting it as some really weird places in the source, like:

function foo (parms) :boolean;
begin
  writeln ('Not implemented');
  abort;
end;

I'm wondering if that was actually the place it went tits up, or if the problem began much earlier (like pointer corruption or something). But just to be clear, I got this during compile time.

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Fatal: Internal error 2012010601
« Reply #3 on: September 26, 2017, 03:20:06 am »
LOL, do you have a unit named heaptrc?  ;-O
If yes, then please change its name. You confused the compiler. 

1st Edit:
To be precise, if you have {$CheckPointer on} and you use pointers and name one of your units heaptrc this will produce internal error 2012010601.

2nd Edit:
Sample project attached.
« Last Edit: September 26, 2017, 03:49:24 am by engkin »

joho

  • Jr. Member
  • **
  • Posts: 69
  • Joaquim Homrighausen
    • ~/JoHo
Re: Fatal: Internal error 2012010601
« Reply #4 on: September 26, 2017, 05:33:16 pm »
LOL, do you have a unit named heaptrc?  ;-O
If yes, then please change its name. You confused the compiler. 

1st Edit:
To be precise, if you have {$CheckPointer on} and you use pointers and name one of your units heaptrc this will produce internal error 2012010601.

2nd Edit:
Sample project attached.

Uhm, no I do not have such a unit :) And it's "sort of" strange that it would always "crash" on that precise place (IMHO).

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Fatal: Internal error 2012010601
« Reply #5 on: September 27, 2017, 02:40:51 am »
How about compiling with -va
Save the output messages to a file
Zip it and share it with us if possible.

joho

  • Jr. Member
  • **
  • Posts: 69
  • Joaquim Homrighausen
    • ~/JoHo
Re: Fatal: Internal error 2012010601
« Reply #6 on: September 27, 2017, 02:47:32 am »
I'll try to remember that the next time it barfs. It doesn't do it every time.

JernejL

  • Jr. Member
  • **
  • Posts: 92
Re: Fatal: Internal error 2012010601
« Reply #7 on: May 19, 2020, 12:02:30 pm »
I gotten to trigger this when trying to use heaptrace unit in my program.
 
It crashes with this error on line:
 
Code: Pascal  [Select][+][-]
  1.  
  2. TWorldRaycastResults = packed record
  3.  
  4.         newtonWorld: PNewtonWorld;
  5.  
  6.                 PtOrigin,
  7.                 PtTarget,
  8.         PtCenterAABB: Vector;
  9.  
  10.                 HitDistance: single;
  11.                 HitCoordinates: Vector;
  12.                 hitNormal: Vector;
  13.                 HitAnything: boolean;
  14.  
  15.                 NearestBodyHit: PNewtonBody;
  16.                 FirstBodyHitUserData: pointer;
  17.         FaceID: int64;
  18.                 FartherstBodyHit: PNewtonBody;
  19.  
  20.         AllBodies: array of PNewtonBody;
  21.  
  22.                 WhenToStop: integer;
  23.                 hitcallback: NewtonBodyIteratorEx;
  24.         ListAllBodies: boolean;
  25.  
  26.                 FilterData: Pointer;
  27.                 FilterMethod: TNfilter;
  28.                 FilterData2: Pointer;
  29.                 FilterMethod2: TNfilter;
  30.  
  31.         end;
  32.  
  33. PWorldRaycastResults = ^TWorldRaycastResults;
  34.  
  35. function filter_procedure_explosion(const body: PNewtonBody; const userData: pointer; const RayCastResults: pointer): Integer; cdecl;
  36. var
  37.         TmpMatrix: TMatrix4f;
  38.     contact_coord, normal_coord: Vector;
  39.         explosion_radius, distance_to_explosion_origin: Single;
  40.         classpointer: Pointer;
  41.     wcr: PWorldRaycastResults;
  42. begin
  43.  
  44.         //assert(PWorldRaycastResults(RayCastResults).FilterData = body, 'filter_procedure_explosion problem with data.');
  45.  
  46.         wcr:= PWorldRaycastResults(RayCastResults);
  47.  
  48.         if wcr.FilterData = body then exit(0); <- crash on this line, where i do a simple pointer comparison
  49.        
  50. ..
  51.  
  52. end;
  53.  
  54.  

I have no idea why this happens, it's a pointer comparison on the line - it could be a bug in how heaptrc is implemented.
 
compiled in {$mode delphi} 
 

JernejL

  • Jr. Member
  • **
  • Posts: 92
Re: Fatal: Internal error 2012010601
« Reply #8 on: May 19, 2020, 12:13:27 pm »
I get this errot to happen on more places if i comment that out, it is nearly always when casting a pointer to pointer type (Psomethingtype^), i suspect a flaw in how freepascal handles this in mode delphi?
 
Edit: could be related to https://bugs.freepascal.org/view.php?id=29899 - i might need a compiler upgrade? (using 3.0.4)
 
« Last Edit: May 19, 2020, 12:23:32 pm by JernejL »

PascalDragon

  • Hero Member
  • *****
  • Posts: 5486
  • Compiler Developer
Re: Fatal: Internal error 2012010601
« Reply #9 on: May 19, 2020, 04:48:58 pm »
Yes, you'll need to wait for 3.2 (or compile a patched release compiler yourself).

JernejL

  • Jr. Member
  • **
  • Posts: 92
Re: Fatal: Internal error 2012010601
« Reply #10 on: May 21, 2020, 08:27:03 am »
I tried 3.2.0 and the error still occurs.
 
Newton_ext.pas(1344,17) Error: Internal error 2012010601
 
Looks like i'll have to reopen the ticket.
 

PascalDragon

  • Hero Member
  • *****
  • Posts: 5486
  • Compiler Developer
Re: Fatal: Internal error 2012010601
« Reply #11 on: May 21, 2020, 10:45:27 am »
In that case please provide a small, self contained example that demonstrates this.

jamie

  • Hero Member
  • *****
  • Posts: 6130
Re: Fatal: Internal error 2012010601
« Reply #12 on: May 21, 2020, 01:13:51 pm »
I've been able to blow up the HEAPTRC myself during execution of some code but that was caused by me flooding memory (spilling over) where I disrupted the handling of HeapTrc.

 How the compiler itself comes into play with this is strange but is it possible there is mistakenly another "InternalError" of the same number being generated elsewhere ?

 Seems like I remember seeing this once reported where as the same number being used in two different places unrelated to each other..
The only true wisdom is knowing you know nothing

PascalDragon

  • Hero Member
  • *****
  • Posts: 5486
  • Compiler Developer
Re: Fatal: Internal error 2012010601
« Reply #13 on: May 21, 2020, 02:51:43 pm »
I've been able to blow up the HEAPTRC myself during execution of some code but that was caused by me flooding memory (spilling over) where I disrupted the handling of HeapTrc.

 How the compiler itself comes into play with this is strange but is it possible there is mistakenly another "InternalError" of the same number being generated elsewhere ?

 Seems like I remember seeing this once reported where as the same number being used in two different places unrelated to each other..

You just need to search the compiler's source code for the number to see whether it occurs multiple times (hint: this one doesn't). And this internalerror can only trigger if both -gh and -gc (or $CheckPointer On) is given, cause the compiler looks for the CheckPointer function in unit heaptrc.

Thaddy

  • Hero Member
  • *****
  • Posts: 14377
  • Sensorship about opinions does not belong here.
Re: Fatal: Internal error 2012010601
« Reply #14 on: May 21, 2020, 03:06:11 pm »
It is very easy to blow up heaptrc (not heaptrace) if you install an alternative memory manager.
That said: an internal error should be fixed.

The ratio is that heaptrc is a memory manager by itself. Don't ever use things like cmem and the likes together with heaptrc.
« Last Edit: May 21, 2020, 03:08:20 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

 

TinyPortal © 2005-2018