On Wed, Feb 18, 2009 at 05:55:43AM -0800, Nathan Froyd wrote: > On Wed, Feb 18, 2009 at 06:03:58PM +0800, JCX wrote: > > Hello, > > After I compile the following file for testing, I check the dump > > file called "129t.final_cleanup". I doubt about why the type "short > > int" changes into "short unsigned int" during the array operations, > > and at last changes back to "short int" when it stores the result into > > memory. > > [...] > > I don't know why GCC do such a type conversion. Can anyone tell me? > > This makes me more difficult to do the optimization in GCC. > > Because GCC converts to short unsigned int to avoid arithmetic
Bah, set this before it was complete. GCC converts to short unsigned int to avoid signed arithmetic overflow, which is undefined. See convert.c:convert_to_integer. -Nathan