[PATCH][C++] Fix PR37742

H.J. Lu hjl.tools@gmail.com
Tue Jan 6 19:39:00 GMT 2009


On Sun, Nov 2, 2008 at 11:00 AM, Richard Guenther <rguenther@suse.de> wrote:
> On Fri, 31 Oct 2008, Jason Merrill wrote:
>
>> Richard Guenther wrote:
>> > Ping!  The C++ parts need approval.
>>
>> OK.
>
> Re-testing the patch uncovered one optimization regression.  The
> following patch fixes that by ensuring that we still propagate
> addresses of a decl even if we lose restrict qualification in this case.
> This is a fair trade-off and should make sure we do not run into
> wrong-code problems.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, I'll apply this
> variant tomorrow.
>
> Richard.
>
> 2008-10-14  Richard Guenther  <rguenther@suse.de>
>
>        PR middle-end/37742
>        * tree-ssa.c (useless_type_conversion_p_1): Check different restrict
>        qualified pointer conversion before stripping qualifiers.
>        * gimplify.c (create_tmp_from_val): Use correctly qualified type.
>        * tree-flow.h (may_propagate_address_into_dereference): Declare.
>        * tree-ssa-ccp.c (may_propagate_address_into_dereference): New function.
>        (ccp_fold): Use it.
>        * tree-ssa-forwprop.c (rhs_to_tree): Remove useless conversions,
>        properly canonicalize binary ops.
>        (forward_propagate_addr_expr_1): Use
>        may_propagate_address_into_dereference.
>
>        cp/
>        * decl.c (start_preparsed_function): Use the correct type for
>        building the RESULT_DECL.
>
>        * gcc.c-torture/compile/pr37742.c: New testcase.
>        * g++.dg/pr37742.C: Likewise.
>        * gcc.dg/tree-ssa/forwprop-7.c: Check for two volatile loads.
>

This patch caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38745

-- 
H.J.



More information about the Gcc-patches mailing list