diff options
author | YamaArashi <shadow962@live.com> | 2016-01-06 01:47:28 -0800 |
---|---|---|
committer | YamaArashi <shadow962@live.com> | 2016-01-06 01:47:28 -0800 |
commit | be8b04496302184c6e8f04d6179f9c3afc50aeb6 (patch) | |
tree | 726e2468c0c07add773c0dbd86ab6386844259ae /gcc/testsuite/gcc.c-torture/special |
initial commit
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/special')
-rwxr-xr-x | gcc/testsuite/gcc.c-torture/special/920413-1.c | 1 | ||||
-rwxr-xr-x | gcc/testsuite/gcc.c-torture/special/920520-1.c | 1 | ||||
-rwxr-xr-x | gcc/testsuite/gcc.c-torture/special/920521-1.c | 1 | ||||
-rwxr-xr-x | gcc/testsuite/gcc.c-torture/special/920717-x.c | 3 | ||||
-rwxr-xr-x | gcc/testsuite/gcc.c-torture/special/920717-y.c | 8 | ||||
-rwxr-xr-x | gcc/testsuite/gcc.c-torture/special/920730-1.c | 32 | ||||
-rwxr-xr-x | gcc/testsuite/gcc.c-torture/special/921210-1.c | 4 | ||||
-rwxr-xr-x | gcc/testsuite/gcc.c-torture/special/930510-1.c | 3 | ||||
-rwxr-xr-x | gcc/testsuite/gcc.c-torture/special/951130-1.c | 2 | ||||
-rwxr-xr-x | gcc/testsuite/gcc.c-torture/special/960224-1.c | 6 | ||||
-rwxr-xr-x | gcc/testsuite/gcc.c-torture/special/960224-2.c | 4 | ||||
-rwxr-xr-x | gcc/testsuite/gcc.c-torture/special/981006-1.c | 50 | ||||
-rwxr-xr-x | gcc/testsuite/gcc.c-torture/special/Makefile.in | 12 | ||||
-rwxr-xr-x | gcc/testsuite/gcc.c-torture/special/configure.in | 15 | ||||
-rwxr-xr-x | gcc/testsuite/gcc.c-torture/special/eeprof-1.c | 67 | ||||
-rwxr-xr-x | gcc/testsuite/gcc.c-torture/special/special.exp | 119 |
16 files changed, 328 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/special/920413-1.c b/gcc/testsuite/gcc.c-torture/special/920413-1.c new file mode 100755 index 0000000..a3e0613 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/special/920413-1.c @@ -0,0 +1 @@ +x(b){unsigned long c;c=4294967295U/(unsigned long)b;} diff --git a/gcc/testsuite/gcc.c-torture/special/920520-1.c b/gcc/testsuite/gcc.c-torture/special/920520-1.c new file mode 100755 index 0000000..6b1cd7b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/special/920520-1.c @@ -0,0 +1 @@ +f(){asm("%0"::"r"(1.5F));}g(){asm("%0"::"r"(1.5));} diff --git a/gcc/testsuite/gcc.c-torture/special/920521-1.c b/gcc/testsuite/gcc.c-torture/special/920521-1.c new file mode 100755 index 0000000..95b9497 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/special/920521-1.c @@ -0,0 +1 @@ +f(){asm("f":::"cc");}g(x,y){asm("g"::"%r"(x), "r"(y));} diff --git a/gcc/testsuite/gcc.c-torture/special/920717-x.c b/gcc/testsuite/gcc.c-torture/special/920717-x.c new file mode 100755 index 0000000..07601e3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/special/920717-x.c @@ -0,0 +1,3 @@ +/* 920717-1.c */ + +const char s[]="foo"; diff --git a/gcc/testsuite/gcc.c-torture/special/920717-y.c b/gcc/testsuite/gcc.c-torture/special/920717-y.c new file mode 100755 index 0000000..eaffa5e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/special/920717-y.c @@ -0,0 +1,8 @@ +/* 920717-y.c */ + +extern const char s[]; + +main() +{ + puts(s); +} diff --git a/gcc/testsuite/gcc.c-torture/special/920730-1.c b/gcc/testsuite/gcc.c-torture/special/920730-1.c new file mode 100755 index 0000000..d97d873 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/special/920730-1.c @@ -0,0 +1,32 @@ +/* 920730-1.c */ + +f1() +{ + int b=0x80000000; + return b>=0x80000000; +} + +f2() +{ + int b=0x80000001; + return b>=0x80000001; +} + +f3() +{ + int b=0x7fffffff; + return b>=0x7fffffff; +} + +f4() +{ + int b=0xffffffff; + return b>=0xffffffff; +} + +main () +{ + if((f1()&f2()&f3()&f4())!=1) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/special/921210-1.c b/gcc/testsuite/gcc.c-torture/special/921210-1.c new file mode 100755 index 0000000..bbbf39a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/special/921210-1.c @@ -0,0 +1,4 @@ +#define a1(y) (y+1) +#define a2(y) a1(y)+1 +#define f a->f +a2(f) diff --git a/gcc/testsuite/gcc.c-torture/special/930510-1.c b/gcc/testsuite/gcc.c-torture/special/930510-1.c new file mode 100755 index 0000000..54ad858 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/special/930510-1.c @@ -0,0 +1,3 @@ +#define ugly 3 +#ugly "foobar" 3 /* { dg-error "invalid" "invalid directive" } */ +int main() { exit (0); } diff --git a/gcc/testsuite/gcc.c-torture/special/951130-1.c b/gcc/testsuite/gcc.c-torture/special/951130-1.c new file mode 100755 index 0000000..c06ba07 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/special/951130-1.c @@ -0,0 +1,2 @@ +unsigned long long x = -(unsigned long long)(-(long long)(((unsigned long +long)0 - 1) >> 1) - 1); diff --git a/gcc/testsuite/gcc.c-torture/special/960224-1.c b/gcc/testsuite/gcc.c-torture/special/960224-1.c new file mode 100755 index 0000000..de0a6ae --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/special/960224-1.c @@ -0,0 +1,6 @@ +#if 0 +#if 0 +#endif \ +\ + +#endif diff --git a/gcc/testsuite/gcc.c-torture/special/960224-2.c b/gcc/testsuite/gcc.c-torture/special/960224-2.c new file mode 100755 index 0000000..3d69694 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/special/960224-2.c @@ -0,0 +1,4 @@ +#if 0 +#if 0 +#endif / +#endif diff --git a/gcc/testsuite/gcc.c-torture/special/981006-1.c b/gcc/testsuite/gcc.c-torture/special/981006-1.c new file mode 100755 index 0000000..6af6d9a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/special/981006-1.c @@ -0,0 +1,50 @@ +/* Test that tablejump insns are correctly handled. If the compiler + loses track of the jump targets, it will report that x and y can be + used uninitialized. + + This is broken in egcs 1998/10/06 for mips in pic mode. */ +/* { dg-do compile } */ + +int foo (int a, int b) +{ + __label__ z; + int x; /* { dg-bogus "warning: `.' might be used uninitialized in this function" } */ + int y; /* { dg-bogus "warning: `.' might be used uninitialized in this function" } */ + static void *p; + + switch (a) { + case 2: + x = 4; + break; + case 4: + x = 6; + break; + case 8: case 10: case 13: case 11: case 17: case 19: + x = 7; + break; + default: + x = -1; + break; + } + switch (b) { + case 2: + y = 4; + break; + case 4: + y = 6; + break; + case 8: case 10: case 13: case 11: case 17: case 19: + y = 7; + break; + default: + y = -1; + break; + } + z: + p = &&z; + return x * y; +} +int main (int argc, char *argv[]) +{ + return 1 == foo (argc, argc + 1); +} diff --git a/gcc/testsuite/gcc.c-torture/special/Makefile.in b/gcc/testsuite/gcc.c-torture/special/Makefile.in new file mode 100755 index 0000000..e6209db --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/special/Makefile.in @@ -0,0 +1,12 @@ +#### host, target, and site specific Makefile frags come in here. + +srcdir = . + +# Nothing to do... +all: + +clean: + -rm -f *.o *.diff *~ *.bad core *.x + +distclean: clean + -rm -f Makefile config.status diff --git a/gcc/testsuite/gcc.c-torture/special/configure.in b/gcc/testsuite/gcc.c-torture/special/configure.in new file mode 100755 index 0000000..b9cbac3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/special/configure.in @@ -0,0 +1,15 @@ +# This file is a shell script fragment that supplies the information +# necessary to tailor a template configure script into the configure +# script appropriate for this directory. For more information, check +# any existing configure script. + +srctrigger=special.exp +srcname="DejaGnu" + +# per-host: + +# per-target: + +target_makefile_frag=../config/mt-${target_alias} + +# post-target: diff --git a/gcc/testsuite/gcc.c-torture/special/eeprof-1.c b/gcc/testsuite/gcc.c-torture/special/eeprof-1.c new file mode 100755 index 0000000..6dad7ec --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/special/eeprof-1.c @@ -0,0 +1,67 @@ +#define ASSERT(X) if (!(X)) abort (); +#define NOCHK __attribute__ ((no_instrument_function)) + +int entry_calls, exit_calls; +void (*last_fn_entered)(); +void (*last_fn_exited)(); + +int main () NOCHK; + +void foo () +{ + ASSERT (last_fn_entered == foo); +} + +static void foo2 () +{ + ASSERT (entry_calls == 1 && exit_calls == 0); + ASSERT (last_fn_entered == foo2); + foo (); + ASSERT (entry_calls == 2 && exit_calls == 1); + ASSERT (last_fn_entered == foo); + ASSERT (last_fn_exited == foo); +} + +void nfoo (void) NOCHK; +void nfoo () +{ + ASSERT (entry_calls == 2 && exit_calls == 2); + ASSERT (last_fn_entered == foo); + ASSERT (last_fn_exited == foo2); + foo (); + ASSERT (entry_calls == 3 && exit_calls == 3); + ASSERT (last_fn_entered == foo); + ASSERT (last_fn_exited == foo); +} + +int main () +{ + ASSERT (entry_calls == 0 && exit_calls == 0); + + foo2 (); + + ASSERT (entry_calls == 2 && exit_calls == 2); + ASSERT (last_fn_entered == foo); + ASSERT (last_fn_exited == foo2); + + nfoo (); + + ASSERT (entry_calls == 3 && exit_calls == 3); + ASSERT (last_fn_entered == foo); + + return 0; +} + +void __cyg_profile_func_enter (void (*fn)(), void (*parent)()) NOCHK; +void __cyg_profile_func_exit (void (*fn)(), void (*parent)()) NOCHK; + +void __cyg_profile_func_enter (void (*fn)(), void (*parent)()) +{ + entry_calls++; + last_fn_entered = fn; +} +void __cyg_profile_func_exit (void (*fn)(), void (*parent)()) +{ + exit_calls++; + last_fn_exited = fn; +} diff --git a/gcc/testsuite/gcc.c-torture/special/special.exp b/gcc/testsuite/gcc.c-torture/special/special.exp new file mode 100755 index 0000000..a2ef927 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/special/special.exp @@ -0,0 +1,119 @@ +# Copyright (C) 1988, 90-96, 1997 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gcc@prep.ai.mit.edu + +# This file was written by Rob Savoye. (rob@cygnus.com) + +# +# These tests come from Torbjorn Granlund (tege@cygnus.com) +# C torture test suite. +# + +if $tracelevel then { + strace $tracelevel +} + +# load support procs +load_lib c-torture.exp +load_lib gcc-dg.exp + +################## ADD NEXT CASE HERE (NOT AT THE END) ################## + +# 981006-1 +# For MIPS at least, pic is needed to trigger the problem. +dg-init +# CYGNUS LOCAL nickc/fr30 +if { [istarget rs6000-*-aix*] + || [istarget powerpc*-*-aix*] + || [istarget arm*-*-*] + || [istarget fr30-*-*] +} { + set extra_flags "" +} else { + set extra_flags "-fpic" +} +# END CYGNUS LOCAL +dg-runtest $srcdir/$subdir/981006-1.c "-Wuninitialized -O2 $extra_flags" "" +dg-finish + +# 921210-1 +set lines [gcc_target_compile $srcdir/$subdir/921210-1.c "" preprocess ""] +set lines [prune [split [prune_warnings [prune_gcc_output $lines]] "\n"] ""] +set line [lindex $lines [expr [llength $lines]-1]] +regsub -all " " $line "" clean +if [expr [string compare $clean "(a->f+1)+1"]==0] then { + pass "921210-1.c" +} else { + fail "921210-1.c" +} + +# 920521-1 +c-torture 920521-1.c "-S" + +# 920520-1 +c-torture 920520-1.c "-S" + +# 920717-1 +if [isnative] then { + set lines [gcc_target_compile "$srcdir/$subdir/920717-x.c" "920717-x.o" object {additional_flags="-w"}] + if ![string match "" $lines] then { + fail "920717-x.c" + } else { + # This is a completely bogus test. Sorry. + catch exec "rm -f 920717-y.o" + send_log "cc -c $srcdir/$subdir/920717-y.c 2>/dev/null >/dev/null\n" + catch exec "cc -c $srcdir/$subdir/920717-y.c 2>/dev/null >/dev/null" + if ![file exists "920717-y.o"] then { + send_log "c89 -c $srcdir/$subdir/920717-y.c 2>/dev/null >/dev/null\n" + catch exec "c89 -c $srcdir/$subdir/920717-y.c 2>/dev/null >/dev/null" + } + if [file exists "920717-y.o"] then { + set lines [gcc_target_compile "920717-y.o x.o" "x" executable ""] + if [string match "" $lines] then { + pass "920717-1.c" + } else { + fail "920717-1.c" + } + } + } +} + +# 920730-1 +if [isnative] then { + c-torture "920730-1.c" + c-torture "920730-1.c" "-traditional" +} + +# 920413-1 +c-torture 920413-1.c "-Wtraditional" + +# 930510-1 +dg-init +dg-runtest $srcdir/$subdir/930510-1.c "" "" +dg-finish + +# 951130-1 +c-torture 951130-1.c "-Werror" + +# 960224-1 +c-torture 960224-1.c "-E -ansi -pedantic-errors" + +# 960224-2 +#c-torture 960224-2.c "-E -ansi -pedantic-errors" + +c-torture-execute $srcdir/$subdir/eeprof-1.c "-finstrument-functions" |