plateform
stringclasses 1
value | repo_name
stringclasses 2
values | name
stringlengths 1
78
| ext
stringclasses 2
values | path
stringlengths 15
1.11k
| size
int64 1
8.55M
| source_encoding
stringclasses 11
values | md5
stringlengths 32
32
| text
stringlengths 0
8.49M
|
---|---|---|---|---|---|---|---|---|
google
|
chromium
|
vector12
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/vector12.C
| 88 |
utf_8
|
173dc80ba2834a9afdc07f599ac08c74
|
// PR c++/34917
// { dg-do compile }
const int i __attribute ((vector_size (8))) = {};
|
google
|
chromium
|
gnu-inline-template-func
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/gnu-inline-template-func.C
| 562 |
utf_8
|
df8bb001c84f32307c935ddafd4b28e1
|
/* { dg-do compile } */
/* { dg-options "-O" } */ // such that static functions are optimized out
/* { dg-final { scan-assembler "func1" } } */
/* { dg-final { scan-assembler "func2" } } */
/* { dg-final { scan-assembler-not "func3" } } */
/* { dg-final { scan-assembler "func4" } } */
/* { dg-final { scan-assembler-not "func5" } } */
#define defpfx template <typename T>
#include "gnu-inline-global.C"
template int func1<int>(void);
template int func2<int>(void);
template int func3<int>(void);
template int func4<int>(void);
template int func5<int>(void);
|
google
|
chromium
|
vla1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/vla1.C
| 525 |
utf_8
|
8d703bcc46788d72b8227a16a1decdf8
|
// { dg-do compile }
// Crash tests from PR middle-end/6994. See also gcc.dg/vla-2.c.
// A::A is acceptable extended C++ (VLA types brought over from C99);
// B::B is not, but is closely related to acceptable extended C, though
// not to acceptable C99.
class A { A (int); };
A::A (int i)
{
int ar[1][i]; // { dg-error "variable length array" }
ar[0][0] = 0;
}
class B { B (int); };
B::B (int i)
{
struct S {
int ar[1][i]; // { dg-error "array" }
} s;
s.ar[0][0] = 0; // { dg-error "no member" }
}
|
google
|
chromium
|
altivec-3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/altivec-3.C
| 3,484 |
utf_8
|
d3261ef497bef041056bc7661e3a3686
|
/* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
/* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec" } */
/* Test for correct handling of AltiVec constants passed
through '...' (va_arg). */
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <altivec.h>
#define CHECK_INVARIANT(expr) \
if (!(expr)) { \
printf ("ASSERT FAILED: %d: %s\n", __LINE__, #expr); \
abort (); \
}
struct foo { int x; int y; };
struct vfoo { int x; __vector signed int v; int y; };
union u { __vector signed int v; signed int i[4]; };
struct foo x_g = { 3, 4};
struct vfoo vx_g = { 10, {11, 12, 13, 14}, 15 };
__vector signed int v_g = {22, 23, 24, 25};
struct vfoo vx2_g = { 30, {31, 32, 33, 34}, 35 };
__vector signed int v2_g = {40, 41, 42, 43};
int i_1 = 99, i_2 = 33;
double d_2 = 1.5, d_3 = 1.75;
double ld_1 = 1.25;
void bar (int i, ... )
{
struct foo xi;
double d;
double ld;
float f;
char c;
short s;
va_list ap;
va_start(ap, i);
xi = va_arg(ap, struct foo);
s = (short)va_arg(ap, int);
f = (float)va_arg(ap, double);
ld = va_arg(ap, double);
c = (char)va_arg(ap, int);
d = va_arg(ap, double);
va_end(ap);
CHECK_INVARIANT (xi.x == x_g.x && xi.y == x_g.y);
CHECK_INVARIANT (s == (short)i_2);
CHECK_INVARIANT (f == (float)d_2);
CHECK_INVARIANT (ld == ld_1);
CHECK_INVARIANT (c == (char)i_1);
CHECK_INVARIANT (d == d_3);
}
void baz (int i, ... )
{
struct vfoo vx, vx2;
__vector signed int v_i, v2_i;
int j, k, l;
va_list ap;
va_start(ap, i);
v_i = va_arg(ap, __vector signed int);
j = va_arg(ap, int);
vx = va_arg(ap, struct vfoo);
k = va_arg(ap, int);
v2_i = va_arg(ap, __vector signed int);
l = va_arg(ap, int);
vx2 = va_arg(ap, struct vfoo);
va_end(ap);
CHECK_INVARIANT (vec_all_eq (v_i, v_g));
CHECK_INVARIANT (j == i_1);
CHECK_INVARIANT (vx.x == vx_g.x);
CHECK_INVARIANT (vec_all_eq (vx.v, vx_g.v));
CHECK_INVARIANT (vx.y == vx_g.y);
CHECK_INVARIANT (k == i_1);
CHECK_INVARIANT (vec_all_eq (v2_i, v2_g));
CHECK_INVARIANT (l == i_1);
CHECK_INVARIANT (vx2.x == vx2_g.x);
CHECK_INVARIANT (vec_all_eq (vx2.v, vx2_g.v));
CHECK_INVARIANT (vx2.y == vx2_g.y);
}
void quux (int i, ... )
{
__vector signed int v_i, v2_i;
union u vi, v2i;
va_list ap;
va_start(ap, i);
v_i = va_arg(ap, __vector signed int);
v2_i = va_arg(ap, __vector signed int);
va_end(ap);
vi.v = v_i;
v2i.v = v2_i;
CHECK_INVARIANT (vec_all_eq (v_i, v_g));
CHECK_INVARIANT (vec_all_eq (v2_i, v_g));
CHECK_INVARIANT (vec_all_eq (vi.v, v_g));
CHECK_INVARIANT (vec_all_eq (v2i.v, v_g));
}
void baz2 (int i, ... )
{
struct vfoo vx;
union u vxi;
va_list ap;
va_start(ap, i);
vx = va_arg(ap, struct vfoo);
va_end(ap);
vxi.v = vx.v;
CHECK_INVARIANT (vx.x == vx_g.x);
CHECK_INVARIANT (vec_all_eq (vx.v, vx_g.v));
CHECK_INVARIANT (vx.y == vx_g.y);
CHECK_INVARIANT (vec_all_eq (vxi.v, vx_g.v));
}
void main1(void)
{
CHECK_INVARIANT (sizeof(struct foo) == 8 && sizeof(struct vfoo) == 48);
bar(i_1, x_g, (short)i_2, (float)d_2, ld_1, (char)i_1, d_3);
baz(i_1, v_g, i_1, vx_g, i_1, v2_g, i_1, vx2_g);
quux(i_1, v_g, v_g);
baz2(i_1, vx_g);
}
int main(void)
{
main1();
return 0;
}
|
google
|
chromium
|
builtin6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/builtin6.C
| 300 |
utf_8
|
b7c9d67e055f43c68752eb5dee97ef5b
|
// PR c++/19044
// Verify that alternate asm name for builtin named "foo" also gets
// applied to its sibling "__builtin_foo".
// { dg-do compile }
// { dg-final { scan-assembler "fancy_sin" } }
extern "C" double sin(double) __asm("_fancy_sin");
double foo(double x) { return __builtin_sin(x); }
|
google
|
chromium
|
attrib8
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/attrib8.C
| 262 |
utf_8
|
96c6791e16518bc1891b0b699b2ec487
|
// PR 8656
// { dg-do compile { target i?86-*-* x86_64-*-* } }
// { dg-require-effective-target ilp32 }
extern int * (__attribute__((stdcall)) *fooPtr)( void);
int * __attribute__((stdcall)) myFn01( void) { return 0; }
void snafu( void)
{
fooPtr = myFn01;
}
|
google
|
chromium
|
anon-struct4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/anon-struct4.C
| 157 |
utf_8
|
9ab8118751608e965f6bdd1d74306f13
|
// PR c++/14401
struct { struct { int& i ; } bar ; } foo ; // { dg-error "uninitialized" "uninit" }
// { dg-warning "anonymous" "anon" { target *-*-* } 3 }
|
google
|
chromium
|
va-arg-pack-len-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/va-arg-pack-len-1.C
| 2,565 |
utf_8
|
5767d28306995682901a8025cc09bcf5
|
// { dg-do run }
// { dg-options "-O2" }
#include <stdarg.h>
extern "C" int error_open_missing_mode (void)
__attribute__((__error__ ("open with O_CREAT needs 3 arguments, only 2 were given")));
extern "C" int warn_open_too_many_arguments (void)
__attribute__((__warning__ ("open called with more than 3 arguments")));
extern "C" void abort (void);
char expected_char;
__attribute__((noinline)) int
myopen2 (const char *path, int oflag)
{
if (expected_char++ != path[0] || path[1] != '\0')
abort ();
switch (path[0])
{
case 'f':
if (oflag != 0x2)
abort ();
break;
case 'g':
if (oflag != 0x43)
abort ();
// In real __open_2 this would terminate the program:
// open with O_CREAT without third argument.
return -6;
default:
abort ();
}
return 0;
}
__attribute__((noinline)) int
myopenva (const char *path, int oflag, ...)
{
int mode = 0;
va_list ap;
if ((oflag & 0x40) != 0)
{
va_start (ap, oflag);
mode = va_arg (ap, int);
va_end (ap);
}
if (expected_char++ != path[0] || path[1] != '\0')
abort ();
switch (path[0])
{
case 'a':
if (oflag != 0x43 || mode != 0644)
abort ();
break;
case 'b':
if (oflag != 0x3)
abort ();
break;
case 'c':
if (oflag != 0x2)
abort ();
break;
case 'd':
if (oflag != 0x43 || mode != 0600)
abort ();
break;
case 'e':
if (oflag != 0x3)
abort ();
break;
default:
abort ();
}
return 0;
}
extern inline __attribute__((always_inline, gnu_inline)) int
myopen (const char *path, int oflag, ...)
{
if (__builtin_va_arg_pack_len () > 1)
warn_open_too_many_arguments ();
if (__builtin_constant_p (oflag))
{
if ((oflag & 0x40) != 0 && __builtin_va_arg_pack_len () < 1)
{
error_open_missing_mode ();
return myopen2 (path, oflag);
}
return myopenva (path, oflag, __builtin_va_arg_pack ());
}
if (__builtin_va_arg_pack_len () < 1)
return myopen2 (path, oflag);
return myopenva (path, oflag, __builtin_va_arg_pack ());
}
volatile int l0;
int
main (void)
{
expected_char = 'a';
if (myopen ("a", 0x43, 0644))
abort ();
if (myopen ("b", 0x3, 0755))
abort ();
if (myopen ("c", 0x2))
abort ();
if (myopen ("d", l0 + 0x43, 0600))
abort ();
if (myopen ("e", l0 + 0x3, 0700))
abort ();
if (myopen ("f", l0 + 0x2))
abort ();
// Invalid use of myopen, but only detectable at runtime.
if (myopen ("g", l0 + 0x43) != -6)
abort ();
return 0;
}
|
google
|
chromium
|
complit7
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/complit7.C
| 81 |
utf_8
|
e710a424682710a7b643aeb0875d892d
|
// PR c++/27807
// { dg-options "" }
int i = (int()){0}; // { dg-error "type" }
|
google
|
chromium
|
label5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/label5.C
| 181 |
utf_8
|
cd2b25de330220dc6703e78dbb48bdee
|
// { dg-options "" }
// PR c++/24052
struct A { };
int main() { b: A() && && b; } // { dg-error "A\\(\\) && && *b" }
// { dg-message "candidate" "additional" { target *-*-* } 5 }
|
google
|
chromium
|
stmtexpr5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/stmtexpr5.C
| 156 |
utf_8
|
a6cc01634e0bd707301c873f2d35f891
|
// PR c++/21440
// { dg-options "" }
struct Foo {
~Foo();
int i;
};
void bar() {
Foo foo = ({
Foo bletch;
bletch.i = 0;
bletch;
});
}
|
google
|
chromium
|
interface2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/interface2.C
| 186 |
utf_8
|
869c6cc33c04831bc61047af9a9ac5fc
|
// PR c++/26195
// { dg-do link }
// { dg-additional-sources "interface2b.cc" }
// { dg-options "-fno-inline" }
#pragma implementation "interface2-imaginary.h"
#include "interface2a.h"
|
google
|
chromium
|
has_nothrow_copy-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/has_nothrow_copy-1.C
| 1,999 |
utf_8
|
bebddf14a198be01c01151a6a32442df
|
// { dg-do "run" }
#include <cassert>
struct A
{
double a;
double b;
};
struct B
{
A a;
};
struct C
: public A { };
struct D
{
D(const D&) throw() { }
};
struct E
{
E(const E&) throw(int) { }
};
struct E1
{
E1(const E1&) throw(int) { throw int(); }
};
struct F
{
F() throw() { }
};
struct G
{
G() throw(int) { throw int(); }
};
struct H
{
H(H&) throw(int) { }
};
struct H1
{
H1(H1&) throw(int) { throw int(); }
};
struct I
{
I(I&) throw(int) { }
I(const I&) throw() { }
};
struct I1
{
I1(I1&) throw(int) { throw int(); }
I1(const I1&) throw() { }
};
struct J
{
J(J&) throw() { }
J(const J&) throw() { }
J(volatile J&) throw() { }
J(const volatile J&) throw() { }
};
template<typename T>
bool
f()
{ return __has_nothrow_copy(T); }
template<typename T>
class My
{
public:
bool
f()
{ return !!__has_nothrow_copy(T); }
};
template<typename T>
class My2
{
public:
static const bool trait = __has_nothrow_copy(T);
};
template<typename T>
const bool My2<T>::trait;
template<typename T, bool b = __has_nothrow_copy(T)>
struct My3_help
{ static const bool trait = b; };
template<typename T, bool b>
const bool My3_help<T, b>::trait;
template<typename T>
class My3
{
public:
bool
f()
{ return My3_help<T>::trait; }
};
#define PTEST(T) (__has_nothrow_copy(T) && f<T>() \
&& My<T>().f() && My2<T>::trait && My3<T>().f())
#define NTEST(T) (!__has_nothrow_copy(T) && !f<T>() \
&& !My<T>().f() && !My2<T>::trait && !My3<T>().f())
int main()
{
assert (PTEST (int));
assert (NTEST (int (int)));
assert (NTEST (void));
assert (PTEST (A));
assert (PTEST (B));
assert (NTEST (C[]));
assert (PTEST (D));
assert (NTEST (E));
assert (NTEST (E1));
assert (PTEST (F));
assert (PTEST (G));
assert (NTEST (H));
assert (NTEST (H1));
assert (NTEST (I));
assert (NTEST (I1));
assert (PTEST (J));
return 0;
}
|
google
|
chromium
|
bitfield5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/bitfield5.C
| 291 |
utf_8
|
5ae84e299d858dd174f54056c4a452d1
|
/* { dg-do compile } */
/* { dg-options "-Wno-packed-bitfield-compat" } */
/* { dg-options "-Wno-packed-bitfield-compat -mno-ms-bitfields" { target i?86-*-netware } } */
struct t
{
char a:4;
char b:8 __attribute__ ((packed));
char c:4;
};
int assrt[sizeof (struct t) == 2 ? 1 : -1];
|
google
|
chromium
|
typename1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/typename1.C
| 303 |
utf_8
|
a55635b999e217d4900dcb3975178408
|
// PR c++/6255
// { dg-options "-fpermissive -w" }
template <class T> struct A { typedef int X; };
template <class T> struct B { typedef A<T> Y; void f (typename Y::X); };
template <class T, class T1, class T2, class T3> struct C : public B<T> { void g (typename B<T>::Y::X); };
template class B<int>;
|
google
|
chromium
|
asm11
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/asm11.C
| 862 |
utf_8
|
25fbbf0ac13b6baebc40ebabaedfe317
|
// PR c/37772
// { dg-do compile }
// { dg-options "" }
void
foo ()
{
int i;
asm (); // { dg-error "expected string-literal before" }
asm (1); // { dg-error "expected string-literal before" }
asm (int); // { dg-error "expected string-literal before" }
asm (: "=r" (i)); // { dg-error "expected string-literal before" }
asm (1 : "=r" (i)); // { dg-error "expected string-literal before" }
asm (int : "=r" (i)); // { dg-error "expected string-literal before" }
asm (: : "r" (i)); // { dg-error "expected string-literal before" }
asm (1 : : "r" (i)); // { dg-error "expected string-literal before" }
asm (int : : "r" (i)); // { dg-error "expected string-literal before" }
asm (: : : "memory"); // { dg-error "expected string-literal before" }
asm (1 : : : "memory"); // { dg-error "expected string-literal before" }
}
|
google
|
chromium
|
flexary1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/flexary1.C
| 435 |
utf_8
|
c0dc41d4a72302e0ac9ef29725c83d30
|
// { dg-do compile }
// PR c++ 11614
typedef int ary_t[];
struct test
{
ary_t *b;
int (*a)[]; // this is not a flexible array member
};
void test(void)
{
struct test s;
int (*a)[] = 0;
ary_t *b = 0;
a = s.a;
a = s.b;
s.a = a;
s.b = a;
b = s.a;
b = s.b;
s.a = b;
s.b = b;
}
|
google
|
chromium
|
complex1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/complex1.C
| 148 |
utf_8
|
15f53dad7ebd6c04a3f9232631c7a032
|
/* { dg-options "" } */
/* { dg-do compile } */
// Testing if we can do a new of a complex type
// PR C++/28450
void* q = new __complex__ int ();
|
google
|
chromium
|
attrib22
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/attrib22.C
| 105 |
utf_8
|
833f8e3e0d22842c6ce92cb71319b39f
|
// PR c++/27648
void f()
{
static_cast<float *__attribute((unused))>(0); // { dg-error "expected" }
}
|
google
|
chromium
|
utf16-4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/utf16-4.C
| 887 |
utf_8
|
ac5f1f302552d2e9b354d67c0e3a8a40
|
/* Expected errors for char16_t character constants. */
/* { dg-do compile } */
/* { dg-options "-std=c++0x" } */
const static char16_t c0 = u''; /* { dg-error "empty character" } */
const static char16_t c1 = u'ab'; /* { dg-warning "constant too long" } */
const static char16_t c2 = u'\U00064321'; /* { dg-warning "constant too long" } */
const static char16_t c3 = 'a';
const static char16_t c4 = U'a';
const static char16_t c5 = U'\u2029';
const static char16_t c6 = U'\U00064321'; /* { dg-warning "implicitly truncated" } */
const static char16_t c7 = L'a';
const static char16_t c8 = L'\u2029';
const static char16_t c9 = L'\U00064321'; /* { dg-warning "implicitly truncated" "" { target { 4byte_wchar_t } } 16 } */
/* { dg-warning "constant too long" "" { target { ! 4byte_wchar_t } } 16 } */
int main () {}
|
google
|
chromium
|
vector1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/vector1.C
| 162 |
utf_8
|
1e6ab4b0a8dd095b526fad3f97ec5a91
|
// PR c++/11895
// This used to ICE in reshape_init.
__attribute__((vector_size(16))) int a1 = { 100, 200, 300, 400 };
|
google
|
chromium
|
fpreg1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/fpreg1.C
| 3,866 |
utf_8
|
60898b718df5cec3ef7222e3b1257e0f
|
// Test permitted and invalid uses of __fpreg, for C++.
// { dg-do compile { target ia64-*-* } }
// { dg-options "" }
__float80 f80;
double d;
// Default initialized __fpreg is OK.
__fpreg fpreg, fpreg2;
// But explicitly zero-initialized is an invalid conversion.
__fpreg fi = 0; // { dg-error "invalid conversion to '__fpreg'" }
__fpreg f0 (__fpreg);
int f1 (__float80);
// __fpreg in a structure is OK.
struct s {
__float80 b;
__fpreg a;
} x;
void
f (void)
{
__fpreg *p;
// Valid operations.
fpreg = fpreg2;
fpreg2 = (__fpreg) fpreg;
fpreg = f0 (fpreg2);
fpreg = +fpreg2;
p = &fpreg;
(void) fpreg;
fpreg = x.a;
fpreg2 = (struct s) { 0 }.a;
fpreg = (d ? fpreg : fpreg2);
d = sizeof (fpreg);
(void)(fpreg, fpreg);
// Invalid operations.
++fpreg; // { dg-error "invalid operation on '__fpreg'" }
--fpreg; // { dg-error "invalid operation on '__fpreg'" }
fpreg++; // { dg-error "invalid operation on '__fpreg'" }
fpreg--; // { dg-error "invalid operation on '__fpreg'" }
fpreg = -fpreg; // { dg-error "invalid operation on '__fpreg'" }
fpreg = ~fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = !fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = *fpreg; // { dg-error "invalid type argument" }
if (fpreg) // { dg-error "invalid conversion from '__fpreg'" }
return;
d = fpreg; // { dg-error "invalid conversion from '__fpreg'" }
d = (double) fpreg; // { dg-error "invalid conversion from '__fpreg'" }
fpreg = (__fpreg) d; // { dg-error "invalid conversion to '__fpreg'" }
fpreg = fpreg * fpreg; // { dg-error "invalid operation on '__fpreg'" }
fpreg = fpreg / fpreg; // { dg-error "invalid operation on '__fpreg'" }
fpreg = fpreg % fpreg; // { dg-error "invalid operation on '__fpreg'" }
fpreg = fpreg + fpreg; // { dg-error "invalid operation on '__fpreg'" }
fpreg = fpreg - fpreg; // { dg-error "invalid operation on '__fpreg'" }
fpreg = fpreg << fpreg; // { dg-error "invalid operation on '__fpreg'" }
fpreg = fpreg >> fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = fpreg < fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = fpreg > fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = fpreg <= fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = fpreg >= fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = fpreg == fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = fpreg != fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = fpreg & fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = fpreg ^ fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = fpreg | fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = fpreg && fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = fpreg || fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = (fpreg ? 1 : 2); // { dg-error "invalid conversion from '__fpreg'" }
fpreg = (d ? fpreg : d); // { dg-error "invalid conversion to '__fpreg'" }
fpreg *= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
fpreg /= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
fpreg %= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
fpreg += fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
fpreg -= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
fpreg <<= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
fpreg >>= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
fpreg &= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
fpreg ^= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
fpreg |= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
}
|
google
|
chromium
|
packed2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/packed2.C
| 680 |
utf_8
|
de5f86b7a10350b9ce405e101438c412
|
// PR c++/10091
// Original synopsis
// Bug: We were dying because in general, B::a doesn't have enough
// alignment for us to take its address. But if the B is C::b, it does
// have enough alignment, and we should be able to determine that.
// This only failed on STRICT_ALIGNMENT targets (i.e. not i686)
// July 2003
// packing of non-pods is now only allowed if the non-pod is itself
// packed. Also only such pods can be reference bound to non-consts
struct A {
int i;
A();
A(const A&);
A& operator=(const A&);
} __attribute__ ((packed));
struct B {
A a;
} __attribute__ ((packed));
struct C {
B b;
int j;
};
void f (A&);
void g (C& c)
{
f (c.b.a);
}
|
google
|
chromium
|
always_inline-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/always_inline-1.C
| 429 |
utf_8
|
644c5b82757cda2bb4ab9658b9dff77a
|
// { dg-options "-O0" }
// { dg-do compile }
// PR C++/34715
namespace X
{
template <class T>
const T& min(const T& a, const T& b);
template <class T>
inline __attribute__ ((always_inline)) const T& min(const T& a, const T& b)
{
return a < b ? a : b;
}
}
template <class T>
inline __attribute__ ((always_inline)) T y(const T& a, const T& b)
{
return X::min(a, b);
}
int main()
{
int a = 0, b = 0;
return y(a, b);
}
|
google
|
chromium
|
cleanup-5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/cleanup-5.C
| 1,292 |
utf_8
|
5163d55058f3e9b1c2787f0e8f021dff
|
/* HP-UX libunwind.so doesn't provide _UA_END_OF_STACK */
/* { dg-do run } */
/* { dg-options "-fexceptions" } */
/* { dg-skip-if "" { "ia64-*-hpux11.*" } { "*" } { "" } } */
/* Verify that cleanups work with exception handling. */
#include <unwind.h>
#include <stdlib.h>
#include <string.h>
static _Unwind_Reason_Code
force_unwind_stop (int version, _Unwind_Action actions,
_Unwind_Exception_Class exc_class,
struct _Unwind_Exception *exc_obj,
struct _Unwind_Context *context,
void *stop_parameter)
{
if (actions & _UA_END_OF_STACK)
abort ();
return _URC_NO_REASON;
}
static void force_unwind ()
{
struct _Unwind_Exception *exc
= (struct _Unwind_Exception *) malloc (sizeof (*exc));
memset (&exc->exception_class, 0, sizeof (exc->exception_class));
exc->exception_cleanup = 0;
#ifndef __USING_SJLJ_EXCEPTIONS__
_Unwind_ForcedUnwind (exc, force_unwind_stop, 0);
#else
_Unwind_SjLj_ForcedUnwind (exc, force_unwind_stop, 0);
#endif
abort ();
}
static void handler (void *p __attribute__((unused)))
{
exit (0);
}
static void doit ()
{
char dummy __attribute__((cleanup (handler)));
force_unwind ();
}
int main()
{
doit ();
abort ();
}
|
google
|
chromium
|
is_base_of_diagnostic
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/is_base_of_diagnostic.C
| 142 |
utf_8
|
1d02d3da81936dbac4acf7fc5bab3598
|
class A
{ };
class B;
union C
{ };
union D;
void f()
{
__is_base_of(A, B); // { dg-error "incomplete type" }
__is_base_of(C, D);
}
|
google
|
chromium
|
builtin1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/builtin1.C
| 281 |
utf_8
|
2688425f4bb09561395ab602acbbe5c1
|
// Test whether alternate 'asm' name is applied correctly to
// builtin in global namespace
// { dg-do compile }
// { dg-options "" }
// { dg-final { scan-assembler "fancy_printf" } }
extern "C" int printf(const char*, ...) __asm("_fancy_printf");
void foo() { printf("abc"); }
|
google
|
chromium
|
attrib17
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/attrib17.C
| 511 |
utf_8
|
5ce9613d48cc00994b9fa919e8cc1293
|
// { dg-do compile }
// Origin: Benjamin Kosnik <bkoz at gcc dot gnu dot org>
// PR c++/17743: Attributes applied to typedefs.
struct A {
typedef char layout_type[sizeof(double)]
__attribute__((aligned(__alignof__(double))));
layout_type data;
};
struct B {
typedef char layout_type[sizeof(double)];
layout_type data __attribute__((aligned(__alignof__(double))));
};
template<bool> struct StaticAssert;
template<> struct StaticAssert<true> {};
StaticAssert<__alignof__(A) == __alignof__(B)> a1;
|
google
|
chromium
|
vector8
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/vector8.C
| 393 |
utf_8
|
2eae796d26829372d14224527a39750b
|
/* { dg-do compile } */
/* { dg-options "" } */
/* Check for application of |, ^, and & on vector types. */
#define vector __attribute__((vector_size(16) ))
vector float a;
vector int a1;
vector float b;
vector int b1;
int f(void)
{
a = a | b; /* { dg-error "" } */
a = a & b; /* { dg-error "" } */
a = a ^ b; /* { dg-error "" } */
a1 = a1 | b1;
a1 = a1 & b1;
a1 = a1 ^ b1;
}
|
google
|
chromium
|
is_polymorphic
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/is_polymorphic.C
| 1,280 |
utf_8
|
cfa9503b4961ef09af7a624c704b0e86
|
// { dg-do "run" }
#include <cassert>
#include <exception>
struct A
{
double a;
double b;
};
class B
{
virtual void rotate(int) { }
};
class C
: public B { };
union U
{
double a;
double b;
};
template<typename T>
bool
f()
{ return __is_polymorphic(T); }
template<typename T>
class My
{
public:
bool
f()
{ return !!__is_polymorphic(T); }
};
template<typename T>
class My2
{
public:
static const bool trait = __is_polymorphic(T);
};
template<typename T>
const bool My2<T>::trait;
template<typename T, bool b = __is_polymorphic(T)>
struct My3_help
{ static const bool trait = b; };
template<typename T, bool b>
const bool My3_help<T, b>::trait;
template<typename T>
class My3
{
public:
bool
f()
{ return My3_help<T>::trait; }
};
#define PTEST(T) (__is_polymorphic(T) && f<T>() \
&& My<T>().f() && My2<T>::trait && My3<T>().f())
#define NTEST(T) (!__is_polymorphic(T) && !f<T>() \
&& !My<T>().f() && !My2<T>::trait && !My3<T>().f())
int main()
{
assert (NTEST (int));
assert (NTEST (void));
assert (PTEST (std::exception));
assert (NTEST (A));
assert (PTEST (B));
assert (NTEST (C[]));
assert (NTEST (U));
return 0;
}
|
google
|
chromium
|
altivec-8
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/altivec-8.C
| 757 |
utf_8
|
683588ba7d8e9b0d8436b68f5b28c8cb
|
/* { dg-do compile { target powerpc*-*-* } } */
/* { dg-require-effective-target powerpc_altivec_ok } */
/* This test case exercises intrinsic/argument combinations that,
while not in the Motorola AltiVec PIM, have nevertheless crept
into the AltiVec vernacular over the years. */
#include <altivec.h>
void foo (void)
{
vector bool int boolVec1 = (vector bool int) vec_splat_u32(3);
vector bool short boolVec2 = (vector bool short) vec_splat_u16(3);
vector bool char boolVec3 = (vector bool char) vec_splat_u8(3);
boolVec1 = vec_sld( boolVec1, boolVec1, 4 );
boolVec2 = vec_sld( boolVec2, boolVec2, 2 );
boolVec3 = vec_sld( boolVec3, boolVec3, 1 );
}
|
google
|
chromium
|
altivec-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/altivec-1.C
| 284 |
utf_8
|
f94bcd708feb1a029065a7503b545f54
|
/* { dg-do compile { target powerpc*-*-* } } */
/* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec" } */
#include <altivec.h>
int main()
{
return 0;
}
class F32vec4 {
public:
vector float val;
vector float operator++(void) { return val;}
};
|
google
|
chromium
|
gnu-inline-namespace
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/gnu-inline-namespace.C
| 391 |
utf_8
|
b4a8192e545a20f5b7dea0d9fb8a6f63
|
/* { dg-do compile } */
/* { dg-options "-O" } */ // such that static functions are optimized out
/* { dg-final { scan-assembler "func1" } } */
/* { dg-final { scan-assembler "func2" } } */
/* { dg-final { scan-assembler-not "func3" } } */
/* { dg-final { scan-assembler "func4" } } */
/* { dg-final { scan-assembler-not "func5" } } */
namespace gnu_test {
#include "gnu-inline-global.C"
}
|
google
|
chromium
|
attrib33
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/attrib33.C
| 254 |
utf_8
|
b4d4dad31de4936353878d38d9bf3387
|
// PR c++/35546
// { dg-do compile }
template <int N>
struct T
{
void foo (char const * ...) __attribute__ ((format (printf,2,3)));
};
template struct T<3>;
template <typename T>
struct U
{
typedef T __attribute__((mode (SI))) V;
};
U<int>::V v;
|
google
|
chromium
|
altivec-cell-2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/altivec-cell-2.C
| 2,503 |
utf_8
|
ee8876bb4c7e26216a124a7d6118d4ed
|
/* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
/* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec" } */
/* Test the vec_extract VMX intrinsics. */
#include <altivec.h>
extern "C" void abort (void);
vector int a = {0, 1, 2, 3};
vector short b = {0, 1, 2, 3, 4, 5, 6, 7};
int f(vector int a, int b)
{
return vec_extract (a, b);
}
int f0 (vector int a)
{
return vec_extract (a, 0);
}
int f1 (vector int a)
{
return vec_extract (a, 1);
}
int f2 (vector int a)
{
return vec_extract (a, 2);
}
int f3 (vector int a)
{
return vec_extract (a, 3);
}
int f4 (vector int a)
{
return vec_extract (a, 4);
}
int g(vector short a, int b)
{
return vec_extract (a, b);
}
int g0 (vector short a)
{
return vec_extract (a, 0);
}
int g1 (vector short a)
{
return vec_extract (a, 1);
}
int g2 (vector short a)
{
return vec_extract (a, 2);
}
int g3 (vector short a)
{
return vec_extract (a, 3);
}
int g4 (vector short a)
{
return vec_extract (a, 4);
}
int g5 (vector short a)
{
return vec_extract (a, 5);
}
int g6 (vector short a)
{
return vec_extract (a, 6);
}
int g7 (vector short a)
{
return vec_extract (a, 7);
}
int g8 (vector short a)
{
return vec_extract (a, 8);
}
int main1(void) __attribute__((noinline));
int main1(void)
{
int i;
/* Check vec_extract with a non constant element numbering */
for(i=0;i<10;i++)
{
if (f(a, i) != (i&0x3))
abort ();
}
/* Check vec_extract with a constant element numbering */
if (f0(a) != 0)
abort ();
if (f1(a) != 1)
abort ();
if (f2(a) != 2)
abort ();
if (f3(a) != 3)
abort ();
/* Check that vec_extract works with a constant element higher than
the number of elements. */
if (f4(a) != 0)
abort ();
/* Check vec_extract with a non constant element numbering */
for(i=0;i<10;i++)
{
if (g(b, i) != (i&0x7))
abort ();
}
/* Check vec_extract with a constant element numbering */
if (g0(b) != 0)
abort ();
if (g1(b) != 1)
abort ();
if (g2(b) != 2)
abort ();
if (g3(b) != 3)
abort ();
if (g4(b) != 4)
abort ();
if (g5(b) != 5)
abort ();
if (g6(b) != 6)
abort ();
if (g7(b) != 7)
abort ();
/* Check that vec_extract works with a constant element higher than
the number of elements. */
if (g8(b) != 0)
abort ();
return 0;
}
int main(void)
{
return main1 ();
}
|
google
|
chromium
|
utf-type
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/utf-type.C
| 427 |
utf_8
|
7a8ffbc3282a1e0c0bf5fe1f463f8c28
|
/* Ensure that __CHAR16_TYPE__ and __CHAR32_TYPE__ exist, match the types they
are the underlying data type for. */
/* { dg-do run } */
/* { dg-options "-std=c++0x -Wall -Werror" } */
extern "C" void abort (void);
int main ()
{
if (sizeof (__CHAR16_TYPE__) != sizeof (char16_t))
abort();
if (sizeof (__CHAR32_TYPE__) != sizeof (char32_t))
abort();
}
|
google
|
chromium
|
altivec-14
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/altivec-14.C
| 352 |
utf_8
|
35f5233dc3266b57653c840644e9cbd2
|
/* { dg-do compile { target powerpc*-*-* } } */
/* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec" } */
void f (__attribute__((altivec (vector__))) signed int * a,
__attribute__((altivec (vector__))) signed int * const b);
int
foo (void)
{
__attribute__((altivec (vector__))) signed int a[1], b[1];
f (a, b);
}
|
google
|
chromium
|
tmplattr6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/tmplattr6.C
| 192 |
utf_8
|
b2cbeefe0b660f19695decd8817dfef1
|
// Don't crash on an unknown attribute.
struct foo {
template <class T>
void __attribute__((leafify)) bar() {} // { dg-warning "ignored" }
};
void bar(void)
{
foo f;
f.bar<int>();
}
|
google
|
chromium
|
asm6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/asm6.C
| 117 |
utf_8
|
0689b61a59bc7c15432dc6d704aebb9f
|
struct A
{
~A();
};
int foo(A);
void bar()
{
A a;
asm("" : : "r"(foo(a)) );//<-- cleanup needed here.
}
|
google
|
chromium
|
label11
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/label11.C
| 370 |
utf_8
|
416b5c7eddab17750318ee4dec3372e4
|
// PR c++/38725
// { dg-do compile }
// { dg-options "" }
struct A {};
struct B : virtual A {};
int vi;
void *vp;
void
f1 (int i)
{
goto *i;
}
void
f2 (B b)
{
goto *b; // { dg-error "cannot convert" }
}
template <typename T>
void
f3 (T i)
{
goto *i;
}
void
f3a ()
{
f3 (vi);
}
template <typename T>
void
f4 (T i)
{
goto *i;
}
void
f4a ()
{
f4 (vp);
}
|
google
|
chromium
|
utf-typedef-cxx98
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/utf-typedef-cxx98.C
| 257 |
utf_8
|
960c6b9ddd1bdea1576c8861d7d63855
|
/* Ensure that a typedef to char16_t/char32_t is fine in c++98. */
/* { dg-do compile } */
/* { dg-options "-std=c++98" } */
typedef short unsigned int char16_t;
typedef unsigned int char32_t;
|
google
|
chromium
|
attribute-test-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/attribute-test-1.C
| 816 |
utf_8
|
e7f9381db119c9c6ce6e52d04c2a9bd8
|
// { dg-do run }
// { dg-options "" }
// PR c++/13989
extern "C" void abort();
#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 unsigned int const_deadbeef(Constants &C)
{
return C.deadbeef();
}
union u {
unsigned int f[4];
vector unsigned int v;
} data;
int main()
{
Constants c;
if (data.f[0] != 0xdeadbeef || data.f[1] != 0xabababab
|| data.f[2] != 0x55555555 || data.f[3] != 0x12345678)
abort();
return 0;
}
/* Ignore a warning that is irrelevant to the purpose of this test. */
/* { dg-prune-output ".*GCC vector returned by reference.*" } */
|
google
|
chromium
|
complit2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/complit2.C
| 271 |
utf_8
|
7350965e2763a3a6e1d4346deaa1e94e
|
// PR c++/12726
// { dg-options "" }
struct A
{
A();
A(const A&);
A(int);
};
struct B
{
A a;
};
void foo()
{
B b;
b = (B){0};
}
|
google
|
chromium
|
asm5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/asm5.C
| 759 |
utf_8
|
e5f9fb7d1c25afe2ab0823f495d251e5
|
void f (int i)
{
__asm__("" : );
__asm__("" : "+g" (i));
__asm__("" :: );
__asm__("" :: "g" (i));
__asm__("" : : );
__asm__("" : "+g" (i) : );
__asm__("" : : "g" (i));
__asm__("" : "+g" (i) : "g" (i));
__asm__("" ::: );
__asm__("" ::: "memory");
__asm__("" : :: );
__asm__("" : "+g" (i) :: );
__asm__("" : :: "memory");
__asm__("" : "+g" (i) :: "memory");
__asm__("" :: : );
__asm__("" :: "g" (i) : );
__asm__("" :: : "memory");
__asm__("" :: "g" (i) : "memory");
__asm__("" : : : );
__asm__("" : "+g" (i) : : );
__asm__("" : : "g" (i) : );
__asm__("" : : : "memory");
__asm__("" : "+g" (i) : "g" (i) : );
__asm__("" : "+g" (i) : : "memory");
__asm__("" : : "g" (i) : "memory");
__asm__("" : "+g" (i) : "g" (i) : "memory");
}
|
google
|
chromium
|
bitfield3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/bitfield3.C
| 291 |
utf_8
|
4f6083c38df859567d6aab1182f8cade
|
/* { dg-do compile } */
/* { dg-options "-Wno-packed-bitfield-compat" } */
/* { dg-options "-Wno-packed-bitfield-compat -mno-ms-bitfields" { target i?86-*-netware } } */
struct t
{
char a:4;
char b:8;
char c:4;
} __attribute__ ((packed));
int assrt[sizeof (struct t) == 2 ? 1 : -1];
|
google
|
chromium
|
java-2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/java-2.C
| 1,278 |
utf_8
|
2484bd8763c28e930db150903973ca92
|
// PR c++/30293
// PR c++/30294
// { dg-do compile { target { ! { powerpc-ibm-aix* } } } }
// { dg-options "" }
extern "Java" {
typedef __java_byte jbyte;
namespace java {
namespace lang {
class Object {};
class Class {};
}
}
typedef struct java::lang::Object* jobject;
typedef java::lang::Class *jclass;
}
extern "C" jobject _Jv_AllocObject (jclass);
extern "Java" {
struct A { static java::lang::Class class$; };
}
struct B {
A a; // { dg-error "has Java class type" }
};
void* operator new (__SIZE_TYPE__, void*) throw();
char buf[1024];
A a; // { dg-error "not allocated with" }
A b = A (); // { dg-error "not allocated with" }
A *c = new ((void *) buf) A (); // { dg-error "using placement new" }
A *d = new A ();
jbyte e = 6;
const A fn1 () // { dg-error "return type has Java class type" }
{
A a; // { dg-error "not allocated with" }
return a;
}
A fn2 () // { dg-error "return type has Java class type" }
{
A a; // { dg-error "not allocated with" }
return a;
}
A *fn3 ()
{
return new A ();
}
A &fn4 ()
{
return *c;
}
jbyte fn5 ()
{
return 7;
}
void fn6 (A x) // { dg-error "has Java class type" }
{
}
void fn7 (const A x) // { dg-error "has Java class type" }
{
}
void fn8 (A *x)
{
(void) x;
}
void fn9 (jbyte x)
{
(void) x;
}
|
google
|
chromium
|
va-arg-pack-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/va-arg-pack-1.C
| 2,664 |
utf_8
|
33d19c269a9e9108be7e58ebb9f5dba4
|
// __builtin_va_arg_pack () builtin tests.
// { dg-do run }
// { dg-options "-O2" }
#include <stdarg.h>
extern "C" void abort (void);
int v1 = 8;
long int v2 = 3;
void *v3 = (void *) &v2;
struct A { char c[16]; } v4 = { "foo" };
long double v5 = 40;
char seen[20];
int cnt;
__attribute__ ((noinline)) int
foo1 (int x, int y, ...)
{
int i;
long int l;
void *v;
struct A a;
long double ld;
va_list ap;
va_start (ap, y);
if (x < 0 || x >= 20 || seen[x])
abort ();
seen[x] = ++cnt;
if (y != 6)
abort ();
i = va_arg (ap, int);
if (i != 5)
abort ();
switch (x)
{
case 0:
i = va_arg (ap, int);
if (i != 9 || v1 != 9)
abort ();
a = va_arg (ap, struct A);
if (__builtin_memcmp (a.c, v4.c, sizeof (a.c)) != 0)
abort ();
v = (void *) va_arg (ap, struct A *);
if (v != (void *) &v4)
abort ();
l = va_arg (ap, long int);
if (l != 3 || v2 != 4)
abort ();
break;
case 1:
ld = va_arg (ap, long double);
if (ld != 41 || v5 != ld)
abort ();
i = va_arg (ap, int);
if (i != 8)
abort ();
v = va_arg (ap, void *);
if (v != &v2)
abort ();
break;
case 2:
break;
default:
abort ();
}
va_end (ap);
return x;
}
__attribute__ ((noinline)) int
foo2 (int x, int y, ...)
{
long long int ll;
void *v;
struct A a, b;
long double ld;
va_list ap;
va_start (ap, y);
if (x < 0 || x >= 20 || seen[x])
abort ();
seen[x] = ++cnt | 64;
if (y != 10)
abort ();
switch (x)
{
case 11:
break;
case 12:
ld = va_arg (ap, long double);
if (ld != 41 || v5 != 40)
abort ();
a = va_arg (ap, struct A);
if (__builtin_memcmp (a.c, v4.c, sizeof (a.c)) != 0)
abort ();
b = va_arg (ap, struct A);
if (__builtin_memcmp (b.c, v4.c, sizeof (b.c)) != 0)
abort ();
v = va_arg (ap, void *);
if (v != &v2)
abort ();
ll = va_arg (ap, long long int);
if (ll != 16LL)
abort ();
break;
case 2:
break;
default:
abort ();
}
va_end (ap);
return x + 8;
}
__attribute__ ((noinline)) int
foo3 (void)
{
return 6;
}
extern inline __attribute__ ((always_inline, gnu_inline)) int
bar (int x, ...)
{
if (x < 10)
return foo1 (x, foo3 (), 5, __builtin_va_arg_pack ());
return foo2 (x, foo3 () + 4, __builtin_va_arg_pack ());
}
int
main (void)
{
if (bar (0, ++v1, v4, &v4, v2++) != 0)
abort ();
if (bar (1, ++v5, 8, v3) != 1)
abort ();
if (bar (2) != 2)
abort ();
if (bar (v1 + 2) != 19)
abort ();
if (bar (v1 + 3, v5--, v4, v4, v3, 16LL) != 20)
abort ();
return 0;
}
|
google
|
chromium
|
dllexport-MI1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/dllexport-MI1.C
| 1,351 |
utf_8
|
6aa7306aa2bf445debe3d81c5b253dd4
|
// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }
// Test that non-virtual MI thunks are exported.
// To build the dll and client app:
// g++ -shared -o MI.dll dllexport-MI1.C
// g++ -o MItest.exe dllimport-MI1.C -L. MI.dll
#define BUILDING_MI_DLL
#include "dll-MI1.h"
MBase::~MBase(){}
int D1::vf() const { return D1_return; }
D2::D2() { }
D2::D2 (D2 const&) { }
int D2::vf() const { return D2_return; }
int MI1::vf() const { return D1::vf();}
// a dllexported object
DLL_IMPEXP MI1 dllMI1;
// use default copy ctor
DLL_IMPEXP MI1 dllMI1Copy = dllMI1;
// Scan for export of some methods that are undefined in dllimportMI1.C,
// { dg-final { scan-assembler "-export:_ZNK2D12vfEv" } }
// { dg-final { scan-assembler "-export:_ZNK2D22vfEv" } }
// { dg-final { scan-assembler "-export:_ZNK3MI12vfEv" } }
// and MI thunks,
// { dg-final { scan-assembler "-export:_ZThn4_NK3MI12vfEv" } }
// { dg-final { scan-assembler "-export:_ZTv0_n12_NK2D12vfEv" } }
// and a vtable data variable.
// { dg-final { scan-assembler "-export:_ZTV2D1,data" } }
// an explicit copy ctor
// { dg-final { scan-assembler "-export:_ZN2D2C2ERKS_" } }
// but not implicit copy ctor generated by compiler
// nor implicit dtor
// { dg-final { scan-assembler-not "-export:_ZN2D1C2ERKS_" } }
// { dg-final { scan-assembler-not "-export:_ZN2D1D2Ev" } }
|
google
|
chromium
|
va-arg-pack-len-2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/va-arg-pack-len-2.C
| 1,184 |
utf_8
|
3da578ea7fb89ed9d7d870cd2355c8a1
|
// { dg-do compile }
// { dg-options "-O2" }
#include <stdarg.h>
extern int error_open_missing_mode (void)
__attribute__((__error__ ("open with O_CREAT needs 3 arguments, only 2 were given")));
extern int warn_open_too_many_arguments (void)
__attribute__((__warning__ ("open called with more than 3 arguments")));
extern int myopen2 (const char *path, int oflag);
extern int myopenva (const char *path, int oflag, ...);
extern inline __attribute__((always_inline, gnu_inline)) int
myopen (const char *path, int oflag, ...)
{
if (__builtin_va_arg_pack_len () > 1)
warn_open_too_many_arguments (); // { dg-warning "called with more than 3" }
if (__builtin_constant_p (oflag))
{
if ((oflag & 0x40) != 0 && __builtin_va_arg_pack_len () < 1)
{
error_open_missing_mode (); // { dg-error "needs 3 arguments, only 2 were given" }
return myopen2 (path, oflag);
}
return myopenva (path, oflag, __builtin_va_arg_pack ());
}
if (__builtin_va_arg_pack_len () < 1)
return myopen2 (path, oflag);
return myopenva (path, oflag, __builtin_va_arg_pack ());
}
int
main (void)
{
myopen ("h", 0x43);
myopen ("i", 0x43, 0644, 0655);
return 0;
}
|
google
|
chromium
|
complit10
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/complit10.C
| 321 |
utf_8
|
3cf8f5d118ccef5a3e2d44a12df39f35
|
// PR c++/36023
// { dg-do compile }
// { dg-options "" }
struct A;
void
f1 (int i)
{
(int[i]) { 1 }; // { dg-error "variable-sized compound literal" }
(A[5]) { 1 }; // { dg-error "have incomplete type" }
(A[i]) { 1 }; // { dg-error "have incomplete type" }
}
void
f2 ()
{
(int[]) { 1 };
(int[1]) { 1 };
}
|
google
|
chromium
|
altivec-9
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/altivec-9.C
| 355 |
utf_8
|
5bc21f478c5c54165eb98a3afe01f181
|
/* Test for AltiVec function vec_ld, passing a pointer to const vector */
/* { dg-do compile { target powerpc*-*-* } } */
/* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec" } */
#include <altivec.h>
typedef vector unsigned char vuc_t;
const vuc_t* p;
vector unsigned char test_vec_ld()
{
return vec_ld(0,p);
}
|
google
|
chromium
|
vlm1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/vlm1.C
| 170 |
utf_8
|
11bcf00b0a6402fad7b9569e02318690
|
// { dg-options "" }
template <class T> struct A {};
struct B {
static const int s;
A<int[s]> a; // { dg-error "array|template" }
};
const int B::s=16;
B b;
|
google
|
chromium
|
instantiate3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/instantiate3.C
| 360 |
utf_8
|
561bb7137df38a016a786156224c9769
|
// Test that 'inline template' instantiates the vtable.
// { dg-do compile }
// { dg-options "-O -fno-implicit-templates" }
template <class T> struct A {
virtual void f () { }
};
inline template struct A<int>;
// { dg-final { scan-assembler "\n_?_ZTV1AIiE(:|\n|\t)" } }
A<int> a;
// { dg-final { scan-assembler-not "\n_?_ZTV1AIcE(:|\n|\t)" } }
A<char> b;
|
google
|
chromium
|
pr28291
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/pr28291.C
| 201 |
utf_8
|
120e689afda3dc7576257e6a7ec0d8ae
|
// Test to make sure we do not ICE on this invalid program.
// { dg-do compile }
// { dg-options "" }
struct A
{
static int i;
int j;
};
A a = { i:0 }; // { dg-error "non-static data member" }
|
google
|
chromium
|
cleanup-9
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/cleanup-9.C
| 2,122 |
utf_8
|
cd3700a4142b5a693ac706905beabdc6
|
/* { dg-do run { target hppa*-*-hpux* *-*-linux* powerpc*-*-darwin* *-*-darwin[912]* } } */
/* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */
/* Verify that cleanups work with exception handling through realtime
signal frames. */
#include <unwind.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
static _Unwind_Reason_Code
force_unwind_stop (int version, _Unwind_Action actions,
_Unwind_Exception_Class exc_class,
struct _Unwind_Exception *exc_obj,
struct _Unwind_Context *context,
void *stop_parameter)
{
if (actions & _UA_END_OF_STACK)
abort ();
return _URC_NO_REASON;
}
static void force_unwind ()
{
struct _Unwind_Exception *exc
= (struct _Unwind_Exception *) malloc (sizeof (*exc));
memset (&exc->exception_class, 0, sizeof (exc->exception_class));
exc->exception_cleanup = 0;
#ifndef __USING_SJLJ_EXCEPTIONS__
_Unwind_ForcedUnwind (exc, force_unwind_stop, 0);
#else
_Unwind_SjLj_ForcedUnwind (exc, force_unwind_stop, 0);
#endif
abort ();
}
int count;
char *null;
static void counter (void *p __attribute__((unused)))
{
++count;
}
static void handler (void *p __attribute__((unused)))
{
if (count != 2)
abort ();
exit (0);
}
static int __attribute__((noinline)) fn5 ()
{
char dummy __attribute__((cleanup (counter)));
force_unwind ();
return 0;
}
static void fn4 (int sig, siginfo_t *info, void *ctx)
{
char dummy __attribute__((cleanup (counter)));
fn5 ();
null = NULL;
}
static void fn3 ()
{
abort ();
}
static int __attribute__((noinline)) fn2 ()
{
*null = 0;
fn3 ();
return 0;
}
static int __attribute__((noinline)) fn1 ()
{
struct sigaction s;
sigemptyset (&s.sa_mask);
s.sa_sigaction = fn4;
s.sa_flags = SA_RESETHAND | SA_SIGINFO;
sigaction (SIGSEGV, &s, NULL);
sigaction (SIGBUS, &s, NULL);
fn2 ();
return 0;
}
static int __attribute__((noinline)) fn0 ()
{
char dummy __attribute__((cleanup (handler)));
fn1 ();
null = 0;
return 0;
}
int main()
{
fn0 ();
abort ();
}
|
google
|
chromium
|
tmplattr4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/tmplattr4.C
| 263 |
utf_8
|
13a9bd280c5578a4d3a70a4e930438d1
|
// PR c++/7586
// { dg-do run }
template<typename T>
int f()
{
typedef unsigned char type[sizeof (T)]
__attribute((aligned(__alignof(T))));
return __alignof (type);
}
int main()
{
if (f<int>() == __alignof (int))
return 0;
else
return 1;
}
|
google
|
chromium
|
has_nothrow_assign
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/has_nothrow_assign.C
| 2,519 |
utf_8
|
ddd6a150c6e731acb2ed3440640d50d1
|
// { dg-do "run" }
#include <cassert>
struct A
{
double a;
double b;
};
struct B
{
A a;
};
struct C
: public A { };
struct D
{
D& operator=(const D&) throw() { return *this; }
};
struct E
{
E& operator=(const E&) throw(int) { return *this; }
};
struct E1
{
E1& operator=(const E1&) throw(int) { throw int(); return *this; }
};
struct F
{
F() throw(int) { }
};
struct G
{
G() throw(int) { throw int(); }
};
struct H
{
H& operator=(H&) throw(int) { return *this; }
};
struct H1
{
H1& operator=(H1&) throw(int) { throw int(); return *this; }
};
struct I
{
I& operator=(I&) throw(int) { return *this; }
I& operator=(const I&) throw() { return *this; }
};
struct I1
{
I1& operator=(I1&) throw(int) { throw int(); return *this; }
I1& operator=(const I1&) throw() { return *this; }
};
struct J
{
J& operator=(J&) throw() { return *this; }
J& operator=(const J&) throw() { return *this; }
J& operator=(volatile J&) throw() { return *this; }
J& operator=(const volatile J&) throw() { return *this; }
};
struct K
{
K& operator=(K&) throw() { return *this; }
};
struct L
{
L& operator=(const L&) throw() { return *this; }
};
template<typename T>
bool
f()
{ return __has_nothrow_assign(T); }
template<typename T>
class My
{
public:
bool
f()
{ return !!__has_nothrow_assign(T); }
};
template<typename T>
class My2
{
public:
static const bool trait = __has_nothrow_assign(T);
};
template<typename T>
const bool My2<T>::trait;
template<typename T, bool b = __has_nothrow_assign(T)>
struct My3_help
{ static const bool trait = b; };
template<typename T, bool b>
const bool My3_help<T, b>::trait;
template<typename T>
class My3
{
public:
bool
f()
{ return My3_help<T>::trait; }
};
#define PTEST(T) (__has_nothrow_assign(T) && f<T>() \
&& My<T>().f() && My2<T>::trait && My3<T>().f())
#define NTEST(T) (!__has_nothrow_assign(T) && !f<T>() \
&& !My<T>().f() && !My2<T>::trait && !My3<T>().f())
int main()
{
assert (PTEST (int));
assert (NTEST (int (int)));
assert (NTEST (void));
assert (PTEST (A));
assert (PTEST (B));
assert (NTEST (C[]));
assert (PTEST (D));
assert (NTEST (E));
assert (NTEST (E1));
assert (PTEST (F));
assert (PTEST (G));
assert (NTEST (H));
assert (NTEST (H1));
assert (NTEST (I));
assert (NTEST (I1));
assert (PTEST (J));
assert (NTEST (const K));
assert (NTEST (const L));
return 0;
}
|
google
|
chromium
|
desig1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/desig1.C
| 309 |
utf_8
|
739dd1176941bfc4e49f4d7f144da1d3
|
// { dg-options "" }
struct a {
int x;
};
struct b {
int x;
int y;
};
struct foo {
union {
struct a a;
struct b b;
} u;
};
int main(void)
{
struct foo bar = { u: { b: { x: 0, y: 0, }}};
(void)bar;
return 0;
}
|
google
|
chromium
|
unary_trait_incomplete
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/unary_trait_incomplete.C
| 2,778 |
utf_8
|
6bf89b233bc22f82e85f50abc2d3bef3
|
// PR c++/39475
struct I;
struct C { };
bool nas1 = __has_nothrow_assign(I); // { dg-error "incomplete type" }
bool nas2 = __has_nothrow_assign(C[]);
bool nas3 = __has_nothrow_assign(I[]);
bool nas4 = __has_nothrow_assign(void);
bool nas5 = __has_nothrow_assign(const void);
bool tas1 = __has_trivial_assign(I); // { dg-error "incomplete type" }
bool tas2 = __has_trivial_assign(C[]);
bool tas3 = __has_trivial_assign(I[]);
bool tas4 = __has_trivial_assign(void);
bool tas5 = __has_trivial_assign(const void);
bool nco1 = __has_nothrow_constructor(I); // { dg-error "incomplete type" }
bool nco2 = __has_nothrow_constructor(C[]);
bool nco3 = __has_nothrow_constructor(I[]);
bool nco4 = __has_nothrow_constructor(void);
bool nco5 = __has_nothrow_constructor(const void);
bool tco1 = __has_trivial_constructor(I); // { dg-error "incomplete type" }
bool tco2 = __has_trivial_constructor(C[]);
bool tco3 = __has_trivial_constructor(I[]);
bool tco4 = __has_trivial_constructor(void);
bool tco5 = __has_trivial_constructor(const void);
bool ncp1 = __has_nothrow_copy(I); // { dg-error "incomplete type" }
bool ncp2 = __has_nothrow_copy(C[]);
bool ncp3 = __has_nothrow_copy(I[]);
bool ncp4 = __has_nothrow_copy(void);
bool ncp5 = __has_nothrow_copy(const void);
bool tcp1 = __has_trivial_copy(I); // { dg-error "incomplete type" }
bool tcp2 = __has_trivial_copy(C[]);
bool tcp3 = __has_trivial_copy(I[]);
bool tcp4 = __has_trivial_copy(void);
bool tcp5 = __has_trivial_copy(const void);
bool vde1 = __has_virtual_destructor(I); // { dg-error "incomplete type" }
bool vde2 = __has_virtual_destructor(C[]);
bool vde3 = __has_virtual_destructor(I[]);
bool vde4 = __has_virtual_destructor(void);
bool vde5 = __has_virtual_destructor(const void);
bool tde1 = __has_trivial_destructor(I); // { dg-error "incomplete type" }
bool tde2 = __has_trivial_destructor(C[]);
bool tde3 = __has_trivial_destructor(I[]);
bool tde4 = __has_trivial_destructor(void);
bool tde5 = __has_trivial_destructor(const void);
bool abs1 = __is_abstract(I); // { dg-error "incomplete type" }
bool abs2 = __is_abstract(C[]);
bool abs3 = __is_abstract(I[]);
bool abs4 = __is_abstract(void);
bool abs5 = __is_abstract(const void);
bool pod1 = __is_pod(I); // { dg-error "incomplete type" }
bool pod2 = __is_pod(C[]);
bool pod3 = __is_pod(I[]);
bool pod4 = __is_pod(void);
bool pod5 = __is_pod(const void);
bool emp1 = __is_empty(I); // { dg-error "incomplete type" }
bool emp2 = __is_empty(C[]);
bool emp3 = __is_empty(I[]);
bool emp4 = __is_empty(void);
bool emp5 = __is_empty(const void);
bool pol1 = __is_polymorphic(I); // { dg-error "incomplete type" }
bool pol2 = __is_polymorphic(C[]);
bool pol3 = __is_polymorphic(I[]);
bool pol4 = __is_polymorphic(void);
bool pol5 = __is_polymorphic(const void);
|
google
|
chromium
|
lvaddr
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/lvaddr.C
| 192 |
utf_8
|
92a7056cf4009e7b4513a036edcef967
|
// { dg-do compile }
void f()
{
int n;
char* p = &(char) n; // { dg-error "lvalue" }
}
|
google
|
chromium
|
anon-struct6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/anon-struct6.C
| 283 |
utf_8
|
72746a0d7f31bf889b45b24a8426c590
|
// PR c++/33460
struct A
{
struct
{ // { dg-error "anonymous struct cannot have function members" }
struct { static int i; }; // { dg-error "prohibits anonymous structs|non-static data members" }
void foo() { i; }
}; // { dg-error "prohibits anonymous structs" }
};
|
google
|
chromium
|
vla5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/vla5.C
| 149 |
utf_8
|
98395fbe8def84169d327400e5e3f8dd
|
// PR c++/37417
// { dg-do compile }
// { dg-options "-O" }
void
test (int a)
{
new (char[a]);
}
|
google
|
chromium
|
vector9
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/vector9.C
| 197 |
utf_8
|
b79e2b0f0e2ad656cfc1480a14e2166a
|
// PR c++/34891
typedef float v4f __attribute__((vector_size(8)));
typedef int v4i __attribute__((vector_size(8)));
void foo()
{
v4f v;
!(v4i)v; // { dg-error "int __vector__|argument" }
}
|
google
|
chromium
|
attrib3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/attrib3.C
| 439 |
utf_8
|
7d022bc15e4179e83cb22834a71091af
|
// Test that attributes work in a variety of situations.
// { dg-options -O }
// { dg-do run }
#define attrib __attribute ((mode (QI)))
attrib signed int a; // attributes before type are broken
static attrib unsigned int b;
int foo(attrib int o) // attribute arguments are broken
{
return (sizeof (a) != 1
|| sizeof (b) != 1
|| sizeof (o) != 1
|| sizeof ((attrib signed int) b) != 1);
}
int main ()
{
return foo (42);
}
|
google
|
chromium
|
dllimport-MI1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/dllimport-MI1.C
| 1,099 |
utf_8
|
8762efb9149a937554f3e867cca0e9d8
|
// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }
// Test handling of MI thunks in dllimported classes.
// To build the dll and client app:
// g++ -shared -o MI.dll dllexport-MI1.C
// g++ -o MItest.exe dllimport-MI1.C -L. MI.dll
#include <stdlib.h>
#include "dll-MI1.h"
extern DLL_IMPEXP MI1 dllMI1;
// This should use the implicit copy ctor for D1 (not imported)
// and the explicit copy ctor for D2 (dll-imported).
MI1 dllMI1LocalCopy = dllMI1;
class MI2 : public D1, public D2
{
public:
int vf() const { return D2::vf();}
};
class MI3 : public MI1
{
};
int main ()
{
MI1 bar1;
MI2 bar2;
MI3 bar3;
if (dllMI1.vf() != D1_return)
abort();
if (dllMI1LocalCopy.vf() != D1_return)
abort();
if (bar1.vf() != D1_return)
abort();
if (bar2.vf() != (D2_return))
abort();
if (bar3.vf() != D1_return )
abort();
}
// Scan for import of explicit copy ctor for D2, but no import
// of compiler generated copy ctor for D1.
// { dg-final { scan-assembler "__imp___ZN2D2C2ERKS_" } }
// { dg-final { scan-assembler-not "__imp___ZN2D1C2ERKS_" } }
|
google
|
chromium
|
attrib5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/attrib5.C
| 783 |
utf_8
|
ec01dbb0bb96c7cda806a516a5cf87d4
|
// There were two related problems here, depending on the vintage. At
// one time:
//
// typedef struct A { ... } A __attribute__ ((aligned (16)));
//
// would cause original_types to go into an infinite loop. At other
// times, the attributes applied to an explicit typedef would be lost
// (check_b3 would have a negative size).
// First check that the declaration is accepted and has an effect.
typedef struct A { int i; } A __attribute__ ((aligned (16)));
int check_A[__alignof__ (A) >= 16 ? 1 : -1];
// Check that the alignment is only applied to the typedef.
struct B { int i; };
struct B b1;
typedef struct B B __attribute__((aligned (16)));
struct B b2;
B b3;
int check_b1[__alignof__ (b1) == __alignof__ (b2) ? 1 : -1];
int check_b3[__alignof__ (b3) >= 16 ? 1 : -1];
|
google
|
chromium
|
label1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/label1.C
| 141 |
utf_8
|
7448fb50d33d0e0b5699d1a46190acd0
|
// { dg-options "" }
int main(void) {
static const void* lbls[2][2] = {{&&lbl0, &&lbl0}, {&&lbl0, &&lbl0}};
goto *lbls[0];
lbl0:
;
}
|
google
|
chromium
|
utf-rtti
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/utf-rtti.C
| 284 |
utf_8
|
f2f226beecfd8f6e19653afe7231d791
|
/* Ensure that typeinfo data is generated for char16_t/char32_t. */
/* { dg-do link } */
/* { dg-options "-std=c++0x" } */
#include <typeinfo>
int main(void)
{
typeid(char16_t).name();
typeid(char32_t).name();
}
|
google
|
chromium
|
packed4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/packed4.C
| 1,184 |
utf_8
|
bcf9b6873e48870b8f6014b5da708cd3
|
// { dg-do run { target { ! default_packed } } }
// { dg-options "-w" }
// Packed fields are unsuitable for direct reference binding.
struct Unpacked { int i; };
int ConstRef (int const &p, int const *ptr, int v)
{
if (p != v)
return 1;
if (&p == ptr)
return 2;
return 0;
}
int ConstRef (Unpacked const &p, Unpacked const *ptr, int v)
{
if (p.i != v)
return 1;
if (&p == ptr)
return 2;
return 0;
}
int Val (int p, int v)
{
if (p != v)
return 1;
return 0;
}
int Val (Unpacked p, int v)
{
if (p.i != v)
return 1;
return 0;
}
struct __attribute__ ((packed)) Packed
{
char c;
int i;
Unpacked u;
char t;
};
int Foo (Packed &p, int i, int ui)
{
int r;
if ((r = Val (p.i, i)))
return r;
if ((r = Val (p.u.i, ui)))
return r + 2;
if ((r = Val (p.u, ui)))
return r + 4;
if ((r = ConstRef (p.i, &p.i, i)))
return r + 6;
return 0;
}
int main ()
{
Packed p;
p.c = 0x12;
p.i = 0x3456789a;
p.u.i = 0xbcdef00f;
p.t = 0xed;
return Foo (p, 0x3456789a, 0xbcdef00f);
}
|
google
|
chromium
|
c99struct1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/c99struct1.C
| 155 |
utf_8
|
584e264d76b42642e1d520318920eb9c
|
// { dg-options "" }
// C99 anon struct variable with array accesses.
struct s { int a[1]; };
void
foo5 (void)
{
((struct s) { { 0 } }).a[0] = 1;
}
|
google
|
chromium
|
gnu-inline-global-redecl
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/gnu-inline-global-redecl.C
| 371 |
utf_8
|
83baade7989ec401bd49db5363e07e77
|
/* Test __attribute__((gnu_inline)).
Check that we don't get out-of-line definitions for extern inline
gnu_inline functions, regardless of redeclaration.
*/
/* { dg-do link } */
/* { dg-options "-O" } */ // such that static functions are optimized out
#include "gnu-inline-common.h"
decl(extern, fn)
gnuindef(fn, 0)
decl(extern, fn)
int main () {
fn ();
}
|
google
|
chromium
|
attrib35
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/attrib35.C
| 464 |
utf_8
|
72dcf6393fd2127116d516c2816413ba
|
// { dg-do compile { target i*86-*-* x86_64-*-* } }
// { dg-options "-O3 -msse2" }
// You can make NON-template typedefs with a large alignment.
typedef double AlignedDoubleType __attribute__((aligned(16)));
template <typename RealType>
RealType f(const RealType* p)
{
// But if you use a template parameter it complains.
typedef RealType AlignedRealType __attribute__((aligned(16)));
return p[0];
}
double f2(const double* p)
{
return f<double>(p);
}
|
google
|
chromium
|
typeof10
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/typeof10.C
| 236 |
utf_8
|
a9f6e5ffa8ee45297e80ce1461434dc7
|
// PR c++/20552
template<int> struct A
{
void foo()
{
typedef int T; // { dg-error "previous" }
typedef __typeof__(*this) T; // { dg-error "conflicting" }
}
};
|
google
|
chromium
|
has_nothrow_copy-6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/has_nothrow_copy-6.C
| 161 |
utf_8
|
683b5fae158dbf72cfe24417308a4a1a
|
// { dg-do "run" }
#include <cassert>
struct S {
S (S&) throw ();
S (const S&, int) throw (int);
};
int main ()
{
assert (__has_nothrow_copy (S));
}
|
google
|
chromium
|
vector13
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/vector13.C
| 156 |
utf_8
|
0b89905c123e9d47c7e0b5514f4c50e2
|
// PR c++/35096
// { dg-do compile }
typedef const int X __attribute((vector_size(8)));
extern const int x[] __attribute((vector_size(8)));
X x[] = { 5 };
|
google
|
chromium
|
label12
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/label12.C
| 454 |
utf_8
|
0c4dee38ff36603320c2d05c89f20b89
|
// PR c++/39028
// { dg-do compile }
void
f ()
{
int i;
for (i = 0; i < 2; i++)
{
__label__ l;
goto l;
l:;
}
while (i++ < 5)
{
__label__ l;
goto l;
l:;
}
do
{
__label__ l;
goto l;
l:;
}
while (i++ < 8);
if (1)
{
__label__ l;
goto l;
l:;
}
{
__label__ l;
goto l;
l:;
}
}
|
google
|
chromium
|
complit5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/complit5.C
| 142 |
utf_8
|
5caaf9e2321715eb7f6a18ff81d49dda
|
// PR c++/25417
// { dg-options "" }
struct object {
int a;
int b;
};
void f (int c, int d)
{
object o = ((object){ a : c, b : d});
}
|
google
|
chromium
|
asm8
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/asm8.C
| 352 |
utf_8
|
9c3b7de14ce6ac49627b91e2808376e5
|
/* { dg-do compile } */
/* Test that asm with no outputs are treated as volatile. */
void f(int x)
{
__asm__ ("extended asm not discarded" : : "r" (x));
}
void g (void)
{
__asm__ ("simple asm not discarded");
}
/* { dg-final { scan-assembler "extended asm not discarded" } } */
/* { dg-final { scan-assembler "simple asm not discarded" } } */
|
google
|
chromium
|
is_enum
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/is_enum.C
| 1,060 |
utf_8
|
0ae0b89107bfa1fc2ca82a358f64505e
|
// { dg-do "run" }
#include <cassert>
struct A
{
double a;
double b;
};
class B
{ };
enum E
{
e0
};
template<typename T>
bool
f()
{ return __is_enum(T); }
template<typename T>
class My
{
public:
bool
f()
{ return !!__is_enum(T); }
};
template<typename T>
class My2
{
public:
static const bool trait = __is_enum(T);
};
template<typename T>
const bool My2<T>::trait;
template<typename T, bool b = __is_enum(T)>
struct My3_help
{ static const bool trait = b; };
template<typename T, bool b>
const bool My3_help<T, b>::trait;
template<typename T>
class My3
{
public:
bool
f()
{ return My3_help<T>::trait; }
};
#define PTEST(T) (__is_enum(T) && f<T>() \
&& My<T>().f() && My2<T>::trait && My3<T>().f())
#define NTEST(T) (!__is_enum(T) && !f<T>() \
&& !My<T>().f() && !My2<T>::trait && !My3<T>().f())
int main()
{
assert (NTEST (int));
assert (NTEST (void));
assert (NTEST (A));
assert (NTEST (B));
assert (PTEST (E));
return 0;
}
|
google
|
chromium
|
typeof8
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/typeof8.C
| 263 |
utf_8
|
a9d136cfb86815cbf4d2e46089c90ce0
|
// PR c++/14116
// Any use of typeof in a templete was causing an ICE.
// { dg-options "" }
struct vector { typedef int iterator; };
vector read_queue;
template <class T> void f(){
typedef typeof (read_queue) read_queue_t;
read_queue_t::iterator it;
}
|
google
|
chromium
|
stmtexpr4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/stmtexpr4.C
| 119 |
utf_8
|
7f4e8ebedb382ebc1349d7067b034121
|
// PR c++/20147
// { dg-do compile }
// { dg-options "" }
void foo()
{
({x;}); // { dg-error "was not declared" }
}
|
google
|
chromium
|
vector11
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/vector11.C
| 102 |
utf_8
|
86631ce973fe08bf3f9ad84e595fb594
|
// PR c++/34913
template<typename T> struct A
{
int x[sizeof(T)] __attribute((vector_size(8)));
};
|
google
|
chromium
|
alignof2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/alignof2.C
| 351 |
utf_8
|
0c971bcbaac508ae1054a9ee28a27be8
|
// PRs 16387 and 16389
// We were treating alignof (sa.a) as alignof (typeof (sa.a)), which is
// wrong for some fields.
// { dg-do run }
extern "C" void abort();
struct A
{
double a;
} sa;
struct B
{
char c;
double b;
} sb;
int main()
{
if (__alignof (sa) != __alignof (sa.a)
|| __alignof (sb) != __alignof (sb.b))
abort();
}
|
google
|
chromium
|
bitfield4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/bitfield4.C
| 362 |
utf_8
|
b9dcf1ba56b6782c19ca555e3554c6a3
|
/* { dg-do compile } */
/* { dg-options "" } */
/* { dg-options "-mno-ms-bitfields" { target i?86-*-netware } } */
struct t
{ /* { dg-message "note: Offset of packed bit-field 't::b' has changed in GCC 4.4" "" { target pcc_bitfield_type_matters } } */
char a:4;
char b:8 __attribute__ ((packed));
char c:4;
};
int assrt[sizeof (struct t) == 2 ? 1 : -1];
|
google
|
chromium
|
tmplattr8
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/tmplattr8.C
| 182 |
utf_8
|
bcdc198bba142d390818f427b8129565
|
// PR c++/28560
template<typename> struct A {};
template<int> struct B;
template<int N> struct C :
A<typename B<N>::X __attribute__((unused))> {}; // { dg-warning "attribute" }
|
google
|
chromium
|
construct1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/construct1.C
| 176 |
utf_8
|
10abc828e1142ff735666c5c8f9d280f
|
// PR c++/16717
// { dg-options "-O2" }
int i;
void hello (void) __attribute__ ((constructor));
void hello (void) { i = 1; }
int main (void) {
if (i != 1)
return 1;
}
|
google
|
chromium
|
builtin10
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/builtin10.C
| 1,427 |
utf_8
|
8e27d5e71c6ca468b0da85a6f69c93ca
|
// { dg-do compile { target correct_iso_cpp_string_wchar_protos } }
// { dg-options "-O2 -fdump-tree-optimized" }
#include <cstring>
const void *cv1;
const char *cc1, *cc2, *cc3, *cc4;
void *v1;
char *c1, *c2, *c3, *c4;
void
f1 (void)
{
cv1 = memchr ("abcba", 'b', 3);
cc1 = strchr ("abcba", 'b');
cc2 = strrchr ("abcba", 'b');
cc3 = strpbrk ("dabc", "abc");
cc4 = strstr ("aaabc", "abc");
}
void
f2 (void)
{
cv1 = std::memchr ("abcba", 'b', 3);
cc1 = std::strchr ("abcba", 'b');
cc2 = std::strrchr ("abcba", 'b');
cc3 = std::strpbrk ("dabc", "abc");
cc4 = std::strstr ("aaabc", "abc");
}
void
f3 (void)
{
v1 = memchr ((char *)"abcba", 'b', 3);
c1 = strchr ((char *)"abcba", 'b');
c2 = strrchr ((char *)"abcba", 'b');
c3 = strpbrk ((char *)"dabc", "abc");
c4 = strstr ((char *)"aaabc", "abc");
}
void
f4 (void)
{
v1 = std::memchr ((char *)"abcba", 'b', 3);
c1 = std::strchr ((char *)"abcba", 'b');
c2 = std::strrchr ((char *)"abcba", 'b');
c3 = std::strpbrk ((char *)"dabc", "abc");
c4 = std::strstr ((char *)"aaabc", "abc");
}
// { dg-final { scan-tree-dump-not "memchr" "optimized" } }
// { dg-final { scan-tree-dump-not "strchr" "optimized" } }
// { dg-final { scan-tree-dump-not "strrchr" "optimized" } }
// { dg-final { scan-tree-dump-not "strpbrk" "optimized" } }
// { dg-final { scan-tree-dump-not "strstr" "optimized" } }
// { dg-final { cleanup-tree-dump "optimized" } }
|
google
|
chromium
|
attrib26
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/attrib26.C
| 296 |
utf_8
|
974eff96719a23fa80e58b0108eba0c3
|
// PR c++/28659
// The attribute was causing us to get confused in merge_types when
// combining the template type with an uninstantiated version.
template<class T>
struct __attribute__((aligned(1))) A
{
A& operator=(const A &t);
};
template<class T>
A<T>& A<T>::operator=(const A<T> &t)
{
}
|
google
|
chromium
|
altivec-12
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/altivec-12.C
| 397 |
utf_8
|
ce4ff2095f5aadd1429d75f9964e3068
|
/* Test vec_dst* functions with float pointer as first argument. */
/* { dg-do compile { target powerpc*-*-* } } */
/* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec" } */
#include <altivec.h>
extern int i;
extern float *fp;
extern vector float vf;
void
foo ()
{
vec_dst (fp, i, 1);
vec_dstst (fp, i, 1);
vec_dststt (fp, i, 1);
vec_dstt (fp, i, 1);
}
|
google
|
chromium
|
anon-struct5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/anon-struct5.C
| 262 |
utf_8
|
0746023f7d159fb8e9a9c90f3e5b1396
|
// PR c++/30302
struct A
{
struct { static int i; }; // { dg-error "prohibits anonymous structs|an anonymous struct" }
void foo() { i; }
};
struct B
{
union { static int i; }; // { dg-error "an anonymous union|member of a union" }
void foo() { i; }
};
|
google
|
chromium
|
tmplattr2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/tmplattr2.C
| 388 |
utf_8
|
089638758b33bf99338184db0181179c
|
// PR c++/17743
template <unsigned Len, unsigned Align>
struct aligned_storage
{
typedef char type[Len] __attribute__((aligned((Align))));
};
template<typename T>
struct X
{
typename aligned_storage<sizeof(T),__alignof(T)>::type data;
};
template<bool> struct StaticAssert;
template<> struct StaticAssert<true> {};
StaticAssert<__alignof (X<double>) == __alignof (double)> dummy;
|
google
|
chromium
|
label9
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/label9.C
| 190 |
utf_8
|
c510e07acd289ccbf9cf0ca2264c4ad7
|
// PR c++/32121
// { dg-do compile }
int f (void)
{
while (1)
__label__ a; // { dg-error "not at the beginning" }
for (;;)
__label__ b; // { dg-error "not at the beginning" }
}
|
google
|
chromium
|
tmplattr1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/tmplattr1.C
| 402 |
utf_8
|
b8a7bc7b0dc38a84a435cecd41d9f4c3
|
// PR c++/24260
// { dg-do compile { target i?86-*-* x86_64-*-* } }
// { dg-require-effective-target ilp32 }
#define stdcall __attribute__((stdcall))
struct T {
template <class S>
static int stdcall func(int arg1, int arg2);
};
template <class S>
int stdcall T::func(int arg1, int arg2)
{
return arg1+arg2;
}
struct dummy {};
void xx()
{
int (stdcall *ptr2)(int,int) = &T::func<dummy>;
}
|
google
|
chromium
|
vector6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/vector6.C
| 342 |
utf_8
|
9dca9632e59d179ee1b85a181a34cae7
|
// { dg-options "" }
// { dg-do compile }
// C++/30016, we were allowing conversion between vector types
// and union types which is invalid.
typedef float __v_4F __attribute__ ((vector_size (16)));
typedef union {__v_4F v; float a[4];} __v4F;
void f(void)
{
__v_4F b;
(reinterpret_cast<__v4F>(b).a)[1] = 1; // { dg-error "" }
}
|
google
|
chromium
|
vector15
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/vector15.C
| 161 |
utf_8
|
609de4a1bd102907e8c94926e720e269
|
/* { dg-do compile } */
/* Check that we error out when using vector_size on the bool type. */
__attribute__((vector_size(16) )) bool a; /* { dg-error "" } */
|
google
|
chromium
|
cleanup-3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/cleanup-3.C
| 580 |
utf_8
|
8947a9ede099a6adc4fdf950293341b9
|
/* { dg-do run } */
/* { dg-options "" } */
/* Verify that the cleanup handler receives the proper contents
of the variable. */
extern "C" void exit(int);
extern "C" void abort(void);
static int expected;
static void
handler(int *p)
{
if (*p != expected)
abort ();
}
static void __attribute__((noinline))
bar(void)
{
}
static void doit(int x, int y)
{
int r __attribute__((cleanup (handler)));
if (x < y)
{
r = 0;
return;
}
bar();
r = x + y;
}
int main()
{
expected = 0;
doit (1, 2);
expected = 3;
doit (2, 1);
return 0;
}
|
google
|
chromium
|
array2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/array2.C
| 257 |
utf_8
|
f1a9da555162b7ed9f63dd442d842c1c
|
// { dg-do compile }
// Avoid -pedantic-error default
// { dg-options "" }
// PR 19989 - dependent array of size 0 fails to compile.
template<int I> struct A
{
static const int zero = 0;
};
template<int N> struct B
{
int x[A<N>::zero];
};
B<0> b;
|
google
|
chromium
|
is_empty
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/is_empty.C
| 1,143 |
utf_8
|
1fc9c68973f25404ea587aa6ed700dc7
|
// { dg-do "run" }
#include <cassert>
struct A
{
double a;
double b;
};
struct B
{
virtual ~B() { }
};
class C
{ };
union U
{ };
template<typename T>
bool
f()
{ return __is_empty(T); }
template<typename T>
class My
{
public:
bool
f()
{ return !!__is_empty(T); }
};
template<typename T>
class My2
{
public:
static const bool trait = __is_empty(T);
};
template<typename T>
const bool My2<T>::trait;
template<typename T, bool b = __is_empty(T)>
struct My3_help
{ static const bool trait = b; };
template<typename T, bool b>
const bool My3_help<T, b>::trait;
template<typename T>
class My3
{
public:
bool
f()
{ return My3_help<T>::trait; }
};
#define PTEST(T) (__is_empty(T) && f<T>() \
&& My<T>().f() && My2<T>::trait && My3<T>().f())
#define NTEST(T) (!__is_empty(T) && !f<T>() \
&& !My<T>().f() && !My2<T>::trait && !My3<T>().f())
int main()
{
assert (NTEST (int));
assert (NTEST (void));
assert (NTEST (A));
assert (NTEST (B));
assert (NTEST (C[]));
assert (NTEST (U));
return 0;
}
|
google
|
chromium
|
utf-cvt
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/utf-cvt.C
| 1,799 |
utf_8
|
4b8fa376ae347ac191c6d32bbe4863f0
|
/* Test the char16_t and char32_t promotion rules. */
/* { dg-do compile } */
/* { dg-options "-std=c++0x -Wall -Wconversion -Wsign-conversion -Wsign-promo" } */
extern void f_c (char);
extern void fsc (signed char);
extern void fuc (unsigned char);
extern void f_s (short);
extern void fss (signed short);
extern void fus (unsigned short);
extern void f_i (int);
extern void fsi (signed int);
extern void fui (unsigned int);
extern void f_l (long);
extern void fsl (signed long);
extern void ful (unsigned long);
extern void f_ll (long long);
extern void fsll (signed long long);
extern void full (unsigned long long);
void m(char16_t c0, char32_t c1)
{
f_c (c0); /* { dg-warning "alter its value" } */
fsc (c0); /* { dg-warning "alter its value" } */
fuc (c0); /* { dg-warning "alter its value" } */
f_s (c0); /* { dg-warning "change the sign" } */
fss (c0); /* { dg-warning "change the sign" } */
fus (c0);
f_i (c0);
fsi (c0);
fui (c0);
f_l (c0);
fsl (c0);
ful (c0);
f_ll (c0);
fsll (c0);
full (c0);
f_c (c1); /* { dg-warning "alter its value" } */
fsc (c1); /* { dg-warning "alter its value" } */
fuc (c1); /* { dg-warning "alter its value" } */
f_s (c1); /* { dg-warning "alter its value" } */
fss (c1); /* { dg-warning "alter its value" } */
fus (c1); /* { dg-warning "alter its 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 } } } */
ful (c1);
f_ll (c1);
fsll (c1);
full (c1);
}
|
google
|
chromium
|
stmtexpr10
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/ext/stmtexpr10.C
| 214 |
utf_8
|
b1f2237b354111a738a7ac26e40fca77
|
/* { dg-do compile } " */
/* { dg-options "" } */
void foo(int i)
{
(i ? 1 : 2) = ({ X; }); /* { dg-error "" } */
}
struct A
{
~A ();
void foo()
{
delete this = ({ X; }); /* { dg-error "" } */
}
};
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.