www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15455] New: Compiler segfault for simple nested structure

https://issues.dlang.org/show_bug.cgi?id=15455

          Issue ID: 15455
           Summary: Compiler segfault for simple nested structure
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: saurabh.das gmail.com

struct xlref
{
    ushort rwFirst;
    ushort rwLast;
    ubyte colFirst;
    ubyte colLast;
}

struct xlmref
{
    ushort count;
    xlref reflist;
}

Mac OS X (dmd 2.069.0)
===================
dmd  dprob.d
Segmentation fault: 11

Windows (dmd 2.069.2)
==================
dmd -v -m64 dprob.d
binary C:\D\dmd2\windows\bin\dmd.exe
version v2.069.2
config C:\D\dmd2\windows\bin\sc.ini
parse xlcall_wrap2
importall xlcall_wrap2
import object (C:\D\dmd2\windows\bin....\src\druntime\import\object.d)
semantic xlcall_wrap2

object.Error (0): assert(0) or HLT instruction

0x0040496F
0x00404CF8
0x004CF2B6
0x004565A7
0x0044EAB0
0x004BF99E
0x74F757F9 in MultiByteToWideChar
0x76F2139E in RtlQueryProcessDebugInformation
0x76F21340 in RtlQueryProcessDebugInformation
0x76F21190 in RtlQueryProcessDebugInformation

WORKAROUNDS
===========
Hope this helps in debugging. See
http://forum.dlang.org/post/n4rbeh$2eir$1 digitalmars.com

1) Changing the order of the members of xlmref seems to be a workaround:

struct xlmref
{
    xlref reflist;
    ushort count;
}

2) Changing the 2x ubyte to ubyte[2] seems to be a workaround:

struct xlref
{
     ushort rwFirst;
     ushort rwLast;
     ubyte[2] cols;
}

--
Dec 16 2015