This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [GOOGLE] More strict checking for call args
- From: Martin Jambor <mjambor at suse dot cz>
- To: Dehao Chen <dehao at google dot com>
- Cc: Xinliang David Li <davidxl at google dot com>, Richard Biener <richard dot guenther at gmail dot com>, Duncan Sands <baldrick at free dot fr>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 10 Jun 2013 11:19:12 +0200
- Subject: Re: [GOOGLE] More strict checking for call args
- References: <CAO2gOZWs7maFPDo=EZUe1mPARfNFxxnA5Yg3z0Wo0WS1+2ji2Q at mail dot gmail dot com> <51A85C16 dot 1030505 at free dot fr> <CAAkRFZL7aPp9WSxsj1yaujdBWrs91D=H0d_+KxVcgnh=xnt7Ng at mail dot gmail dot com> <CAO2gOZUZ0xTXoMPmLyhsCRkyFQehu7A7EiuqS1E40hBvd8yvxQ at mail dot gmail dot com> <CAFiYyc2q4nGUWNqDbqcpMunEPr-jQN0f2==h-rmMUCjqTWtTUw at mail dot gmail dot com> <CAO2gOZXqae0ju2nMK=f_XSKZFMOscdmL__P=MYf7x01BBs=jOw at mail dot gmail dot com> <CAAkRFZK4rfGvcaJ2PH34TGXtGaC41Wk8SeJ5hEyiC_eU9LTiTA at mail dot gmail dot com> <CAO2gOZViTTifco=SJ8sFqGjdAzg2h8Dzs87xtLa0ZVGaAJzGLg at mail dot gmail dot com> <20130606141124 dot GB30912 at virgil dot suse> <CAO2gOZWYMEa5y9F++nrfZm9JapTP2kCSEeHv-ad_aPNvRdS4-A at mail dot gmail dot com>
Hi,
On Thu, Jun 06, 2013 at 08:10:13AM -0700, Dehao Chen wrote:
> Hi, Martin,
>
> Yes, your patch can fix my case. Thanks a lot for the fix.
good. However, as usual when I'm trying to do things too quickly, I
made a stupid mistaker and testing has revealed I picked exactly the
wrong branch in the second hunk. So this is the correct patch, now
after proper bootstrapping and testing on x86_64-linux. Since the
intent is clearly the same as the approved patch, I intend to commit
it later today/early tomorrow, unless there are any objections.
Thanks and sorry again,
Martin
2013-06-07 Martin Jambor <mjambor@suse.cz>
* ipa-cp.c (ipa_get_indirect_edge_target_1): Check that param_index is
within bounds at the beginning of the function.
Index: src/gcc/ipa-cp.c
===================================================================
--- src.orig/gcc/ipa-cp.c
+++ src/gcc/ipa-cp.c
@@ -1481,7 +1481,8 @@ ipa_get_indirect_edge_target_1 (struct c
tree otr_type;
tree t;
- if (param_index == -1)
+ if (param_index == -1
+ || known_vals.length () <= (unsigned int) param_index)
return NULL_TREE;
if (!ie->indirect_info->polymorphic)
@@ -1516,8 +1517,7 @@ ipa_get_indirect_edge_target_1 (struct c
t = NULL;
}
else
- t = (known_vals.length () > (unsigned int) param_index
- ? known_vals[param_index] : NULL);
+ t = known_vals[param_index];
if (t &&
TREE_CODE (t) == ADDR_EXPR