www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3884] New: Segfault: typedef present when passing array in tuple argument to function template

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

           Summary: Segfault: typedef present when passing array in tuple
                    argument to function template
           Product: D
           Version: 1.056
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: matti.niemenmaa+dbugzilla iki.fi



2010-03-06 00:54:56 PST ---
The following code causes DMD 1.056 to segfault:


typedef int X;
X[] a;

void f() { g(a); }

void g(T...)(T x) {}


Using int[] instead of X[] works.

However, interestingly enough, keeping the typedef but using an int[] also
causes a segfault, even though the typedef is unused:


typedef int X;
int[] a;

void f() { g(a); }

void g(T...)(T x) {}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 06 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3884


Don <clugdbug yahoo.com.au> changed:

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



I cannot reproduce the bug on either 1.055 or 1.057 Windows, nor on D2. Is
there something missing from the test case?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 10 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3884


Matti Niemenmaa <matti.niemenmaa+dbugzilla iki.fi> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ice-on-valid-code           |ice-on-invalid-code
            Summary|Segfault: typedef present   |Segfault: defining a
                   |when passing array in tuple |typedef with an invalid
                   |argument to function        |object.d
                   |template                    |



2010-03-11 02:34:40 PST ---
Took me a while to reproduce it again myself. It's quite different from what I
reported: I had an invalid object.d in the working directory, which triggers
it. It seems the typedef alone is enough, the array and tuple business is
unneeded:

$ cat arst.d
typedef int X;
$ dmd -c arst.d
[no errors]
$ touch object.d
$ dmd -c arst.d 
E: Child terminated by signal ‘Segmentation fault’

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 11 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3884


Don <clugdbug yahoo.com.au> changed:

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



This is really obscure, but here's a patch:
typeinf.c, line 108:

Expression *Type::getTypeInfo(Scope *sc)
{
    Expression *e;
    Type *t;
+    if (!Type::typeinfo)
+    {
+    error(0, "TypeInfo not found. object.d may be incorrectly installed or
corrupt");
+    return new ErrorExp();
+    }

    //printf("Type::getTypeInfo() %p, %s\n", this, toChars());

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 16 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3884


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com



14:29:22 PDT ---
changeset 426

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 28 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3884


Don <clugdbug yahoo.com.au> changed:

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



Fixed DMD1.058 and 2.043.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 09 2010