Bug 772343

Summary: leak check macros fail to compile with -Wunused-but-set-variable enabled
Product: [Fedora] Fedora Reporter: Henrik Nordström <henrik>
Component: valgrindAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: dodji, jakub
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-01-27 19:42:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Test program using the offending valgrind macros
none
Proposed patch silencing the gcc warning/error none

Description Henrik Nordström 2012-01-06 21:39:17 UTC
Created attachment 551270 [details]
Test program using the offending valgrind macros

Description of problem:

Trying to compile programs using the valgrind leak check macros causes
warnings/errors about _qzz_res being set but unused.

Version-Release number of selected component (if applicable):

valgrind-3.6.1-6.fc16.x86_64

How reproducible:

always

Steps to Reproduce:
1. gcc -O2 -Wunused-but-set-variable test.c
2.
3.
  
Actual results:

Compilation warns/fails with error about _qzz_res being unused but assigned

Expected results:

No warnings/errors emitted by gcc

Additional info:

Comment 1 Henrik Nordström 2012-01-06 21:43:32 UTC
Created attachment 551275 [details]
Proposed patch silencing the gcc warning/error

Adding __attribute__((unused)) to the _qzz_res variable declarations in these macros in include/memcheck.h fixes the problem.

   {__attribute__((unused)) unsigned long _qzz_res;                                      \

Comment 2 Jakub Jelinek 2012-01-27 19:42:40 UTC
Should be fixed in valgrind-3.7.0-1.fc17.