[Bug fortran/87689] New: Memory corruption on Power 8

judicael.grasset at stfc dot ac.uk gcc-bugzilla@gcc.gnu.org
Mon Oct 22 13:29:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87689

            Bug ID: 87689
           Summary: Memory corruption on Power 8
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: judicael.grasset at stfc dot ac.uk
  Target Milestone: ---

Hello,

I am compiling this code with gfortran 7.1.0 on a power 8 machine:
main.f:
      program main
        implicit none
        character :: c
        character(len=20) :: res, doesntwork_p8
        external doesntwork_p8
        c = 'o'
        res = doesntwork_p8(c,1,2,3,4,5,6)
        write(*,*)res
      end program main

doesnwork_p8.f:
      function doesntwork_p8(c,a1,a2,a3,a4,a5,a6)
        implicit none
        character(len=20) :: doesntwork_p8
        character :: c
        integer :: a1,a2,a3,a4,a5,a6
        write(*,*)a1,a2,a3,a4,a5,a6
        write(*,*)c
        doesntwork_p8 = 'foo'
        return
      end

And when I run it, it prints:
           1           2           3           4           5           0
 �
 foo  

But I expect:
           1           2           3           4           5           6
 o
 foo  

Also if compiled with fcheck=all, a runtime message say:
At line 1 of file doesntwork_p8.f
Fortran runtime error: Actual string length is shorter than the declared one
for dummy argument 'c' (0/1)

gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/gpfs/paragon/local/apps/gcc/gcc/7.1.0/bin/../libexec/gcc/powerpc64le-unknown-linux-gnu/7.1.0/lto-wrapper
Target: powerpc64le-unknown-linux-gnu
Configured with: ./configure --prefix=/gpfs/panther/local/apps/gcc/gcc/7.1.0
--enable-languages=c,c++,fortran --disable-multilib --disable-bootstrap
--with-system-zlib --enable-__cxa_atexit --disable-nls --disable-linux-futex
Thread model: posix
gcc version 7.1.0 (GCC)


More information about the Gcc-bugs mailing list