Explorar el Código

* keep track of the type of symbolic floating point constants rather
than always forcing them to bestreal (mantis #21151)

git-svn-id: trunk@20190 -

Jonas Maebe hace 13 años
padre
commit
74e721517d
Se han modificado 5 ficheros con 16 adiciones y 5 borrados
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/ncon.pas
  3. 1 1
      compiler/ppu.pas
  4. 7 3
      compiler/symsym.pas
  5. 6 0
      tests/webtbs/tw21151.pp

+ 1 - 0
.gitattributes

@@ -12178,6 +12178,7 @@ tests/webtbs/tw21073.pp svneol=native#text/plain
 tests/webtbs/tw2109.pp svneol=native#text/plain
 tests/webtbs/tw2110.pp svneol=native#text/plain
 tests/webtbs/tw21146.pp svneol=native#text/pascal
+tests/webtbs/tw21151.pp svneol=native#text/plain
 tests/webtbs/tw2128.pp svneol=native#text/plain
 tests/webtbs/tw2129.pp svneol=native#text/plain
 tests/webtbs/tw2129b.pp svneol=native#text/plain

+ 1 - 1
compiler/ncon.pas

@@ -313,7 +313,7 @@ implementation
           constwstring :
             p1:=cstringconstnode.createwstr(pcompilerwidestring(p.value.valueptr));
           constreal :
-            p1:=crealconstnode.create(pbestreal(p.value.valueptr)^,pbestrealtype^);
+            p1:=crealconstnode.create(pbestreal(p.value.valueptr)^,p.constdef);
           constset :
             p1:=csetconstnode.create(pconstset(p.value.valueptr),p.constdef);
           constpointer :

+ 1 - 1
compiler/ppu.pas

@@ -43,7 +43,7 @@ type
 {$endif Test_Double_checksum}
 
 const
-  CurrentPPUVersion = 143;
+  CurrentPPUVersion = 144;
 
 { buffer sizes }
   maxentrysize = 1024;

+ 7 - 3
compiler/symsym.pas

@@ -1816,6 +1816,7 @@ implementation
              end;
            constreal :
              begin
+               ppufile.getderef(constdefderef);
                new(pd);
                pd^:=ppufile.getreal;
                value.valueptr:=pd;
@@ -1860,14 +1861,14 @@ implementation
 
     procedure tconstsym.buildderef;
       begin
-        if consttyp in [constord,constpointer,constset] then
+        if consttyp in [constord,constreal,constpointer,constset] then
           constdefderef.build(constdef);
       end;
 
 
     procedure tconstsym.deref;
       begin
-        if consttyp in [constord,constpointer,constset] then
+        if consttyp in [constord,constreal,constpointer,constset] then
           constdef:=tdef(constdefderef.resolve);
       end;
 
@@ -1900,7 +1901,10 @@ implementation
                ppufile.putdata(pchar(value.valueptr)^,value.len);
              end;
            constreal :
-             ppufile.putreal(pbestreal(value.valueptr)^);
+             begin
+               ppufile.putderef(constdefderef);
+               ppufile.putreal(pbestreal(value.valueptr)^);
+             end;
            constset :
              begin
                ppufile.putderef(constdefderef);

+ 6 - 0
tests/webtbs/tw21151.pp

@@ -0,0 +1,6 @@
+const
+  cs = single(0.05);
+begin
+  if sizeof(cs)<>4 then
+    halt(1);
+end.