public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "laurent at guerby dot net" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug ada/14997] ncurses build fails with Ada Date: Sun, 18 Apr 2004 02:21:00 -0000 [thread overview] Message-ID: <20040417213848.17354.qmail@sources.redhat.com> (raw) In-Reply-To: <20040417201417.14997.ehicks@binarymagi.com> ------- Additional Comments From laurent at guerby dot net 2004-04-17 21:38 ------- Here is a reduced test cases that ICE even at -O0. But the problem is that the user code is incorrect, it assumes that Interfaces.C.Unsigned_Long is 64 bits, however it is 32 bits. In the aux package C_Chtype should be declared as: type C_Chtype is mod 2**64; Then everything should work (it compiles, I cannot test fully). On the GCC side, if the code does the assignement in two steps, I get a warning not a blow up: X : constant C_Chtype := 0; Y : Character_Attribute_Set; Z : Attributed_Character; begin Z := Chtype_To_AttrChar (X); Y := Z.Attr; $ gcc -c -O1 pq.adb pq.adb:70:04: warning: types for unchecked conversion have different sizes So on the front-end side, a warning should be generated and may be a way not to ICE in back-end could be found. Generated code will be meaningless anyway. Laurent $ gcc -c -O0 pq.adb +===========================GNAT BUG DETECTED==============================+ | 3.5.0 20040417 (experimental) (i686-pc-linux-gnu) GCC error: | | in expand_expr_real, at expr.c:7137 | | Error detected at pq.adb:78:29 | -- with Interfaces.C; use Interfaces.C; with Ada.Unchecked_Conversion; procedure PQ is subtype C_ULong is Interfaces.C.unsigned_long; type C_Chtype is new C_ULong; type Character_Attribute_Set is record Stand_Out : Boolean; Under_Line : Boolean; Reverse_Video : Boolean; Blink : Boolean; Dim_Character : Boolean; Bold_Character : Boolean; Alternate_Character_Set : Boolean; Invisible_Character : Boolean; Protected_Character : Boolean; Horizontal : Boolean; Left : Boolean; Low : Boolean; Right : Boolean; Top : Boolean; Vertical : Boolean; end record; pragma Pack (Character_Attribute_Set); pragma Convention (C, Character_Attribute_Set); for Character_Attribute_Set use record Stand_Out at 0 range 47 .. 47; Under_Line at 0 range 46 .. 46; Reverse_Video at 0 range 45 .. 45; Blink at 0 range 44 .. 44; Dim_Character at 0 range 43 .. 43; Bold_Character at 0 range 42 .. 42; Alternate_Character_Set at 0 range 41 .. 41; Invisible_Character at 0 range 40 .. 40; Protected_Character at 0 range 39 .. 39; Horizontal at 0 range 38 .. 38; Left at 0 range 37 .. 37; Low at 0 range 36 .. 36; Right at 0 range 35 .. 35; Top at 0 range 34 .. 34; Vertical at 0 range 33 .. 33; end record; for Character_Attribute_Set'Size use 48; type Color_Pair is range 0 .. 255; for Color_Pair'Size use 8; type Attributed_Character is record Attr : Character_Attribute_Set; Color : Color_Pair; Ch : Character; end record; pragma Convention (C, Attributed_Character); -- This is the counterpart for the chtype in C. for Attributed_Character use record Ch at 0 range 56 .. 63; Color at 0 range 48 .. 55; Attr at 0 range 0 .. 47; end record; for Attributed_Character'Size use 64; function Chtype_To_AttrChar is new Ada.Unchecked_Conversion (Source => C_Chtype, Target => Attributed_Character); X : constant C_Chtype := 0; Y : Character_Attribute_Set; begin Y := Chtype_To_AttrChar (X).Attr; end PQ; -- What |Removed |Added ---------------------------------------------------------------------------- Severity|minor |normal Priority|P3 |P2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14997
next prev parent reply other threads:[~2004-04-17 21:38 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-04-17 20:16 [Bug ada/14997] New: " ehicks at binarymagi dot com 2004-04-17 20:25 ` [Bug ada/14997] " ehicks at binarymagi dot com 2004-04-17 20:32 ` ehicks at binarymagi dot com 2004-04-17 20:43 ` ehicks at binarymagi dot com 2004-04-17 20:54 ` ehicks at binarymagi dot com 2004-04-17 20:55 ` pinskia at gcc dot gnu dot org 2004-04-17 21:15 ` laurent at guerby dot net 2004-04-17 21:16 ` ehicks at binarymagi dot com 2004-04-17 21:16 ` pinskia at gcc dot gnu dot org 2004-04-17 23:43 ` pinskia at gcc dot gnu dot org 2004-04-18 2:21 ` laurent at guerby dot net [this message] 2004-11-24 19:32 ` pinskia at gcc dot gnu dot org 2005-03-30 9:12 ` charlet at gcc dot gnu dot org 2005-05-09 13:06 ` ebotcazou at gcc dot gnu dot org 2005-09-06 8:30 ` [Bug middle-end/14997] " ebotcazou at gcc dot gnu dot org 2005-09-06 19:47 ` cvs-commit at gcc dot gnu dot org 2005-09-06 19:50 ` ebotcazou at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20040417213848.17354.qmail@sources.redhat.com \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).