From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 38166 invoked by alias); 3 Apr 2015 20:11:20 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 38130 invoked by uid 48); 3 Apr 2015 20:11:17 -0000 From: "jvdelisle at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/65089] FAIL: gfortran.dg/io_real_boz(2|_[45]).f90 when tested with -fsanitize=address Date: Fri, 03 Apr 2015 20:11:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jvdelisle at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-04/txt/msg00237.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65089 Jerry DeLisle changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jvdelisle at gcc dot gnu.org --- Comment #3 from Jerry DeLisle --- With the following patch, the fsanitize error goes away in the io_real_boz2 case. With -std=f2003 the case yields an expected runtime error. It is the formatting of this error where the -fsanitize does not like referencing a pointer for some reason. Index: format.c =================================================================== --- format.c (revision 221842) +++ format.c (working copy) @@ -1117,9 +1117,9 @@ void format_error (st_parameter_dt *dtp, const fnode *f, const char *message) { - int width, i, offset; + int width, i, offset, len; #define BUFLEN 300 - char *p, buffer[BUFLEN]; + char *p, *q, buffer[BUFLEN]; format_data *fmt = dtp->u.p.fmt; if (f != NULL) @@ -1132,9 +1132,12 @@ else snprintf (buffer, BUFLEN, "%s\n", message); + /* Find the length of the format string. */ + for (q = p, len = 0; *q; len++, q++); + /* Get the offset into the format string where the error occurred. */ offset = dtp->format_len - (fmt->reversion_ok ? - (int) strlen(p) : fmt->format_string_len); + len : fmt->format_string_len); width = dtp->format_len;