On Wed, Sep 11, 2024 at 9:27 AM Jin Ma <ji...@linux.alibaba.com> wrote: > > > > > I'm curious why you ever get a ggc_freed decl here. > > > > > > It seems that the overloaded interface of RVV has been registered > > > repeatedly, resulting > > > in invalid registrations except for the first registration, and these > > > invalid registrations > > > have been ggc_freed. But anyway, I think it is necessary to do a check > > > here. I think using > > > "integer_zero_node" is to meet the needs, although direct return would be > > > better. > > > > But there isn't any way to check whether 'decl' has been freed ... > > just make sure it isn't - you > > should not even have a reference to it. > > Richard. > > I'm trying to understand what you mean. You mean that directly using > "integer_zero_node" to > overwrite decl will not guarantee whether the memory of the original decl has > been properly > cleaned up, right?
I'm saying that if you ever get a ggc_free()d object as argument to this function that's the thing to fix - somewhere there is a stale reference to that object that either shouldn't be there or that should have prevented the object from being ggc_free()d. Richard. > > If so, then the current method is really not appropriate. Maybe I should > check whether > the function has been registered before registering the current function. If > it has > been registered, I will skip it directly. This will lead to a decrease in > efficiency. > I am not sure whether this is appropriate. In fact, I see a similar patch on > aarch64: > > https://github.com/gcc-mirror/gcc/commit/685d822e524cc8b2726ad6c44c2ccaabe55a198c > > Or any other comments? > > BR > Jin