Bug 324319 (MONO81643) - [GMCS] gmcs generates invalid il for null a : class constraint
Summary: [GMCS] gmcs generates invalid il for null a : class constraint
Status: RESOLVED FIXED
: 415314 448558 (view as bug list)
Alias: MONO81643
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Minor
Target Milestone: ---
Assignee: Marek Safar
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on: 469742
Blocks:
  Show dependency treegraph
 
Reported: 2007-05-16 22:48 UTC by Forgotten User vxPDddArjq
Modified: 2009-01-28 12:38 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:38:50 UTC


---- Reported by vargaz@gmail.com 2007-05-16 15:48:43 MST ----

Testcase:
======================================================================
using System;

public class Tests {

	public virtual ServiceType GetService<ServiceType>(params object[] args) 
		where ServiceType : class {
		return null;
	}

	public static int Main () {
		return 0;
	}
}
=======================================================================

csc generates an initobj !!ServiceType, while gmcs generates an ldnull, and
PEVerify flags this as invalid IL.



---- Additional Comments From rharinath@novell.com 2007-05-18 06:07:54 MST ----

Hmm.  That's strange.  The 'ldnull' verifiability rule says:

The ldnull instruction is always verifiable, and produces a value that
verification considers compatible with any other reference type.

Does that mean that verification doesn't take constraints into account?


Unknown operating system unknown. Setting to default OS "Other".

Comment 2 Marek Safar 2008-11-25 16:56:31 UTC
*** Bug 448558 has been marked as a duplicate of this bug. ***
Comment 3 Marek Safar 2009-01-27 22:43:42 UTC
Fixed in trunk by emitting extraneous unbox.any
Comment 4 Marek Safar 2009-01-28 12:38:06 UTC
*** Bug 415314 has been marked as a duplicate of this bug. ***