Thread overview | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
July 25, 2012 [Issue 8435] New: BigInts don't work well in associative arrays | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=8435 Summary: BigInts don't work well in associative arrays Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: wrong-code Severity: normal Priority: P2 Component: druntime AssignedTo: nobody@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@eml.cc 2012-07-25 07:44:03 PDT --- import std.bigint; void main() { int[BigInt] aa; aa[BigInt(100)] = 1; assert(BigInt(100) in aa); // assert error } While this is OK: import std.bigint; void main() { int[BigInt] aa; auto x = BigInt(100); aa[x] = 1; assert(x in aa); // assert passes } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 08, 2013 [Issue 8435] BigInts don't work well in associative arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=8435 --- Comment #1 from hsteoh@quickfur.ath.cx 2013-07-07 18:11:30 PDT --- cf. #10118. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 08, 2013 [Issue 8435] BigInts don't work well in associative arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=8435 --- Comment #2 from hsteoh@quickfur.ath.cx 2013-07-07 18:12:15 PDT --- Gah, I meant bug #10118. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 08, 2013 [Issue 8435] BigInts don't work well in associative arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=8435 --- Comment #3 from hsteoh@quickfur.ath.cx 2013-07-07 20:44:34 PDT --- This bug is caused by two problems: 1) BigInt does not define toHash(), so two different instances of BigInt will always have a distinct hash, even if the values they represent are equal. 2) For some reason, typeid(BigInt).compare() will always return non-zero for two distinct instances of BigInt; this causes the AA code to think the two BigInts are not equal even if their hash is the same. I have the fix for (1), but still investigating (2); it may be a compiler bug, I'm not sure yet. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 08, 2013 [Issue 8435] BigInts don't work well in associative arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=8435 --- Comment #4 from hsteoh@quickfur.ath.cx 2013-07-07 21:26:26 PDT --- The fix for (2) is blocked by issue #10567. :-( -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 08, 2013 [Issue 8435] BigInts don't work well in associative arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=8435 --- Comment #5 from hsteoh@quickfur.ath.cx 2013-07-08 07:55:34 PDT --- https://github.com/D-Programming-Language/phobos/pull/1402 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 09, 2013 [Issue 8435] BigInts don't work well in associative arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=8435 --- Comment #6 from hsteoh@quickfur.ath.cx 2013-07-08 19:32:50 PDT --- Related to issue #10380. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 09, 2013 [Issue 8435] BigInts don't work well in associative arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=8435 --- Comment #7 from hsteoh@quickfur.ath.cx 2013-07-08 19:33:37 PDT --- Gah, ignore the previous note, I posted it to the wrong bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 09, 2013 [Issue 8435] BigInts don't work well in associative arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=8435 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |alvaro.segura@gmail.com --- Comment #8 from Kenji Hara <k.hara.pg@gmail.com> 2013-07-08 19:45:18 PDT --- *** Issue 10118 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 09, 2013 [Issue 8435] BigInts don't work well in associative arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=8435 --- Comment #9 from Kenji Hara <k.hara.pg@gmail.com> 2013-07-08 19:46:02 PDT --- From bug 10118: > Associative arrays with BigInts as keys are unusable: > > import std.bigint, std.stdio; > void main() > { > int[BigInt] a; > a[BigInt(3)] = 3; > a[BigInt(3)] = 4; > writeln(a); > } > > Prints: > > [3:3, 3:4] > > Apparently duplicate keys. > > Probably related to Issue 8435. > > I thought this was a consequence of Issue 3789 because BigInt is a struct containing a string. But that was resolved recently, and this bug still appears in 2.063 beta. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation