From cd504e49bcece187dee85b33e39f72b5eab53cda Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Tue, 30 Nov 2010 21:07:55 -0200 Subject: [PATCH] Workaround a GCC warning about a pointer being cast to a larger integral type. Use intptr which is designed to hold pointer values and pass it to off_t. mysys/stacktrace.c: Add a compile time assert to ensure that off_t is large enough to hold the pointer value. --- mysys/stacktrace.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index b6bf88cf3e1..93e8ae6b508 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -87,8 +87,11 @@ static int safe_print_str(const char *addr, int max_len) if ((fd= open(buf, O_RDONLY)) < 0) return -1; + /* Ensure that off_t can hold a pointer. */ + compile_time_assert(sizeof(off_t) >= sizeof(intptr)); + total= max_len; - offset= (off_t) addr; + offset= (intptr) addr; /* Read up to the maximum number of bytes. */ while (total)