From: Tobias Burnus Date: Sat, 30 Aug 2014 18:47:04 +0000 (+0200) Subject: re PR fortran/62278 (gfc_check_dependency should also check for TARGET attribute) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e284dec53b47987924dfaaec965c2e6c20defe66;p=gcc.git re PR fortran/62278 (gfc_check_dependency should also check for TARGET attribute) 2014-08-30 Tobias Burnus PR fortran/62278 PR fortran/44735 PR fortran/60593 * dependency.c (gfc_check_dependency): Allow for optimizations in the pointer-alias check. From-SVN: r214757 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 7c4a2c4a0ae..b9706f4450d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2014-08-30 Tobias Burnus + + PR fortran/62278 + PR fortran/44735 + PR fortran/60593 + * dependency.c (gfc_check_dependency): Allow for optimizations + in the pointer-alias check. + 2014-08-30 Janne Blomqvist * module.c (gfc_dump_module): Use ISO C remove() instead of POSIX diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c index c18482aff2e..367b323eae2 100644 --- a/gcc/fortran/dependency.c +++ b/gcc/fortran/dependency.c @@ -1269,6 +1269,7 @@ gfc_check_dependency (gfc_expr *expr1, gfc_expr *expr2, bool identical) /* The interesting cases are when the symbols don't match. */ if (expr1->symtree->n.sym != expr2->symtree->n.sym) { + symbol_attribute attr1, attr2; gfc_typespec *ts1 = &expr1->symtree->n.sym->ts; gfc_typespec *ts2 = &expr2->symtree->n.sym->ts; @@ -1284,9 +1285,13 @@ gfc_check_dependency (gfc_expr *expr1, gfc_expr *expr2, bool identical) return 0; } - /* If either variable is a pointer, assume the worst. */ - /* TODO: -fassume-no-pointer-aliasing */ - if (gfc_is_data_pointer (expr1) || gfc_is_data_pointer (expr2)) + /* We have to also include target-target as ptr%comp is not a + pointer but it still alias with "dt%comp" for "ptr => dt". As + subcomponents and array access to pointers retains the target + attribute, that's sufficient. */ + attr1 = gfc_expr_attr (expr1); + attr2 = gfc_expr_attr (expr2); + if ((attr1.pointer || attr1.target) && (attr2.pointer || attr2.target)) { if (check_data_pointer_types (expr1, expr2) && check_data_pointer_types (expr2, expr1))