summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture')
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20010516-1.c5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20030310-1.c13
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20030405-1.c78
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20030405-1.x3
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20030416-1.c16
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20030530-1.c23
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20030530-3.c16
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20030716-1.c7
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20030823-1.c18
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20030902-1.c37
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20030910-1.c11
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20030917-1.c18
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20031124-1.c8
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20031125-1.c36
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20031125-2.c20
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20031203-1.c22
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20031203-2.c6
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20031203-3.c7
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20040219-1.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20040220-1.c16
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20040303-1.c16
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20040303-2.c23
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20040304-1.c61
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20040309-1.c20
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20040310-1.c10
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20040317-1.c4
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20040317-2.c25
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20040317-3.c11
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20040323-1.c11
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20040401-1.c6
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20040415-1.c5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20040415-2.c7
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr14730.c16
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr15245.c21
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20000603-1.c11
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20020819-1.c22
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20021113-1.c17
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20030403-1.c16
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20030404-1.c23
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20030501-1.c17
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20030828-1.c18
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20030828-2.c28
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20030903-1.c21
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20030909-1.c35
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20030910-1.c13
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20030913-1.c26
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20031010-1.c34
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20031211-1.c13
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20031211-2.c19
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20040319-1.c17
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20040423-1.c30
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/930529-1.x23
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtin-constant.x11
53 files changed, 867 insertions, 124 deletions
diff --git a/gcc/testsuite/gcc.c-torture/compile/20010516-1.c b/gcc/testsuite/gcc.c-torture/compile/20010516-1.c
deleted file mode 100644
index 7732812cfb1..00000000000
--- a/gcc/testsuite/gcc.c-torture/compile/20010516-1.c
+++ /dev/null
@@ -1,5 +0,0 @@
-foo()
-{
- char d;
- asm volatile ( "" :: "m"(&d));
-}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20030310-1.c b/gcc/testsuite/gcc.c-torture/compile/20030310-1.c
new file mode 100644
index 00000000000..0e89e0bfca2
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20030310-1.c
@@ -0,0 +1,13 @@
+static inline void
+foo (char accept)
+{
+ char s;
+ while (s == accept) ;
+}
+
+static void
+bar (void)
+{
+ char ch;
+ foo (ch);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20030405-1.c b/gcc/testsuite/gcc.c-torture/compile/20030405-1.c
index 2e61f1fa3ff..f84e606c045 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20030405-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20030405-1.c
@@ -1,58 +1,30 @@
-/* PR optimization/10024 */
-extern int *allegro_errno;
-typedef long fixed;
-extern inline int
-fixfloor (fixed x)
-{
- if (x >= 0)
- return (x >> 16);
- else
- return ~((~x) >> 16);
-}
-extern inline int
-fixtoi (fixed x)
-{
- return fixfloor (x) + ((x & 0x8000) >> 15);
-}
-extern inline fixed
-ftofix (double x)
-{
- if (x > 32767.0)
- {
- *allegro_errno = 34;
- return 0x7FFFFFFF;
- }
- if (x < -32767.0)
- {
- *allegro_errno = 34;
- return -0x7FFFFFFF;
- }
- return (long) (x * 65536.0 + (x < 0 ? -0.5 : 0.5));
-}
-extern inline double
-fixtof (fixed x)
-{
- return (double) x / 65536.0;
-}
-extern inline fixed
-fixdiv (fixed x, fixed y)
+/* When compiled with -pedantic, this program will cause an ICE when the
+ constant propagator tries to set the value of *str to UNDEFINED.
+
+ This happens because *str is erroneously considered as a store alias.
+ The aliasing code is then making *str an alias leader for its alias set
+ and when the PHI node at the end of the while() is visited the first
+ time, CCP will try to assign it a value of UNDEFINED, but the default
+ value for *str is a constant. */
+typedef unsigned int size_t;
+size_t strlength (const char * const);
+char foo();
+
+static const char * const str = "mingo";
+
+bar()
{
- if (y == 0)
+ size_t c;
+ char *x;
+
+ c = strlength (str);
+ while (c < 10)
{
- *allegro_errno = 34;
- return (x < 0) ? -0x7FFFFFFF : 0x7FFFFFFF;
+ if (c > 5)
+ *x = foo ();
+ if (*x < 'a')
+ break;
}
- else
- return ftofix (fixtof (x) / fixtof (y));
-}
-extern inline fixed
-itofix (int x)
-{
- return x << 16;
-}
-int
-foo (int n)
-{
- return fixtoi (fixdiv (itofix (512), itofix (n)));
+ return *x == '3';
}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20030405-1.x b/gcc/testsuite/gcc.c-torture/compile/20030405-1.x
new file mode 100644
index 00000000000..3dbbbda51b7
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20030405-1.x
@@ -0,0 +1,3 @@
+# This test was found to fail only when -pedantic is used.
+set options "-pedantic"
+return 0
diff --git a/gcc/testsuite/gcc.c-torture/compile/20030416-1.c b/gcc/testsuite/gcc.c-torture/compile/20030416-1.c
new file mode 100644
index 00000000000..c3d18b68281
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20030416-1.c
@@ -0,0 +1,16 @@
+void foo(int x)
+{
+ if (x > 3)
+ {;}
+ else
+ bar();
+ x = 9;
+}
+
+main()
+{
+ int j;
+
+ foo(j);
+ return j;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20030530-1.c b/gcc/testsuite/gcc.c-torture/compile/20030530-1.c
new file mode 100644
index 00000000000..b479ea22b1d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20030530-1.c
@@ -0,0 +1,23 @@
+union tree_node;
+typedef union tree_node *tree;
+struct tree_common
+{
+ tree type;
+ unsigned lang_flag_0 : 1;
+};
+union tree_node
+{
+ struct tree_common common;
+};
+static void
+java_check_regular_methods (tree class_decl)
+{
+ int saw_constructor = class_decl->common.type->common.lang_flag_0;
+ tree class = class_decl->common.type;
+ for (;;)
+ {
+ if (class)
+ if (class_decl->common.type)
+ bar (class);
+ }
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20030530-3.c b/gcc/testsuite/gcc.c-torture/compile/20030530-3.c
new file mode 100644
index 00000000000..0a93d2f13fa
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20030530-3.c
@@ -0,0 +1,16 @@
+struct tree_decl
+{
+ unsigned in_system_header_flag:1;
+};
+union tree_node
+{
+ struct tree_decl decl;
+};
+typedef union tree_node *tree;
+static int
+redeclaration_error_message (olddecl)
+ tree olddecl;
+{
+ if (({olddecl;})->decl.in_system_header_flag)
+ ;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20030716-1.c b/gcc/testsuite/gcc.c-torture/compile/20030716-1.c
new file mode 100644
index 00000000000..ceb4b6171e9
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20030716-1.c
@@ -0,0 +1,7 @@
+void baz(int i);
+
+void foo(int i, int A[i+1])
+{
+ int j=A[i];
+ void bar() { baz(A[i]); }
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20030823-1.c b/gcc/testsuite/gcc.c-torture/compile/20030823-1.c
new file mode 100644
index 00000000000..89a3ea50a7f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20030823-1.c
@@ -0,0 +1,18 @@
+struct A
+{
+ int a;
+};
+
+int foo (struct A *a)
+{
+ static int c = 30;
+ int x;
+
+ a->a = c;
+ /* Dominator optimizations will replace the use of 'a->a' with 'c', but
+ they won't copy the virtual operands for 'c' from its originating
+ statement. This exposes symbol 'c' without a correct SSA version
+ number. */
+ x = a->a;
+ return x;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20030902-1.c b/gcc/testsuite/gcc.c-torture/compile/20030902-1.c
new file mode 100644
index 00000000000..443b43921b8
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20030902-1.c
@@ -0,0 +1,37 @@
+typedef unsigned int size_t;
+typedef unsigned long int reg_syntax_t;
+struct re_pattern_buffer
+{
+ unsigned char *buffer;
+};
+typedef enum
+{
+ jump,
+ jump_n,
+} re_opcode_t;
+static int
+foo (bufp)
+ struct re_pattern_buffer *bufp;
+{
+ int mcnt;
+ unsigned char *p = bufp->buffer;
+ switch (((re_opcode_t) * p++))
+ {
+ unconditional_jump:
+ ;
+ /* This test case caused an ICE because the statement insertion
+ routines were failing to update basic block boundaries. */
+ case jump:
+ do
+ {
+ (mcnt) = *(p) & 0377;
+ }
+ while (0);
+ (p) += 2;
+ p += mcnt;
+ case jump_n:
+ (mcnt) = *(p + 2) & 0377;
+ if (mcnt)
+ goto unconditional_jump;
+ }
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20030910-1.c b/gcc/testsuite/gcc.c-torture/compile/20030910-1.c
new file mode 100644
index 00000000000..9fad109208c
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20030910-1.c
@@ -0,0 +1,11 @@
+/* The gimplifier was getting confused when taking the real or
+ imaginary component of a complex rvalue. */
+
+void test()
+{
+ __complex double dc;
+ double d;
+
+ d = __real (dc * dc);
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/compile/20030917-1.c b/gcc/testsuite/gcc.c-torture/compile/20030917-1.c
new file mode 100644
index 00000000000..38b6598af14
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20030917-1.c
@@ -0,0 +1,18 @@
+typedef struct string STR;
+typedef struct atbl ARRAY;
+struct string {
+ unsigned char str_pok;
+};
+struct atbl {
+ int ary_fill;
+};
+blah(size,strp)
+register int size;
+register STR **strp;
+{
+ register ARRAY *ar;
+ ar->ary_fill = size - 1;
+ while (size--)
+ (*strp)->str_pok &= ~128;
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/compile/20031124-1.c b/gcc/testsuite/gcc.c-torture/compile/20031124-1.c
new file mode 100644
index 00000000000..102e71aa84f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20031124-1.c
@@ -0,0 +1,8 @@
+/* PR 13143 */
+
+int f (void *ptr)
+{
+ extern char const stop[];
+ return ptr >= (void *) &stop;
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/compile/20031125-1.c b/gcc/testsuite/gcc.c-torture/compile/20031125-1.c
new file mode 100644
index 00000000000..735a20bc241
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20031125-1.c
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+short *_offsetTable;
+/* This tests to make sure PRE splits the entry block ->block 0 edge
+ when there are multiple block 0 predecessors.
+ This is done so that we don't end up with an insertion on the
+ entry block -> block 0 edge which would require a split at insertion
+ time.
+ PR 13163. */
+void proc4WithoutFDFE(char *dst, const char *src, int next_offs, int bw,
+ int bh, int pitch)
+{
+ do {
+ int i = bw;
+ int code = *src++;
+ int x, l;
+ int length = *src++ + 1;
+
+ for (l = 0; l < length; l++) {
+ int x;
+
+ for (x = 0; x < 4; x++) ;
+ if (i == 0)
+ dst += pitch * 3;
+ }
+ char *dst2 = dst + _offsetTable[code] + next_offs;
+
+ for (x = 0; x < 4; x++) {
+ int j = 0;
+ (dst + pitch * x)[j] = (dst2 + pitch * x)[j];
+ }
+ dst += pitch * 3;
+ } while (--bh);
+}
+
+
diff --git a/gcc/testsuite/gcc.c-torture/compile/20031125-2.c b/gcc/testsuite/gcc.c-torture/compile/20031125-2.c
new file mode 100644
index 00000000000..2af8a021175
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20031125-2.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+struct BlobSpan {
+ int right;
+};
+/* This test makes sure we don't accidently cause a bad insertion to occur
+ by choosing the wrong variable name so that we end up with a use not
+ dominated by a def. */
+void render_blob_line(struct BlobSpan blobdata) {
+ int buf[4 * 8];
+ int *data = buf;
+ int i, n = 0;
+ if (blobdata.right)
+ n++;
+ if (n)
+ for (; i < 2 * n;)
+ data[i] = 0;
+ n *= 2;
+ for (; n;) ;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20031203-1.c b/gcc/testsuite/gcc.c-torture/compile/20031203-1.c
new file mode 100644
index 00000000000..7827eb9066f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20031203-1.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+void make_file_symbol_completion_list (char *);
+/* This tests to make sure PRE doesn't choose the wrong name when
+ inserting phi nodes. Otherwise, we get uses that aren't dominated
+ by defs.
+ PR 13177. */
+void location_completer (char *text)
+{
+ char *p, *symbol_start = text;
+ for (p = text; *p != '\0'; ++p) {
+ if (*p == '\\' && p[1] == '\'')
+ p++;
+ else if (*p == ':')
+ symbol_start = p + 1;
+ else
+ symbol_start = p + 1;
+ make_file_symbol_completion_list(symbol_start);
+ }
+}
+
+
diff --git a/gcc/testsuite/gcc.c-torture/compile/20031203-2.c b/gcc/testsuite/gcc.c-torture/compile/20031203-2.c
new file mode 100644
index 00000000000..47f561bae77
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20031203-2.c
@@ -0,0 +1,6 @@
+/* Don't ICE on stupid user tricks. */
+
+int foo(int bar)
+{
+ return (&bar)[-1];
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20031203-3.c b/gcc/testsuite/gcc.c-torture/compile/20031203-3.c
new file mode 100644
index 00000000000..341a9df984a
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20031203-3.c
@@ -0,0 +1,7 @@
+/* Don't ICE on user silliness. GCC 3.4 and before accepts this without
+ comment; 3.5 warns. Perhaps eventually we'll declare this an error. */
+
+void bar (void)
+{
+ ({});
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040219-1.c b/gcc/testsuite/gcc.c-torture/compile/20040219-1.c
new file mode 100644
index 00000000000..d3bc9272b64
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20040219-1.c
@@ -0,0 +1 @@
+double foo() { return __builtin_isgreater(0.,0.); }
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040220-1.c b/gcc/testsuite/gcc.c-torture/compile/20040220-1.c
new file mode 100644
index 00000000000..8a4a5ba6d0f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20040220-1.c
@@ -0,0 +1,16 @@
+/* PR 14194 */
+
+int irqs;
+
+static inline __attribute__((always_inline))
+int kstat_irqs (void) {
+ int i, sum = 0;
+ for (i = 0; i < 1; i++)
+ if (__builtin_expect(i, 0))
+ sum += irqs;
+ return sum;
+}
+
+int show_interrupts (void) {
+ return kstat_irqs ();
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040303-1.c b/gcc/testsuite/gcc.c-torture/compile/20040303-1.c
new file mode 100644
index 00000000000..6b2452adab9
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20040303-1.c
@@ -0,0 +1,16 @@
+typedef struct input {
+ struct input *next;
+} input_t;
+static input_t *inputs = (input_t *)((void *)0);
+void
+RemoveInput(unsigned long id)
+{
+ input_t *ip;
+ input_t *prev;
+ while (1)
+ if (ip == (input_t *)id)
+ break;
+ if (ip == (input_t *)((void *)0))
+ return;
+ prev->next = ip->next;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040303-2.c b/gcc/testsuite/gcc.c-torture/compile/20040303-2.c
new file mode 100644
index 00000000000..6751620a43a
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20040303-2.c
@@ -0,0 +1,23 @@
+void abort(void);
+int x, y;
+void init_xy(void);
+void
+test4(void)
+{
+ init_xy();
+ _Bool iftemp0;
+ int x1 = x;
+ _Bool iftemp1;
+ x1++;
+ if (x1 != 3)
+ {
+ iftemp1 = 1;
+ goto endfirstif;
+ }
+ iftemp1 = 0;
+ endfirstif:
+ iftemp0 = iftemp1;
+ if (iftemp0)
+ abort();
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040304-1.c b/gcc/testsuite/gcc.c-torture/compile/20040304-1.c
index 146d42f23d6..ee277d799a4 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20040304-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20040304-1.c
@@ -1,45 +1,20 @@
-/* PR optimization/14235 */
-/* Origin: <senor_fjord@yahoo.com> */
-
-typedef signed char int8_t;
-typedef short int16_t;
-typedef int int32_t;
-typedef unsigned long long uint64_t;
-
-static const uint64_t LOW_BYTE_MASK = 0x00000000000000ffULL;
-static const uint64_t HIGH_BYTE_MASK = 0x000000000000ff00ULL;
-static const uint64_t WORD_MASK = 0x000000000000ffffULL;
-static const uint64_t DWORD_MASK = 0x00000000ffffffffULL;
-
-extern uint64_t *srca_mask;
-extern int *assert_thrown;
-
-void foo()
+void
+cpplib_macroExpand (char * pfile)
{
- uint64_t tempA = 0; /* actually a bunch of code to set A */
- uint64_t tempB = 0; /* actually a bunch of code to set B */
-
- /* cast A to right size */
- tempA = (((*srca_mask == LOW_BYTE_MASK) ||
- (*srca_mask == HIGH_BYTE_MASK)) ?
- ((int8_t)tempA) :
- ((*srca_mask == WORD_MASK) ?
- ((int16_t)tempA) :
- ((*srca_mask == DWORD_MASK) ?
- ((int32_t)tempA) :
- tempA)));
-
- /* cast B to right size */
- tempB = (((*srca_mask == LOW_BYTE_MASK) ||
- (*srca_mask == HIGH_BYTE_MASK)) ?
- ((int8_t)tempB) :
- ((*srca_mask == WORD_MASK) ?
- ((int16_t)tempB) :
- ((*srca_mask == DWORD_MASK) ?
- ((int32_t)tempB) :
- tempB)));
-
- if ((int) tempA > (int) tempB) {
- *assert_thrown = 1;
- }
+ int nargs;
+ int rest_args;
+ int token = -1;
+ rest_args = 0;
+ do
+ {
+ if (rest_args != 0)
+ continue;
+ if (nargs == 0)
+ {
+ rest_args = 1;
+ token = macarg (pfile, rest_args);
+ }
+ }
+ while (token == 20);
}
+
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040309-1.c b/gcc/testsuite/gcc.c-torture/compile/20040309-1.c
new file mode 100644
index 00000000000..df8390f207b
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20040309-1.c
@@ -0,0 +1,20 @@
+static const char default_tupleseps[] = ", \t";
+
+
+fubar (tupleseps)
+ const char *tupleseps;
+{
+ char *kp, *sp;
+ const char *septmp;
+ const char *tseplist;
+ tseplist = (tupleseps) ? tupleseps : default_tupleseps;
+ while (kp)
+ {
+ if (*tseplist)
+ septmp = tseplist;
+ bar (*septmp);
+ if (*tseplist)
+ if (*kp)
+ ;
+ }
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040310-1.c b/gcc/testsuite/gcc.c-torture/compile/20040310-1.c
new file mode 100644
index 00000000000..f0c85f0ada5
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20040310-1.c
@@ -0,0 +1,10 @@
+void I_wacom ()
+{
+ char buffer[50], *p;
+ int RequestData (char *cmd)
+ {
+ p = buffer;
+ foo (buffer);
+ }
+ RequestData (0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040317-1.c b/gcc/testsuite/gcc.c-torture/compile/20040317-1.c
new file mode 100644
index 00000000000..4a3455115cb
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20040317-1.c
@@ -0,0 +1,4 @@
+int String2Array(int len, char strarr[][len])
+{
+ strarr[0];
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040317-2.c b/gcc/testsuite/gcc.c-torture/compile/20040317-2.c
new file mode 100644
index 00000000000..3c8ee2b8ec5
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20040317-2.c
@@ -0,0 +1,25 @@
+typedef struct _ScaleRec *ScaleWidget;
+typedef struct
+{
+ short *x;
+ unsigned short *width;
+} Table;
+typedef struct
+{
+ Table table;
+} ScalePart;
+typedef struct _ScaleRec
+{
+ ScalePart scale;
+} ScaleRec;
+static int
+FindPixel (ScaleWidget sw, short x, short y,
+ short * img_x, short * img_y, unsigned long * img_pixel)
+{
+ if (sw->scale.table.x[(int) *img_x] +
+ (short) sw->scale.table.width[(int) *img_x] < x)
+ {
+ ++*img_x;
+ return FindPixel (sw, x, y, img_x, img_y, img_pixel);
+ }
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040317-3.c b/gcc/testsuite/gcc.c-torture/compile/20040317-3.c
new file mode 100644
index 00000000000..e6982c3e3b3
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20040317-3.c
@@ -0,0 +1,11 @@
+I_wacom ()
+{
+ char buffer[50], *p;
+ int RequestData (char *cmd)
+ {
+ p = buffer;
+ foo (buffer);
+ }
+ RequestData (0);
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040323-1.c b/gcc/testsuite/gcc.c-torture/compile/20040323-1.c
new file mode 100644
index 00000000000..c87e7dc70ba
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20040323-1.c
@@ -0,0 +1,11 @@
+/* PR 14694 */
+/* { dg-require-alias "" } */
+
+extern unsigned int _rtld_local __attribute__ ((alias ("_rtld_global")));
+
+unsigned int
+_dl_start (void *arg)
+{
+ unsigned int elf_machine_rel () { return _rtld_local; }
+ return elf_machine_rel ();
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040401-1.c b/gcc/testsuite/gcc.c-torture/compile/20040401-1.c
new file mode 100644
index 00000000000..ee727a9b205
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20040401-1.c
@@ -0,0 +1,6 @@
+int __atomic_readv_replacement(unsigned char iov_len, int count, int i) {
+ unsigned char bytes = 0;
+ if ((unsigned char)((char)127 - bytes) < iov_len)
+ return 22;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040415-1.c b/gcc/testsuite/gcc.c-torture/compile/20040415-1.c
new file mode 100644
index 00000000000..1b1537a7ba6
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20040415-1.c
@@ -0,0 +1,5 @@
+int isdigit (int);
+int f (const char *type)
+{
+ return isdigit ((unsigned char) *type++);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040415-2.c b/gcc/testsuite/gcc.c-torture/compile/20040415-2.c
new file mode 100644
index 00000000000..e78e81e8cf8
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20040415-2.c
@@ -0,0 +1,7 @@
+int isascii (int);
+
+int f1 (const char *type)
+{
+ return isascii ((unsigned char) *type++);
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr14730.c b/gcc/testsuite/gcc.c-torture/compile/pr14730.c
new file mode 100644
index 00000000000..b4f36a9ae3c
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr14730.c
@@ -0,0 +1,16 @@
+/* PR middle-end/14730 */
+
+int t (char i)
+{
+ switch (i)
+ {
+ case 1:
+ case 7:
+ case 10:
+ case 14:
+ case 9:
+ case 256:
+ return 0;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr15245.c b/gcc/testsuite/gcc.c-torture/compile/pr15245.c
new file mode 100644
index 00000000000..d7d9051a1c1
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr15245.c
@@ -0,0 +1,21 @@
+/* Testcase from <marcus@jet.franken.de>
+ PR optimization/15245
+ This used to ICE as convert was used
+ in tree-ssa-phiopt which created non gimple
+ code. */
+
+char *f(char *x, int flag)
+{
+ char *ret = (char*)0;
+
+
+ if( x > (char*)1 ) {
+ if(x)
+ return (char*)0;
+ } else {
+ if( flag & 1 )
+ ret = (char*)1;
+ flag |= 2;
+ }
+ return ret;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20000603-1.c b/gcc/testsuite/gcc.c-torture/execute/20000603-1.c
index 9c9f69baf04..4e31eee4563 100644
--- a/gcc/testsuite/gcc.c-torture/execute/20000603-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/20000603-1.c
@@ -1,5 +1,10 @@
+/* It is not clear whether this test is conforming. See DR#236
+ http://wwwold.dkuug.dk/JTC1/SC22/WG14/www/docs/dr_236.htm. However,
+ there seems to be consensus that the presence of a union to aggregate
+ struct s1 and struct s2 should make it conforming. */
struct s1 { double d; };
struct s2 { double d; };
+union u { struct s1 x; struct s2 y; };
double f(struct s1 *a, struct s2 *b)
{
@@ -9,9 +14,9 @@ double f(struct s1 *a, struct s2 *b)
int main()
{
- struct s1 a;
- a.d = 0.0;
- if (f (&a, (struct s2 *)&a) != 2.0)
+ union u a;
+ a.x.d = 0.0;
+ if (f (&a.x, &a.y) != 2.0)
abort ();
return 0;
}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20020819-1.c b/gcc/testsuite/gcc.c-torture/execute/20020819-1.c
new file mode 100644
index 00000000000..549da910cd4
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20020819-1.c
@@ -0,0 +1,22 @@
+foo ()
+{
+ return 0;
+}
+
+main()
+{
+ int i, j, k, ccp_bad = 0;
+
+ for (i = 0; i < 10; i++)
+ {
+ for (j = 0; j < 10; j++)
+ if (foo ())
+ ccp_bad = 1;
+
+ k = ccp_bad != 0;
+ if (k)
+ abort ();
+ }
+
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20021113-1.c b/gcc/testsuite/gcc.c-torture/execute/20021113-1.c
new file mode 100644
index 00000000000..420926d7548
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20021113-1.c
@@ -0,0 +1,17 @@
+/* This program tests a data flow bug that would cause constant propagation
+ to propagate constants through function calls. */
+
+foo (int *p)
+{
+ *p = 10;
+}
+
+main()
+{
+ int *ptr = alloca (sizeof (int));
+ *ptr = 5;
+ foo (ptr);
+ if (*ptr == 5)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20030403-1.c b/gcc/testsuite/gcc.c-torture/execute/20030403-1.c
new file mode 100644
index 00000000000..cbf1351c4be
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20030403-1.c
@@ -0,0 +1,16 @@
+/* The non-destructive folder was always emitting >= when folding
+ comparisons to signed_max+1. */
+
+#include <limits.h>
+
+int
+main ()
+{
+ unsigned long count = 8;
+
+ if (count > INT_MAX)
+ abort ();
+
+ return (0);
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/execute/20030404-1.c b/gcc/testsuite/gcc.c-torture/execute/20030404-1.c
new file mode 100644
index 00000000000..1dd1ec09906
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20030404-1.c
@@ -0,0 +1,23 @@
+/* This exposed a bug in tree-ssa-ccp.c. Since 'j' and 'i' are never
+ defined, CCP was not traversing the edges out of the if(), which caused
+ the PHI node for 'k' at the top of the while to only be visited once.
+ This ended up causing CCP to think that 'k' was the constant '1'. */
+main()
+{
+ int i, j, k;
+
+ k = 0;
+ while (k < 10)
+ {
+ k++;
+ if (j > i)
+ j = 5;
+ else
+ j =3;
+ }
+
+ if (k != 10)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20030501-1.c b/gcc/testsuite/gcc.c-torture/execute/20030501-1.c
new file mode 100644
index 00000000000..f47dc291bd3
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20030501-1.c
@@ -0,0 +1,17 @@
+int
+main (int argc, char **argv)
+{
+ int size = 10;
+
+ {
+ int retframe_block()
+ {
+ return size + 5;
+ }
+
+ if (retframe_block() != 15)
+ abort ();
+ exit (0);
+
+ }
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20030828-1.c b/gcc/testsuite/gcc.c-torture/execute/20030828-1.c
new file mode 100644
index 00000000000..e8c1f0195df
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20030828-1.c
@@ -0,0 +1,18 @@
+const int *p;
+
+int bar (void)
+{
+ return *p + 1;
+}
+
+main ()
+{
+ /* Variable 'i' is never used but it's aliased to a global pointer. The
+ alias analyzer was not considering that 'i' may be used in the call to
+ bar(). */
+ const int i = 5;
+ p = &i;
+ if (bar() != 6)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20030828-2.c b/gcc/testsuite/gcc.c-torture/execute/20030828-2.c
new file mode 100644
index 00000000000..0c3a195e626
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20030828-2.c
@@ -0,0 +1,28 @@
+struct rtx_def
+{
+ int code;
+};
+
+main()
+{
+ int tmp[2];
+ struct rtx_def *r, s;
+ int *p, *q;
+
+ /* The alias analyzer was creating the same memory tag for r, p and q
+ because 'struct rtx_def *' is type-compatible with 'int *'. However,
+ the alias set of 'int[2]' is not the same as 'int *', so variable
+ 'tmp' was deemed not aliased with anything. */
+ r = &s;
+ r->code = 39;
+
+ /* If 'r' wasn't declared, then q and tmp would have had the same memory
+ tag. */
+ p = tmp;
+ q = p + 1;
+ *q = 0;
+ tmp[1] = 39;
+ if (*q != 39)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20030903-1.c b/gcc/testsuite/gcc.c-torture/execute/20030903-1.c
new file mode 100644
index 00000000000..95dad576f2d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20030903-1.c
@@ -0,0 +1,21 @@
+/* Test that we don't let stmt.c think that the enumeration's values are
+ the entire set of possibilities. Such an assumption is false for C,
+ but true for other languages. */
+
+enum X { X1 = 1, X2, X3, X4 };
+static volatile enum X test = 0;
+static void y(int);
+
+int main()
+{
+ switch (test)
+ {
+ case X1: y(1); break;
+ case X2: y(2); break;
+ case X3: y(3); break;
+ case X4: y(4); break;
+ }
+ return 0;
+}
+
+static void y(int x) { abort (); }
diff --git a/gcc/testsuite/gcc.c-torture/execute/20030909-1.c b/gcc/testsuite/gcc.c-torture/execute/20030909-1.c
new file mode 100644
index 00000000000..2f149857fc7
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20030909-1.c
@@ -0,0 +1,35 @@
+void abort ();
+void exit (int);
+
+void test(int x, int y)
+{
+ if (x == y)
+ abort ();
+}
+
+void foo(int x, int y)
+{
+ if (x == y)
+ goto a;
+ else
+ {
+a:;
+ if (x == y)
+ goto b;
+ else
+ {
+b:;
+ if (x != y)
+ test (x, y);
+ }
+ }
+}
+
+int main(void)
+{
+ foo (0, 0);
+
+ exit (0);
+}
+
+
diff --git a/gcc/testsuite/gcc.c-torture/execute/20030910-1.c b/gcc/testsuite/gcc.c-torture/execute/20030910-1.c
new file mode 100644
index 00000000000..6c849134a9b
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20030910-1.c
@@ -0,0 +1,13 @@
+/* The gimplifier was inserting unwanted temporaries for REALPART_EXPR
+ nodes. These need to be treated like a COMPONENT_REF so their address can
+ be taken. */
+
+int main()
+{
+ __complex double dc;
+ double *dp = &(__real dc);
+ *dp = 3.14;
+ if ((__real dc) != 3.14) abort();
+ exit (0);
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/execute/20030913-1.c b/gcc/testsuite/gcc.c-torture/execute/20030913-1.c
new file mode 100644
index 00000000000..5e33f50f560
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20030913-1.c
@@ -0,0 +1,26 @@
+/* Assignments via pointers pointing to global variables were being killed
+ by SSA-DCE. Test contributed by Paul Brook <paul@nowt.org> */
+
+int glob;
+
+void
+fn2(int ** q)
+{
+ *q = &glob;
+}
+
+void test()
+{
+ int *p;
+
+ fn2(&p);
+
+ *p=42;
+}
+
+int main()
+{
+ test();
+ if (glob != 42) abort();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20031010-1.c b/gcc/testsuite/gcc.c-torture/execute/20031010-1.c
new file mode 100644
index 00000000000..54457f964c3
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20031010-1.c
@@ -0,0 +1,34 @@
+/* A reminder to process ops in generate_expr_as_of_bb exactly once. */
+
+long __attribute__((noinline))
+foo (long ct, long cf, _Bool p1, _Bool p2, _Bool p3)
+{
+ long diff;
+
+ diff = ct - cf;
+
+ if (p1)
+ {
+ if (p2)
+ {
+ if (p3)
+ {
+ long tmp = ct;
+ ct = cf;
+ cf = tmp;
+ }
+ diff = ct - cf;
+ }
+
+ return diff;
+ }
+
+ abort ();
+}
+
+int main ()
+{
+ if (foo(2, 3, 1, 1, 1) == 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20031211-1.c b/gcc/testsuite/gcc.c-torture/execute/20031211-1.c
new file mode 100644
index 00000000000..2361509a096
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20031211-1.c
@@ -0,0 +1,13 @@
+struct a { unsigned int bitfield : 1; };
+
+unsigned int x;
+
+main()
+{
+ struct a a = {0};
+ x = 0xbeef;
+ a.bitfield |= x;
+ if (a.bitfield != 1)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20031211-2.c b/gcc/testsuite/gcc.c-torture/execute/20031211-2.c
new file mode 100644
index 00000000000..555b17d9ac6
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20031211-2.c
@@ -0,0 +1,19 @@
+struct a
+{
+ unsigned int bitfield : 3;
+};
+
+int main()
+{
+ struct a a;
+
+ a.bitfield = 131;
+ foo (a.bitfield);
+ exit (0);
+}
+
+foo(unsigned int z)
+{
+ if (z != 3)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20040319-1.c b/gcc/testsuite/gcc.c-torture/execute/20040319-1.c
new file mode 100644
index 00000000000..357932d9b24
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20040319-1.c
@@ -0,0 +1,17 @@
+int
+blah (int zzz)
+{
+ int foo;
+ if (zzz >= 0)
+ return 1;
+ foo = (zzz >= 0 ? (zzz) : -(zzz));
+ return foo;
+}
+
+main()
+{
+ if (blah (-1) != 1)
+ abort ();
+ else
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20040423-1.c b/gcc/testsuite/gcc.c-torture/execute/20040423-1.c
new file mode 100644
index 00000000000..ace797e79d3
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20040423-1.c
@@ -0,0 +1,30 @@
+int
+sub1 (int i, int j)
+{
+ typedef struct
+ {
+ int c[i+2];
+ }c;
+ int x[10], y[10];
+
+ if (j == 2)
+ {
+ memcpy (x, y, 10 * sizeof (int));
+ return sizeof (c);
+ }
+ else
+ return sizeof (c) * 3;
+}
+
+int
+main ()
+{
+ typedef struct
+ {
+ int c[22];
+ }c;
+ if (sub1 (20, 3) != sizeof (c)*3)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/930529-1.x b/gcc/testsuite/gcc.c-torture/execute/930529-1.x
index a44f482c22f..fb86979f7c1 100644
--- a/gcc/testsuite/gcc.c-torture/execute/930529-1.x
+++ b/gcc/testsuite/gcc.c-torture/execute/930529-1.x
@@ -4,15 +4,20 @@
# The problem is that the multiplication was unsigned SImode, and the
# induction variable is DImode, and we lose the truncation that
# should have happened.
+#
+# On tree-ssa branch, the loop problem is still extant, but the
+# gimple-level optimization makes it easy for the tree-rtl expanders
+# to see that the comparisons are always true, and so the loop code
+# is never exercized.
-set torture_eval_before_execute {
-
- set compiler_conditional_xfail_data {
- "division by a constant conflicts with strength reduction" \
- "alpha*-*-*" \
- { "-O3" } \
- { "" }
- }
-}
+# set torture_eval_before_execute {
+#
+# set compiler_conditional_xfail_data {
+# "division by a constant conflicts with strength reduction" \
+# "alpha*-*-*" \
+# { "-O3" } \
+# { "" }
+# }
+# }
return 0
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtin-constant.x b/gcc/testsuite/gcc.c-torture/execute/builtin-constant.x
deleted file mode 100644
index 7a2e3146675..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtin-constant.x
+++ /dev/null
@@ -1,11 +0,0 @@
-set torture_eval_before_execute {
- global compiler_conditional_xfail_data
- set compiler_conditional_xfail_data {
- "This test fails on all targets when optimizing." \
- { "*-*-*" } \
- { "-O1" } \
- { "" }
- }
-}
-
-return 0