Message ID | CA9BBF0458F83C4F9051448B941B57D124D8DF3C@glaexch3 |
---|---|
State | New |
Headers | show |
On 07/07/2016 09:06 PM, James Bowman wrote: > FT32 makes use of multiple address spaces. When trying to inspect > objects in GDB, GDB was treating them as a straight "const". The cause > seems to be in GCC DWARF2 output. > > This output is handled in gcc/gcc/dwarf2out.c, where modified_type_die() > checks that TYPE has qualifiers CV_QUALS. However while TYPE has > ADDR_SPACE qualifiers, the modified_type_die() explicitly discards the > ADDR_SPACE qualifiers. > > This patch retains the ADDR_SPACE qualifiers as modified_type_die() > outputs the DWARF type tree. This allows the types to match, and correct > type information for the object is emitted. > > OK to commit? > > [gcc] > > 2016-07-07 James Bowman <james.bowman@ftdichip.com> > > * gcc/dwarf2out.c (modified_type_die): Retain ADDR_SPACE > qualifiers. > (add_type_attribute) likewise. Normally any change in this part of the compiler would have to go through a bootstrap and regression test (ie, compare the result of make-check before/after your patch with no regressions). But nothing in a bootstrap is really going to exercise address space qualifiers. So I think it should be sufficient to confirm that you've built either your FT32 target or some other target with this patch. Once you've confirmed that the compiler still builds, this is OK for the trunk. jeff
Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (revision 237998) +++ gcc/dwarf2out.c (working copy) @@ -11222,7 +11222,8 @@ modified_type_die (tree type, int cv_qua dw_die_ref mod_scope; /* Only these cv-qualifiers are currently handled. */ const int cv_qual_mask = (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE - | TYPE_QUAL_RESTRICT | TYPE_QUAL_ATOMIC); + | TYPE_QUAL_RESTRICT | TYPE_QUAL_ATOMIC | + ENCODE_QUAL_ADDR_SPACE(~0U)); if (code == ERROR_MARK) return NULL; @@ -19027,7 +19028,7 @@ add_type_attribute (dw_die_ref object_di return; type_die = modified_type_die (type, - cv_quals | TYPE_QUALS_NO_ADDR_SPACE (type), + cv_quals | TYPE_QUALS (type), reverse, context_die);