This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/31320] New: Illegal read with gfortran.dg/alloc_comp_assign_2.f90 and *_3.f90


gfortran -g gfortran.dg/alloc_comp_assign_2.f90
valgrind ./a.out

==30049== Invalid read of size 1
==30049==    at 0x4C24854: memcpy (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==30049==    by 0x401682: MAIN__ (in
/projects/tob/gcc/gcc/testsuite/gfortran.dg/a.out)
==30049==    by 0x405FAB: main (fmain.c:22)
==30049==  Address 0x404D64B is 3 bytes after a block of size 16 alloc'd
==30049==    at 0x4C22C56: malloc (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==30049==    by 0x4E3DD78: _gfortrani_get_mem (memory.c:53)
==30049==    by 0x400A5C: MAIN__ (in
/projects/tob/gcc/gcc/testsuite/gfortran.dg/a.out)
==30049==    by 0x405FAB: main (fmain.c:22)

I checked the example itself with g95 and NAG f95 and both fail at the second,
third and fourth "call abort()" whereas ifort has a segv.
Is this example (PR 20541) really valid?

A check with NAG f95, g95 and ifort with valgrind shows no problem for NAG f95,
and invalid reads for g95 and ifort.

For alloc_comp_assign_3.f90: Compiles with g95, ifort and NAG f95 and gives no
"call abort()", however, gfortran has:

==30454== Invalid read of size 1
==30454==    at 0x4C24854: memcpy (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==30454==    by 0x401223: MAIN__ (alloc_comp_assign_3.f90:22)
==30454==    by 0x40444B: main (fmain.c:22)
==30454==  Address 0x404D64B is 3 bytes after a block of size 16 alloc'd
==30454==    at 0x4C22C56: malloc (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==30454==    by 0x4E3DD78: _gfortrani_get_mem (memory.c:53)
==30454==    by 0x400A5C: MAIN__ (alloc_comp_assign_3.f90:19)
==30454==    by 0x40444B: main (fmain.c:22)

For alloc_comp_initializer_1.f90 the same.


-- 
           Summary: Illegal read with gfortran.dg/alloc_comp_assign_2.f90
                    and *_3.f90
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]