From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22600 invoked by alias); 16 Sep 2016 22:05:25 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 22589 invoked by uid 89); 16 Sep 2016 22:05:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy=D*polaris, dec, HContent-Transfer-Encoding:7Bit X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 16 Sep 2016 22:05:14 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 23BCB8130A for ; Sat, 17 Sep 2016 00:05:12 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id itdDKzsBB8t2 for ; Sat, 17 Sep 2016 00:05:12 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id EF817812F5 for ; Sat, 17 Sep 2016 00:05:11 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Fix ICE on ACATS test for Aarch64 at -O Date: Fri, 16 Sep 2016 23:55:00 -0000 Message-ID: <1566344.Esnov9ALD2@polaris> User-Agent: KMail/4.14.10 (Linux/3.16.7-42-desktop; KDE/4.14.9; x86_64; ; ) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart42164356.cGnqbcYjYb" Content-Transfer-Encoding: 7Bit X-SW-Source: 2016-09/txt/msg01110.txt.bz2 This is a multi-part message in MIME format. --nextPart42164356.cGnqbcYjYb Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Content-length: 2658 Hi, for the attached reduced testcase, the ICE is: eric@polaris:~/gnat/bugs/P901-028> ~/build/gcc/aarch64-linux/gcc/gnat1 -quiet p.adb -O -I ~/build/gcc/aarch64-linux/gcc/ada/rts +===========================GNAT BUG DETECTED==============================+ | 7.0.0 20160914 (experimental) [trunk revision 240142] (aarch64-linux) GCC error:| | in expand_shift_1, at expmed.c:2451 | | Error detected around p.adb:21:29 #0 internal_error (gmsgid=0x22327b7 "in %s, at %s:%d") at /home/eric/svn/gcc/gcc/diagnostic.c:1347 #1 0x0000000001e2373b in fancy_abort ( file=0x1f965f8 "/home/eric/svn/gcc/gcc/expmed.c", line=2451, function=0x1f96ce7 "expand_shift_1") at /home/eric/svn/gcc/gcc/diagnostic.c:1415 #2 0x0000000000eb435c in expand_shift_1 (code=RSHIFT_EXPR, mode=OImode, shifted=0x7ffff68e02e8, amount=0x7ffff68bcef0, target=0x0, unsignedp=1) at /home/eric/svn/gcc/gcc/expmed.c:2451 #3 0x0000000000eb43bd in expand_shift (code=RSHIFT_EXPR, mode=OImode, shifted=0x7ffff68e02e8, amount=255, target=0x0, unsignedp=1) at /home/eric/svn/gcc/gcc/expmed.c:2467 #4 0x0000000000ebefe3 in emit_store_flag (target=0x7ffff68de780, code=NE, op0=0x7ffff68de798, op1=0x7ffff6c3d400, mode=OImode, unsignedp=1, normalizep=1) at /home/eric/svn/gcc/gcc/expmed.c:5826 #5 0x0000000000ebe979 in emit_store_flag (target=0x7ffff68de780, code=NE, op0=0x7ffff68dc138, op1=0x7ffff68dc030, mode=OImode, unsignedp=1, normalizep=1) at /home/eric/svn/gcc/gcc/expmed.c:5670 #6 0x0000000000ebf0ab in emit_store_flag_force (target=0x7ffff68de780, code=NE, op0=0x7ffff68dc138, op1=0x7ffff68dc030, mode=OImode, unsignedp=1, normalizep=1) at /home/eric/svn/gcc/gcc/expmed.c:5860 #7 0x0000000000ef0aba in do_store_flag (ops=0x7fffffffd4d0, target=0x7ffff68de780, mode=QImode) at /home/eric/svn/gcc/gcc/expr.c:11408 #8 0x0000000000ee6873 in expand_expr_real_2 (ops=0x7fffffffd4d0, target=0x0, tmode=QImode, modifier=EXPAND_NORMAL) at /home/eric/svn/gcc/gcc/expr.c:9196 It's an attempt at generating a store-flag sequence with OImode and it fails because there are no shift operations supported in that mode. It turns out that emit_store_flag_force knows how to fall back on a branchy sequence in that case so the attached patch simply removes the assertion. Tested on x86-64/Linux, OK for the mainline? 2016-09-16 Eric Botcazou * expmed.c (expand_shift_1): Remove assertion and adjust comment. (expand_shift): Adjust comment. -- Eric Botcazou --nextPart42164356.cGnqbcYjYb Content-Disposition: attachment; filename="p.diff" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="p.diff" Content-length: 1194 Index: expmed.c =================================================================== --- expmed.c (revision 240142) +++ expmed.c (working copy) @@ -2247,7 +2247,7 @@ expand_dec (rtx target, rtx dec) and AMOUNT the rtx for the amount to shift by. Store the result in the rtx TARGET, if that is convenient. If UNSIGNEDP is nonzero, do a logical shift; otherwise, arithmetic. - Return the rtx for where the value is. */ + Return the rtx for where the value is or 0 if that cannot be done. */ static rtx expand_shift_1 (enum tree_code code, machine_mode mode, rtx shifted, @@ -2448,7 +2448,6 @@ expand_shift_1 (enum tree_code code, mac define_expand for lshrsi3 was added to vax.md. */ } - gcc_assert (temp); return temp; } @@ -2457,7 +2456,7 @@ expand_shift_1 (enum tree_code code, mac and AMOUNT the amount to shift by. Store the result in the rtx TARGET, if that is convenient. If UNSIGNEDP is nonzero, do a logical shift; otherwise, arithmetic. - Return the rtx for where the value is. */ + Return the rtx for where the value is, or 0 if that cannot be done. */ rtx expand_shift (enum tree_code code, machine_mode mode, rtx shifted, --nextPart42164356.cGnqbcYjYb--