Bug 15180 – [REG2.069.0-b1] Segfault with empty struct used as UDA

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Mac OS X
Creation time
2015-10-09T07:33:00Z
Last change time
2015-10-11T07:20:15Z
Keywords
ice
Assigned to
nobody
Creator
doob

Attachments

IDFilenameSummaryContent-TypeSize
15560001-Test-patch.patchTest patchapplication/mbox1266

Comments

Comment #0 by doob — 2015-10-09T07:33:04Z
The following code will result in "Segmentation fault: 11" on OS X: struct foo { } @foo bar () { } Backtrace: Process 73487 launched: '/Users/jacob/.dvm/compilers/dmd-2.069.0-b1/osx/bin/dmd' (x86_64) Process 73487 stopped * thread #1: tid = 0x554c57, 0x0000000100161921 dmd`objc_isUdaSelector(StructDeclaration*) + 9, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8) frame #0: 0x0000000100161921 dmd`objc_isUdaSelector(StructDeclaration*) + 9 dmd`objc_isUdaSelector(StructDeclaration*): -> 0x100161921 <+9>: movq 0x8(%rdi), %rax 0x100161925 <+13>: leaq 0x1b1dec(%rip), %rcx ; Id::udaSelector 0x10016192c <+20>: cmpq (%rcx), %rax 0x10016192f <+23>: jne 0x100161938 ; <+32> (lldb) bt * thread #1: tid = 0x554c57, 0x0000000100161921 dmd`objc_isUdaSelector(StructDeclaration*) + 9, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8) * frame #0: 0x0000000100161921 dmd`objc_isUdaSelector(StructDeclaration*) + 9 frame #1: 0x0000000100161887 dmd`objc_FuncDeclaration_semantic_setSelector(FuncDeclaration*, Scope*) + 175 frame #2: 0x00000001000b9276 dmd`FuncDeclaration::semantic2(Scope*) + 30 frame #3: 0x000000010000b0da dmd`AttribDeclaration::semantic2(Scope*) + 98 frame #4: 0x000000010000e076 dmd`UserAttributeDeclaration::semantic2(Scope*) + 94 frame #5: 0x0000000100061bfa dmd`Module::semantic2() + 90 frame #6: 0x00000001000f6abd dmd`tryMain(unsigned long, char const**) + 29045 frame #7: 0x0000000100002eeb dmd`_Dmain + 47 frame #8: 0x0000000100227158 dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 40 frame #9: 0x000000010022709d dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 45 frame #10: 0x00000001002270fd dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZv + 45 frame #11: 0x000000010022709d dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 45 frame #12: 0x0000000100227013 dmd`_d_run_main + 499 frame #13: 0x0000000100002f88 dmd`main + 20 frame #14: 0x00000001000013ed dmd`_start + 203 frame #15: 0x0000000100001321 dmd`start + 33
Comment #1 by k.hara.pg — 2015-10-09T09:35:25Z
Created attachment 1556 Test patch I cannot test the code in OSX, but I found some trivial bugs in src/objc.d. @Jacob can you test my patch in your local?
Comment #2 by doob — 2015-10-09T14:21:41Z
(In reply to Kenji Hara from comment #1) > @Jacob can you test my patch in your local? Yes, I'll give it a try.
Comment #3 by doob — 2015-10-09T19:58:54Z
It fixes the problem but causes an other regression, it fails to call Objective-C methods. There seems to be some other problem with the Objective-C support as well. It doesn't output the Objective-C special symbols in the object file. Is it possible to do a linking test? A test that passes if it fails to link and the output contains these special symbols.
Comment #4 by doob — 2015-10-09T20:13:43Z
(In reply to Jacob Carlborg from comment #3) > There seems to be some other problem with the > Objective-C support as well. It doesn't output the Objective-C special > symbols in the object file. > > Is it possible to do a linking test? A test that passes if it fails to link > and the output contains these special symbols. Never mind. It looks like it was never implemented.
Comment #5 by doob — 2015-10-10T11:38:22Z
Comment #6 by k.hara.pg — 2015-10-11T07:20:15Z