[C PATCH] PR25309: unsigned HOST_WIDE_INT array indices in diagnostics

Roger Sayle roger@eyesopen.com
Fri Apr 28 20:13:00 GMT 2006

On Thu, 27 Apr 2006, Richard Henderson wrote:
> On Wed, Apr 26, 2006 at 08:02:03PM -0600, Roger Sayle wrote:
> > If you'd prefer, I'm happy to change the above line to read
> > "tree_low_cst (constructor_index, 1)" ...
> Yes please.

Cool.  I've committed this fix to mainline with above change, after
another bootstrap and regression test on x86_64-unknown-linux-gnu
just to be safe.  I'll backport to the release branches after a few
days without problems.

> > My thinking was to make this aspect of the compiler "fail-soft",
> > removing the assertion and instead always treating the array index
> > as effectively modulo "unsigned HOST_WIDE_INT" for error messages.
> Am I confused?  I thought this push was used for more than just error
> messages; that it was also used for generating indicies.

The tree "constructor_index" is used in generating indices, but the
host integer obtained via tree_low_cst that gets passed to
push_array_bounds looks like its only used for generating messages.
A search of "u.i" across c-typeck.c reveals that its only mentioned
twice; once in push_array_bounds to place it on the "spelling" stack,
and again in print_spelling to generate a diagnostic location.

Thanks again for the review.


More information about the Gcc-patches mailing list