https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115507

            Bug ID: 115507
           Summary: 'Wide_Wide_Value failed for unicode strings
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dramwang at 163 dot com
                CC: dkm at gcc dot gnu.org
  Target Milestone: ---

For following code, CONSTRAINT_ERROR exception will be raised:

```
with Ada.Wide_Wide_Text_IO ;

procedure Sample is
   use Ada.Wide_Wide_Text_IO ;

   type T is (A, 乙) ;
begin
   Put_Line (A'Wide_Wide_Image) ;
   Put_Line (乙'Wide_Wide_Image) ;

   Put_Line (T (T'Wide_Wide_Value ("A"))'Wide_Wide_Image) ;
   Put_Line (T (T'Wide_Wide_Value ("乙"))'Wide_Wide_Image) ;
end Sample ;
```

Output:

```
A
乙                                                                              
                                       A

raised CONSTRAINT_ERROR : bad input for 'Value: "乙"
[./sample]
0x41cd20 System.Val_Util.Bad_Value at s-valuti.adb:61
0x41c6d9 System.Val_Enum_8.Impl.Value_Enumeration at s-valuen.adb:149
0x404a4d Sample at sample.adb:12
0x4046b7 Main at b~sample.adb:258
[/lib/x86_64-linux-gnu/libc.so.6]
0x7fc03814f248
0x7fc03814f303
[./sample]
0x4040ef _start at ???
0xfffffffffffffffe
```

'Wide_Value will also failed with the same error.

I've tested in Debian 12 x86_64 with GNAT 15.0.0 20240615 (git 079506).

Reply via email to