);
> +}
> +
> +void
> +verify_code (gcc_jit_context *ctxt, gcc_jit_result *result)
> +{
> + typedef size_t (*fn_type) (void);
> + CHECK_NON_NULL (result);
> + fn_type test_stack_save_restore =
> +(fn_type)gcc_jit_result_get_code (result, "test_stack_save_restore");
> + CHECK_NON_NULL (test_stack_save_restore);
> + size_t value = test_stack_save_restore();
> + CHECK (value == 512);
> +}
> diff --git a/gcc/tree-ssa-ccp.cc b/gcc/tre
> e-ssa-ccp.cc
> index fcb91c58335..d721c471f74 100644
> --- a/gcc/tree-ssa-ccp.cc
> +++ b/gcc/tree-ssa-ccp.cc
> @@ -2671,7 +2671,8 @@ fold_builtin_alloca_with_align (gimple *stmt)
>block = gimple_block (stmt);
>if (!(cfun->after_inlining
> && block
> -&& TREE_CODE (BLOCK_SUPERCONTEXT (block)) == FUNCTION_DECL))
> + && BLOCK_SUPERCONTEXT (block)
> + && TREE_CODE (BLOCK_SUPERCONTEXT (block)) == FUNCTION_DECL))
This change seems incorrect. Every block should have a super context.
Including the last block which should point to a function decl. Maybe
gccjit is not setting up the blocks correctly where the supper most
one is not setting its context to being the function decl.
I think the following patch will fix that bug:
```
diff --git a/gcc/jit/jit-playback.cc b/gcc/jit/jit-playback.cc
index e32e837f2fe..acdb25c7d09 100644
--- a/gcc/jit/jit-playback.cc
+++ b/gcc/jit/jit-playback.cc
@@ -2118,6 +2118,7 @@ postprocess ()
/* Seem to need this in gimple-low.cc: */
gcc_assert (m_inner_block);
DECL_INITIAL (m_inner_fndecl) = m_inner_block;
+ BLOCK_SUPERCONTEXT (m_inner_block) = m_inner_fndecl;
/* how to add to function? the following appears to be how to
set the body of a m_inner_fndecl: */
```
Signed-off-by: Andrew Pinski
Thanks,
Andrew Pinski
> threshold /= 10;
>if (size > threshold)
> return NULL_TREE;
> --
> 2.43.0
>
On Thu, Dec 5, 2024 at 2:13 PM Antoni Boucher wrote:
>
> Thanks for the review.
> See explanations and questions below.
>
> Le 2024-12-05 à 17 h 03, Andrew Pinski a écrit :
> > On Thu, Dec 5, 2024 at 1:46 PM Antoni Boucher wrote:
> >>
> >> Hi.
> >>
On Thu, Dec 5, 2024 at 1:46 PM Antoni Boucher wrote:
>
> Hi.
> This is a patch for the bug 117886.
> I ran the jit tests on x86-64 and there are as much failures as on the
> master branch (4).
> I also ran the jit tests on Aarch64 with another patch and there are
> much less failures.
> Iains ran