This repository was archived by the owner on Nov 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 503
This repository was archived by the owner on Nov 1, 2020. It is now read-only.
[CppCodeGen] Simple test with enum fails on Linux x64 #2884
Copy link
Copy link
Closed
Labels
Description
The following test fails on x64 Linux with the latest version of corert
using System;
namespace Hello
{
internal class Program
{
enum orientation : byte
{
north = 1,
south = 2,
east = 3,
west = 4
}
private static int Main()
{
orientation myDir = orientation.north;
return Convert.ToInt32(myDir);
}
}
}
the listing of the execution in gdb
(gdb) run
Starting program: /home/signatov/corert/tests/src/Simple/Hello/bin/Debug/x64/native/Hello
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffdc895700 (LWP 27871)]
Thread 1 "Hello" received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x0000000000754289 in System_Private_CoreLib::System::Convert::ToInt32 (_a0=0x7fffdc898b48) at /home/signatov/corert/tests/src/Simple/Hello/obj/Debug/x64/native/Hello.cpp:297709
#2 0x0000000000752285 in Hello::Hello::Program::Main () at /home/signatov/corert/tests/src/Simple/Hello/obj/Debug/x64/native/Hello.cpp:276128
#3 0x00000000007359ed in Hello::_Module_::MainMethodWrapper () at /home/signatov/corert/tests/src/Simple/Hello/obj/Debug/x64/native/Hello.cpp:274913
#4 0x0000000000735736 in Hello::_Module_::StartupCodeMain (_a0=1, _a1=140737488346376) at /home/signatov/corert/tests/src/Simple/Hello/obj/Debug/x64/native/Hello.cpp:262561
#5 0x0000000000735a7b in __managed__Main (_a0=1, _a1=140737488346376) at /home/signatov/corert/tests/src/Simple/Hello/obj/Debug/x64/native/Hello.cpp:262569
#6 0x0000000000b2993a in main (argc=1, argv=0x7fffffffdd08) at /home/signatov/corert/src/Native/Bootstrap/main.cpp:319
(gdb) b System_Private_CoreLib::System::Convert::ToInt32
Breakpoint 1 at 0x7541fc: file /home/signatov/corert/tests/src/Simple/Hello/obj/Debug/x64/native/Hello.cpp, line 297692.
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/signatov/corert/tests/src/Simple/Hello/bin/Debug/x64/native/Hello
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffdc895700 (LWP 27875)]
Thread 1 "Hello" hit Breakpoint 1, System_Private_CoreLib::System::Convert::ToInt32 (_a0=0x7fffdc898b48)
at /home/signatov/corert/tests/src/Simple/Hello/obj/Debug/x64/native/Hello.cpp:297692
297692 int32_t _l0 = 0;
(gdb) n
297697 void* _1 = _a0;
(gdb) n
297698 if (_1 == 0) {
(gdb) n
297701 }
(gdb) n
297705 void* _2 = _a0;
(gdb) n
297706 void* _3 = __castclass(_2, ::System_Private_CoreLib::System::IConvertible::__getMethodTable());
(gdb) n
297708 void*_4 = (void*) ((ToInt32) System_Private_CoreLib::System::Runtime::DispatchResolve::FindInterfaceMethodImplementationTarget(::System_Private_CoreLib::System::Object::get_EEType((::System_Private_CoreLib::System::Object*)_3), ((::System_Private_CoreLib::Internal::Runtime::EEType *)(::System_Private_CoreLib::System::IConvertible::__getMethodTable())), (uint16_t)(::System_Private_CoreLib::System::IConvertible::__getslot__ToInt32(_3))));
(gdb) n
297709 int32_t _5 = ((ToInt32)_4)((::System_Private_CoreLib::System::IConvertible*)_3, (::System_Private_CoreLib::System::IFormatProvider*)0);
(gdb) p _4
$1 = (void *) 0x0
(gdb) p _3
$2 = (void *) 0x7fffdc898b48
(gdb) s
Thread 1 "Hello" received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
I commented #line generation in the file src/ILCompiler.Compiler/src/CppCodeGen/ILToCppImporter.cs and added "-g" in /src/BuildIntegration/Microsoft.NETCore.Native.Unix.props
<CppCompilerAndLinkerArg Condition="'$(Configuration)' == 'Debug'" Include="-O0 -g" />
Reactions are currently unavailable