Parcourir la source

* properly unlink unused type symbols from their defs to avoid
internal errors when generating debug info, resolves #40886

florian il y a 10 mois
Parent
commit
44d9234f38
3 fichiers modifiés avec 25 ajouts et 0 suppressions
  1. 11 0
      compiler/pgenutil.pas
  2. 1 0
      compiler/symtype.pas
  3. 13 0
      tests/webtbs/tw40886.pp

+ 11 - 0
compiler/pgenutil.pas

@@ -1342,6 +1342,17 @@ uses
                   end;
               end;
           end;
+
+        { unlink unused defs }
+        if not(result) and assigned(callerparams) then
+          begin
+            for k:=0 to callerparams.count-1 do
+              begin
+                if tsym(callerparams[k]).typ=typesym then
+                  ttypesym(callerparams[k]).typedef.typesym:=nil;
+              end;
+          end;
+
         callerparams.free;
       end;
 

+ 1 - 0
compiler/symtype.pas

@@ -415,6 +415,7 @@ implementation
           result:=result+GetTypeName;
       end;
 
+
     function tdef.fulltypename:string;
       begin
         result:=fullownerhierarchyname(false);

+ 13 - 0
tests/webtbs/tw40886.pp

@@ -0,0 +1,13 @@
+{ %opt=-gl }
+program test;
+{$modeswitch implicitfunctionspecialization}
+
+generic procedure FillChar<T>(var x; count: SizeInt; value: Byte);
+begin
+end;
+
+var v: array [0..0] of Byte;
+
+begin
+  FillChar(v, 0, 0);
+end.