diff options
author | (no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-07-02 00:35:00 +0000 |
---|---|---|
committer | (no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-07-02 00:35:00 +0000 |
commit | 33c6ff0f4f4f35d7dae7bcdac8d429ab312e2b5e (patch) | |
tree | 89947b04b5c2fbd530076237357ede702d3d6c22 /gcc/testsuite | |
parent | 0fcc981fa6eb41869dce802e289b012f4c3726be (diff) |
This commit was manufactured by cvs2svn to create tagapple/gcc-5208
'apple-gcc-5208'.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/tags/apple-gcc-5208@101526 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
957 files changed, 33264 insertions, 1350 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 34b9f12ddcd..f6975c6e8c9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,979 @@ +2005-06-17 Geoffrey Keating <geoffk@apple.com> + + PR c++/17413 + * g++.dg/template/local5.C: New. + +2005-04-20 Release Manager + + * GCC 4.0.0 released. + +2005-04-18 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/20991 + * g++.dg/opt/pr20991.C: New test. + +2005-04-17 Richard Sandiford <rsandifo@redhat.com> + + * gcc.c-torture/execute/20050410-1.c: New test. + +2005-04-17 Alexandre Oliva <aoliva@redhat.com> + + PR middle-end/20739 + * gcc.dg/tree-ssa/pr20739.c: New test. + +2005-04-16 Mark Mitchell <mark@codesourcery.com> + + PR c++/21025 + * g++.dg/template/sizeof9.C: New test. + +2005-04-14 Ulrich Weigand <uweigand@de.ibm.com> + + PR target/20927 + * gcc.dg/pr20927.c: New test. + +2005-04-14 Alexandre Oliva <aoliva@redhat.com> + Roger Sayle <roger@eyesopen.com> + + PR target/20126 + * gcc.c-torture/execute/20050414-1.c: New. + +2005-04-13 Thomas Koenig <Thomas.Koenig@online.de> + + PR libfortran/20163 + * gfortran.dg/open-options-blanks.f: New test. + +2005-04-12 Ulrich Weigand <uweigand@de.ibm.com> + + PR middle-end/20917 + * gcc.dg/20050409-1.c: New test. + +2005-04-10 Mark Mitchell <mark@codesourcery.com> + + * g++.dg/warn/Wdtor1.C: Declare template in system header with + explicit C++ linkage. + +2005-04-09 Jakub Jelinek <jakub@redhat.com> + + PR target/20795 + * g++.dg/abi/param2.C: New test. + +2005-04-08 Mark Mitchell <mark@codesourcery.com> + + PR c++/20905 + * g++.dg/parse/cond2.C: New test. + +2005-04-08 Mark Mitchell <mark@codesourcery.com> + + PR c++/20145 + * g++.dg/warn/Wdtor1.C: New test. + +2005-04-08 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + PR fortran/17229 + * gfortran.dg/pr17229.f: New test. + +2005-04-07 Steven G. Kargl <kargls@comcast.net> + + * gfortran.dg/tiny_1.f90: New test. + * gfortran.dg/tiny_2.f90: ditto. + +2005-04-07 Thomas Koenig <Thomas.Koenig@online.de> + + * gfortran.dg/eor_1.f90: Fix dg-do run line + * gfortran.dg/open_new.f90: Fix dg-do run line + +2005-03-12 Geoffrey Keating <geoffk@apple.com> + + * gcc.dg/vmx/darwin-abi-3.c: Delete. + +2005-04-06 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de> + + * gfortran.dg/pr15754.f90: Change annotations to dg-error. + +2005-04-06 Joseph S. Myers <joseph@codesourcery.com> + + * gcc.dg/weak/weak-12.c, g++.dg/ext/weak2.C: New tests. + +2005-04-06 Joseph S. Myers <joseph@codesourcery.com> + + * gcc.dg/i386-387-7.c, gcc.dg/i386-3dnowA-1.c, + gcc.dg/i386-3dnowA-2.c, gcc.dg/pr12092-1.c: Skip x86 tests for + -m64. + * gcc.dg/loop-3.c, gcc.dg/short-compare-1.c, + gcc.dg/short-compare-2.c, gcc.dg/smod-1.c, + gcc.dg/torture/badshift.c: Don't give 32-bit options for x86 -m64. + +2005-04-06 Mark Mitchell <mark@codesourcery.com> + + PR c++/20212 + * g++.dg/warn/Wunused-11.C: New test. + +2005-04-05 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/20076 + * gcc.dg/builtin-apply4.c: New test. + + PR preprocessor/19475 + * gcc.dg/cpp/macspace1.c: New test. + * gcc.dg/cpp/macspace2.c: New test. + +2005-04-05 Mark Mitchell <mark@codesourcery.com> + + PR c++/20734 + * g++.dg/template/ptrmem13.C: New test. + +2005-04-05 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + * gfortran.dg/pr20755.f: Fix bad format. + +2005-04-05 Mark Mitchell <mark@codesourcery.com> + + PR c++/20763 + * g++.dg/ext/attrib21.C: New test. + +2005-04-05 Hans-Peter Nilsson <hp@axis.com> + + PR rtl-optimization/20527 + * gcc.c-torture/execute/pr20527-1.c: New test. + +2005-04-05 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + PR libfortran/20755 + * gfortran.dg/pr20755.f: New test. + +2005-04-05 Feng Wang <fengwang@nudt.edu.cn> + + * gfortran.dg/pr15959.f90: New test. + * gfortran.dg/string_pad_trunc.f90: New test. + +2005-04-05 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + * gfortran.dg/backspace.f, gfortran.dg/g77_intrinsics_funcs.f, + gfortran.dg/g77_intrinsics_sub.f, gfortran.dg/negative_unit.f, + gfortran.dg/g77/12002.f: Correct dejagnu syntax. + +2005-04-05 Feng Wang <fengwang@nudt.edu.cn> + + * gfortran.dg/pr18025.f90: Change {dg-do run} to { dg-do run }. + +2005-04-05 Eric Botcazou <ebotcazou@libertysurf.fr> + + * gcc.c-torture/compile/20040323-1.c (_rtld_global): Set to 1. + +2005-04-04 Alexandre Oliva <aoliva@redhat.com> + + PR c++/19199 + * g++.dg/expr/lval2.C: New. + +2005-04-04 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + * gcc.c-torture/compile/20011119-1.c: Require weak and alias support. + * gcc.c-torture/compile/20011119-2.c: Likewise. + * gcc.c-torture/compile/981001-2.c: Likewise. + +2005-04-04 Mark Mitchell <mark@codesourcery.com> + + PR c++/20679 + * g++.dg/template/overload4.C: New test. + +2005-04-04 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/16104 + * gcc.c-torture/execute/20050316-1.c: New test. + +2005-04-04 Nathan Sidwell <nathan@codesourcery.com> + + PR debug/20505 + * g++.dg/debug/const2.C: New. + +2005-04-03 Gabriel Dos Reis <gdr@integrable-solutions.net> + + PR c++/18644 + * g++.old-deja/g++.jason/warning9.C: Adjust. + +2005-04-01 Dale Ranta <dir@lanl.gov> + Francois-Xavier Coudert <coudert@clipper.ens.fr> + + PR libfortran/20068 + PR libfortran/20125 + PR libfortran/20156 + PR libfortran/20471 + * gfortran.dg/backspace.f: New test. + +2005-04-02 Daniel Berlin <dberlin@dberlin.org> + + * gcc.dg/pr19345.c: New test. + +2005-04-02 Alexandre Oliva <aoliva@redhat.com> + + PR tree-optimization/20640 + * gcc.dg/torture/tree-loop-1.c: New. + +2005-04-02 Alexandre Oliva <aoliva@redhat.com> + + PR rtl-optimization/20290 + * gcc.c-torture/execute/loop-ivopts-2.c: New. + +2005-04-01 Joseph S. Myers <joseph@codesourcery.com> + + * gcc.dg/old-style-then-proto-1.c: New test. + +2005-04-01 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + * gfortran.fortran-torture/execute/backspace.f90: Check + after backspace and read was incorrect. + +2005-04-01 Jakub Jelinek <jakub@redhat.com> + + PR c++/19406 + * g++.dg/debug/using1.C: New test. + +2005-04-01 Joseph S. Myers <joseph@codesourcery.com> + + PR c/17855 + * gcc.c-torture/compile/struct-non-lval-1.c, + gcc.c-torture/compile/struct-non-lval-2.c, + gcc.c-torture/compile/struct-non-lval-3.c: New tests. + +2005-03-31 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + PR libfortran/20660 + * gfortran.dg/negative_unit.f: New test. + +2005-03-31 Ben Elliston <bje@au.ibm.com> + + * README: Update the DejaGnu bug reporting address. + * lib/c-torture.exp: Remove the DejaGnu bug reporting address. + * lib/objc-torture.exp: Likewise. + +2005-03-30 Joseph S. Myers <joseph@codesourcery.com> + + PR c/772 + PR c/17913 + * gcc.dg/stmt-expr-label-1.c, gcc.dg/stmt-expr-label-2.c, + gcc.dg/stmt-expr-label-3.c : New tests. + * gcc.c-torture/execute/medce-2.c: Remove. + +2005-03-30 Joseph S. Myers <joseph@codesourcery.com> + + PR c/20368 + * gcc.dg/pr20368-1.c, gcc.dg/pr20368-2.c, gcc.dg/pr20368-3.c: New + tests. + +2005-03-30 Zdenek Dvorak <dvorakz@suse.cz> + + PR rtl-optimization/20249 + * gcc.dg/20050325-1.c: New test. + +2005-03-30 Alan Modra <amodra@bigpond.net.au> + + * gcc.c-torture/compile/pr20203.c: New test. + +2005-03-29 Alexandre Oliva <aoliva@redhat.com> + + PR rtl-optimization/20532 + * gcc.dg/torture/badshift.c: New. + +2005-03-29 Steven G. Kargl <kargls@comcast.net> + + * gfortran.dg/promotion.f90: New test. + +2005-03-29 Alexandre Oliva <aoliva@redhat.com> + + PR middle-end/20491 + * gcc.dg/torture/asm-subreg-1.c: New test. + +2005-03-29 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/20622 + * gcc.dg/alias-7.c: New test. + +2005-03-29 Eric Botcazou <ebotcazou@libertysurf.fr> + + * gcc.dg/sparc-reg-1.c: New test. + +2005-03-29 Dale Ranta <dir@lanl.gov> + Francois-Xavier Coudert <coudert@clipper.ens.fr> + + PR libfortran/20163 + * gfortran.dg/pr20163-2.f: New test. + +2005-03-27 Mark Mitchell <mark@codesourcery.com> + + * g++.old-deja/g++.warn/compare1.C: Fix typo. + +2005-03-24 Geoffrey Keating <geoffk@apple.com> + + * g++.dg/ext/visibility/pragma-override1.C: Mark as requiring + 'internal' visibility. + * g++.dg/ext/visibility/pragma-override2.C: Likewise. + * g++.dg/ext/visibility/visibility-7.C: Mark as requiring + 'protected' visibility. + * gcc.dg/visibility-7.c: Likewise. + * lib/target-supports.exp (check_visibility_available): Take + a parameter, the kind of visibility to check for. + * lib/target-supports-dg.exp (dg-require-visibility): Pass parameter + to check_visibility_available. + + * g++.dg/expr/cast3.C: New. + +2005-03-25 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + PR libfortran/19678 + PR libfortran/19679 + * gfortran.dg/dos_eol.f: New test. + +2005-03-25 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + PR libfortran/15332 + * gfortran.dg/pr15332.f: New test. + +2005-03-23 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + * gfortran.dg/pr18025.f90: New test. + +2005-03-23 Mark Mitchell <mark@codesourcery.com> + + * g++.old-deja/g++.warn/compare1.C: Run with -Wno-deprecated. + +2005-03-22 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + * gfortran.dg/g77_intrinsics_funcs.f: New test. + * gfortran.dg/g77_intrinsics_sub.f: New test. + +2005-03-22 Mark Mitchell <mark@codesourcery.com> + + * g++.dg/opt/max1.C: Run with -Wno-deprecated. + * g++.dg/opt/pr7503-2.C: Likewise. + * g++.dg/opt/pr7503-3.C: Likewise. + * g++.dg/opt/pr7503-4.C: Likewise. + * g++.dg/opt/pr7503-5.C: Likewise. + * g++.dg/warn/minmax.C: New test. + +2005-03-22 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/19980 + * g++.dg/template/redecl3.C: New test. + +2005-03-22 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/20499 + * g++.dg/parse/error16.C: Tweak error markers. + +2005-03-22 Jakub Jelinek <jakub@redhat.com> + + PR target/20561 + * gcc.dg/20050321-2.c: New test. + +2005-03-22 Nathan Sidwell <nathan@codesourcery.com> + + PR c++/20465 + PR c++/20381 + * g++.dg/template/ptrmem12.C: New. + +2005-03-22 Paolo Carlini <pcarlini@suse.de> + + PR c++/20461 + * g++.dg/parse/crash24.C: New test. + + PR c++/20536 + * g++.dg/parse/crash25.C: New test. + +2005-03-22 Paolo Carlini <pcarlini@suse.de> + + PR c++/20463 + * g++.dg/template/crash35.C: New test. + +2005-03-21 Roger Sayle <roger@eyesopen.com> + + PR middle-end/20539 + * gcc.c-torture/compile/pr13066-1.c: New test case. + * gcc.c-torture/compile/pr20539-1.c: Likewise. + * g++.dg/opt/pr13066-1.C: Likewise. + +2005-03-21 Paolo Carlini <pcarlini@suse.de> + + PR c++/20147 + * g++.dg/ext/stmtexpr4.C: New test. + +2005-03-20 Joseph S. Myers <joseph@codesourcery.com> + + * gcc.dg/bitfld-14.c, gcc.dg/enum3.c: New tests. + +2005-03-19 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de> + + PR fortran/18525 + * gfortran.dg/nesting_1.f90: New test. + +2005-03-19 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> + + PR c++/20240 + * g++.dg/lookup/using13.C: New test. + +2005-03-19 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> + + PR c++/20333 + * g++.dg/template/crash36.C: New test. + +2005-03-16 Richard Henderson <rth@redhat.com> + + PR middle-end/15700 + * gcc.c-torture/compile/20040323-1.c: Don't xfail for solaris. + (_rtld_global): New. + * gcc.dg/weak/weak-3.c (ffoox1f, ffoox1g): Define. + * gcc.dg/weak/weak-9.c (notf1, notf2, notf3, notf4): Define. + + * gcc.dg/alias-3.c: New. + * gcc.dg/alias-4.c: New. + * gcc.dg/alias-5.c: New. + * gcc.dg/alias-6.c: New. + +2005-03-16 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + PR libfortran/20257 + * gfortran.dg/pr20257.f90: New test. + +2005-03-16 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + PR libfortran/20480 + * gfortran.dg/pr20480.f90: New test. + +2005-03-15 Feng Wang <fengwang@nudt.edu.cn> + + PR fortran/18827 + * gfortran.dg/assign_2.f90: New test. + * gfortran.dg/assign_3.f90: New test. + * gfortran.dg/assign.f90: New test. + +2005-03-15 Joseph S. Myers <joseph@codesourcery.com> + + * g++.dg/other/cv_func.C, g++.dg/other/offsetof3.C, + g++.dg/parse/error11.C, g++.dg/tc1/dr108.C, + g++.dg/template/local4.C, g++.dg/template/nontype6.C, + g++.dg/warn/deprecated.C: Ensure uniqueness of test assertion + names. + +2005-03-14 Alexandre Oliva <aoliva@redhat.com> + + PR c++/20280 + * g++.dg/tree-ssa/pr20280.C: New. + +2005-03-14 Alexandre Oliva <aoliva@redhat.com> + + * gcc.dg/pr18628.c: New. + +2005-03-14 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de> + + PR fortran/20467 + * gfortran.dg/stfunc_2.f90: New test. + +2005-03-14 Richard Sandiford <rsandifo@redhat.com> + + * gcc.target/mips/fix-vr4130-[1-4].c: New tests. + +2005-03-13 Mark Mitchell <mark@codesourcery.com> + + PR c++/20157 + * g++.dg/template/error18.C: New test. + +2005-03-13 Joseph S. Myers <joseph@codesourcery.com> + + * gcc.dg/anon-struct-6.c, gcc.dg/array-8.c, + gcc.dg/cpp/19940712-1.c, gcc.dg/cpp/19951025-1.c, + gcc.dg/cpp/tr-warn6.c, gcc.dg/deprecated.c, gcc.dg/init-bad-1.c, + gcc.dg/init-bad-2.c, gcc.dg/init-bad-3.c, gcc.dg/m-un-2.c, + gcc.dg/parm-mismatch-1.c, gcc.dg/redecl-1.c: Ensure uniqueness of + test assertion names. + +2003-03-13 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de> + + PR fortran/16907 + * gfortran.dg/real_index_1.f90: New test. + +2005-03-13 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de> + + PR fortran/20323 + * gfortran.dg/spec_expr_1.f90: New test. + +2005-03-12 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de> + + PR fortran/20361 + * gfortran.dg/largeequiv_1.f90: New test. + +2005-03-12 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + PR libfortran/20124 + * gfortran.dg/pr20124.f90: New Test + +2005-03-10 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + * objc.dg/stabs-1.m (dg-final): Change regexp pattern for hppa SOM. + +2005-03-10 Andrew Pinski <pinskia@physics.uc.edu> + + PR rtl-opt/20412 + * gcc.c-torture/compile/pr20412.c: New test. + +2005-03-10 Jakub Jelinek <jakub@redhat.com> + + PR target/20322 + * gcc.dg/20050307-1.c: New test. + +2005-03-10 Nathan Sidwell <nathan@codesourcery.com> + + PR c++/20375 + * g++.dg/other/stdarg3.C: New. + +2005-03-10 Jakub Jelinek <jakub@redhat.com> + + PR c++/18384, c++/18327 + * g++.dg/init/array19.C: New test. + + PR inline-asm/20314 + * gcc.dg/torture/pr20314-1.c: New test. + * gcc.dg/torture/pr20314-2.c: New test. + +2005-03-09 Ulrich Weigand <uweigand@de.ibm.com> + + * gcc.dg/20050309-1.c: New test. + +2005-03-09 Mark Mitchell <mark@codesourcery.com> + + PR c++/20208 + * g++.dg/template/array13.C: New test. + +2005-03-09 Nathan Sidwell <nathan@codesourcery.com> + + PR c++/20186 + * g++.dg/template/non-dependent12.C: New. + +2005-03-08 Mark Mitchell <mark@codesourcery.com> + + PR c++/20142 + * g++.dg/init/array18.C: New test. + +2005-03-08 Ira Rosen <irar@il.ibm.com> + + * gcc.dg/vect/pr20122.c: New test. + +2005-03-07 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + * g++.dg/warn/weak1.C: Skip test on hppa*-*-hpux*. + * g++.dg/init/dso_handle1.C, gcc.dg/torture/builtin-noret-1.c, + gcc.dg/torture/builtin-noret-2.c: Require weak support. + +2005-03-07 Mark Mitchell <mark@codesourcery.com> + + * g++.dg/warn/Wnvdtor.C: New test. + +2005-03-07 Richard Sandiford <rsandifo@redhat.com> + + * gcc.dg/torture/pr19683-1.c: New test. + +2005-03-06 Steven G. Kargl <kargls@comcast.net> + + * gfortran.dg/g77/19990313-1.f: Replace tabs with spaces. + * gfortran.dg/g77/19990313-2.f: ditto + * gfortran.dg/g77/19990313-3.f: ditto + * gfortran.dg/g77/19990525-0.f: ditto + * gfortran.dg/g77/19990826-0.f: ditto + * gfortran.dg/g77/19990826-2.f: ditto + * gfortran.dg/g77/19990826-3.f: ditto + * gfortran.dg/g77/20000511-1.f: ditto + * gfortran.dg/g77/20000511-2.f: ditto + * gfortran.dg/g77/970625-2.f: ditto + * gfortran.dg/g77/980310-2.f: ditto + * gfortran.dg/g77/980310-3.f: ditto + * gfortran.dg/g77/980310-8.f: ditto + * gfortran.dg/g77/980519-2.f: ditto + * gfortran.dg/g77/alpha1.f: ditto + * gfortran.dg/g77/claus.f: ditto + * gfortran.dg/g77/erfc.f: ditto + * gfortran.dg/g77/short.f: ditto + * gfortran.fortran-torture/execute/data.f90: ditto + * gfortran.fortran-torture/execute/integer_select.f90: ditto + * gfortran.fortran-torture/execute/integer_select_1.f90: ditto + +2005-03-06 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + * lib/file-format.exp (gcc_target_object_format): Add check for som + format and hardcode object formats on hppa*-*-hpux*. + * lib/target-supports.exp (check_weak_available): Add check for som + object format. Always return 0 on hppa*-*-hpux10*. + + * gcc.dg/titype-1.c, gcc.dg/uninit-C.c: Don't use TImode if __hppa__ + is defined. + + * objc.dg/stabs-1.m: hppa*64*-*-* doesn't have stabs. + +2005-03-06 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> + + PR c++/19311 + * g++.dg/template/non-dependent11.C: New test. + +2005-03-05 Steven G. Kargl <kargls@comcast.net> + + * gfortran.dg/pr19936_1.f90: New test. + * gfortran.dg/pr19936_1.f90: ditto. + * gfortran.dg/pr19936_1.f90: ditto. + +2005-03-05 Paul Thomas <prthomas@drfccad.cea.fr> + Steven G. Kargl <kargls@comcast.net> + + * gfortran.dg/PR19754_1.f90: New test. + * gfortran.dg/PR19754_2.f90: ditto. + +2005-03-05 John David Anglin <dave.danglin@nrc-cnrc.gc.ca> + Joseph S. Myers <joseph@codesourcery.com> + + PR c++/19797 + * g++.dg/abi/vague1.C: Remove xfail hppa*-*-hpux*. + +2005-03-04 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de> + + PR fortran/19673 + * gfortran.dg/func_result_1.f90: New test. + +2005-03-04 David Billinghurst <David.Billinghurst@riotinto.com> + + * gcc.dg/cpp/assert4.c: Fix for cygwin. + +2005-03-02 Mark Mitchell <mark@codesourcery.com> + + PR c++/19916 + * g++.dg/init/ptrmem2.C: New test. + +2005-03-02 Alexandre Oliva <aoliva@redhat.com> + + * g++.dg/overload/using2.C: New. + +2005-03-01 Nathan Sidwell <nathan@codesourcery.com> + + PR c++/20232 + * g++.dg/inherit/covariant12.C: New. + +2005-02-28 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de> + + PR fortran/19479 + * gfortran.dg/bound_1.f90: New test. + +2005-02-28 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/19874 + * gcc.c-torture/execute/20050119-2.c: New test case. + +2005-02-27 Steven G. Kargl <kargl@gcc.gnu.org> + + * gfortran.dg/boz_1.f90: New test. + * gfortran.dg/boz_3.f90: New test. + * gfortran.dg/boz_4.f90: New test. + +2005-02-27 Steven G. Kargl <kargl@gcc.gnu.org> + + * gfortran.dg/ishft.f90: Remove kind suffix from BOZ constant + * gfortran.fortran-torture/execute/intrinsic_mvbits.f90: ditto + +2005-02-27 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + PR libfortran/20101 + * gfortran.dg/write_0_pe_format.f90: New test. + +2005-02-27 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de> + + * gfortran.dg/e_d_fmt.f90: New test. + +2005-02-27 Jakub Jelinek <jakub@redhat.com> + + PR c++/20206 + * g++.dg/opt/thunk2.C: New test. + * g++.dg/opt/covariant1.C: New test. + +2005-02-27 Andrew Pinski <pinskia@physics.uc.edu> + + * gcc.dg/tree-ssa/inline_asm-2.c: link_error produces + a V_MAY_DEF also. + +2005-02-26 Andrew Pinski <pinskia@physics.uc.edu> + + PR tree-opt/20188 + * gcc.dg/tree-ssa/inline_asm-1.c: New test. + * gcc.dg/tree-ssa/inline_asm-2.c: New test. + * gcc.dg/asm-b.c: New test. + +2005-02-26 Richard Sandiford <rsandifo@redhat.com> + + * gcc.c-torture/execute/ieee/mul-subnormal-single-1.x: New file. + Disable this test on IRIX 6. + +2005-02-25 Diego Novillo <dnovillo@redhat.com> + + PR tree-optimization/20204 + * testsuite/gcc.dg/pr20204.c: New test. + +2005-02-24 Jakub Jelinek <jakub@redhat.com> + + PR target/20196 + * gcc.c-torture/execute/20050224-1.c: New test. + + PR c++/20175 + * g++.dg/warn/Wbraces2.C: New test. + +2005-02-23 Mark Mitchell <mark@codesourcery.com> + + PR c++/19878 + * g++.dg/init/const2.C: New test. + +2005-02-23 Hans-Peter Nilsson <hp@axis.com> + + PR tree-optimization/20100 + * gcc.c-torture/execute/pr20100-1.c: New test. + +2005-02-23 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de> + + * gfortran.dg/implicit_3.f90: New test. + + * gfortran.dg/deftype_1.f90: New test. + +2005-02-23 Alexandre Oliva <aoliva@redhat.com> + + * g++.dg/lookup/anon2.C: Don't let access checks make it look like + the test passes. + * g++.dg/other/anon3.C: Accept a warning. + +2005-02-23 Kazu Hirata <kazu@cs.umass.edu> + + * gcc.dg/pr20017.c: Fix a comment typo. + +2005-02-23 Bud Davis <bdavis@gfortran.org> + + * gfortran.dg/list_read_4.f90: Change to f90 comments. + +2005-02-23 Eric Botcazou <ebotcazou@libertysurf.fr> + + PR ada/19902 + * ada/acats/tests/cxa/cxa3004.a: Remove. + * ada/acats/tests/cxb/cxb30061.am: Likewise. + +2005-02-22 Mark Mitchell <mark@codesourcery.com> + + PR c++/20073 + * g++.dg/init/const1.C: New test. + + PR c++/19991 + * g++.dg/parse/constant7.C: New test. + + PR c++/20152 + * g++.dg/parse/error27.C: New test. + * g++.dg/template/qualttp15.C: Adjust error markers. + * g++.old-deja/g++.other/struct1.C: Likewise. + + PR c++/20153 + * g++.dg/template/error17.C: New test. + + PR c++/20148 + * g++.dg/parser/error26.C: New test. + +2005-02-22 Diego Novillo <dnovillo@redhat.com> + + PR tree-optimization/20100 + PR tree-optimization/20115 + * gcc.dg/pr20115.c: New test. + * gcc.dg/pr20115-1.c: New test. + * gcc.dg/pr20100.c: New test. + * gcc.dg/tree-ssa/20040517-1.c: Expect virtual operands for + call-clobbered variables after alias1. + +2005-02-22 Bud Davis <bdavis@gfortran.org> + + * gfortran.dg/list_read_4.f90: new test. + +2005-02-22 Kazu Hirata <kazu@cs.umass.edu> + + PR rtl-optimization/20017. + * gcc.dg/pr20017.c: New. + +2005-02-22 Devang Patel <dpatel@apple.com> + + PR 19952 + * g++.dg/tree-ssa/pr19952.C: New test. + +2005-02-22 Mark Mitchell <mark@codesourcery.com> + + PR c++/19883 + * g++.dg/parse/constant6.C: New test. + +2005-02-22 Uros Bizjak <uros@kss-loka.si> + + * g++.dg/charset/asm1.c: Check for IBM1047 code set, not IBM-1047. + * g++.dg/charset/asm2.c: Likewise. + * g++.dg/charset/asm3.c: Likewise. + * g++.dg/charset/asm4.c: Likewise. + * g++.dg/charset/asm5.c: Likewise. + * g++.dg/charset/attribute1.c: Likewise. + * g++.dg/charset/attribute2.c: Likewise. + * g++.dg/charset/extern1.cc: Likewise. + * g++.dg/charset/extern2.cc: Likewise. + * g++.dg/charset/extern3.cc: Likewise. + * g++.dg/charset/function.cc: Likewise. + * g++.dg/charset/string.c: Likewise. + * g++.dg/charset/charset.exp: Likewise. + * lib/target-supports.exp (check_iconv_available): Fix comment. + +2005-02-22 Uros Bizjak <uros@kss-loka.si> + + * gcc.dg/charset/builtin1.c: Use dg-require-iconv "IBM1047". + * gcc.dg/charset/asm1.c: Check for IBM1047 code set, not IBM-1047. + * gcc.dg/charset/asm2.c: Likewise. + * gcc.dg/charset/asm3.c: Likewise. + * gcc.dg/charset/asm4.c: Likewise. + * gcc.dg/charset/asm5.c: Likewise. + * gcc.dg/charset/asm6.c: Likewise. + * gcc.dg/charset/attribute1.c: Likewise. + * gcc.dg/charset/attribute2.c: Likewise. + * gcc.dg/charset/builtin1.c: Likewise. + * gcc.dg/charset/extern.c: Likewise. + * gcc.dg/charset/function.c: Likewise. + * gcc.dg/charset/string.c: Likewise. + * gcc.dg/charset/charset.exp: Likewise. + +2005-02-21 Bud Davis <bdavis9659@comcast.net> + + PR fortran/20086 + * gfortran.dg/pr20086.f90: New test. + +2005-02-21 Alexandre Oliva <aoliva@redhat.com> + + PR tree-optimization/19786 + * g++.dg/tree-ssa/pr19786.C: New. + +2005-02-21 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de> + + * lib/gfortran-dg.exp (gfortran-dg-test): Split long regexps. + +2005-02-21 Jeff Law <law@redhat.com> + + * gcc.dg/tree-ssa/20041122-1.c: New test for missing optimization. + +2005-02-20 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de> + + * gfortran.dg/do_iterator: Split loop, markup all lines for + which an error locus is printed. + * gfortran.dg/pr17708.f90: Markup all lines for which an error + locus is printed. + * gfortran.dg/select_4.f90: Likewise. + * lib/gfortran-dg.exp (gfortran-dg-test): Handle gfortran error + locuses in the various permutations. + +2005-02-20 Dorit Naishlos <dorit@il.ibm.com> + + PR tree-optimization/19951 + * g++.dg/vect: New directory. + * g++.dg/vect/vect.exp: New file. + * g++.dg/vect/pr19951.cc: New testcase. + * g++.dg/dg.exp: Also prune vectorizer tests. + +2005-02-20 Zack Weinberg <zack@codesourcery.com> + + PR 18785 + * gcc.dg/charset/builtin1.c: New test. + +2005-02-19 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/19299 + * g++.dg/inherit/volatile1.C: New test. + + PR c++/19440 + * g++.dg/template/dtor4.C: New test. + +2005-02-19 Steven G. Kargl <kargls@comcast.net> + + * gfortran.dg/int_1.f90: New test. + +2005-02-19 Devang Patel <dpatel@apple.com> + + * gcc.dg/cpp/mac-eol-at-eof.c: New test. + +2005-02-19 Steven G. Kargl <kargls@comcast.net> + + * gfortran.dg/achar_1.f90: New test. + +2005-02-19 Hans-Peter Nilsson <hp@axis.com> + + * gcc.c-torture/execute/20020720-1.x: Don't XFAIL cris-*-*. + +2005-02-19 Zdenek Dvorak <dvorakz@suse.cz> + Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/19828 + * gcc.dg/tree-ssa/loop-7.c: New test. + * gcc.c-torture/execute/20050218-1.c: New test. + +2005-02-19 Jakub Jelinek <jakub@redhat.com> + + PR c/20043 + * gcc.dg/transparent-union-1.c: New test. + * gcc.dg/transparent-union-2.c: New test. + +2005-02-18 James E Wilson <wilson@specifixinc.com> + + PR tree-optimization/18977 + * gcc.c-torture/execute/loop-ivopts-1.c: New testcase. + +2005-02-18 Ulrich Weigand <uweigand@de.ibm.com> + + PR target/20054 + * gcc.dg/pr20054.c: New test. + +2005-01-20 Giovanni Bajo <giovannibajo@gcc.gnu.org> + + PR c++/19508 + * g++.dg/ext/attrib20.C: New test. + +2004-02-18 Andrew Pinski <pinskia@physics.uc.edu> + + PR middle-end/20030 + * gfortran.fortran-torture/execute/character_passing.f90: New test. + +2005-02-18 Alexandre Oliva <aoliva@redhat.com> + + PR c++/20008 + * g++.dg/opt/switch4.C: New. + +2005-02-18 Jakub Jelinek <jakub@redhat.com> + + PR c++/20023 + PR tree-optimization/20009 + * gcc.c-torture/compile/20050217-1.c: New test. + * g++.dg/opt/switch3.C: New test. + + PR tree-optimization/18947 + * gcc.c-torture/compile/20050215-1.c: New test. + * gcc.c-torture/compile/20050215-2.c: New test. + * gcc.c-torture/compile/20050215-3.c: New test. + +2005-02-17 Alexandre Oliva <aoliva@redhat.com> + + PR c++/20028 + * g++.dg/template/crash34.C: New. + + PR c++/20022 + * g++.dg/other/access3.C: New. + +2005-02-17 Ira Rosen <irar@il.ibm.com> + + * gcc.dg/vect/vect-98.c: New test. + +2005-02-16 Kazu Hirata <kazu@cs.umass.edu> + + PR tree-optimization/19967 + * gcc.dg/pr19967.c: New. + +2005-02-16 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/19857 + * gcc.dg/tree-ssa/20050215-1.c: New test. + * gcc.c-torture/execute/20050215-1.c: New test. + 2005-02-15 Eric Christopher <echristo@redhat.com> * gcc.dg/cpp/20050215-1.c: New file. @@ -218,9 +1194,9 @@ no longer optimize. * gcc.dg/builtins-47.c: New testcase. -2005-02-07 Leehod Baruch <leehod@il.ibm.com> +2005-02-07 Leehod Baruch <leehod@il.ibm.com> Dorit Naishlos <dorit@il.ibm.com> - + * testsuite/gcc.dg/vect/vect.exp: Add -ftree-vectorizer-verbose=3. 2005-02-06 Richard Sandiford <rsandifo@redhat.com> @@ -249,7 +1225,7 @@ 2005-02-03 Dorit Naishlos <dorit@il.ibm.com> * gcc.dg/vect/vect-85.c: Remove xfail. - * gcc.dg/vect/vect-86.c: Remove xfail. + * gcc.dg/vect/vect-86.c: Remove xfail. * gcc.dg/vect/vect-87.c: Remove xfail. * gcc.dg/vect/vect-88.c: Remove xfail. @@ -273,7 +1249,7 @@ PR c++/19628 * g++/ext/builtin7.C: New. * g++/ext/builtin8.C: New. - + 2005-02-02 Joseph S. Myers <joseph@codesourcery.com> PR c/18502 @@ -427,7 +1403,7 @@ * g++.dg/template/static10.C: New test. PR c++/19395 - * g++.dg/parse/error24.C: New test. + * g++.dg/parse/error24.C: New test. PR c++/19367 * g++.dg/lookup/builtin1.C: New test. @@ -548,7 +1524,7 @@ 2005-01-26 Greg Parker <gparker@apple.com> Stuart Hastings <stuart@apple.com> - + * gcc.c-torture/execute/20050125-1.c: New. 2005-01-18 Jan Hubicka <jh@suse.cz> @@ -861,7 +1837,7 @@ * ada/acats/tests/c3/c92005b.ada: Likewise. * ada/acats/tests/c3/cxb3012.a: Likewise. * ada/acats/norun.lst: Add c380004 and c953002, add PR - + 2005-01-09 Paul Brook <paul@codesourcery.com> * gfortran.dg/common_2.f90: New file. @@ -26126,7 +27102,7 @@ Thu Apr 27 15:58:18 MET DST 2000 Jan Hubicka <jh@suse.cz> * gcc.c-torture/compile/labels-2.c: New test. -1999-12-27 Martin von Löwis <loewis@informatik.hu-berlin.de> +1999-12-27 Martin von L�is <loewis@informatik.hu-berlin.de> * gcc.c-torture/execute/991227-1.c: New test. @@ -26134,7 +27110,7 @@ Thu Apr 27 15:58:18 MET DST 2000 Jan Hubicka <jh@suse.cz> * g++.old-deja/g++.pt/instantiate6.C: Remove excess errors XFAIL. -1999-12-21 Martin von Löwis <loewis@informatik.hu-berlin.de> +1999-12-21 Martin von L�is <loewis@informatik.hu-berlin.de> * gcc.c-torture/execute/991221-1.c: New test. diff --git a/gcc/testsuite/ChangeLog.apple-ppc b/gcc/testsuite/ChangeLog.apple-ppc new file mode 100644 index 00000000000..44cd7e4a522 --- /dev/null +++ b/gcc/testsuite/ChangeLog.apple-ppc @@ -0,0 +1,1346 @@ +2005-06-28 Dale Johannesen <dalej@apple.com> + + Radar 4163069 + * gcc.apple/pack-test-1.c: New. + * gcc.dg/pack-test-1.c: Enable for darwin. + +2005-06-28 Dale Johannesen <dalej@apple.com> + + * gcc.c-torture/execute/20050603-1.c: Move... + * gcc.dg/20050603-1.c: ...to here, and edit to match mainline. + +2005-06-28 Ziemowit Laski <zlaski@apple.com> + + Radar 4140824 + * obj-c++.dg/proto-lossage-5.mm: Bring over from mainline. + * objc.dg/proto-lossage-5.m: Likewise. + +2005-06-23 Ziemowit Laski <zlaski@apple.com> + + * obj-c++.dg/proto-lossage-[1-4].mm: Bring over from mainline. + +2005-06-23 Ziemowit Laski <zlaski@apple.com> + + Radar 4140846 + * obj-c++.dg/typedef-alias-1.mm: Bring over from mainline. + * objc.dg/typedef-alias-1.m: Likewise. + +2005-06-22 Ziemowit Laski <zlaski@apple.com> + + Radar 4154928 + * obj-c++.dg/const-cfstring-5.mm: New. + * obj-c++.dg/const-str-12.mm: New. + * objc.dg/const-cfstring-5.m: New. + * objc.dg/const-str-12.m: New. + +2005-06-21 Ziemowit Laski <zlaski@apple.com> + + * obj-c++.dg/const-cfstring-[1-4].mm: New. + +2005-06-21 Ziemowit Laski <zlaski@apple.com> + + Radar 4149909 + * obj-c++.dg/const-str-[1-9].mm: Bring over from mainline. + * obj-c++.dg/const-str-1[0-1].mm: New. + * objc.dg/const-str-1[0-1].m: New. + +2005-06-20 Dale Johannesen <dalej@apple.com> + + Radar 4151537 + * objc.dg/nopicsetup.m: New. + +2005-06-15 Devang Patel <dpatel@apple.com> + + * g++.dg/pch/debug-1.C: New test. + * g++.dg/pch/debug-1.Hs: New. + +2005-06-13 Dale Johannesen <dalej@apple.com> + + Tests from mainline + Radar 4141805, 4137102 + * gcc.dg/20050607-1.c: New. + * g++.dg/opt/crossjump1.C: New. + +2005-06-13 Dale Johannesen <dalej@apple.com> + + * gcc.c-torture/execute/20050603-1.c: Fix marker. + +2005-06-03 Dale Johannesen <dalej@apple.com> + + Radar 4131839 (from mainline) + * gcc.c-torture/execute/20050603-1.c: New. + +2005-05-31 Devang Patel <dpatel@apple.com> + + Radar 4133821 + * gcc.dg/bincl-1.c: New test. + * gcc.dg/bincl-1.h: New. + * g++.dg/bincl-1.C: New test. + * g++.dg/bincl-1.h: New. + +2005-05-26 Ziemowit Laski <zlaski@apple.com> + + Radar 4128976 + * objc.dg/comp-types-11.m: Bring over from mainline. + * obj-c++.dg/comp-types-12.mm: Likewise. + +2005-05-26 Ziemowit Laski <zlaski@apple.com> + + * obj-c++.dg/selector-[2-4].mm: Bring over from mainline. + * objc.dg/selector-3.m: Likewise. + +2005-05-19 Ziemowit Laski <zlaski@apple.com> + + Radar 4035492 + * obj-c++.dg/bitfield-[1-5].mm, obj-c++.dg/class-protocol-1.mm, + obj-c++.dg/comp-types-1[0-1].mm, obj-c++.dg/comp-types-[2-9].mm, + obj-c++.dg/encode-[4-8].mm, obj-c++.dg/layout-1.mm, + obj-c++.dg/method-1[0-9].mm, obj-c++.dg/method-2[0-1].mm, + obj-c++.dg/method-[8-9].mm, obj-c++.dg/objc-gc-3.mm, + try-catch-10.mm: New. + * obj-c++.dg/objc-gc-1.mm: Add another test. + * objc.dg/bitfield-5.m, objc.dg/comp-types-10.m, + objc.dg/comp-types-9.m, objc.dg/layout-1.m, objc.dg/objc-gc-4.m, + objc.dg/try-catch-9.m: New. + * objc.dg/class-protocol-1.m, objc.dg/comp-types-1.m, + objc.dg/comp-types-[5-6].m, objc.dg/method-9.m: Tweak diagnostics. + +2005-05-17 Devang Patel <dpatel@apple.com> + + Radar 4119059 + * gcc.dg/darwin-altivec-vspl.c: New. + * gcc.apple/apple-altivec-12.c: Fix. + +2005-05-26 Ziemowit Laski <zlaski@apple.com> + + * objc.dg/selector-4.m: Bring over from mainline. + +2005-05-26 Ziemowit Laski <zlaski@apple.com> + + * obj-c++.dg/selector-1.mm: Adjust APPLE LOCAL marker. + * obj-c++.dg/selector-4.mm: Bring over from mainline. + +2005-05-25 Ziemowit Laski <zlaski@apple.com> + + * obj-c++.dg/selector-2.mm: New. + * obj-c++.dg/selector-3.mm: New. + * objc.dg/selector-3.m: New. + +2005-05-25 Ziemowit Laski <zlaski@apple.com> + + * objc.dg/selector-2.m: Remove "-fgnu-runtime"; be flexible + about where warning appears. + +2005-05-16 Ziemowit Laski <zlaski@apple.com> + + Radar 4087344 + * objc.dg/stret-2.m: Grow the 'blob' struct just a bit, + so that ..._stret messaging kicks in on x86 also. + +2005-05-13 Stuart Hastings <stuart@apple.com> + + * gcc.apple/i386-deep-branch-predict-1.c: Added -fPIC. + +2005-05-13 Ziemowit Laski <zlaski@apple.com> + + * objc.dg/volatile-1.m: Provide a + scan-assembler pattern for x86 Darwin. + +2005-05-13 Ziemowit Laski <zlaski@apple.com> + + Radar 4087344 + * objc.dg/symtab-1.m: Accept '.word' as + a synonym for '.short'. + +2005-05-11 Stan Shebs <shebs@apple.com> + + * gcc.dg/darwin64-abi.c: New testcase. + +2005-05-11 Devang Patel <dpatel@apple.com> + + Radar 4110735 + * g++.dg/opt/20050511-1.C: New test. + +2005-05-09 Dale Johannesen <dalej@apple.com> + + Radar 4113078 + * gcc.apple/4113078.c: New. + +2005-05-06 Dale Johannesen <dalej@apple.com> + + Radar 4104248 + * gcc.apple/4104248.c: New. + +2005-05-06 Dale Johannesen <dalej@apple.com> + + Radar 4090661 + * gcc.apple/4090661.c: New. + +2005-05-02 Dale Johannesen <dalej@apple.com> + + Radar 4102133 + * gcc.apple/4102133.c: New. + +2005-05-01 Jon Ziegler <jonz@apple.com> + + Radar 4101687 + * gcc.apple/4101687.c: clean up + +2005-04-29 Dale Johannesen <dalej@apple.com> + + Radar 4101687 + * gcc.apple/4101687.c: New. + +2005-04-28 Devang Patel <dpatel@apple.com> + + Radar 4086969 + * gcc.dg/warn-discard-qual.c: New + +2005-04-25 Dale Johannesen <dalej@apple.com> + + Radar 4100712 + * gcc.c-torture/execute/pr21173.c: New. + * gcc.apple/4100712.c: New. + +2005-04-25 Devang Patel <dpatel@apple.com> + + Radar 3954848 + * gcc.dg/stabs-attrib-vector-darwin.c: New. + +2005-04-25 Ziemowit Laski <zlaski@apple.com> + + Radar 4094385 + * g++.dg/template/templ-deref-1.C: New. + +2005-04-22 Devang Patel <dpatel@apple.com> + + * gcc.apple/falign-loops-max-skip-3.c: Fix typo. + +2005-04-21 Dale Johannesen <dalej@apple.com> + + * gcc.apple/opt-pragma-[1-5].c: New. + g++.dg/ext/opt-pragma-[2-4].C: New. + +2005-04-21 Dale Johannesen <dalej@apple.com> + + * g++.dg/4080945a.C: New. + +2005-04-21 Devang Patel <dpatel@apple.com> + + Radar 4058553 + * gcc.apple/very-long-comment.c: New. + +2005-04-21 Devang Patel <dpatel@apple.com> + + Radar 4080840 + * gcc.apple/faling-loops-max-skip-3.c: New. + +2005-04-19 Ziemowit Laski <zlaski@apple.com> + + Radar 4056870 + * obj-c++.dg/super-class-2.mm: New. + * objc.dg/super-class-4.m: New. + +2005-04-18 Devang Patel <dpatel@apple.com> + + * gcc.dg/vect/vect-11.c: Update APPLE LOCAL markers to reflect + check-in on mainline. + * gcc.dg/vect/vect-11a.c: Same. + * gcc.dg/vect/vect-none.c: Same. + * lib/target-supports.exp (check_effective_target_vect_int_mult): Same. + +2005-04-15 Devang Patel <dpatel@apple.com> + + Radar 3972875 + * gcc.dg/vect/vect-11.c: Require effective target vect_int_mult. + * gcc.dg/vect/vect-11a.c: New. + * gcc.dg/vect/vect-none.c: Update. + * lib/target-supports.exp (check_effective_target_vect_int_mult): New. + +2005-04-14 Devang Patel <dpatel@apple.com> + + Radar 4080840 + * gcc.apple/falign-jumps-max-skip-1.c: New test. + * gcc.apple/falign-jumps-max-skip-2.c: New test. + * gcc.apple/falign-loops-max-skip-1.c: New test. + * gcc.apple/falign-loops-max-skip-2.c: New test. + +2005-04-14 Devang Patel <dpatel@apple.com> + + Radar 3972515 + * lib/target-supports.exp (check_effective_target_vect_shif): New. + * gcc.dg/vect/vect-shift-1.c: New test. + +2005-04-12 Devang Patel <dpatel@apple.com> + + * gcc.dg/vect/vect-98.c: Fix xfail typo. + +2005-04-12 Devang Patel <dpatel@apple.com> + + Radar 4084941 + * gcc.dg/vect/vect-98.c: xfail. + +2005-04-11 Ziemowit Laski <zlaski@apple.com> + + Radar 4065844 + * obj-c++.dg/encode-3.mm: New. + +2005-04-11 Ziemowit Laski <zlaski@apple.com> + + Radar 4073569 + * obj-c++.dg/method-6.mm: New. + * obj-c++.dg/method-7.mm: New. + * objc.dg/method-19.m: New. + * objc.dg/method-5.m: Tweak warnings. + +2005-04-08 Ziemowit Laski <zlaski@apple.com> + + Radar 4055183 + * obj-c++.dg/stubify-1.mm: New. + * obj-c++.dg/stubify-2.mm: New. + * objc.dg/stubify-1.m: Redact APPLE LOCAL marker. + * objc.dg/stubify-2.m: New. + +2005-04-07 Stuart Hastings <stuart@apple.com> + + * gcc.apple/asm-function-15.c: Mark powerpc only. + * gcc.apple/asm-function-16.c: Likewise. + +2005-04-07 Devang Patel <dpatel@apple.com> + + Radar 4069922 + * g++.dg/tree-sra/ssa-sra-3.C: New test. + +2005-04-02 Ziemowit Laski <zlaski@apple.com> + + Radar 4072153 + * gcc.apple/comma-expr-1.c: New. + +2005-03-31 Dale Johannesen <dalej@apple.com> + + * gcc.dg/tree-ssa-chrec/ssa-chrec-55.c: Include stdio.h. + +2005-03-30 Dale Johannesen <dalej@apple.com> + + * gcc.dg/tree-ssa-chrec/ssa-chrec-[30|31| + 32|33|34|35|36|52|59|60]: Remove. + All above files with .ddall suffix: Remove. + ssa-chrec-[03|04|06|07|08|10|56|57|58]: Adjust + flags to ones that exist. + +2005-03-30 Dale Johannesen <dalej@apple.com> + + Radar 3955567 + * gcc.apple/bitreverse-[0-9].c: New. + +2005-03-21 Stuart Hastings <stuart@apple.com> + + Radars 3805723 4010664 3965893 4010496 4015764 + * objc.dg/stubify-1.m, objc.dg/stubify-2.m + gcc.apple/i386-deep-branch-predict-1.c, gcc.apple/dynamic-no-pic-1.c: New. + +2005-03-11 Ziemowit Laski <zlaski@apple.com> + + Radar 3995882 + * obj-c++.dg/try-catch-9.mm: New. + * objc.dg/try-catch-8.m: New. + +2005-03-09 Ziemowit Laski <zlaski@apple.com> + + * objc.dg/selector-2.m: Move dg-warning to correct line. + +2005-03-08 Devang Patel <dpatel@apple.com> + + * gcc.dg/vect/vect-none.c: One test that uses condition + is now vectorized. + +2005-03-03 Dale Johannesen <dalej@apple.com> + + Radar 3897244 + * gcc.apple/align-test-1.c: Adjust for x86. + * gcc.apple/align-test-2.c: Adjust for x86. + * gcc.apple/align-test-3.c: Adjust for x86. + * gcc.apple/align-test-4.c: Adjust for x86. + * gcc.apple/align-test-5a.c: Adjust for x86. + * gcc.apple/align-test-5d.c: New. + * g++.dg/align-test-1.C: Adjust for x86. + * g++.old-deja/g++.abi/align.C: Enable for darwin x86. + +2005-03-02 Robert Bowdidge <bowdidge@apple.com> + Radar 4025923 + * g++.dg/kext11.C: add new test for ptmf casts in kexts + +2005-03-02 Stan Shebs <shebs@apple.com> + + Radar 3951637 + * gcc.dg/ppc_intrinsics-2.c: New. + * gcc.dg/ppc_intrinsics-1.c: Is ppc-only. + +2005-03-01 Ziemowit Laski <zlaski@apple.com> + + Radar 4015382 (Part II) + * g++.dg/ext/new-delete-1.C: Replace confusing '$' + with '.' in search string. + * g++.dg/ext/new-delete-2.C: Likewise. + +2005-02-28 Ziemowit Laski <zlaski@apple.com> + + Radar 4015382 + * g++.dg/ext/new-delete-1.C: New. + * g++.dg/ext/new-delete-2.C: New. + +2005-02-25 Stan Shebs <shebs@apple.com> + + Radar 4020219 + * gcc.dg/pragma-darwin.c: Avoid mac68k align stuff if 64-bit. + * g++.dg/expr/align68k-1.C: Stub out for 64-bit. + * g++.dg/expr/align68k-2.C: Stub out for 64-bit. + +2005-02-23 Devang Patel <dpatel@apple.com> + + Radar 4021019 + * gcc.apple/ppc-ignored-options.c: New test. + * gcc.apple/x86-ignored-options.c: New test. + +2005-02-23 Ziemowit Laski <zlaski@apple.com> + + Radar 3809189 (additional test cases) + * obj-c++.dg/pascal-strings-1.mm: New. + * obj-c++.dg/pascal-strings-2.mm: New. + * objc.dg/pascal-strings-1.m: New. + +2005-02-22 Devang Patel <dpatel@apple.com> + + Radar 3844827 + Backport from Mainline. + + 2005-01-18 Michael Matz <matz@suse.de> + + * gcc.dg/Wno-pointer-sign.c: New test for -Wno-pointer-sign. + +2005-02-22 Dale Johannesen <dalej@apple.com> + + Radar 4015820 + * obj-c++.dg/objc-fast-4.mm: New. + +2005-02-22 Dale Johannesen <dalej@apple.com> + + Radar 4015820 + * objc.dg/objc-fast-4.m: New. + +2005-02-21 Stan Shebs <shebs@apple.com> + + Radar 3939071 + * gcc.dg/mac68k-pragma-unsup-1.c: New. + +2005-02-21 Ziemowit Laski <zlaski@apple.com> + + Radar 3809189 + * g++.dg/pascal-strings-3.C: New. + * g++.dg/pascal-strings-4.C: New. + * gcc.apple/pascal-strings-3.c: New. + +2005-02-21 Devang Patel <dpatel@apple.com> + + Radar 4007432 + * gcc.dg/cpp/mac-eol-at-eof.c: New test. + +2005-02-19 Ziemowit Laski <zlaski@apple.com> + + Radar 4014879 + * obj-c++.dg/objc-fast-3.mm: New. + * objc.dg/objc-fast-3.m: New. + +2005-02-18 Devang Patel <dpatel@apple.com> + + Radar 3984893 + * gcc.dg/vect/vect-dv-1.c: New. + +2005-02-18 Ziemowit Laski <zlaski@apple.com> + + Radar 4011192 + * obj-c++.dg/try-catch-7.mm: New. + * obj-c++.dg/try-catch-8.mm: New. + * objc.dg/try-catch-6.m: New. + * objc.dg/try-catch-7.m: New. + +2005-02-17 Devang Patel <dpatel@apple.com> + + Radar 3958387 + * gcc.apple/Wno-newline-1.c: New. + * gcc.apple/Wno-newline-2.c: New. + +2005-02-17 Fariborz Jahanian <fjahanian@apple.com> + + Radar 3971074 + + * gcc.apple/asm-function-14.c: New. + +2005-02-17 Ziemowit Laski <zlaski@apple.com> + + Radar 4006978 + * obj-c++.dg/isa-field-1.mm: New. + * objc.dg/isa-field-1.m: New. + +2005-02-17 Ziemowit Laski <zlaski@apple.com> + + Radar 3635843, 3922342 + * obj-c++.dg/objc-fast-1.mm: New. + * obj-c++.dg/objc-fast-2.mm: New. + * obj-c++.dg/objc-gc-1.mm: New. + * obj-c++.dg/objc-gc-2.mm: New. + * objc.dg/next-runtime-1.m: New. + * objc.dg/objc-fast-1.m: New. + * objc.dg/objc-fast-2.m: New. + * objc.dg/objc-gc-1.m: New. + * objc.dg/objc-gc-2.m: New. + * objc.dg/objc-gc-3.m: New. + +2005-02-16 Dale Johannesen <dalej@apple.com> + + Radar 4006687 + * gcc.dg/i386-mmx-6.c: New (from mainline). + +2005-02-16 Dale Johannesen <dalej@apple.com> + + Radar 3991611 + * gcc.c-torture/execute/20050111-1.c: New (from mainline). + +2005-02-16 Fariborz Jahanian <fjahanian@apple.com> + + Radar 3970655 + + * g++.dg/asm-function-13.C: New. + * gcc.apple/asm-function-13.c: New. + +2005-02-11 Ziemowit Laski <zlaski@apple.com> + + Radar 3962013 (Part 2) + * obj-c++.dg/method-5.mm: New. + * objc.dg/method-18.m: New. + * objc.dg/method-6.m: Add '-Wstrict-selector-match' flag. + * objc.dg/method-9.m: Likewise. + +2005-02-11 Ziemowit Laski <zlaski@apple.com> + + Radar 3978619 + * obj-c++.dg/super-dealloc-1.mm: New. + * obj-c++.dg/super-dealloc-2.mm: New. + * objc.dg/super-dealloc-1.m: New. + * objc.dg/super-dealloc-2.m: New. + +2005-02-11 Devang Patel <dpatel@apple.com> + + Radar 3996800 + * gcc.dg/pch/pch.exp: Test MACOSX_DEPLOYMENT_TARGET and -save-temps. + +2005-02-10 Ziemowit Laski <zlaski@apple.com> + + Radar 3993052 + * obj-c++.dg/pragma-2.mm: New. + * objc.dg/pragma-1.m: New. + +2005-02-10 Ziemowit Laski <zlaski@apple.com> + + Radar 3982256 + * objc.dg/comp-types-7.m: Sync with FSF mainline. + * objc.dg/comp-types-8.m: New. + +2005-02-08 Ziemowit Laski <zlaski@apple.com> + + Radar 3987972 + * objc.dg/method-17.m: New. + +2005-02-08 Ziemowit Laski <zlaski@apple.com> + + Radar 3987120 + * obj-c++.dg/encode-2.mm: New. + +2005-02-06 Dale Johannesen <dalej@apple.com> + + * g++.dg/kext10.C: new. + +2005-02-02 Stan Shebs <shebs@apple.com> + + * gcc.apple/align-test-5b.c: Xfail for 64-bit. + * gcc.apple/align-test-5c.c: Xfail for 64-bit. + * gcc.apple/mac68k-align-unsup.c: New. + +2005-02-02 Ziemowit Laski <zlaski@apple.com> + + Radar 3984534 + * g++.dg/ext/lvalue-cast-1.cpp: Rename to + g++.dg/ext/lvalue-cast-1.C. + * g++.dg/ext/lvalue-cast-2.cpp: Rename to + g++.dg/ext/lvalue-cast-2.C. + * g++.dg/ext/lvalue-cond-1.cpp: Remove duplicated + lines; rename to g++.dg/ext/lvalue-cond-1.C; mark + warnings as bogus. + +2005-02-02 Ziemowit Laski <zlaski@apple.com> + + Radar 3978104 + * obj-c++.dg/extra-semi.mm: New. + * objc.dg/extra-semi.m: New. + +2005-02-01 Devang Patel <dpatel@apple.com> + + Radar 3983593 + * gcc.dg/pch/faltivec-1.hs: New. + * gcc.dg/pch/faltivec-1.c: New. + +2005-01-31 Ziemowit Laski <zlaski@apple.com> + + Radar 3978168 + * g++.dg/ext/lvalue-cast-2.cpp: New. + * gcc.dg/lvalue-cast-2.c: New. + +2004-01-31 Devang Patel <dpatel@apple.com> + + Radar 3978580 + * gcc.apple/const-cfstring-4.c: New test. + +2005-01-31 Dale Johannesen <dalej@apple.com> + + Radar 3974393 + * g++.dg/pr19650.C: Modify, move to opt subdirectory. + +2005-01-30 Ziemowit Laski <zlaski@apple.com> + + Radar 3962013 + * obj-c++.dg/method-3.mm: New. + * obj-c++.dg/method-4.mm: New. + * objc.dg/method-16.m: New. + * objc.dg/method-7.m: Add '-Wstrict-selector-match'. + +2005-01-27 Dale Johannesen <dalej@apple.com> + + Radar 3974393 + PR 19650 + * g++.dg/pr19650.C: New. + +2005-01-27 Mike Stump <mrs@apple.com> + + Radar 3978098 + * g++.old-deja/g++.mike/pascal.C: Add. + +2005-01-27 Matt Austern <austern@apple.com> + + Radar 3971445 + * obj-c++.dg/template-5.mm: New. + * obj-c++.dg/template-6.mm: New. + +2005-01-27 Ziemowit Laski <zlaski@apple.com> + + Radar 3971244 + * obj-c++.dg/comp-types-1.mm: New. + +2005-01-26 Matt Austern <austern@apple.com> + + Radar 3972840 + * g++.dg/kext9.C: New. + +2005-01-26 Devang Patel <dpatel@apple.com> + + Radar 3971329 + * obj-c++.dg/extern-c-1.mm: New test case. + +2005-01-26 Ziemowit Laski <zlaski@apple.com> + + Radar 3970884 + * g++.dg/ext/apple-altivec-5.C: New. + * g++.dg/ext/apple-altivec-6.C: New. + +2005-01-25 Stan Shebs <shebs@apple.com> + + Radar 3220997 + * g++.dg/align-test-1.C: Fix old problems, add 64-bit cases. + +2005-01-25 Ziemowit Laski <zlaski@apple.com> + + Radar 3961973 (Part 3) + * gcc.dg/cast-lvalue-2.c: Add '-fno-non-lvalue-assign'. + * gcc.dg/lvalue1.c: Likewise. + * gcc.dg/lvalue-cond-1.c: Remove duplicated lines. + +2005-01-24 Ziemowit Laski <zlaski@apple.com> + + Radar 3968938 + * obj-c++.dg/lookup-2.mm: New. + * objc.dg/lookup-1.m: New. + +2005-01-24 Ziemowit Laski <zlaski@apple.com> + + Radar 3961973 (Part 2) + * obj-c++.dg/lvalue-cast-1.mm: New. + * objc.dg/lvalue-cast-1.m: New. + +2005-01-23 Ziemowit Laski <zlaskI@apple.com> + + Radar 3961973 + * gcc.dg/cond-lvalue-1.c: Add '-fno-non-lvalue-assign'; + adjust expected line number for error message. + * g++.dg/ext/lvalue-cast-1.cpp: Rename -flvalue-cast-assign + to -fnon-lvalue-assign; adjust wording of warning message. + * gcc.dg/lvalue-cast-1.c: Likewise. + * g++.dg/ext/lvalue-cond-1.cpp: New. + * gcc.dg/lvalue-cond-1.c: New. + +2005-01-21 Stan Shebs <shebs@apple.com> + + Radar 3952527 + * gcc.apple/align-test-1.c: Add 64-bit alignment values. + * gcc.apple/align-test-2.c: Add 64-bit alignment values. + * gcc.apple/align-test-3.c: Skip over if compiling 64-bit. + * gcc.apple/align-test-4.c: Add 64-bit alignment values. + +2005-01-21 Ziemowit Laski <zlaski@apple.com> + + Radar 3951887 + * objc.dg/comp-types-7.m: New. + +2005-01-20 Geoffrey Keating <geoffk@apple.com> + + Radar 3958413 + * gcc.dg/cpp/cpp.exp: Copy headermap test files into '.'. + * gcc.dg/cpp/headermap-1.c: New. + * gcc.dg/cpp/headermap-2.c: New. + * gcc.dg/cpp/headermap.hmap: New. + * gcc.dg/cpp/inc/A.h: New. + * gcc.dg/cpp/inc/bA.h: New. + * gcc.dg/cpp/inc/c.h: New. + * gcc.dg/cpp/inc/d/d.h: New. + +2005-01-20 Robert Bowdidge <bowdidge@apple.com> + Radar 3962986 + * g++.dg/kext8.C: new check for no coalesced sections in .o's. + +2005-01-19 Matt Austern <austern@apple.com> + + Radar 3960754 + * obj-c++.dg/overload-1.mm: New. + +2005-01-17 Ziemowit Laski <zlaski@apple.com> + + Radar 3955336 + * obj-c++.dg/cxx-scope-1.mm: New. + * obj-c++.dg/cxx-scope-2.mm: New. + +2005-01-17 Ziemowit Laski <zlaski@apple.com> + + Radar 3953044 (PR objc/19321) + * objc.dg/func-ptr-2.m: New. + * objc.dg/volatile-1.m: New. + +2005-01-17 Ziemowit Laski <zlaski@apple.com> + + Radar 3951689 + * obj-c++.dg/try-catch-1.mm: New. + * obj-c++.dg/try-catch-2.mm: New. + * obj-c++.dg/try-catch-3.mm: New. + * obj-c++.dg/try-catch-4.mm: New. + * obj-c++.dg/try-catch-5.mm: New. + * obj-c++.dg/try-catch-6.mm: New. + +2005-01-14 Stuart Hastings <stuart@apple.com> + + Radar 3943021 + * gcc.apple/fenv-minmax-1.c: New. + +2005-01-11 Ziemowit Laski <zlaski@apple.com> + + Radar 3918079 + * obj-c++.dg/method-2.mm: New. + * objc.dg/method-15.m: New. + +2005-01-10 Ziemowit Laski <zlaski@apple.com> + + Radar 3943452 + * g++.dg/ext/apple-altivec-4.C: New. + * gcc.apple/apple-altivec-14.c: New. + +2005-01-08 Dale Johannesen <dalej@apple.com> + + Radar 3941146 + * gcc.dg/pr17133.c: New test. + +2005-01-08 Ziemowit Laski <zlaski@apple.com> + + Radar 3913725 + * g++.dg/ext/lvalue-cast-1.cpp: New. + * gcc.dg/lvalue-cast-1.c. + +2005-01-07 Devang Patel <dpatel@apple.com> + + Radar 3943502 + * obj-c++.dg/defs.mm: New test. + +2005-01-07 Stuart Hastings <stuart@apple.com> + + * gcc.apple/notailcall-1.c: Now tests PPC in addition to x86. + +2005-01-06 Andrew Pinski <pinskia@physics.uc.edu> + Stuart Hastings <stuart@apple.com> + + Radar 3830232 + * gcc/testsuite/gcc.apple/notailcall-1.c: New testcase (also recorded in gcc/ChangeLog.apple-ppc). + +2005-01-06 Robert Bowdidge <bowdidge@apple.com> + + * g++.dg/kext7.C: New. + +2005-01-06 Ziemowit Laski <zlaski@apple.com> + + Radar 3925982 + * obj-c++.dg/encode-1.mm: New. + * objc.dg/encode-6.m: New. + +2005-01-06 Ziemowit Laski <zlaski@apple.com> + + Radar 3926755 + * g++.dg/ext/apple-altivec-1.C: New. + * g++.dg/ext/apple-altivec-2.C: New. + * gcc.apple/apple-altivec-12.c: New. + * gcc.apple/apple-altivec-13.c: New. + +2005-01-06 Devang Patel <dpatel@apple.com> + + Radar 3941766 + * obj-c++.dg/empty-private-1.mm: New test. + +2005-01-05 Mark Mitchell <mark@codesourcery.com> + Matt Austern <austern@apple.com> + + Radar 3934803 + PR c++/18369 + * g++.dg/init/new12.C: New test. + +2005-01-03 Alexander Malmberg <alexander@malmberg.org> + Ziemowit Laski <zlaski@apple.com> + + Radar 3926282 (PR objc/18971) + * objc.dg/encode-5.m: New test. + +2004-12-22 Devang Patel <dpatel@apple.com> + + * gcc.apple/Wextra-tokens-2.c: Remove. + +2004-12-22 Devang Patel <dpatel@apple.com> + + * gcc.dg/vect/vect-ifcvt-9.c: New. + +2004-12-21 Ziemowit Laski <zlaski@apple.com> + + Radar 3866407 + * g++.dg/ext/apple-altivec-3.C: New. + +2004-12-20 Dale Johannesen <dalej@apple.com> + + Radar 3926484 + * objc.dg/no-extra-load.m: New. + * obj-c++.dg/no-extra-load.mm: New. + +2004-12-20 Matt Austern <austern@apple.com> + + Radar 3845716 + PR c++/19044 + * g++.dg/ext/builtin6.C: New + +2004-12-16 Ziemowit Laski <zlaski@apple.com> + + Radar 3921172 (from mainline) + * objc.dg/stabs-1.m: New. + +2004-12-15 Dale Johannesen <dalej@apple.com> + + Radar 3619824 + * gcc.apple/no-math-errno.c: New. + +2004-12-15 Ziemowit Laski <zlaski@apple.com> + + Radar 3918376 + * gcc.apple/apple-altivec-4.c: New. + +2004-12-15 Ziemowit Laski <zlaski@apple.com> + + Radar 3913672 + * gcc.apple/apple-altivec-3.c: New. + +2004-12-13 Mike Stump <mrs@apple.com> + + Radar 3865314 + * gcc.apple/shorten.c: New. + +2004-12-10 Devang Patel <dpatel@apple.com> + + * gcc.dg/vect/vect-ifcvt-2.c: Update. + * gcc.dg/vect/vect-ifcvt-3.c: Update. + * gcc.dg/vect/vect-ifcvt-4.c: Update. + * gcc.dg/vect/vect-ifcvt-5.c: Update. + * gcc.dg/vect/vect-ifcvt-6.c: Update. + * gcc.dg/vect/vect-ifcvt-7.c: Update. + * gcc.dg/vect/vect-ifcvt-8.c: New. + +2004-12-10 Ziemowit Laski <zlaski@apple.com> + + Radar 3640156, 3877958 + * gcc.apple/apple-altivec-1.c, gcc.apple/apple-altivec-2.c: New. + +2004-12-10 Devang Patel <dpatel@apple.com> + + Radar 3909961 + * gcc.apple/Wextra-tokens-2.c: New test. + +2004-12-07 Dale Johannesen <dalej@apple.com> + + Radar 3907006 + * gcc.dg/tree-ssa/20040308-4.c: Remove. + +2004-11-24 Devang Patel <dpatel@apple.com> + + * gcc.dg/cpp/isysroot-1.c: cosmetic changes to match mainline. + * gcc.dg/cpp/usr/include/stdio.h: Same. + * gcc.dg/cpp/isysroot-2.c: Same. + * gcc.dg/cpp/System/Library/Framwork/Carbon.framework/Headers/Carbon.h: Same. + +2004-11-23 Devang Patel <dpatel@apple.com> + + * gcc.dg/cpp/isysroot-1.c: New test. + * gcc.dg/cpp/usr/include/stdio.h: New file. + * gcc.dg/cpp/isysroot-2.c: New test. + * gcc.dg/cpp/System/Library/Framework/Carbon.framework/Headers/Carbon.h: + New file. + +2004-11-23 Ziemowit Laski <zlaski@apple.com> + + Radar 3883557 + * obj-c++.dg/cxx-class-1.mm: New test. + +2004-11-17 Devang Patel <dpatel@apple.com> + + * gcc.apple/altivec-use.c: Remove. + +2004-11-17 Devang Patel <dpatel@apple.com> + + * gcc.dg/vect/vect-none.c: Now 2 loops are vectorized. + +2004-11-16 Devang Patel <dpatel@apple.com> + + From autovect-branch. + + * gcc.dg/vect/vect-ifcvt-1.c: New test. + * gcc.dg/vect/vect-ifcvt-2.c: New test. + * gcc.dg/vect/vect-ifcvt-3.c: New test. + * gcc.dg/vect/vect-ifcvt-4.c: New test. + * gcc.dg/vect/vect-ifcvt-5.c: New test. + * gcc.dg/vect/vect-ifcvt-6.c: New test. + * gcc.dg/vect/vect-ifcvt-7.c: New test. + +2004-11-14 Ziemowit Laski <zlaski@apple.com> + + Radar 3877761 + * obj-c++.dg/ivar-list-semi.mm: New test. + +2004-11-10 Ziemowit Laski <zlaski@apple.com> + + Radar 3761423 + * obj-c++.dg/cxx-ivars-2.mm, obj-c++.dg/template-3.mm: + Make ivars @public to squash new warnings/errors. + * obj-c++.dg/private-1.mm, obj-c++.dg/private-2.mm: + New tests. + +2004-11-10 Devang Patel <dpatel@apple.com> + + Partial Radar 3846472 fix + * gcc.dg/tree-ssa-chrec/ssa-chrec-01.c: Adjust. + * gcc.dg/tree-ssa-chrec/ssa-chrec-02.c: Adjust. + * gcc.dg/tree-ssa-chrec/ssa-chrec-03.c: Adjust. + * gcc.dg/tree-ssa-chrec/ssa-chrec-04.c: Adjust. + * gcc.dg/tree-ssa-chrec/ssa-chrec-05.c: Adjust. + * gcc.dg/tree-ssa-chrec/ssa-chrec-06.c: Adjust. + * gcc.dg/tree-ssa-chrec/ssa-chrec-10.c: Adjust. + * gcc.dg/tree-ssa-chrec/ssa-chrec-15.c: Adjust. + * gcc.dg/tree-ssa-chrec/ssa-chrec-27.c: Adjust. + +2004-11-10 Devang Patel <dpatel@apple.com> + + Radar 384609 + More FSF merge cleanup. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-13.c: Remove test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-34.c: Remove test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-36.c: Remove test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-44.c: Remove test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-48.c: Remove test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-60.c: Remove test. + +2004-11-08 Ziemowit Laski <zlaski@apple.com> + + Radar 3853429 + * objc.dg/const-str-8.m, objc.dg/const-str-9.m, + objc.dg/const-cfstring-3.m, objc.dg/const-cfstring-4.m: + New tests. + +2004-11-08 Devang Patel <dpatel@apple.com> + + Radar 3869007 + * gcc.dg/tree-ssa/ivcanon-1.c: Do not use -fscalar-evolutions. + +2004-11-05 Devang Patel <dpatel@apple.com> + + Radar 3853509. + * obj-c++.dg/lookup-1.mm: New test. + * obj-c++.dg/pragma-1.mm: New test. + +2004-11-04 Devang Patel <dpatel@apple.com> + + Radar 3837835 + * gcc.apple/altivec-use.c: New test. + +2004-11-01 Ziemowit Laski <zlaski@apple.com> + + Radar 2810013 (includes fix from mainline) + * obj-c++.dg/local-decl-1.mm: New test. + * objc.dg/local-decl-2.m: New test. + +2004-10-29 Stuart Hastings <stuart@apple.com> + + * gcc.apple/special/liblongcall.c: Add #include <stdio.h>. + * gcc.apple/special/longcall-prog.c: Add #include <stdlib.h>. + +2004-10-29 Devang Patel <dpatel@apple.com> + + FSF merge cleanup. + * gcc.dg/tree-ssa-vect/ifc-03.c: Remove test. + * gcc.dg/tree-ssa-vect/ifc-03.c: Remove.test. + * gcc.dg/tree-ssa-vect/tree-vect.h (exit): Add extern decl. + (abort): Same. + * gcc.dg/tree-ssa-vect/ifc-01.c: XFAIL. + * gcc.dg/tree-ssa-vect/ifc-02.c: XFAIL. + +2004-10-29 Devang Patel <dpatel@apple.com> + + FSF merge cleanup. These tests now live in gcc.dg/vect directory. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-1.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-10.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-11.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-12.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-14.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-15.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-16.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-17.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-18.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-19.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-2.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-20.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-22.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-23.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-24.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-25.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-26.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-27.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-28.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-29.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-3.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-30.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-32.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-33.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-4.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-40.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-41.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-42.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-43.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-45.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-46.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-47.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-49.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-5.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-50.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-51.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-52.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-53.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-54.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-55.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-56.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-57.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-58.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-59.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-6.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-61.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-7.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-8.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-9.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-all.c: Remove. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-none.c: Remove. + +2004-10-27 Ziemowit Laski <zlaski@apple.com> + + Radar 3854155 + * obj-c++.dg/cxx-ivars-3.mm: New test. + +2004-10-26 Geoffrey Keating <geoffk@apple.com> + + Radar 3840704 + * gcc.apple/altivec-5.c: New. + +2004-10-26 Ziemowit Laski <zlaski@apple.com> + + Radar 3833116 (fix from mainline) + * objc.dg/super-class-3.m: New test. + +2004-10-21 Andrew Pinski <pinskia@physics.uc.edu> + + Radar 3845826 (PR objc/17923) + * objc.dg/const-str-7.m: New test. + +2004-10-21 Ziemowit Laski <zlaski@apple.com> + + Radar 3540965 + * obj-c++.dg/cxx-ivars-1.mm: New. + * obj-c++.dg/cxx-ivars-2.mm: New. + +2004-10-18 Robert Bowdidge <bowdidge@apple.com> + + Radar 3843618 + * Add g++.dg/lookup/koenig4.C: Bring the fix for PR/17829 over + from mainline so that Finder_FE will build again. + +2004-10-18 Ziemowit Laski <zlaski@apple.com> + + Radar 3832999 (fix from mainline) + * objc.dg/method-14.m: New test. + +2004-10-18 Devang Patel <dpatel@apple.com> + + Radar 3753408 + * gcc.dg/tree-ssa-vect/tree-ssa-vect-21.c: Remove test. + +2004-10-13 Geoffrey Keating <geoffk@apple.com> + + Radar 3476357 + * gcc.apple/inttypes-4.c: New test. + +2004-10-11 Devang Patel <dpatel@apple.com> + + * gcc.apple/ppc_intrinsics-1.c: New test. + +2004-09-14 Andrew Pinski <apinski@apple.com> + + Rest of Radar 3753405 + * g++.dg/asm-block-[12].C: Mark abort as extern "C". + * g++.dg/asm-function-[1-5].C: Likewise. + * g++.dg/asm-function-5.C (foo): Fix inline asm so that we load the right + saved link register. + +2004-09-13 Andrew Pinski <apinski@apple.com> + + Part of radar 3753405 and all of 3767339 + * gcc.apple/asm-block-[1-2].c: Add prototype for abort. + * gcc.apple/asm-function-[1-6].c: Likewise. + +2004-08-19 Geoffrey Keating <geoffk@apple.com> + + * gcc.apple/inttypes-3.c: New file. + +2004-08-22 Andrew Pinski <apinski@apple.com> + + * g++.dg/opt/pr14029.C: New test. + * gcc.c-torture/execute/pr15262.c: New test. + +2004-08-19 Ziemowit Laski <zlaski@apple.com> + + * objc.dg/const-cfstring-1.m: Include stdlib.h. + +2004-08-16 Devang Patel <dpatel@apple.com> + + Merge from mainlne. + 2004-08-16 Devang Patel <dpatel@apple.com> + * gcc.dg/darwin-20040809-1.c: New test. + +2004-08-13 Matt Austern <austern@apple.com> + + Radar 2872232 + * gcc.dg/testsuite/c99-tgmath-1.c: New test. + * gcc.dg/testsuite/c99-tgmath-2.c: New test. + * gcc.dg/testsuite/c99-tgmath-3.c: New test. + * gcc.dg/testsuite/c99-tgmath-4.c: New test. + +2004-08-13 Devang Patel <dpatel@apple.com> + + Radar 3729261. Reviewed by Dale. + * gcc.dg/20040813-1.c: New test. + +2004-08-13 Devang Patel <dpatel@apple.com> + + Merge from mainline. Radar 3739309. + 2004-08-11 Devang Patel <dpatel@apple.com> + + * gcc.dg/darwin-20040809-2.c: New test. + +2004-08-13 Devang Patel <dpatel@apple.com> + + Merge from mainline. Radar 3739302. + 2004-08-10 Devang Patel <dpatel@apple.com> + + * gcc.dg/darwin-ld--20040809-1.c: New test. + * gcc.dg/darwin-ld-20040809-2.c: New test. + +2004-08-12 Jon Ziegler <jonz@apple.com> + + Get rid of another APPLE LOCAL (to match Geoff's + change to gcc/ginclude/varargs.h). + * gcc.dg/va-arg-2.c + +2004-08-10 Devang Patel <dpatel@apple.com> + + Remove Symbol Separation. + Radar 3555440. Reviewed by Mike Stump. + * gcc.dg/ss/README: Remove. + * gcc.dg/ss/ss.exp: Remove. + * gcc.dg/ss/one.c: Remove. + * gcc.dg/ss/one.ssh: Remove. + * gcc.dg/ss/ss-cmd1.c: Remove. + +2004-08-03 Stan Shebs <shebs@apple.com> + + Support for CodeWarrior-style assembly language blocks and + functions. Radar 3368707. + * testsuite/gcc.apple/asm-block-[12].c: New tests. + * testsuite/gcc.apple/asm-function-[1-6].c: New tests. + * testsuite/g++.dg/asm-block-[12].C: New tests. + * testsuite/g+.dg/asm-function-[1-6].C: New tests. + +2004-07-30 Geoffrey Keating <geoffk@apple.com> + + * gcc.dg/darwin-longdouble.c: New file. + +2004-07-30 Devang Patel <dpatel@apple.com> + + Re-implement -fwritable-strings support. + Radar : 3699482 + + * gcc.apple/fwritable-strings.c: New test. + +2004-07-14 Devang Patel <dpatel@apple.com> + + * gcc.dg/tree-ssa-vect/ifc-04.c: New test. + +2004-07-13 Matt Austern <austern@apple.com> + + Radar 3278745, 3419910, 3432773 + * gcc.apple/inttypes-2.c: New test. + * gcc.apple/inttypes-wchar-1.c: New test. + * gcc.apple/inttypes-wchar-2.c: New test. + +2006-06-29 Andrew Pinski <apinski@apple.com> + + Radar #: 3717673 + * gcc.dg/pch/struct-1.c: Fix typo of adding a "+". + +2006-06-29 Andrew Pinski <apinski@apple.com> + + * testsuite/gcc.apple/loop-transpose-1.c: New test. + +2004-06-29 Dorit Naishlos <dorit@il.ibm.com> + + * gcc.dg/tree-ssa-vect/tree-ssa-vect-4*.c: Abort instead of print. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-5*.c: Likewise. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-61.c: Likewise. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-62.c: Likewise. + + * gcc.dg/tree-ssa-vect/tree-ssa-vect-40.c: Move call to bar. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-42.c: Likewise. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-60.c: Likewise. + +2006-06-28 Devang Patel <dpatel@apple.com> + + * gcc.dg/tree-ssa-vect/ifc-02.c: New test. + * gcc.dg/tree-ssa-vect/ifc-03.c: New test. + +2006-06-22 Andrew Pinski <apinski@apple.com> + + * gcc.dg/pch/struct-1.c: New. + * gcc.dg/pch/struct-1.hs: New. + +2004-06-22 Devang Patel <dpatel@apple.com> + + * gcc.dg/tree-ssa-vect/pr16105.c: New test. + +2004-06-15 Dorit Naishlos <DORIT@il.ibm.com> + + * gcc.dg/tree-ssa-vect/tree-ssa-vect-30.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-40.c: New test + * gcc.dg/tree-ssa-vect/tree-ssa-vect-41.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-42.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-43.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-44.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-45.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-46.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-47.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-48.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-49.c: New test + * gcc.dg/tree-ssa-vect/tree-ssa-vect-50.c: New test + * gcc.dg/tree-ssa-vect/tree-ssa-vect-51.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-52.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-53.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-54.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-55.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-56.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-57.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-58.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-59.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-60.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-61.c: New test. + + +2004-06-12 Dorit Naishlos <DORIT@il.ibm.com> + + * gcc.dg/tree-ssa-vect/tree-ssa-vect-27.c: Do not xfail. +2004-06-09 Jon Ziegler <jonz@apple.com> + + Radar 3667992 + * gcc.apple/Wlong-double.c: Delete file. + +2004-06-08 Jon Ziegler <jonz@apple.com> + + Radar 3667992 + * g++.dg/altivec-4.C: Remove '-Wno-long-double' flag. + * g++.dg/abi/layout2.C: Likewise. + * gcc.apple/altivec-1.c: Likewise. + * gcc.apple/dg.exp: Likewise. + * gcc.dg/20020416-1.c: Likewise. + * gcc.dg/builtin-inf-1.c: Likewise. + * gcc.dg/c99-complex-1.c: Likewise. + * gcc.dg/dg.exp: Likewise. + * gcc.dg/typespec-1.c: Likewise. + * gcc.dg/wtr-conversion-1.c: Likewise. + * gcc.dg/cpp/sysmac2.c: Likewise. + * gcc.dg/debug/20020220-1.c: Likewise. + * gcc.dg/format/c90-printf-1.c: Likewise. + * gcc.dg/format/c90-scanf-1.c: Likewise. + * gcc.dg/format/strfmon-1.c: Likewise. + * gcc.dg/pch/apple-altivec-1.c: Likewise. + * gcc.dg/pch/apple-altivec-1.hs: Likewise. + * lib/g++.exp: Likewise. + +2004-05-28 Ziemowit Laski <zlaski@apple.com> + + Radar 3665286 + * gcc.apple/altivec-2.c: New test case. + * gcc.apple/altivec-3.c: New test case. + +2004-05-21 Ziemowit Laski <zlaski@apple.com> + + Radar 3621323 + * g++.dg/ext/altivec-11.C: New test case. + * gcc.dg/altivec-15.c: New test case. + +2004-05-10 Ziemowit Laski <zlaski@apple.com> + + * g++.dg/ext/altivec-8.C: Brought over from mainline. + * gcc.apple/altivec-2.c: Remove, superceded by... + * gcc.dg/altivec-13.c: ...this, brought over from mainline. + +2004-04-29 Devang Patel <dpatel@apple.com> + + * gcc.dg/tree-ssa/copy-headers.c : Merge from lno-branch as of + 2004:04:19 00:00. diff --git a/gcc/testsuite/ChangeLog.lno b/gcc/testsuite/ChangeLog.lno new file mode 100644 index 00000000000..35bfc1ccb01 --- /dev/null +++ b/gcc/testsuite/ChangeLog.lno @@ -0,0 +1,203 @@ +2004-07-14 Dorit Naishlos <dorit@il.ibm.com> + + * gcc.dg/tree-ssa-vect/tree-ssa-vect-31.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-32.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-33.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-34.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-35.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-36.c: New test. + +2004-07-04 Andi Kleen <ak@muc.de> + + * gcc.dg/tree-ssa-vect/tree-ssa-vect-*.c: Add support for i?86-*-* + and x86_64-*-*. + * gcc.dg/tree-ssa-vect/tree-vect.h: New file. + +2004-07-04 Dorit Naishlos <dorit@il.ibm.com> + + * gcc.dg/tree-ssa-vect/tree-ssa-vect-4*.c: Abort instead of print, and + remove redundant check loop in main. + + * gcc.dg/tree-ssa-vect/tree-ssa-vect-40.c: Move call to bar from main1 + to main. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-42.c: Likewise. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-46.c: Likewise. + +2004-06-22 Dorit Naishlos <dorit@il.ibm.com> + + * gcc.dg/tree-ssa-vect/tree-ssa-vect-54.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-55.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-56.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-57.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-58.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-59.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-60.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-61.c: New test. + + * gcc.dg/tree-ssa-vect/tree-ssa-vect-50.c: Abort instead of print, and + remove redundant check loop in main. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-51.c: Likewise. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-52.c: Likewise. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-53.c: Likewise. + +2004-06-22 Devang Patel <dpatel@apple.com> + + * gcc.dg/tree-ssa-vect/pr16105.c: New test. + +2004-06-14 Dorit Naishlos <dorit@il.ibm.com> + + * gcc.dg/tree-ssa-vect/tree-ssa-vect-46.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-47.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-48.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-49.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-50.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-51.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-52.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-53.c: New test. + +2004-06-14 Dorit Naishlos <dorit@il.ibm.com> + + * gcc.dg/tree-ssa-vect/tree-ssa-vect-40.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-41.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-42.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-43.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-44.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-45.c: New test. + +2004-06-09 Dorit Naishlos <dorit@il.ibm.com> + + * gcc.dg/tree-ssa-vect/tree-ssa-vect-30.c: New test. + +2004-05-20 Olga Golovanevsky <olga@il.ibm.com> + Dorit Naishlos <dorit@il.ibm.com> + + * gcc.dg/tree-ssa-vect/tree-ssa-vect-8.c: Tests with + unknown loop bounds should now be vectorized. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-none.c: Likewise. + +2004-05-06 Sebastian Pop <pop@cri.ensmp.fr> + + * gcc.dg/tree-ssa-chrec/ssa-chrec-{10, 30-36, 52, 59, 60}.c.ddall: Adjust. + * gcc.dg/tree-ssa-chrec/ssa-chrec-36.c: Remove comment. + +2004-04-15 Dorit Naishlos <dorit@il.ibm.com> + + * gcc.dg/tree-ssa-vect/tree-ssa-vect-26.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-27.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-28.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-29.c: New test. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-*.c: Use -msse2 instead of -msse. + * gcc.dg/tree-ssa-vect/tree-ssa-vect-*.c: Temporarily change i*86 'run' + tests to 'compile' tests. + +2004-03-25 Sebastian Pop <sebastian.pop@ensmp.fr> + + * ssa-chrec-10.c.ddall: Classify more access tuples as + independent. + * ssa-chrec-36.c.ddall: Same. + +2004-03-11 Andrew Pinski <pinskia@physics.uc.edu> + + * gcc.dg/tree-ssa/20040308-2.c: UnXFAIL. + +2004-03-11 Andrew Pinski <apinski@apple.com> + + * gcc.dg/tree-ssa/20040308-2.c: Fix dg-final. + * gcc.dg/tree-ssa/20040308-1.c: XFAIL as the + optimizer for this testcase is disabled. + +2004-03-08 Andrew Pinski <pinskia@physics.uc.edu> + + * gcc.dg/tree-ssa/20040308-1.c: New test. + * gcc.dg/tree-ssa/20040308-2.c: New test. + * gcc.dg/tree-ssa/20040308-3.c: New test. + * gcc.dg/tree-ssa/20040308-4.c: New test. + +2004-03-03 Sebastian Pop <sebastian.pop@ensmp.fr> + + * ssa-chrec-*.c.scev: Removed. + * ssa-chrec-[54..60].c: New. + * ssa-chrec-{59, 60}.c.ddall: New. + * ssa-chrec-*.c.ddall: The analyzer don't print the array + discovery information, and this information has to go away + from the ddall files. This was one of the most varying part + of the ddall files. Maybe the base_name of the arrays has to + be removed in the same way. + * ssa-chrec-*.c: Don't scan the output for scev. Some cases + are adapted for using the elimination of checks. + +2004-02-20 Devang Patel <dpatel@apple.com> + + * testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-3.c: New test. + +2004-02-16 Devang Patel <dpatel@apple.com> + + * gcc.dg/tree-ssa-chrec/20040216-1.c: New test. + +2004-01-29 Sebastian Pop <sebastian.pop@ensmp.fr> + + * ssa-chrec-{01, 10, 30, 31, 32, 33, 34, 35, 36, 52, 53}.c: Update + comments. + * ssa-chrec-{13, 14}.c: Use call functions for avoid optimisations + touching the condition. + * ssa-chrec-{01, 06, 09, 10, 13, 14, 17, 24, 25, 26, 27, 28, 30, 33, + 36, 38, 39, 41, 43, 46, 47, 51, 52, 53}.c.scev: Adjusted. + + * ssa-chrec-10.c.ddall ssa-chrec-30.c.ddall + ssa-chrec-31.c.ddall ssa-chrec-32.c.ddall ssa-chrec-33.c.ddall + ssa-chrec-34.c.ddall ssa-chrec-35.c.ddall ssa-chrec-36.c.ddall + ssa-chrec-52.c.ddall: New files. + * ssa-chrec-10.c.alldd ssa-chrec-30.c.alldd + ssa-chrec-31.c.alldd ssa-chrec-32.c.alldd ssa-chrec-33.c.alldd + ssa-chrec-34.c.alldd ssa-chrec-35.c.alldd ssa-chrec-36.c.alldd + ssa-chrec-52.c.alldd ssa-chrec-53.c.alldd: Removed. + +2004-01-21 Sebastian Pop <s.pop@laposte.net> + + * ssa-chrec-*: Replace -fdump-scalar-evolutions with + -fdump-tree-scev. Replace -fdump-all-data-deps with + -fdump-tree-alldd. + * tree-ssa-vect-*: Use -fdump-tree-vect instead of + -fdump-tree-vect-stats. + +2004-01-15 Sebastian Pop <s.pop@laposte.net> + + * ssa-chrec-{06, 38, 42, 43}.c: Modify comments. + * ssa-chrec-{06, 07, 08, 09, 11, 12, 13, 14, 16, 18, 20, + 21, 37, 38, 39, 42, 43, 44, 45, 53}.c.scev: Adjusted. + * ssa-chrec-53.c.alldd: Adjusted. + +2004-01-12 Sebastian Pop <s.pop@laposte.net> + + * gcc.dg/tree-ssa-chrec/ssa-chrec-51.c.scev: Adjusted. + +2004-01-12 Sebastian Pop <s.pop@laposte.net> + Dorit Naishlos <dorit@il.ibm.com> + + * gcc.dg/tree-ssa-chrec/ssa-chrec-53.c: New test. + * gcc.dg/tree-ssa-chrec/ssa-chrec-53.c.scev: New. + * gcc.dg/tree-ssa-chrec/ssa-chrec-53.c.alldd: New. + +2004-01-09 Sebastian Pop <s.pop@laposte.net> + + * gcc.dg/tree-ssa-chrec/ssa-chrec-{01, 04, 06, 07, 09, 10, 17, + 18, 27, 28, 32, 33, 34, 35, 39, 41, 45, 47, 48}.c: Update comments. + * gcc.dg/tree-ssa-chrec/ssa-chrec-{01, 02, 03, 04, 05, 06, 09, + 10, 11, 17, 18, 27, 28, 30, 32, 33, 34, 35, 36, 37, 38, 39, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50}.c.scev: Adjusted. + * gcc.dg/tree-ssa-chrec/ssa-chrec-{10, 30, 31, 32, 33, 34, 35, + 36}.c.alldd: Adjusted. + * gcc.dg/tree-ssa-chrec/ssa-chrec-{51, 52}.c: New files. + * gcc.dg/tree-ssa-chrec/ssa-chrec-{51, 52}.c.scev: New. + * gcc.dg/tree-ssa-chrec/ssa-chrec-52.alldd: New. + * ChangeLog.lno: New file. + +2003-12-27 Sebastian Pop <s.pop@laposte.net> + + * gcc.dg/tree-ssa-chrec/ssa-chrec-[01..50].c : New testcases. + * gcc.dg/tree-ssa-chrec/ssa-chrec-[01..50].c.scev: Expected + outputs for the scalar evolution analyzer. + * gcc.dg/tree-ssa-chrec/ssa-chrec-{10, 30, 31, 32, 33, 34, + 35, 36}.c.alldd: Expected outputs for the data dependence analyzer. + * gcc.dg/tree-ssa-chrec/tree-ssa-scev.exp: New file. + * lib/scantree.exp (diff-tree-dumps): New procedure. diff --git a/gcc/testsuite/README b/gcc/testsuite/README index ae5e3def522..e8476223716 100644 --- a/gcc/testsuite/README +++ b/gcc/testsuite/README @@ -6,7 +6,7 @@ need a current DejaGnu snapshot, which is available from ftp://gcc.gnu.org/pub/gcc/infrastructure, for example. These tests are included "as is". If any of them fails, do not report -a bug. Bug reports for DejaGnu can go to bug-dejagnu@prep.ai.mit.edu. +a bug. Bug reports for DejaGnu can go to bug-dejagnu@gnu.org. Discussion and comments about this testsuite should be sent to gcc@gcc.gnu.org; additions and changes to should go to sent to gcc-patches@gcc.gnu.org. diff --git a/gcc/testsuite/UNTESTABLE b/gcc/testsuite/UNTESTABLE new file mode 100644 index 00000000000..97683ff5b17 --- /dev/null +++ b/gcc/testsuite/UNTESTABLE @@ -0,0 +1,57 @@ +APPLE LOCAL file testsuite + +This file lists the markers for local changes that are by their nature +not testable, such as source code tweaks that don't directly affect +compiler behavior. Every other local change must have at least one +test case. + +Note that if a local change fixes a bug that is exposed by an existing +test, then by definition the local change should go into FSF GCC +instead of being listed here. + +MW compatibility +Mach time +OS pragma hook +RTX_COST for multiply +Stripped encodings ('!T_' and '!t_') should match. +branch cost +code size reduction / performance enhancement +combine hoisted consts +compare >= 0, not > 0. +darwin host +darwin mmap bug workaround +darwin_set_section_for_var_p +debugging +default to ppro +do not extern fp save/restore +don't define SAVE_FP_PREFIX and friends +fat builds readability +finish file hook +fix prototypes +fix redundant add? +flag_objc +include guard for darwin.h +interrupt signal handler (radar 2941633) +keep tables in sync comment +make easy_vector_constant globally visible (rs6000-protos.h) +manual +more orphaned code +move is_class_name to stub-objc.c +move lookup_interface to stub-objc.c +move lookup_objc_ivar to stub-objc.c +multiply cost pulled into function +objc finish file +order files +parsedir +prototypes +prune man page +reduce code size +remove a stub tweak +remove machopic_output_possible_stub_label +rename for HFS +separate outputdir +setrlimit +time formatting +try to improve ggc +work around a makeinfo complaint +cp_binding_level diff --git a/gcc/testsuite/ada/acats/tests/cxa/cxa3004.a b/gcc/testsuite/ada/acats/tests/cxa/cxa3004.a deleted file mode 100644 index ed2023e37e5..00000000000 --- a/gcc/testsuite/ada/acats/tests/cxa/cxa3004.a +++ /dev/null @@ -1,235 +0,0 @@ --- CXA3004.A --- --- Grant of Unlimited Rights --- --- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, --- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained --- unlimited rights in the software and documentation contained herein. --- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making --- this public release, the Government intends to confer upon all --- recipients unlimited rights equal to those held by the Government. --- These rights include rights to use, duplicate, release or disclose the --- released technical data and computer software in whole or in part, in --- any manner and for any purpose whatsoever, and to have or permit others --- to do so. --- --- DISCLAIMER --- --- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR --- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED --- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE --- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE --- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A --- PARTICULAR PURPOSE OF SAID MATERIAL. ---* --- --- OBJECTIVE: --- Check that the functions defined in package Ada.Characters.Handling --- for classification of and conversion between Wide_Character and --- Character values produce correct results when given the appropriate --- Character and String inputs. --- --- TEST DESCRIPTION: --- This test demonstrates the functions defined in package --- Ada.Characters.Handling which provide for the classification of and --- conversion between Wide_Characters and Characters, in character --- variables and strings. --- Each of the functions is provided with input values that are of the --- appropriate range. The results of the function processing are --- subsequently evaluated. --- --- APPLICABILITY CRITERIA: --- Applicable to all implementations using the Latin_1 set as the --- definition of Character. --- --- --- CHANGE HISTORY: --- 06 Dec 94 SAIC ACVC 2.0 --- 27 Dec 94 SAIC Corrected variable names. --- ---! - -with Report; -with Ada.Characters.Handling; - -procedure CXA3004 is -begin - - Report.Test ("CXA3004", "Check that the functions defined in package " & - "Ada.Characters.Handling for classification " & - "of and conversion between Wide_Character and " & - "Character values produce correct results " & - "when given the appropriate Character " & - "and String inputs"); - - Test_Block: - declare - - package ACH renames Ada.Characters.Handling; - - Char_End : Integer := 255; - WC_Start : Integer := 256; - Sub_Char : Character := '*'; - - Blank : Character := ' '; - First_Char : Character := Character'First; - Last_Char : Character := Character'Last; - F_Char : Character := 'F'; - - - First_Wide_Char : Wide_Character := Wide_Character'First; - Last_Non_Wide_Char : Wide_Character := Wide_Character'Val(Char_End); - First_Unique_Wide_Char : Wide_Character := Wide_Character'Val(WC_Start); - Last_Wide_Char : Wide_Character := Wide_Character'Last; - - A_String : String (1..3) := First_Char & 'X' & Last_Char; - A_Wide_String : Wide_String (1..3) := First_Wide_Char & - ACH.To_Wide_Character('X') & - ACH.To_Wide_Character(Last_Char); - - Unique_Wide_String : Wide_String (1..2) := First_Unique_Wide_Char & - Last_Wide_Char; - - Mixed_Wide_String : Wide_String (1..6) := ACH.To_Wide_Character('A') & - First_Wide_Char & - Last_Non_Wide_Char & - First_Unique_Wide_Char & - Last_Wide_Char & - ACH.To_Wide_Character('Z'); - - - Basic_Char : Character := 'A'; - Basic_Wide_Char : Wide_Character := 'A'; - Basic_String : String (1..6) := "ABCXYZ"; - Basic_Wide_String : Wide_String (1..6) := "ABCXYZ"; - - begin - - - -- Function Is_Character - - - if not ACH.Is_Character(First_Wide_Char) then - Report.Failed ("Incorrect result from Is_Character - 1"); - end if; - - - if ACH.Is_Character(First_Unique_Wide_Char) or - ACH.Is_Character(Last_Wide_Char) - then - Report.Failed ("Incorrect result from Is_Character - 2"); - end if; - - - -- Function Is_String - - - if not ACH.Is_String(A_Wide_String) then - Report.Failed ("Incorrect result from Is_String - 1"); - end if; - - - if ACH.Is_String(Unique_Wide_String) or - ACH.Is_String(Mixed_Wide_String) - then - Report.Failed ("Incorrect result from Is_String - 2"); - end if; - - - -- Function To_Character - - - -- Use default substitution character in call of To_Character. - - if ACH.To_Character(First_Wide_Char) /= First_Char or - ACH.To_Character(Last_Non_Wide_Char) /= Last_Char - then - Report.Failed ("Incorrect result from To_Character - 1"); - end if; - - - -- Provide a substitution character for use with To_Character. - - if ACH.To_Character(First_Unique_Wide_Char, Blank) /= Blank or - ACH.To_Character(First_Unique_Wide_Char, Sub_Char) /= Sub_Char or - ACH.To_Character(Last_Wide_Char) /= ' ' -- default - then - Report.Failed ("Incorrect result from To_Character - 2"); - end if; - - - -- Function To_String - - - if ACH.To_String(A_Wide_String) /= A_String then - Report.Failed ("Incorrect result from To_String - 1"); - end if; - - - if ACH.To_String(Unique_Wide_String, Sub_Char) /= "**" then - Report.Failed ("Incorrect result from To_String - 2"); - end if; - - - - if ACH.To_String(Mixed_Wide_String, Sub_Char) /= - ('A' & First_Char & Last_Char & "**" & 'Z') or - ACH.To_String(Mixed_Wide_String, Sub_Char) /= - (ACH.To_Character(Mixed_Wide_String(1), Sub_Char) & - ACH.To_Character(Mixed_Wide_String(2), Sub_Char) & - ACH.To_Character(Mixed_Wide_String(3), Sub_Char) & - ACH.To_Character(Mixed_Wide_String(4), Sub_Char) & - ACH.To_Character(Mixed_Wide_String(5), Sub_Char) & - ACH.To_Character(Mixed_Wide_String(6), Sub_Char)) - then - Report.Failed ("Incorrect result from To_String - 3"); - end if; - - - -- Function To_Wide_Character - - - if ACH.To_Wide_Character(Basic_Char) /= Basic_Wide_Char then - Report.Failed ("Incorrect result from To_Wide_Character"); - end if; - - - -- Function To_Wide_String - - - if not (ACH.To_Wide_String(Basic_String) = Basic_Wide_String) then - Report.Failed ("Incorrect result from To_Wide_String"); - end if; - - - -- Functions Used In Combination - - if not ACH.Is_Character (ACH.To_Wide_Character ( - ACH.To_Character(First_Wide_Char))) - then - Report.Failed ("Incorrect result from functions in combination - 1"); - end if; - - - if not ACH.Is_String(ACH.To_Wide_String(ACH.To_String(A_Wide_String))) - then - Report.Failed ("Incorrect result from functions in combination - 2"); - end if; - - - if ACH.To_String(ACH.To_Wide_Character('A') & - ACH.To_Wide_Character(F_Char) & - ACH.To_Wide_Character('Z')) /= "AFZ" - then - Report.Failed ("Incorrect result from functions in combination - 3"); - end if; - - - exception - when others => Report.Failed ("Exception raised in Test_Block"); - end Test_Block; - - - Report.Result; - -end CXA3004; diff --git a/gcc/testsuite/ada/acats/tests/cxb/cxb30061.am b/gcc/testsuite/ada/acats/tests/cxb/cxb30061.am deleted file mode 100644 index d31345a8eb1..00000000000 --- a/gcc/testsuite/ada/acats/tests/cxb/cxb30061.am +++ /dev/null @@ -1,404 +0,0 @@ --- CXB30061.AM --- --- Grant of Unlimited Rights --- --- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, --- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained --- unlimited rights in the software and documentation contained herein. --- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making --- this public release, the Government intends to confer upon all --- recipients unlimited rights equal to those held by the Government. --- These rights include rights to use, duplicate, release or disclose the --- released technical data and computer software in whole or in part, in --- any manner and for any purpose whatsoever, and to have or permit others --- to do so. --- --- DISCLAIMER --- --- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR --- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED --- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE --- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE --- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A --- PARTICULAR PURPOSE OF SAID MATERIAL. ---* --- --- OBJECTIVE: --- Check that the function To_C maps between the Ada type Wide_Character --- and the C type wchar_t. --- --- Check that the function To_Ada maps between the C type wchar_t and --- the Ada type Wide_Character. --- --- Check that the function Is_Nul_Terminated returns True if the --- wchar_array parameter contains wide_nul, and otherwise False. --- --- Check that the function To_C produces a correct wchar_array result, --- with lower bound of 0, and length dependent upon the Item and --- Append_Nul parameters. --- --- Check that the function To_Ada produces a correct wide_string result, --- with lower bound of 1, and length dependent upon the Item and --- Trim_Nul parameters. --- --- Check that the function To_Ada raises Terminator_Error if the --- parameter Trim_Nul is set to True, but the actual Item parameter --- does not contain the wide_nul wchar_t. --- --- TEST DESCRIPTION: --- This test uses a variety of Wide_Character, wchar_t, Wide_String, and --- wchar_array objects to test versions of the To_C, To_Ada, and --- Is_Nul_Terminated functions. --- --- This test assumes that the following characters are all included --- in the implementation defined type Interfaces.C.wchar_t: --- ' ', ',', '.', '0'..'9', 'a'..'z' and 'A'..'Z'. --- --- APPLICABILITY CRITERIA: --- This test is applicable to all implementations that provide --- package Interfaces.C. If an implementation provides --- package Interfaces.C, this test must compile, execute, and --- report "PASSED". --- --- SPECIAL REQUIREMENTS: --- The file CXB30060.C must be compiled with a C compiler. --- Implementation dialects of C may require alteration of --- the C program syntax (see individual C files). --- --- Note that the compiled C code must be bound with the compiled Ada --- code to create an executable image. An implementation must provide --- the necessary commands to accomplish this. --- --- Note that the C code included in CXB30060.C conforms --- to ANSI-C. Modifications to these files may be required for other --- C compilers. An implementation must provide the necessary --- modifications to satisfy the function requirements. --- --- TEST FILES: --- The following files comprise this test: --- --- CXB30060.C --- CXB30061.AM --- --- CHANGE HISTORY: --- 07 Sep 95 SAIC Initial prerelease version. --- 09 May 96 SAIC Incorporated reviewer comments for ACVC 2.1. --- 13 Sep 99 RLB Replaced (bogus) Unchecked_Conversions with a --- C function character generator. --- ---! - -with Report; -with Interfaces.C; -- N/A => ERROR -with Ada.Characters.Latin_1; -with Ada.Characters.Handling; -with Ada.Exceptions; -with Ada.Strings.Wide_Fixed; -with Impdef; - -procedure CXB30061 is -begin - - Report.Test ("CXB3006", "Check that the functions To_C and To_Ada " & - "produce correct results"); - - Test_Block: - declare - - use Interfaces, Interfaces.C; - use Ada.Characters, Ada.Characters.Latin_1, Ada.Characters.Handling; - use Ada.Strings.Wide_Fixed; - - First_Character, - Last_Character : Character; - TC_wchar_t, - TC_Low_wchar_t, - TC_High_wchar_t : wchar_t := wchar_t'First; - TC_Wide_String : Wide_String(1..8) := (others => Wide_Character'First); - TC_wchar_array : wchar_array(0..7) := (others => C.wide_nul); - - -- The function Char_Gen returns a character corresponding to its - -- argument. - -- Value 0 .. 9 ==> '0' .. '9' - -- Value 10 .. 19 ==> 'A' .. 'J' - -- Value 20 .. 29 ==> 'k' .. 't' - -- Value 30 ==> ' ' - -- Value 31 ==> '.' - -- Value 32 ==> ',' - - function Char_Gen (Value : in int) return wchar_t; - - -- Use the user-defined C function char_gen as a completion to the - -- function specification above. - - pragma Import (Convention => C, - Entity => Char_Gen, - External_Name => Impdef.CXB30060_External_Name); - - begin - - -- Check that the functions To_C and To_Ada map between the Ada type - -- Wide_Character and the C type wchar_t. - - if To_C(To_Wide_Character(Ada.Characters.Latin_1.NUL)) /= - Interfaces.C.wide_nul - then - Report.Failed("Incorrect result from To_C with NUL character input"); - end if; - - First_Character := Report.Ident_Char('k'); - Last_Character := Report.Ident_Char('t'); - for i in First_Character..Last_Character loop - if To_C(Item => To_Wide_Character(i)) /= - Char_Gen(Character'Pos(i) - Character'Pos('k') + 20) - then - Report.Failed("Incorrect result from To_C with lower case " & - "alphabetic wide character input"); - end if; - end loop; - - First_Character := Report.Ident_Char('A'); - Last_Character := Report.Ident_Char('J'); - for i in First_Character..Last_Character loop - if To_C(Item => To_Wide_Character(i)) /= - Char_Gen(Character'Pos(i) - Character'Pos('A') + 10) - then - Report.Failed("Incorrect result from To_C with upper case " & - "alphabetic wide character input"); - end if; - end loop; - - First_Character := Report.Ident_Char('0'); - Last_Character := Report.Ident_Char('9'); - for i in First_Character..Last_Character loop - if To_C(Item => To_Wide_Character(i)) /= - Char_Gen(Character'Pos(i) - Character'Pos('0')) - then - Report.Failed("Incorrect result from To_C with digit " & - "wide character input"); - end if; - end loop; - - if To_C(Item => To_Wide_Character(' ')) /= Char_Gen(30) - then - Report.Failed("Incorrect result from To_C with space " & - "wide character input"); - end if; - - if To_C(Item => To_Wide_Character('.')) /= Char_Gen(31) - then - Report.Failed("Incorrect result from To_C with dot " & - "wide character input"); - end if; - - if To_C(Item => To_Wide_Character(',')) /= Char_Gen(32) - then - Report.Failed("Incorrect result from To_C with comma " & - "wide character input"); - end if; - - if To_Ada(Interfaces.C.wide_nul) /= - To_Wide_Character(Ada.Characters.Latin_1.NUL) - then - Report.Failed("Incorrect result from To_Ada with wide_nul " & - "wchar_t input"); - end if; - - for Code in int range - int(Report.Ident_Int(20)) .. int(Report.Ident_Int(29)) loop - -- 'k' .. 't' - if To_Ada(Item => Char_Gen(Code)) /= - To_Wide_Character(Character'Val (Character'Pos('k') + (Code - 20))) - then - Report.Failed("Incorrect result from To_Ada with lower case " & - "alphabetic wchar_t input"); - end if; - end loop; - - for Code in int range - int(Report.Ident_Int(10)) .. int(Report.Ident_Int(19)) loop - -- 'A' .. 'J' - if To_Ada(Item => Char_Gen(Code)) /= - To_Wide_Character(Character'Val (Character'Pos('A') + (Code - 10))) - then - Report.Failed("Incorrect result from To_Ada with upper case " & - "alphabetic wchar_t input"); - end if; - end loop; - - for Code in int range - int(Report.Ident_Int(0)) .. int(Report.Ident_Int(9)) loop - -- '0' .. '9' - if To_Ada(Item => Char_Gen(Code)) /= - To_Wide_Character(Character'Val (Character'Pos('0') + (Code))) - then - Report.Failed("Incorrect result from To_Ada with digit " & - "wchar_t input"); - end if; - end loop; - - if To_Ada(Item => Char_Gen(30)) /= ' ' then - Report.Failed("Incorrect result from To_Ada with space " & - "char input"); - end if; - if To_Ada(Item => Char_Gen(31)) /= '.' then - Report.Failed("Incorrect result from To_Ada with dot " & - "char input"); - end if; - if To_Ada(Item => Char_Gen(32)) /= ',' then - Report.Failed("Incorrect result from To_Ada with comma " & - "char input"); - end if; - - -- Check that the function Is_Nul_Terminated produces correct results - -- whether or not the wchar_array argument contains the - -- Ada.Interfaces.C.wide_nul character. - - TC_Wide_String := "abcdefgh"; - if Is_Nul_Terminated(Item => To_C(TC_Wide_String, Append_Nul => False)) - then - Report.Failed("Incorrect result from Is_Nul_Terminated when no " & - "wide_nul wchar_t is present"); - end if; - - if not Is_Nul_Terminated(To_C(TC_Wide_String, Append_Nul => True)) then - Report.Failed("Incorrect result from Is_Nul_Terminated when the " & - "wide_nul wchar_t is present"); - end if; - - - - -- Now that we've tested the character/char versions of To_Ada and To_C, - -- use them to test the string versions. - - declare - i : size_t := 0; - j : integer := 1; - Incorrect_Conversion : Boolean := False; - - TC_No_wide_nul : constant wchar_array := To_C(TC_Wide_String, - False); - TC_wide_nul_Appended : constant wchar_array := To_C(TC_Wide_String, - True); - begin - - -- Check that the function To_C produces a wchar_array result with - -- lower bound of 0, and length dependent upon the Item and - -- Append_Nul parameters (if Append_Nul is True, length is - -- Item'Length + 1; if False, length is Item'Length). - - if TC_No_wide_nul'First /= 0 or TC_wide_nul_Appended'First /= 0 then - Report.Failed("Incorrect lower bound from Function To_C"); - end if; - - if TC_No_wide_nul'Length /= TC_Wide_String'Length then - Report.Failed("Incorrect length returned from Function To_C " & - "when Append_Nul => False"); - end if; - - if TC_wide_nul_Appended'Length /= TC_Wide_String'Length + 1 then - Report.Failed("Incorrect length returned from Function To_C " & - "when Append_Nul => True"); - end if; - - if not Is_Nul_Terminated(TC_wide_nul_Appended) then - Report.Failed("No wide_nul appended to the wide_string " & - "parameter during conversion to wchar_array " & - "by function To_C"); - end if; - - for TC_char in Report.Ident_Char('a')..Report.Ident_Char('h') loop - if TC_No_wide_nul(i) /= To_C(To_Wide_Character(TC_char)) or - TC_wide_nul_Appended(i) /= To_C(To_Wide_Character(TC_char)) then - -- Use single character To_C. - Incorrect_Conversion := True; - end if; - i := i + 1; - end loop; - - if Incorrect_Conversion then - Report.Failed("Incorrect result from To_C with wide_string input " & - "and wchar_array result"); - end if; - - - -- Check that the function To_Ada produces a wide_string result with - -- lower bound of 1, and length dependent upon the Item and - -- Trim_Nul parameters (if Trim_Nul is False, length is Item'Length; - -- if False, length will be the length of the slice of Item prior to - -- the first wide_nul). - - declare - TC_No_NUL_Wide_String : constant Wide_String := - To_Ada(Item => TC_wide_nul_Appended, Trim_Nul => True); - - TC_NUL_Appended_Wide_String : constant Wide_String := - To_Ada(TC_wide_nul_Appended, False); - - begin - - if TC_No_NUL_Wide_String'First /= 1 or - TC_NUL_Appended_Wide_String'First /= 1 - then - Report.Failed("Incorrect lower bound from Function To_Ada"); - end if; - - if TC_No_NUL_Wide_String'Length /= TC_Wide_String'Length then - Report.Failed("Incorrect length returned from Function " & - "To_Ada when Trim_Nul => True"); - end if; - - if TC_NUL_Appended_Wide_String'Length /= - TC_Wide_String'Length + 1 - then - Report.Failed("Incorrect length returned from Function " & - "To_Ada when Trim_Nul => False"); - end if; - - for TC_Character in Wide_Character'('a') .. Wide_Character'('h') loop - if TC_No_NUL_Wide_String(j) /= TC_Character or - TC_NUL_Appended_Wide_String(j) /= TC_Character - then - Report.Failed("Incorrect result from To_Ada with " & - "char_array input, index = " & - Integer'Image(j)); - end if; - j := j + 1; - end loop; - - end; - - - -- Check that the function To_Ada raises Terminator_Error if the - -- parameter Trim_Nul is set to True, but the actual Item parameter - -- does not contain the wide_nul wchar_t. - - begin - TC_Wide_String := To_Ada(TC_No_wide_nul, Trim_Nul => True); - Report.Failed("Terminator_Error not raised when Item " & - "parameter of To_Ada does not contain the " & - "wide_nul wchar_t, but parameter Trim_Nul " & - "=> True"); - Report.Comment - (To_String(TC_Wide_String) & " printed to defeat optimization"); - exception - when Terminator_Error => null; -- OK, expected exception. - when others => - Report.Failed("Incorrect exception raised by function " & - "To_Ada when the Item parameter does not " & - "contain the wide_nul wchar_t, but " & - "parameter Trim_Nul => True"); - end; - - end; - - exception - when The_Error : others => - Report.Failed - ("The following exception was raised in the Test_Block: " & - Ada.Exceptions.Exception_Name(The_Error)); - end Test_Block; - - Report.Result; - -end CXB30061; diff --git a/gcc/testsuite/bugs/powerpc/g++.xfail b/gcc/testsuite/bugs/powerpc/g++.xfail new file mode 100644 index 00000000000..062c4a7d86a --- /dev/null +++ b/gcc/testsuite/bugs/powerpc/g++.xfail @@ -0,0 +1,108 @@ +# APPLE LOCAL file testsuite +### +### List of failing tests with Radar bug numbers +### <radarNum>: <test name> +### test name should be exactly as it appears html summary reports +### including any trailing #<number> +### +### When the bug is fixed and the test passes, it will be an +### analyzed non-fail. You should then comment out the test in this +### file and make sure the Radar is closed. +### +###------------------------------------------------------------------ +3222046: g++.dg/warn/weak1.C (test for excess errors) +3223598: g++.dg/special/conpr-3.C execution test +3222135: g++.old-deja/g++.bugs/900404_02.C (test for warnings, line 25) +3222698: g++.old-deja/g++.ext/pretty4.C execution test +3843119: g++.dg/abi/local1.C execution test +3843157: g++.dg/pascal-strings-2.C (test for warnings, line 7) +3843157: g++.dg/pascal-strings-2.C (test for warnings, line 8) +3843157: g++.dg/pascal-strings-2.C (test for warnings, line 22) +3843157: g++.dg/pascal-strings-2.C (test for warnings, line 24) +3843157: g++.dg/pascal-strings-2.C (test for warnings, line 25) +3843157: g++.dg/pascal-strings-2.C (test for excess errors) +4096269: g++.dg/eh/uncaught1.C execution test +# +# The following tests fail only when the c++ suite is run through Obj-C++. +3904139: g++.dg/ext/fnname3.C execution test +3904139: g++.dg/ext/pretty1.C scan-assembler int bar\\(T\\).*with T = int +3904139: g++.dg/ext/pretty1.C scan-assembler int main\\(\\) +3904178: g++.dg/opt/devirt1.C scan-assembler xyzzy +3904139: g++.old-deja/g++.ext/pretty2.C execution test +3904139: g++.old-deja/g++.ext/pretty3.C execution test +3904139: g++.old-deja/g++.pt/memtemp77.C execution test +3904173: g++.old-deja/g++.jason/cleanup2.C (test for excess errors) +3904173: g++.old-deja/g++.jason/hmc1.C (test for excess errors) +3904173: g++.old-deja/g++.law/ctors10.C (test for errors, line 21) +3904173: g++.old-deja/g++.law/ctors10.C (test for excess errors) +3904173: g++.old-deja/g++.law/shadow1.C (test for excess errors) +3904184: g++.old-deja/g++.mike/p11144.C (test for excess errors) +3904186: g++.dg/pch/system-1.C -g assembly comparison +3904186: g++.dg/pch/system-1.C -O2 -g assembly comparison +3904186: g++.dg/pch/system-1.C -O2 assembly comparison +3904186: g++.dg/pch/system-2.C -g assembly comparison +3904186: g++.dg/pch/system-2.C -O2 -g assembly comparison +3904186: g++.dg/pch/system-2.C -O2 assembly comparison +3904186: g++.dg/pch/uninst.C -g assembly comparison +3904186: g++.dg/pch/uninst.C -O2 -g assembly comparison +3904186: g++.dg/pch/uninst.C -O2 assembly comparison +4079018: g++.dg/template/spec19.C (test for excess errors) +4084977: g++.old-deja/g++.oliva/expr2.C execution test +4084991: g++.dg/expr/lval2.C (test for excess errors) +# +# The following tests fail only when the c++ suite is run with -mcpu=G5 +3719311: g++.dg/template/warn1.C (test for warnings, line 12) +# +# The following tests fail only when the c++ suite is run with -m64 +3964999: g++.old-deja/g++.pt/const2.C (test for excess errors) +3965017: g++.dg/template/repo1.C (test for excess errors) +3965017: g++.dg/template/repo3.C (test for excess errors) +3965017: g++.old-deja/g++.pt/instantiate4.C (test for excess errors) +3965017: g++.old-deja/g++.pt/instantiate6.C (test for excess errors) +3965017: g++.old-deja/g++.pt/repo1.C (test for excess errors) +3965017: g++.old-deja/g++.pt/repo2.C (test for excess errors) +3965017: g++.old-deja/g++.pt/repo3.C (test for excess errors) +3965017: g++.old-deja/g++.pt/repo4.C (test for excess errors) +3941491: g++.dg/debug/const1.C -gdwarf-21 (test for excess errors) +3941491: g++.dg/debug/const1.C -gdwarf-21 -O2 (test for excess errors) +3941491: g++.dg/debug/const1.C -gdwarf-21 -O3 (test for excess errors) +3941491: g++.dg/debug/const1.C -gdwarf-21 -fastcp (test for excess errors) +3941491: g++.dg/debug/const1.C -gdwarf-2 (test for excess errors) +3941491: g++.dg/debug/const1.C -gdwarf-2 -O2 (test for excess errors) +3941491: g++.dg/debug/const1.C -gdwarf-2 -O3 (test for excess errors) +3941491: g++.dg/debug/const1.C -gdwarf-2 -fastcp (test for excess errors) +3941491: g++.dg/debug/const1.C -gdwarf-23 (test for excess errors) +3941491: g++.dg/debug/const1.C -gdwarf-23 -O2 (test for excess errors) +3941491: g++.dg/debug/const1.C -gdwarf-23 -O3 (test for excess errors) +3941491: g++.dg/debug/const1.C -gdwarf-23 -fastcp (test for excess errors) +3941491: g++.dg/debug/debug4.C -gdwarf-21 (test for excess errors) +3941491: g++.dg/debug/debug4.C -gdwarf-21 -O2 (test for excess errors) +3941491: g++.dg/debug/debug4.C -gdwarf-21 -O3 (test for excess errors) +3941491: g++.dg/debug/debug4.C -gdwarf-21 -fastcp (test for excess errors) +3941491: g++.dg/debug/debug4.C -gdwarf-2 (test for excess errors) +3941491: g++.dg/debug/debug4.C -gdwarf-2 -O2 (test for excess errors) +3941491: g++.dg/debug/debug4.C -gdwarf-2 -O3 (test for excess errors) +3941491: g++.dg/debug/debug4.C -gdwarf-2 -fastcp (test for excess errors) +3941491: g++.dg/debug/debug4.C -gdwarf-23 (test for excess errors) +3941491: g++.dg/debug/debug4.C -gdwarf-23 -O2 (test for excess errors) +3941491: g++.dg/debug/debug4.C -gdwarf-23 -O3 (test for excess errors) +3941491: g++.dg/debug/debug4.C -gdwarf-23 -fastcp (test for excess errors) +3941491: g++.dg/debug/trivial.C -gdwarf-21 (test for excess errors) +3941491: g++.dg/debug/trivial.C -gdwarf-21 -O2 (test for excess errors) +3941491: g++.dg/debug/trivial.C -gdwarf-21 -O3 (test for excess errors) +3941491: g++.dg/debug/trivial.C -gdwarf-21 -fastcp (test for excess errors) +3941491: g++.dg/debug/trivial.C -gdwarf-2 (test for excess errors) +3941491: g++.dg/debug/trivial.C -gdwarf-2 -O2 (test for excess errors) +3941491: g++.dg/debug/trivial.C -gdwarf-2 -O3 (test for excess errors) +3941491: g++.dg/debug/trivial.C -gdwarf-2 -fastcp (test for excess errors) +3941491: g++.dg/debug/trivial.C -gdwarf-23 (test for excess errors) +3941491: g++.dg/debug/trivial.C -gdwarf-23 -O2 (test for excess errors) +3941491: g++.dg/debug/trivial.C -gdwarf-23 -O3 (test for excess errors) +3941491: g++.dg/debug/trivial.C -gdwarf-23 -fastcp (test for excess errors) +3967626: g++.dg/eh/forced1.C execution test +3967626: g++.old-deja/g++.eh/terminate2.C execution test +#4097506: g++.dg/ext/opt-pragma-2.C scan-assembler-times bl "L_printf 4 +#4097506: g++.dg/ext/opt-pragma-3.C scan-assembler-times b "L_printf 4 +#4097506: g++.dg/ext/opt-pragma-4.C scan-assembler-times b "L_printf 2 +#4097506: g++.dg/ext/opt-pragma-4.C scan-assembler-times bl "L_printf 2 +#4099260: g++.old-deja/g++.brendan/new3.C execution test diff --git a/gcc/testsuite/bugs/powerpc/gcc.xfail b/gcc/testsuite/bugs/powerpc/gcc.xfail new file mode 100644 index 00000000000..24ddbc5eadf --- /dev/null +++ b/gcc/testsuite/bugs/powerpc/gcc.xfail @@ -0,0 +1,312 @@ +# APPLE LOCAL file testsuite +### +### List of failing tests with Radar bug numbers +### <radarNum>: <test name> +### test name should be exactly as it appears html summary reports +### including any trailing #<number> +### +### When the bug is fixed and the test passes, it will be an +### analyzed non-fail. You should then comment out the test in this +### file and make sure the Radar is closed. +### +###------------------------------------------------------------------ +3191500: gcc.dg/c99-func-3.c execution test +3673618: gcc.c-torture/execute/ieee/fp-cmp-1.c execution, -fast +3673618: gcc.c-torture/execute/ieee/fp-cmp-2.c execution, -fast +3673618: gcc.c-torture/execute/ieee/fp-cmp-3.c execution, -fast +3673618: gcc.c-torture/execute/ieee/fp-cmp-4.c execution, -fast +3673618: gcc.c-torture/execute/ieee/fp-cmp-5.c compilation, -fast +3673618: gcc.c-torture/execute/ieee/fp-cmp-6.c compilation, -fast +3673618: gcc.c-torture/execute/ieee/fp-cmp-8.c execution, -fast +3907496: gcc.dg/rs6000-power2-2.c scan-assembler-not lfd +3717694: gcc.dg/pch/valid-3.c -fast (test for errors, line 3) +3717694: gcc.dg/pch/valid-3.c -fast (test for errors, line 3) #1 +3846097: gcc.c-torture/execute/builtins/fputs.c execution, -fast +3846097: gcc.c-torture/execute/builtins/memmove.c execution, -fast +3846097: gcc.c-torture/execute/builtins/memops-asm.c compilation, -fast +3846097: gcc.c-torture/execute/builtins/mempcpy.c execution, -fast +3846097: gcc.c-torture/execute/builtins/memset.c execution, -fast +3846097: gcc.c-torture/execute/builtins/strlen-2.c execution, -fast +3846097: gcc.c-torture/execute/builtins/strpcpy.c execution, -fast +3846097: gcc.c-torture/execute/builtins/strstr-asm.c compilation, -fast +3846097: gcc.c-torture/execute/builtins/memmove-2.c execution, -fast +3846097: gcc.c-torture/execute/builtins/strcpy-2.c execution, -fast +3846097: gcc.c-torture/execute/builtins/strlen-3.c execution, -fast +3673618: gcc.c-torture/execute/ieee/compare-fp-1.c compilation, -fast +3673618: gcc.c-torture/execute/ieee/compare-fp-4.c execution, -fast +3673618: gcc.c-torture/execute/ieee/fp-cmp-4f.c execution, -fast +3673618: gcc.c-torture/execute/ieee/fp-cmp-4l.c execution, -fast +3673618: gcc.c-torture/execute/ieee/fp-cmp-8f.c execution, -fast +3673618: gcc.c-torture/execute/ieee/fp-cmp-8l.c execution, -fast +3869017: gcc.dg/tree-ssa-chrec/ssa-chrec-04.c scan-tree-dump-times remove_me 0 +3869017: gcc.dg/tree-ssa-chrec/ssa-chrec-06.c scan-tree-dump-times remove_me 0 +3869017: gcc.dg/tree-ssa-chrec/ssa-chrec-07.c scan-tree-dump-times remove_me 0 +3869017: gcc.dg/tree-ssa-chrec/ssa-chrec-08.c scan-tree-dump-times remove_me 0 +3869017: gcc.dg/tree-ssa-chrec/ssa-chrec-57.c scan-tree-dump-times remove_me 0 +3869017: gcc.dg/tree-ssa-chrec/ssa-chrec-58.c scan-tree-dump-times remove_me 0 +3869017: gcc.dg/tree-ssa-chrec/20040216-1.c scan-tree-dump-times Dependence Node 4 +3869017: gcc.dg/tree-ssa/20030807-7.c scan-tree-dump-times if 1 +3869017: gcc.dg/tree-ssa/20031216-1.c scan-tree-dump-times link_error 0 +3673618: gcc.c-torture/execute/ieee/unsafe-fp-assoc.c execution, -fast +3907496: gcc.dg/rs6000-power2-2.c scan-assembler lfq +3907496: gcc.dg/rs6000-power2-2.c scan-assembler stfq +3906375: gcc.dg/debug/debug-1.c -gstabs -fast scan-assembler xyzzy +3906375: gcc.dg/debug/debug-1.c -gstabs3 -fast scan-assembler xyzzy +3906375: gcc.dg/debug/debug-1.c -gstabs+ -fast scan-assembler xyzzy +3906375: gcc.dg/debug/debug-1.c -gstabs+3 -fast scan-assembler xyzzy +3906375: gcc.dg/debug/debug-2.c -gstabs -fast scan-assembler xyzzy +3906375: gcc.dg/debug/debug-2.c -gstabs3 -fast scan-assembler xyzzy +3906375: gcc.dg/debug/debug-2.c -gstabs+ -fast scan-assembler xyzzy +3906375: gcc.dg/debug/debug-2.c -gstabs+3 -fast scan-assembler xyzzy +3906482: gcc.dg/cpp/trad/comment-3.c (test for warnings, line 6) +3961392: gcc.dg/ppc-fsel-3.c scan-assembler-not fsub +3965499: gcc.dg/cpp/headermap-2.c (test for warnings, line 9) +3965499: gcc.dg/cpp/headermap-2.c (test for excess errors) +4078995: gcc.c-torture/execute/ieee/copysign1.c execution, -fast +4078995: gcc.c-torture/execute/ieee/copysign2.c execution, -fast +4078995: gcc.c-torture/execute/ieee/mzero6.c execution, -fast +#4084907: gcc.c-torture/execute/20050316-1.c execution, -fast +4084941: gcc.dg/vect/vect-98.c scan-tree-dump-times not vectorized: complicated access pattern 1 +# +# the following failures occur only when the tests are being run through ObjC +3904213: gcc.dg/20040813-1.c scan-assembler .stabs.*100,0,2 +3904216: gcc.dg/cast-function-1.c (test for warnings, line 25) +3904216: gcc.dg/cast-function-1.c (test for warnings, line 26) +3904216: gcc.dg/cast-function-1.c (test for warnings, line 27) +3904216: gcc.dg/cast-function-1.c (test for warnings, line 28) +3904216: gcc.dg/cast-function-1.c (test for warnings, line 32) +3904216: gcc.dg/cast-function-1.c (test for warnings, line 34) +3904216: gcc.dg/cast-function-1.c (test for warnings, line 35) +3904224: gcc.dg/gnu89-init-1.c (test for excess errors) +3904224: gcc.dg/gnu99-init-1.c (test for excess errors) +3904228: gcc.dg/uninit-A.c (test for excess errors) +3904235: gcc.dg/wtr-unary-plus-1.c unary plus operator (test for warnings, line 12) +3904235: gcc.dg/wtr-unary-plus-1.c unary plus operator (test for warnings, line 13) +4079037: gcc.dg/cpp/direct2.c (test for excess errors) +4079037: gcc.dg/cpp/direct2s.c (test for excess errors) +3904213: gcc.apple/objc-negtest.c (test for errors, line 3) +# +# the following failures are for -mpowerpc64 +3966342: gcc.dg/20020919-1.c (test for errors, line 105) +3966342: gcc.dg/20020919-1.c (test for errors, line 123) +3966342: gcc.dg/20020919-1.c (test for errors, line 132) +3966342: gcc.dg/20020919-1.c (test for errors, line 159) +3966342: gcc.dg/20020919-1.c (test for errors, line 177) +3966342: gcc.dg/20020919-1.c (test for errors, line 231) +#4054717: gcc.dg/compat/scalar-by-value-1 c_compat_x_tst.o-c_compat_y_tst.o execute +#4054717: gcc.dg/compat/struct-by-value-7a c_compat_x_tst.o-c_compat_y_tst.o execute +# +# the following failures are for -mcpu=G5 +4085878: gcc.apple/altivec-5.c (test for warnings, line 30) +4085878: gcc.apple/altivec-5.c scan-assembler-not stvx +4085878: gcc.apple/altivec-faltivec-1.c scan-assembler mainInt +#3939205 causes the following test to fail when run with -m64 +4085878: gcc.apple/altivec-faltivec-1.c scan-tree-dump-times callee has AltiVec 2 +4083754: gcc.apple/comma-expr-1.c (test for errors, line 6) +#4084907: gcc.c-torture/execute/20050316-1.c execution, -O0 +#4084907: gcc.c-torture/execute/20050316-1.c execution, -O1 +#4084907: gcc.c-torture/execute/20050316-1.c execution, -O2 +#4084907: gcc.c-torture/execute/20050316-1.c execution, -O3 -fomit-frame-pointer +#4084907: gcc.c-torture/execute/20050316-1.c execution, -O3 -g +#4084907: gcc.c-torture/execute/20050316-1.c execution, -Os +#4085878: gcc.dg/convert-vec-1.c (test for errors, line 3) +3788046: gcc.dg/simd-2.c (test for excess errors) +# +# the following failures are for -m64 +3966342: gcc.apple/altivec-1.c (test for excess errors) +3966342: gcc.apple/apple-altivec-13.c (test for excess errors) +3966342: gcc.apple/const-cfstring-3.c scan-assembler \\.long[ \\t]+___CFConstantStringClassReference\n[ \\t]*\\.long[ \\t]+1992\n[ \\t]*\\.long[ \\t]+LC.*\n[ \\t]*\\.long[ \\t]+4\n +3966342: gcc.apple/const-cfstring-3.c scan-assembler \\.long[ \\t]+___CFConstantStringClassReference\n[ \\t]*\\.long[ \\t]+1992\n[ \\t]*\\.long[ \\t]+LC.*\n[ \\t]*\\.long[ \\t]+10\n +3966342: gcc.dg/darwin-bool-1.c (test for excess errors) +3966342: gcc.dg/pr17133.c (test for excess errors) +3966342: gcc.dg/lvalue-cast-1.c (test for excess errors) +3939205: gcc.apple/altivec-faltivec-1.c (test for excess errors) +#3939205: gcc.apple/altivec-faltivec-1.c scan-tree-dump-times callee has AltiVec 2 +3939205: gcc.apple/altivec-faltivec-2.c (test for excess errors) +3939205: gcc.apple/altivec-maltivec-1.c (test for excess errors) +3939205: gcc.dg/framework-1.c (test for excess errors) +3967637: gcc.dg/debug/20020220-1.c -gdwarf-21 (test for excess errors) +3967637: gcc.dg/debug/20020220-1.c -gdwarf-21 -O (test for excess errors) +3967637: gcc.dg/debug/20020220-1.c -gdwarf-21 -O3 (test for excess errors) +3967637: gcc.dg/debug/20020220-1.c -gdwarf-21 -fast (test for excess errors) +3967637: gcc.dg/debug/20020220-1.c -gdwarf-2 (test for excess errors) +3967637: gcc.dg/debug/20020220-1.c -gdwarf-2 -O (test for excess errors) +3967637: gcc.dg/debug/20020220-1.c -gdwarf-2 -O3 (test for excess errors) +3967637: gcc.dg/debug/20020220-1.c -gdwarf-2 -fast (test for excess errors) +3967637: gcc.dg/debug/20020220-1.c -gdwarf-23 (test for excess errors) +3967637: gcc.dg/debug/20020220-1.c -gdwarf-23 -O (test for excess errors) +3967637: gcc.dg/debug/20020220-1.c -gdwarf-23 -O3 (test for excess errors) +3967637: gcc.dg/debug/20020220-1.c -gdwarf-23 -fast (test for excess errors) +3967637: gcc.dg/debug/20020327-1.c -gdwarf-21 (test for excess errors) +3967637: gcc.dg/debug/20020327-1.c -gdwarf-21 -O (test for excess errors) +3967637: gcc.dg/debug/20020327-1.c -gdwarf-21 -O3 (test for excess errors) +3967637: gcc.dg/debug/20020327-1.c -gdwarf-21 -fast (test for excess errors) +3967637: gcc.dg/debug/20020327-1.c -gdwarf-2 (test for excess errors) +3967637: gcc.dg/debug/20020327-1.c -gdwarf-2 -O (test for excess errors) +3967637: gcc.dg/debug/20020327-1.c -gdwarf-2 -O3 (test for excess errors) +3967637: gcc.dg/debug/20020327-1.c -gdwarf-2 -fast (test for excess errors) +3967637: gcc.dg/debug/20020327-1.c -gdwarf-23 (test for excess errors) +3967637: gcc.dg/debug/20020327-1.c -gdwarf-23 -O (test for excess errors) +3967637: gcc.dg/debug/20020327-1.c -gdwarf-23 -O3 (test for excess errors) +3967637: gcc.dg/debug/20020327-1.c -gdwarf-23 -fast (test for excess errors) +3967637: gcc.dg/debug/trivial.c -gdwarf-21 (test for excess errors) +3967637: gcc.dg/debug/trivial.c -gdwarf-21 -O (test for excess errors) +3967637: gcc.dg/debug/trivial.c -gdwarf-21 -O3 (test for excess errors) +3967637: gcc.dg/debug/trivial.c -gdwarf-21 -fast (test for excess errors) +3967637: gcc.dg/debug/trivial.c -gdwarf-2 (test for excess errors) +3967637: gcc.dg/debug/trivial.c -gdwarf-2 -O (test for excess errors) +3967637: gcc.dg/debug/trivial.c -gdwarf-2 -O3 (test for excess errors) +3967637: gcc.dg/debug/trivial.c -gdwarf-2 -fast (test for excess errors) +3967637: gcc.dg/debug/trivial.c -gdwarf-23 (test for excess errors) +3967637: gcc.dg/debug/trivial.c -gdwarf-23 -O (test for excess errors) +3967637: gcc.dg/debug/trivial.c -gdwarf-23 -O3 (test for excess errors) +3967637: gcc.dg/debug/trivial.c -gdwarf-23 -fast (test for excess errors) +3967747: gcc.dg/cleanup-10.c execution test +3967747: gcc.dg/cleanup-11.c execution test +3967747: gcc.dg/cleanup-8.c execution test +3967747: gcc.dg/cleanup-9.c execution test +3939035: gcc.misc-tests/linkage.c link +3968604: gcc.dg/pch/apple-altivec-1.c -O0 -g (test for excess errors) +3968604: gcc.dg/pch/apple-altivec-1.c -O0 -g (test for excess errors) #1 +3968604: gcc.dg/pch/apple-altivec-1.c -O0 (test for excess errors) +3968604: gcc.dg/pch/apple-altivec-1.c -O0 (test for excess errors) #1 +3968604: gcc.dg/pch/apple-altivec-1.c -O1 (test for excess errors) +3968604: gcc.dg/pch/apple-altivec-1.c -O1 (test for excess errors) #1 +3968604: gcc.dg/pch/apple-altivec-1.c -O2 (test for excess errors) +3968604: gcc.dg/pch/apple-altivec-1.c -O2 (test for excess errors) #1 +3968604: gcc.dg/pch/apple-altivec-1.c -O3 -fomit-frame-pointer (test for excess errors) +3968604: gcc.dg/pch/apple-altivec-1.c -O3 -fomit-frame-pointer (test for excess errors) #1 +3968604: gcc.dg/pch/apple-altivec-1.c -O3 -g (test for excess errors) +3968604: gcc.dg/pch/apple-altivec-1.c -O3 -g (test for excess errors) #1 +3968604: gcc.dg/pch/apple-altivec-1.c -Os (test for excess errors) +3968604: gcc.dg/pch/apple-altivec-1.c -Os (test for excess errors) #1 +3996036: gcc.dg/Wpadded.c (test for excess errors) +#4063657: gcc.apple/asm-block-2.c execution test +4078608: gcc.misc-tests/bprob-1.c compilation, -fast -fbranch-probabilities +4078608: gcc.misc-tests/bprob-1.c compilation, -fast -ftree-based-profiling -fbranch-probabilities +4078777: gcc.misc-tests/bprob-2.c execution, -fast -ftree-based-profiling -fprofile-arcs +4096268: gcc.misc-tests/bprob-1.c execution, -fast -fbranch-probabilities +4096268: gcc.misc-tests/bprob-1.c execution, -fast -ftree-based-profiling -fbranch-probabilities +4078834: gcc.dg/pr18096-1.c stack frame too large (test for warnings, line 11) +#4078985: gcc.c-torture/compile/920617-1.c -fast (test for excess errors) +#4078985: gcc.c-torture/compile/991202-1.c -fast (test for excess errors) +4078990: gcc.c-torture/execute/comp-goto-1.c execution, -fast +4085016: gcc.dg/altivec-14.c (test for warnings, line 7) +4085016: gcc.dg/altivec-14.c (test for warnings, line 8) +4085016: gcc.dg/altivec-14.c (test for warnings, line 9) +4085016: gcc.dg/altivec-14.c (test for warnings, line 10) +4085016: gcc.dg/altivec-14.c (test for warnings, line 11) +4085016: gcc.dg/altivec-14.c (test for warnings, line 12) +4085016: gcc.dg/altivec-14.c (test for warnings, line 14) +4085016: gcc.dg/altivec-14.c (test for warnings, line 15) +4085016: gcc.dg/altivec-14.c (test for warnings, line 16) +4085016: gcc.dg/altivec-14.c (test for warnings, line 20) +4085016: gcc.dg/altivec-14.c (test for warnings, line 21) +4085016: gcc.dg/altivec-14.c (test for warnings, line 22) +4085016: gcc.dg/altivec-14.c (test for excess errors) +4085217: gcc.dg/asm-b.c execution test +4085231: gcc.dg/transparent-union-1.c (test for excess errors) +4085231: gcc.dg/transparent-union-2.c (test for excess errors) +4097506: gcc.apple/opt-pragma-2.c scan-assembler-times bl "L_printf 4 +4097506: gcc.apple/opt-pragma-3.c scan-assembler-times b "L_printf 4 +4097506: gcc.apple/opt-pragma-4.c scan-assembler-times b "L_printf 2 +4097506: gcc.apple/opt-pragma-4.c scan-assembler-times bl "L_printf 2 +# +# the following failures are for x86 only +4087300: gcc.c-torture/execute/builtins/strcat.c execution, -fast +4087300: gcc.c-torture/execute/builtins/strlen-3.c compilation, -fast +4087300: gcc.c-torture/execute/builtins/strncmp-2.c execution, -fast +4087313: gcc.dg/20011119-1.c (test for excess errors) +4087319: gcc.dg/990424-1.c execution test +4087219: gcc.dg/i386-asm-3.c (test for excess errors) +4087327: gcc.dg/clobbers.c (test for excess errors) +4087330: gcc.dg/sibcall-6.c execution test +4053179: gcc.dg/vect/vect-none.c scan-tree-dump-times vectorized 0 loops 2 +4053179: gcc.dg/vect/vect-none.c scan-tree-dump-times vectorized 1 loops 1 +#4015764: gcc.c-torture/compile/20000518-1.c -O1 (test for excess errors) +#4015764: gcc.c-torture/compile/20000518-1.c -O2 (test for excess errors) +#4015764: gcc.c-torture/compile/20000518-1.c -O3 -fomit-frame-pointer (test for excess errors) +#4015764: gcc.c-torture/compile/20000518-1.c -O3 -g (test for excess errors) +#4015764: gcc.c-torture/compile/20000518-1.c -Os (test for excess errors) +#4015764: gcc.c-torture/compile/20000518-1.c -fast (test for excess errors) +4087219: gcc.c-torture/compile/20000804-1.c -O0 (test for excess errors) +4015789: gcc.c-torture/compile/20011029-1.c -O0 (test for excess errors) +4015854: gcc.c-torture/execute/20020720-1.c compilation, -O1 +4015854: gcc.c-torture/execute/20020720-1.c compilation, -O2 +4015854: gcc.c-torture/execute/20020720-1.c compilation, -O3 -fomit-frame-pointer +4015854: gcc.c-torture/execute/20020720-1.c compilation, -O3 -g +4015854: gcc.c-torture/execute/20020720-1.c compilation, -Os +4015854: gcc.c-torture/execute/20020720-1.c compilation, -fast +4015789: gcc.c-torture/execute/built-in-setjmp.c compilation, -O0 +4015789: gcc.c-torture/execute/built-in-setjmp.c compilation, -O1 +4015789: gcc.c-torture/execute/built-in-setjmp.c compilation, -O2 +4015789: gcc.c-torture/execute/built-in-setjmp.c compilation, -O3 -fomit-frame-pointer +4015789: gcc.c-torture/execute/built-in-setjmp.c compilation, -O3 -fomit-frame-pointer -funroll-loops +4015789: gcc.c-torture/execute/built-in-setjmp.c compilation, -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions +4015789: gcc.c-torture/execute/built-in-setjmp.c compilation, -O3 -g +4015789: gcc.c-torture/execute/built-in-setjmp.c compilation, -Os +4015789: gcc.c-torture/execute/built-in-setjmp.c compilation, -fast +4015896: gcc.dg/20020312-2.c (test for excess errors) +4015896: gcc.dg/20020919-1.c (test for errors, line 244) +4015896: gcc.dg/20020919-1.c (test for excess errors) +#4015916: gcc.dg/c99-tgmath-2.c (test for excess errors) +#4015916: gcc.dg/c99-tgmath-3.c (test for excess errors) +#4015916: gcc.dg/c99-tgmath-4.c (test for excess errors) +#4015922: gcc.dg/cpp/19990407-1.c (test for excess errors) +#4015927: gcc.dg/cpp/headermap-1.c (test for excess errors) +#4015927: gcc.dg/cpp/headermap-2.c (test for warnings, line 10) +#4015922: gcc.dg/cpp/strp1.c (test for excess errors) +#4015922: gcc.dg/cpp/strp2.c (test for excess errors) +4015940: gcc.dg/lvalue-cast-1.c (test for warnings, line 20) +4015940: gcc.dg/lvalue-cast-1.c (test for excess errors) +#4015922: gcc.dg/struct-ret-libc.c (test for excess errors) +4053179: gcc.dg/tree-ssa-vect/ifc-01.c execution test +#4064388: gcc.c-torture/execute/simd-1.c execution, -O0 +#4064388: gcc.c-torture/execute/simd-2.c execution, -O0 +#4064388: gcc.c-torture/execute/simd-2.c execution, -O1 +#4064388: gcc.c-torture/execute/simd-2.c execution, -O2 +#4064388: gcc.c-torture/execute/simd-2.c execution, -O3 -fomit-frame-pointer +#4064388: gcc.c-torture/execute/simd-2.c execution, -O3 -g +#4064388: gcc.c-torture/execute/simd-2.c execution, -Os +#4064388: gcc.c-torture/execute/simd-2.c execution, -fast +#4087332: gcc.c-torture/execute/va-arg-25.c execution, -Os +4087344: gcc.dg/i386-387-1.c scan-assembler call\t_?sin +4087344: gcc.dg/i386-387-1.c scan-assembler call\t_?cos +4087344: gcc.dg/i386-387-1.c scan-assembler call\t_?sqrt +4087344: gcc.dg/i386-387-1.c scan-assembler call\t_?atan2 +4087344: gcc.dg/i386-387-1.c scan-assembler call\t_?log +4087344: gcc.dg/i386-387-1.c scan-assembler call\t_?exp +4087344: gcc.dg/i386-387-1.c scan-assembler call\t_?tan +4087344: gcc.dg/i386-387-1.c scan-assembler call\t_?fmod +4087344: gcc.dg/i386-387-3.c scan-assembler fldpi +4087344: gcc.dg/i386-387-4.c scan-assembler fldpi +4087344: gcc.dg/i386-387-5.c scan-assembler call\t_?atan +4087344: gcc.dg/i386-387-5.c scan-assembler call\t_?log1p +4087344: gcc.dg/i386-387-5.c scan-assembler call\t_?drem +4087344: gcc.dg/i386-cmov1.c scan-assembler sar[^\\n]*magic_namea +4087344: gcc.dg/i386-cmov1.c scan-assembler sar[^\\n]*magic_nameb +4087344: gcc.dg/i386-cmov1.c scan-assembler sar[^\\n]*magic_namec +4087344: gcc.dg/i386-cmov1.c scan-assembler shr[^\\n]*magic_named +4087344: gcc.dg/i386-cmov1.c scan-assembler shr[^\\n]*magic_namee +4087344: gcc.dg/i386-cmov1.c scan-assembler shr[^\\n]*magic_namef +4087344: gcc.dg/i386-cmov4.c scan-assembler cmov +4087344: gcc.dg/i386-local2.c scan-assembler-not sub[^\\n]*sp +4087344: gcc.dg/i386-mul.c scan-assembler and[^\\n]*magic +4087344: gcc.dg/i386-ssetype-1.c scan-assembler andpd[^\\n]*magic +4087344: gcc.dg/i386-ssetype-1.c scan-assembler andnpd[^\\n]*magic +4087344: gcc.dg/i386-ssetype-1.c scan-assembler xorpd[^\\n]*magic +4087344: gcc.dg/i386-ssetype-1.c scan-assembler orpd[^\\n]*magic +4087344: gcc.dg/i386-ssetype-1.c scan-assembler movapd[^\\n]*magic +4087344: gcc.dg/i386-ssetype-3.c scan-assembler andps[^\\n]*magic +4087344: gcc.dg/i386-ssetype-3.c scan-assembler andnps[^\\n]*magic +4087344: gcc.dg/i386-ssetype-3.c scan-assembler xorps[^\\n]*magic +4087344: gcc.dg/i386-ssetype-3.c scan-assembler orps[^\\n]*magic +4087344: gcc.dg/i386-ssetype-3.c scan-assembler movaps[^\\n]*magic +4087344: gcc.dg/i386-ssetype-5.c scan-assembler pand[^\\n]*magic +4087344: gcc.dg/i386-ssetype-5.c scan-assembler pandn[^\\n]*magic +4087344: gcc.dg/i386-ssetype-5.c scan-assembler pxor[^\\n]*magic +4087344: gcc.dg/i386-ssetype-5.c scan-assembler por[^\\n]*magic +4087344: gcc.dg/i386-cvt-1.c scan-assembler cvttsd2si[^\\n]*xmm +4087344: gcc.dg/i386-cvt-1.c scan-assembler cvttss2si[^\\n]*xmm +4087344: gcc.misc-tests/i386-pf-none-1.c -march=i686 scan-assembler-not fetch +4087344: gcc.misc-tests/i386-pf-none-1.c -march=pentium2 scan-assembler-not fetch diff --git a/gcc/testsuite/bugs/powerpc/libstdc++-v3.xfail b/gcc/testsuite/bugs/powerpc/libstdc++-v3.xfail new file mode 100644 index 00000000000..01cb049740a --- /dev/null +++ b/gcc/testsuite/bugs/powerpc/libstdc++-v3.xfail @@ -0,0 +1,34 @@ +# APPLE LOCAL file testsuite +### +### List of failing tests with Radar bug numbers +### <radarNum>: <test name> +### test name should be exactly as it appears html summary reports +### including any trailing #<number> +### +### When the bug is fixed and the test passes, it will be a +### analyzed non-fail. You should then comment out the test in this +### file and make sure the Radar bug is closed. +### +###------------------------------------------------------------------ +4125559: 21_strings/basic_string/capacity/char/18654.cc execution test +4125559: 21_strings/basic_string/capacity/wchar_t/18654.cc execution test +3884894: 23_containers/vector/resize/1.cc execution test +3378287: 26_numerics/cmath/c99_classification_macros_c.cc (test for excess errors) +3378287: 26_numerics/complex/13450.cc execution test +4125559: 27_io/basic_istream/get/char/3.cc execution test +4125559: 27_io/basic_istream/get/wchar_t/3.cc execution test +4125559: 27_io/basic_istream/getline/char/6.cc execution test +4125559: 27_io/basic_istream/getline/wchar_t/6.cc execution test +4127891: 27_io/ios_base/storage/11584.cc execution test +3884894: 27_io/ios_base/storage/2.cc execution test +4079184: demangle/abi_examples/01.cc execution test +4079184: demangle/abi_examples/02.cc execution test +# +# the following failures are for x86 only +#4125564: 22_locale/money_put/put/char/4.cc execution test +#4125564: 22_locale/money_put/put/wchar_t/4.cc execution test +#4125564: 22_locale/num_put/put/char/4.cc execution test +#4125564: 22_locale/num_put/put/wchar_t/4.cc execution test +#4125564: 26_numerics/complex/complex_inserters_extractors.cc execution test +4129761: 26_numerics/complex/complex_value.cc execution test +4129761: 26_numerics/complex/pow.cc execution test diff --git a/gcc/testsuite/bugs/powerpc/obj-c++.xfail b/gcc/testsuite/bugs/powerpc/obj-c++.xfail new file mode 100644 index 00000000000..b0ba438f345 --- /dev/null +++ b/gcc/testsuite/bugs/powerpc/obj-c++.xfail @@ -0,0 +1,12 @@ +# APPLE LOCAL file testsuite +### +### List of failing tests with Radar bug numbers +### <radarNum>: <test name> +### test name should be exactly as it appears html summary reports +### including any trailing #<number> +### +### When the bug is fixed and the test passes, it will be an +### analyzed non-fail. You should then comment out the test in this +### file and make sure the Radar is closed. +### +###------------------------------------------------------------------ diff --git a/gcc/testsuite/bugs/powerpc/objc.xfail b/gcc/testsuite/bugs/powerpc/objc.xfail new file mode 100644 index 00000000000..b47ac9fe83e --- /dev/null +++ b/gcc/testsuite/bugs/powerpc/objc.xfail @@ -0,0 +1,21 @@ +# APPLE LOCAL file testsuite +### +### List of failing tests with Radar bug numbers +### <radarNum>: <test name> +### test name should be exactly as it appears html summary reports +### including any trailing #<number> +### +### When the bug is fixed and the test passes, it will be an +### analyzed non-fail. You should then comment out the test in this +### file and make sure the Radar is closed. +### +###------------------------------------------------------------------ +#4055183: objc.dg/stubify-1.m scan-assembler (bl|call)\tL_objc_msgSend\\$stub\n +#4055183: objc.dg/stubify-1.m scan-assembler (bl|call)\tL_bogonic\\$stub\n +#4055183: objc.dg/stubify-1.m scan-assembler-not \\$non_lazy_ptr +#4055183: objc.dg/stubify-2.m scan-file-not symbol_ref.*"objc_msgSend" +#4087344: objc.dg/stret-2.m scan-assembler objc_msgSend_stret +#4087344: objc.dg/stret-2.m scan-assembler-not objc_msgSend[^_S] +#4087344: objc.dg/stret-2.m scan-assembler-not objc_msgSendSuper[^_] +#4087344: objc.dg/symtab-1.m scan-assembler L_OBJC_SYMBOLS.*:\n\t.long\t0\n\t.long\t0\n\t.short\t2\n\t.short\t0\n\t.long\tL_OBJC_CLASS_Derived.*\n\t.long\tL_OBJC_CLASS_Base.*\n + diff --git a/gcc/testsuite/g++.dg/4080945a.C b/gcc/testsuite/g++.dg/4080945a.C new file mode 100644 index 00000000000..6a46a9e3d09 --- /dev/null +++ b/gcc/testsuite/g++.dg/4080945a.C @@ -0,0 +1,43 @@ +/* APPLE LOCAL file 4080945 / PR 20742 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/**********************************************************************/ + +extern int Loop1Max,Loop2Max; +void bar(int a, int b, int c); +void foo(int parm); + +/**********************************************************************/ + +#define x7(x) x;x;x;x;x;x;x +#define REPL(x) x7(x);x7(x);x7(x);x7(x);x7(x);x7(x) + // 6 * 7 = 42 (0.06 seconds compile-time for GCC 3.3, 1 year for GCC 4.0) + // Changing REPL from 42 to 21 will reduce GCC 4.0 compile-time to 20 seconds. + +/**********************************************************************/ +void foo(int parm) +{ + register int x,y; + register int a,b,c; + + a = b = c = parm; + + for (y=0; y<Loop2Max; ++y) + { + for (x=0; x<Loop1Max; ++x) + { + REPL + ( + a = c * a; + b = a * b; + c = parm - a; + ); + } + } + + bar(a,b,c); + + return; +} + +/**********************************************************************/ diff --git a/gcc/testsuite/g++.dg/abi/param2.C b/gcc/testsuite/g++.dg/abi/param2.C new file mode 100644 index 00000000000..ed3c0dff132 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/param2.C @@ -0,0 +1,18 @@ +// PR target/20795 +// Test passing aligned empty aggregate +// { dg-do compile } + +struct S { union {} a; } __attribute__((aligned)); + +S +foo (S arg) +{ + return arg; +} + +void +bar (void) +{ + S arg; + foo (arg); +} diff --git a/gcc/testsuite/g++.dg/abi/vague1.C b/gcc/testsuite/g++.dg/abi/vague1.C index 83be514919a..02feee9e2d4 100644 --- a/gcc/testsuite/g++.dg/abi/vague1.C +++ b/gcc/testsuite/g++.dg/abi/vague1.C @@ -3,8 +3,6 @@ // Disable debug info so we don't get confused by the symbol name there. // { dg-options "-g0" } -// The test fails on hppa*-*-hpux* because the symbol _ZN1AIiE1tE is imported. -// { dg-final { scan-assembler-not "_ZN1AIiE1tE" { xfail hppa*-*-hpux* } } } template <class T> struct A { static const T t = 0; diff --git a/gcc/testsuite/g++.dg/align-test-1.C b/gcc/testsuite/g++.dg/align-test-1.C new file mode 100644 index 00000000000..e0cdb68c851 --- /dev/null +++ b/gcc/testsuite/g++.dg/align-test-1.C @@ -0,0 +1,295 @@ +/* APPLE LOCAL file Macintosh alignment */ + +/* { dg-do run } */ +/* { dg-options "-Wno-long-long -Wno-invalid-offsetof" } */ + +/* + * Macintosh compiler alignment test for C++. + * Fred Forsman + * Apple Computer, Inc. + */ + +#include <stdio.h> +#include <stddef.h> +#include <string.h> + +extern "C" void abort (void); + +#define Q(x) #x, x + +typedef unsigned char UINT8; +typedef unsigned short UINT16; +typedef unsigned long UINT32; + +static int bad_option = 0; +static int flag_verbose = 0; +static int nbr_failures = 0; + +/* === classes === */ + +class C1 { + static const int f1 = 1; + UINT8 f2; +}; + +class C2 { + static int f1; + UINT8 f2; +}; + +class C3 { + public: + enum E1 { + f1 = 1 + }; + protected: + UINT8 f2; +}; + +class C4 { + UINT8 f1; + static const int f2 = 1; +}; + +class C5 { + UINT8 f2; + static int f1; +}; + +class C6 { + UINT8 f1; + enum E1 { + f2 = 1 + }; +}; + +class C7 { + /* empty base class */ +}; + +#ifndef __LP64__ +#pragma options align=mac68k + +class C8 { + /* empty base class */ +}; + +class C9: public C8 { + public: + UINT8 f1; +}; + +#pragma options align=reset +#endif /* n __LP64 __ */ + +/* What is offset of first field after an empty base class? */ +class C10: public C7 { + public: + UINT8 f1; +}; + +/* Check that we no longer try to put derived class bits in padding at end of base class. */ +class C11 { + public: + UINT32 f1; + UINT8 f2; +}; + +class C12: public C11 { + public: + UINT8 f3; +}; + +/* Check whether compiler will reorder members to take advantage of + padding. If the compiler did this (which it does not appear to + do), f3 and f4 in C14 would be reordered to take advantage of the + padding at the end of the base class. */ +class C13 { + public: + UINT32 f1; + UINT16 f2; +}; + +class C14: public C13 { + public: + UINT32 f3; + UINT16 f4; +}; + +/* Tests for double aligned base class */ + +class C15 { + public: + double f1; + long f2; +}; + +class C16: public C15 { +}; + +class C17: public C15 { + public: + long f3; +}; + +class C18: public C16 { + public: + char f3; +}; + +class C19: public C17 { + public: + char f4; +}; + +/* Tests for alignment in class with v-table pointer */ + +class C20 { + public: + double f1; + virtual void func1(void); +}; + +/* === vectors === */ + +#ifdef __VEC__ +class VC1 { + public: + vector signed short f1; + UINT8 f2; +}; + +typedef struct VS1 { + VC1 f1; + UINT8 f2; +} VS1; + +class VC2: public VC1 { + public: + UINT8 f1; +}; + +typedef struct VS2 { + UINT8 f1; + VC2 f2; + UINT8 f3; +} VS2; + +class VC3 { + public: + vector signed short f1; + virtual void func1(void); +}; + +#endif + +/* === bools === */ + +typedef struct B1 { + bool f1; + UINT8 f2; +} B1; + +typedef struct B2 { + UINT8 f1; + bool f2; +} B2; + + +static void check(char * rec_name, int actual, int expected32, int expected64, + int expected_ia32, char * comment) +{ + int expected; +#ifdef __i386__ + expected = expected_ia32; +#else + expected = ((sizeof(char *) == 8) ? expected64 : expected32); +#endif + if (flag_verbose || (actual != expected)) { + printf("%-20s = %2d (%2d) ", rec_name, actual, expected); + if (actual != expected) { + printf("*** FAIL"); + nbr_failures++; + } else + printf(" PASS"); + printf(": %s\n", comment); + } +} + +static void check_option(char *option) +{ + if (*option == '-') { + if (strcmp(option, "-v") == 0) + flag_verbose = 1; + else { + fprintf(stderr, "*** unrecognized option '%s'.\n", option); + bad_option = 1; + } + } else { + fprintf(stderr, "*** unrecognized option '%s'.\n", option); + bad_option = 1; + } +} + +int main(int argc, char *argv[]) +{ + int i; + + for (i = 1; i < argc; i++) + check_option(argv[i]); + + if (bad_option) + return 1; + + check(Q(sizeof(C1)), 1, 1, 1, "const as 1st field"); + check(Q(sizeof(C2)), 1, 1, 1, "static as 1st field"); + check(Q(sizeof(C3)), 1, 1, 1, "enum as 1st field"); + check(Q(sizeof(C4)), 1, 1, 1, "const as 2nd field"); + check(Q(sizeof(C5)), 1, 1, 1, "static as 2nd field"); + check(Q(sizeof(C6)), 1, 1, 1, "enum as 2nd field"); + check(Q(sizeof(C7)), 1, 1, 1, "empty class, power mode"); +#ifndef __LP64__ + check(Q(sizeof(C8)), 2, 2, 2, "empty class, mac68k mode"); + check(Q(sizeof(C9)), 2, 2, 2, "class with empty base class and one char, mac68k"); + check(Q(offsetof(C9, f1)), 0, 0, 0, "offset of 1st field after empty base class"); +#endif + check(Q(sizeof(C10)), 1, 1, 1, "class based on an empty class, power mode"); + check(Q(sizeof(C11)), 8, 16, 8, "class with long, char"); + check(Q(sizeof(C12)), 12, 24, 12, "class with base class with long, char and its own char"); + check(Q(offsetof(C12, f3)), 8, 16, 8, "offset of 1st field in class with a base class with a long, char"); + check(Q(sizeof(C13)), 8, 16, 8, "class with long, short"); + check(Q(sizeof(C14)), 16, 32, 16, "derived class with short, long"); + check(Q(offsetof(C14, f3)), 8, 16, 8, "offset of 1st field after base class with padding"); + check(Q(offsetof(C14, f4)), 12, 24, 12, "offset of 2nd field after base class with padding"); + + check(Q(sizeof(C15)), 16, 16, 12, "base class with double, long"); + check(Q(sizeof(C16)), 16, 16, 12, "empty derived class with base with double, long"); + check(Q(sizeof(C17)), 24, 24, 16, "derived class with base with double, long and its own long"); + check(Q(sizeof(C18)), 20, 24, 16, "derived class based on empty derived class with base with double, long"); + check(Q(sizeof(C19)), 24, 32, 20, "derived class based on derived class with base with double, long and its own long"); + check(Q(sizeof(C20)), 12, 16, 12, "class with double and v-table ptr"); + check(Q(offsetof(C20, f1)), 4, 8, 4, "offset of double 1st field in class with v-table ptr"); + + /* Vector tests */ +#ifdef __VEC__ + check(Q(sizeof(VC1)), 32, 32, 32, "class with vector as 1st field"); + check(Q(sizeof(VS1)), 48, 48, 48, "struct with a class with a vector as 1st field"); + check(Q(sizeof(VC2)), 48, 48, 48, "class with base class containing a vector"); + check(Q(offsetof(VC2, f1)), 32, 32, 32, "offset of 1st field after base class with vector, char, and padding"); + check(Q(sizeof(VS2)), 80, 80, 80, "struct with a char, class with a vector, char"); + check(Q(offsetof(VS2, f2)), 16, 16, 16, "offset of class with a vector in a struct with char, class..."); + check(Q(offsetof(VS2, f3)), 64, 64, 64, "offset of 2nd char in a struct with char, class, char"); + check(Q(sizeof(VC3)), 32, 32, 32, "class with a vector and v-table ptr"); + check(Q(offsetof(VC3, f1)), 16, 16, 16, "offset vector in class with a vector and v-table ptr"); +#endif + + /* bool tests */ + check(Q(sizeof(bool)), 4, 1, 1, "bool data type"); + check(Q(sizeof(B1)), 8, 2, 2, "struct with bool, char"); + check(Q(sizeof(B2)), 8, 2, 2, "struct with char, bool"); + + if (nbr_failures > 0) + return 1; + else + return 0; +} diff --git a/gcc/testsuite/g++.dg/altivec-1.C b/gcc/testsuite/g++.dg/altivec-1.C new file mode 100644 index 00000000000..6bda7094db0 --- /dev/null +++ b/gcc/testsuite/g++.dg/altivec-1.C @@ -0,0 +1,12 @@ +/* APPLE LOCAL file AltiVec */ +/* Test for static_cast<...> among AltiVec types. */ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-faltivec" } */ + +struct Foo2 { + vector unsigned int vui; + vector signed int As_vsi() { + return static_cast<vector signed int>(vui); /* { dg-bogus "invalid static_cast" } */ + } +}; + diff --git a/gcc/testsuite/g++.dg/altivec-2.C b/gcc/testsuite/g++.dg/altivec-2.C new file mode 100644 index 00000000000..0b2f3751a24 --- /dev/null +++ b/gcc/testsuite/g++.dg/altivec-2.C @@ -0,0 +1,15 @@ +/* APPLE LOCAL file AltiVec */ +/* Test for distinguishing 'vector bool ...' from 'vector unsigned ...' + types by the front-end. */ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-faltivec" } */ + +struct Foo1 { + void foo(vector unsigned char) { } + void foo(vector bool char) { } /* { dg-bogus "has already been declared" } */ + void bar(vector unsigned short) { } + void bar(vector bool short) { } /* { dg-bogus "has already been declared" } */ + void baz(vector unsigned int) { } + void baz(vector bool int) { } /* { dg-bogus "has already been declared" } */ +}; + diff --git a/gcc/testsuite/g++.dg/altivec-3.C b/gcc/testsuite/g++.dg/altivec-3.C new file mode 100644 index 00000000000..77084a1d824 --- /dev/null +++ b/gcc/testsuite/g++.dg/altivec-3.C @@ -0,0 +1,21 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-faltivec -Wall" } */ + +/* This test checks if AltiVec builtins accept const-qualified + arguments. */ + +int main (int argc, const char * argv[]) +{ + int i; + const float cf = 1.0; + vector float v; + const vector float cv = (vector float)(1.0, 2.0, 3.0, 4.0); + + vec_dst(&cv, i, 0); + v = vec_ld(0, &cv); + v = vec_lde(0, &cf); + vec_lvsl(0, &cf); + + return 0; +} diff --git a/gcc/testsuite/g++.dg/altivec-4.C b/gcc/testsuite/g++.dg/altivec-4.C new file mode 100644 index 00000000000..63eb1d5c379 --- /dev/null +++ b/gcc/testsuite/g++.dg/altivec-4.C @@ -0,0 +1,129 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-faltivec -maltivec" } */ + +/* Test for correct handling of AltiVec constants passed + through '...' (va_arg). */ + +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> + +#define CHECK_INVARIANT(expr) \ + if (!(expr)) { \ + printf ("ASSERT FAILED: %d: %s\n", __LINE__, #expr); \ + abort (); \ + } + +struct foo { int x; int y; }; +struct vfoo { int x; __vector signed int v; int y; }; +union u { __vector signed int v; signed int i[4]; }; + +struct foo x_g = { 3, 4}; +struct vfoo vx_g = { 10, (vector signed int)(11, 12, 13, 14), 15 }; +__vector signed int v_g = (vector signed int) (22, 23, 24, 25); +struct vfoo vx2_g = { 30, (vector signed int)(31, 32, 33, 34), 35 }; +__vector signed int v2_g = (vector signed int)(40, 41, 42, 43); +int i_1 = 99, i_2 = 33; +double d_2 = 1.5, d_3 = 1.75; +long double ld_1 = 1.25; + +void bar (int i, ... ) +{ + struct foo xi; + double d; + long double ld; + float f; + char c; + short s; + va_list ap; + va_start(ap, i); + xi = va_arg(ap, struct foo); + s = (short)va_arg(ap, int); + f = (float)va_arg(ap, double); + ld = va_arg(ap, long double); + c = (char)va_arg(ap, int); + d = va_arg(ap, double); + va_end(ap); + + CHECK_INVARIANT (xi.x == x_g.x && xi.y == x_g.y); + CHECK_INVARIANT (s == (short)i_2); + CHECK_INVARIANT (f == (float)d_2); + CHECK_INVARIANT (ld == ld_1); + CHECK_INVARIANT (c == (char)i_1); + CHECK_INVARIANT (d == d_3); +} + +void baz (int i, ... ) +{ + struct vfoo vx, vx2; + __vector signed int v_i, v2_i; + int j, k, l; + va_list ap; + va_start(ap, i); + v_i = va_arg(ap, __vector signed int); /* { dg-bogus "non-POD type" } */ + j = va_arg(ap, int); + vx = va_arg(ap, struct vfoo); /* { dg-bogus "non-POD type" } */ + k = va_arg(ap, int); + v2_i = va_arg(ap, __vector signed int); /* { dg-bogus "non-POD type" } */ + l = va_arg(ap, int); + vx2 = va_arg(ap, struct vfoo); /* { dg-bogus "non-POD type" } */ + va_end(ap); + + CHECK_INVARIANT (vec_all_eq (v_i, v_g)); + CHECK_INVARIANT (j == i_1); + CHECK_INVARIANT (vx.x == vx_g.x && vec_all_eq(vx.v, vx_g.v) && vx.y == vx_g.y); + CHECK_INVARIANT (k == i_1); + CHECK_INVARIANT (vec_all_eq (v2_i, v2_g)); + CHECK_INVARIANT (l == i_1); + CHECK_INVARIANT (vx2.x == vx2_g.x && vec_all_eq(vx2.v, vx2_g.v) && vx2.y == vx2_g.y); +} + +void quux (int i, ... ) +{ + __vector signed int v_i, v2_i; + union u vi, v2i; + va_list ap; + va_start(ap, i); + v_i = va_arg(ap, __vector signed int); + v2_i = va_arg(ap, __vector signed int); + va_end(ap); + vi.v = v_i; + v2i.v = v2_i; + + CHECK_INVARIANT (vec_all_eq (v_i, v_g)); + CHECK_INVARIANT (vec_all_eq (v2_i, v_g)); + CHECK_INVARIANT (vec_all_eq (vi.v, v_g)); + CHECK_INVARIANT (vec_all_eq (v2i.v, v_g)); +} + +void baz2 (int i, ... ) +{ + struct vfoo vx; + union u vxi; + va_list ap; + va_start(ap, i); + vx = va_arg(ap, struct vfoo); + va_end(ap); + vxi.v = vx.v; + + CHECK_INVARIANT (vx.x == vx_g.x && vec_all_eq(vx.v, vx_g.v) && vx.y == vx_g.y); + CHECK_INVARIANT (vec_all_eq (vxi.v, vx_g.v)); +} + +int main(void) +{ + CHECK_INVARIANT (sizeof(struct foo) == 8 && sizeof(struct vfoo) == 48); + + bar(i_1, x_g, (short)i_2, (float)d_2, ld_1, (char)i_1, d_3); + baz(i_1, v_g, /* { dg-bogus "non-POD type" "" { target *-*-* } 122 } */ + i_1, vx_g, /* { dg-bogus "non-POD type" "" { target *-*-* } 122 } */ + i_1, v2_g, /* { dg-bogus "non-POD type" "" { target *-*-* } 122 } */ + i_1, vx2_g); /* { dg-bogus "non-POD type" } */ + quux(i_1, v_g, /* { dg-bogus "non-POD type" "" { target *-*-* } 124 } */ + v_g); /* { dg-bogus "non-POD type" } */ + baz2(i_1, vx_g); /* { dg-bogus "non-POD type" } */ + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/altivec-5.C b/gcc/testsuite/g++.dg/altivec-5.C new file mode 100644 index 00000000000..9cfa64470d6 --- /dev/null +++ b/gcc/testsuite/g++.dg/altivec-5.C @@ -0,0 +1,19 @@ +/* APPLE LOCAL file AltiVec */ +/* Test for AltiVec type overloading. */ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-faltivec" } */ + void foo(vector unsigned char) { } + void foo(vector signed char) { } + void foo(vector bool char) { } + void foo(vector unsigned short) { } + void foo(vector signed short) { } + void foo(vector bool short) { } + void foo(vector unsigned int) { } + void foo(vector signed int) { } + void foo(vector bool int) { } + void foo(vector float) { } + void foo(vector pixel) { } + void foo(int) { } + void foo(unsigned int) { } + void foo(float) { } + void foo(bool) { } diff --git a/gcc/testsuite/g++.dg/altivec-7.C b/gcc/testsuite/g++.dg/altivec-7.C new file mode 100644 index 00000000000..74467361dd9 --- /dev/null +++ b/gcc/testsuite/g++.dg/altivec-7.C @@ -0,0 +1,66 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-faltivec" } */ + + +extern "C" void abort(void); + +void CMP (vector unsigned char v, vector unsigned char v1) +{ + union { + vector unsigned char vv; + unsigned char s[16]; + } r, r1; + r.vv = v; + r1.vv = v1; + + for (int i=0; i < 16; i++) + if (r.s[i] != r1.s[i]) + abort(); + return; +} + +#define TEST_FUNCTION_TEMPLATE + +#ifdef TEST_FUNCTION_TEMPLATE +template <int I> +#endif +void vectorTest() +{ + typedef vector unsigned char VUC; + + // Multiple initializers with expressions + const unsigned char kFoo = 0; + enum { kBar = 1 }; + VUC v1 = {kFoo,kBar,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + VUC v3 = (VUC)(kFoo,kBar,2,3,4,5,6,7,8,9,10,11,12,13,14,15); + CMP (v1, v3); + + VUC v2 = {kBar*kFoo,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + VUC v4 = (VUC)(kBar*kFoo,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15); + CMP (v2, v4); + + // Single initializers + VUC v5 = {42}; + VUC v7 = (VUC)(42); + CMP (v5, v7); + + VUC v6 = {40+2}; + VUC v8 = (VUC)(40+2); + CMP (v6, v8); + + VUC v9 = {I+5}; + VUC v11 = (VUC)(I+5); + CMP (v9, v11); +} + + +int main (int argc, char * const argv[]) +{ +#ifdef TEST_FUNCTION_TEMPLATE + vectorTest<0>(); +#else + vectorTest(); +#endif + return 0; +} diff --git a/gcc/testsuite/g++.dg/altivec-8.C b/gcc/testsuite/g++.dg/altivec-8.C new file mode 100644 index 00000000000..5e6b75c1b62 --- /dev/null +++ b/gcc/testsuite/g++.dg/altivec-8.C @@ -0,0 +1,31 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-faltivec" } */ + +extern "C" void abort(); + +void check_eq (vector signed short v1, vector signed short v2) +{ + if (!vec_all_eq (v1, v2)) + abort(); + return; +} + +int main() +{ + int r; + + vector signed short vboundary[8] = { + (vector signed short)(0), + (vector signed short)(1), + (vector signed short)(2), + (vector signed short)(3), + (vector signed short)(4), + (vector signed short)(5), + (vector signed short)(6), + (vector signed short)(7) + }; + for (r = 0; r < 8; r++) + check_eq (vboundary[r], (vector signed short)(r,r,r,r,r,r,r,r)); + return 0; +} diff --git a/gcc/testsuite/g++.dg/apple-altivec-1.C b/gcc/testsuite/g++.dg/apple-altivec-1.C new file mode 100644 index 00000000000..c070de43f6c --- /dev/null +++ b/gcc/testsuite/g++.dg/apple-altivec-1.C @@ -0,0 +1,9 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-faltivec" } */ + +void foo() { + vector bool int boolVector = (vector bool int) vec_splat_u32(3); + boolVector = vec_sld( boolVector, boolVector, + 1 ); /* { dg-bogus "no instance of overloaded" } */ +} diff --git a/gcc/testsuite/g++.dg/apple-altivec-2.C b/gcc/testsuite/g++.dg/apple-altivec-2.C new file mode 100644 index 00000000000..4e6d70b483b --- /dev/null +++ b/gcc/testsuite/g++.dg/apple-altivec-2.C @@ -0,0 +1,32 @@ +/* APPLE LOCAL file */ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-maltivec" } */ + +#include <altivec.h> + +extern "C" void abort (void); + +int main() +{ + vector float tiny = (vector float) ((vector unsigned int) (0x00800000, 0xBF800000, 0x3E800000, 0)); + unsigned int af[4] = { + (unsigned int)(unsigned int)0x00800000, + (unsigned int)(unsigned int)0xBF800000, + (unsigned int)(unsigned int)0x3E800000, + (unsigned int)(unsigned int)0}; + + union u { + vector float vf; + unsigned int ai[4]; + }vu; + int i; + + vu.vf = tiny; + + for (i=0; i < 4; i++) + if (af[i] != vu.ai[i]) + abort(); + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/apple-altivec-6.C b/gcc/testsuite/g++.dg/apple-altivec-6.C new file mode 100644 index 00000000000..90c2d48abe1 --- /dev/null +++ b/gcc/testsuite/g++.dg/apple-altivec-6.C @@ -0,0 +1,15 @@ +/* APPLE LOCAL file */ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-maltivec -pedantic" } */ + +int main() + { + typedef unsigned char UC; + typedef vector unsigned char VUC; + + const UC kBar = 7; + VUC vBar1 = (VUC)(kBar); + VUC vBar2 = {kBar}; + VUC vBar3 = (VUC){kBar}; + return 0; + } diff --git a/gcc/testsuite/g++.dg/apple-altivec-7.C b/gcc/testsuite/g++.dg/apple-altivec-7.C new file mode 100644 index 00000000000..c5f2cd51933 --- /dev/null +++ b/gcc/testsuite/g++.dg/apple-altivec-7.C @@ -0,0 +1,21 @@ +/* APPLE LOCAL file */ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-faltivec" } */ + +typedef __vector unsigned int vui; // 1 +typedef __vector float vf; // 2 + +template <int i> vui do2 () // 3 +{ + vui v; return v; +} + +template <int j> vf do1 () +{ + static_cast <vf> (do2 <j> ()); // 4 +} + +int main () +{ + do1 <12> (); // 5 +} diff --git a/gcc/testsuite/g++.dg/apple-altivec-test.C b/gcc/testsuite/g++.dg/apple-altivec-test.C new file mode 100644 index 00000000000..723ed86006d --- /dev/null +++ b/gcc/testsuite/g++.dg/apple-altivec-test.C @@ -0,0 +1,57 @@ +/* APPLE LOCAL file */ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-maltivec" } */ + +#include <altivec.h> + +extern "C" void abort(); + +class Star +{ + public: + inline vector float foo() const; + + Star() + { + data.f[0] = 1.0; data.f[1] = 2.0; data.f[2] = 3.0, data.f[3] = 4.0; + } + + private: + union { + float f[4]; + vector float v; + } data; + + friend vector float fTest(const Star &); +}; + +vector float Star::foo() const +{ + return data.v; +} + +vector float fTest(const Star & val) +{ + vector float vf = val.foo(); + return vf; +} + +int main() { + + Star s; + + union u { + float f[4]; + vector float v; + } data; + + data.v = fTest(s); + for (int i=0 ; i < 4; i++) + if (data.f[i] != (float)(i+1)) + abort(); + return 0; +} + + + + diff --git a/gcc/testsuite/g++.dg/asm-array-ref.C b/gcc/testsuite/g++.dg/asm-array-ref.C new file mode 100644 index 00000000000..0a0089a8764 --- /dev/null +++ b/gcc/testsuite/g++.dg/asm-array-ref.C @@ -0,0 +1,21 @@ +/* APPLE LOCAL file CW asm blocks */ +/* { dg-do assemble { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks" } */ + +struct x { + int filler; + float f[100]; + virtual void vf(); +}; + +asm void func() +{ + lwz r4, x.f[0](r2) + lwz r5, x.f[0]+4(r2) +} + +int main (int argc, char * const argv[]) +{ + func(); +} + diff --git a/gcc/testsuite/g++.dg/asm-block-1.C b/gcc/testsuite/g++.dg/asm-block-1.C new file mode 100644 index 00000000000..63446417a12 --- /dev/null +++ b/gcc/testsuite/g++.dg/asm-block-1.C @@ -0,0 +1,75 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test asm-syntax blocks within functions. */ + +/* { dg-do run { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks" } */ + +extern "C" void abort (void); + +int +foo (int argx, int argy) +{ + register int locx = argx, locy = argy, rslt; + asm { + add rslt,locx,locy + } + return rslt; +} + +/* Exercise corners of syntax. */ + +int +bar () +{ + register int rslt = 100; + asm { + // Combos of instructions on a line + + nop + ; + nop + nop ; + ; nop + nop ; nop + ; nop ;;; li r3,95 ; nop ; + // '.' in an opcode + add. r6,r6,r5 + } + return rslt; +} + +int baz () +{ + register int rslt = 1; + asm { + li r8,29+(2 * 3); + add rslt,rslt,r8; + b @192 + @34 + nop + ble+ @34 + b forward + abc: + b abc + @abc: + b @abc + forward: ; @192: + nop + ; + sameline: nop + x1: @x2 @x3: nop ; @x4 x5: + } + return rslt; +} + +int +main () +{ + if (foo (22, 23) != 45) + abort (); + if (bar () != 100) + abort (); + if (baz () != 36) + abort (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/asm-block-2.C b/gcc/testsuite/g++.dg/asm-block-2.C new file mode 100644 index 00000000000..6248c2dcc63 --- /dev/null +++ b/gcc/testsuite/g++.dg/asm-block-2.C @@ -0,0 +1,101 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test structure refs in asm-syntax blocks within functions. */ + +/* { dg-do run { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks -O2" } */ + +extern "C" void abort(void); + +typedef struct astruct { + int arr[40]; + char charfield; + int fieldx; +} atypedef; + +union aunion { + int field1; + int field2; +}; + +class aclass { + public: + double headfield; + int intfield; +}; + +int fun1 (struct astruct *x) +{ + int loc; + asm { + lwz loc, astruct.fieldx(x) + addi loc, loc, 42 + } + return loc; +} + +int fun2 (atypedef *x) +{ + int loc; + + asm { + lwz loc, atypedef.fieldx(r3) + addi loc, loc, 43 + } + return loc; +} + +int fun3(int arg) +{ + int loc; + + asm { + mr loc, r3 + addi loc, loc, aunion.field1 + } + return loc; +} + +int fun4 (struct astruct *arg) +{ + int loc; + asm { + lbz loc, arg->charfield + addi loc, loc, 1 + } + return loc; +} + +int fun5 (aclass *x) +{ + int loc; + asm { + lwz loc, aclass.intfield(x) + addi loc, loc, 95 + } + return loc; +} + +struct astruct glob; +union uglob; + +int +main () +{ + aclass *localobj = new aclass; + + glob.charfield = 'b'; + glob.fieldx = 22; + if (fun1 (&glob) != 64) + abort (); + if (fun2 (&glob) != 65) + abort (); + if (fun3 (89) != 89) + abort (); + if (fun4 (&glob) != 'c') + abort (); + localobj->intfield = 55; + if (fun5 (localobj) != 150) + abort (); + return 0; +} + diff --git a/gcc/testsuite/g++.dg/asm-block-3.C b/gcc/testsuite/g++.dg/asm-block-3.C new file mode 100644 index 00000000000..b7fa0fe475a --- /dev/null +++ b/gcc/testsuite/g++.dg/asm-block-3.C @@ -0,0 +1,24 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test C++ keywords in asm-syntax blocks within functions. */ + +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks" } */ + +void +bar () +{ + register unsigned int theColor; + register unsigned char bbb; + asm {and++ bbb,theColor,24; }; + asm {and bbb,theColor,24; }; + asm {and_eq bbb,theColor,24; }; + asm {bitand bbb,theColor,24; }; + asm {bitor bbb,theColor,24; }; + asm {compl bbb,theColor,24; }; + asm {not bbb,theColor,24; }; + asm {not_eq bbb,theColor,24; }; + asm {or bbb,theColor,24; }; + asm {or_eq bbb,theColor,24; }; + asm {xor bbb,theColor,24; }; + asm {xor_eq bbb,theColor,24; }; +} diff --git a/gcc/testsuite/g++.dg/asm-block-4.C b/gcc/testsuite/g++.dg/asm-block-4.C new file mode 100644 index 00000000000..75886faa038 --- /dev/null +++ b/gcc/testsuite/g++.dg/asm-block-4.C @@ -0,0 +1,13 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test C++ keywords that are binary operators in asm-syntax blocks within functions. */ + +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks" } */ + +int baz (int arg1) { + asm { + mr r2, arg1 + add r3, r2, r2 + and r3, arg1, r3 + } +} diff --git a/gcc/testsuite/g++.dg/asm-block-5.C b/gcc/testsuite/g++.dg/asm-block-5.C new file mode 100644 index 00000000000..5bafb6df7f3 --- /dev/null +++ b/gcc/testsuite/g++.dg/asm-block-5.C @@ -0,0 +1,11 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test -40(sp) in asm-syntax blocks within functions. */ + +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks" } */ + +void foo() { + asm { + stfd f9,-40(sp); + } +} diff --git a/gcc/testsuite/g++.dg/asm-block-6.C b/gcc/testsuite/g++.dg/asm-block-6.C new file mode 100644 index 00000000000..55c78e4f975 --- /dev/null +++ b/gcc/testsuite/g++.dg/asm-block-6.C @@ -0,0 +1,14 @@ +/* APPLE LOCAL begin radar 4150131 */ +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks" } */ + +main() +{ + asm { + add r0,r0,r0 + } +} + +#pragma options align=mac68k +#pragma options align=reset +/* APPLE LOCAL end radar 4150131 */ diff --git a/gcc/testsuite/g++.dg/asm-function-1.C b/gcc/testsuite/g++.dg/asm-function-1.C new file mode 100644 index 00000000000..c546c1f0dde --- /dev/null +++ b/gcc/testsuite/g++.dg/asm-function-1.C @@ -0,0 +1,39 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test whole asm functions. */ + +/* { dg-do run { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks -O2" } */ + +extern "C" void abort (void); + +asm int +foo (register int argx, register int argy) +{ + add r3, argx, argy +} + +#define rsltreg r3 + +asm int +foo1 (register int argx, register int argy) +{ register int loc1, loc2; + nop + li loc1, 100 + li rsltreg,0 + b @a34 + add rsltreg, argx, argy +@a34 + add rsltreg, rsltreg, loc1 + blr +} + +int +main () +{ + if (foo (22, 23) != 45) + abort (); + if (foo1 (1, 2) != 100) + abort (); + return 0; +} + diff --git a/gcc/testsuite/g++.dg/asm-function-10.C b/gcc/testsuite/g++.dg/asm-function-10.C new file mode 100644 index 00000000000..c3ebc52bf65 --- /dev/null +++ b/gcc/testsuite/g++.dg/asm-function-10.C @@ -0,0 +1,21 @@ +/* APPLE LOCAL file CW asm blocks */ +/* { dg-do assemble { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks" } */ + +struct tDummyStruct +{ + unsigned long fDummy; + unsigned long fSample; +}; + +asm void foo() +{ + lwzu r1,(sizeof(tDummyStruct))(r2) // works + lwzu r1,sizeof(tDummyStruct)(r2) +} + +int main (int argc, char * const argv[]) +{ + foo(); +} + diff --git a/gcc/testsuite/g++.dg/asm-function-11.C b/gcc/testsuite/g++.dg/asm-function-11.C new file mode 100644 index 00000000000..c46d4c5a292 --- /dev/null +++ b/gcc/testsuite/g++.dg/asm-function-11.C @@ -0,0 +1,24 @@ +/* APPLE LOCAL file CW asm blocks */ +/* { dg-do assemble { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks" } */ + +struct tDummyStruct +{ + unsigned long fDummy; + unsigned long fSample; +}; + +asm void foo() +{ + lwz r1,-8+tDummyStruct.fSample(r2) + stw r1,-8+tDummyStruct.fSample(r2) + lwz r1,-8-(tDummyStruct.fSample-tDummyStruct.fDummy)(r2) + stw r1,-8-(tDummyStruct.fSample-tDummyStruct.fDummy)(r2) +} + +int main (int argc, char * const argv[]) +{ + foo(); +} + + diff --git a/gcc/testsuite/g++.dg/asm-function-12.C b/gcc/testsuite/g++.dg/asm-function-12.C new file mode 100644 index 00000000000..c518550fcdd --- /dev/null +++ b/gcc/testsuite/g++.dg/asm-function-12.C @@ -0,0 +1,18 @@ +/* APPLE LOCAL file CW asm blocks */ +/* { dg-do assemble { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks" } */ + +asm void foo() +{ + b .+8 + bl .+24 + b .-8 + bl .-32 + andi. r1, r0, 3 +} + +int main (int argc, char * const argv[]) +{ + foo(); +} + diff --git a/gcc/testsuite/g++.dg/asm-function-13.C b/gcc/testsuite/g++.dg/asm-function-13.C new file mode 100644 index 00000000000..ace3cba12ef --- /dev/null +++ b/gcc/testsuite/g++.dg/asm-function-13.C @@ -0,0 +1,26 @@ +/* APPLE LOCAL file CW asm blocks */ +/* { dg-do assemble { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks" } */ + +asm void foo() +{ + .align 15 + andi. r1,r2, 3 + .align 10 + b .+8 + .align 4 + b .-16 + .align 3 + lha r1, 4(r3) + .align 4 + add r1,r2,r3 + .align 3 + .align 4 +} + +int main (int argc, char * const argv[]) +{ + foo(); +} + + diff --git a/gcc/testsuite/g++.dg/asm-function-14.C b/gcc/testsuite/g++.dg/asm-function-14.C new file mode 100644 index 00000000000..f7f4162aaee --- /dev/null +++ b/gcc/testsuite/g++.dg/asm-function-14.C @@ -0,0 +1,19 @@ +/* APPLE LOCAL file CW asm blocks */ +/* { dg-do assemble { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks" } */ +/* Test for use of '*' in a relative jump. This is to conform with CW compiler. */ + +asm void foo() +{ + b *+8 + bl *+24 + b *-8 + bl *-32 + andi. r1,r0,2 +} + +int main (int argc, char * const argv[]) +{ + foo(); +} + diff --git a/gcc/testsuite/g++.dg/asm-function-15.C b/gcc/testsuite/g++.dg/asm-function-15.C new file mode 100644 index 00000000000..41a8a05cc12 --- /dev/null +++ b/gcc/testsuite/g++.dg/asm-function-15.C @@ -0,0 +1,21 @@ +/* APPLE LOCAL file CW asm blocks */ +/* { dg-do assemble { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks" } */ + +signed short foo(signed int a, signed short b) +{ + b = a * -1; + + asm { + bl *+24 + bl *-32 + b .+8 + } + return b; +} + +int main (int argc, char * const argv[]) +{ + return foo(1,2); +} + diff --git a/gcc/testsuite/g++.dg/asm-function-2.C b/gcc/testsuite/g++.dg/asm-function-2.C new file mode 100644 index 00000000000..87f46a6b787 --- /dev/null +++ b/gcc/testsuite/g++.dg/asm-function-2.C @@ -0,0 +1,75 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test whole asm functions. */ + +/* { dg-do run { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks -O2" } */ + +extern "C" void abort(void); + +asm void normal_fn () +{ + nop + nop +} + +asm void nofralloc_fn () +{ + nofralloc + nop + blr +} + +asm void fralloc_fn () +{ + fralloc + nop + nop +} + +asm int fralloc_fn_1 () +{ + fralloc + mr r4,r1 + frfree + sub r3,r4,r1 + blr +} + +asm int fralloc_fn_2 () +{ + fralloc 1000 + nop + frfree + blr +} + +asm int fralloc_fn_3 () +{ + int loc1, loc2; + fralloc 41 + nop + mr r3, loc2 + frfree + mr r3, loc1 + blr +} + +asm int f6 () +{ + opword 0x386004d2 /* li r3,1234 */ +} + +main() +{ + normal_fn (); + nofralloc_fn (); + fralloc_fn (); + /* + fralloc_fn_1 (); + fralloc_fn_2 (); + fralloc_fn_3 (); + */ + if (f6 () != 1234) + abort (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/asm-function-3.C b/gcc/testsuite/g++.dg/asm-function-3.C new file mode 100644 index 00000000000..8a05a300004 --- /dev/null +++ b/gcc/testsuite/g++.dg/asm-function-3.C @@ -0,0 +1,26 @@ +/* APPLE LOCAL file CW asm blocks */ +/* More tests of asm functions. */ + +/* { dg-do run { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks -O2" } */ + +extern "C" void abort(void); + +/* Return 0 if xer and spr1 both have the same data. */ + +asm int +test_spr () +{ + mfspr r5,xer + mfspr r4,spr1 + sub r3,r4,r5 +} + +int +main () +{ + if (test_spr ()) + abort (); + return 0; +} + diff --git a/gcc/testsuite/g++.dg/asm-function-4.C b/gcc/testsuite/g++.dg/asm-function-4.C new file mode 100644 index 00000000000..eb1baa76b83 --- /dev/null +++ b/gcc/testsuite/g++.dg/asm-function-4.C @@ -0,0 +1,62 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test asm with macros. */ + +/* { dg-do run { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks -O2" } */ + +extern "C" void abort(void); + +#define mac1 add r3, argx, argy + +asm int +foo (register int argx, register int argy) +{ + mac1 +} + +#define rsltreg r3 +#define mac2(x,y) add rsltreg,x,y + +asm int +foo1 (register int argx, register int argy) +{ + register int loc1, loc2; + nop + li loc1, 100 + li rsltreg,0 + b @a34 + mac2(argx,argy) +@a34 + mac2(rsltreg,loc1) + blr +} + +#define limac li +#define num 48 + +asm int foo2(int x, float y) +{ +#pragma unused(x) +#pragma unused(x,y) + limac rsltreg, num; +#define mac3(zzz) \ + limac r4, zzz +#pragma unused(y) + nop + mac3(num) +#pragma unused(x) + add r3,r3,r4 +} + +int +main () +{ + if (foo (22, 23) != 45) + abort (); + if (foo1 (1, 2) != 100) + abort (); + if (foo2 (100, 1.2) != 2 * num) + abort (); + return 0; +} + diff --git a/gcc/testsuite/g++.dg/asm-function-5.C b/gcc/testsuite/g++.dg/asm-function-5.C new file mode 100644 index 00000000000..f04eb4eed19 --- /dev/null +++ b/gcc/testsuite/g++.dg/asm-function-5.C @@ -0,0 +1,55 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test function calls in asm functions. */ + +/* { dg-do run { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks -O2" } */ + +void function_with_asm_stmts () { + asm ("nop"); + asm volatile ("nop"); + __asm__ ("nop"); + __asm__ __volatile__ ("nop"); +} + +extern "C" void abort (void); + +int glob = 0; + +int other (); +extern "C" int stubfn (); +int localfn () { return other (); } + +asm void foo(int arg) +{ + nofralloc + mflr r0 + stmw r30,(-8)(r1) + stw r0,8(r1) + stwu r1,(-80)(r1) + bl stubfn + addi r1,r1,80 + lwz r0,8(r1) + lmw r30,(-8)(r1) + mtlr r0 + b localfn +} + +void bar (int arg) +{ + stubfn (); + localfn (); +} + +int stubfn () { return other(); } + +int other () { return ++glob; } + +int main () +{ + bar(34); + foo(92); + if (glob != 4) + abort (); + return 0; +} + diff --git a/gcc/testsuite/g++.dg/asm-function-6.C b/gcc/testsuite/g++.dg/asm-function-6.C new file mode 100644 index 00000000000..0c46c33476c --- /dev/null +++ b/gcc/testsuite/g++.dg/asm-function-6.C @@ -0,0 +1,33 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test entry points in asm functions. */ + +/* { dg-do run { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks -O2" } */ + +#include <stdlib.h> + +int entry1(int); +int entry2(int); +int entry3(int); + +asm int foo(int x) +{ + addi x,x,45 + entry entry1 + addi x,x,1 + entry static entry2 + addi x,x,1 + entry extern entry3 + addi x,x,1 +} + +int main () +{ + if (entry1(0) != 3) + abort(); + if (entry2(89) != 91) + abort(); + if (entry3(100) != 101) + abort(); + return 0; +} diff --git a/gcc/testsuite/g++.dg/asm-function-7.C b/gcc/testsuite/g++.dg/asm-function-7.C new file mode 100644 index 00000000000..fc877cf5fd8 --- /dev/null +++ b/gcc/testsuite/g++.dg/asm-function-7.C @@ -0,0 +1,17 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test la16(TABLE), lo16(TABLE), and bdnz+. */ + +/* { dg-do assemble { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks" } */ + +double TABLE[4]={2.0, 1./2., 3., 1.}; + +asm void SQRT() +{ + lis r3,ha16(TABLE) + addi r3,r3,lo16(TABLE) +@cycle: + fmul fp6,fp1,fp1 + bdnz+ @cycle + blr +} diff --git a/gcc/testsuite/g++.dg/asm-function-8.C b/gcc/testsuite/g++.dg/asm-function-8.C new file mode 100644 index 00000000000..5101c078628 --- /dev/null +++ b/gcc/testsuite/g++.dg/asm-function-8.C @@ -0,0 +1,14 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test lo16(foo)(v) and ha16(foo). */ + +/* { dg-do assemble { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks" } */ + +int foo; + +asm int fun1 () +{ + int v; + addis v,0,ha16(foo) + lwz r3,lo16(foo)(v) +} diff --git a/gcc/testsuite/g++.dg/asm-function-9.C b/gcc/testsuite/g++.dg/asm-function-9.C new file mode 100644 index 00000000000..576390fc1a3 --- /dev/null +++ b/gcc/testsuite/g++.dg/asm-function-9.C @@ -0,0 +1,12 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test macros with . in the opcode. */ + +/* { dg-do assemble { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks" } */ + +#define foodef() rlwinm. r4,r4,31,16,31 + +asm void foo (void) +{ + foodef() +} diff --git a/gcc/testsuite/g++.dg/bincl-1.C b/gcc/testsuite/g++.dg/bincl-1.C new file mode 100644 index 00000000000..222fe1b4e76 --- /dev/null +++ b/gcc/testsuite/g++.dg/bincl-1.C @@ -0,0 +1,19 @@ +/* APPLE LOCAL file bincl/eincl stabs */ +/* Test BINCL/EINCL stabs. */ +/* Contributed by Devang Patel <dpatel@apple.com> */ + +/* { dg-do compile } */ +/* { dg-skip-if "No stabs" { mmix-*-* *-*-aix* *-*-netware* alpha*-*-* hppa*64*-*-* ia64-*-* } { "*" } { "" } } */ +/* { dg-options "-gstabs -fno-eliminate-unused-debug-symbols" } */ + +#include "bincl-1.h" +int +main () +{ + my_int j = 0; + return j; +} + +/* { dg-final { scan-assembler ".stabs.*130,0,0,0" } } */ +/* { dg-final { scan-assembler ".stabs.*162,0,0,0" } } */ + diff --git a/gcc/testsuite/g++.dg/bincl-1.h b/gcc/testsuite/g++.dg/bincl-1.h new file mode 100644 index 00000000000..3bf51278e90 --- /dev/null +++ b/gcc/testsuite/g++.dg/bincl-1.h @@ -0,0 +1,3 @@ +/* APPLE LOCAL file bincl/eincl stabs */ +/* Test BINCL/EINCL stabs. */ +typedef int my_int; diff --git a/gcc/testsuite/g++.dg/charset/asm1.c b/gcc/testsuite/g++.dg/charset/asm1.c index 9c0ff2866b0..7076d128566 100644 --- a/gcc/testsuite/g++.dg/charset/asm1.c +++ b/gcc/testsuite/g++.dg/charset/asm1.c @@ -1,5 +1,5 @@ /* { dg-do compile { target *-*-* } } - { dg-require-iconv "IBM-1047" } + { dg-require-iconv "IBM1047" } { dg-final { scan-assembler ".ascii bar" } } { dg-final { scan-assembler ".ascii foo" } } */ diff --git a/gcc/testsuite/g++.dg/charset/asm2.c b/gcc/testsuite/g++.dg/charset/asm2.c index 8d8dbbb524d..8ae2212fd26 100644 --- a/gcc/testsuite/g++.dg/charset/asm2.c +++ b/gcc/testsuite/g++.dg/charset/asm2.c @@ -1,7 +1,7 @@ /* Test for complex asm statements. Make sure it compiles then test for some of the asm statements not being translated. */ /* { dg-do compile { target i?86-*-* } } - { dg-require-iconv "IBM-1047" } + { dg-require-iconv "IBM1047" } { dg-final { scan-assembler "std" } } { dg-final { scan-assembler "cld" } } { dg-final { scan-assembler "rep" } } diff --git a/gcc/testsuite/g++.dg/charset/asm3.c b/gcc/testsuite/g++.dg/charset/asm3.c index cd850c3e81f..59c8d59ff39 100644 --- a/gcc/testsuite/g++.dg/charset/asm3.c +++ b/gcc/testsuite/g++.dg/charset/asm3.c @@ -1,6 +1,6 @@ /* Simple asm test. */ /* { dg-do compile } - { dg-require-iconv "IBM-1047" } + { dg-require-iconv "IBM1047" } { dg-final { scan-assembler "foo" } } */ extern int bar; diff --git a/gcc/testsuite/g++.dg/charset/asm4.c b/gcc/testsuite/g++.dg/charset/asm4.c index fa93f40fdaf..a4bb01401a9 100644 --- a/gcc/testsuite/g++.dg/charset/asm4.c +++ b/gcc/testsuite/g++.dg/charset/asm4.c @@ -1,6 +1,6 @@ /* Test for string translation. */ /* { dg-do compile } - { dg-require-iconv "IBM-1047" } + { dg-require-iconv "IBM1047" } { dg-final { scan-assembler-not "translate" } } */ void foo (void) { diff --git a/gcc/testsuite/g++.dg/charset/asm5.c b/gcc/testsuite/g++.dg/charset/asm5.c index 91316224f0c..ae2ec485d80 100644 --- a/gcc/testsuite/g++.dg/charset/asm5.c +++ b/gcc/testsuite/g++.dg/charset/asm5.c @@ -1,6 +1,6 @@ /* Test for string translation. */ /* { dg-do compile } - { dg-require-iconv "IBM-1047" } + { dg-require-iconv "IBM1047" } { dg-final { scan-assembler "foo" } } */ int main() { diff --git a/gcc/testsuite/g++.dg/charset/attribute1.c b/gcc/testsuite/g++.dg/charset/attribute1.c index 993c7934c80..799630030ba 100644 --- a/gcc/testsuite/g++.dg/charset/attribute1.c +++ b/gcc/testsuite/g++.dg/charset/attribute1.c @@ -1,6 +1,6 @@ /* Test for attribute non-translation. */ /* { dg-do compile } - { dg-require-iconv "IBM-1047" } + { dg-require-iconv "IBM1047" } { dg-final { scan-assembler "foo" } } */ int walrus __attribute__ ((section (".foo"))); diff --git a/gcc/testsuite/g++.dg/charset/attribute2.c b/gcc/testsuite/g++.dg/charset/attribute2.c index 3cb766aa63a..dcb28f2da27 100644 --- a/gcc/testsuite/g++.dg/charset/attribute2.c +++ b/gcc/testsuite/g++.dg/charset/attribute2.c @@ -2,7 +2,7 @@ If error recovery is ever testable then "foobar" should be translated. */ /* { dg-do compile } - { dg-require-iconv "IBM-1047" } + { dg-require-iconv "IBM1047" } */ int foo __attribute__ ((walrus)); /* { dg-error "walrus" "ignored" } */ char x[] = "foobar"; diff --git a/gcc/testsuite/g++.dg/charset/charset.exp b/gcc/testsuite/g++.dg/charset/charset.exp index 7a74217dec3..6bb19593944 100644 --- a/gcc/testsuite/g++.dg/charset/charset.exp +++ b/gcc/testsuite/g++.dg/charset/charset.exp @@ -30,7 +30,7 @@ load_lib target-supports.exp # If a testcase doesn't have special options, use these. global DEFAULT_CHARSETCFLAGS if ![info exists DEFAULT_CHARSETCFLAGS] then { - set DEFAULT_CHARSETCFLAGS "-fexec-charset=IBM-1047" + set DEFAULT_CHARSETCFLAGS "-fexec-charset=IBM1047" } # Initialize `dg'. diff --git a/gcc/testsuite/g++.dg/charset/extern1.cc b/gcc/testsuite/g++.dg/charset/extern1.cc index 2a68ab7cf78..09284ad1ed2 100644 --- a/gcc/testsuite/g++.dg/charset/extern1.cc +++ b/gcc/testsuite/g++.dg/charset/extern1.cc @@ -1,6 +1,6 @@ /* Test extern statments not being translated. */ /* { dg-do compile } - { dg-require-iconv "IBM-1047" } + { dg-require-iconv "IBM1047" } */ extern "C" { diff --git a/gcc/testsuite/g++.dg/charset/extern2.cc b/gcc/testsuite/g++.dg/charset/extern2.cc index 82157a6fea4..3a8f4e82d7e 100644 --- a/gcc/testsuite/g++.dg/charset/extern2.cc +++ b/gcc/testsuite/g++.dg/charset/extern2.cc @@ -1,5 +1,5 @@ /* Check that we push the declaration and then continue translation. */ /* { dg-do compile } - { dg-require-iconv "IBM-1047" } + { dg-require-iconv "IBM1047" } { dg-final { scan-assembler-not "foobar" } } */ extern "C" { char *foo = "foobar"; } diff --git a/gcc/testsuite/g++.dg/charset/extern3.cc b/gcc/testsuite/g++.dg/charset/extern3.cc index 5e46ca6facf..05a0c3e42bc 100644 --- a/gcc/testsuite/g++.dg/charset/extern3.cc +++ b/gcc/testsuite/g++.dg/charset/extern3.cc @@ -1,5 +1,5 @@ /* { dg-do compile } - { dg-require-iconv "IBM-1047" } + { dg-require-iconv "IBM1047" } { dg-final { scan-assembler-not "abcdefghijklmnopqrstuvwxyz" } } */ extern char *bar; diff --git a/gcc/testsuite/g++.dg/charset/function.cc b/gcc/testsuite/g++.dg/charset/function.cc index ab4c2bcba0e..5aba6511bd0 100644 --- a/gcc/testsuite/g++.dg/charset/function.cc +++ b/gcc/testsuite/g++.dg/charset/function.cc @@ -1,5 +1,5 @@ /* { dg-do compile } - { dg-require-iconv "IBM-1047" } + { dg-require-iconv "IBM1047" } { dg-final { scan-assembler-not "\"foobar\"" } } */ const char *str; diff --git a/gcc/testsuite/g++.dg/charset/string.c b/gcc/testsuite/g++.dg/charset/string.c index 375e28a2ed6..f720773dd57 100644 --- a/gcc/testsuite/g++.dg/charset/string.c +++ b/gcc/testsuite/g++.dg/charset/string.c @@ -1,5 +1,5 @@ /* Simple character translation test. */ /* { dg-do compile } - { dg-require-iconv "IBM-1047" } + { dg-require-iconv "IBM1047" } { dg-final { scan-assembler-not "string foobar" } } */ char *foo = "string foobar"; diff --git a/gcc/testsuite/g++.dg/const-cfstring-1.C b/gcc/testsuite/g++.dg/const-cfstring-1.C new file mode 100644 index 00000000000..23bfb0e4ee7 --- /dev/null +++ b/gcc/testsuite/g++.dg/const-cfstring-1.C @@ -0,0 +1,26 @@ +/* APPLE LOCAL file constant cfstrings */ +/* Test whether the __builtin__CFStringMakeConstantString + "function" fails gracefully when handed a non-constant + argument. This will only work on MacOS X 10.1.2 and later. */ +/* Developed by Ziemowit Laski <zlaski@apple.com>. */ + +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-fconstant-cfstrings" } */ + +#import <CoreFoundation/CFString.h> + +#ifdef __CONSTANT_CFSTRINGS__ +#undef CFSTR +#define CFSTR(STR) ((CFStringRef) __builtin___CFStringMakeConstantString (STR)) +#endif + +extern int cond; +extern const char *func(void); + +int main(void) { + CFStringRef s1 = CFSTR("Str1"); + CFStringRef s2 = CFSTR(cond? "Str2": "Str3"); /* { dg-error "CFString literal expression is not constant" } */ + CFStringRef s3 = CFSTR(func()); /* { dg-error "CFString literal expression is not constant" } */ + + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp/normalize-1.C b/gcc/testsuite/g++.dg/cpp/normalize-1.C new file mode 100644 index 00000000000..ef1d727fda8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp/normalize-1.C @@ -0,0 +1,36 @@ +/* APPLE LOCAL begin mainline UCNs 2005-04-17 3892809 */ +/* { dg-do preprocess } */ +/* { dg-options "-Wnormalized=id" } */ + +\u00AA +\u00B7 +\u0F43 /* { dg-warning "not in NFC" } */ +a\u05B8\u05B9\u05B9\u05BBb + a\u05BB\u05B9\u05B8\u05B9b /* { dg-warning "not in NFC" } */ +\u09CB +\u09C7\u09BE /* { dg-warning "not in NFC" } */ +\u0B4B +\u0B47\u0B3E /* { dg-warning "not in NFC" } */ +\u0BCA +\u0BC6\u0BBE /* { dg-warning "not in NFC" } */ +\u0BCB +\u0BC7\u0BBE /* { dg-warning "not in NFC" } */ +\u0CCA +\u0CC6\u0CC2 /* { dg-warning "not in NFC" } */ +\u0D4A +\u0D46\u0D3E /* { dg-warning "not in NFC" } */ +\u0D4B +\u0D47\u0D3E /* { dg-warning "not in NFC" } */ + +K +\u212A + +\u03AC +\u1F71 /* { dg-warning "not in NFC" } */ + +\uAC00 +\u1100\u1161 +\uAC01 +\u1100\u1161\u11A8 +\uAC00\u11A8 +/* APPLE LOCAL end mainline UCNs 2005-04-17 3892809 */ diff --git a/gcc/testsuite/g++.dg/cpp/ucnid-1.C b/gcc/testsuite/g++.dg/cpp/ucnid-1.C new file mode 100644 index 00000000000..42b84c1f503 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp/ucnid-1.C @@ -0,0 +1,19 @@ +/* APPLE LOCAL begin mainline UCNs 2005-04-17 3892809 */ +/* { dg-do preprocess } */ +/* { dg-options "-pedantic" } */ + +\u00AA /* { dg-error "not valid in an identifier" } */ +\u00AB /* { dg-error "not valid in an identifier" } */ +\u00B6 /* { dg-error "not valid in an identifier" } */ +\u00BA /* { dg-error "not valid in an identifier" } */ +\u00C0 +\u00D6 +\u0384 + +\u0669 /* { dg-error "not valid in an identifier" } */ +A\u0669 /* { dg-error "not valid in an identifier" } */ +0\u00BA /* { dg-error "not valid in an identifier" } */ +0\u0669 /* { dg-error "not valid in an identifier" } */ +\u0E59 +A\u0E59 +/* APPLE LOCAL end mainline UCNs 2005-04-17 3892809 */ diff --git a/gcc/testsuite/g++.dg/debug/const2.C b/gcc/testsuite/g++.dg/debug/const2.C new file mode 100644 index 00000000000..8e98f8b195e --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/const2.C @@ -0,0 +1,15 @@ +// Copyright (C) 2005 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 1 Apr 2005 <nathan@codesourcery.com> + +// { dg-options "-ggdb2" } +// Origin: ivan <ivanr@syncad.com> +// pinskia@gcc.gnu.org +// Bug 20505: ICE with -ggdb2 + +struct b +{ + static const int d; + virtual bool IsEmpty() const=0; + int e,c; +}; +const int b::d = ((__SIZE_TYPE__)(&((b*)1)->c) - 1); diff --git a/gcc/testsuite/g++.dg/debug/using1.C b/gcc/testsuite/g++.dg/debug/using1.C new file mode 100644 index 00000000000..d3168fc6c1c --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/using1.C @@ -0,0 +1,15 @@ +// PR c++/19406 +// { dg-do compile } + +struct A +{ + virtual int foo(); + double d; +}; + +struct B : public A +{ + A::d; +}; + +B b; diff --git a/gcc/testsuite/g++.dg/dg.exp b/gcc/testsuite/g++.dg/dg.exp index f809f10f2db..f4ec94c6ee1 100644 --- a/gcc/testsuite/g++.dg/dg.exp +++ b/gcc/testsuite/g++.dg/dg.exp @@ -39,6 +39,7 @@ set tests [prune $tests $srcdir/$subdir/gcov/*] set tests [prune $tests $srcdir/$subdir/pch/*] set tests [prune $tests $srcdir/$subdir/special/*] set tests [prune $tests $srcdir/$subdir/tls/*] +set tests [prune $tests $srcdir/$subdir/vect/*] # Main loop. dg-runtest $tests "" $DEFAULT_CXXFLAGS diff --git a/gcc/testsuite/g++.dg/eh/uncaught1.C b/gcc/testsuite/g++.dg/eh/uncaught1.C new file mode 100644 index 00000000000..2aa1068b090 --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/uncaught1.C @@ -0,0 +1,83 @@ +// PR libstdc++/10606 +// { dg-do run } + +#include <exception> +#include <cstdlib> + + +struct Check { + int obj1, obj2; + bool state; +}; + +static Check const data[] = { + { 0, 0, false }, // construct [0] + { 1, 0, true }, // [1] = [0] + { 0, 0, true }, // destruct [0] + { 2, 1, true }, // [2] = [1] + { 2, 2, true }, // destruct [2] + { 3, 1, true }, // [3] = [1] + { 3, 3, false }, // destruct [3] + { 1, 1, false }, // destruct [1] + { 9, 9, false } // end-of-data +}; + +static int pos = 0; + +static void test(int obj1, int obj2, bool state) +{ + if (obj1 != data[pos].obj1) abort (); + if (obj2 != data[pos].obj2) abort (); + if (state != data[pos].state) abort (); + pos++; +} + + +struct S { + int id; + S (); + S (const S &); + ~S (); +}; + +static int next_id = 0; + +S::S() + : id (next_id++) +{ + test (id, id, std::uncaught_exception ()); +} + +S::S(const S &x) + : id (next_id++) +{ + test (id, x.id, std::uncaught_exception ()); +} + +S::~S() +{ + test (id, id, std::uncaught_exception ()); +} + +extern void foo (S *); + +int main() +{ + try + { + try + { + S s0; + throw s0; // s1 is the exception object + } + catch (S s2) + { + throw; + } + } + catch (S s3) + { + } + + return 0; +} diff --git a/gcc/testsuite/g++.dg/expr/align68k-1.C b/gcc/testsuite/g++.dg/expr/align68k-1.C new file mode 100644 index 00000000000..8a89425f1d7 --- /dev/null +++ b/gcc/testsuite/g++.dg/expr/align68k-1.C @@ -0,0 +1,53 @@ +// APPLE LOCAL file test of -mdynamic-no-pic combined with 68k alignment +// Radar 3242139: Positive C++ test case +// Origin: Matt Austern <austern@apple.com> +// { dg-do run } +// { dg-options "-mdynamic-no-pic" } + +#ifdef __LP64__ +/* mac68k align not going to be supported for 64-bit, so skip entirely. */ +int main () { return 0; } +#else + +const long val1 = 0xa0b0; +const long val2 = 0x1234; + +#pragma options align=mac68k +struct X { + long x1; + long x2; +}; + +#pragma options align=reset + +void setX(X* x) { + x->x1 = val1; + x->x2 = val2; +} + +struct Y +{ + X field; + void set_vals(); +}; + +void Y::set_vals() +{ + ::setX(&field); +} + +int main() +{ + Y y; + bool ok = true; + + y.field.x1 = y.field.x2 = 0; + ok = ok && y.field.x1 == 0 && y.field.x2 == 0; + + y.set_vals(); + ok = ok && y.field.x1 == val1 && y.field.x2 == val2; + + return !ok; +} + +#endif /* __LP64__ */ diff --git a/gcc/testsuite/g++.dg/expr/align68k-2.C b/gcc/testsuite/g++.dg/expr/align68k-2.C new file mode 100644 index 00000000000..e0bebacf332 --- /dev/null +++ b/gcc/testsuite/g++.dg/expr/align68k-2.C @@ -0,0 +1,45 @@ +// APPLE LOCAL file test 68k alignment +// Radar 3313261: Positive C++ test case +// Origin: Matt Austern <austern@apple.com> +// { dg-do run } + +#ifdef __LP64__ +/* mac68k align not going to be supported for 64-bit, so skip entirely. */ +int main () { return 0; } +#else + +#pragma options align=mac68k + +typedef struct PMR { + double x; + double y; +}PMR; + +#pragma options align=reset + +static void GetDouble(double *doubleP) +{ + *doubleP = 1.; +} + +static void GetPMR(PMR *p) +{ + GetDouble(&p->x); + GetDouble(&p->y); +} + +int main(void) +{ + PMR tmp; + bool ok = true; + + tmp.x = tmp.y = 0; + ok = ok && tmp.x == 0.0 && tmp.y == 0.0; + + GetPMR(&tmp); + ok = ok && tmp.x == 1.0 && tmp.y == 1.0; + + return !ok; +} + +#endif /* __LP64__ */ diff --git a/gcc/testsuite/g++.dg/expr/cast-ptr-1.C b/gcc/testsuite/g++.dg/expr/cast-ptr-1.C new file mode 100644 index 00000000000..cb42d13ac48 --- /dev/null +++ b/gcc/testsuite/g++.dg/expr/cast-ptr-1.C @@ -0,0 +1,15 @@ +/* APPLE LOCAL file pointer casts */ +/* Test that casts of pointer to unsigned long long aren't sign extended */ +/* Author: Matt Austern <austern@apple.com> */ +/* { dg-do run } */ +/* { dg-options "-Wno-error -w" } */ + +int main () { + /* Note: test assumes sizeof(long long) >= sizeof(void*) */ + + unsigned long x1 = 0x80000000ul; + void* p = (void*) x1; + unsigned long long x2 = (unsigned long long) p; + + return !(x1 == x2); +} diff --git a/gcc/testsuite/g++.dg/expr/cast3.C b/gcc/testsuite/g++.dg/expr/cast3.C new file mode 100644 index 00000000000..c0607b90245 --- /dev/null +++ b/gcc/testsuite/g++.dg/expr/cast3.C @@ -0,0 +1,24 @@ +/* APPLE LOCAL begin mainline 4.0 2005-03-25 */ +// { dg-do compile } + +enum MyState +{ + QUIT = 0, + START, + STOP, + PAUSE +}; + +double GetDouble() +{ + return 1.0; +} + +int main() +{ + MyState the_state; + + the_state = (MyState)GetDouble(); // { dg-bogus "invalid cast" } + return 0; +} +/* APPLE LOCAL end mainline 4.0 2005-03-25 */ diff --git a/gcc/testsuite/g++.dg/expr/fieldref1.C b/gcc/testsuite/g++.dg/expr/fieldref1.C new file mode 100644 index 00000000000..b04ed137548 --- /dev/null +++ b/gcc/testsuite/g++.dg/expr/fieldref1.C @@ -0,0 +1,23 @@ +// APPLE LOCAL file - test of access to 8-byte struct field +// Radar 3309305: positive C++ test case +// Origin: Matt Austern <austern@apple.com> +// { dg-do run } + +struct X { + char array[8]; +}; + +char* get_array(X* p) { + char* p2 = p->array; + return p2; +} + +int main() +{ + X t; + X* p = &t; + char* p2 = get_array(p); + + bool ok = (void*)p == (void*)p2; + return !ok; +} diff --git a/gcc/testsuite/g++.dg/expr/lval2.C b/gcc/testsuite/g++.dg/expr/lval2.C new file mode 100644 index 00000000000..5d062f1c628 --- /dev/null +++ b/gcc/testsuite/g++.dg/expr/lval2.C @@ -0,0 +1,27 @@ +// PR c++/19199 + +// { dg-do run } + +// We used to turn the COND_EXPR lvalue into a MIN_EXPR rvalue, and +// then return a reference to a temporary in qMin. + +#include <assert.h> + +enum Foo { A, B }; + +template<typename T> T &qMin(T &a, T &b) +{ + return a < b ? a : b; +} + +int main (int, char **) +{ + Foo f = A; + Foo g = B; + Foo &h = qMin(f, g); + assert (&h == &f || &h == &g); + const Foo &i = qMin((const Foo&)f, (const Foo&)g); + assert (&i == &f || &i == &g); + return 0; +} + diff --git a/gcc/testsuite/g++.dg/ext/altivec-apple-11.C b/gcc/testsuite/g++.dg/ext/altivec-apple-11.C new file mode 100644 index 00000000000..c5104b2635b --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/altivec-apple-11.C @@ -0,0 +1,18 @@ +/* APPLE LOCAL file AltiVec */ +/* This is a compile-only test for interaction of "-maltivec" and "-save-temps". */ +/* Author: Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-save-temps -maltivec" } */ + +#define vector_float vector float +#define vector_float_foo vector float foo +#define vector_float_bar_eq vector float bar = + +/* NB: Keep the following split across three lines. */ +vector +int +a1 = { 100, 200, 300, 400 }; + +vector_float f1 = { 1.0, 2.0, 3.0, 4.0 }; +vector_float_foo = { 3.0, 4.0, 5.0, 6.0 }; +vector_float_bar_eq { 8.0, 7.0, 6.0, 5.0 }; diff --git a/gcc/testsuite/g++.dg/ext/apple-altivec-1.C b/gcc/testsuite/g++.dg/ext/apple-altivec-1.C new file mode 100644 index 00000000000..2726c81b3af --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/apple-altivec-1.C @@ -0,0 +1,43 @@ +/* APPLE LOCAL file AltiVec */ +/* Additional AltiVec PIM argument type combinations. */ + +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-faltivec -Wall" } */ + +vector signed int +LoadUnalignedSI( signed int *p) +{ + vector signed int vload1 = vec_ld( 0, (vector signed int *)p); + if ( ((long)p) * 0xF){ + vector signed int vload2 = vec_ld( 16, (vector signed int *)p); + vector unsigned char vperm = vec_ldl( 0, p); + + vload1 = vec_perm(vload1, vload2, vperm); + } + return vload1; +} + +inline vector float Reciprocal( vector float v ) +{ + + vector float estimate = vec_re( v ); + + return vec_madd( vec_nmsub( estimate, v, (vector float) (1.0) ), estimate, estimate ); +} + +void foo(void) { + vector bool char vbc1 = (vector bool char)(255); + vector pixel vp1, vp2; + vector float vf1, vf2; + vector unsigned char vuc1; + vector unsigned short vus1, vus2; + vector bool short vbs1, vbs2; + vector signed short vss1; + vector signed int vsi1, vsi2; + vbc1 = vec_splat (vbc1, 9); + vp2 = vec_splat (vp1, 7); + vf1 = vec_splat (vf2, 31); + vuc1 = vec_pack (vus1, vus2); + vbc1 = vec_pack (vbs1, vbs2); + vss1 = vec_pack (vsi1, vsi2); +} diff --git a/gcc/testsuite/g++.dg/ext/apple-altivec-2.C b/gcc/testsuite/g++.dg/ext/apple-altivec-2.C new file mode 100644 index 00000000000..e83b997a00c --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/apple-altivec-2.C @@ -0,0 +1,398 @@ +/* APPLE LOCAL file AltiVec */ +/* Check for presence of AltiVec PIM "specific operations". */ + +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-faltivec -Wall" } */ + +vector signed int +specific_operations( signed int *p) +{ + vector unsigned int vui1, vui2; + vector unsigned short vus1, vus2; + vector unsigned char vuc1, vuc2; + vector signed int vsi1, vsi2; + vector signed short vss1, vss2; + vector signed char vsc1, vsc2; + vector bool int vbi1, vbi2; + vector bool short vbs1, vbs2; + vector bool char vbc1, vbc2; + vector float vf1, vf2; + vector pixel vp1, vp2; + + vuc1 = vec_lvebx (8, (unsigned char *)p); + vss1 = vec_lvehx (4, (short *)p); + vf1 = vec_lvewx (2, (float *)p); + + vsi1 = vec_lvx (1, (vector signed int *)p); + vp1 = vec_lvxl (16, (vector pixel *)p); + + vec_stvebx (vuc1, 2, (char *)p); + vec_stvehx (vp1, 4, (unsigned short *)p); + vec_stvewx (vf1, 1, (float *)p); + + vec_stvx (vbi1, 12, (vector int bool *)p); + vec_stvxl (vp1, 11, (vector pixel *)p); + + vui1 = vec_vaddcuw (vui1, vui2); + vf1 = vec_vaddfp (vf1, vf2); + + vsc1 = vec_vaddsbs (vsc1, vsc2); + vss1 = vec_vaddshs (vss1, vss2); + vsi1 = vec_vaddsws (vsi1, vsi2); + vuc1 = vec_vaddubs (vuc1, vuc2); + vus1 = vec_vadduhs (vus1, vus2); + vui1 = vec_vadduws (vui1, vui2); + vuc1 = vec_vaddubm (vuc1, vuc2); + vus1 = vec_vadduhm (vus1, vus2); + vui1 = vec_vadduwm (vui1, vui2); + + vsc1 = vec_vand (vsc1, vsc2); + vss1 = vec_vandc (vss1, vss2); + + vsc1 = vec_vavgsb (vsc1, vsc2); + vss1 = vec_vavgsh (vss1, vss2); + vsi1 = vec_vavgsw (vsi1, vsi2); + vuc1 = vec_vavgub (vuc1, vuc2); + vus1 = vec_vavguh (vus1, vus2); + vui1 = vec_vavguw (vui1, vui2); + + vf1 = vec_vcfsx (vsi1, 4); + vf2 = vec_vcfux (vui1, 3); + + vsi1 = vec_vcmpbfp (vf1, vf2); + vbi1 = vec_vcmpeqfp (vf1, vf2); + + vbc1 = vec_vcmpequb (vuc1, vuc2); + vbs2 = vec_vcmpequh (vus1, vus2); + vbi1 = vec_vcmpequw (vui1, vui2); + + vbi1 = vec_vcmpgefp (vf1, vf2); + vbi2 = vec_vcmpgtfp (vf1, vf2); + + vbc1 = vec_vcmpgtsb (vsc1, vsc2); + vbs1 = vec_vcmpgtsh (vss1, vss2); + vbi1 = vec_vcmpgtsw (vsi1, vsi2); + + vbc1 = vec_vcmpgtub (vuc1, vuc2); + vbs1 = vec_vcmpgtuh (vus1, vus2); + vbi1 = vec_vcmpgtuw (vui1, vui2); + + vsi1 = vec_vctsxs (vf1, 22); + vui1 = vec_vctuxs (vf2, 30); + + vf2 = vec_vexptefp (vf1); + vf1 = vec_vlogefp (vf2); + vf2 = vec_vmaddfp (vf1, vf2, vf2); + + vf1 = vec_vmaxfp (vf1, vf2); + + vsc1 = vec_vmaxsb (vsc1, vsc2); + vss1 = vec_vmaxsh (vss1, vss2); + vsi1 = vec_vmaxsw (vsi1, vsi2); + vuc1 = vec_vmaxub (vuc1, vuc2); + vus1 = vec_vmaxuh (vus1, vus2); + vui1 = vec_vmaxuw (vui1, vui2); + + vbc1 = vec_vmrghb (vbc1, vbc2); + vp1 = vec_vmrghh (vp1, vp2); + vf2 = vec_vmrghw (vf2, vf1); + + vbc1 = vec_vmrglb (vbc1, vbc2); + vp1 = vec_vmrglh (vp1, vp2); + vf2 = vec_vmrglw (vf2, vf1); + + vf1 = vec_vminfp (vf1, vf2); + + vsc1 = vec_vminsb (vsc1, vsc2); + vss1 = vec_vminsh (vss1, vss2); + vsi1 = vec_vminsw (vsi1, vsi2); + vuc1 = vec_vminub (vuc1, vuc2); + vus1 = vec_vminuh (vus1, vus2); + vui1 = vec_vminuw (vui1, vui2); + + vss1 = vec_vmhaddshs (vss1, vss2, vss2); + vss2 = vec_vmhraddshs (vss1, vss2, vss2); + vus1 = vec_vmladduhm (vus1, vus1, vus2); + vui1 = vec_vmsumubm (vuc1, vuc2, vui1); + vsi1 = vec_vmsummbm (vsc1, vuc2, vsi1); + vsi2 = vec_vmsumshm (vss1, vss2, vsi1); + vui1 = vec_vmsumuhm (vus1, vus2, vui2); + vui2 = vec_vmsumuhs (vus1, vus2, vui1); + vsi2 = vec_vmsumshs (vss1, vss1, vsi2); + + vus1 = vec_vmuleub (vuc1, vuc2); + vss1 = vec_vmulesb (vsc1, vsc2); + vui1 = vec_vmuleuh (vus1, vus2); + vsi1 = vec_vmulesh (vss1, vss2); + + vus2 = vec_vmuloub (vuc1, vuc2); + vss2 = vec_vmulosb (vsc1, vsc2); + vui2 = vec_vmulouh (vus1, vus2); + vsi2 = vec_vmulosh (vss1, vss2); + + vf1 = vec_vnmsubfp (vf1, vf2, vf1); + + vp1 = vec_vnor (vp1, vp2); + vf2 = vec_vor (vf2, vbi1); + vf2 = vec_vxor (vf2, vbi1); + + vsc1 = vec_vpkuhum (vss1, vss2); + vbs1 = vec_vpkuwum (vbi1, vbi2); + vp1 = vec_vpkpx (vui1, vui2); + vuc1 = vec_vpkuhus (vus1, vus1); + vsc1 = vec_vpkshss (vss1, vss2); + vus1 = vec_vpkuwus (vui1, vui2); + vss2 = vec_vpkswss (vsi1, vsi1); + vuc1 = vec_vpkshus (vss1, vss2); + vus1 = vec_vpkswus (vsi1, vsi1); + + vp1 = vec_vperm (vp1, vp2, vuc1); + + vf1 = vec_vrefp (vf2); + vf2 = vec_vrfin (vf1); + vf1 = vec_vrsqrtefp (vf2); + + vuc1 = vec_vrlb (vuc1, vuc2); + vss1 = vec_vrlh (vss2, vss1); + vui2 = vec_vrlw (vui2, vui1); + + vf1 = vec_vsel (vf2, vf1, vbi1); + + vuc1 = vec_vslb (vuc1, vuc2); + vss1 = vec_vslh (vss2, vss1); + vui2 = vec_vslw (vui2, vui1); + + vp1 = vec_vsldoi (vp2, vp1, 14); + vp2 = vec_vsl (vp1, vuc1); + vp1 = vec_vslo (vp2, vuc1); + + vbc1 = vec_vspltb (vbc1, 9); + vp2 = vec_vsplth (vp1, 7); + vf1 = vec_vspltw (vf2, 31); + vsc2 = vec_vspltisb (15); + vss1 = vec_vspltish (14); + vsi1 = vec_vspltisw (13); + + vuc1 = vec_vsrb (vuc1, vuc2); + vss1 = vec_vsrh (vss2, vss1); + vui2 = vec_vsrw (vui2, vui1); + vuc2 = vec_vsrab (vuc1, vuc2); + vss2 = vec_vsrah (vss2, vss1); + vui1 = vec_vsraw (vui2, vui1); + vp2 = vec_vsr (vp1, vuc1); + vp1 = vec_vsro (vp2, vuc1); + + vui1 = vec_vsubcuw (vui1, vui2); + vf1 = vec_vsubfp (vf1, vf2); + + vsc1 = vec_vsubsbs (vsc1, vsc2); + vss1 = vec_vsubshs (vss1, vss2); + vsi1 = vec_vsubsws (vsi1, vsi2); + vuc1 = vec_vsububs (vuc1, vuc2); + vus1 = vec_vsubuhs (vus1, vus2); + vui1 = vec_vsubuws (vui1, vui2); + vuc1 = vec_vsububm (vuc1, vuc2); + vus1 = vec_vsubuhm (vus1, vus2); + vui1 = vec_vsubuwm (vui1, vui2); + + vui2 = vec_vsum4ubs (vuc1, vui1); + vsi1 = vec_vsum4sbs (vsc2, vsi1); + vsi1 = vec_vsum2sws (vsi1, vsi1); + vsi2 = vec_vsumsws (vsi2, vsi1); + + vf2 = vec_vrfiz (vf1); + + vbs1 = vec_vupkhsb (vbc1); + vui1 = vec_vupkhpx (vp1); + vbi1 = vec_vupkhsh (vbs1); + + vss1 = vec_vupklsb (vsc1); + vui1 = vec_vupklpx (vp2); + vbi1 = vec_vupklsh (vbs1); + + return vsi1; +} + +/* { dg-final { scan-assembler "\tlvebx " } } */ +/* { dg-final { scan-assembler "\tlvehx " } } */ +/* { dg-final { scan-assembler "\tlvewx " } } */ +/* { dg-final { scan-assembler "\tlvx " } } */ +/* { dg-final { scan-assembler "\tlvxl " } } */ +/* { dg-final { scan-assembler "\tstvebx " } } */ +/* { dg-final { scan-assembler "\tstvehx " } } */ +/* { dg-final { scan-assembler "\tstvewx " } } */ +/* { dg-final { scan-assembler "\tstvx " } } */ +/* { dg-final { scan-assembler "\tstvxl " } } */ + +/* { dg-final { scan-assembler "\tvaddcuw " } } */ +/* { dg-final { scan-assembler "\tvaddfp " } } */ +/* { dg-final { scan-assembler "\tvaddsbs " } } */ +/* { dg-final { scan-assembler "\tvaddshs " } } */ +/* { dg-final { scan-assembler "\tvaddsws " } } */ +/* { dg-final { scan-assembler "\tvaddubs " } } */ +/* { dg-final { scan-assembler "\tvadduhs " } } */ +/* { dg-final { scan-assembler "\tvadduws " } } */ +/* { dg-final { scan-assembler "\tvaddubm " } } */ +/* { dg-final { scan-assembler "\tvadduhm " } } */ +/* { dg-final { scan-assembler "\tvadduwm " } } */ + +/* { dg-final { scan-assembler "\tvand " } } */ +/* { dg-final { scan-assembler "\tvandc " } } */ + +/* { dg-final { scan-assembler "\tvavgsb " } } */ +/* { dg-final { scan-assembler "\tvavgsh " } } */ +/* { dg-final { scan-assembler "\tvavgsw " } } */ +/* { dg-final { scan-assembler "\tvavgub " } } */ +/* { dg-final { scan-assembler "\tvavguh " } } */ +/* { dg-final { scan-assembler "\tvavguw " } } */ + +/* { dg-final { scan-assembler "\tvcfsx " } } */ +/* { dg-final { scan-assembler "\tvcfux " } } */ + +/* { dg-final { scan-assembler "\tvcmpbfp " } } */ +/* { dg-final { scan-assembler "\tvcmpeqfp " } } */ + +/* { dg-final { scan-assembler "\tvcmpequb " } } */ +/* { dg-final { scan-assembler "\tvcmpequh " } } */ +/* { dg-final { scan-assembler "\tvcmpequw " } } */ + +/* { dg-final { scan-assembler "\tvcmpgefp " } } */ +/* { dg-final { scan-assembler "\tvcmpgtfp " } } */ + +/* { dg-final { scan-assembler "\tvcmpgtsb " } } */ +/* { dg-final { scan-assembler "\tvcmpgtsh " } } */ +/* { dg-final { scan-assembler "\tvcmpgtsw " } } */ + +/* { dg-final { scan-assembler "\tvcmpgtub " } } */ +/* { dg-final { scan-assembler "\tvcmpgtuh " } } */ +/* { dg-final { scan-assembler "\tvcmpgtuw " } } */ + +/* { dg-final { scan-assembler "\tvctsxs " } } */ +/* { dg-final { scan-assembler "\tvctuxs " } } */ + +/* { dg-final { scan-assembler "\tvexptefp " } } */ +/* { dg-final { scan-assembler "\tvlogefp " } } */ +/* { dg-final { scan-assembler "\tvmaddfp " } } */ + +/* { dg-final { scan-assembler "\tvmaxfp " } } */ +/* { dg-final { scan-assembler "\tvmaxsb " } } */ +/* { dg-final { scan-assembler "\tvmaxsh " } } */ +/* { dg-final { scan-assembler "\tvmaxsw " } } */ +/* { dg-final { scan-assembler "\tvmaxub " } } */ +/* { dg-final { scan-assembler "\tvmaxuh " } } */ +/* { dg-final { scan-assembler "\tvmaxuw " } } */ + +/* { dg-final { scan-assembler "\tvmrghb " } } */ +/* { dg-final { scan-assembler "\tvmrghh " } } */ +/* { dg-final { scan-assembler "\tvmrghw " } } */ + +/* { dg-final { scan-assembler "\tvmrglb " } } */ +/* { dg-final { scan-assembler "\tvmrglh " } } */ +/* { dg-final { scan-assembler "\tvmrglw " } } */ + +/* { dg-final { scan-assembler "\tvminfp " } } */ +/* { dg-final { scan-assembler "\tvminsb " } } */ +/* { dg-final { scan-assembler "\tvminsh " } } */ +/* { dg-final { scan-assembler "\tvminsw " } } */ +/* { dg-final { scan-assembler "\tvminub " } } */ +/* { dg-final { scan-assembler "\tvminuh " } } */ +/* { dg-final { scan-assembler "\tvminuw " } } */ + +/* { dg-final { scan-assembler "\tvmhaddshs " } } */ +/* { dg-final { scan-assembler "\tvmhraddshs " } } */ +/* { dg-final { scan-assembler "\tvmladduhm " } } */ +/* { dg-final { scan-assembler "\tvmsumubm " } } */ +/* { dg-final { scan-assembler "\tvmsummbm " } } */ +/* { dg-final { scan-assembler "\tvmsumshm " } } */ +/* { dg-final { scan-assembler "\tvmsumuhm " } } */ +/* { dg-final { scan-assembler "\tvmsumuhs " } } */ +/* { dg-final { scan-assembler "\tvmsumshs " } } */ + +/* { dg-final { scan-assembler "\tvmuleub " } } */ +/* { dg-final { scan-assembler "\tvmulesb " } } */ +/* { dg-final { scan-assembler "\tvmuleuh " } } */ +/* { dg-final { scan-assembler "\tvmulesh " } } */ + +/* { dg-final { scan-assembler "\tvmuloub " } } */ +/* { dg-final { scan-assembler "\tvmulosb " } } */ +/* { dg-final { scan-assembler "\tvmulouh " } } */ +/* { dg-final { scan-assembler "\tvmulosh " } } */ + +/* { dg-final { scan-assembler "\tvnmsubfp " } } */ + +/* { dg-final { scan-assembler "\tvnor " } } */ +/* { dg-final { scan-assembler "\tvor " } } */ +/* { dg-final { scan-assembler "\tvxor " } } */ + +/* { dg-final { scan-assembler "\tvpkuhum " } } */ +/* { dg-final { scan-assembler "\tvpkuwum " } } */ +/* { dg-final { scan-assembler "\tvpkpx " } } */ +/* { dg-final { scan-assembler "\tvpkuhus " } } */ +/* { dg-final { scan-assembler "\tvpkshss " } } */ +/* { dg-final { scan-assembler "\tvpkuwus " } } */ +/* { dg-final { scan-assembler "\tvpkswss " } } */ +/* { dg-final { scan-assembler "\tvpkshus " } } */ +/* { dg-final { scan-assembler "\tvpkswus " } } */ + +/* { dg-final { scan-assembler "\tvperm " } } */ + +/* { dg-final { scan-assembler "\tvrefp " } } */ +/* { dg-final { scan-assembler "\tvrfin " } } */ +/* { dg-final { scan-assembler "\tvrsqrtefp " } } */ + +/* { dg-final { scan-assembler "\tvrlb " } } */ +/* { dg-final { scan-assembler "\tvrlh " } } */ +/* { dg-final { scan-assembler "\tvrlw " } } */ + +/* { dg-final { scan-assembler "\tvsel " } } */ + +/* { dg-final { scan-assembler "\tvslb " } } */ +/* { dg-final { scan-assembler "\tvslh " } } */ +/* { dg-final { scan-assembler "\tvslw " } } */ + +/* { dg-final { scan-assembler "\tvsldoi " } } */ +/* { dg-final { scan-assembler "\tvsl " } } */ +/* { dg-final { scan-assembler "\tvslo " } } */ + +/* { dg-final { scan-assembler "\tvspltb " } } */ +/* { dg-final { scan-assembler "\tvsplth " } } */ +/* { dg-final { scan-assembler "\tvspltw " } } */ +/* { dg-final { scan-assembler "\tvspltisb " } } */ +/* { dg-final { scan-assembler "\tvspltish " } } */ +/* { dg-final { scan-assembler "\tvspltisw " } } */ + +/* { dg-final { scan-assembler "\tvsrb " } } */ +/* { dg-final { scan-assembler "\tvsrh " } } */ +/* { dg-final { scan-assembler "\tvsrw " } } */ +/* { dg-final { scan-assembler "\tvsrab " } } */ +/* { dg-final { scan-assembler "\tvsrah " } } */ +/* { dg-final { scan-assembler "\tvsraw " } } */ +/* { dg-final { scan-assembler "\tvsr " } } */ +/* { dg-final { scan-assembler "\tvsro " } } */ + +/* { dg-final { scan-assembler "\tvsubcuw " } } */ +/* { dg-final { scan-assembler "\tvsubfp " } } */ +/* { dg-final { scan-assembler "\tvsubsbs " } } */ +/* { dg-final { scan-assembler "\tvsubshs " } } */ +/* { dg-final { scan-assembler "\tvsubsws " } } */ +/* { dg-final { scan-assembler "\tvsububs " } } */ +/* { dg-final { scan-assembler "\tvsubuhs " } } */ +/* { dg-final { scan-assembler "\tvsubuws " } } */ +/* { dg-final { scan-assembler "\tvsububm " } } */ +/* { dg-final { scan-assembler "\tvsubuhm " } } */ +/* { dg-final { scan-assembler "\tvsubuwm " } } */ + +/* { dg-final { scan-assembler "\tvsum4ubs " } } */ +/* { dg-final { scan-assembler "\tvsum4sbs " } } */ +/* { dg-final { scan-assembler "\tvsum2sws " } } */ +/* { dg-final { scan-assembler "\tvsumsws " } } */ + +/* { dg-final { scan-assembler "\tvrfiz " } } */ + +/* { dg-final { scan-assembler "\tvupkhsb " } } */ +/* { dg-final { scan-assembler "\tvupkhpx " } } */ +/* { dg-final { scan-assembler "\tvupkhsh " } } */ + +/* { dg-final { scan-assembler "\tvupklsb " } } */ +/* { dg-final { scan-assembler "\tvupklpx " } } */ +/* { dg-final { scan-assembler "\tvupklsh " } } */ diff --git a/gcc/testsuite/g++.dg/ext/apple-altivec-3.C b/gcc/testsuite/g++.dg/ext/apple-altivec-3.C new file mode 100644 index 00000000000..b095b88eee4 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/apple-altivec-3.C @@ -0,0 +1,18 @@ +/* APPLE LOCAL file AltiVec */ +/* Vectors in template functions. */ + +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-faltivec -Wall" } */ + +template<int I> +void FooBar() +{ + vector unsigned char va, vb, vc; + vc = (vector unsigned char)vec_mergeh((vector unsigned short)va, (vector unsigned short)vb); +} + +int main (int argc, char * const argv[]) +{ + FooBar<0>(); + return 0; +} diff --git a/gcc/testsuite/g++.dg/ext/apple-altivec-4.C b/gcc/testsuite/g++.dg/ext/apple-altivec-4.C new file mode 100644 index 00000000000..0bb1dcd1d3a --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/apple-altivec-4.C @@ -0,0 +1,15 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-faltivec" } */ +/* Existing AltiVec PIM implementations allow numeric literals with + any number of bits, so long as the value is within allowed range. */ +int foo(void) +{ + vector unsigned char amask = vec_splat_u8 ( 0xFFFFFFF3L ); + vector signed short bmask = vec_splat_s16 ( 0xFFFFFFFFFFFFFFF1LL ); +} + + +/* { dg-final { scan-assembler "vspltisb.+\\-13" } } */ +/* { dg-final { scan-assembler "vspltish.+\\-15" } } */ + diff --git a/gcc/testsuite/g++.dg/ext/apple-altivec-5.C b/gcc/testsuite/g++.dg/ext/apple-altivec-5.C new file mode 100644 index 00000000000..4473881dda7 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/apple-altivec-5.C @@ -0,0 +1,31 @@ +/* APPLE LOCAL file AltiVec */ +/* Test for handling of reference vector parameters. */ +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-faltivec" } */ + +struct Vect +{ + typedef vector unsigned int vector_1; + + static vector_1 ConvertPixel1(const vector_1 &source, const vector unsigned char &vp); + static vector_1 ConvertPixel2(const vector_1 source, const vector unsigned char vp); + static vector_1 ConvertPixel3(vector_1 &source, vector unsigned char &vp); + static vector_1 ConvertPixel4(vector_1 source, vector unsigned char vp); +}; + +Vect::vector_1 Vect::ConvertPixel1(const vector_1 &source, const vector unsigned char &vp) +{ + return (vector_1) vec_perm(source, source, vp); +} +Vect::vector_1 Vect::ConvertPixel2(const vector_1 source, const vector unsigned char vp) +{ + return (vector_1) vec_perm(source, source, vp); +} +Vect::vector_1 Vect::ConvertPixel3(vector_1 &source, vector unsigned char &vp) +{ + return (vector_1) vec_perm(source, source, vp); +} +Vect::vector_1 Vect::ConvertPixel4(vector_1 source, vector unsigned char vp) +{ + return (vector_1) vec_perm(source, source, vp); +} diff --git a/gcc/testsuite/g++.dg/ext/apple-altivec-6.C b/gcc/testsuite/g++.dg/ext/apple-altivec-6.C new file mode 100644 index 00000000000..7a74578d477 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/apple-altivec-6.C @@ -0,0 +1,15 @@ +/* APPLE LOCAL file AltiVec */ +/* Test for handling of volatile reference vector parameters. */ +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-faltivec" } */ + +int foo(volatile vector float &i, int &j) +{ + vector unsigned char zero = vec_splat_u8(0); + vector unsigned char one = vec_splat_u8(1); + i = vec_add( (vector float)zero, (vector float)one ); + j = 5; + return 0; +} + +/* { dg-final { scan-assembler "Z3fooRVU8__vectorfRi" } } */ diff --git a/gcc/testsuite/g++.dg/ext/attrib20.C b/gcc/testsuite/g++.dg/ext/attrib20.C new file mode 100644 index 00000000000..e46e8ae2077 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attrib20.C @@ -0,0 +1,23 @@ +// { dg-do compile } +// { dg-options "-g" } +// Origin: <jan at etpmod dot phys dot tue dot nl> +// PR c++/19508: avoid attributes for template parameters + +template <typename T> +struct BVector +{ + typedef T T2; + typedef T value_type __attribute__ ((aligned(8))); // { dg-bogus "attribute" "attribute" { xfail *-*-* } } + typedef T2 value_type2 __attribute__ ((aligned(8))); // { dg-bogus "attribute" "attribute" { xfail *-*-* } } + value_type v; +}; +BVector<int> m; + +template <template <class> class T> +struct BV2 +{ + typedef T<float> value_type __attribute__((aligned(8))); // { dg-bogus "attribute" "attribute" { xfail *-*-* } } + value_type v; +}; +BV2<BVector> m2; + diff --git a/gcc/testsuite/g++.dg/ext/attrib21.C b/gcc/testsuite/g++.dg/ext/attrib21.C new file mode 100644 index 00000000000..2fc5800b05e --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attrib21.C @@ -0,0 +1,17 @@ +// PR c++/20763 + +typedef void *voidp; + +struct S +{ + char a; + voidp __attribute__ ((aligned (16))) b; +}; + +struct T +{ + char a; + void *__attribute__ ((aligned (16))) b; +}; + +int f[sizeof (struct S) != sizeof (struct T) ? -1 : 1]; diff --git a/gcc/testsuite/g++.dg/ext/lvalue-cast-1.C b/gcc/testsuite/g++.dg/ext/lvalue-cast-1.C new file mode 100644 index 00000000000..ebee754f069 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/lvalue-cast-1.C @@ -0,0 +1,34 @@ +/* APPLE LOCAL file non lvalue assign */ +/* { dg-do run } */ +/* { dg-options "-fnon-lvalue-assign" } */ + +#include <stdlib.h> +#define CHECK_IF(expr) if (!(expr)) abort () + +static int global; + +void f(int &) { global = 35; } +void f(const int &) { global = 78; } + +long long_arr[2]; + +int main(void) { + + char *p; + + (long *)p = long_arr; /* { dg-warning "target of assignment not really an lvalue" } */ + ((long *)p)++; /* { dg-warning "target of assignment not really an lvalue" } */ + *(long *)p = -1; + + *p = -2; + CHECK_IF(p[-1] == 0 && p[0] == -2 && p[1] == -1); + + (long *)p += 2; /* { dg-warning "target of assignment not really an lvalue" } */ + (long *)p -= 2; /* { dg-warning "target of assignment not really an lvalue" } */ + + long x = 0; + f((int)x); + CHECK_IF(global == 78); + + return 0; +} diff --git a/gcc/testsuite/g++.dg/ext/lvalue-cast-2.C b/gcc/testsuite/g++.dg/ext/lvalue-cast-2.C new file mode 100644 index 00000000000..bfd2e29e52c --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/lvalue-cast-2.C @@ -0,0 +1,14 @@ +/* APPLE LOCAL file non lvalue assign */ +/* Allow lvalue casts in conjunction with '&'. */ +/* { dg-do compile } */ +/* { dg-options "-fnon-lvalue-assign" } */ + +int foo (void **ptr) { + return 1; +} + +int bar (void) { + char *string; + + return foo ((void **)&((char *)string)); /* { dg-warning "argument to .&. not really an lvalue" } */ +} diff --git a/gcc/testsuite/g++.dg/ext/lvalue-cond-1.C b/gcc/testsuite/g++.dg/ext/lvalue-cond-1.C new file mode 100644 index 00000000000..ad059afe9b6 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/lvalue-cond-1.C @@ -0,0 +1,32 @@ +/* APPLE LOCAL file non lvalue assign */ +/* Allow assignments to conditional expressions, as long as the second and third + operands are already lvalues. */ +/* NB: It turns out that C++ (unlike C) already allows these as lvalues, and so + no warnings whatsoever will be produced. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ +/* { dg-options "-fnon-lvalue-assign" } */ +/* { dg-do run } */ + +#include <stdlib.h> + +int g1 = 3, g2 = 5; + +void assign_val1 (int which, int value) { + (which ? g1 : g2) = value; /* { dg-bogus "target of assignment not really an lvalue" } */ +} + +void assign_val2 (int which) { + (which ? g1 : g2)++; /* { dg-bogus "target of assignment not really an lvalue" } */ +} + +int main(void) { + assign_val1 (0, 15); + if (g1 != 3 || g2 != 15) + abort (); + + assign_val2 (1); + if (g1 != 4 || g2 != 15) + abort (); + + return 0; +} diff --git a/gcc/testsuite/g++.dg/ext/new-delete-1.C b/gcc/testsuite/g++.dg/ext/new-delete-1.C new file mode 100644 index 00000000000..8f09183ab7a --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/new-delete-1.C @@ -0,0 +1,28 @@ +/* APPLE LOCAL file coalescing */ +/* Make sure that non-weak '::new' and '::delete' operators do not wind + up in a coalesced section. Whether or not they get called via a stub + from within the same translation unit is an issue we defer for later + (i.e., Positron); when called from other translation units, they do + need a stub. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile { target powerpc*-*-darwin* } } */ + +extern "C" void free(void *); + +void operator delete(void*) throw(); +void operator delete(void* p) throw() { free(p); } + +void operator delete(void*, int) throw(); + +void *operator new(unsigned long) throw(); +void *operator new(unsigned long) throw() { return (void *)0; } + +int *foo(void) { + int *n = new int(); + ::operator delete(n, 0); + ::operator delete(n); + return 0; +} + +/* { dg-final { scan-assembler-not "coal" } } */ +/* { dg-final { scan-assembler "bl L__ZdlPvi.stub" } } */ diff --git a/gcc/testsuite/g++.dg/ext/new-delete-2.C b/gcc/testsuite/g++.dg/ext/new-delete-2.C new file mode 100644 index 00000000000..72d6b9e3ae1 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/new-delete-2.C @@ -0,0 +1,28 @@ +/* APPLE LOCAL file coalescing */ +/* Make sure that weak '::new' and '::delete' operators wind + up in a coalesced section and get called via a stub. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile { target powerpc*-*-darwin* } } */ + +extern "C" void free(void *); + +void operator delete(void*) throw() __attribute__((weak)); +void operator delete(void* p) throw() { free(p); } + +void operator delete(void*, int) throw() __attribute__((weak)); + +void *operator new(unsigned long) throw() __attribute__((weak)); +void *operator new(unsigned long) throw() { return (void *)0; } + +int *foo(void) { + int *n = new int(); + ::operator delete(n, 0); + ::operator delete(n); + return 0; +} + +/* { dg-final { scan-assembler "coal" } } */ + +/* { dg-final { scan-assembler "bl L__Znwm.stub" } } */ +/* { dg-final { scan-assembler "bl L__ZdlPvi.stub" } } */ +/* { dg-final { scan-assembler "bl L__ZdlPv.stub" } } */ diff --git a/gcc/testsuite/g++.dg/ext/opt-pragma-2.C b/gcc/testsuite/g++.dg/ext/opt-pragma-2.C new file mode 100644 index 00000000000..f44285a2f9c --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/opt-pragma-2.C @@ -0,0 +1,27 @@ +/* APPLE LOCAL file */ +#include <stdio.h> +/* Radar 3124235 */ +/* { dg-do compile { target "powerpc*-*-darwin*" } } */ +/* { dg-options "-O3" } */ +void f4(int); +#pragma optimization_level 0 +void f1(int x) { + printf("%d\n", x); +} +#pragma GCC optimize_for_size on +#pragma GCC optimization_level 0 +void f4(int x) { + printf("%d\n", x); +} +#pragma GCC optimization_level 0 +void f5(int x) { +#pragma GCC optimization_level 2 + printf("%d\n", x); +} +#pragma GCC optimization_level reset +void f6(int x) { + printf("%d\n", x); +} +/* Make sure sibling call optimization is not applied. */ +/* { dg-final { scan-assembler-times "b L_printf" 0 } } */ +/* { dg-final { scan-assembler-times "bl L_printf" 4 } } */ diff --git a/gcc/testsuite/g++.dg/ext/opt-pragma-3.C b/gcc/testsuite/g++.dg/ext/opt-pragma-3.C new file mode 100644 index 00000000000..dcb4845cc21 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/opt-pragma-3.C @@ -0,0 +1,27 @@ +/* APPLE LOCAL file */ +#include <stdio.h> +/* Radar 3124235 */ +/* { dg-do compile { target "powerpc*-*-darwin*" } } */ +/* { dg-options "-O0" } */ +void f4(int); +#pragma optimization_level 3 +void f1(int x) { + printf("%d\n", x); +} +#pragma GCC optimize_for_size on +#pragma GCC optimization_level 3 +void f4(int x) { + printf("%d\n", x); +} +#pragma GCC optimization_level 3 +void f5(int x) { +#pragma GCC optimization_level 0 + printf("%d\n", x); +} +#pragma GCC optimization_level reset +void f6(int x) { + printf("%d\n", x); +} +/* Make sure sibling call optimization is applied. */ +/* { dg-final { scan-assembler-times "b L_printf" 4 } } */ +/* { dg-final { scan-assembler-times "bl L_printf" 0 } } */ diff --git a/gcc/testsuite/g++.dg/ext/opt-pragma-4.C b/gcc/testsuite/g++.dg/ext/opt-pragma-4.C new file mode 100644 index 00000000000..60064ab768d --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/opt-pragma-4.C @@ -0,0 +1,26 @@ +/* APPLE LOCAL file */ +#include <stdio.h> +/* Radar 3124235 */ +/* { dg-do compile { target "powerpc*-*-darwin*" } } */ +/* { dg-options "-O0" } */ +void f4(int); +#pragma optimization_level 3 +void f1(int x) { + printf("%d\n", x); +} +#pragma GCC optimize_for_size on +#pragma GCC optimization_level 3 +void f4(int x) { + printf("%d\n", x); +} +#pragma GCC optimization_level 0 +void f5(int x) { +#pragma GCC optimization_level 2 + printf("%d\n", x); +} +#pragma GCC optimization_level reset +void f6(int x) { + printf("%d\n", x); +} +/* { dg-final { scan-assembler-times "b L_printf" 2 } } */ +/* { dg-final { scan-assembler-times "bl L_printf" 2 } } */ diff --git a/gcc/testsuite/g++.dg/ext/stmtexpr4.C b/gcc/testsuite/g++.dg/ext/stmtexpr4.C new file mode 100644 index 00000000000..a37c33ae086 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/stmtexpr4.C @@ -0,0 +1,8 @@ +// PR c++/20147 +// { dg-do compile } +// { dg-options "" } + +void foo() +{ + ({x;}); // { dg-error "was not declared" } +} diff --git a/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C b/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C index a2c93ebb752..e292df41b4c 100644 --- a/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C +++ b/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C @@ -1,6 +1,6 @@ /* Test that #pragma GCC visibility does not override class member specific settings. */ /* { dg-do compile } */ -/* { dg-require-visibility "" } */ +/* { dg-require-visibility "internal" } */ /* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" } } */ #pragma GCC visibility push(hidden) diff --git a/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C b/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C index a4bb42c728a..fe6c47fdbf5 100644 --- a/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C +++ b/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C @@ -1,6 +1,6 @@ /* Test that #pragma GCC visibility does not override class member specific settings. */ /* { dg-do compile } */ -/* { dg-require-visibility "" } */ +/* { dg-require-visibility "internal" } */ /* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" } } */ #pragma GCC visibility push(hidden) diff --git a/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C b/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C index dbd7010d028..ae4589397b6 100644 --- a/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C +++ b/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C @@ -1,5 +1,5 @@ /* Test warning from conflicting visibility specifications. */ -/* { dg-require-visibility "" } */ +/* { dg-require-visibility "protected" } */ /* { dg-final { scan-hidden "xyzzy" } } */ extern int diff --git a/gcc/testsuite/g++.dg/ext/weak2.C b/gcc/testsuite/g++.dg/ext/weak2.C new file mode 100644 index 00000000000..1bf2ddcb4d6 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/weak2.C @@ -0,0 +1,17 @@ +// Test for #pragma weak with declaration not at file scope. +// { dg-do compile } +// { dg-require-weak "" } +// { dg-options "" } + +// { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?_Z3foov" } } + +#pragma weak _Z3foov + +int +main (void) +{ + extern int foo (void); + if (&foo) + return foo (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/f-asm-blocks-test.C b/gcc/testsuite/g++.dg/f-asm-blocks-test.C new file mode 100644 index 00000000000..1c37a3afed0 --- /dev/null +++ b/gcc/testsuite/g++.dg/f-asm-blocks-test.C @@ -0,0 +1,33 @@ +/* APPLE LOCAL begin CW asm blocks */ +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks" } */ +class Foo +{ + public: + explicit Foo(int i) { mFoo = i; } + + private: + int mFoo; +}; + +class FooRange +{ + public: + explicit FooRange(const Foo &start, const Foo &end) : mStart(start), mEnd(end) + { + } + + private: + Foo mStart, mEnd; +}; + +void FooFunc(const FooRange &inRange) +{ +} + +int main (int argc, char * const argv[]) { + FooRange theRange( Foo( 0 ) , Foo( 0 ) ); // Change this to FooRange theRange = FooRange( Foo( 0 ) , Foo( 0 ) ); + // and everything is good... + FooFunc(theRange); +} +/* APPLE LOCAL end CW asm blocks */ diff --git a/gcc/testsuite/g++.dg/inherit/covariant12.C b/gcc/testsuite/g++.dg/inherit/covariant12.C new file mode 100644 index 00000000000..434082abb0d --- /dev/null +++ b/gcc/testsuite/g++.dg/inherit/covariant12.C @@ -0,0 +1,18 @@ +// Copyright (C) 2004 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 27 Feb 2005<nathan@codesourcery.com> + +// PR 20232: ICE on invalid + +struct T { }; + +struct S; + +struct B +{ + virtual T *Foo (); // { dg-error "overriding" "" } +}; + +struct D : B +{ + virtual S *Foo (); // { dg-error "invalid covariant" "" } +}; diff --git a/gcc/testsuite/g++.dg/inherit/volatile1.C b/gcc/testsuite/g++.dg/inherit/volatile1.C new file mode 100644 index 00000000000..48df50adac5 --- /dev/null +++ b/gcc/testsuite/g++.dg/inherit/volatile1.C @@ -0,0 +1,14 @@ +// PR c++/19299 +// Origin: Andrew Pinski <pinskia@gcc.gnu.org> + +// { dg-do compile } + +struct V +{ + virtual void foo() = 0; +}; + +void bar(V volatile* p) +{ + p->V::~V(); +} diff --git a/gcc/testsuite/g++.dg/init/array18.C b/gcc/testsuite/g++.dg/init/array18.C new file mode 100644 index 00000000000..154d03fcff8 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/array18.C @@ -0,0 +1,22 @@ +// PR c++/20142 +// { dg-do run } + +int n=4; + +struct A +{ + A() {} + A& operator= (const A&) { --n; return *this; } +}; + +struct B +{ + A x[2][2]; +}; + +int main() +{ + B b; + b = b; + return n; +} diff --git a/gcc/testsuite/g++.dg/init/array19.C b/gcc/testsuite/g++.dg/init/array19.C new file mode 100644 index 00000000000..a5f124e21ce --- /dev/null +++ b/gcc/testsuite/g++.dg/init/array19.C @@ -0,0 +1,4 @@ +// { dg-do compile } +// { dg-options "" } +double a[0] = { }; +const double b[0][1] = { }; diff --git a/gcc/testsuite/g++.dg/init/const1.C b/gcc/testsuite/g++.dg/init/const1.C new file mode 100644 index 00000000000..af4427d9ab3 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/const1.C @@ -0,0 +1,8 @@ +// PR c++/20073 + +template<int> struct A +{ + A(); +}; + +const A<0> x[] = { A<0>() }; diff --git a/gcc/testsuite/g++.dg/init/const2.C b/gcc/testsuite/g++.dg/init/const2.C new file mode 100644 index 00000000000..4fd631851a4 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/const2.C @@ -0,0 +1,7 @@ +// PR c++/19878 + +struct S { + char k; +}; +char const volatile S::* const p01 = &S::k; + diff --git a/gcc/testsuite/g++.dg/init/dso_handle1.C b/gcc/testsuite/g++.dg/init/dso_handle1.C index 6578f4fae7e..97f67cad8f4 100644 --- a/gcc/testsuite/g++.dg/init/dso_handle1.C +++ b/gcc/testsuite/g++.dg/init/dso_handle1.C @@ -1,5 +1,6 @@ // PR c++/17042 // { dg-do assemble } +/* { dg-require-weak "" } */ // { dg-options "-fuse-cxa-atexit" } struct A diff --git a/gcc/testsuite/g++.dg/init/ptrmem2.C b/gcc/testsuite/g++.dg/init/ptrmem2.C new file mode 100644 index 00000000000..54b69215bb4 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/ptrmem2.C @@ -0,0 +1,12 @@ +// PR c++/19916 +// { dg-do run } + +struct S { + char k; +}; + +char const volatile S::* const p01 = &S::k; +int main(void) +{ + return 0; +} diff --git a/gcc/testsuite/g++.dg/kext1.C b/gcc/testsuite/g++.dg/kext1.C new file mode 100644 index 00000000000..2b8cdfa07e9 --- /dev/null +++ b/gcc/testsuite/g++.dg/kext1.C @@ -0,0 +1,11 @@ +/* APPLE LOCAL file KEXT indirect-virtual-calls --sts */ +/* Radar 3008388: Positive C++ test case. */ +/* Origin: Matt Austern <austern@apple.com> */ +/* { dg-do compile } */ +/* { dg-options "-fapple-kext" } */ + +struct B1 { }; /* ok */ +struct B2 { }; /* ok */ +struct D1 : B1 { }; /* ok */ +struct D2 : B1, B2 { }; /* ok */ +struct D3 : virtual B1 { }; /* ok */ diff --git a/gcc/testsuite/g++.dg/kext10.C b/gcc/testsuite/g++.dg/kext10.C new file mode 100644 index 00000000000..74cfa24c96b --- /dev/null +++ b/gcc/testsuite/g++.dg/kext10.C @@ -0,0 +1,23 @@ +// APPLE LOCAL file +// Radar 3988061 +// { dg-do compile { target powerpc*-*-darwin* } } +// { dg-options "-Os -static -fapple-kext" } +// the virtual call to IOHIDElement::free() is normally resolved +// at compile time, but with -fapple-kext we don't want this. +class IOHIDElement +{ +protected: + virtual ~IOHIDElement(); + virtual void free(); +}; +class IOHIDElementPrivate: public IOHIDElement +{ +protected: + virtual void free(); +}; +IOHIDElement::~IOHIDElement() {} +void IOHIDElementPrivate::free() +{ + IOHIDElement::free(); +} +// { dg-final { scan-assembler-times "IOHIDElement4free" 1} } diff --git a/gcc/testsuite/g++.dg/kext11.C b/gcc/testsuite/g++.dg/kext11.C new file mode 100644 index 00000000000..d91a686e00f --- /dev/null +++ b/gcc/testsuite/g++.dg/kext11.C @@ -0,0 +1,39 @@ +/* APPLE LOCAL file ptmf casts --bowdidge */ +/* In gcc-4.0 and beyond, kexts are not permitted to cast + pointer-to-member- functions into pointer-to-functions. + These casts should be flagged as a hard error if + -fapple-kext is an option for the compile. -fpermissive shouldn't permit + this, either. This checks for OSMemberFunctionCast in the error message + because the error advises developers to use that function to replace + these casts. + + Radar 4025923, gcc-4.0 should ban kexts from doing ptmf to ptf + conversions without OSMemberFunctionCast +*/ +/* { dg-do compile { target powerpc*-apple-darwin* } } */ +/* { dg-options "-S -static -fapple-kext -fpermissive -fno-exceptions" } */ + +typedef int(*INT_FUNC_INT)(int); +class Superclass { +public: + /* In 3.3, this would get the foo function for the class of "this". In 4.0, it + gets the foo function for Superclass. */ + virtual int init(void) {_myFunc = (INT_FUNC_INT)&Superclass::foo;}; /* { dg-error "OSMemberFunctionCast" } */ + INT_FUNC_INT _myFunc; + virtual int foo(int i) { return 2;}; +}; + +class Subclass : public Superclass { +public: + virtual int foo(int) { return 1;}; +}; + +main(int argc, char **argv) { + Superclass sup; + Subclass sub; + sup.init(); + sup.foo(1); + sub.init(); + sub.foo(1); +} + diff --git a/gcc/testsuite/g++.dg/kext2.C b/gcc/testsuite/g++.dg/kext2.C new file mode 100644 index 00000000000..992c81c6a3a --- /dev/null +++ b/gcc/testsuite/g++.dg/kext2.C @@ -0,0 +1,13 @@ +/* APPLE LOCAL file KEXT indirect-virtual-calls --sts */ +/* Radar 3008388: Positive C++ test case. */ +/* Origin: Matt Austern <austern@apple.com> */ +/* { dg-do compile } */ +/* { dg-options "-fapple-kext" } */ + +struct B1 { virtual ~B1(); virtual void f(); }; /* ok */ +struct D1 : B1 { }; /* ok */ +struct X1 : D1 { virtual void f(); }; /* ok */ + +void X1::f() { D1::f(); } /* ok */ + + diff --git a/gcc/testsuite/g++.dg/kext3.C b/gcc/testsuite/g++.dg/kext3.C new file mode 100644 index 00000000000..25b904bf78b --- /dev/null +++ b/gcc/testsuite/g++.dg/kext3.C @@ -0,0 +1,18 @@ +/* APPLE LOCAL file KEXT indirect-virtual-calls --sts */ +/* Radar 3008388: Negative C++ test case. */ +/* Origin: Matt Austern <austern@apple.com> */ +/* { dg-do compile } */ +/* { dg-options "-fapple-kext" } */ + +struct B1 { virtual ~B1(); virtual void f(); }; /* ok */ +struct D1 : B1 { }; /* ok */ +struct D2 { }; /* ok */ + +struct X1 : D1, D2 { }; /* ok */ +struct X2 : virtual D1 { }; /* ok */ + +struct Y1 : X1 { virtual void f(); }; /* ok */ +struct Y2 : X2 { virtual void f(); }; /* ok */ + +void Y1::f() { X1::f(); } /* { dg-error "indirect virtual" } */ +void Y2::f() { X2::f(); } /* { dg-error "indirect virtual" } */ diff --git a/gcc/testsuite/g++.dg/kext4.C b/gcc/testsuite/g++.dg/kext4.C new file mode 100644 index 00000000000..bdaefb61121 --- /dev/null +++ b/gcc/testsuite/g++.dg/kext4.C @@ -0,0 +1,27 @@ +/* APPLE LOCAL file KEXT double destructor */ +/* { dg-do compile } */ +/* { dg-options "-fapple-kext" } */ +/* test for use of apple_kext_compatibility on stack */ +struct B1 { + virtual ~B1(); +} __attribute__((apple_kext_compatibility)); + +struct D1 : B1 { + void operator delete(void *) { } + D1(); +}; + +struct D2 : B1 { + void operator delete(void *); + D2(); +}; + +struct D3 : B1 { + D3(); +}; + +void foo() { + D1 d1; // ok + D2 d2; // { dg-warning "is an instance of a class" } + D3 d3; // { dg-warning "is an instance of a class" } +} diff --git a/gcc/testsuite/g++.dg/kext5.C b/gcc/testsuite/g++.dg/kext5.C new file mode 100644 index 00000000000..4306c171401 --- /dev/null +++ b/gcc/testsuite/g++.dg/kext5.C @@ -0,0 +1,16 @@ +/* APPLE LOCAL file KEXT double destructor */ +/* { dg-do compile } */ +/* { dg-options "-fapple-kext" } */ + +class tTest +{ + public: + + tTest(); + ~tTest(); +}; + +void bar () +{ + tTest tests[5]; +} diff --git a/gcc/testsuite/g++.dg/kext6.C b/gcc/testsuite/g++.dg/kext6.C new file mode 100644 index 00000000000..c3f7503e53d --- /dev/null +++ b/gcc/testsuite/g++.dg/kext6.C @@ -0,0 +1,29 @@ +/* APPLE LOCAL file KEXT indirect-virtual-calls --sts */ +/* Radar 3848842 Positive C++ test case. */ +/* Origin F. Jahanian <fjahanian@apple.com> */ +/* { dg-do compile } */ +/* { dg-options "-Os -fapple-kext" } */ + +struct Integer +{ + Integer ( void ) ; + virtual ~Integer ( void ) ; +}; + +static void AppendMa(unsigned char *outBuffer); +static void AppendNonce(); + +extern "C" void afpfs_DHXLogin () +{ + unsigned char *cptr = __null; + AppendMa(cptr); + AppendNonce(); +} + +static void AppendNonce() { } + + +static void AppendMa(unsigned char *outBuffer) +{ + Integer Ma; +} diff --git a/gcc/testsuite/g++.dg/kext7.C b/gcc/testsuite/g++.dg/kext7.C new file mode 100644 index 00000000000..564e1219599 --- /dev/null +++ b/gcc/testsuite/g++.dg/kext7.C @@ -0,0 +1,20 @@ +/* APPLE LOCAL file KEXT double destructor --bowdidge */ +/* Radar 3943783 kernel extensions built with gcc-4.0 can't be loaded */ +/* { dg-do compile { target powerpc*-apple-darwin* } } */ +/* { dg-options "-S -fapple-kext" } */ + +struct Base { + virtual ~Base(); +} __attribute__((apple_kext_compatibility)); + +struct Derived : Base { + void operator delete(void *) { } + Derived(); +}; + +void foo() { + Derived d1; // ok +} +/* An implicit in-charge destructor shouldn't be created when -fapple-kext + is declared. */ +/* { dg-final { scan-assembler-not "_ZN7DerivedD1Ev" } } */ diff --git a/gcc/testsuite/g++.dg/kext8.C b/gcc/testsuite/g++.dg/kext8.C new file mode 100644 index 00000000000..399f8c03f44 --- /dev/null +++ b/gcc/testsuite/g++.dg/kext8.C @@ -0,0 +1,36 @@ +/* APPLE LOCAL file KEXT double destructor --bowdidge */ +/* Radar 3943783 kernel extensions built with gcc-4.0 can't be loaded */ +/* { dg-do compile { target powerpc*-apple-darwin* } } */ +/* { dg-options "-S -fapple-kext -fno-exceptions" } */ + +/* Here's some kext class hierarchy code. */ + + +struct Base { + virtual ~Base(); +} __attribute__((apple_kext_compatibility)); + +struct Derived : Base { + void operator delete(void *) { } + Derived(); +}; + +void foo() { + Derived d1; // ok +} + +/* Here's some inlined functions to try to trick the compiler into creating coalesced + sections. */ +inline unsigned f(unsigned n) { return n == 0 ? 0 : n + f(n-1); } + +unsigned g(unsigned n) { return f(n); } + +/* Here's some template stuff to try to trick the compiler into creating coalesced sections + another way. */ + + template <typename X> X ident(X x) { return x; } + int foo(int n) { return ident(n); } + +/* See if there's any sections with the coalesced flag. coalesced sections + currently aren't loaded by the kernel loader into memory. */ +/* { dg-final { scan-assembler-not "coalesced" } } */ diff --git a/gcc/testsuite/g++.dg/kext9.C b/gcc/testsuite/g++.dg/kext9.C new file mode 100644 index 00000000000..88293aa5558 --- /dev/null +++ b/gcc/testsuite/g++.dg/kext9.C @@ -0,0 +1,13 @@ +/* APPLE LOCAL file KEXT indirect virtual calls */ +/* Radar 3972840: Positive C++ test case */ +/* Origin: Matt Austern <austern@apple.com> */ +/* { dg-do compile } */ +/* { dg-options "-fapple-kext" } */ + +struct Base { virtual char* abc(void) const; }; + +char* Base::abc() const { return 0; } + +void f(Base* p) { + char* c = p->Base::abc(); +} diff --git a/gcc/testsuite/g++.dg/lookup/anon2.C b/gcc/testsuite/g++.dg/lookup/anon2.C index 4cd64aecb49..d556ba0034a 100644 --- a/gcc/testsuite/g++.dg/lookup/anon2.C +++ b/gcc/testsuite/g++.dg/lookup/anon2.C @@ -1,6 +1,9 @@ // { dg-do compile } // { dg-options "" } -class { int i; } a; // { dg-error "private|anonymous type" } -void foo() { a.i; } // { dg-error "context" } +// Make sure we issue a diagnostic if a type with no linkage is used +// to declare a a variable that has linkage. +struct { int i; } a; // { dg-warning "anonymous type" } + +void foo() { a.i; } diff --git a/gcc/testsuite/g++.dg/lookup/using13.C b/gcc/testsuite/g++.dg/lookup/using13.C new file mode 100644 index 00000000000..c102fdcf872 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/using13.C @@ -0,0 +1,12 @@ +// { dg-do compile } + +// Origin: Stefan Straßer <sstrasser@systemhaus-gruppe.de> + +// PR c++/20240: + +namespace A { int a; } + +namespace C{ + int a; + using A::a; // { dg-error "already declared" } +} diff --git a/gcc/testsuite/g++.dg/opt/20050511-1.C b/gcc/testsuite/g++.dg/opt/20050511-1.C new file mode 100644 index 00000000000..6b25296c333 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/20050511-1.C @@ -0,0 +1,65 @@ +/* APPLE LOCAL file 4110735 */ +/* { dg-do run } */ +/* { dg-options "-O3" { target powerpc*-*-* } } */ +#include <stdio.h> +#include <stdlib.h> + +typedef signed short SINT16 ; +typedef unsigned long UINT32 ; +typedef unsigned int UINT ; + +class A +{ +public: + union + { + SINT16 xy[2]; + UINT32 abXY; + }; + bool operator==(const A& other) const {return abXY == other.abXY;} + bool operator!=(const A& other) const {return abXY != other.abXY;} +}; + +template <int size> struct pArray { unsigned char u08[16*(((size*1)+15)/16)] __attribute__ ((aligned(16))); }; + +struct B +{ + union { + A mvL[2]; + pArray<1> xyz; + }; +} ; + +typedef struct +{ + UINT w; + B b; + +}C; + + +UINT32 bar (const C * sPtr) +{ + UINT w = sPtr->w; + A a; + + a.xy[0] = sPtr->b.mvL[w].xy[0]<<2; + a.xy[1] = sPtr->b.mvL[w].xy[1]<<2; + + if (a.xy[0] != (SINT16) (0xffff << 2)) + abort (); +} + +int main() +{ + A a; + C c; + a.xy[0] = 0xffff; + a.xy[1] = 0xffff; + c.w=0; + c.b.mvL[0].xy[0] = a.xy[0]; + c.b.mvL[0].xy[1] = a.xy[1]; + + bar (&c); +} + diff --git a/gcc/testsuite/g++.dg/opt/covariant1.C b/gcc/testsuite/g++.dg/opt/covariant1.C new file mode 100644 index 00000000000..e57cf4c6be0 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/covariant1.C @@ -0,0 +1,47 @@ +// PR c++/20206 +// { dg-do run } +// { dg-options "-O0" } + +void +bar (int x) +{ + asm ("" : : "g" (x)); +} + +struct S { S () {}; virtual ~S () {}; }; +struct T { virtual T *foo (int) {}; }; +struct V : virtual S, virtual T {}; +struct V v; +struct U : public S, public T +{ + bool a; + U () {} + virtual ~U () {} + virtual V *foo (int x) + { + switch (x) + { + case 12: + break; + case 9: + bar (7); + break; + case 10: + bar (12); + break; + case 4: + bar (18); + break; + case 2: + bar (26); + break; + } + return &v; + } +}; +U u; + +int +main () +{ +} diff --git a/gcc/testsuite/g++.dg/opt/crossjump1.C b/gcc/testsuite/g++.dg/opt/crossjump1.C new file mode 100644 index 00000000000..acb3af03b1d --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/crossjump1.C @@ -0,0 +1,36 @@ +// APPLE LOCAL file mainline +// modified to avoid using test harness feature unsupported locally +// PR middle-end/21492 +// { dg-do compile } +// { dg-options "-Os" } +// { dg-options "-Os -fPIC" } + +extern char *bar (const char *, const char *); +extern char *baz (char *, const char *); +extern unsigned int fn (const char *); +static const struct C { int i; } k = { 0}; + +struct A +{ + ~A (); +}; + +char * +foo (char *x, const char *y) +{ + A a; + char *c = x; + + if (bar (y, "foo")) + { + baz (c, "foo"); + c += fn ("foo"); + } + else if (bar (y, "bar")) + { + baz (c, "bar"); + c += fn ("bar"); + } + + return x; +} diff --git a/gcc/testsuite/g++.dg/opt/max1.C b/gcc/testsuite/g++.dg/opt/max1.C index 61b7021da66..10a6e57d92d 100644 --- a/gcc/testsuite/g++.dg/opt/max1.C +++ b/gcc/testsuite/g++.dg/opt/max1.C @@ -1,7 +1,7 @@ /* PR middle-end/19068 */ /* Test case by Andrew Pinski <pinskia@physics.uc.edu> */ /* { dg-do run } */ -/* { dg-options "-O2" } */ +/* { dg-options "-O2 -Wno-deprecated" } */ extern "C" void abort (void); diff --git a/gcc/testsuite/g++.dg/opt/pr13066-1.C b/gcc/testsuite/g++.dg/opt/pr13066-1.C new file mode 100644 index 00000000000..67f85345676 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr13066-1.C @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +class nsIURI; + +struct nsCOMPtr +{ + operator nsIURI*() const + { + return mRawPtr; + } + + nsIURI *mRawPtr; +}; + +void func() +{ + nsCOMPtr u1; + if (!u1 == !u1) + return; +} + diff --git a/gcc/testsuite/g++.dg/opt/pr19108.C b/gcc/testsuite/g++.dg/opt/pr19108.C new file mode 100644 index 00000000000..206a2bc382b --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr19108.C @@ -0,0 +1,19 @@ +// PR tree-optimization/19108 +// This used to abort due to not handing RANGE_EXPR in SRA. + +// { dg-do compile } +// { dg-options "-O" } + +struct A +{ + int i[6]; + A () : i() {} +}; + +struct B +{ + A a; + B(const A& x) : a(x) {} +}; + +B b=A(); diff --git a/gcc/testsuite/g++.dg/opt/pr20991.C b/gcc/testsuite/g++.dg/opt/pr20991.C new file mode 100644 index 00000000000..32b3d05c351 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr20991.C @@ -0,0 +1,34 @@ +// PR middle-end/20991 +// { dg-options "-O2" } +// { dg-do compile } + +struct S +{ + virtual inline int foo () const; + virtual inline bool bar () const; + virtual int baz (int) const; +}; + +inline int S::foo () const +{ + return 1; +} + +inline bool S::bar () const +{ + return foo () == 0; +} + +void A () +{ + S s; + if (s.bar ()) + s.foo (); +} + +void B () +{ + S s; + if (s.bar ()) + s.foo (); +} diff --git a/gcc/testsuite/g++.dg/opt/pr7503-2.C b/gcc/testsuite/g++.dg/opt/pr7503-2.C index 68bb143e45e..02ce5988d70 100644 --- a/gcc/testsuite/g++.dg/opt/pr7503-2.C +++ b/gcc/testsuite/g++.dg/opt/pr7503-2.C @@ -1,6 +1,6 @@ // PR c++/7503 // { dg-do run } -// { dg-options "-O2" } +// { dg-options "-O2 -Wno-deprecated" } extern "C" void abort(); diff --git a/gcc/testsuite/g++.dg/opt/pr7503-3.C b/gcc/testsuite/g++.dg/opt/pr7503-3.C index 34d91ddb6c0..4e8de0f207c 100644 --- a/gcc/testsuite/g++.dg/opt/pr7503-3.C +++ b/gcc/testsuite/g++.dg/opt/pr7503-3.C @@ -1,6 +1,6 @@ // PR c++/7503 // { dg-do compile } -// { dg-options "-O2" } +// { dg-options "-O2 -Wno-deprecated" } extern int A, B; diff --git a/gcc/testsuite/g++.dg/opt/pr7503-4.C b/gcc/testsuite/g++.dg/opt/pr7503-4.C index 06ac901229f..7ed70946984 100644 --- a/gcc/testsuite/g++.dg/opt/pr7503-4.C +++ b/gcc/testsuite/g++.dg/opt/pr7503-4.C @@ -1,6 +1,6 @@ // PR c++/7503 // { dg-do run } -// { dg-options "-O2" } +// { dg-options "-O2 -Wno-deprecated" } extern "C" void abort(); diff --git a/gcc/testsuite/g++.dg/opt/pr7503-5.C b/gcc/testsuite/g++.dg/opt/pr7503-5.C index 9e1e719f5c2..236ac93aa3a 100644 --- a/gcc/testsuite/g++.dg/opt/pr7503-5.C +++ b/gcc/testsuite/g++.dg/opt/pr7503-5.C @@ -1,6 +1,6 @@ // PR c++/7503 // { dg-do run } -// { dg-options "-O2" } +// { dg-options "-O2 -Wno-deprecated" } extern "C" void abort(); diff --git a/gcc/testsuite/g++.dg/opt/switch3.C b/gcc/testsuite/g++.dg/opt/switch3.C new file mode 100644 index 00000000000..643cac3235b --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/switch3.C @@ -0,0 +1,16 @@ +// PR c++/20023 +// { dg-do compile } +// { dg-options "-O2" } + +void f (void); +typedef __SIZE_TYPE__ size_t; +void g (void *a) +{ + size_t b = (size_t) a; + switch (b) + { + case 1: + f (); + break; + } +} diff --git a/gcc/testsuite/g++.dg/opt/switch4.C b/gcc/testsuite/g++.dg/opt/switch4.C new file mode 100644 index 00000000000..231929fdf3d --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/switch4.C @@ -0,0 +1,30 @@ +// { dg-do compile } + +// PR c++/20008 + +// We failed to compile this because CFG cleanup left the switch +// statement intact, whereas expand_case expected at least one +// in-range case to remain. + +typedef enum _SECStatus { + SECWouldBlock = -2, + SECFailure = -1, + SECSuccess = 0 +} SECStatus; + +typedef enum { + SEC_ERROR_BAD_SIGNATURE = (-0x2000) + 10 +} SECErrorCodes; + +void g(void); +void f(SECStatus status) +{ + switch( status ) + { + case SEC_ERROR_BAD_SIGNATURE : + // This case can be optimized away in C++ (but apparently not in + // C), because the enum type is defined with a narrow range. + g(); + break ; + } +} diff --git a/gcc/testsuite/g++.dg/opt/thunk2.C b/gcc/testsuite/g++.dg/opt/thunk2.C new file mode 100644 index 00000000000..52fcd74bc11 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/thunk2.C @@ -0,0 +1,44 @@ +// PR c++/20206 +// { dg-do run } +// { dg-options "-O0" } + +void +bar (int x) +{ + asm ("" : : "g" (x)); +} + +struct S { S () {}; virtual ~S () {}; }; +struct T { virtual void foo (int) = 0; }; +struct U : public S, public T +{ + bool a; + U () {} + virtual ~U () {} + virtual void foo (int x) + { + switch (x) + { + case 12: + break; + case 9: + bar (7); + break; + case 10: + bar (12); + break; + case 4: + bar (18); + break; + case 2: + bar (26); + break; + } + } +}; +U u; + +int +main () +{ +} diff --git a/gcc/testsuite/g++.dg/other/access3.C b/gcc/testsuite/g++.dg/other/access3.C new file mode 100644 index 00000000000..2c21c1e5fa9 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/access3.C @@ -0,0 +1,13 @@ +// { dg-do compile } +// { dg-options "-fno-access-control" } + +// PR c++/20022 + +// Make sure -fno-access-control doesn't crash, and actually grants at +// least some access. + +class B { + enum A {}; +}; + +B::A r; diff --git a/gcc/testsuite/g++.dg/other/anon3.C b/gcc/testsuite/g++.dg/other/anon3.C index 87cbfb544cd..87116eb8901 100644 --- a/gcc/testsuite/g++.dg/other/anon3.C +++ b/gcc/testsuite/g++.dg/other/anon3.C @@ -4,4 +4,4 @@ // { dg-do compile } -enum { a = 3 } x; +enum { a = 3 } x; // { dg-warning "anonymous type" } diff --git a/gcc/testsuite/g++.dg/other/cv_func.C b/gcc/testsuite/g++.dg/other/cv_func.C new file mode 100644 index 00000000000..4f103824d93 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/cv_func.C @@ -0,0 +1,32 @@ +// { dg-do compile } +// { dg-options "-pedantic -pedantic-errors" } +typedef int FIC(int) const; +typedef int FI(int); + +FIC f; // { dg-error "qualified" } +// { dg-error "ignoring" "ignoring" { target *-*-* } 6 } +struct S { + FIC f; // OK + + const FI g; // { dg-error "qualifier" } + + int h(int) const; + +}; +FIC S::*pm = &S::f; +const FI S::*pm2 = &S::f; // { dg-error "qualifier" } +// { dg-error "cannot convert" "cannot convert" { target *-*-* } 17 } +const FIC S::*pm3 = &S::f; // { dg-error "qualifier" } + +int S::f(int) const +{ + return 17; +} + + +int foo(float) const // { dg-error "qualifier" } +{ + return 0; +} + +int bar(float) volatile; // { dg-error "qualifier" } diff --git a/gcc/testsuite/g++.dg/other/offsetof3.C b/gcc/testsuite/g++.dg/other/offsetof3.C index 7106a3f01ad..1e83af98071 100644 --- a/gcc/testsuite/g++.dg/other/offsetof3.C +++ b/gcc/testsuite/g++.dg/other/offsetof3.C @@ -13,4 +13,4 @@ typedef X* pX; typedef __SIZE_TYPE__ size_t; size_t yoff = size_t(&(pX(0)->y)); /* { dg-warning "invalid access" "" } */ -/* { dg-warning "macro was used incorrectly" "" { target *-*-* } 15 } */ +/* { dg-warning "macro was used incorrectly" "macro" { target *-*-* } 15 } */ diff --git a/gcc/testsuite/g++.dg/other/stdarg3.C b/gcc/testsuite/g++.dg/other/stdarg3.C new file mode 100644 index 00000000000..3d11dffae1f --- /dev/null +++ b/gcc/testsuite/g++.dg/other/stdarg3.C @@ -0,0 +1,16 @@ +// Copyright (C) 2005 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 8 Mar 2005 <nathan@codesourcery.com> + +// PR 20375: ICE +// Origin: Joseph S. Myers <jsm28@gcc.gnu.org> +// { dg-options "-mlp64" { target "ia64-*-*" } } + +union U +{ + void *m[7]; +}; + +struct C; + +void f(struct C *c, float f, union U, ...) +{ } diff --git a/gcc/testsuite/g++.dg/other/ucnid-1.C b/gcc/testsuite/g++.dg/other/ucnid-1.C new file mode 100644 index 00000000000..c55afd6b1d7 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/ucnid-1.C @@ -0,0 +1,27 @@ +/* APPLE LOCAL begin mainline UCNs 2005-04-17 3892809 */ +/* { dg-do run } */ +#include <cstdlib> + +int \u00C0(void) { return 1; } +int \u00C1(void) { return 2; } +int \U000000C2(void) { return 3; } +int wh\u00ff(void) { return 4; } +int a\u00c4b\u0441\U000003b4e(void) { return 5; } + +int main (void) +{ + + if (\u00C0() != 1) + abort (); + if (\u00c1() != 2) + abort (); + if (\u00C2() != 3) + abort (); + if (wh\u00ff() != 4) + abort (); + if (a\u00c4b\u0441\U000003b4e() != 5) + abort (); + + return 0; +} +/* APPLE LOCAL end mainline UCNs 2005-04-17 3892809 */ diff --git a/gcc/testsuite/g++.dg/overload/using2.C b/gcc/testsuite/g++.dg/overload/using2.C new file mode 100644 index 00000000000..2ecb5fad6b0 --- /dev/null +++ b/gcc/testsuite/g++.dg/overload/using2.C @@ -0,0 +1,87 @@ +// { dg-do compile } + +// Copyright 2005 Free Software Foundation +// by Alexandre Oliva <aoliva@redhat.com> +// based on https://bugzilla.redhat.com/beta/show_bug.cgi?id=149098 + +// Per the ISO C++ 90 Standard, using declarations before of after a +// declaration of the same function name and prototype should be +// errors (7.3.3/11). However, DR 101's resolution recommends +// accepting such duplicates if they denote the same function, which +// means extern "C" declarations are supposed to match and be +// accepted. + +// This test makes sure we reject or accept regular and using +// declarations regardless of order as appropriate, and that having +// built-in declarations or overloads doesn't affet the outcome. + +namespace std { + extern "C" void exit (int) throw (); // these are built-in (extern "C") + extern "C" void *malloc (__SIZE_TYPE__) throw () __attribute__((malloc)); + + void abort (void) throw (); // these aren't + void _exit (int) throw (); // { dg-error "std::_exit" } + + extern "C" void c1 (void) throw (); + void C1 (void) throw (); // { dg-error "std::C1" } + + extern "C" void c2 (void) throw (); + void C2 (void) throw (); + + extern "C" void c3 (void) throw (); + void C3 (void) throw (); // { dg-error "std::C3" } +} + +namespace other { + extern "C" void c3 (void) throw (); + void C3 (void) throw (); // { dg-error "other::C3" } +} + +using std::exit; +using std::_exit; +using std::c1; +using std::C1; + + extern "C" void exit (int) throw (); + extern "C" void *malloc (__SIZE_TYPE__) throw () __attribute__((malloc)); + + void abort (void) throw (); + void _exit (int) throw (); // { dg-error "conflicts|void _exit" } + + extern "C" void c1 (void) throw (); + void C1 (void) throw (); // { dg-error "conflicts|void C1" } + + extern "C" void c2 (void) throw (); + void C2 (void) throw (); + + int C3 (int) throw (); + +using std::malloc; +using std::abort; // { dg-error "already declared" } +using std::c2; +using std::C2; // { dg-error "already declared" } + +using std::c3; using other::c3; +using std::C3; using other::C3; + + long C3 (long) throw (); + +int main () { + malloc (0); + exit (0); + + _exit (0); // { dg-error "ambiguous" } + abort (); + + c1 (); + C1 (); // { dg-error "ambiguous" } + + c2 (); + C2 (); // one might expect an ambiguous call error here as well, but + // we don't add the using decl if we find it to be in error. + + c3 (); + C3 (); // { dg-error "ambiguous" } + C3 (0); + C3 (0l); +} diff --git a/gcc/testsuite/g++.dg/parse/cond2.C b/gcc/testsuite/g++.dg/parse/cond2.C new file mode 100644 index 00000000000..2dbe42b34f3 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/cond2.C @@ -0,0 +1,14 @@ +// PR c++/20905 + +struct name {}; + +int +f (); + +void +g () +{ + if (int name = f ()) + { + } +} diff --git a/gcc/testsuite/g++.dg/parse/constant6.C b/gcc/testsuite/g++.dg/parse/constant6.C new file mode 100644 index 00000000000..dae01d47be3 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/constant6.C @@ -0,0 +1,23 @@ +// PR c++/19883 + +template<typename T> struct A +{ + static const T i = 1; + char a[int(i)]; +}; + +template<int> struct B {}; + +template<typename T> struct C +{ + static const T i = 2; + B<int(i)> a; +}; + +template< typename T, T N > +struct integral_c +{ + static const T value = N; + + typedef integral_c< T, static_cast<T>((value + 1)) > next; +}; diff --git a/gcc/testsuite/g++.dg/parse/constant7.C b/gcc/testsuite/g++.dg/parse/constant7.C new file mode 100644 index 00000000000..c54ad55c1f0 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/constant7.C @@ -0,0 +1,9 @@ +// PR c++/19991 + +enum { e = 1 }; + +template<typename> struct A +{ + static const int i = e; + char a[i]; +}; diff --git a/gcc/testsuite/g++.dg/parse/crash24.C b/gcc/testsuite/g++.dg/parse/crash24.C new file mode 100644 index 00000000000..fdc4f1e7c9d --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/crash24.C @@ -0,0 +1,6 @@ +// PR c++/20461 +// { dg-do compile } + +class C; // { dg-error "forward declaration" } + +C::C() : f() {} // { dg-error "invalid use|does not have" } diff --git a/gcc/testsuite/g++.dg/parse/crash25.C b/gcc/testsuite/g++.dg/parse/crash25.C new file mode 100644 index 00000000000..d7f20c62f26 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/crash25.C @@ -0,0 +1,10 @@ +// PR c++/20536 +// Found by Wolfgang Wieser 03/2005. +// { dg-do compile } + +struct yyguts_t +{ + class TestScanner* yyextra_r; // { dg-error "forward declaration" } +}; + +TestScanner::TestScanner() {} // { dg-error "invalid use" } diff --git a/gcc/testsuite/g++.dg/parse/error11.C b/gcc/testsuite/g++.dg/parse/error11.C index 6b3deec178a..0a8e2e4fc3d 100644 --- a/gcc/testsuite/g++.dg/parse/error11.C +++ b/gcc/testsuite/g++.dg/parse/error11.C @@ -50,4 +50,4 @@ template struct Foo<::B>; // { dg-error "cannot begin|alternate spelling" } // On the first error message, an additional note about the use of // -fpermissive should be present -// { dg-error "-fpermissive" "" { target *-*-* } 18 } +// { dg-error "-fpermissive" "-fpermissive" { target *-*-* } 18 } diff --git a/gcc/testsuite/g++.dg/parse/error16.C b/gcc/testsuite/g++.dg/parse/error16.C index afc790e072e..3dc58ad53c0 100644 --- a/gcc/testsuite/g++.dg/parse/error16.C +++ b/gcc/testsuite/g++.dg/parse/error16.C @@ -2,7 +2,7 @@ struct A { - struct B {}; // { dg-error "" } + struct B {}; // { dg-error "previous" } }; -struct A::B{}; // { dg-error "" } +struct A::B{}; // { dg-error "redefinition" } diff --git a/gcc/testsuite/g++.dg/parse/error26.C b/gcc/testsuite/g++.dg/parse/error26.C new file mode 100644 index 00000000000..6e2b897d92b --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/error26.C @@ -0,0 +1,12 @@ +// PR c++/20148 +// { dg-options "" } + +void foo() +{ + if (({int c[2];})) ; // { dg-error "\{\.\.\.\}" } +} + +void bar() +{ + if (({})); // { dg-error "\{\.\.\.\}" } +} diff --git a/gcc/testsuite/g++.dg/parse/error27.C b/gcc/testsuite/g++.dg/parse/error27.C new file mode 100644 index 00000000000..f52d3cecce6 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/error27.C @@ -0,0 +1,7 @@ +// PR c++/20152 + +struct KrSelectionMode { virtual void init() = 0; }; // { dg-error "previous definition" } +struct KrKDESelectionMode : public KrSelectionMode { void init() { } }; // { dg-error "previous definition" } +struct KrSelectionMode { virtual void init() = 0; }; // { dg-error "" } +struct KrKDESelectionMode : public KrSelectionMode { void init() { } }; // { dg-error "" } +KrKDESelectionMode krKDESelectionMode; diff --git a/gcc/testsuite/g++.dg/pascal-strings-1.C b/gcc/testsuite/g++.dg/pascal-strings-1.C new file mode 100644 index 00000000000..50c52015ec4 --- /dev/null +++ b/gcc/testsuite/g++.dg/pascal-strings-1.C @@ -0,0 +1,44 @@ +/* APPLE LOCAL file pascal strings */ +/* Positive C++ test cases. */ +/* Origin: Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do run } */ +/* { dg-options "-fpascal-strings" } */ + +typedef __SIZE_TYPE__ size_t; +extern "C" void abort (void); +extern "C" size_t strlen (const char *s); + +const unsigned char *pascalStr1 = "\pHello, World!"; +const unsigned char *concat1 = "\pConcatenated" "string" "\pliteral"; + +const unsigned char msg1[] = "\pHello"; /* ok */ +const unsigned char *msg2 = "\pHello"; /* ok */ +const signed char msg3[] = "\pHello"; /* ok */ +const char msg4[] = "\pHello"; /* ok */ +unsigned char msg5[] = "\pHello"; /* ok */ +signed char msg7[] = "\pHello"; /* ok */ +char msg8[] = "\pHello"; /* ok */ + +int +main (void) +{ + const unsigned char *pascalStr2 = "\pGood-bye!"; + + if (strlen ((const char *)pascalStr1) != 14) + abort (); + if (*pascalStr1 != 13) + abort (); /* the length byte does not include trailing null */ + + if (strlen ((const char *)pascalStr2) != 10) + abort (); + if (*pascalStr2 != 9) + abort (); + + if (strlen ((const char *)concat1) != 26) + abort (); + if (*concat1 != 25) + abort (); + + return 0; +} + diff --git a/gcc/testsuite/g++.dg/pascal-strings-2.C b/gcc/testsuite/g++.dg/pascal-strings-2.C new file mode 100644 index 00000000000..e74c67f89c7 --- /dev/null +++ b/gcc/testsuite/g++.dg/pascal-strings-2.C @@ -0,0 +1,43 @@ +/* APPLE LOCAL file pascal strings */ +/* Negative C++ test cases. */ +/* Origin: Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile } */ +/* { dg-options "-fpascal-strings" } */ + +const wchar_t *pascalStr1 = L"\pHi!"; /* { dg-warning "unknown escape sequence" } */ +const wchar_t *pascalStr2 = L"Bye\p!"; /* { dg-warning "unknown escape sequence" } */ + +const wchar_t *initErr0 = "\pHi"; /* { dg-error "cannot convert" } */ +const wchar_t initErr0a[] = "\pHi"; /* { dg-error "initialized from non-wide string" } */ +const wchar_t *initErr1 = "Bye"; /* { dg-error "cannot convert" } */ +const wchar_t initErr1a[] = "Bye"; /* { dg-error "initialized from non-wide string" } */ + +const char *initErr2 = L"Hi"; /* { dg-error "cannot convert" } */ +const char initErr2a[] = L"Hi"; /* { dg-error "initialized from wide string" } */ +const signed char *initErr3 = L"Hi"; /* { dg-error "cannot convert" } */ +const signed char initErr3a[] = L"Hi"; /* { dg-error "initialized from wide string" } */ +const unsigned char *initErr4 = L"Hi"; /* { dg-error "cannot convert" } */ +const unsigned char initErr4a[] = L"Hi"; /* { dg-error "initialized from wide string" } */ + +const char *pascalStr3 = "Hello\p, World!"; /* { dg-warning "unknown escape sequence" } */ + +const char *concat2 = "Hi" "\pthere"; /* { dg-warning "unknown escape sequence" } */ +const char *concat3 = "Hi" "there\p"; /* { dg-warning "unknown escape sequence" } */ + +const char *s2 = "\pGoodbye!"; /* { dg-error "invalid conversion" } */ +unsigned char *s3 = "\pHi!"; /* { dg-error "invalid conversion" } */ +char *s4 = "\pHi"; /* { dg-error "invalid conversion" } */ +signed char *s5 = "\pHi"; /* { dg-error "invalid conversion" } */ +const signed char *s6 = "\pHi"; /* { dg-error "invalid conversion" } */ + +/* the maximum length of a Pascal literal is 255. */ +const unsigned char *almostTooLong = + "\p12345678901234567890123456789012345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890123456789012345678901234567890" + "123456789012345"; /* ok */ +const unsigned char *definitelyTooLong = + "\p12345678901234567890123456789012345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890123456789012345678901234567890" + "1234567890123456"; /* { dg-error "too long" } */ diff --git a/gcc/testsuite/g++.dg/pascal-strings-3.C b/gcc/testsuite/g++.dg/pascal-strings-3.C new file mode 100644 index 00000000000..7c7cf8139ed --- /dev/null +++ b/gcc/testsuite/g++.dg/pascal-strings-3.C @@ -0,0 +1,20 @@ +/* APPLE LOCAL file pascal strings */ +/* Ensure that there are no warnings or errors issued when a Pascal string is used to + initialize an array and the NUL terminator does not fit. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-do compile } */ +/* { dg-options "-fpascal-strings" } */ + +typedef unsigned char Str15[16]; + +Str15 ggg = "\p012345678901234"; +Str15 hhh = "\p0123456789012345"; /* { dg-error "initializer.string for array of chars is too long" } */ + +int foo(void) +{ + Str15 sss = "\p012345678901234"; + Str15 ttt = "\p0123456789012345"; /* { dg-error "initializer.string for array of chars is too long" } */ + + return 0; +} diff --git a/gcc/testsuite/g++.dg/pascal-strings-4.C b/gcc/testsuite/g++.dg/pascal-strings-4.C new file mode 100644 index 00000000000..ef336990455 --- /dev/null +++ b/gcc/testsuite/g++.dg/pascal-strings-4.C @@ -0,0 +1,20 @@ +/* APPLE LOCAL file pascal strings */ +/* Ensure that Pascal strings do not get confused with ordinary C strings when + -funsigned-char is being used. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-do compile } */ +/* { dg-options "-fpascal-strings -funsigned-char" } */ + +typedef unsigned char Str15[16]; + +Str15 ggg = "\p012345678901234"; +Str15 hhh = "0123456789012345"; /* { dg-error "initializer.string for array of chars is too long" } */ + +int foo(void) +{ + Str15 sss = "\p012345678901234"; + Str15 ttt = "0123456789012345"; /* { dg-error "initializer.string for array of chars is too long" } */ + + return 0; +} diff --git a/gcc/testsuite/g++.dg/pch/debug-1.C b/gcc/testsuite/g++.dg/pch/debug-1.C new file mode 100644 index 00000000000..ba221ef58b4 --- /dev/null +++ b/gcc/testsuite/g++.dg/pch/debug-1.C @@ -0,0 +1,6 @@ +/* APPLE LOCAL file bincl/eincl */ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-g -fno-eliminate-unused-debug-symbols -I. -Winvalid-pch" } */ +#include "debug-1.H" +typedef int myint; + diff --git a/gcc/testsuite/g++.dg/pch/debug-1.Hs b/gcc/testsuite/g++.dg/pch/debug-1.Hs new file mode 100644 index 00000000000..949320dfede --- /dev/null +++ b/gcc/testsuite/g++.dg/pch/debug-1.Hs @@ -0,0 +1,4 @@ +/* APPLE LOCAL file bincl eincl */ +/* { dg-options "-g -fno-eliminate-unused-debug-symbols -I." } */ +#include <Carbon/Carbon.h> + diff --git a/gcc/testsuite/g++.dg/preserve-PPC-CR.C b/gcc/testsuite/g++.dg/preserve-PPC-CR.C new file mode 100644 index 00000000000..38e76873ddd --- /dev/null +++ b/gcc/testsuite/g++.dg/preserve-PPC-CR.C @@ -0,0 +1,41 @@ +// APPLE LOCAL file preserve CR2 for save_world prologues +// This testcase failed at -O2 due to a missing EH note describing the PowerPC Condition Register. +// Thanks to Dale Johannesen. + +// { dg-do run } +// { dg-options "-fpascal-strings" } +#include <stdlib.h> +#include <stdio.h> +int tick = 1; +int caught_x = 1; +int h() { return 2; } +void f() +{ throw(3); } +extern int h(); +void ff() { + bool xx = h() == 0; + if ( !xx ) { + try { + f(); + } catch (float f) { + if (!xx) printf("%f\n", f); + } + } +} +int g(int y) +{ + bool x = h() != 0; + if ( x) { + try { + ff(); + } catch (int ex) { + // if (x) printf("%d\n", ex); + if (x) { tick++; caught_x = ex; } + }} +} +main() +{ + g(3); + if (tick != 2 || caught_x != 3) + abort(); +} diff --git a/gcc/testsuite/g++.dg/ss/one.C b/gcc/testsuite/g++.dg/ss/one.C new file mode 100644 index 00000000000..b75a8ebcd74 --- /dev/null +++ b/gcc/testsuite/g++.dg/ss/one.C @@ -0,0 +1,17 @@ +/* Copyright (C) 2005 Free Software Foundation. + Contributed by Devang Patel <dpatel@apple.com> */ + +/* Test simple use of symbol repository. + Include file one.h is supplied as one.ssh in this directory, + so that ss.exp can pick it up as candidate for making + repository. */ +/* { dg-do assemble } */ + +#include "one.h" +int main () +{ + struct x_y_point a; + a.x = 0; + a.y = 0; + return 0; +} diff --git a/gcc/testsuite/g++.dg/ss/one.ssh b/gcc/testsuite/g++.dg/ss/one.ssh new file mode 100644 index 00000000000..b35ec2d1ce8 --- /dev/null +++ b/gcc/testsuite/g++.dg/ss/one.ssh @@ -0,0 +1,11 @@ +/* Copyright (C) 2005 Free Software Foundation. + Contributed by Devang Patel <dpatel@apple.com> */ + +/* Test simple use of symbol repository. + Part of one.c test. */ + +struct x_y_point +{ + int x; + int y; +}; diff --git a/gcc/testsuite/g++.dg/ss/one_part_2.C b/gcc/testsuite/g++.dg/ss/one_part_2.C new file mode 100644 index 00000000000..2d6f73f8379 --- /dev/null +++ b/gcc/testsuite/g++.dg/ss/one_part_2.C @@ -0,0 +1,12 @@ +/* Copyright (C) 2005 Free Software Foundation. + Contributed by Devang Patel <dpatel@apple.com> */ + +/* Test simple use of symbol repository. + Include file one.h is supplied as one.ssh in this directory, + so that ss.exp can pick it up as candidate for making + repository. */ +/* { dg-do assemble } */ +#include "one.h" +extern int foo () +{ +} diff --git a/gcc/testsuite/g++.dg/ss/ss-cmd1.c b/gcc/testsuite/g++.dg/ss/ss-cmd1.c new file mode 100644 index 00000000000..3fb08a5be80 --- /dev/null +++ b/gcc/testsuite/g++.dg/ss/ss-cmd1.c @@ -0,0 +1,9 @@ +/* Copyright (C) 2005 Free Software Foundation. + Contributed by Devang Patel <dpatel@apple.com> */ +/* Test command line option -grepository */ +/* { dg-do compile } */ +/* { dg-options "-gfull -fsave-repository=ss-cmd1-ss.o" } */ +int main() +{ + return 0; +} diff --git a/gcc/testsuite/g++.dg/ss/ss.exp b/gcc/testsuite/g++.dg/ss/ss.exp new file mode 100644 index 00000000000..5b76de7cc31 --- /dev/null +++ b/gcc/testsuite/g++.dg/ss/ss.exp @@ -0,0 +1,230 @@ +# Copyright (C) 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# GCC testsuite for symbol separation interaction, +# that uses the `dg.exp' driver. + +# Load support procs. +load_lib g++-dg.exp + +# Initialize `dg'. +dg-init + +# Get checksum (first field of BINCL and EXCL stab information +proc get_checksum {input_file search_string} { + global RESULT nshort + + # Regular expression to extract hexadecimal word + set hexexp {[0-9a-fA-F]+} + + # Do nm on input_file and grep for search_string + set tmp [remote_exec host "nm -ap $input_file"] + set status [lindex $tmp 0]; + set output [lindex $tmp 1]; + + if {$status != 0} { + fail "$nshort test checksum" + } else { + pass "$nshort test checksum" + } + + regexp $hexexp $output RESULT; + + # Return check sum + return $RESULT +} + +set old_dg_do_what_default "${dg-do-what-default}" + +# Main loop. +foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.C]] { + global runtests torture_without_loops dg-do-what-default nshort + + # If we're only testing specific files and this isn't one of them, skip it. + if ![runtest_file_p $runtests $test] { + continue + } + + # [file tail name] returns part of name after last / + set nshort "$subdir/[file tail $test]" + set short_bname "[file rootname [file tail $test]]" + set bname "[file rootname $test]" + set ss_exp_debug 0 + + # We don't try to use the loop-optimizing options, since they are highly + # unlikely to make any difference to CINFO. + foreach flags "[list {-gfull}]" { + verbose "Testing $nshort, $flags" 1 + + # Clean up + catch { file delete "$bname.h" } + catch { file delete "$bname.o" } + catch { file delete "$bname.h.o" } + + if {$ss_exp_debug == 1} { + puts "ss_exp_debug: various names" + puts "ss_exp_debug bname:"; puts $bname + puts "ss_exp_debug bname.ssh:"; puts $bname.ssh + puts "ss_exp_debug test:"; puts $test + puts "ss_exp_debug short_bname:"; puts $short_bname + } + + # 1) compile foo.h to create foo.h.o + if { [ file exists "$bname.ssh" ] } { + + # For the header files, the default is to make repository + set dg-do-what-default assemble + + # Header files are supplied using .ssh extension, so that we can + # identify candidates for makeing symbol repository. Get header copy + # with .h here. + file copy -force "$bname.ssh" "$bname.h" + file copy -force "$bname.ssh" "$short_bname.h" + + # Make repository + # This will create two output files $short_bname.h.o and PCH + dg-test -keep-output "$bname.h" $flags "-fsave-repository=$short_bname.h.o -x c++-header" + + if { [ file exists "$short_bname.o" ] } { + file rename -force "$short_bname.h.o" "$bname.h.o" + + puts "ss_exp_debug short_bname:"; puts $bname.h.o; puts $bname.h; + # Do nm on $bname.h.o and grep for "BINCL $bname.h" + # Extract dummy-checksum from the grep result and save it in RESULT1 + set RESULT1 [get_checksum $bname.h.o "BINCL $bname.h"] + + if {$ss_exp_debug == 1} { + puts "ss_exp_debug: RESULT1"; puts $RESULT1 + } + + pass "$nshort $flags Make Repository" + } else { + set RESULT1 " " + fail "$nshort $flags Make Repository" + } + + if { [ file exists "$bname.h.o" ] } { + + # 2) compile foo.c to create foo.o + dg-test -keep-output $test $flags "-I. " + if { [ file exists "$short_bname.o" ] } { + + # Do nm on $bname.o and grep for "EXCL $bname.h" + # Extract dummy-checksum from the grep result and save it in RESULT2 + set RESULT2 [get_checksum $short_bname.o "EXCL $bname.h"] + + if {$ss_exp_debug == 1} { + puts "ss_exp_debug: RESULT2"; puts $RESULT2 + } + + pass "$nshort $flags Use symbol repository" + + } else { + set RESULT2 " " + fail "$nshort $flags Use symbol repository" + } + + + if { [ file exists "$bname.part_2.c" ] } { + + # 3) compile foo_part_2.c to create foo_part_2.o + dg-test -keep-output "$bname_part_2.c" $flags "-I. -grepository" + if { [ file exists "$short_bname_part_2.o" ] } { + + # Do nm on $bname_part_2.o and grep for "EXCL $bname.h" + # Extract dummy-checksum from the grep result and save it in RESULT3 + set RESULT3 [get_checksum $short_bname_part_2.o "EXCL $bname.h"] + + if {$ss_exp_debug == 1} { + puts "ss_exp_debug: RESULT3"; puts $RESULT3 + } + + pass "$nshort $flags Use symbol repository" + + } else { + set RESULT3 " " + fail "$nshort $flags Use symbol repository" + } + + # 4) Link foo.h.o and foo.o to create foo + set dg-do-what-default link + dg-test -keep-output "$bname.h.o" "$bname.o" "-o $short_bname.out" + + # 5) do 'nm |grep ' on final assembler and save result in RES4 + # Do nm on $bname.out and grep for "EXCL $bname.h" + # Extract dummy-checksum from the grep result and save it in RESULT4 + set RESULT4 [get_checksum $short_bname.out "EXCL $bname.h"] + + # Do nm on $bname.out and grep for "BINCL $bname.h" + # Extract dummy-checksum from the grep result and save it in RESULT5 + set RESULT5 [get_checksum $short_bname.out "BINCL $bname.h"] + + if {$ss_exp_debug == 1} { + puts "ss_exp_debug: RESULT4"; puts $RESULT4 + puts "ss_exp_debug: RESULT5"; puts $RESULT5 + } + + pass "$nshort $flags symbol separation: linking" + + } else { + + # If we are not testing second part then set values so that comparison test succeeds + set RESULT3 $RESULT2 + set RESULT4 $RESULT2 + set RESULT5 $RESULT2 + if {$ss_exp_debug == 1} { + puts "ss_exp_debug: RESULT3"; puts $RESULT3 + puts "ss_exp_debug: RESULT4"; puts $RESULT4 + puts "ss_exp_debug: RESULT5"; puts $RESULT5 + } + } + + # 6) Compare RES1 and RES2 and RES3 and RES4 + if { ( $RESULT1 == $RESULT2 ) + && ( $RESULT1 == $RESULT3 ) + && ( $RESULT1 == $RESULT4 ) } { + pass "$nshort $flags symbol separation valid use test" + } else { + fail "$nshort $flags symbol separation valid use test" + } + if { ( $RESULT1 == $RESULT5 ) } { + pass "$nshort $flags symbol separation link test" + } else { + fail "$nshort $flags symbol separation link test" + } + pass "$nshort $flags Make repository" + } else { + fail "$nshort $flags Make repository" + } + } else { + + # Normal test + set dg-do-what-default compile + dg-test -keep-output $test $flags "-I." + } + + } + + # Clean up + catch { file delete "$bname.h" } + catch { file delete "$bname.o" } + catch { file delete "$bname.h.o" } +} + +set dg-do-what-default "$old_dg_do_what_default" + +# All done. +dg-finish diff --git a/gcc/testsuite/g++.dg/tc1/dr108.C b/gcc/testsuite/g++.dg/tc1/dr108.C index f7848ec74b6..6b567a9fad5 100644 --- a/gcc/testsuite/g++.dg/tc1/dr108.C +++ b/gcc/testsuite/g++.dg/tc1/dr108.C @@ -12,4 +12,4 @@ template <class T> struct S { }; // Additional notes on the same line are allowed -// { dg-error "" "" { target *-*-* } 10 } +// { dg-error "" "additional" { target *-*-* } 10 } diff --git a/gcc/testsuite/g++.dg/template/array13.C b/gcc/testsuite/g++.dg/template/array13.C new file mode 100644 index 00000000000..3bc152ce4f8 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/array13.C @@ -0,0 +1,14 @@ +// PR c++/20208 +// { dg-do run } +// { dg-options "-O2" } + +extern "C" void abort(); + +template <typename T> +inline void *Foo (T arg) { return &arg[0]; } + +int main () { + int bry[2]; + if (Foo<int[2]>(bry) != bry) + abort(); +} diff --git a/gcc/testsuite/g++.dg/template/crash34.C b/gcc/testsuite/g++.dg/template/crash34.C new file mode 100644 index 00000000000..9cca62f0539 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash34.C @@ -0,0 +1,12 @@ +// { dg-do compile } + +// PR c++/20028 + +// We used to crash when referencing TYPE_SIZE_UNIT of the messed-up +// type used for x, because it was not initialized. + +class Foo; + +template <typename T> class Foo { }; // { dg-error "not a template type" } + +Foo<int> x; // { dg-error "not a template" } diff --git a/gcc/testsuite/g++.dg/template/crash35.C b/gcc/testsuite/g++.dg/template/crash35.C new file mode 100644 index 00000000000..dd8aa2f0906 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash35.C @@ -0,0 +1,9 @@ +// PR c++/20463 +// { dg-do compile } + +template <typename T> struct C; // { dg-error "declaration" } + +template <typename T> void C<T>::f() // { dg-error "invalid|template" } +{ + const foo bar; // { dg-error "name a type" } +} diff --git a/gcc/testsuite/g++.dg/template/crash36.C b/gcc/testsuite/g++.dg/template/crash36.C new file mode 100644 index 00000000000..2f0ef921a67 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash36.C @@ -0,0 +1,9 @@ +// { dg-do compile } + +// Origin: Ivan Godard <igodard@pacbell.net> +// Andrew Pinski <pinskia@gcc.gnu.org> + +// PR c++/20333: ICE parsing typename without nested-name-specifier + +template<class> struct f {}; +f<int> f2[2] = {typename f<int>()}; // { dg-error "" } diff --git a/gcc/testsuite/g++.dg/template/dtor4.C b/gcc/testsuite/g++.dg/template/dtor4.C new file mode 100644 index 00000000000..6d7cd2343f1 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/dtor4.C @@ -0,0 +1,9 @@ +// PR c++/19440 +// Origin: Volker Reichelt <reichelt@igpm.rwth-aachen.de> + +// { dg-do compile } + +template<int> struct A +{ + ~A<0>(); // { dg-error "declaration" } +}; diff --git a/gcc/testsuite/g++.dg/template/error17.C b/gcc/testsuite/g++.dg/template/error17.C new file mode 100644 index 00000000000..24b364455fd --- /dev/null +++ b/gcc/testsuite/g++.dg/template/error17.C @@ -0,0 +1,8 @@ +// PR c++/20153 + +template <typename T> +void +foo() +{ + union { struct { }; }; // { dg-error "" } +} diff --git a/gcc/testsuite/g++.dg/template/error18.C b/gcc/testsuite/g++.dg/template/error18.C new file mode 100644 index 00000000000..7b7151a3b7f --- /dev/null +++ b/gcc/testsuite/g++.dg/template/error18.C @@ -0,0 +1,11 @@ +// PR c++/20157 + +template<typename AT> +struct A{ + template<typename T> + void function(T); +}; + +template<> +template<typename ABC,typename DEF> +void A<int>::function(ABC); // { dg-error "match" } diff --git a/gcc/testsuite/g++.dg/template/local4.C b/gcc/testsuite/g++.dg/template/local4.C index 748810b409e..20f8bf29441 100644 --- a/gcc/testsuite/g++.dg/template/local4.C +++ b/gcc/testsuite/g++.dg/template/local4.C @@ -6,6 +6,6 @@ int main () { struct S {}; // We do not simply use "local|match" on line 10 because we want to // make sure that "local" appears. - // { dg-error "local" "" { target *-*-* } 10 } + // { dg-error "local" "local" { target *-*-* } 10 } foo<S> (); // { dg-error "trying|match" } } diff --git a/gcc/testsuite/g++.dg/template/local5.C b/gcc/testsuite/g++.dg/template/local5.C new file mode 100644 index 00000000000..bd1d21bfaf2 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/local5.C @@ -0,0 +1,13 @@ +/* APPLE LOCAL file mainline 4.1 2005-06-17 4122333 */ +struct Attribute { }; + +template <class T> bool operator == (const Attribute &attr, const T &value); + +enum { + anon = 123 +}; + +void test(int foo) +{ + if (foo == anon) ; /* { dg-bogus "anonymous type" } */ +} diff --git a/gcc/testsuite/g++.dg/template/mem_func_ptr.C b/gcc/testsuite/g++.dg/template/mem_func_ptr.C new file mode 100644 index 00000000000..bcdda5ca69d --- /dev/null +++ b/gcc/testsuite/g++.dg/template/mem_func_ptr.C @@ -0,0 +1,57 @@ +// { dg-do compile } +template<typename T> struct takes_member_ptr; +template<typename T, typename Class> struct takes_member_ptr<T Class::*> {}; + +template<typename T, typename Class> +void fun_takes_member_ptr(T Class::*) {} + + +template<typename T> struct order_member_ptrs; +template<typename T, typename Class> struct order_member_ptrs<T Class::*> {}; +template<typename R, typename T1, typename Class> + struct order_member_ptrs<R (Class::*)(T1)> + { + typedef int type; + }; + +template<typename R, typename T1, typename Class> + struct order_member_ptrs<R (Class::*)(T1) const> + { + typedef int c_type; + }; + +template<typename R, typename T1, typename Class> + struct order_member_ptrs<R (Class::*)(T1) volatile> + { + typedef int v_type; + }; + +template<typename R, typename T1, typename Class> + struct order_member_ptrs<R (Class::*)(T1) const volatile> + { + typedef int cv_type; + }; + + +struct X { + void bar(float) {} + void bar_c(float) const {} + void bar_v(float) volatile {} + void bar_cv(float) const volatile {} +}; + +void foo() +{ + sizeof(takes_member_ptr<void (X::*)(float)>); + sizeof(takes_member_ptr<void (X::*)(float) const>); + sizeof(takes_member_ptr<void (X::*)(float) volatile>); + sizeof(takes_member_ptr<void (X::*)(float) const volatile>); + sizeof(order_member_ptrs<void (X::*)(float)>::type); + sizeof(order_member_ptrs<void (X::*)(float) const>::c_type); + sizeof(order_member_ptrs<void (X::*)(float) volatile>::v_type); + sizeof(order_member_ptrs<void (X::*)(float) const volatile>::cv_type); + fun_takes_member_ptr(&X::bar); + fun_takes_member_ptr(&X::bar_c); + fun_takes_member_ptr(&X::bar_v); + fun_takes_member_ptr(&X::bar_cv); +} diff --git a/gcc/testsuite/g++.dg/template/non-dependent11.C b/gcc/testsuite/g++.dg/template/non-dependent11.C new file mode 100644 index 00000000000..dff5b909d95 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/non-dependent11.C @@ -0,0 +1,18 @@ +// { dg-do compile } + +// Origin: Jakub Jelinek <jakub@gcc.gnu.org> +// Wolfgang Bangerth <bangerth@ticam.utexas.edu> + +// PR c++/19311: Non-dependent address to member as function argument. + +template <class R, class T> void foo (R (T::*x) ()); +template <class R, class T, class C> void foo (R (T::*x) (C)); + +template<int> struct I { + int o (); + int o () const; +}; + +template <int> void bar (void) { + foo <int, I<1> > (&I<1>::o); +} diff --git a/gcc/testsuite/g++.dg/template/non-dependent12.C b/gcc/testsuite/g++.dg/template/non-dependent12.C new file mode 100644 index 00000000000..73d7e949766 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/non-dependent12.C @@ -0,0 +1,10 @@ +// Copyright (C) 2005 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 8 Mar 2005 <nathan@codesourcery.com> + +// PR 20186: ICE +// Origin: Jan Dvorak <jan.dvorak@kraxnet.cz> + +template<typename T> void foo(T &t) +{ + int i = static_cast<int>(t); +} diff --git a/gcc/testsuite/g++.dg/template/nontype6.C b/gcc/testsuite/g++.dg/template/nontype6.C index 43470ccdb1d..298ce82591c 100644 --- a/gcc/testsuite/g++.dg/template/nontype6.C +++ b/gcc/testsuite/g++.dg/template/nontype6.C @@ -13,7 +13,7 @@ template <class T> void func(void) { (void)A<T>::type(); // { dg-error "if a type is meant" } -// { dg-error "parsed as a non-type" "" { target *-*-* } 15 } +// { dg-error "parsed as a non-type" "non-type" { target *-*-* } 15 } } template void func<float>(void); // { dg-error "instantiated from here" } diff --git a/gcc/testsuite/g++.dg/template/overload4.C b/gcc/testsuite/g++.dg/template/overload4.C new file mode 100644 index 00000000000..1a294eb3c05 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/overload4.C @@ -0,0 +1,20 @@ +// PR c++/20679 + +template <class T> +struct foo +{ + struct bar + { + int m; + }; + + void m() const {} + void m() {} + + bool n() const { return b->m < 42; } + + bar *b; +}; + + + diff --git a/gcc/testsuite/g++.dg/template/ptrmem12.C b/gcc/testsuite/g++.dg/template/ptrmem12.C new file mode 100644 index 00000000000..717b86988cb --- /dev/null +++ b/gcc/testsuite/g++.dg/template/ptrmem12.C @@ -0,0 +1,29 @@ +// Copyright (C) 2005 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 17 Mar 2005 <nathan@codesourcery.com> + +// PR 20465 +// Origin: Matthias Klose <doko@debian.org> +// Andrew Pinski <pinskia@gcc.gnu.org> + +template <class _Ret, class _Tp> +void mem_fun_ref(_Ret (_Tp::*__f)()); + +struct A { + double f(); +}; + +void h () +{ + mem_fun_ref(&A::f); +} + +template <class T> +void f() +{ + mem_fun_ref(&A::f); +} + +void g() +{ + f<int>(); +} diff --git a/gcc/testsuite/g++.dg/template/ptrmem13.C b/gcc/testsuite/g++.dg/template/ptrmem13.C new file mode 100644 index 00000000000..84374ea05fc --- /dev/null +++ b/gcc/testsuite/g++.dg/template/ptrmem13.C @@ -0,0 +1,11 @@ +// PR c++/20734 + +struct A; +void blah(int A::*); +struct A{ + int a; +}; +template<typename T> +void hoho(){ + blah(&A::a); +} diff --git a/gcc/testsuite/g++.dg/template/qualttp15.C b/gcc/testsuite/g++.dg/template/qualttp15.C index 1b1f3bb725d..0f97c32fcb8 100644 --- a/gcc/testsuite/g++.dg/template/qualttp15.C +++ b/gcc/testsuite/g++.dg/template/qualttp15.C @@ -17,8 +17,8 @@ template <class T> struct X<T::template B> T z; }; -template <class T> struct X<T::template B> -{ // { dg-error "redefinition" } +template <class T> struct X<T::template B> // { dg-error "redefinition" } +{ T z; }; diff --git a/gcc/testsuite/g++.dg/template/qualttp20.C b/gcc/testsuite/g++.dg/template/qualttp20.C index 5a9c61c4304..ae20d762902 100644 --- a/gcc/testsuite/g++.dg/template/qualttp20.C +++ b/gcc/testsuite/g++.dg/template/qualttp20.C @@ -1,4 +1,5 @@ // { dg-do compile } +// { dg-options "-pedantic -pedantic-errors" } // Copyright (C) 2001 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 15 Dec 2001 <nathan@codesourcery.com> @@ -16,7 +17,7 @@ struct AS template <typename T> struct B1 : T { typedef typename T::L __restrict__ r;// { dg-error "'__restrict__' qualifiers cannot" "" } - typedef typename T::myT __restrict__ p;// { dg-warning "ignoring '__restrict__'" "" { xfail *-*-* } } + typedef typename T::myT __restrict__ p;// { dg-error "ignoring '__restrict__'" } // The following are DR 295 dependent typedef typename T::myT volatile *myvolatile; diff --git a/gcc/testsuite/g++.dg/template/redecl3.C b/gcc/testsuite/g++.dg/template/redecl3.C new file mode 100644 index 00000000000..029f9e69a5f --- /dev/null +++ b/gcc/testsuite/g++.dg/template/redecl3.C @@ -0,0 +1,7 @@ +// PR c++/19980 +// Origin: Volker Reichelt <reichelt@igpm.rwth-aachen.de> + +// { dg-do compile } + +int foo; // { dg-error "previous declaration" } +template<int> void foo() {} // { dg-error "redeclared" } diff --git a/gcc/testsuite/g++.dg/template/sizeof9.C b/gcc/testsuite/g++.dg/template/sizeof9.C new file mode 100644 index 00000000000..8d9ec95ae1f --- /dev/null +++ b/gcc/testsuite/g++.dg/template/sizeof9.C @@ -0,0 +1,6 @@ +// PR c++/21025 + +template<int N> struct X { char x[N]; }; +template<typename T> X<1 + sizeof(T) - sizeof(T)> F(T const &); +template<int N> struct S { int d() { F(1); } }; + diff --git a/gcc/testsuite/g++.dg/template/templ-deref-1.C b/gcc/testsuite/g++.dg/template/templ-deref-1.C new file mode 100644 index 00000000000..dba909a989b --- /dev/null +++ b/gcc/testsuite/g++.dg/template/templ-deref-1.C @@ -0,0 +1,68 @@ +/* APPLE LOCAL file C++ */ +/* It should be possible to be possible to explicitly call 'operator ...' + functions with an implicit 'this', so long as the base class is not + a dependent type. For dependent base types, 'this->' or 'Base::' + must be used. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile } */ + +class Foo +{ + public: + void read(int i); +}; + +void Func(Foo* inFoo); + +void Foo::read(int i) +{ + i = i + 1; +} + +class Baz +{ + public: + Baz(Foo* in) : fFoo(in) {} + operator Foo*() { return fFoo; } + Foo *foofoo(void) { return fFoo; } + Foo* fFoo; +}; + +template <class T> class Boop { + public: + Foo *booboo(void) { return gFoo; } + operator void *(void) { return (void *)gFoo; } + Foo *gFoo; +}; + +void Func(Foo* inFoo) +{ + inFoo->read(1); +} + +template <class T> class Bar : public Baz, public Boop <T> +{ + public: + Bar(T *inFoo) : Baz(inFoo) {} + void CallMe() + { + void *p; + Func(this->foofoo()); + Func(this->operator Foo*()); + Func(this->booboo()); + p = Boop<T>::operator void*(); + Func(foofoo()); + Func(operator Foo*()); + Func(booboo()); /* { dg-error "must be available" } */ + p = operator void *(); /* { dg-error "must be available" } */ + } +}; + +int main (int argc, char * const argv[]) +{ + Foo theFoo; + Bar<Foo> theBar(&theFoo); + theBar.CallMe(); +} + +/* { dg-error "allowing the use of an undeclared name is deprecated" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr19786.C b/gcc/testsuite/g++.dg/tree-ssa/pr19786.C new file mode 100644 index 00000000000..faaecdfd971 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr19786.C @@ -0,0 +1,48 @@ +// { dg-do run } +/* { dg-options "-O2" } */ + +// We used to get alias grouping wrong on this one, hoisting accesses +// to the vector's end out of the loop. + +#include <vector> +#include <cassert> + +struct A +{ + double unused; // If I remove it => it works. + std::vector<int> v; + + A() : v(1) {} +}; + +inline // If not inline => it works. +A g() +{ + A r; + r.v.resize(2); + r.v[0] = 1; + + while (!r.v.empty() && r.v.back() == 0) + r.v.pop_back(); + + return r; +} + +A f(const A &a) +{ + if (a.v.empty()) return a; + if (a.v.empty()) return a; + + // A z = g(); return z; // If I return like this => it works. + return g(); +} + +int main() +{ + A a; + A b; + A r = f(a); + assert(r.v.size() != 0); + + return 0; +} diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr19952.C b/gcc/testsuite/g++.dg/tree-ssa/pr19952.C new file mode 100644 index 00000000000..92d669c1415 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr19952.C @@ -0,0 +1,24 @@ +/* PR 19952 */ +/* { dg-compile } */ +/* { dg-options "-ftree-vectorize -O2" } */ + +int i; + +struct A +{ + ~A() { ++i; } +}; + +struct B +{ + A a; +}; + +void foo() +{ + for (int i=0; i<2; ++i) + { + B *p; + if (p) p->~B(); + } +} diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr20280.C b/gcc/testsuite/g++.dg/tree-ssa/pr20280.C new file mode 100644 index 00000000000..ec4dad70620 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr20280.C @@ -0,0 +1,63 @@ +// PR c++/20280 + +// { dg-do compile } + +// Gimplification of the COND_EXPR used to fail because it had an +// addressable type, and create_tmp_var rejected that. + +struct A +{ + ~A(); +}; + +struct B : A {}; + +A& foo(); + +void bar(bool b) +{ + (B&) (b ? foo() : foo()); +} + +// Make sure bit-fields and addressable types don't cause crashes. +// These were not in the original bug report. + +// Added by Alexandre Oliva <aoliva@redhat.com> + +// Copyright 2005 Free Software Foundation + +struct X +{ + long i : 32, j, k : 32; +}; + +void g(long&); +void h(const long&); + +void f(X &x, bool b) +{ + (b ? x.i : x.j) = 1; + (b ? x.j : x.k) = 2; + (b ? x.i : x.k) = 3; + + (void)(b ? x.i : x.j); + (void)(b ? x.i : x.k); + (void)(b ? x.j : x.k); + + g (b ? x.i : x.j); // { dg-error "cannot bind bitfield" } + g (b ? x.i : x.k); // { dg-error "cannot bind bitfield" } + g (b ? x.j : x.k); // { dg-error "cannot bind bitfield" } + + // It's not entirely clear whether these should be accepted. The + // conditional expressions are lvalues for sure, and 8.5.3/5 exempts + // lvalues for bit-fields, but it's not clear that conditional + // expressions that are lvalues and that have at least one possible + // result that is a bit-field lvalue meets this condition. + h (b ? x.i : x.j); + h (b ? x.i : x.k); + h (b ? x.j : x.k); + + (long &)(b ? x.i : x.j); // { dg-error "address of bit-field" } + (long &)(b ? x.i : x.k); // { dg-error "address of bit-field" } + (long &)(b ? x.j : x.k); // { dg-error "address of bit-field" } +} diff --git a/gcc/testsuite/g++.dg/tree-ssa/ssa-sra-3.C b/gcc/testsuite/g++.dg/tree-ssa/ssa-sra-3.C new file mode 100644 index 00000000000..41bbc919f65 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/ssa-sra-3.C @@ -0,0 +1,86 @@ +/* APPLE LOCAL file mainline and 4.0 branch 2005-03-31 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* Test check use_block_copy bit propagation in sra element hierarchy. */ + +typedef unsigned char UINT8 ; +typedef unsigned int UINT ; +class C4 +{ +public: + int xy[2]; +}; + +class C3 +{ +public: + inline void + Reset() + { + C4 const mvMax = {0x7fff, 0x7fff}; + + m42(0,mvMax); + m42(1,mvMax); + m43(0); + }; + + inline void m42 (UINT i, C4 mv) + { + mMv[i] = mv; + }; + + + + inline void m43(UINT j) + { + m44 (j); + d41 = j + 1; + }; + +private: + + C4 mMv[2]; + UINT8 d41; + inline void m44 (UINT j) const {}; +}; + +class C2 +{ +private: + bool valid; +}; + +class C1 +{ +public: + void m1(C3 *c); + +private: + const C2 * d1[2]; + void m2(C3 *m); +}; + +void C1::m1 (C3 *r) +{ + C3 x; + m2(&x); +} +void C1::m2(C3 *x) +{ + C3 m3; + int i; + m3.Reset (); + for(i=0; i<2; i++) + { + const C2 * r = d1[i]; + if (r!=__null) + { + C4 const c400 = {0,0}; + m3.m42 (i, c400); + + } + } +} + + + diff --git a/gcc/testsuite/g++.dg/vect/pr19951.cc b/gcc/testsuite/g++.dg/vect/pr19951.cc new file mode 100644 index 00000000000..bb6586c0629 --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr19951.cc @@ -0,0 +1,17 @@ +/* { dg-do compile } */ + +struct A +{ + ~A(); +}; + +void foo(); + +void bar() +{ + A a; + + foo(); + for (;;) + foo(); +} diff --git a/gcc/testsuite/g++.dg/vect/vect.exp b/gcc/testsuite/g++.dg/vect/vect.exp new file mode 100644 index 00000000000..cc2e4e30364 --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/vect.exp @@ -0,0 +1,95 @@ +# Copyright (C) 2004 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# GCC testsuite that uses the 'dg.exp' driver. + +# There's a bunch of headers we need. +if [is_remote host] { + foreach header [glob -nocomplain $srcdir/$subdir/*.{h,def} ] { + remote_download host $header + } +} + +# Load support procs. +load_lib g++-dg.exp +load_lib target-supports.exp + +# If the target system supports vector instructions, the default action +# for a test is 'run', otherwise it's 'compile'. Save current default. +# Executing vector instructions on a system without hardware vector support +# is also disabled by a call to check_vect, but disabling execution here is +# more efficient. +global dg-do-what-default +set save-dg-do-what-default ${dg-do-what-default} + +# Set up flags used for tests that don't specify options. +set DEFAULT_VECTCFLAGS "" + +# These flags are used for all targets. +lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" \ + "-ftree-vectorizer-verbose=3" "-fdump-tree-vect-stats" + +# Skip these tests for targets that do not support generating vector +# code. Set additional target-dependent vector flags, which can be +# overridden by using dg-options in individual tests. +if [istarget "powerpc*-*-*"] { + # If there are powerpc targets to skip, do it here. + + lappend DEFAULT_VECTCFLAGS "-maltivec" + if [check_vmx_hw_available] { + set dg-do-what-default run + } else { + if [is-effective-target ilp32] { + # Specify a cpu that supports VMX for compile-only tests. + lappend DEFAULT_VECTCFLAGS "-mcpu=7400" + } + set dg-do-what-default compile + } +} elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } { + lappend DEFAULT_VECTCFLAGS "-msse2" + set dg-do-what-default run +} elseif [istarget "mipsisa64*-*-*"] { + lappend DEFAULT_VECTCFLAGS "-mpaired-single" + set dg-do-what-default run +} elseif [istarget "sparc*-*-*"] { + lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis" + set dg-do-what-default run +} elseif [istarget "alpha*-*-*"] { + lappend DEFAULT_VECTCFLAGS "-mmax" + if [check_alpha_max_hw_available] { + set dg-do-what-default run + } else { + set dg-do-what-default compile + } +} elseif [istarget "ia64-*-*"] { + set dg-do-what-default run +} else { + return +} + + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{c,cc,S} ]] \ + "" $DEFAULT_VECTCFLAGS + +# Clean up. +set dg-do-what-default ${save-dg-do-what-default} + +# All done. +dg-finish diff --git a/gcc/testsuite/g++.dg/warn/Wbraces2.C b/gcc/testsuite/g++.dg/warn/Wbraces2.C new file mode 100644 index 00000000000..b51d5ca77b9 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wbraces2.C @@ -0,0 +1,15 @@ +// PR c++/20175 +// { dg-options "-Wmissing-braces" } +int a[2][2] = { 0, 1, 2, 3 }; // { dg-warning "missing braces" } +int b[2][2] = { { 0, 1 }, { 2, 3 } }; +int c[2][2] = { { { 0 }, 1 }, { 2, 3 } }; // { dg-error "brace-enclosed" } +struct S { char s[6]; int i; }; +S d = { "hello", 1 }; +S e = { { "hello" }, 1 }; +S f = { { { "hello" } }, 1 }; // { dg-error "brace-enclosed" } +S g = { 'h', 'e', 'l', 'l', 'o', '\0', 1 }; // { dg-warning "missing braces" } +struct T { wchar_t s[6]; int i; }; +T i = { L"hello", 1 }; +T j = { { L"hello" }, 1 }; +T k = { { { L"hello" } }, 1 }; // { dg-error "brace-enclosed" } +T l = { L'h', L'e', L'l', L'l', L'o', L'\0', 1 };// { dg-warning "missing braces" } diff --git a/gcc/testsuite/g++.dg/warn/Wdtor1.C b/gcc/testsuite/g++.dg/warn/Wdtor1.C new file mode 100644 index 00000000000..34c8a7edcad --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wdtor1.C @@ -0,0 +1,22 @@ +// PR c++/20145 +// { dg-options "-Wnon-virtual-dtor" } +# 1 "t.cc" +# 1 "<built-in>" +# 1 "<command line>" +# 1 "t.cc" +# 1 "include/t.h" 1 3 4 +// Declare the template with explicit C++ linkage in case system +// headers have implicit C linkage. +extern "C++" { +template <int> class t +{ + virtual void f(); +}; +} +# 2 "t.cc" 2 + +void f(void) +{ + t<1> h; +} + diff --git a/gcc/testsuite/g++.dg/warn/Wnvdtor.C b/gcc/testsuite/g++.dg/warn/Wnvdtor.C new file mode 100644 index 00000000000..b04fdcbe6b1 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wnvdtor.C @@ -0,0 +1,10 @@ +// { dg-options "-Wnon-virtual-dtor" } + +extern "Java" +{ + class Foo + { + public: + virtual void bar( void); + }; +} diff --git a/gcc/testsuite/g++.dg/warn/Wunused-11.C b/gcc/testsuite/g++.dg/warn/Wunused-11.C new file mode 100644 index 00000000000..4a151d24547 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wunused-11.C @@ -0,0 +1,11 @@ +// PR c++/20212 +// { dg-options "-O2 -Wunused -Wextra" } + +template<int> void f(int); +void g(int i) +{ + f<0>(i); +} +template<int> void f(int i __attribute__((unused)) ) +{} + diff --git a/gcc/testsuite/g++.dg/warn/deprecated.C b/gcc/testsuite/g++.dg/warn/deprecated.C index 21b901af4f5..59dc3d67257 100644 --- a/gcc/testsuite/g++.dg/warn/deprecated.C +++ b/gcc/testsuite/g++.dg/warn/deprecated.C @@ -53,10 +53,10 @@ int func1() int (*pf)() = f1; /* { dg-warning "'f1' is deprecated" "" } */ z = w + x + y + g1 + g2 + g3; /* { dg-warning "'x' is deprecated" "" } */ - /* { dg-warning "'y' is deprecated" "" { target *-*-* } 55 } */ - /* { dg-warning "'g2' is deprecated" "" { target *-*-* } 55 } */ - /* { dg-warning "'g3' is deprecated" "" { target *-*-* } 55 } */ - return f1(); /* { dg-warning "'f1' is deprecated" "" } */ + /* { dg-warning "'y' is deprecated" "y" { target *-*-* } 55 } */ + /* { dg-warning "'g2' is deprecated" "g2" { target *-*-* } 55 } */ + /* { dg-warning "'g3' is deprecated" "g3" { target *-*-* } 55 } */ + return f1(); /* { dg-warning "'f1' is deprecated" "f1" } */ } int func2(S1 *p) @@ -71,7 +71,7 @@ int func2(S1 *p) p->u1.field5 = g1 + p->field7; p->u2.field9; /* { dg-warning "'u2' is deprecated" "" } */ return p->u1.field6 + p->field8; /* { dg-warning "'field6' is deprecated" "" } */ - /* { dg-warning "'field8' is deprecated" "" { target *-*-* } 73 } */ + /* { dg-warning "'field8' is deprecated" "field8" { target *-*-* } 73 } */ } struct SS1 { diff --git a/gcc/testsuite/g++.dg/warn/minmax.C b/gcc/testsuite/g++.dg/warn/minmax.C new file mode 100644 index 00000000000..7431bfc3c4e --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/minmax.C @@ -0,0 +1,15 @@ +int i, j, k; + +void f() { + i = j <? k; // { dg-warning "deprecated" } + i = j >? k; // { dg-warning "deprecated" } + i <?= j; // { dg-warning "deprecated" } + i >?= j; // { dg-warning "deprecated" } +} + +struct S { + void operator<?(int); // { dg-warning "deprecated" } + void operator>?(int); // { dg-warning "deprecated" } + void operator<?=(int); // { dg-warning "deprecated" } + void operator>?=(int); // { dg-warning "deprecated" } +}; diff --git a/gcc/testsuite/g++.dg/warn/weak1.C b/gcc/testsuite/g++.dg/warn/weak1.C index 84d08fbd479..034716accce 100644 --- a/gcc/testsuite/g++.dg/warn/weak1.C +++ b/gcc/testsuite/g++.dg/warn/weak1.C @@ -1,5 +1,7 @@ +// The PA HP-UX dynamic loader doesn't support unsatisfied weak symbols. // { dg-do run } // { dg-require-weak "" } +// { dg-skip-if "No unsat" { hppa*-*-hpux* } { "*" } { "" } } extern void foo (void) __attribute__ ((weak)); diff --git a/gcc/testsuite/g++.old-deja/g++.abi/align.C b/gcc/testsuite/g++.old-deja/g++.abi/align.C index 28d3ba9ce86..09b5667ddef 100644 --- a/gcc/testsuite/g++.old-deja/g++.abi/align.C +++ b/gcc/testsuite/g++.old-deja/g++.abi/align.C @@ -1,4 +1,5 @@ -// { dg-do run { target i?86-*-linux* i?86-*-freebsd* } } +// APPLE LOCAL why is this local? +// { dg-do run { target i?86-*-linux* i?86-*-freebsd* i?86-*-darwin* } } // { dg-options "-malign-double" } // Origin: Alex Samuel <samuel@codesourcery.com> diff --git a/gcc/testsuite/g++.old-deja/g++.jason/warning9.C b/gcc/testsuite/g++.old-deja/g++.jason/warning9.C index 9423ac1269b..775a37ca33d 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/warning9.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/warning9.C @@ -3,12 +3,13 @@ struct A { operator int (); - A& operator= (int); // { dg-warning "" } not used below + A& operator= (int); }; +int main() { A a, b; - a = b; // { dg-warning "" } uses synthesized op= + a = b; } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/pascal.C b/gcc/testsuite/g++.old-deja/g++.mike/pascal.C new file mode 100644 index 00000000000..e1d6fe342a7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.mike/pascal.C @@ -0,0 +1,5 @@ +// APPLE LOCAL file pascal strings +// { dg-do compile } +// { dg-options "-fpascal-strings -save-temps" } + +const unsigned char * cucp = "\pHi"; diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/ChangeLog b/gcc/testsuite/g++.old-deja/g++.oliva/ChangeLog index cb7d567f659..6972b58b6a7 100644 --- a/gcc/testsuite/g++.old-deja/g++.oliva/ChangeLog +++ b/gcc/testsuite/g++.old-deja/g++.oliva/ChangeLog @@ -1,3 +1,12 @@ +2005-04-20 Release Manager + + * GCC 4.0.0 released. + +2005-04-04 Alexandre Oliva <aoliva@redhat.com> + + PR c++/19199 + * expr2.C: Fixed. + 2003-06-04 J"orn Rennecke <joern.rennecke@superh.com> * template1.C (bar): Remove xfail marker. diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/expr2.C b/gcc/testsuite/g++.old-deja/g++.oliva/expr2.C index dd364accfa4..1e63c645b6c 100644 --- a/gcc/testsuite/g++.old-deja/g++.oliva/expr2.C +++ b/gcc/testsuite/g++.old-deja/g++.oliva/expr2.C @@ -1,4 +1,4 @@ -// { dg-do run { xfail *-*-* } } +// { dg-do run } // Copyright (C) 2000 Free Software Foundation diff --git a/gcc/testsuite/g++.old-deja/g++.other/struct1.C b/gcc/testsuite/g++.old-deja/g++.other/struct1.C index f4fa322bd1f..b1f943f604f 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/struct1.C +++ b/gcc/testsuite/g++.old-deja/g++.other/struct1.C @@ -9,34 +9,34 @@ class Y { // { dg-error "" } previous definition }; -class Y -{ // { dg-error "" } redefinition +class Y // { dg-error "" } redefinition +{ }; template<class T> class X { // { dg-error "" } previous definition }; -template<class T> class X -{ // { dg-error "" } redefinition +template<class T> class X // { dg-error "" } redefinition +{ }; template<class T> class X<T *> { // { dg-error "" } previous definition }; -template<class T> class X<T *> -{ // { dg-error "" } redefinition +template<class T> class X<T *> // { dg-error "" } redefinition +{ }; template<> class X<int> { // { dg-error "" } previous definition }; -template<> class X<int> -{ // { dg-error "" } redefinition +template<> class X<int> // { dg-error "" } redefinition +{ }; template<> class X<int *> { // { dg-error "" } previous definition }; -template<> class X<int *> -{ // { dg-error "" } redefinition +template<> class X<int *> // { dg-error "" } redefinition +{ }; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/ptrmem5.C b/gcc/testsuite/g++.old-deja/g++.pt/ptrmem5.C index 4b7d5f9f572..54e975edab6 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/ptrmem5.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/ptrmem5.C @@ -14,4 +14,4 @@ struct Null { int *pd = NULL; int (*pf)() = NULL; int Null::*pmd = NULL; -int (Null::*pmf)() = NULL; // { dg-bogus "" "" { xfail *-*-* } } - cannot convert - +int (Null::*pmf)() = NULL; diff --git a/gcc/testsuite/g++.old-deja/g++.warn/compare1.C b/gcc/testsuite/g++.old-deja/g++.warn/compare1.C index 5407c936057..7a231801bfa 100644 --- a/gcc/testsuite/g++.old-deja/g++.warn/compare1.C +++ b/gcc/testsuite/g++.old-deja/g++.warn/compare1.C @@ -1,5 +1,5 @@ // { dg-do assemble } -// { dg-options "-ansi -pedantic-errors -Wsign-compare" } +// { dg-options "-ansi -pedantic-errors -Wsign-compare -Wno-deprecated" } // Copyright (C) 2001 Free Software Foundation, Inc. // Contributed by Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 5/13/2001 diff --git a/gcc/testsuite/gcc.apple/4090661.c b/gcc/testsuite/gcc.apple/4090661.c new file mode 100644 index 00000000000..b460b46243c --- /dev/null +++ b/gcc/testsuite/gcc.apple/4090661.c @@ -0,0 +1,9 @@ +/* APPLE LOCAL file 4090661 */ +/* { dg-do compile { target "*-*-darwin*" } } */ +const char c29[] = "12345678901234567890123456789"; +const char c30[] = "123456789012345678901234567890"; +const char c31[] = "1234567890123456789012345678901"; +const char *p29 = "12345678901234567890123456789"; +const char *p30 = "123456789012345678901234567890"; +const char *p31 = "1234567890123456789012345678901"; +/* { dg-final { scan-assembler-not "align 5" } } */ diff --git a/gcc/testsuite/gcc.apple/4100712.c b/gcc/testsuite/gcc.apple/4100712.c new file mode 100644 index 00000000000..7298a3fa7c4 --- /dev/null +++ b/gcc/testsuite/gcc.apple/4100712.c @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +void foo(void *pdst, short i, double *sp, + short xsize, short dorder, short strided) +{ + unsigned short *dp = (unsigned short*)pdst + i*strided; + short j, k; + if (strided == xsize) + { + for (j = 0; j < (xsize << dorder); j++) + { + double x = sp[2*j]; + if (x >= (32767 * 2 + 1)) + x = (32767 * 2 + 1); + if (x <= 0) x + = 0; + dp[j] = (short) x; + } + } + else + { + for (k = 0; k < (1 << dorder); k++) + { + for (j = 0; j < xsize; j++) + { + double x = sp[2*j]; + if (x >= (32767 * 2 + 1)) + x = (32767 * 2 + 1); + if (x <= 0) + x = 0; + dp[j] = (short) x; + } + sp += 2*xsize; + dp += strided; + } + } +} diff --git a/gcc/testsuite/gcc.apple/4101687.c b/gcc/testsuite/gcc.apple/4101687.c new file mode 100644 index 00000000000..0655cb0e0f2 --- /dev/null +++ b/gcc/testsuite/gcc.apple/4101687.c @@ -0,0 +1,26 @@ +/* APPLE LOCAL file 4101687 */ +/* { dg-do run } */ +/* { dg-options "-Os" } */ +#include <stdlib.h> + +void +fill(char *buf) +{ + int i; + + for (i = 0; i < 16; i++) { + buf[i+i] = 2; + buf[i+i+1] = 3; + } + buf[i+i] = '\0'; +} + +int main() +{ + char buf[33]; + + fill(buf); + if (buf[16] == '\0') + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.apple/4102133.c b/gcc/testsuite/gcc.apple/4102133.c new file mode 100644 index 00000000000..90d13c77f0b --- /dev/null +++ b/gcc/testsuite/gcc.apple/4102133.c @@ -0,0 +1,22 @@ +/* APPLE LOCAL file 4102133 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +struct { +int k_; +} detwfn_; +struct { +double x_[1]; +} fmcom_; +void gciprt_(int *iw_) +{ +int Tmp8, ibcon_, iwrk_, ibo_, jstsym_, lcivec_, iacon_, igmul_; +int i_, nsym_, ipica_, ipicb_; +ibo_ = iwrk_ + 43; +Tmp8 = detwfn_.k_; +for(i_ = 1;i_ <= Tmp8;i_++) { + gcisym_(iw_,&fmcom_.x_[lcivec_ + -1],&fmcom_.x_[ipica_ + -1],&fmcom_.x_[ipicb_ + -1], + &fmcom_.x_[iacon_ + -1],&fmcom_.x_[ibcon_ + -1],&fmcom_.x_[igmul_ + -1],&nsym_, + &fmcom_.x_[iwrk_ + -1],&fmcom_.x_[ibo_ + -1],&jstsym_); +} +return ; +} diff --git a/gcc/testsuite/gcc.apple/4104248.c b/gcc/testsuite/gcc.apple/4104248.c new file mode 100644 index 00000000000..5cbf564f3d7 --- /dev/null +++ b/gcc/testsuite/gcc.apple/4104248.c @@ -0,0 +1,9 @@ +/* APPLE LOCAL file 4104248 */ +/* { dg-do compile { target "i?86*-*-darwin*" } } +/* { dg-options "-Os" } */ +register char foo asm("edi"); +char x; +int bar() { + foo = x; +} +/* { dg-final { scan-assembler "movzbl" } } */ diff --git a/gcc/testsuite/gcc.apple/4113078.c b/gcc/testsuite/gcc.apple/4113078.c new file mode 100644 index 00000000000..37ff9d76948 --- /dev/null +++ b/gcc/testsuite/gcc.apple/4113078.c @@ -0,0 +1,17 @@ +/* APPLE LOCAL file 4113078 */ +/* Check that stack alignment is correct when callee inlined function uses + a vector and caller does not. */ +/* { dg-do compile { target i?86-*-darwin* } } */ +/* { dg-options "-O2 -msse3 -march=pentium4 -march=prescott" } */ +#include <xmmintrin.h> +extern void bar(__m128i*); +__m128i *global; +static void vfunc(void) { + volatile __m128i xone = _mm_cvtsi32_si128(0x00010001); + global = (__m128i*)&xone; +} +void baz() { + int x; + vfunc(); +} +/* { dg-final { scan-assembler "\\-24\\(\\%ebp\\)" } } */ diff --git a/gcc/testsuite/gcc.apple/Wextra-tokens.c b/gcc/testsuite/gcc.apple/Wextra-tokens.c new file mode 100644 index 00000000000..08b3cb7745c --- /dev/null +++ b/gcc/testsuite/gcc.apple/Wextra-tokens.c @@ -0,0 +1,21 @@ +/* APPLE LOCAL file -Wextra-tokens */ +/* Lifted from gcc.dg/cpp/extratokens2.c. */ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-fno-show-column -Wextra-tokens" } */ + +/* Tests that -Wextra-tokens correctly enables the checks + that are disabled by default. */ + +#if 1 +#if 0 +#else foo /* { dg-warning "extra tokens" "bad warning" } */ +#endif / /* { dg-warning "extra tokens" "bad warning" } */ +#endif + +# 36 "file.c" 3 + +/* ... but in a system header, it's acceptable. */ +#ifdef KERNEL +#endif KERNEL /* { dg-bogus "extra tokens" "bad warning" } */ diff --git a/gcc/testsuite/gcc.apple/Wfour-char-constants-1.c b/gcc/testsuite/gcc.apple/Wfour-char-constants-1.c new file mode 100644 index 00000000000..536396454b7 --- /dev/null +++ b/gcc/testsuite/gcc.apple/Wfour-char-constants-1.c @@ -0,0 +1,12 @@ +/* APPLE LOCAL file -Wfour-char-constants */ +/* We warn by default on Darwin, so no specific option needed. */ + +/* { dg-do compile { target "*-*-darwin*" } } */ +/* { dg-options "" } */ + +int glob1 = 'a'; +int glob2 = 'ab'; /* { dg-warning "multi-character character constant" } */ +int glob3 = 'abc'; /* { dg-warning "multi-character character constant" } */ +int glob4 = 'abcd'; /* say nothing */ +int glob5 = 'abcde'; /* { dg-warning "character constant too long" } */ + diff --git a/gcc/testsuite/gcc.apple/Wfour-char-constants-2.c b/gcc/testsuite/gcc.apple/Wfour-char-constants-2.c new file mode 100644 index 00000000000..14115ba6fea --- /dev/null +++ b/gcc/testsuite/gcc.apple/Wfour-char-constants-2.c @@ -0,0 +1,12 @@ +/* APPLE LOCAL file -Wfour-char-constants */ +/* Explicitly enable the warning. */ + +/* { dg-do compile } */ +/* { dg-options "-Wfour-char-constants" } */ + +int glob1 = 'a'; +int glob2 = 'ab'; /* { dg-warning "multi-character character constant" } */ +int glob3 = 'abc'; /* { dg-warning "multi-character character constant" } */ +int glob4 = 'abcd'; /* { dg-warning "multi-character character constant" } */ +int glob5 = 'abcde'; /* { dg-warning "character constant too long" } */ + diff --git a/gcc/testsuite/gcc.apple/Wmost.c b/gcc/testsuite/gcc.apple/Wmost.c new file mode 100644 index 00000000000..6e1d3342539 --- /dev/null +++ b/gcc/testsuite/gcc.apple/Wmost.c @@ -0,0 +1,19 @@ +/* APPLE LOCAL file -Wmost */ + +/* { dg-do compile } */ +/* { dg-options "-Wmost" } */ + +int baz (void); + +int +foo () +{ + int loc; + + bar (); /* { dg-warning "implicit declaration" } */ + + if (loc = baz ()) /* be quiet about this */ + return 1; + return 0; +} + diff --git a/gcc/testsuite/gcc.apple/Wno-newline-1.c b/gcc/testsuite/gcc.apple/Wno-newline-1.c new file mode 100644 index 00000000000..44eab6e533c --- /dev/null +++ b/gcc/testsuite/gcc.apple/Wno-newline-1.c @@ -0,0 +1,3 @@ +/* Test no newline at eof warning. */ +/* { dg-do compile } */ +int main() { return 0; }
\ No newline at end of file diff --git a/gcc/testsuite/gcc.apple/Wno-newline-2.c b/gcc/testsuite/gcc.apple/Wno-newline-2.c new file mode 100644 index 00000000000..74acf1afa68 --- /dev/null +++ b/gcc/testsuite/gcc.apple/Wno-newline-2.c @@ -0,0 +1,4 @@ +/* Test no newline at eof warning. */ +/* { dg-do compile } */ +/* { dg-options "-Wnewline-eof" } */ +int main() { return 0; } /* { dg-warning "no newline" } */
\ No newline at end of file diff --git a/gcc/testsuite/gcc.apple/align-func.c b/gcc/testsuite/gcc.apple/align-func.c new file mode 100644 index 00000000000..0633cbc2277 --- /dev/null +++ b/gcc/testsuite/gcc.apple/align-func.c @@ -0,0 +1,4 @@ +/* APPLE LOCAL file 4096997 */ +/* { dg-do compile } */ +/* { dg-options "-falign-functions=4" } */ +main() {} diff --git a/gcc/testsuite/gcc.apple/align-test-1.c b/gcc/testsuite/gcc.apple/align-test-1.c new file mode 100644 index 00000000000..e8493c0e260 --- /dev/null +++ b/gcc/testsuite/gcc.apple/align-test-1.c @@ -0,0 +1,613 @@ +/* APPLE LOCAL file Macintosh alignment */ + +/* { dg-do run } */ +/* { dg-options "-Wno-long-long" } */ + +/* + * Macintosh compiler alignment test for C. + * Fred Forsman + * Apple Computer, Inc. + */ + +#include <stdio.h> +#include <stddef.h> +#include <string.h> + +#define Q(x) #x, x + +typedef unsigned char UINT8; + +static int bad_option = 0; +static int flag_verbose = 0; +static int nbr_failures = 0; + +/* === basic types === */ + +typedef struct B1 { + char f1; + UINT8 f2; +} B1; + +typedef struct B2 { + short f1; + UINT8 f2; +} B2; + +typedef struct B3 { + long f1; + UINT8 f2; +} B3; + +typedef struct B4 { + int f1; + UINT8 f2; +} B4; + +typedef struct B5 { + float f1; + UINT8 f2; +} B5; + +/* doubles, long longs, and vectors are treated separately below. */ + +/* === enums === */ + +typedef enum E1 { + e1_b = 0, + e1_e = 255 +} E1; + +typedef enum E2 { + e2_b = -256, + e2_e = 255 +} E2; + +typedef enum E3 { + e3_b = 0, + e3_e = 32767 +} E3; + +typedef enum E4 { + e4_b = 0, + e4_e = 65536 +} E4; + +/* === pointers === */ + +typedef struct P1 { + char * f1; + UINT8 f2; +} P1; + +typedef struct P2 { + long * f1; + UINT8 f2; +} P2; + +typedef struct P3 { + double * f1; + UINT8 f2; +} P3; + +typedef struct P4 { + long long * f1; + UINT8 f2; +} P4; + +typedef struct P5 { + void (* f1) (void); + UINT8 f2; +} P5; + +#ifdef __VEC__ +typedef struct P61 { + vector signed short * f1; + UINT8 f2; +} P6; +#endif + +/* === vectors === */ + +#ifdef __VEC__ +typedef struct V1 { + vector signed short f1; + UINT8 f2; +} V1; + +typedef struct V2 { + V1 f1; + UINT8 f2; +} V2; + +typedef struct V3 { + UINT8 f1; + vector signed short f2; +} V3; + +typedef struct V4 { + V3 f1; + UINT8 f2; +} V4; +#endif + +/* === doubles === */ + +typedef struct D1 { + double f1; + UINT8 f2; +} D1; + +typedef struct D2 { + D1 f1; + UINT8 f2; +} D2; + +typedef struct D3 { + UINT8 f1; + double f2; +} D3; + +typedef struct D4 { + D3 f1; + UINT8 f2; +} D4; + +typedef struct D5 { + UINT8 f1; + D3 f2; +} D5; + +typedef struct D6 { + double f1; + UINT8 f2; + double f3; +} D6; + +typedef struct D7 { + UINT8 f1; + D1 f2; +} D7; + +/* === long longs === */ + +typedef struct LL1 { + long long f1; + UINT8 f2; +} LL1; + +typedef struct LL2 { + LL1 f1; + UINT8 f2; +} LL2; + +typedef struct LL3 { + UINT8 f1; + long long f2; +} LL3; + +typedef struct LL4 { + LL3 f1; + UINT8 f2; +} LL4; + +typedef struct LL5 { + UINT8 f1; + LL3 f2; +} LL5; + +/* === arrays === */ + +typedef struct A1 { + short f1[4]; + UINT8 f2; +} A1; + +typedef struct A2 { + A1 f1; + UINT8 f2; +} A2; + +typedef struct A3 { + double f1[4]; + UINT8 f2; +} A3; + +typedef struct A4 { + A3 f1; + UINT8 f2; +} A4; + +typedef struct A5 { + long long f1[4]; + UINT8 f2; +} A5; + +typedef struct A6 { + A5 f1; + UINT8 f2; +} A6; + +#ifdef __VEC__ +typedef struct A7 { + vector signed short f1[4]; + UINT8 f2; +} A7; + +typedef struct A8 { + A7 f1; + UINT8 f2; +} A8; +#endif + +typedef struct A9 { + D1 f1[4]; + UINT8 f2; +} A9; + +typedef struct A10 { + A9 f1; + UINT8 f2; +} A10; + +/* === unions === */ + +typedef union U1 { + UINT8 f1; + double f2; +} U1; + +typedef struct U2 { + U1 f1; + UINT8 f2; +} U2; + +typedef union U3 { + UINT8 f1; + long long f2; +} U3; + +typedef struct U4 { + U3 f1; + UINT8 f2; +} U4; + +#ifdef __VEC__ +typedef union U5 { + UINT8 f1; + vector signed short f2; +} U5; + +typedef struct U6 { + U5 f1; + UINT8 f2; +} U6; +#endif + +typedef union U7 { + UINT8 f1; + short f2[4]; +} U7; + +typedef struct U8 { + U7 f1; + UINT8 f2; +} U8; + +/* === misc === */ + +typedef struct { /* unnamed struct */ + long long f1; + UINT8 f2; +} M0; + +typedef struct M1 { + UINT8 f1[8]; +} M1; + +typedef struct M2 { + M1 f1; + UINT8 f2; +} M2; + +typedef struct M3 { + UINT8 f1; + M1 f2; +} M3; + +typedef struct M4 { /* M4 & M5: see corresponding mac68k tests (M68K11 & M68K12) */ + UINT8 f1[9]; +} M4; + +typedef struct M5 { + UINT8 f1; + M4 f2; +} M5; + +/* === mac68k === */ + +#ifndef __LP64__ +#pragma options align=mac68k + +typedef struct M68K0 { + long f1; + UINT8 f2; +} M68K0; + +typedef struct M68K1 { + double f1; + UINT8 f2; +} M68K1; + +#pragma options align=reset + +typedef struct M68K2 { + M68K1 f1; + UINT8 f2; +} M68K2; + +#ifdef __VEC__ +#pragma options align=mac68k + +typedef struct M68K3 { + vector signed short f1; + UINT8 f2; +} M68K3; + +typedef struct M68K4 { + M68K3 f1; + UINT8 f2; +} M68K4; + +#pragma options align=reset + +typedef struct M68K5 { + M68K3 f1; + UINT8 f2; +} M68K5; + +#pragma options align=mac68k + +typedef struct M68K6 { + UINT8 f1; + vector signed short f2; +} M68K6; + +#pragma options align=reset +#endif /* __VEC__ */ + +#pragma options align=mac68k + +typedef struct M68K7 { + UINT8 f1; +} M68K7; + +typedef union M68K8 { + UINT8 f1; +} M68K8; + +typedef struct M68K9 { + UINT8 f1; + int f2; + UINT8 f3; +} M68K9; + +#pragma options align=reset + +typedef struct M68K10 { + UINT8 f1; + M68K9 f2; +} M68K10; + +#pragma options align=mac68k + +typedef struct M68K11 { /* M68K11 & M68K12: see corresponding power tests (M4 & M5) */ + UINT8 f1[9]; +} M68K11; + +typedef struct M68K12 { + UINT8 f1; + M68K11 f2; +} M68K12; + +typedef struct M68K13 { + UINT8 f1; + UINT8 f2[5]; +} M68K13; + +#pragma options align=reset +#endif /* n __LP64__ */ + +static void check(char * rec_name, int actual, int expected32, int expected64, + int expected_ia32, char * comment) +{ + int expected; +#ifdef __i386__ + expected = expected_ia32; +#else + expected = ((sizeof(char *) == 8) ? expected64 : expected32); +#endif + if (flag_verbose || (actual != expected)) { + printf("%-20s = %2d (%2d) ", rec_name, actual, expected); + if (actual != expected) { + printf("*** FAIL"); + nbr_failures++; + } else + printf(" PASS"); + printf(": %s\n", comment); + } +} + +static void check_option(char *option) +{ + if (*option == '-') { + if (strcmp(option, "-v") == 0) + flag_verbose = 1; + else { + fprintf(stderr, "*** unrecognized option '%s'.\n", option); + bad_option = 1; + } + } else { + fprintf(stderr, "*** unrecognized option '%s'.\n", option); + bad_option = 1; + } +} + +int main(int argc, char *argv[]) +{ + int i; + + for (i = 1; i < argc; i++) + check_option(argv[i]); + + if (bad_option) + return 1; + + /* === basic data types === */ + + check(Q(sizeof(char)), 1, 1, 1, "char data type"); + check(Q(sizeof(signed char)), 1, 1, 1, "signed char data type"); + check(Q(sizeof(unsigned char)), 1, 1, 1, "unsigned char data type"); + check(Q(sizeof(short)), 2, 2, 2, "short data type"); + check(Q(sizeof(signed short)), 2, 2, 2, "signed short data type"); + check(Q(sizeof(unsigned short)), 2, 2, 2, "unsigned short data type"); + check(Q(sizeof(long)), 4, 8, 4, "short long type"); + check(Q(sizeof(signed long)), 4, 8, 4, "signed long data type"); + check(Q(sizeof(unsigned long)), 4, 8, 4, "unsigned long data type"); + check(Q(sizeof(int)), 4, 4, 4, "short int type"); + check(Q(sizeof(signed int)), 4, 4, 4, "signed int data type"); + check(Q(sizeof(unsigned int)), 4, 4, 4, "unsigned int data type"); + check(Q(sizeof(float)), 4, 4, 4, "float type"); + check(Q(sizeof(double)), 8, 8, 8, "double data type"); + check(Q(sizeof(long long)), 8, 8, 8, "long long data type"); + check(Q(sizeof(signed long long)), 8, 8, 8, "signed long long data type"); + check(Q(sizeof(unsigned long long)), 8, 8, 8, "unsigned long long data type"); + + check(Q(sizeof(B1)), 2, 2, 2, "char as 1st field"); + check(Q(sizeof(B2)), 4, 4, 4, "short as 1st field"); + check(Q(sizeof(B3)), 8, 16, 8, "long as 1st field"); + check(Q(sizeof(B4)), 8, 8, 8, "int as 1st field"); + check(Q(sizeof(B5)), 8, 8, 8, "float as 1st field"); + + /* === enums === */ + + check(Q(sizeof(E1)), 4, 4, 4, "enum with range 0..255"); + check(Q(sizeof(E2)), 4, 4, 4, "enum with range -256..255"); + check(Q(sizeof(E3)), 4, 4, 4, "enum with range 0..32767"); + check(Q(sizeof(E4)), 4, 4, 4, "enum with range 0..65536"); + + /* === pointers === */ + + check(Q(sizeof(P1)), 8, 16, 8, "char * as 1st field"); + check(Q(sizeof(P2)), 8, 16, 8, "long * as 1st field"); + check(Q(sizeof(P3)), 8, 16, 8, "double * as 1st field"); + check(Q(sizeof(P4)), 8, 16, 8, "long long * as 1st field"); + check(Q(sizeof(P5)), 8, 16, 8, "function * as 1st field"); + +#ifdef __VEC__ + check(Q(sizeof(P6)), 8, 16, 8, "vector signed short * as 1st field"); +#endif + +#ifdef __VEC__ + /* === vectors === */ + + /* ??? Do we want to test all the possible vector data types? ??? */ + check(Q(sizeof(vector signed short)), 16, 16, 16, "vector signed short data type"); + + check(Q(sizeof(V1)), 32, 32, 32, "vector as 1st field"); + check(Q(sizeof(V2)), 48, 48, 48, "embedding struct with vector as 1st field"); + check(Q(sizeof(V3)), 32, 32, 32, "vector as 2nd field"); + check(Q(offsetof(V3, f2)), 16, 16, 16, "offset of vector as 2nd field"); + check(Q(sizeof(V4)), 48, 48, 48, "embedding struct with vector as 2nd field"); +#endif + + /* === doubles === */ + + check(Q(sizeof(D1)), 16, 16, 12, "double as 1st field"); + check(Q(sizeof(D2)), 24, 24, 16, "embedding struct with double as 1st field"); + check(Q(sizeof(D3)), 12, 16, 12, "double as 2nd field"); + check(Q(offsetof(D3, f2)), 4, 8, 4, "offset of double as 2nd field"); + check(Q(sizeof(D4)), 16, 24, 16, "embedding struct with double as 2nd field"); + check(Q(sizeof(D5)), 16, 24, 16, "struct with double as 2nd field"); + check(Q(offsetof(D5, f2)), 4, 8, 4, "offset of struct with double as 2nd field"); + check(Q(sizeof(D6)), 24, 24, 20, "struct with double, char, double"); + check(Q(offsetof(D6, f3)), 12, 16, 12, "offset of 2nd double in struct with double, char, double"); + check(Q(sizeof(D7)), 20, 24, 16, "struct with double as 2nd field of another struct"); + check(Q(offsetof(D7, f2)), 4, 8, 4, "offset of struct with double as 2nd field of another struct"); + + /* === long longs === */ + + check(Q(sizeof(LL1)), 16, 16, 12, "long long as 1st field"); + check(Q(sizeof(LL2)), 24, 24, 16, "embedding struct with long long as 1st field"); + check(Q(sizeof(LL3)), 12, 16, 12, "long long as 2nd field"); + check(Q(offsetof(LL3, f2)), 4, 8, 4, "offset of long long as 2nd field"); + check(Q(sizeof(LL4)), 16, 24, 16, "embedding struct with long long as 2nd field"); + check(Q(sizeof(LL5)), 16, 24, 16, "struct with long long as 2nd field"); + check(Q(offsetof(LL5, f2)), 4, 8, 4, "offset of struct with long long as 2nd field"); + + /* === arrays === */ + + check(Q(sizeof(A1)), 10, 10, 10, "array of shorts as 1st field"); + check(Q(sizeof(A2)), 12, 12, 12, "embedding struct with array of shorts as 1st field"); + check(Q(sizeof(A3)), 40, 40, 36, "array of doubles as 1st field"); + check(Q(sizeof(A4)), 48, 48, 40, "embedding struct with array of doubles as 1st field"); + check(Q(sizeof(A5)), 40, 40, 36, "array of long longs as 1st field"); + check(Q(sizeof(A6)), 48, 48, 40, "embedding struct with array of long longs as 1st field"); +#ifdef __VEC__ + check(Q(sizeof(A7)), 80, 80, 80, "array of vectors as 1st field"); + check(Q(sizeof(A8)), 96, 96, 96, "embedding struct with array of vectors as 1st field"); +#endif + check(Q(sizeof(A9)), 72, 72, 52, "array of structs as 1st field"); + check(Q(sizeof(A10)), 80, 80, 56, "embedding struct with array of structs as 1st field"); + + /* === unions === */ + + check(Q(sizeof(U1)), 8, 8, 8, "union with double"); + check(Q(sizeof(U2)), 16, 16, 12, "embedding union with double"); + check(Q(sizeof(U3)), 8, 8, 8, "union with long long"); + check(Q(sizeof(U4)), 16, 16, 12, "embedding union with long long"); +#if __VEC__ + check(Q(sizeof(U5)), 16, 16, 16, "union with vector"); + check(Q(sizeof(U6)), 32, 32, 32, "embedding union with vector"); +#endif + check(Q(sizeof(U7)), 8, 8, 8, "union with array of shorts"); + check(Q(sizeof(U8)), 10, 10, 10, "embedding union with array of shorts"); + + /* === misc === */ + + check(Q(sizeof(M0)), 16, 16, 12, "untagged struct with long long as 1st field"); + check(Q(sizeof(M1)), 8, 8, 8, "array[8] of char"); + check(Q(sizeof(M2)), 9, 9, 9, "embedding struct with array[8] of char as 1st field"); + check(Q(sizeof(M3)), 9, 9, 9, "embedding struct with array[8] of char as 2nd field"); + check(Q(offsetof(M3, f2)), 1, 1, 1, "offset of struct with array[8] of char as 2nd field"); + check(Q(sizeof(M4)), 9, 9, 9, "odd size struct: array[9] of char"); + check(Q(sizeof(M5)), 10, 10, 10, "embedding odd size struct"); + + /* === mac68k mode === */ + +#ifndef __LP64__ + check(Q(sizeof(M68K0)), 6, 6, 6, "mac68k struct with long"); + check(Q(sizeof(M68K1)), 10, 10, 10, "mac68k struct with double as 1st field"); + check(Q(sizeof(M68K2)), 12, 12, 12, "embedding mac68k struct with double as 1st field"); +#ifdef __VEC__ + check(Q(sizeof(M68K3)), 32, 32, 32, "mac68k struct with vector as 1st field"); + check(Q(sizeof(M68K4)), 48, 48, 48, "embedding mac68k struct with vector as 1st field in a mac68k struct"); + check(Q(sizeof(M68K5)), 48, 48, 48, "embedding mac68k struct with vector as 1st field in a power struct"); + check(Q(offsetof(M68K6, f2)), 16, 16, 16, "offset of vector as 2nd field in a mac68k struct"); +#endif + check(Q(sizeof(M68K7)), 2, 2, 2, "padding of mac68k struct with one char"); + check(Q(sizeof(M68K8)), 2, 2, 2, "padding of mac68k union with one char"); + check(Q(sizeof(M68K9)), 8, 8, 8, "padding of mac68k struct"); + check(Q(offsetof(M68K9, f2)), 2, 2, 2, "offset of int as 2nd field in a mac68k struct"); + check(Q(sizeof(M68K10)), 10, 10, 10, "power struct with embedded mac68k struct"); + check(Q(offsetof(M68K10, f2)), 2, 2, 2, "offset of mac68k struct as 2nd field in a power struct"); + check(Q(sizeof(M68K11)), 10, 10, 10, "odd size struct (before padding): array[9] of char"); + check(Q(sizeof(M68K12)), 12, 12, 12, "embedding odd size struct (before padding)"); + check(Q(sizeof(M68K13)), 6, 6, 6, "array of char at odd addr in mac68k struct"); + check(Q(offsetof(M68K13, f2)), 1, 1, 1, "offset of array of char at odd addr in mac68k struct"); +#endif + + if (nbr_failures > 0) + return 1; + else + return 0; +} diff --git a/gcc/testsuite/gcc.apple/align-test-2.c b/gcc/testsuite/gcc.apple/align-test-2.c new file mode 100644 index 00000000000..c78b8e390a4 --- /dev/null +++ b/gcc/testsuite/gcc.apple/align-test-2.c @@ -0,0 +1,163 @@ +/* APPLE LOCAL file Macintosh alignment */ + +/* { dg-do run } */ +/* { dg-options "-Wno-long-long" } */ + +/* + * Macintosh compiler alignment test for alignment extensions in GCC 3. + * Fred Forsman + * Apple Computer, Inc. + */ + + /* Check whether we are testing GCC 3 or later. */ +#ifdef __GNUC__ +#if __GNUC__ >= 3 + #define GCC3 1 +#endif +#endif + +#include <stdio.h> +#include <stddef.h> +#include <string.h> + +#define Q(x) #x, x + +typedef unsigned char UINT8; +typedef unsigned long UINT32; + +static int bad_option = 0; +static int flag_verbose = 0; +static int nbr_failures = 0; + +/* === alignment modes === */ + +typedef struct S1 { + UINT8 f1; +} S1; + +#ifndef __LP64__ +#pragma options align=mac68k + +typedef struct S2 { + UINT8 f1; +} S2; +#endif + +#pragma options align=native + +typedef struct S3 { + UINT8 f1; +} S3; + +#pragma options align=reset +/* Should be mac68k mode here. */ + +#ifndef __LP64__ +#pragma options align=reset +#endif +/* Should be power mode here. */ + +typedef struct S4 { + UINT8 f1; + double f2; +} S4; + +#pragma options align=natural + +typedef struct S5 { + UINT8 f1; + double f2; +} S5; + +typedef struct S6 { + UINT8 f1; + double f2; + UINT8 f3; +} S6; + +#pragma options align=reset +/* Should be power mode here. */ + +#pragma options align=packed + +typedef struct S7 { + UINT8 f1; + UINT32 f2; +} S7; + +#pragma options align=reset +/* Should be power mode here. */ + +typedef struct S8 { + UINT8 f1; + UINT32 f2; +} S8; + +static void check(char * rec_name, int actual, int expected32, int expected64, + int expected_ia32, char * comment) +{ + int expected; +#ifdef __i386__ + expected = expected_ia32; +#else + expected = ((sizeof(char *) == 8) ? expected64 : expected32); +#endif + if (flag_verbose || (actual != expected)) { + printf("%-20s = %2d (%2d) ", rec_name, actual, expected); + if (actual != expected) { + printf("*** FAIL"); + nbr_failures++; + } else + printf(" PASS"); + printf(": %s\n", comment); + } +} + +static void check_option(char *option) +{ + if (*option == '-') { + if (strcmp(option, "-v") == 0) + flag_verbose = 1; + else { + fprintf(stderr, "*** unrecognized option '%s'.\n", option); + bad_option = 1; + } + } else { + fprintf(stderr, "*** unrecognized option '%s'.\n", option); + bad_option = 1; + } +} + +int main(int argc, char *argv[]) +{ + int i; + + for (i = 1; i < argc; i++) + check_option(argv[i]); + + if (bad_option) + return 1; + +#ifndef GCC3 + printf("This test requires GCC 3"); + return 1; +#endif + + check(Q(sizeof(S1)), 1, 1, 1, "struct with 1 char; power mode"); +#ifndef __LP64__ + check(Q(sizeof(S2)), 2, 2, 2, "struct with 1 char; mac68k mode"); +#endif + check(Q(sizeof(S3)), 1, 1, 1, "struct with 1 char; native mode"); + check(Q(sizeof(S4)), 12, 16, 12, "struct with char, double; power/natural mode"); + check(Q(offsetof(S4, f2)), 4, 8, 4, "offset of double in a struct with char, double; power/natural mode"); + check(Q(sizeof(S5)), 16, 16, 12, "struct with char, double; natural mode"); + check(Q(offsetof(S5, f2)), 8, 8, 4, "offset of double in a struct with char, double; natural mode"); + check(Q(sizeof(S6)), 24, 24, 16, "struct with char, double, char; natural mode"); + check(Q(sizeof(S7)), 5, 9, 5, "struct with char, long; packed mode"); + check(Q(sizeof(S8)), 8, 16, 8, "struct with char, long; power/natural mode"); + + if (nbr_failures > 0) + return 1; + else + return 0; +} diff --git a/gcc/testsuite/gcc.apple/align-test-3.c b/gcc/testsuite/gcc.apple/align-test-3.c new file mode 100644 index 00000000000..ef806238508 --- /dev/null +++ b/gcc/testsuite/gcc.apple/align-test-3.c @@ -0,0 +1,136 @@ +/* APPLE LOCAL file Macintosh alignment */ + +/* { dg-do run } */ +/* { dg-options "-Wno-long-long" } */ + +/* + * GCC alignment test for alignment problems due to interactions + * between FSF and Macintosh alignment modes. + * Fred Forsman + * Apple Computer, Inc. + */ + +#ifdef __LP64__ +int main() +{ + return 0; +} +#else /* 32-bit */ + + /* Check whether we are testing GCC 3 or later. */ +#ifdef __GNUC__ +#if __GNUC__ >= 3 +#define GCC3 1 +#else +#define GCC3 0 +#endif +#endif + +#include <stdio.h> +#include <stddef.h> +#include <string.h> + +#define Q(x) #x, x + +typedef unsigned char UINT8; +typedef unsigned long UINT32; + +static int bad_option = 0; +static int flag_verbose = 0; +static int nbr_failures = 0; + +/* === alignment modes === */ + +#pragma options align=power +#pragma options align=mac68k +#pragma pack(1) + +typedef struct S0 { + UINT32 f1; + UINT8 f2; +} S0; + +#pragma options align=reset + +/* We should be back in mac68k alignment, if #pragma option align=reset + can rest a #pragma pack(n). So check for mac68k alignment. */ + +typedef struct S1 { + UINT32 f1; + UINT8 f2; +} S1; + +#if GCC3 +#pragma options align=power +#pragma options align=mac68k +//#pragma pack(push, 1) +//#pragma pack(pop) +#pragma pack(1) +#pragma pack() + +/* We should be back in mac68k alignment, if #pragma pack() + can reset a #pragma pack(n). So check for mac68k alignment. */ + +typedef struct S2 { + UINT32 f1; + UINT8 f2; +} S2; +#endif /* GCC3 */ + +static void check(char * rec_name, int actual, int expected_ppc32, int expected_ia32, char * comment) +{ + int expected; +#ifdef __i386__ + expected = expected_ia32; +#else + expected = expected_ppc32; +#endif + if (flag_verbose || (actual != expected)) { + printf("%-20s = %2d (%2d) ", rec_name, actual, expected); + if (actual != expected) { + printf("*** FAIL"); + nbr_failures++; + } else + printf(" PASS"); + printf(": %s\n", comment); + } +} + +static void check_option(char *option) +{ + if (*option == '-') { + if (strcmp(option, "-v") == 0) + flag_verbose = 1; + else { + fprintf(stderr, "*** unrecognized option '%s'.\n", option); + bad_option = 1; + } + } else { + fprintf(stderr, "*** unrecognized option '%s'.\n", option); + bad_option = 1; + } +} + +int main(int argc, char *argv[]) +{ + int i; + + for (i = 1; i < argc; i++) + check_option(argv[i]); + + if (bad_option) + return 1; + + check(Q(sizeof(S0)), 5, 5, "struct with 1 long, 1 char; pack(1) mode"); + check(Q(sizeof(S1)), 6, 6, "struct with 1 long, 1 char; should be mac68k mode"); +#if GCC3 + check(Q(sizeof(S2)), 6, 6, "struct with 1 long, 1 char; should be mac68k mode"); +#endif + + if (nbr_failures > 0) + return 1; + else + return 0; +} + +#endif /* 32-bit */ diff --git a/gcc/testsuite/gcc.apple/align-test-4.c b/gcc/testsuite/gcc.apple/align-test-4.c new file mode 100644 index 00000000000..dec805161f4 --- /dev/null +++ b/gcc/testsuite/gcc.apple/align-test-4.c @@ -0,0 +1,233 @@ +/* APPLE LOCAL file Macintosh alignment */ + +/* { dg-do run } */ +/* { dg-options "-Wno-long-long" } */ + +/* + * GCC alignment test for bit-fields. + * This came up initially as an alignment problem in the kernel. + * Fred Forsman + * Apple Computer, Inc. + */ + + /* Check whether we are testing GCC 3 or later. */ +#ifdef __GNUC__ +#if __GNUC__ >= 3 +#define GCC3 1 +#else +#define GCC3 0 +#endif +#endif + +#include <stdio.h> +#include <stddef.h> +#include <string.h> + +/* + * The following defined determines whether we should compare against + * the values produced by GCC 2.95 or against the values I expect given + * my understanding of the alignment rules. + */ +#define USE_GCC2_VALUES 1 + +#define NAME2(name,mode) mode##_##name +#define NAME(name,mode) NAME2(name,mode) + +#define STR(s) #s +#define SIZEOF3(name) STR(sizeof(name)), sizeof(name) +#define SIZEOF2(name,mode) SIZEOF3(mode##_##name) +#define SIZEOF(name,mode) SIZEOF2(name,mode) + +#define OFFSETOF3(name,field) STR(offsetof(name,field)), offsetof(name,field) +#define OFFSETOF2(name,mode,field) OFFSETOF3(mode##_##name,field) +#define OFFSETOF(name,mode,field) OFFSETOF2(name,mode,field) + +typedef unsigned char UINT8; +typedef unsigned long UINT32; + +static int bad_option = 0; +static int flag_verbose = 0; +static int nbr_failures = 0; + +/* === mac68k alignment problem in kernel === */ + +typedef unsigned PEF_UBits32, ByteCount; +typedef short SInt16; + +/* === power === */ +#pragma options align=power +#define MODE power +#include "align-test-4.h" + +#ifndef __LP64__ +/* === mac68k === */ +#pragma options align=mac68k +#undef MODE +#define MODE mac68k +#include "align-test-4.h" +#endif + +/* === pack(2) === */ +#pragma pack(2) +#undef MODE +#define MODE pack2 +#include "align-test-4.h" + + +static void check(char * rec_name, int actual, int expected32, int expected64, + int expected_ia32, char * comment) +{ + int expected; +#ifdef __i386__ + expected = expected_ia32; +#else + expected = ((sizeof(char *) == 8) ? expected64 : expected32); +#endif + if (flag_verbose || (actual != expected)) { + printf("%-30s = %2d (%2d) ", rec_name, actual, expected); + if (actual != expected) { + printf("*** FAIL"); + nbr_failures++; + } else + printf(" PASS"); + printf(": %s\n", comment); + } +} + +static void check_option(char *option) +{ + if (*option == '-') { + if (strcmp(option, "-v") == 0) + flag_verbose = 1; + else { + fprintf(stderr, "*** unrecognized option '%s'.\n", option); + bad_option = 1; + } + } else { + fprintf(stderr, "*** unrecognized option '%s'.\n", option); + bad_option = 1; + } +} + +int main(int argc, char *argv[]) +{ + int i; + + for (i = 1; i < argc; i++) + check_option(argv[i]); + + if (bad_option) + return 1; + +#undef MODE +#define MODE power + +#if USE_GCC2_VALUES + check(SIZEOF(LoaderExport, MODE), 12, 12, 12, "kernel struct"); + check(OFFSETOF(LoaderExport, MODE, offset), 4, 4, 4, "offset of offset"); + check(OFFSETOF(LoaderExport, MODE, sectionNumber), 8, 8, 8, "offset of sectionNumber"); + check(SIZEOF(S1, MODE), 8, 8, 8, "bitfields & char"); + check(SIZEOF(S2, MODE), 8, 8, 8, "int & char"); + check(SIZEOF(S3, MODE), 12, 12, 12, "char, bitfields(32), char"); + check(OFFSETOF(S3, MODE, f3), 8, 8, 8, "offset of 2nd char"); + check(SIZEOF(S4, MODE), 8, 8, 8, "char, bitfields(32), char"); + check(OFFSETOF(S4, MODE, f3), 7, 7, 7, "offset of 2nd char"); + check(SIZEOF(S5, MODE), 4, 4, 4, "char, bitfields(16), char"); + check(OFFSETOF(S5, MODE, f3), 3, 3, 3, "offset of 2nd char"); + check(SIZEOF(S6, MODE), 4, 4, 4, "char, bitfields(8), char"); + check(OFFSETOF(S6, MODE, f3), 2, 2, 2, "offset of 2nd char"); +#else + check(SIZEOF(LoaderExport, MODE), 12, 12, "kernel struct"); + check(OFFSETOF(LoaderExport, MODE, offset), 4, 4, "offset of offset"); + check(OFFSETOF(LoaderExport, MODE, sectionNumber), 8, 8, "offset of sectionNumber"); + check(SIZEOF(S1, MODE), 8, 8, "bitfields & char"); + check(SIZEOF(S2, MODE), 8, 8, "int & char"); + check(SIZEOF(S3, MODE), 12, 12, "char, bitfields(32), char"); + check(OFFSETOF(S3, MODE, f3), 8, 8, "offset of 2nd char"); + check(SIZEOF(S4, MODE), 12, 12, "char, bitfields(32), char"); + check(OFFSETOF(S4, MODE, f3), 8, 8, "offset of 2nd char"); + check(SIZEOF(S5, MODE), 12, 12, "char, bitfields(16), char"); + check(OFFSETOF(S5, MODE, f3), 8, 8, "offset of 2nd char"); + check(SIZEOF(S6, MODE), 12, 12, "char, bitfields(8), char"); + check(OFFSETOF(S6, MODE, f3), 8, 8, "offset of 2nd char"); +#endif + +#ifndef __LP64__ +#undef MODE +#define MODE mac68k + +#if USE_GCC2_VALUES + check(SIZEOF(LoaderExport, MODE), 10, 10, 10, "kernel struct"); + check(OFFSETOF(LoaderExport, MODE, offset), 4, 4, 4, "offset of offset"); + check(OFFSETOF(LoaderExport, MODE, sectionNumber), 8, 8, 8, "offset of sectionNumber"); +#if 1 + // GCC 2 is wrong on the following. + check(SIZEOF(S1, MODE), 6, 6, 6, "bitfields & char"); +#else + check(SIZEOF(S1, MODE), 8, 8, "bitfields & char"); +#endif + check(SIZEOF(S2, MODE), 6, 6, 6, "int & char"); + check(SIZEOF(S3, MODE), 6, 6, 6, "char, bitfields(32), char"); + check(OFFSETOF(S3, MODE, f3), 5, 5, 5, "offset of 2nd char"); + check(SIZEOF(S4, MODE), 6, 6, 6, "char, bitfields(32), char"); + check(OFFSETOF(S4, MODE, f3), 5, 5, 5, "offset of 2nd char"); + check(SIZEOF(S5, MODE), 4, 4, 4, "char, bitfields(16), char"); + check(OFFSETOF(S5, MODE, f3), 3, 3, 3, "offset of 2nd char"); + check(SIZEOF(S6, MODE), 4, 4, 4, "char, bitfields(8), char"); + check(OFFSETOF(S6, MODE, f3), 2, 2, 2, "offset of 2nd char"); +#else + check(SIZEOF(LoaderExport, MODE), 10, 10, "kernel struct"); + check(OFFSETOF(LoaderExport, MODE, offset), 4, 4, "offset of offset"); + check(OFFSETOF(LoaderExport, MODE, sectionNumber), 8, 8, "offset of sectionNumber"); + check(SIZEOF(S1, MODE), 6, 6, "bitfields & char"); + check(SIZEOF(S2, MODE), 6, 6, "int & char"); + check(SIZEOF(S3, MODE), 8, 8, "char, bitfields(32), char"); + check(OFFSETOF(S3, MODE, f3), 6, 6, "offset of 2nd char"); + check(SIZEOF(S4, MODE), 8, 8, "char, bitfields(32), char"); + check(OFFSETOF(S4, MODE, f3), 6, 6, "offset of 2nd char"); + check(SIZEOF(S5, MODE), 6, 6, "char, bitfields(16), char"); + check(OFFSETOF(S5, MODE, f3), 4, 4, "offset of 2nd char"); + check(SIZEOF(S6, MODE), 4, 4, "char, bitfields(8), char"); + check(OFFSETOF(S6, MODE, f3), 2, 2, "offset of 2nd char"); +#endif +#endif /* n __LP64__ */ + +#undef MODE +#define MODE pack2 + +#if USE_GCC2_VALUES + check(SIZEOF(LoaderExport, MODE), 10, 10, 10, "kernel struct"); + check(OFFSETOF(LoaderExport, MODE, offset), 4, 4, 4, "offset of offset"); + check(OFFSETOF(LoaderExport, MODE, sectionNumber), 8, 8, 8, "offset of sectionNumber"); + /* GCC2 used to have this as '8', but it should really be 6. */ + check(SIZEOF(S1, MODE), 6, 6, 6, "bitfields & char"); + check(SIZEOF(S2, MODE), 6, 6, 6, "int & char"); + check(SIZEOF(S3, MODE), 6, 6, 6, "char, bitfields(32), char"); + check(OFFSETOF(S3, MODE, f3), 5, 5, 5, "offset of 2nd char"); + check(SIZEOF(S4, MODE), 6, 6, 6, "char, bitfields(32), char"); + check(OFFSETOF(S4, MODE, f3), 5, 5, 5, "offset of 2nd char"); + check(SIZEOF(S5, MODE), 4, 4, 4, "char, bitfields(16), char"); + check(OFFSETOF(S5, MODE, f3), 3, 3, 3, "offset of 2nd char"); + check(SIZEOF(S6, MODE), 4, 4, 4, "char, bitfields(8), char"); + check(OFFSETOF(S6, MODE, f3), 2, 2, 2, "offset of 2nd char"); +#else + check(SIZEOF(LoaderExport, MODE), 10, 10, "kernel struct"); + check(OFFSETOF(LoaderExport, MODE, offset), 4, 4, "offset of offset"); + check(OFFSETOF(LoaderExport, MODE, sectionNumber), 8, 8, "offset of sectionNumber"); + check(SIZEOF(S1, MODE), 6, 6, "bitfields & char"); + check(SIZEOF(S2, MODE), 6, 6, "int & char"); + check(SIZEOF(S3, MODE), 8, 8, "char, bitfields(32), char"); + check(OFFSETOF(S3, MODE, f3), 6, 6, "offset of 2nd char"); + check(SIZEOF(S4, MODE), 8, 8, "char, bitfields(32), char"); + check(OFFSETOF(S4, MODE, f3), 6, 6, "offset of 2nd char"); + check(SIZEOF(S5, MODE), 6, 6, "char, bitfields(16), char"); + check(OFFSETOF(S5, MODE, f3), 4, 4, "offset of 2nd char"); + check(SIZEOF(S6, MODE), 4, 4, "char, bitfields(8), char"); + check(OFFSETOF(S6, MODE, f3), 2, 2, "offset of 2nd char"); +#endif + + if (nbr_failures > 0) + return 1; + else + return 0; +} diff --git a/gcc/testsuite/gcc.apple/align-test-4.h b/gcc/testsuite/gcc.apple/align-test-4.h new file mode 100644 index 00000000000..f7c18727fee --- /dev/null +++ b/gcc/testsuite/gcc.apple/align-test-4.h @@ -0,0 +1,43 @@ +/* APPLE LOCAL file Macintosh alignment */ + +typedef struct { + PEF_UBits32 symClass : 8; + PEF_UBits32 nameOffset : 24; + ByteCount offset; + SInt16 sectionNumber; +} NAME(LoaderExport, MODE); + +typedef struct { + unsigned f1 : 32; + char f2; +} NAME(S1, MODE); + +typedef struct { + unsigned f1; + char f2; +} NAME(S2, MODE); + +typedef struct { + char f1; + unsigned f2 : 32; + char f3; +} NAME(S3, MODE); + +typedef struct { + char f1; + unsigned f2_1 : 8; + unsigned f2_2 : 24; + char f3; +} NAME(S4, MODE); + +typedef struct { + char f1; + unsigned f2 : 16; + char f3; +} NAME(S5, MODE); + +typedef struct { + char f1; + unsigned f2 : 8; + char f3; +} NAME(S6, MODE); diff --git a/gcc/testsuite/gcc.apple/align-test-5a.c b/gcc/testsuite/gcc.apple/align-test-5a.c new file mode 100644 index 00000000000..10c7d8ad7c3 --- /dev/null +++ b/gcc/testsuite/gcc.apple/align-test-5a.c @@ -0,0 +1,87 @@ +/* APPLE LOCAL file Macintosh alignment */ +/* align-test-5*.c are all the same code but with different options. */ + +/* { dg-do run { target "powerpc-*-darwin*" } } */ +/* { dg-options "-malign-natural -DSIZE=16" } */ + +/* + * GCC alignment test for command line options for setting alignment modes. + * Fred Forsman + * Apple Computer, Inc. + * (C) 2000-2002. + * Last modified 2002-2-18. + * + */ + + /* Check whether we are testing GCC 3 or later. */ +#ifdef __GNUC__ +#if __GNUC__ >= 3 +#define GCC3 1 +#else +#define GCC3 0 +#endif +#endif + +#include <stdio.h> +#include <stddef.h> +#include <string.h> + +#define Q(x) #x, x + +typedef unsigned char UINT8; +typedef unsigned long UINT32; + +static int bad_option = 0; +static int flag_verbose = 0; +static int nbr_failures = 0; + +typedef struct S0 { + UINT8 f1; + double f2; +} S0; + +static void check(char * rec_name, int actual, int expected, char * comment) +{ + if (flag_verbose || (actual != expected)) { + printf("%-20s = %2d (%2d) ", rec_name, actual, expected); + if (actual != expected) { + printf("*** FAIL"); + nbr_failures++; + } else + printf(" PASS"); + printf(": %s\n", comment); + } +} + +static void check_option(char *option) +{ + if (*option == '-') { + if (strcmp(option, "-v") == 0) + flag_verbose = 1; + else { + fprintf(stderr, "*** unrecognized option '%s'.\n", option); + bad_option = 1; + } + } else { + fprintf(stderr, "*** unrecognized option '%s'.\n", option); + bad_option = 1; + } +} + +int main(int argc, char *argv[]) +{ + int i; + + for (i = 1; i < argc; i++) + check_option(argv[i]); + + if (bad_option) + return 1; + + check(Q(sizeof(S0)), SIZE, "struct with 1 char, 1 double"); + + if (nbr_failures > 0) + return 1; + else + return 0; +} diff --git a/gcc/testsuite/gcc.apple/align-test-5b.c b/gcc/testsuite/gcc.apple/align-test-5b.c new file mode 100644 index 00000000000..a44d8cb4d8f --- /dev/null +++ b/gcc/testsuite/gcc.apple/align-test-5b.c @@ -0,0 +1,87 @@ +/* APPLE LOCAL file Macintosh alignment */ +/* align-test-5*.c are all the same code but with different options. */ + +/* { dg-do run } */ +/* { dg-options "-malign-power -DSIZE=12" } */ + +/* We have a different test to pick up the warning from 64-bit case. */ +/* { dg-xfail-if "" { powerpc*-*-darwin* } { "-m64" } { "" } } */ + +/* + * GCC alignment test for command line options for setting alignment modes. + * Fred Forsman + * Apple Computer, Inc. + */ + + /* Check whether we are testing GCC 3 or later. */ +#ifdef __GNUC__ +#if __GNUC__ >= 3 +#define GCC3 1 +#else +#define GCC3 0 +#endif +#endif + +#include <stdio.h> +#include <stddef.h> +#include <string.h> + +#define Q(x) #x, x + +typedef unsigned char UINT8; +typedef unsigned long UINT32; + +static int bad_option = 0; +static int flag_verbose = 0; +static int nbr_failures = 0; + +typedef struct S0 { + UINT8 f1; + double f2; +} S0; + +static void check(char * rec_name, int actual, int expected, char * comment) +{ + if (flag_verbose || (actual != expected)) { + printf("%-20s = %2d (%2d) ", rec_name, actual, expected); + if (actual != expected) { + printf("*** FAIL"); + nbr_failures++; + } else + printf(" PASS"); + printf(": %s\n", comment); + } +} + +static void check_option(char *option) +{ + if (*option == '-') { + if (strcmp(option, "-v") == 0) + flag_verbose = 1; + else { + fprintf(stderr, "*** unrecognized option '%s'.\n", option); + bad_option = 1; + } + } else { + fprintf(stderr, "*** unrecognized option '%s'.\n", option); + bad_option = 1; + } +} + +int main(int argc, char *argv[]) +{ + int i; + + for (i = 1; i < argc; i++) + check_option(argv[i]); + + if (bad_option) + return 1; + + check(Q(sizeof(S0)), SIZE, "struct with 1 char, 1 double"); + + if (nbr_failures > 0) + return 1; + else + return 0; +} diff --git a/gcc/testsuite/gcc.apple/align-test-5c.c b/gcc/testsuite/gcc.apple/align-test-5c.c new file mode 100644 index 00000000000..707a9c6a215 --- /dev/null +++ b/gcc/testsuite/gcc.apple/align-test-5c.c @@ -0,0 +1,87 @@ +/* APPLE LOCAL file Macintosh alignment */ +/* align-test-5*.c are all the same code but with different options. */ + +/* { dg-do run } */ +/* { dg-options "-malign-mac68k -DSIZE=10" } */ + +/* dg-skip-if would be better, should be in the next merge after 2004-01. */ +/* { dg-xfail-if "" { powerpc*-*-darwin* } { "-m64" } { "" } } */ + +/* + * GCC alignment test for command line options for setting alignment modes. + * Fred Forsman + * Apple Computer, Inc. + */ + + /* Check whether we are testing GCC 3 or later. */ +#ifdef __GNUC__ +#if __GNUC__ >= 3 +#define GCC3 1 +#else +#define GCC3 0 +#endif +#endif + +#include <stdio.h> +#include <stddef.h> +#include <string.h> + +#define Q(x) #x, x + +typedef unsigned char UINT8; +typedef unsigned long UINT32; + +static int bad_option = 0; +static int flag_verbose = 0; +static int nbr_failures = 0; + +typedef struct S0 { + UINT8 f1; + double f2; +} S0; + +static void check(char * rec_name, int actual, int expected, char * comment) +{ + if (flag_verbose || (actual != expected)) { + printf("%-20s = %2d (%2d) ", rec_name, actual, expected); + if (actual != expected) { + printf("*** FAIL"); + nbr_failures++; + } else + printf(" PASS"); + printf(": %s\n", comment); + } +} + +static void check_option(char *option) +{ + if (*option == '-') { + if (strcmp(option, "-v") == 0) + flag_verbose = 1; + else { + fprintf(stderr, "*** unrecognized option '%s'.\n", option); + bad_option = 1; + } + } else { + fprintf(stderr, "*** unrecognized option '%s'.\n", option); + bad_option = 1; + } +} + +int main(int argc, char *argv[]) +{ + int i; + + for (i = 1; i < argc; i++) + check_option(argv[i]); + + if (bad_option) + return 1; + + check(Q(sizeof(S0)), SIZE, "struct with 1 char, 1 double"); + + if (nbr_failures > 0) + return 1; + else + return 0; +} diff --git a/gcc/testsuite/gcc.apple/align-test-5d.c b/gcc/testsuite/gcc.apple/align-test-5d.c new file mode 100644 index 00000000000..fbbe60f7aa2 --- /dev/null +++ b/gcc/testsuite/gcc.apple/align-test-5d.c @@ -0,0 +1,90 @@ +/* APPLE LOCAL file Macintosh alignment */ +/* align-test-5*.c are all the same code but with different options. */ + +/* { dg-do run { target "i?86-*-darwin*" } } */ +/* { dg-options "-malign-natural -DSIZE=12" } */ + +/* This is for Intel only. */ +/* { dg-xfail-if "" { powerpc*-*-darwin* } { "" } { "" } } */ + +/* + * GCC alignment test for command line options for setting alignment modes. + * Fred Forsman + * Apple Computer, Inc. + * (C) 2000-2002. + * Last modified 2002-2-18. + * + */ + + /* Check whether we are testing GCC 3 or later. */ +#ifdef __GNUC__ +#if __GNUC__ >= 3 +#define GCC3 1 +#else +#define GCC3 0 +#endif +#endif + +#include <stdio.h> +#include <stddef.h> +#include <string.h> + +#define Q(x) #x, x + +typedef unsigned char UINT8; +typedef unsigned long UINT32; + +static int bad_option = 0; +static int flag_verbose = 0; +static int nbr_failures = 0; + +typedef struct S0 { + UINT8 f1; + double f2; +} S0; + +static void check(char * rec_name, int actual, int expected, char * comment) +{ + if (flag_verbose || (actual != expected)) { + printf("%-20s = %2d (%2d) ", rec_name, actual, expected); + if (actual != expected) { + printf("*** FAIL"); + nbr_failures++; + } else + printf(" PASS"); + printf(": %s\n", comment); + } +} + +static void check_option(char *option) +{ + if (*option == '-') { + if (strcmp(option, "-v") == 0) + flag_verbose = 1; + else { + fprintf(stderr, "*** unrecognized option '%s'.\n", option); + bad_option = 1; + } + } else { + fprintf(stderr, "*** unrecognized option '%s'.\n", option); + bad_option = 1; + } +} + +int main(int argc, char *argv[]) +{ + int i; + + for (i = 1; i < argc; i++) + check_option(argv[i]); + + if (bad_option) + return 1; + + check(Q(sizeof(S0)), SIZE, "struct with 1 char, 1 double"); + + if (nbr_failures > 0) + return 1; + else + return 0; +} diff --git a/gcc/testsuite/gcc.apple/altivec-1.c b/gcc/testsuite/gcc.apple/altivec-1.c new file mode 100644 index 00000000000..c8df7f026b9 --- /dev/null +++ b/gcc/testsuite/gcc.apple/altivec-1.c @@ -0,0 +1,124 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-faltivec" } */ + +/* Test for correct handling of AltiVec constants passed + through '...' (va_arg). */ + +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> + +#define CHECK_INVARIANT(expr) \ + if (!(expr)) { \ + printf ("ASSERT FAILED: %d: %s\n", __LINE__, #expr); \ + abort (); \ + } + +struct foo { int x; int y; }; +struct vfoo { int x; __vector signed int v; int y; }; +union u { __vector signed int v; signed int i[4]; }; + +struct foo x_g = { 3, 4}; +struct vfoo vx_g = { 10, (vector signed int)(11, 12, 13, 14), 15 }; +__vector signed int v_g = (vector signed int) (22, 23, 24, 25); +struct vfoo vx2_g = { 30, (vector signed int)(31, 32, 33, 34), 35 }; +__vector signed int v2_g = (vector signed int)(40, 41, 42, 43); +int i_1 = 99, i_2 = 33; +double d_2 = 1.5, d_3 = 1.75; +long double ld_1 = 1.25; + +void bar (int i, ... ) +{ + struct foo xi; + double d; + long double ld; + float f; + char c; + short s; + va_list ap; + va_start(ap, i); + xi = va_arg(ap, struct foo); + s = (short)va_arg(ap, int); + f = (float)va_arg(ap, double); + ld = va_arg(ap, long double); + c = (char)va_arg(ap, int); + d = va_arg(ap, double); + va_end(ap); + + CHECK_INVARIANT (xi.x == x_g.x && xi.y == x_g.y); + CHECK_INVARIANT (s == (short)i_2); + CHECK_INVARIANT (f == (float)d_2); + CHECK_INVARIANT (ld == ld_1); + CHECK_INVARIANT (c == (char)i_1); + CHECK_INVARIANT (d == d_3); +} + +void baz (int i, ... ) +{ + struct vfoo vx, vx2; + __vector signed int v_i, v2_i; + int j, k, l; + va_list ap; + va_start(ap, i); + v_i = va_arg(ap, __vector signed int); + j = va_arg(ap, int); + vx = va_arg(ap, struct vfoo); + k = va_arg(ap, int); + v2_i = va_arg(ap, __vector signed int); + l = va_arg(ap, int); + vx2 = va_arg(ap, struct vfoo); + va_end(ap); + + CHECK_INVARIANT (vec_all_eq (v_i, v_g)); + CHECK_INVARIANT (j == i_1); + CHECK_INVARIANT (vx.x == vx_g.x && vec_all_eq(vx.v, vx_g.v) && vx.y == vx_g.y); + CHECK_INVARIANT (k == i_1); + CHECK_INVARIANT (vec_all_eq (v2_i, v2_g)); + CHECK_INVARIANT (l == i_1); + CHECK_INVARIANT (vx2.x == vx2_g.x && vec_all_eq(vx2.v, vx2_g.v) && vx2.y == vx2_g.y); +} + +void quux (int i, ... ) +{ + __vector signed int v_i, v2_i; + union u vi, v2i; + va_list ap; + va_start(ap, i); + v_i = va_arg(ap, __vector signed int); + v2_i = va_arg(ap, __vector signed int); + va_end(ap); + vi.v = v_i; + v2i.v = v2_i; + + CHECK_INVARIANT (vec_all_eq (v_i, v_g)); + CHECK_INVARIANT (vec_all_eq (v2_i, v_g)); + CHECK_INVARIANT (vec_all_eq (vi.v, v_g)); + CHECK_INVARIANT (vec_all_eq (v2i.v, v_g)); +} + +void baz2 (int i, ... ) +{ + struct vfoo vx; + union u vxi; + va_list ap; + va_start(ap, i); + vx = va_arg(ap, struct vfoo); + va_end(ap); + vxi.v = vx.v; + + CHECK_INVARIANT (vx.x == vx_g.x && vec_all_eq(vx.v, vx_g.v) && vx.y == vx_g.y); + CHECK_INVARIANT (vec_all_eq (vxi.v, vx_g.v)); +} + +int main(void) +{ + CHECK_INVARIANT (sizeof(struct foo) == 8 && sizeof(struct vfoo) == 48); + + bar(i_1, x_g, (short)i_2, (float)d_2, ld_1, (char)i_1, d_3); + baz(i_1, v_g, i_1, vx_g, i_1, v2_g, i_1, vx2_g); + quux(i_1, v_g, v_g); + baz2(i_1, vx_g); + + return 0; +} diff --git a/gcc/testsuite/gcc.apple/altivec-19.c b/gcc/testsuite/gcc.apple/altivec-19.c new file mode 100644 index 00000000000..857962f9f2e --- /dev/null +++ b/gcc/testsuite/gcc.apple/altivec-19.c @@ -0,0 +1,15 @@ +/* APPLE LOCAL entire file */ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-maltivec -pedantic" } */ + +int main() + { + typedef unsigned char UC; + typedef vector unsigned char VUC; + + const UC kBar = 7; + VUC vBar1 = (VUC)(kBar); + VUC vBar2 = {kBar}; + VUC vBar3 = (VUC){kBar}; + return 0; + } diff --git a/gcc/testsuite/gcc.apple/altivec-2.c b/gcc/testsuite/gcc.apple/altivec-2.c new file mode 100644 index 00000000000..23eaf3d230d --- /dev/null +++ b/gcc/testsuite/gcc.apple/altivec-2.c @@ -0,0 +1,22 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-faltivec" } */ + +/* Check whether AltiVec allows for 'bool' + and 'pixel' to be #defined to mean other things. */ + +extern void abort (void); +#define CHECK_IF(E) if(!(E)) abort() + +#define bool char +#define pixel unsigned char + +int main(void) { + bool x1; + pixel x2; + + CHECK_IF(sizeof(x1) == 1); + CHECK_IF(sizeof(x2) == 1); + return 0; +} + diff --git a/gcc/testsuite/gcc.apple/altivec-20.c b/gcc/testsuite/gcc.apple/altivec-20.c new file mode 100644 index 00000000000..63cc2dba6d8 --- /dev/null +++ b/gcc/testsuite/gcc.apple/altivec-20.c @@ -0,0 +1,7 @@ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-maltivec" } */ + +#define vector __attribute__((vector_size(16))) + +vector long long vbl; /* { dg-error "use of 'long long' in AltiVec types is invalid" } */ + diff --git a/gcc/testsuite/gcc.apple/altivec-3.c b/gcc/testsuite/gcc.apple/altivec-3.c new file mode 100644 index 00000000000..09579468c9b --- /dev/null +++ b/gcc/testsuite/gcc.apple/altivec-3.c @@ -0,0 +1,14 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-faltivec" } */ + +int main(void) +{ + bool b; /* { dg-error ".bool. undeclared" } */ + /* { dg-error "is reported only once" "" { target *-*-* } 7 } */ + /* { dg-error "function it appears in" "" { target *-*-* } 7 } */ + /* { dg-error "(parse|syntax) error" "" { target *-*-* } 7 } */ + + return 0; +} + diff --git a/gcc/testsuite/gcc.apple/altivec-4.c b/gcc/testsuite/gcc.apple/altivec-4.c new file mode 100644 index 00000000000..c81cc7676aa --- /dev/null +++ b/gcc/testsuite/gcc.apple/altivec-4.c @@ -0,0 +1,23 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-faltivec" } */ + +extern void abort(); + +#include <stdio.h> +int main() +{ + int i; + union u { + vector signed short uv; + signed short val[8]; + } v; + + vector signed short SpecialConstants = (vector signed short)( 1, 2, 3, 4, 5, 6,7,8); + v.uv = SpecialConstants; + for (i=0; i < 8; i++) + if (v.val[i] != i+1) + abort(); + return 0; +} + diff --git a/gcc/testsuite/gcc.apple/altivec-5.c b/gcc/testsuite/gcc.apple/altivec-5.c new file mode 100644 index 00000000000..cd9e1888af2 --- /dev/null +++ b/gcc/testsuite/gcc.apple/altivec-5.c @@ -0,0 +1,33 @@ +/* APPLE LOCAL file AltiVec 3840704 */ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-faltivec" } */ +/* { dg-final { scan-assembler-not "stvx" } } */ + +void *memset(void *, int, unsigned long int); + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + long tm_gmtoff; + char *tm_zone; +}; + + +int asl_send() +{ + char *str, *out; + unsigned int i, len, level, outstatus; + struct tm gtime; + + memset(>ime, 0, sizeof(struct tm)); /* { dg-warning "disabled" } */ + return 0; +} + diff --git a/gcc/testsuite/gcc.apple/altivec-faltivec-1.c b/gcc/testsuite/gcc.apple/altivec-faltivec-1.c new file mode 100644 index 00000000000..f624187d56e --- /dev/null +++ b/gcc/testsuite/gcc.apple/altivec-faltivec-1.c @@ -0,0 +1,135 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-O3 -finline-limit=9999 -faltivec -Wa,-force_cpusubtype_ALL -fdump-ipa-cgraph -S" } */ +/* Inliner should not inline AltiVec(tm) functions when -faltivec is on. */ +/* <rdar://problem/3837835> Selective inlining of functions that use Altivec */ +#include <Carbon/Carbon.h> +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +/* #include <altivec.h> */ + +#define N 400 +#define N4 ((N+3)/4) +#define N8 ((N+7)/8) + +typedef union +{ + signed short sInt[8]; + vector signed short vInt; +} IntegerToVector; + +static signed long vIntDotProduct (vector signed short [], vector signed short [], long int); +static int mainInt(); +static Ptr getMemory (size_t); + +static int +mainInt() +{ + long int n = N, n8 = N8, m, i, j; + signed long vDotProduct, sDotProduct; + signed short *sx, *sy; + vector signed short *x, *y; + IntegerToVector *sX, *sY; + + sx = (short *) getMemory( 4*(n+3) ); + if (sx == nil) + return 0; + sy = (short *) getMemory( 4*(n+3) ); + if (sy == nil) + return 0; + + x = (vector signed short *) getMemory( n8*16 ); + if ( x == nil) + return 0; + y = (vector signed short *) getMemory( n8*16 ); + if ( y == nil) + return 0; + + sX = (IntegerToVector *) getMemory( n8*16 ); + if (sX == nil) + return 0; + sY = (IntegerToVector *) getMemory( n8*16 ); + if (sY == nil) + return 0; + + for ( i = 0; i < n; i++ ) + { + sx[i] = ( signed short ) scalb(( M_PI * ( double ) ( i ) / ( double ) n ), 8) + 0.5; + sy[i] = ( signed short ) scalb(( M_PI * ( double ) ( n - i ) / ( double ) n ), 8) + 0.5; + } + + m = n % 8; + if (m != 0) + for (i = n; i < n + 8 - m; i++) + { + sx[i] = 0.0; + sy[i] = 0.0; + } + + for ( i = 0; i < n8; i++ ) + for ( j = 0; j < 8; j++ ) + { + sX[i].sInt[j] = sx[i*8+j]; + sY[i].sInt[j] = sy[i*8+j]; + } + + for ( i = 0; i < n8; i++ ) + { + x[i] = sX[i].vInt; + y[i] = sY[i].vInt; + } + + vDotProduct = vIntDotProduct ( x, y, n8 ); + + printf ( "\nVector dot product = %10d\n", (int) vDotProduct ); + + return 0; +} + +static Ptr +getMemory ( size_t amount ) +{ + Ptr ptr; + + ptr = malloc(amount); + if (ptr == nil) + printf ("\nUnable to allocate sufficient memory."); + return (ptr); +} + +signed long +vIntDotProduct ( vector signed short x[], vector signed short y[], long int n ) +{ + + typedef union + { + signed long xElem[4]; + vector signed int vWord; + } WordToVector; + + long int i; + + vector signed int partialProduct, zero = ( vector signed int ) { 0,0,0,0 }; + WordToVector sum; + + partialProduct = zero; + + for ( i = 0; i < n ; i++ ) + partialProduct = vec_msums ( x[i], y[i], partialProduct ); + + sum.vWord = vec_sums( partialProduct, zero); + + return sum.xElem[3]; +} + +int +main() +{ + mainInt(); + exit(0); +} + +/* { dg-final { scan-tree-dump-times "callee has AltiVec" 2 "cgraph" } } */ +/* { dg-final { scan-assembler-not "vIntDotProduct" } } */ +/* { dg-final { scan-assembler "mainInt" } } */ diff --git a/gcc/testsuite/gcc.apple/altivec-faltivec-2.c b/gcc/testsuite/gcc.apple/altivec-faltivec-2.c new file mode 100644 index 00000000000..fe376397d6c --- /dev/null +++ b/gcc/testsuite/gcc.apple/altivec-faltivec-2.c @@ -0,0 +1,135 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-O3 -finline-limit=9999 -faltivec -Wa,-force_cpusubtype_ALL -fdump-ipa-cgraph -S" } */ +/* Inliner should inline always-inline AltiVec(tm) functions when -faltivec is on. */ +/* <rdar://problem/3837835> Selective inlining of functions that use Altivec */ +#include <Carbon/Carbon.h> +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +/* #include <altivec.h> */ + +#define N 400 +#define N4 ((N+3)/4) +#define N8 ((N+7)/8) + +typedef union +{ + signed short sInt[8]; + vector signed short vInt; +} IntegerToVector; + +static signed long __attribute__ ((always_inline)) vIntDotProduct (vector signed short [], vector signed short [], long int); +static int __attribute__ ((always_inline)) mainInt(); +static Ptr getMemory (size_t); + +static int __attribute__ ((always_inline)) +mainInt() +{ + long int n = N, n8 = N8, m, i, j; + signed long vDotProduct, sDotProduct; + signed short *sx, *sy; + vector signed short *x, *y; + IntegerToVector *sX, *sY; + + sx = (short *) getMemory( 4*(n+3) ); + if (sx == nil) + return 0; + sy = (short *) getMemory( 4*(n+3) ); + if (sy == nil) + return 0; + + x = (vector signed short *) getMemory( n8*16 ); + if ( x == nil) + return 0; + y = (vector signed short *) getMemory( n8*16 ); + if ( y == nil) + return 0; + + sX = (IntegerToVector *) getMemory( n8*16 ); + if (sX == nil) + return 0; + sY = (IntegerToVector *) getMemory( n8*16 ); + if (sY == nil) + return 0; + + for ( i = 0; i < n; i++ ) + { + sx[i] = ( signed short ) scalb(( M_PI * ( double ) ( i ) / ( double ) n ), 8) + 0.5; + sy[i] = ( signed short ) scalb(( M_PI * ( double ) ( n - i ) / ( double ) n ), 8) + 0.5; + } + + m = n % 8; + if (m != 0) + for (i = n; i < n + 8 - m; i++) + { + sx[i] = 0.0; + sy[i] = 0.0; + } + + for ( i = 0; i < n8; i++ ) + for ( j = 0; j < 8; j++ ) + { + sX[i].sInt[j] = sx[i*8+j]; + sY[i].sInt[j] = sy[i*8+j]; + } + + for ( i = 0; i < n8; i++ ) + { + x[i] = sX[i].vInt; + y[i] = sY[i].vInt; + } + + vDotProduct = vIntDotProduct ( x, y, n8 ); + + printf ( "\nVector dot product = %10d\n", (int) vDotProduct ); + + return 0; +} + +static Ptr +getMemory ( size_t amount ) +{ + Ptr ptr; + + ptr = malloc(amount); + if (ptr == nil) + printf ("\nUnable to allocate sufficient memory."); + return (ptr); +} + +signed long __attribute__ ((always_inline)) +vIntDotProduct ( vector signed short x[], vector signed short y[], long int n ) +{ + + typedef union + { + signed long xElem[4]; + vector signed int vWord; + } WordToVector; + + long int i; + + vector signed int partialProduct, zero = ( vector signed int ) { 0,0,0,0 }; + WordToVector sum; + + partialProduct = zero; + + for ( i = 0; i < n ; i++ ) + partialProduct = vec_msums ( x[i], y[i], partialProduct ); + + sum.vWord = vec_sums( partialProduct, zero); + + return sum.xElem[3]; +} + +int +main() +{ + mainInt(); + exit(0); +} + +/* { dg-final { scan-tree-dump-times "callee has AltiVec" 0 "cgraph" } } */ +/* { dg-final { scan-assembler-not "vIntDotProduct" } } */ +/* { dg-final { scan-assembler-not "mainInt" } } */ diff --git a/gcc/testsuite/gcc.apple/altivec-maltivec-1.c b/gcc/testsuite/gcc.apple/altivec-maltivec-1.c new file mode 100644 index 00000000000..52181bde5be --- /dev/null +++ b/gcc/testsuite/gcc.apple/altivec-maltivec-1.c @@ -0,0 +1,135 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-O3 -finline-limit=9999 -maltivec -Wa,-force_cpusubtype_ALL -fdump-ipa-cgraph -S" } */ +/* Inliner should inline AltiVec(tm) functions normally when -maltivec is on. */ +/* <rdar://problem/3837835> Selective inlining of functions that use Altivec */ +#include <Carbon/Carbon.h> +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <altivec.h> + +#define N 400 +#define N4 ((N+3)/4) +#define N8 ((N+7)/8) + +typedef union +{ + signed short sInt[8]; + vector signed short vInt; +} IntegerToVector; + +static signed long vIntDotProduct (vector signed short [], vector signed short [], long int); +static int mainInt(); +static Ptr getMemory ( size_t amount ); + +static int +mainInt() +{ + long int n = N, n8 = N8, m, i, j; + signed long vDotProduct, sDotProduct; + signed short *sx, *sy; + vector signed short *x, *y; + IntegerToVector *sX, *sY; + + sx = (short *) getMemory( 4*(n+3) ); + if (sx == nil) + return 0; + sy = (short *) getMemory( 4*(n+3) ); + if (sy == nil) + return 0; + + x = (vector signed short *) getMemory( n8*16 ); + if ( x == nil) + return 0; + y = (vector signed short *) getMemory( n8*16 ); + if ( y == nil) + return 0; + + sX = (IntegerToVector *) getMemory( n8*16 ); + if (sX == nil) + return 0; + sY = (IntegerToVector *) getMemory( n8*16 ); + if (sY == nil) + return 0; + + for ( i = 0; i < n; i++ ) + { + sx[i] = ( signed short ) scalb(( M_PI * ( double ) ( i ) / ( double ) n ), 8) + 0.5; + sy[i] = ( signed short ) scalb(( M_PI * ( double ) ( n - i ) / ( double ) n ), 8) + 0.5; + } + + m = n % 8; + if (m != 0) + for (i = n; i < n + 8 - m; i++) + { + sx[i] = 0.0; + sy[i] = 0.0; + } + + for ( i = 0; i < n8; i++ ) + for ( j = 0; j < 8; j++ ) + { + sX[i].sInt[j] = sx[i*8+j]; + sY[i].sInt[j] = sy[i*8+j]; + } + + for ( i = 0; i < n8; i++ ) + { + x[i] = sX[i].vInt; + y[i] = sY[i].vInt; + } + + vDotProduct = vIntDotProduct ( x, y, n8 ); + + printf ( "\nVector dot product = %10d\n", (int) vDotProduct ); + + return 0; +} + +static Ptr +getMemory ( size_t amount ) +{ + Ptr ptr; + + ptr = malloc(amount); + if (ptr == nil) + printf ("\nUnable to allocate sufficient memory."); + return (ptr); +} + +static signed long +vIntDotProduct ( vector signed short x[], vector signed short y[], long int n ) +{ + + typedef union + { + signed long xElem[4]; + vector signed int vWord; + } WordToVector; + + long int i; + + vector signed int partialProduct, zero = ( vector signed int ) { 0,0,0,0 }; + WordToVector sum; + + partialProduct = zero; + + for ( i = 0; i < n ; i++ ) + partialProduct = vec_msums ( x[i], y[i], partialProduct ); + + sum.vWord = vec_sums( partialProduct, zero); + + return sum.xElem[3]; +} + +int +main() +{ + mainInt(); + exit(0); +} + +/* { dg-final { scan-tree-dump-times "callee has AltiVec" 0 "cgraph" } } */ +/* { dg-final { scan-assembler-not "vIntDotProduct" } } */ +/* { dg-final { scan-assembler-not "mainInt" } } */ diff --git a/gcc/testsuite/gcc.apple/altivec-test-macro.c b/gcc/testsuite/gcc.apple/altivec-test-macro.c new file mode 100644 index 00000000000..6d5a2dc894d --- /dev/null +++ b/gcc/testsuite/gcc.apple/altivec-test-macro.c @@ -0,0 +1,30 @@ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-maltivec" } */ + +#include <altivec.h> + +#define TYPE unsigned int +union U { + TYPE ui[4]; + vector TYPE uv; +} data; + +extern void abort(); + +int main( void ) +{ + vector unsigned int v = {1,2,3,4}; + vector TYPE UUUUUU = {10,10,10,10}; + int i; + + v = vec_add( v, UUUUUU ); + + data.uv = v; + + for (i=0; i < 4; i++) + if (data.ui[i] != (10+i+1)) + abort(); + + return 0; +} + diff --git a/gcc/testsuite/gcc.apple/apple-altivec-1.c b/gcc/testsuite/gcc.apple/apple-altivec-1.c new file mode 100644 index 00000000000..81a5bc1beab --- /dev/null +++ b/gcc/testsuite/gcc.apple/apple-altivec-1.c @@ -0,0 +1,64 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-faltivec" } */ + +static vector int x, y; + +static vector signed int i,j; +static vector signed short s,t; +static vector signed char c,d; +static vector float f,g; +static vector unsigned short us; + +static vector unsigned char uc; + +static vector signed int *pi; + +static int int1, int2; + +void +b() +{ + vec_add (x, y); + + /* Make sure the predicates accept correct argument types. */ + + int1 = vec_all_in (f, g); + int1 = vec_all_ne (f, g); + int1 = vec_all_ne (c, d); + int1 = vec_all_ne (s, t); + int1 = vec_all_ne (i, j); + int1 = vec_all_nge (f, g); + int1 = vec_all_ngt (f, g); + int1 = vec_all_ge (c, d); + int1 = vec_all_ge (s, t); + int1 = vec_all_ge (i, j); + int1 = vec_all_ge (c, d); + int1 = vec_all_ge (s, t); + int1 = vec_all_ge (i, j); + + vec_mtvscr (i); + vec_dssall (); + us = vec_mfvscr (); + vec_dss (3); + + vec_dst (pi, int1 + int2, 3); + vec_dstst (pi, int1 + int2, 3); + vec_dststt (pi, int1 + int2, 3); + vec_dstt (pi, int1 + int2, 3); + + uc = vec_lvsl (int1 + 69, pi); + uc = vec_lvsr (int1 + 69, pi); + + c = vec_lde (int1, (vector bool char *)pi); + s = vec_lde (int1, (vector pixel *)pi); + i = vec_lde (int1, pi); + i = vec_ldl (int1, pi); + i = vec_ld (int1, pi); + + vec_st (i, int2, pi); + vec_ste (c, int2, (vector unsigned char *)pi); + vec_ste (s, int2, (vector bool short *)pi); + vec_ste (i, int2, pi); + vec_stl (i, int2, pi); +} diff --git a/gcc/testsuite/gcc.apple/apple-altivec-10.c b/gcc/testsuite/gcc.apple/apple-altivec-10.c new file mode 100644 index 00000000000..12afefa4c1c --- /dev/null +++ b/gcc/testsuite/gcc.apple/apple-altivec-10.c @@ -0,0 +1,81 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-faltivec" } */ +extern void abort(); + +#include <stdio.h> + +int main() +{ + char str[128]; + vector unsigned char + vuchar = (vector unsigned char)((vector unsigned int)(0x001f001d, 0x001f001d, 0x001f001d, 0x001f001d)); + + vector unsigned short + vushort = (vector unsigned short)((vector unsigned int)(0x001f001d, 0x001f001d, 0x001f001d, 0x001f001d)); + + vector unsigned char + vushort_to_char = (vector unsigned char) + ((vector unsigned short)(0x001f,0x001d, 0x001f,0x001d, 0x001f,0x001d, 0x001f,0x001d)); + + vector signed char + vschar = (vector signed char)((vector signed int)(0x001f001d, 0x001f001d, 0x001f001d, 0x001f001d)); + + vector signed short + vsshort = (vector signed short)((vector signed int)(0x001f001d, 0x001f001d, 0x001f001d, 0x001f001d)); + + vector signed char + vsshort_to_char = (vector signed char) + ((vector signed short)(0x001f,0x001d, 0x001f,0x001d, 0x001f,0x001d, 0x001f,0x001d)); + + vector unsigned int + vui = (vector unsigned int)((vector unsigned short)(0x011f,0x021d, 0x031f,0x041d, 0x051f,0x061d, 0x071f,0x081d)); + + vector unsigned int + vui1 = (vector unsigned int) + ((vector unsigned char)(0x01,0x1f,0x02,0x1d, 0x03,0x1f,0x04,0x1d, + 0x05,0x1f,0x06,0x1d, 0x07,0x1f,0x08,0x1d)); + + vector unsigned short + vus = (vector unsigned short) + ((vector unsigned char)(0x01,0x1f,0x02,0x1d, 0x03,0x1f,0x04,0x1d, + 0x05,0x1f,0x06,0x1d, 0x07,0x1f,0x08,0x1d)); + + vector float + vf = (vector float) + ((vector unsigned int)(0x001f001d, 0x001f001d, 0x001f001d, 0x001f001d)); + + sprintf(str, "%vhu", vuchar); + if (strcmp (str, "31 29 31 29 31 29 31 29")) + abort(); + sprintf(str, "%vhu", vushort); + if (strcmp (str, "31 29 31 29 31 29 31 29")) + abort(); + sprintf(str, "%vhu", vushort_to_char); + if (strcmp (str, "31 29 31 29 31 29 31 29")) + abort(); + sprintf(str, "%vhu", vschar); + if (strcmp (str, "31 29 31 29 31 29 31 29")) + abort(); + sprintf(str, "%vhu", vsshort); + if (strcmp (str, "31 29 31 29 31 29 31 29")) + abort(); + sprintf(str, "%vhu", vsshort_to_char); + if (strcmp (str, "31 29 31 29 31 29 31 29")) + abort(); + sprintf(str, "%vd", vui); + if (strcmp (str, "1 31 2 29 3 31 4 29 5 31 6 29 7 31 8 29")) + abort(); + sprintf(str, "%vd", vui1); + if (strcmp (str, "1 31 2 29 3 31 4 29 5 31 6 29 7 31 8 29")) + abort(); + sprintf(str, "%vd", vus); + if (strcmp (str, "1 31 2 29 3 31 4 29 5 31 6 29 7 31 8 29")) + abort(); + sprintf(str, "%vhu", vf); + if (strcmp (str, "31 29 31 29 31 29 31 29")) + abort(); + return 0; +} + + diff --git a/gcc/testsuite/gcc.apple/apple-altivec-11.c b/gcc/testsuite/gcc.apple/apple-altivec-11.c new file mode 100644 index 00000000000..6224923c1be --- /dev/null +++ b/gcc/testsuite/gcc.apple/apple-altivec-11.c @@ -0,0 +1,23 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-faltivec" } */ + +extern void abort(); + +vector signed int +vandc(vector signed int a, vector signed int b) +{ + return vec_andc(a, b); +} + +int main () +{ + char buf [1024]; + vector signed int a1 = (vector signed int) (0XFFFFFFFF); + vector signed int b1 = (vector signed int) (0X0); + + if (!vec_all_eq (vandc (a1, b1), a1)) + abort(); + return 0; +} + diff --git a/gcc/testsuite/gcc.apple/apple-altivec-12.c b/gcc/testsuite/gcc.apple/apple-altivec-12.c new file mode 100644 index 00000000000..54b30e5059c --- /dev/null +++ b/gcc/testsuite/gcc.apple/apple-altivec-12.c @@ -0,0 +1,395 @@ +/* APPLE LOCAL file AltiVec */ +/* Check for presence of AltiVec PIM "specific operations". */ + +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-faltivec -Wall" } */ + +vector signed int +specific_operations( signed int *p) +{ + vector unsigned int vui1, vui2; + vector unsigned short vus1, vus2; + vector unsigned char vuc1, vuc2; + vector signed int vsi1, vsi2; + vector signed short vss1, vss2; + vector signed char vsc1, vsc2; + vector bool int vbi1, vbi2; + vector bool short vbs1, vbs2; + vector bool char vbc1, vbc2; + vector float vf1, vf2; + vector pixel vp1, vp2; + + vuc1 = vec_lvebx (8, (unsigned char *)p); + vss1 = vec_lvehx (4, (short *)p); + vf1 = vec_lvewx (2, (float *)p); + + vsi1 = vec_lvx (1, (vector signed int *)p); + vp1 = vec_lvxl (16, (vector pixel *)p); + + vec_stvebx (vuc1, 2, (char *)p); + vec_stvehx (vp1, 4, (unsigned short *)p); + vec_stvewx (vf1, 1, (float *)p); + + vec_stvx (vbi1, 12, (vector int bool *)p); + vec_stvxl (vp1, 11, (vector pixel *)p); + + vui1 = vec_vaddcuw (vui1, vui2); + vf1 = vec_vaddfp (vf1, vf2); + + vsc1 = vec_vaddsbs (vsc1, vsc2); + vss1 = vec_vaddshs (vss1, vss2); + vsi1 = vec_vaddsws (vsi1, vsi2); + vuc1 = vec_vaddubs (vuc1, vuc2); + vus1 = vec_vadduhs (vus1, vus2); + vui1 = vec_vadduws (vui1, vui2); + vuc1 = vec_vaddubm (vuc1, vuc2); + vus1 = vec_vadduhm (vus1, vus2); + vui1 = vec_vadduwm (vui1, vui2); + + vsc1 = vec_vand (vsc1, vsc2); + vss1 = vec_vandc (vss1, vss2); + + vsc1 = vec_vavgsb (vsc1, vsc2); + vss1 = vec_vavgsh (vss1, vss2); + vsi1 = vec_vavgsw (vsi1, vsi2); + vuc1 = vec_vavgub (vuc1, vuc2); + vus1 = vec_vavguh (vus1, vus2); + vui1 = vec_vavguw (vui1, vui2); + + vf1 = vec_vcfsx (vsi1, 4); + vf2 = vec_vcfux (vui1, 3); + + vsi1 = vec_vcmpbfp (vf1, vf2); + vbi1 = vec_vcmpeqfp (vf1, vf2); + + vbc1 = vec_vcmpequb (vuc1, vuc2); + vbs2 = vec_vcmpequh (vus1, vus2); + vbi1 = vec_vcmpequw (vui1, vui2); + + vbi1 = vec_vcmpgefp (vf1, vf2); + vbi2 = vec_vcmpgtfp (vf1, vf2); + + vbc1 = vec_vcmpgtsb (vsc1, vsc2); + vbs1 = vec_vcmpgtsh (vss1, vss2); + vbi1 = vec_vcmpgtsw (vsi1, vsi2); + + vbc1 = vec_vcmpgtub (vuc1, vuc2); + vbs1 = vec_vcmpgtuh (vus1, vus2); + vbi1 = vec_vcmpgtuw (vui1, vui2); + + vsi1 = vec_vctsxs (vf1, 22); + vui1 = vec_vctuxs (vf2, 30); + + vf2 = vec_vexptefp (vf1); + vf1 = vec_vlogefp (vf2); + vf2 = vec_vmaddfp (vf1, vf2, vf2); + + vf1 = vec_vmaxfp (vf1, vf2); + vsc1 = vec_vmaxsb (vsc1, vsc2); + vss1 = vec_vmaxsh (vss1, vss2); + vsi1 = vec_vmaxsw (vsi1, vsi2); + vuc1 = vec_vmaxub (vuc1, vuc2); + vus1 = vec_vmaxuh (vus1, vus2); + vui1 = vec_vmaxuw (vui1, vui2); + + vbc1 = vec_vmrghb (vbc1, vbc2); + vp1 = vec_vmrghh (vp1, vp2); + vf2 = vec_vmrghw (vf2, vf1); + + vbc1 = vec_vmrglb (vbc1, vbc2); + vp1 = vec_vmrglh (vp1, vp2); + vf2 = vec_vmrglw (vf2, vf1); + + vf1 = vec_vminfp (vf1, vf2); + vsc1 = vec_vminsb (vsc1, vsc2); + vss1 = vec_vminsh (vss1, vss2); + vsi1 = vec_vminsw (vsi1, vsi2); + vuc1 = vec_vminub (vuc1, vuc2); + vus1 = vec_vminuh (vus1, vus2); + vui1 = vec_vminuw (vui1, vui2); + + vss1 = vec_vmhaddshs (vss1, vss2, vss2); + vss2 = vec_vmhraddshs (vss1, vss2, vss2); + vus1 = vec_vmladduhm (vus1, vus1, vus2); + vui1 = vec_vmsumubm (vuc1, vuc2, vui1); + vsi1 = vec_vmsummbm (vsc1, vuc2, vsi1); + vsi2 = vec_vmsumshm (vss1, vss2, vsi1); + vui1 = vec_vmsumuhm (vus1, vus2, vui2); + vui2 = vec_vmsumuhs (vus1, vus2, vui1); + vsi2 = vec_vmsumshs (vss1, vss1, vsi2); + + vus1 = vec_vmuleub (vuc1, vuc2); + vss1 = vec_vmulesb (vsc1, vsc2); + vui1 = vec_vmuleuh (vus1, vus2); + vsi1 = vec_vmulesh (vss1, vss2); + + vus2 = vec_vmuloub (vuc1, vuc2); + vss2 = vec_vmulosb (vsc1, vsc2); + vui2 = vec_vmulouh (vus1, vus2); + vsi2 = vec_vmulosh (vss1, vss2); + + vf1 = vec_vnmsubfp (vf1, vf2, vf1); + + vp1 = vec_vnor (vp1, vp2); + vf2 = vec_vor (vf2, vbi1); + vf2 = vec_vxor (vf2, vbi1); + + vsc1 = vec_vpkuhum (vss1, vss2); + vbs1 = vec_vpkuwum (vbi1, vbi2); + vp1 = vec_vpkpx (vui1, vui2); + vuc1 = vec_vpkuhus (vus1, vus1); + vsc1 = vec_vpkshss (vss1, vss2); + vus1 = vec_vpkuwus (vui1, vui2); + vss2 = vec_vpkswss (vsi1, vsi1); + vuc1 = vec_vpkshus (vss1, vss2); + vus1 = vec_vpkswus (vsi1, vsi1); + + vp1 = vec_vperm (vp1, vp2, vuc1); + + vf1 = vec_vrefp (vf2); + vf2 = vec_vrfin (vf1); + vf1 = vec_vrsqrtefp (vf2); + + vuc1 = vec_vrlb (vuc1, vuc2); + vss1 = vec_vrlh (vss2, vss1); + vui2 = vec_vrlw (vui2, vui1); + + vf1 = vec_vsel (vf2, vf1, vbi1); + + vuc1 = vec_vslb (vuc1, vuc2); + vss1 = vec_vslh (vss2, vss1); + vui2 = vec_vslw (vui2, vui1); + + vp1 = vec_vsldoi (vp2, vp1, 14); + vp2 = vec_vsl (vp1, vuc1); + vp1 = vec_vslo (vp2, vuc1); + + vbc1 = vec_vspltb (vbc1, 9); + vp2 = vec_vsplth (vp1, 7); + vf1 = vec_vspltw (vf2, 31); + vsc2 = vec_vspltisb (15); + vss1 = vec_vspltish (14); + vsi1 = vec_vspltisw (13); + + vuc1 = vec_vsrb (vuc1, vuc2); + vss1 = vec_vsrh (vss2, vss1); + vui2 = vec_vsrw (vui2, vui1); + vuc2 = vec_vsrab (vuc1, vuc2); + vss2 = vec_vsrah (vss2, vss1); + vui1 = vec_vsraw (vui2, vui1); + vp2 = vec_vsr (vp1, vuc1); + vp1 = vec_vsro (vp2, vuc1); + + vui1 = vec_vsubcuw (vui1, vui2); + vf1 = vec_vsubfp (vf1, vf2); + vsc1 = vec_vsubsbs (vsc1, vsc2); + vss1 = vec_vsubshs (vss1, vss2); + vsi1 = vec_vsubsws (vsi1, vsi2); + vuc1 = vec_vsububs (vuc1, vuc2); + vus1 = vec_vsubuhs (vus1, vus2); + vui1 = vec_vsubuws (vui1, vui2); + vuc1 = vec_vsububm (vuc1, vuc2); + vus1 = vec_vsubuhm (vus1, vus2); + vui1 = vec_vsubuwm (vui1, vui2); + + vui2 = vec_vsum4ubs (vuc1, vui1); + vsi1 = vec_vsum4sbs (vsc2, vsi1); + vsi1 = vec_vsum2sws (vsi1, vsi1); + vsi2 = vec_vsumsws (vsi2, vsi1); + + vf2 = vec_vrfiz (vf1); + + vbs1 = vec_vupkhsb (vbc1); + vui1 = vec_vupkhpx (vp1); + vbi1 = vec_vupkhsh (vbs1); + + vss1 = vec_vupklsb (vsc1); + vui1 = vec_vupklpx (vp2); + vbi1 = vec_vupklsh (vbs1); + + return vsi1; +} + +/* { dg-final { scan-assembler "\tlvebx " } } */ +/* { dg-final { scan-assembler "\tlvehx " } } */ +/* { dg-final { scan-assembler "\tlvewx " } } */ +/* { dg-final { scan-assembler "\tlvx " } } */ +/* { dg-final { scan-assembler "\tlvxl " } } */ +/* { dg-final { scan-assembler "\tstvebx " } } */ +/* { dg-final { scan-assembler "\tstvehx " } } */ +/* { dg-final { scan-assembler "\tstvewx " } } */ +/* { dg-final { scan-assembler "\tstvx " } } */ +/* { dg-final { scan-assembler "\tstvxl " } } */ + +/* { dg-final { scan-assembler "\tvaddcuw " } } */ +/* { dg-final { scan-assembler "\tvaddfp " } } */ +/* { dg-final { scan-assembler "\tvaddsbs " } } */ +/* { dg-final { scan-assembler "\tvaddshs " } } */ +/* { dg-final { scan-assembler "\tvaddsws " } } */ +/* { dg-final { scan-assembler "\tvaddubs " } } */ +/* { dg-final { scan-assembler "\tvadduhs " } } */ +/* { dg-final { scan-assembler "\tvadduws " } } */ +/* { dg-final { scan-assembler "\tvaddubm " } } */ +/* { dg-final { scan-assembler "\tvadduhm " } } */ +/* { dg-final { scan-assembler "\tvadduwm " } } */ + +/* { dg-final { scan-assembler "\tvand " } } */ +/* { dg-final { scan-assembler "\tvandc " } } */ + +/* { dg-final { scan-assembler "\tvavgsb " } } */ +/* { dg-final { scan-assembler "\tvavgsh " } } */ +/* { dg-final { scan-assembler "\tvavgsw " } } */ +/* { dg-final { scan-assembler "\tvavgub " } } */ +/* { dg-final { scan-assembler "\tvavguh " } } */ +/* { dg-final { scan-assembler "\tvavguw " } } */ + +/* { dg-final { scan-assembler "\tvcfsx " } } */ +/* { dg-final { scan-assembler "\tvcfux " } } */ + +/* { dg-final { scan-assembler "\tvcmpbfp " } } */ +/* { dg-final { scan-assembler "\tvcmpeqfp " } } */ + +/* { dg-final { scan-assembler "\tvcmpequb " } } */ +/* { dg-final { scan-assembler "\tvcmpequh " } } */ +/* { dg-final { scan-assembler "\tvcmpequw " } } */ + +/* { dg-final { scan-assembler "\tvcmpgefp " } } */ +/* { dg-final { scan-assembler "\tvcmpgtfp " } } */ + +/* { dg-final { scan-assembler "\tvcmpgtsb " } } */ +/* { dg-final { scan-assembler "\tvcmpgtsh " } } */ +/* { dg-final { scan-assembler "\tvcmpgtsw " } } */ + +/* { dg-final { scan-assembler "\tvcmpgtub " } } */ +/* { dg-final { scan-assembler "\tvcmpgtuh " } } */ +/* { dg-final { scan-assembler "\tvcmpgtuw " } } */ + +/* { dg-final { scan-assembler "\tvctsxs " } } */ +/* { dg-final { scan-assembler "\tvctuxs " } } */ + +/* { dg-final { scan-assembler "\tvexptefp " } } */ +/* { dg-final { scan-assembler "\tvlogefp " } } */ +/* { dg-final { scan-assembler "\tvmaddfp " } } */ + +/* { dg-final { scan-assembler "\tvmaxfp " } } */ +/* { dg-final { scan-assembler "\tvmaxsb " } } */ +/* { dg-final { scan-assembler "\tvmaxsh " } } */ +/* { dg-final { scan-assembler "\tvmaxsw " } } */ +/* { dg-final { scan-assembler "\tvmaxub " } } */ +/* { dg-final { scan-assembler "\tvmaxuh " } } */ +/* { dg-final { scan-assembler "\tvmaxuw " } } */ + +/* { dg-final { scan-assembler "\tvmrghb " } } */ +/* { dg-final { scan-assembler "\tvmrghh " } } */ +/* { dg-final { scan-assembler "\tvmrghw " } } */ + +/* { dg-final { scan-assembler "\tvmrglb " } } */ +/* { dg-final { scan-assembler "\tvmrglh " } } */ +/* { dg-final { scan-assembler "\tvmrglw " } } */ + +/* { dg-final { scan-assembler "\tvminfp " } } */ +/* { dg-final { scan-assembler "\tvminsb " } } */ +/* { dg-final { scan-assembler "\tvminsh " } } */ +/* { dg-final { scan-assembler "\tvminsw " } } */ +/* { dg-final { scan-assembler "\tvminub " } } */ +/* { dg-final { scan-assembler "\tvminuh " } } */ +/* { dg-final { scan-assembler "\tvminuw " } } */ + +/* { dg-final { scan-assembler "\tvmhaddshs " } } */ +/* { dg-final { scan-assembler "\tvmhraddshs " } } */ +/* { dg-final { scan-assembler "\tvmladduhm " } } */ +/* { dg-final { scan-assembler "\tvmsumubm " } } */ +/* { dg-final { scan-assembler "\tvmsummbm " } } */ +/* { dg-final { scan-assembler "\tvmsumshm " } } */ +/* { dg-final { scan-assembler "\tvmsumuhm " } } */ +/* { dg-final { scan-assembler "\tvmsumuhs " } } */ +/* { dg-final { scan-assembler "\tvmsumshs " } } */ + +/* { dg-final { scan-assembler "\tvmuleub " } } */ +/* { dg-final { scan-assembler "\tvmulesb " } } */ +/* { dg-final { scan-assembler "\tvmuleuh " } } */ +/* { dg-final { scan-assembler "\tvmulesh " } } */ + +/* { dg-final { scan-assembler "\tvmuloub " } } */ +/* { dg-final { scan-assembler "\tvmulosb " } } */ +/* { dg-final { scan-assembler "\tvmulouh " } } */ +/* { dg-final { scan-assembler "\tvmulosh " } } */ + +/* { dg-final { scan-assembler "\tvnmsubfp " } } */ + +/* { dg-final { scan-assembler "\tvnor " } } */ +/* { dg-final { scan-assembler "\tvor " } } */ +/* { dg-final { scan-assembler "\tvxor " } } */ + +/* { dg-final { scan-assembler "\tvpkuhum " } } */ +/* { dg-final { scan-assembler "\tvpkuwum " } } */ +/* { dg-final { scan-assembler "\tvpkpx " } } */ +/* { dg-final { scan-assembler "\tvpkuhus " } } */ +/* { dg-final { scan-assembler "\tvpkshss " } } */ +/* { dg-final { scan-assembler "\tvpkuwus " } } */ +/* { dg-final { scan-assembler "\tvpkswss " } } */ +/* { dg-final { scan-assembler "\tvpkshus " } } */ +/* { dg-final { scan-assembler "\tvpkswus " } } */ + +/* { dg-final { scan-assembler "\tvperm " } } */ + +/* { dg-final { scan-assembler "\tvrefp " } } */ +/* { dg-final { scan-assembler "\tvrfin " } } */ +/* { dg-final { scan-assembler "\tvrsqrtefp " } } */ + +/* { dg-final { scan-assembler "\tvrlb " } } */ +/* { dg-final { scan-assembler "\tvrlh " } } */ +/* { dg-final { scan-assembler "\tvrlw " } } */ + +/* { dg-final { scan-assembler "\tvsel " } } */ + +/* { dg-final { scan-assembler "\tvslb " } } */ +/* { dg-final { scan-assembler "\tvslh " } } */ +/* { dg-final { scan-assembler "\tvslw " } } */ + +/* { dg-final { scan-assembler "\tvsldoi " } } */ +/* { dg-final { scan-assembler "\tvsl " } } */ +/* { dg-final { scan-assembler "\tvslo " } } */ + +/* { dg-final { scan-assembler "\tvspltb " } } */ +/* { dg-final { scan-assembler "\tvsplth " } } */ +/* { dg-final { scan-assembler "\tvspltw " } } */ +/* { dg-final { scan-assembler "\tvspltisb " } } */ +/* { dg-final { scan-assembler "\tvspltish " } } */ +/* { dg-final { scan-assembler "\tvspltisw " } } */ + +/* { dg-final { scan-assembler "\tvsrb " } } */ +/* { dg-final { scan-assembler "\tvsrh " } } */ +/* { dg-final { scan-assembler "\tvsrw " } } */ +/* { dg-final { scan-assembler "\tvsrab " } } */ +/* { dg-final { scan-assembler "\tvsrah " } } */ +/* { dg-final { scan-assembler "\tvsraw " } } */ +/* { dg-final { scan-assembler "\tvsr " } } */ +/* { dg-final { scan-assembler "\tvsro " } } */ + +/* { dg-final { scan-assembler "\tvsubcuw " } } */ +/* { dg-final { scan-assembler "\tvsubfp " } } */ +/* { dg-final { scan-assembler "\tvsubsbs " } } */ +/* { dg-final { scan-assembler "\tvsubshs " } } */ +/* { dg-final { scan-assembler "\tvsubsws " } } */ +/* { dg-final { scan-assembler "\tvsububs " } } */ +/* { dg-final { scan-assembler "\tvsubuhs " } } */ +/* { dg-final { scan-assembler "\tvsubuws " } } */ +/* { dg-final { scan-assembler "\tvsububm " } } */ +/* { dg-final { scan-assembler "\tvsubuhm " } } */ +/* { dg-final { scan-assembler "\tvsubuwm " } } */ + +/* { dg-final { scan-assembler "\tvsum4ubs " } } */ +/* { dg-final { scan-assembler "\tvsum4sbs " } } */ +/* { dg-final { scan-assembler "\tvsum2sws " } } */ +/* { dg-final { scan-assembler "\tvsumsws " } } */ + +/* { dg-final { scan-assembler "\tvrfiz " } } */ + +/* { dg-final { scan-assembler "\tvupkhsb " } } */ +/* { dg-final { scan-assembler "\tvupkhpx " } } */ +/* { dg-final { scan-assembler "\tvupkhsh " } } */ + +/* { dg-final { scan-assembler "\tvupklsb " } } */ +/* { dg-final { scan-assembler "\tvupklpx " } } */ +/* { dg-final { scan-assembler "\tvupklsh " } } */ diff --git a/gcc/testsuite/gcc.apple/apple-altivec-13.c b/gcc/testsuite/gcc.apple/apple-altivec-13.c new file mode 100644 index 00000000000..f680d20eb7a --- /dev/null +++ b/gcc/testsuite/gcc.apple/apple-altivec-13.c @@ -0,0 +1,43 @@ +/* APPLE LOCAL file AltiVec */ +/* Additional AltiVec PIM argument type combinations. */ + +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-faltivec -Wall" } */ + +vector signed int +LoadUnalignedSI( signed int *p) +{ + vector signed int vload1 = vec_ld( 0, (vector signed int *)p); + if ( ((int)p) * 0xF){ + vector signed int vload2 = vec_ld( 16, (vector signed int *)p); + vector unsigned char vperm = vec_ldl( 0, p); + + vload1 = vec_perm(vload1, vload2, vperm); + } + return vload1; +} + +inline vector float Reciprocal( vector float v ) +{ + + vector float estimate = vec_re( v ); + + return vec_madd( vec_nmsub( estimate, v, (vector float) (1.0) ), estimate, estimate ); +} + +void foo(void) { + vector bool char vbc1 = (vector bool char)(255); + vector pixel vp1, vp2; + vector float vf1, vf2; + vector unsigned char vuc1; + vector unsigned short vus1, vus2; + vector bool short vbs1, vbs2; + vector signed short vss1; + vector signed int vsi1, vsi2; + vbc1 = vec_splat (vbc1, 9); + vp2 = vec_splat (vp1, 7); + vf1 = vec_splat (vf2, 31); + vuc1 = vec_pack (vus1, vus2); + vbc1 = vec_pack (vbs1, vbs2); + vss1 = vec_pack (vsi1, vsi2); +} diff --git a/gcc/testsuite/gcc.apple/apple-altivec-14.c b/gcc/testsuite/gcc.apple/apple-altivec-14.c new file mode 100644 index 00000000000..0bb1dcd1d3a --- /dev/null +++ b/gcc/testsuite/gcc.apple/apple-altivec-14.c @@ -0,0 +1,15 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-faltivec" } */ +/* Existing AltiVec PIM implementations allow numeric literals with + any number of bits, so long as the value is within allowed range. */ +int foo(void) +{ + vector unsigned char amask = vec_splat_u8 ( 0xFFFFFFF3L ); + vector signed short bmask = vec_splat_s16 ( 0xFFFFFFFFFFFFFFF1LL ); +} + + +/* { dg-final { scan-assembler "vspltisb.+\\-13" } } */ +/* { dg-final { scan-assembler "vspltish.+\\-15" } } */ + diff --git a/gcc/testsuite/gcc.apple/apple-altivec-15.c b/gcc/testsuite/gcc.apple/apple-altivec-15.c new file mode 100644 index 00000000000..96bee290c9b --- /dev/null +++ b/gcc/testsuite/gcc.apple/apple-altivec-15.c @@ -0,0 +1,39 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-faltivec" } */ + +union agg_def { + vector unsigned int v ; + unsigned int i; +}; + +extern void abort(); + +int my_vec_all_eq(union agg_def a, union agg_def b); +int compare(int d1, int d2); + +int main() { + union agg_def a, b, d1, d2; + + d1.i = 0; + d2.i = 1; + a.v = (vector unsigned int) (2,3,4,5); + b.v = (vector unsigned int) (2,3,4,5); + + d1.i = my_vec_all_eq(a, b); + d2.i = vec_all_eq(a.v, b.v); + + if (compare(d1.i, d2.i)) + return 0; + else + abort(); +} + +int my_vec_all_eq(union agg_def a, union agg_def b) { + return vec_all_eq(a.v, b.v); +} + +int compare(int d1, int d2) { + return (d1 == d2); +} + diff --git a/gcc/testsuite/gcc.apple/apple-altivec-2.c b/gcc/testsuite/gcc.apple/apple-altivec-2.c new file mode 100644 index 00000000000..dddf761b670 --- /dev/null +++ b/gcc/testsuite/gcc.apple/apple-altivec-2.c @@ -0,0 +1,95 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do run { target powerpc*-*-darwin* } } */ +/* { dg-options "-faltivec" } */ + +/* Program to test PowerPC AltiVec instructions. */ + +#include "../gcc.dg/altivec_check.h" + +extern void abort (void); +#define CHECK_IF(E) if(!(E)) abort() + +vector int a1 = (vector int)( 100, 200, 300, 400 ); +vector int a2 = (vector int)( 500, 600, 700, 800 ); +vector int addi = (vector int)( 600, 800, 1000, 1200 ); +vector int avgi = (vector int)( 300, 400, 500, 600 ); + +vector float f1 = (vector float)( 1.0, 2.0, 3.0, 4.0 ); +vector float f2 = (vector float)( 5.0, 6.0, 7.0, 8.0 ); +vector float f3; +vector float addf1 = (vector float)( 6.0, 8.0, 10.0, 12.0 ); +vector float addf2 = (vector float)( 6.1, 8.1, 10.1, 12.1 ); +vector float addf3 = (vector float)( 6.0, 8.0, 9.9, 12.1 ); +vector int k; +vector float f, g, h; + +int main () +{ + + altivec_check(); /* Exit if AltiVec not available. */ + + k = vec_add (a1, a2); + CHECK_IF (vec_all_eq (addi, k)); + CHECK_IF (vec_all_ge (addi, k)); + CHECK_IF (vec_all_le (addi, k)); + CHECK_IF (vec_any_eq (addi, k)); + CHECK_IF (vec_any_ge (addi, k)); + CHECK_IF (vec_any_le (addi, k)); + CHECK_IF (!vec_any_ne (addi, k)); + CHECK_IF (!vec_any_lt (addi, k)); + CHECK_IF (!vec_any_gt (addi, k)); + CHECK_IF (!vec_any_ne (addi, k)); + CHECK_IF (!vec_any_lt (addi, k)); + CHECK_IF (!vec_any_gt (addi, k)); + + k = vec_avg (a1, a2); + CHECK_IF (vec_all_eq (k, avgi)); + + h = vec_add (f1, f2); + CHECK_IF (vec_all_eq (h, addf1)); + CHECK_IF (vec_all_ge (h, addf1)); + CHECK_IF (vec_all_le (h, addf1)); + CHECK_IF (vec_any_eq (h, addf1)); + CHECK_IF (vec_any_ge (h, addf1)); + CHECK_IF (vec_any_le (h, addf1)); + CHECK_IF (!vec_any_ne (h, addf1)); + CHECK_IF (!vec_any_lt (h, addf1)); + CHECK_IF (!vec_any_gt (h, addf1)); + CHECK_IF (!vec_any_ne (h, addf1)); + CHECK_IF (!vec_any_lt (h, addf1)); + CHECK_IF (!vec_any_gt (h, addf1)); + + CHECK_IF (vec_all_gt (addf2, addf1)); + CHECK_IF (vec_any_gt (addf2, addf1)); + CHECK_IF (vec_all_ge (addf2, addf1)); + CHECK_IF (vec_any_ge (addf2, addf1)); + CHECK_IF (vec_all_ne (addf2, addf1)); + CHECK_IF (vec_any_ne (addf2, addf1)); + CHECK_IF (!vec_all_lt (addf2, addf1)); + CHECK_IF (!vec_any_lt (addf2, addf1)); + CHECK_IF (!vec_all_le (addf2, addf1)); + CHECK_IF (!vec_any_le (addf2, addf1)); + CHECK_IF (!vec_all_eq (addf2, addf1)); + CHECK_IF (!vec_any_eq (addf2, addf1)); + + CHECK_IF (vec_any_eq (addf3, addf1)); + CHECK_IF (vec_any_ne (addf3, addf1)); + CHECK_IF (vec_any_lt (addf3, addf1)); + CHECK_IF (vec_any_le (addf3, addf1)); + CHECK_IF (vec_any_gt (addf3, addf1)); + CHECK_IF (vec_any_ge (addf3, addf1)); + CHECK_IF (!vec_all_eq (addf3, addf1)); + CHECK_IF (!vec_all_ne (addf3, addf1)); + CHECK_IF (!vec_all_lt (addf3, addf1)); + CHECK_IF (!vec_all_le (addf3, addf1)); + CHECK_IF (!vec_all_gt (addf3, addf1)); + CHECK_IF (!vec_all_ge (addf3, addf1)); + + CHECK_IF (vec_all_numeric (addf3)); + CHECK_IF (vec_all_in (addf1, addf2)); + + CHECK_IF (vec_step (vector bool char) == 16); + CHECK_IF (vec_step (addf3) == 4); + + return 0; +} diff --git a/gcc/testsuite/gcc.apple/apple-altivec-3.c b/gcc/testsuite/gcc.apple/apple-altivec-3.c new file mode 100644 index 00000000000..1112913de1b --- /dev/null +++ b/gcc/testsuite/gcc.apple/apple-altivec-3.c @@ -0,0 +1,14 @@ +/* APPLE LOCAL file AltiVec */ +/* Providing '-maltivec' should ensure that AltiVec codegen for block copies is enabled, + even if '-faltivec' is also specified. */ +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-faltivec -maltivec" } */ +typedef struct { vector int a; vector int b; } Scld1; + +void testvaScld1 (int n, Scld1); + +void foo () +{ + Scld1 g1sScld1; + testvaScld1 (1, g1sScld1); /* { dg-bogus "disabled" } */ +} diff --git a/gcc/testsuite/gcc.apple/apple-altivec-4.c b/gcc/testsuite/gcc.apple/apple-altivec-4.c new file mode 100644 index 00000000000..d05aac5fedc --- /dev/null +++ b/gcc/testsuite/gcc.apple/apple-altivec-4.c @@ -0,0 +1,20 @@ +/* APPLE LOCAL file AltiVec */ +/* Additional AltiVec PIM argument type combinations. */ + +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-faltivec" } */ + +typedef float R; +typedef vector float V; +V gV = (vector float)(0.3, 0.4, 0.5, 0.6); + +void foo(int ovs) { + vector float vFGravity1, vFGravity2, vCombined1OverR_12 = (vector float)(0.3); + V v; R *x = (R *)&gV; + + vFGravity1 = vec_mergeh(vCombined1OverR_12, vCombined1OverR_12); + vFGravity2 = vec_mergel(vCombined1OverR_12, vCombined1OverR_12); + + vec_ste (v, 0, x); + vec_ste (v, 4 + ovs, x); +} diff --git a/gcc/testsuite/gcc.apple/apple-altivec-5.c b/gcc/testsuite/gcc.apple/apple-altivec-5.c new file mode 100644 index 00000000000..0c7dd9bcb60 --- /dev/null +++ b/gcc/testsuite/gcc.apple/apple-altivec-5.c @@ -0,0 +1,31 @@ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-maltivec" } */ + +#include <altivec.h> + +extern void abort(); + +int main() +{ + vector float tiny = (vector float) ((vector unsigned int) (0x00800000, 0xBF800000, 0x3E800000, 0)); + unsigned int af[4] = { + (unsigned int)(unsigned int)0x00800000, + (unsigned int)(unsigned int)0xBF800000, + (unsigned int)(unsigned int)0x3E800000, + (unsigned int)(unsigned int)0}; + + union u { + vector float vf; + unsigned int ai[4]; + }vu; + int i; + + vu.vf = tiny; + + for (i=0; i < 4; i++) + if (af[i] != vu.ai[i]) + abort(); + + return 0; +} + diff --git a/gcc/testsuite/gcc.apple/apple-altivec-6.c b/gcc/testsuite/gcc.apple/apple-altivec-6.c new file mode 100644 index 00000000000..09e1f6861bf --- /dev/null +++ b/gcc/testsuite/gcc.apple/apple-altivec-6.c @@ -0,0 +1,31 @@ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-maltivec" } */ + +#include <altivec.h> + +extern void abort(); + +int main() +{ + vector unsigned int tiny = (vector unsigned int) ((vector signed int) (0x00800000, 0xBF800000, 0x3E800000, 0)); + unsigned int af[4] = { + (signed int)0x00800000, + (signed int)0xBF800000, + (signed int)0x3E800000, + (signed int)0}; + + union u { + vector unsigned int vf; + unsigned int ai[4]; + }vu; + int i; + + vu.vf = tiny; + + for (i=0; i < 4; i++) + if (af[i] != vu.ai[i]) + abort(); + + return 0; +} + diff --git a/gcc/testsuite/gcc.apple/apple-altivec-7.c b/gcc/testsuite/gcc.apple/apple-altivec-7.c new file mode 100644 index 00000000000..ffbb408aadd --- /dev/null +++ b/gcc/testsuite/gcc.apple/apple-altivec-7.c @@ -0,0 +1,34 @@ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-maltivec" } */ + +#include <altivec.h> + +extern void abort(); + +int main() +{ + + static vector float vINF = + ( vector float ) ( ( vector unsigned int ) ( 0x7F800000, 0x7F800000, 0x7F800000, 0x7F800000 ) ); + + unsigned int af[4] = { + (unsigned int)0x7F800000, + (unsigned int)0x7F800000, + (unsigned int)0x7F800000, + (unsigned int)0x7F800000}; + + union u { + vector float vf; + unsigned int ai[4]; + }vu; + + int i; + + vu.vf = vINF; + + for (i=0; i < 4; i++) + if (af[i] != vu.ai[i]) + abort(); + + return 0; +} diff --git a/gcc/testsuite/gcc.apple/apple-altivec-8.c b/gcc/testsuite/gcc.apple/apple-altivec-8.c new file mode 100644 index 00000000000..fb2389526d2 --- /dev/null +++ b/gcc/testsuite/gcc.apple/apple-altivec-8.c @@ -0,0 +1,36 @@ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-maltivec -O2" } */ + +/* ICEs at -O1 or more */ + +#include <altivec.h> + +extern void abort(); + +int main() +{ + + const static vector float vINF = + ( vector float ) ( ( vector unsigned int ) ( 0x7F800000, 0x7F800000, 0x7F800000, 0x7F800000 ) ); + + unsigned int af[4] = { + (unsigned int)0x7F800000, + (unsigned int)0x7F800000, + (unsigned int)0x7F800000, + (unsigned int)0x7F800000}; + + union u { + vector float vf; + unsigned int ai[4]; + }vu; + + int i; + + vu.vf = vINF; + + for (i=0; i < 4; i++) + if (af[i] != vu.ai[i]) + abort(); + + return 0; +} diff --git a/gcc/testsuite/gcc.apple/apple-altivec-9.c b/gcc/testsuite/gcc.apple/apple-altivec-9.c new file mode 100644 index 00000000000..938baca5356 --- /dev/null +++ b/gcc/testsuite/gcc.apple/apple-altivec-9.c @@ -0,0 +1,9 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-faltivec -ftrapping-math" } */ + +int vConvert_PlanarFtoPlanar16F( ) +{ + vector float twoP10 = (vector float) (0x1.0p+10f, 0x1.0p+24f, 0x1.0p+102f, 1.0f/0.0f ); + return 0; +} diff --git a/gcc/testsuite/gcc.apple/apple-altivec-abi-test.c b/gcc/testsuite/gcc.apple/apple-altivec-abi-test.c new file mode 100644 index 00000000000..5361cc7d314 --- /dev/null +++ b/gcc/testsuite/gcc.apple/apple-altivec-abi-test.c @@ -0,0 +1,39 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-O -faltivec" } */ +/* { dg-final { scan-assembler "vspltisw v2,1" } } */ +/* { dg-final { scan-assembler "vspltisw v3,2" } } */ +/* { dg-final { scan-assembler "vspltisw v4,3" } } */ +/* { dg-final { scan-assembler "vspltisw v5,4" } } */ +/* { dg-final { scan-assembler "vspltisw v6,5" } } */ +/* { dg-final { scan-assembler "vspltisw v7,6" } } */ +/* { dg-final { scan-assembler "vspltisw v8,7" } } */ +/* { dg-final { scan-assembler "vspltisw v9,8" } } */ +/* { dg-final { scan-assembler "vspltisw v10,9" } } */ +/* { dg-final { scan-assembler "vspltisw v11,10" } } */ +/* { dg-final { scan-assembler "vspltisw v12,11" } } */ +/* { dg-final { scan-assembler "vspltisw v13,12" } } */ + +void +foo (vector signed int v0, vector signed int v1, vector signed int v2, + vector signed int v3, vector signed int v4, vector signed int v5, + vector signed int v6, vector signed int v7, vector signed int v8, + vector signed int v9, vector signed int v10, vector signed int v11, + vector signed int v12, + int z, double u); + +int main(void) +{ + foo ((vector signed int) ( 1 ), (vector signed int) ( 2 ), + (vector signed int) ( 3 ), + (vector signed int) ( 4 ), (vector signed int) ( 5 ), + (vector signed int) ( 6 ), (vector signed int) ( 7 ), + (vector signed int) ( 8 ), (vector signed int) ( 9 ), + (vector signed int) ( 10 ), (vector signed int) ( 11 ), + (vector signed int) ( 12 ), (vector signed int) ( 13 ), + 20, 3.0); +} + + + + diff --git a/gcc/testsuite/gcc.apple/apple-altivec-abi.c b/gcc/testsuite/gcc.apple/apple-altivec-abi.c new file mode 100644 index 00000000000..264791801c9 --- /dev/null +++ b/gcc/testsuite/gcc.apple/apple-altivec-abi.c @@ -0,0 +1,66 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-faltivec" } */ + +#include <stdio.h> + +typedef vector signed int VSI; + +VSI VI( + VSI v2, + int gpr3, + VSI v3, + int gpr4, + VSI v4, + int gpr5, + VSI v5, + int gpr6, + int gpr7, + int gpr8, + int gpr9, + VSI v6, + int gpr10, /* gpr3-gpr10 in registers */ + VSI v7, + VSI v8, + VSI v9, + VSI v10, + VSI v11, + VSI v12, + VSI v13, /* All in v2-v13 */ + volatile VSI v14, + int gpr11, + int gpr12, + int gpr13, + int gpr14, + VSI v15, + VSI v16, int* sum) +{ + *sum = gpr3 + gpr4 + gpr5 + gpr6 + gpr7 + gpr8 + gpr9 + gpr10 + gpr11 + gpr12 + gpr13 + gpr14; + return v2+v3+v4+v5+v6+v7+v8+v9+v10+v11+v12+v13+v14+v15+v16; +} + +extern void abort(); + +int main() +{ + union u { + VSI uv; + int val[4]; + } union_var; + + int i; + + int sum; + union_var.uv = + VI((VSI){1,1,1,1},3,(VSI){1,1,1,1},4,(VSI){1,1,1,1},5,(VSI){1,1,1,1},6,7,8,9, + (VSI){1,1,1,1},10,(VSI){1,1,1,1},(VSI){1,1,1,1},(VSI){1,1,1,1},(VSI){1,1,1,1}, + (VSI){1,1,1,1},(VSI){1,1,1,1},(VSI){1,1,1,1},(VSI){1,1,1,1},11,12,13,14, + (VSI){1,1,1,1},(VSI){1,1,1,1}, &sum); + if (sum != 102) + abort(); + + for (i=0; i < 4; i++) + if (union_var.val[i] != 15) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.apple/apple-altivec-builtin-nanf.c b/gcc/testsuite/gcc.apple/apple-altivec-builtin-nanf.c new file mode 100644 index 00000000000..fb9253929f2 --- /dev/null +++ b/gcc/testsuite/gcc.apple/apple-altivec-builtin-nanf.c @@ -0,0 +1,8 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-faltivec" } */ + +void _sqrt() +{ + __vector float vNAN = (__vector float)(__builtin_nanf("0x7fc00000")); +} diff --git a/gcc/testsuite/gcc.apple/applecc.c b/gcc/testsuite/gcc.apple/applecc.c new file mode 100644 index 00000000000..757ad573272 --- /dev/null +++ b/gcc/testsuite/gcc.apple/applecc.c @@ -0,0 +1,14 @@ +/* APPLE LOCAL file Apple version */ +/* { dg-do compile } */ + +#if __APPLE_CC__ < 1000 +#error build number too small +#endif +#if __APPLE_CC__ > 32768 +#error build number too big +#endif +#if ! ( __APPLE_CC__ > 1000) +#error build number not really a number +#endif + +int x = __APPLE_CC__; diff --git a/gcc/testsuite/gcc.apple/asm-array-ref.c b/gcc/testsuite/gcc.apple/asm-array-ref.c new file mode 100644 index 00000000000..c66c29bc734 --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-array-ref.c @@ -0,0 +1,20 @@ +/* APPLE LOCAL file CW asm blocks */ +/* { dg-do assemble { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks" } */ + +struct x { + int filler; + float f[100]; +}; + +asm void func() +{ + lwz r4, x.f[0](r2) + lwz r5, x.f[0]+4(r2) +} + +int main (int argc, char * const argv[]) +{ + func(); +} + diff --git a/gcc/testsuite/gcc.apple/asm-block-1.c b/gcc/testsuite/gcc.apple/asm-block-1.c new file mode 100644 index 00000000000..3ad73fb12f7 --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-block-1.c @@ -0,0 +1,75 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test asm-syntax blocks within functions. */ + +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks" } */ + +void abort(void); + +int +foo (int argx, int argy) +{ + register int locx = argx, locy = argy, rslt; + asm { + add rslt,locx,locy + } + return rslt; +} + +/* Exercise corners of syntax. */ + +int +bar () +{ + register int rslt = 100; + asm { + // Combos of instructions on a line + + nop + ; + nop + nop ; + ; nop + nop ; nop + ; nop ;;; li r3,95 ; nop ; + // '.' in an opcode + add. r6,r6,r5 + } + return rslt; +} + +int baz () +{ + register int rslt = 1; + asm { + li r8,29+(2 * 3); + add rslt,rslt,r8; + b @192 + @34 + nop + ble+ @34 + b forward + abc: + b abc + @abc: + b @abc + forward: ; @192: + nop + ; + sameline: nop + x1: @x2 @x3: nop ; @x4 x5: + } + return rslt; +} + +int +main () +{ + if (foo (22, 23) != 45) + abort (); + if (bar () != 100) + abort (); + if (baz () != 36) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.apple/asm-block-2.c b/gcc/testsuite/gcc.apple/asm-block-2.c new file mode 100644 index 00000000000..586f2c73357 --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-block-2.c @@ -0,0 +1,88 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test structure refs in asm-syntax blocks within functions. */ + +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks -O2" } */ + +void abort(void); + + +typedef struct astruct { + int arr[40]; + char charfield; + int fieldx; + int fieldy; +} atypedef; + +union aunion { + int field1; + int field2; +}; + +int fun1 (struct astruct *x) +{ + int loc; + asm { + lwz loc, astruct.fieldx(x) + addi loc, loc, 42 + stw loc, astruct.fieldx+4(x) + } + return loc; +} + +int fun2 (atypedef *x) +{ + int loc; + + asm { + lwz loc, atypedef.fieldx(r3) + addi loc, loc, 43 + stw loc, 4 + astruct.fieldx(x) + } + return loc; +} + +int fun3(int arg) +{ + int loc; + + asm { + mr loc, r3 + addi loc, loc, aunion.field1 + } + return loc; +} + +int fun4 (struct astruct *arg) +{ + int loc; + asm { + lbz loc, arg->charfield + addi loc, loc, 1 + } + return loc; +} + +struct astruct glob; +union uglob; + +int +main () +{ + glob.charfield = 'b'; + glob.fieldx = 22; + if (fun1 (&glob) != 64) + abort (); + if (glob.fieldy != 64) + abort (); + if (fun2 (&glob) != 65) + abort (); + if (glob.fieldy != 65) + abort (); + if (fun3 (89) != 89) + abort (); + if (fun4 (&glob) != 'c') + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.apple/asm-block-3.c b/gcc/testsuite/gcc.apple/asm-block-3.c new file mode 100644 index 00000000000..c3071dceaf2 --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-block-3.c @@ -0,0 +1,11 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test single line asms */ + +/* { dg-do compile } */ +/* { dg-options "-fasm-blocks" } */ + +void +bar () +{ + asm { nop }; +} diff --git a/gcc/testsuite/gcc.apple/asm-block-4.c b/gcc/testsuite/gcc.apple/asm-block-4.c new file mode 100644 index 00000000000..5bafb6df7f3 --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-block-4.c @@ -0,0 +1,11 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test -40(sp) in asm-syntax blocks within functions. */ + +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks" } */ + +void foo() { + asm { + stfd f9,-40(sp); + } +} diff --git a/gcc/testsuite/gcc.apple/asm-block-5.c b/gcc/testsuite/gcc.apple/asm-block-5.c new file mode 100644 index 00000000000..e6465f473a7 --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-block-5.c @@ -0,0 +1,19 @@ +/* APPLE LOCAL begin radar 4125900 */ +/* Test interaction of optimization on memory references in CW asm block. */ + +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-fasm-blocks -O2" } */ + +void Process() +{ + long BufferSize; + long ControlRate; + long lBlocks=(BufferSize/ControlRate)+(BufferSize?1:0); + + asm + { + lwz r23, lBlocks + lwz r24, BufferSize + } +} +/* APPLE LOCAL end radar 4125900 */ diff --git a/gcc/testsuite/gcc.apple/asm-function-1.c b/gcc/testsuite/gcc.apple/asm-function-1.c new file mode 100644 index 00000000000..9a031f27386 --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-function-1.c @@ -0,0 +1,51 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test whole asm functions. */ + +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks -O2" } */ + +void abort(void); + +asm int +foo (register int argx, register int argy) +{ + add r3, argx, argy +} + +#define rsltreg r3 + +asm int +foo1 (register int argx, register int argy) +{ + register int loc1, loc2; + nop + li loc1, 100 + li rsltreg,0 + b @a34 + add rsltreg, argx, argy +@a34 + add rsltreg, rsltreg, loc1 + blr +} + +extern asm int foo2(int x, float y) +{ +#pragma unused(x) +#pragma unused(x,y) + li rsltreg, 48; +#pragma unused(y) + nop +#pragma unused(x) +} + +int +main () +{ + if (foo (22, 23) != 45) + abort (); + if (foo1 (1, 2) != 100) + abort (); + if (foo2 (100, 1.2) != 48) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.apple/asm-function-10.c b/gcc/testsuite/gcc.apple/asm-function-10.c new file mode 100644 index 00000000000..46c5cb09591 --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-function-10.c @@ -0,0 +1,16 @@ +/* APPLE LOCAL file CW asm blocks */ +/* { dg-do assemble { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks" } */ + +asm void foo() +{ + lis r1,(kUndefindedConstant<<10)|(3<<5)|(7) + rlwinm r0,r2,16+kUndefindedConstant,31 /* { dg-error "block assembly operand not recognized" } */ + cmpwi cr7,r1,kUndefindedConstant-1 /* { dg-error "block assembly operand not recognized" } */ +} /* { dg-error "block assembly operand not recognized" } */ + +int main (int argc, char * const argv[]) +{ + foo(); +} + diff --git a/gcc/testsuite/gcc.apple/asm-function-11.c b/gcc/testsuite/gcc.apple/asm-function-11.c new file mode 100644 index 00000000000..e75f3c132f8 --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-function-11.c @@ -0,0 +1,24 @@ +/* APPLE LOCAL file CW asm blocks */ +/* { dg-do assemble { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks" } */ + +struct tDummyStruct +{ + unsigned long fDummy; + unsigned long fSample; +}; + +asm void foo() +{ + lwz r1,-8+tDummyStruct.fSample(r2) + stw r1,-8+tDummyStruct.fSample(r2) + lwz r1,-8-(tDummyStruct.fSample-tDummyStruct.fDummy)(r2) + stw r1,-8-(tDummyStruct.fSample-tDummyStruct.fDummy)(r2) +} + +int main (int argc, char * const argv[]) +{ + foo(); +} + + diff --git a/gcc/testsuite/gcc.apple/asm-function-12.c b/gcc/testsuite/gcc.apple/asm-function-12.c new file mode 100644 index 00000000000..5a1a3d6af55 --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-function-12.c @@ -0,0 +1,18 @@ +/* APPLE LOCAL file CW asm blocks */ +/* { dg-do assemble { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks" } */ + +asm void foo() +{ + b .+8 + bl .+24 + b .-8 + bl .-32 + andi. r1,r0,2 +} + +int main (int argc, char * const argv[]) +{ + foo(); +} + diff --git a/gcc/testsuite/gcc.apple/asm-function-13.c b/gcc/testsuite/gcc.apple/asm-function-13.c new file mode 100644 index 00000000000..ace3cba12ef --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-function-13.c @@ -0,0 +1,26 @@ +/* APPLE LOCAL file CW asm blocks */ +/* { dg-do assemble { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks" } */ + +asm void foo() +{ + .align 15 + andi. r1,r2, 3 + .align 10 + b .+8 + .align 4 + b .-16 + .align 3 + lha r1, 4(r3) + .align 4 + add r1,r2,r3 + .align 3 + .align 4 +} + +int main (int argc, char * const argv[]) +{ + foo(); +} + + diff --git a/gcc/testsuite/gcc.apple/asm-function-14.c b/gcc/testsuite/gcc.apple/asm-function-14.c new file mode 100644 index 00000000000..56458390f4c --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-function-14.c @@ -0,0 +1,11 @@ +/* APPLE LOCAL file CW asm blocks */ +/* { dg-do assemble { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks" } */ + +asm void foo() +{ + dcbst r0,r5 /* { dg-error "r0 not allowed for parameter 1" } */ + + li r1, kUndefindedConstant /* { dg-error "expression must be absolute" } */ + +} diff --git a/gcc/testsuite/gcc.apple/asm-function-15.c b/gcc/testsuite/gcc.apple/asm-function-15.c new file mode 100644 index 00000000000..f7f4162aaee --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-function-15.c @@ -0,0 +1,19 @@ +/* APPLE LOCAL file CW asm blocks */ +/* { dg-do assemble { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks" } */ +/* Test for use of '*' in a relative jump. This is to conform with CW compiler. */ + +asm void foo() +{ + b *+8 + bl *+24 + b *-8 + bl *-32 + andi. r1,r0,2 +} + +int main (int argc, char * const argv[]) +{ + foo(); +} + diff --git a/gcc/testsuite/gcc.apple/asm-function-16.c b/gcc/testsuite/gcc.apple/asm-function-16.c new file mode 100644 index 00000000000..41a8a05cc12 --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-function-16.c @@ -0,0 +1,21 @@ +/* APPLE LOCAL file CW asm blocks */ +/* { dg-do assemble { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks" } */ + +signed short foo(signed int a, signed short b) +{ + b = a * -1; + + asm { + bl *+24 + bl *-32 + b .+8 + } + return b; +} + +int main (int argc, char * const argv[]) +{ + return foo(1,2); +} + diff --git a/gcc/testsuite/gcc.apple/asm-function-17.c b/gcc/testsuite/gcc.apple/asm-function-17.c new file mode 100644 index 00000000000..457b8836e5c --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-function-17.c @@ -0,0 +1,23 @@ +/* APPLE LOCAL file CW asm blocks */ +/* { dg-do assemble { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks" } */ + +typedef struct astruct { + int fieldy; + int fieldx; +} atypedef; + +void fun2 () +{ + register int R3 asm ("r3"); + register int R4 asm ("r4"); + + asm { + stw R4, atypedef.fieldx(R3) + } +} + +int main() +{ + return 0; +} diff --git a/gcc/testsuite/gcc.apple/asm-function-18.c b/gcc/testsuite/gcc.apple/asm-function-18.c new file mode 100644 index 00000000000..4f180a4f97f --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-function-18.c @@ -0,0 +1,84 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test that gcc does not issue error on use of r31 (pic register) */ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks -faltivec" } */ + +asm void saveNonvolatileRegistersPPC(register unsigned long *saveBuffer) +{ + // zero offset register + xor r10, r10, r10 + // store stack pointer (4 bytes) + stwx r1, r3, r10 + addi r10, r10, 4 + // store gpr's 13 through 31 (72 bytes) + stwx r13, r3, r10 + addi r10, r10, 4 + stwx r14, r3, r10 + addi r10, r10, 4 + stwx r15, r3, r10 + addi r10, r10, 4 + stwx r16, r3, r10 + addi r10, r10, 4 + stwx r17, r3, r10 + addi r10, r10, 4 + stwx r18, r3, r10 + addi r10, r10, 4 + stwx r19, r3, r10 + addi r10, r10, 4 + stwx r20, r3, r10 + addi r10, r10, 4 + stwx r21, r3, r10 + addi r10, r10, 4 + stwx r22, r3, r10 + addi r10, r10, 4 + stwx r23, r3, r10 + addi r10, r10, 4 + stwx r24, r3, r10 + addi r10, r10, 4 + stwx r25, r3, r10 + addi r10, r10, 4 + stwx r26, r3, r10 + addi r10, r10, 4 + stwx r27, r3, r10 + addi r10, r10, 4 + stwx r28, r3, r10 + addi r10, r10, 4 + stwx r29, r3, r10 + addi r10, r10, 4 + stwx r30, r3, r10 + addi r10, r10, 4 + stwx r31, r3, r10 + addi r10, r10, 4 + + // Store VRSAVE (4 bytes) + mfspr r11, 256 + stwx r11, r3, r10 + addi r10, r10, 4 + + // store vector registers 20 - 31 (176 bytes) + stvx v20, r3, r10 + addi r10, r10, 16 + stvx v21, r3, r10 + addi r10, r10, 16 + stvx v22, r3, r10 + addi r10, r10, 16 + stvx v23, r3, r10 + addi r10, r10, 16 + stvx v24, r3, r10 + addi r10, r10, 16 + stvx v25, r3, r10 + addi r10, r10, 16 + stvx v26, r3, r10 + addi r10, r10, 16 + stvx v27, r3, r10 + addi r10, r10, 16 + stvx v28, r3, r10 + addi r10, r10, 16 + stvx v29, r3, r10 + addi r10, r10, 16 + stvx v30, r3, r10 + addi r10, r10, 16 + stvx v31, r3, r10 + + blr +} diff --git a/gcc/testsuite/gcc.apple/asm-function-2.c b/gcc/testsuite/gcc.apple/asm-function-2.c new file mode 100644 index 00000000000..9ac177eff08 --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-function-2.c @@ -0,0 +1,73 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test whole asm functions. */ + +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks -O2" } */ + +void abort(void); + +asm void normal_fn () +{ + nop +} + +asm void nofralloc_fn () +{ + nofralloc + nop + blr +} + +asm void fralloc_fn () +{ + fralloc + nop +} + +asm int fralloc_fn_1 () +{ + fralloc + mr r4,r1 + frfree + sub r3,r4,r1 + blr +} + +asm int fralloc_fn_2 () +{ + fralloc 1000 + nop + frfree + blr +} + +asm int fralloc_fn_3 () +{ + int loc1, loc2; + fralloc 41 + nop + mr r3, loc2 + frfree + mr r3, loc1 + blr +} + +asm int f6 () +{ + opword 0x386004d2 /* li r3,1234 */ +} + +main() +{ + normal_fn (); + nofralloc_fn (); + fralloc_fn (); + /* + fralloc_fn_1 (); + fralloc_fn_2 (); + fralloc_fn_3 (); + */ + if (f6 () != 1234) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.apple/asm-function-3.c b/gcc/testsuite/gcc.apple/asm-function-3.c new file mode 100644 index 00000000000..944900fb75b --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-function-3.c @@ -0,0 +1,26 @@ +/* APPLE LOCAL file CW asm blocks */ +/* More tests of asm functions. */ + +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks -O2" } */ + +void abort(void); + +/* Return 0 if xer and spr1 both have the same data. */ + +asm int +test_spr () +{ + mfspr r5,xer + mfspr r4,spr1 + sub r3,r4,r5 +} + +int +main () +{ + if (test_spr ()) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.apple/asm-function-4.c b/gcc/testsuite/gcc.apple/asm-function-4.c new file mode 100644 index 00000000000..f3889a413bd --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-function-4.c @@ -0,0 +1,62 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test asm with macros. */ + +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks -O2" } */ + +void abort(void); + +#define mac1 add r3, argx, argy + +asm int +foo (register int argx, register int argy) +{ + mac1 +} + +#define rsltreg r3 +#define mac2(x,y) add rsltreg,x,y + +asm int +foo1 (register int argx, register int argy) +{ + register int loc1, loc2; + nop + li loc1, 100 + li rsltreg,0 + b @a34 + mac2(argx,argy) +@a34 + mac2(rsltreg,loc1) + blr +} + +#define limac li +#define num 48 + +asm int foo2(int x, float y) +{ +#pragma unused(x) +#pragma unused(x,y) + limac rsltreg, num; +#define mac3(zzz) \ + limac r4, zzz +#pragma unused(y) + nop + mac3(num) +#pragma unused(x) + add r3,r3,r4 +} + +int +main () +{ + if (foo (22, 23) != 45) + abort (); + if (foo1 (1, 2) != 100) + abort (); + if (foo2 (100, 1.2) != 2 * num) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.apple/asm-function-5.c b/gcc/testsuite/gcc.apple/asm-function-5.c new file mode 100644 index 00000000000..7808daaa81b --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-function-5.c @@ -0,0 +1,49 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test function calls in asm functions. */ + +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks -O2" } */ + +void abort(void); + +int glob = 0; + +int other (); +int stubfn (); +int localfn () { return other (); } + +asm void foo(int arg) +{ + nofralloc + mflr r0 + stmw r30,-8(r1) + stw r0,8(r1) + stwu r1,-80(r1) + bl stubfn + /* bl L_stubfn$stub */ + lwz r0,88(r1) + addi r1,r1,80 + mtlr r0 + lmw r30,-8(r1) + b localfn +} + +void bar (int arg) +{ + stubfn (); + localfn (); +} + +int stubfn () { return other(); } + +int other () { return ++glob; } + +int main () +{ + bar(34); + foo(92); + if (glob != 4) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.apple/asm-function-6.c b/gcc/testsuite/gcc.apple/asm-function-6.c new file mode 100644 index 00000000000..1ff272e183e --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-function-6.c @@ -0,0 +1,33 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test entry points in asm functions. */ + +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks -O2" } */ + +void abort(void); + +int entry1(int); +int entry2(int); +int entry3(int); + +asm int foo(int x) +{ + addi r3,r3,45 + entry entry1 + addi r3,r3,1 + entry static entry2 + addi r3,r3,1 + entry extern entry3 + addi r3,r3,1 +} + +int main () +{ + if (entry1(0) != 3) + abort(); + if (entry2(89) != 91) + abort(); + if (entry3(100) != 101) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.apple/asm-function-7.c b/gcc/testsuite/gcc.apple/asm-function-7.c new file mode 100644 index 00000000000..c182fd05c1e --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-function-7.c @@ -0,0 +1,17 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test la16(TABLE), lo16(TABLE), and bdnz+. */ + +/* { dg-do assemble { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks" } */ + +double TABLE[4]={2.0, 1./2., 3., 1.}; + +asm void SQRT() +{ + lis r3,ha16(TABLE) + addi r3,r3,lo16(TABLE) +@cycle: + fmul fp6,fp1,fp1 + bdnz+ @cycle + blr +} diff --git a/gcc/testsuite/gcc.apple/asm-function-8.c b/gcc/testsuite/gcc.apple/asm-function-8.c new file mode 100644 index 00000000000..2e559043308 --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-function-8.c @@ -0,0 +1,14 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test lo16(foo)(v) and ha16(foo). */ + +/* { dg-do assemble { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks" } */ + +int foo; + +asm int fun1 () +{ + int v; + addis v,0,ha16(foo) + lwz r3,lo16(foo)(v) +} diff --git a/gcc/testsuite/gcc.apple/asm-function-9.c b/gcc/testsuite/gcc.apple/asm-function-9.c new file mode 100644 index 00000000000..7b5e3101b68 --- /dev/null +++ b/gcc/testsuite/gcc.apple/asm-function-9.c @@ -0,0 +1,12 @@ +/* APPLE LOCAL file CW asm blocks */ +/* Test macros with . in the opcode. */ + +/* { dg-do assemble { target powerpc*-*-* } } */ +/* { dg-options "-fasm-blocks" } */ + +#define foodef() rlwinm. r4,r4,31,16,31 + +asm void foo (void) +{ + foodef() +} diff --git a/gcc/testsuite/gcc.apple/bitreverse-0.c b/gcc/testsuite/gcc.apple/bitreverse-0.c new file mode 100644 index 00000000000..4425dc972fc --- /dev/null +++ b/gcc/testsuite/gcc.apple/bitreverse-0.c @@ -0,0 +1,76 @@ +/* APPLE LOCAL file */ +#include <stdio.h> +#include <string.h> + +/* This tests layout when the pragma is off, as a sanity check. */ +/* { dg-do run { target powerpc*-*-darwin* } } */ + +#pragma reverse_bitfields off +typedef struct +{ + union + { + unsigned int i1; + struct + { + unsigned int b1: 1; + unsigned int b2: 2; + unsigned int b3: 4; + unsigned int b4: 8; + unsigned int b5: 16; + } bits; + } u1; + + union + { + struct + { + unsigned int i2; + unsigned int i3; + } ints; + + struct + { + unsigned int b1: 16; + unsigned int b2: 8; + unsigned int b3: 4; + unsigned int b4: 2; + unsigned int b5: 1; + unsigned int b6: 2; + unsigned int b7: 4; + unsigned int b8: 8; + unsigned int b9: 16; + } bits; + } u2; +} Bitfields; + + +int main() +{ + Bitfields bitfields; + + + memset(&bitfields, 0, sizeof(bitfields)); + + bitfields.u1.bits.b1 = 1; + bitfields.u1.bits.b2 = 1; + bitfields.u1.bits.b3 = 1; + bitfields.u1.bits.b4 = 1; + bitfields.u1.bits.b5 = 1; + + bitfields.u2.bits.b1 = 1; + bitfields.u2.bits.b2 = 1; + bitfields.u2.bits.b3 = 1; + bitfields.u2.bits.b4 = 1; + bitfields.u2.bits.b5 = 1; + bitfields.u2.bits.b6 = 1; + bitfields.u2.bits.b7 = 1; + bitfields.u2.bits.b8 = 1; + bitfields.u2.bits.b9 = 1; + + if (bitfields.u1.i1 != 0xa2020002 + || bitfields.u2.ints.i2 != 0x00010116 + || bitfields.u2.ints.i3 != 0x44040004) + return 42; + return 0; +} diff --git a/gcc/testsuite/gcc.apple/bitreverse-1.c b/gcc/testsuite/gcc.apple/bitreverse-1.c new file mode 100644 index 00000000000..4a38bca6bb6 --- /dev/null +++ b/gcc/testsuite/gcc.apple/bitreverse-1.c @@ -0,0 +1,96 @@ +/* APPLE LOCAL file */ +#include <stdio.h> +#include <string.h> + +/* This is the same data structure originally supplied by a user. */ +/* { dg-do run { target powerpc*-*-darwin* } } */ + +/* + Fun with bitfields! + + This needs to generate the same output when compiled with CodeWarrior and + with XCode. Following is the output I see. + + CodeWarrior: + + u1: 0x0000808b + u2: 0x51010001 0x00004045 + + + XCode: + + u1: 0xa2020002 + u2: 0x00010116 0x44040004 +*/ + + +#pragma reverse_bitfields on + +typedef struct +{ + union + { + unsigned int i1; + struct + { + unsigned int b1: 1; + unsigned int b2: 2; + unsigned int b3: 4; + unsigned int b4: 8; + unsigned int b5: 16; + } bits; + } u1; + + union + { + struct + { + unsigned int i2; + unsigned int i3; + } ints; + + struct + { + unsigned int b1: 16; + unsigned int b2: 8; + unsigned int b3: 4; + unsigned int b4: 2; + unsigned int b5: 1; + unsigned int b6: 2; + unsigned int b7: 4; + unsigned int b8: 8; + unsigned int b9: 16; + } bits; + } u2; +} Bitfields; + + +int main() +{ + Bitfields bitfields; + + + memset(&bitfields, 0, sizeof(bitfields)); + + bitfields.u1.bits.b1 = 1; + bitfields.u1.bits.b2 = 1; + bitfields.u1.bits.b3 = 1; + bitfields.u1.bits.b4 = 1; + bitfields.u1.bits.b5 = 1; + + bitfields.u2.bits.b1 = 1; + bitfields.u2.bits.b2 = 1; + bitfields.u2.bits.b3 = 1; + bitfields.u2.bits.b4 = 1; + bitfields.u2.bits.b5 = 1; + bitfields.u2.bits.b6 = 1; + bitfields.u2.bits.b7 = 1; + bitfields.u2.bits.b8 = 1; + bitfields.u2.bits.b9 = 1; + + if (bitfields.u1.i1 != 0x0000808b || + bitfields.u2.ints.i2 != 0x51010001 || + bitfields.u2.ints.i3 != 0x00004045) + return 42; + return 0; +} diff --git a/gcc/testsuite/gcc.apple/bitreverse-2.c b/gcc/testsuite/gcc.apple/bitreverse-2.c new file mode 100644 index 00000000000..ef74d8eb3ea --- /dev/null +++ b/gcc/testsuite/gcc.apple/bitreverse-2.c @@ -0,0 +1,88 @@ +/* APPLE LOCAL file */ +#include <stdio.h> +#include <string.h> + +/* Tests interleaving of bitfields and non-bitfields. Note that they + overlap, so the code cannot possibly work, but bug compability is + the requirement. */ + +/* { dg-do run { target powerpc*-*-darwin* } } */ + +#pragma reverse_bitfields on + +typedef struct +{ + union + { + unsigned int i1; + struct + { + unsigned int b1: 1; + unsigned int b2: 2; + unsigned int b3: 4; + unsigned int b4: 8; + unsigned int b5: 16; + } bits; + } u1; + char baz; + union + { + struct + { + unsigned int i2; + unsigned int i3; + unsigned int i4; + } ints; + + struct + { + unsigned int b1: 16; + unsigned int b2: 8; + unsigned int b3: 4; + unsigned int b4: 2; + unsigned int b5: 1; + char baz; + unsigned int b6: 2; + unsigned int b7: 4; + char baz2; + unsigned int b8: 8; + unsigned int b9: 16; + } bits; + } u2; +} Bitfields; + + +int main() +{ + Bitfields bitfields; + + + memset(&bitfields, 0, sizeof(bitfields)); + + bitfields.u1.bits.b1 = 1; + bitfields.u1.bits.b2 = 1; + bitfields.u1.bits.b3 = 1; + bitfields.u1.bits.b4 = 1; + bitfields.u1.bits.b5 = 1; + bitfields.baz = 0x55; + bitfields.u2.bits.b1 = 1; + bitfields.u2.bits.b2 = 1; + bitfields.u2.bits.b3 = 1; + bitfields.u2.bits.b4 = 1; + bitfields.u2.bits.b5 = 1; + bitfields.u2.bits.baz = 0xaa; /* { dg-warning "overflow in implicit constant conversion" } */ + bitfields.u2.bits.b6 = 1; + bitfields.u2.bits.b7 = 1; + bitfields.u2.bits.baz2 = 0x33; + bitfields.u2.bits.b8 = 1; + bitfields.u2.bits.b9 = 1; + + if (bitfields.u1.i1 != 0x0000808b + || bitfields.baz != 0x55 + || bitfields.u2.ints.i2 != 0x51010001 + || bitfields.u2.ints.i3 != 0x01003300 + || bitfields.u2.ints.i4 != 0x00000001 + || sizeof(bitfields) != 20) + return 42; + return 0; +} diff --git a/gcc/testsuite/gcc.apple/bitreverse-3.c b/gcc/testsuite/gcc.apple/bitreverse-3.c new file mode 100644 index 00000000000..034d120f6ba --- /dev/null +++ b/gcc/testsuite/gcc.apple/bitreverse-3.c @@ -0,0 +1,80 @@ +/* APPLE LOCAL file */ +#include <stdio.h> +#include <string.h> + +/* Tests turning pragma on and off, and that setting in effect at time + of the struct definition, not the variable definition, is what matters. +. Layout same as bitreverse-0. */ + +/* { dg-do run { target powerpc*-*-darwin* } } */ + +#pragma reverse_bitfields on +#pragma reverse_bitfields off +typedef struct +{ + union + { + unsigned int i1; + struct + { + unsigned int b1: 1; + unsigned int b2: 2; + unsigned int b3: 4; + unsigned int b4: 8; + unsigned int b5: 16; + } bits; + } u1; + + union + { + struct + { + unsigned int i2; + unsigned int i3; + } ints; + + struct + { + unsigned int b1: 16; + unsigned int b2: 8; + unsigned int b3: 4; + unsigned int b4: 2; + unsigned int b5: 1; + unsigned int b6: 2; + unsigned int b7: 4; + unsigned int b8: 8; + unsigned int b9: 16; + } bits; + } u2; +} Bitfields; + +#pragma reverse_bitfields on +int main() +{ + Bitfields bitfields; + + + memset(&bitfields, 0, sizeof(bitfields)); + + bitfields.u1.bits.b1 = 1; + bitfields.u1.bits.b2 = 1; + bitfields.u1.bits.b3 = 1; + bitfields.u1.bits.b4 = 1; + bitfields.u1.bits.b5 = 1; + + bitfields.u2.bits.b1 = 1; + bitfields.u2.bits.b2 = 1; + bitfields.u2.bits.b3 = 1; + bitfields.u2.bits.b4 = 1; + bitfields.u2.bits.b5 = 1; + bitfields.u2.bits.b6 = 1; + bitfields.u2.bits.b7 = 1; + bitfields.u2.bits.b8 = 1; + bitfields.u2.bits.b9 = 1; + + if (bitfields.u1.i1 != 0xa2020002 + || bitfields.u2.ints.i2 != 0x00010116 + || bitfields.u2.ints.i3 != 0x44040004) + return 42; + return 0; +} diff --git a/gcc/testsuite/gcc.apple/bitreverse-4.c b/gcc/testsuite/gcc.apple/bitreverse-4.c new file mode 100644 index 00000000000..1ebf5f7eb07 --- /dev/null +++ b/gcc/testsuite/gcc.apple/bitreverse-4.c @@ -0,0 +1,92 @@ +/* APPLE LOCAL file */ +#include <stdio.h> +#include <string.h> + +/* Tests interleaving of bitfields and non-bitfields. Note that they + overlap, so the code cannot possibly work, but bug compability is + the requirement. */ + +/* { dg-do run { target powerpc*-*-darwin* } } */ + +#pragma reverse_bitfields on +typedef struct +{ + union + { + unsigned int i1; + struct + { + int b1: 1; + unsigned int b2: 2; + unsigned int b3: 4; + unsigned int b4: 8; + int b5: 16; + } bits; + } u1; + + short baz; + union + { + struct + { + unsigned int i2; + unsigned int i3; + unsigned int i4; + unsigned int i5; + } ints; + + struct + { + unsigned int b1: 16; + unsigned int b2: 8; + unsigned int b3: 4; + char quux; + unsigned int b4: 2; + unsigned int b5: 1; + short baz; + unsigned int b6: 2; + unsigned int b7: 4; + short baz2; + unsigned int b8: 8; + unsigned int b9: 16; + } bits; + } u2; +} Bitfields; + + +int main() +{ + Bitfields bitfields; + + + memset(&bitfields, 0, sizeof(bitfields)); + + bitfields.u1.bits.b1 = 1; /* { dg-warning "overflow in implicit constant conversion" } */ + bitfields.u1.bits.b2 = 1; + bitfields.u1.bits.b3 = 1; + bitfields.u1.bits.b4 = 1; + bitfields.u1.bits.b5 = 1; + bitfields.baz = 0x5555; + bitfields.u2.bits.b1 = 1; + bitfields.u2.bits.b2 = 1; + bitfields.u2.bits.b3 = 1; + bitfields.u2.bits.quux = 0xa55a; /* { dg-warning "overflow in implicit constant conversion" } */ + bitfields.u2.bits.b4 = 1; + bitfields.u2.bits.b5 = 1; + bitfields.u2.bits.baz = 0xaaaa; /* { dg-warning "overflow in implicit constant conversion" } */ + bitfields.u2.bits.b6 = 1; + bitfields.u2.bits.b7 = 1; + bitfields.u2.bits.baz2 = 0x3333; + bitfields.u2.bits.b8 = 1; + bitfields.u2.bits.b9 = 1; + + if (bitfields.u1.i1 != 0x0000808b + || bitfields.baz != 0x5555 + || bitfields.u2.ints.i2 != 0x01010001 + || bitfields.u2.ints.i3 != 0x5a00aaaa + || bitfields.u2.ints.i4 != 0x00003333 + || bitfields.u2.ints.i5 != 0x00000101 + || sizeof(bitfields) != 24) + return 42; + return 0; +} diff --git a/gcc/testsuite/gcc.apple/bitreverse-5.c b/gcc/testsuite/gcc.apple/bitreverse-5.c new file mode 100644 index 00000000000..50c4df3879e --- /dev/null +++ b/gcc/testsuite/gcc.apple/bitreverse-5.c @@ -0,0 +1,92 @@ +/* APPLE LOCAL file */ +#include <stdio.h> +#include <string.h> + +/* Tests interaction with pragma pack, and interleaving of bitfields + and non-bitfields. */ + +/* { dg-do run { target powerpc*-*-darwin* } } */ + +#pragma reverse_bitfields on +typedef struct +{ + union + { + unsigned int i1; + struct + { + int b1: 1; + unsigned int b2: 2; + unsigned int b3: 4; + unsigned int b4: 8; + int b5: 16; + } bits; + } u1; + + short baz; + union + { + struct + { + unsigned int i2; + unsigned int i3; + unsigned int i4; + unsigned int i5; + } ints; + +#pragma pack(1) + struct + { + unsigned int b1: 16; + unsigned int b2: 8; + unsigned int b3: 4; + char quux; + unsigned int b4: 2; + unsigned int b5: 1; + short baz; + unsigned int b6: 2; + unsigned int b7: 4; + short baz2; + unsigned int b8: 8; + unsigned int b9: 16; + } bits; + } u2; +} Bitfields; + + +int main() +{ + Bitfields bitfields; + + + memset(&bitfields, 0, sizeof(bitfields)); + + bitfields.u1.bits.b1 = 1; /* { dg-warning "overflow in implicit constant conversion" } */ + bitfields.u1.bits.b2 = 1; + bitfields.u1.bits.b3 = 1; + bitfields.u1.bits.b4 = 1; + bitfields.u1.bits.b5 = 1; + bitfields.baz = 0x5555; + bitfields.u2.bits.b1 = 1; + bitfields.u2.bits.b2 = 1; + bitfields.u2.bits.b3 = 1; + bitfields.u2.bits.quux = 0xa55a; /* { dg-warning "overflow in implicit constant conversion" } */ + bitfields.u2.bits.b4 = 1; + bitfields.u2.bits.b5 = 1; + bitfields.u2.bits.baz = 0xaaaa; /* { dg-warning "overflow in implicit constant conversion" } */ + bitfields.u2.bits.b6 = 1; + bitfields.u2.bits.b7 = 1; + bitfields.u2.bits.baz2 = 0x3333; + bitfields.u2.bits.b8 = 1; + bitfields.u2.bits.b9 = 1; + + if (bitfields.u1.i1 != 0x0000808b + || bitfields.baz != 0x5555 + || bitfields.u2.ints.i2 != 0x01010001 + || bitfields.u2.ints.i3 != 0x5a00aaaa + || bitfields.u2.ints.i4 != 0x01333305 + || bitfields.u2.ints.i5 != 0x00000001 + || sizeof(bitfields) != 22) + return 42; + return 0; +} diff --git a/gcc/testsuite/gcc.apple/bitreverse-6.c b/gcc/testsuite/gcc.apple/bitreverse-6.c new file mode 100644 index 00000000000..d24689f4412 --- /dev/null +++ b/gcc/testsuite/gcc.apple/bitreverse-6.c @@ -0,0 +1,93 @@ +/* APPLE LOCAL file */ +#include <stdio.h> +#include <string.h> + +/* Tests interaction with pragma pack, and interleaving of bitfields + and non-bitfields. */ + +/* { dg-do run { target powerpc*-*-darwin* } } */ + +#pragma reverse_bitfields on +typedef struct +{ + union + { + unsigned int i1; +#pragma pack(2) + struct + { + int b1: 1; + unsigned int b2: 2; + unsigned int b3: 4; + unsigned int b4: 8; + int b5: 16; + } bits; + } u1; + + short baz; + union + { + struct + { + unsigned int i2; + unsigned int i3; + unsigned int i4; + unsigned int i5; + } ints; + +#pragma pack(1) + struct + { + unsigned int b1: 16; + unsigned int b2: 8; + unsigned int b3: 4; + char quux; + unsigned int b4: 2; + unsigned int b5: 1; + short baz; + unsigned int b6: 2; + unsigned int b7: 4; + short baz2; + unsigned int b8: 8; + unsigned int b9: 16; + } bits; + } u2; +} Bitfields; + + +int main() +{ + Bitfields bitfields; + + + memset(&bitfields, 0, sizeof(bitfields)); + + bitfields.u1.bits.b1 = 1; /* { dg-warning "overflow in implicit constant conversion" } */ + bitfields.u1.bits.b2 = 1; + bitfields.u1.bits.b3 = 1; + bitfields.u1.bits.b4 = 1; + bitfields.u1.bits.b5 = 1; + bitfields.baz = 0x5555; + bitfields.u2.bits.b1 = 1; + bitfields.u2.bits.b2 = 1; + bitfields.u2.bits.b3 = 1; + bitfields.u2.bits.quux = 0xa55a; /* { dg-warning "overflow in implicit constant conversion" } */ + bitfields.u2.bits.b4 = 1; + bitfields.u2.bits.b5 = 1; + bitfields.u2.bits.baz = 0xaaaa; /* { dg-warning "overflow in implicit constant conversion" } */ + bitfields.u2.bits.b6 = 1; + bitfields.u2.bits.b7 = 1; + bitfields.u2.bits.baz2 = 0x3333; + bitfields.u2.bits.b8 = 1; + bitfields.u2.bits.b9 = 1; + + if (bitfields.u1.i1 != 0x0000808b + || bitfields.baz != 0x5555 + || bitfields.u2.ints.i2 != 0x01010001 + || bitfields.u2.ints.i3 != 0x5a00aaaa + || bitfields.u2.ints.i4 != 0x01333305 + || bitfields.u2.ints.i5 != 0x00000001 + || sizeof(bitfields) != 22) + return 42; + return 0; +} diff --git a/gcc/testsuite/gcc.apple/bitreverse-7.c b/gcc/testsuite/gcc.apple/bitreverse-7.c new file mode 100644 index 00000000000..f09076bd363 --- /dev/null +++ b/gcc/testsuite/gcc.apple/bitreverse-7.c @@ -0,0 +1,94 @@ +/* APPLE LOCAL file */ +#include <stdio.h> +#include <string.h> + +/* Tests interaction with pragma pack, and interleaving of bitfields + and non-bitfields. */ + +/* { dg-do run { target powerpc*-*-darwin* } } */ +/* { dg-options "-std=gnu99" } */ + +#pragma reverse_bitfields on +typedef struct +{ + union + { + unsigned int i1; +#pragma pack(2) + struct + { + short b1: 1; + unsigned int b2: 2; + char b3: 4; + unsigned int b4: 8; + unsigned int b5: 16; + } bits; + } u1; + + short baz; + union + { + struct + { + unsigned int i2; + unsigned int i3; + unsigned int i4; + unsigned int i5; + } ints; + +#pragma pack(1) + struct + { + unsigned int b1: 16; + unsigned int b2: 8; + unsigned int b3: 4; + char quux; + unsigned int b4: 2; + unsigned int b5: 1; + short baz; + unsigned int b6: 2; + unsigned int b7: 4; + short baz2; + unsigned int b8: 8; + unsigned int b9: 16; + } bits; + } u2; +} Bitfields; + + +int main() +{ + Bitfields bitfields; + + + memset(&bitfields, 0, sizeof(bitfields)); + + bitfields.u1.bits.b1 = 1; + bitfields.u1.bits.b2 = 1; + bitfields.u1.bits.b3 = 1; + bitfields.u1.bits.b4 = 1; + bitfields.u1.bits.b5 = 1; + bitfields.baz = 0x5555; + bitfields.u2.bits.b1 = 1; + bitfields.u2.bits.b2 = 1; + bitfields.u2.bits.b3 = 1; + bitfields.u2.bits.quux = 0xa55a; /* { dg-warning "overflow in implicit constant conversion" } */ + bitfields.u2.bits.b4 = 1; + bitfields.u2.bits.b5 = 1; + bitfields.u2.bits.baz = 0xaaaa; + bitfields.u2.bits.b6 = 1; + bitfields.u2.bits.b7 = 1; + bitfields.u2.bits.baz2 = 0x3333; + bitfields.u2.bits.b8 = 1; + bitfields.u2.bits.b9 = 1; + + if (bitfields.u1.i1 != 0x00008082 + || bitfields.baz != 0x5555 + || bitfields.u2.ints.i2 != 0x01010001 + || bitfields.u2.ints.i3 != 0x5a00aaaa + || bitfields.u2.ints.i4 != 0x01333305 + || bitfields.u2.ints.i5 != 0x00000001 + || sizeof(bitfields) != 22) + return 42; + return 0; +} diff --git a/gcc/testsuite/gcc.apple/bitreverse-8.c b/gcc/testsuite/gcc.apple/bitreverse-8.c new file mode 100644 index 00000000000..77f5d6c6e9d --- /dev/null +++ b/gcc/testsuite/gcc.apple/bitreverse-8.c @@ -0,0 +1,90 @@ +/* APPLE LOCAL file */ +#include <stdio.h> +#include <string.h> + +/* Tests interleaving of bitfields and non-bitfields. */ + +/* { dg-do run { target powerpc*-*-darwin* } } */ +/* { dg-options "-std=gnu99" } */ + +#pragma reverse_bitfields on +typedef struct +{ + union + { + unsigned int i1; + struct + { + short b1: 1; + unsigned int b2: 2; + char b3: 4; + unsigned int b4: 8; + unsigned int b5: 16; + } bits; + } u1; + + short baz; + union + { + struct + { + unsigned int i2; + unsigned int i3; + unsigned int i4; + unsigned int i5; + } ints; + + struct + { + unsigned int b1: 16; + unsigned int b2: 8; + unsigned int b3: 4; + char quux; + unsigned int b4: 2; + unsigned int b5: 1; + short baz; + unsigned int b6: 2; + unsigned int b7: 4; + short baz2; + unsigned int b8: 8; + unsigned int b9: 16; + } bits; + } u2; +} Bitfields; + + +int main() +{ + Bitfields bitfields; + + + memset(&bitfields, 0, sizeof(bitfields)); + + bitfields.u1.bits.b1 = 1; + bitfields.u1.bits.b2 = 1; + bitfields.u1.bits.b3 = 1; + bitfields.u1.bits.b4 = 1; + bitfields.u1.bits.b5 = 1; + bitfields.baz = 0x5555; + bitfields.u2.bits.b1 = 1; + bitfields.u2.bits.b2 = 1; + bitfields.u2.bits.b3 = 1; + bitfields.u2.bits.quux = 0xa55a; /* { dg-warning "overflow in implicit constant conversion" } */ + bitfields.u2.bits.b4 = 1; + bitfields.u2.bits.b5 = 1; + bitfields.u2.bits.baz = 0xaaaa; + bitfields.u2.bits.b6 = 1; + bitfields.u2.bits.b7 = 1; + bitfields.u2.bits.baz2 = 0x3333; + bitfields.u2.bits.b8 = 1; + bitfields.u2.bits.b9 = 1; + if (bitfields.u1.i1 != 0x00008082 + || bitfields.baz != 0x5555 + || bitfields.u2.ints.i2 != 0x01010001 + || bitfields.u2.ints.i3 != 0x5a00aaaa + || bitfields.u2.ints.i4 != 0x00003333 + || bitfields.u2.ints.i5 != 0x00000101 + || sizeof(bitfields) != 24) + return 42; + return 0; +} diff --git a/gcc/testsuite/gcc.apple/bitreverse-9.c b/gcc/testsuite/gcc.apple/bitreverse-9.c new file mode 100644 index 00000000000..f719335b17e --- /dev/null +++ b/gcc/testsuite/gcc.apple/bitreverse-9.c @@ -0,0 +1,92 @@ +/* APPLE LOCAL file */ +#include <stdio.h> +#include <string.h> + +/* Test reset. */ + +/* { dg-do run { target powerpc*-*-darwin* } } */ +/* { dg-options "-std=gnu99" } */ + +#pragma reverse_bitfields on +#pragma reverse_bitfields reset +typedef struct +{ + union + { + unsigned int i1; + struct + { + short b1: 1; + unsigned int b2: 2; + char b3: 4; + unsigned int b4: 8; + unsigned int b5: 16; + } bits; + } u1; + + short baz; + union + { + struct + { + unsigned int i2; + unsigned int i3; + unsigned int i4; + unsigned int i5; + } ints; + + struct + { + unsigned int b1: 16; + unsigned int b2: 8; + unsigned int b3: 4; + char quux; + unsigned int b4: 2; + unsigned int b5: 1; + short baz; + unsigned int b6: 2; + unsigned int b7: 4; + short baz2; + unsigned int b8: 8; + unsigned int b9: 16; + } bits; + } u2; +} Bitfields; + +#pragma reverse_bitfields on +int main() +{ + Bitfields bitfields; + + + memset(&bitfields, 0, sizeof(bitfields)); + + bitfields.u1.bits.b1 = 1; + bitfields.u1.bits.b2 = 1; + bitfields.u1.bits.b3 = 1; + bitfields.u1.bits.b4 = 1; + bitfields.u1.bits.b5 = 1; + bitfields.baz = 0x5555; + bitfields.u2.bits.b1 = 1; + bitfields.u2.bits.b2 = 1; + bitfields.u2.bits.b3 = 1; + bitfields.u2.bits.quux = 0xa55a; /* { dg-warning "overflow in implicit constant conversion" } */ + bitfields.u2.bits.b4 = 1; + bitfields.u2.bits.b5 = 1; + bitfields.u2.bits.baz = 0xaaaa; + bitfields.u2.bits.b6 = 1; + bitfields.u2.bits.b7 = 1; + bitfields.u2.bits.baz2 = 0x3333; + bitfields.u2.bits.b8 = 1; + bitfields.u2.bits.b9 = 1; + + if (bitfields.u1.i1 != 0xa2020002 + || bitfields.baz != 0x5555 + || bitfields.u2.ints.i2 != 0x00010110 + || bitfields.u2.ints.i3 != 0x5a60aaaa + || bitfields.u2.ints.i4 != 0x44003333 + || bitfields.u2.ints.i5 != 0x01000100 + || sizeof(bitfields) != 24) + return 42; + return 0; +} diff --git a/gcc/testsuite/gcc.apple/comma-expr-1.c b/gcc/testsuite/gcc.apple/comma-expr-1.c new file mode 100644 index 00000000000..35c082ec78f --- /dev/null +++ b/gcc/testsuite/gcc.apple/comma-expr-1.c @@ -0,0 +1,6 @@ +/* APPLE LOCAL file AltiVec */ +/* Comma expressions are not considered constant per C99, even if their + constituent elements are. */ +/* { dg-do compile } */ + +int i = (1, 2); /* { dg-error "initializer element is not constant" } */ diff --git a/gcc/testsuite/gcc.apple/const-cfstring-1.c b/gcc/testsuite/gcc.apple/const-cfstring-1.c new file mode 100644 index 00000000000..3e8c1194d20 --- /dev/null +++ b/gcc/testsuite/gcc.apple/const-cfstring-1.c @@ -0,0 +1,29 @@ +/* APPLE LOCAL file constant CFStrings */ +/* Test whether the __builtin__CFStringMakeConstantString + "function" fails gracefully when handed a non-constant + argument. This will only work on MacOS X 10.1.2 and later. */ +/* Developed by Ziemowit Laski <zlaski@apple.com>. */ + +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-fconstant-cfstrings" } */ + +typedef const struct __CFString *CFStringRef; + +#ifdef __CONSTANT_CFSTRINGS__ +#define CFSTR(STR) ((CFStringRef) __builtin___CFStringMakeConstantString (STR)) +#else +#error __CONSTANT_CFSTRINGS__ not defined +#endif + +extern int cond; +extern const char *func(void); + +const CFStringRef s0 = CFSTR("Hello" "there"); + +int main(void) { + CFStringRef s1 = CFSTR("Str1"); + CFStringRef s2 = CFSTR(cond? "Str2": "Str3"); /* { dg-error "literal expression is not constant" } */ + CFStringRef s3 = CFSTR(func()); /* { dg-error "literal expression is not constant" } */ + + return 0; +} diff --git a/gcc/testsuite/gcc.apple/const-cfstring-2.c b/gcc/testsuite/gcc.apple/const-cfstring-2.c new file mode 100644 index 00000000000..cbf09d3a977 --- /dev/null +++ b/gcc/testsuite/gcc.apple/const-cfstring-2.c @@ -0,0 +1,13 @@ +/* APPLE LOCAL file constant CFStrings */ +/* Test whether the __builtin__CFStringMakeConstantString + "function" fails gracefully when used without the + -fconstant-cfstrings flag. */ +/* Developed by Ziemowit Laski <zlaski@apple.com>. */ + +/* { dg-options "-fno-constant-cfstrings" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +typedef const struct __CFString *CFStringRef; + +const CFStringRef S = ((CFStringRef)__builtin___CFStringMakeConstantString("Testing")); +/* { dg-error "built-in" "built-in function .* requires .* flag" { target *-*-* } 12 } */ diff --git a/gcc/testsuite/gcc.apple/const-cfstring-3.c b/gcc/testsuite/gcc.apple/const-cfstring-3.c new file mode 100644 index 00000000000..aba558b1f8b --- /dev/null +++ b/gcc/testsuite/gcc.apple/const-cfstring-3.c @@ -0,0 +1,29 @@ +/* APPLE LOCAL file constant CFStrings */ +/* Test whether the __builtin__CFStringMakeConstantString + "function" generates compile-time objects with the correct layout. */ +/* Developed by Ziemowit Laski <zlaski@apple.com>. */ + +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-fconstant-cfstrings" } */ + +typedef const struct __CFString *CFStringRef; + +#ifdef __CONSTANT_CFSTRINGS__ +#define CFSTR(STR) ((CFStringRef) __builtin___CFStringMakeConstantString (STR)) +#else +#error __CONSTANT_CFSTRINGS__ not defined +#endif + +extern int cond; +extern const char *func(void); + +CFStringRef s0 = CFSTR("Hello" "there"); + +void foo(void) { + const CFStringRef s1 = CFSTR("Str1"); + + s0 = s1; +} + +/* { dg-final { scan-assembler "\\.long\[ \\t\]+___CFConstantStringClassReference\n\[ \\t\]*\\.long\[ \\t\]+1992\n\[ \\t\]*\\.long\[ \\t\]+LC.*\n\[ \\t\]*\\.long\[ \\t\]+4\n" } } */ +/* { dg-final { scan-assembler "\\.long\[ \\t\]+___CFConstantStringClassReference\n\[ \\t\]*\\.long\[ \\t\]+1992\n\[ \\t\]*\\.long\[ \\t\]+LC.*\n\[ \\t\]*\\.long\[ \\t\]+10\n" } } */ diff --git a/gcc/testsuite/gcc.apple/const-cfstring-4.c b/gcc/testsuite/gcc.apple/const-cfstring-4.c new file mode 100644 index 00000000000..0c7c326100e --- /dev/null +++ b/gcc/testsuite/gcc.apple/const-cfstring-4.c @@ -0,0 +1,30 @@ +/* APPLE LOCAL file */ +/* Test constant cfstring and writabe strings interaction. + Radar 3978580. */ +/* Developed by Devang Patel <dpatel@apple.com>. */ + +/* { dg-do assemble { target *-*-darwin* } } */ +/* { dg-options "-fconstant-cfstrings -fwritable-strings" } */ + +typedef const struct __CFString *CFStringRef; + +#ifdef __CONSTANT_CFSTRINGS__ +#define CFSTR(STR) ((CFStringRef) __builtin___CFStringMakeConstantString (STR)) +#else +#error __CONSTANT_CFSTRINGS__ not defined +#endif + +extern void bar (const void **); + +static void foo() +{ + CFStringRef keys[] = + { + CFSTR("blah1"), + CFSTR("blah2") + }; + int count = sizeof(keys) / sizeof(keys[0]); + + bar ((const void **)keys); +} + diff --git a/gcc/testsuite/gcc.apple/cw-altivec-asm-block.c b/gcc/testsuite/gcc.apple/cw-altivec-asm-block.c new file mode 100644 index 00000000000..1b3baaa6e2f --- /dev/null +++ b/gcc/testsuite/gcc.apple/cw-altivec-asm-block.c @@ -0,0 +1,35 @@ +/* APPLE LOCAL file CW asm blocks with AltiVec insn. */ +/* Test asm-syntax blocks within functions. */ + +/* { dg-do run { target powerpc*-*-darwin* } } */ +/* { dg-options "-faltivec -fasm-blocks" } */ + +extern void abort(); + +int main( void ) +{ + int i; + register vector float a = (vector float) (1.0f); + register vector float b = (vector float) (2.0f); + register vector float c = (vector float) (3.0f); + float result[4] = {5.00, 5.00, 5.00, 5.00}; + union u { + vector float v; + float fv[4]; + } uv; + + asm + { + vmaddfp c, a, c, b + } + + uv.v = c; + + for (i=0; i < 4; i++) + if (uv.fv[i] != result[i]) + abort(); + + return 0; +} + + diff --git a/gcc/testsuite/gcc.apple/darwin-fsel-3.c b/gcc/testsuite/gcc.apple/darwin-fsel-3.c new file mode 100644 index 00000000000..3c7b19e0453 --- /dev/null +++ b/gcc/testsuite/gcc.apple/darwin-fsel-3.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-O -mpowerpc-gfxopt" } */ +/* { dg-final { scan-assembler "fsub" } } */ + +/* This is the same as gcc.dg/ppc-fsel-3.c, which is checking to see + that this optimization is *not* done, that is, that + -fno-trapping-math is the default. They can't both pass. */ + +double foo(double a, double b, double c, double d) +{ + return a < b ? c : d; +} diff --git a/gcc/testsuite/gcc.apple/dg.exp b/gcc/testsuite/gcc.apple/dg.exp new file mode 100644 index 00000000000..83910af8ac8 --- /dev/null +++ b/gcc/testsuite/gcc.apple/dg.exp @@ -0,0 +1,40 @@ +# APPLE LOCAL file testsuite +# Copyright (C) 1997 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Apple-specific GCC testsuite driver. +# Note that this is basically a clone of gcc.dg/dg.exp, updated +# whenever the original file changes (which is not very often). + +# Load support procs. +load_lib gcc-dg.exp + +# If a testcase doesn't have special options, use these. +global DEFAULT_CFLAGS +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS " -ansi -pedantic-errors" +} + +# Initialize `dg'. +dg-init + +# Main loop. +# APPLE LOCAL preprocess .s files +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cSs\]]] \ + "" $DEFAULT_CFLAGS + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.apple/dynamic-no-pic-1.c b/gcc/testsuite/gcc.apple/dynamic-no-pic-1.c new file mode 100644 index 00000000000..070544c5fc8 --- /dev/null +++ b/gcc/testsuite/gcc.apple/dynamic-no-pic-1.c @@ -0,0 +1,18 @@ +/* APPLE LOCAL file Radar 4010664 */ +/* { dg-do compile { target i?86*-*-darwin* } } */ +/* { dg-options "-mdynamic-no-pic -march=pentium4" } */ +/* { dg-final { scan-assembler-not "86.get_pc_thunk" } } */ +#define TEST_STRING "test string %d" +#define TEST_STRING0 "test string 0" +#include <stdlib.h> +#include <stdio.h> +int globalvar_i; +main (int argc, char *argv[]) +{ + char buf[90]; + + sprintf (buf, TEST_STRING, globalvar_i); + if (strcmp (buf, TEST_STRING0)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.apple/execute/bitfield-1.c b/gcc/testsuite/gcc.apple/execute/bitfield-1.c new file mode 100644 index 00000000000..bd472d28ccb --- /dev/null +++ b/gcc/testsuite/gcc.apple/execute/bitfield-1.c @@ -0,0 +1,52 @@ +/* { dg-do run { target *-*-darwin* } } */ +/* { dg-options "-O2 -fss-const-prop" } */ +/* APPLE LOCAL file bitfield zero initialization */ +/* <rdar://problem/3366203>:Setup Assistant crashes in SetModificationDateToPasteboard */ +/* <rdar://problem/3379022>:GCC compiler error in bitfield handling */ + + +typedef struct +{ + unsigned int b01 : 1; + unsigned int b02 : 2; + unsigned int b03 : 1; + unsigned int b04 : 1; + unsigned int b05 : 1; + unsigned int b06 : 1; + unsigned int b07 : 3; + unsigned int b08 : 3; + unsigned int b09 : 3; + unsigned int b10 : 3; + unsigned int b11 : 8; + unsigned int b12 : 1; + unsigned int b13 : 4; +} test_struct; + +void func( test_struct* s, int t ) +{ + s->b12 = 0; + s->b02 = 0; +} + +main() +{ + test_struct r = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; + + func (&r, 42); + + if (r.b01 != 1 + || r.b03 != 1 + || r.b04 != 1 + || r.b05 != 1 + || r.b06 != 1 + || r.b07 != 1 + || r.b08 != 1 + || r.b09 != 1 + || r.b10 != 1 + || r.b11 != 1 + || r.b13 != 1) + { + abort(); + } + exit (0); +} diff --git a/gcc/testsuite/gcc.apple/execute/execute.exp b/gcc/testsuite/gcc.apple/execute/execute.exp new file mode 100644 index 00000000000..f7b1f5b5eeb --- /dev/null +++ b/gcc/testsuite/gcc.apple/execute/execute.exp @@ -0,0 +1,43 @@ +# Copyright (C) 1991, 1992, 1993, 1995, 1997 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# This file was written by Rob Savoye. (rob@cygnus.com) +# Modified and maintained by Jeffrey Wheat (cassidy@cygnus.com) + +# +# These tests come from Torbjorn Granlund (tege@cygnus.com) +# C torture test suite. +# + +if $tracelevel then { + strace $tracelevel +} + +# load support procs +load_lib c-torture.exp + +# +# main test loop +# + +foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] { + # If we're only testing specific files and this isn't one of them, skip it. + if ![runtest_file_p $runtests $src] then { + continue + } + + c-torture-execute $src +} diff --git a/gcc/testsuite/gcc.apple/falign-jumps-max-skip-1.c b/gcc/testsuite/gcc.apple/falign-jumps-max-skip-1.c new file mode 100644 index 00000000000..447e0d57802 --- /dev/null +++ b/gcc/testsuite/gcc.apple/falign-jumps-max-skip-1.c @@ -0,0 +1,7 @@ +/* {dg-do compile } */ +/* Test -falign-jumps-max-skip */ +/* { dg-options "-falign-jumps-max-skip" } */ + +void foo() +{ +} diff --git a/gcc/testsuite/gcc.apple/falign-jumps-max-skip-2.c b/gcc/testsuite/gcc.apple/falign-jumps-max-skip-2.c new file mode 100644 index 00000000000..ee9ff6a6e0c --- /dev/null +++ b/gcc/testsuite/gcc.apple/falign-jumps-max-skip-2.c @@ -0,0 +1,7 @@ +/* {dg-do compile } */ +/* Test -falign-jumps-max-skip */ +/* { dg-options "-falign-jumps-max-skip=1234" } */ + +void foo() +{ +} diff --git a/gcc/testsuite/gcc.apple/falign-loops-max-skip-1.c b/gcc/testsuite/gcc.apple/falign-loops-max-skip-1.c new file mode 100644 index 00000000000..405ed4adc5d --- /dev/null +++ b/gcc/testsuite/gcc.apple/falign-loops-max-skip-1.c @@ -0,0 +1,7 @@ +/* {dg-do compile } */ +/* Test -falign-loops-max-skip */ +/* { dg-options "-falign-loops-max-skip" } */ + +void foo() +{ +} diff --git a/gcc/testsuite/gcc.apple/falign-loops-max-skip-2.c b/gcc/testsuite/gcc.apple/falign-loops-max-skip-2.c new file mode 100644 index 00000000000..1d00bd88f02 --- /dev/null +++ b/gcc/testsuite/gcc.apple/falign-loops-max-skip-2.c @@ -0,0 +1,7 @@ +/* {dg-do compile } */ +/* Test -falign-loops-max-skip */ +/* { dg-options "-falign-loops-max-skip=1234" } */ + +void foo() +{ +} diff --git a/gcc/testsuite/gcc.apple/falign-loops-max-skip-3.c b/gcc/testsuite/gcc.apple/falign-loops-max-skip-3.c new file mode 100644 index 00000000000..664c75cd339 --- /dev/null +++ b/gcc/testsuite/gcc.apple/falign-loops-max-skip-3.c @@ -0,0 +1,13 @@ +/* { dg-do compile { target "powerpc*-*-darwin*" } } */ +/* Test -falign-loops-max-skip */ +/* { dg-options "-O3 -falign-loops=16 -falign-loops-max-skip=11" } */ + +void foo() +{ + int i; + float j; + for (i=0; i<1000; i++) + j = 123*456; +} + +/* { dg-final { scan-assembler "p2align 4,,11" } } */ diff --git a/gcc/testsuite/gcc.apple/fenv-minmax-1.c b/gcc/testsuite/gcc.apple/fenv-minmax-1.c new file mode 100644 index 00000000000..4385ae3ced6 --- /dev/null +++ b/gcc/testsuite/gcc.apple/fenv-minmax-1.c @@ -0,0 +1,11 @@ +/* APPLE LOCAL file Radar 3943021 */ +/* { dg-do compile { target powerpc-*-darwin* } } */ +/* { dg-options "-ffast-math" } */ +#pragma GCC fenv +float size[2], tex_size; +void +test_of_pragma_fenv () +{ + size[0] = ((size[0]) < (tex_size) ? (size[0]) : (tex_size)); +} + diff --git a/gcc/testsuite/gcc.apple/framework1.c b/gcc/testsuite/gcc.apple/framework1.c new file mode 100644 index 00000000000..bd0203669c2 --- /dev/null +++ b/gcc/testsuite/gcc.apple/framework1.c @@ -0,0 +1,12 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -c -F${srcdir}/gcc.apple" } */ + +/* Contributed by Devang Patel <dpatel@apple.com> */ + +#include <one/one.h> +int main() +{ + return 0; +} diff --git a/gcc/testsuite/gcc.apple/fwritable-strings.c b/gcc/testsuite/gcc.apple/fwritable-strings.c new file mode 100644 index 00000000000..4cf335a0db3 --- /dev/null +++ b/gcc/testsuite/gcc.apple/fwritable-strings.c @@ -0,0 +1,19 @@ +/* { dg-do run } */ +/* { dg-options "-fwritable-strings" } */ + +/*#include <stdio.h>*/ +void foo( void *dst) +{ + char *ucdst; + + ucdst = (char *)dst; + ucdst++; + *ucdst = 'X'; +} + +int main() +{ + char *a = "Hello"; + foo ((void *) a); + return 0; +} diff --git a/gcc/testsuite/gcc.apple/i386-builtin-shufps.c b/gcc/testsuite/gcc.apple/i386-builtin-shufps.c new file mode 100644 index 00000000000..ac102fbe834 --- /dev/null +++ b/gcc/testsuite/gcc.apple/i386-builtin-shufps.c @@ -0,0 +1,21 @@ +/* APPLE LOCAL begin radar 4099352 */ +/* { dg-do compile { target i?86-*-darwin* } } */ +/* { dg-options "-O1 -msse2" } */ +/* { dg-final { scan-assembler "xorps" } } */ + +typedef float __m128 __attribute__ ((__vector_size__ (16))); +typedef float __v4sf __attribute__ ((__vector_size__ (16))); + +int main() +{ + __m128 f2; + + volatile __m128 votf = (__m128){ 0.0f, 0.0f, 0.0f, 0.0f }; + + do { + XXXXXX(); + volatile __v4sf __t1 = __builtin_ia32_shufps (f2, (__m128){ 0.0f, 0.0f, 0.0f, 0.0f }, 0x44); + XXXXXX(); + } while (0); +} +/* APPLE LOCAL end radar 4099352 */ diff --git a/gcc/testsuite/gcc.apple/i386-deep-branch-predict-1.c b/gcc/testsuite/gcc.apple/i386-deep-branch-predict-1.c new file mode 100644 index 00000000000..507d2149c90 --- /dev/null +++ b/gcc/testsuite/gcc.apple/i386-deep-branch-predict-1.c @@ -0,0 +1,18 @@ +/* APPLE LOCAL file Radar 4010498 et. al. */ +/* { dg-do compile { target i?86-*-darwin* } } */ +/* { dg-options "-march=pentium4 -fPIC" } */ +/* { dg-final { scan-assembler "86.get_pc_thunk" } } */ +#define TEST_STRING "test string %d" +#define TEST_STRING0 "test string 0" +#include <stdlib.h> +#include <stdio.h> +int globalvar_i; +main (int argc, char *argv[]) +{ + char buf[90]; + + sprintf (buf, TEST_STRING, globalvar_i); + if (strcmp (buf, TEST_STRING0)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.apple/i386-leaf-stack-opt.c b/gcc/testsuite/gcc.apple/i386-leaf-stack-opt.c new file mode 100644 index 00000000000..1b1f2896b63 --- /dev/null +++ b/gcc/testsuite/gcc.apple/i386-leaf-stack-opt.c @@ -0,0 +1,10 @@ +/* APPLE LOCAL begin radar 4095567 */ +/* { dg-do compile { target i?86-*-darwin* } } */ +/* { dg-options "-O2 -mfpmath=387 -mdynamic-no-pic" } */ +/* { dg-final { scan-assembler-not "sub\[^\\n\]*sp" } } */ + +/* -Os -mfpmath=387 -mdynamic-no-pic */ +double foo(double x) { + return x+1.0; +} +/* APPLE LOCAL end radar 4095567 */ diff --git a/gcc/testsuite/gcc.apple/i386-ssetype-6.c b/gcc/testsuite/gcc.apple/i386-ssetype-6.c new file mode 100644 index 00000000000..ed517d648bf --- /dev/null +++ b/gcc/testsuite/gcc.apple/i386-ssetype-6.c @@ -0,0 +1,24 @@ +/* APPLE LOCAL file 4099020 */ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -msse2 -march=pentium4" } */ +/* { dg-final { scan-assembler-times "movq\[^\\n\]*" 3} } */ + +/* Verify that we generate proper instruction with memory operand. */ + +#include <emmintrin.h> + +__m128i +t1(__m128i *p) +{ + return _mm_loadl_epi64(p); /* 64-bit, zero-extended result in %xmm. */ +} +void +t2(__m128i *p, __m128i a) +{ + _mm_storel_epi64(p, a); /* 64-bit store from %xmm. */ +} +__m128i +t3(__m128i a) +{ + return _mm_move_epi64(a); /* 64-bit move between %xmm registers. */ +} diff --git a/gcc/testsuite/gcc.apple/import.c b/gcc/testsuite/gcc.apple/import.c new file mode 100644 index 00000000000..110a2d249ed --- /dev/null +++ b/gcc/testsuite/gcc.apple/import.c @@ -0,0 +1,9 @@ +/* APPLE LOCAL file #import not deprecated */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +#import "importee.h" + +#import "importee.h" + +void foo (bar x) {} diff --git a/gcc/testsuite/gcc.apple/importee.h b/gcc/testsuite/gcc.apple/importee.h new file mode 100644 index 00000000000..86fbd11da4d --- /dev/null +++ b/gcc/testsuite/gcc.apple/importee.h @@ -0,0 +1,3 @@ +/* APPLE LOCAL file #import not deprecated */ + +typedef int bar; diff --git a/gcc/testsuite/gcc.apple/inttypes-1.c b/gcc/testsuite/gcc.apple/inttypes-1.c new file mode 100644 index 00000000000..40404e2995b --- /dev/null +++ b/gcc/testsuite/gcc.apple/inttypes-1.c @@ -0,0 +1,21 @@ +/* APPLE LOCAL file test of inttypes.h formatter macros */ + +/* { dg-do compile } */ +/* { dg-options "-Wall -W" } */ + +#include <stdio.h> +#include <inttypes.h> +#include <stdint.h> + +int main () +{ + uint32_t x = 12; + int32_t y = 15; + printf("x = %" PRIo32 "\n", x); + printf("x = %" PRIu32 "\n", x); + printf("x = %" PRIx32 "\n", x); + printf("x = %" PRIX32 "\n", x); + printf("y = %" PRId32 "\n", y); + printf("y = %" PRIi32 "\n", y); + return 0; +} diff --git a/gcc/testsuite/gcc.apple/inttypes-2.c b/gcc/testsuite/gcc.apple/inttypes-2.c new file mode 100644 index 00000000000..7ea63badc58 --- /dev/null +++ b/gcc/testsuite/gcc.apple/inttypes-2.c @@ -0,0 +1,45 @@ +/* APPLE LOCAL file test of inttypes.h [U]INT*_C macros */ + +/* { dg-do compile } */ +/* { dg-options "-Wall -W" } */ + +#include <stdio.h> +#include <inttypes.h> +#include <stdint.h> + +#if INT8_C(3) != 3 +#error int8 comparison failed +#endif + +#if INT16_C(-3) != -3 +#error int16 comparison failed +#endif + +#if INT32_C(536870912) != 536870912L +#error int32 comparison failed +#endif + +#if INT64_C(536870912) != 536870912LL +#error int64 comparison failed +#endif + +#if UINT8_C(3) != 3 +#error int8 comparison failed +#endif + +#if UINT16_C(3) != 3 +#error int16 comparison failed +#endif + +#if UINT32_C(536870912) != 536870912UL +#error int32 comparison failed +#endif + +#if UINT64_C(536870912) != 536870912ULL +#error int64 comparison failed +#endif + +int main() +{ + return INT32_C(0); +} diff --git a/gcc/testsuite/gcc.apple/inttypes-3.c b/gcc/testsuite/gcc.apple/inttypes-3.c new file mode 100644 index 00000000000..14fcd0805e0 --- /dev/null +++ b/gcc/testsuite/gcc.apple/inttypes-3.c @@ -0,0 +1,51 @@ +/* APPLE LOCAL file test of inttypes.h SCN* and PRI* macros */ + +/* { dg-do compile } */ +/* { dg-options "-Wall -W" } */ + +#include <stdint.h> +#include <stdio.h> +#include <inttypes.h> + +#define TEST(tn, scn, pri) \ +do { \ + tn x; \ + scanf ("%" scn "\n", &x); \ + printf ("%" pri "\n", x); \ +} while (0) + +void foo(void) +{ + TEST (int8_t, SCNd8, PRId8); + TEST (uint8_t, SCNu8, PRIu8); + TEST (int16_t, SCNd16, PRId16); + TEST (uint16_t, SCNu16, PRIu16); + TEST (int32_t, SCNd32, PRId32); + TEST (uint32_t, SCNu32, PRIu32); + TEST (int64_t, SCNd64, PRId64); + TEST (uint64_t, SCNu64, PRIu64); + + TEST (int_least8_t, SCNdLEAST8, PRIdLEAST8); + TEST (uint_least8_t, SCNuLEAST8, PRIuLEAST8); + TEST (int_least16_t, SCNdLEAST16, PRIdLEAST16); + TEST (uint_least16_t, SCNuLEAST16, PRIuLEAST16); + TEST (int_least32_t, SCNdLEAST32, PRIdLEAST32); + TEST (uint_least32_t, SCNuLEAST32, PRIuLEAST32); + TEST (int_least64_t, SCNdLEAST64, PRIdLEAST64); + TEST (uint_least64_t, SCNuLEAST64, PRIuLEAST64); + + TEST (int_fast8_t, SCNdFAST8, PRIdFAST8); + TEST (uint_fast8_t, SCNuFAST8, PRIuFAST8); + TEST (int_fast16_t, SCNdFAST16, PRIdFAST16); + TEST (uint_fast16_t, SCNuFAST16, PRIuFAST16); + TEST (int_fast32_t, SCNdFAST32, PRIdFAST32); + TEST (uint_fast32_t, SCNuFAST32, PRIuFAST32); + TEST (int_fast64_t, SCNdFAST64, PRIdFAST64); + TEST (uint_fast64_t, SCNuFAST64, PRIuFAST64); + + TEST (intptr_t, SCNdPTR, PRIdPTR); + TEST (uintptr_t, SCNuPTR, PRIuPTR); + + TEST (intmax_t, SCNdMAX, PRIdMAX); + TEST (uintmax_t, SCNuMAX, PRIuMAX); +} diff --git a/gcc/testsuite/gcc.apple/inttypes-4.c b/gcc/testsuite/gcc.apple/inttypes-4.c new file mode 100644 index 00000000000..4f1029981bb --- /dev/null +++ b/gcc/testsuite/gcc.apple/inttypes-4.c @@ -0,0 +1,43 @@ +/* APPLE LOCAL file stdint.h */ + +/* { dg-do run } */ +/* { dg-options "-Wall -W" } */ + +/* Check SIG_ATOMIC_{MIN,MAX}, WINT_{MIN,MAX}. Also check that + stdint.h and sys/types.h can be included simultaneously. */ + +#include <stdint.h> +#include <sys/types.h> +#include <signal.h> +#include <wchar.h> +#include <stdlib.h> + +int main(void) +{ + sig_atomic_t s_a; + wint_t wi; + + s_a = SIG_ATOMIC_MIN; + if (s_a != SIG_ATOMIC_MIN) + abort (); + if (s_a > 0) + abort (); + s_a--; + if (s_a != SIG_ATOMIC_MAX) + abort (); + if (s_a <= 0) + abort (); + + wi = WINT_MIN; + if (wi != WINT_MIN) + abort (); + if (wi > 0) + abort (); + wi--; + if (wi != WINT_MAX) + abort (); + if (wi <= 0) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.apple/inttypes-wchar-1.c b/gcc/testsuite/gcc.apple/inttypes-wchar-1.c new file mode 100644 index 00000000000..6799c59c5eb --- /dev/null +++ b/gcc/testsuite/gcc.apple/inttypes-wchar-1.c @@ -0,0 +1,26 @@ +/* APPLE LOCAL file test of wchar_t's definition in inttypes.h */ + +/* { dg-do run } */ +/* { dg-options "-Wall -W" } */ + +#include <inttypes.h> +#include <stdint.h> + +/* Verify that WCHAR_MAX is the largest positive 32-bit integer */ +#if WCHAR_MAX != 0x7fffffff +# error WCHAR_MAX has incorrect value +#endif + +/* Verify that WCHAR_MIN is negative and consistent with WCHAR_MAX. */ +#if WCHAR_MIN != (-WCHAR_MAX-1) +# error WCHAR_MIN has incorrect value +#endif + +int dummy1[5 - sizeof(wchar_t)] = { 0 }; +int dummy2[sizeof(wchar_t) - 3] = { 0 }; + +int main () +{ + /* Verify that wchar_t is a 32-bit type. */ + return (sizeof(wchar_t) == 4) ? 0 : 1; +} diff --git a/gcc/testsuite/gcc.apple/inttypes-wchar-2.c b/gcc/testsuite/gcc.apple/inttypes-wchar-2.c new file mode 100644 index 00000000000..0021b3dc0fc --- /dev/null +++ b/gcc/testsuite/gcc.apple/inttypes-wchar-2.c @@ -0,0 +1,26 @@ +/* APPLE LOCAL file test that the definition of wchar_t in + inttypes.h gives sizeof(wchar_t) == 2 when using -fshort-wchar. */ + +/* { dg-do run } */ +/* { dg-options "-Wall -W -fshort-wchar" } */ + +#include <inttypes.h> +#include <stdint.h> + +/* Verify that WCHAR_MAX is the largest unsigned 16-bit integer. */ +#if WCHAR_MAX != 0xffffU +# error WCHAR_MAX has incorrect value +#endif + +/* Verify that WCHAR_MIN is 0 */ +#if WCHAR_MIN != 0 +# error WCHAR_MIN has incorrect value +#endif + +int dummy1[3 - sizeof(wchar_t)] = { 0 }; +int dummy2[sizeof(wchar_t) - 1] = { 0 }; + +int main () +{ + return (sizeof(wchar_t) == 2) ? 0 : 1; +} diff --git a/gcc/testsuite/gcc.apple/lazy-ptr-test.c b/gcc/testsuite/gcc.apple/lazy-ptr-test.c new file mode 100644 index 00000000000..da66b518ff0 --- /dev/null +++ b/gcc/testsuite/gcc.apple/lazy-ptr-test.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target powerpc*-apple-darwin* } } */ +/* { dg-options "-S" } */ + +void f () __attribute__((weak_import)); + +typedef void PF (void); + +void f(void){}; + +PF* g (void) { return f; } + +int main() +{ + (*g())(); + return 0; +} + +/* { dg-final { scan-assembler "non_lazy_ptr" } } */ diff --git a/gcc/testsuite/gcc.apple/mac68k-align-unsup.c b/gcc/testsuite/gcc.apple/mac68k-align-unsup.c new file mode 100644 index 00000000000..52c0b2e2573 --- /dev/null +++ b/gcc/testsuite/gcc.apple/mac68k-align-unsup.c @@ -0,0 +1,9 @@ +/* APPLE LOCAL file 64-bit */ +/* Darwin (Mac OS X) alignment exercises. */ + +/* { dg-do compile { target powerpc-*-darwin[89]* } } */ +/* { dg-options "-m64 -malign-mac68k" } */ + +/* { dg-error "-malign-mac68k is not allowed for 64-bit Darwin" "" { target *-*-* } 1 } */ + +main() {} diff --git a/gcc/testsuite/gcc.apple/no-math-errno.c b/gcc/testsuite/gcc.apple/no-math-errno.c new file mode 100644 index 00000000000..cad9edf8be2 --- /dev/null +++ b/gcc/testsuite/gcc.apple/no-math-errno.c @@ -0,0 +1,8 @@ +/* APPLE LOCAL math-errno off by default 3619824 */ +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-mpowerpc-gpopt -O2" } */ +/* { dg-final { scan-assembler-not "fcmpu" } } */ +extern double sqrt(double); +float foo(float y) { + return sqrt(y); +} diff --git a/gcc/testsuite/gcc.apple/no-warning.c b/gcc/testsuite/gcc.apple/no-warning.c new file mode 100644 index 00000000000..9b71d722239 --- /dev/null +++ b/gcc/testsuite/gcc.apple/no-warning.c @@ -0,0 +1,8 @@ +/* APPLE LOCAL file -Wno-#warnings */ + +/* { dg-do compile } */ +/* { dg-options "-Wno-#warnings" } */ + +#warning "suppress this warning" + +int a; diff --git a/gcc/testsuite/gcc.apple/non-lazy-ptr-test.c b/gcc/testsuite/gcc.apple/non-lazy-ptr-test.c new file mode 100644 index 00000000000..e496784d32b --- /dev/null +++ b/gcc/testsuite/gcc.apple/non-lazy-ptr-test.c @@ -0,0 +1,40 @@ +/* { dg-do compile { target powerpc*-apple-darwin* } } */ +/* { dg-options "-S" } */ + +typedef void PF (void); + +static void f(void) { +} + +void f1(void) { +} + +extern void f2(void) { +} + +static void f3(void); + +__private_extern__ void pe(void) +{ +} + +PF* g (void) { f(); return f; } +PF* x (void) { return f1; } +PF* y (void) { f2(); return f2; } +PF* z (void) { return f3; } +PF* w (void) { pe(); return pe; } + +int main() +{ + (*g())(); + (*x())(); + (*y())(); + (*z())(); + (*w())(); + return 0; +} + +void f3(void) { +} + +/* { dg-final { scan-assembler-not "non_lazy_ptr" } } */ diff --git a/gcc/testsuite/gcc.apple/notailcall-1.c b/gcc/testsuite/gcc.apple/notailcall-1.c new file mode 100644 index 00000000000..ee072d283fd --- /dev/null +++ b/gcc/testsuite/gcc.apple/notailcall-1.c @@ -0,0 +1,73 @@ +/* APPLE LOCAL file Radar 3830232 */ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-not "\(jmp|b\)\[ \\t\]+_*init_iconv_desc" } } */ +/* Contributed by Andrew Pinski 26 Oct 2004 <pinskia@gcc.gnu.org> */ + +struct cset_converter { int func; int cd; }; +void abort(void); int puts(const char*); +int f(int i){return i;} +void g(void){puts("hi");} +struct conversion +{ + int pair; + int func; + int fake_cd; +}; +static const struct conversion conversion_tab[] = { + { 2, 2, 2 }, + { 3, 3, 3 } +}; +static struct cset_converter +init_iconv_desc (int i) +{ + struct cset_converter ret; + unsigned i1; + char *pair; + if (!i) + { + ret.func = 0; + ret.cd = 0; + return ret; + } + pair = __builtin_alloca(i*3); + for (i1 = 0; i1 < (sizeof (conversion_tab) / sizeof ((conversion_tab)[0])); i1++) + if (i == conversion_tab[i1].pair) + { + ret.func = conversion_tab[i1].func; + ret.cd = conversion_tab[i1].fake_cd; + return ret; + } + + ret.func = 2; + ret.cd = f(i); + if (ret.cd == 4) + { + g(); + ret.func = 4; + } + return ret; +} +struct f +{ + struct cset_converter a; + struct cset_converter b; +}; + +void ff(struct f *a) +{ + a->a = init_iconv_desc(0); + /* Compiler was illegally optimizing this call into a tailcall (jmp). Radar 3830232 */ + a->b = init_iconv_desc(1); +} + +int main(void) +{ + struct f a; + ff (&a); + if (a.a.func!=0 || a.a.cd !=0) + abort(); + if (a.b.func!=2 || a.b.cd !=1) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.apple/objc-negtest.c b/gcc/testsuite/gcc.apple/objc-negtest.c new file mode 100644 index 00000000000..aeff151892a --- /dev/null +++ b/gcc/testsuite/gcc.apple/objc-negtest.c @@ -0,0 +1,8 @@ +/* APPLE LOCAL begin radar 4122328 */ +/* { dg-options "-fasm-blocks" } */ +@class NSString; /* { dg-error "parse error before '@' token" } */ + +int main() +{ +} +/* APPLE LOCAL end radar 4122328 */ diff --git a/gcc/testsuite/gcc.apple/objcpp.c b/gcc/testsuite/gcc.apple/objcpp.c new file mode 100644 index 00000000000..64728306efd --- /dev/null +++ b/gcc/testsuite/gcc.apple/objcpp.c @@ -0,0 +1,6 @@ +/* { dg-options "-x objc++-cpp-output $srcdir/gcc.apple/objcpp.c" } */ + +/* Radar 3981486 */ + +int main() { +} diff --git a/gcc/testsuite/gcc.apple/one.framework/Headers/one.h b/gcc/testsuite/gcc.apple/one.framework/Headers/one.h new file mode 100644 index 00000000000..50c24d3e6c5 --- /dev/null +++ b/gcc/testsuite/gcc.apple/one.framework/Headers/one.h @@ -0,0 +1,3 @@ +/* Contributed by Devang Patel <dpatel@apple.com> */ + +/* Empty header */ diff --git a/gcc/testsuite/gcc.apple/opt-pragma-1.c b/gcc/testsuite/gcc.apple/opt-pragma-1.c new file mode 100644 index 00000000000..046ea5050b8 --- /dev/null +++ b/gcc/testsuite/gcc.apple/opt-pragma-1.c @@ -0,0 +1,15 @@ +/* Test error handling of optimization pragmas. */ +/* Radar 3124235 */ +/* { dg-do compile } */ +int outwit; /* make the file non-empty */ +#pragma optimization_level -1 /* { dg-warning "malformed '#pragma optimization_level" } */ +#pragma optimization_level foo /* { dg-warning "malformed '#pragma optimization_level" } */ +#pragma optimization_level 3.0 /* { dg-warning "malformed '#pragma optimization_level" } */ +#pragma optimization_level 3 extra /* { dg-warning "junk at end of '#pragma optimization_level" } */ +#pragma optimization_level 0x4 +#pragma optimize_for_size on +#pragma optimize_for_size foo /* { dg-warning "malformed '#pragma optimize_for_size" } */ +#pragma optimization_level reset +#pragma optimization_level reset +#pragma optimization_level reset +#pragma optimization_level reset /* { dg-warning "optimization pragma stack underflow" } */ diff --git a/gcc/testsuite/gcc.apple/opt-pragma-2.c b/gcc/testsuite/gcc.apple/opt-pragma-2.c new file mode 100644 index 00000000000..fb5dc7aafce --- /dev/null +++ b/gcc/testsuite/gcc.apple/opt-pragma-2.c @@ -0,0 +1,26 @@ +#include <stdio.h> +/* Radar 3124235 */ +/* { dg-do compile { target "powerpc*-*-darwin*" } } */ +/* { dg-options "-O3" } */ +void f4(int); +#pragma optimization_level 0 +void f1(int x) { + printf("%d\n", x); +} +#pragma GCC optimize_for_size on +#pragma GCC optimization_level 0 +void f4(int x) { + printf("%d\n", x); +} +#pragma GCC optimization_level 0 +void f5(int x) { +#pragma GCC optimization_level 2 + printf("%d\n", x); +} +#pragma GCC optimization_level reset +void f6(int x) { + printf("%d\n", x); +} +/* Make sure sibling call optimization is not applied. */ +/* { dg-final { scan-assembler-times "b L_printf" 0 } } */ +/* { dg-final { scan-assembler-times "bl L_printf" 4 } } */ diff --git a/gcc/testsuite/gcc.apple/opt-pragma-3.c b/gcc/testsuite/gcc.apple/opt-pragma-3.c new file mode 100644 index 00000000000..786d30e261b --- /dev/null +++ b/gcc/testsuite/gcc.apple/opt-pragma-3.c @@ -0,0 +1,26 @@ +#include <stdio.h> +/* Radar 3124235 */ +/* { dg-do compile { target "powerpc*-*-darwin*" } } */ +/* { dg-options "-O0" } */ +void f4(int); +#pragma optimization_level 3 +void f1(int x) { + printf("%d\n", x); +} +#pragma GCC optimize_for_size on +#pragma GCC optimization_level 3 +void f4(int x) { + printf("%d\n", x); +} +#pragma GCC optimization_level 3 +void f5(int x) { +#pragma GCC optimization_level 0 + printf("%d\n", x); +} +#pragma GCC optimization_level reset +void f6(int x) { + printf("%d\n", x); +} +/* Make sure sibling call optimization is applied. */ +/* { dg-final { scan-assembler-times "b L_printf" 4 } } */ +/* { dg-final { scan-assembler-times "bl L_printf" 0 } } */ diff --git a/gcc/testsuite/gcc.apple/opt-pragma-4.c b/gcc/testsuite/gcc.apple/opt-pragma-4.c new file mode 100644 index 00000000000..4129450eea3 --- /dev/null +++ b/gcc/testsuite/gcc.apple/opt-pragma-4.c @@ -0,0 +1,25 @@ +#include <stdio.h> +/* Radar 3124235 */ +/* { dg-do compile { target "powerpc*-*-darwin*" } } */ +/* { dg-options "-O0" } */ +void f4(int); +#pragma optimization_level 3 +void f1(int x) { + printf("%d\n", x); +} +#pragma GCC optimize_for_size on +#pragma GCC optimization_level 3 +void f4(int x) { + printf("%d\n", x); +} +#pragma GCC optimization_level 0 +void f5(int x) { +#pragma GCC optimization_level 2 + printf("%d\n", x); +} +#pragma GCC optimization_level reset +void f6(int x) { + printf("%d\n", x); +} +/* { dg-final { scan-assembler-times "b L_printf" 2 } } */ +/* { dg-final { scan-assembler-times "bl L_printf" 2 } } */ diff --git a/gcc/testsuite/gcc.apple/opt-pragma-5.c b/gcc/testsuite/gcc.apple/opt-pragma-5.c new file mode 100644 index 00000000000..c637fa3f8ac --- /dev/null +++ b/gcc/testsuite/gcc.apple/opt-pragma-5.c @@ -0,0 +1,25 @@ +/* Radar 3124235 */ +/* { dg-do compile { target "powerpc*-*-darwin*" } } */ +/* { dg-options "-O3" } */ +#pragma optimization_level 0 +extern void f1a(int), f4a(int), f5a(int), f6a(int); +void f4(int); void f6(int); +void f1(int x) { + f1a(x); +} +#pragma GCC optimization_level 2 +void f5(int x) { + f5a(x); +} +#pragma GCC optimization_level 3 +void f6(int x) { + f6a(x); +} +#pragma GCC optimization_level 1 +void f4(int x) { + f4a(x); +} +/* { dg-final { scan-assembler "bl L_f1a" } } */ +/* { dg-final { scan-assembler "bl L_f4a" } } */ +/* { dg-final { scan-assembler "b L_f5a" } } */ +/* { dg-final { scan-assembler "b L_f6a" } } */ diff --git a/gcc/testsuite/gcc.apple/pack-test-1.c b/gcc/testsuite/gcc.apple/pack-test-1.c new file mode 100644 index 00000000000..10273b2ba27 --- /dev/null +++ b/gcc/testsuite/gcc.apple/pack-test-1.c @@ -0,0 +1,76 @@ +/* APPLE LOCAL file 4163069 */ +/* Test semantics of #pragma pack. + Contributed by Mike Stump <mrs@apple.com> */ + +/* { dg-do run { target *-*-darwin* } } */ + +#include <stdio.h> + +#pragma pack(push, 1) +struct +{ + int a; + short b; +} ShouldBeSixBytes; + +#pragma pack(push, 8) +struct +{ + int a; + short b; +} ShouldBeEightBytes; + +/* Does a "push" in Apple's standard GCC, should here, too. */ +#pragma pack(push, 4) +struct +{ + char a; + short b; +} ShouldBeFourBytes; + +/* Should be popped back to eight bytes. */ +#pragma pack() +struct +{ + int a; + short b; +} ShouldBeEightBytesToo; + +/* Should be popped back to one byte packing. */ +#pragma pack(pop) +struct +{ + char a; + char b; + char c; +} ShouldBeThreeBytes; + +/* pop to native packing. */ +#pragma pack(pop) +struct +{ + char a; + short b; +} ShouldBeFourBytesToo; /* (well, four bytes on 32-bit PowerPC. YMMV.) */ + +int nerrs = 0; + +static void +dotest (const char *name, int trueOrFalse) +{ + if (! trueOrFalse) + ++nerrs; + printf ("test %s: %s\n", name, trueOrFalse ? "passed" : "failed"); +} + +int main(void) +{ + dotest ("push 1", sizeof (ShouldBeSixBytes) == 6); + dotest ("push 8", sizeof (ShouldBeEightBytes) == 8); + dotest ("push 4", sizeof (ShouldBeFourBytes) == 4); + dotest (" pop 8", sizeof (ShouldBeEightBytesToo) == 8); + dotest (" pop 1", sizeof (ShouldBeThreeBytes) == 3); + dotest (" pop n", sizeof (ShouldBeFourBytesToo) == 4); + + return nerrs; +} diff --git a/gcc/testsuite/gcc.apple/pascal-strings-1.c b/gcc/testsuite/gcc.apple/pascal-strings-1.c new file mode 100644 index 00000000000..c4e2d86ddc9 --- /dev/null +++ b/gcc/testsuite/gcc.apple/pascal-strings-1.c @@ -0,0 +1,46 @@ +/* APPLE LOCAL file pascal strings */ +/* Positive C test cases. */ +/* Origin: Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do run } */ +/* { dg-options "-std=iso9899:1999 -fpascal-strings" } */ + +typedef __WCHAR_TYPE__ wchar_t; +typedef __SIZE_TYPE__ size_t; + +extern void abort (void); +extern size_t strlen (const char *s); + +const unsigned char *pascalStr1 = "\pHello, World!"; +const unsigned char *concat1 = "\pConcatenated" "string" "\pliteral"; + +const unsigned char msg1[] = "\pHello"; /* ok */ +const unsigned char *msg2 = "\pHello"; /* ok */ +const signed char msg3[] = "\pHello"; /* ok */ +const char msg4[] = "\pHello"; /* ok */ +unsigned char msg5[] = "\pHello"; /* ok */ +signed char msg7[] = "\pHello"; /* ok */ +char msg8[] = "\pHello"; /* ok */ + +int +main (void) +{ + const unsigned char *pascalStr2 = "\pGood-bye!"; + + if (strlen ((const char *)pascalStr1) != 14) + abort (); + if (*pascalStr1 != 13) + abort (); /* the length byte does not include trailing null */ + + if (strlen ((const char *)pascalStr2) != 10) + abort (); + if (*pascalStr2 != 9) + abort (); + + if (strlen ((const char *)concat1) != 26) + abort (); + if (*concat1 != 25) + abort (); + + return 0; +} + diff --git a/gcc/testsuite/gcc.apple/pascal-strings-2.c b/gcc/testsuite/gcc.apple/pascal-strings-2.c new file mode 100644 index 00000000000..b25c6cf8013 --- /dev/null +++ b/gcc/testsuite/gcc.apple/pascal-strings-2.c @@ -0,0 +1,45 @@ +/* APPLE LOCAL file pascal strings */ +/* Negative C test cases. */ +/* Origin: Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -Wwrite-strings -fpascal-strings" } */ + +typedef __WCHAR_TYPE__ wchar_t; + +const wchar_t *pascalStr1 = L"\pHi!"; /* { dg-warning "unknown escape sequence" } */ +const wchar_t *pascalStr2 = L"Bye\p!"; /* { dg-warning "unknown escape sequence" } */ + +const wchar_t *initErr0 = "\pHi"; /* { dg-warning "incompatible pointer type" } */ +const wchar_t initErr0a[] = "\pHi"; /* { dg-error "initialized from non-wide string" } */ +const wchar_t *initErr1 = "Bye"; /* { dg-warning "incompatible pointer type" } */ +const wchar_t initErr1a[] = "Bye"; /* { dg-error "initialized from non-wide string" } */ + +const char *initErr2 = L"Hi"; /* { dg-warning "incompatible pointer type" } */ +const char initErr2a[] = L"Hi"; /* { dg-error "initialized from wide string" } */ +const signed char *initErr3 = L"Hi"; /* { dg-warning "incompatible pointer type" } */ +const signed char initErr3a[] = L"Hi"; /* { dg-error "initialized from wide string" } */ +const unsigned char *initErr4 = L"Hi"; /* { dg-warning "incompatible pointer type" } */ +const unsigned char initErr4a[] = L"Hi"; /* { dg-error "initialized from wide string" } */ + +const char *pascalStr3 = "Hello\p, World!"; /* { dg-warning "unknown escape sequence" } */ + +const char *concat2 = "Hi" "\pthere"; /* { dg-warning "unknown escape sequence" } */ +const char *concat3 = "Hi" "there\p"; /* { dg-warning "unknown escape sequence" } */ + +const unsigned char *s2 = "\pGoodbye!"; /* ok */ +unsigned char *s3 = "\pHi!"; /* { dg-warning "initialization discards qualifiers" } */ +char *s4 = "\pHi"; /* { dg-warning "initialization discards qualifiers" } */ +signed char *s5 = "\pHi"; /* { dg-warning "initialization discards qualifiers" } */ +const signed char *s6 = "\pHi"; /* { dg-warning "differ in signedness" } */ + +/* the maximum length of a Pascal literal is 255. */ +const unsigned char *almostTooLong = + "\p12345678901234567890123456789012345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890123456789012345678901234567890" + "123456789012345"; /* ok */ +const unsigned char *definitelyTooLong = + "\p12345678901234567890123456789012345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890123456789012345678901234567890" + "1234567890123456"; /* { dg-error "too long" } */ diff --git a/gcc/testsuite/gcc.apple/pascal-strings-3.c b/gcc/testsuite/gcc.apple/pascal-strings-3.c new file mode 100644 index 00000000000..477b94bbff2 --- /dev/null +++ b/gcc/testsuite/gcc.apple/pascal-strings-3.c @@ -0,0 +1,20 @@ +/* APPLE LOCAL file pascal strings */ +/* Ensure that there are no warnings or errors issued when a Pascal string is used to + initialize an array and the NUL terminator does not fit. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-do compile } */ +/* { dg-options "-fpascal-strings" } */ + +typedef unsigned char Str15[16]; + +Str15 ggg = "\p012345678901234"; +Str15 hhh = "\p0123456789012345"; /* { dg-warning "initializer.string for array of chars is too long" } */ + +int foo(void) +{ + Str15 sss = "\p012345678901234"; + Str15 ttt = "\p0123456789012345"; /* { dg-warning "initializer.string for array of chars is too long" } */ + + return 0; +} diff --git a/gcc/testsuite/gcc.apple/power-align-unsup.c b/gcc/testsuite/gcc.apple/power-align-unsup.c new file mode 100644 index 00000000000..63d86853a97 --- /dev/null +++ b/gcc/testsuite/gcc.apple/power-align-unsup.c @@ -0,0 +1,8 @@ +/* Darwin (Mac OS X) alignment exercises. */ + +/* { dg-do compile { target powerpc-*-darwin[89]* } } */ +/* { dg-options "-m64 -malign-power" } */ + +/* { dg-error "-malign-power is not supported for 64-bit Darwin" "" { target *-*-* } 1 } */ + +main() {} diff --git a/gcc/testsuite/gcc.apple/ppc-ignored-options.c b/gcc/testsuite/gcc.apple/ppc-ignored-options.c new file mode 100644 index 00000000000..e08634f4fe5 --- /dev/null +++ b/gcc/testsuite/gcc.apple/ppc-ignored-options.c @@ -0,0 +1,11 @@ +/* Test options to ignore. */ + +/* { dg-do run { target powerpc-*-darwin* } } */ +/* { dg-options "-msse -msse2 -march=pentium4 -mcpu=pentium4" } */ + +int +main () +{ + return 0; +} + diff --git a/gcc/testsuite/gcc.apple/ppc_intrinsics-1.c b/gcc/testsuite/gcc.apple/ppc_intrinsics-1.c new file mode 100644 index 00000000000..3df118853ca --- /dev/null +++ b/gcc/testsuite/gcc.apple/ppc_intrinsics-1.c @@ -0,0 +1,35 @@ +/* { dg-options "-I ${srcdir}/../../more-hdrs" } */ +/* { dg-do compile { target "powerpc*-*-darwin*" } } */ +/* Radar 3208244 */ +#include "ppc_intrinsics.h" +#include <stdlib.h> + +int main( void ) +{ + int i,j; + int value; + register int temp; + double a,b,c,d; + a = 1.;b=2.;c=3.; + + d = __fmadd(a,b,c); + a = __fmadd(c,b,d); + d = __fmadd(a,b,c); + + __lwsync(); + __nop(); + __lwsync(); + __nop(); + d = __fctidz(a); + d = __fctidz(d); + b = __fctid(a); + b = __fctid(b); + c = __fcfid(a); + c = __fcfid(c); + __dcbzl(32,&value); + __dcbzl(&value,0); + + return a+b+c+d; +} + + diff --git a/gcc/testsuite/gcc.apple/ppc_intrinsics-2.c b/gcc/testsuite/gcc.apple/ppc_intrinsics-2.c new file mode 100644 index 00000000000..2f5698fc685 --- /dev/null +++ b/gcc/testsuite/gcc.apple/ppc_intrinsics-2.c @@ -0,0 +1,66 @@ +/* { dg-options "-I ${srcdir}/../../more-hdrs -Wshorten-64-to-32 -Wno-long-long" } */ +/* { dg-do run { target "powerpc*-*-darwin*" } } */ +#include "ppc_intrinsics.h" +#include <stdlib.h> + +int main( void ) +{ + int intconst = 0x5; + long long longlongconst = 0x5; + int intloc, intloc1, intloc2; + unsigned int uintloc, uintloc1, uintloc2; + long longloc; + long long longlongloc; + int fails = 0; + + intloc = __cntlzw(intconst); + if (intloc != 29) + ++fails; + + longlongloc = __cntlzd(longlongconst); + if (longlongloc != 61) + ++fails; + + intloc = 0xffff; + __rlwimi(intloc, 0x21876543, 8, 0, 23); + if (intloc != 0x876543ff) + ++fails; + + intloc = __rlwinm(0x21876543, 8, 0, 31); + if (intloc != 0x87654321) + ++fails; + + longloc = __rlwinm(0x45, 5, 24, 31); + if (longloc != 0xa0) + ++fails; + + longloc = __rlwnm(0x47, 5, 24, 31); + if (longloc != 0xe0) + ++fails; + + intloc1 = 1 << 20; + intloc2 = 1 << 21; + intloc = __mulhw (intloc1, intloc2); + if (intloc != (1 << 9)) + ++fails; + + intloc1 = 0xfffe0000; + intloc2 = 0xfffc0000; + intloc = __mulhw (intloc1, intloc2); + if (intloc != 8) + ++fails; + + uintloc1 = 0xffffffff; + uintloc2 = 0xfffffffe; + uintloc = __mulhwu (uintloc1, uintloc2); + if (uintloc != 0xfffffffd) + ++fails; + + uintloc1 = 0xfffe0000; + uintloc2 = 0xfffc0000; + uintloc = __mulhwu (uintloc1, uintloc2); + if (uintloc != 0xfffa0008) + ++fails; + + return fails; +} diff --git a/gcc/testsuite/gcc.apple/preprocess.s b/gcc/testsuite/gcc.apple/preprocess.s new file mode 100644 index 00000000000..897f2a7d6b1 --- /dev/null +++ b/gcc/testsuite/gcc.apple/preprocess.s @@ -0,0 +1,16 @@ +/* APPLE LOCAL file preprocess .s files */ + +/* Regression test - in assembly language, # may have some significance + other than 'stringize macro argument' and therefore must be preserved + in the output, and should not be warned about. */ + +/* { dg-do preprocess } */ + +#define foo() mov r0, #5 /* { dg-bogus "not followed" "spurious warning" } */ + +entry: + foo() + +/* Check we don't EOF on an unknown directive. */ +#unknown directive +#error a later diagnostic /* { dg-error "diagnostic" } */ diff --git a/gcc/testsuite/gcc.apple/shorten.c b/gcc/testsuite/gcc.apple/shorten.c new file mode 100644 index 00000000000..842979b4ed9 --- /dev/null +++ b/gcc/testsuite/gcc.apple/shorten.c @@ -0,0 +1,20 @@ +/* APPLE LOCAL file 64bit shorten warning 3865314 */ +/* { dg-do compile } */ +/* { dg-options "-Wshorten-64-to-32" } */ +/* Radar 3865314 */ + +long long ll; +int i; +char c; + +void bar (int); + +void foo() { + c = i; + c = ll; + i = (int) ll; + i = ll; /* { dg-warning "implicit conversion shortens 64-bit value into a 32-bit value" } */ + i += ll; /* { dg-warning "implicit conversion shortens 64-bit value into a 32-bit value" } */ + i = i ? ll : i;/* { dg-warning "implicit conversion shortens 64-bit value into a 32-bit value" } */ + bar (ll); /* { dg-warning "implicit conversion shortens 64-bit value into a 32-bit value" } */ +} diff --git a/gcc/testsuite/gcc.apple/special/liblongcall.c b/gcc/testsuite/gcc.apple/special/liblongcall.c new file mode 100644 index 00000000000..6a952281ecd --- /dev/null +++ b/gcc/testsuite/gcc.apple/special/liblongcall.c @@ -0,0 +1,10 @@ +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-mlongcall" } */ +#include <stdio.h> + +int +dy_foo (char *str, int i) +{ + printf ("dy_foo (\"%s\", %d)\n", str, i); + return i + 1; +} diff --git a/gcc/testsuite/gcc.apple/special/longcall-prog.c b/gcc/testsuite/gcc.apple/special/longcall-prog.c new file mode 100644 index 00000000000..5cbb8c0e4ee --- /dev/null +++ b/gcc/testsuite/gcc.apple/special/longcall-prog.c @@ -0,0 +1,18 @@ +#include <stdlib.h> +#include <stdio.h> + +/* declare all externally visible functions in libweak.c */ +int dy_foo (char *, int); + +main () +{ + int answer, x=41; + char *str = "foostr"; + printf ("%s begins:\n", __FILE__); + answer = dy_foo (str, x); + printf ("dy_foo (\"%s\", %d) = %d", str, x, answer); + if (answer != 42) + printf (" (error!)"); + printf ("\n%s done.\n", __FILE__); + exit (answer != 42); +} diff --git a/gcc/testsuite/gcc.apple/special/longcall.exp b/gcc/testsuite/gcc.apple/special/longcall.exp new file mode 100644 index 00000000000..d9ebd1270ea --- /dev/null +++ b/gcc/testsuite/gcc.apple/special/longcall.exp @@ -0,0 +1,69 @@ +# APPLE LOCAL file testsuite +# Copyright (C) 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +# Load support procs. +load_lib gcc-dg.exp + +# Initialize `dg'. +dg-init + +set timeout 30 + +set prms_id 0 +set bug_id 0 + +set testfile "longcall-prog" +set binfile ${objdir}/${subdir}/${testfile} +set srcfile ${srcdir}/${subdir}/${testfile}.c + +set libfilestem "longcall" +set libfile "lib${libfilestem}" +set libbinfile ${objdir}/${subdir}/${libfile}.dylib +set libsrcfile ${srcdir}/${subdir}/${libfile}.c + +file mkdir ${objdir}/${subdir} + +set test "longcall/dylib" + +proc note_result {success diagnostic} { + set verb [expr {($success) ? "pass" : "fail"}] + eval {$verb $diagnostic} +} + +set whine "building $test library" +set additional_flags "additional_flags=-dynamiclib -mlongcall" +set result [expr {[gcc_target_compile "${libsrcfile}" "${libbinfile}" executable [list debug $additional_flags]] == ""}] +note_result $result $whine + +set whine "building $test test program" +set additional_flags "additional_flags=-L${objdir}/${subdir} -l${libfilestem}" +set result [expr {[gcc_target_compile "${srcfile}" "${binfile}" executable [list debug $additional_flags]] == ""}] +note_result $result $whine + +set result [gcc_load "$binfile" "" ""] +set status [lindex $result 0] +set output [lindex $result 1]; +if {$status == "pass" } { + pass $test + file delete $libbinfile $binfile +} else { + fail $test +} + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.apple/special/special.exp b/gcc/testsuite/gcc.apple/special/special.exp new file mode 100644 index 00000000000..5344a4817b7 --- /dev/null +++ b/gcc/testsuite/gcc.apple/special/special.exp @@ -0,0 +1,42 @@ +# APPLE LOCAL file testsuite +# Copyright (C) 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +# Load support procs. +load_lib gcc-dg.exp + +# Initialize `dg'. +dg-init + +# Test the zerofill support by seeing if a file with a large array +# compiled -fno-common has a small size on disk. + +gcc_target_compile "$srcdir/$subdir/zerofill.c" "zerofill.o" object \ + "additional_flags=-fno-common" + +set size [ exec wc -c < zerofill.o ] + +if { $size < 100000 } { + pass "zerofill" +} else { + fail "zerofill" +} + +file delete zerofill.o + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.apple/special/zerofill.c b/gcc/testsuite/gcc.apple/special/zerofill.c new file mode 100644 index 00000000000..e4bd84c816f --- /dev/null +++ b/gcc/testsuite/gcc.apple/special/zerofill.c @@ -0,0 +1,5 @@ +/* APPLE LOCAL file zerofill */ + +int arr[40000]; + +foo() {} diff --git a/gcc/testsuite/gcc.apple/string-insns.c b/gcc/testsuite/gcc.apple/string-insns.c new file mode 100644 index 00000000000..aee058d5548 --- /dev/null +++ b/gcc/testsuite/gcc.apple/string-insns.c @@ -0,0 +1,9 @@ +/* APPLE LOCAL Disable string insns with -Os on Darwin (radar 3509006) */ +/* { dg-do compile { target powerpc*-apple-darwin* } } */ +/* { dg-options "-Os" } */ +/* On ppc at Apple, -Os should not use string instructions. 3509006. */ +struct s { int a; int b; int c; }; +int foo (struct s* p, struct s* q) { + *p = *q; +} +/* { dg-final { scan-assembler-not "lswi" } } */ diff --git a/gcc/testsuite/gcc.apple/test-ldouble.c b/gcc/testsuite/gcc.apple/test-ldouble.c new file mode 100644 index 00000000000..fe85d86e0e1 --- /dev/null +++ b/gcc/testsuite/gcc.apple/test-ldouble.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ + +extern void __inline_x80told(long double *x); +extern double rint( double ); + +extern unsigned long AECreateDesc(const void * dataPtr); + +unsigned long aeCoercePtrToMagnitude() +{ + unsigned long err = 0; + unsigned long magValue; + double doubleValue; + long double longDoubleValue; + + __inline_x80told(&longDoubleValue); + doubleValue = longDoubleValue; + if (doubleValue < 0) + err = 2; + else + magValue = (unsigned long) rint(doubleValue); + err = AECreateDesc(&magValue); + return err; +} diff --git a/gcc/testsuite/gcc.apple/test-local-static-longlong.c b/gcc/testsuite/gcc.apple/test-local-static-longlong.c new file mode 100644 index 00000000000..19afa53c016 --- /dev/null +++ b/gcc/testsuite/gcc.apple/test-local-static-longlong.c @@ -0,0 +1,19 @@ +/* { dg-do run } */ +/* { dg-options "-Wno-long-long" } */ + +#include <stdlib.h> + +long long foo() +{ + static long long rat = (1LL<<62); + return rat; +} + +int main() +{ + + if (foo() != (1LL<<62)) + abort(); + exit(0); +} + diff --git a/gcc/testsuite/gcc.apple/very-long-comment.c b/gcc/testsuite/gcc.apple/very-long-comment.c new file mode 100644 index 00000000000..2d9928dd4b3 --- /dev/null +++ b/gcc/testsuite/gcc.apple/very-long-comment.c @@ -0,0 +1,14 @@ +/* +This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. + */ +#warning test warning /* { dg-warning "test warning" } */ +#include <stdio.h> + +int main() +{ + printf("This is line %d\n", __LINE__); + return 0; +} + +/* { dg-options "-Wall" } */ +/* { dg-do compile } */ diff --git a/gcc/testsuite/gcc.apple/x86-ignored-options.c b/gcc/testsuite/gcc.apple/x86-ignored-options.c new file mode 100644 index 00000000000..d48919758bf --- /dev/null +++ b/gcc/testsuite/gcc.apple/x86-ignored-options.c @@ -0,0 +1,11 @@ +/* Test options to ignore. */ + +/* { dg-do run { target i?86-*-darwin* } } */ +/* { dg-options "-faltivec -mno-fused-madd -mlong-branch -mlongcall -mcpu=G4 -mcpu=G5" } */ + +int +main () +{ + return 0; +} + diff --git a/gcc/testsuite/gcc.apple/x86-no-math-errno.c b/gcc/testsuite/gcc.apple/x86-no-math-errno.c new file mode 100644 index 00000000000..c0b018d8be3 --- /dev/null +++ b/gcc/testsuite/gcc.apple/x86-no-math-errno.c @@ -0,0 +1,9 @@ +/* APPLE LOCAL begin math-errno off by default 4094534 */ +/* { dg-do compile { target i?86-*-darwin* } } */ +/* { dg-options "-O3" } */ +/* { dg-final { scan-assembler-not "ucomiss" } } */ +extern double sqrt(double); +float foo(float y) { + return sqrt(y); +} +/* APPLE LOCAL end math-errno off by default 4094534 */ diff --git a/gcc/testsuite/gcc.c-torture/compile/20011119-1.c b/gcc/testsuite/gcc.c-torture/compile/20011119-1.c index 2204c11c90b..4057ff0612c 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20011119-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20011119-1.c @@ -1,3 +1,5 @@ +/* { dg-require-weak "" } */ +/* { dg-require-alias "" } */ extern inline int foo (void) { return 23; } int xxx(void) __asm__("xxx"); int xxx(void) { return 23; } diff --git a/gcc/testsuite/gcc.c-torture/compile/20011119-2.c b/gcc/testsuite/gcc.c-torture/compile/20011119-2.c index ab649b98bc7..3f5a62f10a4 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20011119-2.c +++ b/gcc/testsuite/gcc.c-torture/compile/20011119-2.c @@ -1,3 +1,5 @@ +/* { dg-require-weak "" } */ +/* { dg-require-alias "" } */ extern inline int foo (void) { return 23; } int bar (void) { return foo (); } extern int foo (void) __attribute__ ((weak, alias ("xxx"))); diff --git a/gcc/testsuite/gcc.c-torture/compile/20040323-1.c b/gcc/testsuite/gcc.c-torture/compile/20040323-1.c index a8d924ab0fc..77ddadc9dcd 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20040323-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20040323-1.c @@ -1,7 +1,7 @@ /* PR middle-end/14694 */ /* { dg-require-alias "" } */ -/* { dg-xfail-if "undefined alias" { "*-*-solaris2.*" } { "*" } { "" } } */ +unsigned int _rtld_global = 1; extern unsigned int _rtld_local __attribute__ ((alias ("_rtld_global"))); unsigned int diff --git a/gcc/testsuite/gcc.c-torture/compile/20050215-1.c b/gcc/testsuite/gcc.c-torture/compile/20050215-1.c new file mode 100644 index 00000000000..e9717797a10 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050215-1.c @@ -0,0 +1,4 @@ +/* PR tree-optimization/18947 */ +extern __inline void f1 (void) { } +extern __inline void f2 (void) { f1 (); } +void f2 (void) {} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050215-2.c b/gcc/testsuite/gcc.c-torture/compile/20050215-2.c new file mode 100644 index 00000000000..44550d04ce7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050215-2.c @@ -0,0 +1,7 @@ +/* PR tree-optimization/18947 */ +int v; +extern __inline void f1 (void) { v++; } +void f4 (void) { f1 (); } +extern __inline void f2 (void) { f1 (); } +void f3 (void) { f2 (); } +void f2 (void) { f1 (); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20050215-3.c b/gcc/testsuite/gcc.c-torture/compile/20050215-3.c new file mode 100644 index 00000000000..7a35eb6d0c1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050215-3.c @@ -0,0 +1,8 @@ +/* PR tree-optimization/18947 */ +int v; +extern __inline void f0 (void) { v++; } +extern __inline void f1 (void) { f0 (); } +void f4 (void) { f1 (); } +extern __inline void f2 (void) { f1 (); } +void f3 (void) { f2 (); } +void f2 (void) { f1 (); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20050217-1.c b/gcc/testsuite/gcc.c-torture/compile/20050217-1.c new file mode 100644 index 00000000000..f4b928d1e04 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050217-1.c @@ -0,0 +1,14 @@ +/* PR c++/20023 */ + +void f (void); +typedef __SIZE_TYPE__ size_t; +void g (void *a) +{ + size_t b = (size_t) a; + switch (b) + { + case 1: + f (); + break; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050303-1.c b/gcc/testsuite/gcc.c-torture/compile/20050303-1.c new file mode 100644 index 00000000000..005a8c50ea4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050303-1.c @@ -0,0 +1,11 @@ +/* APPLE LOCAL file mainline */ +void crc() +{ + int toread; + long long nleft; + unsigned char buf[(128 * 1024)]; + + nleft = 0; + while (toread = (nleft < (2147483647 * 2U + 1U)) ? nleft: (2147483647 * 2U + 1U) ) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/981001-2.c b/gcc/testsuite/gcc.c-torture/compile/981001-2.c index 9ade1d92aef..f635cbb60e3 100644 --- a/gcc/testsuite/gcc.c-torture/compile/981001-2.c +++ b/gcc/testsuite/gcc.c-torture/compile/981001-2.c @@ -1,3 +1,5 @@ +/* { dg-require-weak "" } */ +/* { dg-require-alias "" } */ #define weak_alias(func, aliasname) \ extern __typeof (func) aliasname __attribute__ ((weak, alias (#func))); diff --git a/gcc/testsuite/gcc.c-torture/compile/pr13066-1.c b/gcc/testsuite/gcc.c-torture/compile/pr13066-1.c new file mode 100644 index 00000000000..c2930f95df6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr13066-1.c @@ -0,0 +1,10 @@ +void *g, *c; +int a, b; + +int f() +{ + if ((0 == a) != (b || g == c)) + return 1; + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr20203.c b/gcc/testsuite/gcc.c-torture/compile/pr20203.c new file mode 100644 index 00000000000..1fb2a045d55 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr20203.c @@ -0,0 +1,16 @@ +void *memset (void *, int, unsigned long); + +typedef struct bfd_section +{ + unsigned long size; + unsigned char *contents; +} asection; + +int +_bfd_mips_elf_finish_dynamic_sections (asection *s) +{ + long long dummy_offset; + dummy_offset = s->size - 16; + memset (s->contents + dummy_offset, 0, 16); + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr20412.c b/gcc/testsuite/gcc.c-torture/compile/pr20412.c new file mode 100644 index 00000000000..c0feecf3d43 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr20412.c @@ -0,0 +1,20 @@ +int +foo(void) +{ + int a,b,g; + int i,len; + int stop; + + len = 10; + stop = 0; + for (i=0; i<len; i++) + { + a = bar1() ? 0 : 1; + b = bar2() ? 0 : 1; + g = bar3() ? 0 : 1; + + if (stop = ((a+b) % 2 != g)) break; + } + + return stop; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr20539-1.c b/gcc/testsuite/gcc.c-torture/compile/pr20539-1.c new file mode 100644 index 00000000000..f67f06b8816 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr20539-1.c @@ -0,0 +1,10 @@ +char l7_en; +long long l6_data_Z_0th; +int t; +void f() +{ + if (((char )(l6_data_Z_0th>>1 & 1U)) & ((l6_data_Z_0th & 1U) + | !(((char )(l6_data_Z_0th>>35 & 15U))==14U))) + t = 0ULL; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-4.x b/gcc/testsuite/gcc.c-torture/compile/simd-4.x new file mode 100644 index 00000000000..0ab59899f66 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/simd-4.x @@ -0,0 +1,4 @@ +# APPLE LOCAL file vector instructions are not supported except with -faltivec + +if { [istarget "*-apple-darwin*"] } { set options "-faltivec" } +return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/struct-non-lval-1.c b/gcc/testsuite/gcc.c-torture/compile/struct-non-lval-1.c new file mode 100644 index 00000000000..0924f5cc02d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/struct-non-lval-1.c @@ -0,0 +1,7 @@ +/* Bug c/17855. */ +struct foo {char x, y, z[2];}; +struct foo f(); +void bar(int baz) +{ + f().z[baz] = 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/struct-non-lval-2.c b/gcc/testsuite/gcc.c-torture/compile/struct-non-lval-2.c new file mode 100644 index 00000000000..daa0d17492d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/struct-non-lval-2.c @@ -0,0 +1,7 @@ +/* Bug c/17855, using conditional expression for non-lvalue. */ +struct foo {char x, y, z[2];}; +struct foo p, q; int r; +void bar(int baz) +{ + (r ? p : q).z[baz] = 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/struct-non-lval-3.c b/gcc/testsuite/gcc.c-torture/compile/struct-non-lval-3.c new file mode 100644 index 00000000000..3020194cae0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/struct-non-lval-3.c @@ -0,0 +1,7 @@ +/* Bug c/17855, using assignment for non-lvalue. */ +struct foo {char x, y, z[2];}; +struct foo p, q; +void bar(int baz) +{ + (p = q).z[baz] = 1; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020720-1.x b/gcc/testsuite/gcc.c-torture/execute/20020720-1.x index 7afd9e44879..c693128a791 100644 --- a/gcc/testsuite/gcc.c-torture/execute/20020720-1.x +++ b/gcc/testsuite/gcc.c-torture/execute/20020720-1.x @@ -29,7 +29,7 @@ set torture_eval_before_compile { set compiler_conditional_xfail_data { "This test fails to optimize completely on certain platforms." \ { "xtensa-*-*" "sh-*-*" "arm*-*-*" "strongarm*-*-*" "xscale*-*-*" \ - "h8300*-*-*" "cris-*-*" "frv-*-*" "powerpc-*-*spe" } \ + "h8300*-*-*" "frv-*-*" "powerpc-*-*spe" } \ { "*" } \ { "-O0" } } diff --git a/gcc/testsuite/gcc.c-torture/execute/20050119-2.c b/gcc/testsuite/gcc.c-torture/execute/20050119-2.c new file mode 100644 index 00000000000..568109cb2c9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050119-2.c @@ -0,0 +1,40 @@ +/* PR middle-end/19874 */ +typedef enum { A, B, C, D } E; + +struct S { + E __attribute__ ((mode (__byte__))) a; + E __attribute__ ((mode (__byte__))) b; + E __attribute__ ((mode (__byte__))) c; + E __attribute__ ((mode (__byte__))) d; +}; + +extern void abort (void); +extern void exit (int); + +E +foo (struct S *s) +{ + if (s->a != s->b) + abort (); + if (s->c != C) + abort (); + return s->d; +} + +int +main (void) +{ + struct S s[2]; + s[0].a = B; + s[0].b = B; + s[0].c = C; + s[0].d = D; + s[1].a = D; + s[1].b = C; + s[1].c = B; + s[1].d = A; + if (foo (s) != D) + abort (); + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20050215-1.c b/gcc/testsuite/gcc.c-torture/execute/20050215-1.c new file mode 100644 index 00000000000..f4920ce5fd9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050215-1.c @@ -0,0 +1,25 @@ +/* PR middle-end/19857 */ + +typedef struct { char c[8]; } V +#ifdef __ELF__ + __attribute__ ((aligned (8))) +#endif + ; +typedef __SIZE_TYPE__ size_t; +V v; +void abort (void); + +int +main (void) +{ + V *w = &v; + if (((size_t) ((float *) ((size_t) w & ~(size_t) 3)) % 8) != 0 + || ((size_t) w & 1)) + { +#ifndef __ELF__ + if (((size_t) &v & 7) == 0) +#endif + abort (); + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050218-1.c b/gcc/testsuite/gcc.c-torture/execute/20050218-1.c new file mode 100644 index 00000000000..104174f923a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050218-1.c @@ -0,0 +1,30 @@ +/* PR tree-optimization/19828 */ +typedef __SIZE_TYPE__ size_t; +extern size_t strlen (const char *s); +extern int strncmp (const char *s1, const char *s2, size_t n); +extern void abort (void); + +const char *a[16] = { "a", "bc", "de", "fgh" }; + +int +foo (char *x, const char *y, size_t n) +{ + size_t i, j = 0; + for (i = 0; i < n; i++) + { + if (strncmp (x + j, a[i], strlen (a[i])) != 0) + return 2; + j += strlen (a[i]); + if (y) + j += strlen (y); + } + return 0; +} + +int +main (void) +{ + if (foo ("abcde", (const char *) 0, 3) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050224-1.c b/gcc/testsuite/gcc.c-torture/execute/20050224-1.c new file mode 100644 index 00000000000..681200364c1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050224-1.c @@ -0,0 +1,33 @@ +/* Origin: Mikael Pettersson <mikpe@csd.uu.se> and the Linux kernel. */ + +extern void abort (void); +unsigned long a = 0xc0000000, b = 0xd0000000; +unsigned long c = 0xc01bb958, d = 0xc0264000; +unsigned long e = 0xc0288000, f = 0xc02d4378; + +void +foo (int x, int y, int z) +{ + if (x != 245 || y != 36 || z != 444) + abort (); +} + +int +main (void) +{ + unsigned long g; + int h = 0, i = 0, j = 0; + + if (sizeof (unsigned long) < 4) + return 0; + + for (g = a; g < b; g += 0x1000) + if (g < c) + h++; + else if (g >= d && g < e) + j++; + else if (g < f) + i++; + foo (i, j, h); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050316-1.c b/gcc/testsuite/gcc.c-torture/execute/20050316-1.c new file mode 100644 index 00000000000..2a1c6254dfa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050316-1.c @@ -0,0 +1,69 @@ +/* PR rtl-optimization/16104 */ + +extern void abort (void); + +typedef int V2SI __attribute__ ((vector_size (8))); +typedef unsigned int V2USI __attribute__ ((vector_size (8))); +typedef short V2HI __attribute__ ((vector_size (4))); +typedef unsigned int V2UHI __attribute__ ((vector_size (4))); + +int +test1 (void) +{ + return (long long) (V2SI) 0LL; +} + +int +test2 (V2SI x) +{ + return (long long) x; +} + +V2SI +test3 (void) +{ + return (V2SI) (long long) (int) (V2HI) 0; +} + +V2SI +test4 (V2HI x) +{ + return (V2SI) (long long) (int) x; +} + +V2SI +test5 (V2USI x) +{ + return (V2SI) x; +} + +int +main (void) +{ + if (sizeof (short) != 2 || sizeof (int) != 4 || sizeof (long long) != 8) + return 0; + + if (test1 () != 0) + abort (); + + V2SI x = { 2, 2 }; + if (test2 (x) != 2) + abort (); + + union { V2SI x; int y[2]; V2USI z; long long l; } u; + u.x = test3 (); + if (u.y[0] != 0 || u.y[1] != 0) + abort (); + + V2HI y = { 4, 4 }; + union { V2SI x; long long y; } v; + v.x = test4 (y); + if (v.y != 0x40004) + abort (); + + V2USI z = { 6, 6 }; + u.x = test5 (z); + if (u.y[0] != 6 || u.y[1] != 6) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050410-1.c b/gcc/testsuite/gcc.c-torture/execute/20050410-1.c new file mode 100644 index 00000000000..c4cd85279a9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050410-1.c @@ -0,0 +1,13 @@ +int s = 200; +int __attribute__((noinline)) +foo (void) +{ + return (signed char) (s - 100) - 5; +} +int +main (void) +{ + if (foo () != 95) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050414-1.c b/gcc/testsuite/gcc.c-torture/execute/20050414-1.c new file mode 100644 index 00000000000..8217280ae1b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050414-1.c @@ -0,0 +1,47 @@ +/* PR target/20126 was not really target-specific, but rather a loop's + failure to take into account the possibility that a DEST_ADDR giv + replacement might fail, such as when you attempt to replace a REG + with a PLUS in one of the register_operands of cmpstrqi_rex_1. */ + +extern void abort (void); + +typedef struct { int a; char b[3]; } S; +S c = { 2, "aa" }, d = { 2, "aa" }; + +void * +bar (const void *x, int y, int z) +{ + return (void *) 0; +} + +int +foo (S *x, S *y) +{ + const char *e, *f, *g; + int h; + + h = y->a; + f = y->b; + e = x->b; + + if (h == 1) + return bar (e, *f, x->a) != 0; + + g = e + x->a - h; + while (e <= g) + { + const char *t = e + 1; + if (__builtin_memcmp (e, f, h) == 0) + return 1; + e = t; + } + return 0; +} + +int +main (void) +{ + if (foo (&c, &d) != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.x b/gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.x new file mode 100644 index 00000000000..8e3b5f146f1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.x @@ -0,0 +1,6 @@ +if [istarget "mips-sgi-irix6*"] { + # IRIX 6 sets the MIPS IV flush to zero bit by default, so this test + # isn't expected to work for n32 and n64 on MIPS IV targets. + return 1 +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-ivopts-1.c b/gcc/testsuite/gcc.c-torture/execute/loop-ivopts-1.c new file mode 100644 index 00000000000..13396fbf0da --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-ivopts-1.c @@ -0,0 +1,30 @@ +/* From PR 18977. */ +void foo(float * x); + +int main() +{ + float x[4]; + foo (x); + return 0; +} + +void foo (float *x) +{ + int i,j,k; + float temp; + static float t16[16]={1.,2.,3.,4.,5.,6.,7.,8.,9., + 10.,11.,12.,13.,14.,15.,16.}; + static float tmp[4]={0.,0.,0.,0.}; + + for (i=0; i<4; i++) { + k = 3 - i; + temp = t16[5*k]; + for(j=k+1; j<4; j++) { + tmp[k] = t16[k+ j*4] * temp; + } + } + x[0] = tmp[0]; + x[1] = tmp[1]; + x[2] = tmp[2]; + x[3] = tmp[3]; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-ivopts-2.c b/gcc/testsuite/gcc.c-torture/execute/loop-ivopts-2.c new file mode 100644 index 00000000000..737640bff05 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-ivopts-2.c @@ -0,0 +1,50 @@ +/* PR rtl-optimization/20290 */ + +/* We used to mis-optimize the second loop in main on at least ppc and + arm, because tree loop would change the loop to something like: + + ivtmp.65 = &l[i]; + ivtmp.16 = 113; + goto <bb 4> (<L4>); + +<L3>:; + *(ivtmp.65 + 4294967292B) = 9; + i = i + 1; + +<L4>:; + ivtmp.16 = ivtmp.16 - 1; + ivtmp.65 = ivtmp.65 + 4B; + if (ivtmp.16 != 0) goto <L3>; + + We used to consider the increment of i as executed in every + iteration, so we'd miscompute the final value. */ + +extern void abort (void); + +void +check (unsigned int *l) +{ + int i; + for (i = 0; i < 288; i++) + if (l[i] != 7 + (i < 256 || i >= 280) + (i >= 144 && i < 256)) + abort (); +} + +int +main (void) +{ + int i; + unsigned int l[288]; + + for (i = 0; i < 144; i++) + l[i] = 8; + for (; i < 256; i++) + l[i] = 9; + for (; i < 280; i++) + l[i] = 7; + for (; i < 288; i++) + l[i] = 8; + check (l); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/medce-2.c b/gcc/testsuite/gcc.c-torture/execute/medce-2.c deleted file mode 100644 index cd83ead2867..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/medce-2.c +++ /dev/null @@ -1,42 +0,0 @@ - -extern void abort (); - -static int ok = 0; - -int bar(void) -{ - ok |= 1; - return 1; -} - -void bat(void) -{ - ok |= 2; -} - -void baz(void) -{ - ok |= 4; -} - -void foo() -{ - goto lab; - - if (0) - { - if (({lab: bar();})) - bat (); - else - baz (); - } -} - -int main() -{ - foo(); - if (ok != 3) - abort (); - return 0; -} - diff --git a/gcc/testsuite/gcc.c-torture/execute/pr17133.c b/gcc/testsuite/gcc.c-torture/execute/pr17133.c new file mode 100644 index 00000000000..6357d03a54f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr17133.c @@ -0,0 +1,28 @@ +/* APPLE LOCAL file mainline */ +extern void abort (void); + +int foo = 0; +void *bar = 0; +unsigned int baz = 100; + +void *pure_alloc () +{ + void *res; + + while (1) + { + res = (void *) ((((unsigned int) (foo + bar))) & ~1); + foo += 2; + if (foo < baz) + return res; + foo = 0; + } +} + +int main () +{ + pure_alloc (); + if (!foo) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr20100-1.c b/gcc/testsuite/gcc.c-torture/execute/pr20100-1.c new file mode 100644 index 00000000000..8782edcd845 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr20100-1.c @@ -0,0 +1,76 @@ +/* PR tree-optimization/20100 + Pure function being treated as const. + Author: Hans-Peter Nilsson. */ + +static unsigned short g = 0; +static unsigned short p = 0; +unsigned char e; + +static unsigned short +next_g (void) +{ + return g == e - 1 ? 0 : g + 1; +} + +static unsigned short +curr_p (void) +{ + return p; +} + +static unsigned short +inc_g (void) +{ + return g = next_g (); +} + +static unsigned short +curr_g (void) +{ + return g; +} + +static char +ring_empty (void) +{ + if (curr_p () == curr_g ()) + return 1; + else + return 0; +} + +char +frob (unsigned short a, unsigned short b) +{ + g = a; + p = b; + inc_g (); + return ring_empty (); +} + +unsigned short +get_n (void) +{ + unsigned short n = 0; + unsigned short org_g; + org_g = curr_g (); + while (!ring_empty () && n < 5) + { + inc_g (); + n++; + } + + return n; +} + +void abort (void); +void exit (int); +int main (void) +{ + e = 3; + if (frob (0, 2) != 0 || g != 1 || p != 2 || e != 3 + || get_n () != 1 + || g != 2 || p != 2) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr20527-1.c b/gcc/testsuite/gcc.c-torture/execute/pr20527-1.c new file mode 100644 index 00000000000..81162dfebb4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr20527-1.c @@ -0,0 +1,81 @@ +/* PR rtl-optimization/20527 + Mishandled postincrement. This test-case is derived from the + function BZ2_hbCreateDecodeTables in the file huffman.c from + bzip2-1.0.2, hence requiring the following disclaimer copied here: */ + +/*-- + This file is a part of bzip2 and/or libbzip2, a program and + library for lossless, block-sorting data compression. + + Copyright (C) 1996-2002 Julian R Seward. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. + + 3. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + + 4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + Julian Seward, Cambridge, UK. + jseward@acm.org + bzip2/libbzip2 version 1.0 of 21 March 2000 + + This program is based on (at least) the work of: + Mike Burrows + David Wheeler + Peter Fenwick + Alistair Moffat + Radford Neal + Ian H. Witten + Robert Sedgewick + Jon L. Bentley + + For more information on these sources, see the manual. +--*/ + +void f (long *limit, long *base, long minLen, long maxLen) __attribute__ ((__noinline__)); +void f (long *limit, long *base, long minLen, long maxLen) +{ + long i; + long vec; + vec = 0; + for (i = minLen; i <= maxLen; i++) { + vec += (base[i+1] - base[i]); + limit[i] = vec-1; + } +} +extern void abort (void); +extern void exit (int); +long b[] = {1, 5, 11, 23}; +int main (void) +{ + long l[3]; + f (l, b, 0, 2); + if (l[0] != 3 || l[1] != 9 || l[2] != 21) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr20601-1.c b/gcc/testsuite/gcc.c-torture/execute/pr20601-1.c new file mode 100644 index 00000000000..7c13c913819 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr20601-1.c @@ -0,0 +1,122 @@ +/* PR tree-optimization/20601 */ +extern void abort (void); +extern void exit (int); + +struct T +{ + char *t1; + char t2[4096]; + char **t3; +}; + +int a[5]; +int b; +char **c; +int d; +char **e; +struct T t; +char *f[16]; +char *g[] = { "a", "-u", "b", "c" }; + +__attribute__ ((__noreturn__)) void +foo (void) +{ + while (1); +} + +__attribute__ ((noinline)) char * +bar (char *x, unsigned int y) +{ + return 0; +} + +static inline char * +baz (char *x, unsigned int y) +{ + if (sizeof (t.t2) != (unsigned int) -1 && y > sizeof (t.t2)) + foo (); + return bar (x, y); +} + +static inline int +setup1 (int x) +{ + char *p; + int rval; + + if (!baz (t.t2, sizeof (t.t2))) + baz (t.t2, sizeof (t.t2)); + + if (x & 0x200) + { + char **h, **i = e; + + ++d; + e = f; + if (t.t1 && *t.t1) + e[0] = t.t1; + else + abort (); + + for (h = e + 1; (*h = *i); ++i, ++h) + ; + } + return 1; +} + +static inline int +setup2 (void) +{ + int j = 1; + + e = c + 1; + d = b - 1; + while (d > 0 && e[0][0] == '-') + { + if (e[0][1] != '\0' && e[0][2] != '\0') + abort (); + + switch (e[0][1]) + { + case 'u': + if (!e[1]) + abort (); + + t.t3 = &e[1]; + d--; + e++; + break; + case 'P': + j |= 0x1000; + break; + case '-': + d--; + e++; + if (j == 1) + j |= 0x600; + return j; + } + d--; + e++; + } + + if (d > 0 && !(j & 1)) + abort (); + + return j; +} + +int +main (void) +{ + int x; + c = g; + b = 4; + x = setup2 (); + t.t1 = "/bin/sh"; + setup1 (x); + /* PRE shouldn't transform x into the constant 0x601 here, it's not legal. */ + if ((x & 0x400) && !a[4]) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr21173.c b/gcc/testsuite/gcc.c-torture/execute/pr21173.c new file mode 100644 index 00000000000..e9509b294f7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr21173.c @@ -0,0 +1,22 @@ +/* APPLE LOCAL file 4100712 FSF 4.0 branch */ +void abort (void); + +char q; +void *a[2]; + +void foo (char *p) +{ + int i; + for (i = 0; i < 2; i++) + a[i] += p - &q; +} + +int main (void) +{ + int i; + foo (&q); + for (i = 0; i < 2; i ++) + if (a[i]) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/20050307-1.c b/gcc/testsuite/gcc.dg/20050307-1.c new file mode 100644 index 00000000000..0e8dac69a65 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20050307-1.c @@ -0,0 +1,52 @@ +/* PR target/20322 */ + +extern void abort (void); + +typedef unsigned long T; +typedef struct +{ + T a, b; + unsigned char c, d; +} S; + +#define M (sizeof (T) * 4) + +S __attribute__((noinline)) +foo (T x, T y) +{ + S e; + T f[2], g; + + e.b = (x & (~(T) 0 >> M)) * (y & (~(T) 0 >> M)); + e.a = (x >> M) * (y >> M); + + f[0] = (x & (~(T) 0 >> M)) * (y >> M); + f[1] = (x >> M) * (y & (~(T) 0 >> M)); + + g = e.b; + e.b += (f[0] & (~(T) 0 >> M)) << M; + if (e.b < g) + e.a++; + + g = e.b; + e.b += (f[1] & (~(T) 0 >> M)) << M; + if (e.b < g) + e.a++; + + e.a += (f[0] >> M); + e.a += (f[1] >> M); + e.c = 1; + e.d = 0; + + return e; +} + +int +main (void) +{ + T x = 1UL << (M * 2 - 1); + S y = foo (1, x); + if (y.a || y.b != x || y.c != 1 || y.d) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/20050309-1.c b/gcc/testsuite/gcc.dg/20050309-1.c new file mode 100644 index 00000000000..413930f86f8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20050309-1.c @@ -0,0 +1,37 @@ +/* This caused an ICE on s390 due to incorrect secondary + output reloads. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fprofile-generate" } */ + +char * +test(char *ret, int *counter, void *schema, + const char* name, const char *namespace, + void *node, int topLevel) +{ + char buf[30]; + int val; + + if (counter == 0) return 0; + if (schema == 0) return 0; + if (name == 0) return 0; + + __builtin_memset (ret, 0, 100); + lookup (schema, name, -1); + val = hash (schema, name, namespace, name, ret); + if (val == 0) return ret; + + if (topLevel != 0) + { + error (1, 0, 0, node, "%s", name); + return 0; + } + + __snprintf_chk (buf, 29, 1, 30, "#eCont %d", ++*counter); + val = hash (schema, name, buf, namespace, ret); + if (val == 0) return ret; + + error (1, 0, 0, node, "%s", name); + return 0; +} + diff --git a/gcc/testsuite/gcc.dg/20050321-1.c b/gcc/testsuite/gcc.dg/20050321-1.c new file mode 100644 index 00000000000..01c68cd5ed9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20050321-1.c @@ -0,0 +1,26 @@ +/* This caused an ICE on powerpc-linux-gnu due to not + up-to-date life info (PR middle-end/20177). */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fmodulo-sched" } */ +extern void * malloc (long); + +struct s { + int k; +}; + +int n; +struct s *a1, *(*use)[]; +float (*vector)[]; + +void +foo (float *V) +{ + int i, used = 0; + + vector = malloc (i * sizeof (float)); + while ((*use)[used] != a1) + used += 1; + for (i = 0; i < n; i++) + *V += (*vector)[i]; +} diff --git a/gcc/testsuite/gcc.dg/20050321-2.c b/gcc/testsuite/gcc.dg/20050321-2.c new file mode 100644 index 00000000000..ac3191423b1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20050321-2.c @@ -0,0 +1,54 @@ +/* This testcase could not assemble on ppc32, because the compiler assumed + the huge ADDR_DIFF_VEC will be emitted into rodata section, yet because + of some notes inserted between jump table's CODE_LABEL and the jump table + it ended up in the .text section and thus shorten_branches couldn't + figure out branch to lab is too far. */ +/* { dg-do link } */ +/* { dg-options "-g1 -fpic" } */ + +#define A(n) \ + case n##1: return n##1 * 131 + 63; \ + case n##3: return n##3 * 1231 + 182; \ + case n##5: return n##5 * 351 + 1; \ + case n##7: return n##7 * 312 + 61; \ + case n##9: return n##9 * 17 - 1; +#define B(n) \ +A(n##0) A(n##1) A(n##2) A(n##3) A(n##4) \ +A(n##5) A(n##6) A(n##7) A(n##8) A(n##9) +#define C(n) \ +B(n##0) B(n##1) B(n##2) B(n##3) B(n##4) \ +B(n##5) B(n##6) B(n##7) B(n##8) B(n##9) +#define D(n) \ +C(n##0) C(n##1) B(n##20) B(n##21) B(n##22) + +int +foo (int x) +{ + { +lab:; + int a = x; + while (a < 60000) + { + int b = a; + { + int c = b; + switch (c) + { + D(1) + default: break; + } + } + a += 10000; + if (a == 4168) + goto lab; + } + } + return x; +} + +int +main (void) +{ + foo (71); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/20050325-1.c b/gcc/testsuite/gcc.dg/20050325-1.c new file mode 100644 index 00000000000..5760e387a22 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20050325-1.c @@ -0,0 +1,19 @@ +/* PR 20249 */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fprofile-arcs" } */ + +extern int *g (int x, void* y); +extern void fg (long long x, int y); + +static void +ff (int y, long long z) +{ + fg (z, 1); +} + +void +f () +{ + g (42, ff); +} diff --git a/gcc/testsuite/gcc.dg/20050330-1.c b/gcc/testsuite/gcc.dg/20050330-1.c new file mode 100644 index 00000000000..69b5f9dcfe9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20050330-1.c @@ -0,0 +1,14 @@ +/* This test is a reduced test case for a bug that caused + ICE while bootstrapping with -fmodulo-sched on powerpc-apple-darwin + related to (PR middle-end/20177). */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fmodulo-sched" } */ + +void +foo ( const char *bytes, int len , char *buf) +{ + int i; + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; +} diff --git a/gcc/testsuite/gcc.dg/20050409-1.c b/gcc/testsuite/gcc.dg/20050409-1.c new file mode 100644 index 00000000000..be85f71a6b7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20050409-1.c @@ -0,0 +1,18 @@ +/* This used to ICE due to a regmove problem on s390. */ + +/* { dg-do compile { target s390*-*-* } } */ +/* { dg-options "-O2" } */ + + +extern void abort (void); +extern void **alloc (void); + +void *test (void) +{ + void **p = alloc (); + if (!p) abort (); + + __builtin_set_thread_pointer (p); + return *p; +} + diff --git a/gcc/testsuite/gcc.dg/20050603-1.c b/gcc/testsuite/gcc.dg/20050603-1.c new file mode 100644 index 00000000000..7ec96dbc09d --- /dev/null +++ b/gcc/testsuite/gcc.dg/20050603-1.c @@ -0,0 +1,25 @@ +/* APPLE LOCAL file mainline */ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-O2" } */ +#include <locale.h> +#include <stdlib.h> +register int *testreg asm ("r29"); + +int x; +int y; +int *ext_func (int *p) { return p; } + +void test_reg_save_restore (int*) __attribute__((noinline)); +void +test_reg_save_restore (int *p) +{ + setlocale (LC_ALL, "C"); + testreg = ext_func(p); +} +main() { + testreg = &x; + test_reg_save_restore (&y); + if (testreg != &y) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/20050607-1.c b/gcc/testsuite/gcc.dg/20050607-1.c new file mode 100644 index 00000000000..5e53e3fcd6e --- /dev/null +++ b/gcc/testsuite/gcc.dg/20050607-1.c @@ -0,0 +1,14 @@ +/* APPLE LOCAL file mainline */ +/* { dg-do compile } */ +/* { dg-options "-Wpadded" } +/* The struct internally constructed for the nested function should + not result in a warning from -Wpadded. */ +extern int baz(int (*) (int)); +int foo(void) +{ + int k = 3; + int bar(int x) { + return x + k; + } + return baz(bar); +} diff --git a/gcc/testsuite/gcc.dg/Foundation.framework/empty b/gcc/testsuite/gcc.dg/Foundation.framework/empty new file mode 100644 index 00000000000..412078626a1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Foundation.framework/empty @@ -0,0 +1,2 @@ +/* APPLE LOCAL file mainline */ +This directory is empty. diff --git a/gcc/testsuite/gcc.dg/alias-3.c b/gcc/testsuite/gcc.dg/alias-3.c new file mode 100644 index 00000000000..3dc25a91c49 --- /dev/null +++ b/gcc/testsuite/gcc.dg/alias-3.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-require-alias "" } */ +/* { dg-options "" } */ + +extern int foo(); + +int baz () { return foo(); } + +static inline int bar () __attribute__ ((alias ("foo"))); /* { dg-error "aliased to" } */ + +int main () { return bar (); } diff --git a/gcc/testsuite/gcc.dg/alias-4.c b/gcc/testsuite/gcc.dg/alias-4.c new file mode 100644 index 00000000000..0a2633932ef --- /dev/null +++ b/gcc/testsuite/gcc.dg/alias-4.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-require-alias "" } */ +/* { dg-options "-O2 -funit-at-a-time" } */ + +extern int foo(); + +int baz () { return foo(); } + +static inline int bar () __attribute__ ((alias ("foo"))); /* { dg-error "aliased to" } */ + +int main () { return bar (); } diff --git a/gcc/testsuite/gcc.dg/alias-5.c b/gcc/testsuite/gcc.dg/alias-5.c new file mode 100644 index 00000000000..56848c9a416 --- /dev/null +++ b/gcc/testsuite/gcc.dg/alias-5.c @@ -0,0 +1,7 @@ +/* { dg-do link } */ +/* { dg-require-alias "" } */ +/* { dg-options "" } */ + +static inline int foo () { return 0; } +static int bar () __attribute__ ((alias ("foo"))); +int main () { return bar (); } diff --git a/gcc/testsuite/gcc.dg/alias-6.c b/gcc/testsuite/gcc.dg/alias-6.c new file mode 100644 index 00000000000..3ba101aa1b4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/alias-6.c @@ -0,0 +1,7 @@ +/* { dg-do link } */ +/* { dg-require-alias "" } */ +/* { dg-options "-O2 -funit-at-a-time" } */ + +static inline int foo () { return 0; } +static int bar () __attribute__ ((alias ("foo"))); +int main () { return bar (); } diff --git a/gcc/testsuite/gcc.dg/alias-7.c b/gcc/testsuite/gcc.dg/alias-7.c new file mode 100644 index 00000000000..697497021f1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/alias-7.c @@ -0,0 +1,16 @@ +/* { dg-do run } */ +/* { dg-require-alias "" } */ +/* { dg-options "-O2" } */ + +extern void abort (void); + +int foo __asm__ ("foo") __attribute__((nocommon)); +extern __typeof (foo) bar __attribute__ ((weak, alias ("foo"))); + +int +main (void) +{ + if (&foo != &bar || foo || bar) + abort (); + return bar; +} diff --git a/gcc/testsuite/gcc.dg/altivec-20.c b/gcc/testsuite/gcc.dg/altivec-20.c new file mode 100644 index 00000000000..f733d18214c --- /dev/null +++ b/gcc/testsuite/gcc.dg/altivec-20.c @@ -0,0 +1,23 @@ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-maltivec -mcpu=G5 -O2" } */ + +#include <altivec.h> + +void foo( float scalar) +{ + unsigned long width; + unsigned long x; + vector float vColor; + vector unsigned int selectMask; + vColor = vec_perm( vec_ld( 0, &scalar), vec_ld( 3, &scalar), vec_lvsl( 0, &scalar) ); + + float *destRow; + vector float store, load0; + + for( ; x < width; x++) + { + load0 = vec_sel( vColor, load0, selectMask ); + vec_st( store, 0, destRow ); + store = load0; + } +} diff --git a/gcc/testsuite/gcc.dg/altivec-21.c b/gcc/testsuite/gcc.dg/altivec-21.c new file mode 100644 index 00000000000..bcb78ced52b --- /dev/null +++ b/gcc/testsuite/gcc.dg/altivec-21.c @@ -0,0 +1,16 @@ +/* APPLE LOCAL begin mainline 2005-04-14 */ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-xfail-if "" { "powerpc*-*-*" } { "-m64" } { "" } } */ +/* { dg-options "-maltivec" } */ + +#include <altivec.h> + +extern void preansi(); + +typedef void (*pvecfunc) (); + +void foo(pvecfunc pvf) { + vector int v = (vector int){1, 2, 3, 4}; + (*pvf) (4, 4.0, v); /* { dg-error "AltiVec argument passed to unprototyped function" } */ +} +/* APPLE LOCAL end mainline 2005-04-14 */ diff --git a/gcc/testsuite/gcc.dg/altivec-22.c b/gcc/testsuite/gcc.dg/altivec-22.c new file mode 100644 index 00000000000..51bcb4b4c69 --- /dev/null +++ b/gcc/testsuite/gcc.dg/altivec-22.c @@ -0,0 +1,16 @@ +/* APPLE LOCAL begin altivec test */ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-xfail-if "" { "powerpc*-*-*" } { "-m64" } { "" } } */ +/* { dg-options "-maltivec" } */ + +#include <altivec.h> + +extern void preansi(); + +typedef void (*pvecfunc) (); + +void foo(pvecfunc pvf) { + vector int v = (vector int){1, 2, 3, 4}; + preansi (4, 4.0, v); /* { dg-error "AltiVec argument passed to unprototyped function" } */ +} +/* APPLE LOCAL end altivec test */ diff --git a/gcc/testsuite/gcc.dg/altivec-cpusubtype.c b/gcc/testsuite/gcc.dg/altivec-cpusubtype.c new file mode 100644 index 00000000000..fb5c30c5ac1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/altivec-cpusubtype.c @@ -0,0 +1,10 @@ +/* APPLE LOCAL begin radar 4161346 */ +/* { dg-do compile { target "powerpc*-*-darwin*" } } */ +/* { dg-options "-faltivec" } */ +/* { dg-final { scan-assembler-not "ppc7400" } } */ + +int main( int argc, char * argv[] ) +{ + return 0; +} +/* APPLE LOCAL end radar 4161346 */ diff --git a/gcc/testsuite/gcc.dg/altivec-nomfcr.c b/gcc/testsuite/gcc.dg/altivec-nomfcr.c new file mode 100644 index 00000000000..a4a06333aa7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/altivec-nomfcr.c @@ -0,0 +1,12 @@ +/* APPLE LOCAL begin radar 4149154 */ +/* { dg-do compile { target powerpc-*-* } } */ +/* { dg-options "-O3 -maltivec" } */ +/* { dg-final { scan-assembler-not "mfcr" } } */ + +#include <altivec.h> + +int foo(vector float x, vector float y) { + if (vec_all_eq(x,y)) return 3245; + else return 12; +} +/* APPLE LOCAL begin radar 4149154 */ diff --git a/gcc/testsuite/gcc.dg/anon-struct-6.c b/gcc/testsuite/gcc.dg/anon-struct-6.c index a2042176c03..ad961c62aea 100644 --- a/gcc/testsuite/gcc.dg/anon-struct-6.c +++ b/gcc/testsuite/gcc.dg/anon-struct-6.c @@ -9,4 +9,4 @@ struct s { const; }; /* { dg-warning "warning: useless type qualifier in empty declaration" "empty" { target *-*-* } 9 } */ -/* { dg-warning "warning: empty declaration" "empty" { target *-*-* } 9 } */ +/* { dg-warning "warning: empty declaration" "empty 2" { target *-*-* } 9 } */ diff --git a/gcc/testsuite/gcc.dg/array-8.c b/gcc/testsuite/gcc.dg/array-8.c index 6d0a211461b..44b757b70df 100644 --- a/gcc/testsuite/gcc.dg/array-8.c +++ b/gcc/testsuite/gcc.dg/array-8.c @@ -43,7 +43,7 @@ g (void) pv[0]; /* { dg-warning "warning: dereferencing 'void \\*' pointer" } */ 0[pv]; /* { dg-warning "warning: dereferencing 'void \\*' pointer" } */ sip[0]; /* { dg-error "error: invalid use of undefined type 'struct si'" } */ - /* { dg-error "error: dereferencing pointer to incomplete type" "" { target *-*-* } 45 } */ + /* { dg-error "error: dereferencing pointer to incomplete type" "incomplete" { target *-*-* } 45 } */ 0[sip]; /* { dg-error "error: invalid use of undefined type 'struct si'" } */ - /* { dg-error "error: dereferencing pointer to incomplete type" "" { target *-*-* } 47 } */ + /* { dg-error "error: dereferencing pointer to incomplete type" "incomplete" { target *-*-* } 47 } */ } diff --git a/gcc/testsuite/gcc.dg/asm-b.c b/gcc/testsuite/gcc.dg/asm-b.c new file mode 100644 index 00000000000..ce68cabe300 --- /dev/null +++ b/gcc/testsuite/gcc.dg/asm-b.c @@ -0,0 +1,39 @@ +/* { dg-do run { target powerpc-*-* i?386-*-* x86_64-*-* } } */ +/* { dg-options "-O1" } */ +/* Test to make sure that inline-asm causes the tree optimizators get the + V_MAY_DEFs and clober memory. */ +/* Test from Jakub Jelinek, modified by Andrew Pinski to work on all powerpc targets. */ +extern void abort (void); + +unsigned short v = 0x0300; + +void +foo (unsigned short *p) +{ + *p = v; +} + +int +bar (void) +{ + unsigned short x; + volatile unsigned short *z; + foo (&x); + const unsigned int y = x; + z = &x; +#if defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) || defined (_POWER) + __asm __volatile ("sthbrx %1,0,%2" : "=m" (*z) : "r" (y), "r" (z)); +#elif defined __i386__ || defined __x86_64__ + __asm __volatile ("movb %b1,1(%2); movb %h1,(%2)" : "=m" (*z) : "r" (y), "r" +(z)); +#endif + return (x & 1) == 0; +} + +int +main (void) +{ + if (bar ()) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/bincl-1.c b/gcc/testsuite/gcc.dg/bincl-1.c new file mode 100644 index 00000000000..222fe1b4e76 --- /dev/null +++ b/gcc/testsuite/gcc.dg/bincl-1.c @@ -0,0 +1,19 @@ +/* APPLE LOCAL file bincl/eincl stabs */ +/* Test BINCL/EINCL stabs. */ +/* Contributed by Devang Patel <dpatel@apple.com> */ + +/* { dg-do compile } */ +/* { dg-skip-if "No stabs" { mmix-*-* *-*-aix* *-*-netware* alpha*-*-* hppa*64*-*-* ia64-*-* } { "*" } { "" } } */ +/* { dg-options "-gstabs -fno-eliminate-unused-debug-symbols" } */ + +#include "bincl-1.h" +int +main () +{ + my_int j = 0; + return j; +} + +/* { dg-final { scan-assembler ".stabs.*130,0,0,0" } } */ +/* { dg-final { scan-assembler ".stabs.*162,0,0,0" } } */ + diff --git a/gcc/testsuite/gcc.dg/bincl-1.h b/gcc/testsuite/gcc.dg/bincl-1.h new file mode 100644 index 00000000000..3bf51278e90 --- /dev/null +++ b/gcc/testsuite/gcc.dg/bincl-1.h @@ -0,0 +1,3 @@ +/* APPLE LOCAL file bincl/eincl stabs */ +/* Test BINCL/EINCL stabs. */ +typedef int my_int; diff --git a/gcc/testsuite/gcc.dg/bitfld-14.c b/gcc/testsuite/gcc.dg/bitfld-14.c new file mode 100644 index 00000000000..eca0b03def0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/bitfld-14.c @@ -0,0 +1,11 @@ +/* Test for non-integer bit-field widths. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +enum e { E, F }; +struct s { + int a : (void *)4; /* { dg-error "error: bit-field 'a' width not an integer constant" } */ + int b : (enum e)F; + int c : (_Bool)1; +}; diff --git a/gcc/testsuite/gcc.dg/builtin-apply4.c b/gcc/testsuite/gcc.dg/builtin-apply4.c new file mode 100644 index 00000000000..289694e3c1b --- /dev/null +++ b/gcc/testsuite/gcc.dg/builtin-apply4.c @@ -0,0 +1,30 @@ +/* PR tree-optimization/20076 */ +/* { dg-options "-O2" } */ +/* { dg-do run } */ + +extern void abort (void); + +double +foo (int arg) +{ + if (arg != 116) + abort(); + return arg + 1; +} + +inline double +bar (int arg) +{ + foo (arg); + __builtin_return (__builtin_apply ((void (*) ()) foo, + __builtin_apply_args (), 16)); +} + +int +main (int argc, char **argv) +{ + if (bar (116) != 117.0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/c99-tgmath-1.c b/gcc/testsuite/gcc.dg/c99-tgmath-1.c new file mode 100644 index 00000000000..e4890226511 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-tgmath-1.c @@ -0,0 +1,248 @@ +/* APPLE LOCAL file radar 2872232 */ +/* Test for <tgmath.h> in C99. */ +/* Origin: Matt Austern <austern@apple.com> +/* { dg-do preprocess } */ +/* { dg-options "-std=iso9899:1999" } */ + +/* Test that tgmath defines the macros it's supposed to. */ +#include <tgmath.h> + +#ifndef acos +#error acos undefined +#endif + +#ifndef asin +#error asin undefined +#endif + +#ifndef atan +#error atan undefined +#endif + +#ifndef acosh +#error acosh undefined +#endif + +#ifndef asinh +#error asinh undefined +#endif + +#ifndef atanh +#error atanh undefined +#endif + +#ifndef cos +#error cos undefined +#endif + +#ifndef sin +#error sin undefined +#endif + +#ifndef tan +#error tan undefined +#endif + +#ifndef cosh +#error cosh undefined +#endif + +#ifndef sinh +#error sinh undefined +#endif + +#ifndef tanh +#error tanh undefined +#endif + +#ifndef exp +#error exp undefined +#endif + +#ifndef log +#error log undefined +#endif + +#ifndef pow +#error pow undefined +#endif + +#ifndef sqrt +#error sqrt undefined +#endif + +#ifndef fabs +#error fabs undefined +#endif + +#ifndef atan2 +#error atan2 undefined +#endif + +#ifndef cbrt +#error cbrt undefined +#endif + +#ifndef ceil +#error ceil undefined +#endif + +#ifndef copysign +#error copysign undefined +#endif + +#ifndef erf +#error erf undefined +#endif + +#ifndef erfc +#error erfc undefined +#endif + +#ifndef exp2 +#error exp2 undefined +#endif + +#ifndef expm1 +#error expm1 undefined +#endif + +#ifndef fdim +#error fdim undefined +#endif + +#ifndef floor +#error floor undefined +#endif + +#ifndef fma +#error fma undefined +#endif + +#ifndef fmax +#error fmax undefined +#endif + +#ifndef fmin +#error fmin undefined +#endif + +#ifndef fmod +#error fmod undefined +#endif + +#ifndef frexp +#error frexp undefined +#endif + +#ifndef hypot +#error hypot undefined +#endif + +#ifndef ilogb +#error ilogb undefined +#endif + +#ifndef ldexp +#error ldexp undefined +#endif + +#ifndef lgamma +#error lgamma undefined +#endif + +#ifndef llrint +#error llrint undefined +#endif + +#ifndef llround +#error llround undefined +#endif + +#ifndef log10 +#error log10 undefined +#endif + +#ifndef log1p +#error log1p undefined +#endif + +#ifndef log2 +#error log2 undefined +#endif + +#ifndef logb +#error logb undefined +#endif + +#ifndef lrint +#error lrint undefined +#endif + +#ifndef lround +#error lround undefined +#endif + +#ifndef nearbyint +#error nearbyint undefined +#endif + +#ifndef nextafter +#error nextafter undefined +#endif + +#ifndef nexttoward +#error nexttoward undefined +#endif + +#ifndef remainder +#error remainder undefined +#endif + +#ifndef remquo +#error remquo undefined +#endif + +#ifndef rint +#error rint undefined +#endif + +#ifndef round +#error round undefined +#endif + +#ifndef scalbn +#error scalbn undefined +#endif + +#ifndef scalbln +#error scalbln undefined +#endif + +#ifndef tgamma +#error tgamma undefined +#endif + +#ifndef trunc +#error trunc undefined +#endif + +#ifndef carg +#error carg undefined +#endif + +#ifndef cimag +#error cimag undefined +#endif + +#ifndef conj +#error conj undefined +#endif + +#ifndef cproj +#error cproj undefined +#endif + +#ifndef creal +#error creal undefined +#endif diff --git a/gcc/testsuite/gcc.dg/c99-tgmath-2.c b/gcc/testsuite/gcc.dg/c99-tgmath-2.c new file mode 100644 index 00000000000..35978cc8469 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-tgmath-2.c @@ -0,0 +1,15 @@ +/* APPLE LOCAL file radar 2872232 */ +/* Test for <tgmath.h> in C99. */ +/* Origin: Matt Austern <austern@apple.com> +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999" } */ + +/* Test that invoking type-generic sin on a float invokes sinf. */ +#include <tgmath.h> + +float foo(float x) +{ + return sin(x); +} + +/* {dg-final {scan-assembler "sinf" } } */ diff --git a/gcc/testsuite/gcc.dg/c99-tgmath-3.c b/gcc/testsuite/gcc.dg/c99-tgmath-3.c new file mode 100644 index 00000000000..9d164095a70 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-tgmath-3.c @@ -0,0 +1,15 @@ +/* APPLE LOCAL file radar 2872232 */ +/* Test for <tgmath.h> in C99. */ +/* Origin: Matt Austern <austern@apple.com> +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999" } */ + +/* Test that invoking type-generic exp on a complex invokes cexp. */ +#include <tgmath.h> + +complex double foo(complex double x) +{ + return exp(x); +} + +/* {dg-final {scan-assembler "cexp" } } */ diff --git a/gcc/testsuite/gcc.dg/c99-tgmath-4.c b/gcc/testsuite/gcc.dg/c99-tgmath-4.c new file mode 100644 index 00000000000..dbb8d1c341c --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-tgmath-4.c @@ -0,0 +1,15 @@ +/* APPLE LOCAL file radar 2872232 */ +/* Test for <tgmath.h> in C99. */ +/* Origin: Matt Austern <austern@apple.com> +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999" } */ + +/* Test that invoking type-generic pow on complex float invokes cpowf. */ +#include <tgmath.h> + +complex double foo(complex float x, float y) +{ + return pow(x, y); +} + +/* {dg-final {scan-assembler "cpowf" } } */ diff --git a/gcc/testsuite/gcc.dg/cast-lvalue-2.c b/gcc/testsuite/gcc.dg/cast-lvalue-2.c index ed6a2e69fe8..0d52a6253c7 100644 --- a/gcc/testsuite/gcc.dg/cast-lvalue-2.c +++ b/gcc/testsuite/gcc.dg/cast-lvalue-2.c @@ -1,7 +1,8 @@ /* Test for error on casts as lvalues. Casts to same type. */ /* Origin: Joseph Myers <jsm@polyomino.org.uk> */ /* { dg-do compile } */ -/* { dg-options "" } */ +/* APPLE LOCAL non lvalue assign */ +/* { dg-options "-fno-non-lvalue-assign" } */ int x; @@ -10,4 +11,5 @@ foo (void) { (int) x = 1; /* { dg-bogus "warning" "warning in place of error" } */ } -/* { dg-error "lvalue" "cast as lvalue" { target *-*-*} 11 } */ +/* APPLE LOCAL non lvalue assign */ +/* { dg-error "lvalue" "cast as lvalue" { target *-*-*} 12 } */ diff --git a/gcc/testsuite/gcc.dg/cast-ptr-1.c b/gcc/testsuite/gcc.dg/cast-ptr-1.c new file mode 100644 index 00000000000..cb42d13ac48 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cast-ptr-1.c @@ -0,0 +1,15 @@ +/* APPLE LOCAL file pointer casts */ +/* Test that casts of pointer to unsigned long long aren't sign extended */ +/* Author: Matt Austern <austern@apple.com> */ +/* { dg-do run } */ +/* { dg-options "-Wno-error -w" } */ + +int main () { + /* Note: test assumes sizeof(long long) >= sizeof(void*) */ + + unsigned long x1 = 0x80000000ul; + void* p = (void*) x1; + unsigned long long x2 = (unsigned long long) p; + + return !(x1 == x2); +} diff --git a/gcc/testsuite/gcc.dg/charset/asm1.c b/gcc/testsuite/gcc.dg/charset/asm1.c index d7578d418f6..dfd14018613 100644 --- a/gcc/testsuite/gcc.dg/charset/asm1.c +++ b/gcc/testsuite/gcc.dg/charset/asm1.c @@ -1,5 +1,5 @@ /* { dg-do compile } - { dg-require-iconv "IBM-1047" } + { dg-require-iconv "IBM1047" } { dg-final { scan-assembler ".ascii bar" } } { dg-final { scan-assembler ".ascii foo" } } */ diff --git a/gcc/testsuite/gcc.dg/charset/asm2.c b/gcc/testsuite/gcc.dg/charset/asm2.c index bfca86c8e96..a9a9c011b2b 100644 --- a/gcc/testsuite/gcc.dg/charset/asm2.c +++ b/gcc/testsuite/gcc.dg/charset/asm2.c @@ -2,7 +2,7 @@ If we ever get a good way to test error recovery the string "foobar" should be translated. */ /* { dg-do compile } */ -/* { dg-require-iconv "IBM-1047" } */ +/* { dg-require-iconv "IBM1047" } */ asm (not_a_string); /* { dg-error "(parse error|syntax error|expected string literal) before" "not_a_string" } */ char x[] = "foobar"; diff --git a/gcc/testsuite/gcc.dg/charset/asm3.c b/gcc/testsuite/gcc.dg/charset/asm3.c index 8d8dbbb524d..8ae2212fd26 100644 --- a/gcc/testsuite/gcc.dg/charset/asm3.c +++ b/gcc/testsuite/gcc.dg/charset/asm3.c @@ -1,7 +1,7 @@ /* Test for complex asm statements. Make sure it compiles then test for some of the asm statements not being translated. */ /* { dg-do compile { target i?86-*-* } } - { dg-require-iconv "IBM-1047" } + { dg-require-iconv "IBM1047" } { dg-final { scan-assembler "std" } } { dg-final { scan-assembler "cld" } } { dg-final { scan-assembler "rep" } } diff --git a/gcc/testsuite/gcc.dg/charset/asm4.c b/gcc/testsuite/gcc.dg/charset/asm4.c index cd850c3e81f..59c8d59ff39 100644 --- a/gcc/testsuite/gcc.dg/charset/asm4.c +++ b/gcc/testsuite/gcc.dg/charset/asm4.c @@ -1,6 +1,6 @@ /* Simple asm test. */ /* { dg-do compile } - { dg-require-iconv "IBM-1047" } + { dg-require-iconv "IBM1047" } { dg-final { scan-assembler "foo" } } */ extern int bar; diff --git a/gcc/testsuite/gcc.dg/charset/asm5.c b/gcc/testsuite/gcc.dg/charset/asm5.c index fa93f40fdaf..a4bb01401a9 100644 --- a/gcc/testsuite/gcc.dg/charset/asm5.c +++ b/gcc/testsuite/gcc.dg/charset/asm5.c @@ -1,6 +1,6 @@ /* Test for string translation. */ /* { dg-do compile } - { dg-require-iconv "IBM-1047" } + { dg-require-iconv "IBM1047" } { dg-final { scan-assembler-not "translate" } } */ void foo (void) { diff --git a/gcc/testsuite/gcc.dg/charset/asm6.c b/gcc/testsuite/gcc.dg/charset/asm6.c index 91316224f0c..ae2ec485d80 100644 --- a/gcc/testsuite/gcc.dg/charset/asm6.c +++ b/gcc/testsuite/gcc.dg/charset/asm6.c @@ -1,6 +1,6 @@ /* Test for string translation. */ /* { dg-do compile } - { dg-require-iconv "IBM-1047" } + { dg-require-iconv "IBM1047" } { dg-final { scan-assembler "foo" } } */ int main() { diff --git a/gcc/testsuite/gcc.dg/charset/attribute1.c b/gcc/testsuite/gcc.dg/charset/attribute1.c index 993c7934c80..799630030ba 100644 --- a/gcc/testsuite/gcc.dg/charset/attribute1.c +++ b/gcc/testsuite/gcc.dg/charset/attribute1.c @@ -1,6 +1,6 @@ /* Test for attribute non-translation. */ /* { dg-do compile } - { dg-require-iconv "IBM-1047" } + { dg-require-iconv "IBM1047" } { dg-final { scan-assembler "foo" } } */ int walrus __attribute__ ((section (".foo"))); diff --git a/gcc/testsuite/gcc.dg/charset/attribute2.c b/gcc/testsuite/gcc.dg/charset/attribute2.c index 4ce95a51f84..ef1f35f3ed1 100644 --- a/gcc/testsuite/gcc.dg/charset/attribute2.c +++ b/gcc/testsuite/gcc.dg/charset/attribute2.c @@ -2,7 +2,7 @@ If error recovery is ever testable then "foobar" should be translated. */ /* { dg-do compile } - { dg-require-iconv "IBM-1047" } + { dg-require-iconv "IBM1047" } */ int foo __attribute__ ((walrus)); /* { dg-error "walrus" "ignored" } */ char x[] = "foobar"; diff --git a/gcc/testsuite/gcc.dg/charset/builtin1.c b/gcc/testsuite/gcc.dg/charset/builtin1.c new file mode 100644 index 00000000000..753049c9666 --- /dev/null +++ b/gcc/testsuite/gcc.dg/charset/builtin1.c @@ -0,0 +1,26 @@ +/* isdigit(c) can be optimized to ((unsigned)c) - '0' <= 9, but only if + we know the correct value of '0'. PR 18785. */ + +/* { dg-do run } */ +/* { dg-require-iconv "IBM1047" } */ +/* { dg-options "-O2 -fno-inline -fexec-charset=IBM1047" } */ + +extern int isdigit(int); +extern void abort(void); + +static int str1(void) { return '1'; } +static int strA(void) { return 'A'; } + +int +main(void) +{ + if (!isdigit('1')) + abort(); + if (isdigit('A')) + abort(); + if (!isdigit(str1())) + abort(); + if (isdigit(strA())) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/charset/charset.exp b/gcc/testsuite/gcc.dg/charset/charset.exp index ad75cb55af8..bc2c65db910 100644 --- a/gcc/testsuite/gcc.dg/charset/charset.exp +++ b/gcc/testsuite/gcc.dg/charset/charset.exp @@ -30,7 +30,7 @@ load_lib target-supports.exp # If a testcase doesn't have special options, use these. global DEFAULT_CHARSETCFLAGS if ![info exists DEFAULT_CHARSETCFLAGS] then { - set DEFAULT_CHARSETCFLAGS "-fexec-charset=IBM-1047" + set DEFAULT_CHARSETCFLAGS "-fexec-charset=IBM1047" } # Initialize `dg'. diff --git a/gcc/testsuite/gcc.dg/charset/extern.c b/gcc/testsuite/gcc.dg/charset/extern.c index 5e46ca6facf..05a0c3e42bc 100644 --- a/gcc/testsuite/gcc.dg/charset/extern.c +++ b/gcc/testsuite/gcc.dg/charset/extern.c @@ -1,5 +1,5 @@ /* { dg-do compile } - { dg-require-iconv "IBM-1047" } + { dg-require-iconv "IBM1047" } { dg-final { scan-assembler-not "abcdefghijklmnopqrstuvwxyz" } } */ extern char *bar; diff --git a/gcc/testsuite/gcc.dg/charset/function.c b/gcc/testsuite/gcc.dg/charset/function.c index ab4c2bcba0e..5aba6511bd0 100644 --- a/gcc/testsuite/gcc.dg/charset/function.c +++ b/gcc/testsuite/gcc.dg/charset/function.c @@ -1,5 +1,5 @@ /* { dg-do compile } - { dg-require-iconv "IBM-1047" } + { dg-require-iconv "IBM1047" } { dg-final { scan-assembler-not "\"foobar\"" } } */ const char *str; diff --git a/gcc/testsuite/gcc.dg/charset/string.c b/gcc/testsuite/gcc.dg/charset/string.c index 375e28a2ed6..f720773dd57 100644 --- a/gcc/testsuite/gcc.dg/charset/string.c +++ b/gcc/testsuite/gcc.dg/charset/string.c @@ -1,5 +1,5 @@ /* Simple character translation test. */ /* { dg-do compile } - { dg-require-iconv "IBM-1047" } + { dg-require-iconv "IBM1047" } { dg-final { scan-assembler-not "string foobar" } } */ char *foo = "string foobar"; diff --git a/gcc/testsuite/gcc.dg/cond-lvalue-1.c b/gcc/testsuite/gcc.dg/cond-lvalue-1.c index f2605af6ad6..8c7595bd591 100644 --- a/gcc/testsuite/gcc.dg/cond-lvalue-1.c +++ b/gcc/testsuite/gcc.dg/cond-lvalue-1.c @@ -1,7 +1,8 @@ /* Test for deprecation of conditional expressions as lvalues. */ /* Origin: Joseph Myers <jsm@polyomino.org.uk> */ /* { dg-do compile } */ -/* { dg-options "" } */ +/* APPLE LOCAL non lvalue assign */ +/* { dg-options "-fno-non-lvalue-assign" } */ int x, y, z; @@ -10,4 +11,5 @@ foo (void) { (x ? y : z) = 1; /* { dg-bogus "warning" "warning in place of error" } */ } -/* { dg-error "lvalue" "conditional expression as lvalue" { target *-*-* } 11 } */ +/* APPLE LOCAL non lvalue assign */ +/* { dg-error "lvalue" "conditional expression as lvalue" { target *-*-* } 12 } */ diff --git a/gcc/testsuite/gcc.dg/const-compare.c b/gcc/testsuite/gcc.dg/const-compare.c new file mode 100644 index 00000000000..f0e30d89e1e --- /dev/null +++ b/gcc/testsuite/gcc.dg/const-compare.c @@ -0,0 +1,30 @@ +/* APPLE LOCAL begin radar 3869444 */ +/* { dg-do compile { target "powerpc*-*-darwin*" } } */ +/* { dg-options "-m64 -O1 -static" } */ +typedef unsigned long long uint64_t; + +static int +match(name, pat) + uint64_t *name, *pat; +{ + int ok=0, negate_range; + uint64_t c, k; + + c = *pat++; + switch (c & 0xffffffffffULL) { + case ((uint64_t)(('[')|0x8000000000ULL)): + if ((negate_range = ((*pat & 0xffffffffffULL) == ((uint64_t)(('!')|0x8000000000ULL)) )) != '\0') + ++pat; + while (((c = *pat++) & 0xffffffffffULL) ) + if ((*pat & 0xffffffffffULL) == ((uint64_t)(('-')|0x8000000000ULL))) + { + pat += 2; + } + + if (ok == negate_range) + return(0); + break; + } + return(*name == '\0'); +} +/* APPLE LOCAL end radar 3869444 */ diff --git a/gcc/testsuite/gcc.dg/cpp/19940712-1.c b/gcc/testsuite/gcc.dg/cpp/19940712-1.c index 5b4ac8b722c..d5ed88973e3 100644 --- a/gcc/testsuite/gcc.dg/cpp/19940712-1.c +++ b/gcc/testsuite/gcc.dg/cpp/19940712-1.c @@ -3,7 +3,7 @@ /* dg.exp doesn't read the header files for magic comments. */ /* { dg-error "unterminated comment" "" { target *-*-* } 4 } */ -/* { dg-error "unterminated comment" "" { target *-*-* } 8 } */ +/* { dg-error "unterminated comment" "header error" { target *-*-* } 8 } */ #include "19940712-1.h" /* { dg-error "" } // In file included from: */ #include "19940712-1a.h" /* { dg-error "" } // In file included from: */ diff --git a/gcc/testsuite/gcc.dg/cpp/19951025-1.c b/gcc/testsuite/gcc.dg/cpp/19951025-1.c index 283b5f53f1a..b817b68c8ae 100644 --- a/gcc/testsuite/gcc.dg/cpp/19951025-1.c +++ b/gcc/testsuite/gcc.dg/cpp/19951025-1.c @@ -1,4 +1,4 @@ /* { dg-do preprocess } */ -/* { dg-error "include expects" "" { target *-*-* } 4 } */ -/* { dg-error "newline at end" "" { target *-*-* } 4 } */ +/* { dg-error "include expects" "include" { target *-*-* } 4 } */ +/* { dg-error "newline at end" "newline" { target *-*-* } 4 } */ #include /\ diff --git a/gcc/testsuite/gcc.dg/cpp/assert4.c b/gcc/testsuite/gcc.dg/cpp/assert4.c index 99b304f2455..023bb50cdeb 100644 --- a/gcc/testsuite/gcc.dg/cpp/assert4.c +++ b/gcc/testsuite/gcc.dg/cpp/assert4.c @@ -78,7 +78,7 @@ # error #endif -#if defined __unix__ || defined _AIX +#if ( defined __unix__ && !defined __CYGWIN__ ) || defined _AIX # if !#system(unix) # error # endif @@ -118,7 +118,7 @@ # error #endif -#if defined __WINNT__ +#if defined __WINNT__ || defined __CYGWIN__ # if !#system(winnt) # error # endif diff --git a/gcc/testsuite/gcc.dg/cpp/c++98-pedantic.cc b/gcc/testsuite/gcc.dg/cpp/c++98-pedantic.cc new file mode 100644 index 00000000000..1e8c160a96f --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/c++98-pedantic.cc @@ -0,0 +1,11 @@ +/* APPLE LOCAL file rename for HFS */ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=c++98 -pedantic" } */ + +/* This file is for testing the preprocessor in -std=c++98 -pedantic mode. + Neil Booth, 2 Dec 2000. */ + +#if 1LL /* { dg-warning "long long" } */ +#endif diff --git a/gcc/testsuite/gcc.dg/cpp/c++98.cc b/gcc/testsuite/gcc.dg/cpp/c++98.cc new file mode 100644 index 00000000000..a9843b878fd --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/c++98.cc @@ -0,0 +1,11 @@ +/* APPLE LOCAL file rename for HFS */ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=c++98" } */ + +/* This file is for testing the preprocessor in -std=c++98 mode. + Neil Booth, 2 Dec 2000. */ + +#if 1LL +#endif diff --git a/gcc/testsuite/gcc.dg/cpp/cpp.exp b/gcc/testsuite/gcc.dg/cpp/cpp.exp index 960a29182d0..d1ed5e8c981 100644 --- a/gcc/testsuite/gcc.dg/cpp/cpp.exp +++ b/gcc/testsuite/gcc.dg/cpp/cpp.exp @@ -23,6 +23,13 @@ if [is_remote host] { } } +# APPLE LOCAL begin headermaps +file mkdir d +foreach header { A.h bA.h c.h d/d.h } { + remote_download host $srcdir/$subdir/inc/$header $header +} +# APPLE LOCAL end headermaps + # Load support procs. load_lib gcc-dg.exp diff --git a/gcc/testsuite/gcc.dg/cpp/endif-pedantic2.c b/gcc/testsuite/gcc.dg/cpp/endif-pedantic2.c index d5c6eb960e6..0b2124bd512 100644 --- a/gcc/testsuite/gcc.dg/cpp/endif-pedantic2.c +++ b/gcc/testsuite/gcc.dg/cpp/endif-pedantic2.c @@ -3,6 +3,8 @@ /* { dg-do preprocess } */ /* { dg-options "-Wno-endif-labels -pedantic" } */ +/* APPLE LOCAL -Wextra-tokens */ +/* { dg-options "-Wextra-tokens -Wno-endif-labels -pedantic" { target *-apple-darwin* } } */ /* Tests combinations of -pedantic and -Wno-endif-labels; see extratokens2.c for more general tests. */ diff --git a/gcc/testsuite/gcc.dg/cpp/extratokens.c b/gcc/testsuite/gcc.dg/cpp/extratokens.c index c06a41d4c2b..125a9bdf805 100644 --- a/gcc/testsuite/gcc.dg/cpp/extratokens.c +++ b/gcc/testsuite/gcc.dg/cpp/extratokens.c @@ -1,7 +1,8 @@ /* Copyright (C) 2000 Free Software Foundation, Inc. */ /* { dg-do preprocess } */ -/* { dg-options "-fno-show-column" } */ +/* APPLE LOCAL -Wextra-tokens */ +/* { dg-options "-fno-show-column -Wextra-tokens" } */ /* Tests all directives that do not permit excess tokens at the end of the line. */ diff --git a/gcc/testsuite/gcc.dg/cpp/headermap-1.c b/gcc/testsuite/gcc.dg/cpp/headermap-1.c new file mode 100644 index 00000000000..aac0257df63 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/headermap-1.c @@ -0,0 +1,18 @@ +/* APPLE LOCAL file headermaps */ +/* Copyright (C) 2005 Free Software Foundation, Inc. */ + +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* This test is ppc specific, as the headermap binary was generated for ppc. */ +/* { dg-options "-I $srcdir/gcc.dg/cpp/headermap.hmap" } */ + +#define COUNT 1 +#include <A.h> +#include <bA.h> +#include <c.h> +#import <d.h> +#import <d.h> +#import <A.h> + +#if COUNT != 5 + #error COUNT not 5 in headermap-1 +#endif diff --git a/gcc/testsuite/gcc.dg/cpp/headermap-2.c b/gcc/testsuite/gcc.dg/cpp/headermap-2.c new file mode 100644 index 00000000000..68e4690c475 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/headermap-2.c @@ -0,0 +1,16 @@ +/* APPLE LOCAL file headermaps */ +/* Copyright (C) 2005 Free Software Foundation, Inc. */ + +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* This test is ppc specific, as the headermap binary was generated for ppc. */ +/* { dg-options "-I $srcdir/gcc.dg/cpp/headermap.hmap" } */ + +#define COUNT 1 +#include <a.h> /* { dg-warning "mismatched case" } */ +#include <Ba.h> /* { dg-warning "mismatched case" } */ +#include <C.h> /* { dg-warning "mismatched case" } */ +#import <c.h> + +#if COUNT != 4 + #error COUNT not 4 in headermap-d21 +#endif diff --git a/gcc/testsuite/gcc.dg/cpp/headermap.hmap b/gcc/testsuite/gcc.dg/cpp/headermap.hmap Binary files differnew file mode 100644 index 00000000000..f9b70b5cce5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/headermap.hmap diff --git a/gcc/testsuite/gcc.dg/cpp/if-2.c b/gcc/testsuite/gcc.dg/cpp/if-2.c index 8bca251b46b..8237112078d 100644 --- a/gcc/testsuite/gcc.dg/cpp/if-2.c +++ b/gcc/testsuite/gcc.dg/cpp/if-2.c @@ -1,5 +1,7 @@ /* { dg-do preprocess } */ /* { dg-options -pedantic-errors } */ +/* APPLE LOCAL -Wfour-char-constants */ +/* { dg-options "-Wfour-char-constants" { target *-apple-darwin* } } */ #if 'a' != 'a' || '\001' != 1 || '\x12' != 0x12 #error a,1,0x12 /* { dg-bogus "#error" "basic charconst recognition" } */ diff --git a/gcc/testsuite/gcc.dg/cpp/inc/A.h b/gcc/testsuite/gcc.dg/cpp/inc/A.h new file mode 100644 index 00000000000..a1a6ef851c3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/inc/A.h @@ -0,0 +1,6 @@ +/* APPLE LOCAL file headermaps */ +#if COUNT != 1 + #error COUNT not 1 +#endif +#undef COUNT +#define COUNT 2 diff --git a/gcc/testsuite/gcc.dg/cpp/inc/bA.h b/gcc/testsuite/gcc.dg/cpp/inc/bA.h new file mode 100644 index 00000000000..4ba328017bf --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/inc/bA.h @@ -0,0 +1,6 @@ +/* APPLE LOCAL file headermaps */ +#if COUNT != 2 + #error COUNT not 2 in bA +#endif +#undef COUNT +#define COUNT 3 diff --git a/gcc/testsuite/gcc.dg/cpp/inc/c.h b/gcc/testsuite/gcc.dg/cpp/inc/c.h new file mode 100644 index 00000000000..48a738aa7cd --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/inc/c.h @@ -0,0 +1,6 @@ +/* APPLE LOCAL file headermaps */ +#if COUNT != 3 + #error COUNT not 3 in c +#endif +#undef COUNT +#define COUNT 4 diff --git a/gcc/testsuite/gcc.dg/cpp/inc/d/d.h b/gcc/testsuite/gcc.dg/cpp/inc/d/d.h new file mode 100644 index 00000000000..29173816d0a --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/inc/d/d.h @@ -0,0 +1,7 @@ +/* APPLE LOCAL file headermaps */ +#if COUNT != 4 + #error COUNT not 4 in d +#endif +#undef COUNT +#define COUNT 5 + diff --git a/gcc/testsuite/gcc.dg/cpp/include2.c b/gcc/testsuite/gcc.dg/cpp/include2.c index 60edfccb0cd..f4f6ab41f9d 100644 --- a/gcc/testsuite/gcc.dg/cpp/include2.c +++ b/gcc/testsuite/gcc.dg/cpp/include2.c @@ -1,10 +1,10 @@ /* Copyright (C) 2000 Free Software Foundation, Inc. */ /* { dg-do preprocess } */ - +/* APPLE LOCAL begin -Wextra-tokens */ /* Tests that #include does not allow the terminating '>' or '"' to be escaped, as per the standard. */ - +/* { dg-options "-Wextra-tokens" } */ /* Source: Neil Booth, 4 Nov 2000. */ #include <silly\>> /* { dg-warning "extra tokens" "" } */ @@ -13,4 +13,4 @@ /* These error is No such file or directory, just once. However, this message is locale-dependent, so don't test for it. */ /* { dg-error "silly" "" { target *-*-* } 10 } */ - +/* APPLE LOCAL end */ diff --git a/gcc/testsuite/gcc.dg/cpp/mac-eol-at-eof.c b/gcc/testsuite/gcc.dg/cpp/mac-eol-at-eof.c new file mode 100644 index 00000000000..e3dca859b32 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/mac-eol-at-eof.c @@ -0,0 +1 @@ +/* APPLE LOCAL file mainline 2005-03-04 */
/* Test no newline at eof warning when Mac line ending is used*/
/* { dg-do compile } */
int main() { return 0; }
\ No newline at end of file diff --git a/gcc/testsuite/gcc.dg/cpp/macspace1.c b/gcc/testsuite/gcc.dg/cpp/macspace1.c new file mode 100644 index 00000000000..ddd62c743b9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/macspace1.c @@ -0,0 +1,61 @@ +/* PR preprocessor/19475 */ +/* { dg-do preprocess } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors -fno-show-column" } */ + +#define a! /* { dg-warning "missing whitespace" } */ +#define b" /* { dg-warning "missing whitespace" } */ +#define c# /* { dg-warning "missing whitespace" } */ +#define d% /* { dg-warning "missing whitespace" } */ +#define e& /* { dg-warning "missing whitespace" } */ +#define f' /* { dg-warning "missing whitespace" } */ +#define g) /* { dg-warning "missing whitespace" } */ +#define h* /* { dg-warning "missing whitespace" } */ +#define i+ /* { dg-warning "missing whitespace" } */ +#define j, /* { dg-warning "missing whitespace" } */ +#define k- /* { dg-warning "missing whitespace" } */ +#define l. /* { dg-warning "missing whitespace" } */ +#define m/ /* { dg-warning "missing whitespace" } */ +#define n: /* { dg-warning "missing whitespace" } */ +#define o; /* { dg-warning "missing whitespace" } */ +#define p< /* { dg-warning "missing whitespace" } */ +#define q= /* { dg-warning "missing whitespace" } */ +#define r> /* { dg-warning "missing whitespace" } */ +#define s? /* { dg-warning "missing whitespace" } */ +#define t[ /* { dg-warning "missing whitespace" } */ +#define u] /* { dg-warning "missing whitespace" } */ +#define v^ /* { dg-warning "missing whitespace" } */ +#define w{ /* { dg-warning "missing whitespace" } */ +#define x| /* { dg-warning "missing whitespace" } */ +#define y} /* { dg-warning "missing whitespace" } */ +#define z~ /* { dg-warning "missing whitespace" } */ +#define A>> /* { dg-warning "missing whitespace" } */ +#define B<< /* { dg-warning "missing whitespace" } */ +#define E&& /* { dg-warning "missing whitespace" } */ +#define F|| /* { dg-warning "missing whitespace" } */ +#define G== /* { dg-warning "missing whitespace" } */ +#define H!= /* { dg-warning "missing whitespace" } */ +#define I>= /* { dg-warning "missing whitespace" } */ +#define J<= /* { dg-warning "missing whitespace" } */ +#define K+= /* { dg-warning "missing whitespace" } */ +#define L-= /* { dg-warning "missing whitespace" } */ +#define M*= /* { dg-warning "missing whitespace" } */ +#define N/= /* { dg-warning "missing whitespace" } */ +#define O%= /* { dg-warning "missing whitespace" } */ +#define P&= /* { dg-warning "missing whitespace" } */ +#define Q|= /* { dg-warning "missing whitespace" } */ +#define R^= /* { dg-warning "missing whitespace" } */ +#define S>>= /* { dg-warning "missing whitespace" } */ +#define T<<= /* { dg-warning "missing whitespace" } */ +#define W... /* { dg-warning "missing whitespace" } */ +#define X++ /* { dg-warning "missing whitespace" } */ +#define Y-- /* { dg-warning "missing whitespace" } */ +#define Z-> /* { dg-warning "missing whitespace" } */ +#define aa:: /* { dg-warning "missing whitespace" } */ +#define ab->* /* { dg-warning "missing whitespace" } */ +#define ac.* /* { dg-warning "missing whitespace" } */ +#define ad\x /* { dg-warning "missing whitespace" } */ +#define ae\\x /* { dg-warning "missing whitespace" } */ +#define af'1' /* { dg-warning "missing whitespace" } */ +#define ag"abc" /* { dg-warning "missing whitespace" } */ + +int dummy; diff --git a/gcc/testsuite/gcc.dg/cpp/macspace2.c b/gcc/testsuite/gcc.dg/cpp/macspace2.c new file mode 100644 index 00000000000..21576fa22fa --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/macspace2.c @@ -0,0 +1,61 @@ +/* PR preprocessor/19475 */ +/* { dg-do preprocess } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors -fno-show-column" } */ + +#define a! /* { dg-error "requires whitespace" } */ +#define b" /* { dg-error "requires whitespace" } */ +#define c# /* { dg-error "requires whitespace" } */ +#define d% /* { dg-error "requires whitespace" } */ +#define e& /* { dg-error "requires whitespace" } */ +#define f' /* { dg-error "requires whitespace" } */ +#define g) /* { dg-error "requires whitespace" } */ +#define h* /* { dg-error "requires whitespace" } */ +#define i+ /* { dg-error "requires whitespace" } */ +#define j, /* { dg-error "requires whitespace" } */ +#define k- /* { dg-error "requires whitespace" } */ +#define l. /* { dg-error "requires whitespace" } */ +#define m/ /* { dg-error "requires whitespace" } */ +#define n: /* { dg-error "requires whitespace" } */ +#define o; /* { dg-error "requires whitespace" } */ +#define p< /* { dg-error "requires whitespace" } */ +#define q= /* { dg-error "requires whitespace" } */ +#define r> /* { dg-error "requires whitespace" } */ +#define s? /* { dg-error "requires whitespace" } */ +#define t[ /* { dg-error "requires whitespace" } */ +#define u] /* { dg-error "requires whitespace" } */ +#define v^ /* { dg-error "requires whitespace" } */ +#define w{ /* { dg-error "requires whitespace" } */ +#define x| /* { dg-error "requires whitespace" } */ +#define y} /* { dg-error "requires whitespace" } */ +#define z~ /* { dg-error "requires whitespace" } */ +#define A>> /* { dg-error "requires whitespace" } */ +#define B<< /* { dg-error "requires whitespace" } */ +#define E&& /* { dg-error "requires whitespace" } */ +#define F|| /* { dg-error "requires whitespace" } */ +#define G== /* { dg-error "requires whitespace" } */ +#define H!= /* { dg-error "requires whitespace" } */ +#define I>= /* { dg-error "requires whitespace" } */ +#define J<= /* { dg-error "requires whitespace" } */ +#define K+= /* { dg-error "requires whitespace" } */ +#define L-= /* { dg-error "requires whitespace" } */ +#define M*= /* { dg-error "requires whitespace" } */ +#define N/= /* { dg-error "requires whitespace" } */ +#define O%= /* { dg-error "requires whitespace" } */ +#define P&= /* { dg-error "requires whitespace" } */ +#define Q|= /* { dg-error "requires whitespace" } */ +#define R^= /* { dg-error "requires whitespace" } */ +#define S>>= /* { dg-error "requires whitespace" } */ +#define T<<= /* { dg-error "requires whitespace" } */ +#define W... /* { dg-error "requires whitespace" } */ +#define X++ /* { dg-error "requires whitespace" } */ +#define Y-- /* { dg-error "requires whitespace" } */ +#define Z-> /* { dg-error "requires whitespace" } */ +#define aa:: /* { dg-error "requires whitespace" } */ +#define ab->* /* { dg-error "requires whitespace" } */ +#define ac.* /* { dg-error "requires whitespace" } */ +#define ad\x /* { dg-error "requires whitespace" } */ +#define ae\\x /* { dg-error "requires whitespace" } */ +#define af'1' /* { dg-error "requires whitespace" } */ +#define ag"abc" /* { dg-error "requires whitespace" } */ + +int dummy; diff --git a/gcc/testsuite/gcc.dg/cpp/normalize-1.c b/gcc/testsuite/gcc.dg/cpp/normalize-1.c new file mode 100644 index 00000000000..967b29c2a66 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/normalize-1.c @@ -0,0 +1,36 @@ +/* APPLE LOCAL begin mainline UCNs 2005-04-17 3892809 */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c99" } */ + +\u00AA +\u00B7 +\u0F43 /* { dg-warning "not in NFC" } */ +a\u05B8\u05B9\u05B9\u05BBb + a\u05BB\u05B9\u05B8\u05B9b /* { dg-warning "not in NFC" } */ +\u09CB +\u09C7\u09BE /* { dg-warning "not in NFC" } */ +\u0B4B +\u0B47\u0B3E /* { dg-warning "not in NFC" } */ +\u0BCA +\u0BC6\u0BBE /* { dg-warning "not in NFC" } */ +\u0BCB +\u0BC7\u0BBE /* { dg-warning "not in NFC" } */ +\u0CCA +\u0CC6\u0CC2 /* { dg-warning "not in NFC" } */ +\u0D4A +\u0D46\u0D3E /* { dg-warning "not in NFC" } */ +\u0D4B +\u0D47\u0D3E /* { dg-warning "not in NFC" } */ + +K +\u212A /* { dg-warning "not in NFC" } */ + +\u03AC +\u1F71 /* { dg-warning "not in NFC" } */ + +\uAC00 +\u1100\u1161 /* { dg-warning "not in NFC" } */ +\uAC01 +\u1100\u1161\u11A8 /* { dg-warning "not in NFC" } */ +\uAC00\u11A8 /* { dg-warning "not in NFC" } */ +/* APPLE LOCAL end mainline UCNs 2005-04-17 3892809 */ diff --git a/gcc/testsuite/gcc.dg/cpp/normalize-2.c b/gcc/testsuite/gcc.dg/cpp/normalize-2.c new file mode 100644 index 00000000000..eb61fa607ae --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/normalize-2.c @@ -0,0 +1,36 @@ +/* APPLE LOCAL begin mainline UCNs 2005-04-17 3892809 */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -Wnormalized=nfkc" } */ + +\u00AA /* { dg-warning "not in NFKC" } */ +\u00B7 +\u0F43 /* { dg-warning "not in NFC" } */ +a\u05B8\u05B9\u05B9\u05BBb + a\u05BB\u05B9\u05B8\u05B9b /* { dg-warning "not in NFC" } */ +\u09CB +\u09C7\u09BE /* { dg-warning "not in NFC" } */ +\u0B4B +\u0B47\u0B3E /* { dg-warning "not in NFC" } */ +\u0BCA +\u0BC6\u0BBE /* { dg-warning "not in NFC" } */ +\u0BCB +\u0BC7\u0BBE /* { dg-warning "not in NFC" } */ +\u0CCA +\u0CC6\u0CC2 /* { dg-warning "not in NFC" } */ +\u0D4A +\u0D46\u0D3E /* { dg-warning "not in NFC" } */ +\u0D4B +\u0D47\u0D3E /* { dg-warning "not in NFC" } */ + +K +\u212A /* { dg-warning "not in NFC" } */ + +\u03AC +\u1F71 /* { dg-warning "not in NFC" } */ + +\uAC00 +\u1100\u1161 /* { dg-warning "not in NFC" } */ +\uAC01 +\u1100\u1161\u11A8 /* { dg-warning "not in NFC" } */ +\uAC00\u11A8 /* { dg-warning "not in NFC" } */ +/* APPLE LOCAL end mainline UCNs 2005-04-17 3892809 */ diff --git a/gcc/testsuite/gcc.dg/cpp/normalize-3.c b/gcc/testsuite/gcc.dg/cpp/normalize-3.c new file mode 100644 index 00000000000..6205a68a545 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/normalize-3.c @@ -0,0 +1,36 @@ +/* APPLE LOCAL begin mainline UCNs 2005-04-17 3892809 */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -Wnormalized=id" } */ + +\u00AA +\u00B7 +\u0F43 /* { dg-warning "not in NFC" } */ +a\u05B8\u05B9\u05B9\u05BBb + a\u05BB\u05B9\u05B8\u05B9b /* { dg-warning "not in NFC" } */ +\u09CB +\u09C7\u09BE /* { dg-warning "not in NFC" } */ +\u0B4B +\u0B47\u0B3E /* { dg-warning "not in NFC" } */ +\u0BCA +\u0BC6\u0BBE /* { dg-warning "not in NFC" } */ +\u0BCB +\u0BC7\u0BBE /* { dg-warning "not in NFC" } */ +\u0CCA +\u0CC6\u0CC2 /* { dg-warning "not in NFC" } */ +\u0D4A +\u0D46\u0D3E /* { dg-warning "not in NFC" } */ +\u0D4B +\u0D47\u0D3E /* { dg-warning "not in NFC" } */ + +K +\u212A + +\u03AC +\u1F71 /* { dg-warning "not in NFC" } */ + +\uAC00 +\u1100\u1161 +\uAC01 +\u1100\u1161\u11A8 +\uAC00\u11A8 +/* APPLE LOCAL end mainline UCNs 2005-04-17 3892809 */ diff --git a/gcc/testsuite/gcc.dg/cpp/normalize-4.c b/gcc/testsuite/gcc.dg/cpp/normalize-4.c new file mode 100644 index 00000000000..c05df47d38d --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/normalize-4.c @@ -0,0 +1,36 @@ +/* APPLE LOCAL begin mainline UCNs 2005-04-17 3892809 */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -Wnormalized=none" } */ + +\u00AA +\u00B7 +\u0F43 +a\u05B8\u05B9\u05B9\u05BBb + a\u05BB\u05B9\u05B8\u05B9b +\u09CB +\u09C7\u09BE +\u0B4B +\u0B47\u0B3E +\u0BCA +\u0BC6\u0BBE +\u0BCB +\u0BC7\u0BBE +\u0CCA +\u0CC6\u0CC2 +\u0D4A +\u0D46\u0D3E +\u0D4B +\u0D47\u0D3E + +K +\u212A + +\u03AC +\u1F71 + +\uAC00 +\u1100\u1161 +\uAC01 +\u1100\u1161\u11A8 +\uAC00\u11A8 +/* APPLE LOCAL end mainline UCNs 2005-04-17 3892809 */ diff --git a/gcc/testsuite/gcc.dg/cpp/skipping2.c b/gcc/testsuite/gcc.dg/cpp/skipping2.c index 3b0d0f32c8e..61428c2b989 100644 --- a/gcc/testsuite/gcc.dg/cpp/skipping2.c +++ b/gcc/testsuite/gcc.dg/cpp/skipping2.c @@ -1,6 +1,8 @@ /* Copyright (C) 2001 Free Software Foundation, Inc. */ /* { dg-do preprocess } */ +/* APPLE LOCAL -Wextra-tokens */ +/* { dg-options "-Wextra-tokens" } */ /* Tests that excess tokens in skipped conditional blocks don't warn. */ diff --git a/gcc/testsuite/gcc.dg/cpp/tr-warn6.c b/gcc/testsuite/gcc.dg/cpp/tr-warn6.c index 5c94e4ca14a..e9aa851d041 100644 --- a/gcc/testsuite/gcc.dg/cpp/tr-warn6.c +++ b/gcc/testsuite/gcc.dg/cpp/tr-warn6.c @@ -13,7 +13,7 @@ #define foo7(AA, hello, world, EEE) sdf "A B hello C,world,DhelloE F" fds EEE /* { dg-warning "macro argument \"hello\" would be stringified" "traditional stringification" } */ /* Catch the second warning from the above line. */ -/* { dg-warning "macro argument \"world\" would be stringified" "traditional stringification" { target *-*-* } 13 } */ +/* { dg-warning "macro argument \"world\" would be stringified" "traditional stringification second warning" { target *-*-* } 13 } */ # 19 "sys-header.h" 3 /* We are in system headers now, no -Wtraditional warnings should issue. */ diff --git a/gcc/testsuite/gcc.dg/cpp/trad/comment-3.c b/gcc/testsuite/gcc.dg/cpp/trad/comment-3.c index e2710ad5629..4694b1a922a 100644 --- a/gcc/testsuite/gcc.dg/cpp/trad/comment-3.c +++ b/gcc/testsuite/gcc.dg/cpp/trad/comment-3.c @@ -1,6 +1,8 @@ /* Test we don't accept C++ comments. */ /* { dg-do preprocess } */ +/* APPLE LOCAL -Wextra-tokens 2001-08-01 --sts */ +/* { dg-options "-traditional-cpp -Wextra-tokens" } */ #if 0 #endif // /* { dg-warning "extra tokens" } */ diff --git a/gcc/testsuite/gcc.dg/cpp/ucnid-1.c b/gcc/testsuite/gcc.dg/cpp/ucnid-1.c new file mode 100644 index 00000000000..5f19eed903f --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/ucnid-1.c @@ -0,0 +1,28 @@ +/* APPLE LOCAL begin mainline UCNs 2005-04-17 3892809 */ +/* { dg-do run } */ +/* { dg-options "-std=c99" } */ +void abort (void); + +#define \u00C0 1 +#define \u00C1 2 +#define \U000000C2 3 +#define wh\u00ff 4 +#define a\u00c4b\u0441\U000003b4e 5 + +int main (void) +{ + + if (\u00C0 != 1) + abort (); + if (\u00c1 != 2) + abort (); + if (\u00C2 != 3) + abort (); + if (wh\u00ff != 4) + abort (); + if (a\u00c4b\u0441\U000003b4e != 5) + abort (); + + return 0; +} +/* APPLE LOCAL end mainline UCNs 2005-04-17 3892809 */ diff --git a/gcc/testsuite/gcc.dg/cpp/ucnid-2.c b/gcc/testsuite/gcc.dg/cpp/ucnid-2.c new file mode 100644 index 00000000000..02ffdaf32ee --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/ucnid-2.c @@ -0,0 +1,18 @@ +/* APPLE LOCAL begin mainline UCNs 2005-04-17 3892809 */ +/* { dg-do run } */ +/* { dg-options "-std=c99" } */ +#include <stdlib.h> +#include <string.h> + +#define str(t) #t + +int main (void) +{ + const char s[] = str (\u30b2); + + if (strcmp (s, "\u30b2") != 0) + abort (); + + return 0; +} +/* APPLE LOCAL end mainline UCNs 2005-04-17 3892809 */ diff --git a/gcc/testsuite/gcc.dg/cpp/ucnid-3.c b/gcc/testsuite/gcc.dg/cpp/ucnid-3.c new file mode 100644 index 00000000000..e04f092a616 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/ucnid-3.c @@ -0,0 +1,9 @@ +/* APPLE LOCAL begin mainline UCNs 2005-04-17 3892809 */ +/* { dg-do compile } */ +/* { dg-options "-std=c99" } */ + +#define paste(x, y) x ## y + +int paste(\u00aa, \u0531) = 3; + +/* APPLE LOCAL end mainline UCNs 2005-04-17 3892809 */ diff --git a/gcc/testsuite/gcc.dg/cpp/ucnid-4.c b/gcc/testsuite/gcc.dg/cpp/ucnid-4.c new file mode 100644 index 00000000000..395c0d4e311 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/ucnid-4.c @@ -0,0 +1,19 @@ +/* APPLE LOCAL begin mainline UCNs 2005-04-17 3892809 */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c99" } */ + +\u00AA +\u00AB /* { dg-error "not valid in an identifier" } */ +\u00B6 /* { dg-error "not valid in an identifier" } */ +\u00BA +\u00C0 +\u00D6 +\u0384 + +\u0669 /* { dg-error "not valid at the start of an identifier" } */ +A\u0669 +0\u00BA +0\u0669 +\u0E59 /* { dg-error "not valid at the start of an identifier" } */ +A\u0E59 +/* APPLE LOCAL end mainline UCNs 2005-04-17 3892809 */ diff --git a/gcc/testsuite/gcc.dg/cpp/ucnid-5.c b/gcc/testsuite/gcc.dg/cpp/ucnid-5.c new file mode 100644 index 00000000000..3ede8f728d1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/ucnid-5.c @@ -0,0 +1,19 @@ +/* APPLE LOCAL begin mainline UCNs 2005-04-17 3892809 */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -pedantic" } */ + +\u00AA +\u00AB /* { dg-error "not valid in an identifier" } */ +\u00B6 /* { dg-error "not valid in an identifier" } */ +\u00BA +\u00C0 +\u00D6 +\u0384 /* { dg-error "not valid in an identifier" } */ + +\u0669 /* { dg-error "not valid at the start of an identifier" } */ +A\u0669 +0\u00BA +0\u0669 +\u0E59 /* { dg-error "not valid at the start of an identifier" } */ +A\u0E59 +/* APPLE LOCAL end mainline UCNs 2005-04-17 3892809 */ diff --git a/gcc/testsuite/gcc.dg/cpp/ucnid-6.c b/gcc/testsuite/gcc.dg/cpp/ucnid-6.c new file mode 100644 index 00000000000..1bc491bfa32 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/ucnid-6.c @@ -0,0 +1,7 @@ +/* APPLE LOCAL begin mainline UCNs 2005-04-17 3892809 */ +/* { dg-do compile } */ +/* { dg-options "-std=c89" } */ +#define a b( +#define b(x) q +int a\u00aa); +/* APPLE LOCAL end mainline UCNs 2005-04-17 3892809 */ diff --git a/gcc/testsuite/gcc.dg/cpp/ucnid-7.c b/gcc/testsuite/gcc.dg/cpp/ucnid-7.c new file mode 100644 index 00000000000..57476d5cb68 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/ucnid-7.c @@ -0,0 +1,7 @@ +/* APPLE LOCAL begin mainline UCNs 2005-04-17 3892809 */ +/* { dg-do compile } */ +/* { dg-options "-std=c99" } */ +#define a b( +#define b(x) q +int a\U0000000z ); +/* APPLE LOCAL end mainline UCNs 2005-04-17 3892809 */ diff --git a/gcc/testsuite/gcc.dg/darwin-altivec-vsplt-1.c b/gcc/testsuite/gcc.dg/darwin-altivec-vsplt-1.c new file mode 100644 index 00000000000..f35b52fbc46 --- /dev/null +++ b/gcc/testsuite/gcc.dg/darwin-altivec-vsplt-1.c @@ -0,0 +1,31 @@ +/* APPLE LOCAL file 4119059 */ +/* { dg-do assemble { target powerpc*-*-darwin* } } */ +/* { dg-options "-faltivec -O3" } */ +typedef unsigned char UInt8; +typedef signed char SInt8; +typedef unsigned short UInt16; +typedef signed short SInt16; +typedef signed long SInt32; +typedef unsigned long UInt32; +typedef __attribute__((altivec(vector__))) signed char VSInt8; +typedef __attribute__((altivec(vector__))) unsigned char VUInt8; +typedef __attribute__((altivec(vector__))) signed short VSInt16; + +typedef __attribute__((altivec(vector__))) signed int VSInt32; + + +extern unsigned char *dPtr; +extern VSInt8 xyz; +unsigned long ix; + +void foo () +{ + VSInt16 Y; + const VSInt32 vC1 = (VSInt32) (128, 128, 0, 0); + const VUInt8 vC2 = vec_splat((const VUInt8) vC1,3); + + xyz = vec_sub(xyz, vC2); + Y = vec_unpackl (xyz); + vec_st ((VUInt8) Y, ix, dPtr); +} + diff --git a/gcc/testsuite/gcc.dg/darwin64-abi.c b/gcc/testsuite/gcc.dg/darwin64-abi.c new file mode 100644 index 00000000000..a98e8e1d7de --- /dev/null +++ b/gcc/testsuite/gcc.dg/darwin64-abi.c @@ -0,0 +1,627 @@ +/* APPLE LOCAL file 64-bit ABI testing */ +/* { dg-do run { target "powerpc*-*-darwin*" } } */ +/* { dg-options "-m64 -maltivec" } */ + +/* Set this if 8-byte structs are being passed as integers. */ +/* #define STRUCT8INT */ + +#include <stdarg.h> +#include <stdio.h> +#include <complex.h> +#include <altivec.h> + +extern void abort (void); + +struct s3c { char ch[3]; }; +struct ssc { short sh; char ch; }; +struct sif { int i; float f; }; +struct sfi { float f; int i; }; +struct sfii { float f; int i; int j; }; +struct sfil { float f; int i; long l; }; +struct sfif { float f; int i; float g; }; +struct sfill { float f; int i; long l, m; }; +struct sfl { float f; long l; }; +struct sfldl { float f; long l1; double d; long l2; }; +struct sfpp { float f; char *p1; char *p2; }; + + +struct sff { float f1, f2; }; +struct sfff { float f1, f2, f3; }; +struct sffff { float f1, f2, f3, f4; }; + +struct sfD { float f; long double D; }; + +struct sidi { int i1; double d; int i2; }; + +struct sdd { double d1, d2; }; +struct sddd { double d1, d2, d3; }; +struct sdddd { double d1, d2, d3, d4; }; +struct s3d { double d[3]; }; + +struct vr { union { int ielts[4]; float felts[4]; } elts; }; + +typedef struct +{ + unsigned long gprs[32]; + double fprs[32]; + struct vr vrs[32]; + unsigned char stack[1000]; +} reg_parms_t; + +reg_parms_t gparms; + +#define TESTFN(RET,NAME,PARAMS) \ +RET NAME PARAMS; \ +RET dummy_ ## NAME PARAMS \ +{ \ + asm("b end_" #NAME "\n_" # NAME ":\n\t" SAVE_STATE "b _dummy_" # NAME "\n\tend_" #NAME ":\n\n" ); \ +} + +#define SAVE_STATE \ +SAVE_GPR(0) \ +SAVE_GPR(1) \ +SAVE_GPR(3) \ +SAVE_GPR(4) \ +SAVE_GPR(5) \ +SAVE_GPR(6) \ +SAVE_GPR(7) \ +SAVE_GPR(8) \ +SAVE_GPR(9) \ +SAVE_GPR(10) \ +SAVE_FPR(0) \ +SAVE_FPR(1) \ +SAVE_FPR(2) \ +SAVE_FPR(3) \ +SAVE_FPR(4) \ +SAVE_FPR(5) \ +SAVE_FPR(6) \ +SAVE_FPR(7) \ +SAVE_FPR(8) \ +SAVE_FPR(9) \ +SAVE_FPR(10) \ +SAVE_FPR(12) \ +SAVE_FPR(13) \ +SAVE_VR(0) \ +SAVE_VR(1) \ +SAVE_VR(2) \ +SAVE_VR(3) \ +SAVE_VR(4) \ +SAVE_STACK(112) \ +SAVE_STACK(120) \ +SAVE_STACK(128) \ +SAVE_STACK(136) \ +SAVE_STACK(144) \ + + +#ifdef __LP64__ +#define SAVE_GPR(N) "std r" #N "," #N "*8(r25)\n\t" +#define SAVE_FPR(N) "stfd f" #N "," #N "*8+256(r25)\n\t" +#define SAVE_VR(N) "li r26," #N "*16+512\n\tstvx v" #N ",r25,r26\n\t" +#define SAVE_STACK(N) "ld r26," #N "(r1)\n\tstd r26," #N "+1024(r25)\n\t" +#else +#define SAVE_GPR(N) "stw r" #N "," #N "*4(r25)\n\t" +#define SAVE_FPR(N) "stfd f" #N "," #N "*8+128(r25)\n\t" +#define SAVE_VR(N) +#define SAVE_STACK(N) +#endif + +TESTFN(void, fffi, (float x, float y, int z)) + +#define clearall \ +asm volatile ( \ +"\n\t" \ +"li r3,0x333\n\t" \ +"li r4,0x444 \n\t" \ +"li r5,0x555\n\t" \ +"li r6,0x666\n\t" \ +"li r7,0x777\n\t" \ +"li r8,0x888\n\t" \ +"li r9,0x999\n\t" \ +"li r10,0xaaa\n\t" \ +"fsub f0,f0,f0\n\t" \ +"fsub f1,f1,f1\n\t" \ +"fsub f2,f2,f2\n\t" \ +"fsub f3,f3,f3\n\t" \ +"fsub f4,f4,f4\n\t" \ +"fsub f5,f5,f5\n\t" \ +"fsub f6,f6,f6\n\t" \ +"fsub f7,f7,f7\n\t" \ +"vsubuwm v0,v0,v0\n\t" \ +"vsubuwm v1,v1,v1\n\t" \ +"vsubuwm v2,v2,v2\n\t" \ +"vsubuwm v3,v3,v3\n\t" \ +"vsubuwm v4,v4,v4\n\t" \ +: : : "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \ + "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ + "v0", "v1", "v2", "v3", "v4" ); + +TESTFN(void, fii, (int a, int b)) +TESTFN(void, fid, (int i, double d)) +TESTFN(void, fc, (complex float z)) +TESTFN(void, fffff, (float f1, float f2, float f3, float f4)) +TESTFN(void, fdddd, (double d1, double d2, double d3, double d4)) +TESTFN(void, f_s3c_ssc, (struct s3c s1, struct ssc s2)) +TESTFN(void, f_sff, (struct sff s)) +TESTFN(void, f_sfff, (struct sfff s)) +TESTFN(void, f_sffff, (struct sffff s)) +TESTFN(void, f_sdd, (struct sdd s)) +TESTFN(void, f_sddd, (struct sddd s)) +TESTFN(void, f_sdddd, (struct sdddd s)) +TESTFN(void, f_s3d, (struct s3d s)) +TESTFN(void, f_sif, (int i, struct sif s)) +TESTFN(void, fi_sif, (int i, struct sif s)) +TESTFN(void, fi_sif_i, (int i, struct sif s, int j)) +TESTFN(void, f_sfi, (int i, struct sfi s)) +TESTFN(void, fi_sfi, (int i, struct sfi s)) +TESTFN(void, fi_sfi_if, (int i, struct sfi s, int j, float f)) +TESTFN(void, fi_sfill, (int i, struct sfill s)) +TESTFN(void, fi_sfill_i, (int i, struct sfill s, int j)) +TESTFN(void, f_sfl, (struct sfl s)) +TESTFN(void, f_sfl_sfl_sfl_sfl_sfl, (struct sfl s1, struct sfl s2, struct sfl s3, struct sfl s4, struct sfl s5)) +TESTFN(void, fi_sff, (int i, struct sff s)) +TESTFN(void, f_sfpp_p, (struct sfpp s, char *p)) +TESTFN(void, f_sfldl, (struct sfldl s)) +TESTFN(void, fi_sff_i, (int i, struct sff s, int j)) +TESTFN(void, f_sfD_sfD_sfD_sfD_sfD, (struct sfD s1, struct sfD s2, struct sfD s3, struct sfD s4, struct sfD s5)) +TESTFN(void, fi_sidi, (int i, struct sidi s)) +TESTFN(void, fifvf_sfi_dots, (int i, float f, vector float vf, struct sfi s, ...)) +TESTFN(void, fifvf_sfii_dots, (int i, float f, vector float vf, struct sfii s, ...)) + +int numerrs; + +#ifndef SKIP +check_gpr (int line, int reg, long expected) +{ + if (gparms.gprs[reg] != expected) + { + printf("%d: r%d is 0x%lx, expected 0x%lx\n", + line, reg, gparms.gprs[reg], expected); + ++numerrs; + } +} + +check_gpr_double (int line, int reg, double expected) +{ + double tmp = *((double *) &(gparms.gprs[reg])); + if (tmp != expected) + { + printf("%d: r%d is %f (0x%llx), expected %f (0x%llx)\n", + line, reg, + tmp, *((long long *) &tmp), + expected, *((long long *) &expected)); + ++numerrs; + } +} + +check_gpr_float_pair (int line, int reg, float exp1, float exp2) +{ + float tmp1 = *((float *) &(gparms.gprs[reg])); + float tmp2 = *(((float *) &(gparms.gprs[reg])) + 1); + + if (tmp1 != exp1 || tmp2 != exp2) + { + printf("%d: r%d is %f / %f (0x%llx), expected %f (0x%x) / %f (0x%x)\n", + line, reg, + tmp1, tmp2, *((long long *) &(gparms.gprs[reg])), + exp1, *((int *) &exp1), + exp2, *((int *) &exp2)); + ++numerrs; + } +} + +check_fpr (int line, int reg, double expected) +{ + if (gparms.fprs[reg] != expected) + { + printf("%d: f%d is %f (0x%llx), expected %f (0x%llx)\n", + line, reg, + gparms.fprs[reg], *((long long *) &(gparms.fprs[reg])), + expected, *((long long *) &expected)); + ++numerrs; + } +} + +check_vr_int (int reg, int n1, int n2, int n3, int n4) +{ + if (gparms.vrs[reg].elts.ielts[0] != n1 + || gparms.vrs[reg].elts.ielts[1] != n2 + || gparms.vrs[reg].elts.ielts[2] != n3 + || gparms.vrs[reg].elts.ielts[3] != n4) + { + printf("v%d is (%d,%d,%d,%d) (0x%x,0x%x,0x%x,0x%x),\n" + " expected (%d,%d,%d,%d) (0x%x,0x%x,0x%x,0x%x)\n", + reg, + gparms.vrs[reg].elts.ielts[0], + gparms.vrs[reg].elts.ielts[1], + gparms.vrs[reg].elts.ielts[2], + gparms.vrs[reg].elts.ielts[3], + gparms.vrs[reg].elts.ielts[0], + gparms.vrs[reg].elts.ielts[1], + gparms.vrs[reg].elts.ielts[2], + gparms.vrs[reg].elts.ielts[3], + n1, n2, n3, n4, + n1, n2, n3, n4 + ); + ++numerrs; + } +} + +check_vr_float (int reg, float f1, float f2, float f3, float f4) +{ + if (gparms.vrs[reg].elts.felts[0] != f1 + || gparms.vrs[reg].elts.felts[1] != f2 + || gparms.vrs[reg].elts.felts[2] != f3 + || gparms.vrs[reg].elts.felts[3] != f4) + { + printf("v%d is (%f,%f,%f,%f) (0x%x,0x%x,0x%x,0x%x),\n" + " expected (%f,%f,%f,%f) (0x%x,0x%x,0x%x,0x%x)\n", + reg, + gparms.vrs[reg].elts.felts[0], + gparms.vrs[reg].elts.felts[1], + gparms.vrs[reg].elts.felts[2], + gparms.vrs[reg].elts.felts[3], + gparms.vrs[reg].elts.ielts[0], + gparms.vrs[reg].elts.ielts[1], + gparms.vrs[reg].elts.ielts[2], + gparms.vrs[reg].elts.ielts[3], + f1, f2, f3, f4, + *((int *) &f1), *((int *) &f2), *((int *) &f3), *((int *) &f4) + ); + ++numerrs; + } +} +#endif + +main() +{ + complex float cpx = 4.45f + I * 4.92f; + struct s3c s3c_loc; + struct ssc ssc_loc; + struct sfi sfi_loc; + struct sfi sfi_loc2 = { 6.3f, 0x1108 }; + struct sfii sfii_loc; + struct sfii sfii_loc2 = { 6.9f, 0x1110 }; + vector float vf_loc = (vector float) { 7.1f, 7.2f, 7.3f, 7.4f }; + vector int vi_loc = (vector int) { 0xabc, 0xdef, 0xfed, 0xcba }; + + asm ("mr r25,%0" : : "b" (&gparms) ); + + clearall; + fii(1, 2); + check_gpr (__LINE__, 3, 1); + check_gpr (__LINE__, 4, 2); + + clearall; + fid(45, 4.5); + check_gpr (__LINE__, 3, 45); + check_fpr (__LINE__, 1, 4.5); + + clearall; + fffi(1.2f, 3.4f, 456); + check_fpr(__LINE__, 1, 1.2f); + + clearall; + fc(cpx); + /* Two floats are packed into r3 */ + check_gpr_float_pair (__LINE__, 3, 4.45f, 4.92f); + + clearall; + fffff (4.1f, 4.2f, 4.3f, 4.4f); + check_fpr (__LINE__, 1, 4.1f); + check_fpr (__LINE__, 4, 4.4f); + + clearall; + fdddd (4.1, 4.2, 4.3, 4.4); + check_fpr (__LINE__, 1, 4.1); + check_fpr (__LINE__, 4, 4.4); + + { + struct sff sff_loc = { 2.1f, 2.2f }; + clearall; + f_sff(sff_loc); +#ifdef STRUCT8INT + check_gpr_float_pair (__LINE__, 3, 2.1f, 2.2f); +#else + check_fpr(__LINE__, 1, 2.1f); + check_fpr(__LINE__, 2, 2.2f); +#endif + clearall; + fi_sff_i(65, sff_loc, 66); + check_gpr(__LINE__, 3, 65); +#ifdef STRUCT8INT + check_gpr_float_pair (__LINE__, 4, 2.1f, 2.2f); +#else + check_fpr(__LINE__, 1, 2.1f); + check_fpr(__LINE__, 2, 2.2f); +#endif + check_gpr(__LINE__, 5, 66); + } + + { + struct sfff sfff_loc = { 3.1f, 3.2f, 3.3f }; + clearall; + f_sfff(sfff_loc); + check_fpr(__LINE__, 1, 3.1f); + check_fpr(__LINE__, 2, 3.2f); + check_fpr(__LINE__, 3, 3.3f); + clearall; + f_sfff(sfff_loc); + check_fpr(__LINE__, 1, 3.1f); + check_fpr(__LINE__, 2, 3.2f); + check_fpr(__LINE__, 3, 3.3f); + } + + { + struct sffff sffff_loc = { 4.1f, 4.2f, 4.3f, 4.4f }; + clearall; + f_sffff(sffff_loc); + check_gpr_float_pair(__LINE__, 3, 4.1f, 4.2f); + check_gpr_float_pair(__LINE__, 4, 4.3f, 4.4f); + } + + { + struct sdd sdd_loc = { 2.1, 2.2 }; + clearall; + f_sdd(sdd_loc); + /* 16-byte struct is passed in two GPRs. */ + check_gpr_double(__LINE__, 3, 2.1); + check_gpr_double(__LINE__, 4, 2.2); + } + + { + struct sddd sddd_loc = { 3.1, 3.2, 3.3 }; + clearall; + f_sddd(sddd_loc); + check_fpr(__LINE__, 1, 3.1); + check_fpr(__LINE__, 2, 3.2); + check_fpr(__LINE__, 3, 3.3); + } + + { + struct sdddd sdddd_loc = { 4.1, 4.2, 4.3, 4.4 }; + clearall; + f_sdddd(sdddd_loc); + check_fpr(__LINE__, 1, 4.1); + check_fpr(__LINE__, 2, 4.2); + check_fpr(__LINE__, 3, 4.3); + check_fpr(__LINE__, 4, 4.4); + } + + { + struct s3d s3d_loc = { 89.92, 4.89, 90.9 }; + clearall; + f_s3d(s3d_loc); + check_gpr_double (__LINE__, 3, 89.92); + check_gpr_double (__LINE__, 4, 4.89); + check_gpr_double (__LINE__, 5, 90.9); + } + + { + s3c_loc.ch[0] = 'A'; + s3c_loc.ch[1] = 'B'; + s3c_loc.ch[2] = 'C'; + ssc_loc.sh = 0x1234; + ssc_loc.ch = 'D'; + clearall; + f_s3c_ssc(s3c_loc, ssc_loc); + } + + { + struct sif sif_loc_n = { 334, 4.3f }; + long floatcast; + floatcast = *((int *) &(sif_loc_n.f)); + clearall; + fi_sif(29, sif_loc_n); + check_gpr (__LINE__, 3, 29); + check_gpr (__LINE__, 4, 334LL << 32 | floatcast); +#ifdef STRUCT8INT +#else + check_fpr (__LINE__, 1, 4.3f); +#endif + clearall; + fi_sif_i(31, sif_loc_n, 33); + check_gpr (__LINE__, 3, 31); + check_gpr (__LINE__, 4, 334LL << 32 | floatcast); +#ifdef STRUCT8INT +#else + check_fpr (__LINE__, 1, 4.3f); +#endif + check_gpr (__LINE__, 5, 33); + } + + { + struct sfi sfi_loc_n = { 4.145f, 335 }; + clearall; + fi_sfi(29, sfi_loc_n); + check_gpr (__LINE__, 3, 29); +#ifdef STRUCT8INT + check_gpr (__LINE__, 4, 0x4084a3d70000014fLL); +#else + check_fpr (__LINE__, 1, 4.145f); + check_gpr (__LINE__, 4, 335); +#endif + } + + { + struct sfi sfi_loc_n = { 4.145f, 335 }; + clearall; + fi_sfi_if (29, sfi_loc_n, 65, 9.8f); + check_gpr (__LINE__, 3, 29); +#ifdef STRUCT8INT + check_gpr (__LINE__, 4, 0x4084a3d70000014fLL); +#else + check_fpr (__LINE__, 1, 4.145f); + check_gpr (__LINE__, 4, 335); +#endif + check_gpr (__LINE__, 5, 65); + check_gpr (__LINE__, 6, 0x666); +#ifdef STRUCT8INT + check_fpr (__LINE__, 1, 9.8f); +#else + check_fpr (__LINE__, 2, 9.8f); +#endif + check_gpr (__LINE__, 7, 0x777); + } + + { + struct sfill sfill_loc_n = { 4.145f, 335, 10000000000LL, 20000000000LL }; + clearall; + fi_sfill(29, sfill_loc_n); + check_gpr (__LINE__, 3, 29); + check_fpr (__LINE__, 1, 4.145f); + check_gpr (__LINE__, 4, 335); + check_gpr (__LINE__, 5, 10000000000LL); + check_gpr (__LINE__, 6, 20000000000LL); + } + + { + struct sfl sfl_loc_n = { 4.145f, 335 }; + clearall; + f_sfl (sfl_loc_n); + check_gpr_float_pair (__LINE__, 3, 4.145f, 0.0f); + check_gpr (__LINE__, 4, 335); + check_gpr (__LINE__, 5, 0x555); + clearall; + f_sfl_sfl_sfl_sfl_sfl (sfl_loc_n, sfl_loc_n, sfl_loc_n, sfl_loc_n, sfl_loc_n); + check_gpr_float_pair (__LINE__, 3, 4.145f, 0.0f); + check_gpr (__LINE__, 4, 335); + check_gpr (__LINE__, 6, 335); + check_gpr (__LINE__, 8, 335); + check_gpr (__LINE__, 10, 335); + } + + { + struct sfldl sfldl_loc_n = { 4.145f, 335, 3.3, 336 }; + clearall; + f_sfldl (sfldl_loc_n); + check_fpr (__LINE__, 1, 4.145f); + check_gpr (__LINE__, 4, 335); + check_fpr (__LINE__, 2, 3.3); + check_gpr (__LINE__, 6, 336); + } + + { + char *p1 = "abc"; + char *p2 = "def"; + char *p3 = "ghi"; + struct sfpp sfpp_loc_n = { 4.145f, p1, p2 }; + clearall; + f_sfpp_p(sfpp_loc_n, p3); + check_fpr (__LINE__, 1, 4.145f); + check_gpr (__LINE__, 4, (long) p1); + check_gpr (__LINE__, 5, (long) p2); + check_gpr (__LINE__, 6, (long) p3); + } + + { + struct sff sff_loc_n = { 4.145f, 335.3f }; + clearall; + fi_sff(29, sff_loc_n); + check_gpr (__LINE__, 3, 29); +#ifdef STRUCT8INT + check_gpr_float_pair (__LINE__, 4, 4.145f, 335.3f); +#else + check_fpr (__LINE__, 1, 4.145f); + check_fpr (__LINE__, 2, 335.3f); +#endif + } + + { + struct sfD sfD_loc_n = { 4.145f, 335.335 }; + clearall; + f_sfD_sfD_sfD_sfD_sfD (sfD_loc_n, sfD_loc_n, sfD_loc_n, sfD_loc_n, sfD_loc_n); + check_fpr (__LINE__, 1, 4.145f); + check_fpr (__LINE__, 2, 335.335); + check_fpr (__LINE__, 4, 4.145f); + check_fpr (__LINE__, 5, 335.335); + check_fpr (__LINE__, 7, 4.145f); + check_fpr (__LINE__, 10, 4.145f); + check_fpr (__LINE__, 13, 4.145f); + } + + { + struct sidi sidi_loc_n = { 257, 4.14515, 258 }; + clearall; + fi_sidi(16, sidi_loc_n); + check_gpr (__LINE__, 3, 16); + check_fpr (__LINE__, 1, 4.14515); + check_gpr (__LINE__, 4, 257LL << 32); + check_gpr (__LINE__, 5, 0x555); + check_gpr (__LINE__, 6, 258LL << 32); + } + + sfi_loc.f = 5.2f; + sfi_loc.i = 98; + clearall; + fifvf_sfi_dots(41, 4.3f, vf_loc, sfi_loc, 4.63f, vi_loc, sfi_loc2); + asm ("\n"); + check_gpr (__LINE__, 3, 41); + check_fpr (__LINE__, 1, 4.3f); /* float skips r4 */ + check_vr_float(2, 7.1f, 7.2f, 7.3f, 7.4f); /* vector skips r5/r6 */ +#ifdef STRUCT8INT + check_gpr (__LINE__, 7, 0x40a6666600000062); +#else + check_fpr (__LINE__, 2, sfi_loc.f); + check_gpr (__LINE__, 7, sfi_loc.i); +#endif + /* start of varying parameters */ +#ifdef STRUCT8INT + check_fpr (__LINE__, 2, 4.63f); +#else + check_fpr (__LINE__, 3, 4.63f); +#endif + check_gpr_double (__LINE__, 8, 4.63f); + /* vector takes up r9/r10 */ + /* sfi_loc2 on stack */ + + clearall; + sfii_loc.f = 5.2f; + sfii_loc.i = 98; + clearall; + fifvf_sfii_dots(41, 4.3f, vf_loc, sfii_loc, 4.63f, vi_loc, sfii_loc2); + asm ("\n"); + check_gpr (__LINE__, 3, 41); + check_fpr (__LINE__, 1, 4.3f); /* float skips r4 */ + check_vr_float(2, 7.1f, 7.2f, 7.3f, 7.4f); /* vector skips r5/r6 */ + check_fpr (__LINE__, 2, sfii_loc.f); + check_gpr (__LINE__, 7, sfii_loc.i); + check_gpr (__LINE__, 8, sfii_loc.j); + /* start of varying parameters */ + check_fpr (__LINE__, 3, 4.63f); + check_gpr_double (__LINE__, 9, 4.63f); + /* vector takes up r10/stack (?) */ + /* sfii_loc2 on stack */ + + if (numerrs > 0) + abort (); + return 0; +} + +int dumpall() +{ + int i; + + printf("\n"); + for (i = 3; i <= 10; ++i) +#ifdef __LP64__ + printf("r%d=0x%16.16lx ", i, gparms.gprs[i]); +#else + printf("r%d=0x%8.8x ", i, gparms.gprs[i]); +#endif + printf("\n"); + for (i = 1; i <= 13; ++i) + printf("f%d=%8.8f ", i, gparms.fprs[i]); + printf("\n"); + for (i = 0; i <= 4; ++i) + printf("v%d=(%x,%x,%x,%x) ", i, + gparms.vrs[i].elts.ielts[0], gparms.vrs[i].elts.ielts[1], + gparms.vrs[i].elts.ielts[2], gparms.vrs[i].elts.ielts[3]); + printf("\n"); + for (i = 112; i < 152; ++i) + { + if (i > 112 && i % 8 == 0) + printf(" | "); + printf("%02x", gparms.stack[i]); + } + printf("\n"); +} diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro.c new file mode 100644 index 00000000000..45e93737283 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro.c @@ -0,0 +1,13 @@ +/* Test to make sure the mcaro info includes a start file command for the main source */ +/* { dg-do compile */ +/* { dg-options "-g3 -gdwarf-2 -dA -fverbose-asm" } */ +/* { dg-final { scan-assembler "Start new file" } } */ + +#define ADD(x) (M + x) + +int main (void) +{ +#define N 28 +#define M 42 + return ADD(N); +} diff --git a/gcc/testsuite/gcc.dg/deprecated.c b/gcc/testsuite/gcc.dg/deprecated.c index 1e07efe6314..6ca95d42a74 100644 --- a/gcc/testsuite/gcc.dg/deprecated.c +++ b/gcc/testsuite/gcc.dg/deprecated.c @@ -53,10 +53,10 @@ int func1() int (*pf)() = f1; /* { dg-warning "'f1' is deprecated" "" } */ z = w + x + y + g1 + g2 + g3; /* { dg-warning "'x' is deprecated" "" } */ - /* { dg-warning "'y' is deprecated" "" { target *-*-* } 55 } */ - /* { dg-warning "'g2' is deprecated" "" { target *-*-* } 55 } */ - /* { dg-warning "'g3' is deprecated" "" { target *-*-* } 55 } */ - return f1(); /* { dg-warning "'f1' is deprecated" "" } */ + /* { dg-warning "'y' is deprecated" "y" { target *-*-* } 55 } */ + /* { dg-warning "'g2' is deprecated" "g2" { target *-*-* } 55 } */ + /* { dg-warning "'g3' is deprecated" "g3" { target *-*-* } 55 } */ + return f1(); /* { dg-warning "'f1' is deprecated" "f1" } */ } int func2(S1 *p) @@ -71,7 +71,7 @@ int func2(S1 *p) p->u1.field5 = g1 + p->field7; p->u2.field9; /* { dg-warning "'u2' is deprecated" "" } */ return p->u1.field6 + p->field8; /* { dg-warning "'field6' is deprecated" "" } */ - /* { dg-warning "'field8' is deprecated" "" { target *-*-* } 73 } */ + /* { dg-warning "'field8' is deprecated" "field8" { target *-*-* } 73 } */ } struct SS1 { diff --git a/gcc/testsuite/gcc.dg/enum3.c b/gcc/testsuite/gcc.dg/enum3.c new file mode 100644 index 00000000000..ba3c1da15e3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/enum3.c @@ -0,0 +1,11 @@ +/* Test for non-integer enum values. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +enum e { E, F }; +enum e2 { + E1 = (void *)4, /* { dg-error "error: enumerator value for 'E1' is not an integer constant" } */ + E2 = (enum e)F, + E3 = (_Bool)1 +}; diff --git a/gcc/testsuite/gcc.dg/framework-2.c b/gcc/testsuite/gcc.dg/framework-2.c new file mode 100644 index 00000000000..1fad935a903 --- /dev/null +++ b/gcc/testsuite/gcc.dg/framework-2.c @@ -0,0 +1,5 @@ +/* APPLE LOCAL file mainline */ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-F$srcdir/gcc.dg" } */ + +#include <Foundation/Foundation.h> /* { dg-error "error: Foundation/Foundation.h: No such file" } */ diff --git a/gcc/testsuite/gcc.dg/i386-387-7.c b/gcc/testsuite/gcc.dg/i386-387-7.c index 210917ad415..1a40cd719d8 100644 --- a/gcc/testsuite/gcc.dg/i386-387-7.c +++ b/gcc/testsuite/gcc.dg/i386-387-7.c @@ -1,5 +1,6 @@ /* Verify that 387 fsincos instruction is generated. */ /* { dg-do compile { target "i?86-*-*" } } */ +/* { dg-require-effective-target ilp32 } */ /* { dg-options "-O -ffast-math -march=i686" } */ /* { dg-final { scan-assembler "fsincos" } } */ diff --git a/gcc/testsuite/gcc.dg/i386-3dnowA-1.c b/gcc/testsuite/gcc.dg/i386-3dnowA-1.c index 2ae1a04d5cb..b5327b3d9ec 100644 --- a/gcc/testsuite/gcc.dg/i386-3dnowA-1.c +++ b/gcc/testsuite/gcc.dg/i386-3dnowA-1.c @@ -1,4 +1,5 @@ /* { dg-do assemble { target i?86-*-* } } */ +/* { dg-require-effective-target ilp32 } */ /* { dg-options "-O2 -Werror-implicit-function-declaration -m3dnow -march=athlon" } */ /* Test that the intrinsics compile with optimization. All of them are diff --git a/gcc/testsuite/gcc.dg/i386-3dnowA-2.c b/gcc/testsuite/gcc.dg/i386-3dnowA-2.c index d8ed6cb4c4d..ea336af4147 100644 --- a/gcc/testsuite/gcc.dg/i386-3dnowA-2.c +++ b/gcc/testsuite/gcc.dg/i386-3dnowA-2.c @@ -1,4 +1,5 @@ /* { dg-do assemble { target i?86-*-* } } */ +/* { dg-require-effective-target ilp32 } */ /* { dg-options "-O0 -Werror-implicit-function-declaration -m3dnow -march=athlon" } */ /* Test that the intrinsics compile without optimization. All of them are diff --git a/gcc/testsuite/gcc.dg/i386-darwin-fpmath.c b/gcc/testsuite/gcc.dg/i386-darwin-fpmath.c new file mode 100644 index 00000000000..35798d6593a --- /dev/null +++ b/gcc/testsuite/gcc.dg/i386-darwin-fpmath.c @@ -0,0 +1,10 @@ +/* APPLE LOCAL file mainline 2005-04-11 4010614 */ +/* { dg-do compile { target i?86-*-darwin* } } */ +/* { dg-final { scan-assembler "addsd" } } */ +/* Do not add -msse or -msse2 or -mfpmath=sse to the options. GCC is + supposed to use SSE math on Darwin by default, and libm won't work + right if it doesn't. */ +double foo(double x, double y) +{ + return x + y; +} diff --git a/gcc/testsuite/gcc.dg/i386-sse-11.c b/gcc/testsuite/gcc.dg/i386-sse-11.c new file mode 100644 index 00000000000..0a41fb9d327 --- /dev/null +++ b/gcc/testsuite/gcc.dg/i386-sse-11.c @@ -0,0 +1,17 @@ +/* APPLE LOCAL begin radar 4120689 */ +/* { dg-do compile { target i?86-*-* } } */ +/* { dg-options "-O1 -msse2" } */ +void idct_sse2as(void) +{ + int i; + short dst[64] __attribute__((aligned(16))) ; + + __asm__ __volatile__ ("movdqa" " %%" "xmm1" ", %0" : "=m" (*(dst + 0*8)) : ); +} + +int main() +{ + idct_sse2as(); + return 0; +} +/* APPLE LOCAL end radar 4120689 */ diff --git a/gcc/testsuite/gcc.dg/i386-xorps.c b/gcc/testsuite/gcc.dg/i386-xorps.c new file mode 100644 index 00000000000..450488c1fd2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/i386-xorps.c @@ -0,0 +1,33 @@ +/* APPLE LOCAL begin mainline 2005-04-13 */ +/* { dg-do compile { target i?86-*-* } } */ +/* { dg-options "-Os -msse2" } */ + +typedef float __m128 __attribute__ ((vector_size (16))); + +static __inline __m128 +_mm_mul_ps (__m128 __A, __m128 __B) +{ + return __builtin_ia32_mulps (__A, __B); +} + +static __inline __m128 +_mm_sub_ps (__m128 __A, __m128 __B) +{ + return __builtin_ia32_subps (__A, __B); +} + +__m128 POW_FUNC (__m128 x, __m128 y) +{ + __m128 xmm0 = x, xmm1 = y, xmm2; + + xmm0 = __builtin_ia32_xorps (xmm1, xmm1); + + xmm0 = _mm_mul_ps (xmm0, xmm1); + + xmm0 = _mm_sub_ps (xmm0, xmm1); + + xmm0 = _mm_mul_ps (xmm0, xmm1); + + return xmm0; +} +/* APPLE LOCAL end mainline 2005-04-13 */ diff --git a/gcc/testsuite/gcc.dg/init-bad-1.c b/gcc/testsuite/gcc.dg/init-bad-1.c index 7f20b8cbb0a..1fa1bfb2d82 100644 --- a/gcc/testsuite/gcc.dg/init-bad-1.c +++ b/gcc/testsuite/gcc.dg/init-bad-1.c @@ -10,8 +10,8 @@ void h(a) int a = 1; /* { dg-error "error: parameter 'a' is initialized" } */ { struct s x = { 0 }; /* { dg-error "error: variable 'x' has initializer but incomplete type" } */ - /* { dg-warning "excess elements|near init" "" { target *-*-* } 12 } */ - /* { dg-error "storage size" "" { target *-*-* } 12 } */ + /* { dg-warning "excess elements|near init" "excess" { target *-*-* } 12 } */ + /* { dg-error "storage size" "size" { target *-*-* } 12 } */ } char s[1] = "x"; @@ -19,27 +19,27 @@ char s1[1] = { "x" }; char t[1] = "xy"; /* { dg-warning "warning: initializer-string for array of chars is too long" } */ char t1[1] = { "xy" }; /* { dg-warning "warning: initializer-string for array of chars is too long" } */ char u[1] = { "x", "x" }; /* { dg-error "error: excess elements in char array initializer" } */ -/* { dg-error "near init" "" { target *-*-* } 21 } */ +/* { dg-error "near init" "near" { target *-*-* } 21 } */ int i = { }; /* { dg-error "error: empty scalar initializer" } */ -/* { dg-error "near init" "" { target *-*-* } 24 } */ +/* { dg-error "near init" "near" { target *-*-* } 24 } */ int j = { 1 }; int k = { 1, 2 }; /* { dg-warning "warning: excess elements in scalar initializer" } */ -/* { dg-warning "near init" "" { target *-*-* } 29 } */ +/* { dg-warning "near init" "near" { target *-*-* } 29 } */ int a1[1] = { [1] = 0 }; /* { dg-error "error: array index in initializer exceeds array bounds" } */ -/* { dg-error "near init" "" { target *-*-* } 32 } */ +/* { dg-error "near init" "near" { target *-*-* } 32 } */ int a2[1] = { [-1] = 0 }; /* { dg-error "error: array index in initializer exceeds array bounds" } */ -/* { dg-error "near init" "" { target *-*-* } 34 } */ +/* { dg-error "near init" "near" { target *-*-* } 34 } */ int a3[1] = { [0 ... 1] = 0 }; /* { dg-error "error: array index range in initializer exceeds array bounds" } */ -/* { dg-error "near init" "" { target *-*-* } 36 } */ +/* { dg-error "near init" "near" { target *-*-* } 36 } */ int a4[2] = { [1 ... 0] = 0 }; /* { dg-error "error: empty index range in initializer" } */ -/* { dg-error "near init" "" { target *-*-* } 38 } */ +/* { dg-error "near init" "near" { target *-*-* } 38 } */ int a5[2] = { [0 ... 2] = 0 }; /* { dg-error "error: array index range in initializer exceeds array bounds" } */ -/* { dg-error "near init" "" { target *-*-* } 40 } */ +/* { dg-error "near init" "near" { target *-*-* } 40 } */ int a6[2] = { [-1 ... 1] = 0 }; /* { dg-error "error: array index in initializer exceeds array bounds" } */ -/* { dg-error "near init" "" { target *-*-* } 42 } */ +/* { dg-error "near init" "near" { target *-*-* } 42 } */ int a7[] = { [-1 ... 1] = 0 }; /* { dg-error "error: array index in initializer exceeds array bounds" } */ -/* { dg-error "near init" "" { target *-*-* } 44 } */ +/* { dg-error "near init" "near" { target *-*-* } 44 } */ diff --git a/gcc/testsuite/gcc.dg/init-bad-2.c b/gcc/testsuite/gcc.dg/init-bad-2.c index 794cc412db3..23387e500f0 100644 --- a/gcc/testsuite/gcc.dg/init-bad-2.c +++ b/gcc/testsuite/gcc.dg/init-bad-2.c @@ -11,8 +11,8 @@ void h(a) int a = 1; /* { dg-error "error: parameter 'a' is initialized" } */ { struct s x = { 0 }; /* { dg-error "error: variable 'x' has initializer but incomplete type" } */ - /* { dg-warning "excess elements|near init" "" { target *-*-* } 13 } */ - /* { dg-error "storage size" "" { target *-*-* } 13 } */ + /* { dg-warning "excess elements|near init" "near" { target *-*-* } 13 } */ + /* { dg-error "storage size" "size" { target *-*-* } 13 } */ } char s[1] = "x"; @@ -20,14 +20,14 @@ char s1[1] = { "x" }; char t[1] = "xy"; /* { dg-warning "warning: initializer-string for array of chars is too long" } */ char t1[1] = { "xy" }; /* { dg-warning "warning: initializer-string for array of chars is too long" } */ char u[1] = { "x", "x" }; /* { dg-error "error: excess elements in char array initializer" } */ -/* { dg-error "near init" "" { target *-*-* } 22 } */ +/* { dg-error "near init" "near" { target *-*-* } 22 } */ int j = { 1 }; int k = { 1, 2 }; /* { dg-warning "warning: excess elements in scalar initializer" } */ -/* { dg-warning "near init" "" { target *-*-* } 27 } */ +/* { dg-warning "near init" "near" { target *-*-* } 27 } */ int a1[1] = { [1] = 0 }; /* { dg-error "error: array index in initializer exceeds array bounds" } */ -/* { dg-error "near init" "" { target *-*-* } 30 } */ +/* { dg-error "near init" "near" { target *-*-* } 30 } */ int a2[1] = { [-1] = 0 }; /* { dg-error "error: array index in initializer exceeds array bounds" } */ -/* { dg-error "near init" "" { target *-*-* } 32 } */ +/* { dg-error "near init" "near" { target *-*-* } 32 } */ diff --git a/gcc/testsuite/gcc.dg/init-bad-3.c b/gcc/testsuite/gcc.dg/init-bad-3.c index aed3d35a49f..bb149823dc1 100644 --- a/gcc/testsuite/gcc.dg/init-bad-3.c +++ b/gcc/testsuite/gcc.dg/init-bad-3.c @@ -11,8 +11,8 @@ void h(a) int a = 1; /* { dg-error "error: parameter 'a' is initialized" } */ { struct s x = { 0 }; /* { dg-error "error: variable 'x' has initializer but incomplete type" } */ - /* { dg-error "excess elements|near init" "" { target *-*-* } 13 } */ - /* { dg-error "storage size" "" { target *-*-* } 13 } */ + /* { dg-error "excess elements|near init" "near" { target *-*-* } 13 } */ + /* { dg-error "storage size" "size" { target *-*-* } 13 } */ } char s[1] = "x"; @@ -20,14 +20,14 @@ char s1[1] = { "x" }; char t[1] = "xy"; /* { dg-error "error: initializer-string for array of chars is too long" } */ char t1[1] = { "xy" }; /* { dg-error "error: initializer-string for array of chars is too long" } */ char u[1] = { "x", "x" }; /* { dg-error "error: excess elements in char array initializer" } */ -/* { dg-error "near init" "" { target *-*-* } 22 } */ +/* { dg-error "near init" "near" { target *-*-* } 22 } */ int j = { 1 }; int k = { 1, 2 }; /* { dg-error "error: excess elements in scalar initializer" } */ -/* { dg-error "near init" "" { target *-*-* } 27 } */ +/* { dg-error "near init" "near" { target *-*-* } 27 } */ int a1[1] = { [1] = 0 }; /* { dg-error "error: array index in initializer exceeds array bounds" } */ -/* { dg-error "near init" "" { target *-*-* } 30 } */ +/* { dg-error "near init" "near" { target *-*-* } 30 } */ int a2[1] = { [-1] = 0 }; /* { dg-error "error: array index in initializer exceeds array bounds" } */ -/* { dg-error "near init" "" { target *-*-* } 32 } */ +/* { dg-error "near init" "near" { target *-*-* } 32 } */ diff --git a/gcc/testsuite/gcc.dg/loop-3.c b/gcc/testsuite/gcc.dg/loop-3.c index 3cc6643e15d..f7ceaddb899 100644 --- a/gcc/testsuite/gcc.dg/loop-3.c +++ b/gcc/testsuite/gcc.dg/loop-3.c @@ -3,7 +3,7 @@ /* { dg-do compile } */ /* { dg-options "-O3" } */ -/* { dg-options "-O3 -mtune=i386" { target i?86-*-* } } */ +/* { dg-options "-O3 -mtune=i386" { target { i?86-*-* && ilp32 } } } */ #if defined(STACK_SIZE) && (STACK_SIZE < 65536) # define BYTEMEM_SIZE 10000L diff --git a/gcc/testsuite/gcc.dg/lvalue-cast-1.c b/gcc/testsuite/gcc.dg/lvalue-cast-1.c new file mode 100644 index 00000000000..e434baf6e7e --- /dev/null +++ b/gcc/testsuite/gcc.dg/lvalue-cast-1.c @@ -0,0 +1,23 @@ +/* APPLE LOCAL file non lvalue assign */ +/* { dg-do compile } */ +/* { dg-options "-fnon-lvalue-assign -faltivec" } */ + +int foo(void) { + + char *p; + long l; + short s; + vector unsigned int vui; + volatile int *pvi; + + (long *)p = &l; /* { dg-warning "target of assignment not really an lvalue" } */ + ((long *)p)++; /* { dg-warning "target of assignment not really an lvalue" } */ + (short)l = 2; /* { dg-error "invalid lvalue" } */ + (long)s = 3; /* { dg-error "invalid lvalue" } */ + (int)pvi = 4; /* { dg-warning "target of assignment not really an lvalue" } */ + (int)pvi &= 5; /* { dg-warning "target of assignment not really an lvalue" } */ + + (vector float)vui = (vector float)(1.0, 2.0, 3.0, 4.0); /* { dg-warning "target of assignment not really an lvalue" } */ + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lvalue-cast-2.c b/gcc/testsuite/gcc.dg/lvalue-cast-2.c new file mode 100644 index 00000000000..bfd2e29e52c --- /dev/null +++ b/gcc/testsuite/gcc.dg/lvalue-cast-2.c @@ -0,0 +1,14 @@ +/* APPLE LOCAL file non lvalue assign */ +/* Allow lvalue casts in conjunction with '&'. */ +/* { dg-do compile } */ +/* { dg-options "-fnon-lvalue-assign" } */ + +int foo (void **ptr) { + return 1; +} + +int bar (void) { + char *string; + + return foo ((void **)&((char *)string)); /* { dg-warning "argument to .&. not really an lvalue" } */ +} diff --git a/gcc/testsuite/gcc.dg/lvalue-cond-1.c b/gcc/testsuite/gcc.dg/lvalue-cond-1.c new file mode 100644 index 00000000000..9f48adbdfe2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lvalue-cond-1.c @@ -0,0 +1,30 @@ +/* APPLE LOCAL file non lvalue assign */ +/* Allow assignments to conditional expressions, as long as the second and third + operands are already lvalues. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ +/* { dg-options "-fnon-lvalue-assign" } */ +/* { dg-do run } */ + +#include <stdlib.h> + +int g1 = 3, g2 = 5; + +void assign_val1 (int which, int value) { + (which ? g1 : g2) = value; /* { dg-warning "target of assignment not really an lvalue" } */ +} + +void assign_val2 (int which) { + (which ? g1 : g2)++; /* { dg-warning "target of assignment not really an lvalue" } */ +} + +int main(void) { + assign_val1 (0, 15); + if (g1 != 3 || g2 != 15) + abort (); + + assign_val2 (1); + if (g1 != 4 || g2 != 15) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lvalue1.c b/gcc/testsuite/gcc.dg/lvalue1.c index 7e21608ab36..36fb9d8e0a5 100644 --- a/gcc/testsuite/gcc.dg/lvalue1.c +++ b/gcc/testsuite/gcc.dg/lvalue1.c @@ -1,5 +1,7 @@ /* PR c/5225 */ /* { dg-do compile } */ +/* APPLE LOCAL non lvalue assign */ +/* { dg-options "-fno-non-lvalue-assign" } */ int main() { diff --git a/gcc/testsuite/gcc.dg/m-un-2.c b/gcc/testsuite/gcc.dg/m-un-2.c index d957f868405..0d280bb5793 100644 --- a/gcc/testsuite/gcc.dg/m-un-2.c +++ b/gcc/testsuite/gcc.dg/m-un-2.c @@ -16,7 +16,7 @@ struct vtable mtable = { malloc, free }; /* { dg-warning "missing initializer" "warning regression" { target *-*-* } {18} } */ - /* { dg-warning "initialization for 'mtable._realloc'" "warning regression" { target *-*-* } {18} } */ + /* { dg-warning "initialization for 'mtable._realloc'" "warning regression 2" { target *-*-* } {18} } */ /* With designated initializers, we assume you meant to leave out the initialization of any blank fields. */ diff --git a/gcc/testsuite/gcc.dg/mac68k-pragma-unsup-1.c b/gcc/testsuite/gcc.dg/mac68k-pragma-unsup-1.c new file mode 100644 index 00000000000..2250d0edfed --- /dev/null +++ b/gcc/testsuite/gcc.dg/mac68k-pragma-unsup-1.c @@ -0,0 +1,12 @@ +/* APPLE LOCAL file 64-bit mainline */ +/* 64-bit Darwin officially doesn't like the mac68k alignment pragma. */ + +/* { dg-do compile { target powerpc*-*-darwin[89]* } } */ +/* { dg-options "-m64" } */ + +#pragma options align=mac68k /* { dg-warning "mac68k alignment pragma is deprecated for 64-bit Darwin" } */ + +#pragma options align=reset /* this shouldn't error out */ + + + diff --git a/gcc/testsuite/gcc.dg/old-style-then-proto-1.c b/gcc/testsuite/gcc.dg/old-style-then-proto-1.c new file mode 100644 index 00000000000..abe02d06378 --- /dev/null +++ b/gcc/testsuite/gcc.dg/old-style-then-proto-1.c @@ -0,0 +1,44 @@ +/* Test for old-style definition followed by prototype declaration. + Mismatched qualifiers used to be wrongly forbidden. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void f1() {} +void f1(void); /* { dg-warning "warning: prototype for 'f1' follows non-prototype definition" } */ + +void f2() {} /* { dg-error "error: previous definition of 'f2' was here" } */ +void f2(int); /* { dg-error "error: prototype for 'f2' declares more arguments than previous old-style definition" } */ + +void f3(a) int a; {} /* { dg-error "error: previous definition of 'f3' was here" } */ +void f3(void); /* { dg-error "error: prototype for 'f3' declares fewer arguments than previous old-style definition" } */ + +void f4(a) int a; {} +void f4(int); /* { dg-warning "warning: prototype for 'f4' follows non-prototype definition" } */ + +void f5(a) int a; {} /* { dg-error "error: previous definition of 'f5' was here" } */ +void f5(int, int); /* { dg-error "error: prototype for 'f5' declares more arguments than previous old-style definition" } */ + +void f6(a) int a; {} /* { dg-error "error: previous definition of 'f6' was here" } */ +void f6(int, ...); /* { dg-error "error: conflicting types for 'f6'" } */ + +void f7(a, b) int a, b; {} /* { dg-error "error: previous definition of 'f7' was here" } */ +void f7(int); /* { dg-error "error: prototype for 'f7' declares fewer arguments than previous old-style definition" } */ + +void f8(a, b) int a, b; {} /* { dg-error "error: previous definition of 'f8' was here" } */ +void f8(int, ...); /* { dg-error "error: conflicting types for 'f8'" } */ + +void f9(a, b) int a, b; {} +void f9(int, int); /* { dg-warning "warning: prototype for 'f9' follows non-prototype definition" } */ + +void f10(a, b) int a, b; {} /* { dg-error "error: previous definition of 'f10' was here" } */ +void f10(int, long); /* { dg-error "error: prototype for 'f10' declares argument 2 with incompatible type" } */ + +void f11(a, b) int a, b; {} /* { dg-error "error: previous definition of 'f11' was here" } */ +void f11(long, int); /* { dg-error "error: prototype for 'f11' declares argument 1 with incompatible type" } */ + +void f12(a, b) const int a; volatile int b; {} +void f12(volatile int, const int); /* { dg-warning "warning: prototype for 'f12' follows non-prototype definition" } */ + +void f13(a) const int a[2][2]; {} /* { dg-error "error: previous definition of 'f13' was here" } */ +void f13(volatile int [2][2]); /* { dg-error "error: prototype for 'f13' declares argument 1 with incompatible type" } */ diff --git a/gcc/testsuite/gcc.dg/pack-test-1.c b/gcc/testsuite/gcc.dg/pack-test-1.c index 4d54647918e..a365b245f9b 100644 --- a/gcc/testsuite/gcc.dg/pack-test-1.c +++ b/gcc/testsuite/gcc.dg/pack-test-1.c @@ -1,7 +1,8 @@ /* Test semantics of #pragma pack. Contributed by Mike Coleman <mcoleman2@kc.rr.com> */ -/* { dg-do compile { target *-*-linux* *-*-cygwin* powerpc*-*-eabi* } } */ +/* APPLE LOCAL Macintosh alignment 2002-1-22 ff */ +/* { dg-do compile { target *-*-linux* *-*-cygwin* powerpc*-*-eabi* *-*-darwin* } } */ /* We only test the alignment of char, short, and int, because these are the only ones that are pretty certain to be the same across diff --git a/gcc/testsuite/gcc.dg/parm-mismatch-1.c b/gcc/testsuite/gcc.dg/parm-mismatch-1.c index 59d9447b2e0..6b82b7be1b2 100644 --- a/gcc/testsuite/gcc.dg/parm-mismatch-1.c +++ b/gcc/testsuite/gcc.dg/parm-mismatch-1.c @@ -6,13 +6,13 @@ void f0(); /* { dg-error "error: previous declaration of 'f0' was here" } */ void f0(int, ...); /* { dg-error "error: conflicting types for 'f0'" } */ -/* { dg-error "note: a parameter list with an ellipsis can't match an empty parameter name list declaration" "" { target *-*-* } 8 } */ +/* { dg-error "note: a parameter list with an ellipsis can't match an empty parameter name list declaration" "note" { target *-*-* } 8 } */ void f1(int, ...); /* { dg-error "error: previous declaration of 'f1' was here" } */ void f1(); /* { dg-error "error: conflicting types for 'f1'" } */ -/* { dg-error "note: a parameter list with an ellipsis can't match an empty parameter name list declaration" "" { target *-*-* } 11 } */ +/* { dg-error "note: a parameter list with an ellipsis can't match an empty parameter name list declaration" "note" { target *-*-* } 11 } */ void f2(); /* { dg-error "error: previous declaration of 'f2' was here" } */ void f2(char); /* { dg-error "error: conflicting types for 'f2'" } */ -/* { dg-error "note: an argument type that has a default promotion can't match an empty parameter name list declaration" "" { target *-*-* } 14 } */ +/* { dg-error "note: an argument type that has a default promotion can't match an empty parameter name list declaration" "note" { target *-*-* } 14 } */ void f3(char); /* { dg-error "error: previous declaration of 'f3' was here" } */ void f3(); /* { dg-error "error: conflicting types for 'f3'" } */ -/* { dg-error "note: an argument type that has a default promotion can't match an empty parameter name list declaration" "" { target *-*-* } 17 } */ +/* { dg-error "note: an argument type that has a default promotion can't match an empty parameter name list declaration" "note" { target *-*-* } 17 } */ diff --git a/gcc/testsuite/gcc.dg/pch/apple-altivec-1.c b/gcc/testsuite/gcc.dg/pch/apple-altivec-1.c new file mode 100644 index 00000000000..5f2e93f365e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pch/apple-altivec-1.c @@ -0,0 +1,126 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do compile { target powerpc-*-darwin* } } */ +/* { dg-options "-faltivec -I." } */ + +#include "apple-altivec-1.h" + +/* Test for correct handling of AltiVec constants passed + through '...' (va_arg). */ + +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> + +#define CHECK_INVARIANT(expr) \ + if (!(expr)) { \ + printf ("ASSERT FAILED: %d: %s\n", __LINE__, #expr); \ + abort (); \ + } + +struct foo { int x; int y; }; +struct vfoo { int x; __vector signed int v; int y; }; +union u { __vector signed int v; signed int i[4]; }; + +struct foo x_g = { 3, 4}; +struct vfoo vx_g = { 10, (vector signed int)(11, 12, 13, 14), 15 }; +__vector signed int v_g = (vector signed int) (22, 23, 24, 25); +struct vfoo vx2_g = { 30, (vector signed int)(31, 32, 33, 34), 35 }; +__vector signed int v2_g = (vector signed int)(40, 41, 42, 43); +int i_1 = 99, i_2 = 33; +double d_2 = 1.5, d_3 = 1.75; +long double ld_1 = 1.25; + +void bar (int i, ... ) +{ + struct foo xi; + double d; + long double ld; + float f; + char c; + short s; + va_list ap; + va_start(ap, i); + xi = va_arg(ap, struct foo); + s = (short)va_arg(ap, int); + f = (float)va_arg(ap, double); + ld = va_arg(ap, long double); + c = (char)va_arg(ap, int); + d = va_arg(ap, double); + va_end(ap); + + CHECK_INVARIANT (xi.x == x_g.x && xi.y == x_g.y); + CHECK_INVARIANT (s == (short)i_2); + CHECK_INVARIANT (f == (float)d_2); + CHECK_INVARIANT (ld == ld_1); + CHECK_INVARIANT (c == (char)i_1); + CHECK_INVARIANT (d == d_3); +} + +void baz (int i, ... ) +{ + struct vfoo vx, vx2; + __vector signed int v_i, v2_i; + int j, k, l; + va_list ap; + va_start(ap, i); + v_i = va_arg(ap, __vector signed int); + j = va_arg(ap, int); + vx = va_arg(ap, struct vfoo); + k = va_arg(ap, int); + v2_i = va_arg(ap, __vector signed int); + l = va_arg(ap, int); + vx2 = va_arg(ap, struct vfoo); + va_end(ap); + + CHECK_INVARIANT (vec_all_eq (v_i, v_g)); + CHECK_INVARIANT (j == i_1); + CHECK_INVARIANT (vx.x == vx_g.x && vec_all_eq(vx.v, vx_g.v) && vx.y == vx_g.y); + CHECK_INVARIANT (k == i_1); + CHECK_INVARIANT (vec_all_eq (v2_i, v2_g)); + CHECK_INVARIANT (l == i_1); + CHECK_INVARIANT (vx2.x == vx2_g.x && vec_all_eq(vx2.v, vx2_g.v) && vx2.y == vx2_g.y); +} + +void quux (int i, ... ) +{ + __vector signed int v_i, v2_i; + union u vi, v2i; + va_list ap; + va_start(ap, i); + v_i = va_arg(ap, __vector signed int); + v2_i = va_arg(ap, __vector signed int); + va_end(ap); + vi.v = v_i; + v2i.v = v2_i; + + CHECK_INVARIANT (vec_all_eq (v_i, v_g)); + CHECK_INVARIANT (vec_all_eq (v2_i, v_g)); + CHECK_INVARIANT (vec_all_eq (vi.v, v_g)); + CHECK_INVARIANT (vec_all_eq (v2i.v, v_g)); +} + +void baz2 (int i, ... ) +{ + struct vfoo vx; + union u vxi; + va_list ap; + va_start(ap, i); + vx = va_arg(ap, struct vfoo); + va_end(ap); + vxi.v = vx.v; + + CHECK_INVARIANT (vx.x == vx_g.x && vec_all_eq(vx.v, vx_g.v) && vx.y == vx_g.y); + CHECK_INVARIANT (vec_all_eq (vxi.v, vx_g.v)); +} + +int main(void) +{ + CHECK_INVARIANT (sizeof(struct foo) == 8 && sizeof(struct vfoo) == 48); + + bar(i_1, x_g, (short)i_2, (float)d_2, ld_1, (char)i_1, d_3); + baz(i_1, v_g, i_1, vx_g, i_1, v2_g, i_1, vx2_g); + quux(i_1, v_g, v_g); + baz2(i_1, vx_g); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pch/apple-altivec-1.hs b/gcc/testsuite/gcc.dg/pch/apple-altivec-1.hs new file mode 100644 index 00000000000..156bdf74eba --- /dev/null +++ b/gcc/testsuite/gcc.dg/pch/apple-altivec-1.hs @@ -0,0 +1,2 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-options "-faltivec" } */ diff --git a/gcc/testsuite/gcc.dg/pch/faltivec-1.c b/gcc/testsuite/gcc.dg/pch/faltivec-1.c new file mode 100644 index 00000000000..5824d4155cc --- /dev/null +++ b/gcc/testsuite/gcc.dg/pch/faltivec-1.c @@ -0,0 +1,17 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-do compile { target powerpc-*-darwin* } } */ +/* { dg-options "-faltivec -I. -mcpu=G5" } */ + +#include "faltivec-1.h" +/* { dg-error "No such file or directory" "" { target *-*-* } 5 } */ +/* { dg-error "one or more PCH files were found" "" { target *-*-* } 5 } */ +/* { dg-error "use -Winvalid-pch for more information" "" { target *-*-* } 5 } */ + +/* Test for correct PCH validation of -faltivec. */ +void foo() +{ + const vector signed short vconst = (vector signed short) (0,0,0,0,0,0,0,0); + const vector signed short vconst2 = vec_splat(vconst, 0); + bar(); +} + diff --git a/gcc/testsuite/gcc.dg/pch/faltivec-1.hs b/gcc/testsuite/gcc.dg/pch/faltivec-1.hs new file mode 100644 index 00000000000..c24c35cefae --- /dev/null +++ b/gcc/testsuite/gcc.dg/pch/faltivec-1.hs @@ -0,0 +1,3 @@ +/* APPLE LOCAL file AltiVec */ +/* { dg-options " -mcpu=G5" } */ +extern void bar(); diff --git a/gcc/testsuite/gcc.dg/pch/pch.exp b/gcc/testsuite/gcc.dg/pch/pch.exp index 79fd9e77139..7f6334efbce 100644 --- a/gcc/testsuite/gcc.dg/pch/pch.exp +++ b/gcc/testsuite/gcc.dg/pch/pch.exp @@ -26,6 +26,29 @@ dg-init set old_dg_do_what_default "${dg-do-what-default}" +# APPLE LOCAL begin +# Test MACOSX_DEPLOYMENT_TARGET +set macosx_deployment_target env(MACOSX_DEPLOYMENT_TARGET) +setenv MACOSX_DEPLOYMENT_TARGET 10.2 +set test "cfstring-1.c" +set f [open $test w] +set v 0 +puts $f "#include \"cfstring-1.h\"" +puts $f "/* { dg-options \"-I./ -Winvalid-pch -save-temps\" } */" +puts $f "void foo\(\) { x = 0; }" +puts $f "" +close $f +set testh "cfstring-1.hs" +set f [open $testh w] +puts $f "int x;" +puts $f "" +close $f +dg-pch $subdir $test [concat [list {-O0 -g}] $torture_without_loops] ".h" +set MACOSX_DEPLOYMENT_TARGET $macosx_deployment_target +file delete $test +file delete $testh +# APPLE LOCAL end + # Main loop. foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.c]] { global torture_without_loops diff --git a/gcc/testsuite/gcc.dg/pr12092-1.c b/gcc/testsuite/gcc.dg/pr12092-1.c index 8f38a4a7f46..1b29452881f 100644 --- a/gcc/testsuite/gcc.dg/pr12092-1.c +++ b/gcc/testsuite/gcc.dg/pr12092-1.c @@ -1,6 +1,7 @@ /* PR rtl-optimization/12092 */ /* Test case reduced by Andrew Pinski <pinskia@physics.uc.edu> */ /* { dg-do compile { target i?86-*-* } } */ +/* { dg-require-effective-target ilp32 } */ /* { dg-options "-O2 -mtune=i486 -march=pentium4 -fprefetch-loop-arrays" } */ void DecodeAC(int index,int *matrix) diff --git a/gcc/testsuite/gcc.dg/pr18628.c b/gcc/testsuite/gcc.dg/pr18628.c new file mode 100644 index 00000000000..d365075b729 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr18628.c @@ -0,0 +1,31 @@ +/* { dg-do link } */ +/* { dg-options "-O2" } */ + +/* PR middle-end/18628 exposed a problem in which cse folded a load + from a jump table into the label that was the target of the branch. + Unfortunately, the indirect jump was moved to a different basic + block, and the LABEL_REF copied to the register wasn't enough to + keep the cfg from optimizing the otherwise-unused label away. So + we ended up with a dangling reference to the label. */ + +int i; + +int main() +{ + for (;;) + { + switch (i) + { + case 0: + case 1: + return 1; + + case 2: + case 3: + return 0; + + case 5: + --i; + } + } +} diff --git a/gcc/testsuite/gcc.dg/pr19345.c b/gcc/testsuite/gcc.dg/pr19345.c new file mode 100644 index 00000000000..40c6de4d836 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr19345.c @@ -0,0 +1,12 @@ +/* We shouldn't crash trying to produce the inlined structure type die debug info. */ +/* { dg-do compile } */ +/* { dg-options "-O1 -g" } */ +inline void bar(char a[], unsigned int l) +{ + asm volatile ("" :: "m" ( *(struct {char x[l]; } *)a)); +} + +void foo(void) +{ + bar (0, 0); +} diff --git a/gcc/testsuite/gcc.dg/pr19967.c b/gcc/testsuite/gcc.dg/pr19967.c new file mode 100644 index 00000000000..85afeafe285 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr19967.c @@ -0,0 +1,26 @@ +/* PR middle-end/19967 + These functions mentioned below are supposed to return char *. + However, fold_builtin_... had bugs that caused the return types to + be const char *. */ + +/* { dg-do compile } */ +/* { dg-options "-pedantic" } */ + +char *strchr(const char *, int); +char *strrchr(const char *, int); +char *index(const char *, int); +char *rindex(const char *, int); +char *strpbrk(const char *, const char *); +char *strstr(const char *, const char *); +char *p; + +void +f (void) +{ + p = strchr(__func__, 'f'); + p = strrchr(__func__, 'f'); + p = index(__func__, 'f'); + p = rindex(__func__, 'f'); + p = strpbrk(__func__, "f"); + p = strstr(__func__, "f"); +} diff --git a/gcc/testsuite/gcc.dg/pr20017.c b/gcc/testsuite/gcc.dg/pr20017.c new file mode 100644 index 00000000000..16bd72b315d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr20017.c @@ -0,0 +1,41 @@ +/* PR rtl-optimization/20017 + + After CSE/GCSE folds a switch statement to an unconditional jump, + cfg_cleanup did not remove a dead jump table, confusing the CFG + layout code later on. */ + +/* { dg-do compile } */ +/* { dg-options "-O1" } */ +/* { dg-options "-O1 -march=i386" { target { i?86-*-* && ilp32 } } } */ + +int +foo (int *buf, int *p) +{ + int result; + const int *tmp; + + if (*buf) + return 1; + + result = 2; + *buf = 2; + tmp = buf; + switch (*tmp) + { + case 3: + case 4: + case 6: + case 14: + return 1; + + case 0: + result = *p; + + /* Fall through. */ + default: + if (result) + return 1; + } + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr20054.c b/gcc/testsuite/gcc.dg/pr20054.c new file mode 100644 index 00000000000..292b856d014 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr20054.c @@ -0,0 +1,23 @@ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-strict-aliasing" } */ + + +unsigned int *foo (void); + +char * +bar (double *d) +{ + return (char *) (d + 1) - sizeof (unsigned int); +} + +char +baz (double x) +{ + unsigned int h = *foo (); + unsigned int l = *(unsigned int *) bar (&x); + + return (h & ~0x80000000L) == 0x7FF00000 && l == 0; +} + + diff --git a/gcc/testsuite/gcc.dg/pr20100.c b/gcc/testsuite/gcc.dg/pr20100.c new file mode 100644 index 00000000000..988fbda6429 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr20100.c @@ -0,0 +1,32 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +int func_pure (void) __attribute__ ((pure)); +void func_other (int); +int global_int; +void abort (); +void func_other(int a) +{ + if (a != global_int) + abort (); + global_int++; +} + +int func_pure(void) +{ + return global_int; +} + +int +func_loop (int arg) +{ + // global_int ++; + while (arg--) + func_other (func_pure ()); +} + +int main(void) +{ + func_loop(10); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr20115-1.c b/gcc/testsuite/gcc.dg/pr20115-1.c new file mode 100644 index 00000000000..d1c4066729f --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr20115-1.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-dom1" } */ + +extern int foo (void) __attribute__((pure)); + +int bar() +{ + int a = foo (); + a += foo (); + return a; +} + +/* Check that we only have one call to foo. */ +/* { dg-final { scan-tree-dump-times "foo" 1 "dom1" } } */ diff --git a/gcc/testsuite/gcc.dg/pr20115.c b/gcc/testsuite/gcc.dg/pr20115.c new file mode 100644 index 00000000000..cea4b486854 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr20115.c @@ -0,0 +1,28 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +int func_pure (void); +void func_other (int); +int global_int; +int func_pure (void) { return global_int; } +void func_other (int a) +{ + global_int = a + 1; +} +int f(void) +{ + int a; + a = func_pure(); + func_other (a); + a = func_pure (); // We were removing this function call + return a; +} +void abort (void); + +int main(void) +{ + global_int = 10; + if (f() != 11) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr20204.c b/gcc/testsuite/gcc.dg/pr20204.c new file mode 100644 index 00000000000..ad85af5baa3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr20204.c @@ -0,0 +1,34 @@ +/* { dg-do run { target i?86-*-* } } */ +/* { dg-options "-O2" } */ + +void *x (void *pdst, const void *psrc, unsigned int pn) +{ + register void *return_dst = pdst; + register unsigned char *dst = pdst; + register unsigned const char *src = psrc; + register int n __asm__ ("ebx") = pn; + + if (src < dst && dst < src + n) + { + src += n; + dst += n; + while (n--) + *--dst = *--src; + return return_dst; + } + + while (n >= 16) n--; + + return return_dst; +} +extern void abort (); +extern void exit (int); +char xx[30] = "abc"; +int main (void) +{ + char yy[30] = "aab"; + + if (x (xx + 1, xx, 2) != xx + 1 || memcmp (xx, yy, sizeof (yy)) != 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/pr20216.c b/gcc/testsuite/gcc.dg/pr20216.c new file mode 100644 index 00000000000..8baba44a030 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr20216.c @@ -0,0 +1,16 @@ +/* APPLE LOCAL file why is this local? */ +/* { dg-do compile } */ +/* { dg-options "-O1" } */ + +static unsigned int *buffer; + +void FUNC (void) +{ + unsigned int *base; + int i, j; + + for (i = 0; i < 4; i++) + for (j = 0; j < 1600000; j++) + *base++ = buffer[j]; +} + diff --git a/gcc/testsuite/gcc.dg/pr20368-1.c b/gcc/testsuite/gcc.dg/pr20368-1.c new file mode 100644 index 00000000000..a88c7f803b7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr20368-1.c @@ -0,0 +1,12 @@ +/* ICE with -Wstrict-prototypes and typeof an undeclared function. + Bug 20368. */ +/* { dg-do compile } */ +/* { dg-options "-Wstrict-prototypes" } */ + +extern __typeof (f) g; /* { dg-error "error: 'f' undeclared here \\(not in a function\\)" } */ + +int +f (x) + float x; +{ +} diff --git a/gcc/testsuite/gcc.dg/pr20368-2.c b/gcc/testsuite/gcc.dg/pr20368-2.c new file mode 100644 index 00000000000..e3c8396233e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr20368-2.c @@ -0,0 +1,12 @@ +/* ICE with -Wstrict-prototypes and typeof an undeclared function. + Bug 20368. Test with -Wmissing-prototypes. */ +/* { dg-do compile } */ +/* { dg-options "-Wmissing-prototypes" } */ + +extern __typeof (f) g; /* { dg-error "error: 'f' undeclared here \\(not in a function\\)" } */ + +int +f (x) + float x; +{ +} diff --git a/gcc/testsuite/gcc.dg/pr20368-3.c b/gcc/testsuite/gcc.dg/pr20368-3.c new file mode 100644 index 00000000000..32095999676 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr20368-3.c @@ -0,0 +1,12 @@ +/* ICE with -Wstrict-prototypes and typeof an undeclared function. + Bug 20368. Test with -Wmissing-declarations. */ +/* { dg-do compile } */ +/* { dg-options "-Wmissing-declarations" } */ + +extern __typeof (f) g; /* { dg-error "error: 'f' undeclared here \\(not in a function\\)" } */ + +int +f (x) + float x; +{ +} diff --git a/gcc/testsuite/gcc.dg/pr20927.c b/gcc/testsuite/gcc.dg/pr20927.c new file mode 100644 index 00000000000..55cda33e8c4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr20927.c @@ -0,0 +1,23 @@ +/* This caused an ICE on s390x due to a reload inheritance bug. */ + +/* { dg-do compile { target s390*-*-* } } */ +/* { dg-options "-O2" } */ + +struct point { double x, y; }; +extern void use (struct point); + +void test (struct point *pc, struct point p1) +{ + struct point p0 = *pc; + + if (p0.x == p1.x && p0.y == p1.y) + use (p0); + + asm ("" : : : "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"); + + p1.y -= p0.y; + + use (p0); + use (p1); +} + diff --git a/gcc/testsuite/gcc.dg/pragma-darwin.c b/gcc/testsuite/gcc.dg/pragma-darwin.c index da70c8918a0..7d5d22bb667 100644 --- a/gcc/testsuite/gcc.dg/pragma-darwin.c +++ b/gcc/testsuite/gcc.dg/pragma-darwin.c @@ -14,20 +14,30 @@ extern void abort(void); #pragma options 23 /* { dg-error "malformed '#pragma options'" } */ #pragma options align /* { dg-error "malformed '#pragma options'" } */ -#pragma options align mac68k /* { dg-error "malformed '#pragma options'" } */ +/* APPLE LOCAL 64-bit mainline */ +#pragma options align natural /* { dg-error "malformed '#pragma options'" } */ #pragma options align=45 /* { dg-error "malformed '#pragma options'" } */ #pragma options align=foo /* { dg-error "malformed '#pragma options align" } */ +/* APPLE LOCAL 64-bit mainline */ +#ifndef __LP64__ #pragma options align=mac68k struct s1 { short f1; int f2; }; +/* APPLE LOCAL 64-bit mainline */ +#endif #pragma options align=power struct s2 { short f1; int f2; }; +/* APPLE LOCAL 64-bit mainline */ +#ifndef __LP64__ #pragma options align=mac68k struct s3 { short f1; int f2; }; +/* APPLE LOCAL 64-bit mainline */ +#endif #pragma options align=reset struct s4 { short f1; int f2; }; -#pragma options align=mac68k foo /* { dg-warning "junk at end of '#pragma options'" } */ +/* APPLE LOCAL 64-bit mainline */ +#pragma options align=natural foo /* { dg-warning "junk at end of '#pragma options'" } */ /* Segment pragmas don't do anything anymore. */ @@ -39,12 +49,20 @@ main () int x, z; /* { dg-warning "unused variable" } */ #pragma unused (x, y) +/* APPLE LOCAL 64-bit mainline */ +#ifndef __LP64__ if (sizeof (struct s1) != 6) abort (); +/* APPLE LOCAL 64-bit mainline */ +#endif if (sizeof (struct s2) != 8) abort (); +/* APPLE LOCAL 64-bit mainline */ +#ifndef __LP64__ if (sizeof (struct s3) != 6) abort (); +/* APPLE LOCAL 64-bit mainline */ +#endif if (sizeof (struct s4) != 8) abort (); return 0; diff --git a/gcc/testsuite/gcc.dg/redecl-1.c b/gcc/testsuite/gcc.dg/redecl-1.c index 14877667e91..75ce208457c 100644 --- a/gcc/testsuite/gcc.dg/redecl-1.c +++ b/gcc/testsuite/gcc.dg/redecl-1.c @@ -94,7 +94,7 @@ static int test7(int x) void prime8(void) { test8(); /* { dg-warning "previous" "" } */ - /* { dg-warning "implicit" "" { target *-*-* } 96 } */ + /* { dg-warning "implicit" "implicit" { target *-*-* } 96 } */ } static int test8(int x) diff --git a/gcc/testsuite/gcc.dg/short-compare-1.c b/gcc/testsuite/gcc.dg/short-compare-1.c index 6a4e388d179..7ecca243a7c 100644 --- a/gcc/testsuite/gcc.dg/short-compare-1.c +++ b/gcc/testsuite/gcc.dg/short-compare-1.c @@ -3,7 +3,7 @@ /* { dg-do run } */ /* { dg-options "-O" } */ -/* { dg-options "-O -mtune=i686" { target i?86-*-* } } */ +/* { dg-options "-O -mtune=i686" { target { i?86-*-* && ilp32 } } } */ /* { dg-options "-O -m32 -mtune=i686" { target x86_64-*-* } } */ extern void abort(void); diff --git a/gcc/testsuite/gcc.dg/short-compare-2.c b/gcc/testsuite/gcc.dg/short-compare-2.c index 1c5963c5a2f..736e1510e8d 100644 --- a/gcc/testsuite/gcc.dg/short-compare-2.c +++ b/gcc/testsuite/gcc.dg/short-compare-2.c @@ -4,7 +4,7 @@ /* { dg-do run } */ /* { dg-options "-O" } */ -/* { dg-options "-O -mtune=i686" { target i?86-*-* } } */ +/* { dg-options "-O -mtune=i686" { target { i?86-*-* && ilp32 } } } */ /* { dg-options "-O -m32 -mtune=i686" { target x86_64-*-* } } */ extern void abort(); diff --git a/gcc/testsuite/gcc.dg/smod-1.c b/gcc/testsuite/gcc.dg/smod-1.c index 268b43bd2ab..e75978af595 100644 --- a/gcc/testsuite/gcc.dg/smod-1.c +++ b/gcc/testsuite/gcc.dg/smod-1.c @@ -3,7 +3,7 @@ /* { dg-do run } */ /* { dg-options "-std=c99" } */ -/* { dg-options "-std=c99 -mtune=i486" { target i?86-*-* } } */ +/* { dg-options "-std=c99 -mtune=i486" { target { i?86-*-* && ilp32 } } } */ #include <limits.h> diff --git a/gcc/testsuite/gcc.dg/sparc-reg-1.c b/gcc/testsuite/gcc.dg/sparc-reg-1.c new file mode 100644 index 00000000000..860094299a1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/sparc-reg-1.c @@ -0,0 +1,11 @@ +/* PR middle-end/20263 */ + +/* { dg-do assemble { target sparc64-*-* } } */ +/* { dg-options "" } */ + +register void *tp __asm__("%g7"); + +void set_tp(void) +{ + tp = 0; +} diff --git a/gcc/testsuite/gcc.dg/ss/one.c b/gcc/testsuite/gcc.dg/ss/one.c new file mode 100644 index 00000000000..b75a8ebcd74 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ss/one.c @@ -0,0 +1,17 @@ +/* Copyright (C) 2005 Free Software Foundation. + Contributed by Devang Patel <dpatel@apple.com> */ + +/* Test simple use of symbol repository. + Include file one.h is supplied as one.ssh in this directory, + so that ss.exp can pick it up as candidate for making + repository. */ +/* { dg-do assemble } */ + +#include "one.h" +int main () +{ + struct x_y_point a; + a.x = 0; + a.y = 0; + return 0; +} diff --git a/gcc/testsuite/gcc.dg/ss/one.ssh b/gcc/testsuite/gcc.dg/ss/one.ssh new file mode 100644 index 00000000000..b35ec2d1ce8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ss/one.ssh @@ -0,0 +1,11 @@ +/* Copyright (C) 2005 Free Software Foundation. + Contributed by Devang Patel <dpatel@apple.com> */ + +/* Test simple use of symbol repository. + Part of one.c test. */ + +struct x_y_point +{ + int x; + int y; +}; diff --git a/gcc/testsuite/gcc.dg/ss/one_part_2.c b/gcc/testsuite/gcc.dg/ss/one_part_2.c new file mode 100644 index 00000000000..2d6f73f8379 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ss/one_part_2.c @@ -0,0 +1,12 @@ +/* Copyright (C) 2005 Free Software Foundation. + Contributed by Devang Patel <dpatel@apple.com> */ + +/* Test simple use of symbol repository. + Include file one.h is supplied as one.ssh in this directory, + so that ss.exp can pick it up as candidate for making + repository. */ +/* { dg-do assemble } */ +#include "one.h" +extern int foo () +{ +} diff --git a/gcc/testsuite/gcc.dg/ss/ss-cmd1.c b/gcc/testsuite/gcc.dg/ss/ss-cmd1.c new file mode 100644 index 00000000000..3fb08a5be80 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ss/ss-cmd1.c @@ -0,0 +1,9 @@ +/* Copyright (C) 2005 Free Software Foundation. + Contributed by Devang Patel <dpatel@apple.com> */ +/* Test command line option -grepository */ +/* { dg-do compile } */ +/* { dg-options "-gfull -fsave-repository=ss-cmd1-ss.o" } */ +int main() +{ + return 0; +} diff --git a/gcc/testsuite/gcc.dg/ss/ss.exp b/gcc/testsuite/gcc.dg/ss/ss.exp new file mode 100644 index 00000000000..eef1b489f15 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ss/ss.exp @@ -0,0 +1,230 @@ +# Copyright (C) 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# GCC testsuite for symbol separation interaction, +# that uses the `dg.exp' driver. + +# Load support procs. +load_lib gcc-dg.exp + +# Initialize `dg'. +dg-init + +# Get checksum (first field of BINCL and EXCL stab information +proc get_checksum {input_file search_string} { + global RESULT nshort + + # Regular expression to extract hexadecimal word + set hexexp {[0-9a-fA-F]+} + + # Do nm on input_file and grep for search_string + set tmp [remote_exec host "nm -ap $input_file"] + set status [lindex $tmp 0]; + set output [lindex $tmp 1]; + + if {$status != 0} { + fail "$nshort test checksum" + } else { + pass "$nshort test checksum" + } + + regexp $hexexp $output RESULT; + + # Return check sum + return $RESULT +} + +set old_dg_do_what_default "${dg-do-what-default}" + +# Main loop. +foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.c]] { + global runtests torture_without_loops dg-do-what-default nshort + + # If we're only testing specific files and this isn't one of them, skip it. + if ![runtest_file_p $runtests $test] { + continue + } + + # [file tail name] returns part of name after last / + set nshort "$subdir/[file tail $test]" + set short_bname "[file rootname [file tail $test]]" + set bname "[file rootname $test]" + set ss_exp_debug 0 + + # We don't try to use the loop-optimizing options, since they are highly + # unlikely to make any difference to CINFO. + foreach flags "[list {-gfull}]" { + verbose "Testing $nshort, $flags" 1 + + # Clean up + catch { file delete "$bname.h" } + catch { file delete "$bname.o" } + catch { file delete "$bname.h.o" } + + if {$ss_exp_debug == 1} { + puts "ss_exp_debug: various names" + puts "ss_exp_debug bname:"; puts $bname + puts "ss_exp_debug bname.ssh:"; puts $bname.ssh + puts "ss_exp_debug test:"; puts $test + puts "ss_exp_debug short_bname:"; puts $short_bname + } + + # 1) compile foo.h to create foo.h.o + if { [ file exists "$bname.ssh" ] } { + + # For the header files, the default is to make repository + set dg-do-what-default assemble + + # Header files are supplied using .ssh extension, so that we can + # identify candidates for makeing symbol repository. Get header copy + # with .h here. + file copy -force "$bname.ssh" "$bname.h" + file copy -force "$bname.ssh" "$short_bname.h" + + # Make repository + # This will create two output files $short_bname.h.o and PCH + dg-test -keep-output "$bname.h" $flags "-fsave-repository=$short_bname.h.o -x c-header" + + if { [ file exists "$short_bname.o" ] } { + file rename -force "$short_bname.h.o" "$bname.h.o" + + puts "ss_exp_debug short_bname:"; puts $bname.h.o; puts $bname.h; + # Do nm on $bname.h.o and grep for "BINCL $bname.h" + # Extract dummy-checksum from the grep result and save it in RESULT1 + set RESULT1 [get_checksum $bname.h.o "BINCL $bname.h"] + + if {$ss_exp_debug == 1} { + puts "ss_exp_debug: RESULT1"; puts $RESULT1 + } + + pass "$nshort $flags Make Repository" + } else { + set RESULT1 " " + fail "$nshort $flags Make Repository" + } + + if { [ file exists "$bname.h.o" ] } { + + # 2) compile foo.c to create foo.o + dg-test -keep-output $test $flags "-I. " + if { [ file exists "$short_bname.o" ] } { + + # Do nm on $bname.o and grep for "EXCL $bname.h" + # Extract dummy-checksum from the grep result and save it in RESULT2 + set RESULT2 [get_checksum $short_bname.o "EXCL $bname.h"] + + if {$ss_exp_debug == 1} { + puts "ss_exp_debug: RESULT2"; puts $RESULT2 + } + + pass "$nshort $flags Use symbol repository" + + } else { + set RESULT2 " " + fail "$nshort $flags Use symbol repository" + } + + + if { [ file exists "$bname.part_2.c" ] } { + + # 3) compile foo_part_2.c to create foo_part_2.o + dg-test -keep-output "$bname_part_2.c" $flags "-I. -grepository" + if { [ file exists "$short_bname_part_2.o" ] } { + + # Do nm on $bname_part_2.o and grep for "EXCL $bname.h" + # Extract dummy-checksum from the grep result and save it in RESULT3 + set RESULT3 [get_checksum $short_bname_part_2.o "EXCL $bname.h"] + + if {$ss_exp_debug == 1} { + puts "ss_exp_debug: RESULT3"; puts $RESULT3 + } + + pass "$nshort $flags Use symbol repository" + + } else { + set RESULT3 " " + fail "$nshort $flags Use symbol repository" + } + + # 4) Link foo.h.o and foo.o to create foo + set dg-do-what-default link + dg-test -keep-output "$bname.h.o" "$bname.o" "-o $short_bname.out" + + # 5) do 'nm |grep ' on final assembler and save result in RES4 + # Do nm on $bname.out and grep for "EXCL $bname.h" + # Extract dummy-checksum from the grep result and save it in RESULT4 + set RESULT4 [get_checksum $short_bname.out "EXCL $bname.h"] + + # Do nm on $bname.out and grep for "BINCL $bname.h" + # Extract dummy-checksum from the grep result and save it in RESULT5 + set RESULT5 [get_checksum $short_bname.out "BINCL $bname.h"] + + if {$ss_exp_debug == 1} { + puts "ss_exp_debug: RESULT4"; puts $RESULT4 + puts "ss_exp_debug: RESULT5"; puts $RESULT5 + } + + pass "$nshort $flags symbol separation: linking" + + } else { + + # If we are not testing second part then set values so that comparison test succeeds + set RESULT3 $RESULT2 + set RESULT4 $RESULT2 + set RESULT5 $RESULT2 + if {$ss_exp_debug == 1} { + puts "ss_exp_debug: RESULT3"; puts $RESULT3 + puts "ss_exp_debug: RESULT4"; puts $RESULT4 + puts "ss_exp_debug: RESULT5"; puts $RESULT5 + } + } + + # 6) Compare RES1 and RES2 and RES3 and RES4 + if { ( $RESULT1 == $RESULT2 ) + && ( $RESULT1 == $RESULT3 ) + && ( $RESULT1 == $RESULT4 ) } { + pass "$nshort $flags symbol separation valid use test" + } else { + fail "$nshort $flags symbol separation valid use test" + } + if { ( $RESULT1 == $RESULT5 ) } { + pass "$nshort $flags symbol separation link test" + } else { + fail "$nshort $flags symbol separation link test" + } + pass "$nshort $flags Make repository" + } else { + fail "$nshort $flags Make repository" + } + } else { + + # Normal test + set dg-do-what-default compile + dg-test -keep-output $test $flags "-I." + } + + } + + # Clean up + catch { file delete "$bname.h" } + catch { file delete "$bname.o" } + catch { file delete "$bname.h.o" } +} + +set dg-do-what-default "$old_dg_do_what_default" + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.dg/stabs-attrib-vect-darwin.c b/gcc/testsuite/gcc.dg/stabs-attrib-vect-darwin.c new file mode 100644 index 00000000000..82aa4ada66f --- /dev/null +++ b/gcc/testsuite/gcc.dg/stabs-attrib-vect-darwin.c @@ -0,0 +1,12 @@ +/* APPLE LOCAL file mainline 2005-04-25 */ +/* Test Attribute Vector associated with vectory type stabs. */ +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-gstabs -fno-eliminate-unused-debug-types -faltivec" } */ + +int main () +{ + vector int vi = { 6,7,8,9 }; + return 0; +} + +/* { dg-final { scan-assembler ".stabs.*vi\:\\(0,16\\)=\@V" } } */ diff --git a/gcc/testsuite/gcc.dg/stmt-expr-label-1.c b/gcc/testsuite/gcc.dg/stmt-expr-label-1.c new file mode 100644 index 00000000000..1f52a313918 --- /dev/null +++ b/gcc/testsuite/gcc.dg/stmt-expr-label-1.c @@ -0,0 +1,404 @@ +/* Test for labels in statement expressions: bugs 772 and 17913. + goto statements must not jump into statement expressions. + + This tests all combinations of label and goto locations in a given + function. Each combination is tested twice, once with just that + label and goto and once with many others in order to exercise the + different code paths involved with excess labels. */ + +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void f0 (void) { goto a; a:({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa0 (void) { p0A:goto p0A; goto a; a:({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f1 (void) { goto a; ({ a:({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa1 (void) { p0A:goto p0A; goto a; P0A:goto P0A;({ a:({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f2 (void) { goto a; ({ ({a:0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa2 (void) { p0A:goto p0A; goto a; P0A:goto P0A;({ P01A:goto P01A;({a:0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f3 (void) { goto a; ({ ({0;}); a:({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa3 (void) { p0A:goto p0A; goto a; P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); a:({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f4 (void) { goto a; ({ ({0;}); ({a:0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa4 (void) { p0A:goto p0A; goto a; P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({a:0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f5 (void) { goto a; ({ ({0;}); ({0;}); a:0;}); ({ ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa5 (void) { p0A:goto p0A; goto a; P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); a:0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f6 (void) { goto a; ({ ({0;}); ({0;}); 0;}); a:({ ({0;}); ({0;}); 0;}); 0; } +void fa6 (void) { p0A:goto p0A; goto a; P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); a:({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f7 (void) { goto a; ({ ({0;}); ({0;}); 0;}); ({ a:({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa7 (void) { p0A:goto p0A; goto a; P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ a:({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f8 (void) { goto a; ({ ({0;}); ({0;}); 0;}); ({ ({a:0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa8 (void) { p0A:goto p0A; goto a; P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({a:0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f9 (void) { goto a; ({ ({0;}); ({0;}); 0;}); ({ ({0;}); a:({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa9 (void) { p0A:goto p0A; goto a; P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); a:({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f10 (void) { goto a; ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({a:0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa10 (void) { p0A:goto p0A; goto a; P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({a:0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f11 (void) { goto a; ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); a:0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa11 (void) { p0A:goto p0A; goto a; P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); a:0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f12 (void) { goto a; ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); a:0; } +void fa12 (void) { p0A:goto p0A; goto a; P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); a:0;P0D:goto P0D; } +void f13 (void) { a: goto a; ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa13 (void) { a: goto a; P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f14 (void) { a:({ goto a; ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa14 (void) { a:({ p01A:goto p01A; goto a; P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f15 (void) { ({ goto a; a:({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa15 (void) { P0A:goto P0A;({ p01A:goto p01A; goto a; a:({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f16 (void) { ({ goto a; ({a:0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa16 (void) { P0A:goto P0A;({ p01A:goto p01A; goto a; P01A:goto P01A;({a:0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f17 (void) { ({ goto a; ({0;}); a:({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa17 (void) { P0A:goto P0A;({ p01A:goto p01A; goto a; P01A:goto P01A;({P012A:goto P012A;0;}); a:({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f18 (void) { ({ goto a; ({0;}); ({a:0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa18 (void) { P0A:goto P0A;({ p01A:goto p01A; goto a; P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({a:0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f19 (void) { ({ goto a; ({0;}); ({0;}); a:0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa19 (void) { P0A:goto P0A;({ p01A:goto p01A; goto a; P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); a:0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f20 (void) { ({ goto a; ({0;}); ({0;}); 0;}); a:({ ({0;}); ({0;}); 0;}); 0; } +void fa20 (void) { P0A:goto P0A;({ p01A:goto p01A; goto a; P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); a:({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f21 (void) { ({ goto a; ({0;}); ({0;}); 0;}); ({ a:({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa21 (void) { P0A:goto P0A;({ p01A:goto p01A; goto a; P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ a:({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f22 (void) { ({ goto a; ({0;}); ({0;}); 0;}); ({ ({a:0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa22 (void) { P0A:goto P0A;({ p01A:goto p01A; goto a; P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({a:0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f23 (void) { ({ goto a; ({0;}); ({0;}); 0;}); ({ ({0;}); a:({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa23 (void) { P0A:goto P0A;({ p01A:goto p01A; goto a; P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); a:({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f24 (void) { ({ goto a; ({0;}); ({0;}); 0;}); ({ ({0;}); ({a:0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa24 (void) { P0A:goto P0A;({ p01A:goto p01A; goto a; P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({a:0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f25 (void) { ({ goto a; ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); a:0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa25 (void) { P0A:goto P0A;({ p01A:goto p01A; goto a; P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); a:0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f26 (void) { ({ goto a; ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); a:0; } +void fa26 (void) { P0A:goto P0A;({ p01A:goto p01A; goto a; P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); a:0;P0D:goto P0D; } +void f27 (void) { ({ a: goto a; ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa27 (void) { P0A:goto P0A;({ a: goto a; P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f28 (void) { a:({ ({ goto a; 0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa28 (void) { a:({ P01A:goto P01A;({p012A:goto p012A; goto a; P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f29 (void) { ({ a:({ goto a; 0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa29 (void) { P0A:goto P0A;({ a:({p012A:goto p012A; goto a; P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f30 (void) { ({ ({ goto a; a:0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa30 (void) { P0A:goto P0A;({ P01A:goto P01A;({p012A:goto p012A; goto a; a:0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f31 (void) { ({ ({ goto a; 0;}); a:({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa31 (void) { P0A:goto P0A;({ P01A:goto P01A;({p012A:goto p012A; goto a; P012A:goto P012A;0;}); a:({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f32 (void) { ({ ({ goto a; 0;}); ({a:0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa32 (void) { P0A:goto P0A;({ P01A:goto P01A;({p012A:goto p012A; goto a; P012A:goto P012A;0;}); P01B:goto P01B;({a:0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f33 (void) { ({ ({ goto a; 0;}); ({0;}); a:0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa33 (void) { P0A:goto P0A;({ P01A:goto P01A;({p012A:goto p012A; goto a; P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); a:0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f34 (void) { ({ ({ goto a; 0;}); ({0;}); 0;}); a:({ ({0;}); ({0;}); 0;}); 0; } +void fa34 (void) { P0A:goto P0A;({ P01A:goto P01A;({p012A:goto p012A; goto a; P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); a:({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f35 (void) { ({ ({ goto a; 0;}); ({0;}); 0;}); ({ a:({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa35 (void) { P0A:goto P0A;({ P01A:goto P01A;({p012A:goto p012A; goto a; P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ a:({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f36 (void) { ({ ({ goto a; 0;}); ({0;}); 0;}); ({ ({a:0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa36 (void) { P0A:goto P0A;({ P01A:goto P01A;({p012A:goto p012A; goto a; P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({a:0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f37 (void) { ({ ({ goto a; 0;}); ({0;}); 0;}); ({ ({0;}); a:({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa37 (void) { P0A:goto P0A;({ P01A:goto P01A;({p012A:goto p012A; goto a; P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); a:({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f38 (void) { ({ ({ goto a; 0;}); ({0;}); 0;}); ({ ({0;}); ({a:0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa38 (void) { P0A:goto P0A;({ P01A:goto P01A;({p012A:goto p012A; goto a; P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({a:0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f39 (void) { ({ ({ goto a; 0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); a:0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa39 (void) { P0A:goto P0A;({ P01A:goto P01A;({p012A:goto p012A; goto a; P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); a:0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f40 (void) { ({ ({ goto a; 0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); a:0; } +void fa40 (void) { P0A:goto P0A;({ P01A:goto P01A;({p012A:goto p012A; goto a; P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); a:0;P0D:goto P0D; } +void f41 (void) { ({ ({a: goto a; 0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa41 (void) { P0A:goto P0A;({ P01A:goto P01A;({a: goto a; P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f42 (void) { a:({ ({0;}); goto a; ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa42 (void) { a:({ P01A:goto P01A;({P012A:goto P012A;0;}); p01B:goto p01B; goto a; P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f43 (void) { ({ a:({0;}); goto a; ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa43 (void) { P0A:goto P0A;({ a:({P012A:goto P012A;0;}); p01B:goto p01B; goto a; P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f44 (void) { ({ ({a:0;}); goto a; ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa44 (void) { P0A:goto P0A;({ P01A:goto P01A;({a:0;}); p01B:goto p01B; goto a; P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f45 (void) { ({ ({0;}); goto a; a:({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa45 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); p01B:goto p01B; goto a; a:({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f46 (void) { ({ ({0;}); goto a; ({a:0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa46 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); p01B:goto p01B; goto a; P01B:goto P01B;({a:0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f47 (void) { ({ ({0;}); goto a; ({0;}); a:0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa47 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); p01B:goto p01B; goto a; P01B:goto P01B;({P013A:goto P013A;0;}); a:0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f48 (void) { ({ ({0;}); goto a; ({0;}); 0;}); a:({ ({0;}); ({0;}); 0;}); 0; } +void fa48 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); p01B:goto p01B; goto a; P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); a:({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f49 (void) { ({ ({0;}); goto a; ({0;}); 0;}); ({ a:({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa49 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); p01B:goto p01B; goto a; P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ a:({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f50 (void) { ({ ({0;}); goto a; ({0;}); 0;}); ({ ({a:0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa50 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); p01B:goto p01B; goto a; P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({a:0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f51 (void) { ({ ({0;}); goto a; ({0;}); 0;}); ({ ({0;}); a:({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa51 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); p01B:goto p01B; goto a; P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); a:({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f52 (void) { ({ ({0;}); goto a; ({0;}); 0;}); ({ ({0;}); ({a:0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa52 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); p01B:goto p01B; goto a; P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({a:0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f53 (void) { ({ ({0;}); goto a; ({0;}); 0;}); ({ ({0;}); ({0;}); a:0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa53 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); p01B:goto p01B; goto a; P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); a:0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f54 (void) { ({ ({0;}); goto a; ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); a:0; } +void fa54 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); p01B:goto p01B; goto a; P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); a:0;P0D:goto P0D; } +void f55 (void) { ({ ({0;}); a: goto a; ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa55 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); a: goto a; P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f56 (void) { a:({ ({0;}); ({ goto a; 0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa56 (void) { a:({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({p013A:goto p013A; goto a; P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f57 (void) { ({ a:({0;}); ({ goto a; 0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa57 (void) { P0A:goto P0A;({ a:({P012A:goto P012A;0;}); P01B:goto P01B;({p013A:goto p013A; goto a; P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f58 (void) { ({ ({a:0;}); ({ goto a; 0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa58 (void) { P0A:goto P0A;({ P01A:goto P01A;({a:0;}); P01B:goto P01B;({p013A:goto p013A; goto a; P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f59 (void) { ({ ({0;}); a:({ goto a; 0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa59 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); a:({p013A:goto p013A; goto a; P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f60 (void) { ({ ({0;}); ({ goto a; a:0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa60 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({p013A:goto p013A; goto a; a:0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f61 (void) { ({ ({0;}); ({ goto a; 0;}); a:0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa61 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({p013A:goto p013A; goto a; P013A:goto P013A;0;}); a:0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f62 (void) { ({ ({0;}); ({ goto a; 0;}); 0;}); a:({ ({0;}); ({0;}); 0;}); 0; } +void fa62 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({p013A:goto p013A; goto a; P013A:goto P013A;0;}); P01C:goto P01C;0;}); a:({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f63 (void) { ({ ({0;}); ({ goto a; 0;}); 0;}); ({ a:({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa63 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({p013A:goto p013A; goto a; P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ a:({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f64 (void) { ({ ({0;}); ({ goto a; 0;}); 0;}); ({ ({a:0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa64 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({p013A:goto p013A; goto a; P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({a:0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f65 (void) { ({ ({0;}); ({ goto a; 0;}); 0;}); ({ ({0;}); a:({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa65 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({p013A:goto p013A; goto a; P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); a:({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f66 (void) { ({ ({0;}); ({ goto a; 0;}); 0;}); ({ ({0;}); ({a:0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa66 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({p013A:goto p013A; goto a; P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({a:0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f67 (void) { ({ ({0;}); ({ goto a; 0;}); 0;}); ({ ({0;}); ({0;}); a:0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa67 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({p013A:goto p013A; goto a; P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); a:0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f68 (void) { ({ ({0;}); ({ goto a; 0;}); 0;}); ({ ({0;}); ({0;}); 0;}); a:0; } +void fa68 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({p013A:goto p013A; goto a; P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); a:0;P0D:goto P0D; } +void f69 (void) { ({ ({0;}); ({a: goto a; 0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa69 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({a: goto a; P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f70 (void) { a:({ ({0;}); ({0;}); goto a; 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa70 (void) { a:({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); p01C:goto p01C; goto a; P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f71 (void) { ({ a:({0;}); ({0;}); goto a; 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa71 (void) { P0A:goto P0A;({ a:({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); p01C:goto p01C; goto a; P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f72 (void) { ({ ({a:0;}); ({0;}); goto a; 0;}); ({ ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa72 (void) { P0A:goto P0A;({ P01A:goto P01A;({a:0;}); P01B:goto P01B;({P013A:goto P013A;0;}); p01C:goto p01C; goto a; P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f73 (void) { ({ ({0;}); a:({0;}); goto a; 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa73 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); a:({P013A:goto P013A;0;}); p01C:goto p01C; goto a; P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f74 (void) { ({ ({0;}); ({a:0;}); goto a; 0;}); ({ ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa74 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({a:0;}); p01C:goto p01C; goto a; P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f75 (void) { ({ ({0;}); ({0;}); goto a; a:0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa75 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); p01C:goto p01C; goto a; a:0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f76 (void) { ({ ({0;}); ({0;}); goto a; 0;}); a:({ ({0;}); ({0;}); 0;}); 0; } +void fa76 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); p01C:goto p01C; goto a; P01C:goto P01C;0;}); a:({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f77 (void) { ({ ({0;}); ({0;}); goto a; 0;}); ({ a:({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa77 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); p01C:goto p01C; goto a; P01C:goto P01C;0;}); P0B:goto P0B;({ a:({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f78 (void) { ({ ({0;}); ({0;}); goto a; 0;}); ({ ({a:0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa78 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); p01C:goto p01C; goto a; P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({a:0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f79 (void) { ({ ({0;}); ({0;}); goto a; 0;}); ({ ({0;}); a:({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa79 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); p01C:goto p01C; goto a; P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); a:({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f80 (void) { ({ ({0;}); ({0;}); goto a; 0;}); ({ ({0;}); ({a:0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa80 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); p01C:goto p01C; goto a; P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({a:0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f81 (void) { ({ ({0;}); ({0;}); goto a; 0;}); ({ ({0;}); ({0;}); a:0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa81 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); p01C:goto p01C; goto a; P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); a:0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f82 (void) { ({ ({0;}); ({0;}); goto a; 0;}); ({ ({0;}); ({0;}); 0;}); a:0; } +void fa82 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); p01C:goto p01C; goto a; P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); a:0;P0D:goto P0D; } +void f83 (void) { ({ ({0;}); ({0;}); a: goto a; 0;}); ({ ({0;}); ({0;}); 0;}); 0; } +void fa83 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); a: goto a; P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f84 (void) { a:({ ({0;}); ({0;}); 0;}); goto a; ({ ({0;}); ({0;}); 0;}); 0; } +void fa84 (void) { a:({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); p0B:goto p0B; goto a; P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f85 (void) { ({ a:({0;}); ({0;}); 0;}); goto a; ({ ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa85 (void) { P0A:goto P0A;({ a:({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); p0B:goto p0B; goto a; P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f86 (void) { ({ ({a:0;}); ({0;}); 0;}); goto a; ({ ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa86 (void) { P0A:goto P0A;({ P01A:goto P01A;({a:0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); p0B:goto p0B; goto a; P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f87 (void) { ({ ({0;}); a:({0;}); 0;}); goto a; ({ ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa87 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); a:({P013A:goto P013A;0;}); P01C:goto P01C;0;}); p0B:goto p0B; goto a; P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f88 (void) { ({ ({0;}); ({a:0;}); 0;}); goto a; ({ ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa88 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({a:0;}); P01C:goto P01C;0;}); p0B:goto p0B; goto a; P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f89 (void) { ({ ({0;}); ({0;}); a:0;}); goto a; ({ ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa89 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); a:0;}); p0B:goto p0B; goto a; P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f90 (void) { ({ ({0;}); ({0;}); 0;}); goto a; a:({ ({0;}); ({0;}); 0;}); 0; } +void fa90 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); p0B:goto p0B; goto a; a:({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f91 (void) { ({ ({0;}); ({0;}); 0;}); goto a; ({ a:({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa91 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); p0B:goto p0B; goto a; P0B:goto P0B;({ a:({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f92 (void) { ({ ({0;}); ({0;}); 0;}); goto a; ({ ({a:0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa92 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); p0B:goto p0B; goto a; P0B:goto P0B;({ P02A:goto P02A;({a:0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f93 (void) { ({ ({0;}); ({0;}); 0;}); goto a; ({ ({0;}); a:({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa93 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); p0B:goto p0B; goto a; P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); a:({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f94 (void) { ({ ({0;}); ({0;}); 0;}); goto a; ({ ({0;}); ({a:0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa94 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); p0B:goto p0B; goto a; P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({a:0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f95 (void) { ({ ({0;}); ({0;}); 0;}); goto a; ({ ({0;}); ({0;}); a:0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa95 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); p0B:goto p0B; goto a; P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); a:0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f96 (void) { ({ ({0;}); ({0;}); 0;}); goto a; ({ ({0;}); ({0;}); 0;}); a:0; } +void fa96 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); p0B:goto p0B; goto a; P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); a:0;P0D:goto P0D; } +void f97 (void) { ({ ({0;}); ({0;}); 0;}); a: goto a; ({ ({0;}); ({0;}); 0;}); 0; } +void fa97 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); a: goto a; P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f98 (void) { a:({ ({0;}); ({0;}); 0;}); ({ goto a; ({0;}); ({0;}); 0;}); 0; } +void fa98 (void) { a:({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ p02A:goto p02A; goto a; P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f99 (void) { ({ a:({0;}); ({0;}); 0;}); ({ goto a; ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa99 (void) { P0A:goto P0A;({ a:({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ p02A:goto p02A; goto a; P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f100 (void) { ({ ({a:0;}); ({0;}); 0;}); ({ goto a; ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa100 (void) { P0A:goto P0A;({ P01A:goto P01A;({a:0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ p02A:goto p02A; goto a; P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f101 (void) { ({ ({0;}); a:({0;}); 0;}); ({ goto a; ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa101 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); a:({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ p02A:goto p02A; goto a; P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f102 (void) { ({ ({0;}); ({a:0;}); 0;}); ({ goto a; ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa102 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({a:0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ p02A:goto p02A; goto a; P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f103 (void) { ({ ({0;}); ({0;}); a:0;}); ({ goto a; ({0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa103 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); a:0;}); P0B:goto P0B;({ p02A:goto p02A; goto a; P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f104 (void) { ({ ({0;}); ({0;}); 0;}); a:({ goto a; ({0;}); ({0;}); 0;}); 0; } +void fa104 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); a:({ p02A:goto p02A; goto a; P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f105 (void) { ({ ({0;}); ({0;}); 0;}); ({ goto a; a:({0;}); ({0;}); 0;}); 0; } +void fa105 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ p02A:goto p02A; goto a; a:({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f106 (void) { ({ ({0;}); ({0;}); 0;}); ({ goto a; ({a:0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa106 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ p02A:goto p02A; goto a; P02A:goto P02A;({a:0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f107 (void) { ({ ({0;}); ({0;}); 0;}); ({ goto a; ({0;}); a:({0;}); 0;}); 0; } +void fa107 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ p02A:goto p02A; goto a; P02A:goto P02A;({P024A:goto P024A;0;}); a:({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f108 (void) { ({ ({0;}); ({0;}); 0;}); ({ goto a; ({0;}); ({a:0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa108 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ p02A:goto p02A; goto a; P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({a:0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f109 (void) { ({ ({0;}); ({0;}); 0;}); ({ goto a; ({0;}); ({0;}); a:0;}); 0; } +void fa109 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ p02A:goto p02A; goto a; P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); a:0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f110 (void) { ({ ({0;}); ({0;}); 0;}); ({ goto a; ({0;}); ({0;}); 0;}); a:0; } +void fa110 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ p02A:goto p02A; goto a; P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); a:0;P0D:goto P0D; } +void f111 (void) { ({ ({0;}); ({0;}); 0;}); ({ a: goto a; ({0;}); ({0;}); 0;}); 0; } +void fa111 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ a: goto a; P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f112 (void) { a:({ ({0;}); ({0;}); 0;}); ({ ({ goto a; 0;}); ({0;}); 0;}); 0; } +void fa112 (void) { a:({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({p024A:goto p024A; goto a; P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f113 (void) { ({ a:({0;}); ({0;}); 0;}); ({ ({ goto a; 0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa113 (void) { P0A:goto P0A;({ a:({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({p024A:goto p024A; goto a; P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f114 (void) { ({ ({a:0;}); ({0;}); 0;}); ({ ({ goto a; 0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa114 (void) { P0A:goto P0A;({ P01A:goto P01A;({a:0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({p024A:goto p024A; goto a; P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f115 (void) { ({ ({0;}); a:({0;}); 0;}); ({ ({ goto a; 0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa115 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); a:({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({p024A:goto p024A; goto a; P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f116 (void) { ({ ({0;}); ({a:0;}); 0;}); ({ ({ goto a; 0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa116 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({a:0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({p024A:goto p024A; goto a; P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f117 (void) { ({ ({0;}); ({0;}); a:0;}); ({ ({ goto a; 0;}); ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa117 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); a:0;}); P0B:goto P0B;({ P02A:goto P02A;({p024A:goto p024A; goto a; P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f118 (void) { ({ ({0;}); ({0;}); 0;}); a:({ ({ goto a; 0;}); ({0;}); 0;}); 0; } +void fa118 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); a:({ P02A:goto P02A;({p024A:goto p024A; goto a; P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f119 (void) { ({ ({0;}); ({0;}); 0;}); ({ a:({ goto a; 0;}); ({0;}); 0;}); 0; } +void fa119 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ a:({p024A:goto p024A; goto a; P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f120 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({ goto a; a:0;}); ({0;}); 0;}); 0; } +void fa120 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({p024A:goto p024A; goto a; a:0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f121 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({ goto a; 0;}); a:({0;}); 0;}); 0; } +void fa121 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({p024A:goto p024A; goto a; P024A:goto P024A;0;}); a:({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f122 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({ goto a; 0;}); ({a:0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa122 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({p024A:goto p024A; goto a; P024A:goto P024A;0;}); P02B:goto P02B;({a:0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f123 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({ goto a; 0;}); ({0;}); a:0;}); 0; } +void fa123 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({p024A:goto p024A; goto a; P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); a:0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f124 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({ goto a; 0;}); ({0;}); 0;}); a:0; } +void fa124 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({p024A:goto p024A; goto a; P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); a:0;P0D:goto P0D; } +void f125 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({a: goto a; 0;}); ({0;}); 0;}); 0; } +void fa125 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({a: goto a; P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f126 (void) { a:({ ({0;}); ({0;}); 0;}); ({ ({0;}); goto a; ({0;}); 0;}); 0; } +void fa126 (void) { a:({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); p02B:goto p02B; goto a; P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f127 (void) { ({ a:({0;}); ({0;}); 0;}); ({ ({0;}); goto a; ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa127 (void) { P0A:goto P0A;({ a:({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); p02B:goto p02B; goto a; P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f128 (void) { ({ ({a:0;}); ({0;}); 0;}); ({ ({0;}); goto a; ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa128 (void) { P0A:goto P0A;({ P01A:goto P01A;({a:0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); p02B:goto p02B; goto a; P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f129 (void) { ({ ({0;}); a:({0;}); 0;}); ({ ({0;}); goto a; ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa129 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); a:({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); p02B:goto p02B; goto a; P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f130 (void) { ({ ({0;}); ({a:0;}); 0;}); ({ ({0;}); goto a; ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa130 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({a:0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); p02B:goto p02B; goto a; P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f131 (void) { ({ ({0;}); ({0;}); a:0;}); ({ ({0;}); goto a; ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa131 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); a:0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); p02B:goto p02B; goto a; P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f132 (void) { ({ ({0;}); ({0;}); 0;}); a:({ ({0;}); goto a; ({0;}); 0;}); 0; } +void fa132 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); a:({ P02A:goto P02A;({P024A:goto P024A;0;}); p02B:goto p02B; goto a; P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f133 (void) { ({ ({0;}); ({0;}); 0;}); ({ a:({0;}); goto a; ({0;}); 0;}); 0; } +void fa133 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ a:({P024A:goto P024A;0;}); p02B:goto p02B; goto a; P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f134 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({a:0;}); goto a; ({0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa134 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({a:0;}); p02B:goto p02B; goto a; P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f135 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); goto a; a:({0;}); 0;}); 0; } +void fa135 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); p02B:goto p02B; goto a; a:({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f136 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); goto a; ({a:0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa136 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); p02B:goto p02B; goto a; P02B:goto P02B;({a:0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f137 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); goto a; ({0;}); a:0;}); 0; } +void fa137 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); p02B:goto p02B; goto a; P02B:goto P02B;({P025A:goto P025A;0;}); a:0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f138 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); goto a; ({0;}); 0;}); a:0; } +void fa138 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); p02B:goto p02B; goto a; P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); a:0;P0D:goto P0D; } +void f139 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); a: goto a; ({0;}); 0;}); 0; } +void fa139 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); a: goto a; P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f140 (void) { a:({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({ goto a; 0;}); 0;}); 0; } +void fa140 (void) { a:({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({p025A:goto p025A; goto a; P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f141 (void) { ({ a:({0;}); ({0;}); 0;}); ({ ({0;}); ({ goto a; 0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa141 (void) { P0A:goto P0A;({ a:({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({p025A:goto p025A; goto a; P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f142 (void) { ({ ({a:0;}); ({0;}); 0;}); ({ ({0;}); ({ goto a; 0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa142 (void) { P0A:goto P0A;({ P01A:goto P01A;({a:0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({p025A:goto p025A; goto a; P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f143 (void) { ({ ({0;}); a:({0;}); 0;}); ({ ({0;}); ({ goto a; 0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa143 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); a:({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({p025A:goto p025A; goto a; P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f144 (void) { ({ ({0;}); ({a:0;}); 0;}); ({ ({0;}); ({ goto a; 0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa144 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({a:0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({p025A:goto p025A; goto a; P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f145 (void) { ({ ({0;}); ({0;}); a:0;}); ({ ({0;}); ({ goto a; 0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa145 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); a:0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({p025A:goto p025A; goto a; P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f146 (void) { ({ ({0;}); ({0;}); 0;}); a:({ ({0;}); ({ goto a; 0;}); 0;}); 0; } +void fa146 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); a:({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({p025A:goto p025A; goto a; P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f147 (void) { ({ ({0;}); ({0;}); 0;}); ({ a:({0;}); ({ goto a; 0;}); 0;}); 0; } +void fa147 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ a:({P024A:goto P024A;0;}); P02B:goto P02B;({p025A:goto p025A; goto a; P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f148 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({a:0;}); ({ goto a; 0;}); 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa148 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({a:0;}); P02B:goto P02B;({p025A:goto p025A; goto a; P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f149 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); a:({ goto a; 0;}); 0;}); 0; } +void fa149 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); a:({p025A:goto p025A; goto a; P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f150 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({ goto a; a:0;}); 0;}); 0; } +void fa150 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({p025A:goto p025A; goto a; a:0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f151 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({ goto a; 0;}); a:0;}); 0; } +void fa151 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({p025A:goto p025A; goto a; P025A:goto P025A;0;}); a:0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f152 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({ goto a; 0;}); 0;}); a:0; } +void fa152 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({p025A:goto p025A; goto a; P025A:goto P025A;0;}); P02C:goto P02C;0;}); a:0;P0D:goto P0D; } +void f153 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({a: goto a; 0;}); 0;}); 0; } +void fa153 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({a: goto a; P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f154 (void) { a:({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); goto a; 0;}); 0; } +void fa154 (void) { a:({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); p02C:goto p02C; goto a; P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f155 (void) { ({ a:({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); goto a; 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa155 (void) { P0A:goto P0A;({ a:({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); p02C:goto p02C; goto a; P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f156 (void) { ({ ({a:0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); goto a; 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa156 (void) { P0A:goto P0A;({ P01A:goto P01A;({a:0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); p02C:goto p02C; goto a; P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f157 (void) { ({ ({0;}); a:({0;}); 0;}); ({ ({0;}); ({0;}); goto a; 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa157 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); a:({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); p02C:goto p02C; goto a; P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f158 (void) { ({ ({0;}); ({a:0;}); 0;}); ({ ({0;}); ({0;}); goto a; 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa158 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({a:0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); p02C:goto p02C; goto a; P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f159 (void) { ({ ({0;}); ({0;}); a:0;}); ({ ({0;}); ({0;}); goto a; 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa159 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); a:0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); p02C:goto p02C; goto a; P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f160 (void) { ({ ({0;}); ({0;}); 0;}); a:({ ({0;}); ({0;}); goto a; 0;}); 0; } +void fa160 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); a:({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); p02C:goto p02C; goto a; P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f161 (void) { ({ ({0;}); ({0;}); 0;}); ({ a:({0;}); ({0;}); goto a; 0;}); 0; } +void fa161 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ a:({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); p02C:goto p02C; goto a; P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f162 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({a:0;}); ({0;}); goto a; 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa162 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({a:0;}); P02B:goto P02B;({P025A:goto P025A;0;}); p02C:goto p02C; goto a; P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f163 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); a:({0;}); goto a; 0;}); 0; } +void fa163 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); a:({P025A:goto P025A;0;}); p02C:goto p02C; goto a; P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f164 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({a:0;}); goto a; 0;}); 0; } /* { dg-error "error: jump into statement expression" } */ +void fa164 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({a:0;}); p02C:goto p02C; goto a; P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f165 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); goto a; a:0;}); 0; } +void fa165 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); p02C:goto p02C; goto a; a:0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f166 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); goto a; 0;}); a:0; } +void fa166 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); p02C:goto p02C; goto a; P02C:goto P02C;0;}); a:0;P0D:goto P0D; } +void f167 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); a: goto a; 0;}); 0; } +void fa167 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); a: goto a; P02C:goto P02C;0;}); P0C:goto P0C;0;P0D:goto P0D; } +void f168 (void) { a:({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); goto a; 0; } +void fa168 (void) { a:({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); p0C:goto p0C; goto a; P0C:goto P0C;0;P0D:goto P0D; } +void f169 (void) { ({ a:({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); goto a; 0; } /* { dg-error "error: jump into statement expression" } */ +void fa169 (void) { P0A:goto P0A;({ a:({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); p0C:goto p0C; goto a; P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f170 (void) { ({ ({a:0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); goto a; 0; } /* { dg-error "error: jump into statement expression" } */ +void fa170 (void) { P0A:goto P0A;({ P01A:goto P01A;({a:0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); p0C:goto p0C; goto a; P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f171 (void) { ({ ({0;}); a:({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); goto a; 0; } /* { dg-error "error: jump into statement expression" } */ +void fa171 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); a:({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); p0C:goto p0C; goto a; P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f172 (void) { ({ ({0;}); ({a:0;}); 0;}); ({ ({0;}); ({0;}); 0;}); goto a; 0; } /* { dg-error "error: jump into statement expression" } */ +void fa172 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({a:0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); p0C:goto p0C; goto a; P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f173 (void) { ({ ({0;}); ({0;}); a:0;}); ({ ({0;}); ({0;}); 0;}); goto a; 0; } /* { dg-error "error: jump into statement expression" } */ +void fa173 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); a:0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); p0C:goto p0C; goto a; P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f174 (void) { ({ ({0;}); ({0;}); 0;}); a:({ ({0;}); ({0;}); 0;}); goto a; 0; } +void fa174 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); a:({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); p0C:goto p0C; goto a; P0C:goto P0C;0;P0D:goto P0D; } +void f175 (void) { ({ ({0;}); ({0;}); 0;}); ({ a:({0;}); ({0;}); 0;}); goto a; 0; } /* { dg-error "error: jump into statement expression" } */ +void fa175 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ a:({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); p0C:goto p0C; goto a; P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f176 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({a:0;}); ({0;}); 0;}); goto a; 0; } /* { dg-error "error: jump into statement expression" } */ +void fa176 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({a:0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); p0C:goto p0C; goto a; P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f177 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); a:({0;}); 0;}); goto a; 0; } /* { dg-error "error: jump into statement expression" } */ +void fa177 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); a:({P025A:goto P025A;0;}); P02C:goto P02C;0;}); p0C:goto p0C; goto a; P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f178 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({a:0;}); 0;}); goto a; 0; } /* { dg-error "error: jump into statement expression" } */ +void fa178 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({a:0;}); P02C:goto P02C;0;}); p0C:goto p0C; goto a; P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f179 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); a:0;}); goto a; 0; } /* { dg-error "error: jump into statement expression" } */ +void fa179 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); a:0;}); p0C:goto p0C; goto a; P0C:goto P0C;0;P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f180 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); goto a; a:0; } +void fa180 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); p0C:goto p0C; goto a; a:0;P0D:goto P0D; } +void f181 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); a: goto a; 0; } +void fa181 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); a: goto a; P0C:goto P0C;0;P0D:goto P0D; } +void f182 (void) { a:({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; goto a; } +void fa182 (void) { a:({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;p0D:goto p0D; goto a; P0D:goto P0D; } +void f183 (void) { ({ a:({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; goto a; } /* { dg-error "error: jump into statement expression" } */ +void fa183 (void) { P0A:goto P0A;({ a:({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;p0D:goto p0D; goto a; P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f184 (void) { ({ ({a:0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; goto a; } /* { dg-error "error: jump into statement expression" } */ +void fa184 (void) { P0A:goto P0A;({ P01A:goto P01A;({a:0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;p0D:goto p0D; goto a; P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f185 (void) { ({ ({0;}); a:({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; goto a; } /* { dg-error "error: jump into statement expression" } */ +void fa185 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); a:({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;p0D:goto p0D; goto a; P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f186 (void) { ({ ({0;}); ({a:0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0; goto a; } /* { dg-error "error: jump into statement expression" } */ +void fa186 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({a:0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;p0D:goto p0D; goto a; P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f187 (void) { ({ ({0;}); ({0;}); a:0;}); ({ ({0;}); ({0;}); 0;}); 0; goto a; } /* { dg-error "error: jump into statement expression" } */ +void fa187 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); a:0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;p0D:goto p0D; goto a; P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f188 (void) { ({ ({0;}); ({0;}); 0;}); a:({ ({0;}); ({0;}); 0;}); 0; goto a; } +void fa188 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); a:({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;p0D:goto p0D; goto a; P0D:goto P0D; } +void f189 (void) { ({ ({0;}); ({0;}); 0;}); ({ a:({0;}); ({0;}); 0;}); 0; goto a; } /* { dg-error "error: jump into statement expression" } */ +void fa189 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ a:({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;p0D:goto p0D; goto a; P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f190 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({a:0;}); ({0;}); 0;}); 0; goto a; } /* { dg-error "error: jump into statement expression" } */ +void fa190 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({a:0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;p0D:goto p0D; goto a; P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f191 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); a:({0;}); 0;}); 0; goto a; } /* { dg-error "error: jump into statement expression" } */ +void fa191 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); a:({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;p0D:goto p0D; goto a; P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f192 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({a:0;}); 0;}); 0; goto a; } /* { dg-error "error: jump into statement expression" } */ +void fa192 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({a:0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;p0D:goto p0D; goto a; P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f193 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); a:0;}); 0; goto a; } /* { dg-error "error: jump into statement expression" } */ +void fa193 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); a:0;}); P0C:goto P0C;0;p0D:goto p0D; goto a; P0D:goto P0D; } /* { dg-error "error: jump into statement expression" } */ +void f194 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); a:0; goto a; } +void fa194 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); a:0;p0D:goto p0D; goto a; P0D:goto P0D; } +void f195 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0;a: goto a; } +void fa195 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;a: goto a; P0D:goto P0D; } diff --git a/gcc/testsuite/gcc.dg/stmt-expr-label-2.c b/gcc/testsuite/gcc.dg/stmt-expr-label-2.c new file mode 100644 index 00000000000..863d610545c --- /dev/null +++ b/gcc/testsuite/gcc.dg/stmt-expr-label-2.c @@ -0,0 +1,27 @@ +/* Test for labels in statement expressions: bugs 772 and 17913. + switch statements must not jump into statement expressions. */ + +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void +f (int a) +{ + switch (a) + { + case 0: + case 1: + ({ + case 2: /* { dg-error "error: case label in statement expression not containing enclosing switch statement" } */ + default: /* { dg-error "error: 'default' label in statement expression not containing enclosing switch statement" } */ + switch (a) + { + case 3: + default: + ; + } + 0; + }); + } +} diff --git a/gcc/testsuite/gcc.dg/stmt-expr-label-3.c b/gcc/testsuite/gcc.dg/stmt-expr-label-3.c new file mode 100644 index 00000000000..09258069522 --- /dev/null +++ b/gcc/testsuite/gcc.dg/stmt-expr-label-3.c @@ -0,0 +1,8 @@ +/* Test for labels in statement expressions: bugs 772 and 17913. + Test the particular case of bug 17913. */ + +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +void f(void) { 1 ? 1 : ({ a : 1; 1; }); goto a; } /* { dg-error "error: jump into statement expression" } */ diff --git a/gcc/testsuite/gcc.dg/titype-1.c b/gcc/testsuite/gcc.dg/titype-1.c index d9f9da90756..1d0c570dafa 100644 --- a/gcc/testsuite/gcc.dg/titype-1.c +++ b/gcc/testsuite/gcc.dg/titype-1.c @@ -1,7 +1,7 @@ /* { dg-do run } */ /* Not all platforms support TImode integers. */ -#if defined(__LP64__) +#if defined(__LP64__) && !defined(__hppa__) typedef int TItype __attribute__ ((mode (TI))); #else typedef long TItype; diff --git a/gcc/testsuite/gcc.dg/torture/asm-subreg-1.c b/gcc/testsuite/gcc.dg/torture/asm-subreg-1.c new file mode 100644 index 00000000000..2a539208529 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/asm-subreg-1.c @@ -0,0 +1,14 @@ +/* PR middle-end/20491 */ + +/* { dg-do compile } */ + +/* Combine used to introduce invalid subregs for the asm input, and + we'd crash later on, when removing all subregs. */ + +volatile unsigned short _const_32 [4] = {1,2,3,4}; +void +evas_common_convert_yuv_420p_601_rgba() +{ + __asm__ __volatile__ ("" : : "X" (*_const_32)); +} + diff --git a/gcc/testsuite/gcc.dg/torture/badshift.c b/gcc/testsuite/gcc.dg/torture/badshift.c new file mode 100644 index 00000000000..dec71cfa2d1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/badshift.c @@ -0,0 +1,29 @@ +/* PR rtl-optimization/20532 */ + +/* { dg-do run } */ +/* { dg-options "" } */ +/* { dg-options "-march=i386" { target { i?86-*-* && ilp32 } } } */ + +/* We used to optimize the DImode shift-by-32 to zero because in combine + we turned: + + (v << 31) + (v << 31) + + into: + + (v * (((HOST_WIDE_INT)1 << 31) + ((HOST_WIDE_INT)1 << 31))) + + With a 32-bit HOST_WIDE_INT, the coefficient overflowed to zero. */ + +unsigned long long int badshift(unsigned long long int v) +{ + return v << 31 << 1; +} + +extern void abort (); + +int main() { + if (badshift (1) == 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/builtin-noret-1.c b/gcc/testsuite/gcc.dg/torture/builtin-noret-1.c index b8b970e5cb9..d3e97701f2b 100644 --- a/gcc/testsuite/gcc.dg/torture/builtin-noret-1.c +++ b/gcc/testsuite/gcc.dg/torture/builtin-noret-1.c @@ -2,6 +2,7 @@ /* Origin: Joseph Myers <jsm28@cam.ac.uk> */ /* { dg-options "-multiply_defined suppress" { target powerpc-*-darwin* } } */ /* { dg-do link } */ +/* { dg-require-weak "" } */ extern void abort (void); extern void exit (int); diff --git a/gcc/testsuite/gcc.dg/torture/builtin-noret-2.c b/gcc/testsuite/gcc.dg/torture/builtin-noret-2.c index c8c8609f62c..1103e3d8120 100644 --- a/gcc/testsuite/gcc.dg/torture/builtin-noret-2.c +++ b/gcc/testsuite/gcc.dg/torture/builtin-noret-2.c @@ -3,6 +3,7 @@ <zack@codesourcery.com>. */ /* { dg-options "-multiply_defined suppress" { target powerpc-*-darwin* } } */ /* { dg-do link } */ +/* { dg-require-weak "" } */ extern void tabort (void); extern void texit (void); diff --git a/gcc/testsuite/gcc.dg/torture/pr19683-1.c b/gcc/testsuite/gcc.dg/torture/pr19683-1.c new file mode 100644 index 00000000000..4015fb981e9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr19683-1.c @@ -0,0 +1,42 @@ +/* From PR rtl-optimization/19683. On little-endian MIPS targets, + reload would incorrectly inherit the high part of the multiplication + result. */ +/* { dg-do run { target mips*-*-* } } */ + +extern void abort (void); +extern void exit (int); + +#define REPEAT10(X, Y) \ + X(Y##0); X(Y##1); X(Y##2); X(Y##3); X(Y##4); \ + X(Y##5); X(Y##6); X(Y##7); X(Y##8); X(Y##9) + +#define REPEAT30(X) REPEAT10 (X, 0); REPEAT10 (X, 1); REPEAT10 (X, 2) +#define IN(X) unsigned int x##X = ptr[0] +#define OUT(X) ptr[0] = x##X + +union u { unsigned long long ll; unsigned int i[2]; }; + +unsigned int +foo (volatile unsigned int *ptr) +{ + union u u; + int result; + + u.ll = (unsigned long long) ptr[0] * ptr[0]; + REPEAT30 (IN); + REPEAT30 (OUT); + asm ("#" : "=l" (result) : "l" (u.i[1])); + return result; +} + +int +main (void) +{ + unsigned int array[] = { 1000 * 1000 * 1000 }; + union u u; + + u.ll = (unsigned long long) array[0] * array[0]; + if (foo (array) != u.i[1]) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr20314-1.c b/gcc/testsuite/gcc.dg/torture/pr20314-1.c new file mode 100644 index 00000000000..8a69c2dcaf5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr20314-1.c @@ -0,0 +1,56 @@ +/* PR inline-asm/20314 */ +/* { dg-do compile { target i?86-*-* x86_64-*-* powerpc*-*-* ia64-*-* } } */ + +int +f1 (void) +{ + int x = 4, y; + __asm__ volatile ("" : "+r,r" (x), "=r,r" (y) + : "%r,r" (x), "m,r" (8), "r,r" (2)); + return x; +} + +int +f2 (void) +{ + int x = 4, y; + __asm__ volatile ("" : "=r,r" (x), "=r,r" (y) + : "%0,0" (x), "m,r" (8), "r,r" (2)); + return x; +} + +int +f3 (void) +{ + int x = 4, y; + __asm__ volatile ("" : "+r,r" (x), "=r,r" (y) + : "%m,r" (8), "r,r" (2)); + return x; +} + +int +f4 (void) +{ + int x = 4, y; + __asm__ volatile ("" : "+r" (x), "=r" (y) + : "r" (x), "r" (8), "r" (2)); + return x; +} + +int +f5 (void) +{ + int x = 4, y; + __asm__ volatile ("" : "=r" (x), "=r" (y) + : "0" (x), "r" (8), "r" (2)); + return x; +} + +int +f6 (void) +{ + int x = 4, y; + __asm__ volatile ("" : "+r" (x), "=r" (y) + : "r" (8), "r" (2)); + return x; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr20314-2.c b/gcc/testsuite/gcc.dg/torture/pr20314-2.c new file mode 100644 index 00000000000..ad1b8f9724a --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr20314-2.c @@ -0,0 +1,47 @@ +/* PR inline-asm/20314 */ +/* { dg-do compile { target { x86_64-*-* && lp64 } } } */ +/* { dg-do compile { target ia64-*-* powerpc*-*-* } } */ + +int a, b, c, d, e, f, g, h, i, j, k, l; + +void +f1 (void) +{ + __asm__ volatile ("" + : [a] "+r" (a), [b] "+r" (b), [c] "+r" (c), [d] "+r" (d), + [e] "+r" (e), [f] "+r" (f), [g] "+r" (g), [h] "+r" (h), + [i] "+r" (i), [j] "+r" (j), [k] "+r" (k), [l] "+r" (l)); +} + +void +f2 (void) +{ + __asm__ volatile ("" + : [a] "+r,m" (a), [b] "+r,m" (b), [c] "+r,m" (c), [d] "+r,m" (d), + [e] "+r,m" (e), [f] "+r,m" (f), [g] "+r,m" (g), [h] "+r,m" (h), + [i] "+r,m" (i), [j] "+r,m" (j), [k] "+r,m" (k), [l] "+r,m" (l)); +} + +void +f3 (void) +{ + __asm__ volatile ("" + : [a] "=r" (a), [b] "=r" (b), [c] "=r" (c), [d] "=r" (d), + [e] "=r" (e), [f] "=r" (f), [g] "=r" (g), [h] "=r" (h), + [i] "=r" (i), [j] "=r" (j), [k] "=r" (k), [l] "=r" (l) + : "[a]" (a), "[b]" (b), "[c]" (c), "[d]" (d), + "[e]" (e), "[f]" (f), "[g]" (g), "[h]" (h), + "[i]" (i), "[j]" (j), "[k]" (k), "[l]" (l)); +} + +void +f4 (void) +{ + __asm__ volatile ("" + : [a] "=r,m" (a), [b] "=r,m" (b), [c] "=r,m" (c), [d] "=r,m" (d), + [e] "=r,m" (e), [f] "=r,m" (f), [g] "=r,m" (g), [h] "=r,m" (h), + [i] "=r,m" (i), [j] "=r,m" (j), [k] "=r,m" (k), [l] "=r,m" (l) + : "[a],m" (a), "[b],m" (b), "[c],m" (c), "[d],m" (d), + "[e],m" (e), "[f],m" (f), "[g],m" (g), "[h],m" (h), + "[i],m" (i), "[j],m" (j), "[k],m" (k), "[l],m" (l)); +} diff --git a/gcc/testsuite/gcc.dg/torture/tree-loop-1.c b/gcc/testsuite/gcc.dg/torture/tree-loop-1.c new file mode 100644 index 00000000000..1d38691780a --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/tree-loop-1.c @@ -0,0 +1,21 @@ +/* PR tree-optimization/20640 */ + +/* After unrolling the loop, we'd turn some conditional branches into + unconditional ones, but branch redirection would fail to compute + the PHI args for the PHI nodes in the replacement edge + destination, so they'd remain NULL causing crashes later on. */ + +/* { dg-do compile } */ + +static int a = 0; +extern int foo (void); +extern int *bar (void) __attribute__ ((__const__)); + +void +test (int x) +{ + int b = 10; + while (foo () == -1 && *bar () == 4 && b > 0) + --b; + a = x; +} diff --git a/gcc/testsuite/gcc.dg/transparent-union-1.c b/gcc/testsuite/gcc.dg/transparent-union-1.c new file mode 100644 index 00000000000..a5be8ce9186 --- /dev/null +++ b/gcc/testsuite/gcc.dg/transparent-union-1.c @@ -0,0 +1,83 @@ +/* PR c/20043 */ +/* { dg-compile } */ +/* { dg-options "-std=gnu99" } */ + +extern void f0 (int *); +extern void f0 (int *__restrict); + +extern void f1 (int *__restrict); +extern void f1 (int *); + +typedef union { int *i; long *l; } U2 + __attribute__((transparent_union)); +extern void f2 (U2); +extern void f2 (int *); + +typedef union { int *__restrict i; long *__restrict l; } U3 + __attribute__((transparent_union)); +extern void f3 (U3); +extern void f3 (int *__restrict); + +extern void f4 (U3); +extern void f4 (int *); + +extern void f5 (U2); +extern void f5 (int *__restrict); + +typedef union { long *l; int *i; } U6 + __attribute__((transparent_union)); +extern void f6 (U6); +extern void f6 (int *); + +typedef union { long *__restrict l; int *__restrict i; } U7 + __attribute__((transparent_union)); +extern void f7 (U7); +extern void f7 (int *__restrict); + +extern void f8 (U7); +extern void f8 (int *); + +extern void f9 (U6); +extern void f9 (int *__restrict); + +extern void f10 (U2); +extern void f11 (U3); +extern void f12 (U6); +extern void f13 (U7); + +int i; +long l; + +int +main (void) +{ + f0 (&i); + f0 (&l); /* { dg-warning "warning: passing argument 1 of 'f0' from incompatible pointer type" } */ + f1 (&i); + f1 (&l); /* { dg-warning "warning: passing argument 1 of 'f1' from incompatible pointer type" } */ + f2 (&i); + f2 (&l); /* { dg-warning "warning: passing argument 1 of 'f2' from incompatible pointer type" } */ + f3 (&i); + f3 (&l); /* { dg-warning "warning: passing argument 1 of 'f3' from incompatible pointer type" } */ + f4 (&i); + f4 (&l); /* { dg-warning "warning: passing argument 1 of 'f4' from incompatible pointer type" } */ + f5 (&i); + f5 (&l); /* { dg-warning "warning: passing argument 1 of 'f5' from incompatible pointer type" } */ + f6 (&i); + f6 (&l); /* { dg-warning "warning: passing argument 1 of 'f6' from incompatible pointer type" } */ + f7 (&i); + f7 (&l); /* { dg-warning "warning: passing argument 1 of 'f7' from incompatible pointer type" } */ + f8 (&i); + f8 (&l); /* { dg-warning "warning: passing argument 1 of 'f8' from incompatible pointer type" } */ + f9 (&i); + f9 (&l); /* { dg-warning "warning: passing argument 1 of 'f9' from incompatible pointer type" } */ + f10 (&i); + f10 (&l); + f11 (&i); + f11 (&l); + f12 (&i); + f12 (&l); + f13 (&i); + f13 (&l); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/transparent-union-2.c b/gcc/testsuite/gcc.dg/transparent-union-2.c new file mode 100644 index 00000000000..f466c4aa2be --- /dev/null +++ b/gcc/testsuite/gcc.dg/transparent-union-2.c @@ -0,0 +1,18 @@ +/* PR c/20043 */ +/* { dg-compile } */ +/* { dg-options "-std=gnu99" } */ + +typedef union { int *i; long *l; } U + __attribute__((transparent_union)); + +extern void f0 (U); /* { dg-error "previous declaration" } */ +extern void f0 (void *); /* { dg-error "conflicting types" } */ + +extern void f1 (U); /* { dg-error "previous declaration" } */ +extern void f1 (unsigned long); /* { dg-error "conflicting types" } */ + +extern void f2 (void *); /* { dg-error "previous declaration" } */ +extern void f2 (U); /* { dg-error "conflicting types" } */ + +extern void f3 (unsigned long); /* { dg-error "previous declaration" } */ +extern void f3 (U); /* { dg-error "conflicting types" } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/20040216-1.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/20040216-1.c new file mode 100644 index 00000000000..1d1784e011b --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/20040216-1.c @@ -0,0 +1,27 @@ +/* APPLE LOCAL file lno */ +/* Test dependence graph. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -floop-test -c -fdump-tree-all" } */ + +#define N 16 +void bar(int *); +void foo() +{ + int i,j; + int A[N]; + int X[N]; + int Y[N]; + int Z[N]; + + for (i=2; i<9; i++) + { + X[i] = Y[i] + Z[i]; + A[i] = X[i-1] + 1; + } + + bar (A); +} + +/* Find 4 Dependence nodes */ +/* { dg-final { scan-tree-dump-times "Dependence Node" 4 "lptest"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-01.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-01.c new file mode 100644 index 00000000000..b7ac0083fb4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-01.c @@ -0,0 +1,36 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + +int main(void) +{ + unsigned a; + int b; + int c; + + /* loop_1 runs exactly 4 times. */ + for (a = 22; a < 50; a+=1) + { + /* loop_2 runs exactly 6 times. On exit, the variable B is equal to 53. */ + for (b = 23; b < 50; b+=5) + { + ++a; + + /* loop_3 runs {{77, +, -7}_1, +, -1}_2 times. */ + for (c = a; c < 100; c++) + { + + } + } + } +} + +/* The analyzer has to detect the following evolution functions: + b -> {23, +, 5}_2 + a -> {{22, +, 7}_1, +, 1}_2 + c -> {{{23, +, 7}_1, +, 1}_2, +, 1}_3 +*/ +/* { dg-final { scan-tree-dump-times "set_nb_iterations_in_loop = 4" 1 "lptest"} } */ +/* { dg-final { scan-tree-dump-times "set_nb_iterations_in_loop = 6" 1 "lptest"} } */ + + diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-02.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-02.c new file mode 100644 index 00000000000..2dce3aa1aa6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-02.c @@ -0,0 +1,29 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + +int main(void) +{ + int a; + int b; + int *c; + + /* The following loop runs exactly 3 times. */ + for (a = 11; a < 50; a++) + { + /* The following loop runs exactly 9 times. */ + for (b = 8; b < 50; b+=5) + { + c[a + 5] = 5; + c[b] = 6; + a+=2; + } + } +} + +/* The analyzer has to detect the following evolution functions: + b -> {8, +, 5}_2 + a -> {{11, +, 19}_1, +, 2}_2 +*/ +/* { dg-final { scan-tree-dump-times "set_nb_iterations_in_loop = 3" 1 "lptest"} } */ +/* { dg-final { scan-tree-dump-times "set_nb_iterations_in_loop = 9" 1 "lptest"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-03.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-03.c new file mode 100644 index 00000000000..be137f8e1c2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-03.c @@ -0,0 +1,30 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int main(void) +{ + int a; + int b; + int *c; + + /* loop_1 runs exactly 5 times. */ + for (a = 11; a < 50; a++) + { + /* loop_2 runs exactly 7 times. */ + for (b = 8; b < 50; b+=5) + { + c[a++] = 5; + c[b++] = 6; + } + } +} + +/* The analyzer has to detect the following evolution functions: + b -> {8, +, 6}_2 + a -> {{11, +, 8}_1, +, 1}_2 +*/ +/* { dg-final { scan-tree-dump-times "set_nb_iterations_in_loop = 5" 1 "lptest"} } */ +/* { dg-final { scan-tree-dump-times "set_nb_iterations_in_loop = 7" 1 "lptest"} } */ + diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-04.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-04.c new file mode 100644 index 00000000000..5ab97d19ef9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-04.c @@ -0,0 +1,22 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details -fdump-tree-optimized" } */ + +void remove_me (void); + +int main(void) +{ + int a; + int b = 22; + + /* loop_1 runs exactly 28 times. */ + for (a = 22; a < 50; a++) /* a -> {22, +, 1}_1 */ + { + if (a > b) /* This condition is always false. */ + remove_me (); + b = b + 2; /* b -> {22, +, 2}_1 */ + } +} + +/* { dg-final { scan-tree-dump-times "set_nb_iterations_in_loop = 28" 1 "lptest"} } */ +/* { dg-final { scan-tree-dump-times "remove_me" 0 "optimized"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-05.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-05.c new file mode 100644 index 00000000000..09df0c89050 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-05.c @@ -0,0 +1,33 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int main(void) +{ + int a; + int b; + int c; + + /* nb_iterations 28 */ + for (a = 22; a < 50; a++) + { + /* nb_iterations 6 */ + for (b = 23; b < 50; b+=5) + { + /* nb_iterations {78, +, -1}_1 */ + for (c = a; c < 100; c++) + { + + } + } + } +} + +/* The analyzer has to detect the following evolution functions: + a -> {22, +, 1}_1 + b -> {23, +, 5}_2 + c -> {{22, +, 1}_1, +, 1}_3 +*/ +/* { dg-final { scan-tree-dump-times "set_nb_iterations_in_loop = 28" 1 "lptest"} } */ +/* { dg-final { scan-tree-dump-times "set_nb_iterations_in_loop = 6" 1 "lptest"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-06.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-06.c new file mode 100644 index 00000000000..3a6a67d0a2b --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-06.c @@ -0,0 +1,51 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details -fdump-tree-optimized" } */ + +void remove_me (void); + +int main(void) +{ + int a; + int b; + int c; + + /* loop_1 runs 2 times. */ + for (a = 22; a < 83; a+=1) /* a -> {22, +, 60}_1 */ + { + c = a; + + /* loop_2 runs exactly 6 times. */ + for (b = 23; b < 50; b+=5) /* b -> {23, +, 5}_2 */ + { + ++a; + } + /* The following stmt exercises the value of B on the exit of the loop. + In this case the value of B out of the loop is that of the evolution + function of B applied to the number of iterations the inner loop_2 runs. + Value (B) = {23, +, 5}_2 (6) = 53. */ + + /* At this point, the variable A has the evolution function: + {{22, +, 6}_1, +, 1}_2. */ + if (b != 53 + || a != c + 6) + remove_me (); + + a = a + b; + /* At this point, the variable A has the evolution function: + {{22, +, 59}_1, +, 1}_2. The evolution of the variable B in + the loop_2 does not matter, and is not recorded in the + evolution of A. The above statement is equivalent to: + "a = a + 53", ie. the scalar value of B on exit of the loop_2. */ + + if (a != c + 59) + remove_me (); + + /* And finally the a+=1 from the FOR_STMT produces the evolution + function: {{22, +, 60}_1, +, 1}_2. */ + } +} + +/* { dg-final { scan-tree-dump-times "set_nb_iterations_in_loop = 2" 1 "lptest"} } */ +/* { dg-final { scan-tree-dump-times "set_nb_iterations_in_loop = 6" 1 "lptest"} } */ +/* { dg-final { scan-tree-dump-times "remove_me" 0 "optimized"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-07.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-07.c new file mode 100644 index 00000000000..2143751f6ac --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-07.c @@ -0,0 +1,28 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +void remove_me (void); + +int main(void) +{ + int a = -100; + int b = 2; + int d = -1; + int e = -100; + + while (a) + { + /* Exercises higher order polynomials. */ + a = a + b; /* a -> {-100, +, {2, +, 3}_1}_1 */ + b = b + 3; /* b -> {2, +, 3}_1 */ + + d = d + 3; /* d -> {-1, +, 3}_1 */ + e = e + d; /* e -> {-100, +, {2, +, 3}_1}_1 */ + + if (a != e) /* a -> {-98, +, {5, +, 3}_1}_1 */ + remove_me (); + } +} + +/* { dg-final { scan-tree-dump-times "remove_me" 0 "optimized"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-08.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-08.c new file mode 100644 index 00000000000..a0265000b33 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-08.c @@ -0,0 +1,32 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +void remove_me (void); + +int main(void) +{ + int a = -100; + int b = 2; + int c = 3; + int d = -5; + int e = 3; + int f = -100; + + while (a) + { + /* Exercises higher order polynomials. */ + a = a + b; /* a -> {-100, +, 2, +, 3, +, 4}_1 */ + b = b + c; /* b -> {2, +, 3, +, 4}_1 */ + c = c + 4; /* c -> {3, +, 4}_1 */ + + d = d + 4; /* d -> {-5, +, 4}_1 */ + e = e + d; /* e -> {3, +, -1, +, 4}_1 */ + f = f + e; /* f -> {-100, +, 2, +, 3, +, 4}_1 */ + + if (a != f) /* (a == f) -> {-98, +, 5, +, 7, +, 4}_1 */ + remove_me (); + } +} + +/* { dg-final { scan-tree-dump-times "remove_me" 0 "optimized"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-09.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-09.c new file mode 100644 index 00000000000..406544f3b7d --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-09.c @@ -0,0 +1,42 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + +int main(void) +{ + int a = -100; + int b = 2; + int c = 3; + int d = 4; + int e = 5; + + while (a) + { + /* Exercises the cycle detector: a -> b -> (c -> d -> e -> c)*. */ + a += b; + b += c; + c += d; + d += e; + e += c; + } +} + +/* This is what is commonly called a "mixer". It whirls the data in a + strongly connected component. We expect the following evolution + functions: + + e -> {5, +, c_13}_1 + d -> {4, +, {5, +, c_13}_1}_1 + c -> {3, +, {4, +, {5, +, c_13}_1}_1}_1 + b -> {2, +, {3, +, {4, +, {5, +, c_13}_1}_1}_1}_1 + a -> {-100, +, {2, +, {3, +, {4, +, {5, +, c_13}_1}_1}_1}_1}_1 +*/ + +/* FIXME: + For the moment this testcase does not test for anything, but for + not ICEing, and for documentation purposes (okay here is the + definition of a mixer). However, I'm considering testing something + around the lines of ssa-chrec-08.c, ie. build two mixers, and then + compare their values. But that is difficult, and low priority. */ + + diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-10.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-10.c new file mode 100644 index 00000000000..f9c1c516ece --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-10.c @@ -0,0 +1,30 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + +void bar (int); + +int foo (void) +{ + int a; + int x; + int c[100][100]; + + /* loop_1 runs 39 times. */ + for (a = 11; a < 50; a++) + { + /* Array access functions have to be analyzed. */ + x = a + 5; + c[x][a+1] = c[x+2][a+3] + c[x-1][a+2]; + } + bar (c[1][2]); +} + +/* The analyzer has to detect the scalar functions: + a -> {11, +, 1}_1 + x -> {16, +, 1}_1 + x+2 -> {18, +, 1}_1 + x-1 -> {15, +, 1}_1 +*/ + +/* { dg-final { scan-tree-dump-times "set_nb_iterations_in_loop = 39" 1 "lptest"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-11.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-11.c new file mode 100644 index 00000000000..7e1779f97b4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-11.c @@ -0,0 +1,60 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int main(void) +{ + int a = -100; + int b = 2; + + int f = 6; + int g = 7; + int h = 8; + + /* Exercises complex loop exit conditions. + FIXME: This is a strange case where the compiler cc1 and the wrapper gcc + don't produce the same representation: + + (with gcc from command line) + + T.1_9 = f_2 | a_1; + if (T.1_9 == 0) + { + goto <UL47e0>; + } + + versus (with cc1 called from gdb): + + if (f_2 == 0) + { + if (a_1 == 0) + { + goto <ULc7e0>; + } + else + { + (void)0 + } + } + else + { + (void)0 + }; + */ + while (f || a) + { + a += b; + + f += g; + g += h; + } +} + +/* + g -> {7, +, 8}_1 + f -> {6, +, {7, +, 8}_1}_1 + a -> {-100, +, 2}_1 +*/ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-12.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-12.c new file mode 100644 index 00000000000..067bfcb2474 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-12.c @@ -0,0 +1,33 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int bar (void); + +int foo () +{ + int a = -100; + int b = 2; + int c = 3; + int d = 4; + + while (a) + { + a = a + b; + + /* Exercises if-phi-nodes. */ + if (bar ()) + b = b + c; + + c = c + d; + } +} + +/* The analyzer has to detect the following evolution functions: + c -> {3, +, 4}_1 + b -> {2, +, {[0, 3], +, [0, 4]}_1}_1 + a -> {-100, +, {2, +, {[0, 3], +, [0, 4]}_1}_1}_1 +*/ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-13.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-13.c new file mode 100644 index 00000000000..cb785d020f4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-13.c @@ -0,0 +1,33 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + +int foo (void); + +int main (void) +{ + int a = -100; + int b = 2; + int c = 3; + + while (a) + { + /* Exercises if-phi-nodes. */ + if (foo ()) + a += b; + else + a += c; + + b++; + c++; + } +} + +/* The analyzer has to detect the following evolution function: + a -> {-100, +, {[2, 3], +, 1}_1}_1 +*/ + +/* FIXME. */ + + + diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-14.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-14.c new file mode 100644 index 00000000000..c0258c81aba --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-14.c @@ -0,0 +1,37 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + +int foo (void); + +int main (void) +{ + int a = -100; + int b = 2; + int c = 3; + int d = 4; + + while (d) + { + if (foo ()) + a += b; + else + a += c; + + b += 1; + c += 5; + + /* Exercises the initial condition of A after the if-phi-node. */ + d = d + a; + } +} + +/* The analyzer has to detect the following evolution function: + b -> {2, +, 1}_1 + c -> {3, +, 5}_1 + a -> {-100, +, {[2, 3], +, [1, 5]}_1}_1 + d -> {4, +, {[-98, -97], +, {[2, 3], +, [1, 5]}_1}_1}_1 +*/ + +/* FIXME. */ + diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-15.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-15.c new file mode 100644 index 00000000000..800866b677b --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-15.c @@ -0,0 +1,24 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int main (void) +{ + int a; + int b; + int c; + + /* Exercises the MINUS_EXPR. loop_1 runs 50 times. */ + for (a = 100; a > 50; a--) + { + + } +} + +/* The analyzer has to detect the following evolution function: + a -> {100, +, -1}_1 +*/ + +/* { dg-final { scan-tree-dump-times "set_nb_iterations_in_loop = 50" 1 "lptest"} } */ + diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-16.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-16.c new file mode 100644 index 00000000000..a80414abb83 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-16.c @@ -0,0 +1,27 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int main (void) +{ + int a = -100; + int b = 2; + int c = 3; + int d = 4; + + /* Determining the number of iterations for the != or == is work in + progress. Same for polynomials of degree >= 2, where we have to + find the zeros of the polynomial. */ + while (d) + { + a += 23; + d = a + d; + } +} + +/* a -> {-100, +, 23}_1 + d -> {4, +, {-77, +, 23}_1}_1 +*/ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-17.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-17.c new file mode 100644 index 00000000000..1e7ac50e013 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-17.c @@ -0,0 +1,36 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int bar (void); + +void foo () +{ + int a = -100; + int b = 2; + + while (b) + { + if (bar ()) + a += 3; + else + a = 2; + + /* Exercises the case when one of the branches of the if-phi-node is a constant. + FIXME: + - What is the chrec representation of such an evolution? + - Does this kind of code exist in real codes? */ + b += a; + } +} + +/* For the moment the analyzer is expected to output a "don't know" answer, + both for the initial condition and for the evolution part. This is done + in the merge condition branches information. + + a -> [-oo, +oo] + b -> {2, +, a_1}_1 +*/ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-18.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-18.c new file mode 100644 index 00000000000..f72aaa1f542 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-18.c @@ -0,0 +1,32 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int bar (void); + +int foo (int x) +{ + int a = -100; + int b = 2; + + while (b) + { + if (x) + a += 3; + else + a += bar (); + + /* Exercises the case when one of the branches of the if-phi-node cannot + be determined: [-oo, +oo]. + Since the evolution function is too difficult to handle in the expanded + form, we have to keep it in its symbolic form: "b -> {2, +, a_1}_1". */ + b += a; + } +} + +/* a -> {-100, +, [min<t, 3>, max<t, 3>]}_1 + b -> {2, +, {[min<t, 3>, max<t, 3>] - 100, +, [min<t, 3>, max<t, 3>]}_1}_1 +*/ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-19.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-19.c new file mode 100644 index 00000000000..bb3a5b183ae --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-19.c @@ -0,0 +1,21 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int main () +{ + int b = 2; + + while (b) + { + /* Exercises the MULT_EXPR. */ + b = 2*b; + } +} + +/* b -> {2, *, 2}_1 +*/ + +/* FIXME. */ + diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-20.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-20.c new file mode 100644 index 00000000000..e5a24d80a8f --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-20.c @@ -0,0 +1,30 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int main () +{ + int a = 3; + int b = 2; + + while (a) + { + b += 5; + a += b; + + /* Exercises the sum of a polynomial of degree 2 with an + evolution of degree 1: + + (loop_num = 1, chrec_var = {3, +, 7, +, 5}, to_add = 2). + The result should be: {3, +, 9, +, 5}. */ + a += 2; + } +} + +/* + b -> {2, +, 5}_1 + a -> {3, +, {9, +, 5}_1}_1 +*/ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-21.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-21.c new file mode 100644 index 00000000000..82c5ccb49db --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-21.c @@ -0,0 +1,22 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int main () +{ + int a = 3; + int b = 2; + + while (b) + { + a *= 4; + b *= a; + } +} + +/* a -> {3, *, 4}_1 + b -> {{2, *, 12}_1, *, 4}_1 +*/ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-22.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-22.c new file mode 100644 index 00000000000..a439099e4df --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-22.c @@ -0,0 +1,24 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int main () +{ + int a = 2; + int b = 4; + + while (a) + { + a *= 3; + a *= b; + b *= 5; + } +} + +/* + b -> {4, *, 5}_1 + a -> {2, *, {12, *, 5}_1}_1 +*/ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-23.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-23.c new file mode 100644 index 00000000000..c12bc4bf469 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-23.c @@ -0,0 +1,22 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int main () +{ + int a = 1; + int b = 1; + + while (a) + { + a *= b; + b += 1; + } +} + +/* a -> {1, *, {1, +, 1}_1}_1 +*/ + +/* FIXME. */ + diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-24.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-24.c new file mode 100644 index 00000000000..96095cd4d4e --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-24.c @@ -0,0 +1,30 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int bar (void); + +int foo () +{ + int c; + + /* This exercises the initial condition propagator: + Interval Copy Constant Propagation (ICCP). */ + if (bar ()) + c = 2; + else + c = 3; + + while (c) + { + c += 5; + } +} + +/* + c -> {[2, 3], +, 5}_1 +*/ + +/* FIXME. */ + diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-25.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-25.c new file mode 100644 index 00000000000..43b1dc5bd37 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-25.c @@ -0,0 +1,29 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int bar (void); + +int foo () +{ + int c = 7; + + /* This exercises the initial condition propagator: + Interval Copy Constant Propagation (ICCP). */ + if (bar ()) + c = 2; + else + c += 3; + + while (c) + { + c += 5; + } +} + +/* + c -> {[2, 10], +, 5}_1 +*/ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-26.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-26.c new file mode 100644 index 00000000000..f7025534118 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-26.c @@ -0,0 +1,26 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int bar (void); + +int foo () +{ + int a = -100; + int b = -10; + + /* This exercises a code with two loop nests. */ + + while (a) + a++; + + while (b) + b++; +} + +/* a -> {-100, +, 1}_1 + b -> {-10, +, 1}_2 +*/ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-27.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-27.c new file mode 100644 index 00000000000..92c627d324c --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-27.c @@ -0,0 +1,41 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int bar (void); + +int foo () +{ + int a = -100; + + /* This exercises a code with two loop nests. */ + + /* loop_1 runs 100 times. */ + while (a < 0) + a++; + + a -= 77; + + /* loop_2 runs 26 times. */ + while (a < 0) + a+=3; +} + +/* The analyzer sees two loop nests: + for the first, it determines the evolution: + a -> {-100, +, 1}_1 + + and for the second, it determines that the first loop ends at 0 and then: + a -> {-77, +, 3}_2 + + When the constant propagation is postponed, the analyzer detects + for the second loop the evolution function: + a -> {a_5, +, 3}_2 + +*/ + +/* { dg-final { scan-tree-dump-times "set_nb_iterations_in_loop = 100" 1 "lptest"} } */ +/* { dg-final { scan-tree-dump-times "set_nb_iterations_in_loop = 26" 1 "lptest"} } */ + + diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-28.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-28.c new file mode 100644 index 00000000000..a05930fb0df --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-28.c @@ -0,0 +1,40 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int bar (void); + +int foo () +{ + int i; + int a = 2; + + while (a) + { + a *= 3; + + for (i = 0; i < 100; i++) + a += 4; + } +} + +/* FIXME: We have to transform the evolution function of "a" into an infinite + sum, a -> {//2, *, 2//}, and then to add the 400 from the inner sum... + But this is quite difficult, and cases like this one do not happen often. + + (Francois Irigoin consider that this case falls into the 0.01 percent + rule, and it is no worth to implement a solution for this testcase in a + production compiler. ) +*/ + +/* Do nothing for this testcase. + The following evolutions are detected: + + i -> {0, +, 1}_2 + a -> {{2, *, [-oo, +oo]}_1, +, 4}_2 + +*/ + +/* FIXME. */ + diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-29.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-29.c new file mode 100644 index 00000000000..5d639a9dfae --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-29.c @@ -0,0 +1,41 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int bar (void); + +int foo () +{ + int i; + int a = 2; + + while (a) + { + a *= 3; + a += 5; + } +} + +/* FIXME: This exposes a problem in the representation. Is it + possible to have an exponential and a polynomial together? + + The first assignment constructs "a -> {2, *, 3}_1", + while the second adds 5 as a polynomial function. + + The following two representations are not correct: + "a -> {{2, *, 3}_1, +, 5}_1" + "a -> {{2, +, 5}_1, *, 3}_1" + + The right solution is: + "a -> {2, *, 3}_1 + {0, +, 5}_1" + but this exposes yet again the "exp + poly" problem: the representation + is not homogen. Going into a Taylor decomposition could solve this problem. + + This is too difficult for the moment, and does not happen often. +*/ + +/* Do nothing for this testcase. */ + +/* FIXME. */ + diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-37.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-37.c new file mode 100644 index 00000000000..746a81e68fe --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-37.c @@ -0,0 +1,30 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int main () +{ + int a; + int b = 2; + int c = 11; + + for (a = -123; a < 0; c += 12, b += 5) + { + a += b; + + /* The next stmt exercises the add_function_to_loop_evolution + (loop_num = 1, chrec_before = {-123, +, {2, +, 5}_1}_1, to_add = {11, +, 12}_1). + The result should be: {-123, +, {13, +, 17}_1}_1. */ + a += c; + } +} + +/* + b -> {2, +, 5}_1 + c -> {11, +, 12}_1 + a -> {-123, +, {13, +, 17}_1}_1 +*/ + + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-38.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-38.c new file mode 100644 index 00000000000..bdfe8bc6bfd --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-38.c @@ -0,0 +1,49 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int main () +{ + int a = 3; + int b = 2; + int c = 11; + int d = -5; + + while (a) + { + b += 5; + a += b; + + for (d = -5; d < 0; d++) + { + /* Exercises the build_polynomial_evolution_in_loop function in the following context: + (add_to_evolution + loop_num = 2 + chrec_before = {3, +, 7, +, 5}_1 + to_add = {11, +, 12}_1 + res = {{3, +, 7, +, 5}_1, +, {11, +, 12}_1}_2 + ) + + This also exercises the chrec_apply function in the following context: + (chrec_apply + var = 2 + chrec = {0, +, {11, +, 12}_1}_2 + x = 5 + res = {55, +, 60}_1 + ) + */ + a += c; + } + c += 12; + } +} + +/* + b -> {2, +, 5}_1 + c -> {11, +, 12}_1 + d -> {-5, +, 1}_2 + a -> {{3, +, 62, +, 65}_1, +, {11, +, 12}_1}_2 +*/ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-39.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-39.c new file mode 100644 index 00000000000..87d844482e7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-39.c @@ -0,0 +1,46 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int foo (int ParmN) +{ + int a = 3; + int b = 2; + int d = -5; + + while (a) + { + b += 25; + a += b; + + for (d = -5; d < 0; d++) + { + /* Exercises the build_polynomial_evolution_in_loop in the following context: + (add_to_evolution + loop_num = 2 + chrec_before = {3, +, {27, +, 25}_1}_1 + to_add = ParmN_15 + res = {{3, +, {27, +, 25}_1}_1, +, ParmN_15}_2 + ) + + Then it exercises the add_expr_to_loop_evolution in the following context: + (add_to_evolution + loop_num = 1 + chrec_before = {{3, +, {27, +, 25}_1}_1, +, ParmN_15}_2 + to_add = ParmN_15 * 5 + res = {{3, +, {ParmN_15 * 5 + 27, +, 25}_1}_1, +, ParmN_15}_2 + ) + */ + a += ParmN; + } + } +} + +/* + b -> {2, +, 25}_1 + d -> {-5, +, 1}_2 + a -> {{3, +, {ParmN * 5 + 27, +, 25}_1}_1, +, ParmN}_2 +*/ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-40.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-40.c new file mode 100644 index 00000000000..7a1ecf7d5bd --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-40.c @@ -0,0 +1,23 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int main () +{ + int a = 1; + int b = 1; + + while (a) + { + a += b; + b *= 2; + } +} + +/* + b -> {1, *, 2}_1 + a -> {1, +, {1, *, 2}_1}_1 +*/ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-41.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-41.c new file mode 100644 index 00000000000..ab93fbcaf98 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-41.c @@ -0,0 +1,53 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int main () +{ + int a = 2; + int b = 4; + int c = 2; + + while (a) + { + a *= 3; + for (c = -10; c < 0; c++) + { + /* Exercises the build_exponential_evolution_in_loop function in the following context: + (multiply_evolution + loop_num = 2 + chrec_before = {2, *, 3}_1 + to_mult = {4, *, 5}_1 + res = {{2, *, 3}_1, *, {4, *, 5}_1}_2 + ) + + Then it exerces the chrec_apply in the following context: + (chrec_apply + var = 2 + chrec = {0, +, {4, *, 5}_1}_2 + x = 10 + res = {40, *, 5}_1 + ) + + Finally it tests the + (add_to_evolution + loop_num = 1 + chrec_before = {{2, *, 3}_1, *, {4, *, 5}_1}_2 + to_add = {40, *, 5}_1 + res = {{2, *, {120, *, 5}_1}_1, *, {4, *, 5}_1}_2 + ) + */ + a *= b; + } + b *= 5; + } +} + +/* + c -> {-10, +, 1}_2 + b -> {4, *, 5}_1 + a -> {{2, *, {120, *, 5}_1}_1, *, {4, *, 5}_1}_2 +*/ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-42.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-42.c new file mode 100644 index 00000000000..33378ddfa9c --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-42.c @@ -0,0 +1,31 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int main () +{ + int a = 1; + int b = 2; + int c = 0; + int d = 5; + + while (a) + { + a += b; + a += d; + + b += c; + c += 1; + d += 9; + } +} + +/* + c -> {0, +, 1}_1 + b -> {2, +, 0, +, 1}_1 + d -> {5, +, 9}_1 + a -> {1, +, 7, +, 9, +, 1}_1 +*/ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-43.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-43.c new file mode 100644 index 00000000000..329f205506f --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-43.c @@ -0,0 +1,65 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + + +int main () +{ + int a = 1; + int b = 2; + int c = 0; + int d = 5; + int e; + + while (a) + { + /* The following statement produces the evolution function: + (add_to_evolution + loop_num = 1 + chrec_before = 1 + to_add = {{2, +, 0}_1, +, 10}_1 + res = {{{1, +, 2}_1, +, 0}_1, +, 10}_1 + ) + Note that the evolution of B in the inner loop_2 is not + relevant to the evolution of A in the loop_1. */ + a += b; + + /* And finally the following statement produces the expected scev: + (add_to_evolution + loop_num = 1 + chrec_before = {{{1, +, 2}_1, +, 0}_1, +, 10}_1 + to_add = {5, +, 9}_1 + res = {{{1, +, 7}_1, +, 9}_1, +, 10}_1 + ) + That ends this not so formal proof ("CQFD" in french ;-). */ + a += d; + + for (e = 0; e < 10; e++) + b += c; + /* After having analyzed this loop, the overall effect is added to the evolution of b. + This corresponds to the following operation: + (add_to_evolution + loop_num = 1 + chrec_before = {2, +, {0, +, 1}_1}_2 + to_add = {0, +, 10}_1 + res = {{{2, +, 0}_1, +, 10}_1, +, {0, +, 1}_1}_2 + ). + Note that the variable c has not yet been updated in the loop, and thus its value + at this version is "{0, +, 1}_1". Since the loop_2 runs exactly 10 times, the overall + effect of the loop is "10 * {0, +, 1}_1": that is the TO_ADD argument. + */ + + c += 1; + d += 9; + } +} + +/* + c -> {0, +, 1}_1 + e -> {0, +, 1}_2 + b -> {{2, +, 0, +, 10}_1, +, {0, +, 1}_1}_2 + d -> {5, +, 9}_1 + a -> {1, +, 7, +, 9, +, 10}_1 +*/ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-44.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-44.c new file mode 100644 index 00000000000..86308138d37 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-44.c @@ -0,0 +1,39 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + +/* That's a reduced testcase of one of my favourite simulation programs. + This is also known under the name: "Newton's falling apple". + The general version is known under the name: "the N-body simulation problem". + + The physics terminology is the best to describe the scalar evolution algorithm: + - first determine the initial conditions of the system, + - then analyze its evolution. +*/ + +double Newton_s_apple () +{ + /* Initial conditions. */ + double g = -10.0; + double speed_z = 0; + double altitude = 3000; + double delta_t = 0.1; + double total_time = 0; + + /* Laws of evolution. */ + while (altitude > 0.0) + { + speed_z += g * delta_t; + altitude += speed_z * delta_t; + total_time += delta_t; + } + + return total_time; +} + +/* + speed_z -> {0.0, +, -1.0e+0}_1 + altitude -> {3.0e+3, +, {(0.0 + -1.0e+0) * 1.00000000000000005551115123125782702118158340454e-1, +, -1.0e+0 * 1.00000000000000005551115123125782702118158340454e-1}_1}_1 +*/ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-45.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-45.c new file mode 100644 index 00000000000..40f09a236f3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-45.c @@ -0,0 +1,45 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + +/* That's a reduced testcase of one of my favourite simulation programs. + This is also known under the name: "Newton's falling apple". + The general version is known under the name: "the N-body simulation problem". + + The physics terminology is the best to describe the scalar evolution algorithm: + - first determine the initial conditions of the system, + - then analyze its evolution. +*/ + +double Newton_s_apple () +{ + /* Initial conditions. */ + double g = 10.0; + double speed_z = 0; + double altitude = 3000; + double delta_t = 0.1; + double total_time = 0; + + /* Laws of evolution. */ + while (altitude > 0.0) + { + speed_z += g * delta_t; + altitude -= speed_z * delta_t; + total_time += delta_t; + } + + return total_time; +} + +/* + speed_z -> {0.0, +, 1.0e+0}_1 + altitude -> {3.0e+3, +, {(0.0 + 1.0e+0) * 1.00000000000000005551115123125782702118158340454e-1 * -1, +, 1.0e+0 * 1.00000000000000005551115123125782702118158340454e-1 * -1}_1}_1 + + When computing evolutions in the "symbolic as long as possible" strategy, + the analyzer extracts only the following: + + altitude -> {3.0e+3, +, T.2_11 * -1}_1 + +*/ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-46.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-46.c new file mode 100644 index 00000000000..b97d6f87fab --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-46.c @@ -0,0 +1,19 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + +int +foo (int i, + int precision) +{ + i = precision - i - 1; + + /* At this point the analyzer is confused by the initialisation of "i". + It keeps the initial condition under a symbolic form: "i_1". */ + + while (--i); +} + +/* i -> {i_1, +, -1}_1 */ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-47.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-47.c new file mode 100644 index 00000000000..bd5afc50b7e --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-47.c @@ -0,0 +1,36 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + +int +foo (int unknown_parm, int a, int b) +{ + int p; + + if (unknown_parm) + { + p = a + 2; + } + else + { + p = b + 1; + } + + /* At this point the initial condition of "p" is unknown. + In this case, the analyzer has to keep the initial condition under a symbolic form. */ + + while (p) + p--; + +} + +/* + p -> {p_1, +, -1}_1 + + or, when the Value Range Propagation does its work: + + p -> {[MIN_EXPR <p_4, p_6>, MAX_EXPR <p_4, p_6>], +, -1}_1 + +*/ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-48.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-48.c new file mode 100644 index 00000000000..fbd3c98bb29 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-48.c @@ -0,0 +1,30 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + +int +foo (int *c) +{ + int i; + int j = 10; + + for (i = 0; i < 5; i++) + { + for (j = 10;; j--) + { + if (j == 0) + break; + + *(c + j) = *(c + j) - 1; + } + } + + return j; +} + +/* + j -> {10, +, -1}_2 + i -> {0, +, 1}_1 +*/ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-49.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-49.c new file mode 100644 index 00000000000..413758aa6f6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-49.c @@ -0,0 +1,26 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + +int +foo (int *c) +{ + int i = 0; + int j = 10; + + while (1) + { + if (i == j) + break; + + i++; + j--; + } + + return j; +} + +/* i -> {0, +, 1}_1 */ +/* j -> {10, +, -1}_1 */ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-50.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-50.c new file mode 100644 index 00000000000..b3ea5b5dfb9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-50.c @@ -0,0 +1,27 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + +int +foo (int *c) +{ + int i = 0; + int j = 10; + + while (1) + { + /* This case exercises the number of iterations detector for + {0, +, 1}_1 == {10, +, -1}_1 + */ + if (i == j) + break; + + i++; + j--; + } + + return j; +} + +/* FIXME. */ + diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-51.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-51.c new file mode 100644 index 00000000000..c0a7f51f8ff --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-51.c @@ -0,0 +1,23 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + +int +foo (int j) +{ + int i = 0; + int temp_var; + + while (i < 100) + { + /* This exercises the analyzer on strongly connected + components: here "i -> temp_var -> i". */ + temp_var = i + j; + i = temp_var + 2; + } + + return i; +} + +/* FIXME. */ + diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-53.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-53.c new file mode 100644 index 00000000000..3933c21e360 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-53.c @@ -0,0 +1,129 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details " } */ + +#define N 16 + +void fbar (float *); +void ibar (int *); +void sbar (short *); + +/* Should be vectorized */ + +foo (int n) +{ + float a[N+1]; + float b[N]; + float c[N]; + float d[N]; + int ia[N]; + int ib[N]; + int ic[N]; + double da[N]; + double db[N]; + short sa[N]; + short sb[N]; + short sc[N]; + int i,j; + int diff = 0; + char cb[N]; + char cc[N]; + char image[N][N]; + char block[N][N]; + + /* Not vetorizable yet (unknown loop bound). */ + for (i = 0; i < n; i++){ + a[i] = b[i]; + } + fbar (a); + + /* Vectorizable. */ + for (i = 0; i < N; i++){ + a[i] = b[i]; + } + fbar (a); + + /* Not Vectorizable (mode not supported). */ + for (i = 0; i < N; i++){ + da[i] = db[i]; + } + fbar (a); + + /* Not vetorizable yet (constant assignment). */ + for (i = 0; i < N; i++){ + a[i] = 5; + } + fbar (a); + + /* Vectorizable. */ + for (i = 0; i < N; i++){ + a[i] = b[i] + c[i] + d[i]; + } + fbar (a); + + /* Vectorizable. */ + for (i = 0; i < N; i++){ + a[i] = b[i] * c[i]; + } + fbar (a); + + /* Vectorizable. */ + for (i = 0; i < N/2; i++){ + a[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i]; + d[i] = b[i] * c[i+N/2] + b[i+N/2] * c[i]; + } + fbar (a); + + /* Not vetorizable yet (too conservative dependence test). */ + for (i = 0; i < N/2; i++){ + a[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i]; + a[i+N/2] = b[i] * c[i+N/2] + b[i+N/2] * c[i]; + } + fbar (a); + + /* Not vetorizable yet (access pattern). */ + for (i = 0; i < N/2; i++){ + a[i] = b[2*i+1] * c[2*i+1] - b[2*i] * c[2*i]; + d[i] = b[2*i] * c[2*i+1] + b[2*i+1] * c[2*i]; + } + fbar (a); + + /* Not vetorizable yet (too conservative dependence test; access pattern). */ + for (i = 0; i < N/2; i++){ + a[2*i] = b[2*i+1] * c[2*i+1] - b[2*i] * c[2*i]; + a[2*i+1] = b[2*i] * c[2*i+1] + b[2*i+1] * c[2*i]; + } + fbar (a); + + /* Not vetorizable yet (no support for integer mult). */ + for (i = 0; i < N; i++){ + ia[i] = ib[i] * ic[i]; + } + ibar (ia); + + /* Vectorizable. */ + for (i = 0; i < N; i++){ + a[i] = b[i] + c[i]; + d[i] = b[i] + c[i]; + ia[i] = ib[i] + ic[i]; + } + ibar (ia); + fbar (a); + fbar (d); + + /* Not vectorizable yet (two types with different nunits in vector). */ + for (i = 0; i < N; i++){ + ia[i] = ib[i] + ic[i]; + sa[i] = sb[i] + sc[i]; + } + ibar (ia); + sbar (sa); + + /* Not vetorizable yet (too conservative dependence test). */ + for (i = 0; i < N; i++){ + a[i] = b[i] + c[i]; + a[i+1] = b[i] + c[i]; + } + fbar (a); +} + diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-54.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-54.c new file mode 100644 index 00000000000..1f64eb4e22d --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-54.c @@ -0,0 +1,34 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + +int main(void) +{ + int a = 5; + int b = 6; + int c = 20; + + while (a <= 100) + { + int i; + + a = b; + for (i = 0; i <= 12; i++) + { + a++; + } + b = b + c; + } +} + +/* This example has been distilled from Pattern1 that cannot be + handled: "Big steps, small steps" from the ICS'01 paper "Monotonic + Evolution" by Peng Wu. + + The analyzer has to detect the following evolution functions: + i -> {0, +, 1}_2 + b -> {6, +, 20}_1 + a -> {{6, +, 20}_1, +, 1}_2 +*/ + +/* FIXME. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-55.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-55.c new file mode 100644 index 00000000000..f89f825f100 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-55.c @@ -0,0 +1,18 @@ +/* APPLE LOCAL file lno */ +#include <stdio.h> +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-lptest-details" } */ + +int main(int argc) +{ + int I, J; + const int N = 30; + const int M = 40; + for (J = argc; J < N; J += 3) + { + for (I = J; I < M; I++) + { + printf ("%d %d\n", I, J); + } + } +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-56.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-56.c new file mode 100644 index 00000000000..4230b4726e5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-56.c @@ -0,0 +1,22 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-optimized" } */ + +void remove_me (void); + +int main (void) +{ + int a = -100; + int b = 0; + int c = 3; + + for (a = 0; a < 100; a++) + { + b = b + 3; + if (b != c) + remove_me (); + c = c + 3; + } +} + +/* { dg-final { scan-tree-dump-times "remove_me" 0 "optimized"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-57.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-57.c new file mode 100644 index 00000000000..0d938f6dd25 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-57.c @@ -0,0 +1,24 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-optimized" } */ + +void remove_me (void); + +int main (void) +{ + int a = -100; + int b = 0; + int c = 3; + + for (a = 0; a < 100; a++) + { + if (b > c) + remove_me (); + b = b + 2; + c = c + 3; + } +} + + +/* { dg-final { scan-tree-dump-times "remove_me" 0 "optimized"} } */ + diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-58.c b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-58.c new file mode 100644 index 00000000000..c5e8964c01b --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-58.c @@ -0,0 +1,23 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -floop-test -fdump-tree-optimized" } */ + +void remove_me (void); + +int main (void) +{ + int a, b; + int N = 100; + + a = 0; + b = 0; + while (a < N) + { + if (b >= 5*N - 4) + remove_me (); + a++; + b+=5; + } +} + +/* { dg-final { scan-tree-dump-times "remove_me" 0 "optimized"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-chrec/tree-ssa-scev.exp b/gcc/testsuite/gcc.dg/tree-ssa-chrec/tree-ssa-scev.exp new file mode 100644 index 00000000000..46fcf02054f --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-chrec/tree-ssa-scev.exp @@ -0,0 +1,36 @@ +# APPLE LOCAL file lno +# Copyright (C) 1997 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# GCC testsuite that uses the `dg.exp' driver. + +# Load support procs. +load_lib gcc-dg.exp + +# If a testcase doesn't have special options, use these. +global DEFAULT_CFLAGS +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS " -ansi -pedantic-errors" +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "" $DEFAULT_CFLAGS + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/ifc-01.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/ifc-01.c new file mode 100644 index 00000000000..6f86290c629 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/ifc-01.c @@ -0,0 +1,55 @@ +/* APPLE LOCAL file AV */ +/* { dg-do run { target powerpc*-*-* i?86-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* } } */ + +#include <stdarg.h> +#include <signal.h> + +extern void abort (void); +extern void exit (int); +#define N 16 +#define MAX 42 + +int main1 () +{ + int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; + + int i, j; + + for (i = 0; i < N; i++) + { + j = A[i]; + A[i] = ( j >= MAX ? MAX : 0); + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (A[i] > MAX) + abort (); + } + + return 0; +} + +void +sig_ill_handler (int sig) +{ + exit(0); +} + +int main (void) +{ + /* Exit on systems without altivec. */ + signal (SIGILL, sig_ill_handler); + /* Altivec instruction, 'vor %v0,%v0,%v0'. */ + asm volatile (".long 0x10000484"); + signal (SIGILL, SIG_DFL); + + return main1 (); +} + + +/* { dg-final { scan-tree-dump-times "Applying if-conversion" 1 "vect" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/ifc-02.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/ifc-02.c new file mode 100644 index 00000000000..5d996ef832b --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/ifc-02.c @@ -0,0 +1,49 @@ +/* APPLE LOCAL file */ +/* { dg-do compile { target powerpc*-*-* i?86-*-* } } */ +/* { dg-options "-c -O2 -ftree-vectorize -fdump-tree-vect-details -maltivec" { target powerpc*-*-* } } */ +/* { dg-options "-c -O2 -ftree-vectorize -fdump-tree-vect-details -msse" { target i?86-*-* } } */ + +#include <stdarg.h> +#include <signal.h> + +extern int c; +struct A; +typedef struct A *A_def; +static A_def *data; + +extern void abort (void); +extern void exit (int); + +#define N 128 + +int main1 () +{ + + unsigned int i; + + for (i = 0; i < N; i++) + if (c) + data[i] = 0; + + return 0; +} + +void +sig_ill_handler (int sig) +{ + exit(0); +} + +int main (void) +{ + /* Exit on systems without altivec. */ + signal (SIGILL, sig_ill_handler); + /* Altivec instruction, 'vor %v0,%v0,%v0'. */ + asm volatile (".long 0x10000484"); + signal (SIGILL, SIG_DFL); + + return main1 (); +} + + +/* { dg-final { scan-tree-dump-times "Applying if-conversion" 1 "vect" { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/pr16105.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/pr16105.c new file mode 100644 index 00000000000..3a968ff25ea --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/pr16105.c @@ -0,0 +1,23 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile { target powerpc*-*-* i?86-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */ + +#define VECTOR_SIZE 512 +typedef float afloat __attribute__ ((__aligned__(16))); + +extern void check(const afloat * __restrict__ v); + +void square(const afloat * __restrict__ a, + afloat * __restrict__ out) +{ + unsigned int i; + for (i = 0; i < VECTOR_SIZE; i++) { + float ai = a[i]; + float a2 = ai * ai; + out[i] = a2; + } + check(out); +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-31.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-31.c new file mode 100644 index 00000000000..d1e77acc6e0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-31.c @@ -0,0 +1,44 @@ +/* APPLE LOCAL file lno */ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */ + +#include <stdarg.h> +#include "tree-vect.h" + +typedef char achar __attribute__ ((__aligned__(16))); + +#define N 16 + +int main1 () +{ + struct { + achar ca[N]; + } s; + int i; + + for (i = 0; i < N; i++) + { + s.ca[i] = 5; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (s.ca[i] != 5) + abort (); + } + + return 0; +} + +int main (void) +{ + check_vect (); + + return main1 (); +} + + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-35.c b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-35.c new file mode 100644 index 00000000000..14591764e9f --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-35.c @@ -0,0 +1,43 @@ +/* APPLE LOCAL file lno */ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */ + +#include <stdarg.h> +#include "tree-vect.h" + +#define N 16 + +int main1 () +{ + struct { + char ca[N]; + } s; + char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + int i; + + for (i = 0; i < N; i++) + { + s.ca[i] = cb[i]; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (s.ca[i] != cb[i]) + abort (); + } + + return 0; +} + +int main (void) +{ + check_vect (); + + return main1 (); +} + + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect.exp b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect.exp new file mode 100644 index 00000000000..46fcf02054f --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect.exp @@ -0,0 +1,36 @@ +# APPLE LOCAL file lno +# Copyright (C) 1997 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# GCC testsuite that uses the `dg.exp' driver. + +# Load support procs. +load_lib gcc-dg.exp + +# If a testcase doesn't have special options, use these. +global DEFAULT_CFLAGS +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS " -ansi -pedantic-errors" +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "" $DEFAULT_CFLAGS + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-vect.h b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-vect.h new file mode 100644 index 00000000000..f56e83138b3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa-vect/tree-vect.h @@ -0,0 +1,25 @@ +/* APPLE LOCAL file lno */ +/* Check if system supports SIMD */ +#include <signal.h> + +extern void exit (int); +extern void abort (void); + +void +sig_ill_handler (int sig) +{ + exit(0); +} + +void check_vect (void) +{ + signal(SIGILL, sig_ill_handler); +#if defined(__ppc__) || defined(__ppc64__) + /* Altivec instruction, 'vor %v0,%v0,%v0'. */ + asm volatile (".long 0x10000484"); +#elif defined(__i386__) || defined(__x86_64__) + /* SSE2 instruction: movsd %xmm0,%xmm0 */ + asm volatile (".byte 0xf2,0x0f,0x10,0xc0"); +#endif + signal (SIGILL, SIG_DFL); +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20030711-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20030711-1.c index a1ef017dfda..7e645a85864 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/20030711-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/20030711-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O1 -fdump-tree-dom3" } */ +/* APPLE LOCAL lno */ +/* { dg-options "-O1 -fdump-tree-dom3 -ftree-loop-optimize" } */ extern void abort (void); diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20030714-2.c b/gcc/testsuite/gcc.dg/tree-ssa/20030714-2.c index 2c8a84a494d..e9f57e40f1d 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/20030714-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/20030714-2.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O1 -fdump-tree-dom3" } */ +/* APPLE LOCAL lno */ +/* { dg-options "-O1 -fdump-tree-dom3 -ftree-loop-optimize" } */ union tree_node; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20040308-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20040308-1.c new file mode 100644 index 00000000000..987aad09519 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/20040308-1.c @@ -0,0 +1,19 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-phiopt1-details" } */ + +int t( int i) +{ + int j; + if(i ==0) + j = 1; + else + j = 0; + + + return j; +} + +/* We should convert one COND_EXPRs into straightline code. */ +/* { dg-final { scan-tree-dump-times "straightline" 1 "phiopt1" {xfail *-*-* } } } */ + diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20040308-2.c b/gcc/testsuite/gcc.dg/tree-ssa/20040308-2.c new file mode 100644 index 00000000000..23fad9a47e3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/20040308-2.c @@ -0,0 +1,19 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-phiopt1-details -fdump-tree-tailc-details" } */ + + +int f(int i) +{ + int result; + result = t(i); + if (result) + return result; + return 0; +} + +/* We should convert one COND_EXPRs into straightline code. */ +/* { dg-final { scan-tree-dump-times "straightline" 1 "phiopt1" } } */ +/* Also we should have found that the call to t is tail called. */ +/* { dg-final { scan-tree-dump-times "Found tail call" 1 "tailc" } } */ + diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20040308-3.c b/gcc/testsuite/gcc.dg/tree-ssa/20040308-3.c new file mode 100644 index 00000000000..962734fdf6a --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/20040308-3.c @@ -0,0 +1,18 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-phiopt1-details" } */ + +int t( int i) +{ + int j; + if(i>=0) + j = i; + else + j = -i; + return j; +} + +/* We should convert one COND_EXPRs into straightline code with ABS. */ +/* { dg-final { scan-tree-dump-times "straightline" 1 "phiopt1"} } */ +/* { dg-final { scan-tree-dump-times "ABS_EXPR" 1 "phiopt1"} } */ + diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20040517-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20040517-1.c index 5f99be2874e..4b09b536d13 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/20040517-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/20040517-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O1 -fdump-tree-ssa-vops" } */ +/* { dg-options "-O1 -fdump-tree-alias1-vops" } */ extern void abort (void); int a; @@ -17,5 +17,4 @@ void bar (void) malloc functions may clobber global memory. Only the function result does not alias any other pointer. Hence, we must have a VDEF for a before and after the call to foo(). */ -/* { dg-final { scan-tree-dump-times "V_MAY_DEF" 1 "ssa"} } */ - +/* { dg-final { scan-tree-dump-times "V_MAY_DEF" 1 "alias1"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20041122-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20041122-1.c new file mode 100644 index 00000000000..89b90643e17 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/20041122-1.c @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-dom3" } */ + + +typedef unsigned int size_t; +extern void *xmalloc (size_t) __attribute__ ((__malloc__)); +struct edge_def +{ + struct basic_block_def *dest; + int flags; +}; +typedef struct edge_def *edge; +struct basic_block_def +{ + int flags; +}; +typedef struct basic_block_def *basic_block; +extern int n_basic_blocks; +extern edge frob (); +void +find_unreachable_blocks (int frobit) +{ + basic_block *tos, *worklist, bb; + tos = worklist = xmalloc (sizeof (basic_block) * n_basic_blocks); + edge e = frob(); + if (!(e->dest->flags & 4)) + { + e->dest->flags |= 4; + *tos++ = e->dest; + } +} + +/* If the aliasing code does its job properly, then we should be + able to determine that modifying e->dest->flags does not + modify e or e->dest. The net result is that we only need one + load of e->dest. */ +/* { dg-final { scan-tree-dump-times "->dest" 1 "dom3" { xfail *-*-* } } } */ + + diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20050215-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20050215-1.c new file mode 100644 index 00000000000..6ce588038aa --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/20050215-1.c @@ -0,0 +1,13 @@ +/* PR middle-end/19857 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +int i; +int foo (void) +{ + return i & ~(unsigned int) 3; +} + +/* Make sure the optimizers don't introduce overflow where one + did not exist in the original. */ +/* { dg-final { scan-tree-dump-times "-0+4" 0 "optimized"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/complex-1.c b/gcc/testsuite/gcc.dg/tree-ssa/complex-1.c new file mode 100644 index 00000000000..7dff01ce425 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/complex-1.c @@ -0,0 +1,12 @@ +/* Verify that we don't libcall for complex * real. */ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -O -fdump-tree-optimized" } */ + +typedef _Complex float C; + +C foo(C x, float y) +{ + return x * y; +} + +/* { dg-final { scan-tree-dump-times "__mul" 0 "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/complex-2.c b/gcc/testsuite/gcc.dg/tree-ssa/complex-2.c new file mode 100644 index 00000000000..ce72eb2172f --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/complex-2.c @@ -0,0 +1,12 @@ +/* Verify that we don't libcall for complex / real. */ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -O -fdump-tree-optimized" } */ + +typedef _Complex float C; + +C foo(C x, float y) +{ + return x / y; +} + +/* { dg-final { scan-tree-dump-times "__div" 0 "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/inline_asm-1.c b/gcc/testsuite/gcc.dg/tree-ssa/inline_asm-1.c new file mode 100644 index 00000000000..4b241c30ba2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/inline_asm-1.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized -fdump-tree-alias1-vops" } */ +/* Test to make sure that inline-asm causes a V_MAY_DEF and that we call test_function twice. */ + +char test_function(void ) __attribute__((__pure__)); +char f(char *a) +{ + char b = test_function(); + asm("":"=m"(*a):"r"(b)); + b = test_function(); + return b; +} + +/* test_function should be called twice as the inline-asm changes memory. */ +/* { dg-final { scan-tree-dump-times "test_function" 2 "optimized"} } */ + +/* There should a V_MAY_DEF for the inline-asm. */ +/* { dg-final { scan-tree-dump-times "V_MAY_DEF" 1 "alias1"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/inline_asm-2.c b/gcc/testsuite/gcc.dg/tree-ssa/inline_asm-2.c new file mode 100644 index 00000000000..ef8f9607056 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/inline_asm-2.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-alias1-vops" } */ +/* Test to make sure that inline-asm causes a V_MAY_DEF. */ + + +void link_error(); +void f(char *a) +{ + int *a1 = (int *)a; + if (*a == 0) + asm("":"=m"(*a1)); + if (*a == 0) + link_error (); +} + +/* There should a V_MAY_DEF for the inline-asm and one for the link_error. */ +/* { dg-final { scan-tree-dump-times "V_MAY_DEF" 2 "alias1"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ivcanon-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ivcanon-1.c new file mode 100644 index 00000000000..c9fc2003ec7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ivcanon-1.c @@ -0,0 +1,38 @@ +/* APPLE LOCAL file lno */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-optimize -funroll-loops -fdump-tree-optimized" } */ + +void foo(void) +{ + int n = 16875; + + while (n) + { + if (n&1) + bar (n); + n >>= 1; + } +} + +static inline int power (long x, unsigned int n) +{ + long y = n % 2 ? x : 1; + + while (n >>= 1) + { + x = x * x; + if (n % 2) + y = y * x; + } + + return y; +} + +void test(long x) +{ + bar (power (x, 10)); + bar (power (x, 27)); +} + +/* All loops should be completely unrolled, so there should be no labels. */ +/* { dg-final { scan-tree-dump-times "<L" 0 "optimized"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-7.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-7.c new file mode 100644 index 00000000000..e5a408321d7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-7.c @@ -0,0 +1,34 @@ +/* PR tree-optimization/19828 */ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-lim-details" } */ + +int cst_fun1 (int) __attribute__((__const__)); +int cst_fun2 (int) __attribute__((__const__)); +int pure_fun1 (int) __attribute__((__pure__)); +int pure_fun2 (int) __attribute__((__pure__)); +int foo (void); + +int xxx (void) +{ + int i, k = foo (), x = 0; + + for (i = 0; i < 100; i++) + { + x += cst_fun1 (k); + x += pure_fun1 (k); + + if (k) + { + x += cst_fun2 (k); + x += pure_fun2 (k); + } + } + + return x; +} + +/* Calls to cst_fun1 and pure_fun1 may be moved out of the loop. + Calls to cst_fun2 and pure_fun2 should not be, since calling + with k = 0 may be invalid. */ + +/* { dg-final { scan-tree-dump-times "Moving statement" 2 "lim" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr20739.c b/gcc/testsuite/gcc.dg/tree-ssa/pr20739.c new file mode 100644 index 00000000000..c1e7b58e385 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr20739.c @@ -0,0 +1,24 @@ +/* PR middle-end/20739 */ + +/* dg-do compile */ +/* dg-options "-O" */ + +/* We used to fail to compile this because gimplification dropped the + conversion that added the const qualifier to the sub-expression + involving baz, and then immediately noticed and reported its + absence. */ + +typedef struct +{ + char chars[5]; +} +baz_t; + +extern baz_t * baz; + +extern void foo (baz_t); +int +bar (const baz_t * ls) +{ + foo (ls == 0 ? *(&baz[0]) : *ls); +} diff --git a/gcc/testsuite/gcc.dg/ucnid-1.c b/gcc/testsuite/gcc.dg/ucnid-1.c new file mode 100644 index 00000000000..da8a445d239 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ucnid-1.c @@ -0,0 +1,27 @@ +/* APPLE LOCAL begin mainline UCNs 2005-04-17 3892809 */ +/* { dg-do run } */ +/* { dg-options "-std=c99" } */ +void abort (void); + +int main (void) +{ + int \u00C0 = 1; + int \u00C1 = 2; + int \U000000C2 = 3; + int wh\u00ff = 4; + int a\u00c4b\u0441\U000003b4e = 5; + + if (\u00C0 != 1) + abort (); + if (\u00c1 != 2) + abort (); + if (\u00C2 != 3) + abort (); + if (wh\u00ff != 4) + abort (); + if (a\u00c4b\u0441\U000003b4e != 5) + abort (); + + return 0; +} +/* APPLE LOCAL end mainline UCNs 2005-04-17 3892809 */ diff --git a/gcc/testsuite/gcc.dg/ucnid-2.c b/gcc/testsuite/gcc.dg/ucnid-2.c new file mode 100644 index 00000000000..e4ad6437c1c --- /dev/null +++ b/gcc/testsuite/gcc.dg/ucnid-2.c @@ -0,0 +1,28 @@ +/* APPLE LOCAL begin mainline UCNs 2005-04-17 3892809 */ +/* { dg-do run } */ +/* { dg-options "-std=c99" } */ +void abort (void); + +static int \u00C0 = 1; +static int \u00C1 = 2; +static int \U000000C2 = 3; +static int wh\u00ff = 4; +static int a\u00c4b\u0441\U000003b4e = 5; + +int main (void) +{ + + if (\u00C0 != 1) + abort (); + if (\u00c1 != 2) + abort (); + if (\u00C2 != 3) + abort (); + if (wh\u00ff != 4) + abort (); + if (a\u00c4b\u0441\U000003b4e != 5) + abort (); + + return 0; +} +/* APPLE LOCAL end mainline UCNs 2005-04-17 3892809 */ diff --git a/gcc/testsuite/gcc.dg/ucnid-3.c b/gcc/testsuite/gcc.dg/ucnid-3.c new file mode 100644 index 00000000000..af35b7eeb60 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ucnid-3.c @@ -0,0 +1,28 @@ +/* APPLE LOCAL begin mainline UCNs 2005-04-17 3892809 */ +/* { dg-do run } */ +/* { dg-options "-std=c99" } */ +void abort (void); + +int \u00C0 = 1; +int \u00C1 = 2; +int \U000000C2 = 3; +int wh\u00ff = 4; +int a\u00c4b\u0441\U000003b4e = 5; + +int main (void) +{ + + if (\u00C0 != 1) + abort (); + if (\u00c1 != 2) + abort (); + if (\u00C2 != 3) + abort (); + if (wh\u00ff != 4) + abort (); + if (a\u00c4b\u0441\U000003b4e != 5) + abort (); + + return 0; +} +/* APPLE LOCAL end mainline UCNs 2005-04-17 3892809 */ diff --git a/gcc/testsuite/gcc.dg/ucnid-4.c b/gcc/testsuite/gcc.dg/ucnid-4.c new file mode 100644 index 00000000000..c248fd69dda --- /dev/null +++ b/gcc/testsuite/gcc.dg/ucnid-4.c @@ -0,0 +1,28 @@ +/* APPLE LOCAL begin mainline UCNs 2005-04-17 3892809 */ +/* { dg-do run } */ +/* { dg-options "-std=c99" } */ +void abort (void); + +int \u00C0(void) { return 1; } +int \u00C1(void) { return 2; } +int \U000000C2(void) { return 3; } +int wh\u00ff(void) { return 4; } +int a\u00c4b\u0441\U000003b4e(void) { return 5; } + +int main (void) +{ + + if (\u00C0() != 1) + abort (); + if (\u00c1() != 2) + abort (); + if (\u00C2() != 3) + abort (); + if (wh\u00ff() != 4) + abort (); + if (a\u00c4b\u0441\U000003b4e() != 5) + abort (); + + return 0; +} +/* APPLE LOCAL end mainline UCNs 2005-04-17 3892809 */ diff --git a/gcc/testsuite/gcc.dg/ucnid-5.c b/gcc/testsuite/gcc.dg/ucnid-5.c new file mode 100644 index 00000000000..ddbf766d3b2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ucnid-5.c @@ -0,0 +1,16 @@ +/* APPLE LOCAL begin mainline UCNs 2005-04-17 3892809 */ +/* { dg-do run } */ +/* { dg-options "-std=c99 -fdollars-in-identifiers" } */ +void abort (void); + +int a$b(void) { return 1; } + +int main (void) +{ + + if (a\u0024b() != 1) + abort (); + + return 0; +} +/* APPLE LOCAL end mainline UCNs 2005-04-17 3892809 */ diff --git a/gcc/testsuite/gcc.dg/ucnid-6.c b/gcc/testsuite/gcc.dg/ucnid-6.c new file mode 100644 index 00000000000..d0116413d82 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ucnid-6.c @@ -0,0 +1,28 @@ +/* APPLE LOCAL begin mainline UCNs 2005-04-17 3892809 */ +/* { dg-do run } */ +/* { dg-options "-std=c99 -save-temps" } */ +void abort (void); + +int \u00C0(void) { return 1; } +int \u00C1(void) { return 2; } +int \U000000C2(void) { return 3; } +int wh\u00ff(void) { return 4; } +int a\u00c4b\u0441\U000003b4e(void) { return 5; } + +int main (void) +{ + + if (\u00C0() != 1) + abort (); + if (\u00c1() != 2) + abort (); + if (\u00C2() != 3) + abort (); + if (wh\u00ff() != 4) + abort (); + if (a\u00c4b\u0441\U000003b4e() != 5) + abort (); + + return 0; +} +/* APPLE LOCAL end mainline UCNs 2005-04-17 3892809 */ diff --git a/gcc/testsuite/gcc.dg/uninit-C.c b/gcc/testsuite/gcc.dg/uninit-C.c index 45decf33521..741106cb463 100644 --- a/gcc/testsuite/gcc.dg/uninit-C.c +++ b/gcc/testsuite/gcc.dg/uninit-C.c @@ -3,7 +3,7 @@ /* { dg-options "-O -Wuninitialized" } */ /* Not all platforms support TImode integers. */ -#if defined(__LP64__) +#if defined(__LP64__) && !defined(__hppa__) typedef int TItype __attribute__ ((mode (TI))); #else typedef long TItype; diff --git a/gcc/testsuite/gcc.dg/vec_merge_opt_test.c b/gcc/testsuite/gcc.dg/vec_merge_opt_test.c new file mode 100644 index 00000000000..3191e6256cf --- /dev/null +++ b/gcc/testsuite/gcc.dg/vec_merge_opt_test.c @@ -0,0 +1,583 @@ +/* APPLE LOCAL begin radar 4110116 */ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-faltivec -O2" } */ + +extern void abort(); + +void foo(char *bS, char *bS_edge, int field_MBAFF, int top){ + char intra[16] __attribute__ ((aligned(16))); + signed short mv_const[8] __attribute__((aligned(16))); + + vector signed short v_zero, v_three, v_ref_mask00, v_ref_mask01, v_vec_maskv, v_vec_maskh; + vector unsigned char v_permv, v_permh, v_bS, v_bSh, v_bSv, v_cbp_maskv, v_cbp_maskvn, v_cbp_maskh, v_cbp_maskhn, v_intra_maskh, v_intra_maskv, v_intra_maskhn, v_intra_maskvn; + vector unsigned char tmp7, tmp8, tmp9, tmp10, v_c1, v_cbp1, v_cbp2, v_pocl, v_poch; + vector signed short v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6; + vector signed short idx0; + vector signed short tmp00, tmp01, tmp02, tmp03; + v_zero = (vector signed short) 0x0; + v_three = (vector signed short) vec_ld (0, (vector signed short *) mv_const); + + vector unsigned char v_coef_mask = vec_ld(0, (vector unsigned char *)mv_const); + vector unsigned char v_coef_mask_hi = vec_splat(v_coef_mask, 0); + vector unsigned char v_coef_mask_lo = vec_splat(v_coef_mask, 1); + v_coef_mask = vec_sld(v_coef_mask_hi, v_coef_mask_lo, 8); + vector unsigned char v_bit_mask = vec_sub(vec_splat_u8(7), vec_lvsl(0, (unsigned char *)0)); + v_bit_mask = vec_sld(vec_sld(v_bit_mask, v_bit_mask, 8), v_bit_mask, 8); + v_bit_mask = vec_sl(vec_splat_u8(1), v_bit_mask); + tmp5 = (vector signed short) vec_and(v_coef_mask, v_bit_mask); + + intra[0] = 1; + tmp8 = vec_ld (0, (vector unsigned char *) intra); + tmp9 = vec_ld (0, (vector unsigned char *) mv_const); + tmp10 = vec_ld (0, (vector unsigned char *) mv_const); + v_permv = vec_ld (0, (vector unsigned char *) mv_const); + v_permh = vec_ld (0, (vector unsigned char *) mv_const); + tmp6 = vec_ld (0, (vector signed short *) mv_const); + + tmp8 = vec_splat((vector unsigned char) tmp8, 0); + tmp9 = vec_splat((vector unsigned char) tmp9, 12); + tmp10 = vec_splat((vector unsigned char) tmp10, 12); + tmp9 = vec_sld ((vector unsigned char) tmp9,(vector unsigned char) tmp8, 12); + tmp10 = vec_sld ((vector unsigned char) tmp10, (vector unsigned char) tmp8, 12); + v_intra_maskv = vec_or (tmp9, tmp8); + v_intra_maskh = vec_or (tmp10, tmp8); + v_intra_maskv = (vector unsigned char) vec_cmpgt ((vector unsigned char) v_intra_maskv, (vector unsigned char) v_zero); + v_intra_maskh = (vector unsigned char) vec_cmpgt ((vector unsigned char) v_intra_maskh, (vector unsigned char) v_zero); + + tmp9 = vec_lvsl (4 + (top<<2), (unsigned char *) 0x0); + v_cbp1 = vec_perm ((vector unsigned char) tmp6, (vector unsigned char) tmp6, tmp9); + v_cbp2 = (vector unsigned char) vec_perm ((vector unsigned char) tmp5, (vector unsigned char) tmp5, (vector unsigned char) v_permv); + v_cbp1 = (vector unsigned char) vec_sld ((vector unsigned char) v_cbp1,(vector unsigned char) v_cbp2, 12); + v_cbp_maskv = vec_or (v_cbp1, v_cbp2); + + tmp9 = vec_lvsl (12 + (top<<2), (unsigned char *) 0x0); + v_cbp1 = vec_perm ((vector unsigned char) tmp6, (vector unsigned char) tmp6, tmp9); + v_cbp2 = (vector unsigned char) vec_perm ((vector unsigned char) tmp5, (vector unsigned char) tmp5, (vector unsigned char) v_permh); + v_cbp1 = (vector unsigned char) vec_sld ((vector unsigned char) v_cbp1,(vector unsigned char) v_cbp2, 12); + v_cbp_maskh = vec_or (v_cbp1, v_cbp2); + + v_cbp_maskv = (vector unsigned char) vec_cmpgt ((vector unsigned char) v_cbp_maskv, (vector unsigned char) v_zero); + v_cbp_maskh = (vector unsigned char) vec_cmpgt ((vector unsigned char) v_cbp_maskh, (vector unsigned char) v_zero); + + intra[0] =0; + intra[1] =1; + intra[2] =2; + intra[3] =3; + intra[4] =4; + intra[5] = 5; + intra[6] =6; + intra[7] =7; + intra[8] =8; + intra[9] =9; + intra[10] =9; + intra[11] =9; + intra[12] = 0xff; + + idx0 = vec_ld (0, (signed short *) intra); + + v_c1 = (vector unsigned char) 1; + + if (field_MBAFF){ + v0 = (vector signed short) vec_and ((vector unsigned char) idx0, v_c1); + idx0 = (vector signed short) vec_sra ((vector unsigned char) idx0, v_c1); + + v1 = vec_sld (v0, v0, 15); + v1 = (vector signed short) vec_pack (v1, v0); + + v2 = vec_sld (v1, v1, 2); + v3 = vec_sld (v1, v1, 10); + + v4 = (vector signed short) vec_cmpeq ((vector signed char) v1, (vector signed char) v2); + v5 = (vector signed short) vec_cmpeq ((vector signed char) v1, (vector signed char) v3); + v6 = (vector signed short) vec_cmpeq ((vector signed char) v2, (vector signed char) v3); + } + else { + v4 = v5 = v6 = vec_nor (v_zero, v_zero); + } + + tmp1 = (vector signed short) vec_sl ((vector unsigned char) idx0, v_c1); + v_c1 = vec_mergeh ((vector unsigned char) v_zero, v_c1); + tmp1 = (vector signed short) vec_add (tmp1, (vector signed short) v_c1); + + v_pocl = vec_ld (0, (vector unsigned char *) mv_const); + v_poch = vec_ld (0, (vector unsigned char *) mv_const); + tmp2 = (vector signed short) vec_perm (v_pocl, v_poch, (vector unsigned char) tmp1); + + v_pocl = vec_ld (0, (vector unsigned char *) mv_const); + v_poch = vec_ld (16, (vector unsigned char *) mv_const); + tmp1 = (vector signed short) vec_perm (v_pocl, v_poch, (vector unsigned char) tmp1); + tmp1 = vec_sel (tmp1, tmp2, (vector unsigned short) (0xffff,0xffff,0,0,0,0,0,0)); + + tmp3 = (vector signed short) vec_splat ((vector unsigned char) idx0, 12); + v_c1 = (vector unsigned char) vec_nor (v_zero, v_zero); + tmp0 = (vector signed short) vec_cmpeq ((vector signed char) idx0, (vector signed char) v_c1); + tmp1 = vec_sel (tmp1, (vector signed short) tmp3, (vector unsigned short) tmp0); + + tmp2 = vec_sld (tmp1, tmp1, 15); + tmp1 = (vector signed short) vec_pack (tmp2, tmp1); + + tmp2 = vec_sld (tmp1, tmp1, 2); + tmp3 = vec_sld (tmp1, tmp1, 10); + + tmp0 = (vector signed short) vec_cmpeq ((vector signed char) tmp1, (vector signed char) tmp2); + tmp4 = (vector signed short) vec_cmpeq ((vector signed char) tmp1, (vector signed char) tmp3); + tmp1 = (vector signed short) vec_cmpeq ((vector signed char) tmp2, (vector signed char) tmp3); + tmp0 = vec_and (tmp0, v4); + tmp4 = vec_and (tmp4, v5); + tmp1 = vec_and (tmp1, v6); + tmp2 = vec_sld ((vector signed short) tmp0, (vector signed short) tmp0, 8); + tmp3 = vec_sld ((vector signed short) tmp4, (vector signed short) tmp4, 8); + tmp5 = vec_sld ((vector signed short) tmp1, (vector signed short) tmp1, 8); + tmp0 = vec_and (tmp0, tmp2); + tmp4 = vec_and (tmp4, tmp3); + tmp1 = vec_and (tmp1, tmp5); + v_ref_mask00 = vec_mergeh ((vector signed short) tmp0, (vector signed short) v_c1); + v_ref_mask01 = vec_mergeh ((vector signed short) tmp4, (vector signed short) tmp1); + v_ref_mask00 = (vector signed short) vec_mergeh ((vector unsigned char) v_ref_mask00, (vector unsigned char) v_ref_mask00); + v_ref_mask01 = (vector signed short) vec_mergeh ((vector unsigned char) v_ref_mask01, (vector unsigned char) v_ref_mask01); + + v0 = vec_ld (0, (vector signed short *) mv_const); + v1 = vec_ld (16, (vector signed short *) mv_const); + v4 = vec_ld (64, (vector signed short *) mv_const); + v5 = vec_ld (80, (vector signed short *) mv_const); + v8 = vec_ld (0, (vector signed short *) mv_const); + v9 = vec_ld (16, (vector signed short *) mv_const); + + tmp0 = (vector signed short) vec_perm ((vector unsigned char) v8, (vector unsigned char) v8, (vector unsigned char) (0,1,2,3,8,9,10,11,4,5,6,7,12,13,14,15)); + tmp1 = (vector signed short) vec_mergeh ((vector signed int) v0, (vector signed int) v1); + tmp2 = vec_sld (tmp1, tmp1, 8); + tmp3 = vec_sub (vec_max (tmp0, tmp1), vec_min (tmp0, tmp1)); + tmp4 = vec_sub (vec_max (tmp0, tmp2), vec_min (tmp0, tmp2)); + tmp3 = (vector signed short) vec_cmpgt (tmp3, v_three); + tmp4 = (vector signed short) vec_cmpgt (tmp4, v_three); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + tmp0 = (vector signed short) vec_perm ((vector unsigned char) v9, (vector unsigned char) v9, (vector unsigned char) (0,1,2,3,8,9,10,11,4,5,6,7,12,13,14,15)); + tmp1 = (vector signed short) vec_mergeh ((vector signed int) v4, (vector signed int) v5); + tmp2 = vec_sld (tmp1, tmp1, 8); + tmp5 = vec_sub (vec_max (tmp0, tmp1), vec_min (tmp0, tmp1)); + tmp6 = vec_sub (vec_max (tmp0, tmp2), vec_min (tmp0, tmp2)); + tmp5 = (vector signed short) vec_cmpgt (tmp5, v_three); + tmp6 = (vector signed short) vec_cmpgt (tmp6, v_three); + tmp0 = vec_sld (tmp5, tmp5, 14); + tmp1 = vec_sld (tmp6, tmp6, 14); + tmp5 = vec_or (tmp0, tmp5); + tmp6 = vec_or (tmp1, tmp6); + + tmp3 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp5); + tmp4 = (vector signed short) vec_pack ((vector unsigned int) tmp4, (vector unsigned int) tmp6); + tmp5 = vec_sld (tmp3, tmp3, 12); + tmp6 = vec_sld (tmp4, tmp4, 12); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + tmp00 = (vector signed short) vec_pack ((vector unsigned short) tmp3, (vector unsigned short) tmp4); + + tmp0 = (vector signed short) vec_mergeh ((vector signed int) v0, (vector signed int) v1); + tmp1 = (vector signed short) vec_mergel ((vector signed int) v0, (vector signed int) v1); + tmp2 = vec_sld (tmp1, tmp1, 8); + tmp3 = vec_sub (vec_max (tmp0, tmp1), vec_min (tmp0, tmp1)); + tmp4 = vec_sub (vec_max (tmp0, tmp2), vec_min (tmp0, tmp2)); + tmp3 = (vector signed short) vec_cmpgt (tmp3, v_three); + tmp4 = (vector signed short) vec_cmpgt (tmp4, v_three); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + + tmp0 = (vector signed short) vec_mergeh ((vector signed int) v4, (vector signed int) v5); + tmp1 = (vector signed short) vec_mergel ((vector signed int) v4, (vector signed int) v5); + tmp2 = vec_sld (tmp1, tmp1, 8); + tmp5 = vec_sub (vec_max (tmp0, tmp1), vec_min (tmp0, tmp1)); + tmp6 = vec_sub (vec_max (tmp0, tmp2), vec_min (tmp0, tmp2)); + tmp5 = (vector signed short) vec_cmpgt (tmp5, v_three); + tmp6 = (vector signed short) vec_cmpgt (tmp6, v_three); + tmp0 = vec_sld (tmp5, tmp5, 14); + tmp1 = vec_sld (tmp6, tmp6, 14); + tmp5 = vec_or (tmp0, tmp5); + tmp6 = vec_or (tmp1, tmp6); + + tmp3 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp5); + tmp4 = (vector signed short) vec_pack ((vector unsigned int) tmp4, (vector unsigned int) tmp6); + tmp5 = vec_sld (tmp3, tmp3, 12); + tmp6 = vec_sld (tmp4, tmp4, 12); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + tmp01 = (vector signed short) vec_pack ((vector unsigned short) tmp3, (vector unsigned short) tmp4); + + v2 = vec_ld (32, (vector signed short *) mv_const); + v3 = vec_ld (48, (vector signed short *) mv_const); + v6 = vec_ld (96, (vector signed short *) mv_const); + v7 = vec_ld (112,(vector signed short *) mv_const); + + tmp0 = (vector signed short) vec_mergel ((vector signed int) v0, (vector signed int) v1); + tmp1 = (vector signed short) vec_mergeh ((vector signed int) v2, (vector signed int) v3); + tmp2 = vec_sld (tmp1, tmp1, 8); + tmp3 = vec_sub (vec_max (tmp0, tmp1), vec_min (tmp0, tmp1)); + tmp4 = vec_sub (vec_max (tmp0, tmp2), vec_min (tmp0, tmp2)); + tmp3 = (vector signed short) vec_cmpgt (tmp3, v_three); + tmp4 = (vector signed short) vec_cmpgt (tmp4, v_three); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + + tmp0 = (vector signed short) vec_mergel ((vector signed int) v4, (vector signed int) v5); + tmp1 = (vector signed short) vec_mergeh ((vector signed int) v6, (vector signed int) v7); + tmp2 = vec_sld (tmp1, tmp1, 8); + tmp5 = vec_sub (vec_max (tmp0, tmp1), vec_min (tmp0, tmp1)); + tmp6 = vec_sub (vec_max (tmp0, tmp2), vec_min (tmp0, tmp2)); + tmp5 = (vector signed short) vec_cmpgt (tmp5, v_three); + tmp6 = (vector signed short) vec_cmpgt (tmp6, v_three); + tmp0 = vec_sld (tmp5, tmp5, 14); + tmp1 = vec_sld (tmp6, tmp6, 14); + tmp5 = vec_or (tmp0, tmp5); + tmp6 = vec_or (tmp1, tmp6); + + tmp3 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp5); + tmp4 = (vector signed short) vec_pack ((vector unsigned int) tmp4, (vector unsigned int) tmp6); + tmp5 = vec_sld (tmp3, tmp3, 12); + tmp6 = vec_sld (tmp4, tmp4, 12); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + tmp02 = (vector signed short) vec_pack ((vector unsigned short) tmp3, (vector unsigned short) tmp4); + + tmp0 = (vector signed short) vec_mergeh ((vector signed int) v2, (vector signed int) v3); + tmp1 = (vector signed short) vec_mergel ((vector signed int) v2, (vector signed int) v3); + tmp2 = vec_sld (tmp1, tmp1, 8); + tmp3 = vec_sub (vec_max (tmp0, tmp1), vec_min (tmp0, tmp1)); + tmp4 = vec_sub (vec_max (tmp0, tmp2), vec_min (tmp0, tmp2)); + tmp3 = (vector signed short) vec_cmpgt (tmp3, v_three); + tmp4 = (vector signed short) vec_cmpgt (tmp4, v_three); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + + tmp0 = (vector signed short) vec_mergeh ((vector signed int) v6, (vector signed int) v7); + tmp1 = (vector signed short) vec_mergel ((vector signed int) v6, (vector signed int) v7); + tmp2 = vec_sld (tmp1, tmp1, 8); + tmp5 = vec_sub (vec_max (tmp0, tmp1), vec_min (tmp0, tmp1)); + tmp6 = vec_sub (vec_max (tmp0, tmp2), vec_min (tmp0, tmp2)); + tmp5 = (vector signed short) vec_cmpgt (tmp5, v_three); + tmp6 = (vector signed short) vec_cmpgt (tmp6, v_three); + tmp0 = vec_sld (tmp5, tmp5, 14); + tmp1 = vec_sld (tmp6, tmp6, 14); + tmp5 = vec_or (tmp0, tmp5); + tmp6 = vec_or (tmp1, tmp6); + + tmp3 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp5); + tmp4 = (vector signed short) vec_pack ((vector unsigned int) tmp4, (vector unsigned int) tmp6); + tmp5 = vec_sld (tmp3, tmp3, 12); + tmp6 = vec_sld (tmp4, tmp4, 12); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + tmp03 = (vector signed short) vec_pack ((vector unsigned short) tmp3, (vector unsigned short) tmp4); + + tmp0 = (vector signed short) vec_pack ((vector unsigned int) tmp00, (vector unsigned int) tmp01); + tmp1 = (vector signed short) vec_pack ((vector unsigned int) tmp02, (vector unsigned int) tmp03); + tmp2 = (vector signed short) vec_mergeh ((vector signed int) tmp0, (vector signed int) tmp1); + tmp3 = (vector signed short) vec_mergel ((vector signed int) tmp0, (vector signed int) tmp1); + tmp4 = (vector signed short) vec_mergeh ((vector signed int) tmp2, (vector signed int) tmp3); + tmp5 = (vector signed short) vec_mergel ((vector signed int) tmp2, (vector signed int) tmp3); + tmp4 = vec_and (v_ref_mask00, tmp4); + tmp5 = vec_and (v_ref_mask01, tmp5); + + tmp0 = vec_nor (v_ref_mask00, v_ref_mask01); + tmp1 = vec_and (v_ref_mask00, v_ref_mask01); + tmp2 = vec_and (tmp4, tmp5); + tmp2 = vec_and (tmp2, tmp1); + tmp3 = vec_nor (tmp4, tmp5); + tmp3 = vec_nor (tmp3, tmp1); + v_vec_maskv = vec_or (tmp0, tmp2); + v_vec_maskv = vec_or (v_vec_maskv, tmp3); + + intra[0] = 1; + intra[1] = 1; + intra[2] = 2; + intra[3] = 3; + intra[4] = 2; + intra[5] = 2; + intra[6] = 2; + intra[7] = 1; + intra[8] = 1; + intra[9] = 5; + intra[10] = 5; + intra[11] = 5; + + intra[13] = 0; + intra[14] = 0; + intra[15] = 0; + + idx0 = vec_ld (0, (signed short *) intra); + + v_c1 = (vector unsigned char) 1; + + if (field_MBAFF){ + v8 = (vector signed short) vec_and ((vector unsigned char) idx0, v_c1); + idx0 = (vector signed short) vec_sra ((vector unsigned char) idx0, v_c1); + + v9 = vec_sld (v8, v8, 15); + v9 = (vector signed short) vec_pack (v9, v8); + + v10 = vec_sld (v9, v9, 2); + v11 = vec_sld (v9, v9, 10); + + v8 = (vector signed short) vec_cmpeq ((vector signed char) v9, (vector signed char) v10); + v9 = (vector signed short) vec_cmpeq ((vector signed char) v9, (vector signed char) v11); + v10 = (vector signed short) vec_cmpeq ((vector signed char) v10, (vector signed char) v11); + } + else { + v8 = v9 = v10 = vec_nor (v_zero, v_zero); + } + + tmp1 = (vector signed short) vec_sl ((vector unsigned char) idx0, v_c1); + + v_c1 = vec_mergeh ((vector unsigned char) v_zero, v_c1); + tmp1 = (vector signed short) vec_add (tmp1, (vector signed short) v_c1); + +if (1){ + unsigned char toto2[16] __attribute__((aligned(16))); + int m; + + vec_st(v_c1, 0, (unsigned char *) toto2); + for (m=0; m < 16; m +=2) + if (toto2[m] != 0) + abort(); + for (m=1; m < 16; m +=2) + if (toto2[m] != 1) + abort(); +} + + v_pocl = vec_ld (32, (vector unsigned char *) mv_const); + v_poch = vec_ld (48, (vector unsigned char *) mv_const); + tmp2 = (vector signed short) vec_perm (v_pocl, v_poch, (vector unsigned char) tmp1); + + v_pocl = vec_ld (0, (vector unsigned char *) mv_const); + v_poch = vec_ld (16, (vector unsigned char *) mv_const); + + tmp1 = (vector signed short) vec_perm (v_pocl, v_poch, (vector unsigned char) tmp1); + + tmp1 = vec_sel (tmp1, tmp2, (vector unsigned short) (0xffff,0xffff,0,0,0,0,0,0)); + + + tmp3 = (vector signed short) vec_splat ((vector unsigned char) idx0, 12); + v_c1 = (vector unsigned char) vec_nor (v_zero, v_zero); + tmp0 = (vector signed short) vec_cmpeq ((vector signed char) idx0, (vector signed char) v_c1); + tmp1 = vec_sel (tmp1, (vector signed short) tmp3, (vector unsigned short) tmp0); + + tmp2 = vec_sld (tmp1, tmp1, 15); + tmp1 = (vector signed short) vec_pack (tmp2, tmp1); + + + tmp2 = vec_sld (tmp1, tmp1, 2); + tmp3 = vec_sld (tmp1, tmp1, 10); + + tmp0 = (vector signed short) vec_cmpeq ((vector signed char) tmp1, (vector signed char) tmp2); + tmp4 = (vector signed short) vec_cmpeq ((vector signed char) tmp1, (vector signed char) tmp3); + tmp1 = (vector signed short) vec_cmpeq ((vector signed char) tmp2, (vector signed char) tmp3); + tmp0 = vec_and (tmp0, v8); + tmp4 = vec_and (tmp4, v9); + tmp1 = vec_and (tmp1, v10); + tmp2 = vec_sld ((vector signed short) tmp0, (vector signed short) tmp0, 8); + tmp3 = vec_sld ((vector signed short) tmp4, (vector signed short) tmp4, 8); + tmp5 = vec_sld ((vector signed short) tmp1, (vector signed short) tmp1, 8); + tmp0 = vec_and (tmp0, tmp2); + tmp4 = vec_and (tmp4, tmp3); + tmp1 = vec_and (tmp1, tmp5); + v_ref_mask00 = vec_mergeh ((vector signed short) tmp0, (vector signed short) v_c1); + v_ref_mask01 = vec_mergeh ((vector signed short) tmp4, (vector signed short) tmp1); + v_ref_mask00 = (vector signed short) vec_mergeh ((vector unsigned char) v_ref_mask00, (vector unsigned char) v_ref_mask00); + v_ref_mask01 = (vector signed short) vec_mergeh ((vector unsigned char) v_ref_mask01, (vector unsigned char) v_ref_mask01); + + + v_permv= vec_ld (0, (vector unsigned char *) mv_const); + v8 = vec_ld (0, (vector signed short *) mv_const); + v9 = vec_ld (16, (vector signed short *) mv_const); + tmp2 = vec_perm (v0, v0, v_permv); + tmp3 = vec_sub (vec_max (v8, v0), vec_min (v8, v0)); + tmp4 = vec_sub (vec_max (v8, tmp2), vec_min (v8, tmp2)); + tmp3 = (vector signed short) vec_cmpgt (tmp3, v_three); + tmp4 = (vector signed short) vec_cmpgt (tmp4, v_three); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + + tmp2 = vec_perm (v2, v2, v_permv); + tmp5 = vec_sub (vec_max (v9, v2), vec_min (v9, v2)); + tmp6 = vec_sub (vec_max (v9, tmp2), vec_min (v9, tmp2)); + tmp5 = (vector signed short) vec_cmpgt (tmp5, v_three); + tmp6 = (vector signed short) vec_cmpgt (tmp6, v_three); + tmp0 = vec_sld (tmp5, tmp5, 14); + tmp1 = vec_sld (tmp6, tmp6, 14); + tmp5 = vec_or (tmp0, tmp5); + tmp6 = vec_or (tmp1, tmp6); + + tmp3 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp5); + tmp4 = (vector signed short) vec_pack ((vector unsigned int) tmp4, (vector unsigned int) tmp6); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + tmp00 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp4); + + tmp2 = vec_perm (v1, v1, v_permv); + tmp3 = vec_sub (vec_max (v0, v1), vec_min (v0, v1)); + tmp4 = vec_sub (vec_max (v0, tmp2), vec_min (v0, tmp2)); + tmp3 = (vector signed short) vec_cmpgt (tmp3, v_three); + tmp4 = (vector signed short) vec_cmpgt (tmp4, v_three); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + + tmp2 = vec_perm (v3, v3, v_permv); + tmp5 = vec_sub (vec_max (v2, v3), vec_min (v2, v3)); + tmp6 = vec_sub (vec_max (v2, tmp2), vec_min (v2, tmp2)); + tmp5 = (vector signed short) vec_cmpgt (tmp5, v_three); + tmp6 = (vector signed short) vec_cmpgt (tmp6, v_three); + tmp0 = vec_sld (tmp5, tmp5, 14); + tmp1 = vec_sld (tmp6, tmp6, 14); + tmp5 = vec_or (tmp0, tmp5); + tmp6 = vec_or (tmp1, tmp6); + + tmp3 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp5); + tmp4 = (vector signed short) vec_pack ((vector unsigned int) tmp4, (vector unsigned int) tmp6); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + tmp01 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp4); + + tmp2 = vec_perm (v4, v4, v_permv); + tmp3 = vec_sub (vec_max (v1, v4), vec_min (v1, v4)); + tmp4 = vec_sub (vec_max (v1, tmp2), vec_min (v1, tmp2)); + tmp3 = (vector signed short) vec_cmpgt (tmp3, v_three); + tmp4 = (vector signed short) vec_cmpgt (tmp4, v_three); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + + tmp2 = vec_perm (v6, v6, v_permv); + tmp5 = vec_sub (vec_max (v3, v6), vec_min (v3, v6)); + tmp6 = vec_sub (vec_max (v3, tmp2), vec_min (v3, tmp2)); + tmp5 = (vector signed short) vec_cmpgt (tmp5, v_three); + tmp6 = (vector signed short) vec_cmpgt (tmp6, v_three); + tmp0 = vec_sld (tmp5, tmp5, 14); + tmp1 = vec_sld (tmp6, tmp6, 14); + tmp5 = vec_or (tmp0, tmp5); + tmp6 = vec_or (tmp1, tmp6); + + tmp3 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp5); + tmp4 = (vector signed short) vec_pack ((vector unsigned int) tmp4, (vector unsigned int) tmp6); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + tmp02 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp4); + + + tmp2 = vec_perm (v5, v5, v_permv); + tmp3 = vec_sub (vec_max (v4, v5), vec_min (v4, v5)); + tmp4 = vec_sub (vec_max (v4, tmp2), vec_min (v4, tmp2)); + tmp3 = (vector signed short) vec_cmpgt (tmp3, v_three); + tmp4 = (vector signed short) vec_cmpgt (tmp4, v_three); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + + tmp2 = vec_perm (v7, v7, v_permv); + tmp5 = vec_sub (vec_max (v6, v7), vec_min (v6, v7)); + tmp6 = vec_sub (vec_max (v6, tmp2), vec_min (v6, tmp2)); + tmp5 = (vector signed short) vec_cmpgt (tmp5, v_three); + tmp6 = (vector signed short) vec_cmpgt (tmp6, v_three); + tmp0 = vec_sld (tmp5, tmp5, 14); + tmp1 = vec_sld (tmp6, tmp6, 14); + tmp5 = vec_or (tmp0, tmp5); + tmp6 = vec_or (tmp1, tmp6); + + tmp3 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp5); + tmp4 = (vector signed short) vec_pack ((vector unsigned int) tmp4, (vector unsigned int) tmp6); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + tmp03 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp4); + + tmp0 = (vector signed short) vec_pack ((vector unsigned short) tmp00, (vector unsigned short) tmp01); + tmp1 = (vector signed short) vec_pack ((vector unsigned short) tmp02, (vector unsigned short) tmp03); + tmp2 = (vector signed short) vec_mergeh ((vector signed int) tmp0, (vector signed int) tmp1); + tmp3 = (vector signed short) vec_mergel ((vector signed int) tmp0, (vector signed int) tmp1); + tmp4 = (vector signed short) vec_mergeh ((vector signed int) tmp2, (vector signed int) tmp3); + tmp5 = (vector signed short) vec_mergel ((vector signed int) tmp2, (vector signed int) tmp3); + tmp4 = vec_and (v_ref_mask00, tmp4); + tmp5 = vec_and (v_ref_mask01, tmp5); + + tmp0 = vec_nor (v_ref_mask00, v_ref_mask01); + tmp1 = vec_and (v_ref_mask00, v_ref_mask01); + tmp2 = vec_and (tmp4, tmp5); + tmp2 = vec_and (tmp2, tmp1); + tmp3 = vec_nor (tmp4, tmp5); + tmp3 = vec_nor (tmp3, tmp1); + v_vec_maskh = vec_or (tmp0, tmp2); + v_vec_maskh = vec_or (v_vec_maskh, tmp3); + + + v_intra_maskvn = vec_nor (v_intra_maskv, v_intra_maskv); + v_intra_maskhn = vec_nor (v_intra_maskh, v_intra_maskh); + v_cbp_maskvn = (vector unsigned char) vec_cmpeq ((vector unsigned char) v_cbp_maskv, (vector unsigned char) v_zero); + v_cbp_maskhn = (vector unsigned char) vec_cmpeq ((vector unsigned char) v_cbp_maskh, (vector unsigned char) v_zero); + + v_cbp_maskv = vec_and (v_cbp_maskv, v_intra_maskvn); + v_cbp_maskh = vec_and (v_cbp_maskh, v_intra_maskhn); + v_vec_maskv = vec_and (v_vec_maskv, (vector signed short) v_intra_maskvn); + v_vec_maskv = vec_and (v_vec_maskv, (vector signed short) v_cbp_maskvn); + v_vec_maskh = vec_and (v_vec_maskh, (vector signed short) v_intra_maskhn); + v_vec_maskh = vec_and (v_vec_maskh, (vector signed short) v_cbp_maskhn); + + tmp9 = vec_splat_u8(2); + tmp8 = vec_splat_u8(1); + v_bS = vec_ld (0, (vector unsigned char *) mv_const); + + v_bSv = vec_and ((vector unsigned char) v_bS, (vector unsigned char)v_intra_maskv); + tmp7 = vec_and ((vector unsigned char)tmp9, (vector unsigned char)v_cbp_maskv); + tmp6 = (vector signed short) vec_and ((vector unsigned char)tmp8, (vector unsigned char)v_vec_maskv); + tmp7 = vec_or ((vector unsigned char)tmp7, (vector unsigned char)tmp6); + v_bSv = vec_or ((vector unsigned char)tmp7, (vector unsigned char)v_bSv); + + v_bS = vec_ld (0, (vector unsigned char *) mv_const); + v_bSh = vec_and ((vector unsigned char) v_bS, (vector unsigned char)v_intra_maskh); + tmp7 = vec_and ((vector unsigned char)tmp9, (vector unsigned char)v_cbp_maskh); + tmp6 = (vector signed short) vec_and ((vector unsigned char)tmp8, (vector unsigned char)v_vec_maskh); + tmp7 = vec_or ((vector unsigned char)tmp7, (vector unsigned char)tmp6); + v_bSh = vec_or ((vector unsigned char)tmp7, (vector unsigned char)v_bSh); + + v_permh = (vector unsigned char) vec_ld (0 , (vector unsigned char *) mv_const); + v_permv = (vector unsigned char) vec_ld (0, (vector unsigned char *) mv_const); + v_bSv = vec_and (v_bSv, v_permv); + v_bSh = vec_and (v_bSh, v_permh); + + vec_st (v_bSv, 0, (unsigned char *) mv_const); + vec_st (v_bSh, 0, (unsigned char *) mv_const); + + v_bSv = vec_mergeh (v_bSv, v_bSv); + v_bSv = vec_mergeh (v_bSv, v_bSv); + v_bSh = vec_mergeh (v_bSh, v_bSh); + v_bSh = vec_mergeh (v_bSh, v_bSh); + + vec_st (v_bSv, 0, (vector unsigned char *) mv_const); + vec_st (v_bSh, 0,(vector unsigned char *) mv_const); +} + + +int main(int argc, char **argv) +{ + char toto[32] __attribute__((aligned(16))); + foo(toto, toto, 0, 0); + return 0; +} +/* APPLE LOCAL end radar 4110116 */ diff --git a/gcc/testsuite/gcc.dg/vec_mergel_opt_test.c b/gcc/testsuite/gcc.dg/vec_mergel_opt_test.c new file mode 100644 index 00000000000..265477987f2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vec_mergel_opt_test.c @@ -0,0 +1,583 @@ +/* APPLE LOCAL begin radar 4110116 */ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-options "-faltivec -O2" } */ + +extern void abort(); + +void foo(char *bS, char *bS_edge, int field_MBAFF, int top){ + char intra[16] __attribute__ ((aligned(16))); + signed short mv_const[8] __attribute__((aligned(16))); + + vector signed short v_zero, v_three, v_ref_mask00, v_ref_mask01, v_vec_maskv, v_vec_maskh; + vector unsigned char v_permv, v_permh, v_bS, v_bSh, v_bSv, v_cbp_maskv, v_cbp_maskvn, v_cbp_maskh, v_cbp_maskhn, v_intra_maskh, v_intra_maskv, v_intra_maskhn, v_intra_maskvn; + vector unsigned char tmp7, tmp8, tmp9, tmp10, v_c1, v_cbp1, v_cbp2, v_pocl, v_poch; + vector signed short v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6; + vector signed short idx0; + vector signed short tmp00, tmp01, tmp02, tmp03; + v_zero = (vector signed short) 0x0; + v_three = (vector signed short) vec_ld (0, (vector signed short *) mv_const); + + vector unsigned char v_coef_mask = vec_ld(0, (vector unsigned char *)mv_const); + vector unsigned char v_coef_mask_hi = vec_splat(v_coef_mask, 0); + vector unsigned char v_coef_mask_lo = vec_splat(v_coef_mask, 1); + v_coef_mask = vec_sld(v_coef_mask_hi, v_coef_mask_lo, 8); + vector unsigned char v_bit_mask = vec_sub(vec_splat_u8(7), vec_lvsl(0, (unsigned char *)0)); + v_bit_mask = vec_sld(vec_sld(v_bit_mask, v_bit_mask, 8), v_bit_mask, 8); + v_bit_mask = vec_sl(vec_splat_u8(1), v_bit_mask); + tmp5 = (vector signed short) vec_and(v_coef_mask, v_bit_mask); + + intra[0] = 1; + tmp8 = vec_ld (0, (vector unsigned char *) intra); + tmp9 = vec_ld (0, (vector unsigned char *) mv_const); + tmp10 = vec_ld (0, (vector unsigned char *) mv_const); + v_permv = vec_ld (0, (vector unsigned char *) mv_const); + v_permh = vec_ld (0, (vector unsigned char *) mv_const); + tmp6 = vec_ld (0, (vector signed short *) mv_const); + + tmp8 = vec_splat((vector unsigned char) tmp8, 0); + tmp9 = vec_splat((vector unsigned char) tmp9, 12); + tmp10 = vec_splat((vector unsigned char) tmp10, 12); + tmp9 = vec_sld ((vector unsigned char) tmp9,(vector unsigned char) tmp8, 12); + tmp10 = vec_sld ((vector unsigned char) tmp10, (vector unsigned char) tmp8, 12); + v_intra_maskv = vec_or (tmp9, tmp8); + v_intra_maskh = vec_or (tmp10, tmp8); + v_intra_maskv = (vector unsigned char) vec_cmpgt ((vector unsigned char) v_intra_maskv, (vector unsigned char) v_zero); + v_intra_maskh = (vector unsigned char) vec_cmpgt ((vector unsigned char) v_intra_maskh, (vector unsigned char) v_zero); + + tmp9 = vec_lvsl (4 + (top<<2), (unsigned char *) 0x0); + v_cbp1 = vec_perm ((vector unsigned char) tmp6, (vector unsigned char) tmp6, tmp9); + v_cbp2 = (vector unsigned char) vec_perm ((vector unsigned char) tmp5, (vector unsigned char) tmp5, (vector unsigned char) v_permv); + v_cbp1 = (vector unsigned char) vec_sld ((vector unsigned char) v_cbp1,(vector unsigned char) v_cbp2, 12); + v_cbp_maskv = vec_or (v_cbp1, v_cbp2); + + tmp9 = vec_lvsl (12 + (top<<2), (unsigned char *) 0x0); + v_cbp1 = vec_perm ((vector unsigned char) tmp6, (vector unsigned char) tmp6, tmp9); + v_cbp2 = (vector unsigned char) vec_perm ((vector unsigned char) tmp5, (vector unsigned char) tmp5, (vector unsigned char) v_permh); + v_cbp1 = (vector unsigned char) vec_sld ((vector unsigned char) v_cbp1,(vector unsigned char) v_cbp2, 12); + v_cbp_maskh = vec_or (v_cbp1, v_cbp2); + + v_cbp_maskv = (vector unsigned char) vec_cmpgt ((vector unsigned char) v_cbp_maskv, (vector unsigned char) v_zero); + v_cbp_maskh = (vector unsigned char) vec_cmpgt ((vector unsigned char) v_cbp_maskh, (vector unsigned char) v_zero); + + intra[0] =0; + intra[1] =1; + intra[2] =2; + intra[3] =3; + intra[4] =4; + intra[5] = 5; + intra[6] =6; + intra[7] =7; + intra[8] =8; + intra[9] =9; + intra[10] =9; + intra[11] =9; + intra[12] = 0xff; + + idx0 = vec_ld (0, (signed short *) intra); + + v_c1 = (vector unsigned char) 1; + + if (field_MBAFF){ + v0 = (vector signed short) vec_and ((vector unsigned char) idx0, v_c1); + idx0 = (vector signed short) vec_sra ((vector unsigned char) idx0, v_c1); + + v1 = vec_sld (v0, v0, 15); + v1 = (vector signed short) vec_pack (v1, v0); + + v2 = vec_sld (v1, v1, 2); + v3 = vec_sld (v1, v1, 10); + + v4 = (vector signed short) vec_cmpeq ((vector signed char) v1, (vector signed char) v2); + v5 = (vector signed short) vec_cmpeq ((vector signed char) v1, (vector signed char) v3); + v6 = (vector signed short) vec_cmpeq ((vector signed char) v2, (vector signed char) v3); + } + else { + v4 = v5 = v6 = vec_nor (v_zero, v_zero); + } + + tmp1 = (vector signed short) vec_sl ((vector unsigned char) idx0, v_c1); + v_c1 = vec_mergel ((vector unsigned char) v_zero, v_c1); + tmp1 = (vector signed short) vec_add (tmp1, (vector signed short) v_c1); + + v_pocl = vec_ld (0, (vector unsigned char *) mv_const); + v_poch = vec_ld (0, (vector unsigned char *) mv_const); + tmp2 = (vector signed short) vec_perm (v_pocl, v_poch, (vector unsigned char) tmp1); + + v_pocl = vec_ld (0, (vector unsigned char *) mv_const); + v_poch = vec_ld (16, (vector unsigned char *) mv_const); + tmp1 = (vector signed short) vec_perm (v_pocl, v_poch, (vector unsigned char) tmp1); + tmp1 = vec_sel (tmp1, tmp2, (vector unsigned short) (0xffff,0xffff,0,0,0,0,0,0)); + + tmp3 = (vector signed short) vec_splat ((vector unsigned char) idx0, 12); + v_c1 = (vector unsigned char) vec_nor (v_zero, v_zero); + tmp0 = (vector signed short) vec_cmpeq ((vector signed char) idx0, (vector signed char) v_c1); + tmp1 = vec_sel (tmp1, (vector signed short) tmp3, (vector unsigned short) tmp0); + + tmp2 = vec_sld (tmp1, tmp1, 15); + tmp1 = (vector signed short) vec_pack (tmp2, tmp1); + + tmp2 = vec_sld (tmp1, tmp1, 2); + tmp3 = vec_sld (tmp1, tmp1, 10); + + tmp0 = (vector signed short) vec_cmpeq ((vector signed char) tmp1, (vector signed char) tmp2); + tmp4 = (vector signed short) vec_cmpeq ((vector signed char) tmp1, (vector signed char) tmp3); + tmp1 = (vector signed short) vec_cmpeq ((vector signed char) tmp2, (vector signed char) tmp3); + tmp0 = vec_and (tmp0, v4); + tmp4 = vec_and (tmp4, v5); + tmp1 = vec_and (tmp1, v6); + tmp2 = vec_sld ((vector signed short) tmp0, (vector signed short) tmp0, 8); + tmp3 = vec_sld ((vector signed short) tmp4, (vector signed short) tmp4, 8); + tmp5 = vec_sld ((vector signed short) tmp1, (vector signed short) tmp1, 8); + tmp0 = vec_and (tmp0, tmp2); + tmp4 = vec_and (tmp4, tmp3); + tmp1 = vec_and (tmp1, tmp5); + v_ref_mask00 = vec_mergel ((vector signed short) tmp0, (vector signed short) v_c1); + v_ref_mask01 = vec_mergel ((vector signed short) tmp4, (vector signed short) tmp1); + v_ref_mask00 = (vector signed short) vec_mergel ((vector unsigned char) v_ref_mask00, (vector unsigned char) v_ref_mask00); + v_ref_mask01 = (vector signed short) vec_mergel ((vector unsigned char) v_ref_mask01, (vector unsigned char) v_ref_mask01); + + v0 = vec_ld (0, (vector signed short *) mv_const); + v1 = vec_ld (16, (vector signed short *) mv_const); + v4 = vec_ld (64, (vector signed short *) mv_const); + v5 = vec_ld (80, (vector signed short *) mv_const); + v8 = vec_ld (0, (vector signed short *) mv_const); + v9 = vec_ld (16, (vector signed short *) mv_const); + + tmp0 = (vector signed short) vec_perm ((vector unsigned char) v8, (vector unsigned char) v8, (vector unsigned char) (0,1,2,3,8,9,10,11,4,5,6,7,12,13,14,15)); + tmp1 = (vector signed short) vec_mergel ((vector signed int) v0, (vector signed int) v1); + tmp2 = vec_sld (tmp1, tmp1, 8); + tmp3 = vec_sub (vec_max (tmp0, tmp1), vec_min (tmp0, tmp1)); + tmp4 = vec_sub (vec_max (tmp0, tmp2), vec_min (tmp0, tmp2)); + tmp3 = (vector signed short) vec_cmpgt (tmp3, v_three); + tmp4 = (vector signed short) vec_cmpgt (tmp4, v_three); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + tmp0 = (vector signed short) vec_perm ((vector unsigned char) v9, (vector unsigned char) v9, (vector unsigned char) (0,1,2,3,8,9,10,11,4,5,6,7,12,13,14,15)); + tmp1 = (vector signed short) vec_mergel ((vector signed int) v4, (vector signed int) v5); + tmp2 = vec_sld (tmp1, tmp1, 8); + tmp5 = vec_sub (vec_max (tmp0, tmp1), vec_min (tmp0, tmp1)); + tmp6 = vec_sub (vec_max (tmp0, tmp2), vec_min (tmp0, tmp2)); + tmp5 = (vector signed short) vec_cmpgt (tmp5, v_three); + tmp6 = (vector signed short) vec_cmpgt (tmp6, v_three); + tmp0 = vec_sld (tmp5, tmp5, 14); + tmp1 = vec_sld (tmp6, tmp6, 14); + tmp5 = vec_or (tmp0, tmp5); + tmp6 = vec_or (tmp1, tmp6); + + tmp3 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp5); + tmp4 = (vector signed short) vec_pack ((vector unsigned int) tmp4, (vector unsigned int) tmp6); + tmp5 = vec_sld (tmp3, tmp3, 12); + tmp6 = vec_sld (tmp4, tmp4, 12); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + tmp00 = (vector signed short) vec_pack ((vector unsigned short) tmp3, (vector unsigned short) tmp4); + + tmp0 = (vector signed short) vec_mergel ((vector signed int) v0, (vector signed int) v1); + tmp1 = (vector signed short) vec_mergel ((vector signed int) v0, (vector signed int) v1); + tmp2 = vec_sld (tmp1, tmp1, 8); + tmp3 = vec_sub (vec_max (tmp0, tmp1), vec_min (tmp0, tmp1)); + tmp4 = vec_sub (vec_max (tmp0, tmp2), vec_min (tmp0, tmp2)); + tmp3 = (vector signed short) vec_cmpgt (tmp3, v_three); + tmp4 = (vector signed short) vec_cmpgt (tmp4, v_three); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + + tmp0 = (vector signed short) vec_mergel ((vector signed int) v4, (vector signed int) v5); + tmp1 = (vector signed short) vec_mergel ((vector signed int) v4, (vector signed int) v5); + tmp2 = vec_sld (tmp1, tmp1, 8); + tmp5 = vec_sub (vec_max (tmp0, tmp1), vec_min (tmp0, tmp1)); + tmp6 = vec_sub (vec_max (tmp0, tmp2), vec_min (tmp0, tmp2)); + tmp5 = (vector signed short) vec_cmpgt (tmp5, v_three); + tmp6 = (vector signed short) vec_cmpgt (tmp6, v_three); + tmp0 = vec_sld (tmp5, tmp5, 14); + tmp1 = vec_sld (tmp6, tmp6, 14); + tmp5 = vec_or (tmp0, tmp5); + tmp6 = vec_or (tmp1, tmp6); + + tmp3 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp5); + tmp4 = (vector signed short) vec_pack ((vector unsigned int) tmp4, (vector unsigned int) tmp6); + tmp5 = vec_sld (tmp3, tmp3, 12); + tmp6 = vec_sld (tmp4, tmp4, 12); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + tmp01 = (vector signed short) vec_pack ((vector unsigned short) tmp3, (vector unsigned short) tmp4); + + v2 = vec_ld (32, (vector signed short *) mv_const); + v3 = vec_ld (48, (vector signed short *) mv_const); + v6 = vec_ld (96, (vector signed short *) mv_const); + v7 = vec_ld (112,(vector signed short *) mv_const); + + tmp0 = (vector signed short) vec_mergel ((vector signed int) v0, (vector signed int) v1); + tmp1 = (vector signed short) vec_mergel ((vector signed int) v2, (vector signed int) v3); + tmp2 = vec_sld (tmp1, tmp1, 8); + tmp3 = vec_sub (vec_max (tmp0, tmp1), vec_min (tmp0, tmp1)); + tmp4 = vec_sub (vec_max (tmp0, tmp2), vec_min (tmp0, tmp2)); + tmp3 = (vector signed short) vec_cmpgt (tmp3, v_three); + tmp4 = (vector signed short) vec_cmpgt (tmp4, v_three); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + + tmp0 = (vector signed short) vec_mergel ((vector signed int) v4, (vector signed int) v5); + tmp1 = (vector signed short) vec_mergel ((vector signed int) v6, (vector signed int) v7); + tmp2 = vec_sld (tmp1, tmp1, 8); + tmp5 = vec_sub (vec_max (tmp0, tmp1), vec_min (tmp0, tmp1)); + tmp6 = vec_sub (vec_max (tmp0, tmp2), vec_min (tmp0, tmp2)); + tmp5 = (vector signed short) vec_cmpgt (tmp5, v_three); + tmp6 = (vector signed short) vec_cmpgt (tmp6, v_three); + tmp0 = vec_sld (tmp5, tmp5, 14); + tmp1 = vec_sld (tmp6, tmp6, 14); + tmp5 = vec_or (tmp0, tmp5); + tmp6 = vec_or (tmp1, tmp6); + + tmp3 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp5); + tmp4 = (vector signed short) vec_pack ((vector unsigned int) tmp4, (vector unsigned int) tmp6); + tmp5 = vec_sld (tmp3, tmp3, 12); + tmp6 = vec_sld (tmp4, tmp4, 12); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + tmp02 = (vector signed short) vec_pack ((vector unsigned short) tmp3, (vector unsigned short) tmp4); + + tmp0 = (vector signed short) vec_mergel ((vector signed int) v2, (vector signed int) v3); + tmp1 = (vector signed short) vec_mergel ((vector signed int) v2, (vector signed int) v3); + tmp2 = vec_sld (tmp1, tmp1, 8); + tmp3 = vec_sub (vec_max (tmp0, tmp1), vec_min (tmp0, tmp1)); + tmp4 = vec_sub (vec_max (tmp0, tmp2), vec_min (tmp0, tmp2)); + tmp3 = (vector signed short) vec_cmpgt (tmp3, v_three); + tmp4 = (vector signed short) vec_cmpgt (tmp4, v_three); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + + tmp0 = (vector signed short) vec_mergel ((vector signed int) v6, (vector signed int) v7); + tmp1 = (vector signed short) vec_mergel ((vector signed int) v6, (vector signed int) v7); + tmp2 = vec_sld (tmp1, tmp1, 8); + tmp5 = vec_sub (vec_max (tmp0, tmp1), vec_min (tmp0, tmp1)); + tmp6 = vec_sub (vec_max (tmp0, tmp2), vec_min (tmp0, tmp2)); + tmp5 = (vector signed short) vec_cmpgt (tmp5, v_three); + tmp6 = (vector signed short) vec_cmpgt (tmp6, v_three); + tmp0 = vec_sld (tmp5, tmp5, 14); + tmp1 = vec_sld (tmp6, tmp6, 14); + tmp5 = vec_or (tmp0, tmp5); + tmp6 = vec_or (tmp1, tmp6); + + tmp3 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp5); + tmp4 = (vector signed short) vec_pack ((vector unsigned int) tmp4, (vector unsigned int) tmp6); + tmp5 = vec_sld (tmp3, tmp3, 12); + tmp6 = vec_sld (tmp4, tmp4, 12); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + tmp03 = (vector signed short) vec_pack ((vector unsigned short) tmp3, (vector unsigned short) tmp4); + + tmp0 = (vector signed short) vec_pack ((vector unsigned int) tmp00, (vector unsigned int) tmp01); + tmp1 = (vector signed short) vec_pack ((vector unsigned int) tmp02, (vector unsigned int) tmp03); + tmp2 = (vector signed short) vec_mergel ((vector signed int) tmp0, (vector signed int) tmp1); + tmp3 = (vector signed short) vec_mergel ((vector signed int) tmp0, (vector signed int) tmp1); + tmp4 = (vector signed short) vec_mergel ((vector signed int) tmp2, (vector signed int) tmp3); + tmp5 = (vector signed short) vec_mergel ((vector signed int) tmp2, (vector signed int) tmp3); + tmp4 = vec_and (v_ref_mask00, tmp4); + tmp5 = vec_and (v_ref_mask01, tmp5); + + tmp0 = vec_nor (v_ref_mask00, v_ref_mask01); + tmp1 = vec_and (v_ref_mask00, v_ref_mask01); + tmp2 = vec_and (tmp4, tmp5); + tmp2 = vec_and (tmp2, tmp1); + tmp3 = vec_nor (tmp4, tmp5); + tmp3 = vec_nor (tmp3, tmp1); + v_vec_maskv = vec_or (tmp0, tmp2); + v_vec_maskv = vec_or (v_vec_maskv, tmp3); + + intra[0] = 1; + intra[1] = 1; + intra[2] = 2; + intra[3] = 3; + intra[4] = 2; + intra[5] = 2; + intra[6] = 2; + intra[7] = 1; + intra[8] = 1; + intra[9] = 5; + intra[10] = 5; + intra[11] = 5; + + intra[13] = 0; + intra[14] = 0; + intra[15] = 0; + + idx0 = vec_ld (0, (signed short *) intra); + + v_c1 = (vector unsigned char) 1; + + if (field_MBAFF){ + v8 = (vector signed short) vec_and ((vector unsigned char) idx0, v_c1); + idx0 = (vector signed short) vec_sra ((vector unsigned char) idx0, v_c1); + + v9 = vec_sld (v8, v8, 15); + v9 = (vector signed short) vec_pack (v9, v8); + + v10 = vec_sld (v9, v9, 2); + v11 = vec_sld (v9, v9, 10); + + v8 = (vector signed short) vec_cmpeq ((vector signed char) v9, (vector signed char) v10); + v9 = (vector signed short) vec_cmpeq ((vector signed char) v9, (vector signed char) v11); + v10 = (vector signed short) vec_cmpeq ((vector signed char) v10, (vector signed char) v11); + } + else { + v8 = v9 = v10 = vec_nor (v_zero, v_zero); + } + + tmp1 = (vector signed short) vec_sl ((vector unsigned char) idx0, v_c1); + + v_c1 = vec_mergel ((vector unsigned char) v_zero, v_c1); + tmp1 = (vector signed short) vec_add (tmp1, (vector signed short) v_c1); + +if (1){ + unsigned char toto2[16] __attribute__((aligned(16))); + int m; + + vec_st(v_c1, 0, (unsigned char *) toto2); + for (m=0; m < 16; m +=2) + if (toto2[m] != 0) + abort(); + for (m=1; m < 16; m +=2) + if (toto2[m] != 1) + abort(); +} + + v_pocl = vec_ld (32, (vector unsigned char *) mv_const); + v_poch = vec_ld (48, (vector unsigned char *) mv_const); + tmp2 = (vector signed short) vec_perm (v_pocl, v_poch, (vector unsigned char) tmp1); + + v_pocl = vec_ld (0, (vector unsigned char *) mv_const); + v_poch = vec_ld (16, (vector unsigned char *) mv_const); + + tmp1 = (vector signed short) vec_perm (v_pocl, v_poch, (vector unsigned char) tmp1); + + tmp1 = vec_sel (tmp1, tmp2, (vector unsigned short) (0xffff,0xffff,0,0,0,0,0,0)); + + + tmp3 = (vector signed short) vec_splat ((vector unsigned char) idx0, 12); + v_c1 = (vector unsigned char) vec_nor (v_zero, v_zero); + tmp0 = (vector signed short) vec_cmpeq ((vector signed char) idx0, (vector signed char) v_c1); + tmp1 = vec_sel (tmp1, (vector signed short) tmp3, (vector unsigned short) tmp0); + + tmp2 = vec_sld (tmp1, tmp1, 15); + tmp1 = (vector signed short) vec_pack (tmp2, tmp1); + + + tmp2 = vec_sld (tmp1, tmp1, 2); + tmp3 = vec_sld (tmp1, tmp1, 10); + + tmp0 = (vector signed short) vec_cmpeq ((vector signed char) tmp1, (vector signed char) tmp2); + tmp4 = (vector signed short) vec_cmpeq ((vector signed char) tmp1, (vector signed char) tmp3); + tmp1 = (vector signed short) vec_cmpeq ((vector signed char) tmp2, (vector signed char) tmp3); + tmp0 = vec_and (tmp0, v8); + tmp4 = vec_and (tmp4, v9); + tmp1 = vec_and (tmp1, v10); + tmp2 = vec_sld ((vector signed short) tmp0, (vector signed short) tmp0, 8); + tmp3 = vec_sld ((vector signed short) tmp4, (vector signed short) tmp4, 8); + tmp5 = vec_sld ((vector signed short) tmp1, (vector signed short) tmp1, 8); + tmp0 = vec_and (tmp0, tmp2); + tmp4 = vec_and (tmp4, tmp3); + tmp1 = vec_and (tmp1, tmp5); + v_ref_mask00 = vec_mergel ((vector signed short) tmp0, (vector signed short) v_c1); + v_ref_mask01 = vec_mergel ((vector signed short) tmp4, (vector signed short) tmp1); + v_ref_mask00 = (vector signed short) vec_mergel ((vector unsigned char) v_ref_mask00, (vector unsigned char) v_ref_mask00); + v_ref_mask01 = (vector signed short) vec_mergel ((vector unsigned char) v_ref_mask01, (vector unsigned char) v_ref_mask01); + + + v_permv= vec_ld (0, (vector unsigned char *) mv_const); + v8 = vec_ld (0, (vector signed short *) mv_const); + v9 = vec_ld (16, (vector signed short *) mv_const); + tmp2 = vec_perm (v0, v0, v_permv); + tmp3 = vec_sub (vec_max (v8, v0), vec_min (v8, v0)); + tmp4 = vec_sub (vec_max (v8, tmp2), vec_min (v8, tmp2)); + tmp3 = (vector signed short) vec_cmpgt (tmp3, v_three); + tmp4 = (vector signed short) vec_cmpgt (tmp4, v_three); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + + tmp2 = vec_perm (v2, v2, v_permv); + tmp5 = vec_sub (vec_max (v9, v2), vec_min (v9, v2)); + tmp6 = vec_sub (vec_max (v9, tmp2), vec_min (v9, tmp2)); + tmp5 = (vector signed short) vec_cmpgt (tmp5, v_three); + tmp6 = (vector signed short) vec_cmpgt (tmp6, v_three); + tmp0 = vec_sld (tmp5, tmp5, 14); + tmp1 = vec_sld (tmp6, tmp6, 14); + tmp5 = vec_or (tmp0, tmp5); + tmp6 = vec_or (tmp1, tmp6); + + tmp3 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp5); + tmp4 = (vector signed short) vec_pack ((vector unsigned int) tmp4, (vector unsigned int) tmp6); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + tmp00 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp4); + + tmp2 = vec_perm (v1, v1, v_permv); + tmp3 = vec_sub (vec_max (v0, v1), vec_min (v0, v1)); + tmp4 = vec_sub (vec_max (v0, tmp2), vec_min (v0, tmp2)); + tmp3 = (vector signed short) vec_cmpgt (tmp3, v_three); + tmp4 = (vector signed short) vec_cmpgt (tmp4, v_three); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + + tmp2 = vec_perm (v3, v3, v_permv); + tmp5 = vec_sub (vec_max (v2, v3), vec_min (v2, v3)); + tmp6 = vec_sub (vec_max (v2, tmp2), vec_min (v2, tmp2)); + tmp5 = (vector signed short) vec_cmpgt (tmp5, v_three); + tmp6 = (vector signed short) vec_cmpgt (tmp6, v_three); + tmp0 = vec_sld (tmp5, tmp5, 14); + tmp1 = vec_sld (tmp6, tmp6, 14); + tmp5 = vec_or (tmp0, tmp5); + tmp6 = vec_or (tmp1, tmp6); + + tmp3 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp5); + tmp4 = (vector signed short) vec_pack ((vector unsigned int) tmp4, (vector unsigned int) tmp6); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + tmp01 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp4); + + tmp2 = vec_perm (v4, v4, v_permv); + tmp3 = vec_sub (vec_max (v1, v4), vec_min (v1, v4)); + tmp4 = vec_sub (vec_max (v1, tmp2), vec_min (v1, tmp2)); + tmp3 = (vector signed short) vec_cmpgt (tmp3, v_three); + tmp4 = (vector signed short) vec_cmpgt (tmp4, v_three); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + + tmp2 = vec_perm (v6, v6, v_permv); + tmp5 = vec_sub (vec_max (v3, v6), vec_min (v3, v6)); + tmp6 = vec_sub (vec_max (v3, tmp2), vec_min (v3, tmp2)); + tmp5 = (vector signed short) vec_cmpgt (tmp5, v_three); + tmp6 = (vector signed short) vec_cmpgt (tmp6, v_three); + tmp0 = vec_sld (tmp5, tmp5, 14); + tmp1 = vec_sld (tmp6, tmp6, 14); + tmp5 = vec_or (tmp0, tmp5); + tmp6 = vec_or (tmp1, tmp6); + + tmp3 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp5); + tmp4 = (vector signed short) vec_pack ((vector unsigned int) tmp4, (vector unsigned int) tmp6); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + tmp02 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp4); + + + tmp2 = vec_perm (v5, v5, v_permv); + tmp3 = vec_sub (vec_max (v4, v5), vec_min (v4, v5)); + tmp4 = vec_sub (vec_max (v4, tmp2), vec_min (v4, tmp2)); + tmp3 = (vector signed short) vec_cmpgt (tmp3, v_three); + tmp4 = (vector signed short) vec_cmpgt (tmp4, v_three); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + + tmp2 = vec_perm (v7, v7, v_permv); + tmp5 = vec_sub (vec_max (v6, v7), vec_min (v6, v7)); + tmp6 = vec_sub (vec_max (v6, tmp2), vec_min (v6, tmp2)); + tmp5 = (vector signed short) vec_cmpgt (tmp5, v_three); + tmp6 = (vector signed short) vec_cmpgt (tmp6, v_three); + tmp0 = vec_sld (tmp5, tmp5, 14); + tmp1 = vec_sld (tmp6, tmp6, 14); + tmp5 = vec_or (tmp0, tmp5); + tmp6 = vec_or (tmp1, tmp6); + + tmp3 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp5); + tmp4 = (vector signed short) vec_pack ((vector unsigned int) tmp4, (vector unsigned int) tmp6); + tmp5 = vec_sld (tmp3, tmp3, 14); + tmp6 = vec_sld (tmp4, tmp4, 14); + tmp3 = vec_or (tmp3, tmp5); + tmp4 = vec_or (tmp4, tmp6); + tmp03 = (vector signed short) vec_pack ((vector unsigned int) tmp3, (vector unsigned int) tmp4); + + tmp0 = (vector signed short) vec_pack ((vector unsigned short) tmp00, (vector unsigned short) tmp01); + tmp1 = (vector signed short) vec_pack ((vector unsigned short) tmp02, (vector unsigned short) tmp03); + tmp2 = (vector signed short) vec_mergel ((vector signed int) tmp0, (vector signed int) tmp1); + tmp3 = (vector signed short) vec_mergel ((vector signed int) tmp0, (vector signed int) tmp1); + tmp4 = (vector signed short) vec_mergel ((vector signed int) tmp2, (vector signed int) tmp3); + tmp5 = (vector signed short) vec_mergel ((vector signed int) tmp2, (vector signed int) tmp3); + tmp4 = vec_and (v_ref_mask00, tmp4); + tmp5 = vec_and (v_ref_mask01, tmp5); + + tmp0 = vec_nor (v_ref_mask00, v_ref_mask01); + tmp1 = vec_and (v_ref_mask00, v_ref_mask01); + tmp2 = vec_and (tmp4, tmp5); + tmp2 = vec_and (tmp2, tmp1); + tmp3 = vec_nor (tmp4, tmp5); + tmp3 = vec_nor (tmp3, tmp1); + v_vec_maskh = vec_or (tmp0, tmp2); + v_vec_maskh = vec_or (v_vec_maskh, tmp3); + + + v_intra_maskvn = vec_nor (v_intra_maskv, v_intra_maskv); + v_intra_maskhn = vec_nor (v_intra_maskh, v_intra_maskh); + v_cbp_maskvn = (vector unsigned char) vec_cmpeq ((vector unsigned char) v_cbp_maskv, (vector unsigned char) v_zero); + v_cbp_maskhn = (vector unsigned char) vec_cmpeq ((vector unsigned char) v_cbp_maskh, (vector unsigned char) v_zero); + + v_cbp_maskv = vec_and (v_cbp_maskv, v_intra_maskvn); + v_cbp_maskh = vec_and (v_cbp_maskh, v_intra_maskhn); + v_vec_maskv = vec_and (v_vec_maskv, (vector signed short) v_intra_maskvn); + v_vec_maskv = vec_and (v_vec_maskv, (vector signed short) v_cbp_maskvn); + v_vec_maskh = vec_and (v_vec_maskh, (vector signed short) v_intra_maskhn); + v_vec_maskh = vec_and (v_vec_maskh, (vector signed short) v_cbp_maskhn); + + tmp9 = vec_splat_u8(2); + tmp8 = vec_splat_u8(1); + v_bS = vec_ld (0, (vector unsigned char *) mv_const); + + v_bSv = vec_and ((vector unsigned char) v_bS, (vector unsigned char)v_intra_maskv); + tmp7 = vec_and ((vector unsigned char)tmp9, (vector unsigned char)v_cbp_maskv); + tmp6 = (vector signed short) vec_and ((vector unsigned char)tmp8, (vector unsigned char)v_vec_maskv); + tmp7 = vec_or ((vector unsigned char)tmp7, (vector unsigned char)tmp6); + v_bSv = vec_or ((vector unsigned char)tmp7, (vector unsigned char)v_bSv); + + v_bS = vec_ld (0, (vector unsigned char *) mv_const); + v_bSh = vec_and ((vector unsigned char) v_bS, (vector unsigned char)v_intra_maskh); + tmp7 = vec_and ((vector unsigned char)tmp9, (vector unsigned char)v_cbp_maskh); + tmp6 = (vector signed short) vec_and ((vector unsigned char)tmp8, (vector unsigned char)v_vec_maskh); + tmp7 = vec_or ((vector unsigned char)tmp7, (vector unsigned char)tmp6); + v_bSh = vec_or ((vector unsigned char)tmp7, (vector unsigned char)v_bSh); + + v_permh = (vector unsigned char) vec_ld (0 , (vector unsigned char *) mv_const); + v_permv = (vector unsigned char) vec_ld (0, (vector unsigned char *) mv_const); + v_bSv = vec_and (v_bSv, v_permv); + v_bSh = vec_and (v_bSh, v_permh); + + vec_st (v_bSv, 0, (unsigned char *) mv_const); + vec_st (v_bSh, 0, (unsigned char *) mv_const); + + v_bSv = vec_mergel (v_bSv, v_bSv); + v_bSv = vec_mergel (v_bSv, v_bSv); + v_bSh = vec_mergel (v_bSh, v_bSh); + v_bSh = vec_mergel (v_bSh, v_bSh); + + vec_st (v_bSv, 0, (vector unsigned char *) mv_const); + vec_st (v_bSh, 0,(vector unsigned char *) mv_const); +} + + +int main(int argc, char **argv) +{ + char toto[32] __attribute__((aligned(16))); + foo(toto, toto, 0, 0); + return 0; +} +/* APPLE LOCAL end radar 4110116 */ diff --git a/gcc/testsuite/gcc.dg/vect/pr20122.c b/gcc/testsuite/gcc.dg/vect/pr20122.c new file mode 100644 index 00000000000..ff6ec75e5ab --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr20122.c @@ -0,0 +1,38 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include "tree-vect.h" + +typedef short ashort __attribute__ ((__aligned__(16))); +ashort Kernshort[24]; +static void VecBug(ashort Kernel[8][24]) __attribute__((noinline)); +static void VecBug(ashort Kernel[8][24]); + +/* Doesn't occur of only inner-loop. */ +static void VecBug(ashort Kernel[8][24]) +{ + int k,i; + for (k = 0; k<8; k++) + for (i = 0; i<24; i++) + Kernshort[i] = Kernel[k][i]; +} + +int main (int argc, char **argv) +{ + check_vect (); + + ashort Kernel[8][24]; + int k,i; + + for (k = 0; k<8; k++) + for (i = 0; i<24; i++) + Kernel[k][i] = 0; + + VecBug(Kernel); + + return 0; +} + + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/vect-11.c b/gcc/testsuite/gcc.dg/vect/vect-11.c index 1ad27604627..e2dab4d4aae 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-11.c +++ b/gcc/testsuite/gcc.dg/vect/vect-11.c @@ -1,5 +1,6 @@ /* { dg-require-effective-target vect_int } */ - +/* APPLE LOCAL 3972875 mainline 2005-04-18 */ +/* { dg-require-effective-target vect_int_mult } */ #include <stdarg.h> #include "tree-vect.h" @@ -35,4 +36,5 @@ int main (void) return main1 (); } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */ +/* APPLE LOCAL 3972875 mainline 2005-04-18 */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-11a.c b/gcc/testsuite/gcc.dg/vect/vect-11a.c new file mode 100644 index 00000000000..46b86dbb134 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-11a.c @@ -0,0 +1,52 @@ +/* APPLE LOCAL file 3972875 mainline 2005-04-18 */ +/* { dg-require-effective-target vect_int } */ +/* { dg-require-effective-target vect_int_mult } */ + +#include <stdarg.h> +#include "tree-vect.h" + +extern void abort (void); +void u () +{ + unsigned int A[4] = {0x08000000,0xffffffff,0xff0000ff,0xf0000001}; + unsigned int B[4] = {0x08000000,0x08000001,0xff0000ff,0xf0000001}; + unsigned int Answer[4] = {0,0xf7ffffff,0x0200fe01,0xe0000001}; + unsigned int C[4]; + int i, j; + + for (i=0; i<4; i++) + C[i] = A[i] * B[i]; + for (i=0; i<4; i++) + if (C[i] != Answer[i]) + abort (); +} +void s() +{ + signed int A[4] = {0x08000000,0xffffffff,0xff0000ff,0xf0000001}; + signed int B[4] = {0x08000000,0x08000001,0xff0000ff,0xf0000001}; + signed int Answer[4] = {0,0xf7ffffff,0x0200fe01, 0xe0000001}; + signed int C[4]; + int i, j; + + for (i=0; i<4; i++) + C[i] = A[i] * B[i]; + for (i=0; i<4; i++) + if (C[i] != Answer[i]) + abort (); +} + +int main1 () +{ + u(); + s(); + return 0; +} + +int main (void) +{ + check_vect (); + + return main1 (); +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-98.c b/gcc/testsuite/gcc.dg/vect/vect-98.c new file mode 100644 index 00000000000..d876bce124f --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-98.c @@ -0,0 +1,41 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include "tree-vect.h" + +#define N 4 +#define DOT4( a, b ) ( a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3] ) + +int main1 (int ia[][N]) +{ + int i, j; + int ib[N] = {0,3,6,9}; + int ic[N][N]; + + for (i = 0; i < N; i++) + { + ic[0][i] = DOT4 (ia[i], ib); + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (ic[0][i] != DOT4 (ia[i], ib)) + abort(); + } + + return 0; +} + +int main (void) +{ + int ia[N][N] = {{1,2,3,4},{2,3,5,7},{2,4,6,8},{22,43,55,77}}; + + check_vect (); + + return main1 (ia); +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */ +/* APPLE LOCAL xfail */ +/* { dg-final { scan-tree-dump-times "not vectorized: complicated access pattern" 1 "vect" { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-dv-1.c b/gcc/testsuite/gcc.dg/vect/vect-dv-1.c new file mode 100644 index 00000000000..516956b8cab --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-dv-1.c @@ -0,0 +1,21 @@ +/* APPLE LOCAL file AV */ +/* Test compiler crash when dependence analyzer can not represent + dependence relation by distance vector. */ +/* { dg-do compile } */ + +int x[199]; + +void foo() + +{ + int t,j; + + for (j=99;j>0;j--) + x [j+j]=x[j]; + + for (j=198;j>=100;j--) + if(x[j]) + { + x[j-63]=x[j-3]-x[j]; + } +} diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-1.c b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-1.c new file mode 100644 index 00000000000..be35d3e7bff --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-1.c @@ -0,0 +1,76 @@ +/* APPLE LOCAL file AV data dependence */ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */ + +#include <stdarg.h> +#include <signal.h> + +#define N 64 +#define MAX 42 + +extern void abort(void); + +int main () +{ + int A[N]; + int B[N]; + int C[N]; + int D[N]; + + int i, j; + + for (i = 0; i < N; i++) + { + A[i] = i; + B[i] = i; + C[i] = i; + D[i] = i; + } + + /* Vectorizable */ + for (i = 0; i < 16; i++) + { + A[i] = A[i+20]; + } + + /* check results: */ + for (i = 0; i < 16; i++) + { + if (A[i] != A[i+20]) + abort (); + } + + /* Vectorizable */ + for (i = 0; i < 16; i++) + { + B[i] = B[i] + 5; + } + + /* check results: */ + for (i = 0; i < 16; i++) + { + if (B[i] != C[i] + 5) + abort (); + } + + /* Not vectorizable */ + for (i = 0; i < 4; i++) + { + C[i] = C[i+3]; + } + + /* check results: */ + for (i = 0; i < 4; i++) + { + if (C[i] != D[i+3]) + abort (); + } + + + return 0; +} + + + +/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { xfail i?86-*-* x86_64-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-2.c b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-2.c new file mode 100644 index 00000000000..0f7de3fcb8f --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-2.c @@ -0,0 +1,33 @@ +/* APPLE LOCAL file AV data dependence */ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */ + + +#include <stdarg.h> +#include <signal.h> + +#define N 16 +#define MAX 42 + +extern void abort(void); + +int main () +{ + int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; + int B[N] = {0,0,42,42,42,0,0,0,0,0,42,42,42,42,42,0}; + int i, j; + + for (i = 0; i < 16; i++) + A[i] = ( A[i] >= MAX ? MAX : 0); + + /* check results: */ + for (i = 0; i < N; i++) + if (A[i] != B[i]) + abort (); + + return 0; +} + + + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail i?86-*-* x86_64-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-3.c b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-3.c new file mode 100644 index 00000000000..e9e862ba4f5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-3.c @@ -0,0 +1,32 @@ +/* APPLE LOCAL file AV data dependence */ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */ + +#include <stdarg.h> +#include <signal.h> + +#define N 16 +#define MAX 42 + +extern void abort(void); + +int main () +{ + int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; + int B[N] = {0,0,0,42,42,0,0,0,0,0,42,42,42,42,42,0}; + int i, j; + + for (i = 0; i < 16; i++) + A[i] = ( A[i] > MAX ? MAX : 0); + + /* check results: */ + for (i = 0; i < N; i++) + if (A[i] != B[i]) + abort (); + + return 0; +} + + + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail i?86-*-* x86_64-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-4.c b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-4.c new file mode 100644 index 00000000000..75b397c0bd8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-4.c @@ -0,0 +1,33 @@ +/* APPLE LOCAL file AV data dependence */ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */ + + +#include <stdarg.h> +#include <signal.h> + +#define N 16 +#define MAX 42 + +extern void abort(void); + +int main () +{ + int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; + int B[N] = {42,42,42,0,0,42,42,42,42,42,0,0,0,0,0,42}; + int i, j; + + for (i = 0; i < 16; i++) + A[i] = ( A[i] <= MAX ? MAX : 0); + + /* check results: */ + for (i = 0; i < N; i++) + if (A[i] != B[i]) + abort (); + + return 0; +} + + + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail i?86-*-* x86_64-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-5.c b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-5.c new file mode 100644 index 00000000000..b2e55291495 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-5.c @@ -0,0 +1,33 @@ +/* APPLE LOCAL file AV data dependence */ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */ + + +#include <stdarg.h> +#include <signal.h> + +#define N 16 +#define MAX 42 + +extern void abort(void); + +int main () +{ + int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; + int B[N] = {42,42,0,0,0,42,42,42,42,42,0,0,0,0,0,42}; + int i, j; + + for (i = 0; i < 16; i++) + A[i] = ( A[i] < MAX ? MAX : 0); + + /* check results: */ + for (i = 0; i < N; i++) + if (A[i] != B[i]) + abort (); + + return 0; +} + + + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail i?86-*-* x86_64-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-6.c b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-6.c new file mode 100644 index 00000000000..776c9a6680e --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-6.c @@ -0,0 +1,33 @@ +/* APPLE LOCAL file AV data dependence */ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */ + + +#include <stdarg.h> +#include <signal.h> + +#define N 16 +#define MAX 42 + +extern void abort(void); + +int main () +{ + int A[N] = {36,39,42,45,43,32,21,42,23,34,45,56,67,42,89,11}; + int B[N] = {42,42,0,42,42,42,42,0,42,42,42,42,42,0,42,42}; + int i, j; + + for (i = 0; i < 16; i++) + A[i] = ( A[i] != MAX ? MAX : 0); + + /* check results: */ + for (i = 0; i < N; i++) + if (A[i] != B[i]) + abort (); + + return 0; +} + + + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail i?86-*-* x86_64-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-7.c b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-7.c new file mode 100644 index 00000000000..1647b6f89c0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-7.c @@ -0,0 +1,33 @@ +/* APPLE LOCAL file AV data dependence */ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */ + + +#include <stdarg.h> +#include <signal.h> + +#define N 16 +#define MAX 42 + +extern void abort(void); + +int main () +{ + int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,42,78,89,11}; + int B[N] = {42,42,0,42,42,42,42,42,42,42,42,42,0,42,42,42}; + int i, j; + + for (i = 0; i < 16; i++) + A[i] = ( A[i] == MAX ? 0 : MAX); + + /* check results: */ + for (i = 0; i < N; i++) + if (A[i] != B[i]) + abort (); + + return 0; +} + + + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail i?86-*-* x86_64-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-8.c b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-8.c new file mode 100644 index 00000000000..7ce84470382 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-8.c @@ -0,0 +1,37 @@ +/* APPLE LOCAL file AV data dependence */ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */ + + +#include <stdarg.h> +#include <signal.h> + +#define N 16 +#define MAX 42 + +extern void abort(void); + +int main () +{ + unsigned short A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; + unsigned short B[N] = {0,0,0,3,1,0,0,0,0,0,3,14,25,36,47,0}; + unsigned int i, j; + unsigned m; + + for (i = 0; i < 16; i++) + { + m = A[i]; + A[i] = (unsigned short) ( m >= MAX ? m-MAX : 0); + } + + /* check results: */ + for (i = 0; i < N; i++) + if (A[i] != B[i]) + abort (); + + return 0; +} + + + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail i?86-*-* x86_64-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-9.c b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-9.c new file mode 100644 index 00000000000..ab2eeab6e72 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-9.c @@ -0,0 +1,40 @@ +/* APPLE LOCAL file AV data dependence */ +/* { dg-do run } */ +/* { dg-options "-O3 -funroll-loops -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */ + + +#include <stdarg.h> +#include <signal.h> + +#define N 16 +#define MAX 42 + +extern void abort(void); + +int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; +int B[N] = {0,0,42,42,42,0,0,0,0,0,42,42,42,42,42,0}; +void foo () __attribute__((always_inline)); +void foo () +{ + int i, j; + + for (i = 0; i < 16; i++) + A[i] = ( A[i] >= MAX ? MAX : 0); +} + +int main () +{ + + int i, j; + foo (); + /* check results: */ + for (i = 0; i < N; i++) + if (A[i] != B[i]) + abort (); + + return 0; +} + + + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { xfail i?86-*-* x86_64-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-none.c b/gcc/testsuite/gcc.dg/vect/vect-none.c index f5303b93e18..7dd004aab75 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-none.c +++ b/gcc/testsuite/gcc.dg/vect/vect-none.c @@ -107,6 +107,8 @@ foo (int n) /* Test 3 - no target support for integer mult. */ + /* APPLE LOCAL mainline 2005-04-18 */ + /* This loop is vectorized on platforms that support vect_int_mult. */ for (i = 0; i < N; i++) { ia[i] = ib[i] * ic[i]; @@ -133,6 +135,8 @@ foo (int n) /* Test 6 - condition in loop. */ + /* APPLE LOCAL mainline 2005-04-18 */ + /* This loop is vectorized on platformst that support vect_condition. */ for (i = 0; i < N; i++){ a[i] = (b[i] > 0 ? b[i] : 0); } @@ -181,4 +185,10 @@ foo (int n) } /* { dg-final { scan-tree-dump-times "vectorized " 3 "vect"} } */ -/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 3 "vect"} } */ +/* APPLE LOCAL begin AV */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 3 "vect" { xfail powerpc*-*-* i?86-*-* x86_64-*-* } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target powerpc*-*-* } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 2 "vect" { target powerpc*-*-* } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target i?86-*-* x86_64-*-* ia64-*-* } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 2 "vect" { target i?86-*-* x86_64-*-* ia64-*-* } } } */ +/* APPLE LOCAL end AV */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-shift-1.c b/gcc/testsuite/gcc.dg/vect/vect-shift-1.c new file mode 100644 index 00000000000..d6c4bdc19d2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-shift-1.c @@ -0,0 +1,29 @@ +/* APPLE LOCAL file mainline 2005-04-05 3972515 */ +/* { dg-require-effective-target vect_shift } */ + +#include <stdarg.h> +#include <signal.h> + +#define N 16 +#define MAX 42 + +extern void abort(void); + +int main () +{ + unsigned int A[4] = {0x08000000,0x08000001,0xff0000ff,0xf0000001}; + unsigned int Answer[4] = {0x01000000,0x01000000,0x01fe0001f,0x1e000000}; + unsigned int B[4]; + int i, j; + + for (i=0; i<4; i++) + B[i] = A[i] >> 3; + for (i=0; i<4; i++) + if (B[i] != Answer[i]) + abort (); + return 0; +} + + + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail i?86-*-* x86_64-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/verbose-asm-2.c b/gcc/testsuite/gcc.dg/verbose-asm-2.c new file mode 100644 index 00000000000..314ac949541 --- /dev/null +++ b/gcc/testsuite/gcc.dg/verbose-asm-2.c @@ -0,0 +1,13 @@ +/* APPLE LOCAL file */ +/* Test whether -fverbose-asm emits option values. */ +/* Contibuted by Devang Patel <dpatel@apple.com>. */ + +/* { dg-do compile } */ +/* { dg-options "-fverbose-asm" } */ +/* { dg-final { scan-assembler "fpeephole" } } */ + +int +main (int argc, char *argv []) +{ + return 0; +} diff --git a/gcc/testsuite/gcc.dg/visibility-7.c b/gcc/testsuite/gcc.dg/visibility-7.c index f5e6e9aae5c..aaa8165e3e0 100644 --- a/gcc/testsuite/gcc.dg/visibility-7.c +++ b/gcc/testsuite/gcc.dg/visibility-7.c @@ -1,6 +1,6 @@ /* Test warning from conflicting visibility specifications. */ /* { dg-do compile } */ -/* { dg-require-visibility "" } */ +/* { dg-require-visibility "protected" } */ /* { dg-final { scan-hidden "xyzzy" } } */ extern int diff --git a/gcc/testsuite/gcc.dg/vmx/darwin-abi-3.c b/gcc/testsuite/gcc.dg/vmx/darwin-abi-3.c deleted file mode 100644 index af4d15a0c2d..00000000000 --- a/gcc/testsuite/gcc.dg/vmx/darwin-abi-3.c +++ /dev/null @@ -1,34 +0,0 @@ -/* { dg-do run { target powerpc*-*-darwin* } } */ - -/* This check was originally in test vmx/varargs-4.c. It does not - match the expected behavior according to the PowerPC-64 ELF ABI. */ - -#include <altivec.h> - -extern void abort (void); -extern void exit (int); - -typedef struct n_a -{ - signed char m1; - short m2; - int m3; - double m4; - vector float m5; -} -n_a; - -typedef struct n_a_x -{ - n_a b; - char a; -} -n_a_x; - -int -main () -{ - if (sizeof (n_a_x) - sizeof (n_a) != sizeof (n_a)) - abort (); - exit (0); -} diff --git a/gcc/testsuite/gcc.dg/warn-discard-qual.c b/gcc/testsuite/gcc.dg/warn-discard-qual.c new file mode 100644 index 00000000000..edf757b0cea --- /dev/null +++ b/gcc/testsuite/gcc.dg/warn-discard-qual.c @@ -0,0 +1,16 @@ +/* APPLE LOCAL file 4086969 */ +/* Test -Wno-discard-qual */ +/* { dg-do compile } */ +/* { dg-options "-Wno-discard-qual" } */ + +const char *a( void ) +{ + return "abc"; +} + +int main( void ) +{ + char *s = a(); + return 0; +} + diff --git a/gcc/testsuite/gcc.dg/weak/weak-12.c b/gcc/testsuite/gcc.dg/weak/weak-12.c new file mode 100644 index 00000000000..72cc1445e4b --- /dev/null +++ b/gcc/testsuite/gcc.dg/weak/weak-12.c @@ -0,0 +1,17 @@ +/* Test for #pragma weak with declaration not at file scope. */ +/* { dg-do compile } */ +/* { dg-require-weak "" } */ +/* { dg-options "" } */ + +/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?foo" } } */ + +#pragma weak foo + +int +main (void) +{ + extern int foo (void); + if (&foo) + return foo (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/weak/weak-3.c b/gcc/testsuite/gcc.dg/weak/weak-3.c index c9448f032cf..2294ebf7b4e 100644 --- a/gcc/testsuite/gcc.dg/weak/weak-3.c +++ b/gcc/testsuite/gcc.dg/weak/weak-3.c @@ -52,18 +52,18 @@ void * foo1e (void) extern void * ffoo1f (void); -extern void * ffoox1f (void); void * foo1f (void) { if (ffoo1f) /* { dg-warning "" } */ ffoo1f (); return 0; } +void * ffoox1f (void) { return (void *)0; } extern void * ffoo1f (void) __attribute__((weak, alias ("ffoox1f"))); /* { dg-warning "weak declaration" "weak declaration" } */ extern void * ffoo1g (void); -extern void * ffoox1g (void); +void * ffoox1g (void) { return (void *)0; } extern void * ffoo1g (void) __attribute__((weak, alias ("ffoox1g"))); void * foo1g (void) { diff --git a/gcc/testsuite/gcc.dg/weak/weak-9.c b/gcc/testsuite/gcc.dg/weak/weak-9.c index 95e8f809f38..abbd0201c46 100644 --- a/gcc/testsuite/gcc.dg/weak/weak-9.c +++ b/gcc/testsuite/gcc.dg/weak/weak-9.c @@ -7,10 +7,11 @@ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?f2" } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?f3" } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?f4" } } */ -/* { dg-final { scan-assembler "notf1" } } */ -/* { dg-final { scan-assembler "notf2" } } */ -/* { dg-final { scan-assembler "notf3" } } */ -/* { dg-final { scan-assembler "notf4" } } */ + +void notf1() { } +void notf2() { } +void notf3() { } +void notf4() { } void f1() __attribute__((weak, alias("notf1"))); void f2() __attribute__((alias("notf2"), weak)); diff --git a/gcc/testsuite/gcc.dg/winline-6.c b/gcc/testsuite/gcc.dg/winline-6.c index 7ce7481a3ef..dd8d3a81b08 100644 --- a/gcc/testsuite/gcc.dg/winline-6.c +++ b/gcc/testsuite/gcc.dg/winline-6.c @@ -17,5 +17,5 @@ inline int q(void) } inline int t (void) { - return q (); /* { dg-warning "called from here" } */ + return q () + 1; /* { dg-warning "called from here" } */ } diff --git a/gcc/testsuite/gcc.target/mips/fix-vr4130-1.c b/gcc/testsuite/gcc.target/mips/fix-vr4130-1.c new file mode 100644 index 00000000000..d6d2a5ad7f3 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/fix-vr4130-1.c @@ -0,0 +1,9 @@ +/* { dg-do compile { target mips*-*-* } } */ +/* { dg-skip-if "" { mips-sgi-irix* } { "-mabi=32" } { "" } } */ +/* { dg-options "-mfix-vr4130 -march=vr4130" } */ +#if _MIPS_ARCH_VR4130 && !__mips16 +int foo (void) { int r; asm ("# foo" : "=h" (r)); return r; } +#else +asm ("#\tmacchi\t"); +#endif +/* { dg-final { scan-assembler "\tmacchi\t" } } */ diff --git a/gcc/testsuite/gcc.target/mips/fix-vr4130-2.c b/gcc/testsuite/gcc.target/mips/fix-vr4130-2.c new file mode 100644 index 00000000000..dcb48998425 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/fix-vr4130-2.c @@ -0,0 +1,9 @@ +/* { dg-do compile { target mips*-*-* } } */ +/* { dg-skip-if "" { mips-sgi-irix* } { "-mabi=32" } { "" } } */ +/* { dg-options "-mfix-vr4130 -march=vr4130" } */ +#if _MIPS_ARCH_VR4130 && !__mips16 +int foo (void) { int r; asm ("# foo" : "=l" (r)); return r; } +#else +asm ("#\tmacc\t"); +#endif +/* { dg-final { scan-assembler "\tmacc\t" } } */ diff --git a/gcc/testsuite/gcc.target/mips/fix-vr4130-3.c b/gcc/testsuite/gcc.target/mips/fix-vr4130-3.c new file mode 100644 index 00000000000..ff258bab897 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/fix-vr4130-3.c @@ -0,0 +1,9 @@ +/* { dg-do compile { target mips*-*-* } } */ +/* { dg-skip-if "" { mips-sgi-irix* } { "-mabi=32" } { "" } } */ +/* { dg-options "-mfix-vr4130 -march=vr4130" } */ +#if _MIPS_ARCH_VR4130 && !__mips16 && __mips64 +long long foo (void) { long long r; asm ("# foo" : "=h" (r)); return r; } +#else +asm ("#\tdmacchi\t"); +#endif +/* { dg-final { scan-assembler "\tdmacchi\t" } } */ diff --git a/gcc/testsuite/gcc.target/mips/fix-vr4130-4.c b/gcc/testsuite/gcc.target/mips/fix-vr4130-4.c new file mode 100644 index 00000000000..acb2d0807f3 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/fix-vr4130-4.c @@ -0,0 +1,9 @@ +/* { dg-do compile { target mips*-*-* } } */ +/* { dg-skip-if "" { mips-sgi-irix* } { "-mabi=32" } { "" } } */ +/* { dg-options "-mfix-vr4130 -march=vr4130" } */ +#if _MIPS_ARCH_VR4130 && !__mips16 && __mips64 +long long foo (void) { long long r; asm ("# foo" : "=l" (r)); return r; } +#else +asm ("#\tdmacc\t"); +#endif +/* { dg-final { scan-assembler "\tdmacc\t" } } */ diff --git a/gcc/testsuite/gfortran.dg/PR19754_1.f90 b/gcc/testsuite/gfortran.dg/PR19754_1.f90 new file mode 100644 index 00000000000..b554d1094c5 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/PR19754_1.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! Test of fix to PR19754 +program PR19754_1 + real x(3,3),y(2,2) + x = 1. + y = 2. + x = x + y ! { dg-error "Shapes for operands at" } +end program PR19754_1 + diff --git a/gcc/testsuite/gfortran.dg/PR19754_2.f90 b/gcc/testsuite/gfortran.dg/PR19754_2.f90 new file mode 100644 index 00000000000..9b71bd02ba0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/PR19754_2.f90 @@ -0,0 +1,22 @@ +! { dg-do run } +! Test of Steve Kargl's fix to PR19754 +! This exercises bugs that the original patch caused +! +program PR19754_2 + real a(2,2), b(2,2),c(2,2),d(2,2) + integer i(2,2),j(2,2),k(2,2) + a = 1. ; b = 2. ; i = 4 + c = b - floor( a / b ) ! this caused an ICE + d = b - real(floor( a / b )) + if (any (c/=d)) call abort () + j = aint(b) - floor( a / b ) ! this caused an ICE + if (any(real(j)/=d)) call abort () + c = i + if (any(real(i)/=c)) call abort () + c = i + b ! this caused an ICE + d = real(i) + b + if (any(c/=d)) call abort () + j = i + aint (a) + k = i + a ! this caused an ICE + if (any(j/=k)) call abort () +end program PR19754_2 diff --git a/gcc/testsuite/gfortran.dg/achar_1.f90 b/gcc/testsuite/gfortran.dg/achar_1.f90 new file mode 100644 index 00000000000..1fdb7747210 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/achar_1.f90 @@ -0,0 +1,8 @@ +! { dg-do run } +! achar() should work with all supported integer kinds. +program bug6 + integer(1) :: i = 65 + character a + a = achar(i) + if (a /= 'A') call abort +end program bug6 diff --git a/gcc/testsuite/gfortran.dg/assign.f90 b/gcc/testsuite/gfortran.dg/assign.f90 new file mode 100644 index 00000000000..516a3d7632a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/assign.f90 @@ -0,0 +1,8 @@ +! { dg-do run } +! Program to test ASSIGNing a label to common variable. PR18827. + program test + integer i + common i + assign 2000 to i ! { dg-warning "Obsolete: ASSIGN statement" } +2000 continue + end diff --git a/gcc/testsuite/gfortran.dg/assign_2.f90 b/gcc/testsuite/gfortran.dg/assign_2.f90 new file mode 100644 index 00000000000..4119cd94f58 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/assign_2.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! Option passed to avoid excess errors from obsolete warning +! { dg-options "-w" } +! PR18827 + integer i,j + common /foo/ i,j + assign 1000 to j + j = 5 + goto j + 1000 continue + end diff --git a/gcc/testsuite/gfortran.dg/assign_3.f90 b/gcc/testsuite/gfortran.dg/assign_3.f90 new file mode 100644 index 00000000000..a43b10c11b1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/assign_3.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! Option passed to avoid excess errors from obsolete warning +! { dg-options "-w" } +! PR18827 + integer i,j + equivalence (i,j) + assign 1000 to i + write (*, j) ! { dg-error "not been assigned a format label" } + goto j ! { dg-error "not been assigned a target label" } + 1000 continue + end diff --git a/gcc/testsuite/gfortran.dg/backspace.f b/gcc/testsuite/gfortran.dg/backspace.f new file mode 100644 index 00000000000..c3ec0c41756 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/backspace.f @@ -0,0 +1,82 @@ +! This file is all about BACKSPACE +! { dg-do run } + + integer i, n, nr + real x(10), y(10) + +! PR libfortran/20068 + open (20, status='scratch') + write (20,*) 1 + write (20,*) 2 + write (20,*) 3 + rewind (20) + read (20,*) i + if (i .ne. 1) call abort + write (*,*) ' ' + backspace (20) + read (20,*) i + if (i .ne. 1) call abort + close (20) + +! PR libfortran/20125 + open (20, status='scratch') + write (20,*) 7 + backspace (20) + read (20,*) i + if (i .ne. 7) call abort + close (20) + + open (20, status='scratch', form='unformatted') + write (20) 8 + backspace (20) + read (20) i + if (i .ne. 8) call abort + close (20) + +! PR libfortran/20471 + do n = 1, 10 + x(n) = sqrt(real(n)) + end do + open (3, form='unformatted', status='scratch') + write (3) (x(n),n=1,10) + backspace (3) + rewind (3) + read (3) (y(n),n=1,10) + + do n = 1, 10 + if (abs(x(n)-y(n)) > 0.00001) call abort + end do + close (3) + +! PR libfortran/20156 + open (3, form='unformatted', status='scratch') + do i = 1, 5 + x(1) = i + write (3) n, (x(n),n=1,10) + end do + nr = 0 + rewind (3) + 20 continue + read (3,end=30,err=90) n, (x(n),n=1,10) + nr = nr + 1 + goto 20 + 30 continue + if (nr .ne. 5) call abort + + do i = 1, nr+1 + backspace (3) + end do + + do i = 1, nr + read(3,end=70,err=90) n, (x(n),n=1,10) + if (abs(x(1) - i) .gt. 0.001) call abort + end do + close (3) + stop + + 70 continue + call abort + 90 continue + call abort + + end diff --git a/gcc/testsuite/gfortran.dg/bound_1.f90 b/gcc/testsuite/gfortran.dg/bound_1.f90 new file mode 100644 index 00000000000..ce872bb0af5 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/bound_1.f90 @@ -0,0 +1,20 @@ +! { dg-do run } + implicit none + + type test_type + integer, dimension(5) :: a + end type test_type + + type (test_type), target :: tt(2) + integer i + + i = ubound(tt(1)%a, 1) + if (i/=5) call abort() + i = lbound(tt(1)%a, 1) + if (i/=1) call abort() + + i = ubound(tt, 1) + if (i/=2) call abort() + i = lbound(tt, 1) + if (i/=1) call abort() +end diff --git a/gcc/testsuite/gfortran.dg/boz_1.f90 b/gcc/testsuite/gfortran.dg/boz_1.f90 new file mode 100644 index 00000000000..abf02d36043 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/boz_1.f90 @@ -0,0 +1,38 @@ +! { dg-do run } +! Test the boz handling +program boz + + implicit none + + integer(1), parameter :: b1 = b'00000001' + integer(2), parameter :: b2 = b'0101010110101010' + integer(4), parameter :: b4 = b'01110000111100001111000011110000' + integer(8), parameter :: & + & b8 = b'0111000011110000111100001111000011110000111100001111000011110000' + + integer(1), parameter :: o1 = o'12' + integer(2), parameter :: o2 = o'4321' + integer(4), parameter :: o4 = o'43210765' + integer(8), parameter :: o8 = o'1234567076543210' + + integer(1), parameter :: z1 = z'a' + integer(2), parameter :: z2 = z'ab' + integer(4), parameter :: z4 = z'dead' + integer(8), parameter :: z8 = z'deadbeef' + + if (z1 /= 10_1) call abort + if (z2 /= 171_2) call abort + if (z4 /= 57005_4) call abort + if (z8 /= 3735928559_8) call abort + + if (b1 /= 1_1) call abort + if (b2 /= 21930_2) call abort + if (b4 /= 1894838512_4) call abort + if (b8 /= 8138269444283625712_8) call abort + + if (o1 /= 10_1) call abort + if (o2 /= 2257_2) call abort + if (o4 /= 9245173_4) call abort + if (o8 /= 45954958542472_8) call abort + +end program boz diff --git a/gcc/testsuite/gfortran.dg/boz_3.f90 b/gcc/testsuite/gfortran.dg/boz_3.f90 new file mode 100644 index 00000000000..96184deb7df --- /dev/null +++ b/gcc/testsuite/gfortran.dg/boz_3.f90 @@ -0,0 +1,34 @@ +! { dg-do run } +! Test that the BOZ constant on the RHS, which are of different KIND than +! the LHS, are correctly converted. +! +program boz + + implicit none + + integer(1), parameter :: b1 = b'000000000001111' + integer(2), parameter :: b2 = b'00000000000000000111000011110000' + integer(4), parameter :: & + & b4 = b'0000000000000000000000000000000001110000111100001111000011110000' + + integer(1), parameter :: o1 = o'0012' + integer(2), parameter :: o2 = o'0004321' + integer(4), parameter :: o4 = o'0000000043210765' + + integer(1), parameter :: z1 = z'0a' + integer(2), parameter :: z2 = z'00ab' + integer(4), parameter :: z4 = z'0000dead' + + if (b1 /= 15_1) call abort + if (b2 /= 28912_2) call abort + if (b4 /= 1894838512_4) call abort + + if (o1 /= 10_1) call abort + if (o2 /= 2257_2) call abort + if (o4 /= 9245173_4) call abort + + if (z1 /= 10_1) call abort + if (z2 /= 171_2) call abort + if (z4 /= 57005_4) call abort + +end program boz diff --git a/gcc/testsuite/gfortran.dg/boz_4.f90 b/gcc/testsuite/gfortran.dg/boz_4.f90 new file mode 100644 index 00000000000..d016df22c49 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/boz_4.f90 @@ -0,0 +1,29 @@ +! { dg-do compile } +! Test that the conversion of a BOZ constant that is too large for the +! integer variable is caught by the compiler. +program boz + + implicit none + + integer(1), parameter :: & + & b1 = b'0101010110101010' ! { dg-error "overflow converting" } + integer(2), parameter :: & + & b2 = b'01110000111100001111000011110000' ! { dg-error "overflow converting" } + integer(4), parameter :: & + & b4 = b'0111000011110000111100001111000011110000111100001111000011110000' ! { dg-error "overflow converting" } + + integer(1), parameter :: & + & o1 = o'1234567076543210' ! { dg-error "overflow converting" } + integer(2), parameter :: & + & o2 = o'1234567076543210' ! { dg-error "overflow converting" } + integer(4), parameter :: & + & o4 = o'1234567076543210' ! { dg-error "overflow converting" } + + integer(1), parameter :: & + & z1 = z'deadbeef' ! { dg-error "overflow converting" } + integer(2), parameter :: & + & z2 = z'deadbeef' ! { dg-error "overflow converting" } + integer(4), parameter :: & + & z4 = z'deadbeeffeed' ! { dg-error "overflow converting" } + +end program boz diff --git a/gcc/testsuite/gfortran.dg/deftype_1.f90 b/gcc/testsuite/gfortran.dg/deftype_1.f90 new file mode 100644 index 00000000000..e0476d02e58 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/deftype_1.f90 @@ -0,0 +1,6 @@ +! { dg-do compile } +! Checks for excess errors. +implicit none +dimension i(10) ! { dg-error "has no IMPLICIT type" } +i = 2 +end diff --git a/gcc/testsuite/gfortran.dg/do_iterator.f90 b/gcc/testsuite/gfortran.dg/do_iterator.f90 index 982568e3909..0e11aa23339 100644 --- a/gcc/testsuite/gfortran.dg/do_iterator.f90 +++ b/gcc/testsuite/gfortran.dg/do_iterator.f90 @@ -1,8 +1,12 @@ ! { dg-do compile } ! various checks which verify that we don't change do-iterators -DO I=1,5 - I=1 ! { dg-error "cannot be redefined" "changing do-iterator 1" } +DO I=1,5 ! { dg-error "cannot be redefined" "changing do-iterator 1" } + I=1 ! { dg-error "cannot be redefined" "changing do-iterator 1" } +END DO +DO I=1,5 ! { dg-error "cannot be redefined" "changing do-iterator 2" } READ(5,*) I ! { dg-error "cannot be redefined" "changing do-iterator 2" } +END DO +DO I=1,5 ! { dg-error "cannot be redefined" "changing do-iterator 3" } READ(5,*,iostat=i) j ! { dg-error "cannot be redefined" "changing do-iterator 3" } ENDDO END diff --git a/gcc/testsuite/gfortran.dg/dos_eol.f b/gcc/testsuite/gfortran.dg/dos_eol.f new file mode 100644 index 00000000000..3a22a14b143 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dos_eol.f @@ -0,0 +1,19 @@ +! PR libfortran/19678 and PR libfortran/19679 +! { dg-do run } + integer i, j + + open (10,status='scratch') + write (10,'(2A)') '1', achar(13) + rewind (10) + read (10,*) i + if (i .ne. 1) call abort + close (10) + + open (10,status='scratch') + write (10,'(2A)') ' 1', achar(13) + write (10,'(2A)') ' 2', achar(13) + rewind (10) + read (10,'(I4)') i + read (10,'(I5)') j + if ((i .ne. 1) .or. (j .ne. 2)) call abort + end diff --git a/gcc/testsuite/gfortran.dg/e_d_fmt.f90 b/gcc/testsuite/gfortran.dg/e_d_fmt.f90 new file mode 100644 index 00000000000..1abfa6105ea --- /dev/null +++ b/gcc/testsuite/gfortran.dg/e_d_fmt.f90 @@ -0,0 +1,13 @@ +! { dg-do run } +! Verify that the D format uses 'D' as the exponent character. +! " " " E " " 'E' " " " " +CHARACTER*10 c1, c2 +REAL*8 r +r = 1.0 +write(c1,"(e9.2)") r +write(c2,"(d9.2)") r + +if (trim(adjustl(c1)) .ne. "0.10E+01") call abort() +if (trim(adjustl(c2)) .ne. "0.10D+01") call abort() + +END diff --git a/gcc/testsuite/gfortran.dg/eor_1.f90 b/gcc/testsuite/gfortran.dg/eor_1.f90 index c61a0b7c87f..dd3b5e98f70 100644 --- a/gcc/testsuite/gfortran.dg/eor_1.f90 +++ b/gcc/testsuite/gfortran.dg/eor_1.f90 @@ -1,4 +1,4 @@ -! { dg do-run } +! { dg-do run } ! PR 19451: The test for advance='NO' with eor used to be reversed. program main character*2 c diff --git a/gcc/testsuite/gfortran.dg/func_result_1.f90 b/gcc/testsuite/gfortran.dg/func_result_1.f90 new file mode 100644 index 00000000000..ce3c2e4e685 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/func_result_1.f90 @@ -0,0 +1,19 @@ +! { dg-do run } +! From PR 19673 : We didn't dereference the the result from POINTER +! functions with a RESULT clause +program ret_ptr + if (foo(99) /= bar(99)) call abort () +contains + function foo (arg) result(ptr) + integer :: arg + integer, pointer :: ptr + allocate (ptr) + ptr = arg + end function foo + function bar (arg) + integer :: arg + integer, pointer :: bar + allocate (bar) + bar = arg + end function bar +end program ret_ptr diff --git a/gcc/testsuite/gfortran.dg/g77/12002.f b/gcc/testsuite/gfortran.dg/g77/12002.f index 609573f4a62..0cb29c7549e 100644 --- a/gcc/testsuite/gfortran.dg/g77/12002.f +++ b/gcc/testsuite/gfortran.dg/g77/12002.f @@ -1,5 +1,5 @@ C PR middle-end/12002 -C {dg-do compile } +C { dg-do compile } COMPLEX TE1 TE1=-2. TE1=TE1+TE1 diff --git a/gcc/testsuite/gfortran.dg/g77/19990313-1.f b/gcc/testsuite/gfortran.dg/g77/19990313-1.f index b229bb40f20..db4be77334f 100644 --- a/gcc/testsuite/gfortran.dg/g77/19990313-1.f +++ b/gcc/testsuite/gfortran.dg/g77/19990313-1.f @@ -1,6 +1,6 @@ c { dg-do run } integer *8 foo, bar - double precision r + double precision r data r/4d10/ foo = 4d10 bar = r diff --git a/gcc/testsuite/gfortran.dg/g77/19990313-2.f b/gcc/testsuite/gfortran.dg/g77/19990313-2.f index 5dac2d0ed40..edd5afd8188 100644 --- a/gcc/testsuite/gfortran.dg/g77/19990313-2.f +++ b/gcc/testsuite/gfortran.dg/g77/19990313-2.f @@ -1,6 +1,6 @@ c { dg-do run } integer *8 foo, bar - complex c + complex c data c/(4e10,0)/ foo = 4e10 bar = c diff --git a/gcc/testsuite/gfortran.dg/g77/19990313-3.f b/gcc/testsuite/gfortran.dg/g77/19990313-3.f index c7489f6870a..c14beb92e71 100644 --- a/gcc/testsuite/gfortran.dg/g77/19990313-3.f +++ b/gcc/testsuite/gfortran.dg/g77/19990313-3.f @@ -1,6 +1,6 @@ c { dg-do run } integer *8 foo, bar - double complex c + double complex c data c/(4d10,0)/ foo = 4d10 bar = c diff --git a/gcc/testsuite/gfortran.dg/g77/19990525-0.f b/gcc/testsuite/gfortran.dg/g77/19990525-0.f index 0baa802b66a..589fb8ebfd1 100644 --- a/gcc/testsuite/gfortran.dg/g77/19990525-0.f +++ b/gcc/testsuite/gfortran.dg/g77/19990525-0.f @@ -15,24 +15,24 @@ c { dg-do compile } * * Run the following through g77: * - subroutine a - character*2 string1 - character*2 string2 - character*4 string3 - string1 = 's1' - string2 = 's2' + subroutine a + character*2 string1 + character*2 string2 + character*4 string3 + string1 = 's1' + string2 = 's2' c c the next 2 lines are ok. - string3 = (string1 // string2) - call b(string1//string2) + string3 = (string1 // string2) + call b(string1//string2) c c this line gives gcc/f/com.c:10660: failed assertion `hook' - call b((string1//string2)) - end + call b((string1//string2)) + end * * the output from: * -* /usr/local/egcs-19990418/bin/g77 --verbose -c D.f +* /usr/local/egcs-19990418/bin/g77 --verbose -c D.f * * is: * diff --git a/gcc/testsuite/gfortran.dg/g77/19990826-0.f b/gcc/testsuite/gfortran.dg/g77/19990826-0.f index 054f9abf552..bc471f0bf1a 100644 --- a/gcc/testsuite/gfortran.dg/g77/19990826-0.f +++ b/gcc/testsuite/gfortran.dg/g77/19990826-0.f @@ -16,5 +16,5 @@ c { dg-do run } * It seems to work fine if I change it to the generic NINT(). Probably * a name pollution problem in the new C library, but it seems bad. no? -* Thanks, -* Rick Niles. +* Thanks, +* Rick Niles. diff --git a/gcc/testsuite/gfortran.dg/g77/19990826-2.f b/gcc/testsuite/gfortran.dg/g77/19990826-2.f index 8f0f0c18eb4..b8384f8d25a 100644 --- a/gcc/testsuite/gfortran.dg/g77/19990826-2.f +++ b/gcc/testsuite/gfortran.dg/g77/19990826-2.f @@ -1,7 +1,7 @@ c { dg-do run } * From: "Billinghurst, David (RTD)" <David.Billinghurst@riotinto.com.au> * Subject: RE: single precision complex bug in g77 - was Testing g77 with LA -* PACK 3.0 +* PACK 3.0 * Date: Thu, 8 Jul 1999 00:55:11 +0100 * X-UIDL: b00d9d8081a36fef561b827d255dd4a5 diff --git a/gcc/testsuite/gfortran.dg/g77/19990826-3.f b/gcc/testsuite/gfortran.dg/g77/19990826-3.f index aeaf4439996..dba24becb4c 100644 --- a/gcc/testsuite/gfortran.dg/g77/19990826-3.f +++ b/gcc/testsuite/gfortran.dg/g77/19990826-3.f @@ -28,294 +28,293 @@ c { dg-do compile } * See <URL:http://egcs.cygnus.com/faq.html#bugreport> for instructions. C* PCAPOP - SUBROUTINE PCAPOP(M1,M2,L1,L2,NMEM,N1,N2,IB,IBB,K3,TF,TS,TC,TTO) - DIMENSION NVA(6),C(6),I(6) + SUBROUTINE PCAPOP(M1,M2,L1,L2,NMEM,N1,N2,IB,IBB,K3,TF,TS,TC,TTO) + DIMENSION NVA(6),C(6),I(6) C C CALCUL DES PARAMETRES OPTIMAUX N1 N2 IB IBB C - TACC=.035 - TTRANS=.000004 - RAD=.000001 - RMI=.000001 - RMU=.0000015 - RDI=.000003 - RTE=.000003 - REQ=.000005 - VY1=3*RTE+RDI+8*REQ+3*(RAD+RMI+RMU) - VY2=REQ+2*RAD - AR2=M2*(2*(REQ+RMI)+3*RMU+M1*(2*RAD+REQ)) + TACC=.035 + TTRANS=.000004 + RAD=.000001 + RMI=.000001 + RMU=.0000015 + RDI=.000003 + RTE=.000003 + REQ=.000005 + VY1=3*RTE+RDI+8*REQ+3*(RAD+RMI+RMU) + VY2=REQ+2*RAD + AR2=M2*(2*(REQ+RMI)+3*RMU+M1*(2*RAD+REQ)) C VARIATION DE L1,L2, C - TTOTOP=1.E+10 - N1CO=0 - N2CO=0 - IBCO=0 - IBBCO=0 - K3CO=0 - TESOP=0. - TCOP=0. - TFOP=0. - INUN=7 - INDE=7 - IF(M1.LT.128)INUN=6 - IF(M1.LT.64)INUN=5 - IF(M1.LT.32)INUN=4 - IF(M2.LT.128)INDE=6 - IF(M2.LT.64)INDE=5 - IF(M2.LT.32)INDE=4 - DO 3 NUN =3,INUN - DO 3 NDE=3,INDE - N10=2**NUN - N20=2**NDE - NDIF=(N10-N20) - NDIF=IABS(NDIF) + TTOTOP=1.E+10 + N1CO=0 + N2CO=0 + IBCO=0 + IBBCO=0 + K3CO=0 + TESOP=0. + TCOP=0. + TFOP=0. + INUN=7 + INDE=7 + IF(M1.LT.128)INUN=6 + IF(M1.LT.64)INUN=5 + IF(M1.LT.32)INUN=4 + IF(M2.LT.128)INDE=6 + IF(M2.LT.64)INDE=5 + IF(M2.LT.32)INDE=4 + DO 3 NUN =3,INUN + DO 3 NDE=3,INDE + N10=2**NUN + N20=2**NDE + NDIF=(N10-N20) + NDIF=IABS(NDIF) C POUR AVOIR CES RESULTATS FAIRE TOURNER LE PROGRAMME VEFFT1 - TCFFTU=0. - IF(N10.EQ.128.AND.N20.EQ.128)TCFFTU=3.35 - IF(N10.EQ.64.AND.N20.EQ.64)TCFFTU=.70 - IF(N10.EQ.32.AND.N20.EQ.32)TCFFTU=.138 - IF(N10.EQ.16.AND.N20.EQ.16)TCFFTU=.0332 - IF(N10.EQ.8.AND.N20.EQ.8)TCFFTU=.00688 - IF(NDIF.EQ.64)TCFFTU=1.566 - IF(NDIF.EQ.96)TCFFTU=.709 - IF(NDIF.EQ.112)TCFFTU=.349 - IF(NDIF.EQ.120)TCFFTU=.160 - IF(NDIF.EQ.32)TCFFTU=.315 - IF(NDIF.EQ.48)TCFFTU=.154 - IF(NDIF.EQ.56)TCFFTU=.07 - IF(NDIF.EQ.16)TCFFTU=.067 - IF(NDIF.EQ.24)TCFFTU=.030 - IF(NDIF.EQ.8)TCFFTU=.016 - N30=N10-L1+1 - N40=N20-L2+1 - WW=VY1+N30*VY2 - NDOU=2*N10*N20 - IF((N10.LT.L1).OR.(N20.LT.L2)) GOTO 3 - NB=NMEM-NDOU-N20*(L1-1) - NVC=2*N10*(N20-1)+M1 - IF(NB.LT.(NVC)) GOTO 3 - CALL VALENT(M1,N30,K1) - CALL VALENT(M2,N40,K2) - IS=K1/2 - IF((2*IS).NE.K1)K1=K1+1 - TFF=TCFFTU*K1*K2 - CALL VALENT(M2,N40,JOFI) - IF(NB.GE.(K1*N20*N30+2*N20*(L1-1))) GOTO 4 - TIOOP=1.E+10 - IC=1 + TCFFTU=0. + IF(N10.EQ.128.AND.N20.EQ.128)TCFFTU=3.35 + IF(N10.EQ.64.AND.N20.EQ.64)TCFFTU=.70 + IF(N10.EQ.32.AND.N20.EQ.32)TCFFTU=.138 + IF(N10.EQ.16.AND.N20.EQ.16)TCFFTU=.0332 + IF(N10.EQ.8.AND.N20.EQ.8)TCFFTU=.00688 + IF(NDIF.EQ.64)TCFFTU=1.566 + IF(NDIF.EQ.96)TCFFTU=.709 + IF(NDIF.EQ.112)TCFFTU=.349 + IF(NDIF.EQ.120)TCFFTU=.160 + IF(NDIF.EQ.32)TCFFTU=.315 + IF(NDIF.EQ.48)TCFFTU=.154 + IF(NDIF.EQ.56)TCFFTU=.07 + IF(NDIF.EQ.16)TCFFTU=.067 + IF(NDIF.EQ.24)TCFFTU=.030 + IF(NDIF.EQ.8)TCFFTU=.016 + N30=N10-L1+1 + N40=N20-L2+1 + WW=VY1+N30*VY2 + NDOU=2*N10*N20 + IF((N10.LT.L1).OR.(N20.LT.L2)) GOTO 3 + NB=NMEM-NDOU-N20*(L1-1) + NVC=2*N10*(N20-1)+M1 + IF(NB.LT.(NVC)) GOTO 3 + CALL VALENT(M1,N30,K1) + CALL VALENT(M2,N40,K2) + IS=K1/2 + IF((2*IS).NE.K1)K1=K1+1 + TFF=TCFFTU*K1*K2 + CALL VALENT(M2,N40,JOFI) + IF(NB.GE.(K1*N20*N30+2*N20*(L1-1))) GOTO 4 + TIOOP=1.E+10 + IC=1 18 IB1=2*IC - MAX=(NB-2*N20*(L1-1))/(N20*N30) - IN=MAX/2 - IF(MAX.NE.2*IN) MAX=MAX-1 - K3=K1/IB1 - IBB1=K1-K3*IB1 - IOFI=M1/(IB1*N30) - IRZ=0 - IF(IOFI*IB1*N30.EQ.M1) GOTO1234 - IRZ=1 - IOFI=IOFI+1 - IF(IBB1.EQ.0) GOTO 1234 - IF(M1.EQ.((IOFI-1)*IB1*N30+IBB1*N30)) GOTO 1233 - IRZ=2 - GOTO 1234 + MAX=(NB-2*N20*(L1-1))/(N20*N30) + IN=MAX/2 + IF(MAX.NE.2*IN) MAX=MAX-1 + K3=K1/IB1 + IBB1=K1-K3*IB1 + IOFI=M1/(IB1*N30) + IRZ=0 + IF(IOFI*IB1*N30.EQ.M1) GOTO1234 + IRZ=1 + IOFI=IOFI+1 + IF(IBB1.EQ.0) GOTO 1234 + IF(M1.EQ.((IOFI-1)*IB1*N30+IBB1*N30)) GOTO 1233 + IRZ=2 + GOTO 1234 1233 IRZ=3 1234 IBX1=IBB1 - IF(IBX1.EQ.0)IBX1=IB1 - AR1=M2*(2*(RAD+RMI+RMU+REQ)+(M1-(IOFI-1)*IB1*N30)*2*(REQ+RAD)) + IF(IBX1.EQ.0)IBX1=IB1 + AR1=M2*(2*(RAD+RMI+RMU+REQ)+(M1-(IOFI-1)*IB1*N30)*2*(REQ+RAD)) %+M2*(3*(REQ+RMU+RAD)+4*RMI+(M1-(IOFI-1)*IB1*N30)*(2*RAD+REQ) %+(IOFI-1)*IB1*N30*(2*RMI+REQ+RAD)) - AR5=(JOFI-1)*(N20-L2)*(M1-(IOFI-1)*IB1*N30)*(2*(RAD+RMU)+REQ) + AR5=(JOFI-1)*(N20-L2)*(M1-(IOFI-1)*IB1*N30)*(2*(RAD+RMU)+REQ) %*IOFI+(M2-(JOFI-1)*N40+L2-2)*(M1-(IOFI-1)*IB1*N30)*(2*(RAD+RMU %)+REQ)*IOFI - WQ=((IOFI-1)*IB1+IBX1)*JOFI*WW - AT1=N20*WQ - AT2=N40*WQ - QW=JOFI*(VY1+VY2*IB1*N30) - AT3=IOFI*N40*QW - AT4=(IOFI-1)*N40*QW - AT5=JOFI*((IOFI-1)*N40*(IB1/IBX1)*(VY1+IBX1*N30*VY2) + WQ=((IOFI-1)*IB1+IBX1)*JOFI*WW + AT1=N20*WQ + AT2=N40*WQ + QW=JOFI*(VY1+VY2*IB1*N30) + AT3=IOFI*N40*QW + AT4=(IOFI-1)*N40*QW + AT5=JOFI*((IOFI-1)*N40*(IB1/IBX1)*(VY1+IBX1*N30*VY2) %+N40*((IB1/IBX1)*(IOFI-1)+1)*(VY1+IBX1*N30*VY2)) - AT6=JOFI*((IOFI-1)*N40*(IB1/2)*(VY1+2*N30*VY2)+N40*( + AT6=JOFI*((IOFI-1)*N40*(IB1/2)*(VY1+2*N30*VY2)+N40*( %IB1*(IOFI-1)/2+IBX1/2)*(VY1+2*N30*VY2)) - T1=JOFI*N20*(L1-1)*REQ - T2=M1*(L2-1)*REQ - T3=JOFI*N20*IBX1*N30*(RAD+REQ) - T4=JOFI*((IOFI-1)*IB1*N30*N20*(2*RMI+REQ)+IBX1*N30*N20*(2*RMI+R + T1=JOFI*N20*(L1-1)*REQ + T2=M1*(L2-1)*REQ + T3=JOFI*N20*IBX1*N30*(RAD+REQ) + T4=JOFI*((IOFI-1)*IB1*N30*N20*(2*RMI+REQ)+IBX1*N30*N20*(2*RMI+R %EQ)) - T5=JOFI*((IOFI-1)*IB1/2+IBX1/2)*N20*N30*(2*RAD+REQ) - T6=2*JOFI*(((IOFI-1)*IB1+IBX1)*N20)*((5*(RMI+RMU)+4*RAD + T5=JOFI*((IOFI-1)*IB1/2+IBX1/2)*N20*N30*(2*RAD+REQ) + T6=2*JOFI*(((IOFI-1)*IB1+IBX1)*N20)*((5*(RMI+RMU)+4*RAD %)+(L1-1)*(2*RAD+REQ)+N30*(2*RAD+REQ)) - T7=JOFI*2*((IOFI-1)*IB1+IBX1)*(L1-1)*(2*RAD+REQ) - T8=JOFI*N10*N20*((IOFI-1)*IB1/2+IBX1/2)*(3*REQ+9*RAD+4*RMU+RMI) - T9=N10*N20*JOFI*((IOFI-1)*IB1/2+IBX1/2)*(REQ+RMI)+M1*M2*(REQ+R + T7=JOFI*2*((IOFI-1)*IB1+IBX1)*(L1-1)*(2*RAD+REQ) + T8=JOFI*N10*N20*((IOFI-1)*IB1/2+IBX1/2)*(3*REQ+9*RAD+4*RMU+RMI) + T9=N10*N20*JOFI*((IOFI-1)*IB1/2+IBX1/2)*(REQ+RMI)+M1*M2*(REQ+R %DI+2*RAD) - T10=JOFI*((IOFI-1)*IB1/2+IBX1/2)*2*(3*RMU+2*(RMI+RAD)+N40*(3*RMI + T10=JOFI*((IOFI-1)*IB1/2+IBX1/2)*2*(3*RMU+2*(RMI+RAD)+N40*(3*RMI %+4*RMU+3*(RAD+REQ)+N30*(2*RAD+REQ))) - POI=JOFI - IF(POI.LE.2)POI=2 - TNRAN=(N40+(POI-2)*N20+(M2-(JOFI-1)*N40+L2-1))*(RMI+RMU+RAD + POI=JOFI + IF(POI.LE.2)POI=2 + TNRAN=(N40+(POI-2)*N20+(M2-(JOFI-1)*N40+L2-1))*(RMI+RMU+RAD %+REQ+N30*(2*RAD+2*REQ)*(IB1*(IOFI-1)+IBX1)) - IF(TNRAN.LT.0.)TNRAN=0. - TCPU=T1+T2+T3+T4+T5+T6+T7+T8+T9+T10+TNRAN - NVA(1)=N40 - NVA(2)=N40 - NVA(3)=N20 - NVA(4)=N20 - NVA(5)=M2-(JOFI-1)*N40 - NVA(6)=NVA(5) - C(1)=FLOAT(IB1*N30)/FLOAT(M1) - C(2)=FLOAT(M1-(IOFI-1)*IB1*N30)/FLOAT(M1) - C(3)=C(1) - C(4)=C(2) - C(5)=C(1) - C(6)=C(2) - K=1 - P1=FLOAT(NB)/FLOAT(M1) + IF(TNRAN.LT.0.)TNRAN=0. + TCPU=T1+T2+T3+T4+T5+T6+T7+T8+T9+T10+TNRAN + NVA(1)=N40 + NVA(2)=N40 + NVA(3)=N20 + NVA(4)=N20 + NVA(5)=M2-(JOFI-1)*N40 + NVA(6)=NVA(5) + C(1)=FLOAT(IB1*N30)/FLOAT(M1) + C(2)=FLOAT(M1-(IOFI-1)*IB1*N30)/FLOAT(M1) + C(3)=C(1) + C(4)=C(2) + C(5)=C(1) + C(6)=C(2) + K=1 + P1=FLOAT(NB)/FLOAT(M1) 10 IP1=P1 - I(K)=1 - IF(IP1.GE.NVA(K)) GOTO 7 - P2=P1 - IP2=P2 + I(K)=1 + IF(IP1.GE.NVA(K)) GOTO 7 + P2=P1 + IP2=P2 8 P2=P2-FLOAT(IP2)*C(K) - IP2=P2 - IF(IP2.EQ.0) GOTO 3 - IP1=IP1+IP2 - I(K)=I(K)+1 - IF(IP1.GE.NVA(K))GOTO 7 - GOTO 8 + IP2=P2 + IF(IP2.EQ.0) GOTO 3 + IP1=IP1+IP2 + I(K)=I(K)+1 + IF(IP1.GE.NVA(K))GOTO 7 + GOTO 8 7 IF(K.EQ.6) GOTO 11 - K=K+1 - GOTO 10 + K=K+1 + GOTO 10 11 IP1=0 - IP2=0 - IP3=0 - POFI=JOFI - IF(POFI.LE.2)POFI=2 - TIOL=(I(2)+(IOFI-1)*I(1)+(POFI-2)*(IOFI-1)*I(3)+(POFI- + IP2=0 + IP3=0 + POFI=JOFI + IF(POFI.LE.2)POFI=2 + TIOL=(I(2)+(IOFI-1)*I(1)+(POFI-2)*(IOFI-1)*I(3)+(POFI- %2)*I(4)+(IOFI-1)*I(5)+I(6))*TACC+(IOFI*M1*N40+(POFI-2)*IOFI* %M1*N20+(M2-(JOFI-1)*N40+L2-1)*M1*IOFI)*TTRANS - IF(IBB1.EQ.0) GOTO 33 - IF(IB1.EQ.IBB1) GOTO 33 - IF(IBB1.EQ.2)GOTO 34 - IP3=1 - INL=NMEM/((IOFI-1)*IB1*N30+IBB1*N30) + IF(IBB1.EQ.0) GOTO 33 + IF(IB1.EQ.IBB1) GOTO 33 + IF(IBB1.EQ.2)GOTO 34 + IP3=1 + INL=NMEM/((IOFI-1)*IB1*N30+IBB1*N30) 55 IF(INL.GT.N40)INL=N40 - GOTO 35 + GOTO 35 33 IF(IB1.GT.2) GOTO 36 - IF((M1-(IOFI-1)*IB1*N30).GE.N30) GOTO 36 + IF((M1-(IOFI-1)*IB1*N30).GE.N30) GOTO 36 34 IP1=1 - INL=NMEM/(2*M1-(IOFI-1)*IB1*N30) - GOTO 55 + INL=NMEM/(2*M1-(IOFI-1)*IB1*N30) + GOTO 55 36 IP2=1 - INL=NMEM/(IOFI*IB1*N30) - IF(INL.GT.N40)INL=N40 + INL=NMEM/(IOFI*IB1*N30) + IF(INL.GT.N40)INL=N40 35 CALL VALENT(N40,INL,KN1) - CALL VALENT(M2-(JOFI-1)*N40,INL,KN2) - CALL VALENT(INL*IBB1,IB1,KN3) - CALL VALENT((N40-(KN1-1)*INL)*IBB1,IB1,KN4) - IF((IP1+IP2+IP3).NE.1) CALL ERMESF(14) - TIO1=0. - IF(IP3.EQ.1)TIO1=N30*M2*TTRANS*(IB1*(IOFI-1)+IBB1) - IF(IP1.EQ.1)TIO1=M1*M2*TTRANS - IF(IP2.EQ.1) TIO1=(IB1*N30*M2*IOFI*TTRANS) - TTIO=2.*TIO1+(KN1*IOFI*(JOFI-1)+KN2*IOFI+(KN1-1)*( + CALL VALENT(M2-(JOFI-1)*N40,INL,KN2) + CALL VALENT(INL*IBB1,IB1,KN3) + CALL VALENT((N40-(KN1-1)*INL)*IBB1,IB1,KN4) + IF((IP1+IP2+IP3).NE.1) CALL ERMESF(14) + TIO1=0. + IF(IP3.EQ.1)TIO1=N30*M2*TTRANS*(IB1*(IOFI-1)+IBB1) + IF(IP1.EQ.1)TIO1=M1*M2*TTRANS + IF(IP2.EQ.1) TIO1=(IB1*N30*M2*IOFI*TTRANS) + TTIO=2.*TIO1+(KN1*IOFI*(JOFI-1)+KN2*IOFI+(KN1-1)*( %JOFI-1)+IOFI*(JOFI-1)+KN2-1.+IOFI+(KN1*(JOFI-1)+KN2))*TACC %+M1*M2*TTRANS+TIOL - IF((IP1.EQ.1).AND.(IRZ.EQ.0))TCPU=TCPU+AT1+AT2+AT3 - IF((IP1.EQ.1).AND.(IRZ.NE.0))TCPU=TCPU+AT1+AT2+AT4+AR1 - IF((IP2.EQ.1).AND.(IRZ.EQ.0))TCPU=TCPU+AT1+AT2+AT3 - IF((IP2.EQ.1).AND.(IRZ.NE.0))TCPU=TCPU+AT1+AT2+AT3+AR2 - IFOIS=IB1/IBX1 - IF((IP3.EQ.1).AND.(IFOIS*IBX1.EQ.IB1))TCPU=TCPU+AT1+AT2+AT5+AR2 - IF((IP3.EQ.1).AND.(IFOIS*IBX1.NE.IB1))TCPU=TCPU+AT1+AT2+AT6+AR2 - IF((IP1.EQ.1).AND.(IRZ.EQ.1))TCPU=TCPU+AR5 - IF((IP1.EQ.1).AND.(IRZ.EQ.2))TCPU=TCPU+AR5 - TTIOG=TTIO+TCPU - IF(TTIOG.LE.0.) GOTO 99 - IF(TTIOG.GE.TIOOP) GOTO 99 - IBOP=IB1 - IBBOP=IBB1 - K3OP=K3 - TIOOP=TTIOG - TIOOP1=TTIO - TIOOP2=TCPU + IF((IP1.EQ.1).AND.(IRZ.EQ.0))TCPU=TCPU+AT1+AT2+AT3 + IF((IP1.EQ.1).AND.(IRZ.NE.0))TCPU=TCPU+AT1+AT2+AT4+AR1 + IF((IP2.EQ.1).AND.(IRZ.EQ.0))TCPU=TCPU+AT1+AT2+AT3 + IF((IP2.EQ.1).AND.(IRZ.NE.0))TCPU=TCPU+AT1+AT2+AT3+AR2 + IFOIS=IB1/IBX1 + IF((IP3.EQ.1).AND.(IFOIS*IBX1.EQ.IB1))TCPU=TCPU+AT1+AT2+AT5+AR2 + IF((IP3.EQ.1).AND.(IFOIS*IBX1.NE.IB1))TCPU=TCPU+AT1+AT2+AT6+AR2 + IF((IP1.EQ.1).AND.(IRZ.EQ.1))TCPU=TCPU+AR5 + IF((IP1.EQ.1).AND.(IRZ.EQ.2))TCPU=TCPU+AR5 + TTIOG=TTIO+TCPU + IF(TTIOG.LE.0.) GOTO 99 + IF(TTIOG.GE.TIOOP) GOTO 99 + IBOP=IB1 + IBBOP=IBB1 + K3OP=K3 + TIOOP=TTIOG + TIOOP1=TTIO + TIOOP2=TCPU 99 IF(IB1.GE.MAX)GOTO17 - IC=IC+1 - GOTO 18 + IC=IC+1 + GOTO 18 4 T1=JOFI*N20*(L1-1)*REQ - T2=M1*(L2-1)*REQ - T3=JOFI*N20*N30*(RAD+REQ)*K1 - T4=JOFI*(K1*N30*N20*(2*RMI+REQ)) - T5=JOFI*N20*N30*(2*RAD+REQ)*K1/2 - T6=2*JOFI*(K1*N20)*((5*RMI+RMU)+4*RAD+(L1-1)*(2*RAD+REQ)+N30*2* + T2=M1*(L2-1)*REQ + T3=JOFI*N20*N30*(RAD+REQ)*K1 + T4=JOFI*(K1*N30*N20*(2*RMI+REQ)) + T5=JOFI*N20*N30*(2*RAD+REQ)*K1/2 + T6=2*JOFI*(K1*N20)*((5*RMI+RMU)+4*RAD+(L1-1)*(2*RAD+REQ)+N30*2* %RAD+REQ) - T7=JOFI*2*K1*(L1-1)*(2*RAD+REQ) - T9=JOFI*N10*N20*K1*(REQ+RMI)/2+M1*M2*(REQ+RDI+2*RAD) - T8=JOFI*N10*N20*K1*(3*REQ+9*RAD+4*RMU+RMI)/2 - T10=JOFI*K1*(3*RMU+2*(RMI+RAD)+N40*(3*RMI + T7=JOFI*2*K1*(L1-1)*(2*RAD+REQ) + T9=JOFI*N10*N20*K1*(REQ+RMI)/2+M1*M2*(REQ+RDI+2*RAD) + T8=JOFI*N10*N20*K1*(3*REQ+9*RAD+4*RMU+RMI)/2 + T10=JOFI*K1*(3*RMU+2*(RMI+RAD)+N40*(3*RMI %+4*RMU+3*(RAD+REQ)+N30*(2*RAD+REQ))) - PIO=JOFI - IF(PIO.LE.2)PIO=2 - TNR=(N40+(PIO-2)*N20+(M2-(JOFI-1)*N40+L2-1))*(RMU+RMI+RAD+REQ+ + PIO=JOFI + IF(PIO.LE.2)PIO=2 + TNR=(N40+(PIO-2)*N20+(M2-(JOFI-1)*N40+L2-1))*(RMU+RMI+RAD+REQ+ %N30*(2*RAD+2*REQ)*K1) - IF(TNR.LE.0.)TNR=0. - BT1=JOFI*N20*WW*K1 - BT2=JOFI*N40*WW*K1 - BT3=JOFI*N40*(VY1+K1*N30*VY2) - BR1=M2*(2*(RAD+RMI+RMU+REQ)+(M1*2*(REQ+RAD)))+M2*(3*( + IF(TNR.LE.0.)TNR=0. + BT1=JOFI*N20*WW*K1 + BT2=JOFI*N40*WW*K1 + BT3=JOFI*N40*(VY1+K1*N30*VY2) + BR1=M2*(2*(RAD+RMI+RMU+REQ)+(M1*2*(REQ+RAD)))+M2*(3*( $REQ+RAD+RMU)+4*(RMI)+M1*(2*(RAD)+REQ)) - BR2=M2*(2*(REQ+RMI)+3*RMU+M1*(2*RAD+REQ)) - TCPU=T1+T2+T3+T4+T5+T6+T7+T8+T9+T10 - TCPU=TCPU+TNR+BT1+BT2 - LIOF=M1/(N30) - IRZ=0 - IF(LIOF*N30.EQ.M1) GOTO 2344 - IRZ=1 + BR2=M2*(2*(REQ+RMI)+3*RMU+M1*(2*RAD+REQ)) + TCPU=T1+T2+T3+T4+T5+T6+T7+T8+T9+T10 + TCPU=TCPU+TNR+BT1+BT2 + LIOF=M1/(N30) + IRZ=0 + IF(LIOF*N30.EQ.M1) GOTO 2344 + IRZ=1 2344 IF(IRZ.EQ.0)TCPU=TCPU+BT3 - IF(IRZ.NE.0)TCPU=TCPU+BT3+BR2 - TIOOP=2.*FLOAT(M1)*FLOAT(M2)*TTRANS+2.*FLOAT(K2)*TACC+TCPU - IBOP=1 - IBBOP=0 - K3OP=1 - TIOOP2=TCPU - TIOOP1=TIOOP-TCPU + IF(IRZ.NE.0)TCPU=TCPU+BT3+BR2 + TIOOP=2.*FLOAT(M1)*FLOAT(M2)*TTRANS+2.*FLOAT(K2)*TACC+TCPU + IBOP=1 + IBBOP=0 + K3OP=1 + TIOOP2=TCPU + TIOOP1=TIOOP-TCPU 17 TTOT=TIOOP+TFF - IF(TTOT.LE.0.) GOTO 3 - IF(TTOT.GE.TTOTOP)GOTO3 - N1CO=N10 - N2CO=N20 - IBCO=IBOP - IBBCO=IBBOP - K3CO=K3OP - TTOTOP=TTOT - TESOP=TIOOP1 - TCOP=TIOOP2 - TFOP=TFF + IF(TTOT.LE.0.) GOTO 3 + IF(TTOT.GE.TTOTOP)GOTO3 + N1CO=N10 + N2CO=N20 + IBCO=IBOP + IBBCO=IBBOP + K3CO=K3OP + TTOTOP=TTOT + TESOP=TIOOP1 + TCOP=TIOOP2 + TFOP=TFF 3 CONTINUE -C - N1=N1CO - N2=N2CO - TTO=TTOTOP - IB=IBCO - IBB=IBBCO - K3=K3CO - TC=TCOP - TS=TESOP - TF=TFOP - TT=TCOP+TFOP - TWER=TTO-TT - IF(N1.EQ.0.OR.N2.EQ.0) CALL OUTSTR(0,'PAS DE PLACE MEMOIRE SUFFISA + N1=N1CO + N2=N2CO + TTO=TTOTOP + IB=IBCO + IBB=IBBCO + K3=K3CO + TC=TCOP + TS=TESOP + TF=TFOP + TT=TCOP+TFOP + TWER=TTO-TT + IF(N1.EQ.0.OR.N2.EQ.0) CALL OUTSTR(0,'PAS DE PLACE MEMOIRE SUFFISA $NTE POUR UNE MISE EN OEUVRE PAR BLOCS$') - IF(IB.NE.1)RETURN - IHJ=(M1/(N1-L1+1)) - IF(IHJ*(N1-L1+1).NE.M1)IHJ=IHJ+1 - IHJ1=IHJ/2 - IF(IHJ1*2.NE.IHJ)GOTO7778 - IB=IHJ - IBB=0 - RETURN -7778 IB=IHJ+1 - IBB=0 - RETURN - END + IF(IB.NE.1)RETURN + IHJ=(M1/(N1-L1+1)) + IF(IHJ*(N1-L1+1).NE.M1)IHJ=IHJ+1 + IHJ1=IHJ/2 + IF(IHJ1*2.NE.IHJ)GOTO7778 + IB=IHJ + IBB=0 + RETURN +7778 IB=IHJ+1 + IBB=0 + RETURN + END diff --git a/gcc/testsuite/gfortran.dg/g77/20000511-1.f b/gcc/testsuite/gfortran.dg/g77/20000511-1.f index fca4bf94080..261b6a0e27c 100644 --- a/gcc/testsuite/gfortran.dg/g77/20000511-1.f +++ b/gcc/testsuite/gfortran.dg/g77/20000511-1.f @@ -14,9 +14,9 @@ C -ffast-math ICE provoked by this conditional C C code for both increments equal to 1 C - do i= 1,n - sy(i)= sy(i)+sa*sx(i) - enddo - endif + do i= 1,n + sy(i)= sy(i)+sa*sx(i) + enddo + endif return end diff --git a/gcc/testsuite/gfortran.dg/g77/20000511-2.f b/gcc/testsuite/gfortran.dg/g77/20000511-2.f index b3a3ca3dfd4..1ae24ae5b87 100644 --- a/gcc/testsuite/gfortran.dg/g77/20000511-2.f +++ b/gcc/testsuite/gfortran.dg/g77/20000511-2.f @@ -47,16 +47,16 @@ C Multiply by inv(L). C do j= 1,n-1 C the following min() intrinsic provokes this bug - lm= min(kl,n-j) - jp= ipiv(j) - t= work(jp) - if(jp.ne.j)then + lm= min(kl,n-j) + jp= ipiv(j) + t= work(jp) + if(jp.ne.j)then C but only when combined with this if block - work(jp)= work(j) - work(j)= t - endif + work(jp)= work(j) + work(j)= t + endif C and this subroutine call - call saxpy(lm,-t,ab(kd+1,j),1,work(j+1),1) - enddo + call saxpy(lm,-t,ab(kd+1,j),1,work(j+1),1) + enddo return end diff --git a/gcc/testsuite/gfortran.dg/g77/970625-2.f b/gcc/testsuite/gfortran.dg/g77/970625-2.f index 53a4b23cc5d..c77a2b5f310 100644 --- a/gcc/testsuite/gfortran.dg/g77/970625-2.f +++ b/gcc/testsuite/gfortran.dg/g77/970625-2.f @@ -5,7 +5,7 @@ * Subject: Re: testing 970624. * In-Reply-To: <199706251027.GAA07892@churchy.gnu.ai.mit.edu> * References: <199706251018.MAA21538@nu> -* <199706251027.GAA07892@churchy.gnu.ai.mit.edu> +* <199706251027.GAA07892@churchy.gnu.ai.mit.edu> * X-Mailer: VM 6.30 under Emacs 19.34.1 * Content-Type: text/plain; charset=US-ASCII * @@ -24,7 +24,7 @@ * * Regards, * -- -* ===== R.Hooft@EuroMail.com http://www.Sander.EMBL-Heidelberg.DE/rob/ == +* ===== R.Hooft@EuroMail.com http://www.Sander.EMBL-Heidelberg.DE/rob/ == * ==== In need of protein modeling? http://www.Sander.EMBL-Heidelberg.DE/whatif/ * Validation of protein structures? http://biotech.EMBL-Heidelberg.DE:8400/ ==== * == PGPid 0xFA19277D == Use Linux! Free Software Rules The World! ============= diff --git a/gcc/testsuite/gfortran.dg/g77/980310-2.f b/gcc/testsuite/gfortran.dg/g77/980310-2.f index 829706a9e62..1ed5efc5960 100644 --- a/gcc/testsuite/gfortran.dg/g77/980310-2.f +++ b/gcc/testsuite/gfortran.dg/g77/980310-2.f @@ -33,12 +33,12 @@ C doesn't exist in the g77 runtime) C C RND - Return a random integer mod n C - INTEGER FUNCTION RND (N) - IMPLICIT INTEGER (A-Z) - REAL RAND - COMMON /SEED/ RNSEED + INTEGER FUNCTION RND (N) + IMPLICIT INTEGER (A-Z) + REAL RAND + COMMON /SEED/ RNSEED - RND = RAND(RNSEED)*FLOAT(N) - RETURN + RND = RAND(RNSEED)*FLOAT(N) + RETURN - END + END diff --git a/gcc/testsuite/gfortran.dg/g77/980310-3.f b/gcc/testsuite/gfortran.dg/g77/980310-3.f index e7e9523558a..56560237859 100644 --- a/gcc/testsuite/gfortran.dg/g77/980310-3.f +++ b/gcc/testsuite/gfortran.dg/g77/980310-3.f @@ -1,9 +1,9 @@ c { dg-do compile } c -c This demonstrates a problem with g77 and pic on x86 where -c egcs 1.0.1 and earlier will generate bogus assembler output. -c unfortunately, gas accepts the bogus acssembler output and -c generates code that almost works. +c This demonstrates a problem with g77 and pic on x86 where +c egcs 1.0.1 and earlier will generate bogus assembler output. +c unfortunately, gas accepts the bogus acssembler output and +c generates code that almost works. c diff --git a/gcc/testsuite/gfortran.dg/g77/980310-8.f b/gcc/testsuite/gfortran.dg/g77/980310-8.f index bafb470d340..c20f2d72082 100644 --- a/gcc/testsuite/gfortran.dg/g77/980310-8.f +++ b/gcc/testsuite/gfortran.dg/g77/980310-8.f @@ -4,19 +4,20 @@ C Subject: egcs-g77 and array indexing C Reply-To: etseidl@jutland.ca.sandia.gov C Date: Wed, 26 Nov 1997 10:38:27 -0800 C From: Edward Seidl <etseidl@jutland.ca.sandia.gov> -C -C I have some horrible spaghetti code I'm trying compile with egcs-g77, -C but it's puking on code like the example below. I have no idea if it's -C legal fortran or not, and I'm in no position to change it. All I do know -C is it compiles with a number of other compilers, including f2c and -C g77-0.5.19.1/gcc-2.7.2.1. When I try to compile with egcs-2.90.18 971122 -C I get the following (on both i686-pc-linux-gnu and alphaev56-unknown-linux-gnu): -C -C foo.f: In subroutine `foobar': -C foo.f:11: -C subroutine foobar(norb,nnorb) -C ^ -C Array `norb' at (^) is too large to handle +C +C I have some horrible spaghetti code I'm trying compile with egcs-g77, +C but it's puking on code like the example below. I have no idea if it's +C legal fortran or not, and I'm in no position to change it. All I do know +C is it compiles with a number of other compilers, including f2c and +C g77-0.5.19.1/gcc-2.7.2.1. When I try to compile with egcs-2.90.18 971122 +C I get the following (on both i686-pc-linux-gnu and +C alphaev56-unknown-linux-gnu): +C +Cfoo.f: In subroutine `foobar': +Cfoo.f:11: +C subroutine foobar(norb,nnorb) +C ^ +CArray `norb' at (^) is too large to handle program foo implicit integer(A-Z) diff --git a/gcc/testsuite/gfortran.dg/g77/980519-2.f b/gcc/testsuite/gfortran.dg/g77/980519-2.f index 50b517fbd0c..3134a00b5cd 100644 --- a/gcc/testsuite/gfortran.dg/g77/980519-2.f +++ b/gcc/testsuite/gfortran.dg/g77/980519-2.f @@ -40,10 +40,10 @@ c Next declaration added on transfer to gfortran testsuite common /Idim/ nlay, nlayz common /Idim/ n_work common /Idim/ nb_calls - - real Xsp, Ysp, Xrcv, Yrcv - real in( jT_f-hd_T : jT_l ) - + + real Xsp, Ysp, Xrcv, Yrcv + real in( jT_f-hd_T : jT_l ) + in( jT_f-hd_T ) = Xsp in( jT_f-hd_T + 1 ) = Ysp in( jT_f-hd_T + 2 ) = Xrcv diff --git a/gcc/testsuite/gfortran.dg/g77/alpha1.f b/gcc/testsuite/gfortran.dg/g77/alpha1.f index 5b33840f8c6..e8b8ed7cafd 100644 --- a/gcc/testsuite/gfortran.dg/g77/alpha1.f +++ b/gcc/testsuite/gfortran.dg/g77/alpha1.f @@ -19,8 +19,8 @@ C at this point! ! !if { [ishost "i\[34567\]86-*-*"] } { ! if { [istarget "mmix-knuth-mmixware"] -! || [istarget "powerpc-*-*"] } { -! set torture_compile_xfail [istarget] +! || [istarget "powerpc-*-*"] } { +! set torture_compile_xfail [istarget] ! } !} ! diff --git a/gcc/testsuite/gfortran.dg/g77/claus.f b/gcc/testsuite/gfortran.dg/g77/claus.f index 63b9be254c9..391d1cb9a85 100644 --- a/gcc/testsuite/gfortran.dg/g77/claus.f +++ b/gcc/testsuite/gfortran.dg/g77/claus.f @@ -7,8 +7,8 @@ c { dg-do run } k=1 n=2 ind=k-n+2 - if (ind /= 1) call abort - if (ab(ind) /= 1) call abort - if (k-n+2 /= 1) call abort - if (ab(k-n+2) /= 1) call abort + if (ind /= 1) call abort + if (ab(ind) /= 1) call abort + if (k-n+2 /= 1) call abort + if (ab(k-n+2) /= 1) call abort END diff --git a/gcc/testsuite/gfortran.dg/g77/erfc.f b/gcc/testsuite/gfortran.dg/g77/erfc.f index 0ab0aee8c1c..f8aae199d51 100644 --- a/gcc/testsuite/gfortran.dg/g77/erfc.f +++ b/gcc/testsuite/gfortran.dg/g77/erfc.f @@ -1,32 +1,32 @@ c { dg-do run } c============================================== test.f - real x, y - real*8 x1, y1 - x=0. - y = erfc(x) - if (y .ne. 1.) call abort + real x, y + real*8 x1, y1 + x=0. + y = erfc(x) + if (y .ne. 1.) call abort - x=1.1 - y = erfc(x) - if (abs(y - .1197949) .ge. 1.e-6) call abort + x=1.1 + y = erfc(x) + if (abs(y - .1197949) .ge. 1.e-6) call abort -* modified from x=10, y .gt. 1.5e-44 to avoid lack of -mieee on Alphas. - x=8 - y = erfc(x) - if (y .gt. 1.2e-28) call abort +c modified from x=10, y .gt. 1.5e-44 to avoid lack of -mieee on Alphas. + x=8 + y = erfc(x) + if (y .gt. 1.2e-28) call abort - x1=0. - y1 = erfc(x1) - if (y1 .ne. 1.) call abort + x1=0. + y1 = erfc(x1) + if (y1 .ne. 1.) call abort - x1=1.1d0 - y1 = erfc(x1) - if (abs(y1 - .1197949d0) .ge. 1.d-6) call abort + x1=1.1d0 + y1 = erfc(x1) + if (abs(y1 - .1197949d0) .ge. 1.d-6) call abort - x1=10 - y1 = erfc(x1) - if (y1 .gt. 1.5d-44) call abort - end + x1=10 + y1 = erfc(x1) + if (y1 .gt. 1.5d-44) call abort + end c================================================= !output: ! 0. 1.875 diff --git a/gcc/testsuite/gfortran.dg/g77/short.f b/gcc/testsuite/gfortran.dg/g77/short.f index 3f0e12217ad..e9a18a1315b 100644 --- a/gcc/testsuite/gfortran.dg/g77/short.f +++ b/gcc/testsuite/gfortran.dg/g77/short.f @@ -38,16 +38,16 @@ c a four-way average of rhobar c another four-way average of rhobar do 270 k=0,N - rtmp1 = z(2,2,k) - rtmp2 = z(1,2,k) - rtmp3 = z(2,1,k) - rtmp4 = z(1,1,k) - yzin2(k) = 0.25 * + rtmp1 = z(2,2,k) + rtmp2 = z(1,2,k) + rtmp3 = z(2,1,k) + rtmp4 = z(1,1,k) + yzin2(k) = 0.25 * & ( rtmp1 + rtmp2 + rtmp3 + rtmp4 ) 270 continue do k=0,N - if (yzin1(k) .ne. yzin2(k)) call abort + if (yzin1(k) .ne. yzin2(k)) call abort enddo if (yzin1(0) .ne. -1371.) call abort if (yzin1(1) .ne. -685.5) call abort diff --git a/gcc/testsuite/gfortran.dg/g77_intrinsics_funcs.f b/gcc/testsuite/gfortran.dg/g77_intrinsics_funcs.f new file mode 100644 index 00000000000..a2c37b03fdc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/g77_intrinsics_funcs.f @@ -0,0 +1,51 @@ +! { dg-do compile } +! Testing g77 intrinsics as subroutines + integer*8 i8 + integer*4 i4 + integer i + character*80 c + + i8 = time () + i4 = time () + i8 = time8 () + i4 = time8 () + + i8 = hostnm (c) + i4 = hostnm (c) + i = hostnm (c) + + i8 = ierrno () + i4 = ierrno () + i = ierrno () + + i8 = kill (i8, i8) + i8 = kill (i8, i4) + i8 = kill (i4, i8) + i8 = kill (i4, i4) + i4 = kill (i8, i8) + i4 = kill (i8, i4) + i4 = kill (i4, i8) + i4 = kill (i4, i4) + + i8 = link ('foo', 'bar') + i4 = link ('foo', 'bar') + i = link ('foo', 'bar') + + i8 = rename ('foo', 'bar') + i4 = rename ('foo', 'bar') + i = rename ('foo', 'bar') + + i8 = symlnk ('foo', 'bar') + i4 = symlnk ('foo', 'bar') + i = symlnk ('foo', 'bar') + +! Cleaning our mess + call unlink ('bar') + +! This should be the last test, unless you want garbage everywhere in +! your filesystem. + i8 = chdir ('..') + i4 = chdir ('..') + i = chdir ('..') + + end diff --git a/gcc/testsuite/gfortran.dg/g77_intrinsics_sub.f b/gcc/testsuite/gfortran.dg/g77_intrinsics_sub.f new file mode 100644 index 00000000000..1d797f75a28 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/g77_intrinsics_sub.f @@ -0,0 +1,82 @@ +! { dg-do compile } +! Testing g77 intrinsics as subroutines + integer*8 i8, j8 + integer*4 i4, j4 + integer i, j + character*80 c + + call gerror (c) + call getlog (c) + + call hostnm (c, status = i8) + call hostnm (c, i8) + call hostnm (c, status = i4) + call hostnm (c, i4) + call hostnm (c, status = i) + call hostnm (c, i) + call hostnm (c) + + call kill (i8, i8, status = i8) + call kill (i8, i8, i8) + call kill (i4, i8, i8) + call kill (i8, i4, i8) + call kill (i8, i8, i4) + call kill (i4, i4, i8) + call kill (i4, i8, i4) + call kill (i8, i4, i4) + call kill (i4, i4, i4) + call kill (i, i, i) + call kill (i8, i8) + call kill (i4, i8) + call kill (i8, i4) + call kill (i4, i4) + call kill (i, i) + + call link ('foo', 'bar', status = i8) + call link ('foo', 'bar', status = i4) + call link ('foo', 'bar', status = i) + call link ('foo', 'bar', i8) + call link ('foo', 'bar', i4) + call link ('foo', 'bar', i) + call link ('foo', 'bar') + + call perror (c) + + call rename ('foo', 'bar', status = i8) + call rename ('foo', 'bar', status = i4) + call rename ('foo', 'bar', status = i) + call rename ('foo', 'bar', i8) + call rename ('foo', 'bar', i4) + call rename ('foo', 'bar', i) + call rename ('foo', 'bar') + + i = 1 + i4 = 1 + i8 = 1 + call sleep (i) + call sleep (i4) + call sleep (i8) + call sleep (-1) + + call symlnk ('foo', 'bar', status = i8) + call symlnk ('foo', 'bar', status = i4) + call symlnk ('foo', 'bar', status = i) + call symlnk ('foo', 'bar', i8) + call symlnk ('foo', 'bar', i4) + call symlnk ('foo', 'bar', i) + call symlnk ('foo', 'bar') + +! Cleaning our mess + call unlink ('bar') + +! This should be the last test, unless you want garbage everywhere in +! your filesystem. + call chdir ('..', status = i8) + call chdir ('..', i8) + call chdir ('..', status = i4) + call chdir ('..', i4) + call chdir ('..', status = i) + call chdir ('..', i) + call chdir ('..') + + end diff --git a/gcc/testsuite/gfortran.dg/implicit_3.f90 b/gcc/testsuite/gfortran.dg/implicit_3.f90 new file mode 100644 index 00000000000..830b8611a9f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/implicit_3.f90 @@ -0,0 +1,12 @@ +! { dg-do compile } +! Verify that INTERFACEs don't inherit the implicit types of the +! surrounding namespace. +implicit complex (i-k) + +interface + function f(k,l) + ! k should be default INTEGER + dimension l(k) + end function f +end interface +end diff --git a/gcc/testsuite/gfortran.dg/int_1.f90 b/gcc/testsuite/gfortran.dg/int_1.f90 new file mode 100644 index 00000000000..4e381220a72 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/int_1.f90 @@ -0,0 +1,172 @@ +! { dg-do run } +! +! 13.7.53 INT(A [, KIND]) +! +! Description. Convert to integer type. +! Class. Elemental function. +! Arguments. +! A shall be of type integer, real, or complex, +! or a boz-literal-constant . +! KIND (optional) shall be a scalar integer initialization expression. +! +! Result Characteristics. Integer. If KIND is present, the kind type +! parameter is that specified by the value of KIND; otherwise, the +! kind type parameter is that of default integer type. +! +! Result Value. +! +! Case (1): If A is of type integer, INT (A) = A. +! +! Case (2): If A is of type real, there are two cases: +! (a) if |A| < 1, INT (A) has the value 0 +! (b) if |A| .ge. 1, INT (A) is the integer whose magnitude is the +! largest integer that does not exceed the magnitude of A and +! whose sign is the same as the sign of A. +! +! Case (3): If A is of type complex, INT(A) = INT(REAL(A, KIND(A))). +! +! Case (4): If A is a boz-literal-constant, it is treated as if it were +! an int-literal-constant with a kind-param that specifies the +! representation method with the largest decimal exponent range +! supported by the processor. +! +! Example. INT (3.7) has the value 3. +! +module mykinds + integer, parameter :: ik1 = selected_int_kind(2) + integer, parameter :: ik2 = selected_int_kind(4) + integer, parameter :: ik4 = selected_int_kind(9) + integer, parameter :: ik8 = selected_int_kind(18) + integer, parameter :: sp = selected_real_kind(6,30) + integer, parameter :: dp = selected_real_kind(15,300) + integer, parameter :: ck = kind('a') +end module mykinds + +program test_int + + use mykinds + + integer(ik1) i1 + integer(ik2) i2 + integer(ik4) i4 + integer(ik8) i8 + real(sp) r4 + real(dp) r8 + complex(sp) c4 + complex(dp) c8 + ! + ! Case 1 + ! + i1 = int(-3) + i2 = int(-3) + i4 = int(-3) + i8 = int(-3) + if (i1 /= -3_ik1 .or. i2 /= -3_ik2) call abort + if (i4 /= -3_ik4 .or. i8 /= -3_ik8) call abort + + i1 = int(5, ik1) + i2 = int(i1, ik2) + i4 = int(i1, ik4) + i8 = int(i1, ik8) + if (i1 /= 5_ik1 .or. i2 /= 5_ik2) call abort + if (i4 /= 5_ik4 .or. i8 /= 5_ik8) call abort + + i8 = int(10, ik8) + i1 = int(i8, ik1) + i2 = int(i8, ik2) + i4 = int(i8, ik4) + if (i1 /= 10_ik1 .or. i2 /= 10_ik2) call abort + if (i4 /= 10_ik4 .or. i8 /= 10_ik8) call abort + ! + ! case 2(b) + ! + r4 = -3.7_sp + i1 = int(r4, ik1) + i2 = int(r4, ik2) + i4 = int(r4, ik4) + i8 = int(r4, ik8) + if (i1 /= -3_ik1 .or. i2 /= -3_ik2) call abort + if (i4 /= -3_ik4 .or. i8 /= -3_ik8) call abort + + r8 = -3.7_dp + i1 = int(r8, ik1) + i2 = int(r8, ik2) + i4 = int(r8, ik4) + i8 = int(r8, ik8) + if (i1 /= -3_ik1 .or. i2 /= -3_ik2) call abort + if (i4 /= -3_ik4 .or. i8 /= -3_ik8) call abort + ! + ! Case 2(a) + ! + r4 = -3.7E-1_sp + i1 = int(r4, ik1) + i2 = int(r4, ik2) + i4 = int(r4, ik4) + i8 = int(r4, ik8) + if (i1 /= 0_ik1 .or. i2 /= 0_ik2) call abort + if (i4 /= 0_ik4 .or. i8 /= 0_ik8) call abort + + r8 = -3.7E-1_dp + i1 = int(r8, ik1) + i2 = int(r8, ik2) + i4 = int(r8, ik4) + i8 = int(r8, ik8) + if (i1 /= 0_ik1 .or. i2 /= 0_ik2) call abort + if (i4 /= 0_ik4 .or. i8 /= 0_ik8) call abort + ! + ! Case 3 + ! + c4 = (-3.7E-1_sp,3.7E-1_sp) + i1 = int(c4, ik1) + i2 = int(c4, ik2) + i4 = int(c4, ik4) + i8 = int(c4, ik8) + if (i1 /= 0_ik1 .or. i2 /= 0_ik2) call abort + if (i4 /= 0_ik4 .or. i8 /= 0_ik8) call abort + + c8 = (-3.7E-1_dp,3.7E-1_dp) + i1 = int(c8, ik1) + i2 = int(c8, ik2) + i4 = int(c8, ik4) + i8 = int(c8, ik8) + if (i1 /= 0_ik1 .or. i2 /= 0_ik2) call abort + if (i4 /= 0_ik4 .or. i8 /= 0_ik8) call abort + + c4 = (-3.7_sp,3.7_sp) + i1 = int(c4, ik1) + i2 = int(c4, ik2) + i4 = int(c4, ik4) + i8 = int(c4, ik8) + if (i1 /= -3_ik1 .or. i2 /= -3_ik2) call abort + if (i4 /= -3_ik4 .or. i8 /= -3_ik8) call abort + + c8 = (3.7_dp,3.7_dp) + i1 = int(c8, ik1) + i2 = int(c8, ik2) + i4 = int(c8, ik4) + i8 = int(c8, ik8) + if (i1 /= 3_ik1 .or. i2 /= 3_ik2) call abort + if (i4 /= 3_ik4 .or. i8 /= 3_ik8) call abort + ! + ! Case 4 + ! + i1 = int(b'0011', ik1) + i2 = int(b'0011', ik2) + i4 = int(b'0011', ik4) + i8 = int(b'0011', ik8) + if (i1 /= 3_ik1 .or. i2 /= 3_ik2) call abort + if (i4 /= 3_ik4 .or. i8 /= 3_ik8) call abort + i1 = int(o'0011', ik1) + i2 = int(o'0011', ik2) + i4 = int(o'0011', ik4) + i8 = int(o'0011', ik8) + if (i1 /= 9_ik1 .or. i2 /= 9_ik2) call abort + if (i4 /= 9_ik4 .or. i8 /= 9_ik8) call abort + i1 = int(z'0011', ik1) + i2 = int(z'0011', ik2) + i4 = int(z'0011', ik4) + i8 = int(z'0011', ik8) + if (i1 /= 17_ik1 .or. i2 /= 17_ik2) call abort + if (i4 /= 17_ik4 .or. i8 /= 17_ik8) call abort + +end program test_int diff --git a/gcc/testsuite/gfortran.dg/ishft.f90 b/gcc/testsuite/gfortran.dg/ishft.f90 index d8ca3a7de73..88edd30efdd 100644 --- a/gcc/testsuite/gfortran.dg/ishft.f90 +++ b/gcc/testsuite/gfortran.dg/ishft.f90 @@ -25,7 +25,7 @@ if (ishft (1_8, 0) /= 1) call abort if (ishft (1_8, 1) /= 2) call abort if (ishft (3_8, 1) /= 6) call abort if (ishft (-1_8, 1) /= -2) call abort -if (ishft (-1_8, -60) /= z'F'_8) call abort ! { dg-warning "" "" } +if (ishft (-1_8, -60) /= z'F') call abort if (ishftc (1_1, 0) /= 1) call abort if (ishftc (1_1, 1) /= 2) call abort diff --git a/gcc/testsuite/gfortran.dg/largeequiv_1.f90 b/gcc/testsuite/gfortran.dg/largeequiv_1.f90 new file mode 100644 index 00000000000..39b1f815938 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/largeequiv_1.f90 @@ -0,0 +1,13 @@ +! { dg-do run } +! PR 20361 : We didn't check if a large equivalence actually fit on +! the stack, and therefore segfaulted at execution time +subroutine test +integer i(1000000), j +equivalence (i(50), j) + +j = 1 +if (i(50) /= j) call abort() +end subroutine test + +call test +end diff --git a/gcc/testsuite/gfortran.dg/list_read_4.f90 b/gcc/testsuite/gfortran.dg/list_read_4.f90 new file mode 100644 index 00000000000..fb1770e2303 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/list_read_4.f90 @@ -0,0 +1,54 @@ +! { dg-do run } +! Test of gfortran list directed read> check delimiters are correctly +! treated. Written in f77 so that g77 will run for comparison. +! +! f , e and i edit reads are terminated separately by read_real.c +! +! PThomas Jan 2005 +! BDavis + program list_read_4 + integer i(10),l(10),k,j + real x(10),y(10) +! expected results + data y / 1.0,2.0,3.0,-1.0,-1.0,-1.0,4.0,4.0,99.0,99.0 / + data l /1,2,3,-1,-1,-1,4,4,99,99/ +! put them in a file + open (10,status="scratch") + write (10,*) " 1.0, 2.0 , 3.0,, 2* , 2*4.0 , 5*99.0" + write (10,*) " 1.0e0, 2.0e0 , 3.0e0,, 2* , 2*4.0e0 , 5*99.0e0" + write (10,*) " 1, 2 , 3,, 2* , 2*4 , 5*99" + write (10,*) " 1, 2 , 3,, 2* , 2*4 , 5*99" + rewind (10) +! + do k = 1,10 + x(k) = -1.0 + enddo + read (10,*,iostat=ier) x + if (ier.ne.0) call abort + do k = 1,10 + if (x(k).ne.y(k)) call abort + x(k) = -1 + end do + READ(10,*,iostat=ier) x + if (ier.ne.0) call abort + do k = 1,10 + if (x(k).ne.y(k)) call abort + x(k) = -1 + end do + READ(10,*,iostat=ier) x + if (ier.ne.0) call abort + do k = 1,10 + if (x(k).ne.y(k)) call abort + x(k) = -1 + end do +! integer + do k = 1,10 + i(k) = -1 + end do + READ(10,*,iostat=ier) (i(j),j=1,10) + if (ier.ne.0) call abort + do k = 1,10 + if (i(k).ne.y(k)) call abort + i(k) = -1 + end do + end diff --git a/gcc/testsuite/gfortran.dg/negative_unit.f b/gcc/testsuite/gfortran.dg/negative_unit.f new file mode 100644 index 00000000000..fd0100a14de --- /dev/null +++ b/gcc/testsuite/gfortran.dg/negative_unit.f @@ -0,0 +1,22 @@ +! { dg-do run } +! +! PR libfortran/20660 and other bugs (not filed in bugzilla) relating +! to negative units +! +! Bugs submitted by Walt Brainerd + integer i + logical l + + i = 0 +! gfortran created a 'fort.-1' file and wrote "Hello" in it + write (unit=-1, fmt=*, iostat=i) "Hello" + if (i <= 0) call abort + + i = 0 + open (unit=-11, file="xxx", iostat=i) + if (i <= 0) call abort + + inquire (unit=-42, exist=l) + if (l) call abort + + end diff --git a/gcc/testsuite/gfortran.dg/nesting_1.f90 b/gcc/testsuite/gfortran.dg/nesting_1.f90 new file mode 100644 index 00000000000..51ebfd999a8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/nesting_1.f90 @@ -0,0 +1,18 @@ +! PR 18525 +! we used to incorrectly refer to n from a when resolving the call to +! c from b +! { dg-do run } +subroutine a(n) +call b(n+1) +contains + subroutine b(n) + call c(n) + end subroutine b + + subroutine c(m) + if (m/=1) call abort + end subroutine c +end subroutine a + +call a(0) +end diff --git a/gcc/testsuite/gfortran.dg/open-options-blanks.f b/gcc/testsuite/gfortran.dg/open-options-blanks.f new file mode 100644 index 00000000000..8f5faa41629 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/open-options-blanks.f @@ -0,0 +1,7 @@ +! { dg-do run } +! PR 20163, first half: Trailing blanks on an option to +! open used to cause an error + CHARACTER*8 ST + ST = 'SCRATCH ' + OPEN(UNIT=10,STATUS=ST) + END diff --git a/gcc/testsuite/gfortran.dg/open_new.f90 b/gcc/testsuite/gfortran.dg/open_new.f90 index 9e9c9512776..3b8e95ae944 100644 --- a/gcc/testsuite/gfortran.dg/open_new.f90 +++ b/gcc/testsuite/gfortran.dg/open_new.f90 @@ -1,4 +1,4 @@ -! { dg do-run } +! { dg-do run } ! PR 18982: verifies that opening an existing file with ! status="new" is an error program main diff --git a/gcc/testsuite/gfortran.dg/pr15332.f b/gcc/testsuite/gfortran.dg/pr15332.f new file mode 100644 index 00000000000..238553533e2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr15332.f @@ -0,0 +1,12 @@ +! PR libfortran/15332 +! {do-do run} + character*12 c + + write (c,100) 0, 1 + if (c .ne. 'i = 0, j = 1') call abort + + write (c,100) 0 + if (c .ne. 'i = 0 ') call abort + + 100 format ('i = ',i1,:,', j = ',i1) + end diff --git a/gcc/testsuite/gfortran.dg/pr15754.f90 b/gcc/testsuite/gfortran.dg/pr15754.f90 index 6d8e34f28db..f595d6e2ac6 100644 --- a/gcc/testsuite/gfortran.dg/pr15754.f90 +++ b/gcc/testsuite/gfortran.dg/pr15754.f90 @@ -1,7 +1,7 @@ ! we didn't give a warning if the RHS of an assignment was NULL ! { dg-do-compile } INTEGER, POINTER :: P -I = NULL() ! { dg-warning "NULL appears" "Assignment non-pointer = NULL" } -P = NULL() ! { dg-warning "NULL appears" "Assignment pointer = NULL" } +I = NULL() ! { dg-error "NULL appears" "Assignment non-pointer = NULL" } +P = NULL() ! { dg-error "NULL appears" "Assignment pointer = NULL" } P => NULL() END diff --git a/gcc/testsuite/gfortran.dg/pr15959.f90 b/gcc/testsuite/gfortran.dg/pr15959.f90 new file mode 100644 index 00000000000..b7f3719dfe4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr15959.f90 @@ -0,0 +1,5 @@ +! { dg-do run } +! Test initializer of character array. PR15959 +character (*), parameter :: a (1:2) = (/'ab', 'abc'/) +if (a(2) .ne. 'abc') call abort() +end diff --git a/gcc/testsuite/gfortran.dg/pr17229.f b/gcc/testsuite/gfortran.dg/pr17229.f new file mode 100644 index 00000000000..b1a4471e410 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr17229.f @@ -0,0 +1,23 @@ +! PR fortran/17229 +! { dg-do run } + integer i + logical l + + l = .false. + i = -1 + if (l) if (i) 999,999,999 + + l = .true. + if (l) if (i) 10,999,999 + go to 999 + + 10 i = 0 + if (l) if (i) 999,20,999 + go to 999 + + 20 i = 1 + if (l) if (i) 999,999,30 + go to 999 + + 999 call abort + 30 end diff --git a/gcc/testsuite/gfortran.dg/pr17708.f90 b/gcc/testsuite/gfortran.dg/pr17708.f90 index 7485da8bb07..b696b0c2757 100644 --- a/gcc/testsuite/gfortran.dg/pr17708.f90 +++ b/gcc/testsuite/gfortran.dg/pr17708.f90 @@ -2,8 +2,8 @@ program test j = 0 do 10 i=1,3 - if(i == 2) goto 10 ! { dg-warning "" "" } + if(i == 2) goto 10 ! { dg-warning "jumps to END" } j = j+1 -10 enddo +10 enddo ! { dg-warning "jumps to END" } if (j/=2) call abort end diff --git a/gcc/testsuite/gfortran.dg/pr18025.f90 b/gcc/testsuite/gfortran.dg/pr18025.f90 new file mode 100644 index 00000000000..26d5c01e023 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr18025.f90 @@ -0,0 +1,8 @@ +! PR libfortran/18025 <coudert@clipper.ens.fr> +! { dg-do run } + character(len=80) :: c + write(c, "('#',F0.2,'#')") 1.23 + if (c /= '#1.23#') call abort + write(c, "('#',F0.2,'#')") -1.23 + if (c /= '#-1.23#') call abort + end diff --git a/gcc/testsuite/gfortran.dg/pr19936_1.f90 b/gcc/testsuite/gfortran.dg/pr19936_1.f90 new file mode 100644 index 00000000000..cd5140f21b1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr19936_1.f90 @@ -0,0 +1,5 @@ +! { dg-do compile } +program pr19936_1 + integer, parameter :: i=4 + print *,(/(i,i=1,4)/) ! { dg-error "Expected VARIABLE" } +end program pr19936_1 diff --git a/gcc/testsuite/gfortran.dg/pr19936_2.f90 b/gcc/testsuite/gfortran.dg/pr19936_2.f90 new file mode 100644 index 00000000000..ad43c943fec --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr19936_2.f90 @@ -0,0 +1,5 @@ +! { dg-do compile } +program pr19936_2 + integer i + print *,(/(i,i=1a,4)/) ! { dg-error "Syntax error in iterator" } +end program pr19936_2 diff --git a/gcc/testsuite/gfortran.dg/pr19936_3.f90 b/gcc/testsuite/gfortran.dg/pr19936_3.f90 new file mode 100644 index 00000000000..6f6f8ba37a9 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr19936_3.f90 @@ -0,0 +1,5 @@ +! { dg-do compile } +program pr19936_3 + integer, parameter :: i = 4 + print *,(/(i,i,4)/) ! { dg-error "Syntax error in COMPLEX" } +end program pr19936_3 diff --git a/gcc/testsuite/gfortran.dg/pr20086.f90 b/gcc/testsuite/gfortran.dg/pr20086.f90 new file mode 100644 index 00000000000..e5759da3dc1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr20086.f90 @@ -0,0 +1,14 @@ +! { dg-do run } +! PR 20086 - Missing characters in output with hollerith strings + implicit none + character*80 line + write(line,2070) + if (line.ne.' stiffness reformed for this high step')call abort + write(line,2090) + if (line.ne.' stiffness reformed for hello hello')call abort + stop + + 2070 format (2x,37hstiffness reformed for this high step) + 2090 format (2x,34hstiffness reformed for hello hello) + + end diff --git a/gcc/testsuite/gfortran.dg/pr20124.f90 b/gcc/testsuite/gfortran.dg/pr20124.f90 new file mode 100644 index 00000000000..69f4f18b29c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr20124.f90 @@ -0,0 +1,8 @@ +! { dg-do run } +! pr 20124 + character*80 line + x = -.01 + y = .01 + write(line,'(2f10.2)') x, y + if (line.ne.' -0.01 0.01') call abort + end diff --git a/gcc/testsuite/gfortran.dg/pr20163-2.f b/gcc/testsuite/gfortran.dg/pr20163-2.f new file mode 100644 index 00000000000..c0b2573ed93 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr20163-2.f @@ -0,0 +1,5 @@ + open(10,status="foo",err=100) + call abort + 100 continue + open(10,status="scratch") + end diff --git a/gcc/testsuite/gfortran.dg/pr20257.f90 b/gcc/testsuite/gfortran.dg/pr20257.f90 new file mode 100644 index 00000000000..3808829b486 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr20257.f90 @@ -0,0 +1,9 @@ +! { dg-do run } + integer,parameter :: n = 10000 + real(8) array(10000) + + array(:) = 0 + open (10, status='scratch') + write (10,*) array + close (10) +end diff --git a/gcc/testsuite/gfortran.dg/pr20480.f90 b/gcc/testsuite/gfortran.dg/pr20480.f90 new file mode 100644 index 00000000000..12e53009d91 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr20480.f90 @@ -0,0 +1,9 @@ +! { dg-do run } +! PR libfortran/20480 +! fxcoudert@gcc.gnu.org + character(len=80) c + write (c,'(ES12.3)') 0.0 + if (trim(adjustl(c)) .ne. '0.000E+00') call abort () + write (c,'(EN12.3)') 0.0 + if (trim(adjustl(c)) .ne. '0.000E+00') call abort () + end diff --git a/gcc/testsuite/gfortran.dg/pr20755.f b/gcc/testsuite/gfortran.dg/pr20755.f new file mode 100644 index 00000000000..e2bac5a7dcc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr20755.f @@ -0,0 +1,10 @@ +! PR libfortran/20755 +! { dg-do run } + character*30 s + + write (s,2000) 0.0, 0.02 + if (s .ne. " 0.00 2.000E-02") call abort + write (s,2000) 0.01, 0.02 + if (s .ne. " 1.000E-02 2.000E-02") call abort + 2000 format (1PG12.3,G12.3) + end diff --git a/gcc/testsuite/gfortran.dg/promotion.f90 b/gcc/testsuite/gfortran.dg/promotion.f90 new file mode 100644 index 00000000000..d1b9b686e58 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/promotion.f90 @@ -0,0 +1,12 @@ +! { dg-do run { target i?86-*-* } } +! { dg-options "-fdefault-integer-8 -fdefault-real-8" } +program a + logical l + integer i + real x + double precision d + if (kind(l) /= 8) call abort + if (kind(i) /= 8) call abort + if (kind(x) /= 8) call abort + if (kind(d) /= 8) call abort +end program a diff --git a/gcc/testsuite/gfortran.dg/real_index_1.f90 b/gcc/testsuite/gfortran.dg/real_index_1.f90 new file mode 100644 index 00000000000..16ceca82774 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/real_index_1.f90 @@ -0,0 +1,7 @@ +! { dg-do run } +! PR 16907 : We didn't support REAL array indices as an extension + integer I, A(10) + A = 2 + I=A(1.0) ! { dg-warning "Extension" } + if (i/=2) call abort () + end diff --git a/gcc/testsuite/gfortran.dg/select_4.f90 b/gcc/testsuite/gfortran.dg/select_4.f90 index 8fb661f7c22..dbced6e4c66 100644 --- a/gcc/testsuite/gfortran.dg/select_4.f90 +++ b/gcc/testsuite/gfortran.dg/select_4.f90 @@ -4,15 +4,15 @@ program select_5 integer i select case(i) - case (20:30) - case (25:) ! { dg-error "overlaps with CASE" "" } + case (20:30) ! { dg-error "overlaps with CASE" } + case (25:) ! { dg-error "overlaps with CASE" } end select select case(i) - case (30) - case (25:) ! { dg-error "overlaps with CASE" "" } + case (30) ! { dg-error "overlaps with CASE" } + case (25:) ! { dg-error "overlaps with CASE" } end select select case(i) - case (20:30) - case (25) ! { dg-error "overlaps with CASE" "" } + case (20:30) ! { dg-error "overlaps with CASE" } + case (25) ! { dg-error "overlaps with CASE" } end select end program select_5 diff --git a/gcc/testsuite/gfortran.dg/spec_expr_1.f90 b/gcc/testsuite/gfortran.dg/spec_expr_1.f90 new file mode 100644 index 00000000000..61591c3113c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/spec_expr_1.f90 @@ -0,0 +1,12 @@ +! { dg-do compile } +! PR 20323 +! We didn't verify that character length expressions are specification +! expressions. +function testpresent(arg) + integer, intent(in), optional :: arg + character(len=arg) :: s ! { dg-error "OPTIONAL" } + logical :: testpresent + + testpresent=.true. + +end function testpresent diff --git a/gcc/testsuite/gfortran.dg/stfunc_2.f90 b/gcc/testsuite/gfortran.dg/stfunc_2.f90 new file mode 100644 index 00000000000..75ecb057b05 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/stfunc_2.f90 @@ -0,0 +1,6 @@ +! { dg-do compile } +! PR 20467 : we didn't check if a statement function had the dummy attribute. +SUBROUTINE a(b) + b(c) = 0 ! { dg-error "Unclassifiable statement" } +END SUBROUTINE a + diff --git a/gcc/testsuite/gfortran.dg/string_pad_trunc.f90 b/gcc/testsuite/gfortran.dg/string_pad_trunc.f90 new file mode 100644 index 00000000000..738a181b962 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/string_pad_trunc.f90 @@ -0,0 +1,20 @@ +! { dg-do run } +! PR20713. Pad and truncate string. + +character(len = 6),parameter:: a = 'hello' +character(len = 6),parameter:: b = 'hello *' +character(len = 6),parameter:: c (1:1) = 'hello' +character(len = 11) line + +write (line, '(6A)') a, 'world' +if (line .ne. 'hello world') call abort + +write (line, '(6A)') b, 'world' +if (line .ne. 'hello world') call abort + +write (line, '(6A)') c, 'world' +if (line .ne. 'hello world') call abort + +write (line, '(6A)') c(1), 'world' +if (line .ne. 'hello world') call abort +end diff --git a/gcc/testsuite/gfortran.dg/tiny_1.f90 b/gcc/testsuite/gfortran.dg/tiny_1.f90 new file mode 100644 index 00000000000..e8bfb2d8994 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/tiny_1.f90 @@ -0,0 +1,9 @@ +! { dg-do run } +! Test program inspired by bug report from Walt Brainerd. +! http://gcc.gnu.org/ml/fortran/2005-04/msg00132.html +program tiny1 + real(4) x4 + real(8) x8 + if (minexponent(x4) /= exponent(tiny(x4))) call abort + if (minexponent(x8) /= exponent(tiny(x8))) call abort +end program tiny1 diff --git a/gcc/testsuite/gfortran.dg/tiny_2.f90 b/gcc/testsuite/gfortran.dg/tiny_2.f90 new file mode 100644 index 00000000000..194e6cd3109 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/tiny_2.f90 @@ -0,0 +1,9 @@ +! { dg-do run } +program tiny2 + real(4) x4 + real(8) x8 + x4 = tiny(x4) + x8 = tiny(x8) + if (minexponent(x4) /= exponent(x4)) call abort + if (minexponent(x8) /= exponent(x8)) call abort +end program tiny2 diff --git a/gcc/testsuite/gfortran.dg/write_0_pe_format.f90 b/gcc/testsuite/gfortran.dg/write_0_pe_format.f90 new file mode 100644 index 00000000000..3890c32ecc0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/write_0_pe_format.f90 @@ -0,0 +1,9 @@ +! { dg-do run } +! PR libfortran/20101 +! With format "PE", 0.0 must still have "+00" as exponent +character(len=10) :: c1, c2 +write(c1,"(1pe9.2)") 0.0 +write(c2,"(1pe9.2)") 1.0 +if (trim(adjustl(c1)) .ne. "0.00E+00") call abort() +if (trim(adjustl(c2)) .ne. "1.00E+00") call abort() +end diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/backspace.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/backspace.f90 index 16f5523e353..8781fb2c996 100644 --- a/gcc/testsuite/gfortran.fortran-torture/execute/backspace.f90 +++ b/gcc/testsuite/gfortran.fortran-torture/execute/backspace.f90 @@ -9,6 +9,6 @@ read(10,*)C backspace(10) read(10,*) C - if (C.ne.'b') call abort + if (C.ne.'a') call abort close(10,STATUS='DELETE') end diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/character_passing.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/character_passing.f90 new file mode 100644 index 00000000000..ade7f9d0c29 --- /dev/null +++ b/gcc/testsuite/gfortran.fortran-torture/execute/character_passing.f90 @@ -0,0 +1,21 @@ +! PR middle-end/20030 +! we were messing up the access in LSAME for +! the character agruments. + program foo + character*1 a1, a2, b + a1='A' + a2='A' + b='B' + x = LSAME(a1,a2) + if ( x.ne.1 ) then + call abort (); + endif + end + + logical function LSAME( CA, CB ) + character CA, CB + integer INTA, INTB + INTA = ICHAR( CA ) + INTB = ICHAR( CB ) + LSAME = INTA.EQ.INTB + end diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/data.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/data.f90 index 81954e222b5..d2d86a2d71c 100644 --- a/gcc/testsuite/gfortran.fortran-torture/execute/data.f90 +++ b/gcc/testsuite/gfortran.fortran-torture/execute/data.f90 @@ -1,13 +1,13 @@ ! Program to test data statement program data - call sub1() - call sub2() - end + call sub1() + call sub2() + end subroutine sub1() integer i type tmp integer, dimension(4)::a - real :: r + real :: r end type type tmp1 type (tmp) t1(4) @@ -58,7 +58,7 @@ if (tmp2(2)%b .ne. 0) call abort end - subroutine sub2() + subroutine sub2() integer a(4,4), b(10) integer i,j,k real r,t diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/integer_select.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/integer_select.f90 index 148cd394e68..765356d2610 100644 --- a/gcc/testsuite/gfortran.fortran-torture/execute/integer_select.f90 +++ b/gcc/testsuite/gfortran.fortran-torture/execute/integer_select.f90 @@ -8,20 +8,20 @@ PROGRAM Test_INTEGER_select SELECT CASE (I) CASE (:-1) - CALL abort + CALL abort CASE (1:) - CALL abort + CALL abort CASE DEFAULT - CONTINUE + CONTINUE END SELECT SELECT CASE (I) CASE (3,2,1) - CALL abort + CALL abort CASE (0) - CONTINUE + CONTINUE CASE DEFAULT - call abort + call abort END SELECT ! Not aborted by here, so it worked @@ -31,40 +31,40 @@ PROGRAM Test_INTEGER_select SELECT CASE (I) CASE (:-1) - CALL abort + CALL abort CASE (1:) - CONTINUE + CONTINUE CASE DEFAULT - CALL abort + CALL abort END SELECT SELECT CASE (I) CASE (3,2,1,:0) - CALL abort + CALL abort CASE (maxI) - CONTINUE + CONTINUE CASE DEFAULT - call abort + call abort END SELECT I = minI SELECT CASE (I) CASE (:-1) - CONTINUE + CONTINUE CASE (1:) - CALL abort + CALL abort CASE DEFAULT - CALL abort + CALL abort END SELECT SELECT CASE (I) CASE (3:,2,1,0) - CALL abort + CALL abort CASE (minI) - CONTINUE + CONTINUE CASE DEFAULT - call abort + call abort END SELECT END diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/integer_select_1.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/integer_select_1.f90 index cd9bb00a98c..18bc79b4358 100644 --- a/gcc/testsuite/gfortran.fortran-torture/execute/integer_select_1.f90 +++ b/gcc/testsuite/gfortran.fortran-torture/execute/integer_select_1.f90 @@ -1,6 +1,6 @@ INTEGER :: I = 1 SELECT CASE (I) - CASE (-3:-5) ! Can never be matched + CASE (-3:-5) ! Can never be matched CALL abort CASE (1) CONTINUE diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_mvbits.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_mvbits.f90 index c9fbe782703..3437e9f0c9d 100644 --- a/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_mvbits.f90 +++ b/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_mvbits.f90 @@ -1,6 +1,6 @@ ! Test the MVBITS intrinsic subroutine INTEGER*4 :: from, to, result -integer*8 :: to8 +integer*8 :: from8, to8 DATA from / z'0003FFFC' / DATA to / z'77760000' / @@ -9,7 +9,8 @@ DATA result / z'7777FFFE' / CALL mvbits(from, 2, 16, to, 1) if (to /= result) CALL abort() -to8 = 0 -call mvbits (b'1011'_8*2_8**32, 33, 3, to8, 2) ! { dg-warning "" "" } -if (to8 /= b'10100'_8) call abort ! { dg-warning "" "" } +to8 = 0_8 +from8 = b'1011'*2_8**32 +call mvbits (from8, 33, 3, to8, 2) +if (to8 /= b'10100') call abort end diff --git a/gcc/testsuite/lib/c-torture.exp b/gcc/testsuite/lib/c-torture.exp index f7b547a0708..375ff2c9464 100644 --- a/gcc/testsuite/lib/c-torture.exp +++ b/gcc/testsuite/lib/c-torture.exp @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-dejagnu@gnu.org. - # This file was written by Rob Savoye. (rob@cygnus.com) load_lib file-format.exp diff --git a/gcc/testsuite/lib/file-format.exp b/gcc/testsuite/lib/file-format.exp index 7be398eeb3a..a1aa484455c 100644 --- a/gcc/testsuite/lib/file-format.exp +++ b/gcc/testsuite/lib/file-format.exp @@ -32,6 +32,13 @@ proc gcc_target_object_format { } { } elseif { [string match "*-*-darwin*" $target_triplet] } { # Darwin doesn't necessarily have objdump, so hand-code it. set gcc_target_object_format_saved mach-o + } elseif { [string match "hppa*-*-hpux*" $target_triplet] } { + # HP-UX doesn't necessarily have objdump, so hand-code it. + if { [string match "hppa*64*-*-hpux*" $target_triplet] } { + set gcc_target_object_format_saved elf + } else { + set gcc_target_object_format_saved som + } } else { set objdump_name [find_binutils_prog objdump] set open_file [open objfmtst.c w] @@ -66,6 +73,9 @@ proc gcc_target_object_format { } { pe { set gcc_target_object_format_saved pe } + som { + set gcc_target_object_format_saved som + } default { verbose "Unknown file format: $objformat" 3 set gcc_target_object_format_saved unknown diff --git a/gcc/testsuite/lib/g++.exp b/gcc/testsuite/lib/g++.exp index 19c06839fe6..9f79fbb273a 100644 --- a/gcc/testsuite/lib/g++.exp +++ b/gcc/testsuite/lib/g++.exp @@ -273,6 +273,11 @@ proc g++_target_compile { source dest type options } { } lappend options "additional_flags=[libio_include_flags]" + # APPLE LOCAL begin testsuite multiply defined + if [ istarget *-*-darwin* ] { + lappend options "ldflags=-Wl,-multiply_defined,suppress" + } + # APPLE LOCAL end testsuite multiply defined lappend options "compiler=$GXX_UNDER_TEST"; set options [concat $gpp_compile_options $options] diff --git a/gcc/testsuite/lib/gcc.exp b/gcc/testsuite/lib/gcc.exp index 2f553387666..e5d3d5d857e 100644 --- a/gcc/testsuite/lib/gcc.exp +++ b/gcc/testsuite/lib/gcc.exp @@ -144,6 +144,11 @@ proc gcc_target_compile { source dest type options } { if [target_info exists gcc,timeout] { lappend options "timeout=[target_info gcc,timeout]" } + # APPLE LOCAL begin testsuite multiply defined + if [ istarget *-*-darwin* ] { + lappend options "ldflags=-Wl,-multiply_defined,suppress" + } + # APPLE LOCAL end testsuite multiply defined lappend options "compiler=$GCC_UNDER_TEST" set options [dg-additional-files-options $options $source] return [target_compile $source $dest $type $options] diff --git a/gcc/testsuite/lib/gfortran-dg.exp b/gcc/testsuite/lib/gfortran-dg.exp index 2387403030b..247df02bd0c 100644 --- a/gcc/testsuite/lib/gfortran-dg.exp +++ b/gcc/testsuite/lib/gfortran-dg.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2004 Free Software Foundation, Inc. +# Copyright (C) 2004, 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 @@ -25,11 +25,47 @@ proc gfortran-dg-test { prog do_what extra_tool_flags } { set comp_output [lindex $result 0] set output_file [lindex $result 1] - # Put the error message on the same line as the line number - # FIXME: Add a colon after line number - # Remove the line of source code with the error and - # the number pointing to error - regsub -all "\n\n\[^\n\]*\n *\[0-9\]*\n" $comp_output ": " comp_output + # gfortran error messages look like this: + # In file [name]:[line] + # + # some code + # 1 + # Error: Some error at (1) and (2) + # or + # In file [name]:[line] + # + # some code + # 1 + # In file [name]:[line2] + # + # some other code + # 2 + # Error: Some error at (1) and (2) + # or + # In file [name]:[line] + # + # some code and some more code + # 1 2 + # Error: Some error at (1) and (2) + # + # We collapse these to look like: + # [name]:[line]: Error: Some error at (1) and (2) + # or + # [name]:[line]: Error: Some error at (1) and (2) + # [name]:[line2]: Error: Some error at (1) and (2) + # We proceed in two steps: first we deal with the form with two + # different locus lines, then with the form with only one locus line. + # + # Note that these regexps only make sense in the combinations used below. + # Note also that is imperative that we first deal with the form with + # two loci. + set locus_regexp " In file (\[^\n\]*)\n\n\[^\n\]*\n\[^\n\]*\n" + set diag_regexp "(\[^\n\]*)\n" + + set two_loci "$locus_regexp$locus_regexp$diag_regexp" + set single_locus "$locus_regexp$diag_regexp" + regsub -all $two_loci $comp_output "\\1: \\3\n\\2: \\3\n" comp_output + regsub -all $single_locus $comp_output "\\1: \\2\n" comp_output return [list $comp_output $output_file] } diff --git a/gcc/testsuite/lib/obj-c++-dg.exp b/gcc/testsuite/lib/obj-c++-dg.exp new file mode 100644 index 00000000000..2002230bc1a --- /dev/null +++ b/gcc/testsuite/lib/obj-c++-dg.exp @@ -0,0 +1,29 @@ +# APPLE LOCAL file mainline +# Copyright (C) 2004 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Define obj-c++ callbacks for dg.exp. + +load_lib gcc-dg.exp + +proc obj-c++-dg-test { prog do_what extra_tool_flags } { + return [gcc-dg-test-1 obj-c++_target_compile $prog $do_what $extra_tool_flags] +} + + +proc obj-c++-dg-prune { system text } { + return [gcc-dg-prune $system $text] +} diff --git a/gcc/testsuite/lib/obj-c++.exp b/gcc/testsuite/lib/obj-c++.exp new file mode 100644 index 00000000000..bcebfbcfeca --- /dev/null +++ b/gcc/testsuite/lib/obj-c++.exp @@ -0,0 +1,366 @@ +# APPLE LOCAL file mainline +# Copyright (C) 2004 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# This file was written by Rob Savoye (rob@cygnus.com) +# Many modifications by Jeffrey Wheat (cassidy@cygnus.com) +# With modifications by Mike Stump <mrs@cygnus.com>. + +# +# obj-c++ support library routines +# +load_lib prune.exp +load_lib gcc-defs.exp + +# +# OBJCXX_UNDER_TEST is the compiler under test. +# + + +set gpp_compile_options "" + +# +# obj-c++_version -- extract and print the version number of the compiler +# + +proc obj-c++_version { } { + global OBJCXX_UNDER_TEST + + obj-c++_init + + # ignore any arguments after the command + set compiler [lindex $OBJCXX_UNDER_TEST 0] + + # verify that the compiler exists + if { [is_remote host] || [which $compiler] != 0 } then { + set tmp [remote_exec host "$compiler -v"] + set status [lindex $tmp 0]; + set output [lindex $tmp 1]; + regexp " version \[^\n\r\]*" $output version + if { $status == 0 && [info exists version] } then { + if [is_remote host] { + clone_output "$compiler $version\n" + } else { + clone_output "[which $compiler] $version\n" + } + } else { + clone_output "Couldn't determine version of [which $compiler]\n" + } + } else { + # compiler does not exist (this should have already been detected) + warning "$compiler does not exist" + } +} + +# +# obj-c++_include_flags -- provide new version of obj-c++_include_flags +# (originally from libgloss.exp) which knows about the gcc tree structure +# +proc obj-c++_include_flags { paths } { + global srcdir + global HAVE_LIBSTDCXX_V3 + global TESTING_IN_BUILD_TREE + + set flags "" + + if { [is_remote host] || ! [info exists TESTING_IN_BUILD_TREE] } { + return "${flags}" + } + + set gccpath ${paths} + + set odir [lookfor_file ${gccpath} libstdc++-v3] + if { ${odir} != "" } { + append flags [exec sh ${odir}/scripts/testsuite_flags --build-includes] + } + + return "$flags" +} + +# +# obj-c++_link_flags -- provide new version of obj-c++_link_flags +# (originally from libgloss.exp) which knows about the gcc tree structure +# + +proc obj-c++_link_flags { paths } { + global rootme + global srcdir + global ld_library_path + global OBJCXX_UNDER_TEST + + set gccpath ${paths} + set libio_dir "" + set flags "" + set ld_library_path "." + + if { $gccpath != "" } { + if [file exists "${gccpath}/lib/libstdc++.a"] { + append ld_library_path ":${gccpath}/lib" + } + if [file exists "${gccpath}/libg++/libg++.a"] { + append flags "-L${gccpath}/libg++ " + append ld_library_path ":${gccpath}/libg++" + } + if [file exists "${gccpath}/libstdc++/libstdc++.a"] { + append flags "-L${gccpath}/libstdc++ " + append ld_library_path ":${gccpath}/libstdc++" + } + if [file exists "${gccpath}/libstdc++-v3/src/.libs/libstdc++.a"] { + append flags " -L${gccpath}/libstdc++-v3/src/.libs " + append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs" + } + if [file exists "${gccpath}/libiberty/libiberty.a"] { + append flags "-L${gccpath}/libiberty " + } + if [file exists "${gccpath}/librx/librx.a"] { + append flags "-L${gccpath}/librx " + } + append ld_library_path ":${rootme}" + set compiler [lindex $OBJCXX_UNDER_TEST 0] + if { [is_remote host] == 0 && [which $compiler] != 0 } { + foreach i "[exec $compiler --print-multi-lib]" { + set mldir "" + regexp -- "\[a-z0-9=/\.-\]*;" $i mldir + set mldir [string trimright $mldir "\;@"] + if { "$mldir" == "." } { + continue + } + if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] == 1 } { + append ld_library_path ":${rootme}/${mldir}" + } + } + } + } else { + global tool_root_dir; + + set libgpp [lookfor_file ${tool_root_dir} libg++]; + if { $libgpp != "" } { + append flags "-L${libgpp} "; + append ld_library_path ":${libgpp}" + } + set libstdcpp [lookfor_file ${tool_root_dir} libstdc++]; + if { $libstdcpp != "" } { + append flags "-L${libstdcpp} "; + append ld_library_path ":${libstdcpp}" + } + set libiberty [lookfor_file ${tool_root_dir} libiberty]; + if { $libiberty != "" } { + append flags "-L${libiberty} "; + } + set librx [lookfor_file ${tool_root_dir} librx]; + if { $librx != "" } { + append flags "-L${librx} "; + } + } + + # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but + # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH + # (for the 64-bit ABI). The right way to do this would be to modify + # unix.exp -- but that's not an option since it's part of DejaGNU + # proper, so we do it here. + # The same applies to Darwin (DYLD_LIBRARY_PATH), Solaris 32 bit + # (LD_LIBRARY_PATH_32), Solaris 64 bit (LD_LIBRARY_PATH_64), and HP-UX + # (SHLIB_PATH). + # Doing this does cause trouble when testing cross-compilers. + if {![is_remote target]} { + global env; + if [info exists env(LD_LIBRARY_PATH)] { + # If we've already added these directories once, keep the + # existing path. + if {$ld_library_path == $env(LD_LIBRARY_PATH) + || [string first $ld_library_path: \ + $env(LD_LIBRARY_PATH)] == 0} { + set ld_library_path $env(LD_LIBRARY_PATH) + } elseif { $env(LD_LIBRARY_PATH) != "" } { + append ld_library_path ":$env(LD_LIBRARY_PATH)" + } + } + setenv LD_LIBRARY_PATH $ld_library_path + setenv SHLIB_PATH $ld_library_path + setenv LD_LIBRARYN32_PATH $ld_library_path + setenv LD_LIBRARY64_PATH $ld_library_path + setenv LD_LIBRARY_PATH_32 $ld_library_path + setenv LD_LIBRARY_PATH_64 $ld_library_path + setenv DYLD_LIBRARY_PATH $ld_library_path + } + + return "$flags" +} + +# +# obj-c++_init -- called at the start of each subdir of tests +# + +proc obj-c++_init { args } { + global subdir + global gpp_initialized + global base_dir + global tmpdir + global libdir + global gluefile wrap_flags; + global objdir srcdir + global ALWAYS_OBJCXXFLAGS + global TOOL_EXECUTABLE TOOL_OPTIONS + global OBJCXX_UNDER_TEST + global TESTING_IN_BUILD_TREE + global target_triplet + + if ![info exists OBJCXX_UNDER_TEST] then { + if [info exists TOOL_EXECUTABLE] { + set OBJCXX_UNDER_TEST $TOOL_EXECUTABLE; + } else { + if { [is_remote host] || ! [info exists TESTING_IN_BUILD_TREE] } { + set OBJCXX_UNDER_TEST [transform c++] + } else { + set OBJCXX_UNDER_TEST [findfile $base_dir/../g++ "$base_dir/../g++ -B$base_dir/../" [findfile $base_dir/g++ "$base_dir/g++ -B$base_dir/" [transform c++]]] + } + } + } + + # Bleah, nasty. Bad taste. + if [ishost "*-dos-*" ] { + regsub "c\\+\\+" "$OBJCXX_UNDER_TEST" "gcc" OBJCXX_UNDER_TEST + } + + if ![is_remote host] { + if { [which $OBJCXX_UNDER_TEST] == 0 } then { + perror "OBJCXX_UNDER_TEST ($OBJCXX_UNDER_TEST) does not exist" + exit 1 + } + } + if ![info exists tmpdir] { + set tmpdir "/tmp" + } + + if [info exists gluefile] { + unset gluefile + } + + obj-c++_maybe_build_wrapper "${tmpdir}/obj-c++-testglue.o" + + set ALWAYS_OBJCXXFLAGS "" + + if ![is_remote host] { + if [info exists TOOL_OPTIONS] { + lappend ALWAYS_OBJCXXFLAGS "additional_flags=[obj-c++_include_flags [get_multilibs ${TOOL_OPTIONS}] ]"; + lappend ALWAYS_OBJCXXFLAGS "ldflags=[obj-c++_link_flags [get_multilibs ${TOOL_OPTIONS}] ]"; + } else { + lappend ALWAYS_OBJCXXFLAGS "additional_flags=[obj-c++_include_flags [get_multilibs] ]"; + lappend ALWAYS_OBJCXXFLAGS "ldflags=[obj-c++_link_flags [get_multilibs] ]"; + } + } + + if [info exists TOOL_OPTIONS] { + lappend ALWAYS_OBJCXXFLAGS "additional_flags=$TOOL_OPTIONS"; + } + + # Make sure that lines are not wrapped. That can confuse the + # error-message parsing machinery. + lappend ALWAYS_OBJCXXFLAGS "additional_flags=-fmessage-length=0" + + if { [string match "powerpc-*-darwin*" $target_triplet] } { + lappend ALWAYS_OBJCXXFLAGS "ldflags=-multiply_defined suppress" + } + + verbose -log "ALWAYS_OBJCXXFLAGS set to $ALWAYS_OBJCXXFLAGS" + + verbose "obj-c++ is initialized" 3 +} + +# +# obj-c++_target_compile -- compile a source file +# + +proc obj-c++_target_compile { source dest type options } { + global tmpdir; + global gpp_compile_options + global gluefile wrap_flags + global ALWAYS_OBJCXXFLAGS; + global OBJCXX_UNDER_TEST; + + lappend options "libs=-lobjc" + + if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } { + lappend options "libs=${gluefile}" + lappend options "ldflags=${wrap_flags}" + } + + # If we have built libobjc along with the compiler (which usually + # _is not_ the case on Mac OS X systems), point the test harness + # at it (and associated headers). + + set objcpath "[get_multilibs]" + + set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc.a] + if { $libobjc_dir == ""} { + verbose "see if we have -fgnu-runtime in [target_info name]" + if [regexp ".*-fgnu-runtime.*" [target_info name]] { + set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.a] + } + } + if { $libobjc_dir != "" } { + set objc_include_dir "${srcdir}/../../libobjc" + lappend options "additional_flags=-I${objc_include_dir}" + set libobjc_dir [file dirname ${libobjc_dir}] + set objc_link_flags "-L${libobjc_dir}" + lappend options "additional_flags=${objc_link_flags}" + append ld_library_path ":${libobjc_dir}" + } + + lappend options "additional_flags=[libio_include_flags]" + lappend options "compiler=$OBJCXX_UNDER_TEST"; + + set options [concat $gpp_compile_options $options] + + set options [concat "$ALWAYS_OBJCXXFLAGS" $options]; + + if { [regexp "(^| )-frepo( |$)" $options] && \ + [regexp "\.o(|bj)$" $dest] } then { + regsub "\.o(|bj)$" $dest ".rpo" rponame + exec rm -f $rponame + } + + set options [dg-additional-files-options $options $source] + + set result [target_compile $source $dest $type $options] + + return $result +} + +# +# ${tool}_option_help +# + +proc ${tool}_option_help { } { + send_user " --additional_options,OPTIONS\t\tUse OPTIONS to compile the testcase files. OPTIONS should be comma-separated.\n" +} + +# +# ${tool}_option_proc +# + +proc ${tool}_option_proc { option } { + if [regexp "^--additional_options," $option] { + global gpp_compile_options + regsub "--additional_options," $option "" option + foreach x [split $option ","] { + lappend gpp_compile_options "additional_flags=$x" + } + return 1; + } else { + return 0 + } +} diff --git a/gcc/testsuite/lib/objc-torture.exp b/gcc/testsuite/lib/objc-torture.exp index ec05da91d0d..73cbc6a30a0 100644 --- a/gcc/testsuite/lib/objc-torture.exp +++ b/gcc/testsuite/lib/objc-torture.exp @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-dejagnu@gnu.org. - # This file was written by Rob Savoye. (rob@cygnus.com) load_lib file-format.exp diff --git a/gcc/testsuite/lib/scantree.exp b/gcc/testsuite/lib/scantree.exp index 76d1a59fb60..085faa92f57 100644 --- a/gcc/testsuite/lib/scantree.exp +++ b/gcc/testsuite/lib/scantree.exp @@ -19,6 +19,54 @@ # # This is largely borrowed from scanasm.exp. +# APPLE LOCAL begin lno +# Utility for diffing compiler result against an expected output file. +# Invoked via dg-final. Call pass if there are no differences between +# the output of the compiler and the expected output file, otherwise +# fail. The expected output file has the same name as the output +# file, and is stored in the same directory as the testcase. +# +# Argument 0 is the suffix for the tree dump file +# Argument 1 handles expected failures and the like +proc diff-tree-dumps { args } { + if { [llength $args] < 1 } { + error "diff-tree-dumps: too few arguments" + return + } + if { [llength $args] > 2 } { + error "diff-tree-dumps:: too many arguments" + return + } + if { [llength $args] >= 2 } { + switch [dg-process-target [lindex $args 1]] { + "S" { } + "N" { return } + "F" { setup_xfail "*-*-*" } + "P" { } + } + } + + # This assumes that we are two frames down from dg-test, and that + # it still stores the filename of the testcase in a local variable "name". + # A cleaner solution would require a new dejagnu release. + upvar 2 prog testcase + + # This must match the rule in gcc-dg.exp. + # APPLE LOCAL <rdar://problem/3837835> Selective inlining of functions that use Altivec + set new_file "[glob [file tail $testcase].\[ti\]??.[lindex $args 0]]" + set reference_file "[glob $testcase.[lindex $args 0]]" + + set test_result [diff $reference_file $new_file] + + if { $test_result == 1 } { + pass "$testcase diff-tree-dumps [lindex $args 0]" + } else { + fail "$testcase diff-tree-dumps [lindex $args 0]" + local_exec (diff $reference_file $new_file 0); + } +} +# APPLE LOCAL end lno + # Utility for scanning compiler result, invoked via dg-final. # Call pass if pattern is present, otherwise fail. # @@ -49,7 +97,8 @@ proc scan-tree-dump { args } { upvar 2 name testcase # This must match the rule in gcc-dg.exp. - set output_file "[glob [file tail $testcase].t??.[lindex $args 1]]" + # APPLE LOCAL <rdar://problem/3837835> Selective inlining of functions that use Altivec + set output_file "[glob [file tail $testcase].\[ti\]??.[lindex $args 1]]" set fd [open $output_file r] set text [read $fd] @@ -91,7 +140,8 @@ proc scan-tree-dump-times { args } { upvar 2 name testcase # This must match the rule in gcc-dg.exp. - set output_file "[glob [file tail $testcase].t??.[lindex $args 2]]" + # APPLE LOCAL <rdar://problem/3837835> Selective inlining of functions that use Altivec + set output_file "[glob [file tail $testcase].\[ti\]??.[lindex $args 2]]" set fd [open $output_file r] set text [read $fd] @@ -128,7 +178,8 @@ proc scan-tree-dump-not { args } { } upvar 2 name testcase - set output_file "[glob [file tail $testcase].t??.[lindex $args 1]]" + # APPLE LOCAL <rdar://problem/3837835> Selective inlining of functions that use Altivec + set output_file "[glob [file tail $testcase].\[ti\]??.[lindex $args 1]]" set fd [open $output_file r] set text [read $fd] @@ -179,7 +230,8 @@ proc scan-tree-dump-dem { args } { } upvar 2 name testcase - set output_file "[glob [file tail $testcase].t??.[lindex $args 1]]" + # APPLE LOCAL <rdar://problem/3837835> Selective inlining of functions that use Altivec + set output_file "[glob [file tail $testcase].\[ti\]??.[lindex $args 1]]" set fd [open "| $cxxfilt < $output_file" r] set text [read $fd] @@ -229,7 +281,8 @@ proc scan-tree-dump-dem-not { args } { } upvar 2 name testcase - set output_file "[glob [file tail $testcase].t??.[lindex $args 1]]" + # APPLE LOCAL <rdar://problem/3837835> Selective inlining of functions that use Altivec + set output_file "[glob [file tail $testcase].\[ti\]??.[lindex $args 1]]" set fd [open "| $cxxfilt < $output_file" r] set text [read $fd] diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp index e3ad1d540fa..1f2242fdc5d 100644 --- a/gcc/testsuite/lib/target-supports-dg.exp +++ b/gcc/testsuite/lib/target-supports-dg.exp @@ -32,7 +32,7 @@ proc dg-require-weak { args } { # test. proc dg-require-visibility { args } { - set visibility_available [ check_visibility_available ] + set visibility_available [ check_visibility_available [lindex $args 1 ] ] if { $visibility_available == -1 } { upvar name name unresolved "$name" diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index f2577c18106..f78b89b935f 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -87,6 +87,12 @@ proc check_weak_available { } { return 1 } + # HP-UX 10.X doesn't support it + + if { [regexp "hppa.*hpux10" $target_triplet] } { + return 0 + } + # ELF and ECOFF support it. a.out does with gas/gld but may also with # other linkers, so we should try it @@ -97,19 +103,22 @@ proc check_weak_available { } { ecoff { return 1 } a.out { return 1 } mach-o { return 1 } + som { return 1 } unknown { return -1 } default { return 0 } } } +# APPLE LOCAL begin mainline 4.0 2005-03-25 ############################### -# proc check_visibility_available { } +# proc check_visibility_available { what_kind } ############################### # The visibility attribute is only support in some object formats # This proc returns 1 if it is supported, 0 if not. +# The argument is the kind of visibility, default/protected/hidden/internal. -proc check_visibility_available { } { +proc check_visibility_available { what_kind } { global visibility_available_saved global tool global target_triplet @@ -119,19 +128,31 @@ proc check_visibility_available { } { return 0 } - if {![info exists visibility_available_saved] } { - set lines [get_compiler_messages visibility object { - void f() __attribute__((visibility("hidden"))); - void f() {} - }] - if [string match "" $lines] then { - set visibility_available_saved 1 - } else { - set visibility_available_saved 0 + if [string match "" $what_kind] { set what_kind "hidden" } + + if { [info exists visibility_available_saved] } { + verbose "Saved result is <$visibility_available_saved>" 1 + if { [ lsearch -exact $visibility_available_saved $what_kind ] != -1 } { + return 1 + } elseif { [ lsearch -exact $visibility_available_saved "!$what_kind" ] != -1 } { + return 0 } } - return $visibility_available_saved + + set lines [get_compiler_messages visibility object " + void f() __attribute__((visibility(\"$what_kind\"))); + void f() {} + "] + if [string match "" $lines] then { + set answer 1 + lappend visibility_available_saved $what_kind + } else { + set answer 0 + lappend visibility_available_saved "!$what_kind" + } + return $answer } +# APPLE LOCAL end mainline 4.0 2005-03-25 ############################### # proc check_alias_available { } @@ -609,6 +630,22 @@ proc check_effective_target_vect_int { } { return $et_vect_int_saved } +# APPLE LOCAL begin mainline 2005-04-05 3972515 +# Return 1 if the target supports hardware vector shift operation. + +proc check_effective_target_vect_shift { } { + if { [istarget powerpc*-*-*] } { + set answer 1 + } else { + set answer 0 + } + + verbose "check_effective_target_vect_shift: returning $answer" 2 + return $answer +} + +# APPLE LOCAL end mainline 2005-04-05 3972515 + # Return 1 if the target supports hardware vectors of long, 0 otherwise. # # This can change for different subtargets so do not cache the result. @@ -734,6 +771,26 @@ proc check_effective_target_vect_no_align { } { return $et_vect_no_align_saved } +# APPLE LOCAL begin 3972875 mainline 2005-04-18 +# Return 1 if the target supports vector int multiplication, 0 otherwise. + +proc check_effective_target_vect_int_mult { } { + global et_vect_int_mult_saved + + if [info exists et_vect_int_mult] { + verbose "check_effective_target_vect_int_mult: using cached result" 2 + } else { + set et_vect_int_mult_saved 0 + if { [istarget powerpc*-*-*] } { + set et_vect_int_mult_saved 1 + } + } + + verbose "check_effective_target_vect_int_mult: returning $et_vect_int_mult_saved" 2 + return $et_vect_int_mult_saved +} +# APPLE LOCAL end 3972875 mainline 2005-04-18 + # Return 1 if the target matches the effective target 'arg', 0 otherwise. # This can be used with any check_* proc that takes no argument and # returns only 1 or 0. It could be used with check_* procs that take diff --git a/gcc/testsuite/obj-c++.dg/basic.mm b/gcc/testsuite/obj-c++.dg/basic.mm new file mode 100644 index 00000000000..fc0b63ad2e3 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/basic.mm @@ -0,0 +1,22 @@ +// APPLE LOCAL file mainline +// A basic sanity check for Objective-C++. +// { dg-do run } + +#include <objc/Object.h> +#include <iostream> + +@interface Greeter : Object +- (void) greet: (const char *)msg; +@end + +@implementation Greeter +- (void) greet: (const char *)msg { std::cout << msg; } +@end + +int +main () +{ + std::cout << "Hello from C++\n"; + Greeter *obj = [Greeter new]; + [obj greet: "Hello from Objective-C\n"]; +} diff --git a/gcc/testsuite/obj-c++.dg/bitfield-1.mm b/gcc/testsuite/obj-c++.dg/bitfield-1.mm new file mode 100644 index 00000000000..a5066dc4561 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/bitfield-1.mm @@ -0,0 +1,114 @@ +/* APPLE LOCAL file mainline */ +/* Check if ObjC class layout follows the ABI (informally) + set in the past. ObjC structs must be laid out as if + all ivars, including those inherited from superclasses, + were defined at once (i.e., any padding introduced for + superclasses should be removed). */ +/* Contributed by Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-options "-Wpadded -Wabi" } */ +/* { dg-do run } */ + +#include <objc/objc.h> +#include <objc/Object.h> +#include <stdlib.h> + +#define CHECK_IF(expr) if(!(expr)) abort() + +enum Enum { zero, one, two, three, four }; + +@interface Base: Object { +@public + unsigned a: 2; + int b: 3; + enum Enum c: 4; + unsigned d: 5; +} /* { dg-warning "padding struct size to alignment boundary" } */ +@end + +struct Base_0 { /* { dg-warning "padding struct size to alignment boundary" } */ + Class isa; + unsigned a: 2; + int b: 3; + enum Enum c: 4; + unsigned d: 5; +}; + +@interface Derived: Base { +@public + signed e: 5; + unsigned f: 4; + enum Enum g: 3; +} +@end + +struct Derived_0 { + Class isa; + unsigned a: 2; + int b: 3; + enum Enum c: 4; + unsigned d: 5; + signed e: 5; + int f: 4; + enum Enum g: 3; +}; + +@interface Leaf: Derived { +@public + signed h: 2; +} +@end + +struct Leaf_0 { + Class isa; + unsigned a: 2; + int b: 3; + enum Enum c: 4; + unsigned d: 5; + signed e: 5; + unsigned f: 4; + enum Enum g: 3; + signed h: 2; +}; + +/* Note that the semicolon after @defs(...) is optional. */ + +typedef struct { @defs(Base) } Base_t; /* { dg-warning "padding struct size to alignment boundary" } */ +typedef struct { @defs(Derived); } Derived_t; +typedef struct { @defs(Leaf); } Leaf_t; + +int main(void) +{ + struct Leaf_0 l_0; + Leaf *l = (Leaf *)&l_0; + Leaf_t *l_t = (Leaf_t *)&l_0; + + CHECK_IF(sizeof(Base_t) == sizeof(Base)); + CHECK_IF(sizeof(Derived_t) == sizeof(Derived)); + CHECK_IF(sizeof(Leaf_t) == sizeof(Leaf)); + + CHECK_IF(sizeof(struct Base_0) == sizeof(Base)); + CHECK_IF(sizeof(struct Derived_0) == sizeof(Derived)); + CHECK_IF(sizeof(struct Leaf_0) == sizeof(Leaf)); + + l_0.isa = (Class)0; + l_0.a = 3; + l_0.b = 0; + l_0.c = three; + l_0.d = 31; + l_0.e = 0; + l_0.f = 15; + l_0.g = zero; + l_0.h = -2; + + CHECK_IF(!l_t->isa); + CHECK_IF(l->a == 3 && l_t->a == 3); + CHECK_IF(!l->b && !l_t->b); + CHECK_IF(l->c == three && l_t->c == three); + CHECK_IF(l->d == 31 && l_t->d == 31); + CHECK_IF(!l->e && !l_t->e); + CHECK_IF(l->f == 15 && l_t->f == 15); + CHECK_IF(l->g == zero && l_t->g == zero); + CHECK_IF(l->h == -2 && l_t->h == -2); + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/bitfield-2.mm b/gcc/testsuite/obj-c++.dg/bitfield-2.mm new file mode 100644 index 00000000000..38cb19b543b --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/bitfield-2.mm @@ -0,0 +1,79 @@ +/* APPLE LOCAL file mainline */ +/* Check if bitfield ivars are inherited correctly (i.e., without + being "promoted" to ints). */ +/* Contributed by Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-do run } */ + +#include <objc/Object.h> +#include <stdlib.h> + +#define CHECK_IF(expr) if(!(expr)) abort(); + +@interface Base: Object +{ + int full; + int full2: 32; + int _refs: 8; + int field2: 3; + unsigned f3: 8; + short cc; + unsigned g: 16; + int r2: 8; + int r3: 8; + int r4: 2; + int r5: 8; + char c; +} +- (void)setValues; +@end + +@interface Derived: Base +{ + char d; + int _field3: 6; +} +- (void)checkValues; +@end + +@implementation Base +-(void)setValues { + full = 1; + full2 = 2; + _refs = 3; + field2 = 1; + f3 = 6; + cc = 7; + g = 8; + r2 = 9; + r3 = 10; + r4 = 1; + r5 = 12; + c = 13; +} +@end + +@implementation Derived +-(void)checkValues { + CHECK_IF(full == 1); + CHECK_IF(full2 == 2); + CHECK_IF(_refs == 3); + CHECK_IF(field2 == 1); + CHECK_IF(f3 == 6); + CHECK_IF(cc == 7); + CHECK_IF(g == 8); + CHECK_IF(r2 == 9); + CHECK_IF(r3 == 10); + CHECK_IF(r4 == 1); + CHECK_IF(r5 == 12); + CHECK_IF(c == 13); +} +@end + +int main(void) { + Derived *obj = [[Derived alloc] init]; + + [obj setValues]; + [obj checkValues]; + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/bitfield-3.mm b/gcc/testsuite/obj-c++.dg/bitfield-3.mm new file mode 100644 index 00000000000..8e5a5d4fabf --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/bitfield-3.mm @@ -0,0 +1,58 @@ +/* APPLE LOCAL file mainline */ +/* Check if bitfield ivars are correctly @encode'd when + the NeXT runtime is used. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-options "-fnext-runtime -fsigned-char" } */ +/* { dg-do run { target *-*-darwin* } } */ + +typedef struct objc_object { struct objc_class *class_pointer; } *id; + +extern "C" { + extern void abort(void); + extern int strcmp(const char *, const char *); +} + +#define CHECK_IF(expr) if(!(expr)) abort(); + +@interface Base +{ + struct objc_class *isa; + int full; + int full2: 32; + int _refs: 8; + int field2: 3; + unsigned f3: 8; + short cc; + unsigned g: 16; + int r2: 8; + int r3: 8; + int r4: 2; + int r5: 8; + char c; +} +@end + +@interface Derived: Base +{ + char d; + int _field3: 6; +} +@end + +@implementation Base +@end + +@implementation Derived +@end + +int main(void) { + const char *s1r = "{Base=#ib32b8b3b8sb16b8b8b2b8c}"; + const char *s1 = @encode(Base); + const char *s2r = "{Derived=#ib32b8b3b8sb16b8b8b2b8ccb6}"; + const char *s2 = @encode(Derived); + + CHECK_IF(!strcmp(s1r, s1)); + CHECK_IF(!strcmp(s2r, s2)); + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/bitfield-4.mm b/gcc/testsuite/obj-c++.dg/bitfield-4.mm new file mode 100644 index 00000000000..0a5ecbfc947 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/bitfield-4.mm @@ -0,0 +1,52 @@ +/* APPLE LOCAL file mainline */ +/* Check if the @defs() construct preserves the correct + layout of bitfields. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-options "-lobjc -Wpadded" } */ +/* { dg-do run } */ + +#include <objc/Object.h> + +extern "C" { + extern void abort(void); + extern int strcmp(const char *str1, const char *str2); +} +#define CHECK_IF(expr) if(!(expr)) abort() + +enum Enum { one, two, three, four }; + +@interface Base: Object { + unsigned a: 2; + int b: 3; + enum Enum c: 4; + unsigned d: 5; +} /* { dg-warning "padding struct size to alignment boundary" } */ +@end + +@interface Derived: Base { + signed e: 5; + int f: 4; + enum Enum g: 3; +} +@end + +/* Note that the semicolon after @defs(...) is optional. */ + +typedef struct { @defs(Base) } Base_t; /* { dg-warning "padding struct size to alignment boundary" } */ +typedef struct { @defs(Derived); } Derived_t; + +int main(void) +{ + CHECK_IF(sizeof(Base_t) == sizeof(Base)); + CHECK_IF(sizeof(Derived_t) == sizeof(Derived)); + +#ifdef __NEXT_RUNTIME__ + CHECK_IF(!strcmp(@encode(Base), "{Base=#b2b3b4b5}")); + CHECK_IF(!strcmp(@encode(Derived), "{Derived=#b2b3b4b5b5b4b3}")); + + CHECK_IF(!strcmp(@encode(Base_t), "{?=#b2b3b4b5}")); + CHECK_IF(!strcmp(@encode(Derived_t), "{?=#b2b3b4b5b5b4b3}")); +#endif /* __NEXT_RUNTIME__ */ + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/bitfield-5.mm b/gcc/testsuite/obj-c++.dg/bitfield-5.mm new file mode 100644 index 00000000000..772f92128e0 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/bitfield-5.mm @@ -0,0 +1,29 @@ +/* APPLE LOCAL file mainline */ +/* Make sure that bitfield types are printed correctly, and that ivar redeclaration + (@interface vs. @implementation) checks take the bitfield width into account. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile } */ + +@interface Base { + int i; +} +@end + +@interface WithBitfields: Base { + void *isa; + unsigned a: 3; + signed b: 4; + int c: 5; +} +@end + +@implementation WithBitfields { + char *isa; /* { dg-error "conflicting instance variable type .char \\*isa." } */ + /* { dg-error "previous declaration of .void \\*isa." "" { target *-*-* } 13 } */ + unsigned a: 5; /* { dg-error "conflicting instance variable type .unsigned( int)? a: 5." } */ + /* { dg-error "previous declaration of .unsigned( int)? a: 3." "" { target *-*-* } 14 } */ + signed b: 4; /* This one is fine. */ + int c: 3; /* { dg-error "conflicting instance variable type .int c: 3." } */ + /* { dg-error "previous declaration of .int c: 5." "" { target *-*-* } 16 } */ +} +@end diff --git a/gcc/testsuite/obj-c++.dg/class-protocol-1.mm b/gcc/testsuite/obj-c++.dg/class-protocol-1.mm new file mode 100644 index 00000000000..c219c89cea3 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/class-protocol-1.mm @@ -0,0 +1,442 @@ +/* APPLE LOCAL file mainline */ +/* Check Class <protocol> types */ +/* Author: David Ayers <d.ayers@inode.at> */ +/* { dg-do compile } */ + +#include <objc/objc.h> +#include <objc/objc-api.h> + +@protocol MyProto1 ++(void)doItClass1; +-(void)doItInstance1; +@end + +@protocol MyProto2 ++(void)doItClass2; +-(void)doItInstance2; +@end + +@interface MyClass1 <MyProto1> +{ + Class isa; +} +@end +@implementation MyClass1 ++(void)doItClass1{} +-(void)doItInstance1{} +@end + +@interface MyClass2 : MyClass1 <MyProto2> +@end +@implementation MyClass2 ++(void)doItClass2{} +-(void)doItInstance2{} +@end + +@interface MyClass3 +{ + Class isa; +} +@end +@interface MyClass4 : MyClass3 <MyProto1> +@end + +/*----------------------------------------*/ + +Class cls = 0; +Class <MyProto1> clsP1 = 0; +Class <MyProto2> clsP2 = 0; + +void +testSimple(void) +{ + [cls doItClass1]; + [cls doItInstance1]; + [cls doItClass2]; + [cls doItInstance2]; + + [clsP1 doItClass1]; + [clsP1 doItInstance1]; /* { dg-warning "instead of" } */ + [clsP1 doItClass2]; /* { dg-warning "not found in protocol" } */ + [clsP1 doItInstance2]; /* { dg-warning "not found in protocol" } */ + + [clsP2 doItClass1]; /* { dg-warning "not found in protocol" } */ + [clsP2 doItInstance1]; /* { dg-warning "not found in protocol" } */ + [clsP2 doItClass2]; + [clsP2 doItInstance2]; /* { dg-warning "instead of" } */ + + [MyClass1 doItClass1]; + [MyClass1 doItInstance1]; + [MyClass1 doItClass2]; /* { dg-warning "may not respond to" } */ + [MyClass1 doItInstance2]; /* { dg-warning "may not respond to" } */ + + [MyClass2 doItClass1]; + [MyClass2 doItInstance1]; + [MyClass2 doItClass2]; + [MyClass2 doItInstance2]; /* { dg-warning "may not respond to" } */ + + [MyClass3 doItClass1]; /* { dg-warning "may not respond to" } */ + [MyClass3 doItInstance1]; /* { dg-warning "may not respond to" } */ + + [MyClass4 doItClass1]; + [MyClass4 doItInstance1]; /* { dg-warning "may not respond to" } */ +} + +/*----------------------------------------*/ +/* Protocols declared by categories */ + +@protocol MyProto3 ++(void)doItClass3; +-(void)doItInstance3; +@end +@protocol MyProto4 ++(void)doItClass4; +-(void)doItInstance4; +@end + +@interface MyClass1 (Category1) <MyProto3> +@end +@interface MyClass2 (Category2) <MyProto4> +@end + +void +testCategory(void) +{ + [cls doItClass3]; + [cls doItInstance3]; + [cls doItClass4]; + [cls doItInstance4]; + + [MyClass1 doItClass3]; + [MyClass1 doItInstance3]; + [MyClass1 doItClass4]; /* { dg-warning "may not respond" } */ + [MyClass1 doItInstance4]; /* { dg-warning "may not respond" } */ + + [MyClass2 doItClass3]; + [MyClass2 doItInstance3]; + [MyClass2 doItClass4]; + [MyClass2 doItInstance4]; /* { dg-warning "may not respond" } */ + +} + +/*----------------------------------------*/ +/* Inherited protocols declared by categories */ + +@protocol MyProto5 <MyProto1> ++(void)doItClass5; +-(void)doItInstance5; +@end + +@protocol MyProto6 <MyProto2> ++(void)doItClass6; +-(void)doItInstance6; +@end + +@interface MyClass1 (Category3) <MyProto5> +@end +@interface MyClass2 (Category4) <MyProto6> +@end + +Class <MyProto5> clsP5 = 0; +Class <MyProto6> clsP6 = 0; + +void +testCategoryInherited(void) +{ + [cls doItClass5]; + [cls doItInstance5]; + [cls doItClass6]; + [cls doItInstance6]; + + [clsP5 doItClass1]; + [clsP5 doItInstance1]; /* { dg-warning "instead of" } */ + [clsP5 doItClass2]; /* { dg-warning "not found in protocol" } */ + [clsP5 doItInstance2]; /* { dg-warning "not found in protocol" } */ + + [clsP6 doItClass1]; /* { dg-warning "not found in protocol" } */ + [clsP6 doItInstance1]; /* { dg-warning "not found in protocol" } */ + [clsP6 doItClass2]; + [clsP6 doItInstance2]; /* { dg-warning "instead of" } */ + + + [MyClass1 doItClass5]; + [MyClass1 doItInstance5]; + [MyClass1 doItClass6]; /* { dg-warning "may not respond" } */ + [MyClass1 doItInstance6]; /* { dg-warning "may not respond" } */ + + [MyClass2 doItClass5]; + [MyClass2 doItInstance5]; + [MyClass2 doItClass6]; + [MyClass2 doItInstance6]; /* { dg-warning "may not respond" } */ + +} + +/*----------------------------------------*/ +/* Forward declared root protocols */ + +@protocol FwProto; + +@interface MyClass1 (Forward) <FwProto> +@end + +Class <FwProto> clsP7 = 0; + +void +testForwardeDeclared1(void) +{ + [cls doItClass7]; /* { dg-warning "no .\\+doItClass7. method found" } */ + [cls doItInstance7]; /* { dg-warning "no .\\+doItInstance7. method found" } */ + + [clsP7 doItClass7]; /* { dg-warning "not found in protocol" } */ + /* { dg-warning "no .\\+doItClass7. method found" "" { target *-*-* } 190 } */ + [clsP7 doItInstance7]; /* { dg-warning "not found in protocol" } */ + /* { dg-warning "no .\\+doItInstance7. method found" "" { target *-*-* } 192 } */ + + [MyClass1 doItClass7]; /* { dg-warning "may not respond" } */ + [MyClass1 doItInstance7]; /* { dg-warning "may not respond" } */ + + [MyClass2 doItClass7]; /* { dg-warning "may not respond" } */ + [MyClass2 doItInstance7]; /* { dg-warning "may not respond" } */ + +} + +@protocol FwProto ++(void)doItClass7; +-(void)doItInstance7; +@end + +void +testForwardeDeclared2(void) +{ + [cls doItClass7]; + [cls doItInstance7]; + + [clsP7 doItClass7]; + [clsP7 doItInstance7]; /* { dg-warning "instead of" } */ + + [MyClass1 doItClass7]; + [MyClass1 doItInstance7]; + + [MyClass2 doItClass7]; + [MyClass2 doItInstance7]; +} + +/*----------------------------------------*/ +/* Inherited non root protocols */ + +@protocol MyProto8 ++(void)doItClass8; +-(void)doItInstance8; +@end + +@protocol MyProto9 <MyProto8> ++(void)doItClass9; +-(void)doItInstance9; +@end + +@interface MyClass1 (InheritedNonRoot) <MyProto9> +@end + +Class <MyProto8> clsP8 = 0; +Class <MyProto9> clsP9 = 0; + +void +testInheritedNonRoot(void) +{ + [cls doItClass8]; + [cls doItInstance8]; + [cls doItClass9]; + [cls doItInstance9]; + + [clsP8 doItClass8]; + [clsP8 doItInstance8]; /* { dg-warning "instead of" } */ + [clsP8 doItClass9]; /* { dg-warning "not found in protocol" } */ + [clsP8 doItInstance9]; /* { dg-warning "not found in protocol" } */ + + [clsP9 doItClass8]; + [clsP9 doItInstance8]; /* { dg-warning "instead of" } */ + [clsP9 doItClass9]; + [clsP9 doItInstance9]; /* { dg-warning "instead of" } */ + + [MyClass1 doItClass8]; + [MyClass1 doItInstance8]; + [MyClass1 doItClass9]; + [MyClass1 doItInstance9]; + + [MyClass2 doItClass8]; + [MyClass2 doItInstance8]; + [MyClass2 doItClass9]; + [MyClass2 doItInstance9]; + +} + +/*----------------------------------------*/ +/* Prototype mismatch */ + +@protocol MyOtherProto1 ++(id)doItClass1; +-(id)doItInstance1; +@end +@interface MyOtherClass1 <MyOtherProto1> +@end + +Class <MyOtherProto1> oclsP1; + +void +testPrototypeMismatch(void) +{ + id tmp1 = [oclsP1 doItClass1]; + id tmp2 = [oclsP1 doItInstance1]; /* { dg-warning "instead of" } */ + + [clsP1 doItClass1]; + [clsP1 doItInstance1]; /* { dg-warning "instead of" } */ +} + +id obj = nil; +id <MyProto1> objP1 = nil; +id <MyProto2> objP2 = nil; +id <MyProto5> objP5 = nil; +int num = 0; +void *ptr = 0; + +MyClass1 *mc1 = nil; + +void +testComptypes(void) +{ + { /* id <protocol>, id <protocol> */ + objP1 == objP2; /* { dg-warning "lacks a cast" } */ + objP2 == objP1; /* { dg-warning "lacks a cast" } */ + + objP1 == objP5; + objP5 == objP1; + } + { /* id <protocol>, SomeClass * */ + mc1 == objP1; + objP1 == mc1; + + mc1 == objP2; /* { dg-warning "lacks a cast" } */ + objP2 == mc1; /* { dg-warning "lacks a cast" } */ + } + { /* id <protocol>, id */ + obj == objP1; + objP1 == obj; + } + { /* id <protocol>, Class */ + cls == objP1; /* { dg-warning "lacks a cast" } */ + objP1 == cls; /* { dg-warning "lacks a cast" } */ + } + { /* id <protocol>, non-ObjC */ + num == objP1; /* { dg-warning "between pointer" } */ + objP1 == num; /* { dg-warning "between pointer" } */ + + ptr == objP1; + objP1 == ptr; + } + { /* Class <protocol>, Class <protocol> */ + clsP1 == clsP2; /* { dg-warning "lacks a cast" } */ + clsP2 == clsP1; /* { dg-warning "lacks a cast" } */ + + clsP1 == clsP5; + clsP5 == clsP1; + } + { /* Class <protocol>, SomeClass * */ + mc1 == clsP1; /* { dg-warning "lacks a cast" } */ + clsP1 == mc1; /* { dg-warning "lacks a cast" } */ + } + { /* Class <protocol>, id */ + obj == clsP1; + clsP1 == obj; + } + { /* Class <protocol>, Class */ + cls == clsP1; + clsP1 == cls; + } + { /* Class <protocol>, non-ObjC */ + num == clsP1; /* { dg-warning "between pointer" } */ + clsP1 == num; /* { dg-warning "between pointer" } */ + + ptr == clsP1; + clsP1 == ptr; + } + { /* Class <protocol>, id <protocol> */ + clsP1 == objP1; /* { dg-warning "lacks a cast" } */ + objP1 == clsP1; /* { dg-warning "lacks a cast" } */ + } + + { /* id <protocol>, id <protocol> */ + objP1 = objP2; /* { dg-warning "does not conform" } */ + objP2 = objP1; /* { dg-warning "does not conform" } */ + + objP1 = objP5; + objP5 = objP1; /* { dg-warning "does not conform" } */ + } + { /* id <protocol>, SomeClass * */ + mc1 = objP1; + objP1 = mc1; + + mc1 = objP2; /* { dg-warning "does not conform" } */ + objP2 = mc1; /* { dg-warning "does not implement" } */ + } + { /* id <protocol>, id */ + obj = objP1; + objP1 = obj; + } + { /* id <protocol>, Class */ + cls = objP1; /* { dg-warning "distinct Objective\\-C type" } */ + objP1 = cls; /* { dg-warning "distinct Objective\\-C type" } */ + } + { /* id <protocol>, non-ObjC */ + num = objP1; /* { dg-error "invalid conversion" } */ + objP1 = num; /* { dg-error "invalid conversion" } */ + + ptr = objP1; + objP1 = ptr; /* { dg-error "invalid conversion" } */ + } + { /* Class <protocol>, Class <protocol> */ + clsP1 = clsP2; /* { dg-warning "does not conform" } */ + clsP2 = clsP1; /* { dg-warning "does not conform" } */ + + clsP1 = clsP5; + clsP5 = clsP1; /* { dg-warning "does not conform" } */ + } + { /* Class <protocol>, SomeClass * */ + /* These combinations should always elicit a warning. */ + mc1 = clsP1; /* { dg-warning "distinct Objective\\-C type" } */ + clsP1 = mc1; /* { dg-warning "distinct Objective\\-C type" } */ + + mc1 = clsP2; /* { dg-warning "distinct Objective\\-C type" } */ + clsP2 = mc1; /* { dg-warning "distinct Objective\\-C type" } */ + } + { /* Class <protocol>, id */ + obj = clsP1; + clsP1 = obj; + } + { /* Class <protocol>, Class */ + cls = clsP1; + clsP1 = cls; + } + { /* Class <protocol>, non-ObjC */ + num = clsP1; /* { dg-error "invalid conversion" } */ + clsP1 = num; /* { dg-error "invalid conversion" } */ + + ptr = clsP1; + clsP1 = ptr; /* { dg-error "invalid conversion" } */ + } + { /* Class <protocol>, id <protocol> */ + clsP1 = objP1; /* { dg-warning "distinct Objective\\-C type" } */ + objP1 = clsP1; /* { dg-warning "distinct Objective\\-C type" } */ + } +} + +int main () +{ + testSimple(); + testCategory(); + testCategoryInherited(); + return(0); +} + +/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */ +/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */ +/* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/obj-c++.dg/comp-types-1.mm b/gcc/testsuite/obj-c++.dg/comp-types-1.mm new file mode 100644 index 00000000000..3de76215302 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/comp-types-1.mm @@ -0,0 +1,16 @@ +/* APPLE LOCAL file mainline */ +/* { dg-do compile } */ + +@interface A ++ new; +@end + +@interface B : A +@end + +int main(int argc, char **argv) { + B *b = [B new]; + A *a = b; + + return (b == a); +} diff --git a/gcc/testsuite/obj-c++.dg/comp-types-10.mm b/gcc/testsuite/obj-c++.dg/comp-types-10.mm new file mode 100644 index 00000000000..6ca9a45721b --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/comp-types-10.mm @@ -0,0 +1,20 @@ +/* APPLE LOCAL file mainline */ +/* Yet another mysterious gimplifier crasher. */ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +@class NSString; +@protocol NSObject +@end +@interface NSObject <NSObject> { +} +@end +void __setRetained(id *ivar, id value) { + *ivar = value; +} +static NSString *_logProcessPrefix = 0; +@implementation NSObject (ScopeAdditions) ++ (void)setObjectLogProcessPrefix:(NSString *)processPrefix { + __setRetained(&_logProcessPrefix, processPrefix); +} +@end diff --git a/gcc/testsuite/obj-c++.dg/comp-types-11.mm b/gcc/testsuite/obj-c++.dg/comp-types-11.mm new file mode 100644 index 00000000000..9e7d31d49e7 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/comp-types-11.mm @@ -0,0 +1,30 @@ +/* APPLE LOCAL file mainline */ +/* { dg-do compile } */ + + +#include <objc/Object.h> + +@protocol Foo +- (id)meth1; +- (id)meth2:(int)arg; +@end + +@interface Derived1: Object +@end + +@interface Derived2: Object ++ (Derived1 *)new; +@end + +id<Foo> func(void) { + Object *o = [Object new]; + return o; /* { dg-warning "class .Object. does not implement the .Foo. protocol" } */ +} + +@implementation Derived2 ++ (Derived1 *)new { + Derived2 *o = [super new]; + return o; /* { dg-warning "distinct Objective\\-C type in return" } */ +} +@end + diff --git a/gcc/testsuite/obj-c++.dg/comp-types-12.mm b/gcc/testsuite/obj-c++.dg/comp-types-12.mm new file mode 100644 index 00000000000..3ef2ad3c5cc --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/comp-types-12.mm @@ -0,0 +1,15 @@ +/* APPLE LOCAL file mainline */ +/* { dg-do compile } */ +#include <objc/Object.h> + +@interface Derived: Object +@end + +extern Object* foo(void); +static Derived *test(void) +{ + Derived *m = foo(); /* { dg-warning "initialization from distinct Objective\\-C type" } */ + + return m; +} + diff --git a/gcc/testsuite/obj-c++.dg/comp-types-2.mm b/gcc/testsuite/obj-c++.dg/comp-types-2.mm new file mode 100644 index 00000000000..520c785cffd --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/comp-types-2.mm @@ -0,0 +1,88 @@ +/* APPLE LOCAL file mainline */ +/* Test various ObjC types assignments and comparisons. */ +/* Author: Nicola Pero <nicola@brainstorm.co.uk>. */ +/* { dg-do compile } */ +#include <objc/objc.h> + +@protocol MyProtocol +- (void) foo; +@end + +@interface MyClass +@end + +@interface MyOtherClass <MyProtocol> +- (void) foo; +@end + +int main() +{ + id obj = nil; + id<MyProtocol> obj_p = nil; + MyClass *obj_c = nil; + MyOtherClass *obj_cp = nil; + Class obj_C = Nil; + + /* Assigning to an 'id' variable should never + generate a warning. */ + obj = obj_p; /* Ok */ + obj = obj_c; /* Ok */ + obj = obj_cp; /* Ok */ + obj = obj_C; /* Ok */ + + /* Assigning to a 'MyClass *' variable should always generate a + warning, unless done from an 'id'. */ + obj_c = obj; /* Ok */ + obj_c = obj_p; /* { dg-warning "distinct Objective\\-C type" } */ + obj_c = obj_cp; /* { dg-warning "distinct Objective\\-C type" } */ + obj_c = obj_C; /* { dg-warning "distinct Objective\\-C type" } */ + + /* Assigning to an 'id<MyProtocol>' variable should generate a + warning if done from a 'MyClass *' (which doesn't implement + MyProtocol), but not from an 'id' or from a 'MyOtherClass *' + (which implements MyProtocol). */ + obj_p = obj; /* Ok */ + obj_p = obj_c; /* { dg-warning "does not implement" } */ + obj_p = obj_cp; /* Ok */ + obj_p = obj_C; /* { dg-warning "distinct Objective\\-C type" } */ + + /* Assigning to a 'MyOtherClass *' variable should always generate + a warning, unless done from an 'id' or an 'id<MyProtocol>' (since + MyOtherClass implements MyProtocol). */ + obj_cp = obj; /* Ok */ + obj_cp = obj_c; /* { dg-warning "distinct Objective\\-C type" } */ + obj_cp = obj_p; /* Ok */ + obj_cp = obj_C; /* { dg-warning "distinct Objective\\-C type" } */ + + /* Any comparison involving an 'id' must be without warnings. */ + if (obj == obj_p) ; /* Ok */ /*Bogus warning here in 2.95.4*/ + if (obj_p == obj) ; /* Ok */ + if (obj == obj_c) ; /* Ok */ + if (obj_c == obj) ; /* Ok */ + if (obj == obj_cp) ; /* Ok */ + if (obj_cp == obj) ; /* Ok */ + if (obj == obj_C) ; /* Ok */ + if (obj_C == obj) ; /* Ok */ + + /* Any comparison between 'MyClass *' and anything which is not an 'id' + must generate a warning. */ + if (obj_c == obj_p) ; /* { dg-warning "lacks a cast" } */ + if (obj_p == obj_c) ; /* { dg-warning "lacks a cast" } */ + if (obj_c == obj_cp) ; /* { dg-warning "lacks a cast" } */ + if (obj_cp == obj_c) ; /* { dg-warning "lacks a cast" } */ + if (obj_c == obj_C) ; /* { dg-warning "lacks a cast" } */ + if (obj_C == obj_c) ; /* { dg-warning "lacks a cast" } */ + + /* Any comparison between 'MyOtherClass *' (which implements + MyProtocol) and an 'id' implementing MyProtocol are Ok. */ + if (obj_cp == obj_p) ; /* Ok */ + if (obj_p == obj_cp) ; /* Ok */ + + + if (obj_p == obj_C) ; /* { dg-warning "lacks a cast" } */ + if (obj_C == obj_p) ; /* { dg-warning "lacks a cast" } */ + if (obj_cp == obj_C) ; /* { dg-warning "lacks a cast" } */ + if (obj_C == obj_cp) ; /* { dg-warning "lacks a cast" } */ + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/comp-types-3.mm b/gcc/testsuite/obj-c++.dg/comp-types-3.mm new file mode 100644 index 00000000000..5158e369934 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/comp-types-3.mm @@ -0,0 +1,38 @@ +/* APPLE LOCAL file mainline */ +/* Test simple ObjC types casts. */ +/* Author: Nicola Pero <nicola@brainstorm.co.uk>. */ +/* { dg-do compile } */ +#include <objc/objc.h> + +@protocol MyProtocol +- (void) foo; +@end + +@interface MyClass +@end + +int main() +{ + id obj = nil; + id<MyProtocol> obj_p = nil; + MyClass *obj_c = nil; + Class obj_C = Nil; + + /* All these casts should generate no warnings. */ + + obj = (id)obj_p; + obj = (id)obj_c; + obj = (id)obj_C; + obj_c = (MyClass *)obj; + obj_c = (MyClass *)obj_p; + obj_c = (MyClass *)obj_C; + obj_p = (id<MyProtocol>)obj; + obj_p = (id<MyProtocol>)obj_c; + obj_p = (id<MyProtocol>)obj_C; + obj_C = (Class)obj; + obj_C = (Class)obj_p; + obj_C = (Class)obj_c; + + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/comp-types-4.mm b/gcc/testsuite/obj-c++.dg/comp-types-4.mm new file mode 100644 index 00000000000..87ad8324d76 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/comp-types-4.mm @@ -0,0 +1,64 @@ +/* APPLE LOCAL file mainline */ +/* Test assignments and comparisons between protocols (obscure case). */ +/* Author: Nicola Pero <nicola@brainstorm.co.uk>. */ +/* { dg-do compile } */ +#include <objc/objc.h> + +@protocol MyProtocolA +- (void) methodA; +@end + +@protocol MyProtocolB +- (void) methodB; +@end + +@protocol MyProtocolAB <MyProtocolA, MyProtocolB> +@end + +@protocol MyProtocolAC <MyProtocolA> +- (void) methodC; +@end + +int main() +{ + id<MyProtocolA> obj_a = nil; + id<MyProtocolB> obj_b = nil; + id<MyProtocolAB> obj_ab = nil; + id<MyProtocolAC> obj_ac = nil; + + obj_a = obj_b; /* { dg-warning "does not conform" } */ + obj_a = obj_ab; /* Ok */ + obj_a = obj_ac; /* Ok */ + + obj_b = obj_a; /* { dg-warning "does not conform" } */ + obj_b = obj_ab; /* Ok */ + obj_b = obj_ac; /* { dg-warning "does not conform" } */ + + obj_ab = obj_a; /* { dg-warning "does not conform" } */ + obj_ab = obj_b; /* { dg-warning "does not conform" } */ + obj_ab = obj_ac; /* { dg-warning "does not conform" } */ + + obj_ac = obj_a; /* { dg-warning "does not conform" } */ + obj_ac = obj_b; /* { dg-warning "does not conform" } */ + obj_ac = obj_ab; /* { dg-warning "does not conform" } */ + + if (obj_a == obj_b) ; /* { dg-warning "lacks a cast" } */ + if (obj_b == obj_a) ; /* { dg-warning "lacks a cast" } */ + + if (obj_a == obj_ab) ; /* Ok */ + if (obj_ab == obj_a) ; /* Ok */ /* Spurious 2.95.4 warning here */ + + if (obj_a == obj_ac) ; /* Ok */ + if (obj_ac == obj_a) ; /* Ok */ /* Spurious 2.95.4 warning here */ + + if (obj_b == obj_ab) ; /* Ok */ + if (obj_ab == obj_b) ; /* Ok */ /* Spurious 2.95.4 warning here */ + + if (obj_b == obj_ac) ; /* { dg-warning "lacks a cast" } */ + if (obj_ac == obj_b) ; /* { dg-warning "lacks a cast" } */ + + if (obj_ab == obj_ac) ; /* { dg-warning "lacks a cast" } */ + if (obj_ac == obj_ab) ; /* { dg-warning "lacks a cast" } */ + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/comp-types-5.mm b/gcc/testsuite/obj-c++.dg/comp-types-5.mm new file mode 100644 index 00000000000..8d1305b1b80 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/comp-types-5.mm @@ -0,0 +1,74 @@ +/* APPLE LOCAL file mainline */ +/* Test errors for assignments and comparisons between ObjC and C++ types. */ +/* Author: Nicola Pero <nicola@brainstorm.co.uk>. */ +/* { dg-do compile } */ +#include <objc/objc.h> + +/* The NeXT runtime headers do not define NULL. */ +#ifndef NULL +#define NULL ((void *)0) +#endif + +@protocol MyProtocol +- (void) method; +@end + +@interface MyClass +@end + +int main() +{ + id obj = nil; + id <MyProtocol> obj_p = nil; + MyClass *obj_c = nil; + Class obj_C = Nil; + + int i = 0; + int *j = (int *)NULL; + + /* These should all generate warnings. */ + + obj = i; /* { dg-error "invalid conversion" } */ + obj = j; /* { dg-error "cannot convert" } */ + + obj_p = i; /* { dg-error "invalid conversion" } */ + obj_p = j; /* { dg-error "cannot convert" } */ + + obj_c = i; /* { dg-error "invalid conversion" } */ + obj_c = j; /* { dg-error "cannot convert" } */ + + obj_C = i; /* { dg-error "invalid conversion" } */ + obj_C = j; /* { dg-error "cannot convert" } */ + + i = obj; /* { dg-error "invalid conversion" } */ + i = obj_p; /* { dg-error "invalid conversion" } */ + i = obj_c; /* { dg-error "invalid conversion" } */ + i = obj_C; /* { dg-error "invalid conversion" } */ + + j = obj; /* { dg-error "cannot convert" } */ + j = obj_p; /* { dg-error "cannot convert" } */ + j = obj_c; /* { dg-error "cannot convert" } */ + j = obj_C; /* { dg-error "cannot convert" } */ + + if (obj == i) ; /* { dg-error "comparison between pointer and integer" } */ + if (i == obj) ; /* { dg-error "comparison between pointer and integer" } */ + if (obj == j) ; /* { dg-error "lacks a cast" } */ + if (j == obj) ; /* { dg-error "lacks a cast" } */ + + if (obj_c == i) ; /*{ dg-error "comparison between pointer and integer" }*/ + if (i == obj_c) ; /*{ dg-error "comparison between pointer and integer" }*/ + if (obj_c == j) ; /* { dg-error "lacks a cast" } */ + if (j == obj_c) ; /* { dg-error "lacks a cast" } */ + + if (obj_p == i) ; /*{ dg-error "comparison between pointer and integer" }*/ + if (i == obj_p) ; /*{ dg-error "comparison between pointer and integer" }*/ + if (obj_p == j) ; /* { dg-error "lacks a cast" } */ + if (j == obj_p) ; /* { dg-error "lacks a cast" } */ + + if (obj_C == i) ; /*{ dg-error "comparison between pointer and integer" }*/ + if (i == obj_C) ; /*{ dg-error "comparison between pointer and integer" }*/ + if (obj_C == j) ; /* { dg-error "lacks a cast" } */ + if (j == obj_C) ; /* { dg-error "lacks a cast" } */ + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/comp-types-6.mm b/gcc/testsuite/obj-c++.dg/comp-types-6.mm new file mode 100644 index 00000000000..0bff587f4ab --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/comp-types-6.mm @@ -0,0 +1,33 @@ +/* APPLE LOCAL file mainline */ +/* Test assignments and comparisons involving `one-off' protocols. */ +/* Author: Nicola Pero <nicola@brainstorm.co.uk>. */ +/* { dg-do compile } */ +#include <objc/objc.h> + +@protocol MyProtocol +- (void) method; +@end + +@interface MyClass +@end + +int main() +{ + id obj = nil; + id <MyProtocol> obj_p = nil; + MyClass<MyProtocol> *obj_cp = nil; + + obj_cp = obj; /* Ok */ + obj = obj_cp; /* Ok */ + + obj_cp = obj_p; /* Ok */ + obj_p = obj_cp; /* Ok */ + + if (obj_cp == obj) ; /* Ok */ + if (obj == obj_cp) ; /* Ok */ + + if (obj_cp == obj_p) ; /* Ok */ + if (obj_p == obj_cp) ; /* Ok */ + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/comp-types-7.mm b/gcc/testsuite/obj-c++.dg/comp-types-7.mm new file mode 100644 index 00000000000..d4f79ec87d7 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/comp-types-7.mm @@ -0,0 +1,38 @@ +/* APPLE LOCAL file mainline */ +/* Test assignments and comparisons involving category protocols. */ +/* Author: Nicola Pero <nicola@brainstorm.co.uk>. */ +/* { dg-do compile } */ +#include <objc/objc.h> + +@protocol MyProtocol +- (void) method; +@end + +@interface MyClass +@end + +@interface MyClass (Addition) <MyProtocol> +- (void) method; +@end + +@interface MyOtherClass : MyClass +@end + +int main() +{ + id <MyProtocol> obj_p = nil; + MyClass *obj_cp = nil; + MyOtherClass *obj_cp2 = nil; + + obj_cp = obj_p; /* { dg-warning "distinct Objective\\-C type" } */ + obj_cp2 = obj_p; /* { dg-warning "distinct Objective\\-C type" } */ + obj_p = obj_cp; /* Ok */ + obj_p = obj_cp2; /* Ok */ + + if (obj_cp == obj_p) ; /* Ok */ + if (obj_cp2 == obj_p) ; /* Ok */ + if (obj_p == obj_cp) ; /* Ok */ + if (obj_p == obj_cp2) ; /* Ok */ + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/comp-types-8.mm b/gcc/testsuite/obj-c++.dg/comp-types-8.mm new file mode 100644 index 00000000000..1cde321e60a --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/comp-types-8.mm @@ -0,0 +1,33 @@ +/* APPLE LOCAL file mainline */ +/* { dg-do compile } */ +/* We used to ICE because we removed the cast to List_linked* + in -[ListIndex_linked next]. */ + +@interface List +{ +@public + int firstLink; +} +@end + +@interface ListIndex_linked +{ +@public + List *collection; + int link; +} +@end + +@interface List_linked: List +@end + +@implementation List +@end + +@implementation ListIndex_linked +- next +{ + link = ((List_linked*)collection)->firstLink; +} +@end + diff --git a/gcc/testsuite/obj-c++.dg/comp-types-9.mm b/gcc/testsuite/obj-c++.dg/comp-types-9.mm new file mode 100644 index 00000000000..9c9b3dfe70f --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/comp-types-9.mm @@ -0,0 +1,25 @@ +/* APPLE LOCAL file mainline */ +/* { dg-do compile } */ +/* Another gimplifier ICE... */ + +#include <objc/Object.h> + +@interface MyView: Object { + int _frame; +} +- (void)_finalize; +@end + +@interface MyViewTemplate: MyView { + void *_className; +} +- (id)createRealObject; +@end + +@implementation MyViewTemplate +- (id)createRealObject { + id realObj; + *(MyView *)realObj = *(MyView *)self; + return realObj; +} +@end diff --git a/gcc/testsuite/obj-c++.dg/const-cfstring-1.mm b/gcc/testsuite/obj-c++.dg/const-cfstring-1.mm new file mode 100644 index 00000000000..8645022b6ef --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/const-cfstring-1.mm @@ -0,0 +1,57 @@ +/* APPLE LOCAL file constant cfstrings */ +/* Test the -fconstant-cfstrings option for constructing + compile-time immutable CFStrings, and their interoperation + with both Cocoa and CoreFoundation. This will only work + on MacOS X 10.1.2 and later. */ +/* Developed by Ziemowit Laski <zlaski@apple.com>. */ + +/* { dg-do run { target *-*-darwin* } } */ +/* { dg-options "-fconstant-cfstrings -framework Cocoa" } */ + +#import <Foundation/NSString.h> +#import <CoreFoundation/CFString.h> +#include <stdlib.h> + +void printOut(NSString *str) { + NSLog(@"The value of str is: %@", str); +} + +CFStringRef s0a = CFSTR("Compile-time string literal"); +CFStringRef s0b = CFSTR("Compile-time string literal"); + +void checkNSRange(NSRange r) { + if (r.location != 6 || r.length != 5) { + printOut(@"Range check failed"); + abort(); + } +} + +void checkCFRange(CFRange r) { + if (r.location != 6 || r.length != 5) { + printOut(@"Range check failed"); + abort(); + } +} + +int main(void) { + const NSString *s1 = @"Compile-time string literal"; + CFStringRef s2 = CFSTR("Compile-time string literal"); + + checkNSRange([@"Hello World" rangeOfString:@"World"]); + checkNSRange([(id)CFSTR("Hello World") rangeOfString:@"World"]); + checkNSRange([@"Hello World" rangeOfString:(id)CFSTR("World")]); + checkNSRange([(id)CFSTR("Hello World") rangeOfString:(id)CFSTR("World")]); + + checkCFRange(CFStringFind((CFStringRef)@"Hello World", (CFStringRef)@"World", 0)); + checkCFRange(CFStringFind(CFSTR("Hello World"), (CFStringRef)@"World", 0)); + checkCFRange(CFStringFind((CFStringRef)@"Hello World", CFSTR("World"), 0)); + checkCFRange(CFStringFind(CFSTR("Hello World"), CFSTR("World"), 0)); + + /* Check for string uniquing. */ + if (s0a != s0b || s0a != s2 || s1 != (id)s2) { + NSLog(@"String uniquing failed"); + abort (); + } + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/const-cfstring-2.mm b/gcc/testsuite/obj-c++.dg/const-cfstring-2.mm new file mode 100644 index 00000000000..57b8d95a7d4 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/const-cfstring-2.mm @@ -0,0 +1,26 @@ +/* APPLE LOCAL file constant CFStrings */ +/* Test the -Wnonportable-cfstrings option, which should give + warnings if non-ASCII characters are embedded in constant + CFStrings. This will only work on MacOS X 10.2 and later. */ +/* Developed by Ziemowit Laski <zlaski@apple.com>. */ + +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-fconstant-cfstrings -Wnonportable-cfstrings" } */ + +#import <Foundation/NSString.h> +#import <CoreFoundation/CFString.h> + +#ifndef __CONSTANT_CFSTRINGS__ +#error The -fconstant-cfstrings option is not functioning properly +#endif + +void foo(void) { + NSString *s1 = @"Compile-time string literal"; + CFStringRef s2 = CFSTR("Compile-time string literal"); + NSString *s3 = @"Non-ASCII literal - \222"; /* { dg-warning "non-ASCII character in CFString literal" } */ + CFStringRef s4 = CFSTR("\222 - Non-ASCII literal"); /* { dg-warning "non-ASCII character in CFString literal" } */ + CFStringRef s5 = CFSTR("Non-ASCII (\222) literal"); /* { dg-warning "non-ASCII character in CFString literal" } */ + NSString *s6 = @"\0Embedded NUL"; /* { dg-warning "embedded NUL in CFString literal" } */ + CFStringRef s7 = CFSTR("Embedded \0NUL"); /* { dg-warning "embedded NUL in CFString literal" } */ + CFStringRef s8 = CFSTR("Embedded NUL\0"); /* { dg-warning "embedded NUL in CFString literal" } */ +} diff --git a/gcc/testsuite/obj-c++.dg/const-cfstring-3.mm b/gcc/testsuite/obj-c++.dg/const-cfstring-3.mm new file mode 100644 index 00000000000..82f361cec6f --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/const-cfstring-3.mm @@ -0,0 +1,26 @@ +/* APPLE LOCAL file constant strings */ +/* Test for assigning compile-time constant-string objects to static variables. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-options "-fconstant-cfstrings -framework Foundation" } */ +/* { dg-do run { target *-*-darwin* } } */ + +#include <stdlib.h> + +typedef const struct __CFString * CFStringRef; +static CFStringRef appKey = (CFStringRef) @"com.apple.soundpref"; + +static int CFPreferencesSynchronize (CFStringRef ref) { + return ref == appKey; +} + +static void PrefsSynchronize() +{ + if(!CFPreferencesSynchronize(appKey)) + abort(); +} + +int main(void) { + PrefsSynchronize(); + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/const-cfstring-4.mm b/gcc/testsuite/obj-c++.dg/const-cfstring-4.mm new file mode 100644 index 00000000000..d823adf730b --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/const-cfstring-4.mm @@ -0,0 +1,12 @@ +/* APPLE LOCAL file constant strings */ +/* Test if constant CFStrings get placed in the correct section. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-options "-fconstant-cfstrings" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +typedef const struct __CFString * CFStringRef; +CFStringRef appKey = (CFStringRef) @"com.apple.soundpref"; + +/* { dg-final { scan-assembler ".section __DATA, __cfstring" } } */ +/* { dg-final { scan-assembler ".long\t___CFConstantStringClassReference\n\t.long\t1992\n\t.long\t.*\n\t.long\t19\n\t.data" } } */ diff --git a/gcc/testsuite/obj-c++.dg/const-cfstring-5.mm b/gcc/testsuite/obj-c++.dg/const-cfstring-5.mm new file mode 100644 index 00000000000..1274d5d0889 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/const-cfstring-5.mm @@ -0,0 +1,25 @@ +/* APPLE LOCAL file 4154928 */ +/* Test if constant CFStrings may be passed back as ObjC strings. */ +/* Author: Ziemowit Laski */ + +/* { dg-options "-fconstant-cfstrings" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +#include <objc/Object.h> + +@interface Foo: Object { + char *cString; + unsigned int len; +} ++ (Foo *)description; +@end + +@interface Bar: Object ++ (Foo *) getString: (int) which; +@end + +@implementation Bar ++ (Foo *) getString: (int) which { + return which? [Foo description]: @"Hello"; +} +@end diff --git a/gcc/testsuite/obj-c++.dg/const-str-1.mm b/gcc/testsuite/obj-c++.dg/const-str-1.mm new file mode 100644 index 00000000000..47bf5ab6637 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/const-str-1.mm @@ -0,0 +1,26 @@ +/* APPLE LOCAL file mainline */ +/* Test errors for constant strings. */ +/* { dg-do compile } */ +/* { dg-options "-fgnu-runtime" } */ + +#ifdef __cplusplus +extern void baz(...); +#endif + +void foo() +{ + baz(@"hiya"); /* { dg-error "annot find interface declaration" } */ +} + +@interface NXConstantString +{ + void *isa; + char *str; + int len; +} +@end + +void bar() +{ + baz(@"howdah"); +} diff --git a/gcc/testsuite/obj-c++.dg/const-str-10.mm b/gcc/testsuite/obj-c++.dg/const-str-10.mm new file mode 100644 index 00000000000..6e6d86a8860 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/const-str-10.mm @@ -0,0 +1,29 @@ +/* APPLE LOCAL file 4149909 */ +/* Test if ObjC constant string layout is checked properly, regardless of how + constant string classes get derived. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-options "-fnext-runtime -fno-constant-cfstrings" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +#include <objc/Object.h> + +@interface NSString: Object +@end + +@interface NSSimpleCString : NSString { +@protected + char *bytes; + unsigned int numBytes; +} +@end + +@interface NSConstantString : NSSimpleCString +@end + +extern struct objc_class _NSConstantStringClassReference; + +const NSConstantString *appKey = @"MyApp"; + +/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ +/* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" } } */ diff --git a/gcc/testsuite/obj-c++.dg/const-str-11.mm b/gcc/testsuite/obj-c++.dg/const-str-11.mm new file mode 100644 index 00000000000..de3107cb33d --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/const-str-11.mm @@ -0,0 +1,28 @@ +/* APPLE LOCAL file 4149909 */ +/* Test if ObjC constant string layout is checked properly, regardless of how + constant string classes get derived. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-options "-fnext-runtime -fno-constant-cfstrings -fconstant-string-class=XStr" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +#include <objc/Object.h> + +@interface XString: Object { +@protected + char *bytes; +} +@end + +@interface XStr : XString { +@public + unsigned int len; +} +@end + +extern struct objc_class _XStrClassReference; + +const XStr *appKey = @"MyApp"; + +/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ +/* { dg-final { scan-assembler ".long\t__XStrClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" } } */ diff --git a/gcc/testsuite/obj-c++.dg/const-str-12.mm b/gcc/testsuite/obj-c++.dg/const-str-12.mm new file mode 100644 index 00000000000..134c99b3c37 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/const-str-12.mm @@ -0,0 +1,27 @@ +/* APPLE LOCAL file 4154928 */ +/* Test if ObjC types play nice in conditional expressions. */ +/* Author: Ziemowit Laski */ + +/* { dg-options "-fno-constant-cfstrings -fconstant-string-class=Foo" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +#include <objc/Object.h> + +@interface Foo: Object { + char *cString; + unsigned int len; +} ++ (id)description; +@end + +@interface Bar: Object ++ (Foo *) getString: (int) which; +@end + +struct objc_class _FooClassReference; + +@implementation Bar ++ (Foo *) getString: (int) which { + return which? [Foo description]: @"Hello"; +} +@end diff --git a/gcc/testsuite/obj-c++.dg/const-str-2.mm b/gcc/testsuite/obj-c++.dg/const-str-2.mm new file mode 100644 index 00000000000..cb8d09c8691 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/const-str-2.mm @@ -0,0 +1,8 @@ +/* APPLE LOCAL file mainline */ +/* Test the -fconstant-string-class flag error. */ +/* { dg-do compile } */ +/* { dg-options "-fconstant-string-class=" } */ + +{ dg-error "no class name specified|missing argument" "" { target *-*-* } 0 } + +void foo () {} diff --git a/gcc/testsuite/obj-c++.dg/const-str-3.mm b/gcc/testsuite/obj-c++.dg/const-str-3.mm new file mode 100644 index 00000000000..e94eab49fe8 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/const-str-3.mm @@ -0,0 +1,49 @@ +/* APPLE LOCAL file mainline */ +/* Test the -fconstant-string-class=Foo option under the NeXT + runtime. */ +/* Developed by Markus Hitter <mah@jump-ing.de>. */ + +/* { dg-options "-fnext-runtime -fconstant-string-class=Foo -lobjc" } */ +/* { dg-do run { target *-*-darwin* } } */ + +#include <stdio.h> +#include <stdlib.h> +#include <memory.h> +#include <objc/objc.h> +#include <objc/Object.h> + +@interface Foo: Object { + char *cString; + unsigned int len; +} +- (char *)customString; +@end + +struct objc_class _FooClassReference; + +@implementation Foo : Object +- (char *)customString { + return cString; +} +@end + +int main () { + Foo *string = @"bla"; + Foo *string2 = @"bla"; + + if(string != string2) + abort(); + printf("Strings are being uniqued properly\n"); + + /* This memcpy has to be done before the first message is sent to a + constant string object. Can't be moved to +initialize since _that_ + is already a message. */ + + memcpy(&_FooClassReference, objc_getClass("Foo"), sizeof(_FooClassReference)); + if (strcmp ([string customString], "bla")) { + abort (); + } + + printf([@"This is a working constant string object\n" customString]); + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/const-str-4.mm b/gcc/testsuite/obj-c++.dg/const-str-4.mm new file mode 100644 index 00000000000..6eab2a63e0a --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/const-str-4.mm @@ -0,0 +1,32 @@ +/* APPLE LOCAL file mainline */ +/* Ensure that the preprocessor handles ObjC string constants gracefully. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ +/* { dg-options "-fnext-runtime -fconstant-string-class=MyString -lobjc" } */ +/* { dg-do run { target *-*-darwin* } } */ + +extern "C" void abort(void); + +@interface MyString +{ + void *isa; + char *str; + int len; +} +@end + +#define kMyStringMacro1 "My String" +#define kMyStringMacro2 @"My String" + +void *_MyStringClassReference; + +@implementation MyString +@end + +int main(void) { + MyString* aString1 = @kMyStringMacro1; + MyString* aString2 = kMyStringMacro2; + if(aString1 != aString2) { + abort(); + } + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/const-str-5.mm b/gcc/testsuite/obj-c++.dg/const-str-5.mm new file mode 100644 index 00000000000..915f05c7c59 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/const-str-5.mm @@ -0,0 +1,28 @@ +/* APPLE LOCAL file mainline */ +/* Positive test case for constant string layout. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com>. */ + +/* { dg-options "-fconstant-string-class=MyConstantString" } */ +/* { dg-do compile } */ + +@interface MyBase { + const char *p; +} +@end + +@interface MyConstantString: MyBase { + union { + void *u; + unsigned char *c; + } _contents; + unsigned int _count; +} +@end + +/* The NeXT runtime initializes the 'isa' pointer of string constants at + compile time. */ +#ifdef __NEXT_RUNTIME__ +extern void *_MyConstantStringClassReference; +#endif + +MyConstantString *str = @"Hello"; diff --git a/gcc/testsuite/obj-c++.dg/const-str-6.mm b/gcc/testsuite/obj-c++.dg/const-str-6.mm new file mode 100644 index 00000000000..9caeada7322 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/const-str-6.mm @@ -0,0 +1,28 @@ +/* APPLE LOCAL file mainline */ +/* Negative test case for constant string layout. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com>. */ + +/* { dg-options "-fconstant-string-class=MyConstantString" } */ +/* { dg-do compile } */ + +@interface MyBase { + char p; +} +@end + +@interface MyConstantString: MyBase { + union { + void *u; + unsigned char *c; + } _contents; + char _count; +} +@end + +/* The NeXT runtime initializes the 'isa' pointer of string constants at + compile time. */ +#ifdef __NEXT_RUNTIME__ +extern void *_MyConstantStringClassReference; +#endif + +MyConstantString *str = @"Hello"; /* { dg-error "interface .MyConstantString. does not have valid constant string layout" } */ diff --git a/gcc/testsuite/obj-c++.dg/const-str-7.mm b/gcc/testsuite/obj-c++.dg/const-str-7.mm new file mode 100644 index 00000000000..7eec5f1e454 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/const-str-7.mm @@ -0,0 +1,47 @@ +/* APPLE LOCAL file mainline */ +/* Test to make sure that the const objc strings are the same across + scopes. */ +/* Developed by Andrew Pinski <pinskia@physics.uc.edu> */ + + +/* { dg-options "-fnext-runtime -fconstant-string-class=Foo -lobjc" } */ +/* { dg-do run { target *-*-darwin* } } */ + + +#include <stdio.h> +#include <stdlib.h> +#include <memory.h> +#include <objc/objc.h> +#include <objc/Object.h> + + +@interface Foo: Object { + char *cString; + unsigned int len; +} +- (char *)customString; +@end + +struct objc_class _FooClassReference; + + +@implementation Foo : Object +- (char *)customString { + return cString; +} +@end + + +int main () { + Foo *string = @"bla"; + { + Foo *string2 = @"bla"; + + + if(string != string2) + abort(); + printf("Strings are being uniqued properly\n"); + } + return 0; +} + diff --git a/gcc/testsuite/obj-c++.dg/const-str-8.mm b/gcc/testsuite/obj-c++.dg/const-str-8.mm new file mode 100644 index 00000000000..108e7c3ad0b --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/const-str-8.mm @@ -0,0 +1,40 @@ +/* APPLE LOCAL file mainline */ +/* Test for assigning compile-time constant-string objects to static variables. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-options "-fnext-runtime -fconstant-string-class=Foo -lobjc" } */ +/* { dg-do run { target *-*-darwin* } } */ + + +#include <stdlib.h> +#include <objc/Object.h> + +@interface Foo: Object { + char *cString; + unsigned int len; +} +@end + +struct objc_class _FooClassReference; + +@implementation Foo : Object +- (char *)customString { + return cString; +} +@end + +static const Foo *appKey = @"MyApp"; +static int CFPreferencesSynchronize (const Foo *ref) { + return ref == appKey; +} + +static void PrefsSynchronize(void) +{ + if(!CFPreferencesSynchronize(appKey)) + abort(); +} + +int main () { + PrefsSynchronize(); + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/const-str-9.mm b/gcc/testsuite/obj-c++.dg/const-str-9.mm new file mode 100644 index 00000000000..e59bb742e7f --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/const-str-9.mm @@ -0,0 +1,21 @@ +/* APPLE LOCAL file mainline */ +/* Test if ObjC constant strings get placed in the correct section. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-options "-fnext-runtime" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +#include <objc/Object.h> + +@interface NSConstantString: Object { + char *cString; + unsigned int len; +} +@end + +extern struct objc_class _NSConstantStringClassReference; + +const NSConstantString *appKey = @"MyApp"; + +/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ +/* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" } } */ diff --git a/gcc/testsuite/obj-c++.dg/cxx-class-1.mm b/gcc/testsuite/obj-c++.dg/cxx-class-1.mm new file mode 100644 index 00000000000..7c758840c7a --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/cxx-class-1.mm @@ -0,0 +1,20 @@ +/* APPLE LOCAL file mainline */ +/* Test that Objective-C++ is able to chew through a simple C++ class hierarchy. + This was broken in earlier ObjC++ incarnations. */ + +struct foo +{ + foo(void *a) {}; +}; + +struct bar : foo +{ + bar() : foo((char*)0) {}; +}; + +class apple : foo +{ +public: + apple() : foo(0) { }; +}; + diff --git a/gcc/testsuite/obj-c++.dg/cxx-ivars-1.mm b/gcc/testsuite/obj-c++.dg/cxx-ivars-1.mm new file mode 100644 index 00000000000..26b8bde1d1f --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/cxx-ivars-1.mm @@ -0,0 +1,42 @@ +// APPLE LOCAL file mainline +// Check if ivars may be accessed via the C++ dot notation. +// { dg-do run } +// { dg-options "-fno-objc-call-cxx-cdtors" } + +#include <objc/Object.h> +#include <stdlib.h> +#define CHECK_IF(expr) if(!(expr)) abort() + +struct cxx_struct { + int a, b; + void set_values (int _a, int _b = 3) { + a = _a; b = _b; + } + ~cxx_struct (void) { + a = b = 99; + } +}; + +@interface Manip : Object { + int c; + cxx_struct s; // { dg-warning "user-defined destructor" } + // { dg-warning "constructors and destructors will not be invoked" "" { target *-*-* } 22 } +} +- (void) manipulate_ivars; +@end + +@implementation Manip +- (void) manipulate_ivars { + s.set_values (7); + CHECK_IF (s.a == 7 && s.b == 3); + s.~cxx_struct(); + CHECK_IF (s.a == 99 && s.b == 99); +} +@end + +int main (void) +{ + Manip *obj = [Manip new]; + [obj manipulate_ivars]; + [obj free]; +} diff --git a/gcc/testsuite/obj-c++.dg/cxx-ivars-2.mm b/gcc/testsuite/obj-c++.dg/cxx-ivars-2.mm new file mode 100644 index 00000000000..9cfe5ce4a1d --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/cxx-ivars-2.mm @@ -0,0 +1,77 @@ +// APPLE LOCAL file mainline +// Check if the '- .cxx_construct' and '-.cxx_destruct' methods get called +// and if they perform their desired function. +// { dg-do run } +// { dg-options "-fobjc-call-cxx-cdtors" } + +#include <objc/Object.h> +#include <stdlib.h> +#define CHECK_IF(expr) if(!(expr)) abort() + +static int ctor1_called, ctor2_called, dtor1_called; + +struct bar { + int a, b; + bar(void) { + a = 5; b = 6; + ctor1_called++; + } + ~bar(void) { + a = b = 99; + dtor1_called++; + } +}; + +struct boo: bar { + int c; + boo(int _c = 9): c(_c) { + ctor2_called++; + } +}; + +@interface Baz: Object { +@public + bar aa; +} +@end + +@implementation Baz +@end + +@interface Foo: Baz { +@public + int a; + boo bb; + bar b; + float c; + bar d; +} +@end + +@implementation Foo +@end + +int main (void) +{ + CHECK_IF(!ctor1_called && !ctor2_called && !dtor1_called); /* are we sane? */ + + Baz *baz = [Baz new]; + CHECK_IF(ctor1_called && !ctor2_called && !dtor1_called); + CHECK_IF(baz->aa.a == 5 && baz->aa.b == 6); + ctor1_called = 0; /* reset */ + + [baz free]; + CHECK_IF(!ctor1_called && !ctor2_called && dtor1_called); + dtor1_called = 0; /* reset */ + + Foo *foo = [Foo new]; + CHECK_IF(ctor1_called && ctor2_called && !dtor1_called); + CHECK_IF(foo->bb.a == 5 && foo->bb.b == 6 && foo->bb.c == 9); + CHECK_IF(foo->b.a == 5 && foo->b.b == 6); + CHECK_IF(foo->d.a == 5 && foo->d.b == 6); + ctor1_called = ctor2_called = 0; /* reset */ + + [foo free]; + CHECK_IF(!ctor1_called && !ctor2_called && dtor1_called); + +} diff --git a/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm b/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm new file mode 100644 index 00000000000..4d4b3bf9fee --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm @@ -0,0 +1,46 @@ +// APPLE LOCAL file mainline +// Check if ObjC classes with non-POD C++ ivars are specially marked in the metadata. +// { dg-do run { target *-*-darwin* } } +// { dg-options "-fobjc-call-cxx-cdtors -fnext-runtime" } + +#include <objc/objc-runtime.h> +#include <stdlib.h> +#define CHECK_IF(expr) if(!(expr)) abort() + +#ifndef CLS_HAS_CXX_STRUCTORS +#define CLS_HAS_CXX_STRUCTORS 0x2000L +#endif + +struct cxx_struct { + int a, b; + cxx_struct (void) { a = b = 55; } +}; + +@interface Foo { + int c; + cxx_struct s; +} +@end + +@interface Bar: Foo { + float f; +} +@end + +@implementation Foo +@end + +@implementation Bar +@end + +int main (void) +{ + Class cls; + + cls = objc_getClass("Foo"); + CHECK_IF(cls->info & CLS_HAS_CXX_STRUCTORS); + cls = objc_getClass("Bar"); + CHECK_IF(!(cls->info & CLS_HAS_CXX_STRUCTORS)); + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/cxx-scope-1.mm b/gcc/testsuite/obj-c++.dg/cxx-scope-1.mm new file mode 100644 index 00000000000..33bbc07a670 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/cxx-scope-1.mm @@ -0,0 +1,53 @@ +/* APPLE LOCAL file mainline */ +/* Handle C++ scoping ('::') operators in ObjC message receivers gracefully. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do run } */ + +#include <objc/Object.h> +#include <stdlib.h> + +@class Derived; + +Derived *inst[3]; + +struct CxxClass { + static Derived *get_instance(int); +}; + +Derived *CxxClass::get_instance(int offs) { + return inst[offs]; +} + +@interface Derived: Object { + int value; +} +-(id)initWithValue:(int)val; +-(int)derived_meth; +@end + +@implementation Derived +-(id)initWithValue:(int)val { + [super init]; + value = val; + return self; +} +- (int)derived_meth { + return value; +} +@end + +int main(void) { + int r; + inst[1] = [[::Derived alloc] initWithValue:7]; + inst[2] = [[Derived alloc] initWithValue:77]; + + r = [CxxClass::get_instance(2) derived_meth]; + if (r != 77) + abort(); + + r = [CxxClass::get_instance(1) derived_meth]; + if (r != 7) + abort(); + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/cxx-scope-2.mm b/gcc/testsuite/obj-c++.dg/cxx-scope-2.mm new file mode 100644 index 00000000000..435356ae478 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/cxx-scope-2.mm @@ -0,0 +1,19 @@ +/* APPLE LOCAL file mainline */ +/* Make sure Objective-C++ can distinguish ObjC classes from C++ classes. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile } */ + +#include <objc/Object.h> +#include <iostream> +#include <string> + +@interface iostream: Object +@end + +int main(void) { + id i = [std::iostream new]; /* { dg-warning "not an Objective\\-C class name or alias" } */ + i = [iostream new]; + i = [std::basic_string<char> new]; /* { dg-warning "not an Objective\\-C class name or alias" } */ + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/defs.mm b/gcc/testsuite/obj-c++.dg/defs.mm new file mode 100644 index 00000000000..b30c328e43b --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/defs.mm @@ -0,0 +1,44 @@ +/* APPLE LOCAL file mainline */ +/* Check @defs() in Objective-C++ */ +/* Contributed by Devang Patel <dpatel@apple.com> */ +/* { dg-options "-lobjc" } */ +/* { dg-do run } */ + + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/Object.h> + +extern void abort(void); + +@interface A : Object +{ + @public + int a; +} +@end + +struct A_defs +{ + @defs(A); +}; + +@implementation A +- init +{ + a = 42; + return self; +} +@end + + +int main() +{ + A *a = [A init]; + struct A_defs *a_defs = (struct A_defs *)a; + + if (a->a != a_defs->a) + abort (); + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/dg.exp b/gcc/testsuite/obj-c++.dg/dg.exp new file mode 100644 index 00000000000..d6498e0fe07 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/dg.exp @@ -0,0 +1,38 @@ +# APPLE LOCAL file mainline +# GCC Objective-C++ testsuite that uses the `dg.exp' driver. +# Copyright (C) 2004 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Load support procs. +load_lib obj-c++-dg.exp + +# If a testcase doesn't have special options, use these. +global DEFAULT_OBJCXXFLAGS +if ![info exists DEFAULT_OBJCXXFLAGS] then { + set DEFAULT_OBJCXXFLAGS " -ansi -pedantic-errors -Wno-long-long" +} + +# Initialize `dg'. +dg-init + +# Gather a list of all tests. +set tests [lsort [find $srcdir/$subdir *.mm]] + +# Main loop. +dg-runtest $tests "" $DEFAULT_OBJCXXFLAGS + +# All done. +dg-finish diff --git a/gcc/testsuite/obj-c++.dg/empty-private-1.mm b/gcc/testsuite/obj-c++.dg/empty-private-1.mm new file mode 100644 index 00000000000..4c1346f547f --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/empty-private-1.mm @@ -0,0 +1,9 @@ +/* APPLE LOCAL file mainline */ +/* Test for no entry after @private token. */ +/* { do-do compile } */ + +@interface foo +{ +@private +} +@end diff --git a/gcc/testsuite/obj-c++.dg/encode-1.mm b/gcc/testsuite/obj-c++.dg/encode-1.mm new file mode 100644 index 00000000000..de951375f30 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/encode-1.mm @@ -0,0 +1,23 @@ +/* APPLE LOCAL file mainline */ +/* Test for graceful encoding of const-qualified fields and parameters. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile } */ + +struct Cxx { + const struct Cxx *next; +}; + +@interface ObjC { + const struct Cxx *obj; +} +- (ObjC *)initWithCxx: (struct Cxx *const)c and: (const struct Cxx *)d; +@end + +@implementation ObjC +- (ObjC *)initWithCxx: (struct Cxx *const)c and: (const struct Cxx *)d { + obj = d; + return self; +} +@end + +/* { dg-final { scan-assembler "@\[0-9\]+@0:\[0-9\]+r\\^{Cxx=\\^r{Cxx}}\[0-9\]+\\^r{Cxx}" } } */ diff --git a/gcc/testsuite/obj-c++.dg/encode-2.mm b/gcc/testsuite/obj-c++.dg/encode-2.mm new file mode 100644 index 00000000000..d8f893b2cdd --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/encode-2.mm @@ -0,0 +1,16 @@ +/* APPLE LOCAL file mainline */ +/* { dg-do compile } */ + +template <class T> +struct Vec { + T x, y; + int z; +}; + +Vec<double> dd; +const char *enc = @encode(Vec<float>); +const char *enc2 = @encode(Vec<double>); + +/* { dg-final { scan-assembler "{Vec<float>=ffi}" } } */ +/* { dg-final { scan-assembler "{Vec<double>=ddi}" } } */ + diff --git a/gcc/testsuite/obj-c++.dg/encode-3.mm b/gcc/testsuite/obj-c++.dg/encode-3.mm new file mode 100644 index 00000000000..5c9cff1184c --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/encode-3.mm @@ -0,0 +1,31 @@ +/* APPLE LOCAL file mainline */ +/* { dg-do run } */ + +#include <stdlib.h> +#include <string.h> + +template <class T> +struct Vec { + T x, y; + long z; + long long zz; +}; + +Vec<double> dd; +const char *enc = @encode(Vec<float>); +const char *enc2 = @encode(Vec<double>); + +int main(void) { + char *encode = @encode(long); + + if (strcmp (encode, "l")) + abort(); + + if (strcmp (enc, "{Vec<float>=fflq}")) + abort(); + + if (strcmp (enc2, "{Vec<double>=ddlq}")) + abort(); + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/encode-4.mm b/gcc/testsuite/obj-c++.dg/encode-4.mm new file mode 100644 index 00000000000..0d38dbb04fd --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/encode-4.mm @@ -0,0 +1,105 @@ +/* APPLE LOCAL file mainline */ +/* Test Objective-C method encodings. */ + +/* The _encoded_ parameter offsets for Objective-C methods are + computed inductively as follows: + - The first paramter (self) has offset 0; + - The k-th parameter (k > 1) has offset equal to the + sum of: + - the offset of the k-1-st paramter + - the (void *)-promoted size of the k-1-st parameter. + + Note that the encoded offsets need not correspond + to the actual placement of parameters (relative to 'self') + on the stack! Your target's ABI may have very different + opinions on the matter. */ + +/* Contributed by Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-do run } */ + +#include <objc/objc.h> +#include <objc/Object.h> + +#ifdef __NEXT_RUNTIME__ +#define METHOD Method +#define OBJC_GETCLASS objc_getClass +#define CLASS_GETINSTANCEMETHOD class_getInstanceMethod +#else +#include <objc/objc-api.h> +#define METHOD Method_t +#define OBJC_GETCLASS objc_get_class +#define CLASS_GETINSTANCEMETHOD class_get_instance_method +#endif + +extern "C" { + extern int sscanf(const char *str, const char *format, ...); + extern void abort(void); +} +#define CHECK_IF(expr) if(!(expr)) abort() + +@interface Foo: Object +typedef struct { float x, y; } XXPoint; +typedef struct { float width, height; } XXSize; +typedef struct _XXRect { XXPoint origin; XXSize size; } XXRect; +-(id)setRect:(XXRect)r withInt:(int)i; +-(void) char:(signed char)c float:(float)f double:(double)d long:(long)l; +@end + +XXRect my_rect; +unsigned offs1, offs2, offs3, offs4, offs5, offs6, offs7; + +@implementation Foo +-(id)setRect:(XXRect)r withInt:(int)i { + unsigned offs = sizeof(self); + CHECK_IF(offs == offs3); + offs += sizeof(_cmd); + CHECK_IF(offs == offs4); + offs += sizeof(r); + CHECK_IF(offs == offs5); + offs += sizeof(i); + CHECK_IF(offs == offs1); + return nil; +} +-(void) char:(signed char)c float:(float)f double:(double)d long:(long)l { + unsigned offs = sizeof(self); + CHECK_IF(offs == offs3); + offs += sizeof(_cmd); + CHECK_IF(offs == offs4); + offs += sizeof((int)c); + CHECK_IF(offs == offs5); + offs += sizeof(f); + CHECK_IF(offs == offs6); + offs += sizeof(d); + CHECK_IF(offs == offs7); + offs += sizeof(l); + CHECK_IF(offs == offs1); +} +@end + + +int main(void) { + Foo *foo = [[Foo alloc] init]; + Class fooClass = OBJC_GETCLASS("Foo"); + METHOD meth; + const char *string; + + meth = CLASS_GETINSTANCEMETHOD(fooClass, @selector(setRect:withInt:)); + offs2 = 9999; + sscanf(meth->method_types, "@%u@%u:%u{_XXRect={?=ff}{?=ff}}%ui%u", &offs1, &offs2, &offs3, + &offs4, &offs5); + CHECK_IF(!offs2); + [foo setRect:my_rect withInt:123]; + + meth = CLASS_GETINSTANCEMETHOD(fooClass, @selector(char:float:double:long:)); + offs2 = 9999; + if (sizeof (long) == 8) + string = "v%u@%u:%uc%uf%ud%uq%u"; + else + string = "v%u@%u:%uc%uf%ud%ul%u"; + sscanf(meth->method_types, string, &offs1, &offs2, &offs3, + &offs4, &offs5, &offs6, &offs7); + CHECK_IF(!offs2); + [foo char:'c' float:2.3 double:3.5 long:2345L]; + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/encode-5.mm b/gcc/testsuite/obj-c++.dg/encode-5.mm new file mode 100644 index 00000000000..0b8edc5cfa6 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/encode-5.mm @@ -0,0 +1,75 @@ +/* APPLE LOCAL file mainline */ +/* Method encoding tests for stand-alone @protocol declarations. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-do run } */ + +#include <objc/Protocol.h> +#ifdef __cplusplus +#define ProtoBool bool +#else +#define ProtoBool _Bool +#endif + +#ifndef __NEXT_RUNTIME__ +#include <objc/objc-api.h> +#endif + +extern "C" { + extern int sscanf(const char *str, const char *format, ...); + extern void abort(void); +} +#define CHECK_IF(expr) if(!(expr)) abort() + +enum Enum { + zero, one, two, three +}; +typedef enum Enum Enum; +typedef signed char ObjCBool; /* as used by the NeXT runtime */ + +@protocol Proto +union __XXAngle { unsigned int alpha, beta; }; +typedef struct { float x, y; union __XXAngle a; } XXPoint; +typedef struct { double width, height; } XXSize; +typedef struct _XXRect { XXPoint origin; XXSize size; struct _XXRect *next; } XXRect; +- (void) char:(signed char)c float:(float)f double:(double)d unsigned:(unsigned)u short:(short)s long:(long)l; +- (void *)setRect:(XXRect)r withBool:(ProtoBool)b withInt:(int)i; ++ (Enum *)getEnum:(XXPoint *)pt enum:(enum Enum)e bool:(ObjCBool)b; ++ (ProtoBool **)getBool:(ObjCBool **)b; +@end + +Protocol *proto = @protocol(Proto); +struct objc_method_description *meth; +unsigned totsize, offs0, offs1, offs2, offs3, offs4, offs5, offs6, offs7; + +static void scan_initial(const char *pattern) { + totsize = offs0 = offs1 = offs2 = offs3 = offs4 = offs5 = offs6 = offs7 = (unsigned)-1; + sscanf(meth->types, pattern, &totsize, &offs0, &offs1, &offs2, &offs3, + &offs4, &offs5, &offs6, &offs7); + CHECK_IF(!offs0 && offs1 == sizeof(id) && offs2 == offs1 + sizeof(SEL) && totsize >= offs2); +} + +int main(void) { + const char *string; + + meth = [proto descriptionForInstanceMethod: @selector(char:float:double:unsigned:short:long:)]; + if (sizeof (long) == 8) + string = "v%u@%u:%uc%uf%ud%uI%us%uq%u"; + else + string = "v%u@%u:%uc%uf%ud%uI%us%ul%u"; + scan_initial(string); + CHECK_IF(offs3 == offs2 + sizeof(int) && offs4 == offs3 + sizeof(float)); + CHECK_IF(offs5 == offs4 + sizeof(double) && offs6 == offs5 + sizeof(unsigned)); + CHECK_IF(offs7 == offs6 + sizeof(int) && totsize == offs7 + sizeof(long)); + meth = [proto descriptionForInstanceMethod: @selector(setRect:withBool:withInt:)]; + scan_initial("^v%u@%u:%u{_XXRect={?=ff(__XXAngle=II)}{?=dd}^{_XXRect}}%uB%ui%u"); + CHECK_IF(offs3 == offs2 + sizeof(XXRect) && offs4 == offs3 + sizeof(int)); + CHECK_IF(totsize == offs4 + sizeof(int)); + meth = [proto descriptionForClassMethod: @selector(getEnum:enum:bool:)]; + scan_initial("^i%u@%u:%u^{?=ff(__XXAngle=II)}%ui%uc%u"); + CHECK_IF(offs3 == offs2 + sizeof(XXPoint *) && offs4 == offs3 + sizeof(enum Enum)); + CHECK_IF(totsize == offs4 + sizeof(int)); /* 'ObjCBool' is really 'char' */ + meth = [proto descriptionForClassMethod: @selector(getBool:)]; + scan_initial("^^B%u@%u:%u^*%u"); + CHECK_IF(totsize == offs2 + sizeof(ObjCBool **)); + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/encode-6.mm b/gcc/testsuite/obj-c++.dg/encode-6.mm new file mode 100644 index 00000000000..e7a6e6b3ef8 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/encode-6.mm @@ -0,0 +1,76 @@ +/* APPLE LOCAL file mainline */ +/* Encoding tests for ObjC class layouts. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-options "-lobjc" } */ +/* { dg-do run } */ + +#include <objc/Object.h> +#ifdef __NEXT_RUNTIME__ +#include <objc/objc-class.h> +#define OBJC_GETCLASS objc_getClass +#else +#include <objc/objc-api.h> +#define OBJC_GETCLASS objc_get_class +#endif + +extern "C" { + extern void abort(void); + extern int strcmp(const char *s1, const char *s2); +} +#define CHECK_IF(expr) if(!(expr)) abort() + +@class Int1, Int2; +struct Nested; + +struct Innermost { + unsigned char a, b; + struct Nested *encl; +}; + +struct Nested { + float a, b; + Int1 *next; + struct Innermost innermost; +}; + +@interface Int1: Object { + signed char a, b; + Int2 *int2; + struct Nested nested; +} +@end + +@interface Int2: Int1 { + struct Innermost *innermost; + Int1 *base; +} +@end + +@implementation Int1 +@end + +@implementation Int2 +@end + +struct objc_ivar *ivar; + +static void check_ivar(const char *name, const char *type) { + CHECK_IF(!strcmp(ivar->ivar_name, name)); + CHECK_IF(!strcmp(ivar->ivar_type, type)); + ivar++; +} + +int main(void) { + ivar = ((Class)OBJC_GETCLASS("Int1"))->ivars->ivar_list; + check_ivar("a", "c"); + check_ivar("b", "c"); + check_ivar("int2", "@\"Int2\""); + check_ivar("nested", + "{Nested=\"a\"f\"b\"f\"next\"@\"Int1\"\"innermost\"{Innermost=\"a\"C\"b\"C\"encl\"^{Nested}}}"); + + ivar = ((Class)OBJC_GETCLASS("Int2"))->ivars->ivar_list; + check_ivar("innermost", "^{Innermost=CC^{Nested}}"); + check_ivar("base", "@\"Int1\""); + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/encode-7.mm b/gcc/testsuite/obj-c++.dg/encode-7.mm new file mode 100644 index 00000000000..00f4389eea1 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/encode-7.mm @@ -0,0 +1,79 @@ +/* APPLE LOCAL file mainline */ +/* Check if array arguments of ObjC methods are decayed to pointer types + in a proper fashion: + (1) The _encodings_ for the array arguments should remain to be '[4i]' and + such, since this has been the case since at least gcc 3.3. + (2) However, when building the static C functions out of ObjC method signatures, + we need to decay the arrays into pointers (as C does). + (3) If array size is not known (e.g., 'int a[]'), then the type shall be + encoded as a pointer. */ + +/* Contributed by Alexander Malmberg <alexander@malmberg.org> */ + +#include <objc/Object.h> +#include <stdlib.h> +#include <stdio.h> +#define CHECK_IF(expr) if(!(expr)) abort() + +#ifdef __NEXT_RUNTIME__ +#define METHOD Method +#define OBJC_GETCLASS objc_getClass +#define CLASS_GETINSTANCEMETHOD class_getInstanceMethod +#else +#include <objc/objc-api.h> +#define METHOD Method_t +#define OBJC_GETCLASS objc_get_class +#define CLASS_GETINSTANCEMETHOD class_get_instance_method +#endif + +@interface Test : Object +{ float j; } +-(void) test2: (int [5])a with: (int [])b; +-(id) test3: (Test **)b; /* { dg-warning "previous declaration of .\\-\\(id\\)test3:\\(Test \\*\\*\\)b." } */ +@end + +@implementation Test +-(void) test2: (int [5])a with: (int [])b +{ + a[3] = *b; +} +-(void) test3: (Test [3][4])b { /* { dg-warning "conflicting types for .\\-\\(void\\)test3:\\(Test \\\[3\\\]\\\[4\\\]\\)b." } */ +} +@end + +int bb[6] = { 0, 1, 2, 3, 4, 5 }; +int *b = bb; +Test *cc[4]; +Test **c = cc; + +int offs1, offs2, offs3, offs4, offs5, offs6; + +int main(int argc, char **argv) +{ + Class testClass = OBJC_GETCLASS("Test"); + METHOD meth; + + cc[0] = [Test new]; + CHECK_IF (bb[3] == 3); + [*c test2: b with: bb + 4]; + CHECK_IF (bb[3] == 4); + bb[3] = 0; + [*c test2: bb with: bb + 5]; + CHECK_IF (bb[3] == 5); + + meth = CLASS_GETINSTANCEMETHOD(testClass, @selector(test2:with:)); + offs1 = offs2 = offs3 = offs4 = offs5 = offs6 = -1; + sscanf(meth->method_types, "v%d@%d:%d[%di]%d^i%d", &offs1, &offs2, &offs3, + &offs4, &offs5, &offs6); + CHECK_IF (!offs2 && offs4 == 5 && offs3 > 0); + CHECK_IF (offs5 == 2 * offs3 && offs6 == 3 * offs3 && offs1 == 4 * offs3); + + meth = CLASS_GETINSTANCEMETHOD(testClass, @selector(test3:)); + offs1 = offs2 = offs3 = offs4 = offs5 = offs6 = -1; + sscanf(meth->method_types, "v%d@%d:%d[%d[%d{Test=#f}]]%d", &offs1, &offs2, &offs3, + &offs4, &offs5, &offs6); + CHECK_IF (!offs2 && offs4 == 3 && offs5 == 4 && offs3 > 0); + CHECK_IF (offs6 == 2 * offs3 && offs1 == 3 * offs3); + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/encode-8.mm b/gcc/testsuite/obj-c++.dg/encode-8.mm new file mode 100644 index 00000000000..2e4153a2ec8 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/encode-8.mm @@ -0,0 +1,24 @@ +/* APPLE LOCAL file mainline */ +/* Test if the Objective-C @encode machinery distinguishes between + 'BOOL *' (which should be encoded as '^c') and 'char *' (which + should be encoded as '*'). */ +/* Contributed by Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-options "-lobjc" } */ +/* { dg-do run } */ + +#include <string.h> +#include <stdlib.h> +#include <objc/objc.h> + +int main(void) { + const char *BOOL_ptr = @encode(BOOL *); + const char *char_ptr = @encode(char *); + + if(strcmp(BOOL_ptr, "^c")) + abort(); + + if(strcmp(char_ptr, "*")) + abort(); + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/extern-c-1.mm b/gcc/testsuite/obj-c++.dg/extern-c-1.mm new file mode 100644 index 00000000000..aab0ce78df3 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/extern-c-1.mm @@ -0,0 +1,19 @@ +/* APPLE LOCAL file mainline */ +/* Test extern c support inside @implementation */ +/* Devang Patel <dpatel@apple.com>. */ +#include <objc/objc.h> + +@interface Extern +@end + +@implementation Extern + +extern "C" void NSRegisterElement(id element); + +- init { + NSRegisterElement(self); + return self; +} + +@end + diff --git a/gcc/testsuite/obj-c++.dg/extra-semi.mm b/gcc/testsuite/obj-c++.dg/extra-semi.mm new file mode 100644 index 00000000000..520a59aaaf2 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/extra-semi.mm @@ -0,0 +1,10 @@ +/* APPLE LOCAL file mainline */ +/* Allow extra semicolons in between method declarations, + for old times' sake. */ +/* { dg-do compile } */ + +@interface Foo + -(Foo *) expiration; + -(void) setExpiration:(Foo *) date;; + -(int) getVersion; +@end diff --git a/gcc/testsuite/obj-c++.dg/fix-and-continue-2.mm b/gcc/testsuite/obj-c++.dg/fix-and-continue-2.mm new file mode 100644 index 00000000000..e5db5d5aa35 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/fix-and-continue-2.mm @@ -0,0 +1,25 @@ +/* APPLE LOCAL file mainline */ +/* Static variables, even if local, require indirect access through a stub + if -mfix-and-continue is enabled. */ + +/* Author: Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-do assemble { target *-*-darwin* } } */ +/* { dg-options "-mfix-and-continue" } */ + +#include <objc/Object.h> + +@interface Foo: Object ++ (Object *)indexableFileTypes; +@end + +@implementation Foo ++ (Object *)indexableFileTypes +{ + static Object *fileTypes = 0; + if(!fileTypes) { + fileTypes = [Object new]; + } + return fileTypes; +} +@end diff --git a/gcc/testsuite/obj-c++.dg/isa-field-1.mm b/gcc/testsuite/obj-c++.dg/isa-field-1.mm new file mode 100644 index 00000000000..c925ce3b1b6 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/isa-field-1.mm @@ -0,0 +1,44 @@ +/* APPLE LOCAL file mainline */ +/* Ensure there are no bizarre difficulties with accessing the 'isa' field of objects. */ +/* { dg-do compile } */ + +#include <objc/Object.h> + +@interface Object (Test) +- (Class) test1: (id)object; +@end + +@interface Derived: Object +- (Class) test2: (id)object; +@end + +@implementation Object (Test) + +Class test1(id object) { + Class cls = object->isa; + return cls; +} +- (Class) test1: (id)object { + Class cls = object->isa; + return cls; +} + +@end + +@implementation Derived + +Class test2(id object) { + Class cls = object->isa; + return cls; +} +- (Class) test2: (id)object { + Class cls = object->isa; + return cls; +} + +@end + +Class test3(id object) { + Class cls = object->isa; + return cls; +} diff --git a/gcc/testsuite/obj-c++.dg/ivar-list-semi.mm b/gcc/testsuite/obj-c++.dg/ivar-list-semi.mm new file mode 100644 index 00000000000..f860c873a65 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/ivar-list-semi.mm @@ -0,0 +1,13 @@ +/* APPLE LOCAL file mainline */ +/* Allow for an optional semicolon following the ivar block. */ +/* Contributed by: Ziemowit Laski <zlaski@apple.com>. */ + +#include <objc/Object.h> + +@interface Tink : Object { +@private + unsigned long mCode[4]; +}; +- (id)initWithProc:(void *)inProc; +- (void *)getUniqueProc; +@end diff --git a/gcc/testsuite/obj-c++.dg/layout-1.mm b/gcc/testsuite/obj-c++.dg/layout-1.mm new file mode 100644 index 00000000000..c3e03dc96de --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/layout-1.mm @@ -0,0 +1,16 @@ +/* APPLE LOCAL file mainline */ +/* Ensure that we do not get bizarre warnings referring to + __attribute__((packed)) or some such. */ +/* { dg-do compile } */ +/* { dg-options "-Wpadded -Wpacked -Wabi" } */ + +#include <objc/Object.h> + +@interface Derived1: Object +{ } +@end + +@interface Derived2: Object +- (id) foo; +@end + diff --git a/gcc/testsuite/obj-c++.dg/local-decl-1.mm b/gcc/testsuite/obj-c++.dg/local-decl-1.mm new file mode 100644 index 00000000000..7ef49809768 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/local-decl-1.mm @@ -0,0 +1,43 @@ +/* APPLE LOCAL file mainline */ +/* Test for ivar access inside of class methods. It should be allowed (with a warning), but only + if no other declarations with the same name are seen. */ +/* Author: Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-do compile } */ + +#include <objc/Object.h> + +@interface Sprite: Object { + int sprite, spree; +} ++ (void)setFoo:(int)foo; ++ (void)setSprite:(int)sprite; +- (void)setFoo:(int)foo; +- (void)setSprite:(int)sprite; +@end + +int spree = 23; + +@implementation Sprite ++ (void)setFoo:(int)foo { + sprite = foo; /* { dg-warning "instance variable .sprite. accessed in class method" } */ + spree = foo; +} ++ (void)setSprite:(int)sprite { + int spree; + sprite = 15; + spree = 17; + ((Sprite *)self)->sprite = 16; /* NB: This is how one _should_ access */ + ((Sprite *)self)->spree = 18; /* ivars from within class methods! */ +} +- (void)setFoo:(int)foo { + sprite = foo; + spree = foo; +} +- (void)setSprite:(int)sprite { + int spree; + sprite = 15; /* { dg-warning "local declaration of .sprite. hides instance variable" } */ + self->sprite = 16; + spree = 17; /* { dg-warning "local declaration of .spree. hides instance variable" } */ + self->spree = 18; +} +@end diff --git a/gcc/testsuite/obj-c++.dg/lookup-1.mm b/gcc/testsuite/obj-c++.dg/lookup-1.mm new file mode 100644 index 00000000000..9690e58e56e --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/lookup-1.mm @@ -0,0 +1,9 @@ +/* APPLE LOCAL file mainline */ +/* Simple test to check Objectivec-C++ qualified type lookup. */ +/* Devang Patel <dpatel@apple.com>. */ + +@interface A +{ + A *ap; +} +@end diff --git a/gcc/testsuite/obj-c++.dg/lookup-2.mm b/gcc/testsuite/obj-c++.dg/lookup-2.mm new file mode 100644 index 00000000000..a72c05282ed --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/lookup-2.mm @@ -0,0 +1,57 @@ +/* APPLE LOCAL file mainline */ +/* { dg-do run } */ + +#include <objc/Object.h> +#include <stdlib.h> + +class MyWidget { + public: + int a; + MyWidget(void) { a = 17; } +}; + +MyWidget gWidget; + +@protocol MyProto +- (MyWidget *)widget; +@end + +@interface Foo: Object +@end + +@interface Bar: Foo <MyProto> +@end + +@interface Container: Object ++ (MyWidget *)elementForView:(Foo *)view; +@end + +@implementation Foo +@end + +@implementation Bar +- (MyWidget *)widget { + return &gWidget; +} +@end + +@implementation Container ++ (MyWidget *)elementForView:(Foo *)view +{ + MyWidget *widget = nil; + if ([view conformsTo:@protocol(MyProto)]) { + widget = [(Foo <MyProto> *)view widget]; + } + return widget; +} +@end + +int main(void) { + id view = [Bar new]; + MyWidget *w = [Container elementForView: view]; + + if (!w || w->a != 17) + abort (); + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/lvalue-cast-1.mm b/gcc/testsuite/obj-c++.dg/lvalue-cast-1.mm new file mode 100644 index 00000000000..f2575efc631 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/lvalue-cast-1.mm @@ -0,0 +1,32 @@ +/* APPLE LOCAL file non lvalue assign */ +/* { dg-do compile } */ +/* { dg-options "-fnon-lvalue-assign" } */ + +#include <objc/Object.h> + +typedef struct _NSPoint { + float x; + float y; +} NSPoint; +typedef NSPoint *NSPointPointer; +typedef NSPoint *NSPointArray; +typedef struct _NSSize { + float width; + float height; +} NSSize; +typedef struct _NSRect { + NSPoint origin; + NSSize size; +} NSRect; + +@interface NSLayoutManager: Object { + NSRect *_cachedRectArray; +} +- (void)_growCachedRectArrayToSize:(unsigned)newSize; +@end + +@implementation NSLayoutManager +- (void)_growCachedRectArrayToSize:(unsigned)newSize { + ( NSRect *)_cachedRectArray = nil; /* { dg-warning "target of assignment not really an lvalue" } */ +} +@end diff --git a/gcc/testsuite/obj-c++.dg/method-1.mm b/gcc/testsuite/obj-c++.dg/method-1.mm new file mode 100644 index 00000000000..45fd0c6f836 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/method-1.mm @@ -0,0 +1,30 @@ +/* APPLE LOCAL file mainline */ +/* Test whether casting 'id' to a specific class removes method lookup + ambiguity. */ +/* Author: Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-do compile } */ + +#include <objc/objc.h> + +@class Int1, Int2; + +@interface Int1 ++ (Int1 *)classMethod1; ++ (id)classMethod2; +- (Int1 *)instanceMethod:(Int2 *)arg; /* { dg-bogus "using" } */ +@end + +@interface Int2: Int1 ++ (Int1 *)classMethod1; ++ (id)classMethod2; +- (id)int2Method; +- (int)instanceMethod:(int)arg; /* { dg-bogus "also found" } */ +@end + +int main(void) { + id i = [(Int2 *)[Int1 classMethod1] int2Method]; /* { dg-bogus "may not respond to" } */ + int j = [(Int2 *)[Int2 classMethod2] instanceMethod: 45]; /* { dg-bogus "multiple methods" } */ + /* { dg-bogus "invalid conversion" "" { target *-*-* } 25 } */ + /* { dg-bogus "invalid conversion" "" { target *-*-* } 25 } */ + return j; +} diff --git a/gcc/testsuite/obj-c++.dg/method-10.mm b/gcc/testsuite/obj-c++.dg/method-10.mm new file mode 100644 index 00000000000..2498fcb43d8 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/method-10.mm @@ -0,0 +1,46 @@ +/* APPLE LOCAL file mainline */ +/* Test for sending messages to aliased classes (and instances thereof). */ +/* Author: Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-options "-lobjc" } */ +/* { dg-do run } */ + +#include <objc/Object.h> + +extern "C" void abort(void); +#define CHECK_IF(expr) if(!(expr)) abort() + +@interface Int1: Object ++ (int) classMeth; +- (int) instanceMeth; +@end + +@interface Int2: Object ++ (int) classMeth; +- (int) instanceMeth; +@end + +@implementation Int1 ++ (int) classMeth { return 345; } +- (int) instanceMeth { return 697; } +@end + +@implementation Int2 ++ (int) classMeth { return 1345; } +- (int) instanceMeth { return 1697; } +@end + +typedef Int1 Int1Typedef; +@compatibility_alias Int1Alias Int1Typedef; +@compatibility_alias Int2Alias Int2; +typedef Int2Alias Int2Typedef; + +int main(void) { + Int1Alias *int1alias = [[Int1Typedef alloc] init]; + Int2Typedef *int2typedef = [[Int2Alias alloc] init]; + + CHECK_IF([Int1Typedef classMeth] == 345 && [Int2Alias classMeth] == 1345); + CHECK_IF([int1alias instanceMeth] == 697 && [int2typedef instanceMeth] == 1697); + CHECK_IF([(Int2Typedef *)int1alias instanceMeth] == 697); + CHECK_IF([(Int1Alias *)int2typedef instanceMeth] == 1697); + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/method-11.mm b/gcc/testsuite/obj-c++.dg/method-11.mm new file mode 100644 index 00000000000..755a6dd5b73 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/method-11.mm @@ -0,0 +1,26 @@ +/* APPLE LOCAL file mainline */ +/* Check if class references (generated for the NeXT runtime) are appropriately + folded. This test is safe to run on all targets. */ +/* Author: Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-options "-fnext-runtime" } */ +/* { dg-do compile } */ + +#include <objc/Object.h> + +typedef Object ObjectTypedef1; +typedef ObjectTypedef1 ObjectTypedef2; +@compatibility_alias ObjectAlias1 ObjectTypedef2; +@compatibility_alias ObjectAlias2 ObjectAlias1; +typedef ObjectAlias2 ObjectTypedef3; + +void foo(void) { + id obj = [Object new]; + obj = [ObjectTypedef1 new]; + obj = [ObjectTypedef2 new]; + obj = [ObjectTypedef3 new]; + obj = [ObjectAlias1 new]; + obj = [ObjectAlias2 new]; +} + +/* { dg-final { scan-assembler "_OBJC_CLASS_REFERENCES_0" } } */ +/* { dg-final { scan-assembler-not "_OBJC_CLASS_REFERENCES_1" } } */ diff --git a/gcc/testsuite/obj-c++.dg/method-12.mm b/gcc/testsuite/obj-c++.dg/method-12.mm new file mode 100644 index 00000000000..e3380426689 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/method-12.mm @@ -0,0 +1,34 @@ +/* APPLE LOCAL file mainline */ +/* Check that sending messages to variables of type 'Class' does not involve instance methods, unless they reside in root classes. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile } */ + +#include <objc/Protocol.h> + +@interface Base +- (unsigned)port; +@end + +@interface Derived: Base +- (Object *)port; ++ (Protocol *)port; +- (id)starboard; +@end + +void foo(void) { + Class receiver; + + [receiver port]; /* { dg-warning "multiple methods named .\\+port. found" } */ + /* { dg-warning "using .\\-\\(unsigned( int)?\\)port." "" { target *-*-* } 9 } */ + /* { dg-warning "also found .\\+\\(Protocol \\*\\)port." "" { target *-*-* } 14 } */ + + [receiver starboard]; /* { dg-warning "no .\\+starboard. method found" } */ + /* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 25 } */ + /* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 25 } */ + /* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 25 } */ + + [Class port]; /* { dg-error ".Class. is not an Objective\\-C class name or alias" } */ +} + +/* { dg-options "-Wstrict-selector-match" } */ + diff --git a/gcc/testsuite/obj-c++.dg/method-13.mm b/gcc/testsuite/obj-c++.dg/method-13.mm new file mode 100644 index 00000000000..b714f8eb6f7 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/method-13.mm @@ -0,0 +1,29 @@ +/* APPLE LOCAL file mainline */ +/* Check if finding multiple signatures for a method is handled gracefully. Author: Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile } */ + +#include <objc/Object.h> + +@interface Class1 +- (void)setWindow:(Object *)wdw; +@end + +@interface Class2 +- (void)setWindow:(Class1 *)window; +@end + +id foo(void) { + Object *obj = [[Object alloc] init]; + id obj2 = obj; + [obj setWindow:nil]; /* { dg-warning ".Object. may not respond to .\\-setWindow:." } */ + /* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 18 } */ + /* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 18 } */ + /* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 18 } */ + [obj2 setWindow:nil]; /* { dg-warning "multiple methods named .\\-setWindow:. found" } */ + /* { dg-warning "using .\\-\\(void\\)setWindow:\\(Object \\*\\)wdw." "" { target *-*-* } 8 } */ + /* { dg-warning "also found .\\-\\(void\\)setWindow:\\(Class1 \\*\\)window." "" { target *-*-* } 12 } */ + + return obj; +} + +/* { dg-options "-Wstrict-selector-match" } */ diff --git a/gcc/testsuite/obj-c++.dg/method-14.mm b/gcc/testsuite/obj-c++.dg/method-14.mm new file mode 100644 index 00000000000..77bb7b794ee --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/method-14.mm @@ -0,0 +1,15 @@ +/* APPLE LOCAL file mainline */ +/* Check if casting the receiver type causes method lookup to succeed. This was broken + in Objective-C++. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile } */ + +@interface A +@end + +@interface B: A +- (void)f; +@end + +void g(A *p) { [(B *)p f]; } + diff --git a/gcc/testsuite/obj-c++.dg/method-15.mm b/gcc/testsuite/obj-c++.dg/method-15.mm new file mode 100644 index 00000000000..1ea1445c3ee --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/method-15.mm @@ -0,0 +1,46 @@ +/* APPLE LOCAL file mainline */ +/* Check if finding multiple signatures for a method is handled gracefully when method lookup succeeds (see also method-7.m). */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile } */ + +#include <objc/Object.h> + +@protocol MyObject +- (id)initWithData:(Object *)data; +@end + +@protocol SomeOther +- (id)initWithData:(int)data; +@end + +@protocol MyCoding +- (id)initWithData:(id<MyObject, MyCoding>)data; +@end + +@interface NTGridDataObject: Object <MyCoding> +{ + Object<MyCoding> *_data; +} ++ (NTGridDataObject*)dataObject:(id<MyObject, MyCoding>)data; +@end + +@implementation NTGridDataObject +- (id)initWithData:(id<MyObject, MyCoding>)data { + return data; +} ++ (NTGridDataObject*)dataObject:(id<MyObject, MyCoding>)data +{ + NTGridDataObject *result = [[NTGridDataObject alloc] initWithData:data]; + /* { dg-warning "multiple methods named .\\-initWithData:. found" "" { target *-*-* } 33 } */ + /* { dg-warning "using .\\-\\(id\\)initWithData:\\(Object \\*\\)data." "" { target *-*-* } 9 } */ + /* { dg-warning "also found .\\-\\(id\\)initWithData:\\(id <MyObject, MyCoding>\\)data." "" { target *-*-* } 17 } */ + /* { dg-warning "also found .\\-\\(id\\)initWithData:\\(int\\)data." "" { target *-*-* } 13 } */ + + /* The following warning is a consequence of picking the "wrong" method signature. */ + /* { dg-warning "passing argument 1 of .initWithData:. from distinct Objective\\-C type" "" { target *-*-* } 33 } */ + return result; +} +@end + +/* { dg-options "-Wstrict-selector-match" } */ + diff --git a/gcc/testsuite/obj-c++.dg/method-16.mm b/gcc/testsuite/obj-c++.dg/method-16.mm new file mode 100644 index 00000000000..2235a47e086 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/method-16.mm @@ -0,0 +1,34 @@ +/* APPLE LOCAL file mainline */ +/* Ensure that we indeed cannot obtain the value of a message send + if the chosen method signature returns 'void'. There used to + exist a cheesy hack that allowed it. While at it, check that + the first lexically occurring method signature gets picked + when sending messages to 'id'. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile } */ + +#include <objc/objc.h> + +@interface Object1 +- (void)initWithData:(Object1 *)data; +@end + +@interface Object2 +- (id)initWithData:(Object1 *)data; +@end + +@interface Object3 +- (id)initWithData:(Object2 *)data; +@end + +void foo(void) { + id obj1, obj2 = 0; + obj2 = [obj1 initWithData: obj2]; + /* { dg-warning "multiple methods named .\\-initWithData:. found" "" { target *-*-* } 26 } */ + /* { dg-warning "using .\\-\\(void\\)initWithData:\\(Object1 \\*\\)data." "" { target *-*-* } 13 } */ + /* { dg-warning "also found .\\-\\(id\\)initWithData:\\(Object1 \\*\\)data." "" { target *-*-* } 17 } */ + /* { dg-warning "also found .\\-\\(id\\)initWithData:\\(Object2 \\*\\)data." "" { target *-*-* } 21 } */ + + /* The following error is a consequence of picking the "wrong" method signature. */ + /* { dg-error "void value not ignored as it ought to be" "" { target *-*-* } 26 } */ +} diff --git a/gcc/testsuite/obj-c++.dg/method-17.mm b/gcc/testsuite/obj-c++.dg/method-17.mm new file mode 100644 index 00000000000..8e26caf9435 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/method-17.mm @@ -0,0 +1,33 @@ +/* APPLE LOCAL file mainline */ +/* When there is only one candidate method available, make sure the + compiler uses its argument/return types when constructing the + message sends (so that proper C/C++ argument conversions may + take place). */ +/* { dg-do run } */ + +#include <objc/Object.h> +extern "C" void abort(void); +#define CHECK_IF(expr) if(!(expr)) abort() + +static double d = 4.5920234e2; + +@interface Foo : Object +-(void) brokenType: (int)x floatingPoint: (double)y; +@end + + +@implementation Foo +-(void) brokenType: (int)x floatingPoint: (double)y +{ + CHECK_IF(x == 459); + CHECK_IF(y == d); +} +@end + +int main(void) +{ + Foo *foo=[Foo new]; + [foo brokenType: (int)d floatingPoint: d]; + return 0; +} + diff --git a/gcc/testsuite/obj-c++.dg/method-18.mm b/gcc/testsuite/obj-c++.dg/method-18.mm new file mode 100644 index 00000000000..1035553dcc4 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/method-18.mm @@ -0,0 +1,26 @@ +/* APPLE LOCAL file mainline */ +/* Contributed by Igor Seleznev <selez@mail.ru>. */ +/* This used to be broken. */ + +#include <objc/objc.h> + +@interface A ++ (A *)currentContext; +@end + +@interface B ++ (B *)currentContext; +@end + +int main() +{ + [A currentContext]; /* { dg-bogus "multiple declarations" } */ + return 0; +} + +@implementation A ++ (A *)currentContext { return nil; } +@end +@implementation B ++ (B *)currentContext { return nil; } +@end diff --git a/gcc/testsuite/obj-c++.dg/method-19.mm b/gcc/testsuite/obj-c++.dg/method-19.mm new file mode 100644 index 00000000000..b1e79b58fca --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/method-19.mm @@ -0,0 +1,82 @@ +/* APPLE LOCAL file mainline */ +/* Test if instance methods of root classes are used as class methods, if no + "real" methods are found. For receivers of type 'id' and 'Class', all + root classes must be considered. */ +/* Author: Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-do run } */ + +#include <objc/objc.h> + +#ifdef __NEXT_RUNTIME__ +#include <objc/objc-runtime.h> +#define OBJC_GETCLASS objc_getClass +#else +#include <objc/objc-api.h> +#define OBJC_GETCLASS objc_get_class +#endif + +extern "C" { + extern void abort(void); + extern int strcmp(const char *, const char *); +} +#define CHECK_IF(expr) if(!(expr)) abort() + +@protocol Proto +- (const char *) method4; +@end + +@interface Root +{ Class isa; } ++ (const char *) method2; +@end + +@interface Derived: Root +- (const char *) method1; +- (const char *) method2; +- (const char *) method3; +@end + +@interface Root (Categ) +- (const char *) method3; +@end + +@implementation Root (Categ) +- (const char *) method3 { return "Root(Categ)::-method3"; } +- (const char *) method4 { return "Root(Categ)::-method4"; } +@end + +@implementation Derived +- (const char *) method1 { return "Derived::-method1"; } +- (const char *) method2 { return "Derived::-method2"; } +- (const char *) method3 { return "Derived::-method3"; } +@end + +@implementation Root +#ifdef __NEXT_RUNTIME__ ++ initialize { return self; } +#endif +- (const char *) method1 { return "Root::-method1"; } ++ (const char *) method2 { return "Root::+method2"; } +@end + +int main(void) +{ + Class obj = OBJC_GETCLASS("Derived"); + + /* None of the following should elicit compiler-time warnings. */ + + CHECK_IF(!strcmp([Root method1], "Root::-method1")); + CHECK_IF(!strcmp([Root method2], "Root::+method2")); + CHECK_IF(!strcmp([Root method3], "Root(Categ)::-method3")); + CHECK_IF(!strcmp([Root method4], "Root(Categ)::-method4")); + CHECK_IF(!strcmp([Derived method1], "Root::-method1")); + CHECK_IF(!strcmp([Derived method2], "Root::+method2")); + CHECK_IF(!strcmp([Derived method3], "Root(Categ)::-method3")); + CHECK_IF(!strcmp([Derived method4], "Root(Categ)::-method4")); + CHECK_IF(!strcmp([obj method1], "Root::-method1")); + CHECK_IF(!strcmp([obj method2], "Root::+method2")); + CHECK_IF(!strcmp([obj method3], "Root(Categ)::-method3")); + CHECK_IF(!strcmp([obj method4], "Root(Categ)::-method4")); + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/method-2.mm b/gcc/testsuite/obj-c++.dg/method-2.mm new file mode 100644 index 00000000000..8b22a84a8bf --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/method-2.mm @@ -0,0 +1,56 @@ +/* APPLE LOCAL file mainline */ +/* Test if prior method lookup at method @implementation time is not + overly aggressive, leading to methods being found in other classes. */ +/* Author: Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-do compile } */ + +#include <objc/Object.h> + +@class NSString; + +@protocol NSMenuItem ++ (void)setUsesUserKeyEquivalents:(BOOL)flag; ++ (BOOL)usesUserKeyEquivalents; +@end + +@interface NSMenuItem : Object <NSMenuItem> { + @private + id _menu; +} +@end + +@interface NSResponder : Object <NSMenuItem> +{ + id _nextResponder; +} +@end + +@interface Object(NSMenuValidation) +- (BOOL)validateMenuItem:(id <NSMenuItem>)menuItem; +@end + +@interface NSResponder (NSStandardKeyBindingMethods) +- (void)insertText:(id)insertString; +- (void)doCommandBySelector:(SEL)aSelector; +@end + +@interface NSView : NSResponder +{ + id _superview; + id _subviews; +} +@end + +@interface SKTGraphicView : NSView { + @private + float _gridSpacing; +} +@end + +@implementation SKTGraphicView +- (BOOL)validateMenuItem:(NSMenuItem *)item { + return (BOOL)1; +} +- (void)insertText:(NSString *)str { +} +@end diff --git a/gcc/testsuite/obj-c++.dg/method-20.mm b/gcc/testsuite/obj-c++.dg/method-20.mm new file mode 100644 index 00000000000..bd3b03bb0ea --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/method-20.mm @@ -0,0 +1,18 @@ +/* APPLE LOCAL file mainline */ +/* Test if context-sensitive "in", "out", "byref", etc., qualifiers can be + used as method selectors. */ +/* Author: Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-do compile } */ + +@interface Foo +- (void)insertNewButtonImage:(Foo *)newButtonImage in:(Foo *)buttonCell; ++ (oneway void)oneway:(int)i2 byref:(int)i3 out:(float)f4 bycopy:(float)f5; +@end + +@implementation Foo +- (void)insertNewButtonImage:(Foo *)newButtonImage in:(Foo *)buttonCell { } ++ (oneway void)oneway:(int)i2 byref:(int)i3 out:(float)f4 bycopy:(float)f5 { } +@end + +/* { dg-final { scan-assembler "insertNewButtonImage:in:" } } */ +/* { dg-final { scan-assembler "oneway:byref:out:bycopy:" } } */ diff --git a/gcc/testsuite/obj-c++.dg/method-21.mm b/gcc/testsuite/obj-c++.dg/method-21.mm new file mode 100644 index 00000000000..7ebfa02cc0c --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/method-21.mm @@ -0,0 +1,26 @@ +/* APPLE LOCAL file mainline */ +/* Test for spurious "may or may not return a value" warnings. */ +/* { dg-do compile } */ +/* { dg-options "-Wextra" } */ + +#include <objc/Object.h> + +@interface Foo: Object +- (id) meth1; +- (void) meth2; +@end + +extern int bar; + +@implementation Foo +- (id) meth1 { + if (bar) + return [Object new]; + return; /* { dg-error "return.statement with no value" } */ +} +- (void) meth2 { + if (!bar) + return; + bar = 0; +} +@end diff --git a/gcc/testsuite/obj-c++.dg/method-3.mm b/gcc/testsuite/obj-c++.dg/method-3.mm new file mode 100644 index 00000000000..0173d301a73 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/method-3.mm @@ -0,0 +1,24 @@ +/* APPLE LOCAL file mainline */ +/* Do not warn about "slightly" mismatched method signatures if + -Wstrict-selector-match is off. */ +/* { dg-do compile } */ +/* { dg-options "-Wno-strict-selector-match" } */ + +#include <objc/objc.h> + +@interface Base +- (id) meth1: (Base *)arg1; +- (id) window; +@end + +@interface Derived: Base +- (id) meth1: (Derived *)arg1; +- (Base *) window; +@end + +void foo(void) { + id r; + + [r meth1:r]; + [r window]; +} diff --git a/gcc/testsuite/obj-c++.dg/method-4.mm b/gcc/testsuite/obj-c++.dg/method-4.mm new file mode 100644 index 00000000000..fa9c80227d0 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/method-4.mm @@ -0,0 +1,24 @@ +/* APPLE LOCAL file mainline */ +/* Warn about "slightly" mismatched method signatures if + -Wstrict-selector-match is on. */ +/* { dg-do compile } */ +/* { dg-options "-Wstrict-selector-match" } */ + +#include <objc/objc.h> + +@interface Base +- (id) meth1: (Base *)arg1; /* { dg-warning "using .\\-\\(id\\)meth1:\\(Base \\*\\)arg1." } */ +- (id) window; /* { dg-warning "using .\\-\\(id\\)window" } */ +@end + +@interface Derived: Base +- (id) meth1: (Derived *)arg1; /* { dg-warning "also found .\\-\\(id\\)meth1:\\(Derived \\*\\)arg1." } */ +- (Base *) window; /* { dg-warning "also found .\\-\\(Base \\*\\)window." } */ +@end + +void foo(void) { + id r; + + [r meth1:r]; /* { dg-warning "multiple methods named .\\-meth1:. found" } */ + [r window]; /* { dg-warning "multiple methods named .\\-window. found" } */ +} diff --git a/gcc/testsuite/obj-c++.dg/method-5.mm b/gcc/testsuite/obj-c++.dg/method-5.mm new file mode 100644 index 00000000000..191206a896a --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/method-5.mm @@ -0,0 +1,30 @@ +/* APPLE LOCAL file mainline */ +/* Do not warn about "slightly" mismatched method signatures if + -Wstrict-selector-match is off. */ +/* { dg-do compile } */ +/* { dg-options "-Wno-strict-selector-match" } */ + +#include <objc/objc.h> + +typedef enum { en1_1, en1_2 } En1; +typedef enum { en2_1, en2_2 } En2; +typedef struct { int a, b; } St1; +typedef struct { unsigned a, b; } St2; + +@interface Base +- (id) meth1: (En1)arg1; +- (St1) window; +@end + +@interface Derived: Base +- (id) meth1: (En2)arg1; +- (St2)window; +@end + +void foo(void) { + id r; + En1 en; + + [r meth1:en]; + [r window]; +} diff --git a/gcc/testsuite/obj-c++.dg/method-6.mm b/gcc/testsuite/obj-c++.dg/method-6.mm new file mode 100644 index 00000000000..4d99214ab19 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/method-6.mm @@ -0,0 +1,18 @@ +/* APPLE LOCAL file mainline */ +/* The following should NOT generate "may not respond to" warnings, since a forward-declared + @class (instance) should be treated like a 'Class') ('id'). */ +/* { dg-do compile } */ + +#include <objc/Object.h> + +@class NotKnown; + +void foo(NotKnown *n) { + [NotKnown new]; + [n nonexistent_method]; /* { dg-warning "no .\\-nonexistent_method. method found" } */ +} + +/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */ +/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */ +/* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 0 } */ + diff --git a/gcc/testsuite/obj-c++.dg/method-7.mm b/gcc/testsuite/obj-c++.dg/method-7.mm new file mode 100644 index 00000000000..2817b21693d --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/method-7.mm @@ -0,0 +1,21 @@ +/* APPLE LOCAL file mainline */ +/* Check if sending messages to "underspecified" objects is handled gracefully. */ +/* Author: Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-do compile } */ + +@class UnderSpecified; +typedef struct NotAClass { + int a, b; +} NotAClass; + +void foo(UnderSpecified *u, NotAClass *n) { + [n nonexistent_method]; /* { dg-warning "invalid receiver type" } */ + /* { dg-warning "no .\\-nonexistent_method. method found" "" { target *-*-* } 12 } */ + [NotAClass nonexistent_method]; /* { dg-error ".NotAClass. is not an Objective\\-C class name or alias" } */ + [u nonexistent_method]; /* { dg-warning "no .\\-nonexistent_method. method found" } */ + [UnderSpecified nonexistent_method]; /* { dg-warning "no .\\+nonexistent_method. method found" } */ +} + +/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */ +/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */ +/* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/obj-c++.dg/method-8.mm b/gcc/testsuite/obj-c++.dg/method-8.mm new file mode 100644 index 00000000000..5938c3e0ac2 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/method-8.mm @@ -0,0 +1,31 @@ +/* APPLE LOCAL file mainline */ +/* Tests of duplication. */ +/* { dg-do compile } */ + +@interface class1 +- (int) meth1; +- (void) meth1; /* { dg-error "duplicate declaration of method .\\-meth1." } */ +@end + +@interface class2 ++ (void) meth1; ++ (int) meth1; /* { dg-error "duplicate declaration of method .\\+meth1." } */ +@end + +@interface class3 +- (int) meth1; +@end + +@implementation class3 +- (int) meth1 { return 0; } /* { dg-error "previously defined here" } */ +- (int) meth1 { return 0; } /* { dg-error "redefinition of" } */ +@end + +@interface class4 ++ (void) meth1; +@end + +@implementation class4 ++ (void) meth1 {} /* { dg-error "previously defined here" } */ ++ (void) meth1 {} /* { dg-error "redefinition of" } */ +@end diff --git a/gcc/testsuite/obj-c++.dg/method-9.mm b/gcc/testsuite/obj-c++.dg/method-9.mm new file mode 100644 index 00000000000..2943d7fb12d --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/method-9.mm @@ -0,0 +1,34 @@ +/* APPLE LOCAL file mainline */ +/* Test for lookup of class (factory) methods. */ +/* Author: Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-do compile } */ + +@interface MyBase +- (void) rootInstanceMethod; +@end + +@interface MyIntermediate: MyBase +@end + +@interface MyDerived: MyIntermediate +- (void) instanceMethod; ++ (void) classMethod; +@end + +@implementation MyDerived +- (void) instanceMethod { +} + ++ (void) classMethod { /* If a class method is not found, the root */ + [self rootInstanceMethod]; /* class is searched for an instance method */ + [MyIntermediate rootInstanceMethod]; /* with the same name. */ + + [self instanceMethod]; /* { dg-warning ".MyDerived. may not respond to .\\+instanceMethod." } */ + [MyDerived instanceMethod]; /* { dg-warning ".MyDerived. may not respond to .\\+instanceMethod." } */ +} +@end + +/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */ +/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */ +/* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 0 } */ + diff --git a/gcc/testsuite/obj-c++.dg/no-extra-load.mm b/gcc/testsuite/obj-c++.dg/no-extra-load.mm new file mode 100644 index 00000000000..40ff8114eab --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/no-extra-load.mm @@ -0,0 +1,23 @@ +// APPLE LOCAL file mainline +// Radar 3926484 +// { dg-do compile } + +#include <objc/Object.h> +#include <iostream> + +@interface Greeter : Object +- (void) greet: (const char *)msg; +@end + +@implementation Greeter +- (void) greet: (const char *)msg { std::cout << msg; } +@end + +int +main () +{ + std::cout << "Hello from C++\n"; + Greeter *obj = [Greeter new]; + [obj greet: "Hello from Objective-C\n"]; +} +/* { dg-final { scan-assembler-not "L_objc_msgSend\\\$non_lazy_ptr" } } */ diff --git a/gcc/testsuite/obj-c++.dg/objc-fast-1.mm b/gcc/testsuite/obj-c++.dg/objc-fast-1.mm new file mode 100644 index 00000000000..6db7c38beec --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/objc-fast-1.mm @@ -0,0 +1,24 @@ +/* APPLE LOCAL file ObjC direct dispatch */ +/* A compile-only test for insertion of 'bla' comm page jumps. */ +/* Developed by Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-fnext-runtime -fobjc-gc -fobjc-direct-dispatch -Wassign-intercept" } */ + +#include <objc/Object.h> + +@interface Derived: Object { +@public + Object *other; +} +@end + +void foo(void) { + Derived *o = [Derived new]; + o->other = 0; /* { dg-warning "instance variable assignment has been intercepted" } */ +} + +/* { dg-final { scan-assembler-not "objc_msgSend" } } */ +/* { dg-final { scan-assembler-not "objc_assign_ivar" } } */ + +/* { dg-final { scan-assembler "bla.*fffeff00" } } */ +/* { dg-final { scan-assembler "bla.*fffefec0" } } */ diff --git a/gcc/testsuite/obj-c++.dg/objc-fast-2.mm b/gcc/testsuite/obj-c++.dg/objc-fast-2.mm new file mode 100644 index 00000000000..61e97adad3a --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/objc-fast-2.mm @@ -0,0 +1,29 @@ +/* APPLE LOCAL file ObjC direct dispatch */ +/* A compile-only test for insertion of 'ba' sibcall comm page jumps. */ +/* Developed by Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-fnext-runtime -fobjc-gc -fobjc-direct-dispatch -Wno-assign-intercept -O2" } */ + +#include <objc/Object.h> + +@interface Derived: Object { +@public + Object *other; +} +@end + +void foo(void) { + Derived *o; + o->other = 0; /* sibcall to objc_assign_ivar_Fast() */ +} + +void bar(void) { + Derived *o = nil; + [Derived new]; /* sibcall to objc_msgSend_Fast() */ +} + +/* { dg-final { scan-assembler-not "objc_msgSend" } } */ +/* { dg-final { scan-assembler-not "objc_assign_ivar" } } */ + +/* { dg-final { scan-assembler "ba.*fffeff00" } } */ +/* { dg-final { scan-assembler "ba.*fffefec0" } } */ diff --git a/gcc/testsuite/obj-c++.dg/objc-fast-3.mm b/gcc/testsuite/obj-c++.dg/objc-fast-3.mm new file mode 100644 index 00000000000..fc57f831eef --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/objc-fast-3.mm @@ -0,0 +1,33 @@ +/* APPLE LOCAL file ObjC direct dispatch */ +/* A compile-only test for insertion of 'bla' and 'ba' sibcall comm page jumps + for methods returning 'void'. */ +/* Developed by Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-fnext-runtime -fobjc-gc -fobjc-direct-dispatch -Wno-assign-intercept -O2" } */ + +#include <objc/Object.h> + +@interface Derived: Object { +@public + Object *other; +} +- (void) do_nothing; +@end + +int a; + +void foo(void) { + Derived *o; + [o do_nothing]; /* objc_msgSend_Fast() */ + a = 2; +} + +void bar(void) { + Derived *o = nil; + [o do_nothing]; /* sibcall to objc_msgSend_Fast() */ +} + +/* { dg-final { scan-assembler-not "objc_msgSend" } } */ + +/* { dg-final { scan-assembler "bla.*fffeff00" } } */ +/* { dg-final { scan-assembler "ba.*fffeff00" } } */ diff --git a/gcc/testsuite/obj-c++.dg/objc-fast-4.mm b/gcc/testsuite/obj-c++.dg/objc-fast-4.mm new file mode 100644 index 00000000000..67e8a998bc4 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/objc-fast-4.mm @@ -0,0 +1,13 @@ +/* APPLE LOCAL file ObjC direct dispatch */ +/* Check that 4015820 is fixed. That does not appear except + with -O0, so the sibcall case cannot occur. */ +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-O0 -fobjc-direct-dispatch" } */ +#include <objc/Object.h> + +void foo(void) { + Object *o; + [o++ free]; +} +/* { dg-final { scan-assembler-not "objc_msgSend" } } */ +/* { dg-final { scan-assembler "bla.*fffeff00" } } */ diff --git a/gcc/testsuite/obj-c++.dg/objc-gc-1.mm b/gcc/testsuite/obj-c++.dg/objc-gc-1.mm new file mode 100644 index 00000000000..ed9a8b1ac13 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/objc-gc-1.mm @@ -0,0 +1,146 @@ +/* APPLE LOCAL file ObjC GC */ +/* A compile-only test for insertion of write barriers. */ +/* Developed by Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-fnext-runtime -fobjc-gc -Wassign-intercept" } */ + +#ifndef __OBJC_GC__ +#error Missing __OBJC_GC__ manifest constant +#endif + +#include <objc/Object.h> + +@class Underspecified; +@class MyClass; + +@interface AnotherClass: Object { +@public + __strong void *storage; + MyClass *SomeObj; +} +- (id)assignObj:(id)obj; +@end + +struct Struct1 { + MyClass *someobj; + void *obj2; + __strong void *obj3; +}; + +struct Struct1 *str1a, str1aa; +__strong struct Struct1 *str1b, str1bb, **str1c, *str1d[3][3]; + +extern MyClass *externFunc(void); + +@interface MyClass: Object { +@public + id ivar1, *ivar1a; + void *ivar2; + __strong void *ivar3; + Underspecified *ivar4[2], **ivar4a; + union { + struct { + Underspecified *data; + const unsigned char *dataBytes; + } d; + struct { + __strong void *storage; + AnotherClass *another; + } s; + } contents; + struct { + struct { + void *yy; + } z; + } y; +} +@end + +@implementation AnotherClass +- (id)assignObj:(id)obj { + static MyClass *m_myclass; + static id *indirect; + str1a = 0; + str1b = 0; /* { dg-warning "global\\/static variable assignment" } */ + str1c = 0; /* { dg-warning "global\\/static variable assignment" } */ + str1d[1][1] = 0; /* { dg-warning "global\\/static variable assignment" } */ + str1a->someobj = 0; /* { dg-warning "strong\\-cast may possibly be needed" } */ + str1b->someobj = 0; /* { dg-warning "strong\\-cast may possibly be needed" } */ + str1aa.someobj = 0; /* { dg-warning "global\\/static variable assignment" } */ + str1bb.someobj = 0; /* { dg-warning "global\\/static variable assignment" } */ + str1a->obj2 = 0; + str1b->obj2 = 0; + str1a->obj3 = 0; /* { dg-warning "strong\\-cast may possibly be needed" } */ + str1b->obj3 = 0; /* { dg-warning "strong\\-cast may possibly be needed" } */ + SomeObj->contents.s.another = 0; /* { dg-warning "instance variable assignment" } */ + obj = 0; + externFunc()->ivar1 = 0; /* { dg-warning "instance variable assignment" } */ + externFunc()->contents.s.another->SomeObj = 0; /* { dg-warning "instance variable assignment" } */ + m_myclass = 0; /* { dg-warning "global\\/static variable assignment" } */ + *indirect = obj; /* { dg-warning "strong\\-cast may possibly be needed" } */ + (__strong id)*indirect = obj; /* { dg-warning "strong\\-cast assignment" } */ + (__strong id)(MyClass *)*indirect = obj; /* { dg-warning "strong\\-cast assignment" } */ + self = 0; + self->isa = 0; /* { dg-warning "instance variable assignment" } */ + return SomeObj = obj; /* { dg-warning "instance variable assignment" } */ +} +@end + +typedef MyClass MyClass1; +@compatibility_alias MyClass2 MyClass; + +MyClass *g_myclass; +MyClass1 *g_myclass1; +MyClass2 *g_myclass2; +MyClass2 **g_myclass2a, ***g_myclass2b; +MyClass2 *g_myclass2c[6], *g_myclass2d[4][5]; +__strong void *g_myclass2e[3]; + +id *g_myid, ***g_myid3; + +void function(void) { + static MyClass *l_myclass; + MyClass2 *l_myclass2; + + g_myclass = 0; /* { dg-warning "global\\/static variable assignment" } */ + l_myclass = 0; /* { dg-warning "global\\/static variable assignment" } */ + g_myclass->ivar1 = 0; /* { dg-warning "instance variable assignment" } */ + *g_myclass->ivar1a = 0; + l_myclass2 = 0; + l_myclass2->ivar1 = 0; /* { dg-warning "instance variable assignment" } */ + (__strong id)*g_myclass->ivar1a = 0; /* { dg-warning "strong\\-cast assignment" } */ + g_myclass->ivar2 = 0; + (__strong void *)g_myclass->ivar2 = 0; /* { dg-warning "strong\\-cast assignment" } */ + g_myclass->ivar3 = 0; /* { dg-warning "instance variable assignment" } */ + l_myclass->ivar4[1] = 0; /* { dg-warning "instance variable assignment" } */ + l_myclass->ivar4a = 0; + *l_myclass->ivar4a = 0; + (__strong id)*l_myclass->ivar4a = 0; /* { dg-warning "strong\\-cast assignment" } */ + l_myclass->contents.d.data = 0; /* { dg-warning "instance variable assignment" } */ + l_myclass->contents.d.dataBytes = 0; + (__strong const unsigned char *)l_myclass->contents.d.dataBytes = 0; /* { dg-warning "strong\\-cast assignment" } */ + l_myclass->contents.s.storage = 0; /* { dg-warning "instance variable assignment" } */ + l_myclass->contents.s.another->SomeObj = 0; /* { dg-warning "instance variable assignment" } */ + l_myclass->contents.s.another->storage = 0; /* { dg-warning "instance variable assignment" } */ + (__strong void *)l_myclass->contents.s.another->storage = 0; /* { dg-warning "strong\\-cast assignment" } */ + g_myclass->y.z.yy = 0; + (__strong void *)g_myclass->y.z.yy = 0; /* { dg-warning "strong\\-cast assignment" } */ + g_myclass1->ivar1 = 0; /* { dg-warning "instance variable assignment" } */ + g_myclass2->ivar1 = 0; /* { dg-warning "instance variable assignment" } */ + (*g_myclass2a)->ivar1 = 0; /* { dg-warning "instance variable assignment" } */ + *g_myid = 0; /* { dg-warning "strong\\-cast may possibly be needed" } */ + ***g_myid3 = 0; /* { dg-warning "strong\\-cast may possibly be needed" } */ + (__strong id)*g_myid = 0; /* { dg-warning "strong\\-cast assignment" } */ + (__strong id)***g_myid3 = 0; /* { dg-warning "strong\\-cast assignment" } */ + g_myclass2[3] = g_myclass1[4]; + g_myclass2a[1] = 0; /* { dg-warning "strong\\-cast may possibly be needed" } */ + g_myclass2b[1][2] = 0; /* { dg-warning "strong\\-cast may possibly be needed" } */ + g_myclass2c[1] = 0; /* { dg-warning "global\\/static variable assignment" } */ + g_myclass2e[1] = 0; /* { dg-warning "global\\/static variable assignment" } */ + g_myclass2d[1][2] = 0; /* { dg-warning "global\\/static variable assignment" } */ + g_myclass2a[1]->ivar1 = 0; /* { dg-warning "instance variable assignment" } */ + g_myclass2b[1][2]->ivar1 = 0; /* { dg-warning "instance variable assignment" } */ + g_myclass2c[1]->ivar1 = 0; /* { dg-warning "instance variable assignment" } */ + g_myclass2d[1][2]->ivar1 = 0; /* { dg-warning "instance variable assignment" } */ +} + diff --git a/gcc/testsuite/obj-c++.dg/objc-gc-2.mm b/gcc/testsuite/obj-c++.dg/objc-gc-2.mm new file mode 100644 index 00000000000..a85e3ba14ed --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/objc-gc-2.mm @@ -0,0 +1,60 @@ +/* APPLE LOCAL file ObjC GC */ +/* A compile-only test for insertion of write barriers. */ +/* Developed by Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile } */ +/* { dg-options "-fnext-runtime -fobjc-gc -Wassign-intercept" } */ + +#include <objc/objc.h> + +struct NSRect { + void *a; + id b; + __strong void *c; + __strong id *d; +}; + +@protocol WebCoreImageRenderer +- (void)drawImageInRect:(NSRect)ir fromRect:(NSRect)fr; +- (void)release; +- (void)new; +- (BOOL)isNull; +- (id <WebCoreImageRenderer>)copyWithZone:(int)z; +- (id <WebCoreImageRenderer>)retainOrCopyIfNeeded; +@end + +typedef id <WebCoreImageRenderer> WebCoreImageRendererPtr; + +class QPixmap { +public: + QPixmap() {} + ~QPixmap() {} + + void resize(int w, int h); + +public: + WebCoreImageRendererPtr imageRenderer; + __strong void *somePtr; + mutable bool needCopyOnWrite; +}; + +void inline_func(void) { + QPixmap *pix; + + pix->imageRenderer = 0; /* { dg-warning "strong\\-cast may possibly be needed" } */ + pix->somePtr = 0; /* { dg-warning "strong\\-cast may possibly be needed" } */ + (__strong id)pix->somePtr = 0; /* { dg-warning "strong\\-cast assignment" } */ + (__strong id)pix->imageRenderer = 0; /* { dg-warning "strong\\-cast assignment" } */ +} + +void QPixmap::resize(int w, int h) +{ + if (needCopyOnWrite) { + id <WebCoreImageRenderer> newImageRenderer = [imageRenderer copyWithZone:0]; + [imageRenderer release]; + imageRenderer = newImageRenderer; /* { dg-warning "strong\\-cast may possibly be needed" } */ + somePtr = 0; /* { dg-warning "strong\\-cast may possibly be needed" } */ + (__strong id)imageRenderer = newImageRenderer; /* { dg-warning "strong\\-cast assignment" } */ + needCopyOnWrite = false; + } + [imageRenderer new]; +} diff --git a/gcc/testsuite/obj-c++.dg/objc-gc-3.mm b/gcc/testsuite/obj-c++.dg/objc-gc-3.mm new file mode 100644 index 00000000000..329ee601a87 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/objc-gc-3.mm @@ -0,0 +1,64 @@ +/* APPLE LOCAL file mainline */ +/* Test looking up fields in superclasses in the context of write-barriers + (where component references get rewritten). */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-fobjc-gc" } */ + +#include <objc/Object.h> + +@class MyWindow; + +@interface MyDocument : Object { + MyWindow *_window; +} +@end + +@interface MyFileDocument : MyDocument { + struct { + unsigned int autoClose:1; + unsigned int openForUI:1; + unsigned int isClosing:1; + unsigned int needsDiskCheck:1; + unsigned int isWritable:1; + unsigned int representsFileOnDisk:1; + unsigned int RESERVED:26; + } _fdFlags; +} +@end + +@interface MyTextFileDocument : MyFileDocument { + Object *_textStorage; + struct __tfdFlags { + unsigned int immutable:1; + unsigned int lineEnding:2; + unsigned int isClosing:1; + unsigned int settingsAreSet:1; + unsigned int usesTabs:1; + unsigned int isUTF8WithBOM:1; + unsigned int wrapsLines:1; + unsigned int usingDefaultLanguage:1; + unsigned int RESERVED:23; + } _tfdFlags; + int _tabWidth; + int _indentWidth; +} +@end + +@interface MyRTFFileDocument : MyTextFileDocument +- (BOOL)readFromFile:(const char *)fileName ofType:(const char *)type; +@end + +@implementation MyRTFFileDocument +- (BOOL)readFromFile:(const char *)fileName ofType:(const char *)type { + if (_textStorage && fileName) { + [_textStorage free]; + return YES; + } else if (type) { + _textStorage = [MyRTFFileDocument new]; + return NO; + } + return (fileName && type); +} +@end diff --git a/gcc/testsuite/obj-c++.dg/overload-1.mm b/gcc/testsuite/obj-c++.dg/overload-1.mm new file mode 100644 index 00000000000..bca9fe92218 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/overload-1.mm @@ -0,0 +1,11 @@ +// APPLE LOCAL file mainline +// Make sure we can overload on ObjC classes +// Radar 3960754 +// { dg-do compile } + +@class A, B; + +struct X { + void call(A*); + void call(B*); +}; diff --git a/gcc/testsuite/obj-c++.dg/pascal-strings-1.mm b/gcc/testsuite/obj-c++.dg/pascal-strings-1.mm new file mode 100644 index 00000000000..7c7cf8139ed --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/pascal-strings-1.mm @@ -0,0 +1,20 @@ +/* APPLE LOCAL file pascal strings */ +/* Ensure that there are no warnings or errors issued when a Pascal string is used to + initialize an array and the NUL terminator does not fit. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-do compile } */ +/* { dg-options "-fpascal-strings" } */ + +typedef unsigned char Str15[16]; + +Str15 ggg = "\p012345678901234"; +Str15 hhh = "\p0123456789012345"; /* { dg-error "initializer.string for array of chars is too long" } */ + +int foo(void) +{ + Str15 sss = "\p012345678901234"; + Str15 ttt = "\p0123456789012345"; /* { dg-error "initializer.string for array of chars is too long" } */ + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/pascal-strings-2.mm b/gcc/testsuite/obj-c++.dg/pascal-strings-2.mm new file mode 100644 index 00000000000..ef336990455 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/pascal-strings-2.mm @@ -0,0 +1,20 @@ +/* APPLE LOCAL file pascal strings */ +/* Ensure that Pascal strings do not get confused with ordinary C strings when + -funsigned-char is being used. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-do compile } */ +/* { dg-options "-fpascal-strings -funsigned-char" } */ + +typedef unsigned char Str15[16]; + +Str15 ggg = "\p012345678901234"; +Str15 hhh = "0123456789012345"; /* { dg-error "initializer.string for array of chars is too long" } */ + +int foo(void) +{ + Str15 sss = "\p012345678901234"; + Str15 ttt = "0123456789012345"; /* { dg-error "initializer.string for array of chars is too long" } */ + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/pragma-1.mm b/gcc/testsuite/obj-c++.dg/pragma-1.mm new file mode 100644 index 00000000000..098e96bb820 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/pragma-1.mm @@ -0,0 +1,12 @@ +/* APPLE LOCAL file mainline */ +/* It is OK to use #pragma inside @interface body. This test checks that. */ +/* Devang Patel <dpatel@apple.com>. */ + +@interface A +{ + int p; +} ++(int) foo; +#pragma Mark foobar +-(int) bar; +@end diff --git a/gcc/testsuite/obj-c++.dg/pragma-2.mm b/gcc/testsuite/obj-c++.dg/pragma-2.mm new file mode 100644 index 00000000000..ab354582be6 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/pragma-2.mm @@ -0,0 +1,24 @@ +/* APPLE LOCAL file mainline */ +/* It is OK to use #pragma inside @implementation body. This test checks that. */ +/* Ziemowit Laski <zlaski@apple.com>. */ + +@interface A +{ + int p; +} ++(int) foo; +-(int) bar; +@end + +@implementation A +#pragma mark - +#pragma mark init / dealloc ++ (int)foo { + return 1; +} +#pragma mark - +#pragma mark Private Functions +- (int)bar { + return 2; +} +@end diff --git a/gcc/testsuite/obj-c++.dg/private-1.mm b/gcc/testsuite/obj-c++.dg/private-1.mm new file mode 100644 index 00000000000..6f65be26fac --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/private-1.mm @@ -0,0 +1,59 @@ +/* APPLE LOCAL file mainline */ +/* Test errors for accessing @private and @protected variables. */ +/* Based on work by: Nicola Pero <nicola@brainstorm.co.uk>. */ +/* { dg-do compile } */ +#include <objc/objc.h> + +@interface MySuperClass +{ +@private + int _private; + +@protected + int _protected; + +@public + int _public; +} +- (void) test; +@end + +@implementation MySuperClass +- (void) test +{ + _private = 12; /* Ok */ + _protected = 12; /* Ok */ + _public = 12; /* Ok */ +} +@end + + +@interface MyClass : MySuperClass +@end + +@implementation MyClass +- (void) test +{ + /* Private variables simply don't exist in the subclass. */ + _private = 12; /* { dg-error "._private. was not declared in this scope" } */ + + _protected = 12; /* Ok */ + _public = 12; /* Ok */ +} +@end + +int main (void) +{ + MyClass *m = nil; + + if (m != nil) + { + int access; + + access = m->_private; /* { dg-error "is @private" } */ + access = m->_protected; /* { dg-error "is @protected" } */ + access = m->_public; /* Ok */ + } + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/private-2.mm b/gcc/testsuite/obj-c++.dg/private-2.mm new file mode 100644 index 00000000000..d7ec62fcb00 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/private-2.mm @@ -0,0 +1,55 @@ +/* APPLE LOCAL file mainline */ +/* Test warnings for shadowing instance variables. */ +/* Based on work by: Nicola Pero <nicola@brainstorm.co.uk>. */ +/* { dg-do compile } */ +#include <objc/objc.h> + +@interface MySuperClass +{ +@private + int _private; + +@protected + int _protected; + +@public + int _public; +} +- (void) test; +@end + +@implementation MySuperClass +- (void) test +{ + /* FIXME: I wonder if the warnings shouldn't be better generated + when the variable is declared, rather than used! */ + int _private = 12; + int _protected = 12; + int _public = 12; + int a; + + a = _private; /* { dg-warning "hides instance variable" } */ + a = _protected; /* { dg-warning "hides instance variable" } */ + a = _public; /* { dg-warning "hides instance variable" } */ +} +@end + + +@interface MyClass : MySuperClass +@end + +@implementation MyClass +- (void) test +{ + int _private = 12; + int _protected = 12; + int _public = 12; + int a; + + /* The private variable can be shadowed without warnings, because + * it's invisible, and not accessible, to the subclass! */ + a = _private; /* Ok */ + a = _protected; /* { dg-warning "hides instance variable" } */ + a = _public; /* { dg-warning "hides instance variable" } */ +} +@end diff --git a/gcc/testsuite/obj-c++.dg/proto-lossage-1.mm b/gcc/testsuite/obj-c++.dg/proto-lossage-1.mm new file mode 100644 index 00000000000..20af5472c81 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/proto-lossage-1.mm @@ -0,0 +1,45 @@ +/* APPLE LOCAL file mainline */ +/* Test for situations in which protocol conformance information + may be lost, leading to superfluous warnings. */ +/* Author: Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-do compile } */ + +/* One-line substitute for objc/objc.h */ +typedef struct objc_object { struct objc_class *class_pointer; } *id; + +@protocol NSObject +- (int)someValue; +@end + +@interface NSObject <NSObject> +@end + +@protocol PlateMethods +- (void)someMethod; +@end + +@interface Foo { + NSObject <PlateMethods> *plate; + id <PlateMethods> plate1; + NSObject *plate2; +} +- (id <PlateMethods>) getPlate; +- (id <NSObject>) getPlate1; +- (int) getValue; +@end + +@implementation Foo +- (id <PlateMethods>) getPlate { + return plate; /* { dg-bogus "does not implement" } */ +} +- (id <NSObject>) getPlate1 { + return (id <NSObject>)plate1; /* { dg-bogus "does not conform" } */ +} +- (int) getValue { + int i = [plate1 someValue]; /* { dg-warning ".\\-someValue. not found in protocol\\(s\\)" } */ + + int j = [(id <NSObject>)plate1 someValue]; /* { dg-bogus "not found in protocol" } */ + int k = [(id)plate1 someValue]; /* { dg-bogus "not found in protocol" } */ + return i + j + k; +} +@end diff --git a/gcc/testsuite/obj-c++.dg/proto-lossage-2.mm b/gcc/testsuite/obj-c++.dg/proto-lossage-2.mm new file mode 100644 index 00000000000..12ec9c7b6f9 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/proto-lossage-2.mm @@ -0,0 +1,21 @@ +/* APPLE LOCAL file mainline */ +/* Don't forget to look in protocols if a class (and its superclasses) do not + provide a suitable method. */ +/* { dg-do compile } */ + +#include <objc/Object.h> + +@protocol Zot +-(void) zot; +@end + +@interface Foo : Object <Zot> +@end + +int foo() +{ + Foo *f=nil; + [f zot]; /* There should be no warnings here! */ + return 0; +} + diff --git a/gcc/testsuite/obj-c++.dg/proto-lossage-3.mm b/gcc/testsuite/obj-c++.dg/proto-lossage-3.mm new file mode 100644 index 00000000000..47a5609658d --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/proto-lossage-3.mm @@ -0,0 +1,26 @@ +/* APPLE LOCAL file mainline */ +/* Crash due to descriptionFor(Instance|Class)Method applied to + a protocol with no instance/class methods respectively. + Problem report and original fix by richard@brainstorm.co.uk. */ +/* { dg-do run } */ +#include <objc/objc.h> +#include <objc/Object.h> +#include <objc/Protocol.h> + +@protocol NoInstanceMethods ++ testMethod; +@end + +@protocol NoClassMethods +- testMethod; +@end + +int +main() +{ +[@protocol(NoInstanceMethods) descriptionForInstanceMethod: @selector(name)]; +[@protocol(NoInstanceMethods) descriptionForClassMethod: @selector(name)]; +[@protocol(NoClassMethods) descriptionForInstanceMethod: @selector(name)]; +[@protocol(NoClassMethods) descriptionForClassMethod: @selector(name)]; +return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/proto-lossage-4.mm b/gcc/testsuite/obj-c++.dg/proto-lossage-4.mm new file mode 100644 index 00000000000..4e57d2bda4c --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/proto-lossage-4.mm @@ -0,0 +1,52 @@ +/* APPLE LOCAL file mainline */ /* Test for situations in which protocol conformance information + may be lost while casting. */ +/* Author: Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-do compile } */ + +/* One-line substitute for objc/objc.h */ +typedef struct objc_object { struct objc_class *class_pointer; } *id; + +@protocol Proto +- (long)someValue; +@end + +@interface Obj +- (long)anotherValue; +@end + +long foo(void) { + long receiver = 2; + Obj *objrcvr; + Obj <Proto> *objrcvr2; + + /* NB: Since 'receiver' is an invalid ObjC message receiver, the compiler + should warn but then search for methods as if we were messaging 'id'. */ + + receiver += [receiver someValue]; /* { dg-warning "invalid receiver type .long int." } */ + receiver += [receiver anotherValue]; /* { dg-warning "invalid receiver type .long int." } */ + + receiver += [(Obj *)receiver someValue]; /* { dg-warning ".Obj. may not respond to .\\-someValue." } */ +/* { dg-error "invalid conversion" "" { target *-*-* } 28 } */ + + receiver += [(Obj *)receiver anotherValue]; + receiver += [(Obj <Proto> *)receiver someValue]; + receiver += [(Obj <Proto> *)receiver anotherValue]; + receiver += [objrcvr someValue]; /* { dg-warning ".Obj. may not respond to .\\-someValue." } */ +/* { dg-error "invalid conversion" "" { target *-*-* } 34 } */ + + receiver += [objrcvr anotherValue]; + receiver += [(Obj <Proto> *)objrcvr someValue]; + receiver += [(Obj <Proto> *)objrcvr anotherValue]; + receiver += [objrcvr2 someValue]; + receiver += [objrcvr2 anotherValue]; + receiver += [(Obj *)objrcvr2 someValue]; /* { dg-warning ".Obj. may not respond to .\\-someValue." } */ +/* { dg-warning "invalid conversion" "" { target *-*-* } 42 } */ + + receiver += [(Obj *)objrcvr2 anotherValue]; + + return receiver; +} + +/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */ +/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */ +/* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/obj-c++.dg/proto-lossage-5.mm b/gcc/testsuite/obj-c++.dg/proto-lossage-5.mm new file mode 100644 index 00000000000..c257411561f --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/proto-lossage-5.mm @@ -0,0 +1,23 @@ +/* APPLE LOCAL file mainline */ +/* Do not lose references to forward-declared protocols. */ +/* { dg-do compile } */ +@class MyBaseClass; +@class MyClassThatFails; +@protocol _MyProtocol; + +@interface MyClassThatFails +- (MyBaseClass<_MyProtocol> *) aMethod; +@end + +@interface MyBaseClass +@end + +@protocol _MyProtocol +@end + +@implementation MyClassThatFails +- (MyBaseClass<_MyProtocol> *) aMethod +{ + return 0; +} +@end diff --git a/gcc/testsuite/obj-c++.dg/proto-qual-1.mm b/gcc/testsuite/obj-c++.dg/proto-qual-1.mm new file mode 100644 index 00000000000..aa13fb98b9c --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/proto-qual-1.mm @@ -0,0 +1,52 @@ +// APPLE LOCAL file mainline +/* Check that protocol qualifiers are compiled and encoded properly. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do run } */ + +#include <objc/Protocol.h> +#ifndef __NEXT_RUNTIME__ +#include <objc/objc-api.h> +#endif +#include <stdio.h> +#include <stdlib.h> + +/* The encoded parameter sizes will be rounded up to match pointer alignment. */ +#define ROUND(s,a) (a * ((s + a - 1) / a)) +#define aligned_sizeof(T) ROUND(sizeof(T),__alignof(void *)) + +#define CHECK_IF(expr) if(!(expr)) abort() + +@protocol Retain ++ (oneway void)retainArgument:(out bycopy id)arg1 with:(in signed char **)arg2; +- (bycopy) address:(byref inout id)location with:(out short unsigned **)arg2; +@end + +@interface Foo <Retain> ++ (oneway void)retainArgument:(out bycopy id)arg with:(in signed char **)arg2; +@end + +@implementation Foo ++ (oneway void)retainArgument:(out bycopy id)arg1 with:(in signed char **)arg2 { } +- (bycopy) address:(byref inout id)location with:(out short unsigned **)arg2 { return nil; } +@end + +Protocol *proto = @protocol(Retain); +struct objc_method_description *meth; +unsigned totsize, offs0, offs1, offs2, offs3, offs4, offs5, offs6, offs7; + +static void scan_initial(const char *pattern) { + totsize = offs0 = offs1 = offs2 = offs3 = offs4 = offs5 = offs6 = offs7 = (unsigned)-1; + sscanf(meth->types, pattern, &totsize, &offs0, &offs1, &offs2, &offs3, + &offs4, &offs5, &offs6, &offs7); + CHECK_IF(!offs0 && offs1 == aligned_sizeof(id) && offs2 == offs1 + aligned_sizeof(SEL) && totsize >= offs2); +} + +int main(void) { + meth = [proto descriptionForInstanceMethod: @selector(address:with:)]; + scan_initial("O@%u@%u:%uNR@%uo^^S%u"); + CHECK_IF(offs3 == offs2 + aligned_sizeof(id) && totsize == offs3 + aligned_sizeof(unsigned)); + meth = [proto descriptionForClassMethod: @selector(retainArgument:with:)]; + scan_initial("Vv%u@%u:%uOo@%un^*%u"); + CHECK_IF(offs3 == offs2 + aligned_sizeof(id) && totsize == offs3 + aligned_sizeof(char **)); + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/qual-types-1.mm b/gcc/testsuite/obj-c++.dg/qual-types-1.mm new file mode 100644 index 00000000000..4aef33d6dc5 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/qual-types-1.mm @@ -0,0 +1,72 @@ +/* APPLE LOCAL file mainline */ +/* Test if ObjC++ can distinguish protocol qualifiers from + template arguments. */ +/* Author: Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-do run } */ + +#include <objc/Object.h> +#include <stdlib.h> + +#define CHECK_IF(expr) if(!(expr)) abort() + +@protocol Zone ++ allocFromZone:(void *)zone; +- copyFromZone:(void *)zone; +@end + +@protocol Init <Zone> ++ initialize; +- init; +@end + +@interface Foo: Object +{ @public int val; } +- init; +@end + +template <class T, class U> struct X { + T x; U y; +}; + +X<int, float> xx; + +template <typename T> struct Holder +{ + T *obj; + static int counter; + Holder(void) { obj = [[T alloc] init]; } + ~Holder(void) { [obj free]; --counter; } + id <Init, Zone> getObjId(void) { return obj; } + Object <Zone, Init> *getObj(void) { return obj; } +}; + +typedef Holder <Foo <Init, Zone> > FooHolder; + +@implementation Foo +-(id) init { + [super init]; + val = ++FooHolder::counter; + return self; +} +@end + +template <typename T> +int Holder<T>::counter = 0; + +int main (void) { + CHECK_IF(FooHolder::counter == 0); + { + FooHolder holder; + CHECK_IF(holder.obj->val == 1); + CHECK_IF(FooHolder::counter == 1); + FooHolder holder2; + CHECK_IF(holder2.obj->val == 2); + CHECK_IF(FooHolder::counter == 2); + } + CHECK_IF(FooHolder::counter == 0); + return 0; +} + + + + diff --git a/gcc/testsuite/obj-c++.dg/selector-1.mm b/gcc/testsuite/obj-c++.dg/selector-1.mm new file mode 100644 index 00000000000..a4f2b442b7e --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/selector-1.mm @@ -0,0 +1,32 @@ +/* APPLE LOCAL file mainline */ +/* Test whether including C++ keywords such as 'and', 'or', + 'not', etc., is allowed inside ObjC selectors (as it must be). */ +/* Author: Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-do compile } */ + + +@interface Int1 ++ (int)and_eq:(int)arg1 and:(int)arg2; +- (int)or_eq:(int)arg1 or:(int)arg3; +- (int)not:(int)arg1 xor:(int)arg2; +- (void)bitand:(char)c1 bitor:(char)c2; +- (void)compl:(float)f1 xor_eq:(double)d1; +- (void)not_eq; +@end + +@implementation Int1 ++ (int)and_eq:(int)arg1 and:(int)arg2 { return arg1 + arg2; } +- (int)or_eq:(int)arg1 or:(int)arg3 { return arg1 + arg3; } +- (int)not:(int)arg1 xor:(int)arg2 { return arg1 + arg2; } +- (void)bitand:(char)c1 bitor:(char)c2 { } +- (void)compl:(float)f1 xor_eq:(double)d1 { } +- (void)not_eq { } +@end + +/* { dg-final { scan-assembler "\\+\\\[Int1 and_eq:and:\\]|c_Int1__and_eq_and" } } */ +/* { dg-final { scan-assembler "\\-\\\[Int1 or_eq:or:\\]|i_Int1__or_eq_or" } } */ +/* { dg-final { scan-assembler "\\-\\\[Int1 not:xor:\\]|i_Int1__not_xor" } } */ +/* { dg-final { scan-assembler "\\-\\\[Int1 bitand:bitor:\\]|i_Int1__bitand_bitor" } } */ +/* { dg-final { scan-assembler "\\-\\\[Int1 compl:xor_eq:\\]|i_Int1__compl_xor_eq" } } */ +/* { dg-final { scan-assembler "\\-\\\[Int1 not_eq\\]|i_Int1__not_eq" } } */ + diff --git a/gcc/testsuite/obj-c++.dg/selector-2.mm b/gcc/testsuite/obj-c++.dg/selector-2.mm new file mode 100644 index 00000000000..97ff03d78aa --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/selector-2.mm @@ -0,0 +1,18 @@ +/* APPLE LOCAL file mainline */ +/* Test that we don't ICE when issuing a -Wselector warning. */ +/* { dg-options "-Wselector" } */ +/* { dg-do compile } */ + +#include <objc/Object.h> + +@interface Foo +@end +@implementation Foo +-(void) foo +{ + SEL a; + a = @selector(b1ar); +} +@end +/* { dg-warning "creating selector for nonexistent method .b1ar." "" { target *-*-* } 0 } */ + diff --git a/gcc/testsuite/obj-c++.dg/selector-3.mm b/gcc/testsuite/obj-c++.dg/selector-3.mm new file mode 100644 index 00000000000..7ac1d2aff87 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/selector-3.mm @@ -0,0 +1,27 @@ +/* APPLE LOCAL file mainline */ +/* Test warning for non-existent selectors. */ +/* This is the "-fgnu-runtime" variant of objc.dg/selector-1.m. */ +/* { dg-options "-Wselector -fgnu-runtime" } */ +/* { dg-do compile } */ + +typedef struct objc_object { struct objc_class *class_pointer; } *id; +typedef const struct objc_selector *SEL; + +@interface Foo +- (void) foo; +- (void) bar; +@end + +@implementation Foo +- (void) bar +{ +} + +- (void) foo +{ + SEL a,b,c; + a = @selector(b1ar); + b = @selector(bar); +} +@end /* { dg-warning "creating selector for nonexistent method .b1ar." } */ + diff --git a/gcc/testsuite/obj-c++.dg/selector-4.mm b/gcc/testsuite/obj-c++.dg/selector-4.mm new file mode 100644 index 00000000000..5072615a5d5 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/selector-4.mm @@ -0,0 +1,27 @@ +/* APPLE LOCAL file mainline */ +/* Test warning for non existing selectors. */ +/* Contributed by Devang Patel <dpatel@apple.com>. */ + +/* { dg-options "-Wselector -fnext-runtime" } */ +/* { dg-do compile } */ + +typedef struct objc_object { struct objc_class *class_pointer; } *id; +typedef struct objc_selector *SEL; + +@interface Foo +- (void) foo; +- (void) bar; +@end + +@implementation Foo +- (void) bar +{ +} + +- (void) foo +{ + SEL a,b,c; + a = @selector(b1ar); /* { dg-warning "creating selector for nonexistent method .b1ar." } */ + b = @selector(bar); +} +@end diff --git a/gcc/testsuite/obj-c++.dg/stubify-1.mm b/gcc/testsuite/obj-c++.dg/stubify-1.mm new file mode 100644 index 00000000000..50d9b35aec1 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/stubify-1.mm @@ -0,0 +1,37 @@ +/* APPLE LOCAL file mainline */ +/* All calls must be properly stubified. Complain about any "call + _objc_msgSend<end-of-line>" without the $stub suffix. */ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-Os -mdynamic-no-pic -fno-exceptions" } */ + +typedef struct objc_object { } *id ; +int x = 41 ; + +extern "C" { + extern id objc_msgSend(id self, char * op, ...); + extern int bogonic (int, int, int); +} + +@interface Document {} +- (Document *) window; +- (Document *) class; +- (Document *) close; +@end +@implementation Document +- (Document *) class { } +- (Document *) close { } +- (Document *) window { } +- (void)willEndCloseSheet:(void *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { + [[self window] close]; + ((void (*)(id, char *, int))objc_msgSend)([self class], (char *)contextInfo, 1); + ((void (*)(id, char *, int))bogonic)([self class], (char *)contextInfo, 1); + bogonic (3, 4, 5); + x++; +} +@end + +/* { dg-final { scan-assembler-not "\(bl|call\)\[ \t\]+_objc_msgSend\n" } } */ +/* { dg-final { scan-assembler "\(bl|call\)\[ \t\]+L_objc_msgSend\\\$stub\n" } } */ +/* { dg-final { scan-assembler-not "\(bl|call\)\[ \t\]+_bogonic\n" } } */ +/* { dg-final { scan-assembler "\(bl|call\)\[ \t\]+L_bogonic\\\$stub\n" } } */ +/* { dg-final { scan-assembler-not "\\\$non_lazy_ptr" } } */ diff --git a/gcc/testsuite/obj-c++.dg/stubify-2.mm b/gcc/testsuite/obj-c++.dg/stubify-2.mm new file mode 100644 index 00000000000..a4789434d51 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/stubify-2.mm @@ -0,0 +1,30 @@ +/* APPLE LOCAL file mainline */ +/* All calls must be properly stubified. */ +/* Testcase extracted from TextEdit:Document.m. */ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-mdynamic-no-pic -fdump-rtl-expand" } */ +typedef struct objc_object { } *id ; +int x = 41 ; +extern id objc_msgSend(id self, char * op, ...); +extern int bogonic (int, int, int) ; +@interface Document {} +- (Document *) window; +- (Document *) class; +- (Document *) close; +@end +@implementation Document +- (Document *) class { } +- (Document *) close { } +- (Document *) window { } +- (void)willEndCloseSheet:(void *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { + [[self window] close]; + ((void (*)(id, char *, int))objc_msgSend)([self class], (char *)contextInfo, 1); + ((void (*)(id, char *, int))bogonic)([self class], (char *)contextInfo, 1); + bogonic (3, 4, 5); + x++; +} +@end + +/* Any symbol_ref of an un-stubified objc_msgSend is an error; look + for "objc_msgSend" in quotes, without the $stub suffix. */ +/* { dg-final { scan-file-not stubify-2.mm.00.expand "symbol_ref.*\"objc_msgSend\"" } } */ diff --git a/gcc/testsuite/obj-c++.dg/super-class-1.mm b/gcc/testsuite/obj-c++.dg/super-class-1.mm new file mode 100644 index 00000000000..3ab5a25a896 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/super-class-1.mm @@ -0,0 +1,30 @@ +/* APPLE LOCAL file mainline */ +/* Test calling super from within a category method. */ +/* { dg-do compile } */ +#include <objc/objc.h> + +@interface NSObject +@end +@interface NSMenuItem: NSObject +@end + +@interface NSObject (Test) ++ (int) test_func; +@end + +@implementation NSObject (Test) ++ (int) test_func +{} +@end + +@interface NSMenuItem (Test) ++ (int) test_func; +@end + +@implementation NSMenuItem (Test) ++ (int) test_func +{ + return [super test_func]; /* { dg-bogus "invalid use of undefined type" } */ +} /* { dg-bogus "forward declaration of" "" { target *-*-* } 27 } */ +@end + diff --git a/gcc/testsuite/obj-c++.dg/super-class-2.mm b/gcc/testsuite/obj-c++.dg/super-class-2.mm new file mode 100644 index 00000000000..e0caec43492 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/super-class-2.mm @@ -0,0 +1,35 @@ +/* APPLE LOCAL file mainline */ +/* Bail out gracefully if attempting to derive from a class that has only been + forward-declared (via @class). Conversely, @compatibility_alias declarations + should be traversed to find the @interface. */ +/* { dg-do compile } */ + +#include <objc/Object.h> + +@class MyWpModule; + +@compatibility_alias MyObject Object; +@compatibility_alias FictitiousModule MyWpModule; + +@protocol MySelTarget +- (id) meth1; +@end + +@protocol Img +- (id) meth2; +@end + +@interface FunnyModule: FictitiousModule <Img> /* { dg-error ".MyWpModule., superclass of .FunnyModule." } */ +- (id) meth2; +@end + +@interface MyProjWpModule : MyWpModule <MySelTarget, Img> /* { dg-error ".MyWpModule., superclass of .MyProjWpModule." } */ { + id i1, i2; +} +- (id) meth1; +- (id) meth2; +@end + +@interface AnotherModule: MyObject <MySelTarget> +- (id) meth1; +@end diff --git a/gcc/testsuite/obj-c++.dg/super-dealloc-1.mm b/gcc/testsuite/obj-c++.dg/super-dealloc-1.mm new file mode 100644 index 00000000000..0e123f20b8b --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/super-dealloc-1.mm @@ -0,0 +1,47 @@ +/* APPLE LOCAL file mainline */ +/* Check for warnings about missing [super dealloc] calls. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-do compile } */ + +@interface Foo { + void *isa; +} +- (void) dealloc; +- (void) some_other; +@end + +@interface Bar: Foo { + void *casa; +} +- (void) dealloc; +@end + +@interface Baz: Bar { + void *usa; +} +- (void) dealloc; +@end + +@implementation Foo +- (void) dealloc { + isa = 0; /* Should not warn here. */ +} +- (void) some_other { + isa = (void *)-1; +} +@end + +@implementation Bar +- (void) dealloc { + casa = 0; + [super some_other]; +} /* { dg-warning "method possibly missing a .super dealloc. call" } */ +@end + +@implementation Baz +- (void) dealloc { + usa = 0; + [super dealloc]; /* Should not warn here. */ +} +@end diff --git a/gcc/testsuite/obj-c++.dg/super-dealloc-2.mm b/gcc/testsuite/obj-c++.dg/super-dealloc-2.mm new file mode 100644 index 00000000000..b60b82c13d7 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/super-dealloc-2.mm @@ -0,0 +1,47 @@ +/* APPLE LOCAL file mainline */ +/* Check for warnings about missing [super dealloc] calls. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-do compile } */ + +@interface Foo { + void *isa; +} +- (void) dealloc; +- (void) some_other; +@end + +@interface Bar: Foo { + void *casa; +} +- (void) dealloc0; +@end + +@interface Baz: Bar { + void *usa; +} +- (void) dealloc; +@end + +@implementation Foo +- (void) dealloc { + isa = 0; /* Should not warn here. */ +} +- (void) some_other { + isa = (void *)-1; +} +@end + +@implementation Bar +- (void) dealloc0 { + casa = 0; + [super some_other]; /* Should not warn here. */ +} +@end + +@implementation Baz +- (void) dealloc { + usa = 0; + [super dealloc0]; +} /* { dg-warning "method possibly missing a .super dealloc. call" } */ +@end diff --git a/gcc/testsuite/obj-c++.dg/template-1.mm b/gcc/testsuite/obj-c++.dg/template-1.mm new file mode 100644 index 00000000000..de1e0f1574c --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/template-1.mm @@ -0,0 +1,49 @@ +// APPLE LOCAL file mainline +/* Test for using ObjC classes as C++ template parameters. */ +/* Author: Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-do run } */ + +#include <objc/Object.h> +#include <stdlib.h> + +#define CHECK_IF(expr) if(!(expr)) abort() + +@interface Base: Object +- (int) meth; +@end + +@interface Derived: Base +- (int) meth; +@end + +static int count = 0; + +template <class T> struct Templ +{ + T *m; + int i; + Templ(): i(55), m([[T alloc] init]) { count++; } + ~Templ() { [m free]; count--; } +}; + +@implementation Base +- (int) meth { return 333; } +@end + +@implementation Derived +- (int) meth { return 666; } +@end + +int main (void) { + CHECK_IF(count == 0); + { + Templ<Derived> derived; + CHECK_IF(derived.i == 55 && count == 1); + Templ<Base> base; + CHECK_IF(base.i == 55 && count == 2); + CHECK_IF([base.m meth] == 333); + CHECK_IF([derived.m meth] == 666); + } + CHECK_IF(count == 0); + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/template-2.mm b/gcc/testsuite/obj-c++.dg/template-2.mm new file mode 100644 index 00000000000..91f51db6ea4 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/template-2.mm @@ -0,0 +1,29 @@ +/* APPLE LOCAL file mainline */ +/* Test if ObjC classes (and pointers thereto) can participate + in C++ overloading. Correct handling of cv-qualifiers is + key here. */ +/* Author: Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-do compile } */ + +@interface foo { + int a, b; +} +@end + +struct bar { + int c, d; +}; + +template <class _Tp> +struct allocator { + typedef _Tp* pointer; + typedef const _Tp* const_pointer; + typedef _Tp& reference; + typedef const _Tp& const_reference; + + pointer address(reference __x) const { return &__x; } + const_pointer address(const_reference __x) const { return &__x; } +}; + +allocator<bar *> b; +allocator<foo *> d; diff --git a/gcc/testsuite/obj-c++.dg/template-3.mm b/gcc/testsuite/obj-c++.dg/template-3.mm new file mode 100644 index 00000000000..f8622d53a9a --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/template-3.mm @@ -0,0 +1,80 @@ +/* APPLE LOCAL file mainline */ +/* Test for passing arguments to ObjC methods in the context of template + expansion. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-do run } */ + +#include <objc/Object.h> +#include <stdlib.h> + +#define CHECK_IF(expr) if(!(expr)) abort() + +@interface ObjCClass : Object +{ +@public + int info; +} +-(id) init; +-(id) initWithInformation: (int) whatInfo; +-(id) initWithInformation: (int) whatInfo andInfo: (int) info2; +@end + +void foo(int info) { + ObjCClass *mObj1 = [[ObjCClass alloc] init]; + ObjCClass *mObj2 = [[ObjCClass alloc] initWithInformation: info]; + ObjCClass *mObj3 = [[ObjCClass alloc] initWithInformation: info andInfo: 39]; + + CHECK_IF(mObj1->info == 666); + CHECK_IF(mObj2->info == info); + CHECK_IF(mObj3->info == info + 39); +} + +template <class WrappedObjCClass> +class ObjCObjectWrapper +{ + public: + ObjCObjectWrapper(int info); + WrappedObjCClass *mObj1, *mObj2, *mObj3; +}; + +template <class WrappedObjCClass> +ObjCObjectWrapper<WrappedObjCClass>::ObjCObjectWrapper(int info) +{ + mObj1 = [[WrappedObjCClass alloc] init]; + mObj2 = [[WrappedObjCClass alloc] initWithInformation: info]; + mObj3 = [[WrappedObjCClass alloc] initWithInformation: info andInfo: 67]; +} + +@implementation ObjCClass +-(id) init { + return [self initWithInformation:666]; +} +-(id) initWithInformation: (int) whatInfo { + [super init]; + info = whatInfo; + return self; +} +-(id) initWithInformation: (int) whatInfo andInfo: (int) info2 { + [super init]; + info = whatInfo + info2; + return self; +} +@end + +ObjCObjectWrapper<ObjCClass> staticInstance(42); + +int main(void) { + ObjCObjectWrapper<ObjCClass> stackInstance(47); + + foo(89); + + CHECK_IF(staticInstance.mObj1->info == 666); + CHECK_IF(staticInstance.mObj2->info == 42); + CHECK_IF(staticInstance.mObj3->info == 42 + 67); + + CHECK_IF(stackInstance.mObj1->info == 666); + CHECK_IF(stackInstance.mObj2->info == 47); + CHECK_IF(stackInstance.mObj3->info == 47 + 67); + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/template-4.mm b/gcc/testsuite/obj-c++.dg/template-4.mm new file mode 100644 index 00000000000..17a53957272 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/template-4.mm @@ -0,0 +1,82 @@ +/* APPLE LOCAL file mainline */ +/* Author: Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-do run } */ + +#include <objc/Object.h> +#include <stdarg.h> +#include <stdlib.h> + +#ifdef __NEXT_RUNTIME__ +/* The following ain't pretty, but does allow us to have just one copy + of next_mapping.h. */ +#include "../objc/execute/next_mapping.h" +#else +#include <objc/NXConstStr.h> +#endif + +#define CHECK_IF(expr) if(!(expr)) abort() + +template <class ARR, class TYPE> class TestT +{ +public: + TYPE k; + int abc( ARR *array ) { + return [array count] * k; + } + TestT(TYPE _k): k(_k) { } +}; + +template <class TYPE> +const char *getDesc(void) { + return [TYPE name]; +} + +@class Array; + +template <class TYPE> +int abc( TYPE *xyz, Array *array ) { + return [xyz count] + [array count]; +} + +@interface Array: Object { + id *arr; + int count; +} ++ (id)arrayWithObjects:(id)first, ... ; +- (int)count; +@end + +@implementation Array ++ (id)arrayWithObjects:(id)first, ... { + Array *a = [Array new]; + a->count = 0; + a->arr = (id *) calloc(8, sizeof(id)); + + va_list args; + va_start (args, first); + + a->arr[a->count++] = first; + + for (id el; el = va_arg(args, id); a->count++) + a->arr[a->count] = el; + + return a; +} +- (int)count { + return count; +} +@end + +int main(void) +{ + CHECK_IF(!strcmp ([@"Object" cString], getDesc<Object>())); + CHECK_IF(!strcmp ([@"Array" cString], getDesc<Array>())); + + Array* a1 = [Array arrayWithObjects:@"One", @"Two", @"Three", nil]; + Array* a2 = [Array arrayWithObjects:@"Four", @"Five", nil]; + + TestT<Array, int> t(7); + CHECK_IF(t.abc(a1) + t.abc(a2) == 35); + CHECK_IF(abc(a1, a2) * t.k == 35); + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/template-5.mm b/gcc/testsuite/obj-c++.dg/template-5.mm new file mode 100644 index 00000000000..ca3a3d787e6 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/template-5.mm @@ -0,0 +1,17 @@ +// APPLE LOCAL file mainline +// Test that extern template does not get emitted. +// Author: Matt Austern <austern@apple.com> +// { dg-do compile } +// { dg-options "" } +// { dg-final { scan-assembler-not ".globl __ZN3FooIiE5identEi" } } + +template <typename X> +struct Foo { + X ident(X x) { return x; } +}; + +extern template struct Foo<int>; + +int abcde(Foo<int>& foo, int n) { + return foo.ident(n); +} diff --git a/gcc/testsuite/obj-c++.dg/template-6.mm b/gcc/testsuite/obj-c++.dg/template-6.mm new file mode 100644 index 00000000000..ff762126592 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/template-6.mm @@ -0,0 +1,16 @@ +// APPLE LOCAL file mainline +// Test that extern template does not get emitted. +// Author: Matt Austern <austern@apple.com> +// { dg-do compile } +// { dg-options "" } +// { dg-final { scan-assembler-not ".globl __ZN3FooIiE5identEi" } } + +template <typename X> + struct Foo { X ident(X x); }; + +template <typename X> + X Foo<X>::ident(X x) { return x; } + +extern template struct Foo<int>; + +int abcde(Foo<int>& foo, int n) { return foo.ident(n); } diff --git a/gcc/testsuite/obj-c++.dg/try-catch-1.mm b/gcc/testsuite/obj-c++.dg/try-catch-1.mm new file mode 100644 index 00000000000..b7a25854090 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/try-catch-1.mm @@ -0,0 +1,42 @@ +/* APPLE LOCAL file mainline */ +/* Test if the compiler accepts @throw / @try..@catch..@finally syntax. */ +/* Developed by Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-options "-fobjc-exceptions" } */ +/* { dg-do compile } */ + +#include <objc/Object.h> +#include <stdio.h> +#include <setjmp.h> + +@interface Frob: Object +@end + +@implementation Frob: Object +@end + +static int exc_control = 0; + +int proc() { + if(exc_control) { + printf ("Throwing (%d)... ", exc_control); + @throw [Frob new]; + } + return 1; +} + +int foo() +{ + @try { + return proc(); + } + @catch (Frob* ex) { + if(exc_control > 1) { + printf("Rethrowing (%d)... ", exc_control); + @throw; + } + return 0; + } + @finally { + printf("In @finally block (%d)... ", exc_control); + } +} diff --git a/gcc/testsuite/obj-c++.dg/try-catch-10.mm b/gcc/testsuite/obj-c++.dg/try-catch-10.mm new file mode 100644 index 00000000000..66d59e9bd60 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/try-catch-10.mm @@ -0,0 +1,26 @@ +/* APPLE LOCAL file mainline */ +/* Check that taking the address of a local variable marked 'volatile' + by the compiler does not generate untoward errors. */ +/* Developed by Ziemowit Laski <zlaski@apple.com>. */ + +/* { dg-options "-fobjc-exceptions" } */ +/* { dg-do compile } */ + + +void foo (int *arg1, int *arg2) +{ + *arg1 = *arg2; +} + +void bar (int arg) { + int rcvr; + + @try { + rcvr = arg; + } + @finally { + int *rcvr0 = &rcvr; + foo (rcvr0, &arg); + } +} + diff --git a/gcc/testsuite/obj-c++.dg/try-catch-2.mm b/gcc/testsuite/obj-c++.dg/try-catch-2.mm new file mode 100644 index 00000000000..f6b32ebef49 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/try-catch-2.mm @@ -0,0 +1,80 @@ +/* APPLE LOCAL file mainline */ +/* Test out '@catch(id foo) {...}', which should catch + all uncaught exceptions. */ +/* Developed by Ziemowit Laski <zlaski@apple.com>. */ + +/* { dg-options "-fobjc-exceptions" } */ +/* { dg-do run } */ + +#include <objc/Object.h> +#include <stdio.h> + +/* The following is not required in actual user code; we include it + here to check that the compiler generates an internal definition of + _setjmp that is consistent with what <setjmp.h> provides. */ +#include <setjmp.h> + +extern "C" void abort(void); +#define CHECK_IF(expr) if(!(expr)) abort() + +@interface Frob: Object +@end + +@implementation Frob: Object +@end + +static Frob* _connection = nil; + +//-------------------------------------------------------------------- + + +void test (Object* sendPort) +{ + int cleanupPorts = 1; + Frob* receivePort = nil; + + @try { + printf ("receivePort = %p\n", receivePort); + printf ("sendPort = %p\n", sendPort); + printf ("cleanupPorts = %d\n", cleanupPorts); + printf ("---\n"); + + receivePort = (Frob *) -1; + _connection = (Frob *) -1; + printf ("receivePort = %p\n", receivePort); + printf ("sendPort = %p\n", sendPort); + printf ("cleanupPorts = %d\n", cleanupPorts); + printf ("---\n"); + + receivePort = nil; + sendPort = nil; + cleanupPorts = 0; + + printf ("receivePort = %p\n", receivePort); + printf ("sendPort = %p\n", sendPort); + printf ("cleanupPorts = %d\n", cleanupPorts); + printf ("---\n"); + + @throw [Object new]; + } + @catch(Frob *obj) { + printf ("Exception caught by incorrect handler!\n"); + CHECK_IF(0); + } + @catch(id exc) { + printf ("Exception caught by correct handler.\n"); + printf ("receivePort = %p (expected 0x0)\n", receivePort); + printf ("sendPort = %p (expected 0x0)\n", sendPort); + printf ("cleanupPorts = %d (expected 0)\n", cleanupPorts); + printf ("---"); + CHECK_IF(!receivePort); + CHECK_IF(!sendPort); + CHECK_IF(!cleanupPorts); + } +} + +int main (void) { + + test((Object *)-1); + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/try-catch-3.mm b/gcc/testsuite/obj-c++.dg/try-catch-3.mm new file mode 100644 index 00000000000..97f8c3a59d6 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/try-catch-3.mm @@ -0,0 +1,20 @@ +/* APPLE LOCAL file mainline */ +/* Test if caught exception objects are accessible inside the + @catch block. (Yes, I managed to break this.) */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-do compile } */ +/* { dg-options "-fobjc-exceptions" } */ + +#include <objc/Object.h> + +const char *foo(void) +{ + @try { + return "foo"; + } + @catch (Object* theException) { + return [theException name]; + } +} + diff --git a/gcc/testsuite/obj-c++.dg/try-catch-4.mm b/gcc/testsuite/obj-c++.dg/try-catch-4.mm new file mode 100644 index 00000000000..9c89c44802e --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/try-catch-4.mm @@ -0,0 +1,27 @@ +/* APPLE LOCAL file mainline */ +/* Check that the compiler does not incorrectly complain about + exceptions being caught by previous @catch blocks. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-do compile } */ +/* { dg-options "-Wall -fobjc-exceptions" } */ + +@interface Exception +@end + +@interface FooException : Exception +@end + +extern void foo(); + +void test() +{ + @try { + foo(); + } + @catch (FooException* fe) { + } + @catch (Exception* e) { + } +} + diff --git a/gcc/testsuite/obj-c++.dg/try-catch-5.mm b/gcc/testsuite/obj-c++.dg/try-catch-5.mm new file mode 100644 index 00000000000..8fef6af1423 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/try-catch-5.mm @@ -0,0 +1,28 @@ +/* APPLE LOCAL file mainline */ +/* Check that the compiler does correctly complain about + exceptions being caught by previous @catch blocks. */ +/* Force the use of NeXT runtime to see that we don't ICE after + generating the warning message. */ + +/* { dg-do compile } */ +/* { dg-options "-Wall -fnext-runtime -fobjc-exceptions" } */ + +@interface Exception +@end + +@interface FooException : Exception +@end + +extern void foo(); + +void test() +{ + @try { + foo(); + } + @catch (Exception* e) { /* { dg-warning "earlier handler" } */ + } + @catch (FooException* fe) { /* { dg-warning "will be caught" } */ + } +} + diff --git a/gcc/testsuite/obj-c++.dg/try-catch-6.mm b/gcc/testsuite/obj-c++.dg/try-catch-6.mm new file mode 100644 index 00000000000..af21aea3021 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/try-catch-6.mm @@ -0,0 +1,14 @@ +/* APPLE LOCAL file mainline */ +/* A very simple @try-@catch example. */ +/* { dg-do compile } */ +/* { dg-options "-fobjc-exceptions" } */ + +int foo(void) { + @try { + return 2; + } + @catch (id foo) { + return 1; + } + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/try-catch-7.mm b/gcc/testsuite/obj-c++.dg/try-catch-7.mm new file mode 100644 index 00000000000..608f1d5a52c --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/try-catch-7.mm @@ -0,0 +1,29 @@ +/* APPLE LOCAL file mainline */ +/* { dg-do compile } */ +/* { dg-options "-fobjc-exceptions" } */ + +#include <objc/Object.h> + +int main (int argc, const char * argv[]) { + + Object * pool = [Object new]; + int a; + + if ( 1 ) { + + @try { + a = 1; + } + + @catch (Object *e) { + a = 2; + } + + @finally { + a = 3; + } + } + + [pool free]; + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/try-catch-8.mm b/gcc/testsuite/obj-c++.dg/try-catch-8.mm new file mode 100644 index 00000000000..fed9f362b51 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/try-catch-8.mm @@ -0,0 +1,28 @@ +/* APPLE LOCAL file mainline */ +/* Test for graceful compilation of @synchronized statements. */ +/* { dg-do compile } */ +/* { dg-options "-fobjc-exceptions" } */ + +#include <objc/Object.h> + +@interface Derived: Object +- (id) meth; +@end + +@implementation Derived +- (id) meth { + return self; +} + +static Derived* rewriteDict(void) { + static Derived *sDict = 0; + if (sDict == 0) { + @synchronized ([Derived class]) { + if (sDict == 0) + sDict = [Derived new]; + } + } + return sDict; +} +@end + diff --git a/gcc/testsuite/obj-c++.dg/try-catch-9.mm b/gcc/testsuite/obj-c++.dg/try-catch-9.mm new file mode 100644 index 00000000000..d9720310f57 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/try-catch-9.mm @@ -0,0 +1,65 @@ +/* APPLE LOCAL file mainline */ +/* Check that local variables that get modified inside the @try + block survive until the @catch block is reached. */ +/* Developed by Ziemowit Laski <zlaski@apple.com>. */ + +/* { dg-options "-fobjc-exceptions -O2" } */ +/* { dg-do run } */ + +#include <objc/Object.h> +#include <stdlib.h> +#include <stdio.h> + +int gi1 = 9, gi2 = 19; +float gf1 = 9.0, gf2 = 19.0; +id obj2 = nil; + +void foo (int arg1, float *arg2) +{ + int *pi = &gi1; + float *pf = &gf1; + id obj1 = nil; + int local1 = 45, local2 = 47; + float local3 = 3.0, local4 = 4.0; + register int local5 = 15; + static float local6 = 16.0; + + @try { + local1 = 123; + local2 = 345; + local3 = 5.0; + local4 = 6.0; + local5 = 17; + local6 = 18.0; + pi = &gi2; + pf = &gf2; + obj2 = obj1 = [Object new]; + arg1 = 17; + arg2 = &gf2; + + @throw [Object new]; + } + @catch (Object *obj) { + if(local1 != 123 || local2 != 345 || local3 != 5.0 || local4 != 6.0 || local5 != 17 || local6 != 18.0) { + printf("Abort 1\n"); + abort(); + } + if(pi != &gi2 || pf != &gf2) { + printf("Abort 2\n"); + abort(); + } + if(!obj1 || obj1 != obj2) { + printf("Abort 3\n"); + abort(); + } + if(arg1 != 17 || arg2 != &gf2) { + printf("Abort 4\n"); + abort(); + } + } +} + +int main(void) { + foo(15, &gf1); + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/typedef-alias-1.mm b/gcc/testsuite/obj-c++.dg/typedef-alias-1.mm new file mode 100644 index 00000000000..608084c1504 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/typedef-alias-1.mm @@ -0,0 +1,17 @@ +/* APPLE LOCAL file mainline */ +/* Typedefs of ObjC types should work without any bogus warnings. */ +/* { dg-do compile } */ + +#include <objc/Object.h> + +typedef Object MyObject; + +int main (int argc, const char * argv[]) +{ + Object* a = nil; + MyObject* b = a; + Object* c = b; + + return 0; +} + diff --git a/gcc/testsuite/obj-c++.dg/va-meth-1.mm b/gcc/testsuite/obj-c++.dg/va-meth-1.mm new file mode 100644 index 00000000000..66ecbe3e91a --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/va-meth-1.mm @@ -0,0 +1,74 @@ +/* APPLE LOCAL file mainline */ +/* Based on objc/execute/va_method.m, by Nicola Pero */ +/* { dg-do run } */ + +#include <objc/Object.h> +#include <stdarg.h> +#include <stdlib.h> + +/* Test methods with "C-style" trailing arguments, with or without ellipsis. */ + +@interface MathClass: Object +/* sum positive numbers; -1 ends the list */ ++ (int) sum: (int) firstNumber, int secondNumber, ...; ++ (int) prod: (int) firstNumber, int secondNumber, int thirdNumber; ++ (int) minimum: (int) firstNumber, ...; +@end + +extern "C" int some_func(id self, SEL _cmd, int firstN, int secondN, int thirdN, ...) { + return firstN + secondN + thirdN; +} + +@implementation MathClass ++ (int) sum: (int) firstNumber, int secondNumber, ... +{ + va_list ap; + int sum = 0, number = 0; + + va_start (ap, secondNumber); + number = firstNumber + secondNumber; + + while (number >= 0) + { + sum += number; + number = va_arg (ap, int); + } + + va_end (ap); + + return sum; +} ++ (int) prod: (int) firstNumber, int secondNumber, int thirdNumber { + return firstNumber * secondNumber * thirdNumber; +} ++ (int) minimum: (int) firstNumber, ... +{ + va_list ap; + int minimum = 999, number = 0; + + va_start (ap, firstNumber); + number = firstNumber; + + while (number >= 0) + { + minimum = (minimum < number ? minimum: number); + number = va_arg (ap, int); + } + + va_end (ap); + + return minimum; +} +@end + +int main (void) +{ + if ([MathClass sum: 1, 2, 3, 4, 5, -1] != 15) + abort (); + if ([MathClass prod: 4, 5, 6] != 120) + abort (); + if ([MathClass minimum: 17, 9, 133, 84, 35, -1] != 9) + abort (); + + return 0; +} diff --git a/gcc/testsuite/objc.dg/bitfield-5.m b/gcc/testsuite/objc.dg/bitfield-5.m new file mode 100644 index 00000000000..5cc545ce72f --- /dev/null +++ b/gcc/testsuite/objc.dg/bitfield-5.m @@ -0,0 +1,114 @@ +/* APPLE LOCAL file mainline */ +/* Check ObjC class layout follows the ABI (informally) + set in the past. ObjC structs must be laid out as if + all ivars, including those inherited from superclasses, + were defined at once (i.e., any padding introduced for + superclasses should be removed). */ +/* Contributed by Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-options "-Wpadded" } */ +/* { dg-do run } */ + +#include <objc/objc.h> +#include <objc/Object.h> +#include <stdlib.h> + +#define CHECK_IF(expr) if(!(expr)) abort() + +enum Enum { zero, one, two, three, four }; + +@interface Base: Object { +@public + unsigned a: 2; + int b: 3; + enum Enum c: 4; + unsigned d: 5; +} /* { dg-warning "padding struct size to alignment boundary" } */ +@end + +struct Base_0 { + Class isa; + unsigned a: 2; + int b: 3; + enum Enum c: 4; + unsigned d: 5; +}; /* { dg-warning "padding struct size to alignment boundary" } */ + +@interface Derived: Base { +@public + signed e: 5; + unsigned f: 4; + enum Enum g: 3; +} /* { dg-warning "padding struct size to alignment boundary" } */ +@end + +struct Derived_0 { + Class isa; + unsigned a: 2; + int b: 3; + enum Enum c: 4; + unsigned d: 5; + signed e: 5; + int f: 4; + enum Enum g: 3; +}; /* { dg-warning "padding struct size to alignment boundary" } */ + +@interface Leaf: Derived { +@public + signed h: 2; +} /* { dg-warning "padding struct size to alignment boundary" } */ +@end + +struct Leaf_0 { + Class isa; + unsigned a: 2; + int b: 3; + enum Enum c: 4; + unsigned d: 5; + signed e: 5; + unsigned f: 4; + enum Enum g: 3; + signed h: 2; +}; /* { dg-warning "padding struct size to alignment boundary" } */ + +/* Note that the semicolon after @defs(...) is optional. */ + +typedef struct { @defs(Base) } Base_t; /* { dg-warning "padding struct size to alignment boundary" } */ +typedef struct { @defs(Derived); } Derived_t; /* { dg-warning "padding struct size to alignment boundary" } */ +typedef struct { @defs(Leaf); } Leaf_t; /* { dg-warning "padding struct size to alignment boundary" } */ + +int main(void) +{ + struct Leaf_0 l_0; + Leaf *l = (Leaf *)&l_0; + Leaf_t *l_t = (Leaf_t *)&l_0; + + CHECK_IF(sizeof(Base_t) == sizeof(Base)); + CHECK_IF(sizeof(Derived_t) == sizeof(Derived)); + CHECK_IF(sizeof(Leaf_t) == sizeof(Leaf)); + + CHECK_IF(sizeof(struct Base_0) == sizeof(Base)); + CHECK_IF(sizeof(struct Derived_0) == sizeof(Derived)); + CHECK_IF(sizeof(struct Leaf_0) == sizeof(Leaf)); + + l_0.isa = (Class)0; + l_0.a = 3; + l_0.b = 0; + l_0.c = three; + l_0.d = 31; + l_0.e = 0; + l_0.f = 15; + l_0.g = zero; + l_0.h = -2; + + CHECK_IF(!l_t->isa); + CHECK_IF(l->a == 3 && l_t->a == 3); + CHECK_IF(!l->b && !l_t->b); + CHECK_IF(l->c == three && l_t->c == three); + CHECK_IF(l->d == 31 && l_t->d == 31); + CHECK_IF(!l->e && !l_t->e); + CHECK_IF(l->f == 15 && l_t->f == 15); + CHECK_IF(l->g == zero && l_t->g == zero); + CHECK_IF(l->h == -2 && l_t->h == -2); + + return 0; +} diff --git a/gcc/testsuite/objc.dg/class-protocol-1.m b/gcc/testsuite/objc.dg/class-protocol-1.m index ffa2435f5c0..7eb55024c48 100644 --- a/gcc/testsuite/objc.dg/class-protocol-1.m +++ b/gcc/testsuite/objc.dg/class-protocol-1.m @@ -313,9 +313,11 @@ testComptypes(void) { /* id <protocol>, SomeClass * */ mc1 == objP1; objP1 == mc1; - - mc1 == objP2; /* { dg-warning "does not implement" } */ - objP2 == mc1; /* { dg-warning "does not implement" } */ + + /* APPLE LOCAL begin mainline */ + mc1 == objP2; /* { dg-warning "lacks a cast" } */ + objP2 == mc1; /* { dg-warning "lacks a cast" } */ + /* APPLE LOCAL end mainline */ } { /* id <protocol>, id */ obj == objP1; @@ -371,10 +373,12 @@ testComptypes(void) objP5 = objP1; /* { dg-warning "does not conform" } */ } { /* id <protocol>, SomeClass * */ - mc1 = objP1; /* { dg-warning "incompatible" } */ /* FIXME: should be "" */ + /* APPLE LOCAL mainline */ + mc1 = objP1; objP1 = mc1; - mc1 = objP2; /* { dg-warning "incompatible" } */ /* FIXME: should be "does not implement" */ + /* APPLE LOCAL mainline */ + mc1 = objP2; /* { dg-warning "does not conform" } */ objP2 = mc1; /* { dg-warning "does not implement" } */ } { /* id <protocol>, id */ @@ -382,8 +386,10 @@ testComptypes(void) objP1 = obj; } { /* id <protocol>, Class */ - cls = objP1; /* { dg-warning "incompatible" } */ - objP1 = cls; /* { dg-warning "incompatible" } */ + /* APPLE LOCAL begin mainline */ + cls = objP1; /* { dg-warning "distinct Objective\\-C type" } */ + objP1 = cls; /* { dg-warning "distinct Objective\\-C type" } */ + /* APPLE LOCAL end mainline */ } { /* id <protocol>, non-ObjC */ num = objP1; /* { dg-warning "makes integer" } */ @@ -401,11 +407,13 @@ testComptypes(void) } { /* Class <protocol>, SomeClass * */ /* These combinations should always elicit a warning. */ - mc1 = clsP1; /* { dg-warning "incompatible" } */ - clsP1 = mc1; /* { dg-warning "incompatible" } */ + /* APPLE LOCAL begin mainline */ + mc1 = clsP1; /* { dg-warning "distinct Objective\\-C type" } */ + clsP1 = mc1; /* { dg-warning "distinct Objective\\-C type" } */ - mc1 = clsP2; /* { dg-warning "incompatible" } */ - clsP2 = mc1; /* { dg-warning "incompatible" } */ + mc1 = clsP2; /* { dg-warning "distinct Objective\\-C type" } */ + clsP2 = mc1; /* { dg-warning "distinct Objective\\-C type" } */ + /* APPLE LOCAL end mainline */ } { /* Class <protocol>, id */ obj = clsP1; @@ -423,8 +431,10 @@ testComptypes(void) clsP1 = ptr; } { /* Class <protocol>, id <protocol> */ - clsP1 = objP1; /* { dg-warning "incompatible" } */ - objP1 = clsP1; /* { dg-warning "incompatible" } */ + /* APPLE LOCAL begin mainline */ + clsP1 = objP1; /* { dg-warning "distinct Objective\\-C type" } */ + objP1 = clsP1; /* { dg-warning "distinct Objective\\-C type" } */ + /* APPLE LOCAL end mainline */ } } diff --git a/gcc/testsuite/objc.dg/comp-types-1.m b/gcc/testsuite/objc.dg/comp-types-1.m index 310b22634c0..92554e74490 100644 --- a/gcc/testsuite/objc.dg/comp-types-1.m +++ b/gcc/testsuite/objc.dg/comp-types-1.m @@ -32,9 +32,11 @@ int main() /* Assigning to a 'MyClass *' variable should always generate a warning, unless done from an 'id'. */ obj_c = obj; /* Ok */ - obj_c = obj_p; /* { dg-warning "incompatible pointer type" } */ - obj_c = obj_cp; /* { dg-warning "incompatible pointer type" } */ - obj_c = obj_C; /* { dg-warning "incompatible pointer type" } */ + /* APPLE LOCAL begin mainline */ + obj_c = obj_p; /* { dg-warning "distinct Objective\\-C type" } */ + obj_c = obj_cp; /* { dg-warning "distinct Objective\\-C type" } */ + obj_c = obj_C; /* { dg-warning "distinct Objective\\-C type" } */ + /* APPLE LOCAL end mainline */ /* Assigning to an 'id<MyProtocol>' variable should generate a warning if done from a 'MyClass *' (which doesn't implement @@ -43,14 +45,20 @@ int main() obj_p = obj; /* Ok */ obj_p = obj_c; /* { dg-warning "does not implement" } */ obj_p = obj_cp; /* Ok */ - obj_p = obj_C; /* { dg-warning "incompatible pointer type" } */ + /* APPLE LOCAL mainline */ + obj_p = obj_C; /* { dg-warning "distinct Objective\\-C type" } */ + /* APPLE LOCAL begin mainline */ /* Assigning to a 'MyOtherClass *' variable should always generate - a warning, unless done from an 'id' */ + a warning, unless done from an 'id' or an 'id<MyProtocol>' (since + MyOtherClass implements MyProtocol). */ + /* APPLE LOCAL end mainline */ obj_cp = obj; /* Ok */ - obj_cp = obj_c; /* { dg-warning "incompatible pointer type" } */ - obj_cp = obj_p; /* { dg-warning "incompatible pointer type" } */ - obj_cp = obj_C; /* { dg-warning "incompatible pointer type" } */ + /* APPLE LOCAL begin mainline */ + obj_cp = obj_c; /* { dg-warning "distinct Objective\\-C type" } */ + obj_cp = obj_p; /* Ok */ + obj_cp = obj_C; /* { dg-warning "distinct Objective\\-C type" } */ + /* APPLE LOCAL end mainline */ /* Any comparison involving an 'id' must be without warnings. */ if (obj == obj_p) ; /* Ok */ /*Bogus warning here in 2.95.4*/ @@ -64,8 +72,10 @@ int main() /* Any comparison between 'MyClass *' and anything which is not an 'id' must generate a warning. */ - if (obj_c == obj_p) ; /* { dg-warning "does not implement" } */ - if (obj_p == obj_c) ; /* { dg-warning "does not implement" } */ + /* APPLE LOCAL begin mainline */ + if (obj_c == obj_p) ; /* { dg-warning "lacks a cast" } */ + if (obj_p == obj_c) ; /* { dg-warning "lacks a cast" } */ + /* APPLE LOCAL end mainline */ if (obj_c == obj_cp) ; /* { dg-warning "lacks a cast" } */ if (obj_cp == obj_c) ; /* { dg-warning "lacks a cast" } */ if (obj_c == obj_C) ; /* { dg-warning "lacks a cast" } */ diff --git a/gcc/testsuite/objc.dg/comp-types-10.m b/gcc/testsuite/objc.dg/comp-types-10.m new file mode 100644 index 00000000000..9e7d31d49e7 --- /dev/null +++ b/gcc/testsuite/objc.dg/comp-types-10.m @@ -0,0 +1,30 @@ +/* APPLE LOCAL file mainline */ +/* { dg-do compile } */ + + +#include <objc/Object.h> + +@protocol Foo +- (id)meth1; +- (id)meth2:(int)arg; +@end + +@interface Derived1: Object +@end + +@interface Derived2: Object ++ (Derived1 *)new; +@end + +id<Foo> func(void) { + Object *o = [Object new]; + return o; /* { dg-warning "class .Object. does not implement the .Foo. protocol" } */ +} + +@implementation Derived2 ++ (Derived1 *)new { + Derived2 *o = [super new]; + return o; /* { dg-warning "distinct Objective\\-C type in return" } */ +} +@end + diff --git a/gcc/testsuite/objc.dg/comp-types-11.m b/gcc/testsuite/objc.dg/comp-types-11.m new file mode 100644 index 00000000000..3ef2ad3c5cc --- /dev/null +++ b/gcc/testsuite/objc.dg/comp-types-11.m @@ -0,0 +1,15 @@ +/* APPLE LOCAL file mainline */ +/* { dg-do compile } */ +#include <objc/Object.h> + +@interface Derived: Object +@end + +extern Object* foo(void); +static Derived *test(void) +{ + Derived *m = foo(); /* { dg-warning "initialization from distinct Objective\\-C type" } */ + + return m; +} + diff --git a/gcc/testsuite/objc.dg/comp-types-5.m b/gcc/testsuite/objc.dg/comp-types-5.m index f4d3dfc94e9..fa41c4c8dae 100644 --- a/gcc/testsuite/objc.dg/comp-types-5.m +++ b/gcc/testsuite/objc.dg/comp-types-5.m @@ -19,8 +19,10 @@ int main() obj_cp = obj; /* Ok */ obj = obj_cp; /* Ok */ - obj_cp = obj_p; /* { dg-warning "incompatible pointer type" } */ - obj_p = obj_cp; /* Ok */ /* Spurious 2.95.4 warning here. */ + /* APPLE LOCAL begin mainline */ + obj_cp = obj_p; /* Ok */ + obj_p = obj_cp; /* Ok */ + /* APPLE LOCAL end mainline */ if (obj_cp == obj) ; /* Ok */ if (obj == obj_cp) ; /* Ok */ diff --git a/gcc/testsuite/objc.dg/comp-types-6.m b/gcc/testsuite/objc.dg/comp-types-6.m index 9403b532fd3..8881e22dc11 100644 --- a/gcc/testsuite/objc.dg/comp-types-6.m +++ b/gcc/testsuite/objc.dg/comp-types-6.m @@ -23,8 +23,10 @@ int main() MyClass *obj_cp = nil; MyOtherClass *obj_cp2 = nil; - obj_cp = obj_p; /* { dg-warning "incompatible pointer type" } */ - obj_cp2 = obj_p; /* { dg-warning "incompatible pointer type" } */ + /* APPLE LOCAL begin mainline */ + obj_cp = obj_p; /* { dg-warning "distinct Objective\\-C type" } */ + obj_cp2 = obj_p; /* { dg-warning "distinct Objective\\-C type" } */ + /* APPLE LOCAL end mainline */ obj_p = obj_cp; /* Ok */ obj_p = obj_cp2; /* Ok */ diff --git a/gcc/testsuite/objc.dg/comp-types-8.m b/gcc/testsuite/objc.dg/comp-types-8.m new file mode 100644 index 00000000000..9c9b3dfe70f --- /dev/null +++ b/gcc/testsuite/objc.dg/comp-types-8.m @@ -0,0 +1,25 @@ +/* APPLE LOCAL file mainline */ +/* { dg-do compile } */ +/* Another gimplifier ICE... */ + +#include <objc/Object.h> + +@interface MyView: Object { + int _frame; +} +- (void)_finalize; +@end + +@interface MyViewTemplate: MyView { + void *_className; +} +- (id)createRealObject; +@end + +@implementation MyViewTemplate +- (id)createRealObject { + id realObj; + *(MyView *)realObj = *(MyView *)self; + return realObj; +} +@end diff --git a/gcc/testsuite/objc.dg/comp-types-9.m b/gcc/testsuite/objc.dg/comp-types-9.m new file mode 100644 index 00000000000..6ca9a45721b --- /dev/null +++ b/gcc/testsuite/objc.dg/comp-types-9.m @@ -0,0 +1,20 @@ +/* APPLE LOCAL file mainline */ +/* Yet another mysterious gimplifier crasher. */ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +@class NSString; +@protocol NSObject +@end +@interface NSObject <NSObject> { +} +@end +void __setRetained(id *ivar, id value) { + *ivar = value; +} +static NSString *_logProcessPrefix = 0; +@implementation NSObject (ScopeAdditions) ++ (void)setObjectLogProcessPrefix:(NSString *)processPrefix { + __setRetained(&_logProcessPrefix, processPrefix); +} +@end diff --git a/gcc/testsuite/objc.dg/const-cfstring-1.m b/gcc/testsuite/objc.dg/const-cfstring-1.m new file mode 100644 index 00000000000..8645022b6ef --- /dev/null +++ b/gcc/testsuite/objc.dg/const-cfstring-1.m @@ -0,0 +1,57 @@ +/* APPLE LOCAL file constant cfstrings */ +/* Test the -fconstant-cfstrings option for constructing + compile-time immutable CFStrings, and their interoperation + with both Cocoa and CoreFoundation. This will only work + on MacOS X 10.1.2 and later. */ +/* Developed by Ziemowit Laski <zlaski@apple.com>. */ + +/* { dg-do run { target *-*-darwin* } } */ +/* { dg-options "-fconstant-cfstrings -framework Cocoa" } */ + +#import <Foundation/NSString.h> +#import <CoreFoundation/CFString.h> +#include <stdlib.h> + +void printOut(NSString *str) { + NSLog(@"The value of str is: %@", str); +} + +CFStringRef s0a = CFSTR("Compile-time string literal"); +CFStringRef s0b = CFSTR("Compile-time string literal"); + +void checkNSRange(NSRange r) { + if (r.location != 6 || r.length != 5) { + printOut(@"Range check failed"); + abort(); + } +} + +void checkCFRange(CFRange r) { + if (r.location != 6 || r.length != 5) { + printOut(@"Range check failed"); + abort(); + } +} + +int main(void) { + const NSString *s1 = @"Compile-time string literal"; + CFStringRef s2 = CFSTR("Compile-time string literal"); + + checkNSRange([@"Hello World" rangeOfString:@"World"]); + checkNSRange([(id)CFSTR("Hello World") rangeOfString:@"World"]); + checkNSRange([@"Hello World" rangeOfString:(id)CFSTR("World")]); + checkNSRange([(id)CFSTR("Hello World") rangeOfString:(id)CFSTR("World")]); + + checkCFRange(CFStringFind((CFStringRef)@"Hello World", (CFStringRef)@"World", 0)); + checkCFRange(CFStringFind(CFSTR("Hello World"), (CFStringRef)@"World", 0)); + checkCFRange(CFStringFind((CFStringRef)@"Hello World", CFSTR("World"), 0)); + checkCFRange(CFStringFind(CFSTR("Hello World"), CFSTR("World"), 0)); + + /* Check for string uniquing. */ + if (s0a != s0b || s0a != s2 || s1 != (id)s2) { + NSLog(@"String uniquing failed"); + abort (); + } + + return 0; +} diff --git a/gcc/testsuite/objc.dg/const-cfstring-2.m b/gcc/testsuite/objc.dg/const-cfstring-2.m new file mode 100644 index 00000000000..57b8d95a7d4 --- /dev/null +++ b/gcc/testsuite/objc.dg/const-cfstring-2.m @@ -0,0 +1,26 @@ +/* APPLE LOCAL file constant CFStrings */ +/* Test the -Wnonportable-cfstrings option, which should give + warnings if non-ASCII characters are embedded in constant + CFStrings. This will only work on MacOS X 10.2 and later. */ +/* Developed by Ziemowit Laski <zlaski@apple.com>. */ + +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-fconstant-cfstrings -Wnonportable-cfstrings" } */ + +#import <Foundation/NSString.h> +#import <CoreFoundation/CFString.h> + +#ifndef __CONSTANT_CFSTRINGS__ +#error The -fconstant-cfstrings option is not functioning properly +#endif + +void foo(void) { + NSString *s1 = @"Compile-time string literal"; + CFStringRef s2 = CFSTR("Compile-time string literal"); + NSString *s3 = @"Non-ASCII literal - \222"; /* { dg-warning "non-ASCII character in CFString literal" } */ + CFStringRef s4 = CFSTR("\222 - Non-ASCII literal"); /* { dg-warning "non-ASCII character in CFString literal" } */ + CFStringRef s5 = CFSTR("Non-ASCII (\222) literal"); /* { dg-warning "non-ASCII character in CFString literal" } */ + NSString *s6 = @"\0Embedded NUL"; /* { dg-warning "embedded NUL in CFString literal" } */ + CFStringRef s7 = CFSTR("Embedded \0NUL"); /* { dg-warning "embedded NUL in CFString literal" } */ + CFStringRef s8 = CFSTR("Embedded NUL\0"); /* { dg-warning "embedded NUL in CFString literal" } */ +} diff --git a/gcc/testsuite/objc.dg/const-cfstring-3.m b/gcc/testsuite/objc.dg/const-cfstring-3.m new file mode 100644 index 00000000000..82f361cec6f --- /dev/null +++ b/gcc/testsuite/objc.dg/const-cfstring-3.m @@ -0,0 +1,26 @@ +/* APPLE LOCAL file constant strings */ +/* Test for assigning compile-time constant-string objects to static variables. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-options "-fconstant-cfstrings -framework Foundation" } */ +/* { dg-do run { target *-*-darwin* } } */ + +#include <stdlib.h> + +typedef const struct __CFString * CFStringRef; +static CFStringRef appKey = (CFStringRef) @"com.apple.soundpref"; + +static int CFPreferencesSynchronize (CFStringRef ref) { + return ref == appKey; +} + +static void PrefsSynchronize() +{ + if(!CFPreferencesSynchronize(appKey)) + abort(); +} + +int main(void) { + PrefsSynchronize(); + return 0; +} diff --git a/gcc/testsuite/objc.dg/const-cfstring-4.m b/gcc/testsuite/objc.dg/const-cfstring-4.m new file mode 100644 index 00000000000..9078bfa2313 --- /dev/null +++ b/gcc/testsuite/objc.dg/const-cfstring-4.m @@ -0,0 +1,12 @@ +/* APPLE LOCAL file constant strings */ +/* Test if constant CFStrings get placed in the correct section. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-options "-fconstant-cfstrings" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +typedef const struct __CFString * CFStringRef; +static CFStringRef appKey = (CFStringRef) @"com.apple.soundpref"; + +/* { dg-final { scan-assembler ".section __DATA, __cfstring" } } */ +/* { dg-final { scan-assembler ".long\t___CFConstantStringClassReference\n\t.long\t1992\n\t.long\t.*\n\t.long\t19\n\t.data" } } */ diff --git a/gcc/testsuite/objc.dg/const-cfstring-5.m b/gcc/testsuite/objc.dg/const-cfstring-5.m new file mode 100644 index 00000000000..1274d5d0889 --- /dev/null +++ b/gcc/testsuite/objc.dg/const-cfstring-5.m @@ -0,0 +1,25 @@ +/* APPLE LOCAL file 4154928 */ +/* Test if constant CFStrings may be passed back as ObjC strings. */ +/* Author: Ziemowit Laski */ + +/* { dg-options "-fconstant-cfstrings" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +#include <objc/Object.h> + +@interface Foo: Object { + char *cString; + unsigned int len; +} ++ (Foo *)description; +@end + +@interface Bar: Object ++ (Foo *) getString: (int) which; +@end + +@implementation Bar ++ (Foo *) getString: (int) which { + return which? [Foo description]: @"Hello"; +} +@end diff --git a/gcc/testsuite/objc.dg/const-str-10.m b/gcc/testsuite/objc.dg/const-str-10.m new file mode 100644 index 00000000000..6e6d86a8860 --- /dev/null +++ b/gcc/testsuite/objc.dg/const-str-10.m @@ -0,0 +1,29 @@ +/* APPLE LOCAL file 4149909 */ +/* Test if ObjC constant string layout is checked properly, regardless of how + constant string classes get derived. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-options "-fnext-runtime -fno-constant-cfstrings" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +#include <objc/Object.h> + +@interface NSString: Object +@end + +@interface NSSimpleCString : NSString { +@protected + char *bytes; + unsigned int numBytes; +} +@end + +@interface NSConstantString : NSSimpleCString +@end + +extern struct objc_class _NSConstantStringClassReference; + +const NSConstantString *appKey = @"MyApp"; + +/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ +/* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" } } */ diff --git a/gcc/testsuite/objc.dg/const-str-11.m b/gcc/testsuite/objc.dg/const-str-11.m new file mode 100644 index 00000000000..de3107cb33d --- /dev/null +++ b/gcc/testsuite/objc.dg/const-str-11.m @@ -0,0 +1,28 @@ +/* APPLE LOCAL file 4149909 */ +/* Test if ObjC constant string layout is checked properly, regardless of how + constant string classes get derived. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-options "-fnext-runtime -fno-constant-cfstrings -fconstant-string-class=XStr" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +#include <objc/Object.h> + +@interface XString: Object { +@protected + char *bytes; +} +@end + +@interface XStr : XString { +@public + unsigned int len; +} +@end + +extern struct objc_class _XStrClassReference; + +const XStr *appKey = @"MyApp"; + +/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ +/* { dg-final { scan-assembler ".long\t__XStrClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" } } */ diff --git a/gcc/testsuite/objc.dg/const-str-12.m b/gcc/testsuite/objc.dg/const-str-12.m new file mode 100644 index 00000000000..134c99b3c37 --- /dev/null +++ b/gcc/testsuite/objc.dg/const-str-12.m @@ -0,0 +1,27 @@ +/* APPLE LOCAL file 4154928 */ +/* Test if ObjC types play nice in conditional expressions. */ +/* Author: Ziemowit Laski */ + +/* { dg-options "-fno-constant-cfstrings -fconstant-string-class=Foo" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +#include <objc/Object.h> + +@interface Foo: Object { + char *cString; + unsigned int len; +} ++ (id)description; +@end + +@interface Bar: Object ++ (Foo *) getString: (int) which; +@end + +struct objc_class _FooClassReference; + +@implementation Bar ++ (Foo *) getString: (int) which { + return which? [Foo description]: @"Hello"; +} +@end diff --git a/gcc/testsuite/objc.dg/dg.exp b/gcc/testsuite/objc.dg/dg.exp index ebf952967c7..7b3eba41d98 100644 --- a/gcc/testsuite/objc.dg/dg.exp +++ b/gcc/testsuite/objc.dg/dg.exp @@ -28,7 +28,8 @@ if ![info exists DEFAULT_CFLAGS] then { dg-init # Main loop. -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[m\]]] \ +# APPLE LOCAL -ObjC +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[mc\]]] \ "" $DEFAULT_CFLAGS # All done. diff --git a/gcc/testsuite/objc.dg/encode-1.m b/gcc/testsuite/objc.dg/encode-1.m index 868c3254753..126e5d010f4 100644 --- a/gcc/testsuite/objc.dg/encode-1.m +++ b/gcc/testsuite/objc.dg/encode-1.m @@ -1,9 +1,9 @@ +/* APPLE LOCAL file bool encoding */ /* Test if the Objective-C @encode machinery distinguishes between - 'BOOL *' (which should be encoded as a pointer to BOOL) and 'char *' (which - should be encoded as '*'). This is somewhat tricky wrt the NeXT runtime, - where we have 'typedef char BOOL'. */ + 'BOOL *' (which should be encoded as '^c') and 'char *' (which + should be encoded as '*'). */ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ -/* { dg-options "-fnext-runtime -lobjc" } */ +/* { dg-options "-lobjc" } */ /* { dg-do run } */ #include <string.h> @@ -12,10 +12,9 @@ int main(void) { const char *BOOL_ptr = @encode(BOOL *); - const char *BOOL_ = @encode(BOOL); const char *char_ptr = @encode(char *); - - if(*BOOL_ptr != '^' || strcmp(BOOL_ptr + 1, BOOL_)) + + if(strcmp(BOOL_ptr, "^c")) abort(); if(strcmp(char_ptr, "*")) diff --git a/gcc/testsuite/objc.dg/encode-6.m b/gcc/testsuite/objc.dg/encode-6.m new file mode 100644 index 00000000000..de951375f30 --- /dev/null +++ b/gcc/testsuite/objc.dg/encode-6.m @@ -0,0 +1,23 @@ +/* APPLE LOCAL file mainline */ +/* Test for graceful encoding of const-qualified fields and parameters. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile } */ + +struct Cxx { + const struct Cxx *next; +}; + +@interface ObjC { + const struct Cxx *obj; +} +- (ObjC *)initWithCxx: (struct Cxx *const)c and: (const struct Cxx *)d; +@end + +@implementation ObjC +- (ObjC *)initWithCxx: (struct Cxx *const)c and: (const struct Cxx *)d { + obj = d; + return self; +} +@end + +/* { dg-final { scan-assembler "@\[0-9\]+@0:\[0-9\]+r\\^{Cxx=\\^r{Cxx}}\[0-9\]+\\^r{Cxx}" } } */ diff --git a/gcc/testsuite/objc.dg/extra-semi.m b/gcc/testsuite/objc.dg/extra-semi.m new file mode 100644 index 00000000000..2f60f801733 --- /dev/null +++ b/gcc/testsuite/objc.dg/extra-semi.m @@ -0,0 +1,11 @@ +/* APPLE LOCAL file mainline */ +/* Allow extra semicolons in between method declarations, + for old times' sake. */ + +/* { dg-do compile } */ + +@interface Foo + -(Foo *) expiration; + -(void) setExpiration:(Foo *) date;; + -(int) getVersion; +@end diff --git a/gcc/testsuite/objc.dg/fix-and-continue-1.m b/gcc/testsuite/objc.dg/fix-and-continue-1.m new file mode 100644 index 00000000000..7bfc8a13776 --- /dev/null +++ b/gcc/testsuite/objc.dg/fix-and-continue-1.m @@ -0,0 +1,91 @@ +/* APPLE LOCAL file mainline */ +/* Fix and continue should not interfere with computation of + local (static) function addresses. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-do run { target *-*-darwin* } } */ +/* { dg-options "-mfix-and-continue" } */ + +#include <objc/Object.h> +#include <stdlib.h> + +@class MyTarget, MySet; + +int global_value = 0; + +@interface MyTargetBuildContext : Object +{ + MyTarget * _target; + unsigned _cacheInvalDisableCount; + BOOL _cacheInvalidationNeeded; + unsigned short _isCreatingDependencies:1; + unsigned short _isCreatingHeadermap:1; + unsigned short _haveAddedIdleTimeInvoc:1; + BOOL _hasSetUpBuildSettings; +} +- (id)initWithTarget:(MyTarget *)target; +- (MyTarget *)target; +@end + +@interface MyTargetBuildContext (PrivateMethods) ++ (MySet *)_headerFileExtensions; +@end + +@interface MyCountedSet: Object { +@public + int cardinality; +} +- (id)init; +- (id)sortedArrayUsingFunction:(int (*)(id, id, void *))comparator with:(int)value; +@end + +@implementation MyCountedSet +- (id)init { + cardinality = 5; + global_value = 17; + return self; +} +- (id)sortedArrayUsingFunction:(int (*)(id, id, void *))comparator with:(int)value { + if(value == comparator(self, self, self)) + return self; + return nil; +} +@end + +@implementation MyTargetBuildContext : Object +- (id)initWithTarget:(MyTarget *)target +{ + self = [super init]; + return self; +} +- (MyTarget *)target +{ + return _target; +} + +static int _MyCompareObjectsByDecreasingSetCount (id object1, id object2, MyCountedSet * countedSet) +{ + global_value = 5; + return countedSet->cardinality; +} ++ (MySet *)_headerFileExtensions +{ + MySet * _headerFileExtensions = 0; + return _headerFileExtensions; +} +- (void)_recomputeHeadermap +{ + MyCountedSet *set = [MyCountedSet new]; + int (*functionPointer)(id, id, void *) = (int (*)(id, id, void *))_MyCompareObjectsByDecreasingSetCount; + id result = [set sortedArrayUsingFunction:functionPointer with:5]; +} +@end + +int main(void) { + MyTargetBuildContext *ctx = [MyTargetBuildContext new]; + [ctx _recomputeHeadermap]; + if (global_value != 5) + abort(); + + return 0; +} diff --git a/gcc/testsuite/objc.dg/fix-and-continue-2.m b/gcc/testsuite/objc.dg/fix-and-continue-2.m new file mode 100644 index 00000000000..e5db5d5aa35 --- /dev/null +++ b/gcc/testsuite/objc.dg/fix-and-continue-2.m @@ -0,0 +1,25 @@ +/* APPLE LOCAL file mainline */ +/* Static variables, even if local, require indirect access through a stub + if -mfix-and-continue is enabled. */ + +/* Author: Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-do assemble { target *-*-darwin* } } */ +/* { dg-options "-mfix-and-continue" } */ + +#include <objc/Object.h> + +@interface Foo: Object ++ (Object *)indexableFileTypes; +@end + +@implementation Foo ++ (Object *)indexableFileTypes +{ + static Object *fileTypes = 0; + if(!fileTypes) { + fileTypes = [Object new]; + } + return fileTypes; +} +@end diff --git a/gcc/testsuite/objc.dg/isa-field-1.m b/gcc/testsuite/objc.dg/isa-field-1.m new file mode 100644 index 00000000000..b4147040fa6 --- /dev/null +++ b/gcc/testsuite/objc.dg/isa-field-1.m @@ -0,0 +1,45 @@ +/* APPLE LOCAL file mainline */ +/* Ensure there are no bizarre difficulties with accessing the 'isa' field of objects. */ + +/* { dg-do compile } */ + +#include <objc/Object.h> + +@interface Object (Test) +- (Class) test1: (id)object; +@end + +@interface Derived: Object +- (Class) test2: (id)object; +@end + +@implementation Object (Test) + +Class test1(id object) { + Class cls = object->isa; + return cls; +} +- (Class) test1: (id)object { + Class cls = object->isa; + return cls; +} + +@end + +@implementation Derived + +Class test2(id object) { + Class cls = object->isa; + return cls; +} +- (Class) test2: (id)object { + Class cls = object->isa; + return cls; +} + +@end + +Class test3(id object) { + Class cls = object->isa; + return cls; +} diff --git a/gcc/testsuite/objc.dg/layout-1.m b/gcc/testsuite/objc.dg/layout-1.m new file mode 100644 index 00000000000..f84505f97ae --- /dev/null +++ b/gcc/testsuite/objc.dg/layout-1.m @@ -0,0 +1,16 @@ +/* APPLE LOCAL file mainline */ +/* Ensure that we do not get bizarre warnings referring to + __attribute__((packed)) or some such. */ +/* { dg-do compile } */ +/* { dg-options "-Wpadded -Wpacked" } */ + +#include <objc/Object.h> + +@interface Derived1: Object +{ } +@end + +@interface Derived2: Object +- (id) foo; +@end + diff --git a/gcc/testsuite/objc.dg/lookup-1.m b/gcc/testsuite/objc.dg/lookup-1.m new file mode 100644 index 00000000000..0de22d99a26 --- /dev/null +++ b/gcc/testsuite/objc.dg/lookup-1.m @@ -0,0 +1,55 @@ +/* APPLE LOCAL file mainline */ +/* { dg-do run } */ + +#include <objc/Object.h> +#include <stdlib.h> + +typedef struct MyWidget { + int a; +} MyWidget; + +MyWidget gWidget = { 17 }; + +@protocol MyProto +- (MyWidget *)widget; +@end + +@interface Foo: Object +@end + +@interface Bar: Foo <MyProto> +@end + +@interface Container: Object ++ (MyWidget *)elementForView:(Foo *)view; +@end + +@implementation Foo +@end + +@implementation Bar +- (MyWidget *)widget { + return &gWidget; +} +@end + +@implementation Container ++ (MyWidget *)elementForView:(Foo *)view +{ + MyWidget *widget = nil; + if ([view conformsTo:@protocol(MyProto)]) { + widget = [(Foo <MyProto> *)view widget]; + } + return widget; +} +@end + +int main(void) { + id view = [Bar new]; + MyWidget *w = [Container elementForView: view]; + + if (!w || w->a != 17) + abort (); + + return 0; +} diff --git a/gcc/testsuite/objc.dg/lvalue-cast-1.m b/gcc/testsuite/objc.dg/lvalue-cast-1.m new file mode 100644 index 00000000000..f2575efc631 --- /dev/null +++ b/gcc/testsuite/objc.dg/lvalue-cast-1.m @@ -0,0 +1,32 @@ +/* APPLE LOCAL file non lvalue assign */ +/* { dg-do compile } */ +/* { dg-options "-fnon-lvalue-assign" } */ + +#include <objc/Object.h> + +typedef struct _NSPoint { + float x; + float y; +} NSPoint; +typedef NSPoint *NSPointPointer; +typedef NSPoint *NSPointArray; +typedef struct _NSSize { + float width; + float height; +} NSSize; +typedef struct _NSRect { + NSPoint origin; + NSSize size; +} NSRect; + +@interface NSLayoutManager: Object { + NSRect *_cachedRectArray; +} +- (void)_growCachedRectArrayToSize:(unsigned)newSize; +@end + +@implementation NSLayoutManager +- (void)_growCachedRectArrayToSize:(unsigned)newSize { + ( NSRect *)_cachedRectArray = nil; /* { dg-warning "target of assignment not really an lvalue" } */ +} +@end diff --git a/gcc/testsuite/objc.dg/method-15.m b/gcc/testsuite/objc.dg/method-15.m new file mode 100644 index 00000000000..cc3e96778db --- /dev/null +++ b/gcc/testsuite/objc.dg/method-15.m @@ -0,0 +1,57 @@ +/* APPLE LOCAL file mainline */ +/* Test if prior method lookup at method @implementation time is not + overly aggressive, leading to methods being found in other classes. */ +/* Author: Ziemowit Laski <zlaski@apple.com>. */ + +/* { dg-do compile } */ + +#include <objc/Object.h> + +@class NSString; + +@protocol NSMenuItem ++ (void)setUsesUserKeyEquivalents:(BOOL)flag; ++ (BOOL)usesUserKeyEquivalents; +@end + +@interface NSMenuItem : Object <NSMenuItem> { + @private + id _menu; +} +@end + +@interface NSResponder : Object <NSMenuItem> +{ + id _nextResponder; +} +@end + +@interface Object(NSMenuValidation) +- (BOOL)validateMenuItem:(id <NSMenuItem>)menuItem; +@end + +@interface NSResponder (NSStandardKeyBindingMethods) +- (void)insertText:(id)insertString; +- (void)doCommandBySelector:(SEL)aSelector; +@end + +@interface NSView : NSResponder +{ + id _superview; + id _subviews; +} +@end + +@interface SKTGraphicView : NSView { + @private + float _gridSpacing; +} +@end + +@implementation SKTGraphicView +- (BOOL)validateMenuItem:(NSMenuItem *)item { + return (BOOL)1; +} +- (void)insertText:(NSString *)str { +} +@end diff --git a/gcc/testsuite/objc.dg/method-16.m b/gcc/testsuite/objc.dg/method-16.m new file mode 100644 index 00000000000..66f1fa69acc --- /dev/null +++ b/gcc/testsuite/objc.dg/method-16.m @@ -0,0 +1,24 @@ +/* APPLE LOCAL file mainline */ +/* Do not warn about "slightly" mismatched method signatures if + -Wstrict-selector-match is off. */ +/* { dg-do compile } */ +/* { dg-options "-Wno-strict-selector-match" } */ + +#include <objc/objc.h> + +@interface Base +- (id) meth1: (Base *)arg1; +- (id) window; +@end + +@interface Derived: Base +- (id) meth1: (Derived *)arg1; +- (Base *)window; +@end + +void foo(void) { + id r; + + [r meth1:r]; + [r window]; +} diff --git a/gcc/testsuite/objc.dg/method-17.m b/gcc/testsuite/objc.dg/method-17.m new file mode 100644 index 00000000000..354ade66db7 --- /dev/null +++ b/gcc/testsuite/objc.dg/method-17.m @@ -0,0 +1,27 @@ +/* APPLE LOCAL file mainline */ +/* Test for spurious "may or may not return a value" warnings. */ + +/* { dg-do compile } */ +/* { dg-options "-Wextra" } */ + +#include <objc/Object.h> + +@interface Foo: Object +- (id) meth1; +- (void) meth2; +@end + +extern int bar; + +@implementation Foo +- (id) meth1 { + if (bar) + return [Object new]; + return; +} /* { dg-warning "this function may return with or without a value" } */ +- (void) meth2 { + if (!bar) + return; + bar = 0; +} /* { dg-bogus "this function may return with or without a value" } */ +@end diff --git a/gcc/testsuite/objc.dg/method-18.m b/gcc/testsuite/objc.dg/method-18.m new file mode 100644 index 00000000000..191206a896a --- /dev/null +++ b/gcc/testsuite/objc.dg/method-18.m @@ -0,0 +1,30 @@ +/* APPLE LOCAL file mainline */ +/* Do not warn about "slightly" mismatched method signatures if + -Wstrict-selector-match is off. */ +/* { dg-do compile } */ +/* { dg-options "-Wno-strict-selector-match" } */ + +#include <objc/objc.h> + +typedef enum { en1_1, en1_2 } En1; +typedef enum { en2_1, en2_2 } En2; +typedef struct { int a, b; } St1; +typedef struct { unsigned a, b; } St2; + +@interface Base +- (id) meth1: (En1)arg1; +- (St1) window; +@end + +@interface Derived: Base +- (id) meth1: (En2)arg1; +- (St2)window; +@end + +void foo(void) { + id r; + En1 en; + + [r meth1:en]; + [r window]; +} diff --git a/gcc/testsuite/objc.dg/method-19.m b/gcc/testsuite/objc.dg/method-19.m new file mode 100644 index 00000000000..d30c36a1e9e --- /dev/null +++ b/gcc/testsuite/objc.dg/method-19.m @@ -0,0 +1,18 @@ +/* APPLE LOCAL file mainline */ +/* The following should NOT generate "may not respond to" warnings, since a forward-declared + @class (instance) should be treated like a 'Class') ('id'). */ + +/* { dg-do compile } */ + +#include <objc/Object.h> + +@class NotKnown; + +void foo(NotKnown *n) { + [NotKnown new]; + [n nonexistent_method]; /* { dg-warning "no .\\-nonexistent_method. method found" } */ +} + +/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */ +/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */ +/* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/objc.dg/method-5.m b/gcc/testsuite/objc.dg/method-5.m index 37677a1ccaa..17c3f9f3367 100644 --- a/gcc/testsuite/objc.dg/method-5.m +++ b/gcc/testsuite/objc.dg/method-5.m @@ -11,8 +11,10 @@ void foo(UnderSpecified *u, NotAClass *n) { [n nonexistent_method]; /* { dg-warning "invalid receiver type" } */ /* { dg-warning "no .\\-nonexistent_method. method found" "" { target *-*-* } 11 } */ [NotAClass nonexistent_method]; /* { dg-error ".NotAClass. is not an Objective\\-C class name or alias" } */ - [u nonexistent_method]; /* { dg-warning ".UnderSpecified. may not respond to .\\-nonexistent_method." } */ - [UnderSpecified nonexistent_method]; /* { dg-warning ".UnderSpecified. may not respond to .\\+nonexistent_method." } */ + /* APPLE LOCAL begin mainline */ + [u nonexistent_method]; /* { dg-warning "no .\\-nonexistent_method. method found" } */ + [UnderSpecified nonexistent_method]; /* { dg-warning "no .\\+nonexistent_method. method found" } */ + /* APPLE LOCAL end mainline */ } /* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/objc.dg/method-6.m b/gcc/testsuite/objc.dg/method-6.m index a4c1323fac8..07f46382086 100644 --- a/gcc/testsuite/objc.dg/method-6.m +++ b/gcc/testsuite/objc.dg/method-6.m @@ -1,5 +1,5 @@ -/* Check that sending messages to variables of type 'Class' does not involve instance methods, - unless they reside in root classes. */ +/* APPLE LOCAL file mainline */ +/* Check that sending messages to variables of type 'Class' does not involve instance methods, unless they reside in root classes. */ /* Author: Ziemowit Laski <zlaski@apple.com> */ /* { dg-do compile } */ @@ -29,3 +29,5 @@ void foo(void) { [Class port]; /* { dg-error ".Class. is not an Objective\\-C class name or alias" } */ } + +/* { dg-options "-Wstrict-selector-match" } */ diff --git a/gcc/testsuite/objc.dg/method-7.m b/gcc/testsuite/objc.dg/method-7.m index f84759c2169..b714f8eb6f7 100644 --- a/gcc/testsuite/objc.dg/method-7.m +++ b/gcc/testsuite/objc.dg/method-7.m @@ -1,5 +1,5 @@ -/* Check if finding multiple signatures for a method is handled gracefully. */ -/* Author: Ziemowit Laski <zlaski@apple.com> */ +/* APPLE LOCAL file mainline */ +/* Check if finding multiple signatures for a method is handled gracefully. Author: Ziemowit Laski <zlaski@apple.com> */ /* { dg-do compile } */ #include <objc/Object.h> @@ -25,3 +25,5 @@ id foo(void) { return obj; } + +/* { dg-options "-Wstrict-selector-match" } */ diff --git a/gcc/testsuite/objc.dg/method-9.m b/gcc/testsuite/objc.dg/method-9.m index 3921663ec8f..c72087f1021 100644 --- a/gcc/testsuite/objc.dg/method-9.m +++ b/gcc/testsuite/objc.dg/method-9.m @@ -1,5 +1,5 @@ -/* Check if finding multiple signatures for a method is handled gracefully - when method lookup succeeds (see also method-7.m). */ +/* APPLE LOCAL file mainline */ +/* Check if finding multiple signatures for a method is handled gracefully when method lookup succeeds (see also method-7.m). */ /* Contributed by Ziemowit Laski <zlaski@apple.com> */ /* { dg-do compile } */ @@ -37,7 +37,11 @@ /* { dg-warning "also found .\\-\\(id\\)initWithData:\\(int\\)data." "" { target *-*-* } 13 } */ /* The following warning is a consequence of picking the "wrong" method signature. */ - /* { dg-warning "passing argument 1 of .initWithData:. from incompatible pointer type" "" { target *-*-* } 33 } */ + /* APPLE LOCAL mainline */ + /* { dg-warning "passing argument 1 of .initWithData:. from distinct Objective\\-C type" "" { target *-*-* } 33 } */ return result; } @end + +/* { dg-options "-Wstrict-selector-match" } */ + diff --git a/gcc/testsuite/objc.dg/next-runtime-1.m b/gcc/testsuite/objc.dg/next-runtime-1.m new file mode 100644 index 00000000000..0e05c58f75e --- /dev/null +++ b/gcc/testsuite/objc.dg/next-runtime-1.m @@ -0,0 +1,18 @@ +/* APPLE LOCAL file mainline */ +/* Test that the correct version number (6) is set in the module descriptor + when compiling for the NeXT runtime. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-fnext-runtime" } */ + +#include <objc/Object.h> + +@interface FooBar: Object +- (void)boo; +@end + +@implementation FooBar +- (void)boo { } +@end + +/* { dg-final { scan-assembler "L_OBJC_MODULES:\n\[ \t\]*\.long\t6\n" } } */ diff --git a/gcc/testsuite/objc.dg/no-extra-load.m b/gcc/testsuite/objc.dg/no-extra-load.m new file mode 100644 index 00000000000..d740130a342 --- /dev/null +++ b/gcc/testsuite/objc.dg/no-extra-load.m @@ -0,0 +1,7 @@ +/* APPLE LOCAL file mainline */ +/* { dg-do compile { target *-*-darwin* } } */ + +#import <Foundation/Foundation.h> +main() { [NSObject new]; } + +/* { dg-final { scan-assembler-not "L_objc_msgSend\\\$non_lazy_ptr" } } */ diff --git a/gcc/testsuite/objc.dg/nopicsetup.m b/gcc/testsuite/objc.dg/nopicsetup.m new file mode 100644 index 00000000000..3a5b46fbacd --- /dev/null +++ b/gcc/testsuite/objc.dg/nopicsetup.m @@ -0,0 +1,17 @@ +/* APPLE LOCAL file */ +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* Magic "bcl" to do PIC setup should be suppressed (commented) */ +@interface Base {} +- (id)init; +@end +@interface Derived : Base {} +@end +@implementation Derived +- (id)init +{ + self = [super init]; + if (self) {} + return self; +} +@end +/* { scan-assembler ";bcl" } */ diff --git a/gcc/testsuite/objc.dg/objc-fast-1.m b/gcc/testsuite/objc.dg/objc-fast-1.m new file mode 100644 index 00000000000..6db7c38beec --- /dev/null +++ b/gcc/testsuite/objc.dg/objc-fast-1.m @@ -0,0 +1,24 @@ +/* APPLE LOCAL file ObjC direct dispatch */ +/* A compile-only test for insertion of 'bla' comm page jumps. */ +/* Developed by Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-fnext-runtime -fobjc-gc -fobjc-direct-dispatch -Wassign-intercept" } */ + +#include <objc/Object.h> + +@interface Derived: Object { +@public + Object *other; +} +@end + +void foo(void) { + Derived *o = [Derived new]; + o->other = 0; /* { dg-warning "instance variable assignment has been intercepted" } */ +} + +/* { dg-final { scan-assembler-not "objc_msgSend" } } */ +/* { dg-final { scan-assembler-not "objc_assign_ivar" } } */ + +/* { dg-final { scan-assembler "bla.*fffeff00" } } */ +/* { dg-final { scan-assembler "bla.*fffefec0" } } */ diff --git a/gcc/testsuite/objc.dg/objc-fast-2.m b/gcc/testsuite/objc.dg/objc-fast-2.m new file mode 100644 index 00000000000..61e97adad3a --- /dev/null +++ b/gcc/testsuite/objc.dg/objc-fast-2.m @@ -0,0 +1,29 @@ +/* APPLE LOCAL file ObjC direct dispatch */ +/* A compile-only test for insertion of 'ba' sibcall comm page jumps. */ +/* Developed by Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-fnext-runtime -fobjc-gc -fobjc-direct-dispatch -Wno-assign-intercept -O2" } */ + +#include <objc/Object.h> + +@interface Derived: Object { +@public + Object *other; +} +@end + +void foo(void) { + Derived *o; + o->other = 0; /* sibcall to objc_assign_ivar_Fast() */ +} + +void bar(void) { + Derived *o = nil; + [Derived new]; /* sibcall to objc_msgSend_Fast() */ +} + +/* { dg-final { scan-assembler-not "objc_msgSend" } } */ +/* { dg-final { scan-assembler-not "objc_assign_ivar" } } */ + +/* { dg-final { scan-assembler "ba.*fffeff00" } } */ +/* { dg-final { scan-assembler "ba.*fffefec0" } } */ diff --git a/gcc/testsuite/objc.dg/objc-fast-3.m b/gcc/testsuite/objc.dg/objc-fast-3.m new file mode 100644 index 00000000000..fc57f831eef --- /dev/null +++ b/gcc/testsuite/objc.dg/objc-fast-3.m @@ -0,0 +1,33 @@ +/* APPLE LOCAL file ObjC direct dispatch */ +/* A compile-only test for insertion of 'bla' and 'ba' sibcall comm page jumps + for methods returning 'void'. */ +/* Developed by Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-fnext-runtime -fobjc-gc -fobjc-direct-dispatch -Wno-assign-intercept -O2" } */ + +#include <objc/Object.h> + +@interface Derived: Object { +@public + Object *other; +} +- (void) do_nothing; +@end + +int a; + +void foo(void) { + Derived *o; + [o do_nothing]; /* objc_msgSend_Fast() */ + a = 2; +} + +void bar(void) { + Derived *o = nil; + [o do_nothing]; /* sibcall to objc_msgSend_Fast() */ +} + +/* { dg-final { scan-assembler-not "objc_msgSend" } } */ + +/* { dg-final { scan-assembler "bla.*fffeff00" } } */ +/* { dg-final { scan-assembler "ba.*fffeff00" } } */ diff --git a/gcc/testsuite/objc.dg/objc-fast-4.m b/gcc/testsuite/objc.dg/objc-fast-4.m new file mode 100644 index 00000000000..67e8a998bc4 --- /dev/null +++ b/gcc/testsuite/objc.dg/objc-fast-4.m @@ -0,0 +1,13 @@ +/* APPLE LOCAL file ObjC direct dispatch */ +/* Check that 4015820 is fixed. That does not appear except + with -O0, so the sibcall case cannot occur. */ +/* { dg-do compile { target powerpc*-*-darwin* } } */ +/* { dg-options "-O0 -fobjc-direct-dispatch" } */ +#include <objc/Object.h> + +void foo(void) { + Object *o; + [o++ free]; +} +/* { dg-final { scan-assembler-not "objc_msgSend" } } */ +/* { dg-final { scan-assembler "bla.*fffeff00" } } */ diff --git a/gcc/testsuite/objc.dg/objc-gc-1.m b/gcc/testsuite/objc.dg/objc-gc-1.m new file mode 100644 index 00000000000..ed9a8b1ac13 --- /dev/null +++ b/gcc/testsuite/objc.dg/objc-gc-1.m @@ -0,0 +1,146 @@ +/* APPLE LOCAL file ObjC GC */ +/* A compile-only test for insertion of write barriers. */ +/* Developed by Ziemowit Laski <zlaski@apple.com> */ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-fnext-runtime -fobjc-gc -Wassign-intercept" } */ + +#ifndef __OBJC_GC__ +#error Missing __OBJC_GC__ manifest constant +#endif + +#include <objc/Object.h> + +@class Underspecified; +@class MyClass; + +@interface AnotherClass: Object { +@public + __strong void *storage; + MyClass *SomeObj; +} +- (id)assignObj:(id)obj; +@end + +struct Struct1 { + MyClass *someobj; + void *obj2; + __strong void *obj3; +}; + +struct Struct1 *str1a, str1aa; +__strong struct Struct1 *str1b, str1bb, **str1c, *str1d[3][3]; + +extern MyClass *externFunc(void); + +@interface MyClass: Object { +@public + id ivar1, *ivar1a; + void *ivar2; + __strong void *ivar3; + Underspecified *ivar4[2], **ivar4a; + union { + struct { + Underspecified *data; + const unsigned char *dataBytes; + } d; + struct { + __strong void *storage; + AnotherClass *another; + } s; + } contents; + struct { + struct { + void *yy; + } z; + } y; +} +@end + +@implementation AnotherClass +- (id)assignObj:(id)obj { + static MyClass *m_myclass; + static id *indirect; + str1a = 0; + str1b = 0; /* { dg-warning "global\\/static variable assignment" } */ + str1c = 0; /* { dg-warning "global\\/static variable assignment" } */ + str1d[1][1] = 0; /* { dg-warning "global\\/static variable assignment" } */ + str1a->someobj = 0; /* { dg-warning "strong\\-cast may possibly be needed" } */ + str1b->someobj = 0; /* { dg-warning "strong\\-cast may possibly be needed" } */ + str1aa.someobj = 0; /* { dg-warning "global\\/static variable assignment" } */ + str1bb.someobj = 0; /* { dg-warning "global\\/static variable assignment" } */ + str1a->obj2 = 0; + str1b->obj2 = 0; + str1a->obj3 = 0; /* { dg-warning "strong\\-cast may possibly be needed" } */ + str1b->obj3 = 0; /* { dg-warning "strong\\-cast may possibly be needed" } */ + SomeObj->contents.s.another = 0; /* { dg-warning "instance variable assignment" } */ + obj = 0; + externFunc()->ivar1 = 0; /* { dg-warning "instance variable assignment" } */ + externFunc()->contents.s.another->SomeObj = 0; /* { dg-warning "instance variable assignment" } */ + m_myclass = 0; /* { dg-warning "global\\/static variable assignment" } */ + *indirect = obj; /* { dg-warning "strong\\-cast may possibly be needed" } */ + (__strong id)*indirect = obj; /* { dg-warning "strong\\-cast assignment" } */ + (__strong id)(MyClass *)*indirect = obj; /* { dg-warning "strong\\-cast assignment" } */ + self = 0; + self->isa = 0; /* { dg-warning "instance variable assignment" } */ + return SomeObj = obj; /* { dg-warning "instance variable assignment" } */ +} +@end + +typedef MyClass MyClass1; +@compatibility_alias MyClass2 MyClass; + +MyClass *g_myclass; +MyClass1 *g_myclass1; +MyClass2 *g_myclass2; +MyClass2 **g_myclass2a, ***g_myclass2b; +MyClass2 *g_myclass2c[6], *g_myclass2d[4][5]; +__strong void *g_myclass2e[3]; + +id *g_myid, ***g_myid3; + +void function(void) { + static MyClass *l_myclass; + MyClass2 *l_myclass2; + + g_myclass = 0; /* { dg-warning "global\\/static variable assignment" } */ + l_myclass = 0; /* { dg-warning "global\\/static variable assignment" } */ + g_myclass->ivar1 = 0; /* { dg-warning "instance variable assignment" } */ + *g_myclass->ivar1a = 0; + l_myclass2 = 0; + l_myclass2->ivar1 = 0; /* { dg-warning "instance variable assignment" } */ + (__strong id)*g_myclass->ivar1a = 0; /* { dg-warning "strong\\-cast assignment" } */ + g_myclass->ivar2 = 0; + (__strong void *)g_myclass->ivar2 = 0; /* { dg-warning "strong\\-cast assignment" } */ + g_myclass->ivar3 = 0; /* { dg-warning "instance variable assignment" } */ + l_myclass->ivar4[1] = 0; /* { dg-warning "instance variable assignment" } */ + l_myclass->ivar4a = 0; + *l_myclass->ivar4a = 0; + (__strong id)*l_myclass->ivar4a = 0; /* { dg-warning "strong\\-cast assignment" } */ + l_myclass->contents.d.data = 0; /* { dg-warning "instance variable assignment" } */ + l_myclass->contents.d.dataBytes = 0; + (__strong const unsigned char *)l_myclass->contents.d.dataBytes = 0; /* { dg-warning "strong\\-cast assignment" } */ + l_myclass->contents.s.storage = 0; /* { dg-warning "instance variable assignment" } */ + l_myclass->contents.s.another->SomeObj = 0; /* { dg-warning "instance variable assignment" } */ + l_myclass->contents.s.another->storage = 0; /* { dg-warning "instance variable assignment" } */ + (__strong void *)l_myclass->contents.s.another->storage = 0; /* { dg-warning "strong\\-cast assignment" } */ + g_myclass->y.z.yy = 0; + (__strong void *)g_myclass->y.z.yy = 0; /* { dg-warning "strong\\-cast assignment" } */ + g_myclass1->ivar1 = 0; /* { dg-warning "instance variable assignment" } */ + g_myclass2->ivar1 = 0; /* { dg-warning "instance variable assignment" } */ + (*g_myclass2a)->ivar1 = 0; /* { dg-warning "instance variable assignment" } */ + *g_myid = 0; /* { dg-warning "strong\\-cast may possibly be needed" } */ + ***g_myid3 = 0; /* { dg-warning "strong\\-cast may possibly be needed" } */ + (__strong id)*g_myid = 0; /* { dg-warning "strong\\-cast assignment" } */ + (__strong id)***g_myid3 = 0; /* { dg-warning "strong\\-cast assignment" } */ + g_myclass2[3] = g_myclass1[4]; + g_myclass2a[1] = 0; /* { dg-warning "strong\\-cast may possibly be needed" } */ + g_myclass2b[1][2] = 0; /* { dg-warning "strong\\-cast may possibly be needed" } */ + g_myclass2c[1] = 0; /* { dg-warning "global\\/static variable assignment" } */ + g_myclass2e[1] = 0; /* { dg-warning "global\\/static variable assignment" } */ + g_myclass2d[1][2] = 0; /* { dg-warning "global\\/static variable assignment" } */ + g_myclass2a[1]->ivar1 = 0; /* { dg-warning "instance variable assignment" } */ + g_myclass2b[1][2]->ivar1 = 0; /* { dg-warning "instance variable assignment" } */ + g_myclass2c[1]->ivar1 = 0; /* { dg-warning "instance variable assignment" } */ + g_myclass2d[1][2]->ivar1 = 0; /* { dg-warning "instance variable assignment" } */ +} + diff --git a/gcc/testsuite/objc.dg/objc-gc-2.m b/gcc/testsuite/objc.dg/objc-gc-2.m new file mode 100644 index 00000000000..75c7aea45a3 --- /dev/null +++ b/gcc/testsuite/objc.dg/objc-gc-2.m @@ -0,0 +1,172 @@ +/* APPLE LOCAL file ObjC GC */ +/* A run-time test for insertion of write barriers. */ + +/* { dg-do run { target *-*-darwin* } } */ +/* { dg-options "-fnext-runtime -fobjc-gc" } */ + +#include <objc/objc.h> +#include <stdio.h> +#include <stdlib.h> + +typedef const struct __CFDictionary * CFDictionaryRef; + +// callouts to these are generated with cc -fobjc-gc + +int GlobalAssigns; +int IvarAssigns; +int StrongCastAssigns; + + +id objc_assign_global(id value, id *dest) { + ++GlobalAssigns; + return (*dest = value); +} + +id objc_assign_ivar(id value, id dest, unsigned int offset) { + id *slot = (id*) ((char *)dest + offset); + + ++IvarAssigns; + return (*slot = value); +} + +id objc_assign_strongCast(id value, id *dest) { + id base; + + ++StrongCastAssigns ; + return (*dest = value); +} + +// The test case elements; +@class NSObject; +@class NSString; + +typedef struct { + id element; + id elementArray[10]; + __strong CFDictionaryRef cfElement; + __strong CFDictionaryRef cfElementArray[10]; +} struct_with_ids_t; + +@interface Foo { +@public +// assignments to any/all of these fields should generate objc_assign_ivar + __strong CFDictionaryRef dict; + __strong CFDictionaryRef dictArray[3]; + id ivar; + id array[10]; + NSObject *nsobject; + NSString *stringArray[10]; + struct_with_ids_t inner; +} + +@end + +// assignments to these should generate objc_assign_global +id GlobalId; +id GlobalArray[20]; +NSObject *GlobalObject; +NSObject *GlobalObjectArray[20]; +__strong CFDictionaryRef Gdict; +__strong CFDictionaryRef Gdictarray[10]; +struct_with_ids_t GlobalStruct; +struct_with_ids_t GlobalStructArray[10]; + + +// The test cases +void *rhs = 0; + +#define ASSIGNTEST(expr, global) expr = rhs; if (!global) { printf(# expr " is busted\n"); ++counter; } global = 0 + +int testGlobals() { + // Everything in this function generates assign_global intercepts + int counter = 0; + + static id staticGlobalId; + static id staticGlobalArray[20]; + static NSObject *staticGlobalObject; + static NSObject *staticGlobalObjectArray[20]; + static __strong CFDictionaryRef staticGdict; + static __strong CFDictionaryRef staticGdictarray[10]; + static struct_with_ids_t staticGlobalStruct; + static struct_with_ids_t staticGlobalStructArray[10]; + + ASSIGNTEST(GlobalId, GlobalAssigns); // objc_assign_global + ASSIGNTEST(GlobalArray[0], GlobalAssigns); // objc_assign_global + ASSIGNTEST(GlobalObject, GlobalAssigns); // objc_assign_global + ASSIGNTEST(GlobalObjectArray[0], GlobalAssigns); // objc_assign_global + ASSIGNTEST(Gdict, GlobalAssigns); // objc_assign_global + ASSIGNTEST(Gdictarray[1], GlobalAssigns); // objc_assign_global + + ASSIGNTEST(GlobalStruct.element, GlobalAssigns); // objc_assign_global + ASSIGNTEST(GlobalStruct.elementArray[0], GlobalAssigns); // objc_assign_global + ASSIGNTEST(GlobalStruct.cfElement, GlobalAssigns); // objc_assign_global + ASSIGNTEST(GlobalStruct.cfElementArray[0], GlobalAssigns); // objc_assign_global + + ASSIGNTEST(staticGlobalId, GlobalAssigns); // objc_assign_global + ASSIGNTEST(staticGlobalArray[0], GlobalAssigns); // objc_assign_global + ASSIGNTEST(staticGlobalObject, GlobalAssigns); // objc_assign_global + ASSIGNTEST(staticGlobalObjectArray[0], GlobalAssigns); // objc_assign_global + ASSIGNTEST(staticGdict, GlobalAssigns); // objc_assign_global + ASSIGNTEST(staticGdictarray[1], GlobalAssigns); // objc_assign_global + + ASSIGNTEST(staticGlobalStruct.element, GlobalAssigns); // objc_assign_global + ASSIGNTEST(staticGlobalStruct.elementArray[0], GlobalAssigns); // objc_assign_global + ASSIGNTEST(staticGlobalStruct.cfElement, GlobalAssigns); // objc_assign_global + ASSIGNTEST(staticGlobalStruct.cfElementArray[0], GlobalAssigns); // objc_assign_global + + return counter; +} + + +int testIvars() { + Foo *foo = (Foo *)malloc(sizeof(Foo)); // don't call in ObjC + int counter = 0; + + ASSIGNTEST(foo->ivar, IvarAssigns); // objc_assign_ivar + ASSIGNTEST(foo->dict, IvarAssigns); // objc_assign_ivar + ASSIGNTEST(foo->dictArray[0], IvarAssigns); // objc_assign_ivar + ASSIGNTEST(foo->array[0], IvarAssigns); // objc_assign_ivar + ASSIGNTEST(foo->nsobject, IvarAssigns); // objc_assign_ivar + ASSIGNTEST(foo->stringArray[0], IvarAssigns); // objc_assign_ivar + ASSIGNTEST(foo->inner.element, IvarAssigns); // objc_assign_ivar + ASSIGNTEST(foo->inner.elementArray[0], IvarAssigns); // objc_assign_ivar + ASSIGNTEST(foo->inner.cfElement, IvarAssigns); // objc_assign_ivar + ASSIGNTEST(foo->inner.cfElementArray[0], IvarAssigns); // objc_assign_ivar + + return counter; +} + +int testStrongCasts() { + id x = nil; + int counter = 0; + typedef struct { @defs(Foo) } Foo_defs; + Foo_defs *foo = (Foo_defs *)malloc(sizeof(Foo)); + + // strong casts should always be issued, even if the compiler could know better + + ASSIGNTEST((__strong id)foo->ivar, StrongCastAssigns); // objc_assign_strongCast + ASSIGNTEST((__strong id)foo->dict, StrongCastAssigns); // objc_assign_strongCast + ASSIGNTEST((__strong id)foo->dictArray[0], StrongCastAssigns); // objc_assign_strongCast + ASSIGNTEST((__strong id)foo->array[0], StrongCastAssigns); // objc_assign_strongCast + ASSIGNTEST((__strong id)foo->nsobject, StrongCastAssigns); // objc_assign_strongCast + ASSIGNTEST((__strong id)foo->stringArray[0], StrongCastAssigns); // objc_assign_strongCast + ASSIGNTEST((__strong id)foo->inner.element, StrongCastAssigns); // objc_assign_strongCast + ASSIGNTEST((__strong id)foo->inner.elementArray[0], StrongCastAssigns);// objc_assign_strongCast + ASSIGNTEST((__strong id)foo->inner.cfElement, StrongCastAssigns); // objc_assign_strongCast + ASSIGNTEST((__strong id)foo->inner.cfElementArray[0], StrongCastAssigns);// objc_assign_strongCast + + // assignments to declared __strong on plain structure elements shouldn't work + + return counter; +} + +@implementation Foo +@end + +int main(int argc, char *argv[]) { + int errors = 0; + errors += testGlobals(); + errors += testIvars(); + errors += testStrongCasts(); + return (errors != 0); +} diff --git a/gcc/testsuite/objc.dg/objc-gc-3.m b/gcc/testsuite/objc.dg/objc-gc-3.m new file mode 100644 index 00000000000..dcb6c9679c8 --- /dev/null +++ b/gcc/testsuite/objc.dg/objc-gc-3.m @@ -0,0 +1,54 @@ +/* APPLE LOCAL file ObjC GC */ +/* A run-time test for insertion of write barriers. */ + +/* { dg-do run { target *-*-darwin* } } */ +/* { dg-options "-fnext-runtime -fobjc-gc" } */ + +#include <objc/objc.h> +#include <stdio.h> +#include <stdlib.h> + +// callouts to these are generated with cc -fobjc-gc + +int IvarAssigns; + +id objc_assign_ivar(id value, id dest, unsigned int offset) { + id *slot = (id*) ((char *)dest + offset); + + ++IvarAssigns; + return (*slot = value); +} + +// The test case elements; +@class NSObject; + +@interface Foo { +@public +// assignments to any/all of these fields should generate objc_assign_ivar + Foo *obj[20]; + short idx[5]; +} +@end + +int testIvars() { + Foo *foo = (Foo *)calloc(1,sizeof(Foo)); // don't call in ObjC + int counter = 0, errors = 0; +#define ASSIGNTEST(expr, global) expr = foo; if (!global) { printf(# expr " is busted\n"); ++errors; } global = 0 + + ASSIGNTEST(foo->obj[5], IvarAssigns); // objc_assign_ivar + ASSIGNTEST(foo->obj[++counter], IvarAssigns); // objc_assign_ivar + foo->idx[++counter] = 15; + ASSIGNTEST(foo->obj[foo->idx[2]], IvarAssigns); // objc_assign_ivar + + if (foo->obj[5] != foo || foo->obj[1] != foo || foo->obj[15] != foo) + abort(); + + return errors; +} + +@implementation Foo +@end + +int main(int argc, char *argv[]) { + return testIvars(); +} diff --git a/gcc/testsuite/objc.dg/objc-gc-4.m b/gcc/testsuite/objc.dg/objc-gc-4.m new file mode 100644 index 00000000000..329ee601a87 --- /dev/null +++ b/gcc/testsuite/objc.dg/objc-gc-4.m @@ -0,0 +1,64 @@ +/* APPLE LOCAL file mainline */ +/* Test looking up fields in superclasses in the context of write-barriers + (where component references get rewritten). */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-fobjc-gc" } */ + +#include <objc/Object.h> + +@class MyWindow; + +@interface MyDocument : Object { + MyWindow *_window; +} +@end + +@interface MyFileDocument : MyDocument { + struct { + unsigned int autoClose:1; + unsigned int openForUI:1; + unsigned int isClosing:1; + unsigned int needsDiskCheck:1; + unsigned int isWritable:1; + unsigned int representsFileOnDisk:1; + unsigned int RESERVED:26; + } _fdFlags; +} +@end + +@interface MyTextFileDocument : MyFileDocument { + Object *_textStorage; + struct __tfdFlags { + unsigned int immutable:1; + unsigned int lineEnding:2; + unsigned int isClosing:1; + unsigned int settingsAreSet:1; + unsigned int usesTabs:1; + unsigned int isUTF8WithBOM:1; + unsigned int wrapsLines:1; + unsigned int usingDefaultLanguage:1; + unsigned int RESERVED:23; + } _tfdFlags; + int _tabWidth; + int _indentWidth; +} +@end + +@interface MyRTFFileDocument : MyTextFileDocument +- (BOOL)readFromFile:(const char *)fileName ofType:(const char *)type; +@end + +@implementation MyRTFFileDocument +- (BOOL)readFromFile:(const char *)fileName ofType:(const char *)type { + if (_textStorage && fileName) { + [_textStorage free]; + return YES; + } else if (type) { + _textStorage = [MyRTFFileDocument new]; + return NO; + } + return (fileName && type); +} +@end diff --git a/gcc/testsuite/objc.dg/objc.c b/gcc/testsuite/objc.dg/objc.c new file mode 100644 index 00000000000..748111c26eb --- /dev/null +++ b/gcc/testsuite/objc.dg/objc.c @@ -0,0 +1,6 @@ +/* APPLE LOCAL file -ObjC */ + +/* { dg-do compile } */ +/* { dg-options "-ObjC" } */ + +@class foo; diff --git a/gcc/testsuite/objc.dg/pascal-strings-1.m b/gcc/testsuite/objc.dg/pascal-strings-1.m new file mode 100644 index 00000000000..477b94bbff2 --- /dev/null +++ b/gcc/testsuite/objc.dg/pascal-strings-1.m @@ -0,0 +1,20 @@ +/* APPLE LOCAL file pascal strings */ +/* Ensure that there are no warnings or errors issued when a Pascal string is used to + initialize an array and the NUL terminator does not fit. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-do compile } */ +/* { dg-options "-fpascal-strings" } */ + +typedef unsigned char Str15[16]; + +Str15 ggg = "\p012345678901234"; +Str15 hhh = "\p0123456789012345"; /* { dg-warning "initializer.string for array of chars is too long" } */ + +int foo(void) +{ + Str15 sss = "\p012345678901234"; + Str15 ttt = "\p0123456789012345"; /* { dg-warning "initializer.string for array of chars is too long" } */ + + return 0; +} diff --git a/gcc/testsuite/objc.dg/pragma-1.m b/gcc/testsuite/objc.dg/pragma-1.m new file mode 100644 index 00000000000..ab354582be6 --- /dev/null +++ b/gcc/testsuite/objc.dg/pragma-1.m @@ -0,0 +1,24 @@ +/* APPLE LOCAL file mainline */ +/* It is OK to use #pragma inside @implementation body. This test checks that. */ +/* Ziemowit Laski <zlaski@apple.com>. */ + +@interface A +{ + int p; +} ++(int) foo; +-(int) bar; +@end + +@implementation A +#pragma mark - +#pragma mark init / dealloc ++ (int)foo { + return 1; +} +#pragma mark - +#pragma mark Private Functions +- (int)bar { + return 2; +} +@end diff --git a/gcc/testsuite/objc.dg/proto-lossage-5.m b/gcc/testsuite/objc.dg/proto-lossage-5.m new file mode 100644 index 00000000000..c257411561f --- /dev/null +++ b/gcc/testsuite/objc.dg/proto-lossage-5.m @@ -0,0 +1,23 @@ +/* APPLE LOCAL file mainline */ +/* Do not lose references to forward-declared protocols. */ +/* { dg-do compile } */ +@class MyBaseClass; +@class MyClassThatFails; +@protocol _MyProtocol; + +@interface MyClassThatFails +- (MyBaseClass<_MyProtocol> *) aMethod; +@end + +@interface MyBaseClass +@end + +@protocol _MyProtocol +@end + +@implementation MyClassThatFails +- (MyBaseClass<_MyProtocol> *) aMethod +{ + return 0; +} +@end diff --git a/gcc/testsuite/objc.dg/selector-2.m b/gcc/testsuite/objc.dg/selector-2.m index 5584f1511b6..97ff03d78aa 100644 --- a/gcc/testsuite/objc.dg/selector-2.m +++ b/gcc/testsuite/objc.dg/selector-2.m @@ -1,5 +1,6 @@ +/* APPLE LOCAL file mainline */ /* Test that we don't ICE when issuing a -Wselector warning. */ -/* { dg-options "-Wselector -fgnu-runtime" } */ +/* { dg-options "-Wselector" } */ /* { dg-do compile } */ #include <objc/Object.h> @@ -12,5 +13,6 @@ SEL a; a = @selector(b1ar); } -@end /* { dg-warning "creating selector for nonexistent method .b1ar." } */ +@end +/* { dg-warning "creating selector for nonexistent method .b1ar." "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/objc.dg/selector-3.m b/gcc/testsuite/objc.dg/selector-3.m new file mode 100644 index 00000000000..7ac1d2aff87 --- /dev/null +++ b/gcc/testsuite/objc.dg/selector-3.m @@ -0,0 +1,27 @@ +/* APPLE LOCAL file mainline */ +/* Test warning for non-existent selectors. */ +/* This is the "-fgnu-runtime" variant of objc.dg/selector-1.m. */ +/* { dg-options "-Wselector -fgnu-runtime" } */ +/* { dg-do compile } */ + +typedef struct objc_object { struct objc_class *class_pointer; } *id; +typedef const struct objc_selector *SEL; + +@interface Foo +- (void) foo; +- (void) bar; +@end + +@implementation Foo +- (void) bar +{ +} + +- (void) foo +{ + SEL a,b,c; + a = @selector(b1ar); + b = @selector(bar); +} +@end /* { dg-warning "creating selector for nonexistent method .b1ar." } */ + diff --git a/gcc/testsuite/objc.dg/selector-4.m b/gcc/testsuite/objc.dg/selector-4.m new file mode 100644 index 00000000000..d4dee42461f --- /dev/null +++ b/gcc/testsuite/objc.dg/selector-4.m @@ -0,0 +1,31 @@ +/* APPLE LOCAL file mainline */ +/* Test whether including C++ keywords such as 'and', 'or', + 'not', etc., is allowed inside ObjC selectors (as it must be). */ +/* Author: Ziemowit Laski <zlaski@apple.com>. */ + +/* { dg-do compile } */ + +@interface Int1 ++ (int)and_eq:(int)arg1 and:(int)arg2; +- (int)or_eq:(int)arg1 or:(int)arg3; +- (int)not:(int)arg1 xor:(int)arg2; +- (void)bitand:(char)c1 bitor:(char)c2; +- (void)compl:(float)f1 xor_eq:(double)d1; +- (void)not_eq; +@end + +@implementation Int1 ++ (int)and_eq:(int)arg1 and:(int)arg2 { return arg1 + arg2; } +- (int)or_eq:(int)arg1 or:(int)arg3 { return arg1 + arg3; } +- (int)not:(int)arg1 xor:(int)arg2 { return arg1 + arg2; } +- (void)bitand:(char)c1 bitor:(char)c2 { } +- (void)compl:(float)f1 xor_eq:(double)d1 { } +- (void)not_eq { } +@end + +/* { dg-final { scan-assembler "\\+\\\[Int1 and_eq:and:\\]|c_Int1__and_eq_and" } } */ +/* { dg-final { scan-assembler "\\-\\\[Int1 or_eq:or:\\]|i_Int1__or_eq_or" } } */ +/* { dg-final { scan-assembler "\\-\\\[Int1 not:xor:\\]|i_Int1__not_xor" } } */ +/* { dg-final { scan-assembler "\\-\\\[Int1 bitand:bitor:\\]|i_Int1__bitand_bitor" } } */ +/* { dg-final { scan-assembler "\\-\\\[Int1 compl:xor_eq:\\]|i_Int1__compl_xor_eq" } } */ +/* { dg-final { scan-assembler "\\-\\\[Int1 not_eq\\]|i_Int1__not_eq" } } */ diff --git a/gcc/testsuite/objc.dg/stabs-1.m b/gcc/testsuite/objc.dg/stabs-1.m index 9c38b916728..cb8a6d26269 100644 --- a/gcc/testsuite/objc.dg/stabs-1.m +++ b/gcc/testsuite/objc.dg/stabs-1.m @@ -2,7 +2,7 @@ /* Contributed by Ziemowit Laski <zlaski@apple.com> */ /* { dg-do compile } */ -/* { dg-skip-if "No stabs" { mmix-*-* *-*-aix* alpha*-*-* ia64-*-* } { "*" } { "" } } */ +/* { dg-skip-if "No stabs" { mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* } { "*" } { "" } } */ /* { dg-options "-gstabs" } */ @interface MyClass @@ -15,4 +15,4 @@ } @end -/* { dg-final { scan-assembler ".text\"?\n\t.stabs.*100,0,0,(\\.)?L?Letext\[0-9\]*\n(\\.)?L?Letext" } } */ +/* { dg-final { scan-assembler "(.SUBSPA.*\[\$\]CODE\[\$\]|.text\"?)\n\t.stabs.*100,0,0,(\\.)?L?L\[\$\]?etext\[0-9\]*\n(\\.)?L?L\[\$\]?etext" } } */ diff --git a/gcc/testsuite/objc.dg/stret-2.m b/gcc/testsuite/objc.dg/stret-2.m index dd9a2e8e5b2..b4be5ff6a54 100644 --- a/gcc/testsuite/objc.dg/stret-2.m +++ b/gcc/testsuite/objc.dg/stret-2.m @@ -8,7 +8,10 @@ struct astruct { float a, b; -} glob = { 1.0, 2.0 }; + /* APPLE LOCAL begin testing */ + char c; +} glob = { 1.0, 2.0, 'a' }; +/* APPLE LOCAL end testing */ struct bstruct { float a, b, c, d, e, f; diff --git a/gcc/testsuite/objc.dg/stubify-1.m b/gcc/testsuite/objc.dg/stubify-1.m new file mode 100644 index 00000000000..a96b145f541 --- /dev/null +++ b/gcc/testsuite/objc.dg/stubify-1.m @@ -0,0 +1,34 @@ +/* APPLE LOCAL file mainline */ +/* All calls must be properly stubified. Complain about any "call + _objc_msgSend<end-of-line>" without the $stub suffix. */ + +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-Os -mdynamic-no-pic" } */ + +typedef struct objc_object { } *id ; +int x = 41 ; +extern id objc_msgSend(id self, char * op, ...); +extern int bogonic (int, int, int) ; +@interface Document {} +- (Document *) window; +- (Document *) class; +- (Document *) close; +@end +@implementation Document +- (Document *) class { } +- (Document *) close { } +- (Document *) window { } +- (void)willEndCloseSheet:(void *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { + [[self window] close]; + ((void (*)(id, char *, int))objc_msgSend)([self class], (char *)contextInfo, 1); + ((void (*)(id, char *, int))bogonic)([self class], (char *)contextInfo, 1); + bogonic (3, 4, 5); + x++; +} +@end + +/* { dg-final { scan-assembler-not "\(bl|call\)\[ \t\]+_objc_msgSend\n" } } */ +/* { dg-final { scan-assembler "\(bl|call\)\[ \t\]+L_objc_msgSend\\\$stub\n" } } */ +/* { dg-final { scan-assembler-not "\(bl|call\)\[ \t\]+_bogonic\n" } } */ +/* { dg-final { scan-assembler "\(bl|call\)\[ \t\]+L_bogonic\\\$stub\n" } } */ +/* { dg-final { scan-assembler-not "\\\$non_lazy_ptr" } } */ diff --git a/gcc/testsuite/objc.dg/stubify-2.m b/gcc/testsuite/objc.dg/stubify-2.m new file mode 100644 index 00000000000..0aebedfbecf --- /dev/null +++ b/gcc/testsuite/objc.dg/stubify-2.m @@ -0,0 +1,32 @@ +/* APPLE LOCAL file mainline */ +/* All calls must be properly stubified. */ +/* Testcase extracted from TextEdit:Document.m. */ + +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-mdynamic-no-pic -fdump-rtl-jump" } */ + +typedef struct objc_object { } *id ; +int x = 41 ; +extern id objc_msgSend(id self, char * op, ...); +extern int bogonic (int, int, int) ; +@interface Document {} +- (Document *) window; +- (Document *) class; +- (Document *) close; +@end +@implementation Document +- (Document *) class { } +- (Document *) close { } +- (Document *) window { } +- (void)willEndCloseSheet:(void *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { + [[self window] close]; + ((void (*)(id, char *, int))objc_msgSend)([self class], (char *)contextInfo, 1); + ((void (*)(id, char *, int))bogonic)([self class], (char *)contextInfo, 1); + bogonic (3, 4, 5); + x++; +} +@end + +/* Any symbol_ref of an un-stubified objc_msgSend is an error; look + for "objc_msgSend" in quotes, without the $stub suffix. */ +/* { dg-final { scan-file-not stubify-2.m.03.jump "symbol_ref.*\"objc_msgSend\"" } } */ diff --git a/gcc/testsuite/objc.dg/super-class-4.m b/gcc/testsuite/objc.dg/super-class-4.m new file mode 100644 index 00000000000..0f6317beb50 --- /dev/null +++ b/gcc/testsuite/objc.dg/super-class-4.m @@ -0,0 +1,35 @@ +/* APPLE LOCAL file mainliine */ +/* Bail out gracefully if attempting to derive from a class that has only been + forward-declared (via @class). Conversely, @compatibility_alias declarations + should be traversed to find the @interface. */ +/* { dg-do compile } */ + +#include <objc/Object.h> + +@class MyWpModule; + +@compatibility_alias MyObject Object; +@compatibility_alias FictitiousModule MyWpModule; + +@protocol MySelTarget +- (id) meth1; +@end + +@protocol Img +- (id) meth2; +@end + +@interface FunnyModule: FictitiousModule <Img> /* { dg-error ".MyWpModule., superclass of .FunnyModule." } */ +- (id) meth2; +@end + +@interface MyProjWpModule : MyWpModule <MySelTarget, Img> /* { dg-error ".MyWpModule., superclass of .MyProjWpModule." } */ { + id i1, i2; +} +- (id) meth1; +- (id) meth2; +@end + +@interface AnotherModule: MyObject <MySelTarget> +- (id) meth1; +@end diff --git a/gcc/testsuite/objc.dg/super-dealloc-1.m b/gcc/testsuite/objc.dg/super-dealloc-1.m new file mode 100644 index 00000000000..0e123f20b8b --- /dev/null +++ b/gcc/testsuite/objc.dg/super-dealloc-1.m @@ -0,0 +1,47 @@ +/* APPLE LOCAL file mainline */ +/* Check for warnings about missing [super dealloc] calls. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-do compile } */ + +@interface Foo { + void *isa; +} +- (void) dealloc; +- (void) some_other; +@end + +@interface Bar: Foo { + void *casa; +} +- (void) dealloc; +@end + +@interface Baz: Bar { + void *usa; +} +- (void) dealloc; +@end + +@implementation Foo +- (void) dealloc { + isa = 0; /* Should not warn here. */ +} +- (void) some_other { + isa = (void *)-1; +} +@end + +@implementation Bar +- (void) dealloc { + casa = 0; + [super some_other]; +} /* { dg-warning "method possibly missing a .super dealloc. call" } */ +@end + +@implementation Baz +- (void) dealloc { + usa = 0; + [super dealloc]; /* Should not warn here. */ +} +@end diff --git a/gcc/testsuite/objc.dg/super-dealloc-2.m b/gcc/testsuite/objc.dg/super-dealloc-2.m new file mode 100644 index 00000000000..b60b82c13d7 --- /dev/null +++ b/gcc/testsuite/objc.dg/super-dealloc-2.m @@ -0,0 +1,47 @@ +/* APPLE LOCAL file mainline */ +/* Check for warnings about missing [super dealloc] calls. */ +/* Author: Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-do compile } */ + +@interface Foo { + void *isa; +} +- (void) dealloc; +- (void) some_other; +@end + +@interface Bar: Foo { + void *casa; +} +- (void) dealloc0; +@end + +@interface Baz: Bar { + void *usa; +} +- (void) dealloc; +@end + +@implementation Foo +- (void) dealloc { + isa = 0; /* Should not warn here. */ +} +- (void) some_other { + isa = (void *)-1; +} +@end + +@implementation Bar +- (void) dealloc0 { + casa = 0; + [super some_other]; /* Should not warn here. */ +} +@end + +@implementation Baz +- (void) dealloc { + usa = 0; + [super dealloc0]; +} /* { dg-warning "method possibly missing a .super dealloc. call" } */ +@end diff --git a/gcc/testsuite/objc.dg/symtab-1.m b/gcc/testsuite/objc.dg/symtab-1.m index d031cb46d06..d9e47e592d8 100644 --- a/gcc/testsuite/objc.dg/symtab-1.m +++ b/gcc/testsuite/objc.dg/symtab-1.m @@ -21,4 +21,5 @@ -(void)checkValues { } @end -/* { dg-final { scan-assembler "L_OBJC_SYMBOLS.*:\n\t.long\t0\n\t.long\t0\n\t.short\t2\n\t.short\t0\n\t.long\tL_OBJC_CLASS_Derived.*\n\t.long\tL_OBJC_CLASS_Base.*\n" } } */ +/* APPLE LOCAL testing */ +/* { dg-final { scan-assembler "L_OBJC_SYMBOLS.*:\n\t.long\t0\n\t.long\t0\n\t.(short|word)\t2\n\t.(short|word)\t0\n\t.long\tL_OBJC_CLASS_Derived.*\n\t.long\tL_OBJC_CLASS_Base.*\n" } } */ diff --git a/gcc/testsuite/objc.dg/try-catch-6.m b/gcc/testsuite/objc.dg/try-catch-6.m new file mode 100644 index 00000000000..0d82ff900fa --- /dev/null +++ b/gcc/testsuite/objc.dg/try-catch-6.m @@ -0,0 +1,26 @@ +/* APPLE LOCAL file mainline */ +/* { dg-do compile } */ +/* { dg-options "-fobjc-exceptions" } */ + +#include <objc/Object.h> + +int main (int argc, const char * argv[]) { + Object * pool = [Object new]; + int a; + + if ( 1 ) { + + @try { + a = 1; + } + @catch (Object *e) { + a = 2; + } + @finally { + a = 3; + } + } + + [pool free]; + return 0; +} diff --git a/gcc/testsuite/objc.dg/try-catch-7.m b/gcc/testsuite/objc.dg/try-catch-7.m new file mode 100644 index 00000000000..6a9beecb4ac --- /dev/null +++ b/gcc/testsuite/objc.dg/try-catch-7.m @@ -0,0 +1,28 @@ +/* APPLE LOCAL file mainline */ +/* Test for graceful compilation of @synchronized statements. */ + +/* { dg-do compile } */ +/* { dg-options "-fobjc-exceptions" } */ + +#include <objc/Object.h> + +@interface Derived: Object +- (id) meth; +@end + +@implementation Derived +- (id) meth { + return self; +} + +static Derived* rewriteDict(void) { + static Derived *sDict = 0; + if (sDict == 0) { + @synchronized ([Derived class]) { + if (sDict == 0) + sDict = [Derived new]; + } + } + return sDict; +} +@end diff --git a/gcc/testsuite/objc.dg/try-catch-8.m b/gcc/testsuite/objc.dg/try-catch-8.m new file mode 100644 index 00000000000..a36257051c3 --- /dev/null +++ b/gcc/testsuite/objc.dg/try-catch-8.m @@ -0,0 +1,66 @@ +/* APPLE LOCAL file mainline */ +/* Check that local variables that get modified inside the @try + block survive until the @catch block is reached. */ +/* Developed by Ziemowit Laski <zlaski@apple.com>. */ + +/* { dg-options "-fobjc-exceptions -O2" } */ +/* { dg-do run } */ + +#include <objc/Object.h> +#include <stdlib.h> +#include <stdio.h> + +int gi1 = 9, gi2 = 19; +float gf1 = 9.0, gf2 = 19.0; +id obj2 = nil; + +void foo (int arg1, float *arg2) +{ + int *pi = &gi1; + float *pf = &gf1; + id obj1 = nil; + int local1 = 45, local2 = 47; + float local3 = 3.0, local4 = 4.0; + register int local5 = 15; + static float local6 = 16.0; + + @try { + local1 = 123; + local2 = 345; + local3 = 5.0; + local4 = 6.0; + local5 = 17; + local6 = 18.0; + pi = &gi2; + pf = &gf2; + obj2 = obj1 = [Object new]; + arg1 = 17; + arg2 = &gf2; + + @throw [Object new]; + } + @catch (Object *obj) { + if (local1 != 123 || local2 != 345 || local3 != 5.0 || local4 != 6.0 + || local5 != 17 || local6 != 18.0) { + printf("Abort 1\n"); + abort(); + } + if(pi != &gi2 || pf != &gf2) { + printf("Abort 2\n"); + abort(); + } + if(!obj1 || obj1 != obj2) { + printf("Abort 3\n"); + abort(); + } + if(arg1 != 17 || arg2 != &gf2) { + printf("Abort 4\n"); + abort(); + } + } +} + +int main(void) { + foo(15, &gf1); + return 0; +} diff --git a/gcc/testsuite/objc.dg/try-catch-9.m b/gcc/testsuite/objc.dg/try-catch-9.m new file mode 100644 index 00000000000..66d59e9bd60 --- /dev/null +++ b/gcc/testsuite/objc.dg/try-catch-9.m @@ -0,0 +1,26 @@ +/* APPLE LOCAL file mainline */ +/* Check that taking the address of a local variable marked 'volatile' + by the compiler does not generate untoward errors. */ +/* Developed by Ziemowit Laski <zlaski@apple.com>. */ + +/* { dg-options "-fobjc-exceptions" } */ +/* { dg-do compile } */ + + +void foo (int *arg1, int *arg2) +{ + *arg1 = *arg2; +} + +void bar (int arg) { + int rcvr; + + @try { + rcvr = arg; + } + @finally { + int *rcvr0 = &rcvr; + foo (rcvr0, &arg); + } +} + diff --git a/gcc/testsuite/objc.dg/typedef-alias-1.m b/gcc/testsuite/objc.dg/typedef-alias-1.m new file mode 100644 index 00000000000..608084c1504 --- /dev/null +++ b/gcc/testsuite/objc.dg/typedef-alias-1.m @@ -0,0 +1,17 @@ +/* APPLE LOCAL file mainline */ +/* Typedefs of ObjC types should work without any bogus warnings. */ +/* { dg-do compile } */ + +#include <objc/Object.h> + +typedef Object MyObject; + +int main (int argc, const char * argv[]) +{ + Object* a = nil; + MyObject* b = a; + Object* c = b; + + return 0; +} + diff --git a/gcc/testsuite/objc.dg/volatile-1.m b/gcc/testsuite/objc.dg/volatile-1.m index 8b5381a9874..516c4588106 100644 --- a/gcc/testsuite/objc.dg/volatile-1.m +++ b/gcc/testsuite/objc.dg/volatile-1.m @@ -16,3 +16,5 @@ @end /* { dg-final { scan-assembler "li r\[0-9\]+,1" { target powerpc*-*-darwin* } } } */ +/* APPLE LOCAL testing */ +/* { dg-final { scan-assembler "movl\t\\\$1, 16\\(%ebp\\)" { target i?86*-*-darwin* } } } */ diff --git a/gcc/testsuite/objc/execute/next_mapping.h b/gcc/testsuite/objc/execute/next_mapping.h index 0a361896e12..713558ac8e9 100644 --- a/gcc/testsuite/objc/execute/next_mapping.h +++ b/gcc/testsuite/objc/execute/next_mapping.h @@ -8,6 +8,10 @@ #include <objc/objc-class.h> #include <objc/Object.h> #include <ctype.h> +/* APPLE LOCAL begin mainline */ +#include <stdlib.h> +#include <string.h> +/* APPLE LOCAL end mainline */ #define objc_get_class(C) objc_getClass(C) #define objc_get_meta_class(C) objc_getMetaClass(C) @@ -44,23 +48,33 @@ /* The following is necessary to "cover" the bf*.m test cases on NeXT. */ +/* APPLE LOCAL begin mainline */ #undef MAX +#undef MIN +#undef ROUND + +#ifdef __cplusplus +#define MAX(X, Y) ((X > Y) ? X : Y) +#define MIN(X, Y) ((X < Y) ? X : Y) +#define ROUND(V, A) (A * ((V + A - 1) / A)) +#else #define MAX(X, Y) \ ({ typeof (X) __x = (X), __y = (Y); \ (__x > __y ? __x : __y); }) - -#undef MIN #define MIN(X, Y) \ ({ typeof (X) __x = (X), __y = (Y); \ (__x < __y ? __x : __y); }) - -#undef ROUND #define ROUND(V, A) \ ({ typeof (V) __v = (V); typeof (A) __a = (A); \ __a * ((__v+__a - 1)/__a); }) +#endif +/* APPLE LOCAL end mainline */ #define BITS_PER_UNIT __CHAR_BIT__ -#define STRUCTURE_SIZE_BOUNDARY (BITS_PER_UNIT * sizeof (struct{char a;})) +/* APPLE LOCAL begin mainline */ +typedef struct{ char a; } __small_struct; +#define STRUCTURE_SIZE_BOUNDARY (BITS_PER_UNIT * sizeof (__small_struct)) +/* APPLE LOCAL end mainline */ /* Not sure why the following are missing from NeXT objc headers... */ @@ -104,7 +118,8 @@ struct objc_struct_layout unsigned int record_align; }; -typedef union { +/* APPLE LOCAL mainline */ +typedef union arglist { char *arg_ptr; char arg_regs[sizeof (char*)]; } *arglist_t; /* argument frame */ @@ -117,6 +132,8 @@ void objc_layout_structure (const char *type, BOOL objc_layout_structure_next_member (struct objc_struct_layout *layout); void objc_layout_finish_structure (struct objc_struct_layout *layout, unsigned int *size, unsigned int *align); +/* APPLE LOCAL mainline */ +int objc_aligned_size (const char *type); /* return the size of an object specified by type @@ -193,9 +210,8 @@ objc_sizeof_type (const char *type) return sizeof (double); break; - case _C_VOID: - return sizeof (void); - break; + /* APPLE LOCAL mainline */ + /* Do not compute 'sizeof (void)'. */ case _C_PTR: case _C_ATOM: diff --git a/gcc/testsuite/treelang/ChangeLog b/gcc/testsuite/treelang/ChangeLog index c60765b837c..348ffd6d3cf 100644 --- a/gcc/testsuite/treelang/ChangeLog +++ b/gcc/testsuite/treelang/ChangeLog @@ -1,3 +1,35 @@ +2005-04-20 Release Manager + + * GCC 4.0.0 released. + +2005-03-11 James A. Morrison <phython@gcc.gnu.org> + + Backport recent test cases added to mainline: + 2005-02-26 James A. Morrison <phython@gcc.gnu.org> + + * compile/var_defs: Add uninitialized variables. + + 2005-02-26 James A. Morrison <phython@gcc.gnu.org> + + * compile/extrafunc.tree, compile/extravar.tree: New tests. + + 2005-02-26 James A. Morrison <phython@gcc.gnu.org> + + * compile/unsigned.tree: New test. + +2005-02-24 James A. Morrison <phython@gcc.gnu.org> + + PR other/19896 + * execute/execute.exp: New file. + * execute/funccall.tree, execute/funccall-2.tree, execute/initial.tree, + execute/main.tree, execute/static.tree: New tests. + +2005-02-24 James A. Morrison <phython@gcc.gnu.org> + + PR other/19897 + * compile/exit.tree, compile/extref.tree, compile/function-1.tree, + compile/syntax-1.tree: New tests. + 2004-10-02 James A. Morrison <phython@gcc.gnu.org> * compile/autofunc.tree: New File. diff --git a/gcc/testsuite/treelang/compile/exit.tree b/gcc/testsuite/treelang/compile/exit.tree new file mode 100644 index 00000000000..fd12e3568f6 --- /dev/null +++ b/gcc/testsuite/treelang/compile/exit.tree @@ -0,0 +1,12 @@ +// { dg-do compile { xfail *-*-* } } +external_reference void exit (int code); + +static int foo (); + +foo +{ + automatic int bar = +1; + bar = bar + +1; + exit (0); // Calling external references is currently broken. + return bar; +} diff --git a/gcc/testsuite/treelang/compile/extrafunc.tree b/gcc/testsuite/treelang/compile/extrafunc.tree new file mode 100644 index 00000000000..6682a118a04 --- /dev/null +++ b/gcc/testsuite/treelang/compile/extrafunc.tree @@ -0,0 +1,24 @@ +// { dg-do compile } +// { dg-options "-O2 -fdump-tree-optimized -Wunused-function" } +// Check to see that unused functions get removed at -O2 and +// above. +static int foo (int bar); +static int baz (int aaa); +external_definition int ext (int bbb); + +foo +{ + return bar; +} + +baz // { dg-warning "defined but not used" } +{ + return foo (aaa); +} + +ext +{ + return foo (bbb); +} + +// { dg-final { scan-tree-dump-not "baz" "optimized" } } diff --git a/gcc/testsuite/treelang/compile/extravar.tree b/gcc/testsuite/treelang/compile/extravar.tree new file mode 100644 index 00000000000..5c6b5867b8c --- /dev/null +++ b/gcc/testsuite/treelang/compile/extravar.tree @@ -0,0 +1,13 @@ +// { dg-do compile } +// { dg-options "-fdump-tree-vars -O1 -Wunused-variable" } +external_definition int bar (int aaa, int ddd); + +static int foo = -3; // { dg-warning "defined but not used" } + +bar +{ + automatic int ccc; + + return aaa + ddd + +3; +} +// { dg-final { scan-tree-dump-not "ccc" "vars" } } diff --git a/gcc/testsuite/treelang/compile/extref.tree b/gcc/testsuite/treelang/compile/extref.tree new file mode 100644 index 00000000000..085ab8f88fd --- /dev/null +++ b/gcc/testsuite/treelang/compile/extref.tree @@ -0,0 +1,9 @@ +// { dg-do compile } +external_reference void abort (); + +static int foo (int a); + +foo +{ + return a; +} diff --git a/gcc/testsuite/treelang/compile/function-1.tree b/gcc/testsuite/treelang/compile/function-1.tree new file mode 100644 index 00000000000..6bb4e370a48 --- /dev/null +++ b/gcc/testsuite/treelang/compile/function-1.tree @@ -0,0 +1,14 @@ +// { dg-do compile } +static int foo (); +static int bar (int a); + +foo +{ + return 1; +} + +bar +{ + a = a + foo (); + return a; +} diff --git a/gcc/testsuite/treelang/compile/syntax-1.tree b/gcc/testsuite/treelang/compile/syntax-1.tree new file mode 100644 index 00000000000..32efe744ca2 --- /dev/null +++ b/gcc/testsuite/treelang/compile/syntax-1.tree @@ -0,0 +1,9 @@ +// { dg-do compile } +external_reference void exit(int); // { dg-error "(parse|syntax) error" } + +static int foo (int a); + +foo +{ + return a; +} diff --git a/gcc/testsuite/treelang/compile/unsigned.tree b/gcc/testsuite/treelang/compile/unsigned.tree new file mode 100644 index 00000000000..d10eacf7755 --- /dev/null +++ b/gcc/testsuite/treelang/compile/unsigned.tree @@ -0,0 +1,19 @@ +// { dg-do compile } +// { dg-options "-fdump-tree-generic" } +external_reference void abort (); +external_reference void exit (int status); +external_definition int main (int argc, int argv); + +main +{ + automatic unsigned int bar = 2147483649; + automatic unsigned int baz = 2147483649; + + if (bar == baz) { + abort (); + } else { + exit (0); + } + return +1; +} +// { dg-final { scan-tree-dump-not "\\\(int\\\)" "generic" } } diff --git a/gcc/testsuite/treelang/compile/var_defs.tree b/gcc/testsuite/treelang/compile/var_defs.tree index aaab0d9099e..49f9cd0385b 100644 --- a/gcc/testsuite/treelang/compile/var_defs.tree +++ b/gcc/testsuite/treelang/compile/var_defs.tree @@ -1,4 +1,5 @@ // { dg-do compile } +// { dg-options "-Wuninitialized -O" } external_definition void boring (int arg0); external_definition char condition (char arg1, char arg2); external_definition int first_nonzero (int arg5, int arg6); @@ -14,11 +15,12 @@ condition if (arg1) { automatic int i; - return arg1; + return i + 1; // { dg-warning "uninitialized" } } else { - return 0; + automatic int j; + return j; // { dg-warning "uninitialized" } } } |