[Ada] Convert from UTF_16 to UTF_8 fails for large values
authorArnaud Charlet <charlet@adacore.com>
Mon, 29 Jun 2020 08:18:27 +0000 (04:18 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 16 Oct 2020 07:31:32 +0000 (03:31 -0400)
gcc/ada/

PR ada/95953
* libgnat/a-suenco.adb (Convert): Fix handling of third UTF-8
byte.

gcc/ada/libgnat/a-suenco.adb

index 6d30f84..0b10a63 100644 (file)
@@ -398,7 +398,7 @@ package body Ada.Strings.UTF_Encoding.Conversions is
                               or Shift_Right (yyyyyyyy, 4));
             Result (Len + 3) :=
               Character'Val
-                (2#10_000000# or Shift_Left (yyyyyyyy and 2#1111#, 4)
+                (2#10_000000# or Shift_Left (yyyyyyyy and 2#1111#, 2)
                               or Shift_Right (xxxxxxxx, 6));
             Result (Len + 4) :=
               Character'Val