From patchwork Fri Dec 18 18:38:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schmidt X-Patchwork-Id: 559046 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 5430C1402A8 for ; Sat, 19 Dec 2015 05:38:45 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=pDZmhNv5; 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:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=rcOcERdmQ6MVZqI4S76RebyPnT15c14KlpQ/k1W1xGhgDmMlex 4fdiSZ0cfH8y4GCOWFCdq49XE2ZJYLWlwCvNRwQVYv2wRQ3+P6WBCO7I7scVMRsd 7WqIn9XQUDTYQIlCaJGD0daHCx509nngz1O+vGMgmUGP64xT6DzR84v3A= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=AZJPb4KoXY4IYw9xqFgD31BqzX8=; b=pDZmhNv5tZdk8hGjq0bt OWwYYi0lqhHF99quK5eJNtvuTThrr8cSZTGc+1ZoMUQCMtH4353XcKLmBYRxJVbK H+JcMo71ajEkOHG4MYEe2a0w0joum4nLO9Qk9a+y3SGDO991fJh9Q3v8O1KgaJpD Ii7WbPByvZgcoo1lro+MD7k= Received: (qmail 120813 invoked by alias); 18 Dec 2015 18:38:37 -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 120802 invoked by uid 89); 18 Dec 2015 18:38:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.1 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=Hx-languages-length:1900, 231653, pretend, H*Ad:D*t-online.de X-HELO: mailout04.t-online.de Received: from mailout04.t-online.de (HELO mailout04.t-online.de) (194.25.134.18) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 18 Dec 2015 18:38:34 +0000 Received: from fwd04.aul.t-online.de (fwd04.aul.t-online.de [172.20.26.149]) by mailout04.t-online.de (Postfix) with SMTP id 85C06BDAEC for ; Fri, 18 Dec 2015 19:38:31 +0100 (CET) Received: from [192.168.2.105] (bVsmzvZ1whyvBE9rBuSUN5sznsT-d2Lc1MXHlUehPD8Nww1KF77YOcBgzgcsqiZg27@[87.169.203.104]) by fwd04.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-SHA encrypted) esmtp id 1a9zvC-0cuQ400; Fri, 18 Dec 2015 19:38:30 +0100 To: GCC Patches From: Bernd Schmidt Subject: Fix PR67639 Message-ID: <5674529D.904@t-online.de> Date: Fri, 18 Dec 2015 19:38:21 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 X-IsSubscribed: yes In an earlier fix, the following change was made in varasm.c for invalid register variables: internal error where we expect to see an SSA_NAME instead of a VAR_DECL. The following patch extends the above slightly, by also setting DECL_EXTERNAL to pretend that the erroneous variable is actually a global. Bootstrapped and tested on x86_64-linux, ok? Bernd PR middle-end/67639 * varasm.c (make_decl_rtl): Mark invalid register vars as DECL_EXTERNAL. testsuite/ PR middle-end/67639 * c-c++-common/pr67639.c: New test. Index: gcc/testsuite/c-c++-common/pr67639.c =================================================================== --- gcc/testsuite/c-c++-common/pr67639.c (revision 0) +++ gcc/testsuite/c-c++-common/pr67639.c (working copy) @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +void +foo (int p) +{ + int t; + register long x asm ("rhubarb") = p; /* { dg-error "register name" } */ + __asm ("" : "=r" (t), "=r" (t), "=r" (t), "=r" (x) : "0" (x)); +} Index: gcc/varasm.c =================================================================== --- gcc/varasm.c (revision 231653) +++ gcc/varasm.c (working copy) @@ -1420,6 +1420,9 @@ make_decl_rtl (tree decl) specifications. */ SET_DECL_ASSEMBLER_NAME (decl, NULL_TREE); DECL_HARD_REGISTER (decl) = 0; + /* Also avoid SSA inconsistencies by pretending this is an external + decl now. */ + DECL_EXTERNAL (decl) = 1; return; } /* Now handle ordinary static variables and functions (in memory).