Bug description:

ptype command outputs wrong type when type is a typedef *.  For example with the code:

typedef char* CHAR;
typedef CHAR* CHAR2;

the gdb command 'ptype CHAR' correctly reports char*, but 'ptype CHAR2' reports
char *.  This is incorrect, as CHAR2 is actually a char**.

Another example:

typedef void (*fptr) (void);
typedef fptr* ptr;
fptr f;
ptr p;

the commands 'ptype f' and 'ptype fptr' both correctly return 'void (*)(void)', 
but the commands 'ptype ptr' and 'ptype p' both return 'void *', where they
should return 'void (**)(void)'

GDB version: GNU gdb 5.0
gcc version for gdb and test programs: 2.95.2

Environment: linux-kernel 2.2.17-14.1s12 i386

Problem fix:
The fix for this bug is in two functions, c_type_print_varspec_prefix and 
c_type_print_varspec_suffix both in c-typeprint.c.  I inlcuded in this email is
the original copy of c-typeprint.c (c-typeprint.c.orig), my copy of the file
with the fix in it (c-typeprint.c.fix) and a patch (ptype.patch).

I tested my fix with the files from the gdb test suite and it appears that my 
fix works and does not break anything else.

Any questions or additional info, please feel free to contact me at:
sb24@avaya.com or 303-538-0343.



Sample program:
Attached is ptype.cpp.  I used g++ -g -o ptype ptype.cpp to compile it.  
Set a breakpoin in main, step two or three times and use ptype to print the
types for the variables from the example above.

Thank you
Stewart Brown

