Bug #98241 unused variable p in storage/innobase/include/univ.i
Submitted: 15 Jan 2020 21:40 Modified: 20 Jan 2020 11:45
Reporter: Marcelo Altmann Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:8.0.19 OS:Ubuntu
Assigned to: CPU Architecture:Any

[15 Jan 2020 21:40] Marcelo Altmann
Description:
Compilation in Ubuntu 19.04, gcc 8.3 and valgrind 3.14 throws a warning (which can halt compilation if warnings are interpreted as errors):

In file included from /tmp/ps/storage/innobase/include/os0event.h:37,
                 from /tmp/ps/storage/innobase/include/buf0types.h:36,
                 from /tmp/ps/storage/innobase/include/buf0buddy.h:41,
                 from /tmp/ps/storage/innobase/buf/buf0buddy.cc:33:
/tmp/ps/storage/innobase/buf/buf0buddy.cc: In function 'buf_buddy_free_t* buf_buddy_alloc_zip(buf_pool_t*, ulint)':
/tmp/ps/storage/innobase/include/univ.i:630:11: warning: unused variable 'p' [-Wunused-variable]
     void *p = (addr);                 \
           ^
/tmp/ps/storage/innobase/buf/buf0buddy.cc:327:5: note: in expansion of macro 'UNIV_MEM_TRASH'
     UNIV_MEM_TRASH(buf, ~i, BUF_BUDDY_STAMP_OFFSET);
     ^~~~~~~~~~~~~~
/tmp/ps/storage/innobase/include/univ.i:630:11: warning: unused variable 'p' [-Wunused-variable]
     void *p = (addr);                 \
           ^
/tmp/ps/storage/innobase/buf/buf0buddy.cc:328:5: note: in expansion of macro 'UNIV_MEM_TRASH'
     UNIV_MEM_TRASH(BUF_BUDDY_STAMP_OFFSET + 4 + buf->stamp.bytes, ~i,
     ^~~~~~~~~~~~~~

How to repeat:
cmake -DWITH_VALGRIND=ON
[17 Jan 2020 13:04] MySQL Verification Team
Hello Marcelo,

Thank you for the report and feedback.
I tried to reproduced the issue on reported environment but not seeing any issues(build details are same as that of in Bug #98223). May I request you to please provide exact cmake options(or passing any compiler fags) used for the build? Thank you.

regards,
Umesh
[17 Jan 2020 15:40] Marcelo Altmann
Hi Umesh.

Thanks for testing it out. According to Bug #98223 you are building it as Debug:

-- CMAKE_BUILD_TYPE: Debug

I have observed the issue only with Non-Debug builds. Can you try with -DCMAKE_BUILD_TYPE=RelWithDebInfo

Thanks
[18 Jan 2020 6:46] MySQL Verification Team
Thank you, Marcelo for the details.
I'll try with non-debug build and update accordingly.

regards,
Umesh
[20 Jan 2020 11:45] MySQL Verification Team
Thank you, verified now.

regards,
Umesh
[20 Jan 2020 11:55] MySQL Verification Team
Test results - 8.0.19

Attachment: 98241.results (application/octet-stream, text), 344.61 KiB.