[Bug fortran/28660] Spurious warning: 'ubound.6' is used uninitialized in this function

2006-08-20 Thread pault at gcc dot gnu dot org


--- Comment #10 from pault at gcc dot gnu dot org  2006-08-20 08:21 ---
Subject: Bug 28660

Author: pault
Date: Sun Aug 20 08:20:26 2006
New Revision: 116269

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=116269
Log:
2006-08-20 Paul Thomas [EMAIL PROTECTED]

PR fortran/28601
PR fortran/28630
* gfortran.h : Eliminate gfc_dt_list structure and reference
to it in gfc_namespace.
* resolve.c (resolve_fl_derived): Remove the building of the
list of derived types for the current namespace.
* symbol.c (find_renamed_type): New function to find renamed
derived types by symbol name rather than symtree name.
(gfc_use_derived): Search parent namespace for identical
derived type and use it, even if local version is complete,
except in interface bodies. Ensure that renamed derived types
are found by call to find_renamed_type. Recurse for derived
type components.
(gfc_free_dt_list): Remove.
(gfc_free_namespace): Remove call to previous.
* trans-types.c (copy_dt_decls_ifequal): Remove.
(gfc_get_derived_type): Remove all the paraphenalia for
association of derived types, including calls to previous.
* match.c (gfc_match_allocate): Call gfc_use_derived to
associate any derived types that are being allocated.

PR fortran/20886
* resolve.c (resolve_actual_arglist): The passing of
a generic procedure name as an actual argument is an
error.

PR fortran/28735
* resolve.c (resolve_variable): Check for a symtree before
resolving references.

PR fortran/28762
* primary.c (match_variable): Return MATCH_NO if the symbol
is that of the program.

PR fortran/28425
* trans-expr.c (gfc_trans_subcomponent_assign): Translate
derived type component expressions other than another derived
type constructor.

PR fortran/28496
* expr.c (find_array_section): Correct errors in
the handling of a missing start value for the
index triplet in an array reference.

PR fortran/18111
* trans-decl.c (gfc_build_dummy_array_decl): Before resetting
reference to backend_decl, set it DECL_ARTIFICIAL.
(gfc_get_symbol_decl): Likewise for original dummy decl, when
a copy is made of an array.
(create_function_arglist): Likewise for the _entry paramter
in entry_masters.
(build_entry_thunks): Likewise for dummies in entry thunks.

PR fortran/28771
* decl.c (add_init_expr_to_sym): Remove setting of charlen for
an initializer of an assumed charlen variable.

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-20 Paul Thomas [EMAIL PROTECTED]

PR fortran/28630
* gfortran.dg/used_types_2.f90: New test.

PR fortran/28601
* gfortran.dg/used_types_3.f90: New test.

PR fortran/20886
* gfortran.dg/generic_actual_arg.f90: New test.

PR fortran/28735
* gfortran.dg/module_private_array_refs_1.f90: New test.

PR fortran/28762
* gfortran.dg/program_name_1.f90: New test.

PR fortran/28425
* gfortran.dg/derived_constructor_comps_1.f90: New test.

PR fortran/28496
* gfortran.dg/array_initializer_2.f90: New test.

PR fortran/18111
* gfortran.dg/unused_artificial_dummies_1.f90: New test. 

PR fortran/28771
* gfortran.dg/assumed_charlen_in_main.f90: New test.

PR fortran/28660
* gfortran.dg/dependent_decls_1.f90: New test.

Added:
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/array_initializer_2.f90
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/assumed_charlen_in_main.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/dependent_decls_1.f90
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/derived_constructor_comps_1.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/generic_actual_arg.f90
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/module_private_array_refs_1.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/program_name_1.f90
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/unused_artificial_dummies_1.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/used_types_2.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/used_types_3.f90
Modified:
branches/gcc-4_1-branch/gcc/fortran/ChangeLog
branches/gcc-4_1-branch/gcc/fortran/decl.c
branches/gcc-4_1-branch/gcc/fortran/expr.c
branches/gcc-4_1-branch/gcc/fortran/gfortran.h
branches/gcc-4_1-branch/gcc/fortran/match.c
branches/gcc-4_1-branch/gcc/fortran/primary.c

[Bug fortran/28660] Spurious warning: 'ubound.6' is used uninitialized in this function

2006-08-20 Thread pault at gcc dot gnu dot org


--- Comment #11 from pault at gcc dot gnu dot org  2006-08-20 17:48 ---
Fixed on trunk and 4.1

Paul


-- 

pault at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28660



[Bug fortran/28660] Spurious warning: 'ubound.6' is used uninitialized in this function

2006-08-19 Thread pault at gcc dot gnu dot org


--- Comment #9 from pault at gcc dot gnu dot org  2006-08-20 05:46 ---
Subject: Bug 28660

Author: pault
Date: Sun Aug 20 05:45:43 2006
New Revision: 116268

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=116268
Log:
2006-08-20 Paul Thomas [EMAIL PROTECTED]

PR fortran/28601
PR fortran/28630
* gfortran.h : Eliminate gfc_dt_list structure and reference
to it in gfc_namespace.
* resolve.c (resolve_fl_derived): Remove the building of the
list of derived types for the current namespace.
* symbol.c (find_renamed_type): New function to find renamed
derived types by symbol name rather than symtree name.
(gfc_use_derived): Search parent namespace for identical
derived type and use it, even if local version is complete,
except in interface bodies. Ensure that renamed derived types
are found by call to find_renamed_type. Recurse for derived
type components.
(gfc_free_dt_list): Remove.
(gfc_free_namespace): Remove call to previous.
* trans-types.c (copy_dt_decls_ifequal): Remove.
(gfc_get_derived_type): Remove all the paraphenalia for
association of derived types, including calls to previous.
* match.c (gfc_match_allocate): Call gfc_use_derived to
associate any derived types that are being allocated.

PR fortran/20886
* resolve.c (resolve_actual_arglist): The passing of
a generic procedure name as an actual argument is an
error.

PR fortran/28735
* resolve.c (resolve_variable): Check for a symtree before
resolving references.

PR fortran/28762
* primary.c (match_variable): Return MATCH_NO if the symbol
is that of the program.

PR fortran/28425
* trans-expr.c (gfc_trans_subcomponent_assign): Translate
derived type component expressions other than another derived
type constructor.

PR fortran/28496
* expr.c (find_array_section): Correct errors in
the handling of a missing start value for the
index triplet in an array reference.

PR fortran/18111
* trans-decl.c (gfc_build_dummy_array_decl): Before resetting
reference to backend_decl, set it DECL_ARTIFICIAL.
(gfc_get_symbol_decl): Likewise for original dummy decl, when
a copy is made of an array.
(create_function_arglist): Likewise for the _entry paramter
in entry_masters.
(build_entry_thunks): Likewise for dummies in entry thunks.

PR fortran/28600
* trans-decl.c (gfc_get_symbol_decl): Ensure that the
DECL_CONTEXT of the length of a character dummy is the
same as that of the symbol declaration.

PR fortran/28771
* decl.c (add_init_expr_to_sym): Remove setting of charlen for
an initializer of an assumed charlen variable.

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-20 Paul Thomas [EMAIL PROTECTED]

PR fortran/28630
* gfortran.dg/used_types_2.f90: New test.

PR fortran/28601
* gfortran.dg/used_types_3.f90: New test.

PR fortran/20886
* gfortran.dg/generic_actual_arg.f90: New test.

PR fortran/28735
* gfortran.dg/module_private_array_refs_1.f90: New test.

PR fortran/28762
* gfortran.dg/program_name_1.f90: New test.

PR fortran/28425
* gfortran.dg/derived_constructor_comps_1.f90: New test.

PR fortran/28496
* gfortran.dg/array_initializer_2.f90: New test.

PR fortran/18111
* gfortran.dg/unused_artificial_dummies_1.f90: New test. 

PR fortran/28600
* gfortran.dg/assumed_charlen_function_4.f90: New test.

PR fortran/28771
* gfortran.dg/assumed_charlen_in_main.f90: New test.

PR fortran/28660
* gfortran.dg/dependent_decls_1.f90: New test.

Added:
trunk/gcc/testsuite/gfortran.dg/array_initializer_2.f90
trunk/gcc/testsuite/gfortran.dg/assumed_charlen_function_4.f90
trunk/gcc/testsuite/gfortran.dg/assumed_charlen_in_main.f90
trunk/gcc/testsuite/gfortran.dg/dependent_decls_1.f90
trunk/gcc/testsuite/gfortran.dg/derived_constructor_comps_1.f90
trunk/gcc/testsuite/gfortran.dg/generic_actual_arg.f90
trunk/gcc/testsuite/gfortran.dg/module_private_array_refs_1.f90
trunk/gcc/testsuite/gfortran.dg/program_name_1.f90
trunk/gcc/testsuite/gfortran.dg/unused_artificial_dummies_1.f90
trunk/gcc/testsuite/gfortran.dg/used_types_2.f90
trunk/gcc/testsuite/gfortran.dg/used_types_3.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/decl.c
trunk/gcc/fortran/expr.c
trunk/gcc/fortran/gfortran.h

[Bug fortran/28660] Spurious warning: 'ubound.6' is used uninitialized in this function

2006-08-11 Thread paul dot richard dot thomas at cea dot fr


--- Comment #5 from paul dot richard dot thomas at cea dot fr  2006-08-11 
08:06 ---
Try this one!  No matter what you rename 'r' as, the order of execution is
wrong.

program runoptf90

implicit none
real :: x(10)

call simulated_annealing (x)

contains

subroutine simulated_annealing (zzxmin)
real, intent(inout) :: zzxmin(:)
character(LEN = 5+size(zzxmin)) :: x
real :: r(len(x)-2)

zzxmin = r
print *, here, len(x), size(r)
end subroutine simulated_annealing

end program runoptf90


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28660



[Bug fortran/28660] Spurious warning: 'ubound.6' is used uninitialized in this function

2006-08-11 Thread paul dot richard dot thomas at cea dot fr


--- Comment #6 from paul dot richard dot thomas at cea dot fr  2006-08-11 
14:08 ---
Created an attachment (id=12066)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12066action=view)
Prototype fix

The attached runs the testcase below correctly and regtests, except for 
gfortran.fortran-torture/execute/entry_5.f90, on Cygwin_NT/PIV.

I have not had enough time to really check with it is necessary and sufficient,
to fix this one regression nor have I had time to track down the cause of an
irritating but apparently harmless wrinkle - the declaration char z[1:.z]
appears twice; the first time with an incorrect .z and the second with the
correct value for .z.  Fortunately, it is the second declaration that is seen
in the scope of the executable code.

As of tomorrow, I am back on the road again until the end of next week.  If you
want to run with this, please do.  Otherwise, I will complete the job upon my
return.

All the best

Paul

PS I have made some progress on allocatable component derived type
constructors.

PPS This works with the patch:

program runoptf90
implicit none
real :: x(10)
call simulated_annealing1 (x)
call simulated_annealing2 (x)
call simulated_annealing3 (x)
contains
subroutine simulated_annealing1 (xmin)
real, intent(inout) :: xmin(:)
real :: x(size(xmin)+1)
real :: r(size(x)-2)
xmin = r
print *, #1 , size(r), size(x)
end subroutine simulated_annealing1
subroutine simulated_annealing2 (xmin)
real, intent(inout) :: xmin(:)
real :: x(size(xmin)+3)
real :: zr(size(x)-6)
xmin = zr
print *, #2 , size(zr), size(x)
end subroutine simulated_annealing2
subroutine simulated_annealing3 (xmin)
real, intent(inout) :: xmin(:)
character(size(x)+2) :: y ! host associated x
character(len(y)+3) :: z
real :: r(len(z)-10)
xmin = r
print *, #3 , size(r), len(z)
end subroutine simulated_annealing3
end program runoptf90


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28660



[Bug fortran/28660] Spurious warning: 'ubound.6' is used uninitialized in this function

2006-08-11 Thread pault at gcc dot gnu dot org


--- Comment #7 from pault at gcc dot gnu dot org  2006-08-11 17:17 ---
 The attached runs the testcase below correctly and regtests, except for 
 gfortran.fortran-torture/execute/entry_5.f90, on Cygwin_NT/PIV.

I have tracked down the cause of this - it's just building tonto-2.3 at
present, having regtested fine.

 I have not had enough time to really check with it is necessary and 
 sufficient,
 to fix this one regression nor have I had time to track down the cause of an
 irritating but apparently harmless wrinkle - the declaration char z[1:.z]
 appears twice; the first time with an incorrect .z and the second with the
 correct value for .z.  Fortunately, it is the second declaration that is seen
 in the scope of the executable code.

I'll try to look at this tonight and then I turn into a pumpkin for a few days.

I have upgraded this to major, since I consider the correct treatment of
variable declarations to be absolutely critical.  As you said, Erik, Ah, that
explains the crazy results I'm getting from my program!

Paul


-- 

pault at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
   |dot org |
   Severity|normal  |major
 Status|NEW |ASSIGNED
   Last reconfirmed|2006-08-09 10:20:36 |2006-08-11 17:17:17
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28660



[Bug fortran/28660] Spurious warning: 'ubound.6' is used uninitialized in this function

2006-08-11 Thread patchapp at dberlin dot org


--- Comment #8 from patchapp at dberlin dot org  2006-08-11 19:55 ---
Subject: Bug number PR28660

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-08/msg00378.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28660



[Bug fortran/28660] Spurious warning: 'ubound.6' is used uninitialized in this function

2006-08-09 Thread pinskia at gcc dot gnu dot org


--- Comment #1 from pinskia at gcc dot gnu dot org  2006-08-09 10:20 ---
Actually this is worse than what is said here, this is wrong code.  In a
prerelease of 4.1.0, we allocate r after we allocate x so the size of x is not
know at the time we allocate r.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

   Severity|minor   |normal
 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Keywords|diagnostic  |wrong-code
   Last reconfirmed|-00-00 00:00:00 |2006-08-09 10:20:36
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28660



[Bug fortran/28660] Spurious warning: 'ubound.6' is used uninitialized in this function

2006-08-09 Thread erik dot edelmann at iki dot fi


--- Comment #2 from erik dot edelmann at iki dot fi  2006-08-09 10:54 
---
(In reply to comment #1)
 Actually this is worse than what is said here, this is wrong code.  In a
 prerelease of 4.1.0, we allocate r after we allocate x so the size of x is not
 know at the time we allocate r.

Ah, that explains the cray results I'm getting from my program!


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28660



[Bug fortran/28660] Spurious warning: 'ubound.6' is used uninitialized in this function

2006-08-09 Thread pault at gcc dot gnu dot org


--- Comment #3 from pault at gcc dot gnu dot org  2006-08-09 17:47 ---
uuuhhh!  This is horrible and is a reflection of the symtree being ordered as a
binary tree.  If 'r' is renamed 'zr', the order of translation is changed and
the  code runs correctly; albeit still with an unrequited ubound.

I think that we are going to have to make use of the sym-declared_at to try to
order the declarations or something.

Paul


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28660



[Bug fortran/28660] Spurious warning: 'ubound.6' is used uninitialized in this function

2006-08-09 Thread pault at gcc dot gnu dot org


--- Comment #4 from pault at gcc dot gnu dot org  2006-08-10 04:29 ---
(In reply to comment #3)

 order the declarations or something.
 
 Paul
 
Having slept on it, I realise that this will not work because the statement
order should not matter.  I think that there will have to be a final resolution
stage to resolve the sym_root symbol tree; assigning each symbol a number,
corresponding to it's position in a chain of dependences.  Then,
trans-decl.c(generate_local_vars) will have to be called within a loop over
depency level.

I am not sure that I have time to do this right now but I will think some more
about it.

Paul


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28660