From patchwork Tue Jul 21 11:52:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mikael Morin X-Patchwork-Id: 498171 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 5490D1402D7 for ; Tue, 21 Jul 2015 21:53:17 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=C4ZXdljj; 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:from :subject:to:message-id:date:mime-version:content-type; q=dns; s= default; b=lPoWGG3y5CKg7aVcXcvJpMg2Jy9HKH8a/cWC4u+bTwaWHrOnQPCrA kElCRAmTvm6OPE8JeI45KKeZWLCIT+BRiieJcV8czCOLYIHM9HcuXnKL5EhDxTlt Vl9SL0tOz1SmSIPaycYxz2K8ef1bJ+quR/kQqPdlR/PFYqRdmEsmYs= 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:from :subject:to:message-id:date:mime-version:content-type; s= default; bh=xD1BRYRqXNCBJ/fq9PeiZdSYLtc=; b=C4ZXdljj6zhKlIl9cGBa UTwWmvSq+KczaDX+So2FR57hsroV4OsAiHSLiHZT9XNj16B5KlRtZOGa6V2HVwUU 7lgtvVDhm1bE6kdw7qRta0TGYVp2MA3CRVSz0rxdBdwYU7R7HgEDr/8xPGdVPKMd DUpMJuSERkgNXxl/KtmDR6s= Received: (qmail 66837 invoked by alias); 21 Jul 2015 11:53:07 -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 66826 invoked by uid 89); 21 Jul 2015 11:53:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: smtp23.services.sfr.fr Received: from smtp23.services.sfr.fr (HELO smtp23.services.sfr.fr) (93.17.128.22) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 21 Jul 2015 11:53:04 +0000 Received: from filter.sfr.fr (localhost [86.72.15.247]) by msfrf2317.sfr.fr (SMTP Server) with ESMTP id A2A467000093 for ; Tue, 21 Jul 2015 13:53:01 +0200 (CEST) Authentication-Results: sfrmc.priv.atos.fr; dkim=none (no signature); dkim-adsp=none (no policy) header.from=mikael.morin@sfr.fr Received: from tolstoi.localhost (247.15.72.86.rev.sfr.net [86.72.15.247]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by msfrf2317.sfr.fr (SMTP Server) with ESMTP id 5361C7000081 for ; Tue, 21 Jul 2015 13:53:01 +0200 (CEST) X-SFR-UUID: 20150721115301341.5361C7000081@msfrf2317.sfr.fr From: Mikael Morin Subject: [Patch] Show address operator ('&') in front of strings and functions in dumps To: gcc-patches Message-ID: <55AE328D.1020701@sfr.fr> Date: Tue, 21 Jul 2015 13:52:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 X-IsSubscribed: yes Hello, this is a followup to the bug report/patch at: https://gcc.gnu.org/ml/gcc-patches/2015-07/msg01062.html It's a fortran quite unimportant bug, so I bet nobody cares. However, the bug could have been detected when the co_reduce support was implemented, if double address operators appeared as '&&some_func' in the dump, instead of the rather innocent '&some_func'. So I propose the attached patch which does that change. Bootstrapped and regression tested (c,c++,fortran) on x86_64-linux. OK for trunk? Mikael 2015-07-21 Mikael Morin * tre-pretty-print.c (dump_generic_node): Don't skip address operators in front of strings or procedures. 2015-07-21 Mikael Morin * g++.dg/ipa/devirt-15.C: Add address operator '&' to tree dump pattern. * gcc.dg/pr64715.c: Same. * gfortran.dg/c_funloc_tests_7.f90: Same. * gfortran.dg/co_reduce_1.f90: Same. * gfortran.dg/coarray_collectives_16.f90: Same. Index: testsuite/g++.dg/ipa/devirt-15.C =================================================================== --- testsuite/g++.dg/ipa/devirt-15.C (révision 225979) +++ testsuite/g++.dg/ipa/devirt-15.C (copie de travail) @@ -37,4 +37,4 @@ main() /* { dg-final { scan-ipa-dump "speculatively devirtualizing call" "devirt"} } */ /* Match if (PROF_6 == foo) to verify that the speculation survived. */ -/* { dg-final { scan-tree-dump "== foo" "optimized"} } */ +/* { dg-final { scan-tree-dump "== &foo" "optimized"} } */ Index: testsuite/gcc.dg/pr64715-2.c =================================================================== --- testsuite/gcc.dg/pr64715-2.c (révision 225979) +++ testsuite/gcc.dg/pr64715-2.c (copie de travail) @@ -15,4 +15,4 @@ foo (int x) bar (p, x); } -/* { dg-final { scan-tree-dump "__builtin_memcpy \\\(\[^;\n\r\]*, \"abcdefghijkl\", 13\\\);" "optimized" } } */ +/* { dg-final { scan-tree-dump "__builtin_memcpy \\\(\[^;\n\r\]*, &\"abcdefghijkl\", 13\\\);" "optimized" } } */ Index: testsuite/gfortran.dg/c_funloc_tests_7.f90 =================================================================== --- testsuite/gfortran.dg/c_funloc_tests_7.f90 (révision 225979) +++ testsuite/gfortran.dg/c_funloc_tests_7.f90 (copie de travail) @@ -16,6 +16,6 @@ cfp = c_funloc (noCsub) call c_f_procpointer (cfp, fint) end -! { dg-final { scan-tree-dump-times "cfp =\[^;\]+ nocsub;" 1 "original" } } +! { dg-final { scan-tree-dump-times "cfp =\[^;\]+ &nocsub;" 1 "original" } } ! { dg-final { scan-tree-dump-times "fint =\[^;\]+ cfp;" 1 "original" } } Index: testsuite/gfortran.dg/co_reduce_1.f90 =================================================================== --- testsuite/gfortran.dg/co_reduce_1.f90 (révision 225979) +++ testsuite/gfortran.dg/co_reduce_1.f90 (copie de travail) @@ -30,4 +30,4 @@ contains end program simple_reduce -! { dg-final { scan-tree-dump "_gfortran_caf_co_reduce \\(&desc\\.\\d+,\\s*simple_reduction," "original" } } +! { dg-final { scan-tree-dump "_gfortran_caf_co_reduce \\(&desc\\.\\d+,\\s*&simple_reduction," "original" } } Index: testsuite/gfortran.dg/coarray_collectives_16.f90 =================================================================== --- testsuite/gfortran.dg/coarray_collectives_16.f90 (révision 225979) +++ testsuite/gfortran.dg/coarray_collectives_16.f90 (copie de travail) @@ -33,6 +33,6 @@ contains end function hc end program test -! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&desc.., fr, 4, _gfortran_caf_num_images \\(0, -1\\), &stat1, errmesg1, 0, 6\\);" 1 "original" } } -! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&val2, gz, 0, 4, &stat2, errmesg2, 0, 7\\);" 1 "original" } } -! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&desc.., hc, 1, res, &stat3, errmesg3, 99, 8\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&desc.., &fr, 4, _gfortran_caf_num_images \\(0, -1\\), &stat1, errmesg1, 0, 6\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&val2, &gz, 0, 4, &stat2, errmesg2, 0, 7\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&desc.., &hc, 1, res, &stat3, errmesg3, 99, 8\\);" 1 "original" } } Index: tree-pretty-print.c =================================================================== --- tree-pretty-print.c (révision 225979) +++ tree-pretty-print.c (copie de travail) @@ -2060,12 +2060,7 @@ dump_generic_node (pretty_printer *pp, tree node, case PREDECREMENT_EXPR: case PREINCREMENT_EXPR: case INDIRECT_REF: - if (TREE_CODE (node) == ADDR_EXPR - && (TREE_CODE (TREE_OPERAND (node, 0)) == STRING_CST - || TREE_CODE (TREE_OPERAND (node, 0)) == FUNCTION_DECL)) - ; /* Do not output '&' for strings and function pointers. */ - else - pp_string (pp, op_symbol (node)); + pp_string (pp, op_symbol (node)); if (op_prio (TREE_OPERAND (node, 0)) < op_prio (node)) {