From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3092 invoked by alias); 4 Sep 2011 08:38:22 -0000 Received: (qmail 2923 invoked by uid 22791); 4 Sep 2011 08:38:19 -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-ww0-f43.google.com (HELO mail-ww0-f43.google.com) (74.125.82.43) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 04 Sep 2011 08:38:03 +0000 Received: by wwe32 with SMTP id 32so3610715wwe.12 for ; Sun, 04 Sep 2011 01:38:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.160.134 with SMTP id u6mr1390395wek.18.1315125482311; Sun, 04 Sep 2011 01:38:02 -0700 (PDT) Received: by 10.216.22.75 with HTTP; Sun, 4 Sep 2011 01:38:02 -0700 (PDT) Date: Sun, 04 Sep 2011 09:22:00 -0000 Message-ID: Subject: [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 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/msg00056.txt.bz2 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. Type "show copying" 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 2011-05-06 19:42:17.000000000 +0530 +++ dst/gdb/c-exp.y 2011-09-04 13:57:16.082207664 +0530 @@ -19,7 +19,7 @@ along with this program. If not, see . */ /* Parse a C expression from text in a string, - and return the result as a struct expression pointer. + and return the result as a struct expression pointer. That structure contains arithmetic operations in reverse polish, with constants represented by operations that are followed by special data. See expression.h for the details of the format. @@ -926,12 +926,12 @@ const_or_volatile_or_space_identifier: abs_decl: '*' { push_type (tp_pointer); $$ = 0; } - | '*' abs_decl - { push_type (tp_pointer); $$ = $2; } + | abs_decl '*' + { push_type (tp_pointer); $$ = $1; } | '&' { push_type (tp_reference); $$ = 0; } - | '&' abs_decl - { push_type (tp_reference); $$ = $2; } + | abs_decl '&' + { push_type (tp_reference); $$ = $1; } | direct_abs_decl ; Thanks, Abhijit Halder