www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2229] New: Compiler crashes on invalid code

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2229

           Summary: Compiler crashes on invalid code
           Product: D
           Version: 2.017
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: samukha voliacable.com


T foo(A...)()
{
    return "";
}

void main()
{
    foo!(1, 2)(); // crashes when there is more than one parameter
}


-- 
Jul 16 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2229


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com
           Keywords|                            |ice-on-invalid-code
            Summary|Compiler crashes on invalid |Compiler crashes on trying
                   |code                        |to instantiate a variadic
                   |                            |template with values instead
                   |                            |of types




------- Comment #1 from smjg iname.com  2008-07-16 05:25 -------
Please remember to assign keywords to bug reports.  To everybody reading this:
Please look through issues you've reported and check for missing keywords.

Also, please avoid vague summary lines that could equally apply to many
unrelated bugs.  As a guide, if there exists a keyword that says what your
summary says, then the summary is too vague.


-- 
Jul 16 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2229


samukha voliacable.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Compiler crashes on trying  |Compiler crashes on trying
                   |to instantiate a variadic   |to instantiate a variadic
                   |template with values instead|template
                   |of types                    |




------- Comment #2 from samukha voliacable.com  2008-07-16 06:30 -------
Ok. Could the bugzilla ugliness be modified so that there is a combo from which
to select keywords? I keep forgetting their spelling.

I have changed the summary because the compiler crashes when the template is
parametrized with any tuple containing more than one element.


-- 
Jul 16 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2229





------- Comment #3 from samukha voliacable.com  2008-07-16 06:32 -------
*** Bug 2230 has been marked as a duplicate of this bug. ***


-- 
Jul 16 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2229





------- Comment #4 from smjg iname.com  2008-07-17 11:58 -------
(In reply to comment #2)
 Ok. Could the bugzilla ugliness be modified so that there is a combo from which
 to select keywords? I keep forgetting their spelling.

Really, a <select multiple> is what we want. I don't know whether there's an option in Bugzilla to do this, but it could probably be done by hacking the local installation. That said, the version of Bugzilla we're using here is far from current, so FAIK the best COA might be to upgrade. --
Jul 17 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2229





------- Comment #5 from dsimcha yahoo.com  2009-01-09 14:20 -------
*** Bug 2435 has been marked as a duplicate of this bug. ***


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


clugdbug yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|2.017                       |1.036




------- Comment #6 from clugdbug yahoo.com.au  2009-01-14 00:50 -------
Again, I note that this applies to D1.x as well
Test case from the closed bug 2345.
---
Foo foo(A...)()
{
}

static assert(foo!(1, 2)());


-- 
Jan 13 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2229


clugdbug yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |site.puremagic.com brianguer
                   |                            |tin.com




------- Comment #7 from clugdbug yahoo.com.au  2009-04-03 07:11 -------
*** Bug 2566 has been marked as a duplicate of this bug. ***


-- 
Apr 03 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2229


clugdbug yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Compiler crashes on trying  |ICE instantiating an invalid
                   |to instantiate an invalid   |variadic template with more
                   |variadic template with more |than one argument
                   |than one argument           |




------- Comment #8 from clugdbug yahoo.com.au  2009-04-03 07:15 -------
No longer segfaults.
---------
DMD 1.042:
Assertion failure: 'i < parameters->dim' on line 806 in file 'template.c'

abnormal program termination
-------
DMD2.027:
bug.d(1): Error: template fog.foo(A...) declaration A is already defined

which seems incorrect.


-- 
Apr 03 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2229


clugdbug yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug yahoo.com.au




------- Comment #9 from clugdbug yahoo.com.au  2009-04-03 08:13 -------
*** Bug 2555 has been marked as a duplicate of this bug. ***


-- 
Apr 03 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2229


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #10 from Don <clugdbug yahoo.com.au> 2009-09-12 11:50:02 PDT ---
This is actually really simple. 
ROOT CAUSE: The D1 logic in template.c,
TemplateDeclaration::deduceFunctionTemplateMatch() is completely wrong.
if (nargsi > parameters->dim) && tp, the assert in the for loop will definitely
fail.
PATCH (around line 797 of template.c):
==========
   if (targsi)
    {    // Set initial template arguments

    nargsi = targsi->dim;
+    size_t argsToUse = nargsi;
    if (nargsi > parameters->dim)
    {   if (!tp)
        goto Lnomatch;
        dedargs->setDim(nargsi);
        dedargs->zero();
+        argsToUse = parameters->dim;
    }

    memcpy(dedargs->data, targsi->data, nargsi * sizeof(*dedargs->data));

-    for (size_t i = 0; i < nargsi; i++)
+    for (size_t i = 0; i < argsToUse; i++)
    {   assert(i < parameters->dim);

This patch also fixes bug 1897.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 12 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2229


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


--- Comment #11 from Walter Bright <bugzilla digitalmars.com> 2009-10-13
13:51:09 PDT ---
Fixed dmd 1.049

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 13 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2229


Don <clugdbug yahoo.com.au> changed:

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


--- Comment #12 from Don <clugdbug yahoo.com.au> 2009-11-07 14:51:08 PST ---
The patch for this bug was incorrectly transcribed.

template.c, line 807.

-    memcpy(dedargs->data, targsi->data, n * sizeof(*dedargs->data));
+    memcpy(dedargs->data, targsi->data, nargsi * sizeof(*dedargs->data));


This is causing dstress case for bug 1144 to fail.
http://dstress.kuehne.cn/nocmpile/m/mixin_34_A.d

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 07 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2229


Don <clugdbug yahoo.com.au> changed:

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


--- Comment #13 from Don <clugdbug yahoo.com.au> 2009-11-07 22:43:31 PST ---
*** Issue 3482 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 07 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2229


Walter Bright <bugzilla digitalmars.com> changed:

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


--- Comment #14 from Walter Bright <bugzilla digitalmars.com> 2009-12-06
00:49:17 PST ---
Fixed dmd 1.053

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 06 2009