diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-08 21:46:16 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-08 21:46:16 +0000 |
commit | bb4bf88c4cd66e1393b771e1c628e03f8718f4d2 (patch) | |
tree | 56a487c2d5c324338e2eaf003172baf05b94024d /gcc/testsuite | |
parent | 7deddfded2d013c07a639873a4c90bfed40fd03e (diff) | |
download | gcc-bb4bf88c4cd66e1393b771e1c628e03f8718f4d2.tar.gz |
2010-11-08 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 166453
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@166454 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
81 files changed, 1957 insertions, 59 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fda07c36ac0..7d2688e3547 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,220 @@ +2010-11-08 Jason Merrill <jason@redhat.com> + + * g++.dg/expr/overflow1.C: New. + * g++.dg/warn/overflow-warn-1.C: Add expected diagnostics. + * g++.dg/warn/overflow-warn-3.C: Remove unnecessary line number. + * g++.dg/warn/overflow-warn-4.C: Add expected diagnostics. + * g++.dg/warn/overflow-warn-5.C: Don't expect wrong warning. + +2010-11-08 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * gcc.dg/pr35442.c: Adapt warning. + + PR target/46280 + * g++.dg/eh/simd-2.C: Add -msse to dg-options, add + dg-require-effective-target sse_runtime for for i?86-*-*, x86_64-*-*. + * g++.dg/torture/pr36444.C: Add dg-options -msse for + i?86-*-* x86_64-*-*. + * g++.dg/torture/pr36445.C: Likewise. + * gcc.c-torture/compile/pr34856.c: Likewise. + * gcc.c-torture/compile/pr39928-1.c: Likewise. + * gcc.c-torture/compile/vector-1.c: Likewise. + * gcc.c-torture/compile/vector-2.c: Likewise. + * gcc.dg/pr32912-1.c: Likewise. + * gcc.c-torture/execute/va-arg-25.c: Move ... + * gcc.dg/torture/va-arg-25.c: ... here. + Add dg-do run. + Add dg-options -msse, dg-require-effective-target sse_runtime for + for i?86-*-*, x86_64-*-*. + * gcc.c-torture/execute/vector-1.c: Likewise. + * gcc.c-torture/execute/vector-2.c: Likewise. + * gcc.dg/tree-ssa/forwprop-5.c: Add -msse to dg-options for + i?86-*-*, x86_64-*-*. + * gcc.dg/tree-ssa/fre-vce-1.c: Likewise. + * gcc.dg/tree-ssa/sra-4.c: Likewise. + * gcc.dg/tree-ssa/vector-1.c: Likewise. + * gcc.dg/tree-ssa/vector-2.c: Likewise. + * gcc.target/i386/vect-args.c: Add -Wno-psabi to dg-options. + +2010-11-08 Steve Ellcey <sje@cup.hp.com> + + * gcc.dg/torture/pr45982.c: Add -std=c99 + * gcc.dg/torture/pr45623.c: Ditto. + +2010-11-08 Steve Ellcey <sje@cup.hp.com> + + * gcc/testsuite/g++.dg/abi/covariant1.C: Fix scan-assembler. + * gcc/testsuite/g++.dg/abi/covariant6.C: Ditto. + +2010-11-08 Kai Tietz <kai.tietz@onevision.com> + + PR target/28627 + * g++.dg/ext/dllimport7.C: Adjust second error check and + allow test for x86_64 mingw, too. + +2010-11-08 Janus Weil <janus@gcc.gnu.org> + + PR fortran/46344 + * gfortran.dg/class_28.f03: New. + +2010-11-08 Andrey Belevantsev <abel@ispras.ru> + + PR rtl-optimization/45352 + gcc.dg/pr45352.c, gcc.dg/pr45352-1.c, gcc.dg/pr45352-2.c: New tests. + gcc.target/i386/pr45352.c, gcc.target/i386/pr45352-1.c, + gcc.target/i386/pr45352-2.c: New tests. + +2010-11-06 Iain Sandoe <iains@gcc.gnu.org> + + PR libobjc/36610 + * objc.dg/torture/forward-1.m: Re-enable for gnu-runtime, XFAIL the run for + all but m32 x86. + +2010-11-07 Andreas Schwab <schwab@linux-m68k.org> + + * g++.dg/debug/dwarf2/nested-2.C: Adjust pattern to also match "|" + as comment character. + +2010-11-07 Richard Sandiford <rdsandiford@googlemail.com> + + * gcc.target/mips/mips.exp: Revert previous patch. + * gcc.target/mips/fma-1.c: Delete. + * gcc.target/mips/fma-2.c: Likewise. + * gcc.target/mips/fma-3.c: Likewise. + * gcc.target/mips/fma-4.c: Likewise. + * gcc.target/mips/fma-5.c: Likewise. + * gcc.target/mips/fma-6.c: Likewise. + * gcc.target/mips/fma-7.c: Likewise. + * gcc.target/mips/fma-8.c: Likewise. + * gcc.target/mips/fma-9.c: Likewise. + * gcc.target/mips/fma-10.c: Likewise. + * gcc.target/mips/fma-11.c: Likewise. + * gcc.target/mips/fma-12.c: Likewise. + * gcc.target/mips/fma-13.c: Likewise. + * gcc.target/mips/fma-14.c: Likewise. + * gcc.target/mips/fma-15.c: Likewise. + * gcc.target/mips/fma-16.c: Likewise. + * gcc.target/mips/fma-17.c: Likewise. + * gcc.target/mips/fma-18.c: Likewise. + * gcc.target/mips/fma-19.c: Likewise. + * gcc.target/mips/fma-20.c: Likewise. + +2010-11-07 Richard Sandiford <rdsandiford@googlemail.com> + + * gcc.target/mips/mips.exp: Add support for -ffp-contract. + * gcc.target/mips/fma-1.c: New test. + * gcc.target/mips/fma-2.c: Likewise. + * gcc.target/mips/fma-3.c: Likewise. + * gcc.target/mips/fma-4.c: Likewise. + * gcc.target/mips/fma-5.c: Likewise. + * gcc.target/mips/fma-6.c: Likewise. + * gcc.target/mips/fma-7.c: Likewise. + * gcc.target/mips/fma-8.c: Likewise. + * gcc.target/mips/fma-9.c: Likewise. + * gcc.target/mips/fma-10.c: Likewise. + * gcc.target/mips/fma-11.c: Likewise. + * gcc.target/mips/fma-12.c: Likewise. + * gcc.target/mips/fma-13.c: Likewise. + * gcc.target/mips/fma-14.c: Likewise. + * gcc.target/mips/fma-15.c: Likewise. + * gcc.target/mips/fma-16.c: Likewise. + * gcc.target/mips/fma-17.c: Likewise. + * gcc.target/mips/fma-18.c: Likewise. + * gcc.target/mips/fma-19.c: Likewise. + * gcc.target/mips/fma-20.c: Likewise. + +2010-11-06 Jason Merrill <jason@redhat.com> + + * g++.dg/cpp0x/constexpr-ctor3.C: New. + +2010-11-06 Simon Martin <simartin@users.sourceforge.net> + + PR c/43384 + * gcc.dg/parser-error-3.c: New test. + +2010-11-06 Nathan Froyd <froydnj@codesourcery.com> + + PR c++/45332 + * g++.dg/parse/semicolon2.C: New testcase. + * g++.dg/ext/asmspec1.C: Adjust. + * g++.dg/init/new13.C: Adjust. + * g++.dg/parse/ctor5.C: Adjust. + +2010-11-06 Janus Weil <janus@gcc.gnu.org> + + PR fortran/46330 + * gfortran.dg/class_27.f03: New. + +2010-11-06 Nicola Pero <nicola.pero@meta-innovation.com> + + Fixed using the Objective-C 2.0 dot-syntax with self and super. + * objc.dg/property/dotsyntax-5.m: New. + * objc.dg/property/dotsyntax-6.m: New. + * objc.dg/property/dotsyntax-7.m: New. + * objc.dg/property/dotsyntax-8.m: New. + * objc.dg/property/dotsyntax-9.m: New. + * objc.dg/property/dotsyntax-10.m: New. + * objc.dg/property/dotsyntax-11.m: New. + * obj-c++.dg/property/dotsyntax-5.mm: New. + * obj-c++.dg/property/dotsyntax-6.mm: New. + * obj-c++.dg/property/dotsyntax-7.mm: New. + * obj-c++.dg/property/dotsyntax-8.mm: New. + * obj-c++.dg/property/dotsyntax-9.mm: New. + * obj-c++.dg/property/dotsyntax-10.mm: New. + * obj-c++.dg/property/dotsyntax-11.mm: New. + +2010-11-06 Iain Sandoe <iains@gcc.gnu.org> + + * obj-c++.dg/encode-3.mm: Provide a different string check for the + NeXT runtime when the type is READONLY. + +2010-11-06 Uros Bizjak <ubizjak@gmail.com> + + * gcc.target/i386/387-2.c: Skip if -march= is specified. + * gcc.target/i386/387-6.c: Ditto. + * gcc.target/i386/387-3.c: Add -mfancy-math-387 to dg-options. + * gcc.target/i386/387-4.c: Ditto. + * gcc.target/i386/387-7.c: Ditto. + * gcc.target/i386/387-8.c: Ditto. + * gcc.target/i386/387-9.c: Ditto. + * gcc.target/i386/387-10.c: Ditto. + * gcc.target/i386/387-11.c: Ditto. + * gcc.target/i386/387-12.c: Ditto. + + * gcc.target/i386/funcspec-8.c: Add -mno-sse3 to dg-options. + +2010-11-06 Iain Sandoe <iains@gcc.gnu.org> + + PR target/44981 + * gcc.dg/darwin-cfstring-format-1.c: New. + * gcc.dg/warn-nsstring.c: New. + * objc.dg/fsf-nsstring-format-1.m: New. + * obj-c++.dg/fsf-nsstring-format-1.mm: New. + * obj-c++.dg/torture/strings/const-cfstring-1.mm: Update for darwin10 + linker warning. + +2010-11-05 Jason Merrill <jason@redhat.com> + + PR c++/45473 + * g++.dg/inherit/virtual6.C: New. + +2010-11-05 Jakub Jelinek <jakub@redhat.com> + + PR c/44772 + * gcc.dg/Wcxx-compat-21.c: New test. + +2010-11-05 Ian Lance Taylor <iant@google.com> + + PR target/46084 + * gcc.target/i386/pr46084.c: New test. + +2010-11-05 Steve Ellcey <sje@cup.hp.com> + + * lib/target-supports.exp (check_function_available): Use -fno-builtin. + * (check_effective_target_mempcpy): New. + * gcc.c-torture/execute/pr45636.c: Move this... + * gcc.dg/torture/pr45636.c: to here. Add add dg- directives. + 2010-11-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> * gcc.target/i386/i386.exp (FLAGS): Remove. @@ -72,8 +289,7 @@ 2010-11-04 Bud Davis <jimmied@smu.edu> - * gfortran.dg/intrinsic_numeric_arg.f: Add test to check - error message. + * gfortran.dg/intrinsic_numeric_arg.f: Add test to check error message. 2010-11-04 Chao-ying Fu <fu@mips.com> diff --git a/gcc/testsuite/g++.dg/abi/covariant1.C b/gcc/testsuite/g++.dg/abi/covariant1.C index ae8c5e603da..97737ddb94c 100644 --- a/gcc/testsuite/g++.dg/abi/covariant1.C +++ b/gcc/testsuite/g++.dg/abi/covariant1.C @@ -20,7 +20,7 @@ struct c14 : void c14::f() { } -// { dg-final { scan-assembler "_ZTcv0_n12_v0_n16_N3c143f17Ev" { target ilp32 } } } +// { dg-final { scan-assembler "_ZTcv0_n12_v0_n16_N3c143f17Ev" { target { ilp32 && { ! { ia64-*-hpux* } } } } } } // { dg-final { scan-assembler-not "_ZTch0_v0_n16_N3c143f17Ev" } } -// { dg-final { scan-assembler "_ZTcv0_n24_v0_n32_N3c143f17Ev" { target lp64 } } } +// { dg-final { scan-assembler "_ZTcv0_n24_v0_n32_N3c143f17Ev" { target { lp64 || { ia64-*-hpux* } } } } } // { dg-final { scan-assembler-not "_ZTch0_v0_n32_N3c143f17Ev" } } diff --git a/gcc/testsuite/g++.dg/abi/covariant6.C b/gcc/testsuite/g++.dg/abi/covariant6.C index 9dfc5ba74ab..143b4ad36cb 100644 --- a/gcc/testsuite/g++.dg/abi/covariant6.C +++ b/gcc/testsuite/g++.dg/abi/covariant6.C @@ -16,10 +16,10 @@ struct C: B C* C::f() { return 0; } // When we emit C::f, we should emit both thunks: one for B and one for A. -// { dg-final { scan-assembler "_ZTch0_v0_n16_N1C1fEv" { target ilp32 } } } -// { dg-final { scan-assembler "_ZTch0_v0_n32_N1C1fEv" { target lp64 } } } -// { dg-final { scan-assembler "_ZTcv0_n12_v0_n16_N1C1fEv" { target ilp32 } } } -// { dg-final { scan-assembler "_ZTcv0_n24_v0_n32_N1C1fEv" { target lp64 } } } +// { dg-final { scan-assembler "_ZTch0_v0_n16_N1C1fEv" { target { ilp32 && { ! { ia64-*-hpux* } } } } } } +// { dg-final { scan-assembler "_ZTch0_v0_n32_N1C1fEv" { target { lp64 || { ia64-*-hpux* } } } } } +// { dg-final { scan-assembler "_ZTcv0_n12_v0_n16_N1C1fEv" { target { ilp32 && { ! { ia64-*-hpux* } } } } } } +// { dg-final { scan-assembler "_ZTcv0_n24_v0_n32_N1C1fEv" { target { lp64 || { ia64-*-hpux* } } } } } struct D: B { @@ -30,5 +30,5 @@ struct D: B void D::dummy() { } // When we emit the D vtable, it should refer to the thunk for B. -// { dg-final { scan-assembler "_ZTch0_v0_n16_N1D1fEv" { target ilp32 } } } -// { dg-final { scan-assembler "_ZTch0_v0_n32_N1D1fEv" { target lp64 } } } +// { dg-final { scan-assembler "_ZTch0_v0_n16_N1D1fEv" { target { ilp32 && { ! { ia64-*-hpux* } } } } } } +// { dg-final { scan-assembler "_ZTch0_v0_n32_N1D1fEv" { target { lp64 || { ia64-*-hpux* } } } } } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor3.C new file mode 100644 index 00000000000..d5bfbad3d67 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor3.C @@ -0,0 +1,10 @@ +// PR c++/46348 +// { dg-options -std=c++0x } + +struct A +{ + int arr[1]; + + constexpr A() + : arr() { } +}; diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/nested-2.C b/gcc/testsuite/g++.dg/debug/dwarf2/nested-2.C index 65d382be4f9..5297a4e2b28 100644 --- a/gcc/testsuite/g++.dg/debug/dwarf2/nested-2.C +++ b/gcc/testsuite/g++.dg/debug/dwarf2/nested-2.C @@ -32,6 +32,6 @@ We want to express that the DIE of S::T<int> must be a child of the DIE of S, li Hence the slightly odd regexp: - { dg-final { scan-assembler "\[^\n\r\]*\\(DIE\[^\n\r\]*DW_TAG_structure_type\\)\[\n\r\]+\[^\n\r\]*\"S\\\\0\"\[ \t\]+\(@|#|!|//?\)\[ \t\]+DW_AT_name\[\n\r\]+\(.*\)?\\(DIE\[^\n\r\]*DW_TAG_structure_type\\)\[\n\r\]+\[^\n\r\]*\"T<int>\\\\0\"\[ \t\]+\(.*\)?\\(DIE\[^\n\r\]*DW_TAG_template_type_param\\)\[\n\r\]+\[^\n\r\]*\[\n\r\]+\[^\n\r\]*\[\n\r\]+\[^\n\r\]*\(@|#|!|//?\)\[ \t\]+end of children of DIE\[^\n\r\]*\[\n\r\]+\[^\n\r\]*end of children of DIE\[^\n\r\]*" } } + { dg-final { scan-assembler "\[^\n\r\]*\\(DIE\[^\n\r\]*DW_TAG_structure_type\\)\[\n\r\]+\[^\n\r\]*\"S\\\\0\"\[ \t\]+\(\[@|#!\]|//?\)\[ \t\]+DW_AT_name\[\n\r\]+\(.*\)?\\(DIE\[^\n\r\]*DW_TAG_structure_type\\)\[\n\r\]+\[^\n\r\]*\"T<int>\\\\0\"\[ \t\]+\(.*\)?\\(DIE\[^\n\r\]*DW_TAG_template_type_param\\)\[\n\r\]+\[^\n\r\]*\[\n\r\]+\[^\n\r\]*\[\n\r\]+\[^\n\r\]*\(\[@|#!\]|//?\)\[ \t\]+end of children of DIE\[^\n\r\]*\[\n\r\]+\[^\n\r\]*end of children of DIE\[^\n\r\]*" } } */ diff --git a/gcc/testsuite/g++.dg/eh/simd-2.C b/gcc/testsuite/g++.dg/eh/simd-2.C index da7ef495120..2761061c178 100644 --- a/gcc/testsuite/g++.dg/eh/simd-2.C +++ b/gcc/testsuite/g++.dg/eh/simd-2.C @@ -1,10 +1,11 @@ // Test EH when V4SI SIMD registers are involved. // Contributed by Aldy Hernandez (aldy@quesejoda.com). // { dg-options "-O -Wno-abi" } -// { dg-options "-O -w" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } +// { dg-options "-O -w -msse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } // { dg-options "-O -w" { target powerpc*-*-* } } // { dg-options "-O -w -maltivec" { target { powerpc*-*-* && vmx_hw } } } // { dg-do run } +// { dg-require-effective-target sse_runtime { target { { i?86-*-* x86_64-*-* } && ilp32 } } } #include "check-vect.h" diff --git a/gcc/testsuite/g++.dg/expr/overflow1.C b/gcc/testsuite/g++.dg/expr/overflow1.C new file mode 100644 index 00000000000..b67b4e42edd --- /dev/null +++ b/gcc/testsuite/g++.dg/expr/overflow1.C @@ -0,0 +1,8 @@ +#include <limits.h> + +enum E { + A = (unsigned char)-1, /* OK */ + B = (signed char)UCHAR_MAX, /* implementation-defined */ + C = INT_MAX+1, /* undefined (C)/ill-formed (C++) { dg-message "" } */ + D = UINT_MAX+1 /* OK */ +}; diff --git a/gcc/testsuite/g++.dg/ext/asmspec1.C b/gcc/testsuite/g++.dg/ext/asmspec1.C index 3df2483ad53..0661136fecc 100644 --- a/gcc/testsuite/g++.dg/ext/asmspec1.C +++ b/gcc/testsuite/g++.dg/ext/asmspec1.C @@ -3,6 +3,6 @@ struct A { - int i __asm__(int); // { dg-error "before" } - static int j __asm__(int); // { dg-error "before" } + int i __asm__(int); // { dg-error "expected" } + static int j __asm__(int); // { dg-error "expected" } }; diff --git a/gcc/testsuite/g++.dg/ext/dllimport7.C b/gcc/testsuite/g++.dg/ext/dllimport7.C index 8bf384889b5..0a79b3da33c 100644 --- a/gcc/testsuite/g++.dg/ext/dllimport7.C +++ b/gcc/testsuite/g++.dg/ext/dllimport7.C @@ -1,4 +1,4 @@ -// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} } +// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw* x86_64-*-mingw* } } // Report errors on definition of dllimport'd static data member . @@ -19,12 +19,9 @@ class __declspec(dllimport) Bar }; const int Bar::three = 3; // { dg-warning "redeclared without dllimport" } -// { dg-error "definition of static data" "C++ specific error" { target i?86-*-cygwin* i?86-*-mingw* } 21 } +// { dg-error "definition of static data" "C++ specific error" { target i?86-*-cygwin* i?86-*-mingw* x86_64-*-mingw* } 21 } const Baz Bar::null_baz; // { dg-warning "redeclared without dllimport" } -// { dg-error "definition of static data" "C++ specific error" { target i?86-*-cygwin* i?86-*-mingw* } 24 } - - int foo() { diff --git a/gcc/testsuite/g++.dg/inherit/virtual6.C b/gcc/testsuite/g++.dg/inherit/virtual6.C new file mode 100644 index 00000000000..f0369699321 --- /dev/null +++ b/gcc/testsuite/g++.dg/inherit/virtual6.C @@ -0,0 +1,15 @@ +// PR c++/45473 + +struct A +{ + virtual void B (); +}; + +struct B : A +{ + B (); +}; + +struct C : B +{ +}; diff --git a/gcc/testsuite/g++.dg/init/new13.C b/gcc/testsuite/g++.dg/init/new13.C index 3563c48808f..2ced6e3fe02 100644 --- a/gcc/testsuite/g++.dg/init/new13.C +++ b/gcc/testsuite/g++.dg/init/new13.C @@ -5,7 +5,7 @@ struct A { - void* operator new(__SIZE_TYPE__) throw(X); // { dg-error "" } + void* operator new(__SIZE_TYPE__) throw(X); // { dg-error "expected|type" } }; -A* p = new A; // { dg-error "no suitable" } +A* p = new A; diff --git a/gcc/testsuite/g++.dg/parse/ctor5.C b/gcc/testsuite/g++.dg/parse/ctor5.C index 819458598a3..3ea23549c0b 100644 --- a/gcc/testsuite/g++.dg/parse/ctor5.C +++ b/gcc/testsuite/g++.dg/parse/ctor5.C @@ -2,9 +2,9 @@ struct A { - int i; - A() i() {} // { dg-error "expected" } -}; // { dg-error "expected" } + int i; // { dg-error "conflicts" } + A() i() {} // { dg-error "declaration" } +}; struct B { diff --git a/gcc/testsuite/g++.dg/parse/semicolon2.C b/gcc/testsuite/g++.dg/parse/semicolon2.C new file mode 100644 index 00000000000..d14a225a674 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/semicolon2.C @@ -0,0 +1,9 @@ +// PR c++/45332 +// { dg-do compile } + +class C +{ + int x // { dg-error "at end of member declaration" } + + const int foo() { return x; } +}; diff --git a/gcc/testsuite/g++.dg/torture/pr36444.C b/gcc/testsuite/g++.dg/torture/pr36444.C index fd20bde3d47..ae639e25d2c 100644 --- a/gcc/testsuite/g++.dg/torture/pr36444.C +++ b/gcc/testsuite/g++.dg/torture/pr36444.C @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */ #define vector __attribute__((vector_size(16) )) struct struct1 { union {} vmx; diff --git a/gcc/testsuite/g++.dg/torture/pr36445.C b/gcc/testsuite/g++.dg/torture/pr36445.C index 39a7a553afd..56642e9ec73 100644 --- a/gcc/testsuite/g++.dg/torture/pr36445.C +++ b/gcc/testsuite/g++.dg/torture/pr36445.C @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */ // This used to fail as we would try to expand a VCE where one side had // a mode of BLKmode and the other side was a vector mode. #define vector __attribute__((vector_size(16) )) diff --git a/gcc/testsuite/g++.dg/warn/overflow-warn-1.C b/gcc/testsuite/g++.dg/warn/overflow-warn-1.C index 17bd06783dc..22c512a4f8f 100644 --- a/gcc/testsuite/g++.dg/warn/overflow-warn-1.C +++ b/gcc/testsuite/g++.dg/warn/overflow-warn-1.C @@ -1,7 +1,7 @@ /* Test for diagnostics for constant overflow. */ /* Origin: Joseph Myers <joseph@codesourcery.com> */ /* { dg-do compile } */ -/* { dg-options "" } */ +/* { dg-options "-fpermissive" } */ #include <limits.h> @@ -19,8 +19,10 @@ enum e { E4 = 0 * (1 / 0), /* { dg-warning "division by zero" } */ /* { dg-error "enumerator value for 'E4' is not an integer constant" "enum error" { xfail *-*-* } 19 } */ E5 = INT_MAX + 1, /* { dg-warning "integer overflow in expression" } */ + /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } 21 } */ /* Again, overflow in evaluated subexpression. */ E6 = 0 * (INT_MAX + 1), /* { dg-warning "integer overflow in expression" } */ + /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } 24 } */ /* A cast does not constitute overflow in conversion. */ E7 = (char) INT_MAX }; @@ -29,6 +31,7 @@ struct s { int a; int : 0 * (1 / 0); /* { dg-warning "division by zero" } */ int : 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */ + /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } 33 } */ }; void @@ -49,10 +52,10 @@ void *n = 0; constants. The third has the overflow in an unevaluated subexpression, so is a null pointer constant. */ void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */ -/* { dg-error "invalid conversion from 'int' to 'void" "null" { target *-*-* } 51 } */ +/* { dg-warning "invalid conversion from 'int' to 'void" "null" { target *-*-* } 54 } */ void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */ -/* { dg-error "invalid conversion from 'int' to 'void*'" "null" { xfail *-*-* } 53 } */ -void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } 55 } */ +/* { dg-error "invalid conversion from 'int' to 'void*'" "null" { xfail *-*-* } 56 } */ +void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } } */ void g (int i) @@ -62,6 +65,7 @@ g (int i) case 0 * (1/0): /* { dg-warning "division by zero" } */ ; case 1 + 0 * (INT_MAX + 1): /* { dg-warning "integer overflow in expression" } */ + /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } 67 } */ ; } } diff --git a/gcc/testsuite/g++.dg/warn/overflow-warn-3.C b/gcc/testsuite/g++.dg/warn/overflow-warn-3.C index ce03a9781e4..d88c87a5398 100644 --- a/gcc/testsuite/g++.dg/warn/overflow-warn-3.C +++ b/gcc/testsuite/g++.dg/warn/overflow-warn-3.C @@ -57,7 +57,7 @@ void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */ /* { dg-warning "invalid conversion from 'int' to 'void*'" "null" { xfail *-*-* } 58 } */ -void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } 60 } */ +void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } } */ void g (int i) diff --git a/gcc/testsuite/g++.dg/warn/overflow-warn-4.C b/gcc/testsuite/g++.dg/warn/overflow-warn-4.C index 0c916d0929c..374d29428a8 100644 --- a/gcc/testsuite/g++.dg/warn/overflow-warn-4.C +++ b/gcc/testsuite/g++.dg/warn/overflow-warn-4.C @@ -11,7 +11,7 @@ enum e { E1 = UINT_MAX + 1, /* Overflow in an unevaluated part of an expression is OK (example in the standard). */ - E2 = 2 || 1 / 0, /* { dg-bogus "warning: division by zero" "" { xfail *-*-* } 14 } */ + E2 = 2 || 1 / 0, /* { dg-bogus "warning: division by zero" "" { xfail *-*-* } } */ E3 = 1 / 0, /* { dg-warning "division by zero" } */ /* { dg-error "enumerator value for 'E3' is not an integer constant|not a constant expression" "enum error" { target *-*-* } 15 } */ /* But as in DR#031, the 1/0 in an evaluated subexpression means the @@ -20,9 +20,11 @@ enum e { /* { dg-error "enumerator value for 'E4' is not an integer constant" "enum error" { xfail *-*-* } 19 } */ E5 = INT_MAX + 1, /* { dg-warning "integer overflow in expression" } */ /* { dg-error "overflow in constant expression" "constant" { target *-*-* } 21 } */ + /* { dg-error "enumerator value for 'E5' is not an integer constant" "enum error" { target *-*-* } 21 } */ /* Again, overflow in evaluated subexpression. */ E6 = 0 * (INT_MAX + 1), /* { dg-warning "integer overflow in expression" } */ - /* { dg-error "overflow in constant expression" "constant" { target *-*-* } 24 } */ + /* { dg-error "overflow in constant expression" "constant" { target *-*-* } 25 } */ + /* { dg-error "enumerator value for 'E6' is not an integer constant" "enum error" { target *-*-* } 25 } */ /* A cast does not constitute overflow in conversion. */ E7 = (char) INT_MAX }; @@ -31,7 +33,8 @@ struct s { int a; int : 0 * (1 / 0); /* { dg-warning "division by zero" } */ int : 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */ - /* { dg-error "overflow in constant expression" "constant" { target *-*-* } 33 } */ + /* { dg-error "overflow in constant expression" "constant" { target *-*-* } 35 } */ + /* { dg-error "bit-field .* width not an integer constant" "" { target *-*-* } 35 } */ }; void @@ -53,11 +56,11 @@ void *n = 0; constants. The third has the overflow in an unevaluated subexpression, so is a null pointer constant. */ void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */ -/* { dg-error "invalid conversion from 'int' to 'void" "null" { target *-*-* } 55 } */ +/* { dg-error "invalid conversion from 'int' to 'void" "null" { target *-*-* } 58 } */ void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */ -/* { dg-error "invalid conversion from 'int' to 'void*'" "null" { xfail *-*-* } 58 } */ -void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } 60 } */ +/* { dg-error "invalid conversion from 'int' to 'void*'" "null" { xfail *-*-* } 61 } */ +void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } } */ void g (int i) @@ -67,7 +70,7 @@ g (int i) case 0 * (1/0): /* { dg-warning "division by zero" } */ ; case 1 + 0 * (INT_MAX + 1): /* { dg-warning "integer overflow in expression" } */ - /* { dg-error "overflow in constant expression" "constant" { target *-*-* } 69 } */ + /* { dg-error "overflow in constant expression" "constant" { target *-*-* } 72 } */ ; } } diff --git a/gcc/testsuite/g++.dg/warn/overflow-warn-5.C b/gcc/testsuite/g++.dg/warn/overflow-warn-5.C index 472d4a7cab1..bdfec4a6be1 100644 --- a/gcc/testsuite/g++.dg/warn/overflow-warn-5.C +++ b/gcc/testsuite/g++.dg/warn/overflow-warn-5.C @@ -1,7 +1,11 @@ /* PR c/27273 */ /* { dg-do compile } */ -/* { dg-options "-Woverflow" } */ + +// This used to warn about "overflow in implicit constant conversion", +// which was wrong; 512 is never converted to unsigned char. Rather, an +// appropriate warning would be that the & expression always evaluates to 0 +// because of the limited range of unsigned char. unsigned char rx_async(unsigned char p) { - return p & 512; /* { dg-warning "overflow in implicit constant conversion" } */ + return p & 512; /* { dg-warning "" "" { xfail *-*-* } } */ } diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34856.c b/gcc/testsuite/gcc.c-torture/compile/pr34856.c index a2f43690990..7b0d5962a60 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr34856.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr34856.c @@ -1,3 +1,4 @@ +/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */ #undef __vector #define __vector __attribute__((vector_size(16) )) typedef __vector signed char qword; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39928-1.c b/gcc/testsuite/gcc.c-torture/compile/pr39928-1.c index 3bee4380e5b..1abb5ccb505 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr39928-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr39928-1.c @@ -1,3 +1,4 @@ +/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */ typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__)); extern __m128 _mm_sub_ps (__m128 __A, __m128 __B); extern __m128 _mm_mul_ps (__m128 __A, __m128 __B); diff --git a/gcc/testsuite/gcc.c-torture/compile/vector-1.c b/gcc/testsuite/gcc.c-torture/compile/vector-1.c index d22afd55df5..9be0be19bca 100644 --- a/gcc/testsuite/gcc.c-torture/compile/vector-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/vector-1.c @@ -1,3 +1,4 @@ +/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */ #define vector __attribute__((vector_size(16) )) struct ss { diff --git a/gcc/testsuite/gcc.c-torture/compile/vector-2.c b/gcc/testsuite/gcc.c-torture/compile/vector-2.c index 930a9c1f870..e04d55588e5 100644 --- a/gcc/testsuite/gcc.c-torture/compile/vector-2.c +++ b/gcc/testsuite/gcc.c-torture/compile/vector-2.c @@ -1,3 +1,4 @@ +/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */ #define vector __attribute__((vector_size(16) )) struct ss { diff --git a/gcc/testsuite/gcc.dg/Wcxx-compat-21.c b/gcc/testsuite/gcc.dg/Wcxx-compat-21.c new file mode 100644 index 00000000000..183f0f17980 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wcxx-compat-21.c @@ -0,0 +1,25 @@ +/* PR c/44772 */ +/* { dg-do compile } */ +/* { dg-options "-Wc++-compat" } */ + +typedef enum { E1, E2 } E; + +typedef struct +{ + E e; + union + { + int i; + char *c; + }; /* { dg-bogus "as both field and typedef name" } */ +} S; + +S s; + +typedef int T; + +struct U +{ + T t; + union { int i; }; /* { dg-bogus "as both field and typedef name" } */ +}; diff --git a/gcc/testsuite/gcc.dg/darwin-cfstring-format-1.c b/gcc/testsuite/gcc.dg/darwin-cfstring-format-1.c new file mode 100644 index 00000000000..8771d526fe0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/darwin-cfstring-format-1.c @@ -0,0 +1,36 @@ +/* Check CFString format extensions. */ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-Wall" } */ + +extern int printf (const char *fmt, ...); + +typedef const struct __CFString * CFStringRef; + +#ifdef __CONSTANT_CFSTRINGS__ +#define CFSTR(cStr) ((CFStringRef) __builtin___CFStringMakeConstantString ("" cStr "")) +#else +#error requires CFString +#endif + +int s1 (CFStringRef fmt, ...) __attribute__((format(CFString, 1, 2))) ; /* OK */ +int s2 (int a, CFStringRef fmt, ... ) __attribute__((format(__CFString__, 2, 3))) ; /* OK */ + +int s2a (int a, CFStringRef fmt, ... ) __attribute__((format(CFString, 2, 2))) ; /* { dg-error "format string argument follows the args to be formatted" } */ + +int s3 (const char *fmt, ... ) __attribute__((format(__CFString__, 1, 2))) ; /* { dg-error "format argument should be a .CFString. reference but a string was found" } */ +int s4 (CFStringRef fmt, ... ) __attribute__((format(printf, 1, 2))) ; /* { dg-error "found a .CFStringRef. but the format argument should be a string" } */ + +char *s5 (char dum, char *fmt1, ... ) __attribute__((format_arg(2))) ; /* OK */ +CFStringRef s6 (CFStringRef dum, CFStringRef fmt1, ... ) __attribute__((format_arg(2))) ; /* OK */ + +char *s7 (int dum, void *fmt1, ... ) __attribute__((format_arg(2))) ; /* { dg-error "format string argument is not a string type" } */ +int s8 (CFStringRef dum, CFStringRef fmt1, ... ) __attribute__((format_arg(2))) ; /* { dg-error "function does not return string type" } */ + +void foo (void) +{ + CFStringRef notchk = CFSTR ("here is an unchecked %d %s string"); + s1 (notchk, 5, 6, 7); + printf("this one is checked %d %s", 3, 4, 5); /* { dg-warning "format .%s. expects type .char .., but argument 3 has type .int." } */ + /* { dg-warning "too many arguments for format" "" { target *-*-* } 33 } */ + printf(s5 (1, "and so is this %d %d %s", 3, 4, "hey", 6), 5, 6, 12);/* { dg-warning "format .%s. expects type .char .., but argument 4 has type .int." } */ +}
\ No newline at end of file diff --git a/gcc/testsuite/gcc.dg/parse-error-3.c b/gcc/testsuite/gcc.dg/parse-error-3.c new file mode 100644 index 00000000000..1a463b5dd6b --- /dev/null +++ b/gcc/testsuite/gcc.dg/parse-error-3.c @@ -0,0 +1,14 @@ +/* PR c/43384 */ +/* { dg-do "compile" } */ + +void c_direct(par) + void *par = &&lab; /* { dg-error "is initialized|non-standard|outside of" } */ +{} + +void foo(p, q) + int *p = &q; /* { dg-error "initialized|undeclared" } */ +{} + +void bar(i) + int j = i; /* { dg-error "initialized|undeclared|no such parameter" } */ +{} diff --git a/gcc/testsuite/gcc.dg/pr32912-1.c b/gcc/testsuite/gcc.dg/pr32912-1.c index 1ceb77ad43c..4fcc29a9cc8 100644 --- a/gcc/testsuite/gcc.dg/pr32912-1.c +++ b/gcc/testsuite/gcc.dg/pr32912-1.c @@ -2,6 +2,8 @@ /* { dg-do run } */ /* { dg-options "-O2 -w" } */ /* { dg-options "-O2 -w -fno-common" { target hppa*-*-hpux* } } */ +/* { dg-options "-O2 -w -msse" { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-require-effective-target sse_runtime { target { i?86-*-* x86_64-*-* } } } */ extern void abort (void); diff --git a/gcc/testsuite/gcc.dg/pr35442.c b/gcc/testsuite/gcc.dg/pr35442.c index 875cb0b31b6..206853b9ef0 100644 --- a/gcc/testsuite/gcc.dg/pr35442.c +++ b/gcc/testsuite/gcc.dg/pr35442.c @@ -11,4 +11,4 @@ foo (A a) } /* Ignore a warning that is irrelevant to the purpose of this test. */ -/* { dg-prune-output "(.*GCC vector passed by reference.*|.*ABI of * passing parameter with.*)" } */ +/* { dg-prune-output "(.*GCC vector passed by reference.*|.*ABI for * passing parameters with.*)" } */ diff --git a/gcc/testsuite/gcc.dg/pr45352-1.c b/gcc/testsuite/gcc.dg/pr45352-1.c new file mode 100644 index 00000000000..3b092cd13ed --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr45352-1.c @@ -0,0 +1,13 @@ +/* { dg-do compile { target powerpc*-*-* ia64-*-* x86_64-*-* } } */ +/* { dg-options "-O3 -fschedule-insns -fschedule-insns2 -fselective-scheduling2 -fsel-sched-pipelining -funroll-loops -fprefetch-loop-arrays" } */ + +void main1 (float *pa, float *pc) +{ + int i; + float b[256]; + float c[256]; + for (i = 0; i < 256; i++) + b[i] = c[i] = pc[i]; + for (i = 0; i < 256; i++) + pa[i] = b[i] * c[i]; +} diff --git a/gcc/testsuite/gcc.dg/pr45352-2.c b/gcc/testsuite/gcc.dg/pr45352-2.c new file mode 100644 index 00000000000..eed3847177c --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr45352-2.c @@ -0,0 +1,17 @@ +/* { dg-do compile { target powerpc*-*-* ia64-*-* x86_64-*-* } } */ +/* { dg-options "-O1 -freorder-blocks -fschedule-insns2 -funswitch-loops -fselective-scheduling2 -fsel-sched-pipelining -funroll-all-loops" } */ +void +foo1 (int *s) +{ + s[0] = s[1]; + while (s[6] - s[8]) + { + s[6] -= s[8]; + if (s[8] || s[0]) + { + s[3] += s[0]; + s[4] += s[1]; + } + s[7]++; + } +} diff --git a/gcc/testsuite/gcc.dg/pr45352.c b/gcc/testsuite/gcc.dg/pr45352.c new file mode 100644 index 00000000000..75f9a213706 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr45352.c @@ -0,0 +1,24 @@ +/* { dg-do compile { target powerpc*-*-* ia64-*-* x86_64-*-* } } */ +/* { dg-options "-Os -fselective-scheduling2 -fsel-sched-pipelining -fprofile-generate" } */ + +static inline void +bmp_iter_next (int *bi, int *bit_no) +{ + *bi >>= 1; + *bit_no += 1; +} + +int bmp_iter_set (int *bi, int *bit_no); +void bitmap_initialize_stat (int, ...); +void bitmap_clear (void); + +void +df_md_alloc (int bi, int bb_index, void *bb_info) +{ + for (; bmp_iter_set (&bi, &bb_index); bmp_iter_next (&bi, &bb_index)) + + if (bb_info) + bitmap_clear (); + else + bitmap_initialize_stat (0); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr45623.c b/gcc/testsuite/gcc.dg/torture/pr45623.c index 2f07d2554b5..693a8c4c7be 100644 --- a/gcc/testsuite/gcc.dg/torture/pr45623.c +++ b/gcc/testsuite/gcc.dg/torture/pr45623.c @@ -1,4 +1,5 @@ /* { dg-do run } */ +/* { dg-options "-std=c99" } */ #include <stdint.h> diff --git a/gcc/testsuite/gcc.c-torture/execute/pr45636.c b/gcc/testsuite/gcc.dg/torture/pr45636.c index 031c8037ffc..0566de86e16 100644 --- a/gcc/testsuite/gcc.c-torture/execute/pr45636.c +++ b/gcc/testsuite/gcc.dg/torture/pr45636.c @@ -1,3 +1,5 @@ +/* { dg-do run } */ +/* { dg-require-effective-target mempcpy } */ /* PR fortran/45636 */ typedef __SIZE_TYPE__ size_t; diff --git a/gcc/testsuite/gcc.dg/torture/pr45982.c b/gcc/testsuite/gcc.dg/torture/pr45982.c index 497b0a9807a..4aea6a8d8e4 100644 --- a/gcc/testsuite/gcc.dg/torture/pr45982.c +++ b/gcc/testsuite/gcc.dg/torture/pr45982.c @@ -1,4 +1,5 @@ /* { dg-do run } */ +/* { dg-options "-std=c99" } */ #include <stdint.h> diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-25.c b/gcc/testsuite/gcc.dg/torture/va-arg-25.c index b9f3a1b1237..8496460d28c 100644 --- a/gcc/testsuite/gcc.c-torture/execute/va-arg-25.c +++ b/gcc/testsuite/gcc.dg/torture/va-arg-25.c @@ -1,6 +1,11 @@ /* Varargs and vectors! */ +/* { dg-do run } */ +/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-require-effective-target sse_runtime { target { i?86-*-* x86_64-*-* } } } */ + #include <stdarg.h> +#include <stdlib.h> #include <limits.h> #define vector __attribute__((vector_size(16))) diff --git a/gcc/testsuite/gcc.c-torture/execute/vector-1.c b/gcc/testsuite/gcc.dg/torture/vector-1.c index ff21d68ca7b..9ab78aaf53e 100644 --- a/gcc/testsuite/gcc.c-torture/execute/vector-1.c +++ b/gcc/testsuite/gcc.dg/torture/vector-1.c @@ -1,5 +1,9 @@ /* Check that vector extraction works correctly. */ +/* { dg-do run } */ +/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-require-effective-target sse_runtime { target { i?86-*-* x86_64-*-* } } } */ + #define vector __attribute__((vector_size(16) )) int f0(vector int t) diff --git a/gcc/testsuite/gcc.c-torture/execute/vector-2.c b/gcc/testsuite/gcc.dg/torture/vector-2.c index 55330dd6606..bff9f82cdad 100644 --- a/gcc/testsuite/gcc.c-torture/execute/vector-2.c +++ b/gcc/testsuite/gcc.dg/torture/vector-2.c @@ -1,5 +1,9 @@ /* Check that vector insertion works correctly. */ +/* { dg-do run } */ +/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-require-effective-target sse_runtime { target { i?86-*-* x86_64-*-* } } } */ + #define vector __attribute__((vector_size(16) )) vector int f0(vector int t, int a) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-5.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-5.c index f2ddab2535b..033c60dae0a 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-5.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-5.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O1 -fdump-tree-optimized -w" } */ +/* { dg-options "-O1 -fdump-tree-optimized -w -msse" { target { i?86-*-* x86_64-*-* } } } */ #define vector __attribute__((vector_size(16) )) struct VecClass diff --git a/gcc/testsuite/gcc.dg/tree-ssa/fre-vce-1.c b/gcc/testsuite/gcc.dg/tree-ssa/fre-vce-1.c index 2442b93231a..599d1f1efd5 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/fre-vce-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/fre-vce-1.c @@ -1,4 +1,5 @@ /* { dg-options "-O2 -fdump-tree-fre -w" } */ +/* { dg-options "-O2 -fdump-tree-fre -w -msse" { target { i?86-*-* x86_64-*-* } } } */ /* { dg-do compile } */ #define vector __attribute__((vector_size(sizeof(int)*4) )) struct s { vector int i; }; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/sra-4.c b/gcc/testsuite/gcc.dg/tree-ssa/sra-4.c index 73a68f90043..e6ca7561f7f 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/sra-4.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/sra-4.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O1 -fdump-tree-optimized -w" } */ -/* Check that SRA replaces strucutres containing vectors. */ +/* { dg-options "-O1 -fdump-tree-optimized -w -msse" { target { i?86-*-* x86_64-*-* } } } */ +/* Check that SRA replaces structures containing vectors. */ #define vector __attribute__((vector_size(16))) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vector-1.c b/gcc/testsuite/gcc.dg/tree-ssa/vector-1.c index 5b07c67a2c6..6fe0e872bb9 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vector-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vector-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-w -O1 -fdump-tree-gimple" } */ +/* { dg-options "-w -O1 -fdump-tree-gimple -msse" { target { i?86-*-* x86_64-*-* } } } */ /* We should be able to produce a BIT_FIELD_REF for each of these vector access. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vector-2.c b/gcc/testsuite/gcc.dg/tree-ssa/vector-2.c index cb680937a2f..e34532d3faa 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vector-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vector-2.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-w -O1 -fdump-tree-optimized" } */ +/* { dg-options "-w -O1 -fdump-tree-optimized -msse" { target { i?86-*-* x86_64-*-* } } } */ #define vector __attribute__(( vector_size(16) )) diff --git a/gcc/testsuite/gcc.dg/warn-nsstring.c b/gcc/testsuite/gcc.dg/warn-nsstring.c new file mode 100644 index 00000000000..3795fb7376b --- /dev/null +++ b/gcc/testsuite/gcc.dg/warn-nsstring.c @@ -0,0 +1,7 @@ +/* Check that the NSString format extension is rejected in c. */ +/* { dg-do compile } */ + +extern void NSLog (void *fmt, ...) __attribute__((format(__NSString__, 1, 2))); /* { dg-warning "is only allowed in Objective-C dialects" } */ +extern void NSLog1 (void *fmt, ...) __attribute__((format(NSString, 1, 2))); /* { dg-warning "is only allowed in Objective-C dialects" } */ + + diff --git a/gcc/testsuite/gcc.target/i386/387-10.c b/gcc/testsuite/gcc.target/i386/387-10.c index 565f0196e88..0ff1b2a7c7c 100644 --- a/gcc/testsuite/gcc.target/i386/387-10.c +++ b/gcc/testsuite/gcc.target/i386/387-10.c @@ -1,6 +1,6 @@ /* PR tree-optimization/24964 */ /* { dg-do compile } */ -/* { dg-options "-O2 -mfpmath=387" } */ +/* { dg-options "-O2 -mfpmath=387 -mfancy-math-387" } */ double fabs(double x); diff --git a/gcc/testsuite/gcc.target/i386/387-11.c b/gcc/testsuite/gcc.target/i386/387-11.c index 03020f64fde..869f6061c38 100644 --- a/gcc/testsuite/gcc.target/i386/387-11.c +++ b/gcc/testsuite/gcc.target/i386/387-11.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mfpmath=387" } */ +/* { dg-options "-O2 -mfpmath=387 -mfancy-math-387" } */ double foo(double x, double y) { diff --git a/gcc/testsuite/gcc.target/i386/387-12.c b/gcc/testsuite/gcc.target/i386/387-12.c index 6b3ce240540..62c1d483c27 100644 --- a/gcc/testsuite/gcc.target/i386/387-12.c +++ b/gcc/testsuite/gcc.target/i386/387-12.c @@ -1,7 +1,6 @@ /* PR target/26915 */ /* { dg-do compile } */ -/* { dg-require-effective-target ilp32 } */ -/* { dg-options "-O" } */ +/* { dg-options "-O -mfpmath=387 -mfancy-math-387" } */ double testm0(void) { diff --git a/gcc/testsuite/gcc.target/i386/387-2.c b/gcc/testsuite/gcc.target/i386/387-2.c index 5a317efea57..bd6dbcdda99 100644 --- a/gcc/testsuite/gcc.target/i386/387-2.c +++ b/gcc/testsuite/gcc.target/i386/387-2.c @@ -1,6 +1,7 @@ /* Verify that -march overrides -mno-fancy-math-387. */ /* { dg-do compile } */ /* { dg-require-effective-target ilp32 } */ +/* { dg-skip-if "" { i?86-*-* x86_64-*-* } { "-march=*" } { "-march=i686" } } */ /* { dg-options "-O -ffast-math -mfpmath=387 -march=i686 -mno-fancy-math-387" } */ /* { dg-final { scan-assembler "fsin" } } */ /* { dg-final { scan-assembler "fcos" } } */ diff --git a/gcc/testsuite/gcc.target/i386/387-3.c b/gcc/testsuite/gcc.target/i386/387-3.c index ce11faa8f86..d00c7296721 100644 --- a/gcc/testsuite/gcc.target/i386/387-3.c +++ b/gcc/testsuite/gcc.target/i386/387-3.c @@ -1,7 +1,6 @@ /* Verify that 387 mathematical constants are recognized. */ /* { dg-do compile } */ -/* { dg-require-effective-target ilp32 } */ -/* { dg-options "-O2 -march=i686" } */ +/* { dg-options "-O2 -mfpmath=387 -mfancy-math-387" } */ /* { dg-final { scan-assembler "fldpi" } } */ long double add_pi(long double x) diff --git a/gcc/testsuite/gcc.target/i386/387-4.c b/gcc/testsuite/gcc.target/i386/387-4.c index 5617636da56..e4f4a48f2ef 100644 --- a/gcc/testsuite/gcc.target/i386/387-4.c +++ b/gcc/testsuite/gcc.target/i386/387-4.c @@ -1,6 +1,5 @@ /* { dg-do compile } */ -/* { dg-require-effective-target ilp32 } */ -/* { dg-options "-O2 -march=i686" } */ +/* { dg-options "-O2 -mfancy-math-387" } */ /* { dg-final { scan-assembler "fldpi" } } */ long double atanl (long double); diff --git a/gcc/testsuite/gcc.target/i386/387-6.c b/gcc/testsuite/gcc.target/i386/387-6.c index bfef46ae5f5..7b254d1302f 100644 --- a/gcc/testsuite/gcc.target/i386/387-6.c +++ b/gcc/testsuite/gcc.target/i386/387-6.c @@ -1,6 +1,7 @@ /* Verify that -march overrides -mno-fancy-math-387. */ /* { dg-do compile } */ /* { dg-require-effective-target ilp32 } */ +/* { dg-skip-if "" { i?86-*-* x86_64-*-* } { "-march=*" } { "-march=i686" } } */ /* { dg-options "-O -ffast-math -mfpmath=387 -march=i686 -mno-fancy-math-387" } */ /* { dg-final { scan-assembler "fpatan" } } */ /* { dg-final { scan-assembler "fyl2xp1" } } */ diff --git a/gcc/testsuite/gcc.target/i386/387-7.c b/gcc/testsuite/gcc.target/i386/387-7.c index 61c82c95eed..e01ed2e0576 100644 --- a/gcc/testsuite/gcc.target/i386/387-7.c +++ b/gcc/testsuite/gcc.target/i386/387-7.c @@ -1,7 +1,6 @@ /* Verify that 387 fsincos instruction is generated. */ /* { dg-do compile } */ -/* { dg-require-effective-target ilp32 } */ -/* { dg-options "-O -ffast-math -march=i686" } */ +/* { dg-options "-O -ffast-math -mfpmath=387 -mfancy-math-387" } */ /* { dg-final { scan-assembler "fsincos" } } */ extern double sin (double); diff --git a/gcc/testsuite/gcc.target/i386/387-8.c b/gcc/testsuite/gcc.target/i386/387-8.c index 3293f560c25..2dbcd740f62 100644 --- a/gcc/testsuite/gcc.target/i386/387-8.c +++ b/gcc/testsuite/gcc.target/i386/387-8.c @@ -2,8 +2,7 @@ inherent load of 1.0 is used in further calculations. */ /* { dg-do compile } */ -/* { dg-require-effective-target ilp32 } */ -/* { dg-options "-O2 -ffast-math -march=i686" } */ +/* { dg-options "-O2 -ffast-math -mfpmath=387 -mfancy-math-387" } */ /* { dg-final { scan-assembler "fptan" } } */ /* { dg-final { scan-assembler-not "fld1" } } */ diff --git a/gcc/testsuite/gcc.target/i386/387-9.c b/gcc/testsuite/gcc.target/i386/387-9.c index 9d126aff8dd..2667aa46872 100644 --- a/gcc/testsuite/gcc.target/i386/387-9.c +++ b/gcc/testsuite/gcc.target/i386/387-9.c @@ -1,7 +1,6 @@ /* Verify that 387 fsincos instruction is generated. */ /* { dg-do compile } */ -/* { dg-require-effective-target ilp32 } */ -/* { dg-options "-O -funsafe-math-optimizations -march=i686" } */ +/* { dg-options "-O -funsafe-math-optimizations -mfpmath=387 -mfancy-math-387" } */ extern double sin (double); extern double cos (double); diff --git a/gcc/testsuite/gcc.target/i386/funcspec-8.c b/gcc/testsuite/gcc.target/i386/funcspec-8.c index ba4b7f22743..225843493d9 100644 --- a/gcc/testsuite/gcc.target/i386/funcspec-8.c +++ b/gcc/testsuite/gcc.target/i386/funcspec-8.c @@ -2,7 +2,7 @@ functions in functions with the appropriate function specific options. */ /* { dg-do compile } */ /* { dg-skip-if "" { i?86-*-* x86_64-*-* } { "-march=*" } { "-march=k8" } } */ -/* { dg-options "-O2 -march=k8 -mfpmath=sse" } */ +/* { dg-options "-O2 -march=k8 -mno-sse3 -mfpmath=sse" } */ typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__)); typedef double __m128d __attribute__ ((__vector_size__ (16), __may_alias__)); diff --git a/gcc/testsuite/gcc.target/i386/pr45352-1.c b/gcc/testsuite/gcc.target/i386/pr45352-1.c new file mode 100644 index 00000000000..5cd1bd842d8 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr45352-1.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-mtune=amdfam10 -O3 -fpeel-loops -fselective-scheduling2 -fsel-sched-pipelining -fPIC" } */ + +static int FIR_Tab_16[16][16]; + +void +V_Pass_Avrg_16_C_ref (int *Dst, int *Src, int W, int BpS, int Rnd) +{ + while (W-- > 0) + { + int i, k; + int Sums[16] = { }; + for (i = 0; i < 16; ++i) + for (k = 0; k < 16; ++k) + Sums[k] += FIR_Tab_16[i][k] * Src[i]; + for (i = 0; i < 16; ++i) + Dst[i] = Sums[i] + Src[i]; + } +} diff --git a/gcc/testsuite/gcc.target/i386/pr45352-2.c b/gcc/testsuite/gcc.target/i386/pr45352-2.c new file mode 100644 index 00000000000..58713af869f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr45352-2.c @@ -0,0 +1,108 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -mtune=amdfam10 -fexpensive-optimizations -fgcse -foptimize-register-move -freorder-blocks -fschedule-insns2 -funswitch-loops -fgcse-las -fselective-scheduling2 -fsel-sched-pipelining -funroll-all-loops" } */ + +typedef char uint8_t; +typedef uint32_t; +typedef vo_frame_t; +struct vo_frame_s +{ + uint8_t base[3]; + int pitches[3];}; +typedef struct +{ +void + (*proc_macro_block) + (void); +} +xine_xvmc_t; +typedef struct +{ + uint8_t ref[2][3]; +int pmv; +} +motion_t; +typedef struct +{ + uint32_t bitstream_buf; + int bitstream_bits; + uint8_t * bitstream_ptr; + uint8_t dest[3]; + int pitches[3]; + int offset; + motion_t b_motion; + motion_t f_motion; + int v_offset; + int coded_picture_width; + int picture_structure; +struct vo_frame_s *current_frame;} +picture_t; +typedef struct +{ +int xvmc_last_slice_code;} +mpeg2dec_accel_t; +static bitstream_init (picture_t * picture, void *start) +{ + picture->bitstream_ptr = start; +} +static slice_xvmc_init (picture_t * picture, int code) +{ + int offset; + struct vo_frame_s *forward_reference_frame; + offset = picture->picture_structure == 2; + picture->pitches[0] = picture->current_frame->pitches[0]; + picture->pitches[1] = picture->current_frame->pitches[1]; + if (picture) + picture->f_motion.ref + [0] + [0] + = forward_reference_frame->base + (offset ? picture->pitches[0] : 0); + picture->f_motion.ref[0][1] = (offset); + if (picture->picture_structure) + picture->pitches[0] <<= picture->pitches[1] <<= 1; + offset = 0; + while (1) + { + if (picture->bitstream_buf >= 0x08000000) + break; + switch (picture->bitstream_buf >> 12) + { + case 8: + offset += 33; + picture->bitstream_buf + |= + picture->bitstream_ptr[1] << picture->bitstream_bits; + } + } + picture->offset = (offset); + while (picture->offset - picture->coded_picture_width >= 0) + { + picture->offset -= picture->coded_picture_width; + if (picture->current_frame) + { + picture->dest[0] += picture->pitches[0]; + picture->dest[1] += picture->pitches[1]; + } + picture->v_offset += 16; + } +} + +void +mpeg2_xvmc_slice + (mpeg2dec_accel_t * accel, picture_t * picture, int code, uint8_t buffer,int mba_inc) +{ + xine_xvmc_t * xvmc = bitstream_init (picture, buffer); + slice_xvmc_init (picture, code); + while (1) + { + if (picture) + break; + switch (picture->bitstream_buf) + { + case 8: + mba_inc += accel->xvmc_last_slice_code = code; + xvmc->proc_macro_block (); + while (mba_inc) + ; + } + } +} diff --git a/gcc/testsuite/gcc.target/i386/pr45352.c b/gcc/testsuite/gcc.target/i386/pr45352.c new file mode 100644 index 00000000000..ef710ce6b91 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr45352.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=amdfam10 -fselective-scheduling2 -fsel-sched-pipelining -funroll-all-loops" } */ + +struct S +{ + struct + { + int i; + } **p; + int x; + int y; +}; + +extern int baz (void); +extern int bar (void *, int, int); + +void +foo (struct S *s) +{ + int i; + for (i = 0; i < s->x; i++) + bar (s->p[i], baz (), s->y); + for (i = 0; i < s->x; i++) + s->p[i]->i++; +} diff --git a/gcc/testsuite/gcc.target/i386/pr46084.c b/gcc/testsuite/gcc.target/i386/pr46084.c new file mode 100644 index 00000000000..88bcd1ca5e0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr46084.c @@ -0,0 +1,69 @@ +/* This test needs to use setrlimit to set the stack size, so it can + only run on Unix. */ +/* { dg-do run { target *-*-linux* *-*-solaris* *-*-darwin* } } */ +/* { dg-require-effective-target avx } */ +/* { dg-require-effective-target split_stack } */ +/* { dg-options "-fsplit-stack -O2 -mavx" } */ + +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <sys/resource.h> + +/* Use a noinline function to ensure that the buffer is not removed + from the stack. */ +static void use_buffer (char *buf, size_t) __attribute__ ((noinline)); +static void +use_buffer (char *buf, size_t c) +{ + size_t i; + + for (i = 0; i < c; ++i) + buf[i] = (char) i; +} + +/* Each recursive call uses 10 * i bytes. We call it 1000 times, + using a total of 5,000,000 bytes. If -fsplit-stack is not working, + that will overflow our stack limit. */ + +static void +down1 (int i) +{ + char buf[10 * i]; + + if (i > 0) + { + use_buffer (buf, 10 * i); + down1 (i - 1); + } +} + +/* Same thing, using alloca. */ + +static void +down2 (int i) +{ + char *buf = alloca (10 * i); + + if (i > 0) + { + use_buffer (buf, 10 * i); + down2 (i - 1); + } +} + +int +main (void) +{ + struct rlimit r; + + /* We set a stack limit because we are usually invoked via make, and + make sets the stack limit to be as large as possible. */ + r.rlim_cur = 8192 * 1024; + r.rlim_max = 8192 * 1024; + if (setrlimit (RLIMIT_STACK, &r) != 0) + abort (); + down1 (1000); + down2 (1000); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/vect-args.c b/gcc/testsuite/gcc.target/i386/vect-args.c index 94b602d913a..fc458896ea1 100644 --- a/gcc/testsuite/gcc.target/i386/vect-args.c +++ b/gcc/testsuite/gcc.target/i386/vect-args.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-w" } */ +/* { dg-options "-w -Wno-psabi" } */ /* SSE1 and SSE2 modes. */ typedef unsigned char V16QImode __attribute__((vector_size(16))); diff --git a/gcc/testsuite/gfortran.dg/class_27.f03 b/gcc/testsuite/gfortran.dg/class_27.f03 new file mode 100644 index 00000000000..c3a3c902eae --- /dev/null +++ b/gcc/testsuite/gfortran.dg/class_27.f03 @@ -0,0 +1,67 @@ +! { dg-do compile } +! +! PR 46330: [4.6 Regression] [OOP] ICE after revision 166368 +! +! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr> +! Taken from http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/76f99e7fd4f3e772 + +module type2_type + implicit none + type, abstract :: Type2 + end type Type2 +end module type2_type + +module extended2A_type + use type2_type + implicit none + type, extends(Type2) :: Extended2A + real(kind(1.0D0)) :: coeff1 = 1. + contains + procedure :: setCoeff1 => Extended2A_setCoeff1 + end type Extended2A + contains + function Extended2A_new(c1, c2) result(typePtr_) + real(kind(1.0D0)), optional, intent(in) :: c1 + real(kind(1.0D0)), optional, intent(in) :: c2 + type(Extended2A), pointer :: typePtr_ + type(Extended2A), save, allocatable, target :: type_ + allocate(type_) + typePtr_ => null() + if (present(c1)) call type_%setCoeff1(c1) + typePtr_ => type_ + if ( .not.(associated (typePtr_))) then + stop 'Error initializing Extended2A Pointer.' + endif + end function Extended2A_new + subroutine Extended2A_setCoeff1(this,c1) + class(Extended2A) :: this + real(kind(1.0D0)), intent(in) :: c1 + this% coeff1 = c1 + end subroutine Extended2A_setCoeff1 +end module extended2A_type + +module type1_type + use type2_type + implicit none + type Type1 + class(type2), pointer :: type2Ptr => null() + contains + procedure :: initProc => Type1_initProc + end type Type1 + contains + function Type1_initProc(this) result(iError) + use extended2A_type + implicit none + class(Type1) :: this + integer :: iError + this% type2Ptr => extended2A_new() + if ( .not.( associated(this% type2Ptr))) then + iError = 1 + write(*,'(A)') "Something Wrong." + else + iError = 0 + endif + end function Type1_initProc +end module type1_type + +! { dg-final { cleanup-modules "type2_type extended2A_type type1_type" } } diff --git a/gcc/testsuite/gfortran.dg/class_28.f03 b/gcc/testsuite/gfortran.dg/class_28.f03 new file mode 100644 index 00000000000..cfd46a8eb65 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/class_28.f03 @@ -0,0 +1,30 @@ +! { dg-do compile } +! +! PR 46344: [4.6 Regression] [OOP] ICE with allocatable CLASS components +! +! Contributed by Salvatore Filippone <sfilippone@uniroma2.it> + +module m + + type t1 + end type + + type t2 + class(t1), allocatable :: cc + end type + + class(t2), allocatable :: sm + +end module m + +program p + use m + implicit none + + type(t2), allocatable :: x(:) + + allocate(x(1)) + +end program p + +! { dg-final { cleanup-modules "m" } } diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index f387d7e7233..751c1c51577 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -1366,7 +1366,7 @@ proc check_function_available { function } { #endif char $function (); int main () { $function (); } - }]] + }] "-fno-builtin" ] } # Returns true iff "fork" is available on the target system. @@ -3741,3 +3741,9 @@ proc check_effective_target_run_expensive_tests { } { } return 0 } + +# Returns 1 if "mempcpy" is available on the target system. + +proc check_effective_target_mempcpy {} { + return [check_function_available "mempcpy"] +} diff --git a/gcc/testsuite/obj-c++.dg/encode-3.mm b/gcc/testsuite/obj-c++.dg/encode-3.mm index 44f288d7de0..1486a652a0d 100644 --- a/gcc/testsuite/obj-c++.dg/encode-3.mm +++ b/gcc/testsuite/obj-c++.dg/encode-3.mm @@ -32,6 +32,15 @@ const char *enc3 = @encode(anonymous); #define L "l" #endif +/* Darwin (at least, as of XCode 3.2.3/Darwin10) does not encode the read-only + attribute on the type. Arguably, this is a bug, but we are compatible + with this when -fnext-runtime is selected. */ +#ifdef __NEXT_RUNTIME__ +#define E3 "{?=f[10d]i" L "q{Vec<const signed char>=cc" L "q}}" +#else +#define E3 "{?=f[10d]i" L "q{Vec<const signed char>=rcrc" L "q}}" +#endif + int main(void) { const char *encode = @encode(long); @@ -44,7 +53,7 @@ int main(void) { if (strcmp (enc2, (const char *)"{Vec<double>=dd" L "q}")) abort (); - if (strcmp (enc3, (const char *)"{?=f[10d]i" L "q{Vec<const signed char>=rcrc" L "q}}")) + if (strcmp (enc3, (const char *) E3)) abort (); return 0; diff --git a/gcc/testsuite/obj-c++.dg/fsf-nsstring-format-1.mm b/gcc/testsuite/obj-c++.dg/fsf-nsstring-format-1.mm new file mode 100644 index 00000000000..6e58e65dc7b --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/fsf-nsstring-format-1.mm @@ -0,0 +1,51 @@ +/* Check NSString format extensions. */ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ +/* { dg-options "-Wall" } */ + +#ifndef __CONSTANT_CFSTRINGS__ +#error requires CFString +#endif + +#ifdef __cplusplus +extern "C" { +#endif +extern int printf (const char *fmt, ...); +typedef const struct __CFString * CFStringRef; + +#ifdef __cplusplus +} +#endif + +@class NSString; + +int s1 (NSString *fmt, ...) __attribute__((format(NSString, 1, 2))) ; /* OK */ +/* A CFString can represent an NSString. */ +int s1a (CFStringRef fmt, ...) __attribute__((format(NSString, 1, 2))) ; /* OK */ +/* But... it is possible that a CFString format might imply functionality that + is not present in objective-c. */ +int s1b (NSString *fmt, ...) __attribute__((format(CFString, 1, 2))) ; /* { dg-error "format argument should be a .CFString. reference" } */ + +int s2 (int a, NSString *fmt, ... ) __attribute__((format(__NSString__, 2, 3))) ; /* OK */ + +int s2a (int a, NSString *fmt, ... ) __attribute__((format(NSString, 2, 2))) ; /* { dg-error "format string argument follows the args to be formatted" } */ + +int s3 (const char *fmt, ... ) __attribute__((format(__NSString__, 1, 2))) ; /* { dg-error "format argument should be a .NSString. reference but a string was found" } */ +int s4 (NSString *fmt, ... ) __attribute__((format(printf, 1, 2))) ; /* { dg-error "found a .NSString. reference but the format argument should be a string" } */ + +char *s5 (char dum, char *fmt1, ... ) __attribute__((format_arg(2))) ; /* OK */ +NSString *s6 (NSString *dum, NSString *fmt1, ... ) __attribute__((format_arg(2))) ; /* OK */ + +char *s7 (int dum, void *fmt1, ... ) __attribute__((format_arg(2))) ; /* { dg-error "format string argument is not a string type" } */ +int s8 (NSString *dum, NSString *fmt1, ... ) __attribute__((format_arg(2))) ; /* { dg-error "function does not return string type" } */ + +char *s9 (int dum, char *fmt1, ... ) __attribute__((format_arg(2))) ; /* OK */ +NSString *s10 (int dum, NSString *fmt1, ... ) __attribute__((format_arg(2))) ; /* OK */ + +void foo (void) +{ + s1 (@"this format not checked %d %s", 3, 4); + printf("this one is checked %d %s", 3, 4, 5); /* { dg-warning "format .%s. expects type .char.., but argument 3 has type 'int'" } */ + /* { dg-warning "too many arguments for format" "" { target *-*-* } 48 } */ + printf(s9 (1, (char *)"and so is this %d %d %s" , 3, 4, "hm"), 5, 6, 12); /* { dg-warning "format .%s. expects type .char.., but argument 4 has type .int." } */ +} diff --git a/gcc/testsuite/obj-c++.dg/property/dotsyntax-10.mm b/gcc/testsuite/obj-c++.dg/property/dotsyntax-10.mm new file mode 100644 index 00000000000..433595f3daa --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/property/dotsyntax-10.mm @@ -0,0 +1,86 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */ +/* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ + +/* Test dot-syntax with 'super'. */ + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/runtime.h> + +static int c; + +@interface MyRootClass +{ + Class isa; + int a; +} ++ (id) initialize; ++ (id) alloc; +- (id) init; +- (int) count; +- (void) setCount: (int)count; ++ (int) classCount; ++ (void) setClassCount: (int)count; +@end + +@implementation MyRootClass ++ (id) initialize { return self; } ++ (id) alloc { return class_createInstance (self, 0); } +- (id) init { return self; } +- (int) count +{ + return a; +} +- (void) setCount: (int)count +{ + a = count; +} ++ (int) classCount +{ + return c; +} ++ (void) setClassCount: (int)count +{ + c = count; +} +@end + +@interface MySubClass : MyRootClass ++ (int) testMe; +- (int) testMe; +@end + +@implementation MySubClass +- (int) testMe +{ + super.count = 400; + if (super.count != 400) + abort (); + + return super.count; +} ++ (int) testMe +{ + super.classCount = 4000; + if (super.classCount != 4000) + abort (); + + return super.classCount; +} +@end + +int main (void) +{ + MySubClass *object = [[MySubClass alloc] init]; + + if ([object testMe] != 400) + abort (); + + if ([MySubClass testMe] != 4000) + abort (); + + return 0; +} + + diff --git a/gcc/testsuite/obj-c++.dg/property/dotsyntax-11.mm b/gcc/testsuite/obj-c++.dg/property/dotsyntax-11.mm new file mode 100644 index 00000000000..6c9d924ca82 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/property/dotsyntax-11.mm @@ -0,0 +1,61 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */ +/* { dg-do compile } */ + +/* Test the error reporting for the dot-syntax in the scenario where + we have a setter, but not a getter, yet a getter is requested. */ + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/runtime.h> + +static int c; + +@interface MyRootClass +{ + Class isa; + int a; +} ++ (id) initialize; ++ (id) alloc; +- (id) init; +- (void) setCount: (int)count; ++ (void) setClassCount: (int)count; +@end + +@implementation MyRootClass ++ (id) initialize { return self; } ++ (id) alloc { return class_createInstance (self, 0); } +- (id) init { return self; } +- (void) setCount: (int)count +{ + a = count; +} ++ (void) setClassCount: (int)count +{ + c = count; +} +@end + +@interface MySubClass : MyRootClass ++ (int) testMe; +- (int) testMe; +@end + +@implementation MySubClass +- (int) testMe +{ + super.count = 400; + if (super.count != 400) /* { dg-error "no .count. getter found" } */ + abort (); + + return super.count; /* { dg-error "no .count. getter found" } */ +} ++ (int) testMe +{ + super.classCount = 4000; + if (super.classCount != 4000) /* { dg-error "no .classCount. getter found" } */ + abort (); + + return super.classCount; /* { dg-error "no .classCount. getter found" } */ +} +@end diff --git a/gcc/testsuite/obj-c++.dg/property/dotsyntax-5.mm b/gcc/testsuite/obj-c++.dg/property/dotsyntax-5.mm new file mode 100644 index 00000000000..06e11303219 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/property/dotsyntax-5.mm @@ -0,0 +1,78 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */ +/* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ + +/* Test the 'dot syntax' with self, both in instance and class methods. */ + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/runtime.h> + +static int c; + +@interface MyRootClass +{ + Class isa; + int a; +} ++ (id) initialize; ++ (id) alloc; +- (id) init; +- (int) count; +- (void) setCount: (int)count; ++ (int) classCount; ++ (void) setClassCount: (int)count; +@end + +@implementation MyRootClass ++ (id) initialize { return self; } ++ (id) alloc { return class_createInstance (self, 0); } +- (id) init { return self; } +- (int) count +{ + return a; +} +- (void) setCount: (int)count +{ + a = count; +} ++ (int) classCount +{ + return c; +} ++ (void) setClassCount: (int)count +{ + c = count; +} +- (int) testMe +{ + self.count = 400; + if (self.count != 400) + abort (); + + return self.count; +} ++ (int) testMe +{ + self.classCount = 4000; + if (self.classCount != 4000) + abort (); + + return self.classCount; +} +@end + +int main (void) +{ + MyRootClass *object = [[MyRootClass alloc] init]; + + if ([object testMe] != 400) + abort (); + + if ([MyRootClass testMe] != 4000) + abort (); + + return 0; +} + + diff --git a/gcc/testsuite/obj-c++.dg/property/dotsyntax-6.mm b/gcc/testsuite/obj-c++.dg/property/dotsyntax-6.mm new file mode 100644 index 00000000000..cc8c567cff9 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/property/dotsyntax-6.mm @@ -0,0 +1,107 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */ +/* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ + +/* Test nested 'dot syntax' (xxx.yyy.zzz or [xxx yyy].zzz). */ + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/runtime.h> + +@class MyRootClass; + +static int c; +static MyRootClass *shared_root = nil; + +@interface MyRootClass +{ + Class isa; + int a; + int b; + MyRootClass *next; +} +@property int b; +@property (assign) MyRootClass *next; ++ (id) initialize; ++ (MyRootClass *)sharedInstance; ++ (id) alloc; +- (id) init; +- (MyRootClass *)same; +- (int) count; +- (void) setCount: (int)count; +@end + +@implementation MyRootClass +@synthesize b; +@synthesize next; ++ (id) initialize { return self; } ++ (id) alloc { return class_createInstance (self, 0); } +- (id) init { return self; } ++ (MyRootClass *)sharedInstance +{ + if (!shared_root) + shared_root = [[self alloc] init]; + + return shared_root; +} +- (MyRootClass *)same +{ + return self; +} +- (int) count +{ + return a; +} +- (void) setCount: (int)count +{ + a = count; +} +@end + +int main (void) +{ + MyRootClass *object = [[MyRootClass alloc] init]; + + /* Test ClassName.accessor.accessor. */ + MyRootClass.sharedInstance.count = 500; + if (MyRootClass.sharedInstance.count != 500) + abort (); + + /* Test object.accessor.accessor. */ + object.same.count = 1000; + if (object.same.count != 1000) + abort (); + + /* Test object.accessor.property. */ + object.same.next = object; + if (object.same.next != object) + abort (); + + /* Test lots of nesting. */ + if (object.next.next.same.same.next.next.same != object) + abort (); + + /* Test more nesting. */ + MyRootClass.sharedInstance.next = object; + MyRootClass.sharedInstance.next.next.next.next.next.count = 2000; + if (MyRootClass.sharedInstance.next.next.next.next.next.count != 2000) + abort (); + + /* Test more nesting. */ + MyRootClass.sharedInstance.same.same.same.same.same.count = 3000; + if (MyRootClass.sharedInstance.same.same.same.same.same.count != 3000) + abort (); + + /* Test [object method].property. */ + [MyRootClass sharedInstance].count = 5000; + if ([MyRootClass sharedInstance].count != 5000) + abort (); + + /* Just a final check. */ + if (shared_root.count != 5000) + abort (); + + return 0; +} + + diff --git a/gcc/testsuite/obj-c++.dg/property/dotsyntax-7.mm b/gcc/testsuite/obj-c++.dg/property/dotsyntax-7.mm new file mode 100644 index 00000000000..15c1725d833 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/property/dotsyntax-7.mm @@ -0,0 +1,48 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */ +/* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ + +/* Test dot syntax of a casted expression. */ + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/runtime.h> + +@interface MyRootClass +{ + Class isa; + int a; +} ++ (id) initialize; ++ (id) alloc; +- (id) init; +- (int) count; +- (void) setCount: (int)count; +@end + +@implementation MyRootClass ++ (id) initialize { return self; } ++ (id) alloc { return class_createInstance (self, 0); } +- (id) init { return self; } +- (int) count +{ + return a; +} +- (void) setCount: (int)count +{ + a = count; +} +@end + +int main (void) +{ + id object = [[MyRootClass alloc] init]; + + ((MyRootClass *)object).count = 200; + if (((MyRootClass *)object).count != 200) + abort (); + + return 0; +} + + diff --git a/gcc/testsuite/obj-c++.dg/property/dotsyntax-8.mm b/gcc/testsuite/obj-c++.dg/property/dotsyntax-8.mm new file mode 100644 index 00000000000..35dfda40c9d --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/property/dotsyntax-8.mm @@ -0,0 +1,62 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */ +/* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ + +/* Test the 'dot syntax' with typedefs. */ + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/runtime.h> + +static int c; + +@interface MyRootClass +{ + Class isa; + int a; +} ++ (id) initialize; ++ (id) alloc; +- (id) init; +- (int) count; +- (void) setCount: (int)count; ++ (int) classCount; ++ (void) setClassCount: (int)count; +@end + +@implementation MyRootClass ++ (id) initialize { return self; } ++ (id) alloc { return class_createInstance (self, 0); } +- (id) init { return self; } +- (int) count +{ + return a; +} +- (void) setCount: (int)count +{ + a = count; +} ++ (int) classCount +{ + return c; +} ++ (void) setClassCount: (int)count +{ + c = count; +} +@end + +typedef MyRootClass MyType; + +int main (void) +{ + MyType *object = [[MyRootClass alloc] init]; + + object.count = 1974; + if (object.count != 1974) + abort (); + + return 0; +} + + diff --git a/gcc/testsuite/obj-c++.dg/property/dotsyntax-9.mm b/gcc/testsuite/obj-c++.dg/property/dotsyntax-9.mm new file mode 100644 index 00000000000..61a5c0eb8c6 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/property/dotsyntax-9.mm @@ -0,0 +1,77 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */ +/* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ + +/* Test that setter/getters for dot-syntax are properly found even if + not declared in the @interface, but available in the local + @implementation before the current line (ie, [object name] can be + compiled in that case, so object.name should be compiled too). */ + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/runtime.h> + +static int c; + +@interface MyRootClass +{ + Class isa; + int a; +} ++ (id) initialize; ++ (id) alloc; +- (id) init; +@end + +@implementation MyRootClass ++ (id) initialize { return self; } ++ (id) alloc { return class_createInstance (self, 0); } +- (id) init { return self; } +- (int) count +{ + return a; +} +- (void) setCount: (int)count +{ + a = count; +} ++ (int) classCount +{ + return c; +} ++ (void) setClassCount: (int)count +{ + c = count; +} +- (int) testMe +{ + self.count = 400; + if (self.count != 400) + abort (); + + return self.count; +} ++ (int) testMe +{ + self.classCount = 4000; + if (self.classCount != 4000) + abort (); + + return self.classCount; +} +@end + +int main (void) +{ + MyRootClass *object = [[MyRootClass alloc] init]; + + if ([object testMe] != 400) + abort (); + + if ([MyRootClass testMe] != 4000) + abort (); + + return 0; +} + + diff --git a/gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-1.mm b/gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-1.mm index a11b5266f40..2983c43c445 100644 --- a/gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-1.mm +++ b/gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-1.mm @@ -9,6 +9,9 @@ /* { dg-skip-if "NeXT only" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ /* { dg-options "-mconstant-cfstrings -framework Cocoa" } */ +/* Darwin10's linker emits a warning that the constant strings are incompatible with writable ones. + well, we don't implement writable ones at this juncture. */ +/* { dg-options "-mconstant-cfstrings -framework Cocoa -Wl,-w" { target *-*-darwin[123]* } } */ #import <Foundation/NSString.h> #import <CoreFoundation/CFString.h> diff --git a/gcc/testsuite/objc.dg/fsf-nsstring-format-1.m b/gcc/testsuite/objc.dg/fsf-nsstring-format-1.m new file mode 100644 index 00000000000..2550a550168 --- /dev/null +++ b/gcc/testsuite/objc.dg/fsf-nsstring-format-1.m @@ -0,0 +1,44 @@ +/* Check NSString format extensions. */ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ +/* { dg-options "-Wall" } */ + +extern int printf (const char *fmt, ...); + +#ifndef __CONSTANT_CFSTRINGS__ +#error requires CFString +#endif + +typedef const struct __CFString * CFStringRef; +@class NSString; + +int s1 (NSString *fmt, ...) __attribute__((format(NSString, 1, 2))) ; /* OK */ +/* A CFString can represent an NSString. */ +int s1a (CFStringRef fmt, ...) __attribute__((format(NSString, 1, 2))) ; /* OK */ +/* But... it is possible that a CFString format might imply functionality that + is not present in objective-c. */ +int s1b (NSString *fmt, ...) __attribute__((format(CFString, 1, 2))) ; /* { dg-error "format argument should be a .CFString. reference" } */ + +int s2 (int a, NSString *fmt, ... ) __attribute__((format(__NSString__, 2, 3))) ; /* OK */ + +int s2a (int a, NSString *fmt, ... ) __attribute__((format(NSString, 2, 2))) ; /* { dg-error "format string argument follows the args to be formatted" } */ + +int s3 (const char *fmt, ... ) __attribute__((format(__NSString__, 1, 2))) ; /* { dg-error "format argument should be a .NSString. reference but a string was found" } */ +int s4 (NSString *fmt, ... ) __attribute__((format(printf, 1, 2))) ; /* { dg-error "found a .NSString. reference but the format argument should be a string" } */ + +char *s5 (char dum, char *fmt1, ... ) __attribute__((format_arg(2))) ; /* OK */ +NSString *s6 (NSString *dum, NSString *fmt1, ... ) __attribute__((format_arg(2))) ; /* OK */ + +char *s7 (int dum, void *fmt1, ... ) __attribute__((format_arg(2))) ; /* { dg-error "format string argument is not a string type" } */ +int s8 (NSString *dum, NSString *fmt1, ... ) __attribute__((format_arg(2))) ; /* { dg-error "function does not return string type" } */ + +char *s9 (int dum, char *fmt1, ... ) __attribute__((format_arg(2))) ; /* OK */ +NSString *s10 (int dum, NSString *fmt1, ... ) __attribute__((format_arg(2))) ; /* OK */ + +void foo (void) +{ + s1 (@"format not checked %d %s", 3, 4); + printf("this one is checked %d %s", 3, 4, 5); /* { dg-warning "format .%s. expects type .char .., but argument 3 has type .int." } */ + /* { dg-warning "too many arguments for format" "" { target *-*-* } 41 } */ + printf(s9 (1, "and so is this %d %d %s", 3, 4), 5, 6, 12); /* { dg-warning "format .%s. expects type .char .., but argument 4 has type .int." } */ +} diff --git a/gcc/testsuite/objc.dg/property/dotsyntax-10.m b/gcc/testsuite/objc.dg/property/dotsyntax-10.m new file mode 100644 index 00000000000..433595f3daa --- /dev/null +++ b/gcc/testsuite/objc.dg/property/dotsyntax-10.m @@ -0,0 +1,86 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */ +/* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ + +/* Test dot-syntax with 'super'. */ + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/runtime.h> + +static int c; + +@interface MyRootClass +{ + Class isa; + int a; +} ++ (id) initialize; ++ (id) alloc; +- (id) init; +- (int) count; +- (void) setCount: (int)count; ++ (int) classCount; ++ (void) setClassCount: (int)count; +@end + +@implementation MyRootClass ++ (id) initialize { return self; } ++ (id) alloc { return class_createInstance (self, 0); } +- (id) init { return self; } +- (int) count +{ + return a; +} +- (void) setCount: (int)count +{ + a = count; +} ++ (int) classCount +{ + return c; +} ++ (void) setClassCount: (int)count +{ + c = count; +} +@end + +@interface MySubClass : MyRootClass ++ (int) testMe; +- (int) testMe; +@end + +@implementation MySubClass +- (int) testMe +{ + super.count = 400; + if (super.count != 400) + abort (); + + return super.count; +} ++ (int) testMe +{ + super.classCount = 4000; + if (super.classCount != 4000) + abort (); + + return super.classCount; +} +@end + +int main (void) +{ + MySubClass *object = [[MySubClass alloc] init]; + + if ([object testMe] != 400) + abort (); + + if ([MySubClass testMe] != 4000) + abort (); + + return 0; +} + + diff --git a/gcc/testsuite/objc.dg/property/dotsyntax-11.m b/gcc/testsuite/objc.dg/property/dotsyntax-11.m new file mode 100644 index 00000000000..6c9d924ca82 --- /dev/null +++ b/gcc/testsuite/objc.dg/property/dotsyntax-11.m @@ -0,0 +1,61 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */ +/* { dg-do compile } */ + +/* Test the error reporting for the dot-syntax in the scenario where + we have a setter, but not a getter, yet a getter is requested. */ + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/runtime.h> + +static int c; + +@interface MyRootClass +{ + Class isa; + int a; +} ++ (id) initialize; ++ (id) alloc; +- (id) init; +- (void) setCount: (int)count; ++ (void) setClassCount: (int)count; +@end + +@implementation MyRootClass ++ (id) initialize { return self; } ++ (id) alloc { return class_createInstance (self, 0); } +- (id) init { return self; } +- (void) setCount: (int)count +{ + a = count; +} ++ (void) setClassCount: (int)count +{ + c = count; +} +@end + +@interface MySubClass : MyRootClass ++ (int) testMe; +- (int) testMe; +@end + +@implementation MySubClass +- (int) testMe +{ + super.count = 400; + if (super.count != 400) /* { dg-error "no .count. getter found" } */ + abort (); + + return super.count; /* { dg-error "no .count. getter found" } */ +} ++ (int) testMe +{ + super.classCount = 4000; + if (super.classCount != 4000) /* { dg-error "no .classCount. getter found" } */ + abort (); + + return super.classCount; /* { dg-error "no .classCount. getter found" } */ +} +@end diff --git a/gcc/testsuite/objc.dg/property/dotsyntax-5.m b/gcc/testsuite/objc.dg/property/dotsyntax-5.m new file mode 100644 index 00000000000..06e11303219 --- /dev/null +++ b/gcc/testsuite/objc.dg/property/dotsyntax-5.m @@ -0,0 +1,78 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */ +/* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ + +/* Test the 'dot syntax' with self, both in instance and class methods. */ + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/runtime.h> + +static int c; + +@interface MyRootClass +{ + Class isa; + int a; +} ++ (id) initialize; ++ (id) alloc; +- (id) init; +- (int) count; +- (void) setCount: (int)count; ++ (int) classCount; ++ (void) setClassCount: (int)count; +@end + +@implementation MyRootClass ++ (id) initialize { return self; } ++ (id) alloc { return class_createInstance (self, 0); } +- (id) init { return self; } +- (int) count +{ + return a; +} +- (void) setCount: (int)count +{ + a = count; +} ++ (int) classCount +{ + return c; +} ++ (void) setClassCount: (int)count +{ + c = count; +} +- (int) testMe +{ + self.count = 400; + if (self.count != 400) + abort (); + + return self.count; +} ++ (int) testMe +{ + self.classCount = 4000; + if (self.classCount != 4000) + abort (); + + return self.classCount; +} +@end + +int main (void) +{ + MyRootClass *object = [[MyRootClass alloc] init]; + + if ([object testMe] != 400) + abort (); + + if ([MyRootClass testMe] != 4000) + abort (); + + return 0; +} + + diff --git a/gcc/testsuite/objc.dg/property/dotsyntax-6.m b/gcc/testsuite/objc.dg/property/dotsyntax-6.m new file mode 100644 index 00000000000..cc8c567cff9 --- /dev/null +++ b/gcc/testsuite/objc.dg/property/dotsyntax-6.m @@ -0,0 +1,107 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */ +/* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ + +/* Test nested 'dot syntax' (xxx.yyy.zzz or [xxx yyy].zzz). */ + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/runtime.h> + +@class MyRootClass; + +static int c; +static MyRootClass *shared_root = nil; + +@interface MyRootClass +{ + Class isa; + int a; + int b; + MyRootClass *next; +} +@property int b; +@property (assign) MyRootClass *next; ++ (id) initialize; ++ (MyRootClass *)sharedInstance; ++ (id) alloc; +- (id) init; +- (MyRootClass *)same; +- (int) count; +- (void) setCount: (int)count; +@end + +@implementation MyRootClass +@synthesize b; +@synthesize next; ++ (id) initialize { return self; } ++ (id) alloc { return class_createInstance (self, 0); } +- (id) init { return self; } ++ (MyRootClass *)sharedInstance +{ + if (!shared_root) + shared_root = [[self alloc] init]; + + return shared_root; +} +- (MyRootClass *)same +{ + return self; +} +- (int) count +{ + return a; +} +- (void) setCount: (int)count +{ + a = count; +} +@end + +int main (void) +{ + MyRootClass *object = [[MyRootClass alloc] init]; + + /* Test ClassName.accessor.accessor. */ + MyRootClass.sharedInstance.count = 500; + if (MyRootClass.sharedInstance.count != 500) + abort (); + + /* Test object.accessor.accessor. */ + object.same.count = 1000; + if (object.same.count != 1000) + abort (); + + /* Test object.accessor.property. */ + object.same.next = object; + if (object.same.next != object) + abort (); + + /* Test lots of nesting. */ + if (object.next.next.same.same.next.next.same != object) + abort (); + + /* Test more nesting. */ + MyRootClass.sharedInstance.next = object; + MyRootClass.sharedInstance.next.next.next.next.next.count = 2000; + if (MyRootClass.sharedInstance.next.next.next.next.next.count != 2000) + abort (); + + /* Test more nesting. */ + MyRootClass.sharedInstance.same.same.same.same.same.count = 3000; + if (MyRootClass.sharedInstance.same.same.same.same.same.count != 3000) + abort (); + + /* Test [object method].property. */ + [MyRootClass sharedInstance].count = 5000; + if ([MyRootClass sharedInstance].count != 5000) + abort (); + + /* Just a final check. */ + if (shared_root.count != 5000) + abort (); + + return 0; +} + + diff --git a/gcc/testsuite/objc.dg/property/dotsyntax-7.m b/gcc/testsuite/objc.dg/property/dotsyntax-7.m new file mode 100644 index 00000000000..15c1725d833 --- /dev/null +++ b/gcc/testsuite/objc.dg/property/dotsyntax-7.m @@ -0,0 +1,48 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */ +/* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ + +/* Test dot syntax of a casted expression. */ + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/runtime.h> + +@interface MyRootClass +{ + Class isa; + int a; +} ++ (id) initialize; ++ (id) alloc; +- (id) init; +- (int) count; +- (void) setCount: (int)count; +@end + +@implementation MyRootClass ++ (id) initialize { return self; } ++ (id) alloc { return class_createInstance (self, 0); } +- (id) init { return self; } +- (int) count +{ + return a; +} +- (void) setCount: (int)count +{ + a = count; +} +@end + +int main (void) +{ + id object = [[MyRootClass alloc] init]; + + ((MyRootClass *)object).count = 200; + if (((MyRootClass *)object).count != 200) + abort (); + + return 0; +} + + diff --git a/gcc/testsuite/objc.dg/property/dotsyntax-8.m b/gcc/testsuite/objc.dg/property/dotsyntax-8.m new file mode 100644 index 00000000000..35dfda40c9d --- /dev/null +++ b/gcc/testsuite/objc.dg/property/dotsyntax-8.m @@ -0,0 +1,62 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */ +/* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ + +/* Test the 'dot syntax' with typedefs. */ + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/runtime.h> + +static int c; + +@interface MyRootClass +{ + Class isa; + int a; +} ++ (id) initialize; ++ (id) alloc; +- (id) init; +- (int) count; +- (void) setCount: (int)count; ++ (int) classCount; ++ (void) setClassCount: (int)count; +@end + +@implementation MyRootClass ++ (id) initialize { return self; } ++ (id) alloc { return class_createInstance (self, 0); } +- (id) init { return self; } +- (int) count +{ + return a; +} +- (void) setCount: (int)count +{ + a = count; +} ++ (int) classCount +{ + return c; +} ++ (void) setClassCount: (int)count +{ + c = count; +} +@end + +typedef MyRootClass MyType; + +int main (void) +{ + MyType *object = [[MyRootClass alloc] init]; + + object.count = 1974; + if (object.count != 1974) + abort (); + + return 0; +} + + diff --git a/gcc/testsuite/objc.dg/property/dotsyntax-9.m b/gcc/testsuite/objc.dg/property/dotsyntax-9.m new file mode 100644 index 00000000000..61a5c0eb8c6 --- /dev/null +++ b/gcc/testsuite/objc.dg/property/dotsyntax-9.m @@ -0,0 +1,77 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */ +/* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ + +/* Test that setter/getters for dot-syntax are properly found even if + not declared in the @interface, but available in the local + @implementation before the current line (ie, [object name] can be + compiled in that case, so object.name should be compiled too). */ + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/runtime.h> + +static int c; + +@interface MyRootClass +{ + Class isa; + int a; +} ++ (id) initialize; ++ (id) alloc; +- (id) init; +@end + +@implementation MyRootClass ++ (id) initialize { return self; } ++ (id) alloc { return class_createInstance (self, 0); } +- (id) init { return self; } +- (int) count +{ + return a; +} +- (void) setCount: (int)count +{ + a = count; +} ++ (int) classCount +{ + return c; +} ++ (void) setClassCount: (int)count +{ + c = count; +} +- (int) testMe +{ + self.count = 400; + if (self.count != 400) + abort (); + + return self.count; +} ++ (int) testMe +{ + self.classCount = 4000; + if (self.classCount != 4000) + abort (); + + return self.classCount; +} +@end + +int main (void) +{ + MyRootClass *object = [[MyRootClass alloc] init]; + + if ([object testMe] != 400) + abort (); + + if ([MyRootClass testMe] != 4000) + abort (); + + return 0; +} + + diff --git a/gcc/testsuite/objc.dg/torture/forward-1.m b/gcc/testsuite/objc.dg/torture/forward-1.m index 086d69ef35e..518bf274e6d 100644 --- a/gcc/testsuite/objc.dg/torture/forward-1.m +++ b/gcc/testsuite/objc.dg/torture/forward-1.m @@ -1,6 +1,6 @@ /* { dg-do run } */ /* See if -forward::/-performv:: is able to work. */ -/* { dg-skip-if "PR36610" { *-*-* } { "-fgnu-runtime" } { "" } } */ +/* { dg-xfail-run-if "PR36610" { ! { { i?86-*-* x86_64-*-* } && ilp32 } } { "-fgnu-runtime" } { "" } } */ /* { dg-skip-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ #include <stdio.h> |