diff options
author | Jozef Lawrynowicz <jozef.l@mittosystems.com> | 2020-05-19 12:46:17 +0100 |
---|---|---|
committer | Jozef Lawrynowicz <jozef.l@mittosystems.com> | 2020-05-19 13:15:13 +0100 |
commit | 92ea8e1bccc6a703407570471f6323bfa554af99 (patch) | |
tree | e17b2e12afa712a1295057b7f6303dafeff04712 /gcc/testsuite/g++.dg | |
parent | e107157171af25f6c89be02d62b0a7235a5c988d (diff) | |
download | gcc-92ea8e1bccc6a703407570471f6323bfa554af99.zip gcc-92ea8e1bccc6a703407570471f6323bfa554af99.tar.gz gcc-92ea8e1bccc6a703407570471f6323bfa554af99.tar.bz2 |
TESTSUITE: Fix tests for 16-bit targets
gcc/ChangeLog:
2020-05-19 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* 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 <jozef.l@mittosystems.com>
* 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.
Diffstat (limited to 'gcc/testsuite/g++.dg')
69 files changed, 435 insertions, 342 deletions
diff --git a/gcc/testsuite/g++.dg/abi/scoped1.C b/gcc/testsuite/g++.dg/abi/scoped1.C index 7589ed4..62ae498 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 e68ff0e..7b28177b 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 c393db4..a17d45c 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 8335fad..9902a4d 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 5f253ca..5f12858 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 7dbbf2d..0cb89e6 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 15af84c..7cb3559 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<const int>(nullptr); // { dg-error "16:invalid 'static_cast' " } -const short int n5 = reinterpret_cast<short int>(nullptr); // { dg-error "22:cast from .std::nullptr_t. to .short int. loses precision" } +const short int n5 = reinterpret_cast<short int>(nullptr); // { dg-error "22:cast from .std::nullptr_t. to .short int. loses precision" "" { target { ! ptr_eq_short } } } const intptr_t n6 = reinterpret_cast<intptr_t>(nullptr); const intptr_t n7 = (intptr_t)nullptr; decltype(nullptr) mynull = 0; const int n8 = static_cast<const int>(mynull); // { dg-error "16:invalid 'static_cast' " } -const short int n9 = reinterpret_cast<short int>(mynull); // { dg-error "22:cast from .std::nullptr_t. to .short int. loses precision" } +const short int n9 = reinterpret_cast<short int>(mynull); // { dg-error "22:cast from .std::nullptr_t. to .short int. loses precision" "" { target { ! ptr_eq_short } } } const intptr_t n10 = reinterpret_cast<intptr_t>(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 179919a..b27ac34 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<class... Ts> 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 7ca0033..d6a6509 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<unsigned short> { typedef unsigned type; }; StaticAssert (vflow ? CAT (op, __LINE__)(x, y).v \ : CAT (op, __LINE__)(x, y) == Res<T>(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 727e74e..5343e52 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 ec595a2..dd67a3b 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 b25f492..51c5bd9 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 3cd84a8..4e762aa 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<typename T> - constexpr int var = sizeof (T); + constexpr int32_t var = sizeof (T); template<> - constexpr int var<int> = 100000; + constexpr int32_t var<int32_t> = 100000; int main () { - static_assert(var<int> == 100000 && var<char> == sizeof(char), ""); + static_assert(var<int32_t> == 100000 && var<char> == 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 f1d1aa5..027bd5e 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 412535c..6d37480 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<unsigned short>((32767 * 2 + 1)); diff --git a/gcc/testsuite/g++.dg/expr/bitfield9.C b/gcc/testsuite/g++.dg/expr/bitfield9.C index 177f65b..2e309c3 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 93e08d7..9757903 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 25c90df..91019db 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 7c67d09..f0603f9 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 929b7c7..a792a73 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 ea48c96..b0a003c 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 77436cb..bce4d7b 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 e52effe..9c12831 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 17160d0..024d93ed4 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 <nathan@codesourcery.com> diff --git a/gcc/testsuite/g++.dg/init/array4.C b/gcc/testsuite/g++.dg/init/array4.C index 67519bf..4712e9d 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 <markus.breuer@materna.de> // PR c++/6944 diff --git a/gcc/testsuite/g++.dg/init/const7.C b/gcc/testsuite/g++.dg/init/const7.C index e1f31bc..e1dd4d8 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 cf73aa1..405b67d 100644 --- a/gcc/testsuite/g++.dg/init/new38.C +++ b/gcc/testsuite/g++.dg/init/new38.C @@ -40,7 +40,7 @@ template <typename T> 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 a10ef42..cf4bc16 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 4899bd8..25abd60 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 1ef997f..444805d 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 42b20cb..92dec57 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 7b3af58..c03badd 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 <class T> 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 c61f767..ee2a78b 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 c38b22b..522af3b 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 12f3e66..daa7ffd 100644 --- a/gcc/testsuite/g++.dg/opt/reload3.C +++ b/gcc/testsuite/g++.dg/opt/reload3.C @@ -4,6 +4,8 @@ #include <cstdlib> +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 35520a2..533579a 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 566c0f2..cbda918 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 c60603e..81eec7c 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 7f61071..3ea1af2 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 7d19a7d..e5748c0 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 01a67ed..a81b3c4 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 19e9b9a..9dc6d1c 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 e617f90..e716bee 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 1ed6354..c79268f 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 218a2c6..e4a40b0 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 ff638f4..c730fba 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 d42344c..96a1071 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 f5bdda6..152d92a 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 98723ac..34f8a58 100644 --- a/gcc/testsuite/g++.dg/template/array30.C +++ b/gcc/testsuite/g++.dg/template/array30.C @@ -1,7 +1,9 @@ -template <int I> +typedef int int32_t __attribute__((mode (__SI__))); + +template <int32_t I> 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 a2c5a08..850d02d 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 <class Key, class Value> 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 f71e4f5..ddf1669 100644 --- a/gcc/testsuite/g++.dg/template/constant2.C +++ b/gcc/testsuite/g++.dg/template/constant2.C @@ -3,7 +3,13 @@ template<class C> 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 712d488..a9c5178 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 <int N> struct X +typedef int int32_t __attribute__((mode (__SI__))); + +template <int32_t N> struct X { - template <int M> friend int foo(X const &, X<M> const&) + template <int32_t M> friend int32_t foo(X const &, X<M> const&) { return N * 10000 + M; } diff --git a/gcc/testsuite/g++.dg/template/pr68978.C b/gcc/testsuite/g++.dg/template/pr68978.C index 1904532..cf91558 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 <typename T> int toi_1() { +int32_t i = 0, c = 0, radix = 10, max = 0x7fffffff; + +template <typename T> int32_t toi_1() { if (max < ((i *= radix) += c)) return 0; return i; } -template <typename T> int toi_2() { +template <typename T> int32_t toi_2() { if (max < ((i = radix) = c)) return 0; return i; } -template <typename T> int toi_3() { +template <typename T> int32_t toi_3() { if (max < ((i = radix) += c)) return 0; return i; } -template <typename T> int toi_4() { +template <typename T> int32_t toi_4() { if (max < ((i += radix) = c)) return 0; return i; } -template <typename T> int toi_5() { +template <typename T> int32_t toi_5() { if (max < (((i = radix) += (c += 5)) *= 30)) return 0; return i; } -int x = toi_1<int> (); -int y = toi_2<int> (); -int z = toi_3<int> (); -int w = toi_4<int> (); -int r = toi_5<int> (); +int32_t x = toi_1<int32_t> (); +int32_t y = toi_2<int32_t> (); +int32_t z = toi_3<int32_t> (); +int32_t w = toi_4<int32_t> (); +int32_t r = toi_5<int32_t> (); diff --git a/gcc/testsuite/g++.dg/torture/pr37421.C b/gcc/testsuite/g++.dg/torture/pr37421.C index 4b8447e..c8cfd00 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 <stdio.h> #include <string.h> diff --git a/gcc/testsuite/g++.dg/torture/pr88861.C b/gcc/testsuite/g++.dg/torture/pr88861.C index d2b6a4b..ff66d5e 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 6a3fff0..7a9a2e0 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 <int> \\\[\\\(void .\\\)&a \\\+ 8B\\\]" 3 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "&MEM <int> \\\[\\\(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 c5407c5..053b768 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 2c6fd04..e0e3c5b 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 42d9cb0..2849e81 100644 --- a/gcc/testsuite/g++.dg/warn/Wconversion-integer.C +++ b/gcc/testsuite/g++.dg/warn/Wconversion-integer.C @@ -6,15 +6,18 @@ #include <limits.h> +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 98f5c40..0f5bf58 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 <cstddef> -void g(int) {} -void g(long) {} -void g(long long) {} +void g(__INTPTR_TYPE__) {} extern void g(void*); template <int I> @@ -17,13 +15,7 @@ template <class T> 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 e2ca13e..4cac267 100644 --- a/gcc/testsuite/g++.dg/warn/Wconversion-null.C +++ b/gcc/testsuite/g++.dg/warn/Wconversion-null.C @@ -3,9 +3,7 @@ #include <cstddef> -void g(int) {} -void g(long) {} -void g(long long) {} +void g(__INTPTR_TYPE__) {} extern void g(void*); template <int I> @@ -17,13 +15,7 @@ template <class T> 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 71604f9..8168252 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 1553613..30cea63 100644 --- a/gcc/testsuite/g++.dg/warn/Wduplicated-branches1.C +++ b/gcc/testsuite/g++.dg/warn/Wduplicated-branches1.C @@ -6,7 +6,7 @@ template <typename T> 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 0bed577..4afc7e5 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 2bafff3..48d6b15 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<void> 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<int> exttempl; +extern TemplateClass<int32_t> 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<int> 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 a049251..84c493c 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 5e71ebf..971e535 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<unsigned int*> (&i); /* { dg-bogus "signed vs. unsigned" } */ +int32_t foo () { + int32_t i; + uint32_t* pu = reinterpret_cast<uint32_t*> (&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 99e1e89..813cefc 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 6a968d9..104f53c 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) |