diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2011-01-08 19:17:03 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2011-01-08 19:17:03 +0000 |
commit | f1f39033accfe89082fc2701d02bd65b57df0978 (patch) | |
tree | 6cbb30f180525c7412d32456d32db59b7e9882aa /gcc/fortran/module.c | |
parent | f69e4b94c128d3145ac7377e9d277f0bf48ffad8 (diff) | |
download | gcc-f1f39033accfe89082fc2701d02bd65b57df0978.zip gcc-f1f39033accfe89082fc2701d02bd65b57df0978.tar.gz gcc-f1f39033accfe89082fc2701d02bd65b57df0978.tar.bz2 |
re PR fortran/46896 (Wrong code with transpose(a) passed to subroutine)
2011-01-08 Paul Thomas <pault@gcc.gnu.org>
PR fortran/46896
* trans-expr.c (gfc_conv_procedure_call): With a non-copying
procedure argument (eg TRANSPOSE) use a temporary if there is
any chance of aliasing due to host or use association.
(arrayfunc_assign_needs_temporary): Correct logic for function
results and do not use a temporary for implicitly PURE
variables. Use a temporary for Cray pointees.
* symbol.c (gfc_add_save): Explicit SAVE not compatible with
implicit pureness of containing procedure.
* decl.c (match_old_style_init, gfc_match_data): Where decl
would fail in PURE procedure, set implicit_pure to zero.
* gfortran.h : Add implicit_pure to structure symbol_attr and
add prototype for function gfc_implicit_pure.
* expr.c (gfc_check_pointer_assign, gfc_check_vardef_context):
Where decl would fail in PURE procedure, reset implicit_pure.
* io.c (match_vtag, gfc_match_open, gfc_match_close,
gfc_match_print, gfc_match_inquire, gfc_match_wait): The same.
* match.c (gfc_match_critical, gfc_match_stopcode,
sync_statement, gfc_match_allocate, gfc_match_deallocate): The
same.
* parse.c (decode_omp_directive): The same.
(parse_contained): If not PURE, set implicit pure attribute.
* resolve.c (resolve_formal_arglist, resolve_structure_cons,
resolve_function, resolve_ordinary_assign) : The same.
(gfc_implicit_pure): New function.
* module.c (mio_symbol_attribute): Introduce AB_IMPLICIT_PURE
to ab_attribute enum and use it in this function.
2011-01-08 Paul Thomas <pault@gcc.gnu.org>
PR fortran/46896
* gfortran.dg/transpose_optimization_2.f90 : New test.
From-SVN: r168600
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r-- | gcc/fortran/module.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index f75e3fd..8de1927 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -1,7 +1,7 @@ /* Handle modules, which amounts to loading and saving symbols and their attendant structures. Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010 + 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Andy Vaught @@ -1675,7 +1675,8 @@ typedef enum AB_POINTER_COMP, AB_PRIVATE_COMP, AB_VALUE, AB_VOLATILE, AB_PROTECTED, AB_IS_BIND_C, AB_IS_C_INTEROP, AB_IS_ISO_C, AB_ABSTRACT, AB_ZERO_COMP, AB_IS_CLASS, AB_PROCEDURE, AB_PROC_POINTER, AB_ASYNCHRONOUS, AB_CODIMENSION, - AB_COARRAY_COMP, AB_VTYPE, AB_VTAB, AB_CONTIGUOUS, AB_CLASS_POINTER + AB_COARRAY_COMP, AB_VTYPE, AB_VTAB, AB_CONTIGUOUS, AB_CLASS_POINTER, + AB_IMPLICIT_PURE } ab_attribute; @@ -1725,6 +1726,7 @@ static const mstring attr_bits[] = minit ("VTYPE", AB_VTYPE), minit ("VTAB", AB_VTAB), minit ("CLASS_POINTER", AB_CLASS_POINTER), + minit ("IMPLICIT_PURE", AB_IMPLICIT_PURE), minit (NULL, -1) }; @@ -1859,6 +1861,8 @@ mio_symbol_attribute (symbol_attribute *attr) MIO_NAME (ab_attribute) (AB_ELEMENTAL, attr_bits); if (attr->pure) MIO_NAME (ab_attribute) (AB_PURE, attr_bits); + if (attr->implicit_pure) + MIO_NAME (ab_attribute) (AB_IMPLICIT_PURE, attr_bits); if (attr->recursive) MIO_NAME (ab_attribute) (AB_RECURSIVE, attr_bits); if (attr->always_explicit) @@ -1990,6 +1994,9 @@ mio_symbol_attribute (symbol_attribute *attr) case AB_PURE: attr->pure = 1; break; + case AB_IMPLICIT_PURE: + attr->implicit_pure = 1; + break; case AB_RECURSIVE: attr->recursive = 1; break; |