[Bug c/49617] New: gcc misses uninititialized variables in contained functions
pault at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Jul 3 10:06:00 GMT 2011
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
More information about the Gcc-bugs
mailing list