Thread overview
[phobos] phobos commit, revision 2116
Oct 25, 2010
dsource.org
Oct 25, 2010
Walter Bright
Oct 25, 2010
Don Clugston
Oct 25, 2010
Walter Bright
Oct 25, 2010
Don Clugston
Oct 25, 2010
Walter Bright
October 25, 2010
phobos commit, revision 2116


user: Don Clugston

msg:
Fix for BigInt assign for 64 bit compilers. Also a few steps towards const correctness, and some comment fixes.

http://www.dsource.org/projects/phobos/changeset/2116

October 25, 2010

dsource.org wrote:
> phobos commit, revision 2116
>
>
> user: Don Clugston
>
> msg:
> Fix for BigInt assign for 64 bit compilers. Also a few steps towards const correctness, and some comment fixes.
>
> http://www.dsource.org/projects/phobos/changeset/2116
>
> 

Still dies (OSX only):


core.exception.AssertError at std.bigint(481): unittest failure
----------------
5   bigint                              0x0000a918 onAssertErrorMsg + 68
6   bigint                              0x0000a95a onUnittestErrorMsg + 26
7   bigint                              0x00011f99 _d_unittestm + 45
8   bigint                              0x00001f03 void
std.bigint.__unittest_fa
il(int) + 35
9   bigint                              0x00002714 void
std.bigint.__unittest1()
 + 744
10  bigint                              0x00001e8b void
std.bigint.__modtest() +
 11
11  bigint                              0x0000ad25 extern (C) bool
core.runtime.
runModuleUnitTests() + 45
12  bigint                              0x00005b47
D6object10ModuleInfo7opApplyF
MDFKPS6object10ModuleInfoZiZi + 71
13  bigint                              0x0000ac16 runModuleUnitTests + 134
14  bigint                              0x00012302 extern (C) int
rt.dmain2.main
(int, char**) + 38
15  bigint                              0x00012206 extern (C) int
rt.dmain2.main
(int, char**) + 42
16  bigint                              0x00012193 main + 179
17  bigint                              0x00001e6d start + 53
make[2]: *** [generated/osx/debug/unittest/std/bigint] Error 1
make[1]: *** [unittest] Error 2
make: *** [unittest] Error 2
October 25, 2010
On 25 October 2010 09:45, Walter Bright <walter at digitalmars.com> wrote:
>
>
> dsource.org wrote:
>>
>> phobos commit, revision 2116
>>
>>
>> user: Don Clugston
>>
>> msg:
>> Fix for BigInt assign for 64 bit compilers. Also a few steps towards const
>> correctness, and some comment fixes.
>>
>> http://www.dsource.org/projects/phobos/changeset/2116
>>
>>
>
> Still dies (OSX only):
>
> core.exception.AssertError at std.bigint(481): unittest failure
>

Please add this line at 481, and tell me what it prints.

    assert(BigInt(0x1234_5678_9ABC_5A5AL).ulongLength == 1);
+    printf("%Lx%Lx\n", BigInt(0x1234_5678_9ABC_5A5AL).data.peekUlong(0));
    assert(BigInt(0x1234_5678_9ABC_5A5AL).toLong() == 0x1234_5678_9ABC_5A5AL);

obviously adding
import core.stdc.stdio;

It's looking to me as though have a long-related codegen bug.
October 25, 2010
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/phobos/attachments/20101025/25fc30d7/attachment.html>
October 25, 2010
Cool. This is definitely a compiler bug; it's negating the long before it stores it. Maybe this is a reduced test case:

void foo(T : long)(T x)
{
	ulong q = cast(ulong)((x < 0) ? -x : x);
	assert(q == 0x1234_5678_9ABC_5A5AL);
}

void bar(T : long)(T x)
{
	foo(x);
}

void main()
{
   bar(0x1234_5678_9ABC_5A5AL);
}
If that passes, it may be a problem with opAssign or with passing
ulong as a function parameter between modules.
October 25, 2010
That passes on OSX.

Don Clugston wrote:
> Cool. This is definitely a compiler bug; it's negating the long before it stores it. Maybe this is a reduced test case:
>
> void foo(T : long)(T x)
> {
> 	ulong q = cast(ulong)((x < 0) ? -x : x);
> 	assert(q == 0x1234_5678_9ABC_5A5AL);
> }
>
> void bar(T : long)(T x)
> {
> 	foo(x);
> }
>
> void main()
> {
>    bar(0x1234_5678_9ABC_5A5AL);
> }
> If that passes, it may be a problem with opAssign or with passing
> ulong as a function parameter between modules.
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
>
>
>