From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11096 invoked by alias); 16 Oct 2013 22:07:15 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 11082 invoked by uid 89); 16 Oct 2013 22:07:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 Oct 2013 22:07:14 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9GM7Cpp017941 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 16 Oct 2013 18:07:12 -0400 Received: from psique (ovpn-113-80.phx2.redhat.com [10.3.113.80]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r9GM79D2004055 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 16 Oct 2013 18:07:11 -0400 From: Sergio Durigan Junior To: Jan Kratochvil Cc: Keith Seitz , "gdb-patches\@sourceware.org ml" Subject: Re: Regression for gdb.pascal/* [Re: [RFA 4/4] Constify parse_linesepc] References: <5249C987.50809@redhat.com> <87d2no4uim.fsf@fleche.redhat.com> <524BA344.2070802@redhat.com> <20131016095743.GA17072@host2.jankratochvil.net> X-URL: http://www.redhat.com Date: Wed, 16 Oct 2013 22:07:00 -0000 In-Reply-To: <20131016095743.GA17072@host2.jankratochvil.net> (Jan Kratochvil's message of "Wed, 16 Oct 2013 11:57:43 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2013-10/txt/msg00504.txt.bz2 On Wednesday, October 16 2013, Jan Kratochvil wrote: > On Wed, 02 Oct 2013 06:38:28 +0200, Keith Seitz wrote: >> All committed. Thank you Sergio and Tom for looking at this! > > c85cddc51d5d9e4423509a2dc7cf3d9809451b49 is the first bad commit > commit c85cddc51d5d9e4423509a2dc7cf3d9809451b49 > Author: Keith Seitz > Date: Wed Oct 2 00:46:06 2013 +0000 > > Constification of parse_linespec and fallout: > https://sourceware.org/ml/gdb-patches/2013-09/msg01017.html > https://sourceware.org/ml/gdb-patches/2013-09/msg01018.html > https://sourceware.org/ml/gdb-patches/2013-09/msg01019.html > https://sourceware.org/ml/gdb-patches/2013-09/msg01020.html Thanks for the report. The problem happens because when yylex is going to parse a number, it starts by saving the pointer to the input string in a variable "p", then it advances this variable depending on what it finds, and finally it updates "lexptr" by using "p". However, "p" is "tokstart" at the beginning of the function, which used to be the same pointer as "lexptr", but now it's allocated using "alloca". I chose to fix this by advancing "p" and "lexptr" by the same amounts every time, so that they do not get out of sync (which also makes it unnecessary to update "lexptr" in the end). I ran the failing tests and they pass now. I am running a regression test now, but it will take a long time to complete, so I am sending this patch for appreciation first. OK to apply? -- Sergio gdb/ 2013-10-16 Sergio Durigan Junior Fix regression by Keith's patch (Constification of parse_linesepc and fallout). * p-exp.y (yylex): Advance "lexptr" along with "p" when parsing a number. Do not update "lexptr" using "p" in the end. diff --git a/gdb/p-exp.y b/gdb/p-exp.y index de14cbb..41628ea 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -1264,22 +1264,27 @@ yylex (void) { /* It's a number. */ int got_dot = 0, got_e = 0, toktype; + /* p and lexptr point to the same string, but not to the same + location. They should be both advanced at the same time + so that they do not get out of sync. */ char *p = tokstart; int hex = input_radix > 10; if (c == '0' && (p[1] == 'x' || p[1] == 'X')) { p += 2; + lexptr += 2; hex = 1; } else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D')) { p += 2; + lexptr += 2; hex = 0; } - for (;; ++p) + for (;; ++p, ++lexptr) { /* This test includes !hex because 'e' is a valid hex digit and thus does not indicate a floating point number when @@ -1312,7 +1317,6 @@ yylex (void) err_copy[p - tokstart] = 0; error (_("Invalid number \"%s\"."), err_copy); } - lexptr = p; return toktype; }