From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5ED2938582AC; Fri, 3 Feb 2023 20:15:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5ED2938582AC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675455349; bh=v+Ou4xEBXPRCJZfA7eqedWcH/0f4/3inj7RlBi/gaio=; h=From:To:Subject:Date:From; b=HiNmYzX3q4qP3NXC7HnjCAFsBiz5Qu1FxV6fAiQEfYIj5VvwZ6aJvBmuu8vQ36unc qOjUqaFmC0UCKnRmAxGJ0sLCTsMclR/yEGQOTaiZQyjdKGBGAQqfXrhO7vkKcvPxxD tze4SRPeDwM+pOf1eMUP9xPDvg7m3bATM9Bm5C08= From: "jdx at o2 dot pl" To: gcc-bugs@gcc.gnu.org Subject: [Bug other/108662] New: Cast between incompatible function types in libiberty/physmem.c under MinGW-W64/MSYS2 on Windows 10 Date: Fri, 03 Feb 2023 20:15:49 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: other X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: internal-improvement X-Bugzilla-Severity: normal X-Bugzilla-Who: jdx at o2 dot pl X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone cf_gcchost cf_gccbuild Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108662 Bug ID: 108662 Summary: Cast between incompatible function types in libiberty/physmem.c under MinGW-W64/MSYS2 on Windows 10 Product: gcc Version: 13.0 Status: UNCONFIRMED Keywords: internal-improvement Severity: normal Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: jdx at o2 dot pl Target Milestone: --- Host: x86_64-w64-mingw32 Build: x86_64-w64-mingw32 The following warning appears when gcc is build under MinGW-W64/MSYS2: gcc -c -DHAVE_CONFIG_H -g -O2 -I. -I../../../gcc/libiberty/../include = -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -Wshadow=3Dlocal -pe= dantic -D_GNU_SOURCE ../../../gcc/libiberty/physmem.c -o physmem.o ../../../gcc/libiberty/physmem.c: In function 'physmem_total': ../../../gcc/libiberty/physmem.c:161:18: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'WINBOOL (*)(lMEMORYSTATUSEX *)' {aka 'int (*)(lMEMORYSTATUSEX *)'} [-Wcast-function-type] 161 | if ((pfnex =3D (PFN_MS_EX) GetProcAddress (h, "GlobalMemoryStatusEx"))) | ^ ../../../gcc/libiberty/physmem.c: In function 'physmem_available': ../../../gcc/libiberty/physmem.c:262:18: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'WINBOOL (*)(lMEMORYSTATUSEX *)' {aka 'int (*)(lMEMORYSTATUSEX *)'} [-Wcast-function-type] 262 | if ((pfnex =3D (PFN_MS_EX) GetProcAddress (h, "GlobalMemoryStatusEx"))) | ^ The offending code was added in 2003 (https://gcc.gnu.org/git/?p=3Dgcc.git;a=3Dcommitdiff;h=3Ded935c35314a6fe3b0= c699bf642c704655873d49) and has survived virtually without changes until this day. Perhaps 20 years later it is time to clean the code =E2=80=93 remove definitions of lMEMORYS= TATUSEX and PFN_MS_EX at the top, remove calls to GlobalMemoryStatus (which is pretty m= uch useless these days) and call GlobalMemoryStatusEx directly.=