Summary: | -fbounds-check should catch substring out of range accesses | ||
---|---|---|---|
Product: | gcc | Reporter: | tobias.burnus |
Component: | fortran | Assignee: | Tobias Burnus <burnus> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | CC: | fxcoudert, gcc-bugs |
Priority: | P3 | ||
Version: | 4.2.0 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2006-06-08 09:01:54 | |
Bug Depends on: | |||
Bug Blocks: | 27766 |
Description
tobias.burnus
2006-05-13 14:07:21 UTC
Tobias, You are right, we do not check character lengths in assignment, yet. It is another PR but I just do not recall which, right now. You are correct, that this should be included in bounds checking. The standard demands that the length of the rhs, in total, should not exceed that of the lhs. Thank you for the report. Paul I'm writing a patch to add substring bounds checking. I hope to post it in the next few days. > From Francois-Xavier Coudert 2006-06-08 I'm writing a patch to add substring bounds checking. I hope to post it in the next few days. What is the status? If you have something, I'd save my time of looking at trans-expr.c's gfc_conv_substring and trying to understand how to add it there. Looking at http://www.polyhedron.com/pb05/linux/diagnose.html, this seems to be the last area where gfortran is worse than all others. Subject: Re: -fbounds-check should catch substring out of range accesses > I'm writing a patch to add substring bounds checking. I hope to post it in the > next few days. Great! > What is the status? If you have something, I'd save my time of looking > at trans-expr.c's gfc_conv_substring and trying to understand how to > add it there. The status is: "I had the beginning of a patch, but it didn't work fully, and I think it didn't survive summer cleaning of my account". But, I'll be happy to answer any question you have, and review your patch. Subject: Bug number PR27588 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00234.html The latest patch is at: http://gcc.gnu.org/ml/gcc-patches/2006-10/msg01030.html Problems: - variable name missing - line number is off-by-one Mine. Subject: Bug number PR27588 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-11/msg00694.html Subject: Bug 27588 Author: burnus Date: Wed Nov 15 10:13:16 2006 New Revision: 118852 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=118852 Log: fortran/ 2006-11-15 Tobias Burnus <burnus@net-b.de> Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> PR fortran/27588 * trans-expr.c (gfc_conv_substring): Add bounds checking. (gfc_conv_variable, gfc_conv_substring_expr): Pass more arguments to gfc_conv_substring. testsuite/ 2006-11-15 Tobias Burnus <burnus@net-b.de> PR fortran/27588 * gfortran.dg/char_bounds_check_fail_1.f90: New test. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/trans-expr.c trunk/gcc/testsuite/ChangeLog Fixed in 4.3 == trunk. Subject: Bug 27588 Author: burnus Date: Wed Jan 31 10:23:53 2007 New Revision: 121401 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121401 Log: (This part was missing in the r118852 / Wed Nov 15 10:13:16 2006 check in) 2007-01-31 Tobias Burnus <burnus@net-b.de> PR fortran/27588 * gfortran.dg/char_bounds_check_fail_1.f90: Add test. Added: trunk/gcc/testsuite/gfortran.dg/char_bounds_check_fail_1.f90 Modified: trunk/gcc/testsuite/ChangeLog |