From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id AF3BA3858C52 for ; Fri, 23 Sep 2022 07:02:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AF3BA3858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663916525; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=r3A8tu9emcCGKaVVky6qK7B2GsF/GSfzkwpPLmj1h4A=; b=JuZDIY0qvALR45kd1MgfXQkFLTE15L1KynfXmX0tUvgapQJG0i44nD0unEQNgEFr+5khUl vHhDgS+1EHTGEfy3HG6S7qJRDuAnWVSeHNyTShz/WgUr/ZuOfhUUr7cIj+kv88DcC5ool3 xiI9a1+XmyDix3wdplDXaND5sYEzlL4= Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-120-2m1CytfcOAmNIlACUnHKSQ-1; Fri, 23 Sep 2022 03:02:02 -0400 X-MC-Unique: 2m1CytfcOAmNIlACUnHKSQ-1 Received: by mail-ot1-f70.google.com with SMTP id l15-20020a9d550f000000b0063707d0f4dbso5631676oth.11 for ; Fri, 23 Sep 2022 00:02:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=r3A8tu9emcCGKaVVky6qK7B2GsF/GSfzkwpPLmj1h4A=; b=iAFzShVyCE4/6ChautE0y3+vKLKXeRflYZ5oYXB5oTrF9GXtGgpWY8si+l83o350q8 79aoC4BxefHxW0xItdIXnhBzANgVaWPQ2a/1jyfYjllz3xFOV86vYXchMAD9c/RXQZle Qza824hiB8VsF+sBElOYkXBqMH+W+8bTMMUfurTfcNW9gP7/BLQphiXbBUYvgIbJms0B UzWLWHzbHuLX/ZlduscCD8WswHETIEgI34bSLbJnk1WJCHSMA1Qwu/yjbXQpgQPmZkpM gtFxakFHFaASB4otlGjP0wqHR2qF7lTlskjYcYzFjI9ze9inxdBTuR+fJAJcO9sCLDrS FPBg== X-Gm-Message-State: ACrzQf3rHdbRHvJDikJmQKM7rn5Y2DeW+we5W6BrGUwOq7TiRHNDkMgl dFx1ABrB4S4ZaOCxm4TDl81UxSJMDLNpXJeq0hYLiSUpCGWPzKQX+ZXxmg/wcMEY/I4GHGIX2C+ 5C/27AWBvak8gmpQY7gmJ+0WHQbqVhl86aQ== X-Received: by 2002:a9d:4709:0:b0:655:b51e:fc6a with SMTP id a9-20020a9d4709000000b00655b51efc6amr3466217otf.276.1663916521318; Fri, 23 Sep 2022 00:02:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ugB1FS9dB9NkhccSkesKAyyyEXswN/eUZgBYw1GrbGbke/h46raMQHj54kyZqzBuQgga74wyEn7ZpwdGNJ6w= X-Received: by 2002:a9d:4709:0:b0:655:b51e:fc6a with SMTP id a9-20020a9d4709000000b00655b51efc6amr3466211otf.276.1663916521117; Fri, 23 Sep 2022 00:02:01 -0700 (PDT) MIME-Version: 1.0 References: <20220922164752.2566043-1-aldyh@redhat.com> In-Reply-To: From: Aldy Hernandez Date: Fri, 23 Sep 2022 09:01:50 +0200 Message-ID: Subject: Re: [PATCH] Add debug functions for REAL_VALUE_TYPE. To: Richard Biener Cc: GCC patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, Sep 23, 2022 at 8:54 AM Richard Biener wrote: > > On Thu, Sep 22, 2022 at 6:48 PM Aldy Hernandez via Gcc-patches > wrote: > > > > We currently have no way of dumping REAL_VALUE_TYPEs when debugging. > > > > Tested on a gdb session examining the real value 10.0: > > > > (gdb) p min > > $9 = {cl = 1, decimal = 0, sign = 0, signalling = 0, canonical = 0, uexp = 4, sig = {0, 0, 11529215046068469760}} > > (gdb) p debug (min) > > 0x0.ap+4 > > > > OK for trunk? > > I'd say the reference taking variant is enough (just remember to do > debug (*val)), I added the pointer one because all of real.cc takes pointers argument, but yeah...let's just nuke the pointer variant. I hate that we have various variants in VRP (my fault). Thanks. Aldy > but OK (maybe simplify the pointer variant by forwarding instead of duplicating) > > Richard. > > > > > gcc/ChangeLog: > > > > * real.cc (debug): New. > > --- > > gcc/real.cc | 16 ++++++++++++++++ > > 1 file changed, 16 insertions(+) > > > > diff --git a/gcc/real.cc b/gcc/real.cc > > index 73bbac645d9..a31b256a47b 100644 > > --- a/gcc/real.cc > > +++ b/gcc/real.cc > > @@ -1900,6 +1900,22 @@ real_to_decimal (char *str, const REAL_VALUE_TYPE *r_orig, size_t buf_size, > > digits, crop_trailing_zeros, VOIDmode); > > } > > > > +DEBUG_FUNCTION void > > +debug (const REAL_VALUE_TYPE *r) > > +{ > > + char s[60]; > > + real_to_hexadecimal (s, r, sizeof (s), 0, 1); > > + fprintf (stderr, "%s\n", s); > > +} > > + > > +DEBUG_FUNCTION void > > +debug (const REAL_VALUE_TYPE &r) > > +{ > > + char s[60]; > > + real_to_hexadecimal (s, &r, sizeof (s), 0, 1); > > + fprintf (stderr, "%s\n", s); > > +} > > + > > /* Render R as a hexadecimal floating point constant. Emit DIGITS > > significant digits in the result, bounded by BUF_SIZE. If DIGITS is 0, > > choose the maximum for the representation. If CROP_TRAILING_ZEROS, > > -- > > 2.37.1 > > >