[fortran,patch] Fix PR35682, more wrong array bounds calculation

FX fxcoudert@gmail.com
Tue May 13 07:16:00 GMT 2008


Attached patch fix PR 35682 and all its symptoms: the basic flaw in  
bounds calculation is in gfc_conv_loop_setup(), where a  
TRUNC_DIV_EXPR is used instead of a FLOOR_DIV_EXPR. This fixes all  
the wrong-code symptoms of the bug, but still leave one issue with - 
fbounds-check: we sometimes emit a message in gfc_conv_ss_startstride 
() that section sizes don't match because one is 0 and one is -1 (or  
any other negative number). This is wrong, as negative sizes don't  
exist, only zero-sized sections, so we take the appropriate step:  
size = MAX(size, 0). We also do the the same thing just after the fix  
in gfc_conv_loop_setup(), and we're done.

Regtested on x86_64-linux (both -m32 and -m64), comes with a  
duplicated testcase (once with -fbounds-check and once without)  
expanded from the PR testcase. OK to commit?

FX


-- 
François-Xavier Coudert
http://www.homepages.ucl.ac.uk/~uccafco/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr35682.ChangeLog
Type: application/octet-stream
Size: 382 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080513/69cc6b8a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr35682.diff
Type: application/octet-stream
Size: 3067 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080513/69cc6b8a/attachment-0001.obj>


More information about the Fortran mailing list