diff options
author | dberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-12-06 16:54:04 +0000 |
---|---|---|
committer | dberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-12-06 16:54:04 +0000 |
commit | 0aa57f28eba75992b3f38d970777597851fdc13f (patch) | |
tree | 85f1e092f35883724bee0eb28f5d10a4ddaaed4b /gcc/testsuite/g++.dg | |
parent | f575b079a16669e42ddb0d40a0779fea73362f0a (diff) |
Merge from mainline
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/dataflow-branch@108122 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/g++.dg')
25 files changed, 230 insertions, 20 deletions
diff --git a/gcc/testsuite/g++.dg/ext/packed8.C b/gcc/testsuite/g++.dg/ext/packed8.C index 13fc134bd97..1f86cfc0a69 100644 --- a/gcc/testsuite/g++.dg/ext/packed8.C +++ b/gcc/testsuite/g++.dg/ext/packed8.C @@ -15,7 +15,7 @@ public: class B { - A a __attribute__((packed)); + A a __attribute__((packed)); // { dg-warning "attribute ignored" "" { target default_packed } } public: B() {} diff --git a/gcc/testsuite/g++.dg/inherit/thunk5.C b/gcc/testsuite/g++.dg/inherit/thunk5.C new file mode 100644 index 00000000000..05dba36383d --- /dev/null +++ b/gcc/testsuite/g++.dg/inherit/thunk5.C @@ -0,0 +1,22 @@ +// PR c++/21123 + +struct A +{ + A(const A &a); + const A& operator=(const A& a); +}; + +struct B +{ + virtual A f(A); +}; + +struct C : virtual B +{ + virtual A f(A); +}; + +A C::f(A a) +{ + return a; +} diff --git a/gcc/testsuite/g++.dg/opt/pr7503-3.C b/gcc/testsuite/g++.dg/opt/pr7503-3.C index 4e8de0f207c..dc71d20638b 100644 --- a/gcc/testsuite/g++.dg/opt/pr7503-3.C +++ b/gcc/testsuite/g++.dg/opt/pr7503-3.C @@ -6,21 +6,21 @@ extern int A, B; void test1() { - (A++ <? B) = 0; // { dg-error "lvalue in assignment" } + (A++ <? B) = 0; // { dg-error "lvalue required" } } void test2() { - (A <? B++) = 0; // { dg-error "lvalue in assignment" } + (A <? B++) = 0; // { dg-error "lvalue required" } } void test3() { - (A++ >? B) = 0; // { dg-error "lvalue in assignment" } + (A++ >? B) = 0; // { dg-error "lvalue required" } } void test4() { - (A >? B++) = 0; // { dg-error "lvalue in assignment" } + (A >? B++) = 0; // { dg-error "lvalue required" } } diff --git a/gcc/testsuite/g++.dg/opt/range-test-1.C b/gcc/testsuite/g++.dg/opt/range-test-1.C index 9391748837e..cc5ba669479 100644 --- a/gcc/testsuite/g++.dg/opt/range-test-1.C +++ b/gcc/testsuite/g++.dg/opt/range-test-1.C @@ -2,9 +2,13 @@ // { dg-do run } */ // { dg-options "-O2" } */ +#ifndef __RANGE_TEST_HDR_INCL +#define __RANGE_TEST_HDR_INCL +/* Protect against fix-header weakness */ #include <stdlib.h> #include <stdio.h> #include <limits.h> +#endif #if (INT_MAX == 2147483647) && (INT_MIN == -2147483648) \ && (SCHAR_MIN == -128) && (SCHAR_MAX == 127) \ diff --git a/gcc/testsuite/g++.dg/other/array2.C b/gcc/testsuite/g++.dg/other/array2.C new file mode 100644 index 00000000000..b091d96bec8 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/array2.C @@ -0,0 +1,6 @@ +// PR c++/25263 +// { dg-do compile } + +int x[1/0]; // { dg-warning "division by zero" } + // { dg-error "constant" "constant" { target *-*-* } 4 } + diff --git a/gcc/testsuite/g++.dg/other/crash-4.C b/gcc/testsuite/g++.dg/other/crash-4.C index ea5a14fa7ae..a37b8b2f020 100644 --- a/gcc/testsuite/g++.dg/other/crash-4.C +++ b/gcc/testsuite/g++.dg/other/crash-4.C @@ -17,7 +17,7 @@ struct a struct b { // { dg-error "cannot bind packed field" "" { target { ! default_packed } } } char c; - a aa __attribute__((packed)); + a aa __attribute__((packed)); // { dg-warning "attribute ignored" "" { target default_packed } } }; struct c { diff --git a/gcc/testsuite/g++.dg/other/default1.C b/gcc/testsuite/g++.dg/other/default1.C new file mode 100644 index 00000000000..a6d96818563 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/default1.C @@ -0,0 +1,22 @@ +// PR c++/24103 +// ICE in simple_cst_equal +// Origin: Alexander Stepanov <astepanov@softminecorp.com> +// { dg-do compile } +// { dg-options "" } + +struct S +{ + int i; +}; + +struct A +{ + A(S = (S){0}); +}; + +struct B +{ + B(S = (S){0}); +}; + +B::B(S) {} diff --git a/gcc/testsuite/g++.dg/other/packed1.C b/gcc/testsuite/g++.dg/other/packed1.C index d4422092271..5d19eb0e2a7 100644 --- a/gcc/testsuite/g++.dg/other/packed1.C +++ b/gcc/testsuite/g++.dg/other/packed1.C @@ -11,7 +11,11 @@ struct thing { int m; }; -struct pod {char a; thing m __attribute__ ((packed)); }; +struct pod + { + char a; + thing m __attribute__ ((packed)); // { dg-warning "attribute ignored" "" { target default_packed } } + }; int main () { diff --git a/gcc/testsuite/g++.dg/template/friend40.C b/gcc/testsuite/g++.dg/template/friend40.C new file mode 100644 index 00000000000..39dd994e9d1 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/friend40.C @@ -0,0 +1,16 @@ +// PR c++/24173 +// { dg-options "--param ggc-min-expand=0 --param ggc-min-heapsize=0" } + +template <int> struct A; + +void foo(A<0>); + +template<int> struct A +{ + friend void foo(A<0>); +}; + +void bar() +{ + foo(A<0>()); +} diff --git a/gcc/testsuite/g++.dg/tls/diag-1.C b/gcc/testsuite/g++.dg/tls/diag-1.C index 697d0b13106..af538719d24 100644 --- a/gcc/testsuite/g++.dg/tls/diag-1.C +++ b/gcc/testsuite/g++.dg/tls/diag-1.C @@ -1,4 +1,5 @@ -/* Valid __thread specifiers. */ +// Valid __thread specifiers. +// { dg-require-effective-target tls } __thread int g1; extern __thread int g2; diff --git a/gcc/testsuite/g++.dg/tls/diag-2.C b/gcc/testsuite/g++.dg/tls/diag-2.C index 293409db9ce..484b1884515 100644 --- a/gcc/testsuite/g++.dg/tls/diag-2.C +++ b/gcc/testsuite/g++.dg/tls/diag-2.C @@ -1,4 +1,5 @@ /* Invalid __thread specifiers. */ +/* { dg-require-effective-target tls } */ __thread extern int g1; /* { dg-error "'__thread' before 'extern'" } */ __thread static int g2; /* { dg-error "'__thread' before 'static'" } */ diff --git a/gcc/testsuite/g++.dg/tls/diag-3.C b/gcc/testsuite/g++.dg/tls/diag-3.C index ae2b6ce211f..ea5158b898f 100644 --- a/gcc/testsuite/g++.dg/tls/diag-3.C +++ b/gcc/testsuite/g++.dg/tls/diag-3.C @@ -1,4 +1,5 @@ // Report invalid extern and __thread combinations. +// { dg-require-effective-target tls } extern int j; // { dg-error "previously declared here" } __thread int j; // { dg-error "follows non-thread-local" } diff --git a/gcc/testsuite/g++.dg/tls/diag-4.C b/gcc/testsuite/g++.dg/tls/diag-4.C index 3b840f1e7b9..55e985e9261 100644 --- a/gcc/testsuite/g++.dg/tls/diag-4.C +++ b/gcc/testsuite/g++.dg/tls/diag-4.C @@ -1,4 +1,5 @@ /* Invalid __thread specifiers. */ +/* { dg-require-effective-target tls } */ __thread typedef int g4; /* { dg-error "multiple storage classes" } */ diff --git a/gcc/testsuite/g++.dg/tls/init-1.C b/gcc/testsuite/g++.dg/tls/init-1.C index 74f7641fe27..97867123a95 100644 --- a/gcc/testsuite/g++.dg/tls/init-1.C +++ b/gcc/testsuite/g++.dg/tls/init-1.C @@ -1,4 +1,5 @@ /* Valid initializations. */ +/* { dg-require-effective-target tls } */ __thread int i = 42; diff --git a/gcc/testsuite/g++.dg/tls/init-2.C b/gcc/testsuite/g++.dg/tls/init-2.C index 4cc31c909ac..c9f646d3a1d 100644 --- a/gcc/testsuite/g++.dg/tls/init-2.C +++ b/gcc/testsuite/g++.dg/tls/init-2.C @@ -1,4 +1,5 @@ /* Invalid initializations. */ +/* { dg-require-effective-target tls } */ extern __thread int i; __thread int *p = &i; /* { dg-error "dynamically initialized" } */ diff --git a/gcc/testsuite/g++.dg/tls/static-1.C b/gcc/testsuite/g++.dg/tls/static-1.C index 3cbcbec2d31..2392c634619 100644 --- a/gcc/testsuite/g++.dg/tls/static-1.C +++ b/gcc/testsuite/g++.dg/tls/static-1.C @@ -1,6 +1,7 @@ // { dg-do run } // { dg-options "-O2" } // { dg-additional-sources "static-1a.cc" } +// { dg-require-effective-target tls_runtime } extern "C" void abort (); extern int test (); diff --git a/gcc/testsuite/g++.dg/tls/static-1a.cc b/gcc/testsuite/g++.dg/tls/static-1a.cc index c87efdb8ecd..636f9352d4d 100644 --- a/gcc/testsuite/g++.dg/tls/static-1a.cc +++ b/gcc/testsuite/g++.dg/tls/static-1a.cc @@ -1,6 +1,7 @@ // { dg-do run } // { dg-options "-O2" } // { dg-additional-sources "static-1a.cc" } +// { dg-require-effective-target tls_runtime } struct A { diff --git a/gcc/testsuite/g++.dg/tls/tls.exp b/gcc/testsuite/g++.dg/tls/tls.exp index 20c2bd35bcf..85e7a36fa7c 100644 --- a/gcc/testsuite/g++.dg/tls/tls.exp +++ b/gcc/testsuite/g++.dg/tls/tls.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2002 Free Software Foundation, Inc. +# Copyright (C) 2002, 2005 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 @@ -19,16 +19,6 @@ # Load support procs. load_lib g++-dg.exp -# Test for thread-local data supported by the platform. If it -# isn't, everything will fail with the "not supported" message. - -set comp_output [g++_target_compile \ - "$srcdir/$subdir/trivial.C" "trivialx.S" assembly ""] -remove-build-file "trivialx.S" -if { [string match "*not supported*" $comp_output] } { - return 0 -} - # If a testcase doesn't have special options, use these. global DEFAULT_CXXFLAGS if ![info exists DEFAULT_CXXFLAGS] then { diff --git a/gcc/testsuite/g++.dg/tls/trivial.C b/gcc/testsuite/g++.dg/tls/trivial.C index 1fd70631f33..e2b8f45b845 100644 --- a/gcc/testsuite/g++.dg/tls/trivial.C +++ b/gcc/testsuite/g++.dg/tls/trivial.C @@ -1 +1,3 @@ +// { dg-require-effective-target tls } + __thread int i; diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr14814.C b/gcc/testsuite/g++.dg/tree-ssa/pr14814.C index c793f88f22f..59e3c9bc9b4 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/pr14814.C +++ b/gcc/testsuite/g++.dg/tree-ssa/pr14814.C @@ -14,7 +14,7 @@ int foo(XX& r) { if (r.direction().y() < 0.000001) return 0; return 1; } -/* { dg-final { scan-tree-dump-times "&this" 0 "forwprop2" { xfail *-*-* } } }*/ +/* { dg-final { scan-tree-dump-times "&this" 0 "forwprop2" } } */ /* { dg-final { scan-tree-dump-times "&r" 0 "forwprop2" } } */ /* { dg-final { cleanup-tree-dump "forwprop2" } } */ diff --git a/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-7.C b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-7.C new file mode 100644 index 00000000000..5e41808f6c4 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-7.C @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-Wstrict-aliasing -O2" } */ + +int a[2]; + +double *foo1(void) +{ + return (double *)a; /* { dg-warning "strict-aliasing" } */ +} + +double *foo2(void) +{ + return (double *)&a[0]; /* { dg-warning "strict-aliasing" } */ +} + +__complex__ double x; +int *bar(void) +{ + return (int *)&__imag__ x; /* { dg-warning "strict-aliasing" } */ +} diff --git a/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-1.C b/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-1.C new file mode 100644 index 00000000000..c5dea463b51 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-1.C @@ -0,0 +1,29 @@ +/* PR c/7776 */ +/* { dg-do compile } */ +/* { dg-options "-Wstring-literal-comparison" } */ + +int test1(char *ptr) +{ + return ptr == "foo"; /* { dg-warning "comparison with string" } */ +} + +int test2() +{ + return "foo" != (const char*)0; +} + +int test3() +{ + return "foo" == (const char*)0; +} + +int test4() +{ + return (const char*)0 != "foo"; +} + +int test5() +{ + return (const char*)0 == "foo"; +} + diff --git a/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-2.C b/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-2.C new file mode 100644 index 00000000000..3eb91eeca49 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-2.C @@ -0,0 +1,29 @@ +/* PR c/7776 */ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +int test1(char *ptr) +{ + return ptr == "foo"; /* { dg-warning "comparison with string" } */ +} + +int test2() +{ + return "foo" != (const char*)0; +} + +int test3() +{ + return "foo" == (const char*)0; +} + +int test4() +{ + return (const char*)0 != "foo"; +} + +int test5() +{ + return (const char*)0 == "foo"; +} + diff --git a/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-3.C b/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-3.C new file mode 100644 index 00000000000..f700a51a87b --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-3.C @@ -0,0 +1,29 @@ +/* PR c/7776 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +int test1(char *ptr) +{ + return ptr == "foo"; +} + +int test2() +{ + return "foo" != (const char*)0; +} + +int test3() +{ + return "foo" == (const char*)0; +} + +int test4() +{ + return (const char*)0 != "foo"; +} + +int test5() +{ + return (const char*)0 == "foo"; +} + diff --git a/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-4.C b/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-4.C new file mode 100644 index 00000000000..27f25f3ca98 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-4.C @@ -0,0 +1,29 @@ +/* PR c/7776 */ +/* { dg-do compile } */ +/* { dg-options "-Wall -Wno-string-literal-comparison" } */ + +int test1(char *ptr) +{ + return ptr == "foo"; +} + +int test2() +{ + return "foo" != (const char*)0; +} + +int test3() +{ + return "foo" == (const char*)0; +} + +int test4() +{ + return (const char*)0 != "foo"; +} + +int test5() +{ + return (const char*)0 == "foo"; +} + |