This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, Fortran] PR34262 - Fix MVBITS with arrays


Tobias,

It helps to attach the attached!
Tobias Burnus wrote:

I find my method rather clumsy. Has someone a better idea? If not, OK for the trunk?


Your patch is OK :-)

However, is the attached not more elegant? The extension to all the other intrinsics is done by setting CLASS_ELEMENTAL in intrinsic.c and by adding the extra argument to the calls to gfc_get_intrinsic_sub_symbol, for the generic name.

Cheers and thanks

Paul


Index: gcc/fortran/gfortran.h
===================================================================
*** gcc/fortran/gfortran.h	(revision 130333)
--- gcc/fortran/gfortran.h	(working copy)
*************** void gfc_intrinsic_init_1 (void);
*** 2163,2169 ****
  void gfc_intrinsic_done_1 (void);
  
  char gfc_type_letter (bt);
! gfc_symbol * gfc_get_intrinsic_sub_symbol (const char *);
  try gfc_convert_type (gfc_expr *, gfc_typespec *, int);
  try gfc_convert_type_warn (gfc_expr *, gfc_typespec *, int, int);
  int gfc_generic_intrinsic (const char *);
--- 2163,2169 ----
  void gfc_intrinsic_done_1 (void);
  
  char gfc_type_letter (bt);
! gfc_symbol * gfc_get_intrinsic_sub_symbol (const char *, ...);
  try gfc_convert_type (gfc_expr *, gfc_typespec *, int);
  try gfc_convert_type_warn (gfc_expr *, gfc_typespec *, int, int);
  int gfc_generic_intrinsic (const char *);
Index: gcc/fortran/intrinsic.c
===================================================================
*** gcc/fortran/intrinsic.c	(revision 130333)
--- gcc/fortran/intrinsic.c	(working copy)
*************** gfc_type_letter (bt type)
*** 99,107 ****
  /* Get a symbol for a resolved name.  */
  
  gfc_symbol *
! gfc_get_intrinsic_sub_symbol (const char *name)
  {
    gfc_symbol *sym;
  
    gfc_get_symbol (name, gfc_intrinsic_namespace, &sym);
    sym->attr.always_explicit = 1;
--- 99,110 ----
  /* Get a symbol for a resolved name.  */
  
  gfc_symbol *
! gfc_get_intrinsic_sub_symbol (const char *name, ...)
  {
    gfc_symbol *sym;
+   gfc_intrinsic_sym *isym;
+   va_list vl;
+   const char *iname;
  
    gfc_get_symbol (name, gfc_intrinsic_namespace, &sym);
    sym->attr.always_explicit = 1;
*************** gfc_get_intrinsic_sub_symbol (const char
*** 109,114 ****
--- 112,124 ----
    sym->attr.flavor = FL_PROCEDURE;
    sym->attr.proc = PROC_INTRINSIC;
  
+   va_start (vl, name);
+   iname = va_arg (vl, const char*);
+   isym = gfc_find_subroutine (iname);
+   if (isym)
+     sym->attr.elemental = isym->elemental;
+   va_end (vl);
+ 
    return sym;
  }
  
Index: gcc/fortran/iresolve.c
===================================================================
*** gcc/fortran/iresolve.c	(revision 130333)
--- gcc/fortran/iresolve.c	(working copy)
*************** gfc_resolve_mvbits (gfc_code *c)
*** 2551,2557 ****
    /* TO and FROM are guaranteed to have the same kind parameter.  */
    name = gfc_get_string (PREFIX ("mvbits_i%d"),
  			 c->ext.actual->expr->ts.kind);
!   c->resolved_sym = gfc_get_intrinsic_sub_symbol (name);
  }
  
  
--- 2551,2557 ----
    /* TO and FROM are guaranteed to have the same kind parameter.  */
    name = gfc_get_string (PREFIX ("mvbits_i%d"),
  			 c->ext.actual->expr->ts.kind);
!   c->resolved_sym = gfc_get_intrinsic_sub_symbol (name, "mvbits");
  }
  
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]