This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[BUG] Parser error for "pointer to a function pointer"


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 <http://gnu.org/licenses/gpl.html>
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:
<http://www.gnu.org/software/gdb/bugs/>.
(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 <http://www.gnu.org/licenses/>.  */

 /* 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]