From 92ea8e1bccc6a703407570471f6323bfa554af99 Mon Sep 17 00:00:00 2001 From: Jozef Lawrynowicz Date: Tue, 19 May 2020 12:46:17 +0100 Subject: [PATCH] TESTSUITE: Fix tests for 16-bit targets gcc/ChangeLog: 2020-05-19 Jozef Lawrynowicz * doc/sourcebuild.texi: Document new short_eq_int, ptr_eq_short, msp430_small, msp430_large and size24plus DejaGNU effective targets. Improve grammar in descriptions for size20plus and size32plus effective targets. gcc/testsuite/ChangeLog: 2020-05-19 Jozef Lawrynowicz * c-c++-common/builtin-has-attribute-7.c: Require size24plus. * c-c++-common/cpp/pr63831-1.c: Store result in _has_cpp_attribute in a long. * c-c++-common/pr81376.c: Skip scan-tree-dump for short_eq_int. Extend test for short_eq_int. * g++.dg/abi/scoped1.C: Skip dg-warning tests for short_eq_int. * g++.dg/cpp0x/constexpr-70001-1.C: Require size24plus. * g++.dg/cpp0x/constexpr-bitfield3.C: Require int32plus. * g++.dg/cpp0x/enum13.C: Skip dg-warning for short_eq_int. * g++.dg/cpp0x/initlist5.C: Add dg-error for short_eq_int. * g++.dg/cpp0x/initlist7.C: Add dg-warning for !int32plus. * g++.dg/cpp0x/nullptr04.C: Skip dg-error for ptr_eq_short. * g++.dg/cpp0x/variadic-value1.C: Add typedef for int32_t. * g++.dg/cpp1y/constexpr-arith-overflow.C: Fix test for sizeof(int) == sizeof(short). * g++.dg/cpp1y/digit-sep-neg.C: Add typedef for int32_t. * g++.dg/cpp1y/pr57644.C: Add typedef for uint32_t. * g++.dg/cpp1y/pr77321.C: Require size24plus. * g++.dg/cpp1y/var-templ4.C: Add typedef for int32_t. * g++.dg/cpp1z/direct-enum-init1.C: Skip dg-error for short_eq_int. * g++.dg/delayedfold/fwrapv1.C: Skip for int16. * g++.dg/expr/bitfield9.C: Add typedef for int32_t. * g++.dg/ext/attribute-test-1.C: Add typedef for uint32_t. * g++.dg/ext/bitfield1.C: Add typedef for int32_t. * g++.dg/ext/flexary13.C: Add typedef for int32_t. * g++.dg/ext/utf-cvt.C: Adjust dg-warning for int16. * g++.dg/ext/vector28.C: Add typedef for int32_t. * g++.dg/ext/vla15.C: Add typedef for int32_t. * g++.dg/init/array11.C: Require size32plus. * g++.dg/init/array15.C: Require size24plus. * g++.dg/init/array4.C: Require size20plus. * g++.dg/init/const7.C: Skip dg-message for ptr_eq_short. * g++.dg/init/new38.C: Relax regex in dg-error. * g++.dg/init/new44.C: Skip dg-error for msp430_small. Adjust test for 16-bit size_t. Add special case for msp430 -mlarge. * g++.dg/init/value9.C: Add typedef for int32_t. * g++.dg/ipa/pr77333.C: Add typedef for int32_t. * g++.dg/lto/20080908-1_0.C: Add typedef for int32_t. * g++.dg/opt/pr55717.C: Add typedef for uint32_t. * g++.dg/opt/pr60597.C: Add typedef for int32_t. * g++.dg/opt/pr81715.C: Require size20plus. * g++.dg/opt/reload3.C: Add typedef for uint32_t. * g++.dg/opt/temp2.C: Require size20plus. * g++.dg/opt/thunk1.C: Likewise. * g++.dg/other/error23.C: Dont assume __SIZEOF_INT__ == 4. * g++.dg/other/pr31078.C: Adjust typedef for 32-bit int. * g++.dg/parse/concat1.C: Skip dg-error for size20plus. * g++.dg/parse/defarg5.C: Add typedef for int32_t and uint32_t. * g++.dg/pr48484.C: Add typedef for int32_t. * g++.dg/pr53037-2.C: Likewise. * g++.dg/pr53037-3.C: Likewise. * g++.dg/pr66655.C: Use int32_t. * g++.dg/pr66655.h: Add typedef for int32_t. * g++.dg/pr66655_1.cc: Use int32_t. * g++.dg/pr67351.C: Define 32-bit uint. * g++.dg/template/array30.C: Add typedef for int32_t. * g++.dg/template/constant1.C: Extend test for 8-bit and 16-bit int. * g++.dg/template/constant2.C: Likewise. * g++.dg/template/friend18.C: Add typedef for int32_t. * g++.dg/template/pr68978.C: Likewise. * g++.dg/torture/pr37421.C: Require int_eq_float. * g++.dg/torture/pr88861.C: Handle 16-bit int. * g++.dg/tree-ssa/pr19807.C: Likewise. * g++.dg/tree-ssa/pr27291.C: Fix typedef for uint32_t. * g++.dg/tree-ssa/pr49516.C: Fix typedefs for int{16,32}_t and uint{32,64}_t. * g++.dg/warn/Wconversion-integer.C: Add typedefs for {u,}int32_t. * g++.dg/warn/Wconversion-null-2.C: Adjust g() declaration. * g++.dg/warn/Wconversion-null.C: Likewise. * g++.dg/warn/Wconversion3.C: Skip dg-warning for short_eq_int. * g++.dg/warn/Wduplicated-branches1.C: Add dg-warning for short_eq_int. * g++.dg/warn/Wplacement-new-size-5.C: Add typedef for int32_t. * g++.dg/warn/Wplacement-new-size.C: Likewise. * g++.dg/warn/Wstrict-aliasing-5.C: Add typedef for uint32_t. * g++.dg/warn/Wstrict-aliasing-bogus-signed-unsigned.C: Add typedef for {u,}int32_t. * g++.dg/warn/Wtype-limits-Wextra.C: Adjust dg-warning for short_eq_int. * g++.dg/warn/Wtype-limits.C: Likewise. * g++.old-deja/g++.brendan/enum11.C: Add typedef for uint32_t. * g++.old-deja/g++.bugs/900227_01.C: Skip dg-error for ptr_eq_short. * g++.old-deja/g++.mike/ns15.C: Require size20plus. * g++.old-deja/g++.other/exprstmt1.C: Add typedef for uint32_t. * g++.old-deja/g++.other/inline12.C: Adjust udword typedef. * g++.old-deja/g++.other/new6.C: Add typedef for int32_t. * g++.old-deja/g++.pt/crash16.C: Skip for int16. * g++.old-deja/g++.robertl/eb76.C: Likewise. * g++.old-deja/g++.warn/flow1.C: Add typedef for int32_t. * gcc.dg/Walloca-14.c: Adjust -Walloca-larger-than= parameter for !ptr32plus. * gcc.dg/Warray-bounds-32.c: Adjust dg-warning for size20plus. * gcc.dg/Wbuiltin-declaration-mismatch-4.c: Adjust dg-warning for short_eq_int. Handle case where ptrdiff_t/size_t is __int20. * gcc.dg/concat2.c: Skip dg-error for size20plus. * gcc.dg/fold-convmaxconv-1.c: Add typedef for {u,}int32_t. * gcc.dg/fold-convminconv-1.c: Likewise. * gcc.dg/graphite/scop-4.c: Require size20plus. * gcc.dg/loop-versioning-1.c: Adjust test for small size_t. * gcc.dg/loop-versioning-2.c: Require size20plus. * gcc.dg/lto/20081210-1_0.c: Adjust typedef for uintptr_t. * gcc.dg/lto/pr85870_0.c: Add typedef for uint32_t. * gcc.dg/lto/pr85870_1.c: Likewise. * gcc.dg/pr36227.c: Adjust typedef for ptrcast. * gcc.dg/pr42611.c: First check for size_t equality with void * before trying other types. * gcc.dg/pr59963-2.c: Skip dg-warning for int16 instead of xfail. * gcc.dg/pr68317.c: Add typedef for int32_t. * gcc.dg/pr78973.c: Adjust dg-warning for int16. * gcc.dg/pr85859.c: Cast using __INTPTR_TYPE__ instead of long. * gcc.dg/pr86179.c: Add typedef for {u,}int32_t. * gcc.dg/torture/20181024-1.c: Require size32plus. * gcc.dg/torture/pr71598-2.c: Skip for short_eq_int. * gcc.dg/torture/pr86034.c: Add typedef for int32_t. * gcc.dg/tree-ssa/builtin-sprintf-warn-3.c: Adjust dg-warning for int16 and msp430 -mlarge. * gcc.dg/tree-ssa/integer-addr.c: Use __INTPTR_MAX__ for a large constant that is a valid address. * gcc.dg/tree-ssa/loop-interchange-10.c: Add typedef for int32_t. * gcc.dg/tree-ssa/pr84436-3.c: Adjust dg-final for int16. * gcc.dg/tree-ssa/pr84648.c: Add typedef for uint32_t. * gcc.dg/tree-ssa/scev-8.c: Cast to char if sizeof(int) == sizeof(short). * gcc.dg/tree-ssa/ssa-dom-thread-8.c: Adjust test for msp430 -mlarge. * lib/target-supports.exp (check_effective_target_size24plus): New. (check_effective_target_short_eq_int): New. (check_effective_target_ptr_eq_short): New. (check_effective_target_msp430_small): New. (check_effective_target_msp430_large): New. --- gcc/ChangeLog | 8 + gcc/doc/sourcebuild.texi | 24 +- gcc/testsuite/ChangeLog | 135 ++++++++++ .../c-c++-common/builtin-has-attribute-7.c | 3 +- gcc/testsuite/c-c++-common/cpp/pr63831-1.c | 2 +- gcc/testsuite/c-c++-common/pr81376.c | 9 +- gcc/testsuite/g++.dg/abi/scoped1.C | 20 +- .../g++.dg/cpp0x/constexpr-70001-1.C | 1 + .../g++.dg/cpp0x/constexpr-bitfield3.C | 1 + gcc/testsuite/g++.dg/cpp0x/enum13.C | 2 +- gcc/testsuite/g++.dg/cpp0x/initlist5.C | 2 +- gcc/testsuite/g++.dg/cpp0x/initlist7.C | 2 +- gcc/testsuite/g++.dg/cpp0x/nullptr04.C | 4 +- gcc/testsuite/g++.dg/cpp0x/variadic-value1.C | 6 +- .../g++.dg/cpp1y/constexpr-arith-overflow.C | 18 +- gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C | 10 +- gcc/testsuite/g++.dg/cpp1y/pr57644.C | 4 +- gcc/testsuite/g++.dg/cpp1y/pr77321.C | 1 + gcc/testsuite/g++.dg/cpp1y/var-templ4.C | 8 +- .../g++.dg/cpp1z/direct-enum-init1.C | 6 +- gcc/testsuite/g++.dg/delayedfold/fwrapv1.C | 1 + gcc/testsuite/g++.dg/expr/bitfield9.C | 4 +- gcc/testsuite/g++.dg/ext/attribute-test-1.C | 12 +- gcc/testsuite/g++.dg/ext/bitfield1.C | 6 +- gcc/testsuite/g++.dg/ext/flexary13.C | 10 +- gcc/testsuite/g++.dg/ext/utf-cvt.C | 16 +- gcc/testsuite/g++.dg/ext/vector28.C | 4 +- gcc/testsuite/g++.dg/ext/vla15.C | 4 +- gcc/testsuite/g++.dg/init/array11.C | 1 + gcc/testsuite/g++.dg/init/array15.C | 1 + gcc/testsuite/g++.dg/init/array4.C | 1 + gcc/testsuite/g++.dg/init/const7.C | 2 +- gcc/testsuite/g++.dg/init/new38.C | 2 +- gcc/testsuite/g++.dg/init/new44.C | 54 ++-- gcc/testsuite/g++.dg/init/value9.C | 4 +- gcc/testsuite/g++.dg/ipa/pr77333.C | 4 +- gcc/testsuite/g++.dg/lto/20080908-1_0.C | 21 +- gcc/testsuite/g++.dg/opt/pr55717.C | 4 +- gcc/testsuite/g++.dg/opt/pr60597.C | 30 ++- gcc/testsuite/g++.dg/opt/pr81715.C | 1 + gcc/testsuite/g++.dg/opt/reload3.C | 4 +- gcc/testsuite/g++.dg/opt/temp2.C | 1 + gcc/testsuite/g++.dg/opt/thunk1.C | 3 +- gcc/testsuite/g++.dg/other/error23.C | 2 +- gcc/testsuite/g++.dg/other/pr31078.C | 3 +- gcc/testsuite/g++.dg/parse/concat1.C | 2 +- gcc/testsuite/g++.dg/parse/defarg5.C | 7 +- gcc/testsuite/g++.dg/pr48484.C | 8 +- gcc/testsuite/g++.dg/pr53037-2.C | 12 +- gcc/testsuite/g++.dg/pr53037-3.C | 12 +- gcc/testsuite/g++.dg/pr66655.C | 4 +- gcc/testsuite/g++.dg/pr66655.h | 6 +- gcc/testsuite/g++.dg/pr66655_1.cc | 8 +- gcc/testsuite/g++.dg/pr67351.C | 2 +- gcc/testsuite/g++.dg/template/array30.C | 6 +- gcc/testsuite/g++.dg/template/constant1.C | 6 + gcc/testsuite/g++.dg/template/constant2.C | 6 + gcc/testsuite/g++.dg/template/friend18.C | 6 +- gcc/testsuite/g++.dg/template/pr68978.C | 24 +- gcc/testsuite/g++.dg/torture/pr37421.C | 1 + gcc/testsuite/g++.dg/torture/pr88861.C | 4 + gcc/testsuite/g++.dg/tree-ssa/pr19807.C | 2 +- gcc/testsuite/g++.dg/tree-ssa/pr27291.C | 14 +- gcc/testsuite/g++.dg/tree-ssa/pr49516.C | 32 +-- .../g++.dg/warn/Wconversion-integer.C | 13 +- .../g++.dg/warn/Wconversion-null-2.C | 12 +- gcc/testsuite/g++.dg/warn/Wconversion-null.C | 12 +- gcc/testsuite/g++.dg/warn/Wconversion3.C | 2 +- .../g++.dg/warn/Wduplicated-branches1.C | 2 +- .../g++.dg/warn/Wplacement-new-size-5.C | 10 +- .../g++.dg/warn/Wplacement-new-size.C | 248 +++++++++--------- .../g++.dg/warn/Wstrict-aliasing-5.C | 4 +- .../Wstrict-aliasing-bogus-signed-unsigned.C | 8 +- .../g++.dg/warn/Wtype-limits-Wextra.C | 12 +- gcc/testsuite/g++.dg/warn/Wtype-limits.C | 12 +- .../g++.old-deja/g++.brendan/enum11.C | 3 +- .../g++.old-deja/g++.bugs/900227_01.C | 2 +- gcc/testsuite/g++.old-deja/g++.mike/ns15.C | 1 + .../g++.old-deja/g++.other/exprstmt1.C | 21 +- .../g++.old-deja/g++.other/inline12.C | 2 +- gcc/testsuite/g++.old-deja/g++.other/new6.C | 8 +- gcc/testsuite/g++.old-deja/g++.pt/crash16.C | 1 + gcc/testsuite/g++.old-deja/g++.robertl/eb76.C | 1 + gcc/testsuite/g++.old-deja/g++.warn/flow1.C | 6 +- gcc/testsuite/gcc.dg/Walloca-14.c | 3 +- gcc/testsuite/gcc.dg/Warray-bounds-32.c | 4 +- .../gcc.dg/Wbuiltin-declaration-mismatch-4.c | 6 +- gcc/testsuite/gcc.dg/concat2.c | 2 +- gcc/testsuite/gcc.dg/fold-convmaxconv-1.c | 7 +- gcc/testsuite/gcc.dg/fold-convminconv-1.c | 7 +- gcc/testsuite/gcc.dg/graphite/scop-4.c | 2 + gcc/testsuite/gcc.dg/loop-versioning-1.c | 4 + gcc/testsuite/gcc.dg/loop-versioning-2.c | 2 +- gcc/testsuite/gcc.dg/lto/20081210-1_0.c | 8 +- gcc/testsuite/gcc.dg/lto/pr85870_0.c | 10 +- gcc/testsuite/gcc.dg/lto/pr85870_1.c | 10 +- gcc/testsuite/gcc.dg/pr36227.c | 10 +- gcc/testsuite/gcc.dg/pr42611.c | 3 +- gcc/testsuite/gcc.dg/pr59963-2.c | 2 +- gcc/testsuite/gcc.dg/pr68317.c | 10 +- gcc/testsuite/gcc.dg/pr78973.c | 2 +- gcc/testsuite/gcc.dg/pr85859.c | 2 +- gcc/testsuite/gcc.dg/pr86179.c | 13 +- gcc/testsuite/gcc.dg/torture/20181024-1.c | 1 + gcc/testsuite/gcc.dg/torture/pr71598-2.c | 1 + gcc/testsuite/gcc.dg/torture/pr86034.c | 12 +- .../gcc.dg/tree-ssa/builtin-sprintf-warn-3.c | 32 +-- gcc/testsuite/gcc.dg/tree-ssa/integer-addr.c | 2 +- .../gcc.dg/tree-ssa/loop-interchange-10.c | 10 +- gcc/testsuite/gcc.dg/tree-ssa/pr84436-3.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr84648.c | 4 +- gcc/testsuite/gcc.dg/tree-ssa/scev-8.c | 8 +- .../gcc.dg/tree-ssa/ssa-dom-thread-8.c | 12 +- gcc/testsuite/lib/target-supports.exp | 46 ++++ 114 files changed, 790 insertions(+), 450 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8447bd56d98..703b6349516 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2020-05-19 Jozef Lawrynowicz + + * doc/sourcebuild.texi: Document new short_eq_int, ptr_eq_short, + msp430_small, msp430_large and size24plus DejaGNU effective + targets. + Improve grammar in descriptions for size20plus and size32plus effective + targets. + 2020-05-19 Jose E. Marchesi * config/bpf/bpf.c (bpf_compute_frame_layout): Include space for diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 0f70e4baca9..e5554c4666e 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1363,6 +1363,12 @@ Target has 64-bit @code{long long}. @item long_neq_int Target has @code{int} and @code{long} with different sizes. +@item short_eq_int +Target has @code{short} and @code{int} with the same size. + +@item ptr_eq_short +Target has pointers (@code{void *}) and @code{short} with the same size. + @item int_eq_float Target has @code{int} and @code{float} with the same size. @@ -1379,11 +1385,15 @@ Target supports @code{long double} that is longer than @code{double}. Target has pointers that are 32 bits or longer. @item size20plus -Target has a 20-bit or larger address space, so at least supports +Target has a 20-bit or larger address space, so supports at least 16-bit array and structure sizes. +@item size24plus +Target has a 24-bit or larger address space, so supports at least +20-bit array and structure sizes. + @item size32plus -Target has a 32-bit or larger address space, so at least supports +Target has a 32-bit or larger address space, so supports at least 24-bit array and structure sizes. @item 4byte_wchar_t @@ -2050,6 +2060,16 @@ when using the new ABI. MIPS target supports @code{-mpaired-single}. @end table +@subsubsection MSP430-specific attributes + +@table @code +@item msp430_small +MSP430 target has the small memory model enabled (@code{-msmall}). + +@item msp430_large +MSP430 target has the large memory model enabled (@code{-mlarge}). +@end table + @subsubsection PowerPC-specific attributes @table @code diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1fa18f2982a..fa1d04599dc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,138 @@ +2020-05-19 Jozef Lawrynowicz + + * c-c++-common/builtin-has-attribute-7.c: Require size24plus. + * c-c++-common/cpp/pr63831-1.c: Store result in _has_cpp_attribute in a + long. + * c-c++-common/pr81376.c: Skip scan-tree-dump for short_eq_int. Extend + test for short_eq_int. + * g++.dg/abi/scoped1.C: Skip dg-warning tests for short_eq_int. + * g++.dg/cpp0x/constexpr-70001-1.C: Require size24plus. + * g++.dg/cpp0x/constexpr-bitfield3.C: Require int32plus. + * g++.dg/cpp0x/enum13.C: Skip dg-warning for short_eq_int. + * g++.dg/cpp0x/initlist5.C: Add dg-error for short_eq_int. + * g++.dg/cpp0x/initlist7.C: Add dg-warning for !int32plus. + * g++.dg/cpp0x/nullptr04.C: Skip dg-error for ptr_eq_short. + * g++.dg/cpp0x/variadic-value1.C: Add typedef for int32_t. + * g++.dg/cpp1y/constexpr-arith-overflow.C: Fix test for + sizeof(int) == sizeof(short). + * g++.dg/cpp1y/digit-sep-neg.C: Add typedef for int32_t. + * g++.dg/cpp1y/pr57644.C: Add typedef for uint32_t. + * g++.dg/cpp1y/pr77321.C: Require size24plus. + * g++.dg/cpp1y/var-templ4.C: Add typedef for int32_t. + * g++.dg/cpp1z/direct-enum-init1.C: Skip dg-error for short_eq_int. + * g++.dg/delayedfold/fwrapv1.C: Skip for int16. + * g++.dg/expr/bitfield9.C: Add typedef for int32_t. + * g++.dg/ext/attribute-test-1.C: Add typedef for uint32_t. + * g++.dg/ext/bitfield1.C: Add typedef for int32_t. + * g++.dg/ext/flexary13.C: Add typedef for int32_t. + * g++.dg/ext/utf-cvt.C: Adjust dg-warning for int16. + * g++.dg/ext/vector28.C: Add typedef for int32_t. + * g++.dg/ext/vla15.C: Add typedef for int32_t. + * g++.dg/init/array11.C: Require size32plus. + * g++.dg/init/array15.C: Require size24plus. + * g++.dg/init/array4.C: Require size20plus. + * g++.dg/init/const7.C: Skip dg-message for ptr_eq_short. + * g++.dg/init/new38.C: Relax regex in dg-error. + * g++.dg/init/new44.C: Skip dg-error for msp430_small. + Adjust test for 16-bit size_t. + Add special case for msp430 -mlarge. + * g++.dg/init/value9.C: Add typedef for int32_t. + * g++.dg/ipa/pr77333.C: Add typedef for int32_t. + * g++.dg/lto/20080908-1_0.C: Add typedef for int32_t. + * g++.dg/opt/pr55717.C: Add typedef for uint32_t. + * g++.dg/opt/pr60597.C: Add typedef for int32_t. + * g++.dg/opt/pr81715.C: Require size20plus. + * g++.dg/opt/reload3.C: Add typedef for uint32_t. + * g++.dg/opt/temp2.C: Require size20plus. + * g++.dg/opt/thunk1.C: Likewise. + * g++.dg/other/error23.C: Dont assume __SIZEOF_INT__ == 4. + * g++.dg/other/pr31078.C: Adjust typedef for 32-bit int. + * g++.dg/parse/concat1.C: Skip dg-error for size20plus. + * g++.dg/parse/defarg5.C: Add typedef for int32_t and uint32_t. + * g++.dg/pr48484.C: Add typedef for int32_t. + * g++.dg/pr53037-2.C: Likewise. + * g++.dg/pr53037-3.C: Likewise. + * g++.dg/pr66655.C: Use int32_t. + * g++.dg/pr66655.h: Add typedef for int32_t. + * g++.dg/pr66655_1.cc: Use int32_t. + * g++.dg/pr67351.C: Define 32-bit uint. + * g++.dg/template/array30.C: Add typedef for int32_t. + * g++.dg/template/constant1.C: Extend test for 8-bit and 16-bit int. + * g++.dg/template/constant2.C: Likewise. + * g++.dg/template/friend18.C: Add typedef for int32_t. + * g++.dg/template/pr68978.C: Likewise. + * g++.dg/torture/pr37421.C: Require int_eq_float. + * g++.dg/torture/pr88861.C: Handle 16-bit int. + * g++.dg/tree-ssa/pr19807.C: Likewise. + * g++.dg/tree-ssa/pr27291.C: Fix typedef for uint32_t. + * g++.dg/tree-ssa/pr49516.C: Fix typedefs for int{16,32}_t and + uint{32,64}_t. + * g++.dg/warn/Wconversion-integer.C: Add typedefs for {u,}int32_t. + * g++.dg/warn/Wconversion-null-2.C: Adjust g() declaration. + * g++.dg/warn/Wconversion-null.C: Likewise. + * g++.dg/warn/Wconversion3.C: Skip dg-warning for short_eq_int. + * g++.dg/warn/Wduplicated-branches1.C: Add dg-warning for short_eq_int. + * g++.dg/warn/Wplacement-new-size-5.C: Add typedef for int32_t. + * g++.dg/warn/Wplacement-new-size.C: Likewise. + * g++.dg/warn/Wstrict-aliasing-5.C: Add typedef for uint32_t. + * g++.dg/warn/Wstrict-aliasing-bogus-signed-unsigned.C: Add typedef for + {u,}int32_t. + * g++.dg/warn/Wtype-limits-Wextra.C: Adjust dg-warning for + short_eq_int. + * g++.dg/warn/Wtype-limits.C: Likewise. + * g++.old-deja/g++.brendan/enum11.C: Add typedef for uint32_t. + * g++.old-deja/g++.bugs/900227_01.C: Skip dg-error for ptr_eq_short. + * g++.old-deja/g++.mike/ns15.C: Require size20plus. + * g++.old-deja/g++.other/exprstmt1.C: Add typedef for uint32_t. + * g++.old-deja/g++.other/inline12.C: Adjust udword typedef. + * g++.old-deja/g++.other/new6.C: Add typedef for int32_t. + * g++.old-deja/g++.pt/crash16.C: Skip for int16. + * g++.old-deja/g++.robertl/eb76.C: Likewise. + * g++.old-deja/g++.warn/flow1.C: Add typedef for int32_t. + * gcc.dg/Walloca-14.c: Adjust -Walloca-larger-than= parameter for + !ptr32plus. + * gcc.dg/Warray-bounds-32.c: Adjust dg-warning for size20plus. + * gcc.dg/Wbuiltin-declaration-mismatch-4.c: Adjust dg-warning for + short_eq_int. + Handle case where ptrdiff_t/size_t is __int20. + * gcc.dg/concat2.c: Skip dg-error for size20plus. + * gcc.dg/fold-convmaxconv-1.c: Add typedef for {u,}int32_t. + * gcc.dg/fold-convminconv-1.c: Likewise. + * gcc.dg/graphite/scop-4.c: Require size20plus. + * gcc.dg/loop-versioning-1.c: Adjust test for small size_t. + * gcc.dg/loop-versioning-2.c: Require size20plus. + * gcc.dg/lto/20081210-1_0.c: Adjust typedef for uintptr_t. + * gcc.dg/lto/pr85870_0.c: Add typedef for uint32_t. + * gcc.dg/lto/pr85870_1.c: Likewise. + * gcc.dg/pr36227.c: Adjust typedef for ptrcast. + * gcc.dg/pr42611.c: First check for size_t equality with void * + before trying other types. + * gcc.dg/pr59963-2.c: Skip dg-warning for int16 instead of + xfail. + * gcc.dg/pr68317.c: Add typedef for int32_t. + * gcc.dg/pr78973.c: Adjust dg-warning for int16. + * gcc.dg/pr85859.c: Cast using __INTPTR_TYPE__ instead of long. + * gcc.dg/pr86179.c: Add typedef for {u,}int32_t. + * gcc.dg/torture/20181024-1.c: Require size32plus. + * gcc.dg/torture/pr71598-2.c: Skip for short_eq_int. + * gcc.dg/torture/pr86034.c: Add typedef for int32_t. + * gcc.dg/tree-ssa/builtin-sprintf-warn-3.c: Adjust dg-warning + for int16 and msp430 -mlarge. + * gcc.dg/tree-ssa/integer-addr.c: Use __INTPTR_MAX__ for a large + constant that is a valid address. + * gcc.dg/tree-ssa/loop-interchange-10.c: Add typedef for + int32_t. + * gcc.dg/tree-ssa/pr84436-3.c: Adjust dg-final for int16. + * gcc.dg/tree-ssa/pr84648.c: Add typedef for uint32_t. + * gcc.dg/tree-ssa/scev-8.c: Cast to char if sizeof(int) == + sizeof(short). + * gcc.dg/tree-ssa/ssa-dom-thread-8.c: Adjust test for msp430 -mlarge. + * lib/target-supports.exp (check_effective_target_size24plus): New. + (check_effective_target_short_eq_int): New. + (check_effective_target_ptr_eq_short): New. + (check_effective_target_msp430_small): New. + (check_effective_target_msp430_large): New. + 2020-05-19 Jose E. Marchesi * gcc.target/bpf/xbpf-callee-saved-regs-1.c: New test. diff --git a/gcc/testsuite/c-c++-common/builtin-has-attribute-7.c b/gcc/testsuite/c-c++-common/builtin-has-attribute-7.c index 6ea2e9e7192..1326aed32a7 100644 --- a/gcc/testsuite/c-c++-common/builtin-has-attribute-7.c +++ b/gcc/testsuite/c-c++-common/builtin-has-attribute-7.c @@ -2,7 +2,8 @@ and packed in various forms of array dereferencing and indirection expressions correspondingly to __alignof__. { dg-do compile } - { dg-options "-Wall -Wno-unused -ftrack-macro-expansion=0" } */ + { dg-options "-Wall -Wno-unused -ftrack-macro-expansion=0" } + { dg-require-effective-target size24plus } */ #define ATTR(...) __attribute__ ((__VA_ARGS__)) #define ALIGN(N) ATTR (aligned (N)) diff --git a/gcc/testsuite/c-c++-common/cpp/pr63831-1.c b/gcc/testsuite/c-c++-common/cpp/pr63831-1.c index 135baf6c406..6e97521ecde 100644 --- a/gcc/testsuite/c-c++-common/cpp/pr63831-1.c +++ b/gcc/testsuite/c-c++-common/cpp/pr63831-1.c @@ -61,4 +61,4 @@ T18 t18; T19 t19; T20 t20; #endif -int t21 = __has_attribute (noreturn) + __has_cpp_attribute (__malloc__); +long t21 = __has_attribute (noreturn) + __has_cpp_attribute (__malloc__); diff --git a/gcc/testsuite/c-c++-common/pr81376.c b/gcc/testsuite/c-c++-common/pr81376.c index e67f41e7356..f96a840d6f1 100644 --- a/gcc/testsuite/c-c++-common/pr81376.c +++ b/gcc/testsuite/c-c++-common/pr81376.c @@ -35,7 +35,14 @@ void f4(unsigned short a, int b) { volatile int us_i; us_i = (double) a < (double) b; - /* { dg-final { scan-tree-dump "us_i = \\(int\\) a < b" "original" } } */ + /* { dg-final { scan-tree-dump "us_i = \\(int\\) a < b" "original" { target { ! short_eq_int } } } } */ +} + +void f4_short_eq_int(unsigned short a, long b) +{ + volatile long us_l; + us_l = (double) a < (double) b; + /* { dg-final { scan-tree-dump "us_l = \\(long int\\) a < b" "original" { target { short_eq_int } } } } */ } /* We don't optimize here because neither of integral types is diff --git a/gcc/testsuite/g++.dg/abi/scoped1.C b/gcc/testsuite/g++.dg/abi/scoped1.C index 7589ed44066..62ae498c970 100644 --- a/gcc/testsuite/g++.dg/abi/scoped1.C +++ b/gcc/testsuite/g++.dg/abi/scoped1.C @@ -6,18 +6,18 @@ void f(int i, ...) { __builtin_va_list ap; __builtin_va_start (ap, i); - if (__builtin_va_arg (ap, A) != A::a1) __builtin_abort(); // { dg-warning "passed" } - if (__builtin_va_arg (ap, A) != A::a2) __builtin_abort(); // { dg-warning "passed" } - if (__builtin_va_arg (ap, A) != A::a3) __builtin_abort(); // { dg-warning "passed" } - if (__builtin_va_arg (ap, A) != A::a1) __builtin_abort(); // { dg-warning "passed" } - if (__builtin_va_arg (ap, A) != A::a2) __builtin_abort(); // { dg-warning "passed" } - if (__builtin_va_arg (ap, A) != A::a3) __builtin_abort(); // { dg-warning "passed" } - if (__builtin_va_arg (ap, A) != A::a1) __builtin_abort(); // { dg-warning "passed" } - if (__builtin_va_arg (ap, A) != A::a2) __builtin_abort(); // { dg-warning "passed" } - if (__builtin_va_arg (ap, A) != A::a3) __builtin_abort(); // { dg-warning "passed" } + if (__builtin_va_arg (ap, A) != A::a1) __builtin_abort(); // { dg-warning "passed" "" { target { ! short_eq_int } } } + if (__builtin_va_arg (ap, A) != A::a2) __builtin_abort(); // { dg-warning "passed" "" { target { ! short_eq_int } } } + if (__builtin_va_arg (ap, A) != A::a3) __builtin_abort(); // { dg-warning "passed" "" { target { ! short_eq_int } } } + if (__builtin_va_arg (ap, A) != A::a1) __builtin_abort(); // { dg-warning "passed" "" { target { ! short_eq_int } } } + if (__builtin_va_arg (ap, A) != A::a2) __builtin_abort(); // { dg-warning "passed" "" { target { ! short_eq_int } } } + if (__builtin_va_arg (ap, A) != A::a3) __builtin_abort(); // { dg-warning "passed" "" { target { ! short_eq_int } } } + if (__builtin_va_arg (ap, A) != A::a1) __builtin_abort(); // { dg-warning "passed" "" { target { ! short_eq_int } } } + if (__builtin_va_arg (ap, A) != A::a2) __builtin_abort(); // { dg-warning "passed" "" { target { ! short_eq_int } } } + if (__builtin_va_arg (ap, A) != A::a3) __builtin_abort(); // { dg-warning "passed" "" { target { ! short_eq_int } } } } int main() { - f(9, A::a1, A::a2, A::a3, A::a1, A::a2, A::a3, A::a1, A::a2, A::a3); // { dg-warning "passed" } + f(9, A::a1, A::a2, A::a3, A::a1, A::a2, A::a3, A::a1, A::a2, A::a3); // { dg-warning "passed" "" { target { ! short_eq_int } } } } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-70001-1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-70001-1.C index e68ff0e58a0..7b28177b82f 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-70001-1.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-70001-1.C @@ -1,5 +1,6 @@ // PR c++/70001 // { dg-do compile { target c++11 } } +// { dg-require-effective-target size24plus } struct B { diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-bitfield3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-bitfield3.C index c393db4e6e9..a17d45cf6a2 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-bitfield3.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-bitfield3.C @@ -1,5 +1,6 @@ // PR c++/49136 // { dg-do compile { target c++11 } } +// { dg-require-effective-target int32plus } struct S { diff --git a/gcc/testsuite/g++.dg/cpp0x/enum13.C b/gcc/testsuite/g++.dg/cpp0x/enum13.C index 8335fadd78e..9902a4dc6b1 100644 --- a/gcc/testsuite/g++.dg/cpp0x/enum13.C +++ b/gcc/testsuite/g++.dg/cpp0x/enum13.C @@ -15,5 +15,5 @@ void foo(int x, ...) { } int main() { - foo(0, A::X); // { dg-warning "scoped" } + foo(0, A::X); // { dg-warning "scoped" "" { target { ! short_eq_int } } } } diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist5.C b/gcc/testsuite/g++.dg/cpp0x/initlist5.C index 5f253ca4827..5f128582014 100644 --- a/gcc/testsuite/g++.dg/cpp0x/initlist5.C +++ b/gcc/testsuite/g++.dg/cpp0x/initlist5.C @@ -32,4 +32,4 @@ char c = char{ u }; // { dg-error "narrowing" } // PR c++/50011 short unsigned su; -int i { su }; +int i { su }; // { dg-error "narrowing" "" { target short_eq_int } } diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist7.C b/gcc/testsuite/g++.dg/cpp0x/initlist7.C index 7dbbf2d2200..0cb89e627ac 100644 --- a/gcc/testsuite/g++.dg/cpp0x/initlist7.C +++ b/gcc/testsuite/g++.dg/cpp0x/initlist7.C @@ -3,7 +3,7 @@ typedef enum { AA=1, BB=2 } my_enum; -typedef struct { my_enum a:4 ; unsigned b:28; } stru; +typedef struct { my_enum a:4 ; unsigned b:28; } stru; // { dg-warning "width.*exceeds its type" "" { target { ! int32plus } } } void foo (char c, my_enum x, int i) { diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr04.C b/gcc/testsuite/g++.dg/cpp0x/nullptr04.C index 15af84c1c86..7cb3559b3a3 100644 --- a/gcc/testsuite/g++.dg/cpp0x/nullptr04.C +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr04.C @@ -5,12 +5,12 @@ __extension__ typedef __INTPTR_TYPE__ intptr_t; const int n4 = static_cast(nullptr); // { dg-error "16:invalid 'static_cast' " } -const short int n5 = reinterpret_cast(nullptr); // { dg-error "22:cast from .std::nullptr_t. to .short int. loses precision" } +const short int n5 = reinterpret_cast(nullptr); // { dg-error "22:cast from .std::nullptr_t. to .short int. loses precision" "" { target { ! ptr_eq_short } } } const intptr_t n6 = reinterpret_cast(nullptr); const intptr_t n7 = (intptr_t)nullptr; decltype(nullptr) mynull = 0; const int n8 = static_cast(mynull); // { dg-error "16:invalid 'static_cast' " } -const short int n9 = reinterpret_cast(mynull); // { dg-error "22:cast from .std::nullptr_t. to .short int. loses precision" } +const short int n9 = reinterpret_cast(mynull); // { dg-error "22:cast from .std::nullptr_t. to .short int. loses precision" "" { target { ! ptr_eq_short } } } const intptr_t n10 = reinterpret_cast(mynull); const intptr_t n11 = (intptr_t)mynull; diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-value1.C b/gcc/testsuite/g++.dg/cpp0x/variadic-value1.C index 179919a5bc7..b27ac34692f 100644 --- a/gcc/testsuite/g++.dg/cpp0x/variadic-value1.C +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-value1.C @@ -1,18 +1,20 @@ // PR c++/52796 // { dg-do run { target c++11 } } +typedef int int32_t __attribute__((mode (__SI__))); + inline void *operator new(__SIZE_TYPE__ s, void *p) { return p; } struct A { - int i; + int32_t i; template A(Ts&&... ts): i(ts...) { } }; static union { unsigned char c[sizeof(A)]; - int i; + int32_t i; }; int main() diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-arith-overflow.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-arith-overflow.C index 7ca0033d217..d6a6509d591 100644 --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-arith-overflow.C +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-arith-overflow.C @@ -90,6 +90,10 @@ template <> struct ResType { typedef unsigned type; }; StaticAssert (vflow ? CAT (op, __LINE__)(x, y).v \ : CAT (op, __LINE__)(x, y) == Res(op (x, y), vflow)) +/* If short and int are the same size we will overflow in some additional cases + when testing short. */ +#define INT_EQ_SHORT __SIZEOF_INT__ == __SIZEOF_SHORT__ + /* Signed int addition. */ TEST (sadd, signed char, 0, 0, 0); TEST (sadd, signed char, 0, SCHAR_MAX, 0); @@ -100,11 +104,11 @@ TEST (sadd, signed char, -1, SCHAR_MIN, 0); TEST (sadd, short, 0, 0, 0); TEST (sadd, short, 0, SHRT_MAX, 0); -TEST (sadd, short, 1, SHRT_MAX, 0); -TEST (sadd, short, SHRT_MAX, SHRT_MAX, 0); +TEST (sadd, short, 1, SHRT_MAX, INT_EQ_SHORT); +TEST (sadd, short, SHRT_MAX, SHRT_MAX, INT_EQ_SHORT); TEST (sadd, short, 0, SHRT_MIN, 0); -TEST (sadd, short, -1, SHRT_MIN, 0); -TEST (sadd, short, SHRT_MIN, SHRT_MIN, 0); +TEST (sadd, short, -1, SHRT_MIN, INT_EQ_SHORT); +TEST (sadd, short, SHRT_MIN, SHRT_MIN, INT_EQ_SHORT); TEST (sadd, int, 0, 0, 0); TEST (sadd, int, 0, INT_MAX, 0); @@ -139,8 +143,8 @@ TEST (uadd, unsigned char, UCHAR_MAX, UCHAR_MAX, 0); TEST (uadd, unsigned short, 0U, 0U, 0); TEST (uadd, unsigned short, 0U, USHRT_MAX, 0); -TEST (uadd, unsigned short, 1U, USHRT_MAX, 0); -TEST (uadd, unsigned short, USHRT_MAX, USHRT_MAX, 0); +TEST (uadd, unsigned short, 1U, USHRT_MAX, INT_EQ_SHORT); +TEST (uadd, unsigned short, USHRT_MAX, USHRT_MAX, INT_EQ_SHORT); TEST (uadd, unsigned, 0U, 0U, 0); TEST (uadd, unsigned, 0U, UINT_MAX, 0); @@ -170,7 +174,7 @@ TEST (ssub, short, 0, 0, 0); TEST (ssub, short, 0, SHRT_MAX, 0); TEST (ssub, short, 1, SHRT_MAX, 0); TEST (ssub, short, SHRT_MAX, SHRT_MAX, 0); -TEST (ssub, short, 0, SHRT_MIN, 0); +TEST (ssub, short, 0, SHRT_MIN, INT_EQ_SHORT); TEST (ssub, short, -1, SHRT_MIN, 0); TEST (ssub, short, SHRT_MIN, SHRT_MIN, 0); diff --git a/gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C b/gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C index 727e74e2e10..5343e52c5a5 100644 --- a/gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C +++ b/gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C @@ -1,9 +1,11 @@ // { dg-do compile { target c++14 } } +typedef int int32_t __attribute__((mode (__SI__))); + int main() { - int i = 0; + int32_t i = 0; i = 1048''576; // { dg-error "adjacent digit separators" } i = 0X'100000; // { dg-error "digit separator after base indicator" } i = 0x'100000; // { dg-error "digit separator after base indicator" } @@ -25,6 +27,6 @@ main() float f = 1.602'176'565e-19'F; // { dg-error "digit separator outside digit sequence" } } -// { dg-error "exponent has no digits" "exponent has no digits" { target *-*-* } 21 } -// { dg-error "expected ';' before" "expected ';' before" { target *-*-* } 13 } -// { dg-error "expected ';' before" "expected ';' before" { target *-*-* } 24 } +// { dg-error "exponent has no digits" "exponent has no digits" { target *-*-* } 23 } +// { dg-error "expected ';' before" "expected ';' before" { target *-*-* } 15 } +// { dg-error "expected ';' before" "expected ';' before" { target *-*-* } 26 } diff --git a/gcc/testsuite/g++.dg/cpp1y/pr57644.C b/gcc/testsuite/g++.dg/cpp1y/pr57644.C index ec595a21b7d..dd67a3bd2d1 100644 --- a/gcc/testsuite/g++.dg/cpp1y/pr57644.C +++ b/gcc/testsuite/g++.dg/cpp1y/pr57644.C @@ -1,8 +1,10 @@ // { dg-do compile { target c++14 } } +typedef unsigned uint32_t __attribute__((mode (__SI__))); + struct Foo { - unsigned i: 32; + uint32_t i: 32; }; int diff --git a/gcc/testsuite/g++.dg/cpp1y/pr77321.C b/gcc/testsuite/g++.dg/cpp1y/pr77321.C index b25f492dc4f..51c5bd9b394 100644 --- a/gcc/testsuite/g++.dg/cpp1y/pr77321.C +++ b/gcc/testsuite/g++.dg/cpp1y/pr77321.C @@ -1,6 +1,7 @@ // PR c++/77321 // { dg-do compile { target c++14 } } // { dg-options "-Wall" } +// { dg-require-effective-target size24plus } extern "C" void *memset (void *, int, __SIZE_TYPE__); extern "C" void *malloc(__SIZE_TYPE__); diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ4.C b/gcc/testsuite/g++.dg/cpp1y/var-templ4.C index 3cd84a892c3..4e762aa929e 100644 --- a/gcc/testsuite/g++.dg/cpp1y/var-templ4.C +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ4.C @@ -1,12 +1,14 @@ // { dg-do compile { target c++14 } } +typedef int int32_t __attribute__((mode (__SI__))); + template - constexpr int var = sizeof (T); + constexpr int32_t var = sizeof (T); template<> - constexpr int var = 100000; + constexpr int32_t var = 100000; int main () { - static_assert(var == 100000 && var == sizeof(char), ""); + static_assert(var == 100000 && var == sizeof(char), ""); } diff --git a/gcc/testsuite/g++.dg/cpp1z/direct-enum-init1.C b/gcc/testsuite/g++.dg/cpp1z/direct-enum-init1.C index f1d1aa5dfdc..027bd5e2083 100644 --- a/gcc/testsuite/g++.dg/cpp1z/direct-enum-init1.C +++ b/gcc/testsuite/g++.dg/cpp1z/direct-enum-init1.C @@ -54,7 +54,7 @@ foo () C c3 { 8L }; // { dg-error "cannot convert 'long int' to 'C' in initialization" "" { target c++14_down } } B b4 {short (c + 5)}; // { dg-error "invalid conversion from 'short int' to 'B'" "" { target c++14_down } } B b5 {c + 5}; // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } } - // { dg-error "narrowing conversion of \[^\n\r]* from 'int' to 'short int'" "" { target c++17 } .-1 } + // { dg-error "narrowing conversion of \[^\n\r]* from 'int' to 'short int'" "" { target { c++17 && { ! short_eq_int } } } .-1 } C c4 { ll }; // { dg-error "cannot convert 'long long int' to 'C' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of 'll' from 'long long int' to 'int'" "" { target c++17 } .-1 } C c5 {short (c + 5)}; // { dg-error "cannot convert 'short int' to 'C' in initialization" "" { target c++14_down } } @@ -120,7 +120,7 @@ foo2 () C c3 { 8L }; // { dg-error "cannot convert 'long int' to 'C' in initialization" "" { target c++14_down } } B b4 {short (c + 5)}; // { dg-error "invalid conversion from 'short int' to 'B'" "" { target c++14_down } } B b5 {c + 5}; // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } } - // { dg-error "narrowing conversion of \[^\n\r]* from 'int' to 'short int'" "" { target c++17 } .-1 } + // { dg-error "narrowing conversion of \[^\n\r]* from 'int' to 'short int'" "" { target { c++17 && { ! short_eq_int } } } .-1 } C c4 { ll }; // { dg-error "cannot convert 'long long int' to 'C' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of 'll' from 'long long int' to 'int'" "" { target c++17 } .-1 } C c5 {short (c + 5)}; // { dg-error "cannot convert 'short int' to 'C' in initialization" "" { target c++14_down } } @@ -188,7 +188,7 @@ foo3 () J c3 { 8L }; // { dg-error "cannot convert 'long int' to 'C' in initialization" "" { target c++14_down } } I b4 {short (c + 5)}; // { dg-error "invalid conversion from 'short int' to 'B'" "" { target c++14_down } } I b5 {c + 5}; // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } } - // { dg-error "narrowing conversion of \[^\n\r]* from 'int' to 'short int'" "" { target c++17 } .-1 } + // { dg-error "narrowing conversion of \[^\n\r]* from 'int' to 'short int'" "" { target { c++17 && { ! short_eq_int } } } .-1 } J c4 { ll }; // { dg-error "cannot convert 'long long int' to 'C' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of 'll' from 'long long int' to 'int'" "" { target c++17 } .-1 } J c5 {short (c + 5)}; // { dg-error "cannot convert 'short int' to 'C' in initialization" "" { target c++14_down } } diff --git a/gcc/testsuite/g++.dg/delayedfold/fwrapv1.C b/gcc/testsuite/g++.dg/delayedfold/fwrapv1.C index 412535ce1ee..6d374802f00 100644 --- a/gcc/testsuite/g++.dg/delayedfold/fwrapv1.C +++ b/gcc/testsuite/g++.dg/delayedfold/fwrapv1.C @@ -1,5 +1,6 @@ // PR c++/69631 // { dg-options -fwrapv } +// { dg-skip-if "" int16 } struct C { static const unsigned short max = static_cast((32767 * 2 + 1)); diff --git a/gcc/testsuite/g++.dg/expr/bitfield9.C b/gcc/testsuite/g++.dg/expr/bitfield9.C index 177f65b8800..2e309c34167 100644 --- a/gcc/testsuite/g++.dg/expr/bitfield9.C +++ b/gcc/testsuite/g++.dg/expr/bitfield9.C @@ -4,11 +4,13 @@ extern "C" void abort(); +typedef int int32_t __attribute__((mode (__SI__))); + struct S { long long i : 32; }; -void f(int i, int j) { +void f(int32_t i, int32_t j) { if (i != 0xabcdef01) abort(); if (j != 0) diff --git a/gcc/testsuite/g++.dg/ext/attribute-test-1.C b/gcc/testsuite/g++.dg/ext/attribute-test-1.C index 93e08d7ef89..97579035355 100644 --- a/gcc/testsuite/g++.dg/ext/attribute-test-1.C +++ b/gcc/testsuite/g++.dg/ext/attribute-test-1.C @@ -4,22 +4,24 @@ extern "C" void abort(); +typedef unsigned uint32_t __attribute__((mode (__SI__))); + #define vector __attribute__((vector_size(16))) struct Constants { - inline vector unsigned int deadbeef(void) const { - return (vector unsigned int){0xdeadbeef, 0xabababab, 0x55555555, 0x12345678}; + inline vector uint32_t deadbeef(void) const { + return (vector uint32_t){0xdeadbeef, 0xabababab, 0x55555555, 0x12345678}; }; }; -inline vector unsigned int const_deadbeef(Constants &C) +inline vector uint32_t const_deadbeef(Constants &C) { return C.deadbeef(); } union u { - unsigned int f[4]; - vector unsigned int v; + uint32_t f[4]; + vector uint32_t v; } data; int main() diff --git a/gcc/testsuite/g++.dg/ext/bitfield1.C b/gcc/testsuite/g++.dg/ext/bitfield1.C index 25c90df4191..91019dba52a 100644 --- a/gcc/testsuite/g++.dg/ext/bitfield1.C +++ b/gcc/testsuite/g++.dg/ext/bitfield1.C @@ -2,9 +2,11 @@ // { dg-do link } // { dg-options "" } +typedef int int32_t __attribute__((mode (__SI__))); + struct S { - signed int a:17; + int32_t a:17; } x; typedef typeof (x.a) foo; @@ -15,7 +17,7 @@ T* inc(T* p) { return p+1; } int main () { foo x[2] = { 1,2 }; - int y[2] = { 1,2 }; + int32_t y[2] = { 1,2 }; *inc(x); *inc(y); return 0; diff --git a/gcc/testsuite/g++.dg/ext/flexary13.C b/gcc/testsuite/g++.dg/ext/flexary13.C index 7c67d09ee5a..f0603f9a261 100644 --- a/gcc/testsuite/g++.dg/ext/flexary13.C +++ b/gcc/testsuite/g++.dg/ext/flexary13.C @@ -7,10 +7,12 @@ __FILE__, __LINE__, STR(exp)), \ __builtin_abort ())) -struct Ax { int n, a[]; }; -struct AAx { int i; Ax ax; }; +typedef int int32_t __attribute__((mode (__SI__))); -int i = 12345678; +struct Ax { int32_t n, a[]; }; +struct AAx { int32_t i; Ax ax; }; + +int32_t i = 12345678; int main () { @@ -44,7 +46,7 @@ int main () ASSERT (s.n == 456 && s.a [0] == i); } { - int j = i + 1, k = j + 1; + int32_t j = i + 1, k = j + 1; static Ax s = { 3, { i, j, k } }; // dg-warning "initialization of a flexible array member" } ASSERT (s.n == 3 && s.a [0] == i && s.a [1] == j && s.a [2] == k); diff --git a/gcc/testsuite/g++.dg/ext/utf-cvt.C b/gcc/testsuite/g++.dg/ext/utf-cvt.C index 929b7c71303..a792a737c52 100644 --- a/gcc/testsuite/g++.dg/ext/utf-cvt.C +++ b/gcc/testsuite/g++.dg/ext/utf-cvt.C @@ -27,8 +27,8 @@ void m(char16_t c0, char32_t c1) f_s (c0); /* { dg-warning "change the sign" } */ fss (c0); /* { dg-warning "change the sign" } */ fus (c0); - f_i (c0); - fsi (c0); + f_i (c0); /* { dg-warning "change the sign" "" { target int16 } } */ + fsi (c0); /* { dg-warning "change the sign" "" { target int16 } } */ fui (c0); f_l (c0); fsl (c0); @@ -43,11 +43,13 @@ void m(char16_t c0, char32_t c1) f_s (c1); /* { dg-warning "change value" } */ fss (c1); /* { dg-warning "change value" } */ fus (c1); /* { dg-warning "change value" } */ - f_i (c1); /* { dg-warning "change the sign" } */ - fsi (c1); /* { dg-warning "change the sign" } */ - fui (c1); - f_l (c1); /* { dg-warning "change the sign" "" { target { llp64 || ilp32 } } } */ - fsl (c1); /* { dg-warning "change the sign" "" { target { llp64 || ilp32 } } } */ + f_i (c1); /* { dg-warning "change the sign" "" { target { ! int16 } } } */ + /* { dg-warning "change value" "" { target int16 } .-1 } */ + fsi (c1); /* { dg-warning "change the sign" "" { target { ! int16 } } } */ + /* { dg-warning "change value" "" { target int16 } .-1 } */ + fui (c1); /* { dg-warning "change value" "" { target int16 } } */ + f_l (c1); /* { dg-warning "change the sign" "" { target { llp64 || { ilp32 || int16 } } } } */ + fsl (c1); /* { dg-warning "change the sign" "" { target { llp64 || { ilp32 || int16 } } } } */ ful (c1); f_ll (c1); fsll (c1); diff --git a/gcc/testsuite/g++.dg/ext/vector28.C b/gcc/testsuite/g++.dg/ext/vector28.C index ea48c961244..b0a003c967a 100644 --- a/gcc/testsuite/g++.dg/ext/vector28.C +++ b/gcc/testsuite/g++.dg/ext/vector28.C @@ -1,6 +1,8 @@ /* { dg-do compile } */ -typedef int veci __attribute__ ((vector_size (4 * sizeof (int)))); +typedef int int32_t __attribute__((mode (__SI__))); + +typedef int veci __attribute__ ((vector_size (4 * sizeof (int32_t)))); typedef float vecf __attribute__ ((vector_size (4 * sizeof (float)))); void f (veci *a, vecf *b, int c) diff --git a/gcc/testsuite/g++.dg/ext/vla15.C b/gcc/testsuite/g++.dg/ext/vla15.C index 77436cb58f3..bce4d7b0af7 100644 --- a/gcc/testsuite/g++.dg/ext/vla15.C +++ b/gcc/testsuite/g++.dg/ext/vla15.C @@ -3,12 +3,14 @@ // { dg-options "" } // { dg-require-effective-target alloca } +typedef int int32_t __attribute__((mode (__SI__))); + void *volatile p; int main (void) { - int n = 0; + int32_t n = 0; lab:; int x[n % 1000 + 1]; x[0] = 1; diff --git a/gcc/testsuite/g++.dg/init/array11.C b/gcc/testsuite/g++.dg/init/array11.C index e52effe9ff7..9c12831bbea 100644 --- a/gcc/testsuite/g++.dg/init/array11.C +++ b/gcc/testsuite/g++.dg/init/array11.C @@ -1,3 +1,4 @@ +// { dg-require-effective-target size32plus } /* PR 11665 Orgin: jwhite@cse.unl.edu The problem was in initializer_constant_valid_p, diff --git a/gcc/testsuite/g++.dg/init/array15.C b/gcc/testsuite/g++.dg/init/array15.C index 17160d07611..024d93ed4ab 100644 --- a/gcc/testsuite/g++.dg/init/array15.C +++ b/gcc/testsuite/g++.dg/init/array15.C @@ -1,4 +1,5 @@ // { dg-do run } +// { dg-require-effective-target size24plus } // Copyright (C) 2004 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 8 Dec 2004 diff --git a/gcc/testsuite/g++.dg/init/array4.C b/gcc/testsuite/g++.dg/init/array4.C index 67519bf7c35..4712e9d7253 100644 --- a/gcc/testsuite/g++.dg/init/array4.C +++ b/gcc/testsuite/g++.dg/init/array4.C @@ -1,4 +1,5 @@ // { dg-do compile } +// { dg-require-effective-target size20plus } // Origin: Markus Breuer // PR c++/6944 diff --git a/gcc/testsuite/g++.dg/init/const7.C b/gcc/testsuite/g++.dg/init/const7.C index e1f31bccf7c..e1dd4d802db 100644 --- a/gcc/testsuite/g++.dg/init/const7.C +++ b/gcc/testsuite/g++.dg/init/const7.C @@ -3,7 +3,7 @@ struct s { int x, y; }; short offsets[1] = { - ((char*) &(((struct s*)16)->y) - (char *)16), // { dg-message "narrowing" "" { target c++11 } } + ((char*) &(((struct s*)16)->y) - (char *)16), // { dg-message "narrowing" "" { target { c++11 && { ! ptr_eq_short } } } } }; // This ensures that we get a dump whether or not the bug is present. diff --git a/gcc/testsuite/g++.dg/init/new38.C b/gcc/testsuite/g++.dg/init/new38.C index cf73aa18e60..405b67d151f 100644 --- a/gcc/testsuite/g++.dg/init/new38.C +++ b/gcc/testsuite/g++.dg/init/new38.C @@ -40,7 +40,7 @@ template void large_array_template3(int n) { - new T[n] // { dg-error "size of array exceeds maximum object size" } + new T[n] // { dg-error "size.*of array exceeds maximum object size" } [(1ULL << (sizeof(void *) * 4)) / sizeof(T)] [1ULL << (sizeof(void *) * 4)]; } diff --git a/gcc/testsuite/g++.dg/init/new44.C b/gcc/testsuite/g++.dg/init/new44.C index a10ef424136..cf4bc160746 100644 --- a/gcc/testsuite/g++.dg/init/new44.C +++ b/gcc/testsuite/g++.dg/init/new44.C @@ -42,8 +42,8 @@ test_one_dim_char_array () p = new char [MAX - 2]; // { dg-error "size .\[0-9\]+. of array" } p = new char [MAX - 99]; // { dg-error "size .\[0-9\]+. of array" } p = new char [MAX / 2]; // { dg-error "size .\[0-9\]+. of array" } - p = new char [MAX / 2 - 1]; // { dg-error "size .\[0-9\]+. of array" } - p = new char [MAX / 2 - 2]; // { dg-error "size .\[0-9\]+. of array" } + p = new char [MAX / 2 - 1]; // { dg-error "size .\[0-9\]+. of array" "cookie required" { target { ! msp430_small } } } + p = new char [MAX / 2 - 2]; // { dg-error "size .\[0-9\]+. of array" "cookie required" { target { ! msp430_small } } } // Avoid testing the expressions below since whether or not they // are accepted depends on the precision of size_t (which also @@ -76,7 +76,7 @@ test_one_dim_short_array () p = new short [MAX / 2 - 6]; // { dg-error "size .\[0-9\]+. of array" } p = new short [MAX / 2 - 7]; // { dg-error "size .\[0-9\]+. of array" } p = new short [MAX / 2 - 8]; // { dg-error "size .\[0-9\]+. of array" } - p = new short [MAX / 4]; // { dg-error "size .\[0-9\]+. of array" } + p = new short [MAX / 4]; // { dg-error "size .\[0-9\]+. of array" "cookie required" { target { ! msp430_small } } } // Avoid exercising data model-dependent expressions. // p = new short [MAX / 4 - 1]; @@ -93,8 +93,8 @@ test_two_dim_char_array () p = new char [1][MAX - 2]; // { dg-error "size .\[0-9\]+. of (unnamed )?array" } p = new char [1][MAX - 99]; // { dg-error "size .\[0-9\]+. of (unnamed )?array" } p = new char [1][MAX / 2]; // { dg-error "size .\[0-9\]+. of array" } - p = new char [1][MAX / 2 - 1]; // { dg-error "size .\[0-9\]+. of array" } - p = new char [1][MAX / 2 - 2]; // { dg-error "size .\[0-9\]+. of array" } + p = new char [1][MAX / 2 - 1]; // { dg-error "size .\[0-9\]+. of array" "cookie required" { target { ! msp430_small } } } + p = new char [1][MAX / 2 - 2]; // { dg-error "size .\[0-9\]+. of array" "cookie required" { target { ! msp430_small } } } // Avoid exercising data model-dependent expressions. // p = new char [1][MAX / 2 - 3]; @@ -125,8 +125,8 @@ test_two_dim_char_array () p = new char [MAX][2]; // { dg-error "size .\[0-9\]+. of array" } p = new char [MAX][1]; // { dg-error "size .\[0-9\]+. of array" } p = new char [MAX / 2][1]; // { dg-error "size .\[0-9\]+. of array" } - p = new char [MAX / 2 - 1][1]; // { dg-error "size .\[0-9\]+. of array" } - p = new char [MAX / 2 - 2][1]; // { dg-error "size .\[0-9\]+. of array" } + p = new char [MAX / 2 - 1][1]; // { dg-error "size .\[0-9\]+. of array" "cookie required" { target { ! msp430_small } } } + p = new char [MAX / 2 - 2][1]; // { dg-error "size .\[0-9\]+. of array" "cookie required" { target { ! msp430_small } } } // Avoid exercising data model-dependent expressions. // p = new char [MAX / 2 - 3][1]; @@ -148,8 +148,8 @@ test_three_dim_char_array () p = new char [1][1][MAX - 2]; // { dg-error "size .\[0-9\]+. of (unnamed )?array" } p = new char [1][1][MAX - 99]; // { dg-error "size .\[0-9\]+. of (unnamed )?array" } p = new char [1][1][MAX / 2]; // { dg-error "size .\[0-9\]+. of array" } - p = new char [1][1][MAX / 2 - 1]; // { dg-error "size .\[0-9\]+. of array" } - p = new char [1][1][MAX / 2 - 2]; // { dg-error "size .\[0-9\]+. of array" } + p = new char [1][1][MAX / 2 - 1]; // { dg-error "size .\[0-9\]+. of array" "cookie required" { target { ! msp430_small } } } + p = new char [1][1][MAX / 2 - 2]; // { dg-error "size .\[0-9\]+. of array" "cookie required" { target { ! msp430_small } } } // Avoid exercising data model-dependent expressions. // p = new char [1][1][MAX / 2 - 3]; @@ -173,7 +173,7 @@ test_three_dim_char_array () p = new char [1][2][MAX / 2 - 6]; // { dg-error "size .\[0-9\]+. of (unnamed )?array" } p = new char [1][2][MAX / 2 - 7]; // { dg-error "size .\[0-9\]+. of (unnamed )?array" } p = new char [1][2][MAX / 2 - 8]; // { dg-error "size .\[0-9\]+. of (unnamed )?array" } - p = new char [1][2][MAX / 4]; // { dg-error "size .\[0-9\]+. of array" } + p = new char [1][2][MAX / 4]; // { dg-error "size .\[0-9\]+. of array" "cookie required" { target { ! msp430_small } } } // Avoid exercising data model-dependent expressions. // p = new char [1][2][MAX / 4 - 1]; @@ -195,7 +195,7 @@ test_three_dim_char_array () p = new char [2][1][MAX / 2 - 6]; // { dg-error "size .\[0-9\]+. of array" } p = new char [2][1][MAX / 2 - 7]; // { dg-error "size .\[0-9\]+. of array" } p = new char [2][1][MAX / 2 - 8]; // { dg-error "size .\[0-9\]+. of array" } - p = new char [2][1][MAX / 4]; // { dg-error "size .\[0-9\]+. of array" } + p = new char [2][1][MAX / 4]; // { dg-error "size .\[0-9\]+. of array" "cookie required" { target { ! msp430_small } } } // Avoid exercising data model-dependent expressions. // p = new char [2][1][MAX / 4 - 1]; @@ -290,16 +290,20 @@ test_N_dim_char_array () { #if __SIZEOF_SIZE_T__ == 8 enum { N = 256 }; -#else +#elif __SIZEOF_SIZE_T__ == 4 enum { N = 16 }; +#else + enum { N = 4 }; #endif +#ifndef __MSP430X_LARGE__ /* 20-bit size_t. */ p = new char [N][N][N][N][N][N][N]; p = new char [N / 2][2][N][N][N][N][N][N]; p = new char [N - 1][N / 2][N][N][N][N][N][N]; - p = new char [N / 2][N][N][N][N][N][N][N]; // { dg-error "size .\[0-9\]+. of array" } - p = new char [N - 1][N][N][N][N][N][N][N]; // { dg-error "size .\[0-9\]+. of array" } - p = new char [N] [N][N][N][N][N][N][N]; // { dg-error "size .\[0-9\]+. of array" } + p = new char [N / 2][N][N][N][N][N][N][N]; // { dg-error "size .\[0-9\]+. of array" "" { target { ! msp430_large } } } + p = new char [N - 1][N][N][N][N][N][N][N]; // { dg-error "size .\[0-9\]+. of array" "" { target { ! msp430_large } } } + p = new char [N] [N][N][N][N][N][N][N]; // { dg-error "size .\[0-9\]+. of array" "" { target { ! msp430_large } } } +#endif } typedef struct Byte { @@ -321,8 +325,8 @@ test_one_dim_byte_array (void *p) p = new (p) B [MAX - 2]; // { dg-error "size .\[0-9\]+. of array" } p = new (p) B [MAX - 99]; // { dg-error "size .\[0-9\]+. of array" } p = new (p) B [MAX / 2]; // { dg-error "size .\[0-9\]+. of array" } - p = new (p) B [MAX / 2 - 1]; // { dg-error "size .\[0-9\]+. of array" } - p = new (p) B [MAX / 2 - 2]; // { dg-error "size .\[0-9\]+. of array" } + p = new (p) B [MAX / 2 - 1]; // { dg-error "size .\[0-9\]+. of array" "cookie required" { target { ! msp430_small } } } + p = new (p) B [MAX / 2 - 2]; // { dg-error "size .\[0-9\]+. of array" "cookie required" { target { ! msp430_small } } } // Avoid testing the expressions below since whether or not they // are accepted depends on the precision of size_t (which determines @@ -348,8 +352,8 @@ test_placement_two_dim_byte_struct_array (void *p) p = new (p) B [1][MAX - 2]; // { dg-error "size .\[0-9\]+. of (unnamed )?array" } p = new (p) B [1][MAX - 99]; // { dg-error "size .\[0-9\]+. of (unnamed )?array" } p = new (p) B [1][MAX / 2]; // { dg-error "size .\[0-9\]+. of array" } - p = new (p) B [1][MAX / 2 - 1]; // { dg-error "size .\[0-9\]+. of array" } - p = new (p) B [1][MAX / 2 - 2]; // { dg-error "size .\[0-9\]+. of array" } + p = new (p) B [1][MAX / 2 - 1]; // { dg-error "size .\[0-9\]+. of array" "cookie required" { target { ! msp430_small } } } + p = new (p) B [1][MAX / 2 - 2]; // { dg-error "size .\[0-9\]+. of array" "cookie required" { target { ! msp430_small } } } // Avoid exercising data model-dependent expressions. // p = new (p) B [1][MAX / 2 - 3]; @@ -380,8 +384,8 @@ test_placement_two_dim_byte_struct_array (void *p) p = new (p) B [MAX][2]; // { dg-error "size .\[0-9\]+. of array" } p = new (p) B [MAX][1]; // { dg-error "size .\[0-9\]+. of array" } p = new (p) B [MAX / 2][1]; // { dg-error "size .\[0-9\]+. of array" } - p = new (p) B [MAX / 2 - 1][1]; // { dg-error "size .\[0-9\]+. of array" } - p = new (p) B [MAX / 2 - 2][1]; // { dg-error "size .\[0-9\]+. of array" } + p = new (p) B [MAX / 2 - 1][1]; // { dg-error "size .\[0-9\]+. of array" "cookie required" { target { ! msp430_small } } } + p = new (p) B [MAX / 2 - 2][1]; // { dg-error "size .\[0-9\]+. of array" "cookie required" { target { ! msp430_small } } } // Avoid exercising data model-dependent expressions. // p = new (p) B [MAX / 2 - 3][1]; @@ -403,8 +407,8 @@ test_placement_three_dim_byte_struct_array (void *p) p = new (p) B [1][1][MAX - 2]; // { dg-error "size .\[0-9\]+. of (unnamed )?array" } p = new (p) B [1][1][MAX - 99]; // { dg-error "size .\[0-9\]+. of (unnamed )?array" } p = new (p) B [1][1][MAX / 2]; // { dg-error "size .\[0-9\]+. of array" } - p = new (p) B [1][1][MAX / 2 - 1]; // { dg-error "size .\[0-9\]+. of array" } - p = new (p) B [1][1][MAX / 2 - 2]; // { dg-error "size .\[0-9\]+. of array" } + p = new (p) B [1][1][MAX / 2 - 1]; // { dg-error "size .\[0-9\]+. of array" "cookie required" { target { ! msp430_small } } } + p = new (p) B [1][1][MAX / 2 - 2]; // { dg-error "size .\[0-9\]+. of array" "cookie required" { target { ! msp430_small } } } // Avoid exercising data model-dependent expressions. // p = new (p) B [1][1][MAX / 2 - 3]; @@ -428,7 +432,7 @@ test_placement_three_dim_byte_struct_array (void *p) p = new (p) B [1][2][MAX / 2 - 6]; // { dg-error "size .\[0-9\]+. of (unnamed )?array" } p = new (p) B [1][2][MAX / 2 - 7]; // { dg-error "size .\[0-9\]+. of (unnamed )?array" } p = new (p) B [1][2][MAX / 2 - 8]; // { dg-error "size .\[0-9\]+. of (unnamed )?array" } - p = new (p) B [1][2][MAX / 4]; // { dg-error "size .\[0-9\]+. of array" } + p = new (p) B [1][2][MAX / 4]; // { dg-error "size .\[0-9\]+. of array" "cookie required" { target { ! msp430_small } } } // Avoid exercising data model-dependent expressions. // p = new (p) B [1][2][MAX / 4 - 1]; @@ -450,7 +454,7 @@ test_placement_three_dim_byte_struct_array (void *p) p = new (p) B [2][1][MAX / 2 - 6]; // { dg-error "size .\[0-9\]+. of array" } p = new (p) B [2][1][MAX / 2 - 7]; // { dg-error "size .\[0-9\]+. of array" } p = new (p) B [2][1][MAX / 2 - 8]; // { dg-error "size .\[0-9\]+. of array" } - p = new (p) B [2][1][MAX / 4]; // { dg-error "size .\[0-9\]+. of array" } + p = new (p) B [2][1][MAX / 4]; // { dg-error "size .\[0-9\]+. of array" "cookie required" { target { ! msp430_small } } } // Avoid exercising data model-dependent expressions. // p = new (p) B [2][1][MAX / 4 - 1]; diff --git a/gcc/testsuite/g++.dg/init/value9.C b/gcc/testsuite/g++.dg/init/value9.C index 4899bd81001..25abd60ff3b 100644 --- a/gcc/testsuite/g++.dg/init/value9.C +++ b/gcc/testsuite/g++.dg/init/value9.C @@ -1,6 +1,8 @@ // PR c++/50793 // { dg-do run } +typedef int int32_t __attribute__((mode (__SI__))); + struct NonTrivial { NonTrivial() { } @@ -9,7 +11,7 @@ struct NonTrivial struct S { NonTrivial nt; - int i; + int32_t i; }; int f(S s) diff --git a/gcc/testsuite/g++.dg/ipa/pr77333.C b/gcc/testsuite/g++.dg/ipa/pr77333.C index 1ef997f7a54..444805dca8c 100644 --- a/gcc/testsuite/g++.dg/ipa/pr77333.C +++ b/gcc/testsuite/g++.dg/ipa/pr77333.C @@ -1,6 +1,8 @@ // { dg-do run } // { dg-options "-O2 -fno-ipa-sra" } +typedef int int32_t __attribute__((mode (__SI__))); + volatile int global; int __attribute__((noinline, noclone)) get_data (int i) @@ -18,7 +20,7 @@ char buf[512]; class A { public: - int field; + int32_t field; char *s; A() : field(223344) diff --git a/gcc/testsuite/g++.dg/lto/20080908-1_0.C b/gcc/testsuite/g++.dg/lto/20080908-1_0.C index 42b20cb3b3a..92dec575f9b 100644 --- a/gcc/testsuite/g++.dg/lto/20080908-1_0.C +++ b/gcc/testsuite/g++.dg/lto/20080908-1_0.C @@ -1,16 +1,18 @@ /* { dg-lto-do run } */ extern "C" { extern void *memcpy (void *, const void *, __SIZE_TYPE__); } -inline int +typedef int int32_t __attribute__((mode (__SI__))); + +inline int32_t bci (const float &source) { - int dest; + int32_t dest; memcpy (&dest, &source, sizeof (dest)); return dest; } inline float -bcf (const int &source) +bcf (const int32_t &source) { float dest; memcpy (&dest, &source, sizeof (dest)); @@ -20,9 +22,9 @@ bcf (const int &source) float Foo () { - const int foo = bci (0.0f); - int bar = foo; - const int baz = foo & 1; + const int32_t foo = bci (0.0f); + int32_t bar = foo; + const int32_t baz = foo & 1; if (!baz && (foo & 2)) bar = 0; return bcf (bar); @@ -30,7 +32,10 @@ Foo () int main () { - if (Foo () != 0.0) - return 1; + if (sizeof (int32_t) == sizeof (float)) + { + if (Foo () != 0.0) + return 1; + } return 0; } diff --git a/gcc/testsuite/g++.dg/opt/pr55717.C b/gcc/testsuite/g++.dg/opt/pr55717.C index 7b3af589ee6..c03badd258f 100644 --- a/gcc/testsuite/g++.dg/opt/pr55717.C +++ b/gcc/testsuite/g++.dg/opt/pr55717.C @@ -2,6 +2,8 @@ // { dg-do compile } // { dg-options "-O -g" } +typedef unsigned uint32_t __attribute__((mode (__SI__))); + struct DebugOnly {}; template struct StripConst { typedef T result; }; @@ -90,7 +92,7 @@ bool IsScriptMarked (JSScript **); struct AllocationSiteKey { JSScript *script; - unsigned offset : 24; + uint32_t offset : 24; int kind; typedef AllocationSiteKey Lookup; static unsigned hash (AllocationSiteKey key) { return (long (key.script->code + key.offset)) ^ key.kind; } diff --git a/gcc/testsuite/g++.dg/opt/pr60597.C b/gcc/testsuite/g++.dg/opt/pr60597.C index c61f7679765..ee2a78b4962 100644 --- a/gcc/testsuite/g++.dg/opt/pr60597.C +++ b/gcc/testsuite/g++.dg/opt/pr60597.C @@ -2,44 +2,46 @@ // { dg-do compile } // { dg-options "-O2 -g" } +typedef int int32_t __attribute__((mode (__SI__))); + struct A { - int foo () const; - int bar () const; - int a; + int32_t foo () const; + int32_t bar () const; + int32_t a; }; struct B { - int foo (); - int bar (); + int32_t foo (); + int32_t bar (); }; -int *c, d; +int32_t *c, d; -int +int32_t A::foo () const { - int b = a >> 16; + int32_t b = a >> 16; return b; } -int +int32_t A::bar () const { - int b = a; + int32_t b = a; return b; } void -baz (A &x, B h, int i, int j) +baz (A &x, B h, int32_t i, int32_t j) { for (; i < h.bar (); ++i) for (; h.foo (); ++j) { - int g = x.foo (); - int f = x.bar (); - int e = c[0] & 1; + int32_t g = x.foo (); + int32_t f = x.bar (); + int32_t e = c[0] & 1; d = (e << 1) | (g << 16) | (f & 1); c[j] = 0; } diff --git a/gcc/testsuite/g++.dg/opt/pr81715.C b/gcc/testsuite/g++.dg/opt/pr81715.C index c38b22b7daa..522af3b5aa7 100644 --- a/gcc/testsuite/g++.dg/opt/pr81715.C +++ b/gcc/testsuite/g++.dg/opt/pr81715.C @@ -2,6 +2,7 @@ // { dg-do compile } // Verify the variables for inlined foo parameters are reused // { dg-options "-O2 -Wframe-larger-than=16384" } +// { dg-require-effective-target size20plus } struct S { int a, b, c, d, e; char f[1024]; }; void baz (int *, int *, int *, struct S *, int *, int *); diff --git a/gcc/testsuite/g++.dg/opt/reload3.C b/gcc/testsuite/g++.dg/opt/reload3.C index 12f3e66f369..daa7ffdbcef 100644 --- a/gcc/testsuite/g++.dg/opt/reload3.C +++ b/gcc/testsuite/g++.dg/opt/reload3.C @@ -4,6 +4,8 @@ #include +typedef unsigned uint32_t __attribute__((mode (__SI__))); + class QTime { public: @@ -15,7 +17,7 @@ private: unsigned ds; }; -static const unsigned MSECS_PER_DAY = 86400000; +static const uint32_t MSECS_PER_DAY = 86400000; QTime QTime::addMSecs(int ms) const { diff --git a/gcc/testsuite/g++.dg/opt/temp2.C b/gcc/testsuite/g++.dg/opt/temp2.C index 35520a2427c..533579a0599 100644 --- a/gcc/testsuite/g++.dg/opt/temp2.C +++ b/gcc/testsuite/g++.dg/opt/temp2.C @@ -1,4 +1,5 @@ // { dg-do run } +// { dg-require-effective-target size20plus } // Copyright (C) 2006 Free Software Foundation, Inc. diff --git a/gcc/testsuite/g++.dg/opt/thunk1.C b/gcc/testsuite/g++.dg/opt/thunk1.C index 566c0f2fcc5..cbda9187d5b 100644 --- a/gcc/testsuite/g++.dg/opt/thunk1.C +++ b/gcc/testsuite/g++.dg/opt/thunk1.C @@ -1,13 +1,14 @@ // PR 6788 // Test that the thunk adjusts the this pointer properly. // { dg-do run } +// { dg-require-effective-target size20plus } extern "C" void abort (); struct A { virtual void foo() = 0; - char large[33*1024]; + char large[33*1024U]; }; struct B diff --git a/gcc/testsuite/g++.dg/other/error23.C b/gcc/testsuite/g++.dg/other/error23.C index c60603e8ff5..81eec7ce7c7 100644 --- a/gcc/testsuite/g++.dg/other/error23.C +++ b/gcc/testsuite/g++.dg/other/error23.C @@ -1,5 +1,5 @@ // PR c++/34918 // { dg-do compile } -int v __attribute ((vector_size (8))); +int v __attribute ((vector_size (__SIZEOF_INT__ * 2))); bool b = !(v - v); // { dg-error "not convert .__vector.2. int. to .bool. in initialization" } diff --git a/gcc/testsuite/g++.dg/other/pr31078.C b/gcc/testsuite/g++.dg/other/pr31078.C index 7f610713084..3ea1af25042 100644 --- a/gcc/testsuite/g++.dg/other/pr31078.C +++ b/gcc/testsuite/g++.dg/other/pr31078.C @@ -1,4 +1,5 @@ -typedef int SLONG; +typedef int SLONG __attribute__((mode (__SI__))); + typedef char SCHAR; typedef short SSHORT; typedef char TEXT; diff --git a/gcc/testsuite/g++.dg/parse/concat1.C b/gcc/testsuite/g++.dg/parse/concat1.C index 7d19a7db84d..e5748c02eab 100644 --- a/gcc/testsuite/g++.dg/parse/concat1.C +++ b/gcc/testsuite/g++.dg/parse/concat1.C @@ -3,7 +3,7 @@ /* Intended as a compile-time test for string literal concatenation. */ -#define e0 "a" /* { dg-error "size of string literal is too large" "" { target { ! size32plus } } } */ +#define e0 "a" /* { dg-error "size of string literal is too large" "" { target { ! size20plus } } } */ #define e1 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 #define e2 e1 e1 e1 e1 e1 e1 e1 e1 e1 e1 #define e3 e2 e2 e2 e2 e2 e2 e2 e2 e2 e2 diff --git a/gcc/testsuite/g++.dg/parse/defarg5.C b/gcc/testsuite/g++.dg/parse/defarg5.C index 01a67ed5915..a81b3c4d391 100644 --- a/gcc/testsuite/g++.dg/parse/defarg5.C +++ b/gcc/testsuite/g++.dg/parse/defarg5.C @@ -6,10 +6,13 @@ // PR c++/12167 - infinite recursion +typedef int int32_t __attribute__((mode (__SI__))); +typedef unsigned uint32_t __attribute__((mode (__SI__))); + class A { - void report(int d + void report(int32_t d // the default arg is what NAN etc can expand to, but // with the floatiness removed. - = (__extension__ ((union { unsigned l; int d; }) + = (__extension__ ((union { uint32_t l; int32_t d; }) { l: 0x7fc00000U }).d)); }; diff --git a/gcc/testsuite/g++.dg/pr48484.C b/gcc/testsuite/g++.dg/pr48484.C index 19e9b9a8d0a..9dc6d1c4f21 100644 --- a/gcc/testsuite/g++.dg/pr48484.C +++ b/gcc/testsuite/g++.dg/pr48484.C @@ -2,9 +2,11 @@ /* { dg-options "-O -finline-functions -finline-small-functions -Wuninitialized" } */ /* { dg-add-options bind_pic_locally } */ +typedef int int32_t __attribute__((mode (__SI__))); + struct SQObjectPtr { - int _type; + int32_t _type; SQObjectPtr operator = (long); }; struct SQObjectPtrVec @@ -53,11 +55,11 @@ bool nrefidx = 0; switch (o1._type) { - case 0x02000000: + case 0x02000000L: o4 = nrefidx; jump = 1; return true; - case 0x00000080: + case 0x00000080L: { long idx = 10; diff --git a/gcc/testsuite/g++.dg/pr53037-2.C b/gcc/testsuite/g++.dg/pr53037-2.C index e617f9051f0..e716beed6ab 100644 --- a/gcc/testsuite/g++.dg/pr53037-2.C +++ b/gcc/testsuite/g++.dg/pr53037-2.C @@ -2,6 +2,8 @@ /* { dg-do compile } */ /* { dg-options "-O0 -Wpacked-not-aligned" } */ +typedef int int32_t __attribute__((mode (__SI__))); + struct __attribute__ ((aligned (8))) S8 { char a[8]; }; struct __attribute__ ((packed)) S1 { /* { dg-warning "alignment 1 of 'S1' is less than 8" } */ struct S8 s8; @@ -12,13 +14,13 @@ struct __attribute__ ((packed, aligned (8))) S2 { }; struct __attribute__ ((packed, aligned (8))) S3 { - int i1; + int32_t i1; struct S8 s8; /* { dg-warning "'S3::s8' offset 4 in 'S3' isn't aligned to 8" } */ }; struct __attribute__ ((packed, aligned (8))) S4 { - int i1; - int i2; + int32_t i1; + int32_t i2; struct S8 s8; }; @@ -27,11 +29,11 @@ struct __attribute__ ((packed)) S5 { }; union __attribute__ ((packed)) U1 { /* { dg-warning "alignment 1 of 'U1' is less than 8" } */ - int i1; + int32_t i1; struct S8 s8; }; union __attribute__ ((packed, aligned (8))) U2 { - int i1; + int32_t i1; struct S8 s8; }; diff --git a/gcc/testsuite/g++.dg/pr53037-3.C b/gcc/testsuite/g++.dg/pr53037-3.C index 1ed6354f677..c79268f7cc8 100644 --- a/gcc/testsuite/g++.dg/pr53037-3.C +++ b/gcc/testsuite/g++.dg/pr53037-3.C @@ -2,6 +2,8 @@ /* { dg-do compile } */ /* { dg-options "-O0 -Wall" } */ +typedef int int32_t __attribute__((mode (__SI__))); + struct __attribute__ ((aligned (8))) S8 { char a[8]; }; struct __attribute__ ((packed)) S1 { /* { dg-warning "alignment 1 of 'S1' is less than 8" } */ struct S8 s8; @@ -12,13 +14,13 @@ struct __attribute__ ((packed, aligned (8))) S2 { }; struct __attribute__ ((packed, aligned (8))) S3 { - int i1; + int32_t i1; struct S8 s8; /* { dg-warning "'S3::s8' offset 4 in 'S3' isn't aligned to 8" } */ }; struct __attribute__ ((packed, aligned (8))) S4 { - int i1; - int i2; + int32_t i1; + int32_t i2; struct S8 s8; }; @@ -27,11 +29,11 @@ struct __attribute__ ((packed)) S5 { }; union __attribute__ ((packed)) U1 { /* { dg-warning "alignment 1 of 'U1' is less than 8" } */ - int i1; + int32_t i1; struct S8 s8; }; union __attribute__ ((packed, aligned (8))) U2 { - int i1; + int32_t i1; struct S8 s8; }; diff --git a/gcc/testsuite/g++.dg/pr66655.C b/gcc/testsuite/g++.dg/pr66655.C index 218a2c63eb3..e4a40b02912 100644 --- a/gcc/testsuite/g++.dg/pr66655.C +++ b/gcc/testsuite/g++.dg/pr66655.C @@ -7,13 +7,13 @@ extern "C" void abort (void); #define COOKIE 0xabcd0123 -int +int32_t g (void) { return COOKIE; } -extern int f (void); +extern int32_t f (void); int main (void) diff --git a/gcc/testsuite/g++.dg/pr66655.h b/gcc/testsuite/g++.dg/pr66655.h index ff638f43970..c730fbad48e 100644 --- a/gcc/testsuite/g++.dg/pr66655.h +++ b/gcc/testsuite/g++.dg/pr66655.h @@ -1,5 +1,7 @@ +typedef int int32_t __attribute__((mode (__SI__))); + struct S { - static int i; - static void set (int ii) { i = -ii; } + static int32_t i; + static void set (int32_t ii) { i = -ii; } }; diff --git a/gcc/testsuite/g++.dg/pr66655_1.cc b/gcc/testsuite/g++.dg/pr66655_1.cc index d42344c4a04..96a10714cfc 100644 --- a/gcc/testsuite/g++.dg/pr66655_1.cc +++ b/gcc/testsuite/g++.dg/pr66655_1.cc @@ -1,13 +1,13 @@ #include "pr66655.h" -extern int g (void); +extern int32_t g (void); -int S::i; +int32_t S::i; -int +int32_t f (void) { - int ret = g (); + int32_t ret = g (); S::set (ret); return ret; diff --git a/gcc/testsuite/g++.dg/pr67351.C b/gcc/testsuite/g++.dg/pr67351.C index f5bdda6cca7..152d92af188 100644 --- a/gcc/testsuite/g++.dg/pr67351.C +++ b/gcc/testsuite/g++.dg/pr67351.C @@ -3,7 +3,7 @@ typedef unsigned char uchar; typedef unsigned short ushort; -typedef unsigned int uint; +typedef unsigned uint __attribute__((mode (__SI__))); typedef unsigned long long uint64; class MyRgba diff --git a/gcc/testsuite/g++.dg/template/array30.C b/gcc/testsuite/g++.dg/template/array30.C index 98723ace609..34f8a58aad8 100644 --- a/gcc/testsuite/g++.dg/template/array30.C +++ b/gcc/testsuite/g++.dg/template/array30.C @@ -1,7 +1,9 @@ -template +typedef int int32_t __attribute__((mode (__SI__))); + +template struct A { - int ar[I][I][I][I][I][I][I][I][I][I]; // { dg-error "exceeds maximum object size" } + int32_t ar[I][I][I][I][I][I][I][I][I][I]; // { dg-error "exceeds maximum object size" } }; A<66000> a; diff --git a/gcc/testsuite/g++.dg/template/constant1.C b/gcc/testsuite/g++.dg/template/constant1.C index a2c5a08d366..850d02ded0d 100644 --- a/gcc/testsuite/g++.dg/template/constant1.C +++ b/gcc/testsuite/g++.dg/template/constant1.C @@ -3,7 +3,13 @@ extern void foo(int); template void Basic() { +#if __SIZEOF_INT__ == 4 const int kT = 1.5e6; // <--- causes ICE +#elif __SIZEOF_INT__ == 2 + const int kT = 1.5e4; // <--- causes ICE +#elif __SIZEOF_INT__ == 1 + const int kT = 1.5e2; // <--- causes ICE +#endif int size = kT*2/3; do { foo(size); diff --git a/gcc/testsuite/g++.dg/template/constant2.C b/gcc/testsuite/g++.dg/template/constant2.C index f71e4f56a22..ddf16694c31 100644 --- a/gcc/testsuite/g++.dg/template/constant2.C +++ b/gcc/testsuite/g++.dg/template/constant2.C @@ -3,7 +3,13 @@ template class test { protected: +#if __SIZEOF_INT__ == 4 static const int versionConst = 0x80000000; +#elif __SIZEOF_INT__ == 2 + static const int versionConst = 0x8000; +#elif __SIZEOF_INT__ == 1 + static const int versionConst = 0x80; +#endif enum { versionEnum = versionConst }; public: int getVersion(); diff --git a/gcc/testsuite/g++.dg/template/friend18.C b/gcc/testsuite/g++.dg/template/friend18.C index 712d4889fea..a9c51788661 100644 --- a/gcc/testsuite/g++.dg/template/friend18.C +++ b/gcc/testsuite/g++.dg/template/friend18.C @@ -5,9 +5,11 @@ // PR 10158. implicit inline template friends ICE'd -template struct X +typedef int int32_t __attribute__((mode (__SI__))); + +template struct X { - template friend int foo(X const &, X const&) + template friend int32_t foo(X const &, X const&) { return N * 10000 + M; } diff --git a/gcc/testsuite/g++.dg/template/pr68978.C b/gcc/testsuite/g++.dg/template/pr68978.C index 19045329f01..cf91558847f 100644 --- a/gcc/testsuite/g++.dg/template/pr68978.C +++ b/gcc/testsuite/g++.dg/template/pr68978.C @@ -1,39 +1,41 @@ // PR c++/68978 -int i = 0, c = 0, radix = 10, max = 0x7fffffff; +typedef int int32_t __attribute__((mode (__SI__))); -template int toi_1() { +int32_t i = 0, c = 0, radix = 10, max = 0x7fffffff; + +template int32_t toi_1() { if (max < ((i *= radix) += c)) return 0; return i; } -template int toi_2() { +template int32_t toi_2() { if (max < ((i = radix) = c)) return 0; return i; } -template int toi_3() { +template int32_t toi_3() { if (max < ((i = radix) += c)) return 0; return i; } -template int toi_4() { +template int32_t toi_4() { if (max < ((i += radix) = c)) return 0; return i; } -template int toi_5() { +template int32_t toi_5() { if (max < (((i = radix) += (c += 5)) *= 30)) return 0; return i; } -int x = toi_1 (); -int y = toi_2 (); -int z = toi_3 (); -int w = toi_4 (); -int r = toi_5 (); +int32_t x = toi_1 (); +int32_t y = toi_2 (); +int32_t z = toi_3 (); +int32_t w = toi_4 (); +int32_t r = toi_5 (); diff --git a/gcc/testsuite/g++.dg/torture/pr37421.C b/gcc/testsuite/g++.dg/torture/pr37421.C index 4b8447eac49..c8cfd00cc15 100644 --- a/gcc/testsuite/g++.dg/torture/pr37421.C +++ b/gcc/testsuite/g++.dg/torture/pr37421.C @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target int_eq_float } */ #include #include diff --git a/gcc/testsuite/g++.dg/torture/pr88861.C b/gcc/testsuite/g++.dg/torture/pr88861.C index d2b6a4b7a47..ff66d5e1635 100644 --- a/gcc/testsuite/g++.dg/torture/pr88861.C +++ b/gcc/testsuite/g++.dg/torture/pr88861.C @@ -4,7 +4,11 @@ struct Ax { int n, a[]; }; +#if __SIZEOF_INT__ < 4 +int i = 12345; +#else int i = 12345678; +#endif int main() { static Ax s{456, i}; ((s.a[0]) ? (void)0 : (void)0); diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr19807.C b/gcc/testsuite/g++.dg/tree-ssa/pr19807.C index 6a3fff0d06d..7a9a2e09817 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/pr19807.C +++ b/gcc/testsuite/g++.dg/tree-ssa/pr19807.C @@ -11,7 +11,7 @@ void foo(void) z = 1 + &a[1]; } -/* { dg-final { scan-tree-dump-times "&MEM \\\[\\\(void .\\\)&a \\\+ 8B\\\]" 3 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "&MEM \\\[\\\(void .\\\)&a \\\+ (?:4|8)B\\\]" 3 "optimized" } } */ void bar(int i) diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr27291.C b/gcc/testsuite/g++.dg/tree-ssa/pr27291.C index c5407c5bff6..053b768fda6 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/pr27291.C +++ b/gcc/testsuite/g++.dg/tree-ssa/pr27291.C @@ -29,7 +29,7 @@ namespace std static const bool is_integer = true; }; }; -typedef unsigned int uint32_t; +typedef unsigned uint32_t __attribute__ ((__mode__ (__SI__))); namespace std { template < typename _Alloc > class allocator; @@ -69,8 +69,8 @@ namespace boost { }; } - template <> class integer_traits < int >:public std::numeric_limits < int >, - public detail::integer_traits_base < int, (-2147483647 - 1), 2147483647 > + template <> class integer_traits < int32_t >:public std::numeric_limits < int32_t >, + public detail::integer_traits_base < int32_t, (-2147483647 - 1), 2147483647 > { }; namespace random @@ -191,11 +191,11 @@ namespace boost private:UniformRandomNumberGenerator _rng; }; } - template < class RealType, int w, unsigned int p, - unsigned int q > class lagged_fibonacci_01 + template < class RealType, int32_t w, uint32_t p, + uint32_t q > class lagged_fibonacci_01 { public:typedef RealType result_type; - static const unsigned int long_lag = p; + static const uint32_t long_lag = p; lagged_fibonacci_01 () { seed (); @@ -210,7 +210,7 @@ namespace boost typedef detail::pass_through_engine < Generator & >ref_gen; uniform_01 < ref_gen, RealType > gen01 = uniform_01 < ref_gen, RealType > (ref_gen (gen)); - for (unsigned int j = 0; j < long_lag; ++j) + for (uint32_t j = 0; j < long_lag; ++j) x[j] = gen01 (); } RealType x[long_lag]; diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr49516.C b/gcc/testsuite/g++.dg/tree-ssa/pr49516.C index 2c6fd0496fc..e0e3c5be157 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/pr49516.C +++ b/gcc/testsuite/g++.dg/tree-ssa/pr49516.C @@ -3,25 +3,25 @@ extern "C" void abort (void); -typedef int int32; -typedef unsigned int uint32; -typedef unsigned long long uint64; -typedef short int16; +typedef int int32 __attribute__((mode (__SI__))); +typedef unsigned uint32 __attribute__((mode (__SI__))); +typedef unsigned uint64 __attribute__((mode (__DI__)));; +typedef int int16 __attribute__((mode (__HI__)));; class Tp { public: - Tp(int, const int segment, const int index) __attribute__((noinline)); + Tp(int32, const int32 segment, const int32 index) __attribute__((noinline)); inline bool operator==(const Tp& other) const; inline bool operator!=(const Tp& other) const; - int GetType() const { return type_; } - int GetSegment() const { return segment_; } - int GetIndex() const { return index_; } + int32 GetType() const { return type_; } + int32 GetSegment() const { return segment_; } + int32 GetIndex() const { return index_; } private: - inline static bool IsValidSegment(const int segment); - static const int kSegmentBits = 28; - static const int kTypeBits = 4; - static const int kMaxSegment = (1 << kSegmentBits) - 1; + inline static bool IsValidSegment(const int32 segment); + static const int32 kSegmentBits = 28; + static const int32 kTypeBits = 4; + static const int32 kMaxSegment = (1L << kSegmentBits) - 1; union { @@ -38,7 +38,7 @@ class Tp { }; }; -Tp::Tp(int t, const int segment, const int index) +Tp::Tp(int32 t, const int32 segment, const int32 index) : index_(index), segment_(segment), type_(t) {} inline bool Tp::operator==(const Tp& other) const { @@ -50,18 +50,18 @@ inline bool Tp::operator!=(const Tp& other) const { class Range { public: - inline Range(const Tp& position, const int count) __attribute__((always_inline)); + inline Range(const Tp& position, const int32 count) __attribute__((always_inline)); inline Tp GetBeginTokenPosition() const; inline Tp GetEndTokenPosition() const; private: Tp position_; - int count_; + int32 count_; int16 begin_index_; int16 end_index_; }; inline Range::Range(const Tp& position, - const int count) + const int32 count) : position_(position), count_(count), begin_index_(0), end_index_(0) { } diff --git a/gcc/testsuite/g++.dg/warn/Wconversion-integer.C b/gcc/testsuite/g++.dg/warn/Wconversion-integer.C index 42d9cb00044..2849e81595d 100644 --- a/gcc/testsuite/g++.dg/warn/Wconversion-integer.C +++ b/gcc/testsuite/g++.dg/warn/Wconversion-integer.C @@ -6,15 +6,18 @@ #include +typedef signed int int32_t __attribute__((mode (__SI__))); +typedef unsigned uint32_t __attribute__((mode (__SI__))); + void fsc (signed char sc); void fuc (unsigned char uc); -unsigned fui (unsigned int ui); -void fsi (signed int ui); +unsigned fui (uint32_t ui); +void fsi (int32_t ui); -void h (int x) +void h (int32_t x) { - unsigned int ui = 3; - int si = 3; + uint32_t ui = 3; + int32_t si = 3; unsigned char uc = 3; signed char sc = 3; diff --git a/gcc/testsuite/g++.dg/warn/Wconversion-null-2.C b/gcc/testsuite/g++.dg/warn/Wconversion-null-2.C index 98f5c405165..0f5bf58bd5d 100644 --- a/gcc/testsuite/g++.dg/warn/Wconversion-null-2.C +++ b/gcc/testsuite/g++.dg/warn/Wconversion-null-2.C @@ -3,9 +3,7 @@ #include -void g(int) {} -void g(long) {} -void g(long long) {} +void g(__INTPTR_TYPE__) {} extern void g(void*); template @@ -17,13 +15,7 @@ template void l(T); template <> -void l(int) {} - -template <> -void l(long) {} - -template <> -void l(long long) {} +void l(__INTPTR_TYPE__) {} void warn_for_NULL() { diff --git a/gcc/testsuite/g++.dg/warn/Wconversion-null.C b/gcc/testsuite/g++.dg/warn/Wconversion-null.C index e2ca13e514c..4cac2671116 100644 --- a/gcc/testsuite/g++.dg/warn/Wconversion-null.C +++ b/gcc/testsuite/g++.dg/warn/Wconversion-null.C @@ -3,9 +3,7 @@ #include -void g(int) {} -void g(long) {} -void g(long long) {} +void g(__INTPTR_TYPE__) {} extern void g(void*); template @@ -17,13 +15,7 @@ template void l(T); template <> -void l(int) {} - -template <> -void l(long) {} - -template <> -void l(long long) {} +void l(__INTPTR_TYPE__) {} int main() { diff --git a/gcc/testsuite/g++.dg/warn/Wconversion3.C b/gcc/testsuite/g++.dg/warn/Wconversion3.C index 71604f9a8e6..81682524fd5 100644 --- a/gcc/testsuite/g++.dg/warn/Wconversion3.C +++ b/gcc/testsuite/g++.dg/warn/Wconversion3.C @@ -19,7 +19,7 @@ void test1 (void) unsigned char f = (int) uc; signed char g = (int) sc; unsigned char h = (unsigned int) (short int) uc; - signed char i = (int) (unsigned short int) sc; // { dg-warning "may change value" } + signed char i = (int) (unsigned short int) sc; // { dg-warning "may change value" "" { target { ! short_eq_int } } } unsigned char j = (unsigned int) (short int) us; // { dg-warning "may change value" } signed char k = (int) (unsigned short int) ss; // { dg-warning "may change value" } } diff --git a/gcc/testsuite/g++.dg/warn/Wduplicated-branches1.C b/gcc/testsuite/g++.dg/warn/Wduplicated-branches1.C index 1553613f9ec..30cea63b1e9 100644 --- a/gcc/testsuite/g++.dg/warn/Wduplicated-branches1.C +++ b/gcc/testsuite/g++.dg/warn/Wduplicated-branches1.C @@ -6,7 +6,7 @@ template void f (signed char i, int *p) { - if (i) + if (i) // { dg-warning "this condition has identical branches" "" { target short_eq_int } } *p = (signed short) i; else *p = (unsigned short) i; diff --git a/gcc/testsuite/g++.dg/warn/Wplacement-new-size-5.C b/gcc/testsuite/g++.dg/warn/Wplacement-new-size-5.C index 0bed5771531..4afc7e503ab 100644 --- a/gcc/testsuite/g++.dg/warn/Wplacement-new-size-5.C +++ b/gcc/testsuite/g++.dg/warn/Wplacement-new-size-5.C @@ -11,17 +11,19 @@ void* operator new (__SIZE_TYPE__ n, void *p) { return p; } void* operator new[] (__SIZE_TYPE__ n, void *p) { return p; } +typedef int int32_t __attribute__((mode (__SI__))); + struct A { }; char carr[2]; -int iarr[2]; +int32_t iarr[2]; struct C0 { char i, carr[0]; }; -struct I0 { int i, iarr[0]; }; +struct I0 { int32_t i, iarr[0]; }; struct CX { char i, carr[]; }; -struct IX { int i, iarr[]; }; +struct IX { int32_t i, iarr[]; }; -void test_single (C0 *pc, CX *qc, I0 *pi, IX *qi, int n) +void test_single (C0 *pc, CX *qc, I0 *pi, IX *qi, int32_t n) { new (&carr[DIFF_MIN]) A (); // { dg-warning "placement new constructing an object of type .A. and size .1. in a region of type .char \\\[2]. and size .0." } new (&carr[-1]) A; // { dg-warning "\\\[-Wplacement-new" } diff --git a/gcc/testsuite/g++.dg/warn/Wplacement-new-size.C b/gcc/testsuite/g++.dg/warn/Wplacement-new-size.C index 2bafff34577..48d6b15656a 100644 --- a/gcc/testsuite/g++.dg/warn/Wplacement-new-size.C +++ b/gcc/testsuite/g++.dg/warn/Wplacement-new-size.C @@ -3,6 +3,8 @@ typedef __typeof__ (sizeof 0) size_t; +typedef int int32_t __attribute__((mode (__SI__))); + void* operator new (size_t, void *p) { return p; } void* operator new[] (size_t, void *p) { return p; } @@ -31,7 +33,7 @@ static __attribute__ ((used))struct SAC2 { char ac [2]; } sac2; static __attribute__ ((used))struct SAC3 { char ac [3]; } sac3; static __attribute__ ((used))struct SAC4 { char ac [4]; } sac4; -static __attribute__ ((used))struct SSC { SC sc; int x; } ssc; +static __attribute__ ((used))struct SSC { SC sc; int32_t x; } ssc; static __attribute__ ((used))struct SSAC1 { SAC1 sac; } ssac1; static __attribute__ ((used))struct SSAC2 { SAC2 sac; } ssac2; static __attribute__ ((used))struct SSAC3 { SAC3 sac; } ssac3; @@ -55,7 +57,7 @@ static __attribute__ ((used))void *r; static __attribute__ ((used))void* ptr () { return 0; } static __attribute__ ((used)) -void test (void *p, int n) +void test (void *p, int32_t n) { { void *q = p; @@ -167,83 +169,83 @@ void test (void *p, int n) new (ac8) char [2][2][2]; new (ac8) char [2][2][3]; // { dg-warning "placement" } - new (&c) int; // { dg-warning "placement" } + new (&c) int32_t; // { dg-warning "placement" } - new (&ac1) int; // { dg-warning "placement" } - new (&ac2) int; // { dg-warning "placement" } - new (&ac3) int; // { dg-warning "placement" } - new (&ac4) int; + new (&ac1) int32_t; // { dg-warning "placement" } + new (&ac2) int32_t; // { dg-warning "placement" } + new (&ac3) int32_t; // { dg-warning "placement" } + new (&ac4) int32_t; // Constructing at an address of an array element. - new (&ac1 [0]) int; // { dg-warning "placement" } - new (&ac2 [0]) int; // { dg-warning "placement" } - new (&ac3 [0]) int; // { dg-warning "placement" } - new (&ac4 [0]) int; + new (&ac1 [0]) int32_t; // { dg-warning "placement" } + new (&ac2 [0]) int32_t; // { dg-warning "placement" } + new (&ac3 [0]) int32_t; // { dg-warning "placement" } + new (&ac4 [0]) int32_t; // ...plus or minus a constant offset. - new (&ac1 [0] + 0) int; // { dg-warning "placement" } - new (&ac2 [0] + 0) int; // { dg-warning "placement" } - new (&ac3 [0] + 0) int; // { dg-warning "placement" } - new (&ac4 [0] + 0) int; - new (&ac4 [1] + 0) int; // { dg-warning "placement" } - new (&ac4 [1] - 1) int; - new (&ac4 [2] - 1) int; // { dg-warning "placement" } - new (&ac4 [2] - 2) int; - new (&ac4 [3] - 1) int; // { dg-warning "placement" } - new (&ac4 [3] - 2) int; // { dg-warning "placement" } - new (&ac4 [3] - 3) int; - new (&ac4 [4] - 1) int; // { dg-warning "placement" } - new (&ac4 [4] - 2) int; // { dg-warning "placement" } - new (&ac4 [4] - 3) int; // { dg-warning "placement" } - new (&ac4 [4] - 4) int; - - new (&ac1 [0] + 1) int; // { dg-warning "placement" } - new (&ac2 [0] + 1) int; // { dg-warning "placement" } - new (&ac3 [0] + 1) int; // { dg-warning "placement" } - new (&ac4 [0] + 1) int; // { dg-warning "placement" } - - new (&ac3 [0] + n) int; // { dg-warning "placement" } - new (&ac4 [0] + n) int; // no warning (n could be zero) - new (&ac4 [1] + n) int; // no warning (n could be negative) - new (&ac4 [2] + n) int; // ditto - new (&ac4 [3] + n) int; // ditto - new (&ac4 [4] + n) int; // ditto - new (&ac4 [4] - n) int; // (or positive) - - new (&c + 0) int; // { dg-warning "placement" } - new (&c + 1) int; // { dg-warning "placement" } + new (&ac1 [0] + 0) int32_t; // { dg-warning "placement" } + new (&ac2 [0] + 0) int32_t; // { dg-warning "placement" } + new (&ac3 [0] + 0) int32_t; // { dg-warning "placement" } + new (&ac4 [0] + 0) int32_t; + new (&ac4 [1] + 0) int32_t; // { dg-warning "placement" } + new (&ac4 [1] - 1) int32_t; + new (&ac4 [2] - 1) int32_t; // { dg-warning "placement" } + new (&ac4 [2] - 2) int32_t; + new (&ac4 [3] - 1) int32_t; // { dg-warning "placement" } + new (&ac4 [3] - 2) int32_t; // { dg-warning "placement" } + new (&ac4 [3] - 3) int32_t; + new (&ac4 [4] - 1) int32_t; // { dg-warning "placement" } + new (&ac4 [4] - 2) int32_t; // { dg-warning "placement" } + new (&ac4 [4] - 3) int32_t; // { dg-warning "placement" } + new (&ac4 [4] - 4) int32_t; + + new (&ac1 [0] + 1) int32_t; // { dg-warning "placement" } + new (&ac2 [0] + 1) int32_t; // { dg-warning "placement" } + new (&ac3 [0] + 1) int32_t; // { dg-warning "placement" } + new (&ac4 [0] + 1) int32_t; // { dg-warning "placement" } + + new (&ac3 [0] + n) int32_t; // { dg-warning "placement" } + new (&ac4 [0] + n) int32_t; // no warning (n could be zero) + new (&ac4 [1] + n) int32_t; // no warning (n could be negative) + new (&ac4 [2] + n) int32_t; // ditto + new (&ac4 [3] + n) int32_t; // ditto + new (&ac4 [4] + n) int32_t; // ditto + new (&ac4 [4] - n) int32_t; // (or positive) + + new (&c + 0) int32_t; // { dg-warning "placement" } + new (&c + 1) int32_t; // { dg-warning "placement" } // Constructing at an offset into the address of an array. - new (&ac1 + 0) int; // { dg-warning "placement" } - new (&ac1 + 1) int; // { dg-warning "placement" } - new (&ac1 + n) int; // { dg-warning "placement" } - new (&ac2 + 0) int; // { dg-warning "placement" } - new (&ac2 + 1) int; // { dg-warning "placement" } - new (&ac2 + n) int; // { dg-warning "placement" } - new (&ac3 + 0) int; // { dg-warning "placement" } - new (&ac3 + 1) int; // { dg-warning "placement" } + new (&ac1 + 0) int32_t; // { dg-warning "placement" } + new (&ac1 + 1) int32_t; // { dg-warning "placement" } + new (&ac1 + n) int32_t; // { dg-warning "placement" } + new (&ac2 + 0) int32_t; // { dg-warning "placement" } + new (&ac2 + 1) int32_t; // { dg-warning "placement" } + new (&ac2 + n) int32_t; // { dg-warning "placement" } + new (&ac3 + 0) int32_t; // { dg-warning "placement" } + new (&ac3 + 1) int32_t; // { dg-warning "placement" } // Even though n below is uknown an array of 3 bytes isn't large - // enugh for an int. - new (&ac3 + n) int; // { dg-warning "placement" } + // enugh for an int32_t. + new (&ac3 + n) int32_t; // { dg-warning "placement" } - new (&ac4 + 0) int; - new (&ac4 + 1) int; // { dg-warning "placement" } - new (&ac4 + n) int; // no warning (n could be zero) + new (&ac4 + 0) int32_t; + new (&ac4 + 1) int32_t; // { dg-warning "placement" } + new (&ac4 + n) int32_t; // no warning (n could be zero) // Constructing in an array object. - new (ac1) int; // { dg-warning "placement" } - new (ac2) int; // { dg-warning "placement" } - new (ac3) int; // { dg-warning "placement" } - new (ac4) int; - new (ac5) int; - new (ac5 + 0) int; - new (ac5 + 1) int; - new (ac5 + n) int; // no warning (n could be zero) - new (ac5 + 2) int; // { dg-warning "placement" } - new (ac5 + 3) int; // { dg-warning "placement" } - new (ac5 + 4) int; // { dg-warning "placement" } - new (ac5 + 5) int; // { dg-warning "placement" } + new (ac1) int32_t; // { dg-warning "placement" } + new (ac2) int32_t; // { dg-warning "placement" } + new (ac3) int32_t; // { dg-warning "placement" } + new (ac4) int32_t; + new (ac5) int32_t; + new (ac5 + 0) int32_t; + new (ac5 + 1) int32_t; + new (ac5 + n) int32_t; // no warning (n could be zero) + new (ac5 + 2) int32_t; // { dg-warning "placement" } + new (ac5 + 3) int32_t; // { dg-warning "placement" } + new (ac5 + 4) int32_t; // { dg-warning "placement" } + new (ac5 + 5) int32_t; // { dg-warning "placement" } new (ac1_1) char; new (ac1_1) char[1]; @@ -278,65 +280,65 @@ void test (void *p, int n) new (ac2_2) char[4][2]; // { dg-warning "placement" } new (ac2_2) char[5]; // { dg-warning "placement" } - new (&s) int; // { dg-warning "placement" } - new (&as1) int; // { dg-warning "placement" } - new (&as2) int; + new (&s) int32_t; // { dg-warning "placement" } + new (&as1) int32_t; // { dg-warning "placement" } + new (&as2) int32_t; - new (as1) int; // { dg-warning "placement" } - new (as2) int; + new (as1) int32_t; // { dg-warning "placement" } + new (as2) int32_t; - new (&sc.c) int; // { dg-warning "placement" } - new (&sac1.ac) int; // { dg-warning "placement" } - new (&sac2.ac) int; // { dg-warning "placement" } - new (&sac3.ac) int; // { dg-warning "placement" } - new (&sac4.ac) int; + new (&sc.c) int32_t; // { dg-warning "placement" } + new (&sac1.ac) int32_t; // { dg-warning "placement" } + new (&sac2.ac) int32_t; // { dg-warning "placement" } + new (&sac3.ac) int32_t; // { dg-warning "placement" } + new (&sac4.ac) int32_t; new (sc.pc) char; - new (sc.pc) int; - new (sc.pc) int[1024]; - new (sc.pc + 0) int; - new (sc.pc + 0) int[2048]; - new (sc.pv) int; + new (sc.pc) int32_t; + new (sc.pc) int32_t[1024]; + new (sc.pc + 0) int32_t; + new (sc.pc + 0) int32_t[2048]; + new (sc.pv) int32_t; new (sc.pv) char[1024]; - new (sac1.ac) int; // { dg-warning "placement" } - new (sac2.ac) int; // { dg-warning "placement" } - new (sac3.ac) int; // { dg-warning "placement" } - new (sac4.ac) int; + new (sac1.ac) int32_t; // { dg-warning "placement" } + new (sac2.ac) int32_t; // { dg-warning "placement" } + new (sac3.ac) int32_t; // { dg-warning "placement" } + new (sac4.ac) int32_t; new (&ssc.sc) SSC; // { dg-warning "placement" } - new (&ssac1.sac) int; // { dg-warning "placement" } - new (&ssac2.sac) int; // { dg-warning "placement" } - new (&ssac3.sac) int; // { dg-warning "placement" } - new (&ssac4.sac) int; + new (&ssac1.sac) int32_t; // { dg-warning "placement" } + new (&ssac2.sac) int32_t; // { dg-warning "placement" } + new (&ssac3.sac) int32_t; // { dg-warning "placement" } + new (&ssac4.sac) int32_t; new (&sssac4_2) char[sizeof sssac4_2]; new (&sssac4_2) char[sizeof sssac4_2 + 1]; // { dg-warning "placement" } // taking the address of a temporary is allowed with -fpermissive - new (&fsc ().c) int; // { dg-warning "18:taking address|placement" } - new (&fasc1 ().ac) int; // { dg-warning "20:taking address|placement" } - new (&fasc2 ().ac) int; // { dg-warning "20:taking address|placement" } - new (&fasc3 ().ac) int; // { dg-warning "20:taking address|placement" } - new (&fasc4 ().ac) int; // { dg-warning "20:taking address|placement" } - - new (&uac1) int; // { dg-warning "placement" } - new (&uac2) int; // { dg-warning "placement" } - new (&uac3) int; // { dg-warning "placement" } - new (&uac4) int; - new (&uac4 + 1) int; // { dg-warning "placement" } - - new (&uac1.c) int; // { dg-warning "placement" } - new (&uac2.c) int; // { dg-warning "placement" } - new (&uac3.c) int; // { dg-warning "placement" } + new (&fsc ().c) int32_t; // { dg-warning "18:taking address|placement" } + new (&fasc1 ().ac) int32_t; // { dg-warning "20:taking address|placement" } + new (&fasc2 ().ac) int32_t; // { dg-warning "20:taking address|placement" } + new (&fasc3 ().ac) int32_t; // { dg-warning "20:taking address|placement" } + new (&fasc4 ().ac) int32_t; // { dg-warning "20:taking address|placement" } + + new (&uac1) int32_t; // { dg-warning "placement" } + new (&uac2) int32_t; // { dg-warning "placement" } + new (&uac3) int32_t; // { dg-warning "placement" } + new (&uac4) int32_t; + new (&uac4 + 1) int32_t; // { dg-warning "placement" } + + new (&uac1.c) int32_t; // { dg-warning "placement" } + new (&uac2.c) int32_t; // { dg-warning "placement" } + new (&uac3.c) int32_t; // { dg-warning "placement" } // Diagnose the following even though the size of uac4.c could be // expected to extend to the end of the union (as it is by Built-in // Object Size and so isn't diagnosed in calls to functions like - // memset(&uac4.c, 0, sizeof(int)) when _FORTIFY_SOURCE is non-zero. */ - new (&uac4.c) int; // { dg-warning "placement" } + // memset(&uac4.c, 0, sizeof(int32_t)) when _FORTIFY_SOURCE is non-zero. */ + new (&uac4.c) int32_t; // { dg-warning "placement" } - new (&uac4.c + 1) int; // { dg-warning "placement" } + new (&uac4.c + 1) int32_t; // { dg-warning "placement" } } @@ -344,7 +346,7 @@ struct S { char c [2]; }; // Verify the full text of the warning message. static __attribute__ ((used)) -void test_message (int i) +void test_message (int32_t i) { char a [2]; @@ -364,7 +366,7 @@ void test_message (int i) struct ClassWithMemberNew { - struct Object { int i; } *pobj; + struct Object { int32_t i; } *pobj; unsigned nobj; ClassWithMemberNew (); @@ -382,7 +384,7 @@ void ClassWithMemberNew::foo() struct ClassWithGlobalNew { - int a [4]; + int32_t a [4]; ClassWithGlobalNew (); }; @@ -425,16 +427,16 @@ extern TemplateClass exttempl_void; static __attribute__ ((used)) void test_extern_buffer_of_unknown_size () { - new (extbuf) int (); - new (extbuf) int [1024]; + new (extbuf) int32_t (); + new (extbuf) int32_t [1024]; - new (&exttempl_void) int (); - new (&exttempl_void) int [1024]; + new (&exttempl_void) int32_t (); + new (&exttempl_void) int32_t [1024]; } -extern char extbuf_size_int [sizeof (int)]; +extern char extbuf_size_int [sizeof (int32_t)]; -extern TemplateClass exttempl; +extern TemplateClass exttempl; // Verify that a warning is issued as expected when placement new is // called with an extern buffer of known size (and the case is handled @@ -442,14 +444,14 @@ extern TemplateClass exttempl; static __attribute__ ((used)) void test_extern_buffer () { - new (extbuf_size_int) int (); - new (extbuf_size_int) int [1]; + new (extbuf_size_int) int32_t (); + new (extbuf_size_int) int32_t [1]; - struct S { int a [2]; }; + struct S { int32_t a [2]; }; new (extbuf_size_int) S; // { dg-warning "placement" } - new (extbuf_size_int) int [2]; // { dg-warning "placement" } + new (extbuf_size_int) int32_t [2]; // { dg-warning "placement" } - new (&exttempl) int (); // { dg-warning "placement" } - new (&exttempl) int [1024]; // { dg-warning "placement" } + new (&exttempl) int32_t (); // { dg-warning "placement" } + new (&exttempl) int32_t [1024]; // { dg-warning "placement" } } diff --git a/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-5.C b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-5.C index a0492511865..84c493c435f 100644 --- a/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-5.C +++ b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-5.C @@ -1,9 +1,11 @@ /* { dg-do compile } */ /* { dg-options "-Wstrict-aliasing=2 -O2" } */ +typedef unsigned uint32_t __attribute__((mode (__SI__))); + float foo () { - unsigned int MASK = 0x80000000; + uint32_t MASK = 0x80000000; return (float &) MASK; /* { dg-warning "strict-aliasing" } */ } diff --git a/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-signed-unsigned.C b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-signed-unsigned.C index 5e71ebff805..971e535590c 100644 --- a/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-signed-unsigned.C +++ b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-signed-unsigned.C @@ -1,10 +1,12 @@ /* { dg-do compile } */ /* { dg-options "-O2 -Wstrict-aliasing -fstrict-aliasing" } */ +typedef int int32_t __attribute__((mode (__SI__))); +typedef unsigned uint32_t __attribute__((mode (__SI__))); -int foo () { - int i; - unsigned int* pu = reinterpret_cast (&i); /* { dg-bogus "signed vs. unsigned" } */ +int32_t foo () { + int32_t i; + uint32_t* pu = reinterpret_cast (&i); /* { dg-bogus "signed vs. unsigned" } */ *pu = 1000000; return i; } diff --git a/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C b/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C index 99e1e89b4b7..813cefc2f70 100644 --- a/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C +++ b/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C @@ -22,10 +22,14 @@ void a (unsigned char x) void b (unsigned short x) { - if (x < 0) return;/* { dg-warning "comparison is always false due to limited range of data type" } */ - if (x >= 0) return;/* { dg-warning "comparison is always true due to limited range of data type" } */ - if (0 > x) return;/* { dg-warning "comparison is always false due to limited range of data type" } */ - if (0 <= x) return;/* { dg-warning "comparison is always true due to limited range of data type" } */ + if (x < 0) return;/* { dg-warning "comparison is always false due to limited range of data type" "" { target { ! short_eq_int } } } */ + /* { dg-warning "comparison of unsigned expression in '< 0' is always false" "" { target short_eq_int } .-1 } */ + if (x >= 0) return;/* { dg-warning "comparison is always true due to limited range of data type" "" { target { ! short_eq_int } } } */ + /* { dg-warning "comparison of unsigned expression in '>= 0' is always true" "" { target short_eq_int } .-1 } */ + if (0 > x) return;/* { dg-warning "comparison is always false due to limited range of data type" "" { target { ! short_eq_int } } } */ + /* { dg-warning "comparison of unsigned expression in '< 0' is always false" "" { target short_eq_int } .-1 } */ + if (0 <= x) return;/* { dg-warning "comparison is always true due to limited range of data type" "" { target { ! short_eq_int } } } */ + /* { dg-warning "comparison of unsigned expression in '>= 0' is always true" "" { target short_eq_int } .-1 } */ } void c (unsigned int x) diff --git a/gcc/testsuite/g++.dg/warn/Wtype-limits.C b/gcc/testsuite/g++.dg/warn/Wtype-limits.C index 6a968d953db..104f53c7b56 100644 --- a/gcc/testsuite/g++.dg/warn/Wtype-limits.C +++ b/gcc/testsuite/g++.dg/warn/Wtype-limits.C @@ -22,10 +22,14 @@ void a (unsigned char x) void b (unsigned short x) { - if (x < 0) return;/* { dg-warning "comparison is always false due to limited range of data type" } */ - if (x >= 0) return;/* { dg-warning "comparison is always true due to limited range of data type" } */ - if (0 > x) return;/* { dg-warning "comparison is always false due to limited range of data type" } */ - if (0 <= x) return;/* { dg-warning "comparison is always true due to limited range of data type" } */ + if (x < 0) return;/* { dg-warning "comparison is always false due to limited range of data type" "" { target { ! short_eq_int } } } */ + /* { dg-warning "comparison of unsigned expression in '< 0' is always false" "" { target short_eq_int } .-1 } */ + if (x >= 0) return;/* { dg-warning "comparison is always true due to limited range of data type" "" { target { ! short_eq_int } } } */ + /* { dg-warning "comparison of unsigned expression in '>= 0' is always true" "" { target short_eq_int } .-1 } */ + if (0 > x) return;/* { dg-warning "comparison is always false due to limited range of data type" "" { target { ! short_eq_int } } } */ + /* { dg-warning "comparison of unsigned expression in '< 0' is always false" "" { target short_eq_int } .-1 } */ + if (0 <= x) return;/* { dg-warning "comparison is always true due to limited range of data type" "" { target { ! short_eq_int } } } */ + /* { dg-warning "comparison of unsigned expression in '>= 0' is always true" "" { target short_eq_int } .-1 } */ } void c (unsigned int x) diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/enum11.C b/gcc/testsuite/g++.old-deja/g++.brendan/enum11.C index fda718b4f7e..2979c77718f 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/enum11.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/enum11.C @@ -1,5 +1,6 @@ // { dg-do assemble } // GROUPS passed enums +typedef unsigned uint32_t __attribute__((mode (__SI__))); class X { enum @@ -8,7 +9,7 @@ class X twoMask = 0x000F0000, thiMask = 0xFFF00000, // { dg-error "comma at end" "" { target { ! c++11 } } } }; - unsigned int foo; + uint32_t foo; public: X (int) : foo (oneMask | twoMask ) {} // No warning diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900227_01.C b/gcc/testsuite/g++.old-deja/g++.bugs/900227_01.C index c42557a5c16..453eb540ca2 100644 --- a/gcc/testsuite/g++.old-deja/g++.bugs/900227_01.C +++ b/gcc/testsuite/g++.old-deja/g++.bugs/900227_01.C @@ -33,7 +33,7 @@ int main (); -short s = (short) &main; // { dg-error "11:cast \[^\n\r]* loses precision" "lose" { xfail h8*-*-* xstormy16-*-* } } +short s = (short) &main; // { dg-error "11:cast \[^\n\r]* loses precision" "lose" { target { ! ptr_eq_short } } } char c = (char) &main; // { dg-error "10:cast \[^\n\r]* loses precision" "lose" } int main () { return 0; } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/ns15.C b/gcc/testsuite/g++.old-deja/g++.mike/ns15.C index 7768f698e37..b4cf044a80b 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/ns15.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/ns15.C @@ -1,5 +1,6 @@ // { dg-do assemble } // { dg-xfail-if "" { xstormy16-*-* } } +// { dg-require-effective-target size20plus } #include #include diff --git a/gcc/testsuite/g++.old-deja/g++.other/exprstmt1.C b/gcc/testsuite/g++.old-deja/g++.other/exprstmt1.C index abe072999d1..5970cb21b62 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/exprstmt1.C +++ b/gcc/testsuite/g++.old-deja/g++.other/exprstmt1.C @@ -3,23 +3,22 @@ // { dg-error "limited range of data type" "16-bit target" { target xstormy16-*-* } 0 } // { dg-error "shift count >=" "16-bit target" { target xstormy16-*-* } 0 } +typedef unsigned uint32_t __attribute__((mode (__SI__))); + int main() { - unsigned int x = 1381237248; - - if (sizeof (x) != 4) - return 0; + uint32_t x = 1381237248; x = ({ - unsigned int y = x; + uint32_t y = x; ({ - unsigned int z = y; - (unsigned int) - ((((unsigned int)z & (unsigned int)0x000000ffUL) << 24) - | (((unsigned int)z & (unsigned int)0x0000ff00UL) << 8) - | (((unsigned int)z & (unsigned int)0x00ff0000UL) >> 8) - | (((unsigned int)z & (unsigned int)0xff000000UL) >> 24)); + uint32_t z = y; + (uint32_t) + ((((uint32_t)z & (uint32_t)0x000000ffUL) << 24) + | (((uint32_t)z & (uint32_t)0x0000ff00UL) << 8) + | (((uint32_t)z & (uint32_t)0x00ff0000UL) >> 8) + | (((uint32_t)z & (uint32_t)0xff000000UL) >> 24)); }); }); return x != 152658; diff --git a/gcc/testsuite/g++.old-deja/g++.other/inline12.C b/gcc/testsuite/g++.old-deja/g++.other/inline12.C index c91845c411e..5702141babe 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/inline12.C +++ b/gcc/testsuite/g++.old-deja/g++.other/inline12.C @@ -4,7 +4,7 @@ // Origin: Hans-Peter Nilsson // See -typedef unsigned int udword; +typedef unsigned udword __attribute__((mode (__SI__))); extern "C" { void __assert (const char *, int, const char *); } diff --git a/gcc/testsuite/g++.old-deja/g++.other/new6.C b/gcc/testsuite/g++.old-deja/g++.other/new6.C index 7013337b21b..a3a98a722e2 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/new6.C +++ b/gcc/testsuite/g++.old-deja/g++.other/new6.C @@ -5,8 +5,10 @@ using namespace std; extern "C" void *malloc (size_t); -int special; -int space = 0xdeadbeef; +typedef int int32_t __attribute__((mode (__SI__))); + +int32_t special; +int32_t space = 0xdeadbeef; void *operator new (size_t size) #if __cplusplus <= 199711L @@ -21,7 +23,7 @@ void *operator new (size_t size) int main () { special = 1; - int *p = new int(); + int32_t *p = new int32_t(); special = 0; return *p != 0; } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash16.C b/gcc/testsuite/g++.old-deja/g++.pt/crash16.C index 30bd0cc2dd5..1ac630bc01f 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/crash16.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash16.C @@ -1,6 +1,7 @@ // { dg-do assemble } // { dg-xfail-if "" { xstormy16-*-* } } // { dg-options "" } +// { dg-skip-if "16-bit int overflow" int16 } extern "C" void qsort(void *base, __SIZE_TYPE__ nmemb, __SIZE_TYPE__ size, int (*compar)(const void *, const void *)); diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb76.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb76.C index 3125dc15f34..8109a2f0eaa 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb76.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb76.C @@ -1,5 +1,6 @@ // { dg-do assemble } // { dg-options "-fno-short-enums" } +// { dg-skip-if "" int16 } // the template operator!= interferes. It should be in a namespace. #include diff --git a/gcc/testsuite/g++.old-deja/g++.warn/flow1.C b/gcc/testsuite/g++.old-deja/g++.warn/flow1.C index 61f6a554970..fa2b3e5cd1a 100644 --- a/gcc/testsuite/g++.old-deja/g++.warn/flow1.C +++ b/gcc/testsuite/g++.old-deja/g++.warn/flow1.C @@ -2,13 +2,15 @@ // { dg-options "-Wreturn-type" } // Test that we don't get a warning about flowing off the end. +typedef int int32_t __attribute__((mode (__SI__))); + struct A { ~A (); }; -int f() +int32_t f() { A a1[2]; A a2[2]; - return 1234567; + return 1234567L; } diff --git a/gcc/testsuite/gcc.dg/Walloca-14.c b/gcc/testsuite/gcc.dg/Walloca-14.c index 657402f3891..51362b2d6be 100644 --- a/gcc/testsuite/gcc.dg/Walloca-14.c +++ b/gcc/testsuite/gcc.dg/Walloca-14.c @@ -2,7 +2,8 @@ /* { dg-do compile } */ /* { dg-require-effective-target alloca } */ /* { dg-skip-if "small address space" { "pdp11-*-*" } } */ -/* { dg-options "-O2 -Walloca-larger-than=126812070" } */ +/* { dg-options "-O2 -Walloca-larger-than=126812070" { target ptr32plus } } */ +/* { dg-options "-O2 -Walloca-larger-than=12070" { target { ! ptr32plus } } } */ void g (int *p) diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-32.c b/gcc/testsuite/gcc.dg/Warray-bounds-32.c index 54b09bc9b98..9b5f3331735 100644 --- a/gcc/testsuite/gcc.dg/Warray-bounds-32.c +++ b/gcc/testsuite/gcc.dg/Warray-bounds-32.c @@ -150,8 +150,8 @@ void wide_ptr_index_range_chain (void) T (p3[0]); /* { dg-warning "array subscript \\\[3, 6] is outside array bounds of .\[a-z \]+\\\[3]." } */ T (p3[1]); /* { dg-warning "array subscript \\\[4, 7] is outside array bounds of .\[a-z \]+\\\[3]." } */ - T (p3[9999]); /* { dg-warning "array subscript \\\[10002, 10005] is outside array bounds of .\[a-z \]+\\\[3]." } */ - + T (p3[9999]); /* { dg-warning "array subscript \\\[10002, 10005] is outside array bounds of .\[a-z \]+\\\[3]." "" { target size20plus} } */ + /* { dg-warning "array subscript \\\[-6382, -6379] is outside array bounds of .\[a-z \]+\\\[3]." "" { target { ! size20plus } } .-1 } */ /* Large offsets are indistinguishable from negative values. */ T (p3[DIFF_MAX]); /* { dg-warning "array subscript" "bug" { xfail *-*-* } } */ } diff --git a/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-4.c b/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-4.c index 856166c6673..e845b43c073 100644 --- a/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-4.c +++ b/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-4.c @@ -41,7 +41,7 @@ void test_integer_conversion_abs (void) i = abs (uc); i = abs (si); - i = abs (usi); + i = abs (usi); /* { dg-warning ".abs. argument 1 promotes to .unsigned int. where .int. is expected in a call to built-in function declared without prototype" "" { target short_eq_int } } */ i = abs (i); i = abs (ui); /* { dg-warning ".abs. argument 1 type is .unsigned int. where .int. is expected in a call to built-in function declared without prototype" } */ @@ -77,9 +77,9 @@ void test_integer_conversion_memset (void *d) /* Passing a ptrdiff_t where size_t is expected may not be unsafe but because GCC may emits suboptimal code for such calls warning for them helps improve efficiency. */ - memset (d, 0, diffi); /* { dg-warning ".memset. argument 3 promotes to .ptrdiff_t. {aka .\(long \)?int.} where .\(long \)?unsigned int. is expected" } */ + memset (d, 0, diffi); /* { dg-warning ".memset. argument 3 promotes to .ptrdiff_t. {aka .\(long \)?\(int\)?\(__int20\)?.} where .\(long \)?\(__int20 \)?unsigned\( int\)?. is expected" } */ - memset (d, 0, 2.0); /* { dg-warning ".memset. argument 3 type is .double. where '\(long \)?unsigned int' is expected" } */ + memset (d, 0, 2.0); /* { dg-warning ".memset. argument 3 type is .double. where '\(long \)?\(__int20 \)?unsigned\( int\)?' is expected" } */ /* Verify that the same call as above but to the built-in doesn't trigger a warning. */ diff --git a/gcc/testsuite/gcc.dg/concat2.c b/gcc/testsuite/gcc.dg/concat2.c index e9fa216d63d..62f45d4880b 100644 --- a/gcc/testsuite/gcc.dg/concat2.c +++ b/gcc/testsuite/gcc.dg/concat2.c @@ -11,4 +11,4 @@ #define e4 e3 e3 e3 e3 e3 e3 e3 e3 e3 e3 #define e5 e4 e4 e4 e4 e4 e4 e4 e4 e4 e4 -void foo() { (void)(e5); } /* { dg-error "size of string literal is too large" "" { target { ! size32plus } } } */ +void foo() { (void)(e5); } /* { dg-error "size of string literal is too large" "" { target { ! size20plus } } } */ diff --git a/gcc/testsuite/gcc.dg/fold-convmaxconv-1.c b/gcc/testsuite/gcc.dg/fold-convmaxconv-1.c index 3ffff8bde42..f8157e9257c 100644 --- a/gcc/testsuite/gcc.dg/fold-convmaxconv-1.c +++ b/gcc/testsuite/gcc.dg/fold-convmaxconv-1.c @@ -1,9 +1,12 @@ /* { dg-do compile } */ /* { dg-options "-O -fdump-tree-optimized" } */ -int foo (short a[], int x) +typedef int int32_t __attribute__((mode (__SI__))); +typedef unsigned uint32_t __attribute__((mode (__SI__))); + +int32_t foo (short a[], int32_t x) { - unsigned int i; + uint32_t i; for (i = 0; i < 1000; i++) { x = a[i]; diff --git a/gcc/testsuite/gcc.dg/fold-convminconv-1.c b/gcc/testsuite/gcc.dg/fold-convminconv-1.c index f4a048e1f45..7070ecf337c 100644 --- a/gcc/testsuite/gcc.dg/fold-convminconv-1.c +++ b/gcc/testsuite/gcc.dg/fold-convminconv-1.c @@ -1,9 +1,12 @@ /* { dg-do compile } */ /* { dg-options "-O -fdump-tree-optimized" } */ -int foo (unsigned short a[], unsigned int x) +typedef int int32_t __attribute__((mode (__SI__))); +typedef unsigned uint32_t __attribute__((mode (__SI__))); + +int32_t foo (unsigned short a[], uint32_t x) { - unsigned int i; + uint32_t i; for (i = 0; i < 1000; i++) { x = a[i]; diff --git a/gcc/testsuite/gcc.dg/graphite/scop-4.c b/gcc/testsuite/gcc.dg/graphite/scop-4.c index eeaa7fa02bc..a691eeaf8f2 100644 --- a/gcc/testsuite/gcc.dg/graphite/scop-4.c +++ b/gcc/testsuite/gcc.dg/graphite/scop-4.c @@ -1,3 +1,5 @@ +/* { dg-require-effective-target size20plus } */ + void bar (); int toto() diff --git a/gcc/testsuite/gcc.dg/loop-versioning-1.c b/gcc/testsuite/gcc.dg/loop-versioning-1.c index 17e95fdfbab..2f2c1eeee72 100644 --- a/gcc/testsuite/gcc.dg/loop-versioning-1.c +++ b/gcc/testsuite/gcc.dg/loop-versioning-1.c @@ -45,7 +45,11 @@ f6 (double *x, int stepx, unsigned int limit) *y = 100; } +#if __SIZEOF_SIZE_T__ < 4 +double x[1000]; +#else double x[10000]; +#endif void g1 (int stepx, int n) diff --git a/gcc/testsuite/gcc.dg/loop-versioning-2.c b/gcc/testsuite/gcc.dg/loop-versioning-2.c index 3d07f83d205..d9a1a99aead 100644 --- a/gcc/testsuite/gcc.dg/loop-versioning-2.c +++ b/gcc/testsuite/gcc.dg/loop-versioning-2.c @@ -1,5 +1,5 @@ /* { dg-options "-O3 -fdump-tree-lversion-details" } */ -/* { dg-require-effective-target size32plus } */ +/* { dg-require-effective-target size20plus } */ /* Versioning for step == 1 in these loops would allow loop interchange, but otherwise isn't worthwhile. At the moment we decide not to version. */ diff --git a/gcc/testsuite/gcc.dg/lto/20081210-1_0.c b/gcc/testsuite/gcc.dg/lto/20081210-1_0.c index 80a1e9a2c03..8048b26b34e 100644 --- a/gcc/testsuite/gcc.dg/lto/20081210-1_0.c +++ b/gcc/testsuite/gcc.dg/lto/20081210-1_0.c @@ -1,10 +1,4 @@ -#if defined(_LP64) -typedef unsigned long int uintptr_t; -#elif defined (_WIN64) -typedef unsigned long long int uintptr_t; -#else -typedef unsigned int uintptr_t; -#endif +typedef __UINTPTR_TYPE__ uintptr_t; extern void srand (uintptr_t); diff --git a/gcc/testsuite/gcc.dg/lto/pr85870_0.c b/gcc/testsuite/gcc.dg/lto/pr85870_0.c index b57ac7c0d73..b1b71c63334 100644 --- a/gcc/testsuite/gcc.dg/lto/pr85870_0.c +++ b/gcc/testsuite/gcc.dg/lto/pr85870_0.c @@ -3,16 +3,18 @@ /* { dg-lto-options { { -flto -O2 } } } */ /* { dg-extra-ld-options { -r -nostdlib -flinker-output=nolto-rel } } */ +typedef unsigned uint32_t __attribute__((mode (__SI__))); + typedef struct abc_s { char a1; short a2; - unsigned int a3; - unsigned int a4; + uint32_t a3; + uint32_t a4; } abc; typedef struct xyz_s { - unsigned x1; - unsigned x2; + uint32_t x1; + uint32_t x2; abc *x3; } xyz; diff --git a/gcc/testsuite/gcc.dg/lto/pr85870_1.c b/gcc/testsuite/gcc.dg/lto/pr85870_1.c index cd1cd310164..c035bbb2fbe 100644 --- a/gcc/testsuite/gcc.dg/lto/pr85870_1.c +++ b/gcc/testsuite/gcc.dg/lto/pr85870_1.c @@ -1,14 +1,16 @@ +typedef unsigned uint32_t __attribute__((mode (__SI__))); + typedef struct abc_s { char a1; short a2; - unsigned int a3; - unsigned int a4; + uint32_t a3; + uint32_t a4; } abc; typedef struct xyz_s { - unsigned int x1; - unsigned int x2; + uint32_t x1; + uint32_t x2; abc *x3; } xyz; diff --git a/gcc/testsuite/gcc.dg/pr36227.c b/gcc/testsuite/gcc.dg/pr36227.c index 27fe0015505..ba0d7224939 100644 --- a/gcc/testsuite/gcc.dg/pr36227.c +++ b/gcc/testsuite/gcc.dg/pr36227.c @@ -1,14 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -Wstrict-overflow=3" } */ -#if (__SIZEOF_LONG_LONG__ == __SIZEOF_POINTER__) -typedef unsigned long long ptrcast; -#elif (__SIZEOF_LONG__ == __SIZEOF_POINTER__) -typedef unsigned long ptrcast; -#elif (__SIZEOF_INT__ == __SIZEOF_POINTER__) -typedef unsigned int ptrcast; -#else -#error Add target support here -#endif +typedef __UINTPTR_TYPE__ ptrcast; volatile unsigned long * sat_add(volatile unsigned long *ptr, unsigned long i, volatile unsigned long *end) diff --git a/gcc/testsuite/gcc.dg/pr42611.c b/gcc/testsuite/gcc.dg/pr42611.c index 0426ce2d5bc..f502feac337 100644 --- a/gcc/testsuite/gcc.dg/pr42611.c +++ b/gcc/testsuite/gcc.dg/pr42611.c @@ -3,7 +3,8 @@ /* { dg-options "" } */ #define L \ - (sizeof (__SIZE_TYPE__) == 1 ? __SCHAR_MAX__ \ + (sizeof (__SIZE_TYPE__) == sizeof (void *) ? __INTPTR_MAX__ \ + : sizeof (__SIZE_TYPE__) == 1 ? __SCHAR_MAX__ \ : sizeof (__SIZE_TYPE__) == sizeof (short) ? __SHRT_MAX__ \ : sizeof (__SIZE_TYPE__) == sizeof (int) ? __INT_MAX__ \ : sizeof (__SIZE_TYPE__) == sizeof (long) ? __LONG_MAX__ \ diff --git a/gcc/testsuite/gcc.dg/pr59963-2.c b/gcc/testsuite/gcc.dg/pr59963-2.c index f54a3126960..9344566fc87 100644 --- a/gcc/testsuite/gcc.dg/pr59963-2.c +++ b/gcc/testsuite/gcc.dg/pr59963-2.c @@ -32,6 +32,6 @@ foo (int i) -7, /* { dg-warning "15:-Wsign-conversion" } */ -8); /* { dg-warning "16:-Wsign-conversion" } */ bazu (i, i); /* { dg-warning "9:conversion" } */ - bazi (0x8, 0x80000000); /* { dg-warning "14:-Wsign-conversion" "first" { xfail int16 } } */ + bazi (0x8, 0x80000000); /* { dg-warning "14:-Wsign-conversion" "first" { target { ! int16 } } } */ /* { dg-warning "overflow in conversion from" "second" { target int16 } .-1 } */ } diff --git a/gcc/testsuite/gcc.dg/pr68317.c b/gcc/testsuite/gcc.dg/pr68317.c index 9ba6fb075e6..891d12954ba 100644 --- a/gcc/testsuite/gcc.dg/pr68317.c +++ b/gcc/testsuite/gcc.dg/pr68317.c @@ -1,15 +1,17 @@ /* { dg-do compile } */ /* { dg-options "-O2" } */ -void bar (int); +typedef int int32_t __attribute__((mode (__SI__))); + +void bar (int32_t); void foo () { - int index = 0; + int32_t index = 0; - for (index; index <= 10; index--) + for (index; index <= 10; index--) // expected warning here /* Result of the following multiply will overflow - when converted to signed int. */ + when converted to signed int32_t. */ bar ((0xcafe + index) * 0xdead); /* { dg-warning "iteration \[0-9\]+ invokes undefined behavior" } */ } diff --git a/gcc/testsuite/gcc.dg/pr78973.c b/gcc/testsuite/gcc.dg/pr78973.c index d0ecba49810..6f4f6437926 100644 --- a/gcc/testsuite/gcc.dg/pr78973.c +++ b/gcc/testsuite/gcc.dg/pr78973.c @@ -9,7 +9,7 @@ static void f (void *p, int n) { if (n <= 4) - __builtin_memset (p, 0, n); /* { dg-warning "exceeds maximum object size" "pr79073" { xfail ilp32 } } */ + __builtin_memset (p, 0, n); /* { dg-warning "exceeds maximum object size" "pr79073" { xfail { ilp32 || { int16 && { ! msp430_large } } } } } */ } void g (void *d, unsigned n) diff --git a/gcc/testsuite/gcc.dg/pr85859.c b/gcc/testsuite/gcc.dg/pr85859.c index b1476ba3806..7a57a09682c 100644 --- a/gcc/testsuite/gcc.dg/pr85859.c +++ b/gcc/testsuite/gcc.dg/pr85859.c @@ -15,6 +15,6 @@ int main (void) { b = (unsigned char) __builtin_parity (d); - e ? foo (0) : (long) &c; + e ? foo (0) : (__INTPTR_TYPE__) &c; return 0; } diff --git a/gcc/testsuite/gcc.dg/pr86179.c b/gcc/testsuite/gcc.dg/pr86179.c index 6a90f09e6e8..f3dd3675c06 100644 --- a/gcc/testsuite/gcc.dg/pr86179.c +++ b/gcc/testsuite/gcc.dg/pr86179.c @@ -1,14 +1,17 @@ /* { dg-do compile } */ /* { dg-options "-O3" } */ -void c(int *d, char *g) +typedef int int32_t __attribute__((mode (__SI__))); +typedef unsigned uint32_t __attribute__((mode (__SI__))); + +void c(int32_t *d, char *g) { char *a, *b, *e; int f; for (; f; f -= 8) { - *d++ = *e++ | (unsigned)*g++ << 8 | (unsigned)*b++ << 16 | - (unsigned)*a++ << 24; - *d++ = *e++ | (unsigned)*g++ << 8 | (unsigned)*b++ << 16 | - (unsigned)*a++ << 24; + *d++ = *e++ | (uint32_t)*g++ << 8 | (uint32_t)*b++ << 16 | + (uint32_t)*a++ << 24; + *d++ = *e++ | (uint32_t)*g++ << 8 | (uint32_t)*b++ << 16 | + (uint32_t)*a++ << 24; } } diff --git a/gcc/testsuite/gcc.dg/torture/20181024-1.c b/gcc/testsuite/gcc.dg/torture/20181024-1.c index a3cce24b873..9cc97a9033b 100644 --- a/gcc/testsuite/gcc.dg/torture/20181024-1.c +++ b/gcc/testsuite/gcc.dg/torture/20181024-1.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-require-effective-target size32plus } */ /* { dg-additional-options "-march=core-avx2" { target { x86_64-*-* i?86-*-* } } } */ +/* { dg-require-effective-target size32plus } */ typedef enum { C = 0, N, S, E, W, T, B, NE, NW, SE, SW, NT, NB, ST, SB, ET, EB, WT, WB, FLAGS, N_CELL_ENTRIES} CELL_ENTRIES; diff --git a/gcc/testsuite/gcc.dg/torture/pr71598-2.c b/gcc/testsuite/gcc.dg/torture/pr71598-2.c index 44b23f56663..8b57a50cb47 100644 --- a/gcc/testsuite/gcc.dg/torture/pr71598-2.c +++ b/gcc/testsuite/gcc.dg/torture/pr71598-2.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-prune-output "use of enum values across objects may fail" } */ /* { dg-additional-options "-fshort-enums" } */ +/* { dg-skip-if "" short_eq_int } */ enum e1 { c1 = -__INT_MAX__ }; diff --git a/gcc/testsuite/gcc.dg/torture/pr86034.c b/gcc/testsuite/gcc.dg/torture/pr86034.c index d83ea394ce9..30912cab095 100644 --- a/gcc/testsuite/gcc.dg/torture/pr86034.c +++ b/gcc/testsuite/gcc.dg/torture/pr86034.c @@ -3,15 +3,17 @@ /* { dg-do run } */ +typedef int int32_t __attribute__((mode (__SI__))); + struct A { - int b; - __INT32_TYPE__ c:24; - int d:10; - int e; + int32_t b; + int32_t c:24; + int32_t d:10; + int32_t e; } f; -int g; +int32_t g; void h () { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c index 39d89dbb117..999f55e3691 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c @@ -360,35 +360,35 @@ NOIPA void test_too_large (char *d, int x, __builtin_va_list va) const size_t imax_p1 = imax + 1; __builtin_snprintf (d, imax, "%c", x); - __builtin_snprintf (d, imax_p1, "%c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "INT_MAX + 1" { target lp64 } } */ - /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" "INT_MAX + 1" { target { { avr-*-* } || ilp32 } } .-1 } */ + __builtin_snprintf (d, imax_p1, "%c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "INT_MAX + 1" { target { lp64 || msp430_large } } } */ + /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" "INT_MAX + 1" { target { { avr-*-* } || { { ilp32 } || { int16 && { ! msp430_large } } } } } .-1 } */ __builtin_vsnprintf (d, imax, "%c", va); - __builtin_vsnprintf (d, imax_p1, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "INT_MAX + 1" { target lp64 } } */ - /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" "INT_MAX + 1" { target { { avr-*-* } || ilp32 } } .-1 } */ + __builtin_vsnprintf (d, imax_p1, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "INT_MAX + 1" { target { lp64 || msp430_large } } } */ + /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" "INT_MAX + 1" { target { { avr-*-* } || { { ilp32 } || { int16 && { ! msp430_large } } } } } .-1 } */ __builtin___snprintf_chk (d, imax, 0, imax, "%c", x); - __builtin___snprintf_chk (d, imax_p1, 0, imax_p1, "%c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "INT_MAX + 1" { target lp64 } } */ - /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" "INT_MAX + 1" { target { { avr-*-* } || ilp32 } } .-1 } */ + __builtin___snprintf_chk (d, imax_p1, 0, imax_p1, "%c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "INT_MAX + 1" { target { lp64 || msp430_large } } } */ + /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" "INT_MAX + 1" { target { { avr-*-* } || { { ilp32 } || { int16 && { ! msp430_large } } } } } .-1 } */ __builtin___vsnprintf_chk (d, imax, 0, imax, "%c", va); - __builtin___vsnprintf_chk (d, imax_p1, 0, imax_p1, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "INT_MAX + 1" { target lp64 } } */ - /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" "INT_MAX + 1" { target { { avr-*-* } || ilp32 } } .-1 } */ + __builtin___vsnprintf_chk (d, imax_p1, 0, imax_p1, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "INT_MAX + 1" { target { lp64 || msp430_large } } } */ + /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" "INT_MAX + 1" { target { { avr-*-* } || { { ilp32 } || { int16 && { ! msp430_large } } } } } .-1 } */ const size_t ptrmax = __PTRDIFF_MAX__; const size_t ptrmax_m1 = ptrmax - 1; - __builtin_snprintf (d, ptrmax_m1, "%c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX - 1" { target lp64 } } */ - __builtin_snprintf (d, ptrmax, " %c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX" { target lp64 } } */ + __builtin_snprintf (d, ptrmax_m1, "%c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX - 1" { target { lp64 || msp430_large } } } */ + __builtin_snprintf (d, ptrmax, " %c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX" { target { lp64 || msp430_large } } } */ - __builtin_vsnprintf (d, ptrmax_m1, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX - 1" { target lp64 } } */ - __builtin_vsnprintf (d, ptrmax, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX" { target lp64 } } */ + __builtin_vsnprintf (d, ptrmax_m1, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX - 1" { target { lp64 || msp430_large } } } */ + __builtin_vsnprintf (d, ptrmax, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX" { target { lp64 || msp430_large } } } */ - __builtin___snprintf_chk (d, ptrmax_m1, 0, ptrmax_m1, "%c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX - 1" { target lp64 } } */ - __builtin___snprintf_chk (d, ptrmax, 0, ptrmax, "%c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX" { target lp64 } } */ + __builtin___snprintf_chk (d, ptrmax_m1, 0, ptrmax_m1, "%c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX - 1" { target { lp64 || msp430_large } } } */ + __builtin___snprintf_chk (d, ptrmax, 0, ptrmax, "%c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX" { target { lp64 || msp430_large } } } */ - __builtin___vsnprintf_chk (d, ptrmax_m1, 0, ptrmax_m1, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX - 1" { target lp64 } } */ - __builtin___vsnprintf_chk (d, ptrmax, 0, ptrmax, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX" { target lp64 } } */ + __builtin___vsnprintf_chk (d, ptrmax_m1, 0, ptrmax_m1, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX - 1" { target { lp64 || msp430_large } } } */ + __builtin___vsnprintf_chk (d, ptrmax, 0, ptrmax, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX" { target { lp64 || msp430_large } } } */ } /* Exercise ordinary sprintf with malloc. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/integer-addr.c b/gcc/testsuite/gcc.dg/tree-ssa/integer-addr.c index a8a9de4ef55..ed94f6b3f0d 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/integer-addr.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/integer-addr.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fdump-tree-optimized -fno-strict-aliasing" } */ /* Test with fixed address */ -static int *foo = (int *) (unsigned long) 0x7800000; +static int *foo = (int *) (unsigned long) __INTPTR_MAX__; int func(void) __attribute__ ((noinline)); diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-10.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-10.c index 8f5a9a03970..621f48f7d6e 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-10.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-10.c @@ -3,16 +3,18 @@ /* { dg-require-effective-target size20plus } */ /* { dg-skip-if "too big data segment" { visium-*-* } } */ +typedef int int32_t __attribute__((mode (__SI__))); + #define M 256 int a[M][M], b[M][M]; -int __attribute__((noinline)) +int32_t __attribute__((noinline)) double_reduc (int n) { - int sum = 0; + int32_t sum = 0; for (int j = 0; j < n; j++) { for (int i = 0; i < n; i++) - sum = sum + a[i][j]*b[i][j]; + sum = sum + (int32_t)a[i][j]*(int32_t)b[i][j]; } return sum; } @@ -34,7 +36,7 @@ int main (void) for (int i = 0; i < M; ++i) init (i); - int sum = double_reduc (M); + int32_t sum = double_reduc (M); if (sum != 1065369600) abort (); diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr84436-3.c b/gcc/testsuite/gcc.dg/tree-ssa/pr84436-3.c index 87937f30ab1..48740dd5a24 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr84436-3.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr84436-3.c @@ -20,5 +20,5 @@ void f() { h(g); } -/* { dg-final { scan-tree-dump-times ".* \\+ 4294967247" 1 "switchconv" } } */ +/* { dg-final { scan-tree-dump-times ".* \\+ (?:4294967247|65487)" 1 "switchconv" } } */ /* { dg-final { scan-tree-dump-not "switch" "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr84648.c b/gcc/testsuite/gcc.dg/tree-ssa/pr84648.c index 6ff5a07cd20..7832ffa398b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr84648.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr84648.c @@ -1,8 +1,10 @@ /* { dg-do compile } */ /* { dg-options "-O3 -fdump-tree-cddce1-details" } */ +typedef unsigned uint32_t __attribute__((mode (__SI__))); + int main() { - for (unsigned i = 0; i < (1u << 31); ++i) { + for (uint32_t i = 0; i < (1UL << 31); ++i) { } return 0; } diff --git a/gcc/testsuite/gcc.dg/tree-ssa/scev-8.c b/gcc/testsuite/gcc.dg/tree-ssa/scev-8.c index 666dd30bfbe..a5b2ff71958 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/scev-8.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/scev-8.c @@ -3,6 +3,12 @@ int *a; +#if __SIZEOF_INT__ == __SIZEOF_SHORT__ +typedef char small_t; +#else +typedef short small_t; +#endif + int foo1 (long long s, long long l) { @@ -10,7 +16,7 @@ foo1 (long long s, long long l) for (i = s; i < l; i++) { - a[(short)i] = 0; + a[(small_t)i] = 0; } return 0; } diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-8.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-8.c index c456d734fa7..95c936cbf71 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-8.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-8.c @@ -300,10 +300,10 @@ f2 (struct C *x) else { o = f2 (x); -#if __SIZEOF_POINTER__ == __SIZEOF_LONG__ +#if __SIZEOF_POINTER__ == __SIZEOF_LONG__ && !__MSP430X_LARGE__ if (((unsigned long) o > (unsigned long) -4000L)) -#elif __SIZEOF_POINTER__ == __SIZEOF_INT__ - if (((__UINTPTR_TYPE__) o > (__UINTPTR_TYPE__) -4000U)) +#else + if (((__UINTPTR_TYPE__) o > (__UINTPTR_TYPE__) -4000UL)) #endif { e = 5; @@ -388,10 +388,10 @@ f2 (struct C *x) break; case 19: o = f2 (x); -#if __SIZEOF_POINTER__ == __SIZEOF_LONG__ +#if __SIZEOF_POINTER__ == __SIZEOF_LONG__ && !__MSP430X_LARGE__ if (((unsigned long) o > (unsigned long) -4000L)) -#elif __SIZEOF_POINTER__ == __SIZEOF_INT__ - if (((__UINTPTR_TYPE__) o > (__UINTPTR_TYPE__) -4000U)) +#else + if (((__UINTPTR_TYPE__) o > (__UINTPTR_TYPE__) -4000UL)) #endif { e = 6; diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 3e91a81dd5a..b335108358d 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -2767,6 +2767,16 @@ proc check_effective_target_large_return_values { } { } return 1 } +# Return 1 if we support 20-bit or larger array and structure sizes +# using default options, 0 otherwise. +# This implies at least a 24-bit address space, as no targets have an address +# space between 20 and 24 bits. + +proc check_effective_target_size24plus { } { + return [check_no_compiler_messages size24plus object { + char dummy[524289L]; + }] +} # Return 1 if we support 24-bit or larger array and structure sizes # using default options, 0 otherwise. @@ -2829,6 +2839,24 @@ proc check_effective_target_int_eq_float { } { }] } +# Return 1 if short size is equal to int size, +# 0 otherwise. + +proc check_effective_target_short_eq_int { } { + return [check_no_compiler_messages short_eq_int object { + int dummy[sizeof (short) == sizeof (int) ? 1 : -1]; + }] +} + +# Return 1 if pointer size is equal to short size, +# 0 otherwise. + +proc check_effective_target_ptr_eq_short { } { + return [check_no_compiler_messages ptr_eq_short object { + int dummy[sizeof (void *) == sizeof (short) ? 1 : -1]; + }] +} + # Return 1 if pointer size is equal to long size, # 0 otherwise. @@ -10249,3 +10277,21 @@ proc check_effective_target_lgccjit { } { int main() { return 0; } } "-lgccjit"] } + +# Return 1 if the MSP430 small memory model is in use. +proc check_effective_target_msp430_small {} { + return [check_no_compiler_messages msp430_small assembly { + #if (!defined __MSP430__ || defined __MSP430X_LARGE__) + #error !msp430 || __MSP430X_LARGE__ + #endif + } ""] +} + +# Return 1 if the MSP430 large memory model is in use. +proc check_effective_target_msp430_large {} { + return [check_no_compiler_messages msp430_large assembly { + #ifndef __MSP430X_LARGE__ + #error __MSP430X_LARGE__ + #endif + } ""] +} -- 2.30.2