[issue10044] small int optimization

Antoine Pitrou report at bugs.python.org
Thu Oct 7 23:38:46 CEST 2010


Antoine Pitrou <pitrou at free.fr> added the comment:

> See the example above:  suppose that a compiler is looking at a (p >=
> q) comparison of pointers.  Suppose furthermore that in a particular
> case that compiler is smart enough to figure out that q is a pointer
> to the start of an array.

Which array? You can have arrays everywhere in memory, at any address,
ending anywhere.

union {
   struct {
      char ch1;
      char arr1[2];
   }
   struct {
      char arr2[2];
      char ch2;
   }
   struct {
      char arr3[3];
   }
}

Which is an array, and which is not? is &ch1 an array? and arr1? and
arr2+1? Why would the compiler choose one over another? And what about
arrays defined in other modules?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10044>
_______________________________________


More information about the Python-bugs-list mailing list