Bug 321313 (MONO78584) - [PPC] implicit operator on structs issue
Summary: [PPC] implicit operator on structs issue
Status: RESOLVED FIXED
Alias: MONO78584
Product: Mono: Runtime
Classification: Mono
Component: JIT (show other bugs)
Version: 1.2
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Paolo Molaro
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-05 18:07 UTC by Joachim Ante
Modified: 2010-03-21 12:02 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:00:49 UTC


---- Reported by joe@otee.dk 2006-06-05 11:07:32 MST ----

The following C# program should print 1 but prints 0 instead.
Strangely enough moving 
static private LayerMask mask = 1; makes the problem disappear.



using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[StructLayout (LayoutKind.Sequential)]
public struct LayerMask
{
	private ushort m_Mask;
	public static implicit operator int (LayerMask mask) { return (int)mask.m_Mask; }
	public static implicit operator LayerMask (int intVal) { LayerMask mask; mask.m_Mask = 
unchecked ((ushort)intVal); return mask; }
}

class Test
{
	static private LayerMask mask = 1;

	static void Main ()
	{
		int value = mask;
		System.Console.WriteLine("Output {0}", value);
	}
}



---- Additional Comments From rharinath@novell.com 2006-06-08 08:26:56 MST ----

I cannot reproduce the error with a recent SVN version of the
compiler.  Can you provide more details about the version of the
compiler and the runtime?



---- Additional Comments From joe@otee.dk 2006-06-30 09:56:40 MST ----

This happens with mono 1.1.15 on mac os x ppc 10.4.6.



---- Additional Comments From rharinath@novell.com 2006-07-03 10:15:13 MST ----

Can you verify with a newer snapshot.  If the problem persists, it may
have to do with some endian-ness issue (I don't have access to a
big-endian machine to verify).



---- Additional Comments From joe@otee.dk 2006-09-22 14:49:05 MST ----

I tried with 1.1.17.1 and the problem still appears.



---- Additional Comments From joe@otee.dk 2006-09-22 14:49:33 MST ----

I only tried on ppc.



---- Additional Comments From joe@otee.dk 2006-11-20 12:28:46 MST ----

I just tested on a ppc machine with mono 1.2 again. The bug is still there.

Any idea when this will be fixed?



---- Additional Comments From marek.safar@seznam.cz 2006-11-30 16:34:01 MST ----

It prints

Output 1

on x86. So it looks like runtime issue.
-> reassigning


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

Comment 2 Forgotten User vxPDddArjq 2010-03-21 12:02:58 UTC
This works fine with recent mono versions on ppc.