This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[RFC] PR C++/24138
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: Josh Conner <jconner at apple dot com>, gcc at gcc dot gnu dot org
- Cc: jakub at redhat dot com
- Date: Thu, 10 Nov 2005 16:10:20 -0400
- Subject: [RFC] PR C++/24138
- References: <43727B82.7080402@apple.com>
More questions wrt this PR.
The problem here is in reshape_init_array_1. Ever since we made
max_index_cst and index *unsigned* HOST_WIDE_INT, we are causing the
loop over initializers to wrongly iterate when we have zero sized arrays.
Since on a zero sized array, we have "tree max_index" set to:
<integer_cst 0xf7d981c0 type <integer_type 0xf7ce51a0 long unsigned int> constant invariant -1>
We set max_index_cst to be set to MAX_INT, and the loop over the initializers
happens (when it shouldn't).
We originally made max_index_cst/index an unsigned here:
http://gcc.gnu.org/ml/gcc-patches/2004-12/msg01962.html
I believe we should special case max_index being -1 to handle zero
sized arrays correctly.
(Frustratingly, max_index above yields false on integer_all_onesp(), but
we can tackle that once we can agree what to do here.)
Is it ok to special case max_index being -1?
Aldy