From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2791 invoked by alias); 4 Sep 2011 10:47:29 -0000 Received: (qmail 2783 invoked by uid 22791); 4 Sep 2011 10:47:28 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-wy0-f169.google.com (HELO mail-wy0-f169.google.com) (74.125.82.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 04 Sep 2011 10:47:14 +0000 Received: by wyi11 with SMTP id 11so3630674wyi.0 for ; Sun, 04 Sep 2011 03:47:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.167.194 with SMTP id i44mr3237785wel.33.1315133233526; Sun, 04 Sep 2011 03:47:13 -0700 (PDT) Received: by 10.216.22.75 with HTTP; Sun, 4 Sep 2011 03:47:13 -0700 (PDT) In-Reply-To: References: Date: Sun, 04 Sep 2011 13:54:00 -0000 Message-ID: Subject: Re: [BUG] Parser error for "pointer to a function pointer" From: Abhijit Halder To: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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 X-SW-Source: 2011-09/txt/msg00060.txt.bz2 On Sun, Sep 4, 2011 at 4:13 PM, Abhijit Halder wrote: > On Sun, Sep 4, 2011 at 4:07 PM, Abhijit Halder > wrote: >> On Sun, Sep 4, 2011 at 2:08 PM, Abhijit Halder >> wrote: >>> Hello everybody, >>> >>> While working with gdb I have encountered the following problem. >>> >>> GNU gdb (GDB) 7.3.50.20110814-cvs >>> Copyright (C) 2011 Free Software Foundation, Inc. >>> License GPLv3+: GNU GPL version 3 or later >>> This is free software: you are free to change and redistribute it. >>> There is NO WARRANTY, to the extent permitted by law. =A0Type "show cop= ying" >>> and "show warranty" for details. >>> This GDB was configured as "i686-pc-linux-gnu". >>> For bug reporting instructions, please see: >>> . >>> (gdb) ptype int(**)(void) >>> A syntax error in expression, near `*)(void)'. >>> >>> >>> I have made the following changes to fix this issue. >>> >>> >>> --- src/gdb/c-exp.y =A0 =A0 2011-05-06 19:42:17.000000000 +0530 >>> +++ dst/gdb/c-exp.y =A0 =A0 2011-09-04 13:57:16.082207664 +0530 >>> @@ -19,7 +19,7 @@ >>> =A0 =A0along with this program. =A0If not, see . =A0*/ >>> >>> =A0/* Parse a C expression from text in a string, >>> - =A0 and return the result as a =A0struct expression =A0pointer. >>> + =A0 and return the result as a =A0struct expression pointer. >>> =A0 =A0That structure contains arithmetic operations in reverse polish, >>> =A0 =A0with constants represented by operations that are followed by sp= ecial data. >>> =A0 =A0See expression.h for the details of the format. >>> @@ -926,12 +926,12 @@ const_or_volatile_or_space_identifier: >>> >>> =A0abs_decl: =A0 =A0 =A0'*' >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{ push_type (tp_pointer)= ; $$ =3D 0; } >>> - =A0 =A0 =A0 | =A0 =A0 =A0 '*' abs_decl >>> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 { push_type (tp_pointer);= $$ =3D $2; } >>> + =A0 =A0 =A0 | =A0 =A0 =A0 abs_decl '*' >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 { push_type (tp_pointer);= $$ =3D $1; } >>> =A0 =A0 =A0 =A0| =A0 =A0 =A0 '&' >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{ push_type (tp_referenc= e); $$ =3D 0; } >>> - =A0 =A0 =A0 | =A0 =A0 =A0 '&' abs_decl >>> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 { push_type (tp_reference= ); $$ =3D $2; } >>> + =A0 =A0 =A0 | =A0 =A0 =A0 abs_decl '&' >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 { push_type (tp_reference= ); $$ =3D $1; } >>> =A0 =A0 =A0 =A0| =A0 =A0 =A0 direct_abs_decl >>> =A0 =A0 =A0 =A0; >>> >>> Thanks, >>> Abhijit Halder >>> >> >> A regression happens with the above fix. >> The above fix is not working for the following: >> (gdb)ptype int (*(*(*)(char))(short int))(long int > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0^^^ Oopps!!! Sorry for the typo again. The regression happened for (gdb)ptype int (*(*(*)(char))(short int))(long = int) But once again the following still throws error (gdb)ptype int (*(**(*)(char))(short int))(long int) >> >> The following is working fine. >> >> --- src/gdb/c-exp.y =A0 =A0 2011-05-06 19:42:17.000000000 +0530 >> +++ dst/gdb/c-exp.y =A0 =A0 2011-09-04 15:57:51.212167205 +0530 >> @@ -926,6 +926,8 @@ const_or_volatile_or_space_identifier: >> >> =A0abs_decl: =A0 =A0 =A0'*' >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{ push_type (tp_pointer);= $$ =3D 0; } >> + =A0 =A0 =A0 | =A0 =A0 =A0 abs_decl '*' >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 { push_type (tp_pointer); = $$ =3D $1; } >> =A0 =A0 =A0 =A0| =A0 =A0 =A0 '*' abs_decl >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{ push_type (tp_pointer);= $$ =3D $2; } >> =A0 =A0 =A0 =A0| =A0 =A0 =A0 '&' >> >> >> >> Thanks, >> Abhijit Halder >> >