diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-09-19 18:19:39 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-09-19 18:19:39 +0000 |
commit | e56043cd2c207982e812ce6fcecb7353dea58363 (patch) | |
tree | 01a6f37ad5a9ae6b18bdc20f052b04e19b4255c0 /gcc/testsuite/gcc.c-torture | |
parent | 2e02a1a4548f2ee1ea519c88e68b20621ad16fcc (diff) | |
download | gcc-e56043cd2c207982e812ce6fcecb7353dea58363.tar.gz |
2010-09-19 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 164348, with some improvements
in gcc/melt-runtime.[ch]
2010-09-19 Basile Starynkevitch <basile@starynkevitch.net>
[[merged with trunk rev.164348, so improved MELT runtime!]]
* gcc/melt-runtime.h: improved comments.
(melt_debug_garbcoll, melt_debuggc_eprintf): Moved from melt-runtime.c.
(melt_obmag_string): New declaration.
(struct meltobject_st, struct meltclosure_st, struct
meltroutine_st, struct meltmixbigint_st, struct meltstring_st):
using GTY variable_size and @@MELTGTY@@ comment.
(melt_mark_special): added debug print.
* gcc/melt-runtime.c: Improved comments.
Include bversion.h, realmpfr.h, gimple-pretty-print.h.
(ggc_force_collect) Declared external.
(melt_forward_counter): Added.
(melt_obmag_string): New function.
(melt_alptr_1, melt_alptr_2, melt_break_alptr_1_at)
(melt_break_alptr_2_at, melt_break_alptr_1,melt_break_alptr_1)
(melt_allocate_young_gc_zone, melt_free_young_gc_zone): New.
(delete_special, meltgc_make_special): Improved debug printf and
use melt_break_alptr_1...
(ggc_alloc_*) macros defined for backport to GCC 4.5
(melt_forwarded_copy): Don't clear the new destination zone in old
GGC heap.
(meltgc_add_out_raw_len): Use ggc_alloc_atomic.
(meltgc_raw_new_mappointers, meltgc_raw_put_mappointers)
(meltgc_raw_remove_mappointers): Corrected length argument to
ggc_alloc_cleared_vec_entrypointermelt_st.
(melt_really_initialize): Call melt_allocate_young_gc_zone.
(melt_initialize): Set flag_plugin_added.
(melt_val2passflag): TODO_verify_loops only in GCC 4.5
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@164424 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.c-torture')
67 files changed, 1842 insertions, 1 deletions
diff --git a/gcc/testsuite/gcc.c-torture/compile/20100609-1.c b/gcc/testsuite/gcc.c-torture/compile/20100609-1.c new file mode 100644 index 00000000000..8e1175faa32 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20100609-1.c @@ -0,0 +1,8 @@ +extern unsigned long int strtoul (__const char *__restrict __nptr, char **__restrict __endptr, int __base); +int find_reloads (int i, char *p) +{ + int c; + while ((c = *p++)) + return strtoul (p - 1, &p, 10); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20100907.c b/gcc/testsuite/gcc.c-torture/compile/20100907.c new file mode 100644 index 00000000000..2e6cfb9ff9f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20100907.c @@ -0,0 +1,9 @@ +struct a {int a,b;}; +const static struct a a[1]={{1,2}}; +struct a b,c; +t() +{ + int idx = 0; + b=a[idx]; + c=a[idx]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20100915-1.c b/gcc/testsuite/gcc.c-torture/compile/20100915-1.c new file mode 100644 index 00000000000..04f6ab0fd70 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20100915-1.c @@ -0,0 +1,82 @@ +/* PR rtl-optimization/45593 */ +/* Testcase by Arnaud Lacombe <lacombar@gmail.com> */ + +typedef unsigned int __u32; +typedef __u32 __be32; +static inline __attribute__((always_inline)) int __attribute__((__cold__)) printk(const char *s, ...) { return 0; } +typedef struct journal_s journal_t; +typedef struct journal_header_s +{ + __be32 h_magic; + __be32 h_blocktype; + __be32 h_sequence; +} journal_header_t; +typedef struct journal_superblock_s +{ + journal_header_t s_header; + __be32 s_blocksize; + __be32 s_maxlen; +} journal_superblock_t; +struct journal_s +{ + struct buffer_head *j_sb_buffer; + journal_superblock_t *j_superblock; + int j_format_version; + int j_blocksize; + unsigned int j_maxlen; +}; +static void journal_fail_superblock (journal_t *journal) +{ + journal->j_sb_buffer = ((void *)0); +} +static int journal_get_superblock(journal_t *journal) +{ + struct buffer_head *bh; + journal_superblock_t *sb; + int err = -100; + bh = journal->j_sb_buffer; + if (!buffer_uptodate(bh)) { + if (!buffer_uptodate(bh)) { + printk ("JBD: IO error reading journal superblock\n"); + goto out; + } + } + err = -101; + if (sb->s_header.h_magic != (( __be32)(__u32)(0)) || + sb->s_blocksize != (( __be32)(__u32)(journal->j_blocksize))) { + printk("JBD: no valid journal superblock found\n"); + goto out; + } + switch((( __u32)(__be32)(sb->s_header.h_blocktype))) { + case 0: + case 1: + break; + default: + goto out; + } + if ((( __u32)(__be32)(sb->s_maxlen)) < journal->j_maxlen) + journal->j_maxlen = (( __u32)(__be32)(sb->s_maxlen)); + else if ((( __u32)(__be32)(sb->s_maxlen)) > journal->j_maxlen) { + printk ("JBD: journal file too short\n"); + goto out; + } + return 0; +out: + journal_fail_superblock(journal); + return err; +} +static int load_superblock(journal_t *journal) +{ + journal_get_superblock(journal); + return 0; +} +int jbd2_journal_update_format (journal_t *journal) +{ + journal_get_superblock(journal); + return 0; +} +int jbd2_journal_wipe(journal_t *journal, int write) +{ + load_superblock(journal); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-declparen.c b/gcc/testsuite/gcc.c-torture/compile/limits-declparen.c index 41bf9c5cdc1..ee855800667 100644 --- a/gcc/testsuite/gcc.c-torture/compile/limits-declparen.c +++ b/gcc/testsuite/gcc.c-torture/compile/limits-declparen.c @@ -1,3 +1,4 @@ +/* { dg-xfail-if "" { alpha*-dec-osf5* } { "-g" } { "" } } */ #define PTR1 (* (* (* (* (* (* (* (* (* (* #define PTR2 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 #define PTR3 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-fnargs.c b/gcc/testsuite/gcc.c-torture/compile/limits-fnargs.c index 6640d1a7472..126a2b8e7d3 100644 --- a/gcc/testsuite/gcc.c-torture/compile/limits-fnargs.c +++ b/gcc/testsuite/gcc.c-torture/compile/limits-fnargs.c @@ -1,4 +1,5 @@ /* { dg-timeout-factor 4.0 } */ +/* { dg-require-effective-target run_expensive_tests } */ #define PAR1 int, int, int, int, int, int, int, int, int, int #define PAR2 PAR1, PAR1, PAR1, PAR1, PAR1, PAR1, PAR1, PAR1, PAR1, PAR1 diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-pointer.c b/gcc/testsuite/gcc.c-torture/compile/limits-pointer.c index 1e50ea7cf34..43515556616 100644 --- a/gcc/testsuite/gcc.c-torture/compile/limits-pointer.c +++ b/gcc/testsuite/gcc.c-torture/compile/limits-pointer.c @@ -1,3 +1,4 @@ +/* { dg-xfail-if "" { alpha*-dec-osf5* } { "-g" } { "" } } */ #define PTR1 * * * * * * * * * * #define PTR2 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 #define PTR3 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 diff --git a/gcc/testsuite/gcc.c-torture/compile/pc44485.c b/gcc/testsuite/gcc.c-torture/compile/pc44485.c new file mode 100644 index 00000000000..fc959257dd3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pc44485.c @@ -0,0 +1,46 @@ +static int +foo (int si1, int si2) +{ + return si1 > 0 && si2 > 0 && si1 > -si2 || si1 < 0 && si2 < 0 + && si1 < -si2 ? : si1 + si2; +} + +struct S0 +{ + unsigned short f1; +}; +int g_4; +struct S0 g_54 = { + 3428 +}; + +int +func_21 (int * p_22, int * const int32p_24, unsigned p_25, + const int * p_26); + +void int324 (unsigned p_15, int * p_16, int * p_17, int * p_18) +{ + if (foo (g_4, func_21 (p_18, &g_4, 0, 0))) + { + for (g_54.f1; g_54.f1; g_54.f1 += 1) + { + } + } +} + +int +func_21 (int * p_22, int * const int32p_24, unsigned p_25, + const int * p_26) +{ + for (0; 1; p_25 += 1) + lbl_29:if (p_25) + goto lbl_28; +lbl_28:for (p_25 = 0; p_25 < 9; p_25 += 1) + if (p_25) + goto lbl_29; + unsigned short l_53; + for (0; l_53; l_53 = foo) + { + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42347.c b/gcc/testsuite/gcc.c-torture/compile/pr42347.c new file mode 100644 index 00000000000..e98b8698480 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42347.c @@ -0,0 +1,16 @@ +/* PR bootstrap/42347 */ + +long +foo (long x, long y) +{ + x = x & y; + switch (y) + { + case 63L: x >>= 0; break; + case 4032L: x >>= 6; break; + case 258048L: x >>= 12; break; + case 16515072L: x >>= 18; break; + default: __builtin_unreachable (); + } + return x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43635.c b/gcc/testsuite/gcc.c-torture/compile/pr43635.c new file mode 100644 index 00000000000..4039fa7a569 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43635.c @@ -0,0 +1,7 @@ +extern void d (void); + +void (*foo (void)) (float) +{ + void (*(*x) (void)) (float) = d; + return (*x) (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43636.c b/gcc/testsuite/gcc.c-torture/compile/pr43636.c new file mode 100644 index 00000000000..ebf50edf312 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43636.c @@ -0,0 +1,10 @@ +/* PR target/43636 */ + +extern char a[], *b[]; + +char * +foo (char *x, int y) +{ + x = __builtin_stpcpy (x, b[a[y]]); + return x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43679.c b/gcc/testsuite/gcc.c-torture/compile/pr43679.c new file mode 100644 index 00000000000..c45ef9f965f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43679.c @@ -0,0 +1,33 @@ +unsigned g_5; +int g_7; +int g_23[2]; +int *g_29 = &g_23[0]; +int **g_59; +unsigned long g_186; + +int foo (int, int); +int bar (int); + +void func_37 (long p_38) +{ + int *l_39 = &g_7; + *l_39 = (*l_39 + || + (foo + (((*g_29 != *l_39, ((bar (g_59 != &l_39), 0), 0))), + 0))); + foo (*l_39, 0); + int **l_256 = &l_39; + { + for (0; g_186; 0) + { + *l_256 = *l_256; + if (g_5) + goto lbl_270; + *l_39 &= 0; + } + } +lbl_270: + ; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43791.c b/gcc/testsuite/gcc.c-torture/compile/pr43791.c new file mode 100644 index 00000000000..38cb3c8e00a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43791.c @@ -0,0 +1,21 @@ +int owner(); +int clear(); + +static void fixup() { + clear(); +} + +inline __attribute__ ((always_inline)) +void slowtrylock(void) { + if (owner()) + fixup(); +} + +void fasttrylock(void (*slowfn)()) { + slowfn(); +} + +void trylock(void) { + fasttrylock(slowtrylock); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43845.c b/gcc/testsuite/gcc.c-torture/compile/pr43845.c new file mode 100644 index 00000000000..bdb45e7d2a8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43845.c @@ -0,0 +1,12 @@ +typedef int __attribute__ ((const)) (*x264_pixel_cmp_t)(void); + +typedef struct { + x264_pixel_cmp_t ssd; +} x264_pixel_function_t; + +int x264_pixel_ssd_wxh (x264_pixel_function_t *pf, int i_width) { + int i_ssd = 0, x; + for (x = 0; x < i_width; x++) + i_ssd += pf->ssd(); + return i_ssd; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44030.c b/gcc/testsuite/gcc.c-torture/compile/pr44030.c new file mode 100644 index 00000000000..cd5d5f616c9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44030.c @@ -0,0 +1,28 @@ +typedef int int32_t; +typedef unsigned int uint32_t; +static uint32_t +safe_sub_func_uint32_t_u_u (uint32_t ui1, uint32_t ui2) +{ + return ui1 - ui2; +} + +int32_t l_105[7]; + +int32_t g_4; +int32_t *g_54 = &g_4; +int32_t * +func (int32_t p_73, int32_t * p_74, int32_t p_75, int32_t * *p_76, + int32_t * *p_77) +{ +lbl_110:for (g_4 = 0; g_4; g_4 = 1) + { + } + for (p_75 = -28; p_75; p_75 = safe_sub_func_uint32_t_u_u (p_75, 1)) + { + if (g_4) + goto lbl_110; + *g_54 = 0; + } + return &l_105[5]; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44038.c b/gcc/testsuite/gcc.c-torture/compile/pr44038.c new file mode 100644 index 00000000000..574ff398b42 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44038.c @@ -0,0 +1,13 @@ +struct Ustr { + char data[1]; +}; +int ustr_xi__embed_val_get(char *); +inline static int ustr_len(struct Ustr *s1) +{ + return ustr_xi__embed_val_get(s1->data); +} +static struct Ustr *s1 = ((struct Ustr *) ""); +int tst(char *cstr) +{ + return ustr_len(s1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44043.c b/gcc/testsuite/gcc.c-torture/compile/pr44043.c new file mode 100644 index 00000000000..943501b4091 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44043.c @@ -0,0 +1,87 @@ +typedef unsigned char __u8; +typedef unsigned short __u16; +typedef unsigned int __u32; +typedef unsigned long __kernel_size_t; +typedef __kernel_size_t size_t; +typedef __u8 uint8_t; +typedef __u16 __be16; +typedef __u32 __be32; +struct msghdr { + struct iovec * msg_iov; + unsigned msg_flags; +}; +enum { IPPROTO_ICMP = 1 }; +struct sk_buff { }; +static inline __attribute__((always_inline)) struct dst_entry * +skb_dst(const struct sk_buff *skb) +{ +}; +enum nf_inet_hooks { NF_INET_LOCAL_OUT }; +struct net_device { + unsigned mtu; +}; +static inline __attribute__((always_inline)) int +NF_HOOK_THRESH(uint8_t pf, unsigned int hook, struct sk_buff *skb, + struct net_device *in, struct net_device *out, + int (*okfn)(struct sk_buff *), int thresh) +{ + int ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, thresh); + if (ret == 1) + ret = okfn(skb); + return ret; +} +static inline __attribute__((always_inline)) int +NF_HOOK(uint8_t pf, unsigned int hook, struct sk_buff *skb, + struct net_device *in, struct net_device *out, + int (*okfn)(struct sk_buff *)) +{ + return NF_HOOK_THRESH(pf, hook, skb, in, out, okfn, (-((int)(~0U>>1)) - 1)); +} +struct dst_entry { + struct net_device *dev; + int (*output)(struct sk_buff*); +}; +static inline __attribute__((always_inline)) int dst_output(struct sk_buff *skb) { + return skb_dst(skb)->output(skb); +}; +struct iphdr { + __u8 protocol; +}; +struct inet_sock { + __be16 inet_dport; + __u8 recverr: 1, hdrincl: 1; + struct { } cork; +}; +struct icmphdr { + __u8 type; +}; +struct rtable { + union { struct dst_entry dst; } u; + __be32 rt_dst; +}; +struct sock; +struct inet_sock *inet_sk (struct sock *); +struct net *sock_net (struct sock *); +void *skb_transport_header (struct sk_buff *); +static int raw_send_hdrinc(struct sock *sk, void *from, size_t length, + struct rtable *rt, unsigned int flags) +{ + struct inet_sock *inet = inet_sk(sk); + struct net *net = sock_net(sk); + struct iphdr *iph; + struct sk_buff *skb; + if (length > rt->u.dst.dev->mtu) + ip_local_error(sk, 90, rt->rt_dst, inet->inet_dport, rt->u.dst.dev->mtu); + if (flags&0x10) + goto out; + if (iph->protocol == IPPROTO_ICMP) + icmp_out_count(net, ((struct icmphdr *)skb_transport_header(skb))->type); + NF_HOOK(2, NF_INET_LOCAL_OUT, skb, ((void *)0), rt->u.dst.dev, + dst_output); +out: + while (0); +} +int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) +{ + raw_send_hdrinc(sk, msg->msg_iov, len, (void *)0, msg->msg_flags); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44063.c b/gcc/testsuite/gcc.c-torture/compile/pr44063.c new file mode 100644 index 00000000000..596e1dc991f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44063.c @@ -0,0 +1,38 @@ +typedef signed char int8_t; +typedef short int16_t; +typedef unsigned char uint8_t; +typedef unsigned int uint32_t; + +union unaligned_32 {uint32_t l;} __attribute__((packed)) __attribute__((may_alias)); +static inline uint32_t NEG_USR32(uint32_t a, int8_t s){return a << (32 - s);} +typedef struct GetBitContext { const uint8_t *buffer, *buffer_end; int index;}GetBitContext; +typedef struct VLC {int16_t (*table)[2];} VLC; +static __attribute__((always_inline)) inline int get_vlc2(GetBitContext *s, int16_t (*table)[2], int bits, int max_depth) { + unsigned int re_index= (s)->index; + int re_cache= 0; + { + int n, nb_bits; + unsigned int index; + index= NEG_USR32(re_cache, bits); + n = table[index][1]; + if(max_depth > 1 && n < 0){ + re_cache= bswap_32((((const union unaligned_32 *) (((const uint8_t *)(s)->buffer)+(re_index>>3)))->l)) << (re_index&0x07); + } + } +} +typedef struct HYuvContext{GetBitContext gb; int decorrelate; int bitstream_bpp; uint8_t *temp[3]; VLC vlc[6];} HYuvContext; +static __attribute__((always_inline)) inline void decode_bgr_1(HYuvContext *s, int count, int decorrelate, int alpha){ + int i; + int code = get_vlc2(&s->gb, s->vlc[3].table, 11, 1); + if(code != -1){ + s->temp[0][4*i+0] = get_vlc2(&s->gb, s->vlc[0].table, 11, 3); + s->temp[0][4*i+1] = get_vlc2(&s->gb, s->vlc[1].table, 11, 3); + s->temp[0][4*i+2] = get_vlc2(&s->gb, s->vlc[2].table, 11, 3); + } +} +void decode_bgr_bitstream(HYuvContext *s, int count){ + if(s->decorrelate){ + if(s->bitstream_bpp==24) decode_bgr_1(s, count, 1, 0); + else decode_bgr_1(s, count, 1, 1); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44119.c b/gcc/testsuite/gcc.c-torture/compile/pr44119.c new file mode 100644 index 00000000000..ef6ca4533fc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44119.c @@ -0,0 +1,46 @@ +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +typedef unsigned int uint32_t; +static int8_t +safe_mul_func_int16_t_s_s (int16_t si1, int8_t si2) +{ + return si1 && si2 && si1 > +si2 || si1 && si2 && si2 < +si1 || si1 && si2 + && si1 < +si2 || si1 && si2 && si1 && si2 < +si1 ? : si1 * si2; +} + +struct S0 +{ +}; +int32_t g_72[7][4][1]; +int32_t *g_184 = &g_72[1][2][0]; +int32_t **g_224 = &g_184; +struct S0 g_244 = { +}; + +int8_t * +func_96 (int8_t p_97, uint32_t p_98, uint32_t p_99) +{ + struct S0 *l_243 = &g_244; + int i; + for (i = 0; i < 1; p_98 = 1) + { + int32_t *l_202[3]; + int i; + for (i = 0; i < 1; i++) + l_202[i] = &g_72[2][2][0]; + if (safe_mul_func_int16_t_s_s (0xCAF0, **g_224)) + { + if (p_98 && &l_243) + { + } + else + *g_224 = l_202[0]; + for (0;; 1) + { + } + } + } + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44197.c b/gcc/testsuite/gcc.c-torture/compile/pr44197.c new file mode 100644 index 00000000000..79f5421643f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44197.c @@ -0,0 +1,23 @@ +/* { dg-require-alias "" } */ +typedef unsigned short int __uint16_t; +enum +{ + _ISupper = (1 << (0)), _ISlower = (1 << (1)), _ISalpha = + (1 << (2)), _ISdigit = (1 << (3)), _ISxdigit = (1 << (4)), _ISspace = + (1 << (5)), _ISprint = (1 << (6)), _ISgraph = (1 << (7)), _ISblank = + (1 << (8)), _IScntrl = (1 << (9)), _ISpunct = (1 << (10)), _ISalnum = + (1 << (11)) +}; +typedef __uint16_t __ctype_mask_t; +extern const __ctype_mask_t *__C_ctype_b; +extern +__typeof (__C_ctype_b) + __C_ctype_b __asm__ ("" "__GI___C_ctype_b") + __attribute__ ((visibility ("hidden"))); + static const __ctype_mask_t __C_ctype_b_data[] = { + }; + +const __ctype_mask_t *__C_ctype_b = __C_ctype_b_data + 128; +extern +__typeof (__C_ctype_b) + __EI___C_ctype_b __attribute__ ((alias ("" "__GI___C_ctype_b"))); diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44686.c b/gcc/testsuite/gcc.c-torture/compile/pr44686.c new file mode 100644 index 00000000000..eacd83d3130 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44686.c @@ -0,0 +1,7 @@ +/* { dg-options "-O2 -fipa-pta -fprofile-generate" } */ +void * +memcpy (void *a, const void *b, __SIZE_TYPE__ len) +{ + if (a == b) + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44687.c b/gcc/testsuite/gcc.c-torture/compile/pr44687.c new file mode 100644 index 00000000000..f59c2efd0f5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44687.c @@ -0,0 +1,32 @@ +typedef int int32_t; +typedef unsigned char uint8_t; +struct S0 +{ + uint8_t f0; +}; +struct S0 *g_18[7][5][1][1] = { +}; + +struct S0 **g_17 = &g_18[0][3][0][0]; +int32_t g_86; +struct S0 func_72 (uint8_t p_73, struct S0 p_74); + +void int326 (struct S0 **p_67, int32_t p_68, int32_t * *const p_69, + struct S0 *p_70) +{ + struct S0 l_95 = { + -1L + }; + func_72 (1L, func_72 (0, l_95)); +} + +struct S0 +func_72 (uint8_t p_73, struct S0 p_74) +{ + int32_t *l_85 = &g_86; + if (*l_85) + lbl_94:*l_85 ^= 0; + if (g_86) + goto lbl_94; + return **g_17; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44707.c b/gcc/testsuite/gcc.c-torture/compile/pr44707.c new file mode 100644 index 00000000000..9031f0042c9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44707.c @@ -0,0 +1,14 @@ +extern struct { int a, b, c, d; } v; +extern int w; + +void +foo (void) +{ + int e1 = v.a; + int e2 = w; + int e3 = v.b; + int e4 = v.c; + int e5 = v.d; + __asm__ volatile ("/* %0 %1 %2 %3 %4 */" : : "nro" (e1), "nro" (e2), "nro" (e3), "nro" (e4), "nro" (e5)); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44784.c b/gcc/testsuite/gcc.c-torture/compile/pr44784.c new file mode 100644 index 00000000000..54d531a3dff --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44784.c @@ -0,0 +1,47 @@ +typedef struct rtx_def *rtx; +enum rtx_code { SUBREG }; +typedef union rtunion_def { + long rtint; + unsigned long rtuint; + rtx rtx; +} rtunion; +struct rtx_def { + enum rtx_code code: 8; + rtunion fld[1]; +}; +typedef struct simple_bitmap_def { + unsigned long long elms[1]; +} *sbitmap; +struct df_link { + struct df_link *next; + rtx reg; +}; +typedef enum { UNDEFINED, CONSTANT, VARYING } latticevalue; +typedef struct { + latticevalue lattice_val; +} value; +static value *values; +static sbitmap ssa_edges; +void defs_to_varying (struct df_link *start) +{ + struct df_link *currdef; + for (currdef = start; + currdef; + currdef = currdef->next) + { + rtx reg = currdef->reg; + if (values[(reg->code == SUBREG + ? reg->fld[0].rtx + : reg)->fld[0].rtuint].lattice_val != VARYING) + ssa_edges->elms [(reg->code == SUBREG + ? reg->fld[0].rtx + : reg)->fld[0].rtuint / 64] + |= ((unsigned long long) 1 + << (reg->code == SUBREG + ? reg->fld[0].rtx + : reg)->fld[0].rtuint % 64); + values[(reg->code == SUBREG + ? reg->fld[0].rtx + : reg)->fld[0].rtuint].lattice_val = VARYING; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44788.c b/gcc/testsuite/gcc.c-torture/compile/pr44788.c new file mode 100644 index 00000000000..99dc7982394 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44788.c @@ -0,0 +1,8 @@ +void joint_decode(float* mlt_buffer1, int t) { + int i; + float decode_buffer[1060]; + foo(decode_buffer); + for (i=0; i<10 ; i++) { + mlt_buffer1[i] = i * decode_buffer[t]; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44831.c b/gcc/testsuite/gcc.c-torture/compile/pr44831.c new file mode 100644 index 00000000000..5539583deb0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44831.c @@ -0,0 +1,15 @@ +typedef unsigned char UCHAR, *PUCHAR; +typedef void *HANDLE; +typedef struct _NCB { + UCHAR ncb_reserve[10]; +} NCB, *PNCB; +struct NBCmdQueue { + PNCB head; +}; +PNCB *NBCmdQueueFindNBC(struct NBCmdQueue *queue, PNCB ncb) +{ + PNCB *ret = &queue->head; + while (ret && *ret != ncb) + ret = (PNCB *)((*ret)->ncb_reserve + sizeof(HANDLE)); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44891.c b/gcc/testsuite/gcc.c-torture/compile/pr44891.c new file mode 100644 index 00000000000..145b1446903 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44891.c @@ -0,0 +1,26 @@ +struct S +{ + float f; + long l; +}; + +extern int gi; +extern float gf; + +long foo (long p) +{ + struct S s; + float *pf; + + s.l = p; + + pf = &s.f; + + pf++; + pf--; + + gf = *pf + 3.3; + gi = *((int *)pf) + 2; + + return s.l + 6; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44937.c b/gcc/testsuite/gcc.c-torture/compile/pr44937.c new file mode 100644 index 00000000000..3bb711d7bb4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44937.c @@ -0,0 +1,30 @@ +int g_19; +int *g_42; +int **volatile g = &g_42; +int g_67[5][9][2][1] = { +}; + +int +func_4 (int p_5, unsigned char p_6, unsigned char p_7) +{ + unsigned char l_8[1]; + if (p_6) + goto lbl_13; + for (p_6 = 0; p_6; p_6 = (p_6, 0)) + if (0) + { + } + else + lbl_13:for (p_6 = 0; p_6 < 1; p_6 += 1) + l_8[p_6] = 0; + return 0; +} + +int * +func_45 (unsigned long p_46, unsigned char p_47) +{ + int *l_56 = &g_19; + (void *)&l_56 != (void *)&g | !1 == func_4 (0, g_67[2][6][1][0], 0) ^ func_4 (1, 0, 0); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44941.c b/gcc/testsuite/gcc.c-torture/compile/pr44941.c new file mode 100644 index 00000000000..7d9cc8372fc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44941.c @@ -0,0 +1,8 @@ +struct S { }; + +extern void bar(struct S); + +void foo (int i) +{ + bar (*(struct S *)&i); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44946.c b/gcc/testsuite/gcc.c-torture/compile/pr44946.c new file mode 100644 index 00000000000..7b230124585 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44946.c @@ -0,0 +1,27 @@ +struct A +{ + int i; + long l; +}; + +struct B +{ + int i; +}; + +struct C +{ + int i; + struct B b; +}; + +struct B foo (struct A a) +{ + struct C *c = (struct C *) &a; + return c->b; +} +void bar (struct A a, struct B b) +{ + struct C *c = (struct C *) &a; + c->b = b; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44988.c b/gcc/testsuite/gcc.c-torture/compile/pr44988.c new file mode 100644 index 00000000000..317eafdf7c8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44988.c @@ -0,0 +1,13 @@ +struct S +{ + int i; +}; + +extern void bar (struct S); + +void +foo (void) +{ + int i = 0; + bar (*(struct S *) &i); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45047.c b/gcc/testsuite/gcc.c-torture/compile/pr45047.c new file mode 100644 index 00000000000..f37955a0372 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45047.c @@ -0,0 +1,9 @@ +/* PR tree-optimization/45047 */ + +void +foo (const unsigned short *w, char *x, int y, int z) +{ + int i; + for (i = 0; i < y; i++) + x[i] = w[i] == z; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45059.c b/gcc/testsuite/gcc.c-torture/compile/pr45059.c new file mode 100644 index 00000000000..3f13cdbf8c7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45059.c @@ -0,0 +1,23 @@ +/* PR tree-optimization/45059 */ + +typedef unsigned int T; +extern void foo (signed char *, int); + +static signed char a; +static T b[1] = { -1 }; +static unsigned char c; + +static inline short int +bar (short v) +{ + c |= a < b[0]; + return 0; +} + +int +main () +{ + signed char *e = &a; + foo (e, bar (bar (c))); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45085.c b/gcc/testsuite/gcc.c-torture/compile/pr45085.c new file mode 100644 index 00000000000..5c1ec6a5c96 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45085.c @@ -0,0 +1,45 @@ +/* { dg-options "-O2 -Wuninitialized" } */ +struct S { char *s1; long s2; }; +struct T { int t1; long t2; long t3; }; +extern int fn2 (void); +extern int fn3 (struct T); +extern struct T fn4 (); +extern int fn5 (char **, long *, int); +extern void fn6 (void); +extern void fn7 (void *); +struct S *fn10 (); +static int p; +static void *q; +extern struct T r; + +static struct T +fn8 (struct T x, int y) +{ + struct S *u = fn10 (); + int v = fn5 (&u->s1, &u->s2, 0); + while (1) + { + if (p) +fn6 (); + if (fn3 (x)) +return fn4 (); + if (y & 1) +return r; + v = fn5 (&u->s1, &u->s2, 1); + } +} + +struct T +fn9 (struct T x, int y) +{ + struct T t = fn8 (x, y); + if (fn2 ()) + fn7 (q); + return t; +} + +void * +fn1 (void) +{ + return fn9; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45109.c b/gcc/testsuite/gcc.c-torture/compile/pr45109.c new file mode 100644 index 00000000000..0e46c38409f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45109.c @@ -0,0 +1,38 @@ +struct o_fsm_t; +struct o_fsm_event_t; + +typedef void (*fn_t) (struct o_fsm_t *, + struct o_fsm_event_t const *); + +struct o_fsm_state_t { + fn_t dispatch; +}; + +struct o_fsm_t { + fn_t dispatch; +}; + +extern struct o_fsm_state_t o_fsm_tran(struct o_fsm_t *fsm, + struct o_fsm_state_t next_state); +static void plist_parser_state_start(struct o_fsm_t *fsm, + struct o_fsm_event_t const *fsm_event); + +struct o_fsm_state_t o_fsm_state(fn_t dispatch_fcn) +{ + return *(struct o_fsm_state_t *)&dispatch_fcn; +} + +typedef struct _o_plist_parser_t { + struct o_fsm_t fsm; +} o_plist_parser_t; + +static void plist_parser_state_start(struct o_fsm_t *fsm, + struct o_fsm_event_t const *fsm_event) +{ +} + +void o_plist_deserialize_xml(int fin) +{ + o_plist_parser_t parser; + o_fsm_tran(&parser.fsm, o_fsm_state(plist_parser_state_start)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45182.c b/gcc/testsuite/gcc.c-torture/compile/pr45182.c new file mode 100644 index 00000000000..ad27ff88651 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45182.c @@ -0,0 +1,10 @@ +typedef struct TypHeader { + struct TypHeader ** ptr; +} *TypHandle; +void PlainRange (TypHandle hdList, long lenList, long low, long inc) +{ + long i; + for (i = 1; i <= lenList; i++ ) + (((TypHandle*)((hdList)->ptr))[i] = (((TypHandle) (((long)(low + (i-1) * +inc) << 2) + 1)))); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45412.c b/gcc/testsuite/gcc.c-torture/compile/pr45412.c new file mode 100644 index 00000000000..339854b59af --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45412.c @@ -0,0 +1,22 @@ +extern void baz (int, int, int); + +int j; + +int +bar (void) +{ + int n = 0, *np = &n; + if (j) + baz (0, 0, 0); + if (j) + baz (0, 0, 0); + return n; +} + +void +foo (void) +{ + bar (); + bar (); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45535.c b/gcc/testsuite/gcc.c-torture/compile/pr45535.c new file mode 100644 index 00000000000..03d15a12d05 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45535.c @@ -0,0 +1,38 @@ +typedef struct { + unsigned long pmd0; + unsigned long pmd1; +} pmd_t; +typedef unsigned int pgd_t; +struct mm_struct { + pgd_t * pgd; +}; +extern inline int pmd_bad(pmd_t pmd) +{ +} +extern inline void pmd_clear(pmd_t * pmdp) +{ + ((*pmdp).pmd0) = 0x20 | 0x00; + ((*pmdp).pmd1) = 0x20 | 0x00; +} +static inline void free_one_pmd(pmd_t * dir) +{ + if (pmd_bad(*dir)) { + pmd_clear(dir); + } +} +static inline void free_one_pgd(pgd_t * dir) +{ + int j; + pmd_t * pmd; + pmd = ((pmd_t *) ((unsigned long) (void *)(__pgd_val(dir) & (~((1UL << 12)-1)))) + (((0) >> 21) & (512 - 1))); + for (j = 0; j < 512 ; j++) { + free_one_pmd(pmd+j); + } +} +void clear_page_tables(struct mm_struct *mm, unsigned long first, int nr) +{ + pgd_t * page_dir = mm->pgd; + do { + free_one_pgd(page_dir); + } while (--nr); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20100316-1.c b/gcc/testsuite/gcc.c-torture/execute/20100316-1.c new file mode 100644 index 00000000000..8367d7273d2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20100316-1.c @@ -0,0 +1,24 @@ +struct Foo { + int i; + unsigned precision : 10; + unsigned blah : 3; +} f; + +int __attribute__((noinline,noclone)) +foo (struct Foo *p) +{ + struct Foo *q = p; + return (*q).precision; +} + +extern void abort (void); + +int main() +{ + f.i = -1; + f.precision = 0; + f.blah = -1; + if (foo (&f) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20100416-1.c b/gcc/testsuite/gcc.c-torture/execute/20100416-1.c new file mode 100644 index 00000000000..8b5a6f45e87 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20100416-1.c @@ -0,0 +1,40 @@ +void abort(void); + +int +movegt(int x, int y, long long a) +{ + int i; + int ret = 0; + for (i = 0; i < y; i++) + { + if (a >= (long long) 0xf000000000000000LL) + ret = x; + else + ret = y; + } + return ret; +} + +struct test +{ + long long val; + int ret; +} tests[] = { + { 0xf000000000000000LL, -1 }, + { 0xefffffffffffffffLL, 1 }, + { 0xf000000000000001LL, -1 }, + { 0x0000000000000000LL, -1 }, + { 0x8000000000000000LL, 1 }, +}; + +int +main() +{ + int i; + for (i = 0; i < sizeof (tests) / sizeof (tests[0]); i++) + { + if (movegt (-1, 1, tests[i].val) != tests[i].ret) + abort (); + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20100430-1.c b/gcc/testsuite/gcc.c-torture/execute/20100430-1.c new file mode 100644 index 00000000000..d29c6fa1a37 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20100430-1.c @@ -0,0 +1,51 @@ +/* This used to generate unaligned accesses at -O2 because of IVOPTS. */ + +struct packed_struct +{ + struct packed_struct1 + { + unsigned char cc11; + unsigned char cc12; + } __attribute__ ((packed)) pst1; + struct packed_struct2 + { + unsigned char cc21; + unsigned char cc22; + unsigned short ss[104]; + unsigned char cc23[13]; + } __attribute__ ((packed)) pst2[4]; +} __attribute__ ((packed)); + +typedef struct +{ + int ii; + struct packed_struct buf; +} info_t; + +static unsigned short g; + +static void __attribute__((noinline)) +dummy (unsigned short s) +{ + g = s; +} + +static int +foo (info_t *info) +{ + int i, j; + + for (i = 0; i < info->buf.pst1.cc11; i++) + for (j = 0; j < info->buf.pst2[i].cc22; j++) + dummy (info->buf.pst2[i].ss[j]); + + return 0; +} + +int main(void) +{ + info_t info; + info.buf.pst1.cc11 = 2; + info.buf.pst2[0].cc22 = info.buf.pst2[1].cc22 = 8; + return foo (&info); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20100708-1.c b/gcc/testsuite/gcc.c-torture/execute/20100708-1.c new file mode 100644 index 00000000000..590a94a70b7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20100708-1.c @@ -0,0 +1,29 @@ +/* PR middle-end/44843 */ +/* Verify that we don't use the alignment of struct S for inner accesses. */ + +struct S +{ + double for_alignment; + struct { int x, y, z; } a[16]; +}; + +void f(struct S *s) __attribute__((noinline)); + +void f(struct S *s) +{ + unsigned int i; + + for (i = 0; i < 16; ++i) + { + s->a[i].x = 0; + s->a[i].y = 0; + s->a[i].z = 0; + } +} + +int main (void) +{ + struct S s; + f (&s); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20100805-1.c b/gcc/testsuite/gcc.c-torture/execute/20100805-1.c new file mode 100644 index 00000000000..5b476960ed7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20100805-1.c @@ -0,0 +1,15 @@ +unsigned int foo (unsigned int a, unsigned int b) +{ + unsigned i; + a = a & 1; + for (i = 0; i < b; ++i) + a = a << 1 | a >> (sizeof (unsigned int) * 8 - 1); + return a; +} +extern void abort (void); +int main() +{ + if (foo (1, sizeof (unsigned int) * 8 + 1) != 2) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20100827-1.c b/gcc/testsuite/gcc.c-torture/execute/20100827-1.c new file mode 100644 index 00000000000..8a531b99bb1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20100827-1.c @@ -0,0 +1,23 @@ +extern void abort (void); +int __attribute__((noinline,noclone)) +foo (char *p) +{ + int h = 0; + do + { + if (*p == '\0') + break; + ++h; + if (p == 0) + abort (); + ++p; + } + while (1); + return h; +} +int main() +{ + if (foo("a") != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960321-1.x b/gcc/testsuite/gcc.c-torture/execute/960321-1.x new file mode 100644 index 00000000000..44cc702686d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960321-1.x @@ -0,0 +1,15 @@ +# This test fails to link on 64-bit Solaris 2/x86 due to a Sun as bug. +if { [istarget "i?86-*-solaris2*"] + && ! [check_effective_target_ilp32] + && ! [check_effective_target_gas] } { + set torture_eval_before_compile { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data { + "64-bit Sun as bug" \ + { "i?86-*-solaris2*" } \ + { "-O[1-3s]" } \ + { "" } + } + } +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/frame-address.c b/gcc/testsuite/gcc.c-torture/execute/frame-address.c index 942f5c5d653..109c2b229c8 100644 --- a/gcc/testsuite/gcc.c-torture/execute/frame-address.c +++ b/gcc/testsuite/gcc.c-torture/execute/frame-address.c @@ -25,7 +25,8 @@ int check_fa (char *unused) { const char c = 0; - return check_fa_mid (&c); + /* Prevent a tail call to check_fa_mid, eliding the current stack frame. */ + return check_fa_mid (&c) != 0; } int how_much (void) diff --git a/gcc/testsuite/gcc.c-torture/execute/pr40386.c b/gcc/testsuite/gcc.c-torture/execute/pr40386.c new file mode 100644 index 00000000000..ae0ac5a98f1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr40386.c @@ -0,0 +1,99 @@ +/* { dg-options "-fno-ira-share-spill-slots" } */ +#define CHAR_BIT 8 + +#define ROR(a,b) (((a) >> (b)) | ((a) << ((sizeof (a) * CHAR_BIT) - (b)))) +#define ROL(a,b) (((a) << (b)) | ((a) >> ((sizeof (a) * CHAR_BIT) - (b)))) + +#define CHAR_VALUE ((char)0xf234) +#define SHORT_VALUE ((short)0xf234) +#define INT_VALUE ((int)0xf234) +#define LONG_VALUE ((long)0xf2345678L) +#define LL_VALUE ((long long)0xf2345678abcdef0LL) + +#define SHIFT1 4 +#define SHIFT2 ((sizeof (long long) * CHAR_BIT) - SHIFT1) + +char c = CHAR_VALUE; +short s = SHORT_VALUE; +int i = INT_VALUE; +long l = LONG_VALUE; +long long ll = LL_VALUE; +int shift1 = SHIFT1; +int shift2 = SHIFT2; + +main () +{ + if (ROR (c, shift1) != ROR (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROR (c, SHIFT1) != ROR (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROR (s, shift1) != ROR (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROR (s, SHIFT1) != ROR (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROR (i, shift1) != ROR (INT_VALUE, SHIFT1)) + abort (); + + if (ROR (i, SHIFT1) != ROR (INT_VALUE, SHIFT1)) + abort (); + + if (ROR (l, shift1) != ROR (LONG_VALUE, SHIFT1)) + abort (); + + if (ROR (l, SHIFT1) != ROR (LONG_VALUE, SHIFT1)) + abort (); + + if (ROR (ll, shift1) != ROR (LL_VALUE, SHIFT1)) + abort (); + + if (ROR (ll, SHIFT1) != ROR (LL_VALUE, SHIFT1)) + abort (); + + if (ROR (ll, shift2) != ROR (LL_VALUE, SHIFT2)) + abort (); + + if (ROR (ll, SHIFT2) != ROR (LL_VALUE, SHIFT2)) + abort (); + + if (ROL (c, shift1) != ROL (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROL (c, SHIFT1) != ROL (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROL (s, shift1) != ROL (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROL (s, SHIFT1) != ROL (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROL (i, shift1) != ROL (INT_VALUE, SHIFT1)) + abort (); + + if (ROL (i, SHIFT1) != ROL (INT_VALUE, SHIFT1)) + abort (); + + if (ROL (l, shift1) != ROL (LONG_VALUE, SHIFT1)) + abort (); + + if (ROL (l, SHIFT1) != ROL (LONG_VALUE, SHIFT1)) + abort (); + + if (ROL (ll, shift1) != ROL (LL_VALUE, SHIFT1)) + abort (); + + if (ROL (ll, SHIFT1) != ROL (LL_VALUE, SHIFT1)) + abort (); + + if (ROL (ll, shift2) != ROL (LL_VALUE, SHIFT2)) + abort (); + + if (ROL (ll, SHIFT2) != ROL (LL_VALUE, SHIFT2)) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr40386.x b/gcc/testsuite/gcc.c-torture/execute/pr40386.x new file mode 100644 index 00000000000..12192e203e7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr40386.x @@ -0,0 +1,2 @@ +set additional_flags "-fno-ira-share-spill-slots" +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr40657.c b/gcc/testsuite/gcc.c-torture/execute/pr40657.c new file mode 100644 index 00000000000..e6d8dda9f99 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr40657.c @@ -0,0 +1,23 @@ +/* Verify that that Thumb-1 epilogue size optimization does not clobber the + return value. */ + +long long v = 0x123456789abc; + +__attribute__((noinline)) void bar (int *x) +{ + asm volatile ("" : "=m" (x) ::); +} + +__attribute__((noinline)) long long foo() +{ + int x; + bar(&x); + return v; +} + +int main () +{ + if (foo () != v) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr43560.c b/gcc/testsuite/gcc.c-torture/execute/pr43560.c new file mode 100644 index 00000000000..cb420c614cc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr43560.c @@ -0,0 +1,28 @@ +/* PR tree-optimization/43560 */ + +struct S +{ + int a, b; + char c[10]; +}; + +__attribute__ ((noinline)) void +test (struct S *x) +{ + while (x->b > 1 && x->c[x->b - 1] == '/') + { + x->b--; + x->c[x->b] = '\0'; + } +} + +const struct S s = { 0, 0, "" }; + +int +main () +{ + struct S *p; + asm ("" : "=r" (p) : "0" (&s)); + test (p); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr43783.c b/gcc/testsuite/gcc.c-torture/execute/pr43783.c new file mode 100644 index 00000000000..3880026c405 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr43783.c @@ -0,0 +1,21 @@ +typedef __attribute__((aligned(16))) +struct { + unsigned long long w[3]; +} UINT192; + +UINT192 bid_Kx192[32]; + +extern void abort (void); + +int main() +{ + int i = 0; + unsigned long x = 0; + for (i = 0; i < 32; ++i) + bid_Kx192[i].w[1] = i == 1; + for (i = 0; i < 32; ++i) + x += bid_Kx192[1].w[1]; + if (x != 32) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr43784.c b/gcc/testsuite/gcc.c-torture/execute/pr43784.c new file mode 100644 index 00000000000..622232725a2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr43784.c @@ -0,0 +1,33 @@ +struct s { + unsigned char a[256]; +}; +union u { + struct { struct s b; int c; } d; + struct { int c; struct s b; } e; +}; + +static union u v; +static struct s *p = &v.d.b; +static struct s *q = &v.e.b; + +static struct s __attribute__((noinline)) rp(void) +{ + return *p; +} + +static void qp(void) +{ + *q = rp(); +} + +int main() +{ + int i; + for (i = 0; i < 256; i++) + p->a[i] = i; + qp(); + for (i = 0; i < 256; i++) + if (q->a[i] != i) + __builtin_abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr43835.c b/gcc/testsuite/gcc.c-torture/execute/pr43835.c new file mode 100644 index 00000000000..97237f62538 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr43835.c @@ -0,0 +1,51 @@ +struct PMC { + unsigned flags; +}; + +typedef struct Pcc_cell +{ + struct PMC *p; + long bla; + long type; +} Pcc_cell; + +extern void abort (); +extern void Parrot_gc_mark_PMC_alive_fun(int * interp, struct PMC *pmc) + __attribute__((noinline)); + +void Parrot_gc_mark_PMC_alive_fun (int * interp, struct PMC *pmc) +{ + abort (); +} + +static void mark_cell(int * interp, Pcc_cell *c) + __attribute__((__nonnull__(1))) + __attribute__((__nonnull__(2))) + __attribute__((noinline)); + +static void +mark_cell(int * interp, Pcc_cell *c) +{ + if (c->type == 4 && c->p + && !(c->p->flags & (1<<18))) + Parrot_gc_mark_PMC_alive_fun(interp, c->p); +} + +void foo(int * interp, Pcc_cell *c); + +void +foo(int * interp, Pcc_cell *c) +{ + mark_cell(interp, c); +} + +int main() +{ + int i; + Pcc_cell c; + c.p = 0; + c.bla = 42; + c.type = 4; + foo (&i, &c); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr43987.c b/gcc/testsuite/gcc.c-torture/execute/pr43987.c new file mode 100644 index 00000000000..ee41bdf2717 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr43987.c @@ -0,0 +1,20 @@ +char B[256 * sizeof(void *)]; +typedef void *FILE; +typedef struct globals { + int c; + FILE *l; +} __attribute__((may_alias)) T; +void add_input_file(FILE *file) +{ + (*(T*)&B).l[0] = file; +} +extern void abort (void); +int main() +{ + FILE x; + (*(T*)&B).l = &x; + add_input_file ((void *)-1); + if ((*(T*)&B).l[0] != (void *)-1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44164.c b/gcc/testsuite/gcc.c-torture/execute/pr44164.c new file mode 100644 index 00000000000..171f9c39f59 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44164.c @@ -0,0 +1,24 @@ +struct X { + struct Y { + struct YY { + struct Z { + int i; + } c; + } bb; + } b; +} a; +int __attribute__((noinline, noclone)) +foo (struct Z *p) +{ + int i = p->i; + a.b = (struct Y){}; + return p->i + i; +} +extern void abort (void); +int main() +{ + a.b.bb.c.i = 1; + if (foo (&a.b.bb.c) != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44202-1.c b/gcc/testsuite/gcc.c-torture/execute/pr44202-1.c new file mode 100644 index 00000000000..37e84f2fc37 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44202-1.c @@ -0,0 +1,30 @@ +extern __attribute__ ((__noreturn__)) void exit(int); +extern __attribute__ ((__noreturn__)) void abort(void); +__attribute__ ((__noinline__)) +int +add512(int a, int *b) +{ + int c = a + 512; + if (c != 0) + *b = a; + return c; +} + +__attribute__ ((__noinline__)) +int +add513(int a, int *b) +{ + int c = a + 513; + if (c == 0) + *b = a; + return c; +} + +int main(void) +{ + int b0 = -1; + int b1 = -1; + if (add512(-512, &b0) != 0 || b0 != -1 || add513(-513, &b1) != 0 || b1 != -513) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44468.c b/gcc/testsuite/gcc.c-torture/execute/pr44468.c new file mode 100644 index 00000000000..c4bd492656d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44468.c @@ -0,0 +1,60 @@ +#include <stddef.h> + +struct S { + int i; + int j; +}; +struct R { + int k; + struct S a; +}; +struct Q { + float k; + struct S a; +}; +struct Q s; +int __attribute__((noinline,noclone)) +test1 (void *q) +{ + struct S *b = (struct S *)((char *)q + sizeof (int)); + s.a.i = 0; + b->i = 3; + return s.a.i; +} +int __attribute__((noinline,noclone)) +test2 (void *q) +{ + struct S *b = &((struct R *)q)->a; + s.a.i = 0; + b->i = 3; + return s.a.i; +} +int __attribute__((noinline,noclone)) +test3 (void *q) +{ + s.a.i = 0; + ((struct S *)((char *)q + sizeof (int)))->i = 3; + return s.a.i; +} +extern void abort (void); +int +main() +{ + if (sizeof (float) != sizeof (int) + || offsetof (struct R, a) != sizeof (int) + || offsetof (struct Q, a) != sizeof (int)) + return 0; + s.a.i = 1; + s.a.j = 2; + if (test1 ((void *)&s) != 3) + abort (); + s.a.i = 1; + s.a.j = 2; + if (test2 ((void *)&s) != 3) + abort (); + s.a.i = 1; + s.a.j = 2; + if (test3 ((void *)&s) != 3) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44555.c b/gcc/testsuite/gcc.c-torture/execute/pr44555.c new file mode 100644 index 00000000000..6ba8e491971 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44555.c @@ -0,0 +1,16 @@ +struct a { + char b[100]; +}; +int foo(struct a *a) +{ + if (&a->b) + return 1; + return 0; +} +extern void abort (void); +int main() +{ + if (foo((struct a *)0) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44575.c b/gcc/testsuite/gcc.c-torture/execute/pr44575.c new file mode 100644 index 00000000000..62a7d7800b0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44575.c @@ -0,0 +1,49 @@ +/* PR target/44575 */ + +#include <stdarg.h> + +int fails = 0; +struct S { float a[3]; }; +struct S a[5]; + +void +check (int z, ...) +{ + struct S arg, *p; + va_list ap; + int j = 0, k = 0; + int i; + va_start (ap, z); + for (i = 2; i < 4; ++i) + { + p = 0; + j++; + k += 2; + switch ((z << 4) | i) + { + case 0x12: + case 0x13: + p = &a[2]; + arg = va_arg (ap, struct S); + break; + default: + ++fails; + break; + } + if (p && p->a[2] != arg.a[2]) + ++fails; + if (fails) + break; + } + va_end (ap); +} + +int +main () +{ + a[2].a[2] = -49026; + check (1, a[2], a[2]); + if (fails) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44683.c b/gcc/testsuite/gcc.c-torture/execute/pr44683.c new file mode 100644 index 00000000000..d0fd446f004 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44683.c @@ -0,0 +1,18 @@ +int __attribute__((noinline,noclone)) +copysign_bug (double x) +{ + if (x != 0.0 && (x * 0.5 == x)) + return 1; + if (__builtin_copysign(1.0, x) < 0.0) + return 2; + else + return 3; +} +int main(void) +{ + double x = -0.0; + if (copysign_bug (x) != 2) + __builtin_abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44683.x b/gcc/testsuite/gcc.c-torture/execute/pr44683.x new file mode 100644 index 00000000000..20413409a20 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44683.x @@ -0,0 +1,6 @@ +if { [istarget "sh*-*-*"] } { + # SH require -mieee for this test. + set additional_flags "-mieee" +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44828.c b/gcc/testsuite/gcc.c-torture/execute/pr44828.c new file mode 100644 index 00000000000..93837344b2d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44828.c @@ -0,0 +1,19 @@ +extern void abort (void); + +static signed char +foo (signed char si1, signed char si2) +{ + return si1 * si2; +} + +int a = 0x105F61CA; + +int +main (void) +{ + int b = 0x0332F5C8; + if (foo (b, a) > 0) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44852.c b/gcc/testsuite/gcc.c-torture/execute/pr44852.c new file mode 100644 index 00000000000..440653e5f17 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44852.c @@ -0,0 +1,22 @@ +__attribute__ ((__noinline__)) +char *sf(char *s, char *s0) +{ + asm (""); + while (*--s == '9') + if (s == s0) + { + *s = '0'; + break; + } + ++*s++; + return s; +} + +int main() +{ + char s[] = "999999"; + char *x = sf (s+2, s); + if (x != s+1 || __builtin_strcmp (s, "199999") != 0) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44858.c b/gcc/testsuite/gcc.c-torture/execute/pr44858.c new file mode 100644 index 00000000000..45e1758b0c2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44858.c @@ -0,0 +1,28 @@ +/* PR rtl-optimization/44858 */ + +extern void abort (void); +int a = 3; +int b = 1; + +__attribute__((noinline)) long long +foo (int x, int y) +{ + return x / y; +} + +__attribute__((noinline)) int +bar (void) +{ + int c = 2; + c &= foo (1, b) > b; + b = (a != 0) | c; + return c; +} + +int +main (void) +{ + if (bar () != 0 || b != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44942.c b/gcc/testsuite/gcc.c-torture/execute/pr44942.c new file mode 100644 index 00000000000..3ef0830220d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44942.c @@ -0,0 +1,70 @@ +/* PR target/44942 */ + +#include <stdarg.h> + +void +test1 (int a, int b, int c, int d, int e, int f, int g, long double h, ...) +{ + int i; + va_list ap; + + va_start (ap, h); + i = va_arg (ap, int); + if (i != 1234) + __builtin_abort (); + va_end (ap); +} + +void +test2 (int a, int b, int c, int d, int e, int f, int g, long double h, int i, + long double j, int k, long double l, int m, long double n, ...) +{ + int o; + va_list ap; + + va_start (ap, n); + o = va_arg (ap, int); + if (o != 1234) + __builtin_abort (); + va_end (ap); +} + +void +test3 (double a, double b, double c, double d, double e, double f, + double g, long double h, ...) +{ + double i; + va_list ap; + + va_start (ap, h); + i = va_arg (ap, double); + if (i != 1234.0) + __builtin_abort (); + va_end (ap); +} + +void +test4 (double a, double b, double c, double d, double e, double f, double g, + long double h, double i, long double j, double k, long double l, + double m, long double n, ...) +{ + double o; + va_list ap; + + va_start (ap, n); + o = va_arg (ap, double); + if (o != 1234.0) + __builtin_abort (); + va_end (ap); +} + +int +main () +{ + test1 (0, 0, 0, 0, 0, 0, 0, 0.0L, 1234); + test2 (0, 0, 0, 0, 0, 0, 0, 0.0L, 0, 0.0L, 0, 0.0L, 0, 0.0L, 1234); + test3 (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0L, 1234.0); + test4 (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0L, 0.0, 0.0L, + 0.0, 0.0L, 0.0, 0.0L, 1234.0); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr45034.c b/gcc/testsuite/gcc.c-torture/execute/pr45034.c new file mode 100644 index 00000000000..2d86f309ceb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr45034.c @@ -0,0 +1,45 @@ +extern void abort (void); +static void fixnum_neg(signed char x, signed char *py, int *pv) +{ + unsigned char ux, uy; + + ux = (unsigned char)x; + uy = -ux; + *py = (uy <= 127) ? (signed char)uy : (-(signed char)(255 - uy) - 1); + *pv = (x == -128) ? 1 : 0; +} + +void __attribute__((noinline)) foo(int x, int y, int v) +{ + if (y < -128 || y > 127) + abort(); +} + +int test_neg(void) +{ + signed char x, y; + int v, err; + + err = 0; + x = -128; + for (;;) { + fixnum_neg(x, &y, &v); + foo((int)x, (int)y, v); + if ((v && x != -128) || (!v && x == -128)) + ++err; + if (x == 127) + break; + ++x; + } + return err; +} + +int main(void) +{ + if (sizeof (char) != 1) + return 0; + if (test_neg() != 0) + abort(); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr45070.c b/gcc/testsuite/gcc.c-torture/execute/pr45070.c new file mode 100644 index 00000000000..95ff77aa0b0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr45070.c @@ -0,0 +1,52 @@ +/* PR45070 */ +extern void abort(void); + +struct packed_ushort { + unsigned short ucs; +} __attribute__((packed)); + +struct source { + int pos, length; + int flag; +}; + +static void __attribute__((noinline)) fetch(struct source *p) +{ + p->length = 128; +} + +static struct packed_ushort __attribute__((noinline)) next(struct source *p) +{ + struct packed_ushort rv; + + if (p->pos >= p->length) { + if (p->flag) { + p->flag = 0; + fetch(p); + return next(p); + } + p->flag = 1; + rv.ucs = 0xffff; + return rv; + } + rv.ucs = 0; + return rv; +} + +int main(void) +{ + struct source s; + int i; + + s.pos = 0; + s.length = 0; + s.flag = 0; + + for (i = 0; i < 16; i++) { + struct packed_ushort rv = next(&s); + if ((i == 0 && rv.ucs != 0xffff) + || (i > 0 && rv.ucs != 0)) + abort(); + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr45262.c b/gcc/testsuite/gcc.c-torture/execute/pr45262.c new file mode 100644 index 00000000000..72e186bf287 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr45262.c @@ -0,0 +1,33 @@ +/* PR middle-end/45262 */ + +extern void abort (void); + +int +foo (unsigned int x) +{ + return ((int) x < 0) || ((int) (-x) < 0); +} + +int +bar (unsigned int x) +{ + return x >> 31 || (-x) >> 31; +} + +int +main (void) +{ + if (foo (1) != 1) + abort (); + if (foo (0) != 0) + abort (); + if (foo (-1) != 1) + abort (); + if (bar (1) != 1) + abort (); + if (bar (0) != 0) + abort (); + if (bar (-1) != 1) + abort (); + return 0; +} |