Re: Issue with pointer types marked with scalar_storage_order

Ulrich Weigand via Gdb
2021-05-07T12:45:32Z

On Thu, May 06, 2021 at 04:07:52PM +0200, Eric Botcazou wrote:
> > On the other hand, even the name of the attribute specifically
> > refers to *scalar* types, and the C standard does classsify
> > pointer types amongst the scalar type. So maybe this was
> > originally intended?
>
> I don't think so, the feature was first implemented for Ada and, in Ada,
> pointer types (called access types) are *not* scalar types. So this indeed
> looks like a small oversight in the implementation.

Ah, I see.

> > Any comments or suggestions on what to do here?
>
> I'm going to conduct some testing in Ada but, barring unexpected fallout, I
> would be in favor of changing the GCC implementation. It's presumably a 1-
> line change in the reverse_storage_order_for_component_p predicate.

Makes sense to me. Thanks for the quick fix!

Tom Tromey wrote:
> Ulrich> If we do want to byte-swap pointer types, then I guess we need
> Ulrich> to still fix the debug info problem, which I guess would at a
> Ulrich> minimum require extending DWARF to allow DW_AT_endianity as an
> Ulrich> attribute to DW_TAG_pointer_type (and then probably also
> Ulrich> DW_TAG_reference_type, DW_TAG_rvalue_reference_type,
> Ulrich> DW_TAG_ptr_to_member_type and possibly others). Also, the
> Ulrich> implementation in GDB would need to be changed accordingly.
>
> Ulrich> Any comments or suggestions on what to do here?
>
> This kind of extension is pretty normal in DWARF, so I think it isn't a
> big deal to emit it. Consumers are ordinarily expected to simply ignore
> things they don't understand.

Given Eric's GCC change above, this is no longer necessary now.

Thanks,
Ulrich

--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com