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


--- Comment #0 from Matti Niemenmaa <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


--- Comment #1 from Don <clugdbug yahoo.com.au> 2010-03-10 23:58:17 PST ---
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                    |


--- Comment #2 from Matti Niemenmaa <matti.niemenmaa+dbugzilla iki.fi>
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


--- Comment #3 from Don <clugdbug yahoo.com.au> 2010-03-16 01:02:39 PDT ---
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


--- Comment #4 from Walter Bright <bugzilla digitalmars.com> 2010-03-28
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


--- Comment #5 from Don <clugdbug yahoo.com.au> 2010-04-09 13:40:48 PDT ---
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