From: kenner@vlsi1.ultra.nyu.edu (Richard Kenner)
To: dnovillo@redhat.com
Cc: gcc@gcc.gnu.org
Subject: Re: Q about Ada and value ranges in types
Date: Mon, 27 Jun 2005 20:48:00 -0000 [thread overview]
Message-ID: <10506272049.AA09083@vlsi1.ultra.nyu.edu> (raw)
Sorry it took me so long to get to this.
> You're not showing where this comes from, so it's hard to say. However
> D.1480 is created by the gimplifier, not the Ada front end. There could
> easily be a typing problem in the tree there (e.g., that of the
> subtraction) but I can't tell for sure.
As it turned out, there was.
So, after calling sinfo__chars() and subtracting 300000361, the
FE is emitting that range check. AFAICT, the call to
sinfo__chars(e_5) comes from ada/sem_intr.adb:148
Nam : constant Name_Id := Chars (E);
and 'if (D.1480_32 <= 1)' is at line 155:
I'd also assumed this was where the bogus tree came from, but I was wrong.
The node in question was not made by the Ada front end but by
build_range_check in clearly incorrect code that does the subtraction in the
wrong type.
This fixes that problem. Are you in a position to check if it fixes the
original issue?
*** fold-const.c 25 Jun 2005 01:59:57 -0000 1.599
--- fold-const.c 27 Jun 2005 20:44:56 -0000
*************** build_range_check (tree type, tree exp,
*** 4027,4034 ****
if (value != 0 && ! TREE_OVERFLOW (value))
! return build_range_check (type,
! fold_build2 (MINUS_EXPR, etype, exp, low),
! 1, fold_convert (etype, integer_zero_node),
! value);
return 0;
--- 4027,4045 ----
if (value != 0 && ! TREE_OVERFLOW (value))
! {
! /* There is no requirement that LOW be within the range of ETYPE
! if the latter is a subtype. It must, however, be within the base
! type of ETYPE. So be sure we do the subtraction in that type. */
! if (TREE_TYPE (etype))
! {
! etype = TREE_TYPE (etype);
! value = fold_convert (etype, value);
! }
!
! return build_range_check (type,
! fold_build2 (MINUS_EXPR, etype, exp, low),
! 1, fold_convert (etype, integer_zero_node),
! value);
! }
return 0;
next reply other threads:[~2005-06-27 20:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-27 20:48 Richard Kenner [this message]
2005-06-27 23:36 ` James A. Morrison
-- strict thread matches above, loose matches on Subject: below --
2005-06-28 2:28 Richard Kenner
2005-05-03 22:20 Richard Kenner
2005-05-04 0:40 ` Diego Novillo
2005-05-03 1:46 Richard Kenner
2005-05-03 14:16 ` Diego Novillo
2005-05-02 15:26 Diego Novillo
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=10506272049.AA09083@vlsi1.ultra.nyu.edu \
--to=kenner@vlsi1.ultra.nyu.edu \
--cc=dnovillo@redhat.com \
--cc=gcc@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: link
Be 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).