www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 825] New: dmd segmentation fault with large char[] template value parameter

reply d-bugmail puremagic.com writes:
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.


-- 
Jan 09 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=825






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.


-- 
Jan 09 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=825


bugzilla digitalmars.com changed:

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





Fixed DMD 1.001


-- 
Jan 27 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=825






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


-- 
Feb 15 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=825


thomas-dloop kuehne.cn changed:

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





*** Bug 698 has been marked as a duplicate of this bug. ***


-- 
Feb 27 2007