From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12031 invoked by alias); 1 Mar 2018 23:10:56 -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 12014 invoked by uid 89); 1 Mar 2018 23:10:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 01 Mar 2018 23:10:54 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 44B7840FB646; Thu, 1 Mar 2018 23:10:43 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-204-85.brq.redhat.com [10.40.204.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F242F10AF9D2; Thu, 1 Mar 2018 23:10:42 +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 w21NAe6M026319; Fri, 2 Mar 2018 00:10:41 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id w21NAecv026318; Fri, 2 Mar 2018 00:10:40 +0100 Date: Thu, 01 Mar 2018 23:10:00 -0000 From: Jakub Jelinek To: Uros Bizjak Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix ICE on invalid inline asm with "X" constraint and non-zero CONST_VECTOR (PR inline-asm/84625) Message-ID: <20180301231040.GU5867@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.1 (2017-09-22) X-IsSubscribed: yes X-SW-Source: 2018-03/txt/msg00070.txt.bz2 Hi! Assertions are only useful when inline asm is not involved, otherwise users can write anything they want. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2018-03-02 Jakub Jelinek PR inline-asm/84625 * config/i386/i386.c (ix86_print_operand): Use conditional output_operand_lossage instead of gcc_assert if CONST_VECTOR is not zero vector. * gcc.target/i386/pr84625.c: New test. --- gcc/config/i386/i386.c.jj 2018-02-26 20:49:57.345331383 +0100 +++ gcc/config/i386/i386.c 2018-03-01 12:01:17.820587068 +0100 @@ -18743,7 +18743,8 @@ ix86_print_operand (FILE *file, rtx x, i since we can in fact encode that into an immediate. */ if (GET_CODE (x) == CONST_VECTOR) { - gcc_assert (x == CONST0_RTX (GET_MODE (x))); + if (x != CONST0_RTX (GET_MODE (x))) + output_operand_lossage ("invalid vector immediate"); x = const0_rtx; } --- gcc/testsuite/gcc.target/i386/pr84625.c.jj 2018-03-01 12:00:06.254636914 +0100 +++ gcc/testsuite/gcc.target/i386/pr84625.c 2018-03-01 12:14:54.044024998 +0100 @@ -0,0 +1,12 @@ +/* PR inline-asm/84625 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2" } */ + +typedef int V __attribute__((vector_size (16))); + +void +foo (void) +{ + asm volatile ("# %0" : : "X" ((V) { 1, 2, 3, 4 })); // { dg-error "invalid vector immediate" } + asm volatile ("# %0" : : "" ((V) { 2, 3, 4, 5 })); // { dg-error "invalid vector immediate" } +} Jakub