Zeno's Notes

...

Posts tagged compiler

4 notes

Mono 2.6.7 crash competition

When I compile the following code with Mono 2.6.7, the compiler crashes.

class V<T>
{
	T[] d;
	T this [int i]
	{
		get { return d[0]; }
	}
}

class C
{
	void M()
	{
		V<int> m;
		var x = m[0];
	}
}

It is a short piece of code (101 non-whitespace characters) that still can illustrate the problem.

But is it minimal (ignoring whitespace)? A little bit of playing around gave me this:

class V<T>
{
	T[] d;
	T this [int i]
	{
		get { return d[0]; }
	}
}

class C
{
	void M()
	{
		V<int> m;
		x = m[0];
	}
}

Just 98 characters! Can you come up with something smaller that triggers this bug? Something smaller that triggers another bug?

Filed under mono csharp golf dotnet cli crash compiler

16 notes

Csmith 2.0 has been released

Csmith is a tool that can generate random C programs that statically and dynamically conform to theĀ C99 standard. Thus, it is useful for stress-testing compilers, static analyzers, and other tools that process C code. Csmith has found bugs in every tool that it has tested, and over the last several years we have used it to find and report more than 350 previously-unknown compiler bugs.

Filed under C compiler testing C99