This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: folding of literal array refs
- From: Jeffrey A Law <law at redhat dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: Dirk Mueller <dmueller at suse dot de>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 27 Apr 2006 09:45:54 -0600
- Subject: Re: RFC: folding of literal array refs
- References: <Pine.LNX.4.44.0604270751150.18514-100000@www.eyesopen.com>
- Reply-to: law at redhat dot com
On Thu, 2006-04-27 at 08:07 -0600, Roger Sayle wrote:
> It think the clue to the correct solution is given several lines further
> down in the same if-clause that you cite above:
>
> && (GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (TREE_TYPE (string))))
> == MODE_INT)
> && (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (TREE_TYPE (string))))
> == 1))
>
> Basically, all the middle-end cares about at this point is whether the
> element types are 1-byte wide integers, and checking that TREE_TYPE (exp)
> is identical to TREE_TYPE (TREE_TYPE (string)) guarantees that for both.
> Instead I think to catch the cases that you care about we should simply
> change the line:
IIRC those tests are to kick out folding of literal references to
arrays of wide chars -- most likely because the code in question hasn't
been audited for correctness with characters which are more than a
single byte.
Jeff