unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master 780509f: Improve bignum_integer static checking
       [not found] ` <20190818191251.0828020A0E@vcs0.savannah.gnu.org>
@ 2020-05-06  6:57   ` Andreas Schwab
  2020-05-06 18:03     ` Paul Eggert
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2020-05-06  6:57 UTC (permalink / raw)
  To: emacs-devel; +Cc: Paul Eggert

On Aug 18 2019, Paul Eggert wrote:

> diff --git a/src/bignum.h b/src/bignum.h
> index 743a18f..a9c7a0a 100644
> --- a/src/bignum.h
> +++ b/src/bignum.h
> @@ -83,7 +83,7 @@ mpz_set_uintmax (mpz_t result, uintmax_t v)
>  /* Return a pointer to an mpz_t that is equal to the Lisp integer I.
>     If I is a bignum this returns a pointer to I's representation;
>     otherwise this sets *TMP to I's value and returns TMP.  */
> -INLINE mpz_t *
> +INLINE mpz_t const *
>  bignum_integer (mpz_t *tmp, Lisp_Object i)
>  {
>    if (FIXNUMP (i))

bignum.h: In function ‘bignum_integer’:
bignum.h:111:7: warning: return from incompatible pointer type [enabled by default]
       return tmp;
       ^

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: master 780509f: Improve bignum_integer static checking
  2020-05-06  6:57   ` master 780509f: Improve bignum_integer static checking Andreas Schwab
@ 2020-05-06 18:03     ` Paul Eggert
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggert @ 2020-05-06 18:03 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 322 bytes --]

On 5/5/20 11:57 PM, Andreas Schwab wrote:
> bignum.h: In function ‘bignum_integer’:
> bignum.h:111:7: warning: return from incompatible pointer type [enabled by default]

I guess you are using an old, buggy GCC version. Anyway, I installed the
attached patch to work around the old-GCC false-alarm that I found.

[-- Attachment #2: 0001-Pacify-buggy-old-GCC-with-a-cast.patch --]
[-- Type: text/x-patch, Size: 835 bytes --]

From 02f5a419fdcfb3fb6c8a3e4debe7224010b40227 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Wed, 6 May 2020 10:57:18 -0700
Subject: [PATCH] Pacify buggy old GCC with a cast

* src/bignum.h (bignum_integer): Pacify GCC 4.8.5.
Problem reported by Andreas Schwab in:
https://lists.gnu.org/r/emacs-devel/2020-05/msg00781.html
---
 src/bignum.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/bignum.h b/src/bignum.h
index ad9021f15f..4a906c3c0e 100644
--- a/src/bignum.h
+++ b/src/bignum.h
@@ -108,7 +108,8 @@ bignum_integer (mpz_t *tmp, Lisp_Object i)
   if (FIXNUMP (i))
     {
       mpz_set_intmax (*tmp, XFIXNUM (i));
-      return tmp;
+      /* The unnecessary cast pacifies a buggy GCC 4.8.5.  */
+      return (mpz_t const *) tmp;
     }
   return xbignum_val (i);
 }
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-06 18:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20190818191249.12002.91156@vcs0.savannah.gnu.org>
     [not found] ` <20190818191251.0828020A0E@vcs0.savannah.gnu.org>
2020-05-06  6:57   ` master 780509f: Improve bignum_integer static checking Andreas Schwab
2020-05-06 18:03     ` Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).