[Patch, fortran] PR28660 - Spurious warning: 'ubound.6' is used uninitialized in this function

Paul Thomas paulthomas2@wanadoo.fr
Fri Aug 11 19:54:00 GMT 2006


:ADDPATCH fortran:

This patch fixes a problem in which dependent declarations would get 
added to a function in the wrong order and would cause nonsense to be 
produced or runtime errors for negative allocation of memory.

The patch adds a check of declaration dependences to generate_local_decl 
before the potentially dependent declaration is added to the function.  
The testcase checks both versions of the problem as described in the PR.

It should be noted that two declarations of z are produced, with or 
without the patch.  It so happens that the patched version has 
calculated .z before the second declaration, rather than after it.  The 
redundant declaration should be removed sometime.

Regtested on FC5/Athlon and checked by building tonto-2.3 and running 
its testsuite.

OK for trunk and 4.2?

Paul

2006-08-11  Paul Thomas  <pault@gcc.gnu.org>
 
    PR fortran/28660
    * trans-decl.c (generate_expr_decls): New function.
    (generate_dependency_declarations): New function.
    (generate_local_decl): Call previous if not either a dummy or
    a declaration in an entry master.
 
2006-08-11  Paul Thomas  <pault@gcc.gnu.org>
 
    PR fortran/28660
    * gfortran.dg/dependent_decls_1.f90: New test.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr28660.diff
Type: text/x-patch
Size: 3881 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20060811/c944b468/attachment.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Change.Logs
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20060811/c944b468/attachment.ksh>


More information about the Fortran mailing list