aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2008-08-14 18:31:32 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2008-08-14 18:31:32 +0000
commitc2b00cdcaaef76f88c770351803dcb7040338d58 (patch)
tree85eb8b641f01c373a1ab8b4253e57f255f52349f /gcc
parent6eefb96d4696ef15f07639bb232c1d3acfb20ea9 (diff)
downloadgcc-c2b00cdcaaef76f88c770351803dcb7040338d58.zip
gcc-c2b00cdcaaef76f88c770351803dcb7040338d58.tar.gz
gcc-c2b00cdcaaef76f88c770351803dcb7040338d58.tar.bz2
re PR libfortran/36886 (misaligment for cshift of character)
2008-08-14 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/36886 * Makefile.am: Added $(i_cshift0_c). Added $(i_cshift0_c) to gfor_built_specific_src. Add rule to build from cshift0.m4. * Makefile.in: Regenerated. * libgfortran.h: Addedd prototypes for cshift0_i1, cshift0_i2, cshift0_i4, cshift0_i8, cshift0_i16, cshift0_r4, cshift0_r8, cshift0_r10, cshift0_r16, cshift0_c4, cshift0_c8, cshift0_c10, cshift0_c16. Define Macros GFC_UNALIGNED_C4 and GFC_UNALIGNED_C8. * intrinsics/cshift0.c: Remove helper functions for the innter shift loop. (cshift0): Call specific functions depending on type of array argument. Only call specific functions for correct alignment for other types. * m4/cshift0.m4: New file. * generated/cshift0_i1.c: New file. * generated/cshift0_i2.c: New file. * generated/cshift0_i4.c: New file. * generated/cshift0_i8:.c New file. * generated/cshift0_i16.c: New file. * generated/cshift0_r4.c: New file. * generated/cshift0_r8.c: New file. * generated/cshift0_r10.c: New file. * generated/cshift0_r16.c: New file. * generated/cshift0_c4.c: New file. * generated/cshift0_c8.c: New file. * generated/cshift0_c10.c: New file. * generated/cshift0_c16.c: New file. 2008-08-14 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/36886 * gfortran.dg/cshift_char_3.f90: New test case. * gfortran.dg/cshift_nan_1.f90: New test case. From-SVN: r139111
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gfortran.dg/char_cshift_3.f9013
-rw-r--r--gcc/testsuite/gfortran.dg/cshift_nan_1.f9024
3 files changed, 43 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f738628..1947b43 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2008-08-14 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR libfortran/36886
+ * gfortran.dg/cshift_char_3.f90: New test case.
+ * gfortran.dg/cshift_nan_1.f90: New test case.
+
2008-08-14 Rafael Avila de Espindola <espindola@google.com>
* gcc.dg/visibility-14.c: New test.
diff --git a/gcc/testsuite/gfortran.dg/char_cshift_3.f90 b/gcc/testsuite/gfortran.dg/char_cshift_3.f90
new file mode 100644
index 0000000..80c0ede
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/char_cshift_3.f90
@@ -0,0 +1,13 @@
+! { dg-do run }
+! PR 36886 - misalignment of characters for cshift could cause
+! problems on some architectures.
+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
diff --git a/gcc/testsuite/gfortran.dg/cshift_nan_1.f90 b/gcc/testsuite/gfortran.dg/cshift_nan_1.f90
new file mode 100644
index 0000000..896ecb3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/cshift_nan_1.f90
@@ -0,0 +1,24 @@
+! { dg-do run }
+! Test cshift where the values are eight bytes,
+! but are aligned on a four-byte boundary. The
+! integers correspond to NaN values.
+program main
+ implicit none
+ integer :: i
+ type t
+ sequence
+ integer :: a,b
+ end type t
+ type(t), dimension(4) :: u,v
+ common /foo/ u, i, v
+
+ u(1)%a = 2142240768
+ u(2)%a = 2144337920
+ u(3)%a = -5242880
+ u(4)%a = -3145728
+ u%b = (/(i,i=-1,-4,-1)/)
+ v(1:3:2) = cshift(u(1:3:2),1)
+ v(2:4:2) = cshift(u(2:4:2),-1)
+ if (any(v%a /= (/-5242880, -3145728, 2142240768, 2144337920 /))) call abort
+ if (any(v%b /= (/-3, -4, -1, -2/))) call abort
+end program main