www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13968] New: [REG2.067a] constructing and returing union

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

          Issue ID: 13968
           Summary: [REG2.067a] constructing and returing union causes
                    segfault
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: sinkuupump gmail.com

Compiler segfaults without error messages.

Code:

union U
{
    bool a;
    long b;
}

U test1()
{
    return U();
}

U* test2()
{
    return new U();
}


Stack trace (with test1):

#0  0x00000000004a5231 in checkEscape(Scope*,
Expression*)::EscapeVisitor::visit(StructLiteralExp*) ()
#1  0x00000000004a5b93 in checkEscape(Scope*, Expression*) ()
#2  0x00000000004f6b00 in FuncDeclaration::semantic3(Scope*) ()
#3  0x0000000000407900 in Module::semantic3() ()
#4  0x0000000000404e8c in tryMain(unsigned long, char const**) ()
#5  0x00007ffff6e36ad5 in __libc_start_main () from /lib64/libc.so.6
#6  0x0000000000402c25 in _start ()


Stack trace (with test2):

#0  0x00000000004a5ad1 in checkEscape(Scope*,
Expression*)::EscapeVisitor::visit(NewExp*)
    ()
#1  0x00000000004a5b93 in checkEscape(Scope*, Expression*) ()
#2  0x00000000004f6b00 in FuncDeclaration::semantic3(Scope*) ()
#3  0x0000000000407900 in Module::semantic3() ()
#4  0x0000000000404e8c in tryMain(unsigned long, char const**) ()
#5  0x00007ffff6e36ad5 in __libc_start_main () from /lib64/libc.so.6
#6  0x0000000000402c25 in _start ()

--
Jan 11 2015