This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Move almost everything out of c-torture/special
- To: gcc-patches at gcc dot gnu dot org
- Subject: Move almost everything out of c-torture/special
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Sun, 25 Jun 2000 16:47:58 -0700
While I was going through the new lexer's regressions, I noticed that
almost everything in c-torture/special can be done just as well within
one of the normal directories - c-torture/compile, c-torture/execute,
or gcc.dg. This patch moves all but one of the special test cases
out, and in a couple of cases makes the test a tad more robust too.
The one remaining special test is 920717-[xy].c, which I can't quite
figure out what it's supposed to test - I *think* it has to do with
linking objects compiled by gcc with objects compiled by the vendor
compiler, if any. The logic in special.exp is unclear, and looks
rather fragile. For now, I've left it strictly alone. Clues would be
appreciated.
Bootstrapped on i386-linux (with the new lexer). Ok to commit?
zw
* c-torture/special/special.exp: Remove driver logic for all
tests except 920717-1.
* c-torture/special/920520-1.c, c-torture/special/920521-1.c,
c-torture/special/981006-1.c: Move to c-torture/compile.
* c-torture/compile/920520-1.x, c-torture/compile/920521-1.x,
c-torture/compile/981006-1.x: New options files.
* c-torture/compile/961203-1.x: Delete.
* c-torture/special/920730-1.c, c-torture/special/eeprof-1.c:
Move to c-torture/execute.
* c-torture/execute/920730-1t.c: New test.
* c-torture/execute/920730-1t.x, c-torture/execute/eeprof-1.x:
New options files.
* c-torture/special/920413-1.c, c-torture/special/921210-1.c,
c-torture/special/930510-1.c, c-torture/special/951130-1.c,
c-torture/special/960224-1.c, c-torture/special/960224-2.c:
Move to gcc.dg and add dg.exp magic comments.
* gcc.dg/921210-1.c: Rewrite as actual compile-able source
code.
===================================================================
Index: testsuite/gcc.c-torture/special/920413-1.c
--- testsuite/gcc.c-torture/special/920413-1.c Sun Jun 25 15:51:47 2000
+++ testsuite/gcc.c-torture/special/920413-1.c Tue May 5 13:32:27 1998
@@ -1 +0,0 @@
-x(b){unsigned long c;c=4294967295U/(unsigned long)b;}
===================================================================
Index: testsuite/gcc.c-torture/special/920520-1.c
--- testsuite/gcc.c-torture/special/920520-1.c Sun Jun 25 15:51:47 2000
+++ testsuite/gcc.c-torture/special/920520-1.c Tue May 5 13:32:27 1998
@@ -1 +0,0 @@
-f(){asm("%0"::"r"(1.5F));}g(){asm("%0"::"r"(1.5));}
===================================================================
Index: testsuite/gcc.c-torture/special/920521-1.c
--- testsuite/gcc.c-torture/special/920521-1.c Sun Jun 25 15:51:47 2000
+++ testsuite/gcc.c-torture/special/920521-1.c Tue May 5 13:32:27 1998
@@ -1 +0,0 @@
-f(){asm("f":::"cc");}g(x,y){asm("g"::"%r"(x), "r"(y));}
===================================================================
Index: testsuite/gcc.c-torture/special/920730-1.c
--- testsuite/gcc.c-torture/special/920730-1.c Sun Jun 25 15:51:47 2000
+++ testsuite/gcc.c-torture/special/920730-1.c Tue May 5 13:32:27 1998
@@ -1,32 +0,0 @@
-/* 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);
-}
===================================================================
Index: testsuite/gcc.c-torture/special/921210-1.c
--- testsuite/gcc.c-torture/special/921210-1.c Sun Jun 25 15:51:47 2000
+++ testsuite/gcc.c-torture/special/921210-1.c Tue May 5 13:32:27 1998
@@ -1,4 +0,0 @@
-#define a1(y) (y+1)
-#define a2(y) a1(y)+1
-#define f a->f
-a2(f)
===================================================================
Index: testsuite/gcc.c-torture/special/930510-1.c
--- testsuite/gcc.c-torture/special/930510-1.c Sun Jun 25 15:51:47 2000
+++ testsuite/gcc.c-torture/special/930510-1.c Tue May 5 13:32:27 1998
@@ -1,3 +0,0 @@
-#define ugly 3
-#ugly "foobar" 3 /* { dg-error "invalid" "invalid directive" } */
-int main() { exit (0); }
===================================================================
Index: testsuite/gcc.c-torture/special/951130-1.c
--- testsuite/gcc.c-torture/special/951130-1.c Sun Jun 25 15:51:47 2000
+++ testsuite/gcc.c-torture/special/951130-1.c Tue May 5 13:32:27 1998
@@ -1,2 +0,0 @@
-unsigned long long x = -(unsigned long long)(-(long long)(((unsigned long
-long)0 - 1) >> 1) - 1);
===================================================================
Index: testsuite/gcc.c-torture/special/960224-1.c
--- testsuite/gcc.c-torture/special/960224-1.c Sun Jun 25 15:51:47 2000
+++ testsuite/gcc.c-torture/special/960224-1.c Tue May 5 13:32:27 1998
@@ -1,6 +0,0 @@
-#if 0
-#if 0
-#endif \
-\
-
-#endif
===================================================================
Index: testsuite/gcc.c-torture/special/960224-2.c
--- testsuite/gcc.c-torture/special/960224-2.c Sun Jun 25 15:51:47 2000
+++ testsuite/gcc.c-torture/special/960224-2.c Tue May 5 13:32:27 1998
@@ -1,4 +0,0 @@
-#if 0
-#if 0
-#endif /
-#endif
===================================================================
Index: testsuite/gcc.c-torture/special/981006-1.c
--- testsuite/gcc.c-torture/special/981006-1.c Sun Jun 25 15:51:48 2000
+++ testsuite/gcc.c-torture/special/981006-1.c Tue May 5 13:32:27 1998
@@ -1,50 +0,0 @@
-/* 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);
-}
===================================================================
Index: testsuite/gcc.c-torture/special/eeprof-1.c
--- testsuite/gcc.c-torture/special/eeprof-1.c Sun Jun 25 15:51:48 2000
+++ testsuite/gcc.c-torture/special/eeprof-1.c Tue May 5 13:32:27 1998
@@ -1,67 +0,0 @@
-#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;
-}
===================================================================
Index: testsuite/gcc.c-torture/special/special.exp
--- testsuite/gcc.c-torture/special/special.exp 1999/09/22 10:15:28 1.7
+++ testsuite/gcc.c-torture/special/special.exp 2000/06/25 22:51:47
@@ -1,4 +1,4 @@
-# Copyright (C) 1988, 90-96, 1997 Free Software Foundation, Inc.
+# Copyright (C) 1988, 90-96, 1997, 2000 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
@@ -34,39 +34,6 @@ 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
-if { [istarget rs6000-*-aix*]
- || [istarget powerpc*-*-aix*]
- || [istarget arm*-*-*]
- || [istarget strongarm*-*-*]
- || [istarget fr30-*-*]
-} {
- set extra_flags ""
-} else {
- set extra_flags "-fpic"
-}
-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"}]
@@ -91,28 +58,3 @@ if [isnative] then {
}
}
}
-
-# 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"
===================================================================
Index: testsuite/gcc.c-torture/compile/920520-1.c
--- testsuite/gcc.c-torture/compile/920520-1.c Tue May 5 13:32:27 1998
+++ testsuite/gcc.c-torture/compile/920520-1.c Sun Jun 25 15:51:46 2000
@@ -0,0 +1 @@
+f(){asm("%0"::"r"(1.5F));}g(){asm("%0"::"r"(1.5));}
===================================================================
Index: testsuite/gcc.c-torture/compile/920520-1.x
--- testsuite/gcc.c-torture/compile/920520-1.x Tue May 5 13:32:27 1998
+++ testsuite/gcc.c-torture/compile/920520-1.x Sun Jun 25 15:51:46 2000
@@ -0,0 +1,2 @@
+set options "-S"
+return 0
===================================================================
Index: testsuite/gcc.c-torture/compile/920521-1.c
--- testsuite/gcc.c-torture/compile/920521-1.c Tue May 5 13:32:27 1998
+++ testsuite/gcc.c-torture/compile/920521-1.c Sun Jun 25 15:51:46 2000
@@ -0,0 +1 @@
+f(){asm("f":::"cc");}g(x,y){asm("g"::"%r"(x), "r"(y));}
===================================================================
Index: testsuite/gcc.c-torture/compile/920521-1.x
--- testsuite/gcc.c-torture/compile/920521-1.x Tue May 5 13:32:27 1998
+++ testsuite/gcc.c-torture/compile/920521-1.x Sun Jun 25 15:51:46 2000
@@ -0,0 +1,2 @@
+set options "-S"
+return 0
===================================================================
Index: testsuite/gcc.c-torture/compile/961203-1.x
--- testsuite/gcc.c-torture/compile/961203-1.x Sun Jun 25 15:51:47 2000
+++ testsuite/gcc.c-torture/compile/961203-1.x Tue May 5 13:32:27 1998
@@ -1,7 +0,0 @@
-# This doesn't work on any host with 32 bit int or smaller.
-
-# Because this test tends to consume lots of system resources and doesn't
-# currently work, don't actually run it. Just report a failure.
-setup_xfail "*-*-*"
-fail "gcc.c-torture/compile/961203-1.c"
-return 1 ;# `1' says we handled the testcase ourselves
===================================================================
Index: testsuite/gcc.c-torture/compile/981006-1.c
--- testsuite/gcc.c-torture/compile/981006-1.c Tue May 5 13:32:27 1998
+++ testsuite/gcc.c-torture/compile/981006-1.c Sun Jun 25 15:51:46 2000
@@ -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);
+}
===================================================================
Index: testsuite/gcc.c-torture/compile/981006-1.x
--- testsuite/gcc.c-torture/compile/981006-1.x Tue May 5 13:32:27 1998
+++ testsuite/gcc.c-torture/compile/981006-1.x Sun Jun 25 15:51:46 2000
@@ -0,0 +1,12 @@
+# For MIPS at least, pic is needed to trigger the problem.
+if { [istarget rs6000-*-aix*]
+ || [istarget powerpc*-*-aix*]
+ || [istarget arm*-*-*]
+ || [istarget strongarm*-*-*]
+ || [istarget fr30-*-*]
+} {
+ set options "-Wuninitialized -Werror"
+} else {
+ set options "-Wuninitialized -Werror -fpic"
+}
+return 0
===================================================================
Index: testsuite/gcc.c-torture/execute/920730-1.c
--- testsuite/gcc.c-torture/execute/920730-1.c Tue May 5 13:32:27 1998
+++ testsuite/gcc.c-torture/execute/920730-1.c Sun Jun 25 15:51:46 2000
@@ -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);
+}
===================================================================
Index: testsuite/gcc.c-torture/execute/920730-1t.c
--- testsuite/gcc.c-torture/execute/920730-1t.c Tue May 5 13:32:27 1998
+++ testsuite/gcc.c-torture/execute/920730-1t.c Sun Jun 25 15:51:46 2000
@@ -0,0 +1,3 @@
+/* This is just 920730-1.c compiled with -traditional.
+ See 920730-1t.x. */
+#include "920730-1.c"
===================================================================
Index: testsuite/gcc.c-torture/execute/920730-1t.x
--- testsuite/gcc.c-torture/execute/920730-1t.x Tue May 5 13:32:27 1998
+++ testsuite/gcc.c-torture/execute/920730-1t.x Sun Jun 25 15:51:46 2000
@@ -0,0 +1,2 @@
+set additional_flags "-traditional"
+return 0
===================================================================
Index: testsuite/gcc.c-torture/execute/eeprof-1.c
--- testsuite/gcc.c-torture/execute/eeprof-1.c Tue May 5 13:32:27 1998
+++ testsuite/gcc.c-torture/execute/eeprof-1.c Sun Jun 25 15:51:46 2000
@@ -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;
+}
===================================================================
Index: testsuite/gcc.c-torture/execute/eeprof-1.x
--- testsuite/gcc.c-torture/execute/eeprof-1.x Tue May 5 13:32:27 1998
+++ testsuite/gcc.c-torture/execute/eeprof-1.x Sun Jun 25 15:51:46 2000
@@ -0,0 +1,2 @@
+set additional_flags "-finstrument-functions"
+return 0
===================================================================
Index: testsuite/gcc.dg/920413-1.c
--- testsuite/gcc.dg/920413-1.c Tue May 5 13:32:27 1998
+++ testsuite/gcc.dg/920413-1.c Sun Jun 25 15:51:47 2000
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-Wtraditional" } */
+
+int
+x (b)
+{
+ return
+ 4294967295U /* { dg-warning "width of integer constant may change" } */
+ / (unsigned long) b;
+}
===================================================================
Index: testsuite/gcc.dg/921210-1.c
--- testsuite/gcc.dg/921210-1.c Tue May 5 13:32:27 1998
+++ testsuite/gcc.dg/921210-1.c Sun Jun 25 15:51:47 2000
@@ -0,0 +1,12 @@
+/* A slightly less fragile version of what was c-torture/special/921210-1.c. */
+
+/* { dg-do compile } */
+
+struct able { int f; };
+struct able *a;
+
+#define a1(y) (y+1)
+#define a2(y) a1(y)+1
+#define f a->f
+
+int fun (void) { return a2(f); }
===================================================================
Index: testsuite/gcc.dg/930510-1.c
--- testsuite/gcc.dg/930510-1.c Tue May 5 13:32:27 1998
+++ testsuite/gcc.dg/930510-1.c Sun Jun 25 15:51:47 2000
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+
+#define ugly 3
+#ugly "foobar" 3 /* { dg-error "invalid" "invalid directive" } */
+int main() { exit (0); }
===================================================================
Index: testsuite/gcc.dg/951130-1.c
--- testsuite/gcc.dg/951130-1.c Tue May 5 13:32:27 1998
+++ testsuite/gcc.dg/951130-1.c Sun Jun 25 15:51:47 2000
@@ -0,0 +1,5 @@
+/* { dg-do compile }
+ { dg-options "-Werror" } */
+
+unsigned long long x = -(unsigned long long)(-(long long)
+ (((unsigned long long)0 - 1) >> 1) - 1);
===================================================================
Index: testsuite/gcc.dg/960224-1.c
--- testsuite/gcc.dg/960224-1.c Tue May 5 13:32:27 1998
+++ testsuite/gcc.dg/960224-1.c Sun Jun 25 15:51:47 2000
@@ -0,0 +1,8 @@
+/* { dg-do preprocess } */
+
+#if 0
+#if 0
+#endif \
+\
+
+#endif
===================================================================
Index: testsuite/gcc.dg/960224-2.c
--- testsuite/gcc.dg/960224-2.c Tue May 5 13:32:27 1998
+++ testsuite/gcc.dg/960224-2.c Sun Jun 25 15:51:47 2000
@@ -0,0 +1,6 @@
+/* { dg-do preprocess } */
+
+#if 0
+#if 0
+#endif / /* { dg-error "text after #endif" "text after #endif" } */
+#endif