[Issue 21592] New: two stack traces if high surrogate is printed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 29 20:33:13 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21592

          Issue ID: 21592
           Summary: two stack traces if high surrogate is printed
           Product: D
           Version: D2
          Hardware: Other
                OS: Other
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: kdevel at vogtner.de

```unpsur.d
import std.stdio: writeln;
import std.utf: byCodeUnit;

void main ()
{
   wstring w = "\U00010400";
   wchar wc = w.byCodeUnit [0]; // take high surrogate
   writeln (wc);                // let it throw a UTFException
}
```

Application output

std.utf.UTFException at std/stdio.d(2910): unpaired surrogate UTF-16 value
----------------
??:? @safe void std.stdio.File.LockingTextWriter.highSurrogateShouldBeEmpty()
[0x5616f092907f]
/dlang/dmd/linux/bin64/../../src/phobos/std/stdio.d:2992 @safe void
std.stdio.File.LockingTextWriter.put!(char).put(char) [0x5616f0922407]
/dlang/dmd/linux/bin64/../../src/phobos/std/range/primitives.d:277 @safe void
std.range.primitives.doPut!(std.stdio.File.LockingTextWriter, char).doPut(ref
std.stdio.File.LockingTextWriter, ref char) [0x5616f09223ea]
/dlang/dmd/linux/bin64/../../src/phobos/std/range/primitives.d:380 @safe void
std.range.primitives.put!(std.stdio.File.LockingTextWriter, char).put(ref
std.stdio.File.LockingTextWriter, char) [0x5616f09223bf]
/dlang/dmd/linux/bin64/../../src/phobos/std/stdio.d:1567 @safe void
std.stdio.File.write!(wchar, char).write(wchar, char) [0x5616f0921bfe]
/dlang/dmd/linux/bin64/../../src/phobos/std/stdio.d:3911 @safe void
std.stdio.writeln!(wchar).writeln(wchar) [0x5616f0921b82]
onlineapp.d:8 _Dmain [0x5616f0921736]
std.utf.UTFException at std/stdio.d(2910): unpaired surrogate UTF-16 value
----------------
??:? @safe void std.stdio.File.LockingTextWriter.highSurrogateShouldBeEmpty()
[0x5616f092907f]
??:? @trusted void std.stdio.File.LockingTextWriter.__dtor() [0x5616f0929197]
??:? @trusted void std.stdio.File.LockingTextWriter.__aggrDtor()
[0x5616f09291f0]
/dlang/dmd/linux/bin64/../../src/phobos/std/stdio.d:1541 @safe void
std.stdio.File.write!(wchar, char).write(wchar, char) [0x5616f0921c1d]
/dlang/dmd/linux/bin64/../../src/phobos/std/stdio.d:3911 @safe void
std.stdio.writeln!(wchar).writeln(wchar) [0x5616f0921b82]
onlineapp.d:8 _Dmain [0x5616f0921736]

expected: only one trace

--


More information about the Digitalmars-d-bugs mailing list