aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/module.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2006-12-03 07:18:22 +0000
committerPaul Thomas <pault@gcc.gnu.org>2006-12-03 07:18:22 +0000
commit06469efd1a409d723093cfaa75ab9d39653e6463 (patch)
tree2cc0f500bf05264d75beb5ac0011e36ce0619792 /gcc/fortran/module.c
parent3c5e8e4492a4f360800bfc4d3965a5a85c230a08 (diff)
downloadgcc-06469efd1a409d723093cfaa75ab9d39653e6463.zip
gcc-06469efd1a409d723093cfaa75ab9d39653e6463.tar.gz
gcc-06469efd1a409d723093cfaa75ab9d39653e6463.tar.bz2
re PR fortran/29642 (Fortran 2003: VALUE Attribute (call by value not call by reference for actual arguments))
2006-12-03 Paul Thomas <pault@gcc.gnu.org> PR fortran/29642 * trans-expr.c (gfc_conv_variable): A character expression with the VALUE attribute needs an address expression; otherwise all other expressions with this attribute must not be dereferenced. (gfc_conv_function_call): Pass expressions with the VALUE attribute by value, using gfc_conv_expr. * symbol.c (check_conflict): Add strings for INTENT OUT, INOUT and VALUE. Apply all the constraints associated with the VALUE attribute. (gfc_add_value): New function. (gfc_copy_attr): Call it for VALUE attribute. * decl.c (match_attr_spec): Include the VALUE attribute. (gfc_match_value): New function. * dump-parse-tree.c (gfc_show_attr): Include VALUE. * gfortran.h : Add value to the symbol_attribute structure and add a prototype for gfc_add_value * module.c (mio_internal_string): Include AB_VALUE in enum. (attr_bits): Provide the VALUE string for it. (mio_symbol_attribute): Read or apply the VLUE attribute. * trans-types.c (gfc_sym_type): Variables with the VLAUE attribute are not passed by reference! * resolve.c (was_declared): Add value to those that return 1. (resolve_symbol): Value attribute requires dummy attribute. * match.h : Add prototype for gfc_match_public. * parse.c (decode_statement): Try to match a VALUE statement. 2006-12-03 Paul Thomas <pault@gcc.gnu.org> PR fortran/29642 * gfortran.dg/value_1.f90 : New test. * gfortran.dg/value_2.f90 : New test. * gfortran.dg/value_3.f90 : New test. * gfortran.dg/value_4.f90 : New test. * gfortran.dg/value_4.c : Called from value_4.f90. From-SVN: r119461
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r--gcc/fortran/module.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index cd83ff9..6956fc9 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -1487,11 +1487,11 @@ mio_internal_string (char *string)
typedef enum
{ AB_ALLOCATABLE, AB_DIMENSION, AB_EXTERNAL, AB_INTRINSIC, AB_OPTIONAL,
- AB_POINTER, AB_SAVE, AB_TARGET, AB_DUMMY, AB_RESULT,
- AB_DATA, AB_IN_NAMELIST, AB_IN_COMMON,
- AB_FUNCTION, AB_SUBROUTINE, AB_SEQUENCE, AB_ELEMENTAL, AB_PURE,
- AB_RECURSIVE, AB_GENERIC, AB_ALWAYS_EXPLICIT, AB_CRAY_POINTER,
- AB_CRAY_POINTEE, AB_THREADPRIVATE, AB_ALLOC_COMP, AB_VOLATILE
+ AB_POINTER, AB_SAVE, AB_TARGET, AB_DUMMY, AB_RESULT, AB_DATA,
+ AB_IN_NAMELIST, AB_IN_COMMON, AB_FUNCTION, AB_SUBROUTINE, AB_SEQUENCE,
+ AB_ELEMENTAL, AB_PURE, AB_RECURSIVE, AB_GENERIC, AB_ALWAYS_EXPLICIT,
+ AB_CRAY_POINTER, AB_CRAY_POINTEE, AB_THREADPRIVATE, AB_ALLOC_COMP,
+ AB_VALUE, AB_VOLATILE
}
ab_attribute;
@@ -1504,6 +1504,7 @@ static const mstring attr_bits[] =
minit ("OPTIONAL", AB_OPTIONAL),
minit ("POINTER", AB_POINTER),
minit ("SAVE", AB_SAVE),
+ minit ("VALUE", AB_VALUE),
minit ("VOLATILE", AB_VOLATILE),
minit ("TARGET", AB_TARGET),
minit ("THREADPRIVATE", AB_THREADPRIVATE),
@@ -1575,6 +1576,8 @@ mio_symbol_attribute (symbol_attribute * attr)
MIO_NAME(ab_attribute) (AB_POINTER, attr_bits);
if (attr->save)
MIO_NAME(ab_attribute) (AB_SAVE, attr_bits);
+ if (attr->value)
+ MIO_NAME(ab_attribute) (AB_VALUE, attr_bits);
if (attr->volatile_)
MIO_NAME(ab_attribute) (AB_VOLATILE, attr_bits);
if (attr->target)
@@ -1655,6 +1658,9 @@ mio_symbol_attribute (symbol_attribute * attr)
case AB_SAVE:
attr->save = 1;
break;
+ case AB_VALUE:
+ attr->value = 1;
+ break;
case AB_VOLATILE:
attr->volatile_ = 1;
break;