Thread overview
[phobos] Commit 1717 broke Phobos unittests
Aug 06, 2010
Don Clugston
Aug 06, 2010
SHOO
Aug 06, 2010
Don Clugston
Aug 06, 2010
Don Clugston
August 06, 2010
conv.d, in the parse function for floating point numbers:
Target parse(Target, Source)(ref Source p) if (isInputRange!Source &&
/*!isSomeString!Source && */isFloatingPoint!Target)

The offending line is line 1360:
enforce(anydigits);

This is wrong; it should be throwing ConvError. This makes the unittests in line 2257, 2312, 2380 fail.

In fact, most of the other uses of enforce() in this function should probably be throwing a ConvError.
August 07, 2010
I noticed the bug of the test, too. (But, I didn't analyze it deeply.)

In Windows (Vista), unittest reports an error:

------------------------
make -f win32.mak unittest
...
core.exception.AssertError at std.container(1262): Assertion failure
------------------------

And, cov option doesn't work.

------------------------
make -f win32.mak cov
...
Error 42: Symbol Undefined _D3std9intrinsic12__ModuleInfoZ
------------------------

Is there a person in whom the same problem as me happens?

2010/8/6 Don Clugston <dclugston at googlemail.com>:
> conv.d, in the parse function for floating point numbers:
> Target parse(Target, Source)(ref Source p) if (isInputRange!Source &&
> /*!isSomeString!Source && */isFloatingPoint!Target)
>
> The offending line is line 1360:
> enforce(anydigits);
>
> This is wrong; it should be throwing ConvError. This makes the unittests in line 2257, 2312, 2380 fail.
>
> In fact, most of the other uses of enforce() in this function should
> probably be throwing a ConvError.
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
>
August 06, 2010
Yes, there's a second bug in std.container. The copy constructor gets called erroneously. I didn't track that one down.

On 6 August 2010 17:21, SHOO <zan77137 at nifty.com> wrote:
> I noticed the bug of the test, too. (But, I didn't analyze it deeply.)
>
> In Windows (Vista), unittest reports an error:
>
> ------------------------
> make -f win32.mak unittest
> ...
> core.exception.AssertError at std.container(1262): Assertion failure
> ------------------------
>
> And, cov option doesn't work.
>
> ------------------------
> make -f win32.mak cov
> ...
> Error 42: Symbol Undefined _D3std9intrinsic12__ModuleInfoZ
> ------------------------
>
> Is there a person in whom the same problem as me happens?
>
> 2010/8/6 Don Clugston <dclugston at googlemail.com>:
>> conv.d, in the parse function for floating point numbers:
>> Target parse(Target, Source)(ref Source p) if (isInputRange!Source &&
>> /*!isSomeString!Source && */isFloatingPoint!Target)
>>
>> The offending line is line 1360:
>> enforce(anydigits);
>>
>> This is wrong; it should be throwing ConvError. This makes the unittests in line 2257, 2312, 2380 fail.
>>
>> In fact, most of the other uses of enforce() in this function should
>> probably be throwing a ConvError.
>> _______________________________________________
>> phobos mailing list
>> phobos at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/phobos
>>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
>
August 06, 2010
That is a bug in the compiler. The compiler should never copy the return of a stack variable or parameter - it should just bitblt them. That's not an optimization, it's a language definition thing.

Andrei

Don Clugston wrote:
> Yes, there's a second bug in std.container. The copy constructor gets called erroneously. I didn't track that one down.
> 
> On 6 August 2010 17:21, SHOO <zan77137 at nifty.com> wrote:
>> I noticed the bug of the test, too. (But, I didn't analyze it deeply.)
>>
>> In Windows (Vista), unittest reports an error:
>>
>> ------------------------
>> make -f win32.mak unittest
>> ...
>> core.exception.AssertError at std.container(1262): Assertion failure
>> ------------------------
>>
>> And, cov option doesn't work.
>>
>> ------------------------
>> make -f win32.mak cov
>> ...
>> Error 42: Symbol Undefined _D3std9intrinsic12__ModuleInfoZ
>> ------------------------
>>
>> Is there a person in whom the same problem as me happens?
>>
>> 2010/8/6 Don Clugston <dclugston at googlemail.com>:
>>> conv.d, in the parse function for floating point numbers:
>>> Target parse(Target, Source)(ref Source p) if (isInputRange!Source &&
>>> /*!isSomeString!Source && */isFloatingPoint!Target)
>>>
>>> The offending line is line 1360:
>>> enforce(anydigits);
>>>
>>> This is wrong; it should be throwing ConvError. This makes the unittests in line 2257, 2312, 2380 fail.
>>>
>>> In fact, most of the other uses of enforce() in this function should
>>> probably be throwing a ConvError.
>>> _______________________________________________
>>> phobos mailing list
>>> phobos at puremagic.com
>>> http://lists.puremagic.com/mailman/listinfo/phobos
>>>
>> _______________________________________________
>> phobos mailing list
>> phobos at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/phobos
>>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
August 06, 2010
I'll take care of that today. I also plan to sort out all phobos issues and provide a clean build. I think I tracked down what was causing crashes earlier - pasing a "string literal" by ref compiles (it shouldn't) and generates erroneous code.

Andrei

Don Clugston wrote:
> conv.d, in the parse function for floating point numbers:
> Target parse(Target, Source)(ref Source p) if (isInputRange!Source &&
> /*!isSomeString!Source && */isFloatingPoint!Target)
> 
> The offending line is line 1360:
> enforce(anydigits);
> 
> This is wrong; it should be throwing ConvError. This makes the unittests in line 2257, 2312, 2380 fail.
> 
> In fact, most of the other uses of enforce() in this function should
> probably be throwing a ConvError.
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
August 06, 2010
Do you have a reduced test case? It's happening in Array!bool, after
the end of the first unittest which calls insertBack(). That happens
to be the unittest after empty().

I've been working on the wrong-code compiler bugs. This seems to be one of the worst.

On 6 August 2010 17:52, Andrei Alexandrescu <andrei at erdani.com> wrote:
> That is a bug in the compiler. The compiler should never copy the return of a stack variable or parameter - it should just bitblt them. That's not an optimization, it's a language definition thing.
>
> Andrei
August 08, 2010
I do. After you svn up your tree, try this code:

import std.conv;

// @@@BUG@@@ the size of China
void main() {
     auto i = 2;
     assert(parse!int("0",i) == 0);
}

The code should not even compile because it passes a string literal by reference. It segfaults.


Andrei

On 08/06/2010 01:22 PM, Don Clugston wrote:
> Do you have a reduced test case? It's happening in Array!bool, after
> the end of the first unittest which calls insertBack(). That happens
> to be the unittest after empty().
>
> I've been working on the wrong-code compiler bugs. This seems to be one of the worst.
>
> On 6 August 2010 17:52, Andrei Alexandrescu<andrei at erdani.com>  wrote:
>> That is a bug in the compiler. The compiler should never copy the return of a stack variable or parameter - it should just bitblt them. That's not an optimization, it's a language definition thing.
>>
>> Andrei
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
August 08, 2010
OK, thanks. Just committed a fix.

Andrei

On 08/06/2010 08:25 AM, Don Clugston wrote:
> conv.d, in the parse function for floating point numbers:
> Target parse(Target, Source)(ref Source p) if (isInputRange!Source&&
> /*!isSomeString!Source&&  */isFloatingPoint!Target)
>
> The offending line is line 1360:
> enforce(anydigits);
>
> This is wrong; it should be throwing ConvError. This makes the unittests in line 2257, 2312, 2380 fail.
>
> In fact, most of the other uses of enforce() in this function should
> probably be throwing a ConvError.
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos