On Tue, Sep 10, 2024 at 9:38 AM Jin Ma <ji...@linux.alibaba.com> wrote: > > > > + /* If the code of DECL is ERROR_MARK or invalid code, usually > > > "ggc_freed", we > > > + use integer_zero_node instead of it. This will be very helpful for > > > the > > > + ggc_free. */ > > > + if (TREE_CODE (decl) == ERROR_MARK || TREE_CODE (decl) >= > > > MAX_TREE_CODES) > > > + decl = integer_zero_node; > > > + > > > > ... this one looks like a hack (note ggc_free only poisons memory when > > checking is enabled). > > Hi, I just built the compiler with "--enable-multilib" from > riscv-gnu-toolchain source, > and it seems to have "CHECKING_P"/"ENABLE_EXTRA_CHECKING" on by default, > resulting in > "flag_checking=2". > > I haven't located it in detail, so I'm not sure if it is.
During development checking is enabled by default (--enable-checking=yes), but once released the compiler defaults to --enable-checking=release. > > 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. > BR > Jin