[dmd-internals] runnable/interpret.d + -O == failure

Brad Roberts braddr at puremagic.com
Thu Oct 21 01:32:15 PDT 2010


On 10/21/2010 1:18 AM, Don Clugston wrote:
> The compiler has just got better at detecting errors!
> There's something wrong with the tests in that file (there are
> multiple instances of Compileable, and they're all wrong!). Here's a
> fixed one.

Walter changed it to run with -O with his recent change, it used to be excluded
(no idea why, it started that way with the oldest version of the dmd test suite
I have a copy of).  I tromped back through dmd svn history quite a ways and it
doesn't look like -O and that test have ever gotten along (I stopped at around
r500 as old enough to not care if it's a regression or not).

Did you intend this new version of interpret.d to be checked in or just as a
demo of what's wrong with it.  I'm mostly asking about the manual inlining of
badfoo2 into the static assert.

I can confirm that this change to the test fixes that specific problem, though
it just moves a little further into the file and dies on:

runnable/interpret.d(2109): Error: variable w used before set

int goodfoo3()
{
   S[4] w = void; // uninitialized array of structs
   w[$-2].x = 217; // initialize one member
   return w[2].x; // <-- line 2109
}
static assert(goodfoo3()==217);

Same scenario, passes everything up to the first time -O is included in the
compiler args.

Walter, this is one of the reasons I groaned when you told me you hadn't
actually TESTED the change you made to the new test suite.  Shame shame shame on
you.



More information about the dmd-internals mailing list