From patchwork Mon Jun 27 18:18:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 641174 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rdcdS24JRz9t1K for ; Tue, 28 Jun 2016 04:18:51 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=BRCC2pd8; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=Zc1z2rR/Kk001svcbNYUueD9Z5GVe wrzowUCPnY8l45Xmcpqqg5vi427YBaX8UzNVYJIG1TFHyvnR+DDPdIUD1vIC78SR hHBRSs10FTz3YDDIjzy6/h05kFUVeIVlGbbi6WYQ9VXy+E+W8xhfYUAeApz2CZ3m 7EG3YxJlnGd1b0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=pP27//LXmuFph0AtW/GUHbn8Pt4=; b=BRC C2pd8oRKt5Mgr1rI5XgjGI9gAVleyD38FAmtqxUajjanorxR5uJtooOGPbhpO5Cm 0peLnXdY2kZunuKZY5uPm9IH5g8pcHjko3ltE7I7NzvEELzCEkXZ4XbpwwABbp2T g+he7sr6i0ftcwSBmTaF2AHBtCWxRACAWN01ffP4= Received: (qmail 119742 invoked by alias); 27 Jun 2016 18:18:45 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 119727 invoked by uid 89); 27 Jun 2016 18:18:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 27 Jun 2016 18:18:39 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7E2197F0A4; Mon, 27 Jun 2016 18:18:38 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-51.ams2.redhat.com [10.36.116.51]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5RIIaAv012601 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 27 Jun 2016 14:18:38 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id u5RIIZlN012090; Mon, 27 Jun 2016 20:18:35 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id u5RIIT2Q012089; Mon, 27 Jun 2016 20:18:29 +0200 Date: Mon, 27 Jun 2016 20:18:29 +0200 From: Jakub Jelinek To: Richard Biener , Eric Botcazou Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix ICE with __builtin_*_overflow_p on bitfields (PR rtl-optimization/71673) Message-ID: <20160627181829.GR7387@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes Hi! On targets which don't support sub-word operations trying OPTAB_DIRECT AND on e.g. QImode or HImode leads to NULL being returned, so we ICE on builtin-arith-overflow-p-19.c e.g. on arm, aarch64 or sparc*. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, tested with cross-compiler on the testcase, ok for trunk? 2016-06-27 Jakub Jelinek PR rtl-optimization/71673 * internal-fn.c (expand_arith_overflow_result_store): Use OPTAB_LIB_WIDEN instead of OPTAB_DIRECT as last argument to expand_simple_binop. Jakub --- gcc/internal-fn.c.jj 2016-06-24 13:01:58.000000000 +0200 +++ gcc/internal-fn.c 2016-06-27 13:38:25.753237581 +0200 @@ -454,7 +454,7 @@ expand_arith_overflow_result_store (tree = immed_wide_int_const (wi::shifted_mask (0, prec, false, tgtprec), tgtmode); lres = expand_simple_binop (tgtmode, AND, res, mask, NULL_RTX, - true, OPTAB_DIRECT); + true, OPTAB_LIB_WIDEN); } else {