public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/111945] New: Attribute Image for Unbounded_String raises UTF_ENCODING.ENCODING_ERROR
@ 2023-10-23 21:15 alexandre.dauquier at gmail dot com
2023-10-23 21:18 ` [Bug ada/111945] " alexandre.dauquier at gmail dot com
2024-01-09 10:51 ` ebotcazou at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: alexandre.dauquier at gmail dot com @ 2023-10-23 21:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111945
Bug ID: 111945
Summary: Attribute Image for Unbounded_String raises
UTF_ENCODING.ENCODING_ERROR
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
Assignee: unassigned at gcc dot gnu.org
Reporter: alexandre.dauquier at gmail dot com
CC: dkm at gcc dot gnu.org
Target Milestone: ---
Created attachment 56181
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56181&action=edit
Minimum working example
The following code is failing with Gnat 12.2.0. It passes with 13.2.0 though
(so it might already be known ? But I have not found it).
Note, I have picked Characters.Latin_1.Reserved_128 on purpose.
```ada
-- File 'print_non_graphic_character.adb'
with Ada.Characters.Latin_1;
with Ada.Text_IO;
with Ada.Strings.Unbounded;
procedure Print_Non_Graphic_Character is
Text_String : constant String := "Non Graphic Character: " &
Ada.Characters.Latin_1.Reserved_128;
Text_Unbounded_String : constant Ada.Strings.Unbounded.Unbounded_String :=
Ada.Strings.Unbounded.To_Unbounded_String (Text_String);
begin
Ada.Text_IO.Put_Line (Text_String);
Ada.Text_IO.Put_Line (Ada.Strings.Unbounded.To_String
(Text_Unbounded_String));
Ada.Text_IO.Put_Line (Text_Unbounded_String'Image);
end Print_Non_Graphic_Character;
```
Note that it also fails with:
```ada
Ada.Text_IO.Put_Line (Ada.Strings.Unbounded.Unbounded_String'Image
(Text_Unbounded_String));
```
```
-- File 'print_non_graphic_character.gpr'
project Print_Non_Graphic_Character is
for Main use ("print_non_graphic_character.adb");
for Object_Dir use ".objs";
package Compiler is
-- "-Og" -- Optimize for debug
-- "-g" -- Generate debug info
for Default_Switches ("Ada") use ("-g", "-gnat2020", "-Og");
end Compiler;
package Binder is
for Switches ("Ada") use ("-Es"); -- Symbolic traceback
end Binder;
end Print_Non_Graphic_Character;
```
Cmdline: `gprbuild -p -gnatef print_non_graphic_character.gpr`
Output:
```stdout
Non Graphic Character: �
Non Graphic Character: �
raised ADA.STRINGS.UTF_ENCODING.ENCODING_ERROR : bad input at Item (25)
[./non_graphic_character/.objs/print_non_graphic_character]
0x40e8fb Ada.Strings.Utf_Encoding.Raise_Encoding_Error at a-stuten.adb:126
0x40f38b Ada.Strings.Utf_Encoding.Strings.Decode at a-suenst.adb:163
0x4049a8 Print_Non_Graphic_Character at print_non_graphic_character.adb:13
0x404efa Main at b__print_non_graphic_character.adb:279
[/lib/x86_64-linux-gnu/libc.so.6]
0x7f5e62118d08
[./non_graphic_character/.objs/print_non_graphic_character]
0x404658 _start at ???
0xfffffffffffffffe
```
Output with Gnat 13.2.0 (though I didn't expect the quotation marks):
```stdout
Non Graphic Character: �
Non Graphic Character: �
"Non Graphic Character: �"
"Non Graphic Character: �"
```
Environnement of the bug (with Gnat 12.2.0):
```
> gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/dalex78/bin/gnat_native/12.2.1_11f3b811/bin/../libexec/gcc/x86_64-pc-linux-gnu/12.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../src/configure
--prefix=/home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/gcc/install
--with-build-time-tools=/home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/binutils/install/bin
--enable-languages=c,ada,c++ --enable-libstdcxx --enable-libstdcxx-threads
--enable-libada --disable-nls --without-libiconv-prefix --disable-libstdcxx-pch
--enable-lto --disable-multilib --enable-threads=posix --with-gnu-ld
--with-gnu-as
--with-mpfr=/home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/mpfr/install
--with-gmp=/home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/gmp/install
--with-mpc=/home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/mpc/install
--with-isl=/home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/isl/install
--build=x86_64-pc-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.2.0 (GCC)
```
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug ada/111945] Attribute Image for Unbounded_String raises UTF_ENCODING.ENCODING_ERROR
2023-10-23 21:15 [Bug ada/111945] New: Attribute Image for Unbounded_String raises UTF_ENCODING.ENCODING_ERROR alexandre.dauquier at gmail dot com
@ 2023-10-23 21:18 ` alexandre.dauquier at gmail dot com
2024-01-09 10:51 ` ebotcazou at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: alexandre.dauquier at gmail dot com @ 2023-10-23 21:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111945
--- Comment #1 from Alexandre Dauquier <alexandre.dauquier at gmail dot com> ---
Created attachment 56182
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56182&action=edit
GPR build
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug ada/111945] Attribute Image for Unbounded_String raises UTF_ENCODING.ENCODING_ERROR
2023-10-23 21:15 [Bug ada/111945] New: Attribute Image for Unbounded_String raises UTF_ENCODING.ENCODING_ERROR alexandre.dauquier at gmail dot com
2023-10-23 21:18 ` [Bug ada/111945] " alexandre.dauquier at gmail dot com
@ 2024-01-09 10:51 ` ebotcazou at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-01-09 10:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111945
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
CC| |ebotcazou at gcc dot gnu.org
Target Milestone|--- |13.0
Status|UNCONFIRMED |RESOLVED
--- Comment #2 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Indeed fixed in GCC 13 and later, no backport planned.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-01-09 10:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-23 21:15 [Bug ada/111945] New: Attribute Image for Unbounded_String raises UTF_ENCODING.ENCODING_ERROR alexandre.dauquier at gmail dot com
2023-10-23 21:18 ` [Bug ada/111945] " alexandre.dauquier at gmail dot com
2024-01-09 10:51 ` ebotcazou at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).