From patchwork Thu Aug 2 19:46:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 952956 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-483061-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ywvspXKb"; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="He+3y8qU"; dkim-atps=neutral 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 41hLJr6Cv0z9s0R for ; Fri, 3 Aug 2018 05:46:18 +1000 (AEST) 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=iEjli1XGtti5gW1GdobnfHIBQR0ou2vV773yqIsDiZjWjR17wU U3Ak8s49JbunhQno/pBHWE4pFkI1+uRhBp4gGawkDikJEKLB7vfPQyvXjWkIxOoB ZqlM2ZbFfA5EDZvR+san/Ky1Xxp3p0Cw9e76ERCwmcBnupoc3W7gmcFAw= 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=/yHNKU6BrKzBSAw+e2dLN/qMsfw=; b=ywvspXKblht/cWpbfJfm 4OWlImaVBpfO+sJ7krfGAbwcrasKqSOj7AbnvSWwN+A8KOs3DnCXAS7MCRQLPy0I wVOhKSKmYqL4npjM07DffuQFO7eiOJXOPP2+yPAxuHhEOFs8Y5P1HF1XwGWuQ3+C hQs0G6FVg3+s3EhZaf3ZKx8= Received: (qmail 86091 invoked by alias); 2 Aug 2018 19:46:11 -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 86078 invoked by uid 89); 2 Aug 2018 19:46:10 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=20148, reflects X-HELO: mail-qk0-f175.google.com Received: from mail-qk0-f175.google.com (HELO mail-qk0-f175.google.com) (209.85.220.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 02 Aug 2018 19:46:09 +0000 Received: by mail-qk0-f175.google.com with SMTP id 27-v6so2468164qkv.0 for ; Thu, 02 Aug 2018 12:46:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version; bh=rUhlTmV9+zivAfNvO13bkWkw0FHQ45O6BmHujzL+HRU=; b=He+3y8qUNzzuMXV+MIPSlq4zlSb08KGMDhzTQT1bW818/sAner9wC2GDrkOOoZLTix IpEf4IQihzHU+FMv+j2z6VWevUdMITIarrk4VTQ0KeOkXZQ0OwhVtD1jB/tVSSrIPtyJ Afrff004BJkS8GKjZIkCKeYT+O9UcAOJSmkHR+qqVfnAfQS4Lv02F6AulGqZBug+cALr xIt9wjPDSeBdCSKXiKGYN5IcKlPznKUBxpzWPJTbwmGYjTUaxLKF2v/POdFjJ689sqtm N736z0kUzK8apjIEcZUjeJ3TIaEaW8ijm182yfiagOHiJQBiSgRidFG4+rnVfAGP9aod F9aQ== Received: from localhost.localdomain (97-118-124-30.hlrn.qwest.net. [97.118.124.30]) by smtp.gmail.com with ESMTPSA id t27-v6sm2539087qkl.11.2018.08.02.12.46.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Aug 2018 12:46:06 -0700 (PDT) To: Gcc Patch List , David Edelsohn From: Martin Sebor Subject: [PATCH] adjust sprintf range for AIX QNaN output (PR 86571) Message-ID: <9fafd917-d668-5234-adcb-d99c7546c3cb@gmail.com> Date: Thu, 2 Aug 2018 13:46:04 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 X-IsSubscribed: yes The recently added test gcc.dg/torture/builtin-sprintf.c to verify that the sprintf result computed by GCC matches libc's for Infinity and NaN has been failing on AIX which formats NaN as either QNaN or SNaN, contrary to C/POSIX requirements. The attached tweak adjusts the result computed by GCC to include the AIX format. If there are no objections I'll commit the tweak later this week and backport it to GCC 8 the next. Martin PR tree-optimization/86571 - AIX NaNQ and NaNS output format conflicts with __builtin_sprintf gcc/ChangeLog: PR tree-optimization/86571 * gimple-ssa-sprintf.c (format_floating): Extend upper bound of NaN output to 4. Index: gcc/gimple-ssa-sprintf.c =================================================================== --- gcc/gimple-ssa-sprintf.c (revision 263268) +++ gcc/gimple-ssa-sprintf.c (working copy) @@ -2014,8 +2014,15 @@ format_floating (const directive &dir, tree arg, v res.range.likely = res.range.min; res.range.max = res.range.min; - /* The inlikely maximum is "[-/+]infinity" or "[-/+]nan". */ - res.range.unlikely = sign + (real_isinf (rvp) ? 8 : 3); + /* The unlikely maximum is "[-/+]infinity" or "[-/+][qs]nan". + For NaN, the C/POSIX standards specify two formats: + "[-/+]nan" + and + "[-/+]nan(n-char-sequence)" + No known printf implementation outputs the latter format but AIX + outputs QNaN and SNaN for quiet and signalling NaN, respectively, + so the unlikely maximum reflects that. */ + res.range.unlikely = sign + (real_isinf (rvp) ? 8 : 4); /* The range for infinity and NaN is known unless either width or precision is unknown. Width has the same effect regardless