gprofng: Fix -Wsign-compare warning
authorVladimir Mezentsev <vladimir.mezentsev@oracle.com>
Fri, 26 May 2023 02:06:52 +0000 (19:06 -0700)
committerVladimir Mezentsev <vladimir.mezentsev@oracle.com>
Wed, 31 May 2023 18:46:22 +0000 (11:46 -0700)
gprofng/ChangeLog
2023-05-25  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

PR gprofng/30490
* src/LoadObject.cc: Fix -Wsign-compare warning.

gprofng/src/LoadObject.cc

index 9601dee7bd91482248320e811bbea058b0def423..76dba3e811e78f1a13bb709dfe3b35171b61fb6d 100644 (file)
@@ -463,7 +463,8 @@ LoadObject::find_function (uint64_t foff)
            {
              // Function is already created
              func = fp;
-             if (func->size < foff - func->img_offset)
+             uint64_t sz = func->size < 0 ? 0 : func->size;
+             if (sz + func->img_offset < foff)
                func->size = foff - func->img_offset;
            }
          else