968 – ICE on compile-time execution

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 968 - ICE on compile-time execution
Summary: ICE on compile-time execution
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 All
: P2 normal
Assignee: Walter Bright
URL:
Keywords: ice-on-invalid-code, ice-on-valid-code
: 970 (view as issue list)
Depends on:
Blocks:
Reported: 2007年02月15日 13:40 UTC by Frits van Bommel
Modified: 2014年02月16日 15:21 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Frits van Bommel 2007年02月15日 13:40:57 UTC
-----
// 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...
Comment 1 Frits van Bommel 2007年02月16日 14:46:38 UTC
*** Bug 970 has been marked as a duplicate of this bug. ***
Comment 2 Frits van Bommel 2007年02月16日 14:48:00 UTC
Pragma re-reported this for Windows, so I guess that makes it an OS-independent bug.
Comment 3 Walter Bright 2007年02月26日 19:27:31 UTC
Fixed DMD 1.007
Comment 4 Thomas Kühne 2007年03月11日 06:20:09 UTC
Added to DStress as
http://dstress.kuehne.cn/run/i/interpret_04_A.d 


AltStyle によって変換されたページ (->オリジナル) /