bug-m4
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Assertion error when building in Debug mode with MSVC


From: Julien Marrec
Subject: Assertion error when building in Debug mode with MSVC
Date: Mon, 24 Jan 2022 17:00:01 +0100

Hello,

I realize this is probably not a combination of platform, compiler and build type that you anticipated. m4 is used in a conan - the C++ package manager - recipe, and it serves as the basis for many other recipes (such as bison).

We encountered an issue when building it with Visual Studio (2019 for eg) in Debug mode (runtime MDd). At runtime, even `m4.exe --version` will throw the following assertion in ucrt.dll

```
minkernel\crts\ucrt\src\appcrt\lowio\close.cpp(49) : Assertion failed: (_osfile(fh) & FOPEN)
```

It seems that there is a double close happening, apparently from something gnulib overrides, as this small example produces exactly the same error:

```
#include <io.h>
#include <stdio.h>
int main() {
    int no =  _fileno (stdin);
    _close(no);
    fclose(stdin);
}
```

An issue can be found there: https://github.com/conan-io/conan-center-index/issues/8920
An older discussion with more information is here: https://github.com/conan-io/conan-center-index/pull/7369#issuecomment-927159346

I have implemented a poor-man's workaround for the time being which consists in calling _CrtSetReportMode early in the main function of m4.c so that the popup isn't triggered and instead it prints to the console, but I would ideally like to see if there isn't a small patch we could do to avoid the double close to begin with.

Could you help please?

Thank you for your time and contributions!
Best,
Julien
--
Julien Marrec, EBCP, BPI MFBA
Owner at EffiBEM
T: +33 6 95 14 42 13

LinkedIn (en) | (fr) :

reply via email to

[Prev in Thread] Current Thread [Next in Thread]