Wrong exception handler called?

Glenn Chambers gchamber@bright.net
Sat May 20 17:45:00 GMT 2000


At 01:51 PM 5/20/00 -0700, Per Bothner wrote:
>"Gregory R. Warnes" <warnes@biostat.washington.edu> writes:
>
>> Using the GCC 2.95.2 with Bryce's patches I've experienced method calls
>> being resolved to the wrong method.  (Completely wrong method, IE wrong
>> NAME, wrong number and type of parameters, wrong return value!)  This too
>> seemed to come and go as I rearranged the source or compiled from class
>> files instead of java.
>
>That may happen if you change one file in a way that changes the
>virtual function table (such as adding/removing non-static non-final
>methods), and re-compile some but not all files.
>
>It would be nice if we could figure out a way to give a linker error
>in such cases, but I can't offhand think of a way that doesn't
>require a modified linker.

I'm not up on the current linkers, but the old Dec-10 linker I used allowed
you to define a global absolute symbol with the same value in multiple object
files.  As long as all the symbols had the same value, everything was fine.
If one or more of the values definitions differed, you got an error message 
about multiple definitions.

If this kind of function is generally available, you could checksum the
signatures of the functions in the virtual table, and define a global like
MyClassVtabChecksum (or whatever) that would trap any mismatches.  (You would
define the expected values of each class where you call a non-final method.)

-- Glenn Chambers
-- Toledo, Ohio
-- gchamber@bright.net


More information about the Java mailing list