[Bug middle-end/85420] More -Wrestrict false positives with -fsanitize=undefined

2018-04-16 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85420

--- Comment #4 from Jakub Jelinek  ---
(In reply to Franz Sirl from comment #3)
> Hmm, this maybe creduce'd too much, the original source reads more like
> 
>strcpy(b, b + a + 10);
> 
> which would be only UB for sure if strlen(b + a + 10) >= 9, or?

If b was actually a larger array, then yes, otherwise even b + 10 would be UB.

[Bug middle-end/85420] More -Wrestrict false positives with -fsanitize=undefined

2018-04-16 Thread sirl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85420

--- Comment #3 from Franz Sirl  ---
Hmm, this maybe creduce'd too much, the original source reads more like

   strcpy(b, b + a + 10);

which would be only UB for sure if strlen(b + a + 10) >= 9, or?

[Bug middle-end/85420] More -Wrestrict false positives with -fsanitize=undefined

2018-04-16 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85420

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek  ---
The #c0 testcase is always UB if the function is called, why doesn't it deserve
a warning?  Either a is initially 0, then already the first iteration invokes
UB (strcpy (b, b)) and -Wrestrict is right, or a is 1 and strcpy (b, b + 1)
invokes UB because it dereferences b[1] in the first iteration, or a is
different and and b + a invokes UB.

[Bug middle-end/85420] More -Wrestrict false positives with -fsanitize=undefined

2018-04-16 Thread sirl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85420

--- Comment #1 from Franz Sirl  ---
Created attachment 43951
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43951=edit
C++ testcase