Skip to content

Wrong result from MOVE_ALLOC with character variables #721

@nncarlson

Description

@nncarlson

The MOVE_ALLOC call in this example does not define the value of the result variable B correctly. The example exits on the 'STOP 2' statement. If you print out LEN(B), it is some random integer value that changes from one execution to the next. I'm using the March 2019 binary release.

character(:), allocatable :: a, b
a = 'foo'
call move_alloc(a, b)
if (.not.allocated(b)) stop 1
if (len(b) /= 3) stop 2
if (b /= 'foo') stop 3
end

Here's the output from valgrind:

==19820== Command: ./a.out
==19820== 
==19820== Conditional jump or move depends on uninitialised value(s)
==19820==    at 0x50C03C7: f90_set_type_i8 (in /opt/flang/20190329/lib/libflang.so)
==19820==    by 0x50ADAA9: f90_move_alloc_i8 (in /opt/flang/20190329/lib/libflang.so)
==19820==    by 0x400D1F: MAIN_ (flang-20190511b.f90:3)
==19820==    by 0x400944: main (in /home/nnc/Fortran/fortran-compiler-tests/flang-bugs/a.out)
==19820==  Uninitialised value was created by a stack allocation
==19820==    at 0x400A7B: MAIN_ (flang-20190511b.f90:1)
==19820== 
==19820== Conditional jump or move depends on uninitialised value(s)
==19820==    at 0x50C03D7: f90_set_type_i8 (in /opt/flang/20190329/lib/libflang.so)
==19820==    by 0x50ADAA9: f90_move_alloc_i8 (in /opt/flang/20190329/lib/libflang.so)
==19820==    by 0x400D1F: MAIN_ (flang-20190511b.f90:3)
==19820==    by 0x400944: main (in /home/nnc/Fortran/fortran-compiler-tests/flang-bugs/a.out)
==19820==  Uninitialised value was created by a stack allocation
==19820==    at 0x400A7B: MAIN_ (flang-20190511b.f90:1)
==19820== 
==19820== Conditional jump or move depends on uninitialised value(s)
==19820==    at 0x400D72: MAIN_ (flang-20190511b.f90:5)
==19820==    by 0x400944: main (in /home/nnc/Fortran/fortran-compiler-tests/flang-bugs/a.out)
==19820==  Uninitialised value was created by a stack allocation
==19820==    at 0x400A60: MAIN_ (flang-20190511b.f90:1)
==19820== 

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugnvidiaverifyThis issue appears to be resolved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions