Bug 8664 – Compiler causes stack overflow with recursive typedef and option -g

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-09-15T05:19:00Z
Last change time
2013-11-16T02:42:24Z
Keywords
ice, pull
Assigned to
nobody
Creator
r.sagitario

Comments

Comment #0 by r.sagitario — 2012-09-15T05:19:38Z
The file fail4.d from the dmd test suite causes a stack overflow when generating debug information at the same time. The code is typedef foo bar; typedef bar foo; Without "-g" on the command line, dmd reports: test.d(3): Error: typedef test.foo circular definition If dmd is compiled with the Microsoft compiler instead of dmc, this function type *TypeTypedef::toCtype() { return sym->basetype->toCtype(); } in toctype.c is tail recursion optimized, which results in a freeze. The problem does not happen with "alias", because the recursion is dealt with in the front end: test.d(2): Error: alias test.bar recursive alias declaration
Comment #1 by bugzilla — 2013-11-15T22:52:27Z
Comment #2 by github-bugzilla — 2013-11-16T02:22:07Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/e248270405b8b572115e0474180b258a0d2b73a0 fix Issue 8664 - Compiler causes stack overflow with recursive typedef and option -g https://github.com/D-Programming-Language/dmd/commit/a4319e8383c4a78ef32f51e5e1175cb27439b4e9 Merge pull request #2777 from WalterBright/fix8664 fix Issue 8664 - Compiler causes stack overflow with recursive typedef and option -g