diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg')
40 files changed, 582 insertions, 66 deletions
diff --git a/gcc/testsuite/gcc.dg/20020430-1.c b/gcc/testsuite/gcc.dg/20020430-1.c index 981c4f36dab..5df76801bf4 100644 --- a/gcc/testsuite/gcc.dg/20020430-1.c +++ b/gcc/testsuite/gcc.dg/20020430-1.c @@ -4,8 +4,8 @@ until the last moment. After which we did not delete dead code, which left a reference to the deleted ADDR_VEC. */ -/* { dg-do compile } -/* { do-options "-O2 -frename-registers -fpic" } */ +/* { dg-do compile } */ +/* { dg-options "-O2 -frename-registers -fpic" } */ typedef unsigned long XID; typedef XID Window; diff --git a/gcc/testsuite/gcc.dg/20020503-1.c b/gcc/testsuite/gcc.dg/20020503-1.c index 5f9168eb67d..6e669031cd6 100644 --- a/gcc/testsuite/gcc.dg/20020503-1.c +++ b/gcc/testsuite/gcc.dg/20020503-1.c @@ -4,8 +4,8 @@ for leaf functions, the function was still leaf, but LEAF_REG_REMAP returned -1 for some registers (like %o0). */ /* { dg-do compile } */ -/* { do-options "-O2 -g" } */ -/* { do-options "-O2 -g -mflat" { target sparc*-*-* } } */ +/* { dg-options "-O2 -g" } */ +/* { dg-options "-O2 -g -mflat" { target sparc*-*-* } } */ void foo (char *a, char *b, char *c, char *d) { diff --git a/gcc/testsuite/gcc.dg/20030120-1.c b/gcc/testsuite/gcc.dg/20030120-1.c new file mode 100644 index 00000000000..05689ad0961 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20030120-1.c @@ -0,0 +1,10 @@ +/* PR 7154 */ +/* { dg-do compile } */ +/* { dg-options "-O -fpic" } */ +/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* mmix-*-* } 0 } */ + +const int x[1]={ 1 }; +void foo(int i, int *p) +{ + asm volatile("" : "+r"(i) : "m" (x[0]), "r"(p)); +} diff --git a/gcc/testsuite/gcc.dg/20030123-1.c b/gcc/testsuite/gcc.dg/20030123-1.c new file mode 100644 index 00000000000..1f5858808c4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20030123-1.c @@ -0,0 +1,17 @@ +/* This used to ICE due to a reload bug on s390*. */ + +/* { dg-do compile { target s390*-*-* } } */ +/* { dg-options "-O2" } */ + +void func (char *p); + +void test (void) +{ + char *p = alloca (4096); + long idx; + + asm ("" : "=r" (idx) : : "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"); + + func (p + idx + 1); +} + diff --git a/gcc/testsuite/gcc.dg/20030129-1.c b/gcc/testsuite/gcc.dg/20030129-1.c new file mode 100644 index 00000000000..0b745a901b1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20030129-1.c @@ -0,0 +1,37 @@ +/* This used to ICE due to a reload bug on s390*. */ + +/* { dg-do compile { target s390*-*-* } } */ +/* { dg-options "-O2" } */ + +int f (unsigned int); +void g (void *); + +void test (void *p, void *dummy) +{ + unsigned int flags = 0; + + if (dummy) + g (dummy); + + if (p) + flags |= 0x80000000; + + asm volatile ("" : : : "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"); + + if (dummy) + g (dummy); + + if (p) + { + flags |= 0x20000000|0x80000000; + + if (!f (0)) + flags &= ~0x80000000; + } + + f (flags); + + if (dummy) + g (dummy); +} + diff --git a/gcc/testsuite/gcc.dg/20030213-1.c b/gcc/testsuite/gcc.dg/20030213-1.c new file mode 100644 index 00000000000..c9fe3a40eaf --- /dev/null +++ b/gcc/testsuite/gcc.dg/20030213-1.c @@ -0,0 +1,37 @@ +/* Testcase for http://gcc.gnu.org/ml/gcc-patches/2003-02/msg01017.html */ +/* { dg-do link } */ +/* { dg-options "-O -fpic" } */ +/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* cris-*-aout* mmix-*-* } 0 } */ + +int *g; + +int main (void) +{ + switch (*g) + { + case 0: + { + switch (*g) + { + case 0: *g = 1; break; + case 1: + case 2: *g = 1; break; + case 3: + case 4: *g = 1; break; + } + break; + } + case 1: + { + switch (*g) + { + case 0: *g = 1; break; + case 1: + case 2: *g = 1; break; + case 3: + case 4: *g = 1; break; + } + } + } + return 0; +} diff --git a/gcc/testsuite/gcc.dg/20030225-1.c b/gcc/testsuite/gcc.dg/20030225-1.c new file mode 100644 index 00000000000..7c30898b4ea --- /dev/null +++ b/gcc/testsuite/gcc.dg/20030225-1.c @@ -0,0 +1,103 @@ +/* PR target/9732 + This testcase segfaulted on PPC because PIC_OFFSET_TABLE_REGNUM was no + fixed register. + Distilled from the xvid sources by Guillaume Morin <guillaume@morinfr.org> + and Benjamin Herrenschmidt <benh@kernel.crashing.org>. */ +/* { dg-do run } */ +/* { dg-options "-O2 -fPIC" } */ +/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* mmix-*-* } 0 } */ + + +extern void exit (int); + +#define W1 2841 /* 2048*sqrt(2)*cos(1*pi/16) */ +#define W2 2676 /* 2048*sqrt(2)*cos(2*pi/16) */ +#define W3 2408 /* 2048*sqrt(2)*cos(3*pi/16) */ +#define W5 1609 /* 2048*sqrt(2)*cos(5*pi/16) */ +#define W6 1108 /* 2048*sqrt(2)*cos(6*pi/16) */ +#define W7 565 /* 2048*sqrt(2)*cos(7*pi/16) */ + + +/* private data */ +static short iclip[1024]; /* clipping table */ +static short *iclp; + +void +idct_int32(short *const block) +{ + static short *blk; + static long i; + static long X0, X1, X2, X3, X4, X5, X6, X7, X8; + + for (i = 0; i < 8; i++) /* idct columns */ + { + blk = block + i; + /* shortcut */ + if (! ((X1 = (blk[8 * 4] << 8)) | (X2 = blk[8 * 6]) + | (X3 = blk[8 * 2]) | (X4 = blk[8 * 1]) | (X5 = blk[8 * 7]) + | (X6 = blk[8 * 5]) | (X7 = blk[8 * 3]))) + { + blk[8 * 0] = blk[8 * 1] = blk[8 * 2] = + blk[8 * 3] = blk[8 * 4] = + blk[8 * 5] = blk[8 * 6] = blk[8 * 7] = + iclp[(blk[8 * 0] + 32) >> 6]; + continue; + } + X0 = (blk[8 * 0] << 8) + 8192; + + /* first stage */ + X8 = W7 * (X4 + X5) + 4; + X4 = (X8 + (W1 - W7) * X4) >> 3; + X5 = (X8 - (W1 + W7) * X5) >> 3; + X8 = W3 * (X6 + X7) + 4; + X6 = (X8 - (W3 - W5) * X6) >> 3; + X7 = (X8 - (W3 + W5) * X7) >> 3; + + /* second stage */ + X8 = X0 + X1; + X0 -= X1; + X1 = W6 * (X3 + X2) + 4; + X2 = (X1 - (W2 + W6) * X2) >> 3; + X3 = (X1 + (W2 - W6) * X3) >> 3; + X1 = X4 + X6; + X4 -= X6; + X6 = X5 + X7; + X5 -= X7; + + /* third stage */ + X7 = X8 + X3; + X8 -= X3; + X3 = X0 + X2; + X0 -= X2; + X2 = (181 * (X4 + X5) + 128) >> 8; + X4 = (181 * (X4 - X5) + 128) >> 8; + + /* fourth stage */ + blk[8 * 0] = iclp[(X7 + X1) >> 14]; + blk[8 * 1] = iclp[(X3 + X2) >> 14]; + blk[8 * 2] = iclp[(X0 + X4) >> 14]; + blk[8 * 3] = iclp[(X8 + X6) >> 14]; + blk[8 * 4] = iclp[(X8 - X6) >> 14]; + blk[8 * 5] = iclp[(X0 - X4) >> 14]; + blk[8 * 6] = iclp[(X3 - X2) >> 14]; + blk[8 * 7] = iclp[(X7 - X1) >> 14]; + } +} /* end function idct_int32(block) */ + + +int main(void) { + int i; + unsigned short tab[64]; + + for (i = 0 ; i < 64 ; ++i) + { + tab[i] = (1+(int) (65535)*8000/(2147483647+1.0)); + } + + iclp = iclip + 512; + for (i = -512; i < 512; i++) + iclp[i] = (i < -256) ? -256 : ((i > 255) ? 255 : i); + + idct_int32((short *) tab); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/asmreg-1.c b/gcc/testsuite/gcc.dg/asmreg-1.c new file mode 100644 index 00000000000..a779766d4a6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/asmreg-1.c @@ -0,0 +1,73 @@ +/* { dg-do compile { target cris-*-* } } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler "\\\.ifnc \\\$r9-\\\$r10-\\\$r11-\\\$r12" } } */ + +/* Sanity check for asm register operands in syscall failed for + cris-axis-linux-gnu due to regmove bug. + Hans-Peter Nilsson <hp@axis.com>. */ + +extern void lseek64 (int, long long, int); +extern int *__errno_location (void); +struct dirent64 +{ + long long d_off; + unsigned short int d_reclen; + char d_name[256]; +}; +struct kernel_dirent64 +{ + long long d_off; + unsigned short d_reclen; + char d_name[256]; +}; + +static inline int __attribute__ ((__always_inline__)) +__syscall_getdents64 (int fd, unsigned char * dirp, unsigned count) +{ + register unsigned long __sys_res asm ("r10"); + register unsigned long __r10 __asm__ ("r10") = (unsigned long) fd; + register unsigned long __r11 __asm__ ("r11") = (unsigned long) dirp; + register unsigned long __r12 __asm__ ("r12") = (unsigned long) count; + register unsigned long __callno asm ("r9") = (220); + asm volatile (".ifnc %1-%0-%3-%4,$r9-$r10-$r11-$r12\n\t" + ".err\n\t" + ".endif\n\t" + "break 13" + : "=r" (__sys_res) + : "r" (__callno), "0" (__r10), "r" (__r11), "r" (__r12) + : "memory"); + if (__sys_res >= (unsigned long) -4096) + { + (*__errno_location ()) = - __sys_res; + __sys_res = -1; + } + return __sys_res; +} + +int +__getdents64 (int fd, char *buf, unsigned nbytes) +{ + struct dirent64 *dp; + long long last_offset = -1; + int retval; + struct kernel_dirent64 *skdp, *kdp; + dp = (struct dirent64 *) buf; + skdp = kdp = __builtin_alloca (nbytes); + retval = __syscall_getdents64(fd, (char *)kdp, nbytes); + if (retval == -1) + return -1; + while ((char *) kdp < (char *) skdp + retval) + { + if ((char *) dp > buf + nbytes) + { + lseek64(fd, last_offset, 0); + break; + } + last_offset = kdp->d_off; + __builtin_memcpy (dp->d_name, kdp->d_name, kdp->d_reclen - 10); + dp = (struct dirent64 *) ((char *) dp + sizeof (*dp)); + kdp = (struct kernel_dirent64 *) (((char *) kdp) + kdp->d_reclen); + } + + return (char *) dp - buf; +} diff --git a/gcc/testsuite/gcc.dg/attr-invalid.c b/gcc/testsuite/gcc.dg/attr-invalid.c index a999c267c3a..9cb64541548 100644 --- a/gcc/testsuite/gcc.dg/attr-invalid.c +++ b/gcc/testsuite/gcc.dg/attr-invalid.c @@ -43,7 +43,7 @@ struct ATSYM(struct) { char dummy ATTR; /* { dg-warning "attribute ignored" "" } */ } ATTR; /* { dg-warning "does not apply to types" "" } */ -int ATSYM(var) ATTR; /* { dg-warning "attribute ignored" "" } */ +int ATSYM(var) ATTR; int ATSYM(fn_knrarg) (arg) int arg ATTR; /* { dg-warning "attribute ignored" "" } */ @@ -52,7 +52,7 @@ int ATSYM(fn_knrarg) (arg) int ATSYM(fn_isoarg) (int arg ATTR) { return 0; } /* { dg-warning "attribute ignored" "" } */ int ATSYM(fn_vars) (void) { - static int svar ATTR; /* { dg-warning "attribute ignored" "" } */ + static int svar ATTR; auto int lvar ATTR; /* { dg-warning "attribute ignored" "" } */ return 0; } diff --git a/gcc/testsuite/gcc.dg/c90-restrict-1.c b/gcc/testsuite/gcc.dg/c90-restrict-1.c index 17af58b4b58..60d91b830a1 100644 --- a/gcc/testsuite/gcc.dg/c90-restrict-1.c +++ b/gcc/testsuite/gcc.dg/c90-restrict-1.c @@ -4,4 +4,4 @@ /* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ char *restrict foo; /* { dg-bogus "warning" "warning in place of error" } */ -/* { dg-error "parse error|no type" "restrict not in C90" { target *-*-* } 6 } */ +/* { dg-error "(parse|syntax) error|no type" "restrict not in C90" { target *-*-* } 6 } */ diff --git a/gcc/testsuite/gcc.dg/c99-func-2.c b/gcc/testsuite/gcc.dg/c99-func-2.c index d6a6f243f91..9dc8b58c673 100644 --- a/gcc/testsuite/gcc.dg/c99-func-2.c +++ b/gcc/testsuite/gcc.dg/c99-func-2.c @@ -6,5 +6,5 @@ void foo (void) { - __func__ "foo"; /* { dg-error "parse error" "before string constant" } */ + __func__ "foo"; /* { dg-error "(parse|syntax) error" "before string constant" } */ } diff --git a/gcc/testsuite/gcc.dg/cpp/19990413-1.c b/gcc/testsuite/gcc.dg/cpp/19990413-1.c index 9abddb942fd..22fc5db2218 100644 --- a/gcc/testsuite/gcc.dg/cpp/19990413-1.c +++ b/gcc/testsuite/gcc.dg/cpp/19990413-1.c @@ -9,5 +9,5 @@ func(void) { FOO(i = 4) - else; /* { dg-error "parse error" "error on this line" { target *-*-* } { 12 } } */ + else; /* { dg-error "(parse|syntax) error" "error on this line" { target *-*-* } { 12 } } */ } diff --git a/gcc/testsuite/gcc.dg/cpp/Wunused.c b/gcc/testsuite/gcc.dg/cpp/Wunused.c index aa099ee79c8..ac363ad04b8 100644 --- a/gcc/testsuite/gcc.dg/cpp/Wunused.c +++ b/gcc/testsuite/gcc.dg/cpp/Wunused.c @@ -1,7 +1,8 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. */ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. */ /* { dg-do preprocess } */ -/* { dg-options -Wunused-macros } */ +/* Duplicate command line options should not warn. */ +/* { dg-options "-Wunused-macros -Dfoo -Dfoo" } */ /* Test everything related to -Wunused-macros. diff --git a/gcc/testsuite/gcc.dg/cpp/digraph2.c b/gcc/testsuite/gcc.dg/cpp/digraph2.c index e67ec53878b..cac4e256b0a 100644 --- a/gcc/testsuite/gcc.dg/cpp/digraph2.c +++ b/gcc/testsuite/gcc.dg/cpp/digraph2.c @@ -9,7 +9,7 @@ int main (int argc, char *argv[]) { return 0; -%> /* { dg-error "parse error" } */ +%> /* { dg-error "(parse|syntax) error" } */ /* Place this after main () so we get to test both the compiler above and the preprocessor below. */ diff --git a/gcc/testsuite/gcc.dg/cpp/direct2.c b/gcc/testsuite/gcc.dg/cpp/direct2.c index d6dc1088c37..52d1e31f45f 100644 --- a/gcc/testsuite/gcc.dg/cpp/direct2.c +++ b/gcc/testsuite/gcc.dg/cpp/direct2.c @@ -33,5 +33,5 @@ void f () #define slashstar /##* #define starslash *##/ -slashstar starslash /* { dg-error "parse error" "not a comment" } */ +slashstar starslash /* { dg-error "(parse|syntax) error" "not a comment" } */ /* { dg-warning "does not give" "paste warning(s)" { target *-*-* } 36 } */ diff --git a/gcc/testsuite/gcc.dg/cpp/inc/foo.h b/gcc/testsuite/gcc.dg/cpp/inc/foo.h new file mode 100644 index 00000000000..ec770476c21 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/inc/foo.h @@ -0,0 +1 @@ +extern int a; diff --git a/gcc/testsuite/gcc.dg/cpp/include3.c b/gcc/testsuite/gcc.dg/cpp/include3.c new file mode 100644 index 00000000000..8bea2b78ee8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/include3.c @@ -0,0 +1,7 @@ +/* Unpatched, this file would include "inc/ foo.h" (note the space) */ + +#define PREINC_XSTR(str) #str +#define PREINC_STR(str) PREINC_XSTR(str) +#define COMP_INC(comp,file) PREINC_STR(comp/file) + +#include COMP_INC(inc, foo.h) diff --git a/gcc/testsuite/gcc.dg/cpp/paste4.c b/gcc/testsuite/gcc.dg/cpp/paste4.c index 2215b34a7ad..4e575c2954e 100644 --- a/gcc/testsuite/gcc.dg/cpp/paste4.c +++ b/gcc/testsuite/gcc.dg/cpp/paste4.c @@ -11,6 +11,6 @@ int main () { - double d = glue (1.0e, +1); /* { dg-error "exponent|parse error" } */ + double d = glue (1.0e, +1); /* { dg-error "exponent|(parse|syntax) error" } */ return 0; } diff --git a/gcc/testsuite/gcc.dg/darwin-ld-5.c b/gcc/testsuite/gcc.dg/darwin-ld-5.c index e32f1d9d3ca..0540f92bcbb 100644 --- a/gcc/testsuite/gcc.dg/darwin-ld-5.c +++ b/gcc/testsuite/gcc.dg/darwin-ld-5.c @@ -1,7 +1,7 @@ -/* Test Darwin linker option -bundle_loader. */ +/* Test Darwin linker option -dynamic. */ /* Developed by Devang Patel <dpatel@apple.com>. */ -/* { dg-options "-bundle -bundle_loader foo" } */ +/* { dg-options "-dynamic" } */ /* { dg-do link { target *-*-darwin* } } */ int main() diff --git a/gcc/testsuite/gcc.dg/decl-2.c b/gcc/testsuite/gcc.dg/decl-2.c new file mode 100644 index 00000000000..44fbc733027 --- /dev/null +++ b/gcc/testsuite/gcc.dg/decl-2.c @@ -0,0 +1,10 @@ +/* PR c/7411 */ +/* Contributed by Christian Ehrhardt */ +/* { dg-do compile } */ + +void foo(void) +{ + char c; /* { dg-error "previous declaration" } */ + int i; + int c = i; /* { dg-error "conflicting types" } */ +} diff --git a/gcc/testsuite/gcc.dg/format/attr-5.c b/gcc/testsuite/gcc.dg/format/attr-5.c index a4e96344b61..36b11989687 100644 --- a/gcc/testsuite/gcc.dg/format/attr-5.c +++ b/gcc/testsuite/gcc.dg/format/attr-5.c @@ -11,7 +11,7 @@ static int scanf(const char *restrict, ...); /* This sscanf declaration doesn't have variable arguments, so isn't compatible with a format attribute. */ -extern int sscanf(const char *restrict, const char *restrict, int *); +extern int sscanf(const char *restrict, const char *restrict, int *); /* { dg-warning "conflict" "conflict" } */ void foo (const char *s, int *p) diff --git a/gcc/testsuite/gcc.dg/h8300-stack-1.c b/gcc/testsuite/gcc.dg/h8300-stack-1.c new file mode 100644 index 00000000000..b63bde29c9c --- /dev/null +++ b/gcc/testsuite/gcc.dg/h8300-stack-1.c @@ -0,0 +1,14 @@ +/* Make sure that the H8 backend does not generate a non-atomic stack + adjustment. */ +/* { dg-do compile { target h8300-*-* } } */ +/* { dg-options "" } */ + +void foo (short, short, short, short, short, short); + +void +bar () +{ + foo (0, 0, 0, 0, 0, 0); +} + +/* { dg-final { scan-assembler-not "addx" } } */ diff --git a/gcc/testsuite/gcc.dg/i386-loop-1.c b/gcc/testsuite/gcc.dg/i386-loop-1.c new file mode 100644 index 00000000000..e8bdaf5bcd3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/i386-loop-1.c @@ -0,0 +1,105 @@ +/* PR optimization/9888 */ +/* { dg-do run { target i?86-*-* } } */ +/* { dg-options "-mcpu=k6 -O3" } */ + +/* Verify that GCC doesn't emit out of range 'loop' instructions. */ + +extern void abort (void); +extern void exit (int); + + +f1 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (--a == -1) + return i; + } + return -1; +} + +f2 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (--a != -1) + return i; + } + return -1; +} + +f3 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (--a == 0) + return i; + } + return -1; +} + +f4 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (--a != 0) + return i; + } + return -1; +} + +f5 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (++a == 0) + return i; + } + return -1; +} + +f6 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (++a != 0) + return i; + } + return -1; +} + + +int main() +{ + if (f1 (5L) != 5) + abort (); + if (f2 (1L) != 0) + abort (); + if (f2 (0L) != 1) + abort (); + if (f3 (5L) != 4) + abort (); + if (f4 (1L) != 1) + abort (); + if (f4 (0L) != 0) + abort (); + if (f5 (-5L) != 4) + abort (); + if (f6 (-1L) != 1) + abort (); + if (f6 (0L) != 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/i386-mmx-3.c b/gcc/testsuite/gcc.dg/i386-mmx-3.c new file mode 100644 index 00000000000..b4bd326e2c4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/i386-mmx-3.c @@ -0,0 +1,17 @@ +/* PR target/8870 */ +/* Originator: otaylor@redhat.com */ +/* { dg-do compile { target i?86-*-* x86_64-*-*} } */ +/* { dg-options "-O1 -mmmx -march=athlon" } */ + +typedef int v4hi __attribute__ ((mode (V4HI))); + +static inline v4hi cvtsi_v4hi (int i) +{ + long long tmp = i; + return (v4hi) tmp; +} + +v4hi bar (unsigned short a) +{ + return cvtsi_v4hi (a); +} diff --git a/gcc/testsuite/gcc.dg/i386-ssetype-1.c b/gcc/testsuite/gcc.dg/i386-ssetype-1.c index 6953b751b43..ebf089d114a 100644 --- a/gcc/testsuite/gcc.dg/i386-ssetype-1.c +++ b/gcc/testsuite/gcc.dg/i386-ssetype-1.c @@ -1,32 +1,35 @@ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ /* { dg-options "-O2 -msse2 -march=athlon" } */ -/* { dg-final { scan-assembler "andpd.*\[bs\]p" } } */ -/* { dg-final { scan-assembler "andnpd.*\[bs\]p" } } */ -/* { dg-final { scan-assembler "xorpd.*\[bs\]p" } } */ -/* { dg-final { scan-assembler "orpd.*\[bs\]p" } } */ +/* { dg-final { scan-assembler "andpd.*magic" } } */ +/* { dg-final { scan-assembler "andnpd.*magic" } } */ +/* { dg-final { scan-assembler "xorpd.*magic" } } */ +/* { dg-final { scan-assembler "orpd.*magic" } } */ /* { dg-final { scan-assembler-not "movdqa" } } */ -/* { dg-final { scan-assembler "movapd.*\[bs\]p" } } */ +/* { dg-final { scan-assembler "movapd.*magic" } } */ /* Verify that we generate proper instruction with memory operand. */ #include <xmmintrin.h> + +__m128d magic_a, magic_b; + __m128d -t1(__m128d a, __m128d b) +t1(void) { -return _mm_and_pd (a,b); +return _mm_and_pd (magic_a,magic_b); } __m128d -t2(__m128d a, __m128d b) +t2(void) { -return _mm_andnot_pd (a,b); +return _mm_andnot_pd (magic_a,magic_b); } __m128d -t3(__m128d a, __m128d b) +t3(void) { -return _mm_or_pd (a,b); +return _mm_or_pd (magic_a,magic_b); } __m128d -t4(__m128d a, __m128d b) +t4(void) { -return _mm_xor_pd (a,b); +return _mm_xor_pd (magic_a,magic_b); } diff --git a/gcc/testsuite/gcc.dg/i386-ssetype-2.c b/gcc/testsuite/gcc.dg/i386-ssetype-2.c index b66aa0cfd98..93551e601aa 100644 --- a/gcc/testsuite/gcc.dg/i386-ssetype-2.c +++ b/gcc/testsuite/gcc.dg/i386-ssetype-2.c @@ -5,7 +5,6 @@ /* { dg-final { scan-assembler "xorpd" } } */ /* { dg-final { scan-assembler "orpd" } } */ /* { dg-final { scan-assembler-not "movdqa" } } */ -/* { dg-final { scan-assembler "movapd" } } */ /* Verify that we generate proper instruction without memory operand. */ diff --git a/gcc/testsuite/gcc.dg/i386-ssetype-3.c b/gcc/testsuite/gcc.dg/i386-ssetype-3.c index 4988c0c5abd..c36baccf0e4 100644 --- a/gcc/testsuite/gcc.dg/i386-ssetype-3.c +++ b/gcc/testsuite/gcc.dg/i386-ssetype-3.c @@ -1,32 +1,34 @@ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ /* { dg-options "-O2 -msse2 -march=athlon" } */ -/* { dg-final { scan-assembler "andps.*\[bs\]p" } } */ -/* { dg-final { scan-assembler "andnps.*\[bs\]p" } } */ -/* { dg-final { scan-assembler "xorps.*\[bs\]p" } } */ -/* { dg-final { scan-assembler "orps.*\[bs\]p" } } */ +/* { dg-final { scan-assembler "andps.*magic" } } */ +/* { dg-final { scan-assembler "andnps.*magic" } } */ +/* { dg-final { scan-assembler "xorps.*magic" } } */ +/* { dg-final { scan-assembler "orps.*magic" } } */ /* { dg-final { scan-assembler-not "movdqa" } } */ -/* { dg-final { scan-assembler "movaps.*\[bs\]p" } } */ +/* { dg-final { scan-assembler "movaps.*magic" } } */ /* Verify that we generate proper instruction with memory operand. */ #include <xmmintrin.h> + +__m128 magic_a, magic_b; __m128 -t1(__m128 a, __m128 b) +t1(void) { -return _mm_and_ps (a,b); +return _mm_and_ps (magic_a,magic_b); } __m128 -t2(__m128 a, __m128 b) +t2(void) { -return _mm_andnot_ps (a,b); +return _mm_andnot_ps (magic_a,magic_b); } __m128 -t3(__m128 a, __m128 b) +t3(void) { -return _mm_or_ps (a,b); +return _mm_or_ps (magic_a,magic_b); } __m128 -t4(__m128 a, __m128 b) +t4(void) { -return _mm_xor_ps (a,b); +return _mm_xor_ps (magic_a,magic_b); } diff --git a/gcc/testsuite/gcc.dg/i386-ssetype-5.c b/gcc/testsuite/gcc.dg/i386-ssetype-5.c index 97cc22fd3a8..31e4ae3918f 100644 --- a/gcc/testsuite/gcc.dg/i386-ssetype-5.c +++ b/gcc/testsuite/gcc.dg/i386-ssetype-5.c @@ -1,33 +1,34 @@ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ /* { dg-options "-O2 -msse2 -march=athlon" } */ -/* { dg-final { scan-assembler "pand.*\[bs\]p" } } */ -/* { dg-final { scan-assembler "pandn.*\[bs\]p" } } */ -/* { dg-final { scan-assembler "pxor.*\[bs\]p" } } */ -/* { dg-final { scan-assembler "por.*\[bs\]p" } } */ +/* { dg-final { scan-assembler "pand.*magic" } } */ +/* { dg-final { scan-assembler "pandn.*magic" } } */ +/* { dg-final { scan-assembler "pxor.*magic" } } */ +/* { dg-final { scan-assembler "por.*magic" } } */ /* { dg-final { scan-assembler "movdqa" } } */ -/* { dg-final { scan-assembler-not "movaps.*\[bs\]p" } } */ +/* { dg-final { scan-assembler-not "movaps.*magic" } } */ /* Verify that we generate proper instruction with memory operand. */ #include <xmmintrin.h> +__m128i magic_a, magic_b; __m128i -t1(__m128i a, __m128i b) +t1(void) { -return _mm_and_si128 (a,b); +return _mm_and_si128 (magic_a,magic_b); } __m128i -t2(__m128i a, __m128i b) +t2(void) { -return _mm_andnot_si128 (a,b); +return _mm_andnot_si128 (magic_a,magic_b); } __m128i -t3(__m128i a, __m128i b) +t3(void) { -return _mm_or_si128 (a,b); +return _mm_or_si128 (magic_a,magic_b); } __m128i -t4(__m128i a, __m128i b) +t4(void) { -return _mm_xor_si128 (a,b); +return _mm_xor_si128 (magic_a,magic_b); } diff --git a/gcc/testsuite/gcc.dg/noncompile/920721-2.c b/gcc/testsuite/gcc.dg/noncompile/920721-2.c index 9ec223c3af4..c698b085ea9 100644 --- a/gcc/testsuite/gcc.dg/noncompile/920721-2.c +++ b/gcc/testsuite/gcc.dg/noncompile/920721-2.c @@ -2,5 +2,5 @@ void f(int n) { int s; for(s=0;s<n;s++) - s==5?1 n=1; /* { dg-error "parse error" } */ + s==5?1 n=1; /* { dg-error "(parse|syntax) error" } */ } diff --git a/gcc/testsuite/gcc.dg/noncompile/930622-2.c b/gcc/testsuite/gcc.dg/noncompile/930622-2.c index a1450afbf1f..3409118f0e2 100644 --- a/gcc/testsuite/gcc.dg/noncompile/930622-2.c +++ b/gcc/testsuite/gcc.dg/noncompile/930622-2.c @@ -1,6 +1,6 @@ f () { int i; - for (i--) /* { dg-error "parse" } */ + for (i--) /* { dg-error "parse|syntax" } */ ; } diff --git a/gcc/testsuite/gcc.dg/noncompile/940112-1.c b/gcc/testsuite/gcc.dg/noncompile/940112-1.c index 24780df554e..953840f6dc8 100644 --- a/gcc/testsuite/gcc.dg/noncompile/940112-1.c +++ b/gcc/testsuite/gcc.dg/noncompile/940112-1.c @@ -4,4 +4,4 @@ f (int x) double e = 1; e = 1; return (e) -} /* { dg-error "parse error" } */ +} /* { dg-error "(parse|syntax) error" } */ diff --git a/gcc/testsuite/gcc.dg/noncompile/950921-1.c b/gcc/testsuite/gcc.dg/noncompile/950921-1.c index ed44338fcd1..0f6378524ec 100644 --- a/gcc/testsuite/gcc.dg/noncompile/950921-1.c +++ b/gcc/testsuite/gcc.dg/noncompile/950921-1.c @@ -1,10 +1,10 @@ typedef enum { - a = (X) 0, /* { dg-error "undeclared|not integer|parse error" } */ + a = (X) 0, /* { dg-error "undeclared|not integer|(parse|syntax) error" } */ b } c; typedef enum { - d = (X) 0 /* { dg-error "undeclared|not integer|parse error" } */ + d = (X) 0 /* { dg-error "undeclared|not integer|(parse|syntax) error" } */ } e; diff --git a/gcc/testsuite/gcc.dg/noncompile/951123-1.c b/gcc/testsuite/gcc.dg/noncompile/951123-1.c index 9a5a3215ed6..787cf1e94fa 100644 --- a/gcc/testsuite/gcc.dg/noncompile/951123-1.c +++ b/gcc/testsuite/gcc.dg/noncompile/951123-1.c @@ -1,2 +1,2 @@ struct S { int a; int b[2]; }; -struct S x = { 0, [0]; }; /* { dg-error "array index|near|parse" } */ +struct S x = { 0, [0]; }; /* { dg-error "array index|near|(parse|syntax)" } */ diff --git a/gcc/testsuite/gcc.dg/noncompile/971104-1.c b/gcc/testsuite/gcc.dg/noncompile/971104-1.c index a20b17add58..ed7cb523c3b 100644 --- a/gcc/testsuite/gcc.dg/noncompile/971104-1.c +++ b/gcc/testsuite/gcc.dg/noncompile/971104-1.c @@ -23,6 +23,6 @@ static void up(int sem){ printf("%s had processes sleeping on it!\n", ({ "MUTEX ", "BARB_SEM 1", "BARB_SEM 2", "CUST_SEM 1", "CUST_SEM 2", "WAIT_SEM 1", "WAIT_SEM 2", "WAIT_SEM 3", - "WAIT_SEM 4"} /* { dg-error "parse error" } */ + "WAIT_SEM 4"} /* { dg-error "(parse|syntax) error" } */ [( sb.sem_num )]) ); } diff --git a/gcc/testsuite/gcc.dg/noncompile/990416-1.c b/gcc/testsuite/gcc.dg/noncompile/990416-1.c index 1e874871de2..6b69ead2fe1 100644 --- a/gcc/testsuite/gcc.dg/noncompile/990416-1.c +++ b/gcc/testsuite/gcc.dg/noncompile/990416-1.c @@ -1,7 +1,7 @@ typedef int word_type; static void -copy_reg (unsigned int reg, frame_state *udata, /* { dg-error "parse" } */ +copy_reg (unsigned int reg, frame_state *udata, /* { dg-error "parse|syntax" } */ frame_state *target_udata) { word_type *preg = get_reg_addr (reg, udata, 0); /* { dg-error "undeclared|function|without a cast" } */ diff --git a/gcc/testsuite/gcc.dg/old-style-asm-1.c b/gcc/testsuite/gcc.dg/old-style-asm-1.c new file mode 100644 index 00000000000..a265fe10d84 --- /dev/null +++ b/gcc/testsuite/gcc.dg/old-style-asm-1.c @@ -0,0 +1,27 @@ +/* PR inline-asm/8832 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +/* Verify that GCC doesn't optimize + old style asm instructions. */ + +void foo(int v) +{ + if (v) + asm ("dummy1"); + + asm ("dummy2"); + + if (v) + asm ("dummy3"); +} + +/* The purpose of the test below is to check that there are two branches + in the generated code, supposedly corresponding to the if-statements. + Warning: this is fragile and assumes that one of the generated labels + for the branches matches the string "L2", or as with + mmix-knuth-mmixware, "L:2". That assumption is generally invalid, + because for example it depends on the target macro + ASM_GENERATE_INTERNAL_LABEL to generate a name matching this regexp (as + with the default definition). */ +/* { dg-final { scan-assembler "L(:)?2" } } */ diff --git a/gcc/testsuite/gcc.dg/pragma-ep-1.c b/gcc/testsuite/gcc.dg/pragma-ep-1.c index 91ec640ca5b..e110ff90004 100644 --- a/gcc/testsuite/gcc.dg/pragma-ep-1.c +++ b/gcc/testsuite/gcc.dg/pragma-ep-1.c @@ -5,7 +5,7 @@ /* { dg-final { scan-assembler "four" } } */ /* { dg-final { scan-assembler-not "_four" } } */ -#ifndef __EXTERN_PREFIX +#ifndef __PRAGMA_EXTERN_PREFIX #error #endif diff --git a/gcc/testsuite/gcc.dg/struct-ret-libc.c b/gcc/testsuite/gcc.dg/struct-ret-libc.c new file mode 100644 index 00000000000..723e1cd029b --- /dev/null +++ b/gcc/testsuite/gcc.dg/struct-ret-libc.c @@ -0,0 +1,16 @@ +/* Test evolved from source from Simona Perri <perri@mat.unical.it> + and Gerald Pfeifer<pfeifer@dbai.tuwien.ac.at>. + + Copyright (C) 2003 Free Software Foundation */ + +/* { dg-do run } */ + +#include <stdlib.h> + +int main () +{ + div_t d = div (20, 5); + if ((d.quot != 4) || (d.rem)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/tls/alias-1.c b/gcc/testsuite/gcc.dg/tls/alias-1.c new file mode 100644 index 00000000000..3372da3d10c --- /dev/null +++ b/gcc/testsuite/gcc.dg/tls/alias-1.c @@ -0,0 +1,21 @@ +/* { dg-do link } */ +/* Test that encode_section_info handles the change from externally + defined to locally defined (via hidden). Extracted from glibc. */ + +struct __res_state { + char x[123]; +}; + +extern __thread struct __res_state bar + __attribute__ ((tls_model ("initial-exec"))); + +int main() +{ + bar.x[0] = 0; + return 0; +} + +__thread struct __res_state foo; +extern __thread struct __res_state bar + __attribute__ ((alias ("foo"))) + __attribute__ ((visibility ("hidden"))); diff --git a/gcc/testsuite/gcc.dg/uninit-C.c b/gcc/testsuite/gcc.dg/uninit-C.c new file mode 100644 index 00000000000..c81ada4abfc --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-C.c @@ -0,0 +1,15 @@ +/* Spurious uninitialized variable warning, inspired by libgcc2.c. */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +typedef int TItype __attribute__ ((mode (TI))); + +TItype +__subvdi3 (TItype a, TItype b) +{ + TItype w; + + w = a - b; + + return w; +} |