This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
can a pointer to a 4x4 slice of a 5x5 array be CONTIGUOUS?
- From: Sylwester Arabas <sarabas at igf dot fuw dot edu dot pl>
- To: fortran at gcc dot gnu dot org
- Date: Thu, 03 Jan 2013 12:05:15 +0100
- Subject: can a pointer to a 4x4 slice of a 5x5 array be CONTIGUOUS?
Dear All,
A short question on the CONTIGUOUS attribute for pointers:
Do I understand correctly, that declaring a pointer to a 4x4 slice
within a 5x5 array as CONTIGUOUS is incorrect? (as the elements pointed
by the pointer do not constitute a contiguous region in the memory).
I'm asking as declaring such pointer CONTIGUOUS apparently triggers
auto-vectorisation (reported with -ftree-vectorizer-verbose) which is
not done without the CONTIGUOUS declaration:
...
378: create runtime check for data references MEM[(real(kind=8)[0:]
*)pretmp_244][_158] and MEM[(real(kind=8)[0:] *)tmp$data_136][_155]
378: create runtime check for data references MEM[(real(kind=8)[0:]
*)pretmp_246][_162] and MEM[(real(kind=8)[0:] *)tmp$data_136][_155]
378: created 2 versioning for alias checks.
378: === vect_do_peeling_for_loop_bound ===Setting upper bound of nb
iterations for epilogue loop to 0
378: LOOP VECTORIZED.
...
The results are correct, there's apparently some speed-up, and similar
vectorisation messages are printed for the same lines if instead of a
pointer an (int:int, int:int) range is explicitly given.
Is it just by chance that the bogus (?) CONTIGUOUS declaration produces
correct results, or is CONTIGUOUS still valid for a 4x4 slice of a 5x5
array.
Thanks for help,
Sylwester
P.S. BTW, here's an example of quite a misleading error message:
$ gfortran -OFast aqq.f
f951: error: argument to ‘-O’ should be a non-negative integer
-Ofast works, and "fast" is not an integer
--
http://www.igf.fuw.edu.pl/~slayoo/