[Issue 5159] New: Segfault(interpret.c): calling a static function pointer variable in CTFE
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Nov 3 13:53:18 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5159
Summary: Segfault(interpret.c): calling a static function
pointer variable in CTFE
Product: D
Version: D1 & D2
Platform: Other
OS/Version: Windows
Status: NEW
Keywords: ice-on-invalid-code, patch
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: clugdbug at yahoo.com.au
--- Comment #0 from Don <clugdbug at yahoo.com.au> 2010-11-03 13:52:19 PDT ---
It's not yet possible to make a test case which should compile without error.
But this one segfaults on 2.050.
---
int function() bug5159 = function int() { return 27; };
static assert(bug5159());
---
PATCH: interpret.c, CallExp::interpret(), line 2715.
if (ecall->op == TOKstar)
{ // Calling a function pointer
Expression * pe = ((PtrExp*)ecall)->e1;
if (pe->op == TOKvar) {
VarDeclaration *vd = ((VarExp
*)((PtrExp*)ecall)->e1)->var->isVarDeclaration();
if (vd && vd->value && vd->value->op == TOKsymoff)
fd = ((SymOffExp *)vd->value)->var->isFuncDeclaration();
else {
- ecall = vd->value->interpret(istate);
+ ecall = getVarExp(loc, istate, vd);
+ if (ecall == EXP_CANT_INTERPRET)
+ return ecall;
if (ecall->op == TOKsymoff)
fd = ((SymOffExp *)ecall)->var->isFuncDeclaration();
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list