+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.
+
2020-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* config/bpf/bpf.c (bpf_compute_frame_layout): Include space for
@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.
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
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
+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.
+
2020-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* gcc.target/bpf/xbpf-callee-saved-regs-1.c: New test.
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))
T19 t19;
T20 t20;
#endif
-int t21 = __has_attribute (noreturn) + __has_cpp_attribute (__malloc__);
+long t21 = __has_attribute (noreturn) + __has_cpp_attribute (__malloc__);
{
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
{
__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 } } }
}
// PR c++/70001
// { dg-do compile { target c++11 } }
+// { dg-require-effective-target size24plus }
struct B
{
// PR c++/49136
// { dg-do compile { target c++11 } }
+// { dg-require-effective-target int32plus }
struct S
{
}
int main() {
- foo(0, A::X); // { dg-warning "scoped" }
+ foo(0, A::X); // { dg-warning "scoped" "" { target { ! short_eq_int } } }
}
// PR c++/50011
short unsigned su;
-int i { su };
+int i { su }; // { dg-error "narrowing" "" { target short_eq_int } }
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)
{
__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;
// 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()
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);
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);
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);
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);
// { 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" }
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 }
// { dg-do compile { target c++14 } }
+typedef unsigned uint32_t __attribute__((mode (__SI__)));
+
struct Foo
{
- unsigned i: 32;
+ uint32_t i: 32;
};
int
// 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__);
// { 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), "");
}
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 } }
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 } }
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 } }
// PR c++/69631
// { dg-options -fwrapv }
+// { dg-skip-if "" int16 }
struct C {
static const unsigned short max = static_cast<unsigned short>((32767 * 2 + 1));
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)
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()
// { 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;
int main ()
{
foo x[2] = { 1,2 };
- int y[2] = { 1,2 };
+ int32_t y[2] = { 1,2 };
*inc(x);
*inc(y);
return 0;
__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 ()
{
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);
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);
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);
/* { 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)
// { 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;
+// { dg-require-effective-target size32plus }
/* PR 11665
Orgin: jwhite@cse.unl.edu
The problem was in initializer_constant_valid_p,
// { 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>
// { dg-do compile }
+// { dg-require-effective-target size20plus }
// Origin: Markus Breuer <markus.breuer@materna.de>
// PR c++/6944
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.
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)];
}
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
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];
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];
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];
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];
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];
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];
{
#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 {
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
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];
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];
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];
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];
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];
// PR c++/50793
// { dg-do run }
+typedef int int32_t __attribute__((mode (__SI__)));
+
struct NonTrivial
{
NonTrivial() { }
struct S
{
NonTrivial nt;
- int i;
+ int32_t i;
};
int f(S s)
// { 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)
class A
{
public:
- int field;
+ int32_t field;
char *s;
A() : field(223344)
/* { 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));
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);
int main ()
{
- if (Foo () != 0.0)
- return 1;
+ if (sizeof (int32_t) == sizeof (float))
+ {
+ if (Foo () != 0.0)
+ return 1;
+ }
return 0;
}
// { dg-do compile }
// { dg-options "-O -g" }
+typedef unsigned uint32_t __attribute__((mode (__SI__)));
+
struct DebugOnly {};
template <class T>
struct StripConst { typedef T result; };
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; }
// { 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;
}
// { 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 *);
#include <cstdlib>
+typedef unsigned uint32_t __attribute__((mode (__SI__)));
+
class QTime
{
public:
unsigned ds;
};
-static const unsigned MSECS_PER_DAY = 86400000;
+static const uint32_t MSECS_PER_DAY = 86400000;
QTime QTime::addMSecs(int ms) const
{
// { dg-do run }
+// { dg-require-effective-target size20plus }
// Copyright (C) 2006 Free Software Foundation, Inc.
// 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
// 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" }
-typedef int SLONG;
+typedef int SLONG __attribute__((mode (__SI__)));
+
typedef char SCHAR;
typedef short SSHORT;
typedef char TEXT;
/* 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
// 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));
};
/* { 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
nrefidx = 0;
switch (o1._type)
{
- case 0x02000000:
+ case 0x02000000L:
o4 = nrefidx;
jump = 1;
return true;
- case 0x00000080:
+ case 0x00000080L:
{
long
idx = 10;
/* { 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;
};
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;
};
};
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;
};
/* { 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;
};
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;
};
};
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;
};
#define COOKIE 0xabcd0123
-int
+int32_t
g (void)
{
return COOKIE;
}
-extern int f (void);
+extern int32_t f (void);
int
main (void)
+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; }
};
#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;
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
-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;
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);
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();
// 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;
}
// 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> ();
/* { dg-do compile } */
+/* { dg-require-effective-target int_eq_float } */
#include <stdio.h>
#include <string.h>
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);
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)
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;
{
};
}
- 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
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 ();
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];
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 {
};
};
-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 {
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)
{ }
#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;
#include <cstddef>
-void g(int) {}
-void g(long) {}
-void g(long long) {}
+void g(__INTPTR_TYPE__) {}
extern void g(void*);
template <int I>
void l(T);
template <>
-void l(int) {}
-
-template <>
-void l(long) {}
-
-template <>
-void l(long long) {}
+void l(__INTPTR_TYPE__) {}
void warn_for_NULL()
{
#include <cstddef>
-void g(int) {}
-void g(long) {}
-void g(long long) {}
+void g(__INTPTR_TYPE__) {}
extern void g(void*);
template <int I>
void l(T);
template <>
-void l(int) {}
-
-template <>
-void l(long) {}
-
-template <>
-void l(long long) {}
+void l(__INTPTR_TYPE__) {}
int main()
{
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" }
}
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;
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" }
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; }
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;
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;
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];
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" }
}
// 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];
struct ClassWithMemberNew {
- struct Object { int i; } *pobj;
+ struct Object { int32_t i; } *pobj;
unsigned nobj;
ClassWithMemberNew ();
struct ClassWithGlobalNew {
- int a [4];
+ int32_t a [4];
ClassWithGlobalNew ();
};
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
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" }
}
/* { 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" } */
}
/* { 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;
}
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)
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)
// { dg-do assemble }
// GROUPS passed enums
+typedef unsigned uint32_t __attribute__((mode (__SI__)));
class X
{
enum
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
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; }
// { dg-do assemble }
// { dg-xfail-if "" { xstormy16-*-* } }
+// { dg-require-effective-target size20plus }
#include <stdio.h>
#include <stdlib.h>
// { 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;
// Origin: Hans-Peter Nilsson <hp@axis.com>
// See <URL:http://gcc.gnu.org/ml/gcc-patches/2000-06/msg00310.html>
-typedef unsigned int udword;
+typedef unsigned udword __attribute__((mode (__SI__)));
extern "C" {
void __assert (const char *, int, const char *);
}
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
int main ()
{
special = 1;
- int *p = new int();
+ int32_t *p = new int32_t();
special = 0;
return *p != 0;
}
// { 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 *));
// { dg-do assemble }
// { dg-options "-fno-short-enums" }
+// { dg-skip-if "" int16 }
// the template operator!= interferes. It should be in a namespace.
#include <utility>
// { 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;
}
/* { 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)
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 *-*-* } } */
}
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" } */
/* 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. */
#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 } } } */
/* { 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];
/* { 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];
+/* { dg-require-effective-target size20plus } */
+
void bar ();
int toto()
*y = 100;
}
+#if __SIZEOF_SIZE_T__ < 4
+double x[1000];
+#else
double x[10000];
+#endif
void
g1 (int stepx, int n)
/* { 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. */
-#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);
/* { 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;
+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;
/* { 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)
/* { 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__ \
-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 } */
}
/* { 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" } */
}
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)
main (void)
{
b = (unsigned char) __builtin_parity (d);
- e ? foo (0) : (long) &c;
+ e ? foo (0) : (__INTPTR_TYPE__) &c;
return 0;
}
/* { 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;
}
}
/* { 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;
/* { 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__ };
/* { 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 ()
{
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. */
/* { 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));
/* { 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;
}
for (int i = 0; i < M; ++i)
init (i);
- int sum = double_reduc (M);
+ int32_t sum = double_reduc (M);
if (sum != 1065369600)
abort ();
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" } } */
/* { 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;
}
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)
{
for (i = s; i < l; i++)
{
- a[(short)i] = 0;
+ a[(small_t)i] = 0;
}
return 0;
}
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;
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;
}
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.
}]
}
+# 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.
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
+ } ""]
+}