Package: gnat
Version: 3.15p-12
Severity: normal
Tags: patch

(From GCC Bugzilla PR ada/19519, reported by Georg Bauhaus
<[EMAIL PROTECTED]>)


The following program triggers the bug box when
encoded as UTF-8.

It runs fine when used with Latin-1
characters. The compiler can test the robustness of your system
if you use iconv to encode the source text in EUC-JP
and then try to compile with -gnatiw -gnatWe. (I guess
that the characters below aren't used very frequently in
EUC-JP coded Ada source but still something seems to
be looping and consuming lots of memory in this case.)

with Ada.Text_IO;  use Ada.Text_IO;
--with Ada.Wide_Text_IO;  use Ada.Wide_Text_IO;  -- same effect

procedure oeaeue is

   type People is (Sp�herin,  -- a umlaut
                   -- Pf�rtner, -- o umlaut
                   -- Sch�ler, -- u umlaut
                   -- Spie�,  -- sharp s
                   Jedermann
                  );

   package People_IO is new Enumeration_IO(People);

begin
   for p in People'range loop
      People_IO.put(p);
      new_line;
   end loop;
end oeaeue;

cd /tmp/
gnatmake -gnatiw -gnatW8 oeaeue.adb
gcc-3.4 -c -gnatiw -gnatW8 oeaeue.adb
+===========================GNAT BUG DETECTED==============================+
| 3.4.2 (Debian 3.4.2-2) (i486-pc-linux-gnu) Constraint_Error s-wchcnv.adb:150
explicit raise|
| Error detected at oeaeue.adb:13:4
  |
| Please submit a bug report; see http://gcc.gnu.org/bugs.html.
  |
| Include the entire contents of this bug box in the report.
  |
| Include the exact gcc-3.4 or gnatmake command that you entered.
  |
| Also include sources listed below in gnatchop format
  |
| (concatenated together with no headers between files).
  |
+==========================================================================+



>From Robert Dewar <[EMAIL PROTECTED]>:

        * namet.adb (Copy_One_Character): Set proper wide character encoding
        for upper half character if we have upper half encoding.

===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/namet.adb,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- gcc/gcc/ada/namet.adb       2005/02/10 13:50:27     1.10
+++ gcc/gcc/ada/namet.adb       2005/03/18 11:50:30     1.11
@@ -36,6 +36,7 @@
 --  which is created manually from namet.ads and namet.adb.

 with Debug;    use Debug;
+with Opt;      use Opt;
 with Output;   use Output;
 with Tree_IO;  use Tree_IO;
 with Widechar; use Widechar;
@@ -299,7 +300,20 @@
               and then Name_Buffer (Old + 1) /= '_'
             then
                Old := Old + 1;
-               Insert_Character (Character'Val (Hex (2)));
+
+               --  If we have upper half encoding, then we have to set an
+               --  appropriate wide character sequence for this character.
+
+               if Upper_Half_Encoding then
+                  Widechar.Set_Wide (Char_Code (Hex (2)), New_Buf, New_Len);
+
+                  --  For other encoding methods, upper half characters
can
+                  --  simply use their normal representation.
+
+               else
+                  Insert_Character (Character'Val (Hex (2)));
+               end if;
+

             --  WW (wide wide character insertion)




Reply via email to