From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4171 invoked by alias); 30 Jun 2008 21:02:34 -0000 Received: (qmail 4158 invoked by uid 22791); 30 Jun 2008 21:02:33 -0000 X-Spam-Check-By: sourceware.org Received: from nf-out-0910.google.com (HELO nf-out-0910.google.com) (64.233.182.189) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 30 Jun 2008 21:02:06 +0000 Received: by nf-out-0910.google.com with SMTP id c10so611164nfd.6 for ; Mon, 30 Jun 2008 14:02:04 -0700 (PDT) Received: by 10.210.118.7 with SMTP id q7mr4572680ebc.198.1214859724021; Mon, 30 Jun 2008 14:02:04 -0700 (PDT) Received: from localhost ( [79.75.55.39]) by mx.google.com with ESMTPS id q9sm4010693gve.5.2008.06.30.14.02.02 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 30 Jun 2008 14:02:03 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: RFA: Fix resource.c handling of unspec_volatile Date: Mon, 30 Jun 2008 21:23:00 -0000 Message-ID: <87d4lyab7a.fsf@firetop.home> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 X-SW-Source: 2008-06/txt/msg01965.txt.bz2 This patch fixes some libgomp.fortran/nested1.f90 and libfortran/reference1.f90 failures for MIPS. The problem was that, when looking for used registers, resource.c:mark_referenced_resources did not look inside the UNSPEC_VOLATILE part of a sync instruction. It therefore mistakenly thought that one of the sync operands was dead. It's unsafe in general to ignore operands, so I think we should extend the TRAP_IF behaviour to UNSPEC_VOLATILE and ASM_INPUT. Tested on mips64el-linux-gnu and x86_64-linux-gnu (as a sanity check). OK to install? Richard gcc/ * resource.c (mark_referenced_resources): Look inside UNSPEC_VOLATILEs and ASM_INPUTs. Index: gcc/resource.c =================================================================== --- gcc/resource.c 2008-06-29 22:42:24.000000000 +0100 +++ gcc/resource.c 2008-06-29 22:42:58.000000000 +0100 @@ -266,13 +266,10 @@ mark_referenced_resources (rtx x, struct return; case UNSPEC_VOLATILE: + case TRAP_IF: case ASM_INPUT: /* Traditional asm's are always volatile. */ res->volatil = 1; - return; - - case TRAP_IF: - res->volatil = 1; break; case ASM_OPERANDS: