User account creation filtered due to spam.

Bug 40632 - Support F2008's contiguous attribute
Summary: Support F2008's contiguous attribute
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.5.0
: P3 enhancement
Target Milestone: ---
Assignee: Tobias Burnus
URL:
Keywords: missed-optimization
Depends on:
Blocks: 39627 41137
  Show dependency treegraph
 
Reported: 2009-07-03 11:32 UTC by Tobias Burnus
Modified: 2010-06-21 14:44 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-06-19 06:40:53


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2009-07-03 11:32:45 UTC
On one hand it needs a new attribute, which needs some checking that the contiguity is not violated. It also needs the contiguous flag of the reworked descriptor.

One place where it can be used is:
a) In functions calls
b) In assignments of the type (cf. PR 40551)
   array = function()
c) In compile-time value for the strides, cf. PR 32131
Comment 1 Thomas Koenig 2009-08-24 19:33:49 UTC
It would also be useful when assigning arrays with a single value:

subroutine foo(a)
  integer, a(:,:) :: a
  a = 0   ! See PR 41137, we could use memset

or 

subroutine foo(a)
  integer, a(:,:) :: a
  A = 42
Comment 2 Tobias Burnus 2010-06-19 06:40:53 UTC
Mine. Patch: http://gcc.gnu.org/ml/fortran/2010-06/msg00199.html
Comment 3 Tobias Burnus 2010-06-21 14:16:15 UTC
Subject: Bug 40632

Author: burnus
Date: Mon Jun 21 14:15:56 2010
New Revision: 161079

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=161079
Log:
2010-06-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/40632
        * interface.c (compare_parameter): Add gfc_is_simply_contiguous
        checks.
        * symbol.c (gfc_add_contiguous): New function.
        (gfc_copy_attr, check_conflict): Handle contiguous attribute.
        * decl.c (match_attr_spec): Ditto.
        (gfc_match_contiguous): New function.
        * resolve.c (resolve_fl_derived, resolve_symbol): Handle
        contiguous.
        * gfortran.h (symbol_attribute): Add contiguous.
        (gfc_is_simply_contiguous): Add prototype.
        (gfc_add_contiguous): Add prototype.
        * match.h (gfc_match_contiguous): Add prototype.
        * parse.c (decode_specification_statement,
        decode_statement): Handle contiguous attribute.
        * expr.c (gfc_is_simply_contiguous): New function.
        * dump-parse-tree.c (show_attr): Handle contiguous.
        * module.c (ab_attribute, attr_bits, mio_symbol_attribute):
        Ditto.
        * trans-expr.c (gfc_add_interface_mapping): Copy
        attr.contiguous.
        * trans-array.c (gfc_conv_descriptor_stride_get,
        gfc_conv_array_parameter): Handle contiguous arrays.
        * trans-types.c (gfc_build_array_type, gfc_build_array_type,
        gfc_sym_type, gfc_get_derived_type, gfc_get_array_descr_info):
        Ditto.
        * trans.h (gfc_array_kind): Ditto.
        * trans-decl.c (gfc_get_symbol_decl): Ditto.

2010-06-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/40632
        * gfortran.dg/contiguous_1.f90: New.
        * gfortran.dg/contiguous_2.f90: New.
        * gfortran.dg/contiguous_3.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/contiguous_1.f90
    trunk/gcc/testsuite/gfortran.dg/contiguous_2.f90
    trunk/gcc/testsuite/gfortran.dg/contiguous_3.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/fortran/dependency.c
    trunk/gcc/fortran/dependency.h
    trunk/gcc/fortran/dump-parse-tree.c
    trunk/gcc/fortran/expr.c
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/interface.c
    trunk/gcc/fortran/match.h
    trunk/gcc/fortran/module.c
    trunk/gcc/fortran/parse.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/symbol.c
    trunk/gcc/fortran/trans-array.c
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/fortran/trans-types.c
    trunk/gcc/fortran/trans.h
    trunk/gcc/testsuite/ChangeLog

Comment 4 Tobias Burnus 2010-06-21 14:44:59 UTC
FIXED on the trunk.  Related items: is_contiguous() intrinsic and DO CONCURRENT construct.