From patchwork Tue May 27 13:13:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schmidt X-Patchwork-Id: 352940 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 021E71400DB for ; Tue, 27 May 2014 23:13:24 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=qgFS5pXmqS/0m4ifDvH2qZHJ09u93Kq4FfQ+v7OfR7R75P QSB9ElHyL7ZF5pCVSG9VEhzuXdJQ1QjlpfVuKEpNc5vF6jGn/qbaL7IcBQSGdfh/ WPLlir0cLf8tjNSvjAqNQzLX2XeOKaAmlCj8apwBCIHVJCk8DTXYeGJbmJbBQ= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=9MLed3OET27CNxYNqZZ3Y3CsXVA=; b=oK/c/xbnU+7IW1AOZ1g4 QY3JzezO4k6tuV1VPZN9cVbyH5ePG9tS3c0ZLa2g2LVNBuOS2i88n7Lb/qwff02A 1MMcm07L0SKjW6trs1+5F+olEqGYlKbYTjpx2hvMw/8poVtRw5BoZ8XHrNYSYpPB c6HQxgXqpzyYjjarKONKJCE= Received: (qmail 23021 invoked by alias); 27 May 2014 13:13:18 -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 23010 invoked by uid 89); 27 May 2014 13:13:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, FROM_12LTRDOM autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 27 May 2014 13:13:15 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1WpHBo-0001yQ-3b from Bernd_Schmidt@mentor.com for gcc-patches@gcc.gnu.org; Tue, 27 May 2014 06:13:12 -0700 Received: from SVR-IES-FEM-02.mgc.mentorg.com ([137.202.0.106]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 27 May 2014 06:13:11 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.2.247.3; Tue, 27 May 2014 14:13:10 +0100 Message-ID: <53848F63.2010500@codesourcery.com> Date: Tue, 27 May 2014 15:13:07 +0200 From: Bernd Schmidt User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: GCC Patches Subject: Mark more constants readonly I noticed that string constants built by the Fortran frontend don't set TREE_READONLY for STRING_CST (and subsequently noticed that nothing seems to set it for COMPLEX_CST). That was confusing the ptx backend I'm working on. The -fwritable-strings option for C was removed a while ago, so I tested the following patch to just set the flag unconditionally, and passed bootstrap and test on x86_64-linux. Ok? Bernd * tree.c (build_string, build_complex): Set TREE_READONLY. diff --git a/gcc/tree.c b/gcc/tree.c index 22b92f3..067f15a 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1755,6 +1755,7 @@ build_string (int len, const char *str) memset (s, 0, sizeof (struct tree_typed)); TREE_SET_CODE (s, STRING_CST); TREE_CONSTANT (s) = 1; + TREE_READONLY (s) = 1; TREE_STRING_LENGTH (s) = len; memcpy (s->string.str, str, len); s->string.str[len] = '\0'; @@ -1776,6 +1777,7 @@ build_complex (tree type, tree real, tree imag) TREE_IMAGPART (t) = imag; TREE_TYPE (t) = type ? type : build_complex_type (TREE_TYPE (real)); TREE_OVERFLOW (t) = TREE_OVERFLOW (real) | TREE_OVERFLOW (imag); + TREE_READONLY (t) = 1; return t; }