Regression with snprintf in MinGW-w64 targeting Win32

Bug #1987373 reported by nanake
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
gcc-mingw-w64 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

There are projects that their configure rely on the check `AC_CHECK_FUNC([snprintf]`.

In Ubuntu jammy, this ran without any error:

`
docker run --rm -i ghcr.io/nanake/byouri/ubuntu-jammy-win32:latest bash -s <<-EOF
    {
      echo "char snprintf();"
      echo
      echo "int main () { return snprintf (); }"
    } >> snprintftest.c
    i686-w64-mingw32-gcc -Wall snprintftest.c
EOF
`

`
snprintftest.c:1:6: warning: conflicting types for built-in function 'snprintf'; expected 'int(char *, unsigned int, const char *, ...)' [-Wbuiltin-declaration-mismatch]
    1 | char snprintf();
      | ^~~~~~~~
snprintftest.c:1:1: note: 'snprintf' is declared in header '<stdio.h>'
  +++ |+#include <stdio.h>
    1 | char snprintf();
`

But ubuntu kinetic:

`
docker run --rm -i ghcr.io/nanake/byouri/ubuntu-kinetic-win32:latest bash -s <<-EOF
    {
      echo "char snprintf();"
      echo
      echo "int main () { return snprintf (); }"
    } >> snprintftest.c
    i686-w64-mingw32-gcc -Wall snprintftest.c
EOF
`

`
snprintftest.c:1:6: warning: conflicting types for built-in function 'snprintf'; expected 'int(char *, unsigned int, const char *, ...)' [-Wbuiltin-declaration-mismatch]
    1 | char snprintf();
      | ^~~~~~~~
snprintftest.c:1:1: note: 'snprintf' is declared in header '<stdio.h>'
  +++ |+#include <stdio.h>
    1 | char snprintf();
/usr/bin/i686-w64-mingw32-ld: /usr/lib/gcc/i686-w64-mingw32/10-win32/../../../../i686-w64-mingw32/lib/../lib/libmsvcrt.a(lib32_libmsvcrt_extra_a-_vscprintf.o): in function `_mingw_get_msvcrt_handle':
./build/i686-w64-mingw32-i686-w64-mingw32-crt/./mingw-w64-crt/include/msvcrt.h:9: undefined reference to `_imp__GetModuleHandleW@4'
collect2: error: ld returned 1 exit status
Error: Process completed with exit code 1.
`

It works with MinGW 10 targeting win64.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gcc-mingw-w64 (Ubuntu):
status: New → Confirmed
Revision history for this message
Phil Krylov (phil-krylov) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.