Bug 825 – dmd segmentation fault with large char[] template value parameter

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2007-01-09T11:31:00Z
Last change time
2014-02-15T13:12:55Z
Keywords
ice-on-valid-code
Assigned to
bugzilla
Creator
kamm-removethis

Comments

Comment #0 by kamm-removethis — 2007-01-09T11:31:24Z
void bug(char[] string)() { writefln(string); writefln(string.length); } void main() { bug!("12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012")(); // I think the argument has 452 characters.. } compiles. Add one more character to the template value argument, and the linker returns the error bug.d:(.gnu.linkonce.t_Dmain+0x4): undefined reference to `_D3bug925__T3bugVG453aa453_31323637383930313 ...snip... 23334353637383930313233Z3bugFZv' Add another character and dmd crashes with: semantic3 bug code bug function main function bug Segmentation fault This actually came up in practice when using BCS' template parser generator, which takes the gammar as a template value parameter. Complex grammars will easily exceed the 452 character limitation.
Comment #1 by shro8822 — 2007-01-09T12:25:52Z
You can sidestep the issue to some extent, I have updated the parser generator to do this. It basicly only uses the huge parameter in the mixin its self not the underlying template. http://www.webpages.uidaho.edu/~shro8822/dparse.d BTW I'm glad to see that dparse is being used, and would be interested in hearing about it.
Comment #2 by bugzilla — 2007-01-27T18:56:43Z
Fixed DMD 1.001
Comment #3 by thomas-dloop — 2007-02-15T03:42:25Z
Comment #4 by thomas-dloop — 2007-02-27T18:36:34Z
*** Bug 698 has been marked as a duplicate of this bug. ***