Bug 17646 – dmd segfaults on missing foreach body in import

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-07-13T14:05:46Z
Last change time
2017-08-16T13:20:00Z
Keywords
pull
Assigned to
uplink.coder
Creator
John Colvin

Comments

Comment #0 by john.loughran.colvin — 2017-07-13T14:05:46Z
$ cat ut.d int main() { runTests!""; } int runTests(Modules...)() { import reflection; allTestData!Modules; } $ cat reflection.d struct TestData {} const(TestData)[] allTestData(MOD_STRINGS...)() { foreach (i; MOD_STRINGS) } $ gdb -q dmd Reading symbols from dmd...done. (gdb) r -o- ut.d Starting program: dmd -o- ut.d DMD v2.075.0-b4-102-gf189b2d08-dirty DEBUG reflection.d(4): Error: found '}' instead of statement Program received signal SIGSEGV, Segmentation fault. 0x0000000000637b63 in StatementSemanticVisitor::visit(ForeachStatement*) (this=0x7fffffff98d8, fs=0x7ffff6cb22d0) at ddmd/statementsem.d:742 742 st.push(fs._body.syntaxCopy()); (gdb) p fs._body $1 = (ddmd.statement.Statement *) 0x0 For some reason semantic is going ahead despite syntax having failed?
Comment #1 by uplink.coder — 2017-07-13T14:07:41Z
That should be an easy fix.
Comment #2 by uplink.coder — 2017-07-13T16:15:18Z
Comment #3 by dlang-bugzilla — 2017-07-15T04:47:57Z
Comment #4 by github-bugzilla — 2017-08-07T11:55:13Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/b25be458bebe59f773faf1c2f7bed57d9836ddea Fix Issue 17646 - dmd segfaults on missing [tuple] foreach body in import https://github.com/dlang/dmd/commit/9009c1f4e0798a5c6b1d4c37515e616f97a240a0 add regression test for Issue 17646 https://github.com/dlang/dmd/commit/a3927bd30b0bfbda2a1fe0e127b011e9c3470051 Merge pull request #6993 from UplinkCoder/fix17646_on_stable Fix Issue 17646 - dmd segfaults on missing [tuple] foreach body in import merged-on-behalf-of: Martin Nowak <[email protected]>
Comment #5 by github-bugzilla — 2017-08-16T13:20:00Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/b25be458bebe59f773faf1c2f7bed57d9836ddea Fix Issue 17646 - dmd segfaults on missing [tuple] foreach body in import https://github.com/dlang/dmd/commit/9009c1f4e0798a5c6b1d4c37515e616f97a240a0 add regression test for Issue 17646 https://github.com/dlang/dmd/commit/a3927bd30b0bfbda2a1fe0e127b011e9c3470051 Merge pull request #6993 from UplinkCoder/fix17646_on_stable