[Mono-bugs] [Bug 473530] New: Using interop that return struct crashes

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Feb 6 15:52:57 EST 2009


https://bugzilla.novell.com/show_bug.cgi?id=473530


           Summary: Using interop that return struct crashes
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.2.x
          Platform: x86
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: interop
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: iamphi at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Created an attachment (id=270954)
 --> (https://bugzilla.novell.com/attachment.cgi?id=270954)
Small test program

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US;
rv:1.9.0.5) Gecko/2008120121 Firefox/3.0.5

I am using an embedded instance of mono, calling an interop that returns
struct.
I have found 3 different errors using different structs as the return type. 
There were no problem if the struct contains just one pointer or int.

Reproducible: Always

Steps to Reproduce:
1.  Compile the code attached.
2.  Run the C executable (for main.c)
Actual Results:  
gdb output for: struct { char x; }
<terminal>
phis-macbook-pro:monoTest phi$ make
mcs MyClass.cs
gcc main.c `pkg-config --cflags --libs mono`
phis-macbook-pro:monoTest phi$ gdb a.out
GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Sat Jul 26 08:14:40 UTC 2008)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin"...Reading symbols for
shared libraries ....... done

(gdb) run
Starting program: /Users/phi/workspace/monoTest/a.out
Reading symbols for shared libraries
++++++..............................................................................
done
MyClass.Main()

Program received signal SIGBUS, Bus error.
0x008ea7d5 in mono_decompose_vtype_opts (cfg=0x110b6a0) at decompose.c:1185
1185    decompose.c: No such file or directory.
    in decompose.c
(gdb) where
#0  0x008ea7d5 in mono_decompose_vtype_opts (cfg=0x110b6a0) at decompose.c:1185
#1  0x0089ff00 in mini_method_compile (method=0x181aa94,
opts=64055807, domain=0x5fe70, run_cctors=1, compile_aot=0, parts=0)
at mini.c:12656
#2  0x008a0ba1 in mono_jit_compile_method (method=0x181aa94) at mini.c:13134
#3  0x008a0947 in mono_jit_compile_method (method=0x181a924) at mini.c:13122
#4  0x0091eebd in mono_magic_trampoline (regs=0xbffff7d8, code=0x802b1
"??\f?:", m=0x181a924, tramp=0x0) at mini-trampolines.c:290
#5  0x00025066 in ?? ()
#6  0x00080203 in ?? ()
#7  0x009df9e4 in mono_runtime_exec_main (method=0x1803c64,
args=0x66ea0, exc=0x0) at object.c:3299
#8  0x009e3a17 in mono_runtime_run_main (method=0x1803c64, argc=1,
argv=0xbffff9a8, exc=0x0) at object.c:3084
#9  0x00001fcf in main ()
(gdb) quit
The program is running.  Exit anyway? (y or n) y
phis-macbook-pro:monoTest phi$
</terminal>

gdb output for: struct { char x; int y;}
<terminal>
(gdb) run
Starting program: /Users/phi/workspace/monoTest/a.out
Reading symbols for shared libraries
++++++..............................................................................
done
MyClass.Main()

Program received signal SIGSEGV, Segmentation fault.
0x8fe18c02 in __dyld_misaligned_stack_error ()
(gdb) where
#0  0x8fe18c02 in __dyld_misaligned_stack_error ()
#1  0x00000053 in ?? ()
#2  0x00001f6b in InterOpTest ()
#3  0x000848a5 in ?? ()
#4  0x000802b1 in ?? ()
#5  0x00080203 in ?? ()
#6  0x009df9e4 in mono_runtime_exec_main (method=0x1803c64,
args=0x66ea0, exc=0x0) at object.c:3299
#7  0x009e3a17 in mono_runtime_run_main (method=0x1803c64, argc=1,
argv=0xbffff9a8, exc=0x0) at object.c:3084
#8  0x00001fd1 in main ()
(gdb)
</terminal>

gdb output for: struct { float f; }
<terminal>
gdb) run
Starting program: /Users/phi/workspace/monoTest/a.out
Reading symbols for shared libraries
++++++..............................................................................
done
MyClass.Main()
**
ERROR:mini-x86.c:2020:emit_move_return_value: code should not be reached

Program received signal SIGABRT, Aborted.
0x919d4e42 in __kill ()
(gdb) where
#0  0x919d4e42 in __kill ()
#1  0x919d4e34 in kill$UNIX2003 ()
#2  0x91a4723a in raise ()
#3  0x91a53679 in abort ()
#4  0x00121f74 in g_assertion_message ()
#5  0x0093203a in emit_move_return_value (cfg=0x110bb10, ins=0xadc1ac,
code=0x184302b "") at mini-x86.c:2020
#6  0x009337ce in mono_arch_output_basic_block (cfg=0x110bb10,
bb=0x182457c) at mini-x86.c:2865
#7  0x00866332 in mono_codegen (cfg=0x110bb10) at mini.c:11955
#8  0x0089f4b0 in mini_method_compile (method=0x181aa94,
opts=64055807, domain=0x5fe70, run_cctors=1, compile_aot=0, parts=0)
at mini.c:12807
#9  0x008a0ba1 in mono_jit_compile_method (method=0x181aa94) at mini.c:13134
#10 0x008a0947 in mono_jit_compile_method (method=0x181a924) at mini.c:13122
#11 0x0091eebd in mono_magic_trampoline (regs=0xbffff7d8, code=0x802b1
"??\f?:", m=0x181a924, tramp=0x0) at mini-trampolines.c:290
#12 0x00025066 in ?? ()
#13 0x00080203 in ?? ()
#14 0x009df9e4 in mono_runtime_exec_main (method=0x1803c64,
args=0x66ea0, exc=0x0) at object.c:3299
#15 0x009e3a17 in mono_runtime_run_main (method=0x1803c64, argc=1,
argv=0xbffff9a8, exc=0x0) at object.c:3084
#16 0x00001fce in main ()
(gdb)
</terminal>

Expected Results:  
<terminal>
(gdb) run a.out 
Starting program: /Users/phi/workspace/monoTest/a.out a.out
MyClass.Main()
MyStruct InterOpTest()

Program exited normally.
(gdb) quit
</terminal>

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list