On Wed, Jun 30, 2021 at 7:37 AM Trevor Saunders <tbsau...@tbsaunde.org> wrote:
>
> This simply confirms we can poison them in a small region.
>
> boostrapped and regtested on x86_64-linux-gnu, ok?

So this shows the approach doesn't really scale since it's necessarily
at most function-scope granularity rather than file-scope as possible
with the existing #pragma (maybe add the possibility to un-poison
identifiers or a push/pop mechanism).

> Trev
>
> gcc/ChangeLog:
>
>         * gimple-range.cc (disable_ranger): Prevent access to cfun and
>         input_location.
> ---
>  gcc/gimple-range.cc | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc
> index 1851339c528..d4a3a6e46be 100644
> --- a/gcc/gimple-range.cc
> +++ b/gcc/gimple-range.cc
> @@ -22,6 +22,7 @@ along with GCC; see the file COPYING3.  If not see
>  #include "config.h"
>  #include "system.h"
>  #include "coretypes.h"
> +#include "poison.h"
>  #include "backend.h"
>  #include "tree.h"
>  #include "gimple.h"
> @@ -509,6 +510,8 @@ enable_ranger (struct function *fun)
>  void
>  disable_ranger (struct function *fun)
>  {
> +  auto_poison<location_t> pil (input_location);
> +  auto_poison<function *> pcfun (cfun_poison);
>    delete fun->x_range_query;
>
>    fun->x_range_query = &global_ranges;
> --
> 2.20.1
>

Reply via email to