This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [3.4 PATCH] Fix a fallout of PR14179 fix (take 2)


On Tue, Dec 28, 2004 at 11:12:54AM +0100, Giovanni Bajo wrote:
> Jakub Jelinek <jakub@redhat.com> wrote:
> 
> > Based on discussion in
> > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18384
> > this is what I'd like to commit for gcc-3_4-branch
> > (bootstrapped/regtested on {i386,x86_64,ia64,ppc,ppc64}-redhat-linux).
> > For 3.4 I guess changing the zero/sign extension of sizetype is not
> > appropriate and IDENTIFIER_NODE is the only TREE_PURPOSE that can ever
> > make it into reshape_init_array (from errorneous sources like
> > parse/error9.C; GCC 3.4 parser doesn't parse [4] = nor [4] style array
> > designators). Ok to commit?
> 
> Does convert() build a new node? The whole purpose of adding reshape_init_array
> is that it is able to do its work without never building a new tree. I
> understand that this is going to be done just once for each call, but is there
> a way to achieve the very same thing without building trees (e.g. just regular
> math?)

Sure there is, but at the expense of readability.  As this convert is
done just once for each array, not thousands of times, I think readability
is preferrable and many places in the compiler do the same.

Of course you can do something like:
int prec;
if (TREE_CODE (max_index) != INTEGER_CST)
  abort ();
prec = TYPE_PRECISION (TREE_TYPE (max_index));
if (prec > HOST_BITS_PER_WIDE_INT)
  abort ();
max_index_cst = TREE_INT_CST_LOW (max_index)
		& ((unsigned HOST_WIDE_INT) 2 << (prec - 1)) - 1;
and don't bother checking the bits above prec.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]