www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Phobos PR 2266 blocked by ICE 12057

reply "H. S. Teoh via Digitalmars-d" <digitalmars-d puremagic.com> writes:
Phobos pull request 2266 [1] has been blocked by an ICE (issue 12057
[2]) for almost a month now. I'm wondering if somebody more familiar
with dmd internals can help fix it.  I've managed to reduce the code
down to a minimal (or close to minimal) test case:

	// Compile with: dmd -O
	bool prop(real x) { return false; }
	double f(real) { return double.init; }
	void main()
	{
	    real fc = f(real.init);
	    if (fc == 0 || fc.prop) {}
	}

The bug goes away if -O is not specified. Looks like an optimizer bug.
However, I don't know enough about the backend to be able to proceed
from here. Can somebody help?

[1] https://github.com/D-Programming-Language/phobos/pull/2266
[2] https://issues.dlang.org/show_bug.cgi?id=12057


T

-- 
Give me some fresh salted fish, please.
Jul 20 2014
parent "Daniel Murphy" <yebbliesnospam gmail.com> writes:
"H. S. Teoh via Digitalmars-d"  wrote in message 
news:mailman.32.1405963928.32463.digitalmars-d puremagic.com...

 Phobos pull request 2266 [1] has been blocked by an ICE (issue 12057
 [2]) for almost a month now. I'm wondering if somebody more familiar
 with dmd internals can help fix it.  I've managed to reduce the code
 down to a minimal (or close to minimal) test case:
It looks like fixresult87 (which makes sure the result of an expression is in the correct register) sees you wanted a comparison result (mPSW) and that your value is not already in mPSW. It then asserts it's in ST0, which it isn't, presumably because it's in an xmm reg, and gives up. You could try just removing that assert (line 925) or modifying it to accept xmm regs, it looks like the line below at least considers them a possibility so who knows, it might work. If that doesn't work you could try checking for xmm regs and calling fixresult87 with 'retregs' modified to point to an xmm reg, so it tries to do a cross-bank copy. This is a crime against nature but it might work. Really only Walter knows how that stuff should work.
Jul 21 2014