www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3919] New: Assertion failure: '0' on line 9944 in file 'expression.c'

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

           Summary: Assertion failure: '0' on line 9944 in file
                    'expression.c'
           Product: D
           Version: 2.041
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: crimson.magus gmail.com



PST ---
The error is in MulExp::semantic. It happens no matter if the multiplication
expression is in a template. These are the combinations that fail:

IF * ifloat
IF * IF
ID * idouble
ID * ID
IR * ireal
IR * IR


Here's a sample:

import std.stdio;

typedef ifloat IF;
typedef idouble ID;
typedef ireal IR;

template PrintAddedType(X, Y)
{
    void PrintAddedType()
    {
        X x;
        Y y;
        writeln( typeid( x ), " ", typeid( y ), " ", typeid( x * y ) );
    }
}

template PrintAddedType(X)
{
    void PrintAddedType()
    {
/*
        PrintAddedType!(X, ifloat)();
        PrintAddedType!(X, idouble)();
        PrintAddedType!(X, ireal)();
*/
/*
        PrintAddedType!(X, IF)();
        PrintAddedType!(X, ID)();
        PrintAddedType!(X, IR)();
*/
    }
}

void main()
{
/*
    PrintAddedType!(IF)();
    PrintAddedType!(ID)();
    PrintAddedType!(IR)();
*/
    IR x;
    IR y;
    writeln( typeid( x ), "\t", typeid( y ), "\t", typeid( x * y ) );
}

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |clugdbug yahoo.com.au
            Summary|Assertion failure: '0' on   |ICE(expression.c, 9944): *
                   |line 9944 in file           |or / with typedef ireal
                   |'expression.c'              |



Applies to D1 as well.
Reduced test case for test suite, for both this bug and the next one:
-------
typedef ireal BUG3919;
alias typeof(BUG3919.init*BUG3919.init) ICE3919;
alias typeof(BUG3919.init/BUG3919.init) ICE3920;
-------

Simple: It's not obtaining the base type before checking if it is an imaginary
type.

PATCH:
Expression.c MulExp::semantic, around line 9935.
Apply exactly the same to DivExp::semantic, around line 10003, to fix bug 3920.

    if (!e1->isArrayOperand())
    e1->checkArithmetic();
    if (!e2->isArrayOperand())
    e2->checkArithmetic();
    if (type->isfloating())
-    {    Type *t1 = e1->type;
-    Type *t2 = e2->type;
+    {    Type *t1 = e1->type->toBasetype();
+    Type *t2 = e2->type->toBasetype();

-- 
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=3919


Walter Bright <bugzilla digitalmars.com> changed:

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



20:52:58 PST ---
changeset 415

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


Don <clugdbug yahoo.com.au> changed:

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



Fixed DMD1.058 and 2.042.

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