The following doesn't produce accurate dbx stabs information on powerpc-apple-darwin: struct ssc { char * const ptr; }; struct ss { char * ptr; }; int main () { struct ssc xssc; struct ss xss; } (gdb) ptype xss type = struct ss { char *ptr; } (gdb) ptype xssc type = struct ssc { char *ptr; } http://gcc.gnu.org/ml/gcc-patches/2002-10/msg01872.html has a wrong patch. The corresponding C++ code works as expected. Radar 3085329
For reference, the C++ version: struct ssc { char * const ptr; ssc () :ptr(0) { } }; struct ss { char * ptr; }; int main () { struct ssc xssc; struct ss xss; } and its output: (gdb) ptype xss type = struct ss { char *ptr; } (gdb) ptype xssc type = class ssc { public: char * const ptr; ssc(ssc const&); ssc(); }
Confirmed.
My patch <http://gcc.gnu.org/ml/gcc-patches/2005-01/msg02180.html> should cause fields to be given the correct types within the C front end, and might thereby fix this bug.
Could someone with a Darwin build to hand check whether this bug is indeed fixed as I suggest in my previous comment?
Confirmed as fixed: (gdb) ptype xss type = struct ss { char *ptr; } (gdb) ptype xssc type = struct ssc { char * const ptr; }