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]

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


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/

Attachment: pr35682.ChangeLog
Description: Binary data

Attachment: pr35682.diff
Description: Binary data


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