[Bug fortran/60739] New: Maybe uninitialized with deferred length character
vladimir.fuka at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Apr 2 09:04:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60739
Bug ID: 60739
Summary: Maybe uninitialized with deferred length character
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: vladimir.fuka at gmail dot com
subroutine sub(str)
character(*) :: str
character(:), allocatable :: tmp
tmp = str
print *,allocated(tmp)
end
gfortran-4.9 uninit.f90 -c -Wall
uninit.f90: In function ‘sub’:
uninit.f90:5:0: warning: ‘.tmp’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
tmp = str
^
-fdump-tree-original:
character(kind=1)[1:.tmp] * tmp;
integer(kind=4) .tmp;
bitsizetype D.2326;
sizetype D.2327;
try
{
D.2326 = (bitsizetype) (sizetype) NON_LVALUE_EXPR <_str> * 8;
D.2327 = (sizetype) NON_LVALUE_EXPR <_str>;
tmp = 0B;
{
integer(kind=4) D.2321;
integer(kind=4) D.2320;
integer(kind=4) D.2319;
D.2319 = _str;
if (tmp != 0B) goto L.1;
tmp = (character(kind=1)[1:.tmp] *) __builtin_malloc (MAX_EXPR
<(sizetype) _str, 1>);
goto L.2;
L.1:;
if (.tmp == _str) goto L.2;
tmp = (character(kind=1)[1:.tmp] *) __builtin_realloc ((void *) tmp,
MAX_EXPR <(sizetype) _str, 1>);
L.2:;
.tmp = _str;
D.2320 = _str;
D.2321 = .tmp;
if (D.2321 != 0)
{
if ((unsigned long) D.2320 >= (unsigned long) D.2321)
{
__builtin_memmove ((void *) tmp, (void *) str, (unsigned long)
D.2321);
}
else
{
__builtin_memmove ((void *) tmp, (void *) str, (unsigned long)
D.2320);
__builtin_memset ((void *) tmp + (sizetype) D.2320, 32,
(unsigned long) D.2321 - (unsigned long) D.2320);
}
}
}
...
More information about the Gcc-bugs
mailing list