work around GCC false positive warning?

On 32-bit Release builds, GCC warns about this line in this test,

    ../../tests/SkRasterPipelineTest.cpp:225:40:
    error: ‘int __builtin_memcmp_eq(const void*, const void*, unsigned int)’
    reading 8 bytes from a region of size 0 [-Werror=stringop-overflow=]
                                 !memcmp(&data[j][0], &buffer[j][0], sizeof(buffer[j])));
                                  ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I don't really see anything wrong, and I'm not really sure why it takes
offense here testing load_f16 and not in the very similar next chunk of
code testing load_af16.  Anyway, it's simple enough to write a loop.

Change-Id: Ie4f598328dd7109660b9ae97a5a27b386e833fd5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257869
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
This commit is contained in:
Mike Klein 2019-12-04 09:43:32 -06:00 committed by Skia Commit-Bot
parent e1185589ff
commit f78aa16af1

View File

@ -221,8 +221,9 @@ DEF_TEST(SkRasterPipeline_tail, r) {
p.append(SkRasterPipeline::store_f16, &dst);
p.run(0,0, i,1);
for (unsigned j = 0; j < i; j++) {
REPORTER_ASSERT(r,
!memcmp(&data[j][0], &buffer[j][0], sizeof(buffer[j])));
for (int k = 0; k < 4; k++) {
REPORTER_ASSERT(r, buffer[j][k] == data[j][k]);
}
}
for (int j = i; j < 4; j++) {
for (auto f : buffer[j]) {