This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/49617] New: gcc misses uninititialized variables in contained functions
- From: "pault at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 3 Jul 2011 10:06:00 +0000
- Subject: [Bug c/49617] New: gcc misses uninititialized variables in contained functions
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49617
Summary: gcc misses uninititialized variables in contained
functions
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: pault@gcc.gnu.org
This was reported to the gfortran list by Bill Paxton:
gfortran test_uninit.f -O2 -Wall -o test; ./test
module test_mod
implicit none
contains
subroutine test
integer :: x, y
call t
write(*,*) 'y', y
contains
subroutine t
y = x * 5
end subroutine t
end subroutine test
end module test_mod
program test_uninit
use test_mod
implicit none
call test
end program test_uninit
No warning is given that 'x' is used uninitialized in subroutine 't'.
The uninitialized checking is done in tree-ssa.c and tree-ssa-uninit.c, so this
should be attributed to gcc.
Tobias Burnus produced this (using gcc extension) testcase in C
int
main (void)
{
int y;
int func(void)
{
int x;
/*int z;*/
x = y;
/* x = z;*/
return x;
}
return func();
}
This also fails to report on the state of y, when used in 'func'.
I understand that fixing this will not be straightforward but have submitted it
for the record at least.
Paul