[PATCH] Fix PR fortran/37319
jvdelisle@verizon.net
jvdelisle@verizon.net
Tue Nov 25 05:24:00 GMT 2008
Eric Botcazou wrote:
> Hi,
>
> there is one remaining regression in the Fortran testsuite on
> SPARC/Solaris
>
> FAIL: gfortran.dg/function_kinds_5.f90 -O (test for errors, line 8)
>
> The expected error message is not issued by the compiler. Recompile
> the latter at -O0 and the message is correctly issued.
>
> The problem is that, during the compilation of the testcase, the
> string 'name' in parse.c:match_deferred_characteristics is used
> uninitialized:
>
> /* Set the function locus correctly. If we have not found the
> function name, there is an error. */
> gfc_match ("function% %n", name);
> if (m == MATCH_YES && strcmp (name, gfc_current_block ()->name) ==
> 0)
> {
> gfc_current_block ()->declared_at = gfc_current_locus;
> gfc_commit_symbols ();
> }
> else
> gfc_error_check ();
>
> gfc_match ("function% %n", name) doesn't touch 'name' so the outcome
> of the
> string comparison is random.
>
> Proposed fix attached, tested on SPARC/Solaris, OK for mainline?
>
Reg tested on x86-64-gnu-linux. OK. Thanks for patch.
Jerry
More information about the Gcc-patches
mailing list