From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E82E23858D35; Sun, 19 Mar 2023 08:57:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E82E23858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679216228; bh=WBIY19dYvpSB6XCv8Ba7qZpbEBb4VKCC1KMh8261bwY=; h=From:To:Subject:Date:From; b=YZvFsS8MM2drMb7HeRVG4XI0msO4AYGY0c5EKHPqHsN4KsWrEAZfTsTqevF4gNtWH ukceEiFunnOFrFUKIqjdwbAwmbGLc3HMqYQonBxL6NOdUlRzV8vzo2+b4n9Zlzkz43 jeUBTcebVbVHGxyZhzx/4/fcytwbyMjyxbhijNk4= From: "jdx at o2 dot pl" To: gcc-bugs@gcc.gnu.org Subject: [Bug other/109189] New: Format string warnings in gcc/config/h8300/h8300.cc under MigW-W64/MSYS2 Date: Sun, 19 Mar 2023 08:57:08 +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_gcctarget attachments.created 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=3D109189 Bug ID: 109189 Summary: Format string warnings in gcc/config/h8300/h8300.cc under MigW-W64/MSYS2 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 Target: h8300-elf Created attachment 54704 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D54704&action=3Dedit Proposed patch I get the following messages when I build different gcc versions (12.2, mas= ter) for H8/300: [...] g++ -fno-PIE -c -g -O2 -DIN_GCC -fPIC -DCROSS_DIRECTORY_STRUCTURE=20= =20 -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrow= ing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -I. -I../../../gcc/gcc -I../../../gcc/gcc/. -I../../../gcc/gcc/../include=20 -I../../../gcc/gcc/../libcpp/include -I../../../gcc/gcc/../libcody=20 -I../../../gcc/gcc/../libdecnumber -I../../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../../gcc/gcc/../libbacktrace -o h8300.o -MT h8300= .o -MMD -MP -MF ./.deps/h8300.TPo ../../../gcc/gcc/config/h8300/h8300.cc ../../../gcc/gcc/config/h8300/h8300.cc: In function 'void h8300_print_operand(FILE*, rtx, int)': ../../../gcc/gcc/config/h8300/h8300.cc:1447:26: warning: format '%ld' expec= ts argument of type 'long int', but argument 3 has type 'long long int' [-Wformat=3D] 1447 | fprintf (file, "#%ld", (-INTVAL (x)) & 0xff); | ^~~~~~ ~~~~~~~~~~~~~~~~~~~~ | | | long long int ../../../gcc/gcc/config/h8300/h8300.cc:1460:26: warning: format '%ld' expec= ts argument of type 'long int', but argument 3 has type 'long long int' [-Wformat=3D] 1460 | fprintf (file, "#%ld", ((-INTVAL (x)) & 0xff00) >> 8); | ^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | long long= int ../../../gcc/gcc/config/h8300/h8300.cc:1468:22: warning: format '%ld' expec= ts argument of type 'long int', but argument 3 has type 'long long int' [-Wformat=3D] 1468 | fprintf (file, "#%ld", 0xff & (-INTVAL (x))); | ^~~~~~ ~~~~~~~~~~~~~~~~~~~~ | | | long long int ../../../gcc/gcc/config/h8300/h8300.cc:1545:26: warning: format '%ld' expec= ts argument of type 'long int', but argument 3 has type 'long long int' [-Wformat=3D] 1545 | fprintf (file, "#%ld", ((INTVAL (x) >> 16) & 0xffff)); | ^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | long long int ../../../gcc/gcc/config/h8300/h8300.cc:1570:26: warning: format '%ld' expec= ts argument of type 'long int', but argument 3 has type 'long long int' [-Wformat=3D] 1570 | fprintf (file, "#%ld", INTVAL (x) & 0xffff); | ^~~~~~ ../../../gcc/gcc/config/h8300/h8300.cc:1624:24: warning: format '%ld' expec= ts argument of type 'long int', but argument 3 has type 'long long int' [-Wformat=3D] 1624 | fprintf (file, "#%ld", (INTVAL (x)) & 0xff); | ^~~~~~ ~~~~~~~~~~~~~~~~~~~ | | | long long int ../../../gcc/gcc/config/h8300/h8300.cc:1632:24: warning: format '%ld' expec= ts argument of type 'long int', but argument 3 has type 'long long int' [-Wformat=3D] 1632 | fprintf (file, "#%ld", (INTVAL (x) >> 8) & 0xff); | ^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~ | | | long long int ../../../gcc/gcc/config/h8300/h8300.cc:1640:24: warning: format '%ld' expec= ts argument of type 'long int', but argument 3 has type 'long long int' [-Wformat=3D] 1640 | fprintf (file, "#%ld", INTVAL (x) & 0xff); | ^~~~~~ ../../../gcc/gcc/config/h8300/h8300.cc:1648:24: warning: format '%ld' expec= ts argument of type 'long int', but argument 3 has type 'long long int' [-Wformat=3D] 1648 | fprintf (file, "#%ld", (INTVAL (x) >> 8) & 0xff); | ^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~ | | | long long int ../../../gcc/gcc/config/h8300/h8300.cc:1656:24: warning: format '%ld' expec= ts argument of type 'long int', but argument 3 has type 'long long int' [-Wformat=3D] 1656 | fprintf (file, "#%ld", (INTVAL (x) >> 16) & 0xff); | ^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~ | | | long long int ../../../gcc/gcc/config/h8300/h8300.cc:1664:24: warning: format '%ld' expec= ts argument of type 'long int', but argument 3 has type 'long long int' [-Wformat=3D] 1664 | fprintf (file, "#%ld", (INTVAL (x) >> 24) & 0xff); | ^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~ | | | long long int=