https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82694

--- Comment #1 from amker at gcc dot gnu.org ---
Sorry for the breakage.
As I mentioned when committing the patch, it's kind of an experiment and we can
always revert it.  I can revert it now, but a test case for further
investigation would be highly appreciated.
As for the patch, it doesn't change behavior when !flag_wrapv.  I assume the
difference comes from explicitly specified -fwrapv option.  Described by fwrapv
document:

fwrapv
Common Report Var(flag_wrapv) Optimization
Assume signed arithmetic overflow wraps around.

It indicates wrap behavior for signed arithmetic overflow.  This is not
accurate before this patch, because apparently it also covers wrap behavior for
pointer/memory_object.  Unfortunately, it's not always the case because there
are lots of code ignoring possible pointer wrap when fwrapv is specified.  

I can see GCC has the inconsistency issue here, unfortunately no easy way out.

Last question is, does the code in kernel really depends on wrapping pointer
arithmetic overflow behavior.  The code itself can be fixed if not.  Anyway,
it's hard to tell without a test case.

Hi richi, any comment before I revert the patch?  Thanks.

Reply via email to