aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2009-08-12 11:03:38 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2009-08-12 11:03:38 +0200
commitc0e18b82d02f04edf9b909a75b93092582480fff (patch)
treeb5306121797a925d9c7fbb3c6d5fe0d288dd6ebc /gcc/fortran
parent64754ed578905416836c748cf442eb380996d980 (diff)
downloadgcc-c0e18b82d02f04edf9b909a75b93092582480fff.zip
gcc-c0e18b82d02f04edf9b909a75b93092582480fff.tar.gz
gcc-c0e18b82d02f04edf9b909a75b93092582480fff.tar.bz2
re PR fortran/41034 (Wrongly rejected proc pointer assignment with CDECL (compiler-directive_1.f90))
2009-08-12 Tobias Burnus <burnus@net-b.de> PR fortran/41034 * symbol.c (gfc_copy_attr): Merge bits instead of replace bits in gfc_copy_attr. * gfc_check_pointer_assign (gfc_check_pointer_assign): Initialize ext_attr bits by zero. From-SVN: r150678
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/expr.c15
-rw-r--r--gcc/fortran/symbol.c6
3 files changed, 19 insertions, 10 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 5674907..33e0c34 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,11 @@
+2009-08-12 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/41034
+ * symbol.c (gfc_copy_attr): Merge bits instead of replace
+ bits in gfc_copy_attr.
+ * gfc_check_pointer_assign (gfc_check_pointer_assign):
+ Initialize ext_attr bits by zero.
+
2009-08-11 Richard Guenther <rguenther@suse.de>
* trans-types.c (gfc_get_derived_type): Do not clear TYPE_CANONICAL.
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index b0e58b3..b8d54e7 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -3192,16 +3192,15 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue)
&& lvalue->symtree->n.sym->attr.ext_attr
!= rvalue->symtree->n.sym->attr.ext_attr)
{
- symbol_attribute cdecl, stdcall, fastcall;
- unsigned calls;
+ symbol_attribute calls;
- gfc_add_ext_attribute (&cdecl, EXT_ATTR_CDECL, NULL);
- gfc_add_ext_attribute (&stdcall, EXT_ATTR_STDCALL, NULL);
- gfc_add_ext_attribute (&fastcall, EXT_ATTR_FASTCALL, NULL);
- calls = cdecl.ext_attr | stdcall.ext_attr | fastcall.ext_attr;
+ calls.ext_attr = 0;
+ gfc_add_ext_attribute (&calls, EXT_ATTR_CDECL, NULL);
+ gfc_add_ext_attribute (&calls, EXT_ATTR_STDCALL, NULL);
+ gfc_add_ext_attribute (&calls, EXT_ATTR_FASTCALL, NULL);
- if ((calls & lvalue->symtree->n.sym->attr.ext_attr)
- != (calls & rvalue->symtree->n.sym->attr.ext_attr))
+ if ((calls.ext_attr & lvalue->symtree->n.sym->attr.ext_attr)
+ != (calls.ext_attr & rvalue->symtree->n.sym->attr.ext_attr))
{
gfc_error ("Mismatch in the procedure pointer assignment "
"at %L: mismatch in the calling convention",
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index c2666ae..27f378c 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -1641,7 +1641,9 @@ gfc_copy_attr (symbol_attribute *dest, symbol_attribute *src, locus *where)
{
int is_proc_lang_bind_spec;
- dest->ext_attr = src->ext_attr;
+ /* In line with the other attributes, we only add bits but do not remove
+ them; cf. also PR 41034. */
+ dest->ext_attr |= src->ext_attr;
if (src->allocatable && gfc_add_allocatable (dest, where) == FAILURE)
goto fail;
@@ -1712,7 +1714,7 @@ gfc_copy_attr (symbol_attribute *dest, symbol_attribute *src, locus *where)
if (src->cray_pointer && gfc_add_cray_pointer (dest, where) == FAILURE)
goto fail;
if (src->cray_pointee && gfc_add_cray_pointee (dest, where) == FAILURE)
- goto fail;
+ goto fail;
is_proc_lang_bind_spec = (src->flavor == FL_PROCEDURE ? 1 : 0);
if (src->is_bind_c