This is the mail archive of the gcc@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]

[RFC] PR C++/24138


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


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