https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67293
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #2) > I'm fine with introducing some limit on the size of const values, with a > param. > As for the other question, I think you've answered that yourself, > if the const ends up in the source, then that is supposedly because > something needed its address. At that point it is much better to be able to > print that address in the debugger. > If you want to stream DW_AT_const_value early and actually rewrite the DWARF > during LTO later, rather than just reference unmodified DIEs from other > DIEs, then you could if you end up having an address actually remove the > DW_AT_const_value and replace it with DW_AT_location if possible. A DWARF optimizer could do this indeed. With the current laid out scheme for LTO debug we will add a DW_AT_location late if the object is instantiated thus the debugger will see both. But I will have to pro-actively add the DW_AT_const_value early in case the object doesn't get emitted - but I definitely want to limit the size of the eventually pointless DWARF. I can do the re-writing (remove DW_AT_const_value if we have a location) for the non-LTO path though (and also try adding a DW_AT_const_value with a larger size-cut-off if we don't).