From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 01BD4385801E; Mon, 18 Oct 2021 16:05:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 01BD4385801E From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/100316] [11/12 Regression] __clear_cache() does not support NULL-pointer arguments Date: Mon, 18 Oct 2021 16:05:33 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: kito at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.3 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 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: Mon, 18 Oct 2021 16:05:34 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100316 --- Comment #4 from CVS Commits --- The releases/gcc-11 branch has been updated by Kito Cheng : https://gcc.gnu.org/g:aa827fa170d3e61d17c3daaf4d5008a3c674a005 commit r11-9170-gaa827fa170d3e61d17c3daaf4d5008a3c674a005 Author: Kito Cheng Date: Thu Oct 7 16:17:13 2021 +0800 [PR/target 100316] Allow constant address for __builtin___clear_cache. __builtin___clear_cache was able to accept constant address for the argument, but it seems no longer accept recently, and it even not accept constant address which is hold in variable when optimization is enable: ``` void foo3(){ void *yy =3D (void*)0x1000; __builtin___clear_cache(yy, yy); } ``` So this patch make BEGIN and END accept VOIDmode, like cselib_lookup_mem did per Jim Wilson's suggestion. ``` static cselib_val * cselib_lookup_mem (rtx x, int create) { ... addr_mode =3D GET_MODE (XEXP (x, 0)); if (addr_mode =3D=3D VOIDmode) addr_mode =3D Pmode; ``` Changes v2 -> v3: - Use gcc_assert rather than error, maybe_emit_call_builtin___clear_cac= he is internal use only, and we already checked the type in other place. Changes v1 -> v2: - Check is CONST_INT intead of cehck mode, no new testcase, since constant value with other type like CONST_DOUBLE will catched by front-end. e.g. Code: ```c void foo(){ __builtin___clear_cache(1.11, 0); } ``` Error message: ``` clearcache-double.c: In function 'foo': clearcache-double.c:2:27: error: incompatible type for argument 1 of '__builtin___clear_cache' 2 | __builtin___clear_cache(1.11, 0); | ^~~~ | | | double clearcache-double.c:2:27: note: expected 'void *' but argument is of ty= pe 'double' ``` gcc/ChangeLog: PR target/100316 * builtins.c (maybe_emit_call_builtin___clear_cache): Allow CONST_INT for BEGIN and END, and use gcc_assert rather than error. gcc/testsuite/ChangeLog: PR target/100316 * gcc.c-torture/compile/pr100316.c: New. (cherry picked from commit 4e5bc4e4506a7ae7bb88fc925a425652a1da6b2d)=