Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2015-01

Question about runtime error 219

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Gennady Agranov

Hi All,

What exactly -CR (Verify object method call validity) code generation is checking and how tested is it?

For debugging I prefer to enable all possibles checks - range, overflow, ...

But i can not use -CR:

1. I passed some "var array of array" parameter - error 219 - changed to var array - works...

2. I use generics and 2.7.1 and when I am calling some method that is implemented in grandfather class - runtime error 219 :(

But, If I do not set -CR - everything works just fine...

Any internal scoop about -CR - please?

Thanks,
Gennady

Reply by email

Pierre Free Pascal
to Gennady Agranov
Show quoted text 28 lines
-----Message d'origine----- De : [mailto:fpc-devel- De la part de Gennady Agranov Envoyé : samedi 10 janvier 2015 05:19 À : FPC developers' list Objet : [fpc-devel] Question about runtime error 219 Hi All, What exactly -CR (Verify object method call validity) code generation is checking and how tested is it? For debugging I prefer to enable all possibles checks - range, overflow, ... But i can not use -CR: 1. I passed some "var array of array" parameter - error 219 - changed to var array - works... 2. I use generics and 2.7.1 and when I am calling some method that is implemented in grandfather class - runtime error 219 :( But, If I do not set -CR - everything works just fine... Any internal scoop about -CR - please?

The -CR option add, before any virtual method call, a call to a special function fpc_check_object_ext
to check that the real class of the class variable which is used is indeed a child of the explicit class type specification of this method.

Example

    var
         c : class;
   begin
      derivedclass(c).method1;

the call to fpc_check_object_ext will be done with the true class of c (as given by the address of the vitual method table) to the virtual method table of derived type

This is more or less equivalent to
assert that c is indeed a child type of derivedclass.

It is possible that this option -CR will
generate a RTE 219 in perfectly working code,
a possible case is when two different derived classes implement "compatible" child methods, that end up at the same position in the virtual method table, but without a common virtual definition for the common ancestor.

Pierre Muller

assert

Reply by email

Sven Barth
to Gennady Agranov: What exactly -CR (Verify object method call validity) code generation is checking and how…
Gennady Agranov wrote 19 lines
Hi All, What exactly -CR (Verify object method call validity) code generation is checking and how tested is it? For debugging I prefer to enable all possibles checks - range, overflow, ... But i can not use -CR: 1. I passed some "var array of array" parameter - error 219 - changed to var array - works... 2. I use generics and 2.7.1 and when I am calling some method that is implemented in grandfather class - runtime error 219 :( But, If I do not set -CR - everything works just fine... Any internal scoop about -CR - please?

Would you please provide explicit examples? Then we might be able to tell you whether there is indeed a problem with -CR or something else...

Regards,
Sven

Reply by email