Jelajahi Sumber

* fixes cardinal in reg -> real on x86-64, resolves #8225

git-svn-id: trunk@6588 -
florian 18 tahun lalu
induk
melakukan
05e0a804cc
3 mengubah file dengan 28 tambahan dan 3 penghapusan
  1. 1 0
      .gitattributes
  2. 5 3
      compiler/x86/nx86cnv.pas
  3. 22 0
      tests/webtbs/tw8225.pp

+ 1 - 0
.gitattributes

@@ -8050,6 +8050,7 @@ tests/webtbs/tw8199.pp svneol=native#text/plain
 tests/webtbs/tw8222.pp svneol=native#text/plain
 tests/webtbs/tw8222a.pp svneol=native#text/plain
 tests/webtbs/tw8222b.pp svneol=native#text/plain
+tests/webtbs/tw8225.pp -text
 tests/webtbs/tw8229.pp svneol=native#text/plain
 tests/webtbs/tw8232.pp svneol=native#text/plain
 tests/webtbs/tw8258.pp svneol=native#text/plain

+ 5 - 3
compiler/x86/nx86cnv.pas

@@ -241,16 +241,18 @@ implementation
 
                    { Get sign bit }
                    if (left.location.loc=LOC_REGISTER) then
-                     emit_const_reg(A_BT,S_Q,63,left.location.register)
+                     begin
+                       emit_const_reg(A_BT,S_Q,63,left.location.register);
+                       current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,S_Q,left.location.register,location.register));
+                     end                       
                    else
                      begin
                        inc(left.location.reference.offset,4);
                        emit_const_ref(A_BT,S_L,31,left.location.reference);
                        dec(left.location.reference.offset,4);
+                       current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(op,S_Q,left.location.reference,location.register));
                      end;
 
-                   current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(op,S_Q,left.location.reference,location.register));
-
                    cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NC,l2);
                    current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(l1));
                    reference_reset_symbol(href,l1,0);

+ 22 - 0
tests/webtbs/tw8225.pp

@@ -0,0 +1,22 @@
+program test;
+
+const
+	factor	:	double	=	1.0;
+
+
+function CheckLongint(count,wcount:longint):double;
+begin
+	result:=(count+wcount)*factor;	
+end;
+
+
+function CheckCardinal(count,wcount:cardinal):double;
+begin
+	result:=(count+wcount)*factor;	
+end;
+
+
+begin 
+	writeln('LONGINT:  ',CheckLongint(3,1));
+	writeln('CARDINAL: ',CheckCardinal(3,1));
+end.