[Bug tree-optimization/88973] [8/9 Regression] New -Wrestrict warning since r268048
bkorb at gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Feb 19 19:11:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88973
Bruce Korb <bkorb at gnu dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bkorb at gnu dot org
--- Comment #5 from Bruce Korb <bkorb at gnu dot org> ---
(In reply to Martin Sebor from comment #4)
> canonicalize_pathname.c: In function ‘canonicalize_pathname’:
> canonicalize_pathname.c:61:2: warning: ‘strcpy’ accessing 1 byte at offsets
> [0, 9223372036854775807] and [0, 9223372036854775807] may overlap 1 byte at
> offset 0 [-Wrestrict]
> 61 | strcpy( result + start + 1, result + i + 2 );
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> strcpy (0x217f265 = "//bar", 0x217f267 = "bar"): 3
> /foo/bar
I have a copy of this code in my project, but I haven't been writing code for
several years now. How was this fixed? The best fix would be to determine the
string length and do memmove-s, but that's enough fiddling that I'd have to
clear cobwebs and spend a mess of time. If someone's already done that, ... :)
More information about the Gcc-bugs
mailing list