gimplify: Small RAW_DATA_CST gimplification fix
commit60ad1e40649244aa219b411c1a1ef5e00ec6a87b
authorJakub Jelinek <jakub@redhat.com>
Wed, 16 Oct 2024 08:20:00 +0000 (16 10:20 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 16 Oct 2024 08:32:27 +0000 (16 10:32 +0200)
treec434570daab687eeb35d109d3e17356c27b7bbee
parent1844a4aa6615c2252303e70d41bdb18e7c5664c6
gimplify: Small RAW_DATA_CST gimplification fix

I've noticed the following testcase hangs during gimplification.

While it is gimplifying an assignment from a VAR_DECL .LCNNN to MEM_REF,
because the VAR_DECL is TREE_READONLY, it will happily pick its initializer
and try to gimplify that, which means recursing to the exact same code.

The following patch fixes that by just gimplifying the lhs and building
assignment, because the code decided that it should use copying from
a static var.

2024-10-16  Jakub Jelinek  <jakub@redhat.com>

* gimplify.cc (gimplify_init_ctor_eval): For larger RAW_DATA_CST,
just gimplify cref as lvalue and add gimple assignment of rctor
to cref instead of going through gimplification of INIT_EXPR, as
the latter can suffer from infinite recursion.

* c-c++-common/cpp/embed-24.c: New test.
gcc/gimplify.cc
gcc/testsuite/c-c++-common/cpp/embed-24.c [new file with mode: 0644]