From: Martin Jambor Date: Fri, 23 Apr 2010 14:43:10 +0000 (+0200) Subject: re PR middle-end/43835 (IPA-SRA doesn't rewrite attributes) X-Git-Tag: releases/gcc-4.6.0~7703 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5c20baf14a210ac2df9f81b5a6f90b8ae8455d6d;p=thirdparty%2Fgcc.git re PR middle-end/43835 (IPA-SRA doesn't rewrite attributes) 2010-04-23 Martin Jambor PR middle-end/43835 * tree-sra.c (ipa_sra_preliminary_function_checks): Check that the function does not have type attributes. * testsuite/gcc.c-torture/execute/pr43835.c: New test. From-SVN: r158667 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d81d2eb6b519..1d454224c959 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-04-23 Martin Jambor + + PR middle-end/43835 + * tree-sra.c (ipa_sra_preliminary_function_checks): Check that the + function does not have type attributes. + 2010-04-23 Richard Guenther PR lto/42653 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5dfed4086094..555813437019 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-04-23 Martin Jambor + + PR middle-end/43835 + * gcc.c-torture/execute/pr43835.c: New test. + 2010-04-23 Richard Guenther PR lto/42653 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr43835.c b/gcc/testsuite/gcc.c-torture/execute/pr43835.c new file mode 100644 index 000000000000..97237f625388 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr43835.c @@ -0,0 +1,51 @@ +struct PMC { + unsigned flags; +}; + +typedef struct Pcc_cell +{ + struct PMC *p; + long bla; + long type; +} Pcc_cell; + +extern void abort (); +extern void Parrot_gc_mark_PMC_alive_fun(int * interp, struct PMC *pmc) + __attribute__((noinline)); + +void Parrot_gc_mark_PMC_alive_fun (int * interp, struct PMC *pmc) +{ + abort (); +} + +static void mark_cell(int * interp, Pcc_cell *c) + __attribute__((__nonnull__(1))) + __attribute__((__nonnull__(2))) + __attribute__((noinline)); + +static void +mark_cell(int * interp, Pcc_cell *c) +{ + if (c->type == 4 && c->p + && !(c->p->flags & (1<<18))) + Parrot_gc_mark_PMC_alive_fun(interp, c->p); +} + +void foo(int * interp, Pcc_cell *c); + +void +foo(int * interp, Pcc_cell *c) +{ + mark_cell(interp, c); +} + +int main() +{ + int i; + Pcc_cell c; + c.p = 0; + c.bla = 42; + c.type = 4; + foo (&i, &c); + return 0; +} diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 0635aa7f4a81..b31820186ab4 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -4162,6 +4162,9 @@ ipa_sra_preliminary_function_checks (struct cgraph_node *node) return false; } + if (TYPE_ATTRIBUTES (TREE_TYPE (node->decl))) + return false; + return true; }