From 520e7e4a631cc038b3e867b2255235da35a98ece Mon Sep 17 00:00:00 2001 From: jvoisin Date: Fri, 14 Jun 2024 19:46:14 +0200 Subject: Fix some pointer-arithmetic warnings This should fix the second part of #59 --- include/fortify-headers.h | 4 ++-- tests/Makefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/fortify-headers.h b/include/fortify-headers.h index 796fd2d..f7d8af8 100644 --- a/include/fortify-headers.h +++ b/include/fortify-headers.h @@ -141,8 +141,8 @@ * since gcc seems to like to generate code that relies on dst == src */ #define __fh_overlap(a, len_a, b, len_b) \ ( \ - ((a) < (b) && (b) < ((a) + (__fh_size_t)(len_a))) \ - || ((b) < (a) && (a) < ((b) + (__fh_size_t)(len_b))) \ + ((char*)(a) < (char*)(b) && (char*)(b) < ((char*)(a) + (__fh_size_t)(len_a))) \ + || ((char*)(b) < (char*)(a) && (char*)(a) < ((char*)(b) + (__fh_size_t)(len_b))) \ ) /* diff --git a/tests/Makefile b/tests/Makefile index 32b17b0..d6f5b5d 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,4 +1,4 @@ -CFLAGS+=-I../include/ -D_FORTIFY_SOURCE=3 -static -O2 -DPEDANTIC_CHECKS -Wno-format +CFLAGS+=-I../include/ -D_FORTIFY_SOURCE=3 -static -O2 -DPEDANTIC_CHECKS -Wno-format -Werror=pointer-arith COMPTIME_TARGETS= \ test_memcpy_overwrite_under \ -- cgit v1.3