[Issue 7485] Incorrect BigInt Error Message

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 12 05:26:40 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7485


Stewart Gordon <smjg at iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
                 CC|                            |smjg at iname.com


--- Comment #3 from Stewart Gordon <smjg at iname.com> 2012-02-12 05:26:36 PST ---
That's still not the error message I get at all (2.057, Win32):
-----
C:\Users\Stewart\Documents\Programming\D\Tests\bugs>dmd bz7485.d
bz7485.d(2): Error: undefined identifier BigInt
-----

Please, always post a complete, self-contained testcase, and the full output
from that testcase.

Anyway, adding the necessary import gives for me:
----- bz7485.d -----
import std.bigint;

public struct Test1 {
    BigInt maxCoefficient = (BigInt(10)^^9 )- 1;
}
----------
C:\Users\Stewart\Documents\Programming\D\Tests\bugs>dmd bz7485.d
d:\dmd2\windows\bin\..\..\src\phobos\std\internal\math\biguintx86.d(306):
Error: asm statements cannot be interpreted at compile time
d:\dmd2\windows\bin\..\..\src\phobos\std\internal\math\biguintcore.d(434):     
  called from here: multibyteShl(result[words..words +
this.data.length],this.data,bits)
d:\dmd2\windows\bin\..\..\src\phobos\std\internal\math\biguintcore.d(692):     
  called from here: result.opShl(cast(ulong)(evenbits + firstnonzero * 8u * 4u)
* y)
d:\dmd2\windows\bin\..\..\src\phobos\std\bigint.d(188):        called from
here: pow(this.data,u)
d:\dmd2\windows\bin\..\..\src\phobos\std\bigint.d(188):        called from
here: this.data.opAssign(pow(this.data,u))
d:\dmd2\windows\bin\..\..\src\phobos\std\bigint.d(250):        called from
here: r.opOpAssign(y)
bz7485.d(4):        called from here: BigInt(BigUint([10u]),false).opBinary(9)
bz7485.d(4):        called from here: BigInt(BigUint([10u]),false).opBinary(9)
----------

It seems to me it's a combination of two things:
- in certain circumstances, it fails to give this CTFE call backtrace (what
compiler version are you using?)
- the implementation of power on BigInt relies on inline assembly, thereby
preventing it working with CTFE.

A testcase for the complier crashing might still be useful.
http://pr.stewartsplace.org.uk/d/bugreport.html
might help you with creating one.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list