From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 71510 invoked by alias); 16 Jan 2020 23:49:18 -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 71374 invoked by uid 89); 16 Jan 2020 23:49:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=punt X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (207.211.31.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 16 Jan 2020 23:49:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579218537; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=beAR1W5nyB2mnEcOJNs43M6yHS8Ch81cbgmrn5jH5lc=; b=QoSmN79dDNiBhRrYbX4wkhL+TvpFyniMXaYlXqSHPX2lq5SHIgw9Rv9yuakm596WrhhLSy fx3ymv0X8wTykjFKu6ndhwKE7EbmKTNMlGF7LoJbuKtBPwoX5sHpOyPe/SW5Tklvsktm0k DkwaoLBfJiEmNI9W0zN77FGqxgcsRQ8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-377-V-ED824kP4i2Dg_KyfjaKg-1; Thu, 16 Jan 2020 18:48:55 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 74F31107ACCC; Thu, 16 Jan 2020 23:48:54 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-204-74.brq.redhat.com [10.40.204.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D84518432E; Thu, 16 Jan 2020 23:48:53 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id 00GNmqvc003538; Fri, 17 Jan 2020 00:48:52 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id 00GNmp35003537; Fri, 17 Jan 2020 00:48:51 +0100 Date: Fri, 17 Jan 2020 01:02:00 -0000 From: Jakub Jelinek To: Richard Biener , Richard Sandiford Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] vect: Fix ICE in vectorizable_comparison PR93292 Message-ID: <20200116234851.GL10088@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 User-Agent: Mutt/1.11.3 (2019-02-01) X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-IsSubscribed: yes X-SW-Source: 2020-01/txt/msg01001.txt.bz2 Hi! The following testcase ICEs on powerpc64le-linux. The problem is that get_vectype_for_scalar_type returns NULL, and while most places in tree-vect-stmts.c handle that case, this spot doesn't and punts only if it is non-NULL, but with different number of elts than expected. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2020-01-16 Jakub Jelinek PR tree-optimization/93292 * tree-vect-stmts.c (vectorizable_comparison): Punt also if get_vectype_for_scalar_type returns NULL. * g++.dg/opt/pr93292.C: New test. --- gcc/tree-vect-stmts.c.jj 2020-01-12 11:54:38.522381590 +0100 +++ gcc/tree-vect-stmts.c 2020-01-16 19:42:30.608888882 +0100 @@ -10492,7 +10492,7 @@ vectorizable_comparison (stmt_vec_info s { vectype =3D get_vectype_for_scalar_type (vinfo, TREE_TYPE (rhs1), slp_node); - if (maybe_ne (TYPE_VECTOR_SUBPARTS (vectype), nunits)) + if (!vectype || maybe_ne (TYPE_VECTOR_SUBPARTS (vectype), nunits)) return false; } else if (maybe_ne (nunits, TYPE_VECTOR_SUBPARTS (vectype))) --- gcc/testsuite/g++.dg/opt/pr93292.C.jj 2020-01-16 19:48:51.110144613 +01= 00 +++ gcc/testsuite/g++.dg/opt/pr93292.C 2020-01-16 19:47:57.351956177 +0100 @@ -0,0 +1,18 @@ +// PR tree-optimization/93292 +// { dg-do compile } +// { dg-options "-O3 -w" } + +struct A { + static int foo (float x) { static int b; b =3D x ? x + 0.5 : 0; return b= ; } +}; + +void +bar (int *d, float e) +{ + float g; + for (int h =3D 0; h < 64; h++) + { + d[h] +=3D A::foo (g < 0 ? : g > 5 ? : g); + A::foo (e); + } +} Jakub