[PATCH] Fix PR middle-end/33088

Eric Botcazou ebotcazou@libertysurf.fr
Wed Dec 12 22:24:00 GMT 2007


As diagnosed by Joseph, this is a problem introduced by RTH's patch
  http://gcc.gnu.org/ml/gcc-patches/2005-06/msg00860.html>
which promotes partial stores to the real or imaginary part of a complex 
variable to total stores.

This is achieved by generating a load of the other, unmodified part of the 
complex variables just before the total store, thus introducing a load of
an undefined value if the variable is uninitialized.

This works, i.e. the uninitialized loads are cleaned up, if the fully-fledged
complex operations lowering pass is run, followed by a DCE pass.  The problem 
here is that the lowering pass is not run, even at -O or above, because the 
associated predicate returns false for the function at hand.

The proposed fix is two-pronged: (1) not promoting the partial stores at -O0,
(2) teaching the predicate to detect the uninitialized loads at -O1 or above.

(1) is achieved by just tweaking is_gimple_reg_type, i.e. DECL_GIMPLE_REG_P is 
still being set on the individual variables.  This seems to work, but...

Tested on i586-suse-linux, OK for mainline?


2007-12-12  Eric Botcazou  <ebotcazou@libertysurf.fr>

	PR middle-end/33088
	* gimplify.c (gimplify_modify_expr_complex_part): Add note to comment.
	* tree-complex.c (init_dont_simulate_again): Return true if there are
	uninitialized loads generated by gimplify_modify_expr_complex_part.
	* tree-gimple.c (is_gimple_reg_type): Return false for complex types
	if not optimizing.
	* tree-ssa.c (ssa_undefined_value_p): New predicate extracted from...
	(warn_uninit): ...here.  Use ssa_undefined_value_p.
	* tree-ssa-pre.c (is_undefined_value): Delete.
	(phi_translate_1): Use ssa_undefined_value_p.
	(add_to_exp_gen): Likewise.
	(make_values_for_stmt): Likewise.
	* tree-flow.h (ssa_undefined_value_p): Declare.


2007-12-12  Eric Botcazou  <ebotcazou@libertysurf.fr>

	* gcc.dg/uninit-13.c: UnXFAIL.
	* gcc.dg/complex-5.c: New testcase.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr33088.diff
Type: text/x-diff
Size: 8530 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20071212/f412cba8/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr33088.c
Type: text/x-csrc
Size: 995 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20071212/f412cba8/attachment-0001.bin>


More information about the Gcc-patches mailing list