Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Two issues found with -fsanitize=undefined
On Sat, 19 Sep 2015 20:57:51 +0100
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> --- a/Src/zsh.h
> +++ b/Src/zsh.h
> @@ -36,6 +36,12 @@
> */
> #ifdef ZSH_64_BIT_TYPE
> typedef ZSH_64_BIT_TYPE zlong;
> +#if defind(ZLONG_IS_LONG_LONG) && defined(LLONG_MAX)
I've fixed this, which broke compilation on 32-bit systems with 64-bit
long long.
Here's a patch to neaten up the case (removing a magic number) where
zlong is a 64-bit long.
pws
diff --git a/Src/zsh.h b/Src/zsh.h
index b98fc5c..dd05961 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -39,9 +39,13 @@ typedef ZSH_64_BIT_TYPE zlong;
#if defined(ZLONG_IS_LONG_LONG) && defined(LLONG_MAX)
#define ZLONG_MAX LLONG_MAX
#else
+#ifdef ZLONG_IS_LONG_64
+#define ZLONG_MAX LONG_MAX
+#else
/* umm... */
#define ZLONG_MAX ((zlong)9223372036854775807)
#endif
+#endif
#ifdef ZSH_64_BIT_UTYPE
typedef ZSH_64_BIT_UTYPE zulong;
#else
diff --git a/configure.ac b/configure.ac
index d7db8ba..c3bd713 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1079,9 +1079,15 @@ main() { return sizeof(ino_t) < 8; }
fi
AH_TEMPLATE([ZLONG_IS_LONG_LONG],
[Define to 1 if the zlong type uses long long int.])
+AH_TEMPLATE([ZLONG_IS_LONG_64],
+[Define to 1 if the zlong type uses 64-bit long int.])
if test "$zsh_cv_64_bit_type" = "long long"; then
dnl Remember this so we can get (s)printf output right.
AC_DEFINE(ZLONG_IS_LONG_LONG)
+else
+ if test "$zsh_cv_64_bit_type" = "long"; then
+ AC_DEFINE(ZLONG_IS_LONG_64)
+ fi
fi
dnl We'll blithely assume (f)printf supports the same types as sprintf.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author