www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3336] New: Attempting to compile this file with the '-g' flag crashes the compiler with an assertion failure.

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

           Summary: Attempting to compile this file with the '-g' flag
                    crashes the compiler with an assertion failure.
           Product: D
           Version: 2.032
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: blood.of.life gmail.com


--- Comment #0 from Bernard Helyer <blood.of.life gmail.com> 2009-09-20
21:16:10 PDT ---
File is attached. You don't need to be able to link (and won't be able to), but
compiling it with `dmd main.d -c -g` causes an assertion failure:

    $ dmd main.d -c -g
    dmd: glue.c:958: virtual unsigned int Type::totym(): Assertion `0' failed.
    Aborted

However, using `-gc` works fine:

    $ dmd main.d -c -gc
    $

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



--- Comment #1 from Bernard Helyer <blood.of.life gmail.com> 2009-09-20
21:17:45 PDT ---
Created an attachment (id=462)
Source file that causes compiler to crash.

Main entry to my roguelike; the context is not important.

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE(glue.c) when compiled   |ICE(glue.c) when compiled
                   |with -g                     |with -g [NO TEST CASE]


--- Comment #2 from Don <clugdbug yahoo.com.au> 2009-09-22 06:16:01 PDT ---
This cannot be compiled. It imports a whole bunch of files which are not
attached.
Please provide a complete test case.

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



--- Comment #3 from Bernard Helyer <blood.of.life gmail.com> 2009-09-22
06:38:05 PDT ---
Oops, sorry I didn't think that through. 

Okay, rolling back to the commit that triggered the bug... and it's no longer
triggered (and it was reliably when I submitted it). Nevermind, 'cannot
reproduce' I guess. Bizarre.

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



--- Comment #4 from Don <clugdbug yahoo.com.au> 2009-09-22 07:06:43 PDT ---
If it's like the other ICE(glue.c) bug which is currently open, it might be
compile-order dependent. Otherwise, please close as invalid.

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


Bernard Helyer <blood.of.life gmail.com> changed:

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


--- Comment #5 from Bernard Helyer <blood.of.life gmail.com> 2009-09-22
07:17:50 PDT ---
Jimmied around a bit; no luck. If it comes up again I'll pay closer attention.

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


Bernard Helyer <blood.of.life gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #462 is|0                           |1
           obsolete|                            |


--- Comment #6 from Bernard Helyer <blood.of.life gmail.com> 2009-09-22
08:43:46 PDT ---
Created an attachment (id=463)
Entire project, run make; should fail with same assertion as before.

I figured it out; I had uncommited changes which I had reverted to post the
project -- once I re-added them, the problem came back. In level.d:

alias TypeTuple!(int, int) Coordinate;

...


    Creature[Coordinate] mCreatureMap;   // <-- Remove this line and the
compiler doesn't crash.

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


Bernard Helyer <blood.of.life gmail.com> changed:

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


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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|2.032                       |1.00
            Summary|ICE(glue.c) when compiled   |ICE(glue.c) declaring AA
                   |with -g [NO TEST CASE]      |with tuple key, only with
                   |                            |-g
         OS/Version|Linux                       |All


--- Comment #7 from Don <clugdbug yahoo.com.au> 2009-09-23 00:38:42 PDT ---
I reduced that 1MB test case down to 3 lines <g>:

template Tuple(T...){
    alias T Tuple;
}

int[ Tuple!(int) ] foo;

---------
Segfaults on D1, as well; also happens on Windows as well as Linux.
Curiously, this didn't segfault on 1.010 and earlier, but segfaults on 1.020.
But I believe it was bad code generation on those early compilers, so not a
regression.

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #463 is|0                           |1
           obsolete|                            |


--- Comment #8 from Don <clugdbug yahoo.com.au> 2009-09-23 00:39:21 PDT ---
(From update of attachment 463)
This attachment is now obsolete.

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ice-on-valid-code           |accepts-invalid,
                   |                            |ice-on-invalid-code


--- Comment #9 from Don <clugdbug yahoo.com.au> 2009-09-23 05:52:50 PDT ---
This is ice-on-invalid: the key of an AA must be a type. Although the
declaration is accepted when the -g flag isn't used, that's also a bug. It's
pretty meaningless -- there's no way to put anything into the AA! The
declaration should be rejected.

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


Don <clugdbug yahoo.com.au> changed:

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


--- Comment #10 from Don <clugdbug yahoo.com.au> 2009-09-24 00:45:31 PDT ---
PATCH: This is very easy. Just disallow tuples as AA keys.

In mtype.c, in Type *TypeAArray::semantic(Loc loc, Scope *sc), at line 3293:

    switch (index->toBasetype()->ty)
    {
    case Tbool:
    case Tfunction:
    case Tvoid:
    case Tnone:
+    case Ttuple:
        error(loc, "can't have associative array key of %s",
index->toBasetype()->toChars());
        break;
    }


And here's a test case for the test suite. Should compile without error.
---
template Tuple(T...){
    alias T Tuple;
}
// Bugzilla 3336
static assert(!is(int[ Tuple!(int, int) ]));

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


Walter Bright <bugzilla digitalmars.com> changed:

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


--- Comment #11 from Walter Bright <bugzilla digitalmars.com> 2009-10-06
02:18:55 PDT ---
Fixed dmd 1.048 and 2.033

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