Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Avoid warning about imprecise int to float conversion
- X-seq: zsh-workers 55176
- From: Philippe Altherr <philippe.altherr@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: [PATCH] Avoid warning about imprecise int to float conversion
- Date: Wed, 23 Sep 2026 19:37:03 +0200
- Arc-authentication-results: i=1; mx.google.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=to:subject:message-id:date:from:mime-version:dkim-signature; bh=SWqaY2X6RZHHI/l7z6x4PKbhyasV4gyLtdtOtyECzGE=; fh=BgAYDYpL6Ne/A5nWEMVJiHiBtrz8Imz3uf26RDwgQX4=; b=luOrc4QwlDnf8uw/5oJhfWktyGoCQCATgDAb6lOzvk6+XYpk/DiVjkizhlAFii6Guf geMtq1jkOCsXzaO1a5aEeCt7vTGHXaWWkL8fAXvVP/CnCjxoLp868rXsP0NKx/MJkFbP oGyGUOTHqEqitDBUtMJaCwiKT8ulzx60wZoJ2HI8ygW17yWOT7DnPDAMGOUMqOkJ3sCi kGBjjRV0/IY9ptAac86FBX9KveC4hJePKdC7YSGwfpcy84gLUTMlUYYZU+vOChL6F9VB sI4ii7sLSrF4Z3lGUZkvNSixsPRYhsPN09xXNrRutWuqvMWdNI3qiAOmU7tqG0Ft9Sa9 QDZw==; darn=zsh.org
- Arc-seal: i=1; a=rsa-sha256; t=1790185035; cv=none; d=google.com; s=arc-20260327; b=YQBsslUoBzBUM2RgzwbcUw+joQF0ftW/taRxmKTsh434mHPWBNoT+2Da3+iPlKu04e ahbqFcAqaGCPqc1DLlXrOp/oafIHzoqb6stuIGRkr/hPOx7z/n96JY5SnM/y3UizzuDt J/FHvY/my5A79BSsRXdMCMCKz+SdCgrxnF7ui5bvOAKHy6uuhYtJYi38XNgi79vdIpsU EMU2lZHjQBRwiSi451Vut2aAESYDnRxrDPzCX5JAXEs/9+F+A6KiWOaXsHDA2laTQo8P t3x/oHYueRsyZJHYSprlhlByI9gk+tw1wW7bRh+5QNCpFjG3+Zc/SjZ0CnP27HXS0jWt k3Yw==
- Archived-at: <https://zsh.org/workers/55176>
- List-id: <zsh-workers.zsh.org>
A few months ago, I started getting the following warning:
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -I/usr/local/Cellar/pcre2/10.47_1/include -I/usr/local/Cellar/pcre2/10.47_1/include -DHAVE_CONFIG_H -DMODULE -Wall -Wmissing-prototypes -ggdb -fno-common -o system..o system.c
system.c:642:38: warning: implicit conversion from 'long' to 'double' changes value from 9223372036854775807 to 9223372036854775808
[-Wimplicit-const-int-float-conversion]
642 | || timeout_param.u.d > 0.999 * LONG_MAX) {
| ~ ^~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/21/include/limits.h:51:19: note: expanded from macro 'LONG_MAX'
51 | #define LONG_MAX __LONG_MAX__
| ^~~~~~~~~~~~
<built-in>:62:22: note: expanded from macro '__LONG_MAX__'
62 | #define __LONG_MAX__ 9223372036854775807L
| ^~~~~~~~~~~~~~~~~~~~
1 warning generated.
My gcc version is the following:
% gcc --version
Apple clang version 21.0.0 (clang-2100.1.1.101)
Target: x86_64-apple-darwin25.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
The following patch computes the same value but without warning.
Philippe
diff --git a/Src/Modules/system.c b/Src/Modules/system.c
index 57daf0d87..9ff2318c4 100644
--- a/Src/Modules/system.c
+++ b/Src/Modules/system.c
@@ -639,7 +639,7 @@ bin_zsystem_flock(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
}
timeout_param.u.d = ceil(timeout_param.u.d * 1e6);
if (timeout_param.u.d < 1
- || timeout_param.u.d > 0.999 * LONG_MAX) {
+ || timeout_param.u.d > -(0.999 * LONG_MIN)) {
zwarnnam(nam, "flock: invalid interval value: '%s'",
optarg);
return 1;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author