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: COMMON requires 4 bytes of padding at start


Hi Janus,

Janus Weil wrote:
> here is an extended patch which implements the new options
> falign-commons and Walign-commons, both of which default to true, so
> that gfortran's default behavior is the same as before (COMMON block
> are padded and warned about). The patch includes documentation and
> test cases.
> There has been some discussion in this thread as well as in the PR
> regarding the defaults and the validity of the test case.

I have also no preference for either option.


I just checked with the test case in comment 0 of the PR:

- ifort, sunf95 and g95 print "2 3"
- NAG f95, gfortran, g77, openf95, pathf95 and pgf95 print "0 2"

For the standard conform version in comment 6 (using blank commons),
the result is different:

- ifort, sun95, g95, pathf95, pgf95, NAG f95 and openf95 print "5"
- gfortran and g77 print "0"

I somehow think we should do the padding better such that it works
by default for this case...



+	      if (gfc_option.warn_align_commons)
+		gfc_warning ("Padding of %d bytes required before '%s' in "
+			     "COMMON '%s' at %L", (int)offset, s->sym->name,
+			     common->name, &common->where);

Can you refer to the -fnoalign-commons option in the warnings? Otherwise
it is a bit difficult to find that option and to understand what it means.


Can you also check the patch does the right thing for equivalenced variables
which are in a common block? And can you add a test case for this?

Otherwise the patch looks ok.

Tobias


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