https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113270

--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:33b1173361b08919ef9011e335072925d38327df

commit r14-7040-g33b1173361b08919ef9011e335072925d38327df
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Tue Jan 9 13:57:23 2024 +0100

    aarch64: Fix up GC of aarch64_simd_types [PR113270]

    The r14-6524 changes created aarch64-builtins.h header and moved
    struct aarch64_simd_type_info definition in there.
    Unfortunately, the new header wasn't added to target_gtfiles, so the
    trees and const char * pointer elements in the aarch64_simd_types
    array aren't marked as GC roots anymore.  That breaks e.g. PCH, when
    the array elements then can refer to ggc_freed memory instead of the
expected
    types, but also any other GC collection could free them and further uses
would
    not work correctly.

    Unfortunately, just adding the new header to target_gtfiles doesn't fix
this,
    because non-static variable definitions marked with GTY(()) aren't
considered
    by gengtype, it looks in those cases for an extern GTY(()) declaration, and
    there was none - the aarch64-builtins.h header contains an extern
declaration
    without GTY(()).  Adding GTY(()) to that extern declaration doesn't work,
because
    then gengtype attempts to emit the aarch64_simd_types GC roots in
gtype-desc.cc
    but the corresponding header isn't included there.

    So, the patch instead adds another extern declaration in
aarch64-builtins.cc
    right before the actual definition, which makes sure the GC roots are
registered
    correctly in gt-aarch64-builtins.h (where we want them).

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

            PR target/113270
            * config.gcc (aarch64*-*-*): Add aarch64-builtins.h to
target_gtfiles.
            * config/aarch64/aarch64-builtins.cc (aarch64_simd_types): Add
extern
            GTY(()) declaration before the definition, drop GTY(()) drom the
            definition.

Reply via email to