www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 968] New: ICE on compile-time execution

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

           Summary: ICE on compile-time execution
           Product: D
           Version: 1.006
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: ice-on-invalid-code, ice-on-valid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: fvbommel wxs.nl


-----
// Slightly modified from example provided by 
// Walter upon introduction of v1.006
import std.stdio;

real test(real x)
{
    real root = x / 2;
    for (int ntries = 0; ntries < 5 || true; ntries++) {
        root = (root + x / root) / 2;
    }
    return root;
}

void main()
{
   static x = test();
}
-----
Error checking could be improved here, this gives:
---
test.d(15): function test.test (real) does not match parameter types ()
test.d(15): Error: expected 1 arguments, not 0
dmd: interpret.c:96: Expression* FuncDeclaration::interpret(Expressions*):
Assertion `parameters && parameters->dim == dim' failed.
Aborted (core dumped)
---
It tells you what's wrong, but still trips an assert that seems to be about the
same error. However:
-----
real test()
{
    return 0.0;
}

void main()
{
   static x = test();
}
-----
it still gives:
---
dmd: interpret.c:96: Expression* FuncDeclaration::interpret(Expressions*):
Assertion `parameters && parameters->dim == dim' failed.
Aborted (core dumped)
---
The same assert is tripped, but I don't see why this would even be invalid
code.

So I don't know, maybe it's a different bug entirely. Or it tripped the other
clause of the assert. I don't feel like inspecting interpret.c to find out what
exactly the assert is checking and why it's false...


-- 
Feb 15 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=968


fvbommel wxs.nl changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ericanderton yahoo.com





*** Bug 970 has been marked as a duplicate of this bug. ***


-- 
Feb 16 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=968


fvbommel wxs.nl changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|Linux                       |All





Pragma re-reported this for Windows, so I guess that makes it an OS-independent
bug.


-- 
Feb 16 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=968


bugzilla digitalmars.com changed:

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





Fixed DMD 1.007


-- 
Feb 26 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=968






Added to DStress as
http://dstress.kuehne.cn/run/i/interpret_04_A.d


-- 
Mar 11 2007