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.
This commit is contained in:
Jozef Lawrynowicz 2020-05-19 12:46:17 +01:00
parent e107157171
commit 92ea8e1bcc
114 changed files with 785 additions and 445 deletions

View File

@ -1,3 +1,11 @@
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

View File

@ -1363,6 +1363,12 @@ Target has 64-bit @code{long long}.
@item long_neq_int
Target has @code{int} and @code{long} with different sizes.
@item short_eq_int
Target has @code{short} and @code{int} with the same size.
@item ptr_eq_short
Target has pointers (@code{void *}) and @code{short} with the same size.
@item int_eq_float
Target has @code{int} and @code{float} with the same size.
@ -1379,11 +1385,15 @@ Target supports @code{long double} that is longer than @code{double}.
Target has pointers that are 32 bits or longer.
@item size20plus
Target has a 20-bit or larger address space, so at least supports
Target has a 20-bit or larger address space, so supports at least
16-bit array and structure sizes.
@item size24plus
Target has a 24-bit or larger address space, so supports at least
20-bit array and structure sizes.
@item size32plus
Target has a 32-bit or larger address space, so at least supports
Target has a 32-bit or larger address space, so supports at least
24-bit array and structure sizes.
@item 4byte_wchar_t
@ -2050,6 +2060,16 @@ when using the new ABI.
MIPS target supports @code{-mpaired-single}.
@end table
@subsubsection MSP430-specific attributes
@table @code
@item msp430_small
MSP430 target has the small memory model enabled (@code{-msmall}).
@item msp430_large
MSP430 target has the large memory model enabled (@code{-mlarge}).
@end table
@subsubsection PowerPC-specific attributes
@table @code

View File

@ -1,3 +1,138 @@
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.

View File

@ -2,7 +2,8 @@
and packed in various forms of array dereferencing and indirection
expressions correspondingly to __alignof__.
{ dg-do compile }
{ dg-options "-Wall -Wno-unused -ftrack-macro-expansion=0" } */
{ dg-options "-Wall -Wno-unused -ftrack-macro-expansion=0" }
{ dg-require-effective-target size24plus } */
#define ATTR(...) __attribute__ ((__VA_ARGS__))
#define ALIGN(N) ATTR (aligned (N))

View File

@ -61,4 +61,4 @@ T18 t18;
T19 t19;
T20 t20;
#endif
int t21 = __has_attribute (noreturn) + __has_cpp_attribute (__malloc__);
long t21 = __has_attribute (noreturn) + __has_cpp_attribute (__malloc__);

View File

@ -35,7 +35,14 @@ void f4(unsigned short a, int b)
{
volatile int us_i;
us_i = (double) a < (double) b;
/* { dg-final { scan-tree-dump "us_i = \\(int\\) a < b" "original" } } */
/* { dg-final { scan-tree-dump "us_i = \\(int\\) a < b" "original" { target { ! short_eq_int } } } } */
}
void f4_short_eq_int(unsigned short a, long b)
{
volatile long us_l;
us_l = (double) a < (double) b;
/* { dg-final { scan-tree-dump "us_l = \\(long int\\) a < b" "original" { target { short_eq_int } } } } */
}
/* We don't optimize here because neither of integral types is

View File

@ -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 } } }
}

View File

@ -1,5 +1,6 @@
// PR c++/70001
// { dg-do compile { target c++11 } }
// { dg-require-effective-target size24plus }
struct B
{

View File

@ -1,5 +1,6 @@
// PR c++/49136
// { dg-do compile { target c++11 } }
// { dg-require-effective-target int32plus }
struct S
{

View File

@ -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 } } }
}

View File

@ -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 } }

View File

@ -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)
{

View File

@ -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;

View File

@ -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()

View File

@ -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);

View File

@ -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 }

View File

@ -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

View File

@ -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__);

View File

@ -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), "");
}

View File

@ -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 } }

View File

@ -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));

View File

@ -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)

View File

@ -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()

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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)

View File

@ -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;

View File

@ -1,3 +1,4 @@
// { dg-require-effective-target size32plus }
/* PR 11665
Orgin: jwhite@cse.unl.edu
The problem was in initializer_constant_valid_p,

View File

@ -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>

View File

@ -1,4 +1,5 @@
// { dg-do compile }
// { dg-require-effective-target size20plus }
// Origin: Markus Breuer <markus.breuer@materna.de>
// PR c++/6944

View File

@ -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.

View File

@ -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)];
}

View File

@ -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];

View File

@ -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)

View File

@ -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)

View File

@ -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;
}

View File

@ -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; }

View File

@ -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;
}

View File

@ -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 *);

View File

@ -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
{

View File

@ -1,4 +1,5 @@
// { dg-do run }
// { dg-require-effective-target size20plus }
// Copyright (C) 2006 Free Software Foundation, Inc.

View File

@ -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

View File

@ -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" }

View File

@ -1,4 +1,5 @@
typedef int SLONG;
typedef int SLONG __attribute__((mode (__SI__)));
typedef char SCHAR;
typedef short SSHORT;
typedef char TEXT;

View File

@ -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

View File

@ -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));
};

View File

@ -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;

View File

@ -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;
};

View File

@ -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;
};

View File

@ -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)

View File

@ -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; }
};

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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();

View File

@ -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;
}

View File

@ -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> ();

View File

@ -1,4 +1,5 @@
/* { dg-do compile } */
/* { dg-require-effective-target int_eq_float } */
#include <stdio.h>
#include <string.h>

View File

@ -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);

View File

@ -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)

View File

@ -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];

View File

@ -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)
{ }

View File

@ -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;

View File

@ -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()
{

View File

@ -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()
{

View File

@ -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" }
}

View File

@ -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;

View File

@ -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" }

View File

@ -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] + 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) 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 (&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) 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 (&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) int; // { dg-warning "placement" }
new (&c + 1) int; // { dg-warning "placement" }
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 (&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) 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) 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) int; // { dg-warning "placement" }
new (&uac2.c) int; // { dg-warning "placement" }
new (&uac3.c) int; // { 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" }
}

View File

@ -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" } */
}

View File

@ -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;
}

View File

@ -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)

View File

@ -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)

View File

@ -1,5 +1,6 @@
// { dg-do assemble }
// GROUPS passed enums
typedef unsigned uint32_t __attribute__((mode (__SI__)));
class X
{
enum
@ -8,7 +9,7 @@ class X
twoMask = 0x000F0000,
thiMask = 0xFFF00000, // { dg-error "comma at end" "" { target { ! c++11 } } }
};
unsigned int foo;
uint32_t foo;
public:
X (int) : foo (oneMask | twoMask ) {} // No warning

View File

@ -33,7 +33,7 @@
int main ();
short s = (short) &main; // { dg-error "11:cast \[^\n\r]* loses precision" "lose" { xfail h8*-*-* xstormy16-*-* } }
short s = (short) &main; // { dg-error "11:cast \[^\n\r]* loses precision" "lose" { target { ! ptr_eq_short } } }
char c = (char) &main; // { dg-error "10:cast \[^\n\r]* loses precision" "lose" }
int main () { return 0; }

View File

@ -1,5 +1,6 @@
// { dg-do assemble }
// { dg-xfail-if "" { xstormy16-*-* } }
// { dg-require-effective-target size20plus }
#include <stdio.h>
#include <stdlib.h>

View File

@ -3,23 +3,22 @@
// { dg-error "limited range of data type" "16-bit target" { target xstormy16-*-* } 0 }
// { dg-error "shift count >=" "16-bit target" { target xstormy16-*-* } 0 }
typedef unsigned uint32_t __attribute__((mode (__SI__)));
int main()
{
unsigned int x = 1381237248;
if (sizeof (x) != 4)
return 0;
uint32_t x = 1381237248;
x =
({
unsigned int y = x;
uint32_t y = x;
({
unsigned int z = y;
(unsigned int)
((((unsigned int)z & (unsigned int)0x000000ffUL) << 24)
| (((unsigned int)z & (unsigned int)0x0000ff00UL) << 8)
| (((unsigned int)z & (unsigned int)0x00ff0000UL) >> 8)
| (((unsigned int)z & (unsigned int)0xff000000UL) >> 24));
uint32_t z = y;
(uint32_t)
((((uint32_t)z & (uint32_t)0x000000ffUL) << 24)
| (((uint32_t)z & (uint32_t)0x0000ff00UL) << 8)
| (((uint32_t)z & (uint32_t)0x00ff0000UL) >> 8)
| (((uint32_t)z & (uint32_t)0xff000000UL) >> 24));
});
});
return x != 152658;

View File

@ -4,7 +4,7 @@
// 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 *);
}

View File

@ -5,8 +5,10 @@
using namespace std;
extern "C" void *malloc (size_t);
int special;
int space = 0xdeadbeef;
typedef int int32_t __attribute__((mode (__SI__)));
int32_t special;
int32_t space = 0xdeadbeef;
void *operator new (size_t size)
#if __cplusplus <= 199711L
@ -21,7 +23,7 @@ void *operator new (size_t size)
int main ()
{
special = 1;
int *p = new int();
int32_t *p = new int32_t();
special = 0;
return *p != 0;
}

View File

@ -1,6 +1,7 @@
// { dg-do assemble }
// { dg-xfail-if "" { xstormy16-*-* } }
// { dg-options "" }
// { dg-skip-if "16-bit int overflow" int16 }
extern "C" void qsort(void *base, __SIZE_TYPE__ nmemb, __SIZE_TYPE__ size,
int (*compar)(const void *, const void *));

View File

@ -1,5 +1,6 @@
// { dg-do assemble }
// { dg-options "-fno-short-enums" }
// { dg-skip-if "" int16 }
// the template operator!= interferes. It should be in a namespace.
#include <utility>

View File

@ -2,13 +2,15 @@
// { dg-options "-Wreturn-type" }
// Test that we don't get a warning about flowing off the end.
typedef int int32_t __attribute__((mode (__SI__)));
struct A {
~A ();
};
int f()
int32_t f()
{
A a1[2];
A a2[2];
return 1234567;
return 1234567L;
}

View File

@ -2,7 +2,8 @@
/* { dg-do compile } */
/* { dg-require-effective-target alloca } */
/* { dg-skip-if "small address space" { "pdp11-*-*" } } */
/* { dg-options "-O2 -Walloca-larger-than=126812070" } */
/* { dg-options "-O2 -Walloca-larger-than=126812070" { target ptr32plus } } */
/* { dg-options "-O2 -Walloca-larger-than=12070" { target { ! ptr32plus } } } */
void
g (int *p)

View File

@ -150,8 +150,8 @@ void wide_ptr_index_range_chain (void)
T (p3[0]); /* { dg-warning "array subscript \\\[3, 6] is outside array bounds of .\[a-z \]+\\\[3]." } */
T (p3[1]); /* { dg-warning "array subscript \\\[4, 7] is outside array bounds of .\[a-z \]+\\\[3]." } */
T (p3[9999]); /* { dg-warning "array subscript \\\[10002, 10005] is outside array bounds of .\[a-z \]+\\\[3]." } */
T (p3[9999]); /* { dg-warning "array subscript \\\[10002, 10005] is outside array bounds of .\[a-z \]+\\\[3]." "" { target size20plus} } */
/* { dg-warning "array subscript \\\[-6382, -6379] is outside array bounds of .\[a-z \]+\\\[3]." "" { target { ! size20plus } } .-1 } */
/* Large offsets are indistinguishable from negative values. */
T (p3[DIFF_MAX]); /* { dg-warning "array subscript" "bug" { xfail *-*-* } } */
}

View File

@ -41,7 +41,7 @@ void test_integer_conversion_abs (void)
i = abs (uc);
i = abs (si);
i = abs (usi);
i = abs (usi); /* { dg-warning ".abs. argument 1 promotes to .unsigned int. where .int. is expected in a call to built-in function declared without prototype" "" { target short_eq_int } } */
i = abs (i);
i = abs (ui); /* { dg-warning ".abs. argument 1 type is .unsigned int. where .int. is expected in a call to built-in function declared without prototype" } */
@ -77,9 +77,9 @@ void test_integer_conversion_memset (void *d)
/* Passing a ptrdiff_t where size_t is expected may not be unsafe
but because GCC may emits suboptimal code for such calls warning
for them helps improve efficiency. */
memset (d, 0, diffi); /* { dg-warning ".memset. argument 3 promotes to .ptrdiff_t. {aka .\(long \)?int.} where .\(long \)?unsigned int. is expected" } */
memset (d, 0, diffi); /* { dg-warning ".memset. argument 3 promotes to .ptrdiff_t. {aka .\(long \)?\(int\)?\(__int20\)?.} where .\(long \)?\(__int20 \)?unsigned\( int\)?. is expected" } */
memset (d, 0, 2.0); /* { dg-warning ".memset. argument 3 type is .double. where '\(long \)?unsigned int' is expected" } */
memset (d, 0, 2.0); /* { dg-warning ".memset. argument 3 type is .double. where '\(long \)?\(__int20 \)?unsigned\( int\)?' is expected" } */
/* Verify that the same call as above but to the built-in doesn't
trigger a warning. */

View File

@ -11,4 +11,4 @@
#define e4 e3 e3 e3 e3 e3 e3 e3 e3 e3 e3
#define e5 e4 e4 e4 e4 e4 e4 e4 e4 e4 e4
void foo() { (void)(e5); } /* { dg-error "size of string literal is too large" "" { target { ! size32plus } } } */
void foo() { (void)(e5); } /* { dg-error "size of string literal is too large" "" { target { ! size20plus } } } */

View File

@ -1,9 +1,12 @@
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-optimized" } */
int foo (short a[], int x)
typedef int int32_t __attribute__((mode (__SI__)));
typedef unsigned uint32_t __attribute__((mode (__SI__)));
int32_t foo (short a[], int32_t x)
{
unsigned int i;
uint32_t i;
for (i = 0; i < 1000; i++)
{
x = a[i];

View File

@ -1,9 +1,12 @@
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-optimized" } */
int foo (unsigned short a[], unsigned int x)
typedef int int32_t __attribute__((mode (__SI__)));
typedef unsigned uint32_t __attribute__((mode (__SI__)));
int32_t foo (unsigned short a[], uint32_t x)
{
unsigned int i;
uint32_t i;
for (i = 0; i < 1000; i++)
{
x = a[i];

View File

@ -1,3 +1,5 @@
/* { dg-require-effective-target size20plus } */
void bar ();
int toto()

View File

@ -45,7 +45,11 @@ f6 (double *x, int stepx, unsigned int limit)
*y = 100;
}
#if __SIZEOF_SIZE_T__ < 4
double x[1000];
#else
double x[10000];
#endif
void
g1 (int stepx, int n)

View File

@ -1,5 +1,5 @@
/* { dg-options "-O3 -fdump-tree-lversion-details" } */
/* { dg-require-effective-target size32plus } */
/* { dg-require-effective-target size20plus } */
/* Versioning for step == 1 in these loops would allow loop interchange,
but otherwise isn't worthwhile. At the moment we decide not to version. */

View File

@ -1,10 +1,4 @@
#if defined(_LP64)
typedef unsigned long int uintptr_t;
#elif defined (_WIN64)
typedef unsigned long long int uintptr_t;
#else
typedef unsigned int uintptr_t;
#endif
typedef __UINTPTR_TYPE__ uintptr_t;
extern void srand (uintptr_t);

View File

@ -3,16 +3,18 @@
/* { dg-lto-options { { -flto -O2 } } } */
/* { dg-extra-ld-options { -r -nostdlib -flinker-output=nolto-rel } } */
typedef unsigned uint32_t __attribute__((mode (__SI__)));
typedef struct abc_s {
char a1;
short a2;
unsigned int a3;
unsigned int a4;
uint32_t a3;
uint32_t a4;
} abc;
typedef struct xyz_s {
unsigned x1;
unsigned x2;
uint32_t x1;
uint32_t x2;
abc *x3;
} xyz;

View File

@ -1,14 +1,16 @@
typedef unsigned uint32_t __attribute__((mode (__SI__)));
typedef struct abc_s {
char a1;
short a2;
unsigned int a3;
unsigned int a4;
uint32_t a3;
uint32_t a4;
} abc;
typedef struct xyz_s {
unsigned int x1;
unsigned int x2;
uint32_t x1;
uint32_t x2;
abc *x3;
} xyz;

View File

@ -1,14 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -Wstrict-overflow=3" } */
#if (__SIZEOF_LONG_LONG__ == __SIZEOF_POINTER__)
typedef unsigned long long ptrcast;
#elif (__SIZEOF_LONG__ == __SIZEOF_POINTER__)
typedef unsigned long ptrcast;
#elif (__SIZEOF_INT__ == __SIZEOF_POINTER__)
typedef unsigned int ptrcast;
#else
#error Add target support here
#endif
typedef __UINTPTR_TYPE__ ptrcast;
volatile unsigned long *
sat_add(volatile unsigned long *ptr, unsigned long i, volatile unsigned long *end)

View File

@ -3,7 +3,8 @@
/* { dg-options "" } */
#define L \
(sizeof (__SIZE_TYPE__) == 1 ? __SCHAR_MAX__ \
(sizeof (__SIZE_TYPE__) == sizeof (void *) ? __INTPTR_MAX__ \
: sizeof (__SIZE_TYPE__) == 1 ? __SCHAR_MAX__ \
: sizeof (__SIZE_TYPE__) == sizeof (short) ? __SHRT_MAX__ \
: sizeof (__SIZE_TYPE__) == sizeof (int) ? __INT_MAX__ \
: sizeof (__SIZE_TYPE__) == sizeof (long) ? __LONG_MAX__ \

View File

@ -32,6 +32,6 @@ foo (int i)
-7, /* { dg-warning "15:-Wsign-conversion" } */
-8); /* { dg-warning "16:-Wsign-conversion" } */
bazu (i, i); /* { dg-warning "9:conversion" } */
bazi (0x8, 0x80000000); /* { dg-warning "14:-Wsign-conversion" "first" { xfail int16 } } */
bazi (0x8, 0x80000000); /* { dg-warning "14:-Wsign-conversion" "first" { target { ! int16 } } } */
/* { dg-warning "overflow in conversion from" "second" { target int16 } .-1 } */
}

View File

@ -1,15 +1,17 @@
/* { dg-do compile } */
/* { dg-options "-O2" } */
void bar (int);
typedef int int32_t __attribute__((mode (__SI__)));
void bar (int32_t);
void
foo ()
{
int index = 0;
int32_t index = 0;
for (index; index <= 10; index--)
for (index; index <= 10; index--) // expected warning here
/* Result of the following multiply will overflow
when converted to signed int. */
when converted to signed int32_t. */
bar ((0xcafe + index) * 0xdead); /* { dg-warning "iteration \[0-9\]+ invokes undefined behavior" } */
}

Some files were not shown because too many files have changed in this diff Show More