https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55641
--- Comment #9 from Tom Tromey <tromey at gcc dot gnu.org> --- I think this happens due to this code in gen_variable_die: tree type = TREE_TYPE (decl_or_origin); if (decl_by_reference_p (decl_or_origin)) add_type_attribute (var_die, TREE_TYPE (type), 0, 0, context_die); else add_type_attribute (var_die, type, TREE_READONLY (decl_or_origin), TREE_THIS_VOLATILE (decl_or_origin), context_die); For the reduced test case we enter the second call to add_type_attribute. "g" is marked as TREE_READONLY, so this forces the "const" to be emitted. Is there ever a case where this is correct? That is, where the DWARF needs to emit "const" or "volatile" but the only note is on the object and not the object's type? I didn't know.