Bug 8337 – using contracts on an interface makes the compiler frontend segfault

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2012-07-02T14:19:00Z
Last change time
2013-10-06T23:29:32Z
Keywords
ice
Assigned to
nobody
Creator
w

Comments

Comment #0 by w — 2012-07-02T14:19:26Z
Hi, Not sure if this is specific to D2, x86_64 or Linux (since I haven't tried it anywhere else), but I found that a bit of code which I had written made the compiler frontend segfault. I'm quite sure it's the frontend, since both gdc and dmd would segfault. After running the code in question through dustmite, this is what came out of it: interface Edge { int estimate() out{ } } class DefaultEdge : Edge { int estimate() out{ } body{ } } class DefaultDownEdge : DefaultEdge { int estimate() out{ } body{ } } After removing the out contract on the interface, neither compiler will segfault anymore. I don't know whether adding contracts on an interface is allowed in the first place (I've only been doing this D thing for a few weeks), but if so it should issue an error message, not crash :-)
Comment #1 by clugdbug — 2012-07-03T00:50:10Z
Looks similar to bug 7883 and bug 8292.
Comment #2 by bugzilla — 2013-10-06T23:29:32Z
Updating the code to: --------- interface Edge { int estimate() out{ } } class DefaultEdge : Edge { int estimate() out{ } body{ return 1; } } class DefaultDownEdge : DefaultEdge { override int estimate() out{ } body{ return 1; } } ---------------- and it compiles without error with dmd 2.064 head.