On 1/9/24 01:52, Jakub Jelinek wrote:
Hi!

The copy attributes is allowed on decls as well as types and even has
checks whether decl (set to *node) is DECL_P or TYPE_P, but for diagnostics
unconditionally uses DECL_SOURCE_LOCATION (decl), which obviously only works
if it applies to a decl.

The following patch fixes that, bootstrapped/regtested on x86_64-linux and
i686-linux, ok for trunk?

2024-01-09  Jakub Jelinek  <ja...@redhat.com>

        PR c/113262
        * c-attribs.cc (handle_copy_attribute): Don't use
        DECL_SOURCE_LOCATION (decl) if decl is not DECL_P, use input_location
        instead.  Formatting fixes.

        * gcc.dg/pr113262.c: New test.
ok
Jeff

Reply via email to