COMMON requires 4 bytes of padding at start

Janus Weil jaydub66@googlemail.com
Sun Sep 21 10:01:00 GMT 2008


> Compiling this with -falign-commons now yields:
>
> program test
>           1
> Warning: COMMON '__BLNK__' at (1) requires 4 bytes of padding at
> start; reorder elements or use -fno-align-commons
>
> There are two things I dislike about this warning:
>
> 1) It shows the wrong location, and doesn't display the line where the
> common block was declared. This surely can be improved.
>
> 2) Referring to a blank common as COMMON '__BLNK__' could be confusing
> to the user, since he didn't declare a common block with the name
> __BLNK__, but an unnamed common block. Maybe it would be better to
> just use
>
> "COMMON at (1) requires ..."
>
> or
>
> "Blank COMMON at (1) requires ..."
>
> or something like this.

Ok, I have taken care of both items. Actually, is there a special
reason for this code in gfc_trans_common (which I removed to get the
right locus):

-      /* We've lost the real location, so use the location of the
-	 enclosing procedure.  */
-      if (ns->proc_name != NULL)
-	c->where = ns->proc_name->declared_at;
-      else
-	c->where = ns->blank_common.head->common_head->where;
-
+      c->where = ns->blank_common.head->common_head->where;

The warning message now reads:

common i, r8
     1
Warning: COMMON at (1) requires 4 bytes of padding at start; reorder
elements or use -fno-align-commons

I think this is much better.
Cheers,
Janus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: flag_align_commons.diff
Type: text/x-patch
Size: 9362 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080921/e8bed427/attachment.bin>


More information about the Gcc-patches mailing list