[Issue 825] New: dmd segmentation fault with large char[] template value parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 9 09:31:26 PST 2007


http://d.puremagic.com/issues/show_bug.cgi?id=825

           Summary: dmd segmentation fault with large char[] template value
                    parameter
           Product: D
           Version: 1.00
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: kamm at incasoftware.de


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.


-- 



More information about the Digitalmars-d-bugs mailing list