GNU bug report logs - #34106
27.0.50; master build failed with MSYS2/MinGW-w64

Previous Next

Package: emacs;

Reported by: Chris Zheng <chriszheng99 <at> gmail.com>

Date: Wed, 16 Jan 2019 17:29:01 UTC

Severity: normal

Found in version 27.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 34106 in the body.
You can then email your comments to 34106 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#34106; Package emacs. (Wed, 16 Jan 2019 17:29:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chris Zheng <chriszheng99 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 16 Jan 2019 17:29:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Chris Zheng <chriszheng99 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; master build failed with MSYS2/MinGW-w64
Date: Thu, 17 Jan 2019 01:28:26 +0800
When build master branch under MS-Windows I’m seeing this

 CC       pdumper.o
pdumper.c: In function 'dump_cold_bignum':
pdumper.c:3447:53: error: conversion from 'size_t' {aka 'long long unsigned int'} to 'mp_size_t' {aka 'long int'} may change value [-Werror=conversion]
      mp_limb_t limb = mpz_getlimbn (bignum->value, i);
cc1.exe: some warnings being treated as errors

Because with MSYS2/MinGW-w64 the `long' is 32-bit instead of 64-bit.

A explicit cast can fix it.

diff --git a/src/pdumper.c b/src/pdumper.c
index 3787408e6d..9d5ace6c38 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -3444,7 +3444,7 @@ dump_cold_bignum (struct dump_context *ctx, Lisp_Object object)
  Fputhash (object, descriptor, ctx->bignum_data);
  for (size_t i = 0; i < nlimbs; ++i)
    {
-      mp_limb_t limb = mpz_getlimbn (bignum->value, i);
+      mp_limb_t limb = mpz_getlimbn (bignum->value, (mp_size_t) i);
      dump_write (ctx, &limb, sizeof (limb));
    }
}

Thank you,

Chris




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34106; Package emacs. (Wed, 16 Jan 2019 17:45:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andy Moreton <andrewjmoreton <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#34106: 27.0.50; master build failed with MSYS2/MinGW-w64
Date: Wed, 16 Jan 2019 17:44:10 +0000
On Thu 17 Jan 2019, Chris Zheng wrote:

> When build master branch under MS-Windows I’m seeing this
>
>   CC       pdumper.o
> pdumper.c: In function 'dump_cold_bignum':
> pdumper.c:3447:53: error: conversion from 'size_t' {aka 'long long unsigned int'} to 'mp_size_t' {aka 'long int'} may change value [-Werror=conversion]
>        mp_limb_t limb = mpz_getlimbn (bignum->value, i);
> cc1.exe: some warnings being treated as errors
>
> Because with MSYS2/MinGW-w64 the `long' is 32-bit instead of 64-bit.
>
> A explicit cast can fix it.
>
> diff --git a/src/pdumper.c b/src/pdumper.c
> index 3787408e6d..9d5ace6c38 100644
> --- a/src/pdumper.c
> +++ b/src/pdumper.c
> @@ -3444,7 +3444,7 @@ dump_cold_bignum (struct dump_context *ctx, Lisp_Object object)
>    Fputhash (object, descriptor, ctx->bignum_data);
>    for (size_t i = 0; i < nlimbs; ++i)
>      {
> -      mp_limb_t limb = mpz_getlimbn (bignum->value, i);
> +      mp_limb_t limb = mpz_getlimbn (bignum->value, (mp_size_t) i);
>        dump_write (ctx, &limb, sizeof (limb));
>      }
>  }
>
> Thank you,
>
> Chris

The MSYS2/Mingw-w64 build also has a warning:

C:/emacs/git/emacs/master/src/emacs.c: In function 'load_pdump':
C:/emacs/git/emacs/master/src/emacs.c:752:28: warning: field precision specifier '.*' expects argument of type 'int', but argument 3 has type 'size_t' {aka 'long long unsigned int'} [-Wformat=]
     sprintf (dump_file, "%.*s%s", argv0_len - 4, argv[0], suffix);
                          ~~^~     ~~~~~~~~~~~~~

The following patch fixes the warning, and fixes the bug above without
needing a cast:

diff --git a/src/emacs.c b/src/emacs.c
index c1133f2460..834f55b6f3 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -749,7 +749,7 @@ load_pdump (int argc, char **argv)
   /* Remove the .exe extension if present.  */
   argv0_len = strlen (argv[0]);
   if (argv0_len >= 4 && c_strcasecmp (argv[0] + argv0_len - 4, ".exe") == 0)
-    sprintf (dump_file, "%.*s%s", argv0_len - 4, argv[0], suffix);
+    sprintf (dump_file, "%.*s%s", (int)(argv0_len - 4), argv[0], suffix);
   else
 #endif
   sprintf (dump_file, "%s%s", argv[0], suffix);
diff --git a/src/pdumper.c b/src/pdumper.c
index 3787408e6d..db66e1ba26 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -3442,7 +3442,7 @@ dump_cold_bignum (struct dump_context *ctx, Lisp_Object object)
     dump_off_to_lisp ((mpz_sgn (bignum->value) < 0
                        ? -nlimbs : nlimbs)));
   Fputhash (object, descriptor, ctx->bignum_data);
-  for (size_t i = 0; i < nlimbs; ++i)
+  for (mp_size_t i = 0; i < nlimbs; ++i)
     {
       mp_limb_t limb = mpz_getlimbn (bignum->value, i);
       dump_write (ctx, &limb, sizeof (limb));





Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Wed, 16 Jan 2019 18:07:02 GMT) Full text and rfc822 format available.

Notification sent to Chris Zheng <chriszheng99 <at> gmail.com>:
bug acknowledged by developer. (Wed, 16 Jan 2019 18:07:03 GMT) Full text and rfc822 format available.

Message #13 received at 34106-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andy Moreton <andrewjmoreton <at> gmail.com>
Cc: 34106-done <at> debbugs.gnu.org
Subject: Re: bug#34106: 27.0.50; master build failed with MSYS2/MinGW-w64
Date: Wed, 16 Jan 2019 20:06:01 +0200
> From: Andy Moreton <andrewjmoreton <at> gmail.com>
> Date: Wed, 16 Jan 2019 17:44:10 +0000
> 
> The MSYS2/Mingw-w64 build also has a warning:
> 
> C:/emacs/git/emacs/master/src/emacs.c: In function 'load_pdump':
> C:/emacs/git/emacs/master/src/emacs.c:752:28: warning: field precision specifier '.*' expects argument of type 'int', but argument 3 has type 'size_t' {aka 'long long unsigned int'} [-Wformat=]
>      sprintf (dump_file, "%.*s%s", argv0_len - 4, argv[0], suffix);
>                           ~~^~     ~~~~~~~~~~~~~
> 
> The following patch fixes the warning, and fixes the bug above without
> needing a cast:

Thanks, pushed.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34106; Package emacs. (Thu, 17 Jan 2019 05:55:02 GMT) Full text and rfc822 format available.

Message #16 received at 34106 <at> debbugs.gnu.org (full text, mbox):

From: Chris Zheng <chriszheng99 <at> gmail.com>
To: 34106 <at> debbugs.gnu.org
Subject: bug#34106: 27.0.50; master build failed with MSYS2/MinGW-w64
Date: Thu, 17 Jan 2019 13:54:04 +0800
Thank you, Andy and Eli. It builds.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 14 Feb 2019 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 185 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.