6997 – 64bit optimizer bug

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6997 - 64bit optimizer bug
Summary: 64bit optimizer bug
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Linux
: P2 normal
Assignee: No Owner
URL:
Keywords: wrong-code
Depends on:
Blocks:
Reported: 2011年11月23日 13:21 UTC by timon.gehr
Modified: 2011年11月24日 13:58 UTC (History)
2 users (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 timon.gehr 2011年11月23日 13:21:40 UTC
long fun(long a,long b,long c){
	return a<b?a<c?a:b<c?b:c:b;
}
long baz(long a, long b){
	bool s=(a<0)!=(b<0);
	a = a>0?a:-a;
	return s ? a : a;
}
struct R{
	ulong bar, qux;
	bool c;
	R foo(){
		if(!c){
			long a = baz(bar, 0),
			 b = baz(bar, 0),
			 c = baz(bar, 0);
			return R(fun(a,b,c), fun(a,b,c));
		}
		return R();
	}
}
void main(){auto x=R().foo();}
when compiled with dmd -O -release -inline (64bit), the program fails with a segfault during runtime on my machine. Removing any of the flags makes it run through.
Comment 1 Martin Nowak 2011年11月23日 19:12:29 UTC
https://github.com/D-Programming-Language/dmd/pull/528 


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