diff options
author | Jeff Law <law@gcc.gnu.org> | 2004-12-14 13:29:12 -0700 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2004-12-14 13:29:12 -0700 |
commit | c31d515429183e7d06664b843e65b4b378c5dd70 (patch) | |
tree | 4d73ec5264b4bf8b187fb03092fb75a5c9210b7a /gcc | |
parent | da708cc6f530edb5e6e1369c9e38639ce7503b21 (diff) | |
download | gcc-c31d515429183e7d06664b843e65b4b378c5dd70.zip gcc-c31d515429183e7d06664b843e65b4b378c5dd70.tar.gz gcc-c31d515429183e7d06664b843e65b4b378c5dd70.tar.bz2 |
20041214-1.c: New test.
* gcc.c-torture/execute/20041214-1.c: New test.
Actually commit 20041213-2.c (pr18694).
From-SVN: r92160
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/20041213-2.c | 32 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/20041214-1.c | 68 |
3 files changed, 105 insertions, 1 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 72443ba..f58377f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2004-12-14 Andrew Pinski <pinskia@physics.uc.edu> + * gcc.c-torture/20041214-1.c: New test. + +2004-12-14 Andrew Pinski <pinskia@physics.uc.edu> + PR c++/18965 * g++.dg/init/array17.C: New test. @@ -31,7 +35,7 @@ 2004-12-13 Kazu Hirata <kazu@cs.umass.edu> - * gcc.c-torture/execute/20041213-1.c: New test. + * gcc.c-torture/execute/20041213-2.c: New test. 2004-12-13 Richard Henderson <rth@redhat.com> diff --git a/gcc/testsuite/gcc.c-torture/execute/20041213-2.c b/gcc/testsuite/gcc.c-torture/execute/20041213-2.c new file mode 100644 index 0000000..212d638 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20041213-2.c @@ -0,0 +1,32 @@ +/* PR tree-optimization/18694 + + The dominator optimization didn't take the PHI evaluation order + into account when threading an edge. */ + +extern void abort (void) __attribute__((noreturn)); +extern void exit (int) __attribute__((noreturn)); + +void __attribute__((noinline)) +foo (int i) +{ + int next_n = 1; + int j = 0; + + for (; i != 0; i--) + { + int n; + + for (n = next_n; j < n; j++) + next_n++; + + if (j != n) + abort (); + } +} + +int +main (void) +{ + foo (2); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20041214-1.c b/gcc/testsuite/gcc.c-torture/execute/20041214-1.c new file mode 100644 index 0000000..89df2be --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20041214-1.c @@ -0,0 +1,68 @@ +typedef long unsigned int size_t; +extern void abort (void); +extern char *strcpy (char *, const char *); +extern int strcmp (const char *, const char *); +typedef __builtin_va_list va_list; +static const char null[] = "(null)"; +int g (char *s, const char *format, va_list ap) +{ + const char *f; + const char *string; + char spec; + static const void *step0_jumps[] = { + &&do_precision, + &&do_form_integer, + &&do_form_string, + }; + f = format; + if (*f == '\0') + goto all_done; + do + { + spec = (*++f); + goto *(step0_jumps[2]); + + /* begin switch table. */ + do_precision: + ++f; + __builtin_va_arg (ap, int); + spec = *f; + goto *(step0_jumps[2]); + + do_form_integer: + __builtin_va_arg (ap, unsigned long int); + goto end; + + do_form_string: + string = __builtin_va_arg (ap, const char *); + strcpy (s, string); + + /* End of switch table. */ + end: + ++f; + } + while (*f != '\0'); + +all_done: + return 0; +} + +void +f (char *s, const char *f, ...) +{ + va_list ap; + __builtin_va_start (ap, f); + g (s, f, ap); + __builtin_va_end (ap); +} + +int +main (void) +{ + char buf[10]; + f (buf, "%s", "asdf", 0); + if (strcmp (buf, "asdf")) + abort (); + return 0; +} + |