------- Comment #2 from fxcoudert at gcc dot gnu dot org  2006-06-19 22:11 
-------
Regarding your patch:

+  /* An elemental function is required to return a scalar 12.7.1  */
+  if (sym->attr.elemental && sym->attr.function
+       && sym->as && sym->as->rank)

I'm not sure why the condition sym->as->rank is needed (and if you decide to
include it, I'd prefer the explicit (sym->as->rank > 0)); elsewhere in
resolve.c, I read:

      if (gfc_elemental (proc))
        {
          if (sym->as != NULL)
            {
              gfc_error
                ("Argument '%s' of elemental procedure at %L must be scalar",
                 sym->name, &sym->declared_at);
              continue;
            }

which makes me think that simply having as != NULL is enough to know that it's
not a scalar.


One more thing: reading the lines after the code I pasted above reminds me that
we should check that an elemental function doesn't return a pointer. Could it
be  along these lines?:

+  if (sym->attr.elemental && sym->attr.function
+       && sym->result->attr.pointer)
+    ...


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org
      Known to fail|                            |4.2.0 4.1.2
   Last reconfirmed|2005-12-31 20:03:28         |2006-06-19 22:11:19
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20874

Reply via email to