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: [Patch] Fix infinite loop/crash if array initializer index equals max value


On Wed, 4 Sep 2013, Senthil Kumar Selvaraj wrote:

> Reattaching the patch with a testcase for the AVR target. I'm not sure
> how to generalize the testcase for other targets - the constant is the
> max value (unsigned) of the mode used to represent initialized array
> indices.

Logically that should be __SIZE_MAX__, unless there's an unusual choice of 
size_t.

Are there any issues with large compiler memory consumption if you use 
__SIZE_MAX__ there for ordinary 32-bit or 64-bit targets?  If so, that 
would be a reason to keep the test restricted to AVR; if not, it would 
seem better to have __SIZE_MAX__ in the test (or a macro defined in the 
test that defaults to __SIZE_MAX__ but is overridden for particular 
targets, if some targets need it overridden).

-- 
Joseph S. Myers
joseph@codesourcery.com


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