On Fri, Nov 1, 2024 at 9:22 AM KuanLin Chen <best124...@gmail.com> wrote: > > simulate_builtin_function_decl may return decl that be ggc_freed already > in pushdecl when duplicate_decls is true.
It shouldn't do that. It should either return the duplicate or NULL, so this is definitely not a good fix - well, it's to the right place but continuing to return a ggc_free()d decl is wrong. Not sure if a new parameter is necessary when we change the returned value. > Add a argument CREATE_P for > the caller to know if the return decl is usable. > > gcc/ChangeLog: > > * langhooks.h (simulate_builtin_function_decl): > Add one more argument. > * langhooks.cc (simulate_builtin_function_decl): Ditto. > * config/aarch64/aarch64-builtins.cc > (aarch64_general_simulate_builtin): > Add one more argument to fit simulate_builtin_function_decl. > (aarch64_init_simd_builtin_functions): Ditto. > * config/aarch64/aarch64-sve-builtins.cc > (function_builder::add_function): Ditto. > * config/arm/arm-mve-builtins.cc > (function_builder::add_function): Ditto. > * config/riscv/riscv-vector-builtins.cc > (function_builder::add_function): Ditto.