[PATCH, Fortran] PROCEDURE declarations

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Fri Aug 31 23:31:00 GMT 2007


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



More information about the Fortran mailing list