Browse Source

* patch by Dean Mustakino to avoid generation of debug info for generics, resolves #38827
+ test

florian 3 years ago
parent
commit
ca9384fd6c
3 changed files with 29 additions and 0 deletions
  1. 3 0
      compiler/dbgdwarf.pas
  2. 8 0
      tests/webtbs/tw38827.pp
  3. 18 0
      tests/webtbs/uw38827.pp

+ 3 - 0
compiler/dbgdwarf.pas

@@ -2307,6 +2307,9 @@ implementation
            not assigned(def.procstarttai) then
            not assigned(def.procstarttai) then
           exit;
           exit;
 
 
+        if df_generic in def.defoptions then
+          exit;
+
         { Procdefs are not handled by the regular def writing code, so
         { Procdefs are not handled by the regular def writing code, so
           dbg_state is not set/checked for them. Do it here.  }
           dbg_state is not set/checked for them. Do it here.  }
         if (def.dbg_state in [dbg_state_writing,dbg_state_written]) then
         if (def.dbg_state in [dbg_state_writing,dbg_state_written]) then

+ 8 - 0
tests/webtbs/tw38827.pp

@@ -0,0 +1,8 @@
+{ %OPT=-g }
+program Project1;
+{$mode delphi}
+uses uw38827;
+var R: TRec;
+begin
+  R.GetArr<single>;
+end.

+ 18 - 0
tests/webtbs/uw38827.pp

@@ -0,0 +1,18 @@
+unit uw38827;
+{$mode Delphi}
+interface
+type
+  TRec = record
+    C: TArray<single>;
+    function GetArr<T>: TArray<T>; inline;
+  end;
+implementation
+function TRec.GetArr<T>: TArray<T>;
+begin
+  result := nil;
+  case GetTypeKind(T) of
+    tkFloat:
+      if SizeOf(T) = SizeOf(Single) then result := C;
+  end;
+end;
+end.