3304 – Segfault using 'is' with a pointer enum.

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3304 - Segfault using 'is' with a pointer enum.
Summary: Segfault using 'is' with a pointer enum.
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 major
Assignee: No Owner
URL:
Keywords: ice-on-invalid-code, patch
Depends on:
Blocks:
Reported: 2009年09月07日 07:47 UTC by Don
Modified: 2015年06月09日 01:20 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 Don 2009年09月07日 07:47:24 UTC
This is the first bug from bug 3293.
Test case:
---
enum bug3303 = cast(void*)0xFEFEFEFE;
static assert(bug3303 is bug3303);
---
Crashes because e->optimize() is returning NULL. Bug has existed in at least 2.022 to 2.032.
Comment 1 Don 2009年09月07日 08:00:17 UTC
Root cause: IndentityExp didn't consider the possibility that Equals() can return CANTINTERPRET.
patch: In optimize.c, IdentityExp::optimize, line 838 (DMD2.032)
 if ((this->e1->isConst() && this->e2->isConst()) ||
	(this->e1->op == TOKnull && this->e2->op == TOKnull))
 {
	e = Identity(op, type, this->e1, this->e2);
+	if (e == EXP_CANT_INTERPRET)
+	 e = this;
 }
 return e;
Comment 2 Walter Bright 2009年10月06日 02:17:43 UTC
Fixed dmd 1.048 and 2.033


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