Re: Assertion error when building in Debug mode with MSVC
Paul Eggert <[email protected]> Wed, 26 Jan 2022 10:37:04 -0800
| Newsgroups | gmane.comp.lib.gnulib.bugs,gmane.comp.gnu.m4.bugs |
|---|---|
| Organization | UCLA Computer Science Department |
| Message-ID | <[email protected]> |
On 1/26/22 01:45, Julien Marrec wrote: > Hello Paul, > > I’m not sure why you say it’s a local variable. It’s a “FILE *” isn’t it? A FILE * is a pointer, and can be either local or global. This one's local. > [1] If you want to reproduce, and have conan installed and MSVC 2019, this > command should do it Ships passing in the night, I'm afraid. I don't use MSVC. I installed the attached patch into Gnulib and propagated this into m4 on Savannah so it should appear in the next m4 release. In the meantime you can build with /MD instead of /MDd. Or if you want to learn the GNU build system you can build m4 from Git. This is actually a false alarm in /MDd, since POSIX says fclose is supposed to fail with errno == EBADF instead of crashing when the underlying file descriptor is closed. Although Microsoft doesn't claim POSIX conformance, maybe you can file a bug report with them to save other people this kind of hassle. All the attached does is work around the /MDd bug.
0001-close-stream-avoid-crash-on-MSVC-Debug-mode.patch
(text/x-patch, 1.2 KB)
From 364c5ba2e40d17e98cc66021ef893e30a009068b Mon Sep 17 00:00:00 2001 From: Paul Eggert <[email protected]> Date: Wed, 26 Jan 2022 09:33:03 -0800 Subject: [PATCH] close-stream: avoid crash on MSVC Debug mode Problem reported by Julien Marrec in: https://lists.gnu.org/r/bug-m4/2022-01/msg00000.html * modules/close-stream (Depends-on): Depend on fclose. --- ChangeLog | 7 +++++++ modules/close-stream | 1 + 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index fc4e46747b..f0e65522ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2022-01-26 Paul Eggert <[email protected]> + + close-stream: avoid crash on MSVC Debug mode + Problem reported by Julien Marrec in: + https://lists.gnu.org/r/bug-m4/2022-01/msg00000.html + * modules/close-stream (Depends-on): Depend on fclose. + 2022-01-23 Paul Eggert <[email protected]> xstrtoimax, xstrtoumax: depend on inttypes-incomplete diff --git a/modules/close-stream b/modules/close-stream index 78ed207992..4fce2ea233 100644 --- a/modules/close-stream +++ b/modules/close-stream @@ -6,6 +6,7 @@ lib/close-stream.h lib/close-stream.c Depends-on: +fclose fpending stdbool -- 2.32.0