This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/61240] [6/7/8 Regression] Incorrect warning "integer overflow in expression" on pointer-pointer subtraction
- From: "glisse at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 17 Jan 2018 17:30:19 +0000
- Subject: [Bug c/61240] [6/7/8 Regression] Incorrect warning "integer overflow in expression" on pointer-pointer subtraction
- Auto-submitted: auto-generated
- References: <bug-61240-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61240
--- Comment #18 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #17)
> Created attachment 43162 [details]
> gcc8-pr61240.patch
>
> The C FE doesn't do this optimization anymore, but c_fully_fold does because
> the generic folding code folds it. This should fix that. Can't reproduce
> warning with C++.
I had no idea that convert and view_convert would not be equivalent here, it is
great that the fix is so simple, thanks.
(Maybe some day pointer_plus will take a signed argument and this will become
unnecessary...)