[Issue 16579] New: ReturnStatement[CallExp(DotVarExp)]: Corrupted runtime on missed manifest constant propagation
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Oct 3 01:48:54 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=16579
Issue ID: 16579
Summary: ReturnStatement[CallExp(DotVarExp)]: Corrupted runtime
on missed manifest constant propagation
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: ibuclaw at gdcproject.org
Probably related to issue 16576, if not identical (just another angle of the
same issue).
Working example:
---
struct Thing
{
enum Instance = Thing();
int a = 42;
void iter()
{
import std.stdio;
writeln(this.a); // Prints "42"
}
}
void main()
{
Thing.Instance.iter;
}
---
Broken example:
---
struct Thing
{
enum Instance = Thing();
int a = 42;
void iter()
{
import std.stdio;
writeln(this.a); // Prints "0"
}
}
void main()
{
return Thing.Instance.iter; // Added 'return'
}
---
In the bad code, the frontend gives us a CallExp for:
Instance.iter()
In the good code, the frontend gives us a CallExp for:
Thing().iter()
So it looks on the surface that constfold has missed a case where it should
have propagated the manifest 'Instance' into a literal 'Thing()'.
--
More information about the Digitalmars-d-bugs
mailing list