From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 35BFE384B0C0; Sun, 26 Apr 2020 15:05:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 35BFE384B0C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1587913559; bh=kRbAUJzTz21oieJzow20t5NR/qoQi+UT4NT47MyutA8=; h=From:To:Subject:Date:From; b=ujTl5f1A2cTFkTLkPim7MkxSq0PpHPMP3Lb4/xuHtA+UcOcCpSSsG0+KL9fD+wzIp N9qJuSRWVpMK7jqRPOJO21ZCVHwl6zQOce6PLoaCLVmhHyMiTgeLuAXhpbkg0zmfsX 4VaIMTvdfuvaD60qcdo9+/Lib6wfhf05cGSgEkBw= From: "stefansf at linux dot ibm.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/94774] New: Uninitialized variable retval in function try_substitute_return_value Date: Sun, 26 Apr 2020 15:05:58 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: stefansf at linux dot ibm.com 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 bug_severity priority component assigned_to reporter target_milestone 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2020 15:05:59 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94774 Bug ID: 94774 Summary: Uninitialized variable retval in function try_substitute_return_value Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: stefansf at linux dot ibm.com Target Milestone: --- Created attachment 48377 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D48377&action=3Dedit If SAFE then retval was initialised While bootstrapping GCC on S/390 the following warning/error gets thrown: gcc/gimple-ssa-sprintf.c: In function 'bool handle_printf_call(gimple_stmt_iterator*, const vr_values*)':=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 gcc/gimple-ssa-sprintf.c:4184:8: error: '*((void*)& retval +8)' may be used uninitialized in this function [-Werror=3Dmaybe-uninitialized] 4183 | && (retval[0] < target_int_max () | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4184 | && retval[1] < target_int_max ())) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ gcc/gimple-ssa-sprintf.c:4123:26: note: '*((void*)& retval +8)' was declared here 4123 | unsigned HOST_WIDE_INT retval[2]; | ^~~~~~ gcc/gimple-ssa-sprintf.c:4214:14: error: 'retval' may be used uninitialized= in this function [-Werror=3Dmaybe-uninitialized] 4214 | fprintf (dump_file, " %s %s-bounds return value " | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4215 | HOST_WIDE_INT_PRINT_UNSIGNED ".\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4216 | what, inbounds, retval[0]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ gcc/gimple-ssa-sprintf.c:4123:26: note: 'retval' was declared here 4123 | unsigned HOST_WIDE_INT retval[2]; | ^~~~~~ The attached patch fixes this for me. Otherwise, one could also just initia= lize array retval which may be more appropriate?=