Skip to content
Snippets Groups Projects
Commit 21c7aab0 authored by Andrew Pinski's avatar Andrew Pinski
Browse files

Fix middle-end/103645: empty struct store not removed when using compound literal

For compound literals empty struct stores are not removed as they go down a
different path of the gimplifier; trying to optimize the init constructor.
This fixes the problem by not adding the gimple assignment at the end
of gimplify_init_constructor if it was an empty type.

Note this updates gcc.dg/pr87052.c where we had:
const char d[0] = { };
And was expecting a store to d but after this, there is no store
as the decl's type is zero in size.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

gcc/ChangeLog:

	PR middle-end/103645
	* gimplify.cc (gimplify_init_constructor): Don't build/add
	gimple assignment of an empty type.

gcc/testsuite/ChangeLog:
	* gcc.dg/pr87052.c: Update d var to expect nothing.
parent 5471f55f
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment