|
From: <sv...@va...> - 2013-01-30 23:54:09
|
philippe 2013-01-30 23:53:59 +0000 (Wed, 30 Jan 2013)
New Revision: 13282
Log:
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
Modified files:
trunk/coregrind/m_stacktrace.c
Modified: trunk/coregrind/m_stacktrace.c (+4 -1)
===================================================================
--- trunk/coregrind/m_stacktrace.c 2013-01-30 23:21:34 +00:00 (rev 13281)
+++ trunk/coregrind/m_stacktrace.c 2013-01-30 23:53:59 +00:00 (rev 13282)
@@ -180,7 +180,10 @@
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;
|