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]

[gfortran, testsuite] Fix bounds checking for substrings, enable bounds chekcing in dg testsuite, assorted fixes



Hi,


a curious chain of events lead me to the attached patch, which does several things:
1. it makes the gfortran.dg testsuite use the same set of command line options that the gfortran.fortran-torture/execute tests use. My specific interest in this was that this enables a testsuite run with bounds checking.
2. it fixes bounds checking for substrings. Specifically, something like "a"(i+1:i) is perfectly valid, but gave a runtime error.
3. it fixes a number of out-of-bound accesses in testcases. The case in char_transpose_1.f90 I couldn't verify even though it is what lead to this patch, because this testcase is broken on i686-darwin due to unrelated reasons. OTOH this is the same as in char_spread_1.f90, which I could verify. g77/dnrm2.f is a bit special, because it uses the widespread syntax to imitate assumed-length arrays
dimension a(100)
call s(100, a)
...
subroutine s(n,a)
dimension a(1)
do i=1,n
a(i) = ...
end do
end subroutine
Maybe our bounds checking is overzealous here?
4. testcases which use dg-additional-sources get dg-options "-w" to suppress warnings which come about because -fno-repack-arrays is not a valid option for C source code. Note that if one's checking for warnings, it doesn't make much sense to link in additional sources (at least as long as there's no interprocedural analysis). Please note that, unlike I thought previous to an revelation by Andrew Pinski, and unlike a few testcases seem to assume, giving 'dg-options' doesn't make the testcase only be executed with this set of options, but instead these options are added to every single execution of the test.


The list of options that we cycle through with this patch is:
    set TORTURE_OPTIONS [list \
        { -O0 } { -O1 } { -O2 } \
        { -O2 -fomit-frame-pointer -finline-functions } \
        { -O2 -fomit-frame-pointer -finline-functions -funroll-loops } \
        { -O2 -fbounds-check } \
        { -O2 -fno-repack-arrays } \
        { -O3 -g } \
        { -Os }]
while previously, the dg testsuite would cycle through the following list
        { -O0 } \
        { -O1 } \
        { -O2 } \
        { -O3 -fomit-frame-pointer } \
        { -O3 -fomit-frame-pointer -funroll-loops } \
        { -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions } \
        { -O3 -g } \
        { -Os }

This is a good time to speak up if you think that list is too long, your favorite option is missing, etc. I'm open to suggestions how to shorten this list, as in its current incarnation the patch will grow the list of options by 12.5%

Cheers,
- Tobi


---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.



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