This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [patch, fortran] Fix for PR 47676
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Thomas Koenig <tkoenig at netcologne dot de>
- Cc: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 5 Jan 2015 10:55:08 -0800
- Subject: Re: [patch, fortran] Fix for PR 47676
- Authentication-results: sourceware.org; auth=none
- References: <54A1F0E2 dot 5090100 at netcologne dot de>
On Mon, Dec 29, 2014 at 4:25 PM, Thomas Koenig <tkoenig@netcologne.de> wrote:
> Hello world,
>
> this patch fixes the long-standing bug. A missing temporary
> causes an invalid read in realloc_on_assign_5.f03 which
> only becomes noticable when setting MALLOC_CHECK_ or when
> using valgrind. The bug has three duplicates in the
> data base, so people keep stumbling across this.
>
> I have to confess I could not find the right way to put
> this into the normal dependency code; the assumption that
> the string copying will "do the right thing" is too deeply
> embedded in the code, or I have been looking at the wrong places.
>
> So I took the approach of using the big hammer of a frontend
> pass to fix this up.
>
> I would definitely like to see this bug fixed for 5.0. If anybody
> has a better idea on how to tackle this in a timely manner, please
> let me know.
>
> Otherwise, OK for trunk? What about the other branches?
>
> Regression-tested.
>
> 2014-12-29 Thomas Koenig <tkoenig@gcc.gnu.org>
>
> PR fortran/47674
> * dependency.c (gfc_discard_nops): Add prototype.
> * dependency.c (discard_nops): Rename to gfc_discard_nops,
> make non-static.
> (gfc_discard_nops): Use gfc_discard_nops.
> (gfc_dep_difference): Likewise.
> * frontend-passes.c (realloc_strings): New function.
> Add prototype.
> (gfc_run_passes): Call realloc_strings.
> (realloc_string_callback): New function.
> (create_var): Add prototype. Handle case of a
> scalar character variable.
> (optimize_trim): Do not handle allocatable variables.
>
On Linux/x86, I got
../../src-trunk/gcc/fortran/frontend-passes.c: In function âint
realloc_string_callback(gfc_code**, int*, void*)â:
../../src-trunk/gcc/fortran/frontend-passes.c:152:38: error:
âgfc_discard_nopsâ was not declared in this scope
expr2 = gfc_discard_nops (co->expr2);
^
make[6]: *** [fortran/frontend-passes.o] Error 1
--
H.J.