D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 17124 - dmd segfaults on __traits(getMember, ...)
Summary: dmd segfaults on __traits(getMember, ...)
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 All
: P1 major
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-27 13:36 UTC by John Colvin
Modified: 2022-11-14 14:27 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description John Colvin 2017-01-27 13:36:49 UTC
// test.d
alias BS = BSPu;
alias BS = BSPr;
template BSPu() { }
template BSPr() { }
enum blah = is(typeof(__traits(getMember, test, "BS")));

running `dmd test.d` segfaults, here's the backtrace:

* thread #1: tid = 0x42286e, 0x000000010008072e dmd`resolvePropertiesOnly(Scope*, Expression*) + 798, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8)
    frame #0: 0x000000010008072e dmd`resolvePropertiesOnly(Scope*, Expression*) + 798
dmd`resolvePropertiesOnly:
->  0x10008072e <+798>: cmpb   $0x5, 0x8(%rcx)
    0x100080732 <+802>: jne    0x100080797               ; <+903>
    0x100080734 <+804>: cmpl   $0x0, 0x7c(%rdi)
    0x100080738 <+808>: jne    0x10008074c               ; <+828>
(lldb) bt all
* thread #1: tid = 0x42286e, 0x000000010008072e dmd`resolvePropertiesOnly(Scope*, Expression*) + 798, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8)
  * frame #0: 0x000000010008072e dmd`resolvePropertiesOnly(Scope*, Expression*) + 798
    frame #1: 0x00000001000f1555 dmd`TypeTypeof::resolve(Loc, Scope*, Expression**, Type**, Dsymbol**, bool) + 213
    frame #2: 0x00000001000f1841 dmd`TypeTypeof::semantic(Loc, Scope*) + 65
    frame #3: 0x00000001000e25b2 dmd`Type::trySemantic(Loc, Scope*) + 66
    frame #4: 0x000000010009184e dmd`IsExp::semantic(Scope*) + 182
    frame #5: 0x00000001000cbdbe dmd`ExpInitializer::inferType(Scope*) + 38
    frame #6: 0x000000010003742e dmd`VarDeclaration::semantic(Scope*) + 334
    frame #7: 0x00000001000585de dmd`Module::semantic(Scope*) + 118
    frame #8: 0x00000001000df926 dmd`D4ddmd4mars7tryMainFmPPxaZi + 13494
    frame #9: 0x0000000100003273 dmd`_Dmain + 39
    frame #10: 0x00000001002438cc dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 40
    frame #11: 0x00000001002437f4 dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 32
    frame #12: 0x0000000100243871 dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZv + 45
    frame #13: 0x00000001002437f4 dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 32
    frame #14: 0x0000000100243767 dmd`_d_run_main + 459
    frame #15: 0x000000010000330c dmd`main + 16
    frame #16: 0x00000001000018b4 dmd`start + 52
Comment 1 basile-z 2017-01-28 04:04:34 UTC
Neither 2.073 nor 2.074 alpha, with linux x86_64, crash with your code.
Did you forget a line of code or something else ?
Comment 2 Martin Krejcirik 2017-03-29 14:58:13 UTC
Can't reproduce it, either. Reopen, if new information.
Comment 3 zoujiaqing 2020-07-05 10:13:27 UTC
how to fix it?
Comment 4 zoujiaqing 2020-07-05 10:14:19 UTC
This issue needed : https://github.com/huntlabs/hunt-framework/issues/153
Comment 5 Heromyth 2020-07-05 11:57:13 UTC
See here: https://issues.dlang.org/show_bug.cgi?id=21008.
Comment 6 RazvanN 2022-11-14 14:27:07 UTC
I also cannot reproduce this. Why was this reopened?