Bug 13968 – [REG2.067a] constructing and returing union causes segfault

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-01-12T03:21:00Z
Last change time
2015-02-18T03:42:22Z
Keywords
ice, pull
Assigned to
nobody
Creator
sinkuupump

Comments

Comment #0 by sinkuupump — 2015-01-12T03:21:51Z
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 ()
Comment #1 by sinkuupump — 2015-01-12T04:27:56Z
> without error messages. This is a valid code. I meant ICE.
Comment #2 by k.hara.pg — 2015-01-12T04:49:45Z
Comment #3 by github-bugzilla — 2015-01-12T05:25:55Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/068ff4c676f21579253cb669b9179d060090923a fix Issue 13968 - constructing and returing union causes segfault https://github.com/D-Programming-Language/dmd/commit/62f7d41820b2ba06c9ccff0ee3c3302f2ede418c Merge pull request #4279 from 9rnsr/fix13968 [REG2.067a] Issue 13968 - constructing and returing union causes segfault
Comment #4 by github-bugzilla — 2015-02-18T03:42:22Z