Page 1 of 1

Zeoslib 7.2.1-rc. Internal error C1118 on Delphi 7

Posted: 17.10.2017, 22:50
by tkszeos
Hi, I installed the Zeoslib 7.2.1-rc package in Delphi 7 without any problems. But when I compile a complex project, I get the following error: [Fatal error] ZVariant.pas (1364): Internal error: C1118. In the project I use different packages including jcl and jvcl. In simpler situations, I compile without problems. A tip on how to solve this problem? Thanks

Re: Zeoslib 7.2.1-rc. Internal error C1118 on Delphi 7

Posted: 18.10.2017, 09:17
by marsupilami
Hello tkszeos,

honestly - the easiest way to solve this problem could be using a newer Delphi version. Delphi Internal errors are usually bugs in the compiler. You could also try the current SVN version of Zeos 7.2. and see if this resolves your problem. Or maybe the Lazarus project is an option for you?

With best regards,

Jan

Re: Zeoslib 7.2.1-rc. Internal error C1118 on Delphi 7

Posted: 18.10.2017, 23:47
by tkszeos
Hi marsupilami,
I solved this problem by simply disabling the "Range checking" option in compiler options.
Thank you again

Re: Zeoslib 7.2.1-rc. Internal error C1118 on Delphi 7

Posted: 19.10.2017, 16:06
by Fr0sT
I also had internal error caused by range checking in test suite with D7.

Re: Zeoslib 7.2.1-rc. Internal error C1118 on Delphi 7

Posted: 02.02.2018, 19:06
by EgonHugeist
Hi, still persits? If so i need to change something on my test environments..
Give me a feedback please.

Re: Zeoslib 7.2.1-rc. Internal error C1118 on Delphi 7

Posted: 02.02.2018, 23:11
by Fr0sT
I can't check now, but doubt something changed. This error is hardly related to Zeos code...

Re: Zeoslib 7.2.1-rc. Internal error C1118 on Delphi 7

Posted: 09.02.2018, 20:54
by EgonHugeist
Did commit "something" related to the line tks did report.

please have a look @
http://www.delphigroups.info/2/90/405410.html
http://docwiki.embarcadero.com/RADStudi ... s_(Delphi)

if the issue continues to to fix the variable with double cast as proposed by emba. Funny is the problem seems not be resolved, even if no clear compiler error is written in DXE10.2 Docs...

Re: Zeoslib 7.2.1-rc. Internal error C1118 on Delphi 7

Posted: 11.02.2018, 17:51
by marsupilami
Those internal errors are errors in the compiler. The tells the compiler people which unit failed and on which line it happened. So C1118 in D7 is not the same as C1118 in D6... Fixing this in the source code is a lot of guesswork because it is valid code that triggers this behaviour.

Re: Zeoslib 7.2.1-rc. Internal error C1118 on Delphi 7

Posted: 12.02.2018, 15:59
by Fr0sT
Nope this is hopeless. Adding some typecasts won't help because then appears another errors:
[Error] ZDbcResultSet.pas(358): Declaration of 'GetULong' differs from declaration in interface 'IZResultSet'
which could be cured only by disabling range checking for the whole unit. Here are my changes to ZVariants unit before I got that error:

Code: Select all

Index: ZVariant.pas
===================================================================
--- ZVariant.pas	(revision 4187)
+++ ZVariant.pas	(working copy)
@@ -1352,11 +1352,9 @@
 begin
   case Value1.VType of
     vtNull: Result := EncodeNull;
-    //try handle D7 bug [Fatal error] ZVariant.pas (1364): Internal error: C1118.
-    //see http://www.delphigroups.info/2/90/405410.html
-    //and http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Resolving_Internal_Errors_(Delphi)
-    vtInteger: Result := EncodeInteger(Int64(Value1.VInteger) + Int64(GetAsInteger(Value2)));
-    vtUInteger: Result := EncodeUInteger(UInt64(Value1.VUInteger) + UInt64(GetAsUInteger(Value2)));
+    vtInteger: Result := EncodeInteger(Value1.VInteger + GetAsInteger(Value2));
+    //need that type cast for D7 else "internal error C1118"
+    vtUInteger: Result := EncodeUInteger({$IFDEF WITH_UINT64_C1118_ERROR}UInt64{$ENDIF}(Value1.VUInteger + GetAsUInteger(Value2)));
     //ugly but hope it helps
     vtFloat: Result := EncodeFloat(Value1.VFloat + GetAsFloat(Value2));
     vtString: Result := EncodeString(Value1.VString + GetAsString(Value2));
@@ -1381,11 +1379,9 @@
   case Value1.VType of
     vtNull: Result := EncodeNull;
     vtBoolean: Result := EncodeBoolean(Value1.VBoolean and GetAsBoolean(Value2));
-    //try handle D7 bug [Fatal error] ZVariant.pas (1364): Internal error: C1118.
-    //see http://www.delphigroups.info/2/90/405410.html
-    //and http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Resolving_Internal_Errors_(Delphi)
     vtInteger: Result := EncodeInteger(Int64(Value1.VInteger) and Int64(GetAsInteger(Value2)));
-    vtUInteger: Result := EncodeUInteger(UInt64(Value1.VUInteger) and UInt64(GetAsUInteger(Value2)));
+    //need that type cast for D7 else "internal error C1118"
+    vtUInteger: Result := EncodeUInteger({$IFDEF WITH_UINT64_C1118_ERROR}UInt64{$ENDIF}(Value1.VUInteger and GetAsUInteger(Value2)));
     else RaiseUnsupportedOperation;
   end;
 end;
@@ -1401,11 +1397,9 @@
 begin
   case Value1.VType of
     vtNull: Result := EncodeNull;
-    //try handle D7 bug [Fatal error] ZVariant.pas (1364): Internal error: C1118.
-    //see http://www.delphigroups.info/2/90/405410.html
-    //and http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Resolving_Internal_Errors_(Delphi)
     vtInteger: Result := EncodeInteger(Int64(Value1.VInteger) div Int64(GetAsInteger(Value2)));
-    vtUInteger: Result := EncodeUInteger(UInt64(Value1.VUInteger) div UInt64(GetAsUInteger(Value2)));
+    //need that type cast for D7 else "internal error C1118"
+    vtUInteger: Result := EncodeUInteger({$IFDEF WITH_UINT64_C1118_ERROR}UInt64{$ENDIF}(Value1.VUInteger div GetAsUInteger(Value2)));
     vtFloat: Result := EncodeFloat(Value1.VFloat / GetAsFloat(Value2));
     else RaiseUnsupportedOperation;
   end;
@@ -1458,11 +1452,8 @@
 begin
   case Value1.VType of
     vtNull: Result := EncodeNull;
-    //try handle D7 bug [Fatal error] ZVariant.pas (1364): Internal error: C1118.
-    //see http://www.delphigroups.info/2/90/405410.html
-    //and http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Resolving_Internal_Errors_(Delphi)
     vtInteger: Result := EncodeInteger(Int64(Value1.VInteger) mod Int64(GetAsInteger(Value2)));
-    vtUInteger: Result := EncodeUInteger(UInt64(Value1.VUInteger) mod UInt64(GetAsUInteger(Value2)));
+    vtUInteger: Result := EncodeUInteger({$IFDEF WITH_UINT64_C1118_ERROR}UInt64{$ENDIF}(Value1.VUInteger mod GetAsUInteger(Value2)));
     else RaiseUnsupportedOperation;
   end;
 end;
@@ -1503,7 +1494,7 @@
   case Value1.VType of
     vtNull: Result := EncodeNull;
     vtInteger: Result := EncodeInteger(Value1.VInteger * GetAsInteger(Value2));
-    vtUInteger: Result := EncodeUInteger(Value1.VUInteger * GetAsUInteger(Value2));
+    vtUInteger: Result := EncodeUInteger({$IFDEF WITH_UINT64_C1118_ERROR}UInt64{$ENDIF}(Value1.VUInteger * GetAsUInteger(Value2)));
     vtFloat: Result := EncodeFloat(Value1.VFloat * GetAsFloat(Value2));
     else RaiseUnsupportedOperation;
   end;
@@ -1565,7 +1556,7 @@
     vtNull: SetNull(Result{%H-});
     vtBoolean: Result := EncodeBoolean(Value1.VBoolean or GetAsBoolean(Value2));
     vtInteger: Result := EncodeInteger(Value1.VInteger or GetAsInteger(Value2));
-    vtUInteger: Result := EncodeUInteger(Value1.VInteger or GetAsUInteger(Value2));
+    vtUInteger: Result := EncodeUInteger({$IFDEF WITH_UINT64_C1118_ERROR}UInt64{$ENDIF}(Value1.VInteger or GetAsUInteger(Value2)));
     else RaiseUnsupportedOperation;
   end;
 end;
@@ -1600,7 +1591,7 @@
   case Value1.VType of
     vtNull: Result := EncodeNull;
     vtInteger: Result := EncodeInteger(Value1.VInteger - GetAsInteger(Value2));
-    vtUInteger: Result := EncodeUInteger(Value1.VUInteger - GetAsUInteger(Value2));
+    vtUInteger: Result := EncodeUInteger({$IFDEF WITH_UINT64_C1118_ERROR}UInt64{$ENDIF}(Value1.VUInteger - GetAsUInteger(Value2)));
     vtFloat: Result := EncodeFloat(Value1.VFloat - GetAsFloat(Value2));
     else RaiseUnsupportedOperation;
   end;
@@ -1639,8 +1630,8 @@
       begin
         TempUInteger1 := Value1.VUInteger;
         TempUInteger2 := GetAsUInteger(Value2);
-        Result := EncodeUInteger((TempUInteger1 and not TempUInteger2)
-          or (not TempUInteger1 and TempUInteger2));
+        Result := EncodeUInteger({$IFDEF WITH_UINT64_C1118_ERROR}UInt64{$ENDIF}((TempUInteger1 and not TempUInteger2)
+          or (not TempUInteger1 and TempUInteger2)));
       end;
     else RaiseUnsupportedOperation;
   end;
It is incomplete as it lacks the most complex Convert method.
But anyway IDK how to solve this issue except by disabling range check in zeos.inc when WITH_UINT64_C1118_ERROR is defined.

Re: Zeoslib 7.2.1-rc. Internal error C1118 on Delphi 7

Posted: 12.02.2018, 17:02
by EgonHugeist
If it's hopeless.. Let's rollback my stub.

Question do we talk about RangeChecks or OverFlow checks here? AFAIK is the no range checks for the 8Byte vals.
see https://stackoverflow.com/questions/116 ... ror-delphi

your WITH_UINT64_C1118_ERROR is a nice idea. But guess purpose should be disable the checks in the implementation section like

Code: Select all

{$IFDEF WITH_UINT64_C1118_ERROR}{$R-}{$ENDIF}

Re: Zeoslib 7.2.1-rc. Internal error C1118 on Delphi 7

Posted: 12.02.2018, 17:30
by Fr0sT
Michael,
Let's rollback my stub.
Yep I think it would be better. There's no sense in bloating the code if it won't help.
Question do we talk about RangeChecks or OverFlow checks here?
Range checks. Check this option in compiler settings of Test suite - and get C1118. Uncheck it - and app will be compiled. And adding R- directives to units does solve the issue.
your WITH_UINT64_C1118_ERROR is a nice idea
Actually it is already used in Zeos, I just borrowed the idea :)
But guess purpose should be disable the checks in the implementation section like
Yeah, this seems the only acceptable option. At least checks would be disabled for Zeos units only leaving other ones as a programmer wants to.

Re: Zeoslib 7.2.1-rc. Internal error C1118 on Delphi 7

Posted: 12.02.2018, 19:20
by EgonHugeist
I'd rollback my approach.
@FrOsT
maybe you find the time to finalize the define?

Re: Zeoslib 7.2.1-rc. Internal error C1118 on Delphi 7

Posted: 13.02.2018, 09:49
by Fr0sT
Michael, sure, done