From patchwork Sat Jun 11 15:01:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Edlinger X-Patchwork-Id: 634077 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 3rRj2H5Qbyz9stY for ; Sun, 12 Jun 2016 01:02:29 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=Ium8F5CY; 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:from :to:cc:subject:date:message-id:content-type:mime-version; q=dns; s=default; b=i0bEzOlljLjwHG+GC7B1sqsZJU96TSvZ8uml94FA/PFiSqnp3j 7jSt8W7UGGCMJjhsgbg9YLyYAckLifr4HCWrR5M7FK8fuNLcJnIsC6VLnCL9Akth vk041DQo2bZ5aY76/f+yD2D5SKjPbuUToIXzluPp5pRnZSxdec21KGVes= 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:from :to:cc:subject:date:message-id:content-type:mime-version; s= default; bh=+OdVfPA6lWy1g8s5jZSFIbX8O5E=; b=Ium8F5CYQQ3gq1plUD2m aQnn4zwPHs1O1XwikH3RmGKqsNq646kurYx5a1hEJcUSfpsT9xekWEbxcSDCjX1g ozxbIRvlkaq/CwQfNx8zQ7k4G3O5Cygf938rAOiRsdkuXqvk0jTv/wzXQICQYf0s s0iUawMbfxdWsuWXH/SDiCg= Received: (qmail 91066 invoked by alias); 11 Jun 2016 15:02:22 -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 91056 invoked by uid 89); 11 Jun 2016 15:02:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 spammy=Hx-spam-relays-external:sk:BAY004-, H*RU:sk:BAY004-, Hx-spam-relays-external:15.01.0511.013, H*r:15.01.0511.013 X-HELO: BAY004-OMC3S3.hotmail.com Received: from bay004-omc3s3.hotmail.com (HELO BAY004-OMC3S3.hotmail.com) (65.54.190.141) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA256 encrypted) ESMTPS; Sat, 11 Jun 2016 15:02:11 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com ([65.54.190.189]) by BAY004-OMC3S3.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Sat, 11 Jun 2016 08:02:10 -0700 Received: from DB5EUR01FT008.eop-EUR01.prod.protection.outlook.com (10.152.4.52) by DB5EUR01HT079.eop-EUR01.prod.protection.outlook.com (10.152.4.189) with Microsoft SMTP Server (TLS) id 15.1.497.8; Sat, 11 Jun 2016 15:01:55 +0000 Received: from AM4PR0701MB2162.eurprd07.prod.outlook.com (10.152.4.59) by DB5EUR01FT008.mail.protection.outlook.com (10.152.4.96) with Microsoft SMTP Server (TLS) id 15.1.511.7 via Frontend Transport; Sat, 11 Jun 2016 15:01:54 +0000 Received: from AM4PR0701MB2162.eurprd07.prod.outlook.com ([10.167.132.147]) by AM4PR0701MB2162.eurprd07.prod.outlook.com ([10.167.132.147]) with mapi id 15.01.0511.013; Sat, 11 Jun 2016 15:01:53 +0000 From: Bernd Edlinger To: GCC Patches CC: Jakub Jelinek , Jeff Law , "Richard Henderson" Subject: [PATCH] Fix ICE with invalid use of flags output operand Date: Sat, 11 Jun 2016 15:01:53 +0000 Message-ID: authentication-results: spf=softfail (sender IP is 25.152.4.59) smtp.mailfrom=hotmail.de; redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=none action=none header.from=hotmail.de; received-spf: SoftFail (protection.outlook.com: domain of transitioning hotmail.de discourages use of 25.152.4.59 as permitted sender) x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [mNovYtdn1CmGwY7GN7KhCo7/wdT+Rd7S] x-eopattributedmessage: 0 x-forefront-antispam-report: CIP:25.152.4.59; IPV:NLI; CTRY:GB; EFV:NLI; SFV:NSPM; SFS:(10019020)(98900003); DIR:OUT; SFP:1102; SCL:1; SRVR:DB5EUR01HT079; H:AM4PR0701MB2162.eurprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; x-ms-office365-filtering-correlation-id: 779c8997-8b51-439d-7715-08d39209532e x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(1601124038)(5061506196)(5061507196)(1603103041)(1601125047); SRVR:DB5EUR01HT079; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(432015012)(102415321)(82015046); SRVR:DB5EUR01HT079; BCL:0; PCL:0; RULEID:; SRVR:DB5EUR01HT079; x-forefront-prvs: 0970508454 MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jun 2016 15:01:53.4630 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5EUR01HT079 Hi, this fixes an ICE that happens when an asm statement tries to print the flags output operand. Boot-strapped and reg-tested on x86_64-linux-gnu. OK for trunk? Thanks Bernd. gcc: 2016-06-11 Bernd Edlinger * config/i386/i386.c (print_reg): Emit an error message on attempt to print FLAGS_REG. testsuite: 2016-06-11 Bernd Edlinger * gcc.target/i386/asm-flag-7.c: New test. Index: gcc/config/i386/i386.c =================================================================== --- gcc/config/i386/i386.c (revision 237323) +++ gcc/config/i386/i386.c (working copy) @@ -17180,10 +17180,15 @@ print_reg (rtx x, int code, FILE *file) gcc_assert (regno != ARG_POINTER_REGNUM && regno != FRAME_POINTER_REGNUM - && regno != FLAGS_REG && regno != FPSR_REG && regno != FPCR_REG); + if (regno == FLAGS_REG) + { + output_operand_lossage ("invalid use of asm flag output"); + return; + } + duplicated = code == 'd' && TARGET_AVX; switch (msize) Index: gcc/testsuite/gcc.target/i386/asm-flag-7.c =================================================================== --- gcc/testsuite/gcc.target/i386/asm-flag-7.c (revision 0) +++ gcc/testsuite/gcc.target/i386/asm-flag-7.c (working copy) @@ -0,0 +1,9 @@ +/* Test error conditions of asm flag outputs. */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void test(void) +{ + char x; + asm("# %0" : "=@ccz"(x)); /* { dg-error "invalid use of asm flag output" } */ +}