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

FX Coudert fxcoudert@gmail.com
Sat Nov 25 10:42:00 GMT 2006

> 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?

No, we're right to flag it if the user requested out-of-bounds  
checking. The thing is that we probably want to support it (without - 
fbounds-check) because it's a syntax used in so much legacy code... I  
think what we need is a way to tell the testsuite not to run a  
particular case with -fbounds-check.

> 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 }]
> 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%

Hum, why used -fno-repack-arrays? Isn't it the default behaviour  
anyway? And next one: why not use -ftree-vectorize when it makes  
sense? It has been shown to spot a large number of problems in both  
the front-end and the middle-end.


More information about the Gcc-patches mailing list