array->data and ret->data are not divisible by four in this test case, yet we use ints for copying.
Not too bad on a i686, very bad on systems that enforce alignment. $ cat cshift-char.f90 program main character(len=2) :: c2 character(len=4), dimension(2,2) :: a, b, c, d ! Force misalignment of a or b common /foo/ a, c, c2, b, d a = 'aa' b = 'bb' d = cshift(b,1) c = cshift(a,1) end program main $ gfortran -g cshift-char.f90 $ gdb ./a.out GNU gdb 6.8-debian Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i486-linux-gnu"... (gdb) b _gfortran_cshift0_4_char Function "_gfortran_cshift0_4_char" not defined. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 1 (_gfortran_cshift0_4_char) pending. (gdb) r Starting program: /home/ig25/Krempel/Char/a.out Breakpoint 1, *_gfortran_cshift0_4_char (ret=0xbfc41720, ret_length=4, array=0xbfc41744, pshift=0x8048904, pdim=0x0, array_length=4) at ../../../../gcc/trunk/libgfortran/intrinsics/cshift0.c:364 364 DEFINE_CSHIFT (4); (gdb) p ret->data $1 = 0x8049ad2 "" (gdb) p array->data $2 = 0x8049ac2 "bb bb bb bb " (gdb) -- Summary: misaligment for cshift of character Product: gcc Version: 4.4.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: libfortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tkoenig at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36886