bugDotGNU Portable.NET - Bugs: bug #4535, mscorlib value types being marked...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #4535: mscorlib value types being marked as regular classes

Submitter:  Richard Baumann <Rich333>
Submitted:  Wed 30 Jul 2003 06:17:48 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Mon 04 Aug 2003 06:50:10 AM UTC, comment #3: 

Fix commited by Gopal - 1 Aug 2003

Rhys Weatherley <rweather>
Group administrator
Thu 31 Jul 2003 03:40:41 PM UTC, comment #2: 

I found this bug because mcs.exe is failing to verify, because of an initobj on System.Char. The IsCPPointer check in the INITOBJ case in verify_obj.c is failing because the ILType_FromValueType on classInfo is returning what appears to be garbage. The ILTypeIdentical fails as a result, and a verification exception is thrown. The attached file generates a dynamic assembly which, when run, gives the same verification exception, for the same reason.

Richard Baumann <Rich333>
Group Member
Thu 31 Jul 2003 12:49:27 AM UTC, comment #1: 

The information that indicates that a type is a value type
is stored in the library assembly, not in the referencing
assembly.  There is no way in metadata to record this
in the reference.

The ildasm program only dumps a single assembly at a
time, without loading the dependencies.  And so sometimes
it needs to guess as to what the foreign type is.  This can
cause it to show "class" when you might expect "valuetype",
especially for "box" and "initobj" instructions.

Besides, the IL_META_TYPEDEF_VALUE_TYPE flag
is not used to mark value types.  A value type is anything
that inherits from "System.ValueType".  That flag is obsolete
and is not used any more by the ECMA specifications.

The runtime engine, which does load the dependencies,
will resolve the type, discover that it inherits from the
System.ValueType class, and then "know" that it is a
value type.

Do you have a test case that demonstrates a problem at
runtime, or was it just something you noticed in ildasm?

Rhys Weatherley <rweather>
Group administrator
Wed 30 Jul 2003 06:17:48 PM UTC, original submission:  

The basic mscorlib value types (e.g. Int32, Char) are being marked as regular classes when referenced from other assemblies. This is causing things like initobj on these types to fail verification. Within mscorlib they seem to be treated properly. You can see things like "box        class [mscorlib]System.Char" by "ildasm pnetlib/System/System.dll | grep System.Char". The problem appears to be in the ILClass attributes for these types. I printf'd the attribs for System.Char (at least, that's what the classInfo's ILClassName said it was) in the INITOBJ case in verify_obj.c and it came out as 0x2109. I'm not sure if the missing IL_META_TYPEDEF_SYSTEM_MASK bits are a part of the problem, but I know the missing IL_META_TYPEDEF_CLASS_SEMANTICS_MASK bits are.


Rich

Richard Baumann <Rich333>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #570:  xyz.cs added by Rich333 (2KiB - application/octet-stream - Generates a dynamic assembly which, when run, shows the problem.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

 

Follow 2 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2003-08-04 rweather StatusNone None
    Open/ClosedOpen None

Back to the top

Powered by Savane 3.13-02a9.
Corresponding source code