Bug 18166 - top const stripped in structs for C
Summary: top const stripped in structs for C
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.0.0
: P2 minor
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-debug
Depends on:
Blocks:
 
Reported: 2004-10-26 23:23 UTC by Mike Stump
Modified: 2005-03-20 17:45 UTC (History)
2 users (show)

See Also:
Host:
Target: powerpc-darwin
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-01-25 03:43:48


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Stump 2004-10-26 23:24:01 UTC
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
Comment 1 Mike Stump 2004-10-26 23:27:19 UTC
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();
}
Comment 2 Andrew Pinski 2004-10-26 23:30:54 UTC
Confirmed.
Comment 3 Joseph S. Myers 2005-01-29 16:31:55 UTC
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.
Comment 4 Joseph S. Myers 2005-03-19 13:23:07 UTC
Could someone with a Darwin build to hand check whether this bug is indeed fixed
as I suggest in my previous comment?
Comment 5 Andrew Pinski 2005-03-20 17:45:36 UTC
Confirmed as fixed:
(gdb) ptype xss
type = struct ss {
    char *ptr;
}
(gdb) ptype xssc
type = struct ssc {
    char * const ptr;
}