This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients amaury.forgeotdarc, eric.smith, mark.dickinson, pitrou, rhettinger, stutzbach
Date 2010-10-07.21:22:02
SpamBayes Score 1.4077406e-11
Marked as misclassified No
Message-id <>
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.  Then the compiler is *permitted to assume* that p also points into the same array, since if it didn't then the code would introduce undefined behaviour.  And since q is the start of the array, and p is (by assumption) a pointer into the same array, p >= q will automatically be true, so the compiler is free to replace the expression with the integer '1' (i.e., true).

gcc does similar things with checks like (x + 1 > x):  if x is a (signed) int, then gcc can and will optimize (x + 1 > x) to 'true', on the basis that x + 1 can never overflow, because such overflow would be undefined behaviour and therefore can't occur in a valid C program.
Date User Action Args
2010-10-07 21:22:03mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, amaury.forgeotdarc, pitrou, eric.smith, stutzbach
2010-10-07 21:22:03mark.dickinsonsetmessageid: <>
2010-10-07 21:22:02mark.dickinsonlinkissue10044 messages
2010-10-07 21:22:02mark.dickinsoncreate