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.

     The source file is :

     short int a[20], b[20], c[20];
     int main(){
     int i;
     for(i=0; i<20; i++)
        a[i]=b[i]+c[i];
     return 0;
     }

     The dump file is:

;; Function main (main)

main ()
{
  unsigned int ivtmp.31;

<bb 2>:
  ivtmp.31 = 0;

<bb 3>:
  MEM[base: &a + ivtmp.31] = (short int) ((short unsigned int)
MEM[base: &c + ivtmp.31] + (short unsigned int) MEM[base: &b +
ivtmp.31]);
  ivtmp.31 = ivtmp.31 + 2;
  if (ivtmp.31 != 40)
    goto <bb 3>;
  else
    goto <bb 4>;

<bb 4>:
  return 0;

}

 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.

 Thanks very much!
 Caixia

Reply via email to