Zeoslib 7.2.1-rc. Internal error C1118 on Delphi 7

The forum for ZeosLib 7.2 Report problems. Ask for help, post proposals for the new version and Zeoslib 7.2 features here. This is a forum that will be edited once the 7.2.x version goes into RC/stable!!

My personal intention for 7.2 is to speed up the internals as optimal a possible for all IDE's. Hope you can help?! Have fun with testing 7.2
Post Reply
User avatar
tkszeos
Junior Boarder
Junior Boarder
Posts: 35
Joined: 26.08.2005, 21:45

Zeoslib 7.2.1-rc. Internal error C1118 on Delphi 7

Post 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
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

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

Post 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
User avatar
tkszeos
Junior Boarder
Junior Boarder
Posts: 35
Joined: 26.08.2005, 21:45

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

Post by tkszeos »

Hi marsupilami,
I solved this problem by simply disabling the "Range checking" option in compiler options.
Thank you again
Fr0sT
Zeos Dev Team
Zeos Dev Team
Posts: 280
Joined: 08.05.2014, 12:08

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

Post by Fr0sT »

I also had internal error caused by range checking in test suite with D7.
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

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

Post by EgonHugeist »

Hi, still persits? If so i need to change something on my test environments..
Give me a feedback please.
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
Fr0sT
Zeos Dev Team
Zeos Dev Team
Posts: 280
Joined: 08.05.2014, 12:08

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

Post by Fr0sT »

I can't check now, but doubt something changed. This error is hardly related to Zeos code...
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

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

Post 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...
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

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

Post 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.
Fr0sT
Zeos Dev Team
Zeos Dev Team
Posts: 280
Joined: 08.05.2014, 12:08

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

Post 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.
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

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

Post 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}
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
Fr0sT
Zeos Dev Team
Zeos Dev Team
Posts: 280
Joined: 08.05.2014, 12:08

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

Post 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.
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

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

Post by EgonHugeist »

I'd rollback my approach.
@FrOsT
maybe you find the time to finalize the define?
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
Fr0sT
Zeos Dev Team
Zeos Dev Team
Posts: 280
Joined: 08.05.2014, 12:08

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

Post by Fr0sT »

Michael, sure, done
Post Reply