Bug 117644 - New -Wrestrict warning for GCC 9.0
Summary: New -Wrestrict warning for GCC 9.0
Status: RESOLVED MOVED
Alias: None
Product: libexttextcat
Classification: Unclassified
Component: General (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-16 13:26 UTC by Martin Liška
Modified: 2018-10-24 12:04 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Liška 2018-05-16 13:26:23 UTC
A new more precise warning exposed following:

textcat.c: In function ‘textcat_ClassifyFull’:
textcat.c:363:13: error: ‘memcpy’ accessing 16 bytes at offsets [0, 8] and [0, 8] overlaps between 8 and 16 bytes at offset [0, 8] [-Werror=restrict]
             memcpy(&candidates[cnt - 1], &candidates[i], sizeof(candidate_t));
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Comment 1 Xisco Faulí 2018-06-18 15:20:23 UTC
@Stephan, I thought you might be interested in this issue...
Comment 2 Stephan Bergmann 2018-06-18 16:20:47 UTC
Came across that with a fresh GCC trunk (towards GCC 9) build now, too.  Looks like a legitimate warning to me, as it appears that cnt - 1 == i can be true.  However, with a patch of "if (cnt - 1 != i)" around that memcpy, GCC still emits the warning, for which I now filed <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86196> "Bogus -Wrestrict on memcpy".
Comment 3 Xisco Faulí 2018-10-24 11:30:54 UTC
SInce the issue has been reported in the GCC bugtracker, we can close this one as RESOLVED MOVED
Comment 4 Stephan Bergmann 2018-10-24 12:04:31 UTC
(<https://gerrit.libreoffice.org/#/c/58173/> "Work around GCC trunk (towards GCC 9) bug for now" can be pushed should the GCC bug not get fixed in time for GCC 9)