mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-08 21:09:49 +00:00
Bypass warning reported by gcc
gcc reports a warning:
m_stacktrace.c:183: warning: ‘xip_verified’ may be used uninitialized in this function
This warning is a false positive:
xip_verified is assigned in the following branch:
if (UNLIKELY(xip_verif >= CFUNWIND)) {
if (xip_verif == CFUNWIND) {
...
} else {
<<<< here xip_verified is initialised >>>>
}
}
xip_verified is then used only if xip_verif > CFUNWIND.
Assign a rubish value to xip_verified to silence gcc.
(??? there are GCC pragmas that can be used to
disable a warning only on a specific line e.g.
something like:
#pragma GCC diagnostic ignored "-Wuninitialized"
Addr xip_verified; // xip for which we have calculated fpverif_uregs
#pragma GCC diagnostic warning "-Wuninitialized"
instead of
Addr xip_verified = 0; // xip for which we have calculated fpverif_uregs
// 0 assigned to silence false positive -Wuninitialized warning
but the #pragma technique seems not used currently.
So, using the bypass by assigning a rubbish value
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13282
This commit is contained in:
@@ -180,7 +180,10 @@ UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
|
||||
vg_assert(sizeof(Addr) == sizeof(void*));
|
||||
|
||||
D3UnwindRegs fpverif_uregs; // result of CF unwind for a check reason.
|
||||
Addr xip_verified; // xip for which we have calculated fpverif_uregs
|
||||
Addr xip_verified = 0; // xip for which we have calculated fpverif_uregs
|
||||
// 0 assigned to silence false positive -Wuninitialized warning
|
||||
// This is a false positive as xip_verified is assigned when xip_verif > CFUNWIND
|
||||
// and only used if xip_verif > CFUNWIND.
|
||||
|
||||
D3UnwindRegs uregs;
|
||||
uregs.xip = (Addr)startRegs->r_pc;
|
||||
|
||||
Reference in New Issue
Block a user