From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D5B033858D33; Tue, 6 Feb 2024 18:37:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D5B033858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707244667; bh=p4pyIMfZ0dPenhsaJ87oN7a+zqCgzTrL5wpe8h3ECfU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=nDDjWEQY8sUeH/fJElC6zs6AnS9ygDow34ZjgeaH5zglGuZFF0mQ1BkxLgq8svIxQ gzR6GkTnVOKOepwZvx6Zmip72WCeRHU0HrDCMSu2WPjXSSZEg5PjG2CSzfZrofrkPN tKL0FOC3/d3iZ6npIXNbBHDjlifUlV+7u6BIj3sU= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/113689] [11/12/13/14 Regression] wrong code with -fprofile -mcmodel=large when needing drap register since r11-6548 Date: Tue, 06 Feb 2024 18:37:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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=3D113689 --- Comment #8 from Jakub Jelinek --- (In reply to Rainer Orth from comment #7) > This patch broke Solaris/x86 (i386-pc-solaris2.11) bootstrap: >=20 > /vol/gcc/src/hg/master/local/gcc/config/i386/i386.cc: In function 'void > x86_function_profiler(std::FILE*, int)': > /vol/gcc/src/hg/master/local/gcc/config/i386/i386.cc:22838:40: error: arr= ay > subscript -1 is below array bounds of 'const char* const [92]' > [-Werror=3Darray-bounds=3D] > 22838 | reg =3D hi_reg_name[scratch]; > | ~~~~~~~~~~~~~~~~~~~^c-include=3D/vol/gcc/incl= ude > /vol/gcc/src/hg/master/local/gcc/config/i386/i386.cc:138:26: note: while > referencing 'hi_reg_name'=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > --with-target-bdw-gc-lib=3D/vol/gcc/lib,amd64=3D/vo 138 | static const c= har > *const hi_reg_name[] =3D HI_REGISTER_NAMES; > | ^~~~~~~~~~~ Guess for the case where we issue sorry we shouldn't return INVALID_REGNUM,= but R10_REG or any other, we acknowledged we aren't emitting correct assembly already. And, as I wrote earlier, I think if we did similar discovery at pro_and_epilogue time and find we otherwise wouldn't have any registers for= it and would sorry at final time, it might be better to just pick some call us= ed register and forcibly save it even when it isn't strictly needed. Then it wouldn't sorry at final time anymore.=