Bug 513522 - m_libcassert.c: 'ordered comparison of pointer with integer zero' compiler warning
Summary: m_libcassert.c: 'ordered comparison of pointer with integer zero' compiler wa...
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: 3.27 GIT
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Paul Floyd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-12-18 05:07 UTC by correctmost
Modified: 2025-12-18 07:00 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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