Message ID | 20150521083806.GG47912@msticlxl57.ims.intel.com |
---|---|
State | New |
Headers | show |
On Thu, May 21, 2015 at 10:38 AM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote: > Hi, > > This patch fixes PR66221 by using build_distinct_type_copy instead of copy_node to copy a function type for instrumented function. Bootstrapped and regtested for x86_64-unknown-linux-gnu. Applied to trunk. Is it OK for gcc-5? Ok. Thanks, Richard. > Thanks, > Ilya > -- > gcc/ > > 2015-05-21 Ilya Enkovich <enkovich.gnu@gmail.com> > > PR middle-end/66221 > * ipa-chkp.c (chkp_copy_function_type_adding_bounds): Use > build_distinct_type_copy to copy bounds. > > gcc/testsuite/ > > 2015-05-21 Ilya Enkovich <enkovich.gnu@gmail.com> > > PR middle-end/66221 > * gcc.dg/lto/pr66221_0.c: New test. > * gcc.dg/lto/pr66221_1.c: New test. > > > diff --git a/gcc/ipa-chkp.c b/gcc/ipa-chkp.c > index ac5eb35..c710291 100644 > --- a/gcc/ipa-chkp.c > +++ b/gcc/ipa-chkp.c > @@ -308,7 +308,7 @@ chkp_copy_function_type_adding_bounds (tree orig_type) > if (!arg_type) > return orig_type; > > - type = copy_node (orig_type); > + type = build_distinct_type_copy (orig_type); > TYPE_ARG_TYPES (type) = copy_list (TYPE_ARG_TYPES (type)); > > for (arg_type = TYPE_ARG_TYPES (type); > diff --git a/gcc/testsuite/gcc.dg/lto/pr66221_0.c b/gcc/testsuite/gcc.dg/lto/pr66221_0.c > new file mode 100644 > index 0000000..dbb9282 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/lto/pr66221_0.c > @@ -0,0 +1,10 @@ > +/* { dg-lto-do link } */ > +/* { dg-require-effective-target mpx } */ > +/* { dg-lto-options { { -O2 -flto -fcheck-pointer-bounds -mmpx } } } */ > + > +int test1 (const char *); > + > +int main (int argc, const char **argv) > +{ > + return test1 (argv[0]); > +} > diff --git a/gcc/testsuite/gcc.dg/lto/pr66221_1.c b/gcc/testsuite/gcc.dg/lto/pr66221_1.c > new file mode 100644 > index 0000000..4c94544 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/lto/pr66221_1.c > @@ -0,0 +1,4 @@ > +int test1 (const char *p) > +{ > + return (int)(*p); > +}
diff --git a/gcc/ipa-chkp.c b/gcc/ipa-chkp.c index ac5eb35..c710291 100644 --- a/gcc/ipa-chkp.c +++ b/gcc/ipa-chkp.c @@ -308,7 +308,7 @@ chkp_copy_function_type_adding_bounds (tree orig_type) if (!arg_type) return orig_type; - type = copy_node (orig_type); + type = build_distinct_type_copy (orig_type); TYPE_ARG_TYPES (type) = copy_list (TYPE_ARG_TYPES (type)); for (arg_type = TYPE_ARG_TYPES (type); diff --git a/gcc/testsuite/gcc.dg/lto/pr66221_0.c b/gcc/testsuite/gcc.dg/lto/pr66221_0.c new file mode 100644 index 0000000..dbb9282 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr66221_0.c @@ -0,0 +1,10 @@ +/* { dg-lto-do link } */ +/* { dg-require-effective-target mpx } */ +/* { dg-lto-options { { -O2 -flto -fcheck-pointer-bounds -mmpx } } } */ + +int test1 (const char *); + +int main (int argc, const char **argv) +{ + return test1 (argv[0]); +} diff --git a/gcc/testsuite/gcc.dg/lto/pr66221_1.c b/gcc/testsuite/gcc.dg/lto/pr66221_1.c new file mode 100644 index 0000000..4c94544 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr66221_1.c @@ -0,0 +1,4 @@ +int test1 (const char *p) +{ + return (int)(*p); +}