Bug 391 – .sort and .reverse break utf8 encoding

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2006-10-02T02:13:00Z
Last change time
2015-06-09T05:11:55Z
Assigned to
nobody
Creator
ddparnell

Comments

Comment #0 by ddparnell — 2006-10-02T02:13:41Z
import std.utf; import std.stdio; void main() { char[] a; a = "\u3026\u2021\u3061\n"; writefln("plain"); validate(a); writefln("sorted"); validate(a.sort); // fails writefln("reversed"); validate(a.reverse); // fails }
Comment #1 by thomas-dloop — 2006-10-04T01:43:12Z
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [email protected] schrieb am 2006-10-02: > http://d.puremagic.com/issues/show_bug.cgi?id=391 > import std.utf; > import std.stdio; > void main() > { > char[] a; > a = "\u3026\u2021\u3061\n"; > writefln("plain"); validate(a); > writefln("sorted"); validate(a.sort); // fails > writefln("reversed"); validate(a.reverse); // fails > } Added to DStress as http://dstress.kuehne.cn/run/r/reverse_08_A.d http://dstress.kuehne.cn/run/r/reverse_08_B.d http://dstress.kuehne.cn/run/r/reverse_08_C.d http://dstress.kuehne.cn/run/s/sort_16_A.d http://dstress.kuehne.cn/run/s/sort_16_B.d http://dstress.kuehne.cn/run/s/sort_16_C.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFI033LK5blCcjpWoRAgxQAJ4soetJ+LZHkmwiFl5YqkGdrjmOjACeI2GG wkC8F4+qfNmVEbLeUT0t06g= =HqWF -----END PGP SIGNATURE-----
Comment #2 by bugzilla — 2006-10-10T03:29:13Z
Fixed DMD 0.169
Comment #3 by thomas-dloop — 2006-12-23T07:10:58Z
Process terminating with default action of signal 11 (SIGSEGV) Bad permissions for mapped region at address 0x805A0EC at 0x80544A3: _D3std8typeinfo8ti_dchar10TypeInfo_w4swapMFPvPvZv (in run/s/sort_16_A.d.exe) by 0x8050ACD: _adSort (in run/s/sort_16_A.d.exe) by 0x804A0F4: _Dmain (in run/s/sort_16_A.d:17) by 0x804BBE6: main (in run/s/sort_16_A.d.exe)
Comment #4 by thomas-dloop — 2007-01-24T07:46:46Z
Fixed indeed in DMD 0.169 The test cases failed due to missing dups and thus trying to sort an constant string in place.
Comment #5 by clugdbug — 2009-04-21T03:54:20Z
This case (cut down from reverse_08_C) is still failing. int main(){ wchar[] a = "a\U00000081b\U00002000c\U00010000"; wchar[] b = a.dup; b.reverse; // OK b.reverse; // fails return 0; }
Comment #6 by andrei — 2010-11-26T11:30:22Z
Don's latest fails both on 1.065 and 2.050. Marking as a D1 & D2 issue.
Comment #7 by github-bugzilla — 2012-11-20T01:36:18Z
Comment #8 by github-bugzilla — 2012-11-20T01:40:38Z
Comment #9 by bugzilla — 2012-12-27T18:40:32Z
This is also fixed in Phobos1.