[Mono-devel-list] Bug? get accessor self-refers

2a5gjx302 at sneakemail.com 2a5gjx302 at sneakemail.com
Sun May 4 16:10:46 EDT 2003


At 10:04 PM 04/05/2003 +0200, you wrote:
>El dom, 04 de 05 de 2003 a las 19:55, Burton M. Strauss III escribió:
>> mono 0.23 - Linux (RedHat 8)
>> 
>> // bug 00002 - seg fault
>> 
>> using System;
>> 
>>     public struct x {
>>         protected byte p;
>> 
>>         public x(byte i) {
>>                 p=i;
>>         }
>> 
>>         public byte P {
>>                 get {
>>                         return P;
>>                 }
>>         }
>>     }
>> 
>> class Sample {
>>     public static void Main() {
>>         x v = new x(3);
>>         Console.WriteLine("\tP {0}", v.P );
>>     }
>> }
>> 
>> Seg faults when run.  If you change the 'return P' to 'return p', which is
>> (of course) the correct program, it runs fine.  Shouldn't there be a better
>> trap than an OS segmentation fault?
>
>Well, may be you prefer the fancy "Application has generated an
>exception that could not be handled" window that MS runtime generates
>for such a program ;-).
>
>-Gonzalo

Simple forms of this could be easily detected at the compile stage. I think
I've seen the MS compiler warning about such constructs, saying that the
recursion will never end.

Jonathan



More information about the Mono-devel-list mailing list