Skip to content

Commit 24b5038

Browse files
apinski-caviumAndrew Pinski
authored and
Andrew Pinski
committed
memset-4.c: New test.
2014-11-16 Andrew Pinski <[email protected]> * gcc.c-torture/execute/memset-4.c: New test. * gcc.c-torture/execute/20110418-1.c: New test. * gcc.c-torture/execute/20141022-1.c: New test. * gcc.c-torture/execute/strcpy-2.c: New test. * gcc.c-torture/execute/20140212-2.c: New test. * gcc.c-torture/compile/20120913-1.c: New test. * gcc.c-torture/compile/20121010-1.c: New test. * gcc.c-torture/compile/20120917-1.c: New test. * gcc.c-torture/compile/20140110-1.c: New test. * gcc.c-torture/compile/20121220-1.c: New test. * gcc.c-torture/compile/20120822-1.c: New test. * gcc.c-torture/compile/20121027-1.c: New test. * gcc.c-torture/compile/20120830-2.c: New test. From-SVN: r217625
1 parent f607c5c commit 24b5038

14 files changed

+239
-0
lines changed

gcc/testsuite/ChangeLog

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
2014-11-16 Andrew Pinski <[email protected]>
2+
3+
* gcc.c-torture/execute/memset-4.c: New test.
4+
* gcc.c-torture/execute/20110418-1.c: New test.
5+
* gcc.c-torture/execute/20141022-1.c: New test.
6+
* gcc.c-torture/execute/strcpy-2.c: New test.
7+
* gcc.c-torture/execute/20140212-2.c: New test.
8+
* gcc.c-torture/compile/20120913-1.c: New test.
9+
* gcc.c-torture/compile/20121010-1.c: New test.
10+
* gcc.c-torture/compile/20120917-1.c: New test.
11+
* gcc.c-torture/compile/20140110-1.c: New test.
12+
* gcc.c-torture/compile/20121220-1.c: New test.
13+
* gcc.c-torture/compile/20120822-1.c: New test.
14+
* gcc.c-torture/compile/20121027-1.c: New test.
15+
* gcc.c-torture/compile/20120830-2.c: New test.
16+
117
2014-11-15 Maciej W. Rozycki <[email protected]>
218

319
* g++.dg/guality/guality.exp (check_guality): Fix `test_counts'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
int a;
2+
int c;
3+
int b;
4+
void shr_long(int d, unsigned char s)
5+
{
6+
long long dvd, div, mod;
7+
dvd = b;
8+
mod = dvd % s;
9+
if (((c >> ((mod & 0xff) % 32)) & 1) == 0)
10+
a = 1;
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ubidi_writeReordered_49( int *dest, const unsigned char *dirProps)
2+
{
3+
if (!(1&(1UL<<*dirProps)))
4+
*dest=1;
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
struct list_head {
2+
struct list_head *next, *prev;
3+
};
4+
struct dm_exception {
5+
struct list_head hash_list;
6+
unsigned long long old_chunk;
7+
unsigned long long new_chunk;
8+
};
9+
struct dm_exception *dm_lookup_exception(struct list_head *table, unsigned long long chunk) {
10+
struct list_head *slot;
11+
struct dm_exception *e;
12+
slot = &table[0];
13+
e = (struct dm_exception *)slot->next;
14+
for (; &e->hash_list != (slot);)
15+
if (chunk <= (e->new_chunk>>56))
16+
return e;
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
typedef long long curl_off_t;
2+
int tool_seek_cb(void *userdata, curl_off_t offset, int whence)
3+
{
4+
if(offset > 0x7FFFFFFFLL - 0x1LL)
5+
{
6+
curl_off_t left = offset;
7+
while(left)
8+
{
9+
long step = (left > 0x7FFFFFFFLL - 0x1LL) ? 2147483647L - 1L : (long)left;
10+
left -= step;
11+
}
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
int _IO_getc(int*);
2+
read_long(int *fp)
3+
{
4+
unsigned char b0, b1, b2, b3;
5+
b0 = _IO_getc (fp);
6+
b1 = _IO_getc (fp);
7+
b2 = _IO_getc (fp);
8+
b3 = _IO_getc (fp);
9+
return ((int)(((((b3 << 8) | b2) << 8) | b1) << 8) | b0);
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
extern int nc;
2+
void f(void)
3+
{
4+
unsigned char resp[1024];
5+
int c;
6+
int bl = 0;
7+
unsigned long long *dwords = (unsigned long long *)(resp + 5);
8+
for (c=0; c<nc; c++)
9+
{
10+
ff(dwords[bl/64]);
11+
bl++;
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
typedef unsigned char uint8_t;
2+
typedef unsigned int uint32_t;
3+
static __attribute__ (( always_inline )) __inline__
4+
void rop_8_notsrc_or_dst(uint8_t *dst, uint8_t src)
5+
{
6+
*dst = (~(src)) | (*dst);
7+
}
8+
void cirrus_colorexpand_notsrc_or_dst_8 (uint8_t * dst, int bits)
9+
{
10+
uint8_t src;
11+
uint32_t colors[2];
12+
src = colors[bits];
13+
rop_8_notsrc_or_dst(dst, src);
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
typedef long unsigned int size_t;
2+
struct RangeMapRange {
3+
unsigned fromMin;
4+
unsigned fromMax;
5+
unsigned toMin;
6+
};
7+
void reserve1(void);
8+
void f(struct RangeMapRange *q1, size_t t)
9+
{
10+
const struct RangeMapRange *q2 = q1 + t;
11+
size_t n = q2 - q1;
12+
if (n > 0)
13+
reserve1();
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
typedef unsigned long long uint64_t;
2+
void f(uint64_t *a, uint64_t aa) __attribute__((noinline));
3+
void f(uint64_t *a, uint64_t aa)
4+
{
5+
uint64_t new_value = aa;
6+
uint64_t old_value = *a;
7+
int bit_size = 32;
8+
uint64_t mask = (uint64_t)(unsigned)(-1);
9+
uint64_t tmp = old_value & mask;
10+
new_value &= mask;
11+
/* On overflow we need to add 1 in the upper bits */
12+
if (tmp > new_value)
13+
new_value += 1ull<<bit_size;
14+
/* Add in the upper bits from the old value */
15+
new_value += old_value & ~mask;
16+
*a = new_value;
17+
}
18+
int main(void)
19+
{
20+
uint64_t value, new_value, old_value;
21+
value = 0x100000001;
22+
old_value = value;
23+
new_value = (value+1)&(uint64_t)(unsigned)(-1);
24+
f(&value, new_value);
25+
if (value != old_value+1)
26+
__builtin_abort ();
27+
return 0;
28+
}
29+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/* This used to fail as we would convert f into just return (unsigned int)usVlanID
2+
which is wrong. */
3+
4+
int f(unsigned short usVlanID) __attribute__((noinline,noclone));
5+
int f(unsigned short usVlanID)
6+
{
7+
unsigned int uiVlanID = 0xffffffff;
8+
int i;
9+
if ((unsigned short)0xffff != usVlanID)
10+
uiVlanID = (unsigned int)usVlanID;
11+
return uiVlanID;
12+
}
13+
14+
int main(void)
15+
{
16+
if (f(1) != 1)
17+
__builtin_abort ();
18+
if (f(0xffff) != -1)
19+
__builtin_abort ();
20+
return 0;
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#define ABORT() do { __builtin_printf("assert.\n"); __builtin_abort (); }while(0)
2+
int f(int a) __attribute__((noinline));
3+
int f(int a)
4+
{
5+
int fem_key_src;
6+
int D2930 = a & 4294967291;
7+
fem_key_src = a == 6 ? 0 : 15;
8+
fem_key_src = D2930 != 1 ? fem_key_src : 0;
9+
return fem_key_src;
10+
}
11+
12+
int main(void)
13+
{
14+
if (f(0) != 15)
15+
ABORT ();
16+
if (f(1) != 0)
17+
ABORT ();
18+
if (f(6) != 0)
19+
ABORT ();
20+
if (f(5) != 0)
21+
ABORT ();
22+
if (f(15) != 15)
23+
ABORT ();
24+
return 0;
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* Test to make sure memset of small old size works
2+
correctly. */
3+
#define SIZE 15
4+
5+
void f(char *a) __attribute__((noinline));
6+
void f(char *a)
7+
{
8+
__builtin_memset (a, 0, SIZE);
9+
}
10+
11+
12+
int main(void)
13+
{
14+
int i;
15+
char b[SIZE];
16+
for(i = 0; i < sizeof(b); i++)
17+
{
18+
b[i] = i;
19+
}
20+
f(b);
21+
for(i = 0; i < sizeof(b); i++)
22+
{
23+
if (0 != b[i])
24+
__builtin_abort ();
25+
}
26+
return 0;
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/* Test to make sure strcpy works correctly. */
2+
#define STRING "Hi!THE"
3+
4+
const char a[] = STRING;
5+
6+
void f(char *a) __attribute__((noinline));
7+
void f(char *a)
8+
{
9+
__builtin_strcpy (a, STRING);
10+
}
11+
12+
13+
int main(void)
14+
{
15+
int i;
16+
char b[sizeof(a)] = {};
17+
f(b);
18+
for(i = 0; i < sizeof(b); i++)
19+
{
20+
if (a[i] != b[i])
21+
__builtin_abort ();
22+
}
23+
return 0;
24+
}

0 commit comments

Comments
 (0)