"Paulo J. Matos" <pa...@matos-sorge.com> writes: > I have builtin __function_size(foobar) that is applied to functions. > This should be folded to a symbol foobar@size. > > The problem comes when I mark in the fold_builtin function in my backend > that DECL_PRESERVE(foobar) = 1; > > The reason I need to do this is so that foobar is not removed if we > happen to use __function_size(foobar) since I will need foobar during > linking phase to do some calculations with regards to its size. > > As a consequence of DECL_PRESERVE(foobar) I cannot build GCC with -- > enable-checking because it fails the check in: fold-const.c and shows the > message: > internal compiler error: fold check: original tree changed by fold > > This is really annoying since I like to run my tests with --enable- > checking=full to get the most of the checks in GCC but I can't with this > issue lying around. I am open to suggestions on how to mark the function > as preserve is the function name is referred to by a function builtin.
I'm not sure what you are folding the builtin to, but perhaps you could retain a reference to the function. Or, you could write a tiny pass which set DECL_PRESERVED_P for each function passed to __function_size. Or, perhaps you could handle it in expand_builtin rather than fold_builtin. Ian