This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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] PROCEDURE declarations


Tobias Schlüter wrote:
Janus Weil wrote:
+      /* Add current_attr to the symbol attributes.  */
+      src_attr = (char *) (&(current_attr));
+      dest_attr = (char *) (&(sym->attr));
+      for (i = 0; i < (int) sizeof (sym->attr); i++)
+        {
+          *dest_attr = (*dest_attr) | (*src_attr);
+          dest_attr++;
+          src_attr++;
+        }

This doesn't make any sense. There's a function gfc_copy_attr() which maybe does what you want.

Sorry, I was overly harsh. Note to self: never look at code five minutes before you leave the workplace.


I'm fairly sure that this code violates C's aliasing rules. It would be preferable to separate this into a function of its own (gfc_merge_attr() maybe?), going through the attributes one by one in the way gfc_copy_attr() operates. Besides evading problems with aliasing rules, this allows finding conflicts between the attributes.

Apologies,
- Tobi


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