Bug 513522

Summary: m_libcassert.c: 'ordered comparison of pointer with integer zero' compiler warning
Product: [Developer tools] valgrind Reporter: correctmost <cmbugz>
Component: generalAssignee: Paul Floyd <pjfloyd>
Status: RESOLVED FIXED    
Severity: normal CC: pjfloyd
Priority: NOR    
Version First Reported In: 3.27 GIT   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description correctmost 2025-12-18 05:07:16 UTC
SUMMARY

GCC reports the following warning in coregrind/m_libcassert.c:

m_libcassert.c: In function ‘report_and_quit’:
m_libcassert.c:503:31: warning: ordered comparison of pointer with integer zero [-Wextra]
  503 |    if (VG_(debugLog_getLevel) > 0) {
      |                               ^

SOFTWARE/OS VERSIONS

Commit 1d4182eed4d compiled on Arch Linux
Comment 1 Paul Floyd 2025-12-18 06:24:46 UTC
Which version of GCC produces this warning?
Comment 2 correctmost 2025-12-18 06:29:21 UTC
I compiled with GCC 15.2.1 20251112 from the Arch repos (gcc 15.2.1+r301+gf24307422d1d-1).
Comment 3 Paul Floyd 2025-12-18 06:50:55 UTC
It looks like a straightforward error. The compiler is complaining that we're comparing a function (which decays to a pointer to function) with integer zero. That will always be true. I just need to add parens to make it a function call and check that none of the regressioon tests need updating.
Comment 4 Paul Floyd 2025-12-18 07:00:35 UTC
commit 6f1b1f3d7d00f45bacebc2bfae667fc0ff8a461b (HEAD -> master, origin/master, origin/HEAD)
Author: Paul Floyd <pjfloyd@wanadoo.fr>
Date:   Thu Dec 18 07:59:38 2025 +0100

    Bug 513522 - m_libcassert.c: 'ordered comparison of pointer with integer zero' compiler warning