[Bug middle-end/93519] [8/9/10 Regression] bogus -Wrestrict for strcpy(d, s) call guarded by d != s

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jan 31 12:10:00 GMT 2020


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org
   Target Milestone|---                         |8.4
            Summary|bogus -Wrestrict for        |[8/9/10 Regression] bogus
                   |strcpy(d, s) call guarded   |-Wrestrict for strcpy(d, s)
                   |by d != s                   |call guarded by d != s

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r8-5363-gcc8bea0aeeeeb6ed8046ede1a577ee681da2ca6a

I'd say the bug is in trying to do this from whenever we try to fold such a
call, because there is no way to cleanup the cfg after inlining before it
happens.
So, it would be much better to do this only in specific well chosen passes, say
one among early opts, but sufficiently after einline so that unreachable code
there could be optimized away, and once or twice in late opts.
The overlapping arguments is UB, so I don't really think it is neccessary to
fold it immediately.

Another option is to turn it into IFN_WARNING and defer the diagnostics after
some cleanups.


More information about the Gcc-bugs mailing list