Compiling issues for 32-bit targets

From: Tatsuo Ishii <ishii(at)postgresql(dot)org>
To: pgpool-hackers(at)lists(dot)postgresql(dot)org
Cc: skandigraun(at)gmail(dot)com
Subject: Compiling issues for 32-bit targets
Date: 2025-09-17 10:47:36
Message-ID: 20250917.194736.353755422175293639.ishii@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgpool-hackers

Gyorgy Sarvari <skandigraun(at)gmail(dot)com> pointed out that snprintf.c has
issues when compiled on 32-bit targets:
https://github.com/pgpool/pgpool2/pull/128

> the compiler was complaining about undefined isnan and ininf functions in
> snprintf.c file

(Moreover he pointed out another issue. will discuss later on)

> When building for 32-bit arm arch, compilation fails with the following error:
> | snprintf.c: In function 'fmtfloat':
> | snprintf.c:1232:13: error: implicit declaration of function 'isnan' [-Wimplicit-function-declaration]
> | 1232 | if (isnan(value))
> | | ^~~~~
> | snprintf.c:50:1: note: include '<math.h>' or provide a declaration of 'isnan'
> | 49 | #include "postgresql/server/port.h"
> | +++ |+#include <math.h>
> | 50 |
> | snprintf.c:1254:21: error: implicit declaration of function 'isinf' [-Wimplicit-function-declaration]
> | 1254 | if (isinf(value))
> | | ^~~~~
> | snprintf.c:1254:21: note: include '<math.h>' or provide a declaration of 'isinf'
>
> To avoid the error, add math.h to snprintf.c.

I think his idea is good. snprintf.c was imported from PostgreSQL long
time ago. If we look into the original file (src/port/snprintf.c) it
actually has "#include <math.h>" already.

If there's no objection, I will push attached patch to all supported
branches. It not only adds math.h, but remove ancient ruin "#if 0" and
sort out the order of including files.

Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp

Attachment Content-Type Size
snprintf.patch text/x-patch 826 bytes

Responses

Browse pgpool-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2025-09-17 23:58:16 Re: Compiling issues for 32-bit targets
Previous Message Tatsuo Ishii 2025-09-16 10:30:12 Re: Proposal: recent access based routing for primary-replica setups