D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 17632 - [REG 2.075-b1] opBinary and delegate code generation
Summary: [REG 2.075-b1] opBinary and delegate code generation
Status: RESOLVED DUPLICATE of issue 17622
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P3 regression
Assignee: No Owner
URL:
Keywords: ice, wrong-code
Depends on:
Blocks:
 
Reported: 2017-07-10 18:38 UTC by briancschott
Modified: 2017-08-15 22:06 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description briancschott 2017-07-10 18:38:59 UTC
The following code executes successfully with 2.074.1 but segmentation faults with 2.075.0-b4:

----------------------------------------------------

import std.stdio;

struct Test
{
	void delegate() testBody;
	Exception unexpected;

	void opBinary(string op)(void delegate() fun)
	{
		testBody = fun;

		// Call it
		try
			testBody();
		catch (Exception ex)
			unexpected = ex;
	}
}

struct URL
{
	string fragment;

}

struct JsonCube
{
	URL dataURL;
}

struct JsonCubeDef
{
	JsonCube _def;
	this(string)
	{
	}
}

immutable TEST_JSON = `{}`;

void main()
{
	auto def = cast(immutable) JsonCubeDef(TEST_JSON);

	Test() in
	{ writeln(def); };
}
Comment 1 Vladimir Panteleev 2017-07-10 19:44:41 UTC
Introduced by https://github.com/dlang/dmd/pull/6852
Comment 2 Martin Nowak 2017-07-14 13:05:51 UTC
We'll address this with 2.075.1 to not delay the release even further.
Comment 3 Walter Bright 2017-08-02 09:03:05 UTC
I cannot reproduce this. What switches are used?

Anyhow, it appears to be the same issue as 17622.
Comment 4 briancschott 2017-08-02 09:20:39 UTC
I don't have to pass any switches to cause this behavior:

$ which rdmd
/home/brian/.dvm/compilers/dmd-2.075.0/linux/bin/rdmd
$ rdmd test.d
Segmentation fault

Running on 64-bit Linux.
Comment 5 Martin Nowak 2017-08-03 17:05:56 UTC

*** This issue has been marked as a duplicate of issue 17622 ***
Comment 6 briancschott 2017-08-15 22:06:18 UTC
I can confirm that this bug no longer happens in Emsi's code with 2.075.1.