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
This commit is contained in:
Tobias Burnus 2009-08-12 11:03:38 +02:00 committed by Tobias Burnus
parent 64754ed578
commit c0e18b82d0
3 changed files with 19 additions and 10 deletions

View File

@ -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.

View File

@ -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",

View File

@ -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