diff options
author | kargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-02-28 01:28:09 +0000 |
---|---|---|
committer | kargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-02-28 01:28:09 +0000 |
commit | 157b105a41fef233d04b4519b29cd90121d17362 (patch) | |
tree | 90720e5d5ddaff6a4bd55911c16d7b987b76a332 | |
parent | 44535114620c0f959f1b47db7c783b03e22bce62 (diff) | |
download | gcc-157b105a41fef233d04b4519b29cd90121d17362.tar.gz |
* gfortran.dg/boz_1.f90: New test.
* gfortran.dg/boz_3.f90: New test.
* gfortran.dg/boz_4.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95646 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/boz_1.f90 | 38 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/boz_3.f90 | 34 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/boz_4.f90 | 29 |
4 files changed, 107 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3cab286530c..9e5b5f00c47 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2005-02-27 Steven G. Kargl <kargl@gcc.gnu.org> + * gfortran.dg/boz_1.f90: New test. + * gfortran.dg/boz_3.f90: New test. + * gfortran.dg/boz_4.f90: New test. + +2005-02-27 Steven G. Kargl <kargl@gcc.gnu.org> + * gfortran.dg/ishft.f90: Remove kind suffix from BOZ constant * gfortran.fortran-torture/execute/intrinsic_mvbits.f90: ditto diff --git a/gcc/testsuite/gfortran.dg/boz_1.f90 b/gcc/testsuite/gfortran.dg/boz_1.f90 new file mode 100644 index 00000000000..abf02d36043 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/boz_1.f90 @@ -0,0 +1,38 @@ +! { dg-do run } +! Test the boz handling +program boz + + implicit none + + integer(1), parameter :: b1 = b'00000001' + integer(2), parameter :: b2 = b'0101010110101010' + integer(4), parameter :: b4 = b'01110000111100001111000011110000' + integer(8), parameter :: & + & b8 = b'0111000011110000111100001111000011110000111100001111000011110000' + + integer(1), parameter :: o1 = o'12' + integer(2), parameter :: o2 = o'4321' + integer(4), parameter :: o4 = o'43210765' + integer(8), parameter :: o8 = o'1234567076543210' + + integer(1), parameter :: z1 = z'a' + integer(2), parameter :: z2 = z'ab' + integer(4), parameter :: z4 = z'dead' + integer(8), parameter :: z8 = z'deadbeef' + + if (z1 /= 10_1) call abort + if (z2 /= 171_2) call abort + if (z4 /= 57005_4) call abort + if (z8 /= 3735928559_8) call abort + + if (b1 /= 1_1) call abort + if (b2 /= 21930_2) call abort + if (b4 /= 1894838512_4) call abort + if (b8 /= 8138269444283625712_8) call abort + + if (o1 /= 10_1) call abort + if (o2 /= 2257_2) call abort + if (o4 /= 9245173_4) call abort + if (o8 /= 45954958542472_8) call abort + +end program boz diff --git a/gcc/testsuite/gfortran.dg/boz_3.f90 b/gcc/testsuite/gfortran.dg/boz_3.f90 new file mode 100644 index 00000000000..96184deb7df --- /dev/null +++ b/gcc/testsuite/gfortran.dg/boz_3.f90 @@ -0,0 +1,34 @@ +! { dg-do run } +! Test that the BOZ constant on the RHS, which are of different KIND than +! the LHS, are correctly converted. +! +program boz + + implicit none + + integer(1), parameter :: b1 = b'000000000001111' + integer(2), parameter :: b2 = b'00000000000000000111000011110000' + integer(4), parameter :: & + & b4 = b'0000000000000000000000000000000001110000111100001111000011110000' + + integer(1), parameter :: o1 = o'0012' + integer(2), parameter :: o2 = o'0004321' + integer(4), parameter :: o4 = o'0000000043210765' + + integer(1), parameter :: z1 = z'0a' + integer(2), parameter :: z2 = z'00ab' + integer(4), parameter :: z4 = z'0000dead' + + if (b1 /= 15_1) call abort + if (b2 /= 28912_2) call abort + if (b4 /= 1894838512_4) call abort + + if (o1 /= 10_1) call abort + if (o2 /= 2257_2) call abort + if (o4 /= 9245173_4) call abort + + if (z1 /= 10_1) call abort + if (z2 /= 171_2) call abort + if (z4 /= 57005_4) call abort + +end program boz diff --git a/gcc/testsuite/gfortran.dg/boz_4.f90 b/gcc/testsuite/gfortran.dg/boz_4.f90 new file mode 100644 index 00000000000..d016df22c49 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/boz_4.f90 @@ -0,0 +1,29 @@ +! { dg-do compile } +! Test that the conversion of a BOZ constant that is too large for the +! integer variable is caught by the compiler. +program boz + + implicit none + + integer(1), parameter :: & + & b1 = b'0101010110101010' ! { dg-error "overflow converting" } + integer(2), parameter :: & + & b2 = b'01110000111100001111000011110000' ! { dg-error "overflow converting" } + integer(4), parameter :: & + & b4 = b'0111000011110000111100001111000011110000111100001111000011110000' ! { dg-error "overflow converting" } + + integer(1), parameter :: & + & o1 = o'1234567076543210' ! { dg-error "overflow converting" } + integer(2), parameter :: & + & o2 = o'1234567076543210' ! { dg-error "overflow converting" } + integer(4), parameter :: & + & o4 = o'1234567076543210' ! { dg-error "overflow converting" } + + integer(1), parameter :: & + & z1 = z'deadbeef' ! { dg-error "overflow converting" } + integer(2), parameter :: & + & z2 = z'deadbeef' ! { dg-error "overflow converting" } + integer(4), parameter :: & + & z4 = z'deadbeeffeed' ! { dg-error "overflow converting" } + +end program boz |