From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8546 invoked by alias); 22 Aug 2018 12:48:28 -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 8489 invoked by uid 89); 22 Aug 2018 12:48:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=libcpp X-HELO: mail-lf1-f65.google.com Received: from mail-lf1-f65.google.com (HELO mail-lf1-f65.google.com) (209.85.167.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 22 Aug 2018 12:48:25 +0000 Received: by mail-lf1-f65.google.com with SMTP id c7-v6so1314089lfe.0 for ; Wed, 22 Aug 2018 05:48:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bp2s4p/DE//Ty8Wjjz/TSyhTA0YD3BpBwUuCeNPzelA=; b=HPQnDHvcbsLRl3ta0DrIykIjJjqrCoNYx9LIBpgrGXbCAKBBxRGpDY1x4IxqyduEkL hs5gdAe5QACjPgYuhVhGzTwi9OoRhrUdxulnhECGvO2G5r2gEnB7GjTdfCZnmn769PxA nT2nlKoerL7pGMYo9kWY/AKBnbDX9PRj/46j4/LAAMaJlEIp5UedH0d2U0J3icNpQSNu QhczIWylzoD2Ol2EJEweI099HObTaZhkRqb04gy6aPS5u7XAvTdr2fyhHbhNy/b8sVl7 IwesnvZyh/bO8QH7RZUhI2SW/gg5Vrj9hfev7r1ZvbZT1gys66fRhZuxQDP3rdPOg9D6 w0pQ== MIME-Version: 1.0 References: <5ee56fe9-bf96-196f-6bd6-6ecbda2d1ca0@gmail.com> In-Reply-To: <5ee56fe9-bf96-196f-6bd6-6ecbda2d1ca0@gmail.com> From: Richard Biener Date: Wed, 22 Aug 2018 12:48:00 -0000 Message-ID: Subject: Re: [PATCH] print full STRING_CST in Gimple dumps (PR 87052) To: Martin Sebor Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-08/txt/msg01353.txt.bz2 On Wed, Aug 22, 2018 at 4:56 AM Martin Sebor wrote: > > In the discussion of the fallout from the enhancement for pr71625 > it was pointed out that STRING_CSts in Gimple dumps extend only > to the first nul and don't include any subsequent characters, > and that this makes the dumps harder to read and might give rise > to the question whether the code is correct. > > In the attached patch I enhance the pretty_print_string() function > to print the full contents of a STRING_CST, including any embedded > nuls to make the dumps clearer. I got rid of the single digit > escapes like '\1' since they make the string look ambiguous. > If TREE_STRING_LENGTH (node) is guaranteed to be non-zero these > days the test for it being so may be redundant but I figured it's > better to be safe than sorry. > > A further enhancement might be to also distinguish the type of > the STRING_CST. And somehow indicate whether it is \0 terminated (just thinking of the GIMPLE FE and how it parses string literals simply by relying on libcpp). Can you write a not \0 terminated string literal in C? The patch is OK. Thanks, Richard. > > Martin >