January 09, 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@digitalmars.com
        ReportedBy: kamm@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.


-- 

January 09, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=825





------- Comment #1 from shro8822@uidaho.edu  2007-01-09 12:25 -------
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.


-- 

January 28, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=825


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #2 from bugzilla@digitalmars.com  2007-01-27 18:56 -------
Fixed DMD 1.001


-- 

February 15, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=825





------- Comment #3 from thomas-dloop@kuehne.cn  2007-02-15 03:42 -------
Added to DStress as http://dstress.kuehne.cn/run/l/large_id_02_A.d http://dstress.kuehne.cn/run/l/large_id_02_B.d


-- 

February 28, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=825


thomas-dloop@kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |funisher@gmail.com




------- Comment #4 from thomas-dloop@kuehne.cn  2007-02-27 18:36 -------
*** Bug 698 has been marked as a duplicate of this bug. ***


-- 

Top | Discussion index | About this forum | D home