diff options
Diffstat (limited to 'gcc/testsuite')
201 files changed, 3696 insertions, 138 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 864215d9dc4..6edcc7d5f27 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,501 @@ +2016-09-19 Fritz Reese <fritzoreese@gmail.com> + + PR fortran/77584 + * gfortran.dg/dec_structure_15.f90: New testcase. + +2016-09-19 Richard Biener <rguenther@suse.de> + + PR middle-end/77605 + * gcc.dg/torture/pr77605.c: New testcase. + +2016-09-18 Louis Krupp <louis.krupp@zoho.com> + + * gfortran.dg/pr68078.f90: XFAIL run on Darwin + +2016-09-17 Jan Hubicka <hubicka@ucw.cz> + + * g++.dg/predict-loop-exit-1.C: Disable early jump threading. + * g++.dg/predict-loop-exit-2.C: Disable early jump threading. + * g++.dg/predict-loop-exit-3.C: Disable early jump threading. + * gcc.dg/tree-ssa/pr69196-1.c: Disable early jump threading. + * gcc.dg/tree-ssa/vrp01.c: Disable early jump threading. + * gcc.dg/tree-ssa/ssa-dom-thread-2b.c: Disable early jump threading. + * gcc.dg/tree-ssa/pr68198.c: Scan ethread dump. + * gcc.dg/tree-ssa/ssa-thread-13.c: Scan ethread dump. + * gcc.dg/tree-ssa/vrp56.c: Scan ethread dump. + * gcc.dg/tree-ssa/vrp92.c: Scan ethread dump. + * gcc.dg/uninit-15.c: Swap xfailed and non-xfailed alternative. + +2016-09-18 Kirill Yukhin <kirill.yukhin@gmaile.com> + + * gcc.target/i386/pr68633.c: Fix expected result. + +2016-09-17 Louis Krupp <louis.krupp@gmail.com> + + PR fortran/68078 + * gfortran.dg/pr68078.f90: New test. + * gfortran.dg/set_vm_limit.c: New, called by pr68078. + +2016-09-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + PR target/77613 + * gcc.target/powerpc/swaps-p8-25.c: New. + +2016-09-16 Jakub Jelinek <jakub@redhat.com> + + PR c++/77482 + * g++.dg/cpp0x/constexpr-77482.C: New test. + + PR c++/77379 + * g++.dg/abi/abi-tag23.C: Adjust scan-assembler regex for differing + thunk offsets. + * g++.dg/abi/abi-tag23a.C: Likewise. + + PR c++/77338 + * g++.dg/cpp0x/decltype-77338.C: New test. + + PR c++/77375 + * g++.dg/cpp0x/mutable1.C: New test. + +2016-09-16 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/77612 + * gfortran.dg/pr77612.f90: New test. + +2016-09-16 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com> + + * gcc.dg/torture/pr70421.c: Require int32plus. + +2016-09-16 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/77475 + * gcc.target/i386/pr65990.c: Adjust dg-error regexp. + + PR target/77526 + * gcc.target/i386/pr77526.c: New test. + +2016-09-16 Jakub Jelinek <jakub@redhat.com> + Eric Botcazou <ebotcazou@adacore.com> + + PR middle-end/77594 + * gcc.target/i386/pr77594.c: New test. + +2016-09-15 Louis Krupp <louis.krupp@zoho.com> + + PR fortran/69963 + * gfortran.dg/misplaced_implicit_character.f90: New test. + +2016-09-15 Bin Cheng <bin.cheng@arm.com> + + PR tree-optimization/77503 + * gcc.dg/vect/pr77503.c: New test. + +2016-09-15 Richard Biener <rguenther@suse.de> + + PR middle-end/77544 + * c-c++-common/torture/pr77544.c: New testcase. + +2016-09-15 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/77475 + * gcc.target/i386/pr65990.c: Adjust expected diagnostics. + * gcc.dg/march-generic.c: Likewise. + * gcc.target/i386/spellcheck-options-1.c: New test. + * gcc.target/i386/spellcheck-options-2.c: New test. + * gcc.target/i386/spellcheck-options-3.c: New test. + * gcc.target/i386/spellcheck-options-4.c: New test. + +2016-09-15 Chung-Lin Tang <cltang@codesourcery.com> + + PR fortran/72743 + * gfortran.dg/goacc/pr72743.f90: New test. + +2016-09-15 Richard Biener <rguenther@suse.de> + + * gcc.dg/fold-reassoc-2.c: Fix dump scan. + +2016-09-15 Richard Biener <rguenther@suse.de> + + PR tree-optimization/77514 + * gcc.dg/torture/pr77514.c: New testcase. + +2016-09-14 Jakub Jelinek <jakub@redhat.com> + + PR c++/77549 + * g++.dg/lookup/pr77549.C: New test. + +2016-09-14 Marek Polacek <polacek@redhat.com> + + * c-c++-common/gomp/atomic-12.c: Use -Wno-deprecated. + * c-c++-common/gomp/atomic-13.c: Likewise. + * c-c++-common/gomp/atomic-14.c: Likewise. + * g++.dg/cpp1y/lambda-init11.C: Remove invalid code. + * g++.dg/cpp1z/bool-increment1.C: New test. + * c-c++-common/pr60439.c: Add dg-warning. + * g++.dg/expr/bitfield4.C: Likewise. + * g++.dg/expr/bitfield5.C: Likewise. + * g++.dg/expr/bitfield6.C: Likewise. + * g++.dg/expr/bool1.C: Likewise. + * g++.dg/expr/bool3.C: Likewise. + * g++.dg/expr/lval3.C: Likewise. + * g++.dg/expr/lval4.C: Likewise. + * g++.old-deja/g++.jason/bool5.C: Likewise. + * g++.dg/expr/bitfield3.C: Adjust dg-error. + * g++.dg/other/error18.C: Likewise. + * g++.dg/gomp/atomic-14.C: Likewise. + +2016-09-14 Nathan Sidwell <nathan@acm.org> + + PR c++/77539 + * g++.dg/cpp1y/pr77539.C: New. + +2016-09-14 Christophe Lyon <christophe.lyon@linaro.org> + + * g++.dg/cpp0x/lambda/lambda-mangle.C: Move dg-do directive before + dg-require. + * g++.dg/ext/builtin_alloca.C: Likewise. + * g++.dg/template/spec35.C: Likewise. + * gcc.dg/builtins-68.c: Likewise. + * gcc.misc-tests/gcov-13.c: Likewise. + * gcc.misc-tests/gcov-14.c: Likewise. + +2016-09-13 Jim MacArthur <jim.macarthur@codethink.co.uk> + + * gfortran.dg/dec_structure_14.f90: New testcase. + +2016-09-14 Jakub Jelinek <jakub@redhat.com> + + PR sanitizer/68260 + * c-c++-common/tsan/pr68260.c: New test. + +2016-09-13 Joe Seymour <joe.s@somniumtech.com> + + PR target/70713 + * gcc.target/msp430/function-attributes-1.c: New test. + * gcc.target/msp430/function-attributes-2.c: New test. + * gcc.target/msp430/function-attributes-3.c: New test. + +2016-09-13 Jakub Jelinek <jakub@redhat.com> + + * g++.dg/cpp0x/gen-attrs-61.C: New test. + * g++.dg/cpp1z/gen-attrs1.C: New test. + + PR tree-optimization/77454 + * gcc.dg/pr77454.c: New test. + + PR c++/77553 + * g++.dg/cpp1y/constexpr-77553.C: New test. + +2016-09-13 David Malcolm <dmalcolm@redhat.com> + + * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c + (test_show_locus): Replace rich_location::add_fixit_insert calls + with add_fixit_insert_before and add_fixit_insert_after. + +2016-09-13 Jason Merrill <jason@redhat.com> + Tom de Vries <tom@codesourcery.com> + + PR c++/77427 + * g++.dg/pr77427.C: New test. + +2016-09-13 Martin Liska <mliska@suse.cz> + + * g++.dg/gcov/gcov-threads-1.C: Use profile_update_atomic + effective target. + * gcc.dg/tree-prof/val-profiler-threads-1.c: Likewise. + * lib/target-supports.exp: Define the new target. + +2016-09-12 Andrew Pinski <apinski@cavium.com> + + * gcc.target/aarch64/thunderxloadpair.c: New testcase. + * gcc.target/aarch64/thunderxnoloadpair.c: New testcase. + +2016-09-12 Uros Bizjak <ubizjak@gmail.com> + + * gcc.dg/compat/scalar-by-value-4_x.c: Also test passing of + variable arguments. + * gcc.dg/compat/scalar-by-value-4_y.c (testva##NAME): New. + * gcc.dg/compat/scalar-by-value-4_main.c: Update description comment. + * gcc.dg/compat/scalar-return-4_x.c: Also test returning of + variable argument. + * gcc.dg/compat/scalar-return-4_y.c (testva##NAME): New. + * gcc.dg/compat/scalar-return-4_main.c: Update description comment. + +2016-09-12 Bernd Edlinger <bernd.edlinger@hotmail.de> + + PR c++/77496 + * c-c++-common/warn-ommitted-condop.c: Add more test cases. + * g++.dg/ext/pr77496.C: New test. + * g++.dg/warn/pr77496.C: New test. + +2016-09-12 David Malcolm <dmalcolm@redhat.com> + + PR c/72858 + * gcc.dg/format/diagnostic-ranges.c: Update expected suggestions + to preserve conversion chars, and to preserve prefix information. + * gcc.dg/format/pr72858.c: New test case. + +2016-09-11 Steven G. Kargl <kargl@gcc.gnu.org> + + * gfortran.dg/pr77507.f90: Move to ... + * gfortran.dg/ieee/pr77507.f90: here. + +2016-08-09 Jan Hubicka <hubicka@ucw.cz> + + PR ipa/61159 + * compile/pr61159.c: New testcase + +2016-08-09 Jan Hubicka <hubicka@ucw.cz> + + PR ipa/64316 + * gcc.dg/ipa/pr63416.c: New testcase. + +2016-09-10 Paul Thomas <pault@gcc.gnu.org> + Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/77532 + * gfortran.dg/dtio_11.f90: new test. + +2016-09-10 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/77507 + * gfortran.dg/c_assoc_2.f03: Update error message for revision 240050 + * gfortran.dg/c_assoc_4.f90: Ditto. + +2016-09-10 Tom de Vries <tom@codesourcery.com> + + PR C/71602 + * c-c++-common/va-arg-va-list-type.c: New test. + +2016-09-09 Peter Bergner <bergner@vnet.ibm.com> + + PR rtl-optimization/77289 + * gcc.target/powerpc/pr77289.c: New test. + +2016-09-09 Martin Sebor <msebor@redhat.com> + + PR c/77520 + PR c/77521 + * gcc.dg/pr77520.c: New test. + * gcc.dg/pr77521.c: New test. + +2016-09-09 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/77506 + * gfortran.dg/pr77506.f90: New test. + +2016-09-09 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/77507 + * gfortran.dg/pr77507.f90: New test. + +2016-09-09 Joseph Myers <joseph@codesourcery.com> + + * gcc.dg/limits-width-1.c, gcc.dg/stdint-width-1.c: New tests. + +2016-09-08 Steven G. Kargl <kargl@gcc.gnu.org> + Louis Krupp <lkrupp@gcc.gnu.org> + + PR fortran/69514 + * gfortran.dg/pr69514_1.f90: New test. + * gfortran.dg/pr69514_2.f90: New test. + +2016-09-08 Jakub Jelinek <jakub@redhat.com> + + PR fortran/77500 + * gfortran.dg/gomp/pr77500.f90: New test. + + PR fortran/77516 + * gfortran.dg/gomp/pr77516.f90: New test. + +2016-09-07 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/77475 + * gcc.target/aarch64/arch-diagnostics-1.c: Expect error on line 0. + * gcc.target/aarch64/arch-diagnostics-2.c: Likewise. + * gcc.target/aarch64/cpu-diagnostics-1.c: Likewise. + * gcc.target/aarch64/cpu-diagnostics-2.c: Likewise. + * gcc.target/aarch64/cpu-diagnostics-3.c: Likewise. + * gcc.target/aarch64/cpu-diagnostics-4.c: Likewise. + +2016-09-07 David Malcolm <dmalcolm@redhat.com> + + * gcc.dg/plugin/diagnostic_plugin_test_string_literals.c: Include + "substring-locations.h". + +2016-09-07 Richard Biener <rguenther@suse.de> + + PR c/77450 + * c-c++-common/vector-subscript-8.c: Move .. + * gcc.dg/pr77450.c: ... here. + +2016-09-06 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libgfortran/77393 + * gfortran.dg/fmt_f0_2.f90: Update test. + * gfortran.dg/fmt_f0_3.f90: New test. + +2016-09-07 Dominique d'Humieres <dominiq@lps.ens.fr> + + PR debug/77389 + * g++.dg/debug/dwarf2/template-params-12g.C: Pass -gno-strict-dwarf + in dg-options. + + PR debug/57519 + * g++.dg/debug/dwarf2/imported-decl-2.C: Likewise. + +2016-09-06 Jakub Jelinek <jakub@redhat.com> + + PR target/69255 + * gcc.target/i386/pr69255-1.c: New test. + * gcc.target/i386/pr69255-2.c: New test. + * gcc.target/i386/pr69255-3.c: New test. + +2016-09-06 Martin Sebor <msebor@redhat.com> + + PR c/77336 + * gcc.dg/format/miss-7.c: New test. + +2016-09-06 Uros Bizjak <ubizjak@gmail.com> + + * gfortran.dg/c_by_val_1.f: Correct the call to c_to_c and c_to_c8. + +2016-09-06 Martin Liska <mliska@suse.cz> + + PR gcov-profile/77378 + PR gcov-profile/77466 + * gcc.dg/profile-update-warning.c: New test. + +2016-09-06 Richard Biener <rguenther@suse.de> + + PR tree-optimization/77479 + * gcc.dg/torture/pr77479.c: New testcase. + +2016-09-06 Richard Biener <rguenther@suse.de> + + PR c/77450 + * c-c++-common/vector-subscript-7.c: Adjust. + * c-c++-common/vector-subscript-8.c: New testcase. + +2016-09-06 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com> + + * gcc.dg/Wno-frame-address.c: Skip for avr-*-*. + +2016-09-05 Jakub Jelinek <jakub@redhat.com> + + PR target/77476 + * gcc.target/i386/avx512f-pr77476.c: New test. + * gcc.target/i386/avx512bw-pr77476.c: New test. + * gcc.target/i386/avx512dq-pr77476.c: New test. + + * lib/target-supports.exp (check_effective_target_vect_simd_clones): + Update comment to mention also avx512f. + + PR sanitizer/77396 + * g++.dg/asan/pr77396-2.C: New test. + +2016-09-05 Uros Bizjak <ubizjak@gmail.com> + + PR rtl-optimization/77452 + * gcc.target/i386/pr77452.c: New test. + +2016-09-05 Marek Polacek <polacek@redhat.com> + + PR c/77423 + * c-c++-common/Wlogical-not-parentheses-3.c: New test. + +2016-09-04 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/77391 + * gfortran.dg/pr77391.f90: New test. + +2016-09-04 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/77460 + * gfortran.dg/pr77460.f90: New test. + +2016-09-03 Jakub Jelinek <jakub@redhat.com> + + PR c/65467 + * gcc.dg/gomp/_Atomic-4.c: Require vect_simd_clones effective target. + +2016-09-02 Kirill Yukhin <kirill.yukhin@gmaile.com> + + * gcc.target/i386/avx512f-klogic-2.c: Fix operand calculation order. + +2016-09-02 David Malcolm <dmalcolm@redhat.com> + + * gcc.dg/plugin/diagnostic-test-show-locus-generate-patch.c: New + test case. + * gcc.dg/plugin/plugin.exp (plugin_test_list): Add + diagnostic-test-show-locus-generate-patch.c to the sources + for diagnostic_plugin_test_show_locus.c. + +2016-09-02 Jakub Jelinek <jakub@redhat.com> + + PR c/65467 + * gcc.dg/gomp/_Atomic-1.c: New test. + * gcc.dg/gomp/_Atomic-2.c: New test. + * gcc.dg/gomp/_Atomic-3.c: New test. + * gcc.dg/gomp/_Atomic-4.c: New test. + * gcc.dg/gomp/_Atomic-5.c: New test. + + PR sanitizer/77396 + * g++.dg/asan/pr77396.C: New test. + +2016-09-01 Martin Sebor <msebor@redhat.com> + + PR tree-optimization/71831 + * gcc.dg/builtin-object-size-16.c: New test. + * gcc.dg/builtin-object-size-17.c: New test. + +2016-09-01 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libgfortran/77393 + * gfortran.dg/fmt_f0_2.f90: Update tests for available kinds. + +2016-09-01 Uros Bizjak <ubizjak@gmail.com> + + * gcc.dg/torture/float128-builtin.c, gcc.dg/torture/float128-floath.c, + gcc.dg/torture/float128-ieee-nan.c, gcc.dg/torture/float128-tg-2.c, + gcc.dg/torture/float128-tg.c, gcc.dg/torture/float128x-builtin.c, + gcc.dg/torture/float128x-floath.c, gcc.dg/torture/float128x-nan.c, + gcc.dg/torture/float128x-tg-2.c, gcc.dg/torture/float128x-tg.c, + gcc.dg/torture/float16-builtin.c, gcc.dg/torture/float16-floath.c, + gcc.dg/torture/float16-nan.c, gcc.dg/torture/float16-tg-2.c, + gcc.dg/torture/float16-tg.c, gcc.dg/torture/float32-builtin.c, + gcc.dg/torture/float32-floath.c, gcc.dg/torture/float32-nan.c, + gcc.dg/torture/float32-tg-2.c, gcc.dg/torture/float32-tg.c, + gcc.dg/torture/float32x-builtin.c, gcc.dg/torture/float32x-floath.c, + gcc.dg/torture/float32x-nan.c, gcc.dg/torture/float32x-tg-2.c, + gcc.dg/torture/float32x-tg.c, gcc.dg/torture/float64-builtin.c, + gcc.dg/torture/float64-floath.c, gcc.dg/torture/float64-nan.c, + gcc.dg/torture/float64-tg-2.c, gcc.dg/torture/float64-tg.c, + gcc.dg/torture/float64x-builtin.c, gcc.dg/torture/float64x-floath.c, + gcc.dg/torture/float64x-nan.c, gcc.dg/torture/float64x-tg-2.c, + gcc.dg/torture/float64x-tg.c: Use dg-add-options ieee. + +2016-09-01 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/opt58.adb: New test. + * gnat.dg/opt58_pkg.ads: New helper. + +2016-09-01 Richard Biener <rguenther@suse.de> + + PR middle-end/77436 + * gcc.dg/torture/pr77436.c: New testcase. + +2016-09-01 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com> + + * gcc.dg/pr64252.c: Require int32plus. + * gcc.dg/pr66299-1.c: Likewise. + * gcc.dg/pr66299-2.c: Likewise. + * gcc.dg/torture/20131115-1.c: Skip for avr. + +2016-09-01 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + * gcc.target/aarch64/ands_3.c: New test. + 2016-08-31 Jakub Jelinek <jakub@redhat.com> PR fortran/77352 @@ -137,12 +635,12 @@ PR tree-optimization/71077 * gcc.target/i386/pr71077.c: New test. -2016-08-27 Steven G. Kargl <kargl@gcc.gnu.org> +2016-08-27 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/77380 * gfortran.dg/pr77380.f90: New test. -2016-08-27 Steven G. Kargl <kargl@gcc.gnu.org> +2016-08-27 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/77372 gfortran.dg/pr77372.f90: New test. @@ -196,8 +694,8 @@ PR fortran/77358 * gfortran.dg/submodule_17.f08: New test. -2016-08-24 Michael Collison <michael.collison@linaro.org> - Michael Collison <michael.collison@arm.com> +2016-08-24 Michael Collison <michael.collison@linaro.org> + Michael Collison <michael.collison@arm.com> * gcc.target/arm/builtin_saddl.c: New testcase. * gcc.target/arm/builtin_saddll.c: New testcase. @@ -503,7 +1001,7 @@ PR fortran/67496 * gfortran.dg/pr67496.f90: New test. -2015-08-17 Alan Hayward <alan.hayward@arm.com> +2015-08-17 Alan Hayward <alan.hayward@arm.com> PR tree-optimization/71752 * gcc.dg/vect/pr71752.c: New. @@ -731,7 +1229,7 @@ PR tree-optimization/72851 * gcc.dg/torture/pr72851.c: New testcase. -2016-08-12 Alexandre Oliva <aoliva@redhat.com> +2016-08-12 Alexandre Oliva <aoliva@redhat.com> PR debug/63240 * g++.dg/debug/dwarf2/defaulted-member-function-1.C: New. @@ -1052,7 +1550,7 @@ * gcc.dg/tree-ssa/vrp105.c: New test. * gcc.dg/tree-ssa/vrp106.c: New test. -2016-08-05 Martin Sebor <msebor@redhat.com> +2016-08-05 Martin Sebor <msebor@redhat.com> * g++.dg/cpp0x/constexpr-cast.C: Avoid assuming (void*)1 is spelled 1ul in diagnostics. Remove hyphen from "constant-expression." @@ -1246,7 +1744,7 @@ PR target/72748 * gcc.target/i386/pr72748.c: New test. -2015-08-01 Alan Hayward <alan.hayward@arm.com> +2015-08-01 Alan Hayward <alan.hayward@arm.com> PR tree-optimization/71818 * gcc.dg/vect/pr71818.c: New @@ -1274,7 +1772,7 @@ * lib/target-supports.exp (check_effective_target_c): Fix indentation. (check_effective_target_c++): Likewise. Also match for libstdc++. -2016-07-30 Steven G. Kargl <kargl@gcc.gnu.org> +2016-07-30 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/41922 * gfortran.dg/equiv_constraint_5.f90: Adjust the error message. @@ -1286,7 +1784,7 @@ PR fortran/68566 * gfortran.dg/pr68566.f90: new test. -2016-07-30 Martin Sebor <msebor@redhat.com> +2016-07-30 Martin Sebor <msebor@redhat.com> PR c++/60760 PR c++/71091 @@ -1602,7 +2100,7 @@ EFFECTIVE_TARGETS list. Return the number of supported targets. 2016-07-26 Richard Biener <rguenther@suse.de> - Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> + Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> PR middle-end/70920 * gcc.dg/pr70920-1.c: New test-case. @@ -1634,7 +2132,7 @@ * gfortran.dg/c_sizeof_6.f90: here. Test for error. * gfortran.dg/pr71935.f90: New test. -2016-07-22 Martin Sebor <msebor@redhat.com> +2016-07-22 Martin Sebor <msebor@redhat.com> PR c++/71675 * g++.dg/ext/atomic-3.C: New test. @@ -1871,7 +2369,7 @@ * g++.dg/cpp0x/nullptr35.C (caught): Fix typo. 2016-07-15 Jerry DeLisle <jvdelisle@gcc.gnu.org> - Marco Restelli <mrestelli@gmail.com> + Marco Restelli <mrestelli@gmail.com> PR fortran/62125 * gfortran.dg/pr62125.f90: New test. @@ -2317,7 +2815,7 @@ * gcc.target/i386/mpx/mpx-check.h: Check XGETBV output if kernel supports MPX. -2016-07-05 Kito Cheng <kito.cheng@gmail.com> +2016-07-05 Kito Cheng <kito.cheng@gmail.com> * gcc.c-torture/compile/pr69102.c: Require fpic support. @@ -3287,7 +3785,7 @@ PR target/71103 * gcc.target/avr/torture/pr71103-2.c: New test. -2016-06-19 Martin Sebor <msebor@redhat.com> +2016-06-19 Martin Sebor <msebor@redhat.com> PR c/69507 * gcc.dg/alignof.c: New test. @@ -6446,7 +6944,7 @@ PR tree-optimization/70780 * gcc.dg/torture/pr70780.c: New testcase. -2016-04-25 Michael Collison <michael.collison@arm.com> +2016-04-25 Michael Collison <michael.collison@arm.com> * gcc.target/arm/neon-vaddws16.c: New test. * gcc.target/arm/neon-vaddws32.c: New test. @@ -7158,7 +7656,7 @@ * g++.dg/ipa/devirt-51.C: New testcase. 2016-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> - Jakub Jelinek <jakub@redhat.com> + Jakub Jelinek <jakub@redhat.com> PR middle-end/70457 * gcc.dg/torture/pr70457.c: New. @@ -7388,7 +7886,7 @@ PR tree-optimization/59124 * gcc.dg/Warray-bounds-19.c: New test. -2016-03-29 Zachary T Welch <zwelch@codesourcery.com> +2016-03-29 Zachary T Welch <zwelch@codesourcery.com> * lib/prune.exp (escape_regex_chars): New. (prune_file_path): Update to quote metcharacters for regexp. diff --git a/gcc/testsuite/c-c++-common/Wlogical-not-parentheses-3.c b/gcc/testsuite/c-c++-common/Wlogical-not-parentheses-3.c new file mode 100644 index 00000000000..00aa747652b --- /dev/null +++ b/gcc/testsuite/c-c++-common/Wlogical-not-parentheses-3.c @@ -0,0 +1,31 @@ +/* PR c/77423 */ +/* { dg-do compile } */ +/* { dg-options "-Wlogical-not-parentheses" } */ + +#ifndef __cplusplus +# define bool _Bool +#endif + +int +f (int a, bool b, bool c) +{ + int r = 0; + + r += !a == (b | c); + r += !a == (b ^ c); + r += !a == (b & c); + r += !a == ~b; + r += !a == ~(int) b; + r += !a == ((b & c) | c); + r += !a == ((b & c) | (b ^ c)); + r += !a == (int) (b ^ c); + r += !a == (int) ~b; + r += !a == ~~b; + r += !a == ~(b | c); + r += !a == ~(b | (a == 1)); + r += !a == ~(a == 1); + + r += !a == ((b & c) | (b ^ a)); /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ + + return r; +} diff --git a/gcc/testsuite/c-c++-common/gomp/atomic-12.c b/gcc/testsuite/c-c++-common/gomp/atomic-12.c index 145e4201642..e9ca6503cfe 100644 --- a/gcc/testsuite/c-c++-common/gomp/atomic-12.c +++ b/gcc/testsuite/c-c++-common/gomp/atomic-12.c @@ -1,6 +1,6 @@ /* PR middle-end/45423 */ /* { dg-do compile } */ -/* { dg-options "-fopenmp -fdump-tree-gimple -g0" } */ +/* { dg-options "-fopenmp -fdump-tree-gimple -g0 -Wno-deprecated" } */ /* atomicvar should never be referenced in between the barrier and following #pragma omp atomic_load. */ /* { dg-final { scan-tree-dump-not "barrier\[^#\]*atomicvar" "gimple" } } */ diff --git a/gcc/testsuite/c-c++-common/gomp/atomic-13.c b/gcc/testsuite/c-c++-common/gomp/atomic-13.c index 2452035da5b..7f4afcf63ad 100644 --- a/gcc/testsuite/c-c++-common/gomp/atomic-13.c +++ b/gcc/testsuite/c-c++-common/gomp/atomic-13.c @@ -1,6 +1,6 @@ /* PR middle-end/45423 */ /* { dg-do compile } */ -/* { dg-options "-fopenmp -fdump-tree-gimple -g0 -O2" } */ +/* { dg-options "-fopenmp -fdump-tree-gimple -g0 -O2 -Wno-deprecated" } */ /* atomicvar should never be referenced in between the barrier and following #pragma omp atomic_load. */ /* { dg-final { scan-tree-dump-not "barrier\[^#\]*atomicvar" "gimple" } } */ diff --git a/gcc/testsuite/c-c++-common/gomp/atomic-14.c b/gcc/testsuite/c-c++-common/gomp/atomic-14.c index f8fc9d87257..7e2345387d4 100644 --- a/gcc/testsuite/c-c++-common/gomp/atomic-14.c +++ b/gcc/testsuite/c-c++-common/gomp/atomic-14.c @@ -1,6 +1,6 @@ /* PR middle-end/45423 */ /* { dg-do compile } */ -/* { dg-options "-fopenmp" } */ +/* { dg-options "-fopenmp -Wno-deprecated" } */ #ifdef __cplusplus bool *baz (); diff --git a/gcc/testsuite/c-c++-common/pr60439.c b/gcc/testsuite/c-c++-common/pr60439.c index 68bd33c22cb..71b397a1c7d 100644 --- a/gcc/testsuite/c-c++-common/pr60439.c +++ b/gcc/testsuite/c-c++-common/pr60439.c @@ -132,6 +132,7 @@ f6 (bool b) break; } switch (b++) /* { dg-warning "switch condition has" } */ + /* { dg-warning "is deprecated" "" { target c++ } 134 } */ { case 3: break; diff --git a/gcc/testsuite/c-c++-common/torture/pr77544.c b/gcc/testsuite/c-c++-common/torture/pr77544.c new file mode 100644 index 00000000000..1d1ce3ff74f --- /dev/null +++ b/gcc/testsuite/c-c++-common/torture/pr77544.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ + +struct { + long a : 17; +} b; +int c, d; +void e() { b.a = d + c + ~(long)(302806U >> 0); } diff --git a/gcc/testsuite/c-c++-common/tsan/pr68260.c b/gcc/testsuite/c-c++-common/tsan/pr68260.c new file mode 100644 index 00000000000..86ffd2b2823 --- /dev/null +++ b/gcc/testsuite/c-c++-common/tsan/pr68260.c @@ -0,0 +1,28 @@ +/* PR sanitizer/68260 */ + +#include <pthread.h> +#include <stdbool.h> + +bool lock; +int counter; + +void * +tf (void *arg) +{ + (void) arg; + while (__atomic_test_and_set (&lock, __ATOMIC_ACQUIRE)) + ; + ++counter; + __atomic_clear (&lock, __ATOMIC_RELEASE); + return (void *) 0; +} + +int +main () +{ + pthread_t thr; + pthread_create (&thr, 0, tf, 0); + tf ((void *) 0); + pthread_join (thr, 0); + return 0; +} diff --git a/gcc/testsuite/c-c++-common/va-arg-va-list-type.c b/gcc/testsuite/c-c++-common/va-arg-va-list-type.c new file mode 100644 index 00000000000..cdd97cfb037 --- /dev/null +++ b/gcc/testsuite/c-c++-common/va-arg-va-list-type.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ + +__builtin_va_list *pap; + +void +fn1 (void) +{ + __builtin_va_arg (pap, double); /* { dg-error "first argument to 'va_arg' not of type 'va_list'" } */ +} diff --git a/gcc/testsuite/c-c++-common/vector-subscript-7.c b/gcc/testsuite/c-c++-common/vector-subscript-7.c index e8418f24be9..8e8fa0c1bdc 100644 --- a/gcc/testsuite/c-c++-common/vector-subscript-7.c +++ b/gcc/testsuite/c-c++-common/vector-subscript-7.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O -fdump-tree-ccp1" } */ +/* { dg-options "-O -fdump-tree-fre1" } */ typedef int v4si __attribute__ ((vector_size (16))); @@ -11,4 +11,4 @@ main (int argc, char** argv) return ((v4si){1, 2, 42, 0})[j]; } -/* { dg-final { scan-tree-dump "return 42;" "ccp1" } } */ +/* { dg-final { scan-tree-dump "return 42;" "fre1" } } */ diff --git a/gcc/testsuite/c-c++-common/warn-ommitted-condop.c b/gcc/testsuite/c-c++-common/warn-ommitted-condop.c index 0726f043916..678373f3d70 100644 --- a/gcc/testsuite/c-c++-common/warn-ommitted-condop.c +++ b/gcc/testsuite/c-c++-common/warn-ommitted-condop.c @@ -1,11 +1,15 @@ /* { dg-options "-Wparentheses -ftrack-macro-expansion=0" } */ +#ifndef __cplusplus +#define bool _Bool +#endif + extern void f2 (int); -void bar (int x, int y, int z) +void bar (int x, int y, int z, bool b) { -#define T(op) f2 (x op y ? : 1) -#define T2(op) f2 (x op y ? 2 : 1) +#define T(op) f2 (x op y ? : 1) +#define T2(op) f2 (x op y ? 2 : 1) T(<); /* { dg-warning "omitted middle operand" } */ T(>); /* { dg-warning "omitted middle operand" } */ @@ -16,6 +20,8 @@ void bar (int x, int y, int z) T(||); /* { dg-warning "omitted middle operand" } */ T(&&); /* { dg-warning "omitted middle operand" } */ f2 (!x ? : 1); /* { dg-warning "omitted middle operand" } */ + f2 ((x,!x) ? : 1); /* { dg-warning "omitted middle operand" } */ + f2 ((x,y,!x) ? : 1); /* { dg-warning "omitted middle operand" } */ T2(<); /* { dg-bogus "omitted middle operand" } */ T2(>); /* { dg-bogus "omitted middle operand" } */ T2(==); /* { dg-bogus "omitted middle operand" } */ @@ -26,4 +32,5 @@ void bar (int x, int y, int z) T(*); /* { dg-bogus "omitted middle operand" } */ T(/); /* { dg-bogus "omitted middle operand" } */ T(^); /* { dg-bogus "omitted middle operand" } */ + f2 (b ? : 1); /* { dg-warning "omitted middle operand" } */ } diff --git a/gcc/testsuite/g++.dg/abi/abi-tag23.C b/gcc/testsuite/g++.dg/abi/abi-tag23.C index 5e310a4a42a..4a1c38bc580 100644 --- a/gcc/testsuite/g++.dg/abi/abi-tag23.C +++ b/gcc/testsuite/g++.dg/abi/abi-tag23.C @@ -32,4 +32,4 @@ int main() Final().get_foo(); } -// { dg-final { scan-assembler "_ZThn16_N7Derived7get_fooB3barEv" } } +// { dg-final { scan-assembler "_ZThn\[0-9]+_N7Derived7get_fooB3barEv" } } diff --git a/gcc/testsuite/g++.dg/abi/abi-tag23a.C b/gcc/testsuite/g++.dg/abi/abi-tag23a.C index 72aa037f0b8..10645bf74cf 100644 --- a/gcc/testsuite/g++.dg/abi/abi-tag23a.C +++ b/gcc/testsuite/g++.dg/abi/abi-tag23a.C @@ -32,4 +32,4 @@ int main() Final().get_foo(); } -// { dg-final { scan-assembler "_ZThn16_N7Derived7get_fooEv" } } +// { dg-final { scan-assembler "_ZThn\[0-9]+_N7Derived7get_fooEv" } } diff --git a/gcc/testsuite/g++.dg/asan/pr77396-2.C b/gcc/testsuite/g++.dg/asan/pr77396-2.C new file mode 100644 index 00000000000..0570a14940e --- /dev/null +++ b/gcc/testsuite/g++.dg/asan/pr77396-2.C @@ -0,0 +1,12 @@ +// PR sanitizer/77396 +// { dg-do run } +// { dg-set-target-env-var ASAN_OPTIONS "check_initialization_order=true" } + +struct S { S () { asm volatile ("" : : : "memory"); } }; +static S c; + +int +main () +{ + return 0; +} diff --git a/gcc/testsuite/g++.dg/asan/pr77396.C b/gcc/testsuite/g++.dg/asan/pr77396.C new file mode 100644 index 00000000000..3b3195ec1ec --- /dev/null +++ b/gcc/testsuite/g++.dg/asan/pr77396.C @@ -0,0 +1,12 @@ +// PR sanitizer/77396 +// { dg-do run } +// { dg-set-target-env-var ASAN_OPTIONS "check_initialization_order=true" } + +static int a = 0; +static int b = a; + +int +main () +{ + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/Wattributes1.C b/gcc/testsuite/g++.dg/cpp0x/Wattributes1.C index dd9011b8870..b0a1e864eff 100644 --- a/gcc/testsuite/g++.dg/cpp0x/Wattributes1.C +++ b/gcc/testsuite/g++.dg/cpp0x/Wattributes1.C @@ -5,4 +5,4 @@ #include <new> __attribute__((visibility("hidden")))void*operator new(std::size_t); // { dg-warning "visibility attribute ignored" } -// { dg-message "previous declaration" "" { target *-*-* } 116 } +// { dg-message "previous declaration" "" { target *-*-* } 120 } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-77482.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-77482.C new file mode 100644 index 00000000000..6f5c91621ce --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-77482.C @@ -0,0 +1,6 @@ +// PR c++/77482 +// { dg-do compile { target c++11 } } + +constexpr auto x; // { dg-error "declaration\[^\n\r]*has no initializer" } +extern struct S s; +constexpr auto y = s; // { dg-error "has incomplete type" } diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-77338.C b/gcc/testsuite/g++.dg/cpp0x/decltype-77338.C new file mode 100644 index 00000000000..4ba7c96d32c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype-77338.C @@ -0,0 +1,7 @@ +// PR c++/77338 +// { dg-do compile { target c++11 } } + +struct S; + +template <typename> +auto f (S s) -> decltype (s (s)); // { dg-error "no match for call to" } diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-52.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-52.C index 0f87fd490e5..ad7cffc6b99 100644 --- a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-52.C +++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-52.C @@ -3,19 +3,22 @@ struct A {int i;} a [[gnu::aligned(16)]]; struct B {int i;} __attribute__((aligned(16))) b; +constexpr unsigned si = sizeof(int); +constexpr unsigned ai = alignof(int); + int main () { A aa; B bb; - static_assert (sizeof (a) == 4, "sizeof (a) should be 4"); + static_assert (sizeof (a) == si, "sizeof (a) should be 4"); static_assert (sizeof (b) == 16, "sizeof (b) should be 16"); - static_assert (sizeof (aa) == 4, "sizeof (aa) should be 4"); + static_assert (sizeof (aa) == si, "sizeof (aa) should be 4"); static_assert (sizeof (bb) == 16, "sizeof (bb) should be 16"); static_assert (__alignof__ (a) == 16, "alignof (a) should be 16"); static_assert (__alignof__ (b) == 16, "alignof (b) should be 16"); - static_assert (__alignof__ (aa) == 4, "alignof (aa) should be 4"); + static_assert (__alignof__ (aa) == ai, "alignof (aa) should be 4"); static_assert (__alignof__ (bb) == 16, "alignof (bb) should be 16"); } diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-61.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-61.C new file mode 100644 index 00000000000..fd7f4437dbb --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-61.C @@ -0,0 +1,10 @@ +// { dg-do compile { target c++11 } } +int +foo () +{ + int i [[and::bitor, bar::xor_eq, compl::baz(1), bitand::xor_eq(2, 3)]]; // { dg-warning "ignored" } + int j [[using, using::baz, bar::using, using::using (2)]]; // { dg-warning "ignored" } + i = 0; + j = 0; + return i + j; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle.C index 20ef282ac24..15b8b79ecbc 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle.C @@ -1,6 +1,6 @@ // Test lambda mangling -// { dg-require-weak "" } // { dg-do compile { target c++11 } } +// { dg-require-weak "" } // { dg-options "-fno-inline" } template<typename F> int algo(F fn) { return fn(); } diff --git a/gcc/testsuite/g++.dg/cpp0x/mutable1.C b/gcc/testsuite/g++.dg/cpp0x/mutable1.C new file mode 100644 index 00000000000..4dd37185d72 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/mutable1.C @@ -0,0 +1,12 @@ +// PR c++/77375 +// { dg-do run { target c++11 } } + +struct Base { mutable int i; }; +struct Derived : Base {}; +const Derived foo{}; + +int +main () +{ + foo.i = 42; +} diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-77553.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-77553.C new file mode 100644 index 00000000000..b924b3830dd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-77553.C @@ -0,0 +1,29 @@ +// PR c++/77553 +// { dg-do compile { target c++14 } } + +constexpr void +bar (int *x) +{ + int i = 0; + x[i++] = 1; + x[3] = i; +} + +constexpr int +foo () +{ + int a[] = { 0, 0, 0, 0 }; + bar (a); + + return a[0] + 8 * a[1] + 64 * a[2] + 512 * a[3]; +} + +constexpr int b = foo (); + +int +main () +{ + static_assert (b == 513, ""); + if (foo () != 513) + __builtin_abort (); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-init11.C b/gcc/testsuite/g++.dg/cpp1y/lambda-init11.C index f7525d8664a..4d434cd9ca0 100644 --- a/gcc/testsuite/g++.dg/cpp1y/lambda-init11.C +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-init11.C @@ -16,5 +16,4 @@ int main(){ foo(3.14f); foo(0); foo('a'); - foo(false); } diff --git a/gcc/testsuite/g++.dg/cpp1y/pr77539.C b/gcc/testsuite/g++.dg/cpp1y/pr77539.C new file mode 100644 index 00000000000..d1fba24c625 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr77539.C @@ -0,0 +1,14 @@ +// PR c++/77539 +// { dg-do compile { target c++14 } } + +constexpr int foobar() +{ + int array[100] = {}; + int *ar = array; + if (ar == nullptr) // Error... + { + return 0; + } + return 1; +} +static_assert(foobar(),""); diff --git a/gcc/testsuite/g++.dg/cpp1z/aligned-new1.C b/gcc/testsuite/g++.dg/cpp1z/aligned-new1.C new file mode 100644 index 00000000000..735296fd8fa --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/aligned-new1.C @@ -0,0 +1,17 @@ +// { dg-options -std=c++1z } +// { dg-do run } + +#ifndef __STDCPP_DEFAULT_NEW_ALIGNMENT__ +#error __STDCPP_DEFAULT_NEW_ALIGNMENT__ not defined +#endif + +#include <cstdint> + +struct alignas(64) A { int i; }; + +int main() +{ + A *p = new A; + if (std::intptr_t(p) % 64 != 0) + __builtin_abort(); +} diff --git a/gcc/testsuite/g++.dg/cpp1z/aligned-new2.C b/gcc/testsuite/g++.dg/cpp1z/aligned-new2.C new file mode 100644 index 00000000000..fe159692b3b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/aligned-new2.C @@ -0,0 +1,31 @@ +// { dg-options -std=c++1z } +// { dg-do run } + +#include <new> + +struct alignas(64) A { + int i; + A() { throw 42; } +}; +struct B { int i; } b; + +void *operator new (std::size_t s, std::align_val_t a, B b) +{ + return operator new (s, a); +} + +bool deleted = false; +void operator delete (void *p, std::align_val_t, B) +{ + deleted = true; +} + +int main() +{ + try { + A *p = new (b) A; + __builtin_abort (); + } catch (...) {} + if (!deleted) + __builtin_abort (); +} diff --git a/gcc/testsuite/g++.dg/cpp1z/aligned-new3.C b/gcc/testsuite/g++.dg/cpp1z/aligned-new3.C new file mode 100644 index 00000000000..73e33432542 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/aligned-new3.C @@ -0,0 +1,23 @@ +// { dg-options -std=c++1z } +// { dg-do run } + +#include <new> + +struct alignas(64) A { + int i; +}; + +bool deleted = false; +void operator delete (void *p, std::size_t, std::align_val_t) +{ + deleted = true; + operator delete (p); +} + +int main() +{ + A *p = new A; + delete p; + if (!deleted) + __builtin_abort(); +} diff --git a/gcc/testsuite/g++.dg/cpp1z/aligned-new4.C b/gcc/testsuite/g++.dg/cpp1z/aligned-new4.C new file mode 100644 index 00000000000..cc63a145589 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/aligned-new4.C @@ -0,0 +1,13 @@ +// { dg-options "-std=c++14 -Waligned-new" } + +struct alignas(64) A { int i; }; +struct alignas(64) B { + int i; + void *operator new(__SIZE_TYPE__); +}; + +int main() +{ + A* ap = new A; // { dg-warning "-Waligned-new" } + B* bp = new B; +} diff --git a/gcc/testsuite/g++.dg/cpp1z/aligned-new4a.C b/gcc/testsuite/g++.dg/cpp1z/aligned-new4a.C new file mode 100644 index 00000000000..eb178d46dff --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/aligned-new4a.C @@ -0,0 +1,13 @@ +// { dg-options "-std=c++14 -Waligned-new=all" } + +struct alignas(64) A { int i; }; +struct alignas(64) B { + int i; + void *operator new(__SIZE_TYPE__); +}; + +int main() +{ + A* ap = new A; // { dg-warning "-Waligned-new" } + B* bp = new B; // { dg-warning "-Waligned-new" } +} diff --git a/gcc/testsuite/g++.dg/cpp1z/aligned-new5.C b/gcc/testsuite/g++.dg/cpp1z/aligned-new5.C new file mode 100644 index 00000000000..525129e4c40 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/aligned-new5.C @@ -0,0 +1,14 @@ +// { dg-options -faligned-new } +// { dg-do run } + +#include <new> +#include <stdint.h> + +struct A { int i; }; + +int main() +{ + A* ap = new (std::align_val_t(64)) A; + if (intptr_t(ap) % 64 != 0) + __builtin_abort(); +} diff --git a/gcc/testsuite/g++.dg/cpp1z/bool-increment1.C b/gcc/testsuite/g++.dg/cpp1z/bool-increment1.C new file mode 100644 index 00000000000..ae2dcf9f391 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/bool-increment1.C @@ -0,0 +1,14 @@ +// { dg-options -std=c++1z } + +int +fn (bool b) +{ + int r = 0; + + r += b++; // { dg-error "use of an operand of type .bool. in .operator\\+\\+. is forbidden in" } + r += ++b; // { dg-error "use of an operand of type .bool. in .operator\\+\\+. is forbidden in" } + r += b--; // { dg-error "use of an operand of type .bool. in .operator--. is forbidden" } + r += --b; // { dg-error "use of an operand of type .bool. in .operator--. is forbidden" } + + return r; +} diff --git a/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C b/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C index 41b61114537..982572e65cc 100644 --- a/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C +++ b/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C @@ -350,6 +350,12 @@ # error "__cpp_if_constexpr != 201606" #endif +#ifndef __cpp_aligned_new +# error "__cpp_aligned_new" +#elif __cpp_aligned_new != 201606 +# error "__cpp_aligned_new != 201606" +#endif + #ifdef __has_cpp_attribute # if ! __has_cpp_attribute(maybe_unused) diff --git a/gcc/testsuite/g++.dg/cpp1z/gen-attrs1.C b/gcc/testsuite/g++.dg/cpp1z/gen-attrs1.C new file mode 100644 index 00000000000..fe1ebb29a1d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/gen-attrs1.C @@ -0,0 +1,43 @@ +// { dg-do compile { target c++11 } } +// { dg-options "" } + +int +foo () +{ + static int a [[using gnu: unused, used]]; // { dg-warning "attribute using prefix only available" "" { target c++14_down } } + int b [[ using foo : bar (2), baz ]]; // { dg-warning "'foo::bar' scoped attribute directive ignored" } + // { dg-warning "'foo::baz' scoped attribute directive ignored" "" { target *-*-* } 8 } + // { dg-warning "attribute using prefix only available" "" { target c++14_down } 8 } + int c [[ using foo : using ("foo")]]; // { dg-warning "'foo::using' scoped attribute directive ignored" } + // { dg-warning "attribute using prefix only available" "" { target c++14_down } 11 } + b = 0; + c = 0; + return b + c; +} + +int +bar () +{ + int a [[ using BAR: foo::bar]]; // { dg-error "attribute using prefix used together with scoped attribute token" } + // { dg-warning "ignored" "" { target *-*-* } 21 } + // { dg-warning "attribute using prefix only available" "" { target c++14_down } 21 } + int b [[ using BAZ: bar(2), bar::bar(3, 4) ]];// { dg-error "attribute using prefix used together with scoped attribute token" } + // { dg-warning "ignored" "" { target *-*-* } 24 } + // { dg-warning "attribute using prefix only available" "" { target c++14_down } 24 } + a = 0; + b = 0; + return a + b; +} + +int +baz () +{ + int a [[ using using: using]]; // { dg-warning "attribute using prefix only available" "" { target c++14_down } } + // { dg-warning "'using::using' scoped attribute directive ignored" "" { target *-*-* } 35 } + int b [[ using bitand: bitor, xor]]; // { dg-warning "attribute using prefix only available" "" { target c++14_down } } + // { dg-warning "'bitand::bitor' scoped attribute directive ignored" "" { target *-*-* } 37 } + // { dg-warning "'bitand::xor' scoped attribute directive ignored" "" { target *-*-* } 37 } + a = 0; + b = 0; + return a + b; +} diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/imported-decl-2.C b/gcc/testsuite/g++.dg/debug/dwarf2/imported-decl-2.C index 58f19bee324..22458c0cb45 100644 --- a/gcc/testsuite/g++.dg/debug/dwarf2/imported-decl-2.C +++ b/gcc/testsuite/g++.dg/debug/dwarf2/imported-decl-2.C @@ -1,5 +1,5 @@ // { dg-do compile } -// { dg-options "-gdwarf-2 -dA -O0 -fno-merge-debug-strings" } +// { dg-options "-gdwarf-2 -gno-strict-dwarf -dA -O0 -fno-merge-debug-strings" } class AAAA { diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/template-params-12g.C b/gcc/testsuite/g++.dg/debug/dwarf2/template-params-12g.C index 813f71d1bc0..1d0960a2851 100644 --- a/gcc/testsuite/g++.dg/debug/dwarf2/template-params-12g.C +++ b/gcc/testsuite/g++.dg/debug/dwarf2/template-params-12g.C @@ -1,4 +1,4 @@ -// { dg-options "-gdwarf-2 -dA" } +// { dg-options "-gdwarf-2 -gno-strict-dwarf -dA" } // { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_template_value_param" 1 } } // { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_template_value_param\[^\n\]*\n\[^\n\]* DW_AT_name\n\[^\n\]* DW_AT_type\n\[^\n\]*\[^\n\]* DW_AT_location\n\[^\n\]* DW_OP_addr\n\[^\n\]*_ZN1B1gEv\[^\n\]*\n\[^\n\]* DW_OP_stack_value\n\[^\n\]* DW_OP_piece\n\[^\n\]*\n\[^\n\]* DW_OP_lit0\n\[^\n\]* DW_OP_stack_value\n\[^\n\]* DW_OP_piece" 1 } } #include "template-params-12.H" diff --git a/gcc/testsuite/g++.dg/expr/bitfield3.C b/gcc/testsuite/g++.dg/expr/bitfield3.C index 3221263a906..3f30337c2db 100644 --- a/gcc/testsuite/g++.dg/expr/bitfield3.C +++ b/gcc/testsuite/g++.dg/expr/bitfield3.C @@ -7,6 +7,6 @@ struct S { S s; void f() { - s.x--; // { dg-error "Boolean expression" } - --s.x; // { dg-error "Boolean expression" } + s.x--; // { dg-error "use of an operand of type .bool." } + --s.x; // { dg-error "use of an operand of type .bool." } } diff --git a/gcc/testsuite/g++.dg/expr/bitfield4.C b/gcc/testsuite/g++.dg/expr/bitfield4.C index d824964e187..7fae086b857 100644 --- a/gcc/testsuite/g++.dg/expr/bitfield4.C +++ b/gcc/testsuite/g++.dg/expr/bitfield4.C @@ -14,6 +14,6 @@ template <> void f(bool) {} int main() { - f(s.x++); - f(++s.x); + f(s.x++); // { dg-warning "deprecated" } + f(++s.x); // { dg-warning "deprecated" } } diff --git a/gcc/testsuite/g++.dg/expr/bitfield5.C b/gcc/testsuite/g++.dg/expr/bitfield5.C index 3d18e159cc0..0a37f9f166b 100644 --- a/gcc/testsuite/g++.dg/expr/bitfield5.C +++ b/gcc/testsuite/g++.dg/expr/bitfield5.C @@ -8,10 +8,10 @@ struct S { S s; int main() { - s.x++; + s.x++; // { dg-warning "deprecated" } if (s.x != 1) return 1; - ++s.x; + ++s.x; // { dg-warning "deprecated" } if (s.x != 1) return 2; } diff --git a/gcc/testsuite/g++.dg/expr/bitfield6.C b/gcc/testsuite/g++.dg/expr/bitfield6.C index 6f6d559a38e..8523866cd9d 100644 --- a/gcc/testsuite/g++.dg/expr/bitfield6.C +++ b/gcc/testsuite/g++.dg/expr/bitfield6.C @@ -7,5 +7,5 @@ struct S { S s; void f() { - ++s.x = false; + ++s.x = false; // { dg-warning "deprecated" } } diff --git a/gcc/testsuite/g++.dg/expr/bool1.C b/gcc/testsuite/g++.dg/expr/bool1.C index bfb40e33092..503e8b40c8c 100644 --- a/gcc/testsuite/g++.dg/expr/bool1.C +++ b/gcc/testsuite/g++.dg/expr/bool1.C @@ -10,8 +10,8 @@ int main() my_bool b = false; int i; - b++; - b++; + b++; // { dg-warning "deprecated" } + b++; // { dg-warning "deprecated" } i = b; if (i != 1) abort (); diff --git a/gcc/testsuite/g++.dg/expr/bool3.C b/gcc/testsuite/g++.dg/expr/bool3.C index 61669e27bef..1866ed47e9d 100644 --- a/gcc/testsuite/g++.dg/expr/bool3.C +++ b/gcc/testsuite/g++.dg/expr/bool3.C @@ -10,8 +10,8 @@ int main() my_bool b = false; int i; - b++; - b++; + b++; // { dg-warning "deprecated" } + b++; // { dg-warning "deprecated" } i = b; if (i != 1) abort (); diff --git a/gcc/testsuite/g++.dg/expr/lval3.C b/gcc/testsuite/g++.dg/expr/lval3.C index f106e69619d..8e0aeade4b9 100644 --- a/gcc/testsuite/g++.dg/expr/lval3.C +++ b/gcc/testsuite/g++.dg/expr/lval3.C @@ -4,6 +4,7 @@ f() { bool i = 0; i++ = 3; // { dg-error "" } + // { dg-warning "deprecated" "" { target *-*-* } 6 } } diff --git a/gcc/testsuite/g++.dg/expr/lval4.C b/gcc/testsuite/g++.dg/expr/lval4.C index c66e2f6af25..b903ec8c39e 100644 --- a/gcc/testsuite/g++.dg/expr/lval4.C +++ b/gcc/testsuite/g++.dg/expr/lval4.C @@ -4,6 +4,7 @@ f() { bool i = 0; ++i = 3; + // { dg-warning "deprecated" "" { target *-*-* } 6 } } diff --git a/gcc/testsuite/g++.dg/ext/builtin_alloca.C b/gcc/testsuite/g++.dg/ext/builtin_alloca.C index 7a0d331ced0..e857502685a 100644 --- a/gcc/testsuite/g++.dg/ext/builtin_alloca.C +++ b/gcc/testsuite/g++.dg/ext/builtin_alloca.C @@ -1,7 +1,7 @@ // PR middle-end/69780 - [4.9/5/6 Regression] ICE on // __builtin_alloca_with_align with small alignment -// { dg-require-effective-target alloca } // { dg-do compile } +// { dg-require-effective-target alloca } #define CHAR_BIT __CHAR_BIT__ #define SIZE_MAX __SIZE_MAX__ diff --git a/gcc/testsuite/g++.dg/ext/pr77496.C b/gcc/testsuite/g++.dg/ext/pr77496.C new file mode 100644 index 00000000000..0b21e0cee39 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/pr77496.C @@ -0,0 +1,21 @@ +// { dg-do compile } +// { dg-options "" } + +template <class x> +class z : x +{ +public: + bool zz () { return false; } + int f () { return zz ? : 1; } // { dg-error "cannot convert" } +}; + +class t +{ +}; + +int +main () +{ + z<t> x; + return x.f (); +} diff --git a/gcc/testsuite/g++.dg/gcov/gcov-threads-1.C b/gcc/testsuite/g++.dg/gcov/gcov-threads-1.C index a4a6f0a6ae3..cc9266ab8ea 100644 --- a/gcc/testsuite/g++.dg/gcov/gcov-threads-1.C +++ b/gcc/testsuite/g++.dg/gcov/gcov-threads-1.C @@ -1,5 +1,6 @@ /* { dg-options "-fprofile-arcs -ftest-coverage -pthread -fprofile-update=atomic" } */ /* { dg-do run { target native } } */ +/* { dg-require-effective-target profile_update_atomic } */ #include <stdint.h> #include <pthread.h> diff --git a/gcc/testsuite/g++.dg/gomp/atomic-14.C b/gcc/testsuite/g++.dg/gomp/atomic-14.C index ae1eb50dcd6..982f44fae92 100644 --- a/gcc/testsuite/g++.dg/gomp/atomic-14.C +++ b/gcc/testsuite/g++.dg/gomp/atomic-14.C @@ -8,12 +8,12 @@ int foo (void) { #pragma omp atomic - (*baz ())--; // { dg-error "invalid use of Boolean" } + (*baz ())--; // { dg-error "use of an operand of type .bool." } #pragma omp atomic - --(*baz ()); // { dg-error "invalid use of Boolean" } + --(*baz ()); // { dg-error "use of an operand of type .bool." } #pragma omp atomic - atomicvar--; // { dg-error "invalid use of Boolean" } + atomicvar--; // { dg-error "use of an operand of type .bool." } #pragma omp atomic - --atomicvar; // { dg-error "invalid use of Boolean" } + --atomicvar; // { dg-error "use of an operand of type .bool." } return 0; } diff --git a/gcc/testsuite/g++.dg/lookup/pr77549.C b/gcc/testsuite/g++.dg/lookup/pr77549.C new file mode 100644 index 00000000000..6fe1a0e6b53 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/pr77549.C @@ -0,0 +1,76 @@ +// PR c++/77549 +// { dg-do compile } + +struct A +{ + static int x; +}; + +void +f1 () +{ + using ::A; + x; // { dg-error "'x' was not declared in this scope" } +} + +namespace N +{ + int bar; +} + +void +f2 () +{ + using N::bar; + baz++; // { dg-error "'baz' was not declared in this scope" } +} // { dg-message "note: suggested alternative: 'bar'" "" { target *-*-* } 25 } + +int +bar () +{ + return 0; +} + +namespace M +{ + int + bar () + { + return 0; + } +} + +void +f3 () +{ + using M::bar; + baz (); // { dg-error "'baz' was not declared in this scope" } +} // { dg-message "note: suggested alternative: 'bar'" "" { target *-*-* } 47 } + +namespace O +{ + int + foo () + { + return 0; + } +} + +namespace P +{ + int + bar () + { + return 0; + } +} + +void +f4 () +{ + using O::foo; + using P::bar; + fooo (); // { dg-error "'fooo' was not declared in this scope" } + // { dg-message "note: suggested alternative: 'foo'" "" { target *-*-* } 73 } + baz (); // { dg-error "'baz' was not declared in this scope" } +} // { dg-message "note: suggested alternative: 'bar'" "" { target *-*-* } 75 } diff --git a/gcc/testsuite/g++.dg/other/error18.C b/gcc/testsuite/g++.dg/other/error18.C index 9e4d21cfde0..05ddf116675 100644 --- a/gcc/testsuite/g++.dg/other/error18.C +++ b/gcc/testsuite/g++.dg/other/error18.C @@ -7,5 +7,5 @@ struct A void f(A a) { - a.b--; // { dg-error "Boolean expression" } + a.b--; // { dg-error "use of an operand of type .bool." } } diff --git a/gcc/testsuite/g++.dg/pr77427.C b/gcc/testsuite/g++.dg/pr77427.C new file mode 100644 index 00000000000..544946d70b6 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr77427.C @@ -0,0 +1,17 @@ +// { dg-do compile } + +void bar (__builtin_va_list &); + +struct c +{ + operator const __builtin_va_list &(); + operator __builtin_va_list &(); +}; + +void +foo (void) +{ + struct c c1; + + bar (c1); +} diff --git a/gcc/testsuite/g++.dg/predict-loop-exit-1.C b/gcc/testsuite/g++.dg/predict-loop-exit-1.C index 88262eb9d00..47bdf5182c1 100644 --- a/gcc/testsuite/g++.dg/predict-loop-exit-1.C +++ b/gcc/testsuite/g++.dg/predict-loop-exit-1.C @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-profile_estimate" } */ +/* { dg-options "-O2 -fdump-tree-profile_estimate -fdisable-tree-ethread" } */ int g; int foo(); diff --git a/gcc/testsuite/g++.dg/predict-loop-exit-2.C b/gcc/testsuite/g++.dg/predict-loop-exit-2.C index 15e9866d897..15b63eeb0fa 100644 --- a/gcc/testsuite/g++.dg/predict-loop-exit-2.C +++ b/gcc/testsuite/g++.dg/predict-loop-exit-2.C @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-profile_estimate" } */ +/* { dg-options "-O2 -fdump-tree-profile_estimate -fdisable-tree-ethread" } */ int g; int foo(); diff --git a/gcc/testsuite/g++.dg/predict-loop-exit-3.C b/gcc/testsuite/g++.dg/predict-loop-exit-3.C index 61af84b6f56..8d417422b60 100644 --- a/gcc/testsuite/g++.dg/predict-loop-exit-3.C +++ b/gcc/testsuite/g++.dg/predict-loop-exit-3.C @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-profile_estimate" } */ +/* { dg-options "-O2 -fdump-tree-profile_estimate -fdisable-tree-ethread" } */ int g; int foo(); diff --git a/gcc/testsuite/g++.dg/template/spec35.C b/gcc/testsuite/g++.dg/template/spec35.C index 709ece5dd90..e82323ce448 100644 --- a/gcc/testsuite/g++.dg/template/spec35.C +++ b/gcc/testsuite/g++.dg/template/spec35.C @@ -2,8 +2,8 @@ // C++ DR 605 -- "...the linkage of an explicit specialization must be that of // the template." -// { dg-require-weak "" } // { dg-do compile { target i?86-*-* x86_64-*-* } } +// { dg-require-weak "" } template<class T> static void f1 (T) { } diff --git a/gcc/testsuite/g++.dg/warn/pr77496.C b/gcc/testsuite/g++.dg/warn/pr77496.C new file mode 100644 index 00000000000..4b97d0990cc --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/pr77496.C @@ -0,0 +1,21 @@ +// { dg-do compile } +// { dg-options "-Wparentheses" } + +template <class x> +class z : x +{ +public: + bool zz () { return false; } + int f () { return zz () ? : 1; } // { dg-warning "omitted middle operand" } +}; + +class t +{ +}; + +int +main () +{ + z<t> x; + return x.f (); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/bool5.C b/gcc/testsuite/g++.old-deja/g++.jason/bool5.C index 1d2f5b60b46..0a16ccb16ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/bool5.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/bool5.C @@ -2,10 +2,10 @@ int main () { bool b = false; - int i = b++; + int i = b++; // { dg-warning "deprecated" } if (i != false || b != true) return 1; - i = b++; + i = b++; // { dg-warning "deprecated" } if (i != true || b != true) return 1; } diff --git a/gcc/testsuite/gcc.c-torture/compile/pr61159.c b/gcc/testsuite/gcc.c-torture/compile/pr61159.c new file mode 100644 index 00000000000..5afa6eaa4d5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr61159.c @@ -0,0 +1,7 @@ +/* { dg-require-alias "" } */ +/* { dg-require-weak "" } */ + +static int dummy = 0; +extern int foo __attribute__((__weak__, __alias__("dummy"))); +typedef char check[2*!__builtin_constant_p(dummy)-1]; +typedef char check[2*!__builtin_constant_p(foo)-1]; diff --git a/gcc/testsuite/gcc.dg/Wno-frame-address.c b/gcc/testsuite/gcc.dg/Wno-frame-address.c index de5a8b8d7bc..e6dfe52038a 100644 --- a/gcc/testsuite/gcc.dg/Wno-frame-address.c +++ b/gcc/testsuite/gcc.dg/Wno-frame-address.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-skip-if "Cannot access arbitrary stack frames" { arm*-*-* hppa*-*-* ia64-*-* visium-*-* } } */ +/* { dg-skip-if "Cannot access arbitrary stack frames" { arm*-*-* avr-*-* hppa*-*-* ia64-*-* visium-*-* } } */ /* { dg-options "-Werror" } */ /* { dg-additional-options "-mbackchain" { target { s390*-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/builtin-object-size-16.c b/gcc/testsuite/gcc.dg/builtin-object-size-16.c new file mode 100644 index 00000000000..15721e5ce89 --- /dev/null +++ b/gcc/testsuite/gcc.dg/builtin-object-size-16.c @@ -0,0 +1,201 @@ +/* PR 71831 - __builtin_object_size poor results with no optimization + Verify that even without optimization __builtin_object_size returns + a meaningful result for a subset of simple expressins. In cases + where the result could not easily be made to match the one obtained + with optimization the built-in was made to fail instead. */ +/* { dg-do run } */ +/* { dg-options "-O0" } */ + +static int nfails; + +#define TEST_FAILURE(line, obj, type, expect, result) \ + __builtin_printf ("FAIL: line %i: __builtin_object_size(" \ + #obj ", %i) == %zu, got %zu\n", \ + line, type, expect, result), ++nfails + +#define bos(obj, type) __builtin_object_size (obj, type) +#define size(obj, n) ((size_t)n == X ? sizeof *obj : (size_t)n) + +#define test(expect, type, obj) \ + do { \ + if (bos (obj, type) != size (obj, expect)) \ + TEST_FAILURE (__LINE__, obj, type, size (obj, expect), bos (obj, type)); \ + } while (0) + +#define T(r0, r1, r2, r3, obj) \ + do { \ + test (r0, 0, obj); \ + test (r1, 1, obj); \ + test (r2, 2, obj); \ + test (r3, 3, obj); \ + } while (0) + +/* For convenience. Substitute for 'sizeof object' in test cases where + the size can vary from target to target. */ +#define X (size_t)0xdeadbeef + +/* __builtin_object_size checking results are inconsistent for equivalent + expressions (see bug 71831). To avoid having duplicate the inconsistency + at -O0 the built-in simply fails. The results hardcoded in this test + are those obtained with optimization (for easy comparison) but without + optimization the macros below turn them into expected failures . */ +#if __OPTIMIZE__ +# define F0(n) n +# define F1(n) n +# define F2(n) n +# define F3(n) n +#else +# define F0(n) -1 +# define F1(n) -1 +# define F2(n) 0 +# define F3(n) 0 +#endif + +typedef __SIZE_TYPE__ size_t; + +extern char ax[]; +char ax2[]; /* { dg-warning "assumed to have one element" } */ + +extern char a0[0]; +static char a1[1]; +static char a2[2]; +static char a9[9]; + +#if __SIZEOF_SHORT__ == 4 +extern short ia0[0]; +static short ia1[1]; +static short ia9[9]; +#elif __SIZEOF_INT__ == 4 +extern int ia0[0]; +static int ia1[1]; +static int ia9[9]; +#endif + +static char a2x2[2][2]; +static char a3x5[3][5]; + +struct Sx { char n, a[]; } sx; +struct S0 { char n, a[0]; } s0; +struct S1 { char n, a[1]; } s1; +struct S2 { char n, a[2]; } s2; +struct S9 { char n, a[9]; } s9; + +struct S2x2 { char n, a[2][2]; } s2x2; +struct S3x5 { char n, a[3][5]; } s3x5; + +static __attribute__ ((noclone, noinline)) void +test_arrays () +{ + T ( -1, -1, 0, 0, ax); + + T ( 0, 0, 0, 0, a0); + T ( 1, 1, 1, 1, ax2); + + T ( 1, 1, 1, 1, a1); + T ( 2, 2, 2, 2, a2); + T ( 9, 9, 9, 9, a9); + + T ( 0, 0, 0, 0, a0); + T ( 1, 1, 1, 1, ax2); + + T ( 0, 0, 0, 0, ia0); + T ( 4, 4, 4, 4, ia1); + T ( 36, 36, 36, 36, ia9); + + /* Not all results for multidimensional arrays make sense (see + bug 77293). The expected results below simply reflect those + obtained at -O2 (modulo the known limitations at -O1). */ + T ( 4, 4, 4, 4, a2x2); + T ( 4, 4, 4, 4, &a2x2[0]); + T ( 4, 2, 4, 2, &a2x2[0][0]); + T ( 0, F1 (0), 0, 0, &a2x2 + 1); + T ( 2, F1 ( 2), 2, F3 ( 2), &a2x2[0] + 1); + T ( 3, F1 ( 1), 3, F3 ( 3), &a2x2[0][0] + 1); + + T ( 15, 15, 15, 15, a3x5); + T ( 15, 5, 15, 5, &a3x5[0][0] + 0); + T ( 14, F1 ( 4), 14, F3 (14), &a3x5[0][0] + 1); + + T ( 1, 1, 1, 1, a1 + 0); + T ( 0, F1 (0), 0, 0, a1 + 1); + T ( 0, F1 ( 0), 0, 0, &a1 + 1); + /* In the following the offset is out of bounds which makes + the expression undefined. Still, verify that the returned + size is zero (and not some large number). */ + T ( 0, F1 (0), 0, 0, a1 + 2); + + T ( 2, 2, 2, 2, a2 + 0); + T ( 1, F1 ( 1), 1, F3 ( 1), a2 + 1); + T ( 0, F1 ( 0), 0, 0, a2 + 2); +} + +static __attribute__ ((noclone, noinline)) void +test_structs (struct Sx *psx, struct S0 *ps0, struct S1 *ps1, struct S9 *ps9) +{ + /* The expected size of a declared object with a flexible array member + is sizeof sx in all __builtin_object_size types. */ + T ( X, X, X, X, &sx); + + /* The expected size of an unknown object with a flexible array member + is unknown in all __builtin_object_size types. */ + T ( -1, -1, 0, 0, psx); + + /* The expected size of a flexible array member of a declared object + is zero. */ + T ( 0, 0, 0, 0, sx.a); + + /* The expected size of a flexible array member of an unknown object + is unknown. */ + T ( -1, -1, 0, 0, psx->a); + + /* The expected size of a declared object with a zero-length array member + is sizeof sx in all __builtin_object_size types. */ + T ( X, X, X, X, &s0); + + /* The expected size of an unknown object with a zero-length array member + is unknown in all __builtin_object_size types. */ + T ( -1, -1, 0, 0, ps0); + + /* The expected size of a zero-length array member of a declared object + is zero. */ + T ( 0, 0, 0, 0, s0.a); + + /* The expected size of a zero-length array member of an unknown object + is unknown. */ + T ( -1, -1, 0, 0, ps0->a); + + T ( X, X, X, X, &s1); + T ( 1, 1, 1, 1, s1.a); + T ( 0, F1 (0), 0, 0, s1.a + 1); + + /* GCC treats arrays of all sizes that are the last member of a struct + as flexible array members. */ + T ( -1, -1, 0, 0, ps1); + T ( -1, -1, 0, 0, ps1->a); + T ( -1, -1, 0, 0, ps1->a + 1); + + T ( X, X, X, X, &s9); + T ( 9, 9, 9, 9, s9.a); + T ( 9, 9, 9, 9, s9.a + 0); + T ( 8, F1 ( 8), 8, F3 ( 8), s9.a + 1); + T ( 7, F1 ( 7), 7, F3 ( 7), s9.a + 2); + T ( 0, F1 ( 0), 0, F3 ( 0), s9.a + 9); + + /* The following make little sense but see bug 77301. */ + T ( -1, -1, 0, 0, ps9); + T ( -1, -1, 0, 0, ps9->a); + T ( -1, -1, 0, 0, ps9->a + 1); +} + +int +main() +{ + test_arrays (); + + test_structs (&sx, &s0, &s1, &s9); + + if (nfails) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/builtin-object-size-17.c b/gcc/testsuite/gcc.dg/builtin-object-size-17.c new file mode 100644 index 00000000000..03664d5d9a5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/builtin-object-size-17.c @@ -0,0 +1,158 @@ +/* PR 71831 - __builtin_object_size poor results with no optimization + Verify that even without optimization __builtin_object_size result + is folded into a constant and dead code that depends on it is + eliminated. */ +/* { dg-do compile } */ +/* { dg-options "-O0 -fdump-tree-ssa" } */ + +#define concat(a, b) a ## b +#define CAT(a, b) concat (a, b) + +/* Create a symbol name unique to each tes and object size type. */ +#define SYM(type) CAT (CAT (CAT (failure_on_line_, __LINE__), _type_), type) + +/* References to the following undefined symbol which is unique for each + test case are expected to be eliminated. */ +#define TEST_FAILURE(type) \ + do { \ + extern void SYM (type)(void); \ + SYM (type)(); \ + } while (0) + +#define bos(obj, type) __builtin_object_size (obj, type) +#define size(obj, n) ((size_t)n == X ? sizeof *obj : (size_t)n) + +#define test(expect, type, obj) \ + do { \ + if (bos (obj, type) != size (obj, expect)) \ + TEST_FAILURE (type); \ + } while (0) + +#define FOLD_ALL(r0, r1, r2, r3, obj) \ + do { \ + test (r0, 0, obj); \ + test (r1, 1, obj); \ + test (r2, 2, obj); \ + test (r3, 3, obj); \ + } while (0) + +#define FOLD_0_2(r0, r1, r2, r3, obj) \ + do { \ + test (r0, 0, obj); \ + test (r2, 2, obj); \ + } while (0) + +/* For convenience. Substitute for 'sizeof object' in test cases where + the size can vary from target to target. */ +#define X (size_t)0xdeadbeef + +typedef __SIZE_TYPE__ size_t; + +extern char ax[]; +char ax2[]; /* { dg-warning "assumed to have one element" } */ + +extern char a0[0]; +static char a1[1]; +static char a2[2]; +static char a9[9]; + +#if __SIZEOF_SHORT__ == 4 +extern short ia0[0]; +static short ia1[1]; +static short ia9[9]; +#elif __SIZEOF_INT__ == 4 +extern int ia0[0]; +static int ia1[1]; +static int ia9[9]; +#endif + +static char a2x2[2][2]; +static char a3x5[3][5]; + +struct Sx { char n, a[]; } sx; +struct S0 { char n, a[0]; } s0; +struct S1 { char n, a[1]; } s1; +struct S2 { char n, a[2]; } s2; +struct S9 { char n, a[9]; } s9; + +struct S2x2 { char n, a[2][2]; } s2x2; +struct S3x5 { char n, a[3][5]; } s3x5; + +static __attribute__ ((noclone, noinline)) void +test_arrays () +{ + FOLD_ALL ( 1, 1, 1, 1, ax2); + + FOLD_ALL ( 1, 1, 1, 1, a1); + FOLD_ALL ( 2, 2, 2, 2, a2); + FOLD_ALL ( 9, 9, 9, 9, a9); + + FOLD_ALL ( 0, 0, 0, 0, a0); + FOLD_ALL ( 1, 1, 1, 1, ax2); + + FOLD_ALL ( 0, 0, 0, 0, ia0); + FOLD_ALL ( 4, 4, 4, 4, ia1); + FOLD_ALL ( 36, 36, 36, 36, ia9); + + /* Not all results for multidimensional arrays make sense (see + bug 77293). The expected results below simply reflect those + obtained at -O2 (modulo the known limitations at -O1). */ + FOLD_ALL ( 4, 4, 4, 4, a2x2); + FOLD_ALL ( 4, 4, 4, 4, &a2x2[0]); + FOLD_ALL ( 4, 2, 4, 2, &a2x2[0][0]); + FOLD_0_2 ( 0, F1 (0), 0, 0, &a2x2 + 1); + FOLD_0_2 ( 2, F1 ( 2), 2, F3 ( 2), &a2x2[0] + 1); + FOLD_0_2 ( 3, F1 ( 1), 3, F3 ( 3), &a2x2[0][0] + 1); + + FOLD_ALL ( 15, 15, 15, 15, a3x5); + FOLD_ALL ( 15, 5, 15, 5, &a3x5[0][0] + 0); + FOLD_0_2 ( 14, F1 ( 4), 14, F3 (14), &a3x5[0][0] + 1); + + FOLD_ALL ( 1, 1, 1, 1, a1 + 0); + FOLD_0_2 ( 0, F1 ( 0), 0, 0, &a1 + 1); + FOLD_ALL ( 2, 2, 2, 2, a2 + 0); + FOLD_0_2 ( 1, F1 ( 1), 1, F3 ( 1), a2 + 1); + FOLD_0_2 ( 0, F1 ( 0), 0, 0, a2 + 2); +} + +static __attribute__ ((noclone, noinline)) void +test_structs (void) +{ + /* The expected size of a declared object with a flexible array member + is sizeof sx in all __builtin_object_size types. */ + FOLD_ALL ( X, X, X, X, &sx); + + /* The expected size of a flexible array member of a declared object + is zero. */ + FOLD_ALL ( 0, 0, 0, 0, sx.a); + + /* The expected size of a declared object with a zero-length array member + is sizeof sx in all __builtin_object_size types. */ + FOLD_ALL ( X, X, X, X, &s0); + + /* The expected size of a zero-length array member of a declared object + is zero. */ + FOLD_ALL ( 0, 0, 0, 0, s0.a); + + FOLD_ALL ( X, X, X, X, &s1); + FOLD_ALL ( 1, 1, 1, 1, s1.a); + FOLD_0_2 ( 0, F1 (0), 0, 0, s1.a + 1); + + FOLD_ALL ( X, X, X, X, &s9); + FOLD_ALL ( 9, 9, 9, 9, s9.a); + FOLD_ALL ( 9, 9, 9, 9, s9.a + 0); + FOLD_0_2 ( 8, F1 ( 8), 8, F3 ( 8), s9.a + 1); + FOLD_0_2 ( 7, F1 ( 7), 7, F3 ( 7), s9.a + 2); + FOLD_0_2 ( 0, F1 ( 0), 0, F3 ( 0), s9.a + 9); +} + +int +main() +{ + test_arrays (); + test_structs (); + + return 0; +} + +/* { dg-final { scan-tree-dump-not "failure_on_line" "ssa" } } */ diff --git a/gcc/testsuite/gcc.dg/builtins-68.c b/gcc/testsuite/gcc.dg/builtins-68.c index c0cc1ebdcb9..1247394e4d9 100644 --- a/gcc/testsuite/gcc.dg/builtins-68.c +++ b/gcc/testsuite/gcc.dg/builtins-68.c @@ -1,7 +1,7 @@ /* PR middle-end/69780 - [4.9/5/6 Regression] ICE on __builtin_alloca_with_align with small alignment */ -/* { dg-require-effective-target alloca } */ /* { dg-do compile } */ +/* { dg-require-effective-target alloca } */ /* { dg-options "-Wno-long-long" } */ #define CHAR_BIT __CHAR_BIT__ diff --git a/gcc/testsuite/gcc.dg/compat/scalar-by-value-4_main.c b/gcc/testsuite/gcc.dg/compat/scalar-by-value-4_main.c index 8164b44283a..bd024c0542d 100644 --- a/gcc/testsuite/gcc.dg/compat/scalar-by-value-4_main.c +++ b/gcc/testsuite/gcc.dg/compat/scalar-by-value-4_main.c @@ -1,5 +1,5 @@ /* Test passing scalars by value. This test includes _Complex types - whose real and imaginary parts cannot be used in variable-length + whose real and imaginary parts can be used in variable-length argument lists. */ extern void scalar_by_value_4_x (void); diff --git a/gcc/testsuite/gcc.dg/compat/scalar-by-value-4_x.c b/gcc/testsuite/gcc.dg/compat/scalar-by-value-4_x.c index a4e73c9fdb6..a36a06081f1 100644 --- a/gcc/testsuite/gcc.dg/compat/scalar-by-value-4_x.c +++ b/gcc/testsuite/gcc.dg/compat/scalar-by-value-4_x.c @@ -13,6 +13,7 @@ test##NAME (TYPE x01, TYPE x02, TYPE x03, TYPE x04, \ TYPE x05, TYPE x06, TYPE x07, TYPE x08, \ TYPE x09, TYPE x10, TYPE x11, TYPE x12, \ TYPE x13, TYPE x14, TYPE x15, TYPE x16); \ +extern void testva##NAME (int n, ...); \ \ void \ check##NAME (TYPE x, TYPE v) \ @@ -62,6 +63,81 @@ testit##NAME (void) \ g13##NAME, g14##NAME, g15##NAME, g16##NAME); \ DEBUG_NL; \ DEBUG_FPUTS (#NAME); \ + DEBUG_FPUTS (" testva:"); \ + DEBUG_NL; \ + testva##NAME (1, \ + g01##NAME); \ + DEBUG_NL; \ + testva##NAME (2, \ + g01##NAME, g02##NAME); \ + DEBUG_NL; \ + testva##NAME (3, \ + g01##NAME, g02##NAME, g03##NAME); \ + DEBUG_NL; \ + testva##NAME (4, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME); \ + DEBUG_NL; \ + testva##NAME (5, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME); \ + DEBUG_NL; \ + testva##NAME (6, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME); \ + DEBUG_NL; \ + testva##NAME (7, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME); \ + DEBUG_NL; \ + testva##NAME (8, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME); \ + DEBUG_NL; \ + testva##NAME (9, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME); \ + DEBUG_NL; \ + testva##NAME (10, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME, g10##NAME); \ + DEBUG_NL; \ + testva##NAME (11, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME, g10##NAME, g11##NAME); \ + DEBUG_NL; \ + testva##NAME (12, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME, g10##NAME, g11##NAME, g12##NAME); \ + DEBUG_NL; \ + testva##NAME (13, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME, g10##NAME, g11##NAME, g12##NAME, \ + g13##NAME); \ + DEBUG_NL; \ + testva##NAME (14, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME, g10##NAME, g11##NAME, g12##NAME, \ + g13##NAME, g14##NAME); \ + DEBUG_NL; \ + testva##NAME (15, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME, g10##NAME, g11##NAME, g12##NAME, \ + g13##NAME, g14##NAME, g15##NAME); \ + DEBUG_NL; \ + testva##NAME (16, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME, g10##NAME, g11##NAME, g12##NAME, \ + g13##NAME, g14##NAME, g15##NAME, g16##NAME); \ + DEBUG_NL; \ + DEBUG_FPUTS (#NAME); \ DEBUG_FPUTS (" test2: "); \ test2_##NAME (g01##NAME, g03##NAME, g05##NAME, g07##NAME, \ g09##NAME, g11##NAME, g13##NAME, g15##NAME); \ diff --git a/gcc/testsuite/gcc.dg/compat/scalar-by-value-4_y.c b/gcc/testsuite/gcc.dg/compat/scalar-by-value-4_y.c index e0fa7053996..38b17d50066 100644 --- a/gcc/testsuite/gcc.dg/compat/scalar-by-value-4_y.c +++ b/gcc/testsuite/gcc.dg/compat/scalar-by-value-4_y.c @@ -65,6 +65,23 @@ test##NAME (TYPE x01, TYPE x02, TYPE x03, TYPE x04, \ check##NAME (x14, 14); \ check##NAME (x15, 15); \ check##NAME (x16, 16); \ +} \ + \ +void \ +testva##NAME (int n, ...) \ +{ \ + int i; \ + va_list ap; \ + if (test_va) \ + { \ + va_start (ap, n); \ + for (i = 0; i < n; i++) \ + { \ + TYPE t = va_arg (ap, TYPE); \ + check##NAME (t, i+1); \ + } \ + va_end (ap); \ + } \ } #ifndef SKIP_COMPLEX diff --git a/gcc/testsuite/gcc.dg/compat/scalar-return-4_main.c b/gcc/testsuite/gcc.dg/compat/scalar-return-4_main.c index 2bcfa04872f..866121e5dd3 100644 --- a/gcc/testsuite/gcc.dg/compat/scalar-return-4_main.c +++ b/gcc/testsuite/gcc.dg/compat/scalar-return-4_main.c @@ -1,5 +1,5 @@ /* Test function return values. This test includes _Complex types - whose real and imaginary parts cannot be used in variable-length + whose real and imaginary parts can be used in variable-length argument lists. */ extern void scalar_return_4_x (void); diff --git a/gcc/testsuite/gcc.dg/compat/scalar-return-4_x.c b/gcc/testsuite/gcc.dg/compat/scalar-return-4_x.c index 50305be4d35..11f4688a6d0 100644 --- a/gcc/testsuite/gcc.dg/compat/scalar-return-4_x.c +++ b/gcc/testsuite/gcc.dg/compat/scalar-return-4_x.c @@ -1,12 +1,22 @@ #include "compat-common.h" +#ifdef SKIP_VA +const int test_va = 0; +#else +const int test_va = 1; +#endif + #define T(NAME, TYPE, INITVAL) \ -TYPE g01##NAME; \ +TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \ +TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \ +TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \ +TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \ \ extern void init##NAME (TYPE *p, TYPE v); \ extern void checkg##NAME (void); \ extern TYPE test0##NAME (void); \ extern TYPE test1##NAME (TYPE); \ +extern TYPE testva##NAME (int n, ...); \ \ void \ check##NAME (TYPE x, TYPE v) \ @@ -22,6 +32,21 @@ testit##NAME (void) \ DEBUG_FPUTS (#NAME); \ DEBUG_FPUTS (" init: "); \ init##NAME (&g01##NAME, 1); \ + init##NAME (&g02##NAME, 2); \ + init##NAME (&g03##NAME, 3); \ + init##NAME (&g04##NAME, 4); \ + init##NAME (&g05##NAME, 5); \ + init##NAME (&g06##NAME, 6); \ + init##NAME (&g07##NAME, 7); \ + init##NAME (&g08##NAME, 8); \ + init##NAME (&g09##NAME, 9); \ + init##NAME (&g10##NAME, 10); \ + init##NAME (&g11##NAME, 11); \ + init##NAME (&g12##NAME, 12); \ + init##NAME (&g13##NAME, 13); \ + init##NAME (&g14##NAME, 14); \ + init##NAME (&g15##NAME, 15); \ + init##NAME (&g16##NAME, 16); \ checkg##NAME (); \ DEBUG_NL; \ DEBUG_FPUTS (#NAME); \ @@ -33,13 +58,35 @@ testit##NAME (void) \ DEBUG_FPUTS (" test1: "); \ rslt = test1##NAME (g01##NAME); \ check##NAME (rslt, g01##NAME); \ + if (test_va) \ + { \ + DEBUG_NL; \ + DEBUG_FPUTS (#NAME); \ + DEBUG_FPUTS (" testva: "); \ + rslt = testva##NAME (1, g01##NAME); \ + check##NAME (rslt, g01##NAME); \ + rslt = testva##NAME (5, g01##NAME, g02##NAME, g03##NAME, \ + g04##NAME, g05##NAME); \ + check##NAME (rslt, g05##NAME); \ + rslt = testva##NAME (9, g01##NAME, g02##NAME, g03##NAME, \ + g04##NAME, g05##NAME, g06##NAME, \ + g07##NAME, g08##NAME, g09##NAME); \ + check##NAME (rslt, g09##NAME); \ + rslt = testva##NAME (16, g01##NAME, g02##NAME, g03##NAME, \ + g04##NAME, g05##NAME, g06##NAME, \ + g07##NAME, g08##NAME, g09##NAME, \ + g10##NAME, g11##NAME, g12##NAME, \ + g13##NAME, g14##NAME, g15##NAME, \ + g16##NAME); \ + check##NAME (rslt, g16##NAME); \ + } \ DEBUG_NL; \ } #ifndef SKIP_COMPLEX #ifndef SKIP_COMPLEX_INT T(cc, _Complex char, CINT (0, 1)) -T(cs, _Complex short, CINT (1 + 2)) +T(cs, _Complex short, CINT (1, 2)) #endif T(cf, _Complex float, CDBL (1.0, 2.0)) #endif diff --git a/gcc/testsuite/gcc.dg/compat/scalar-return-4_y.c b/gcc/testsuite/gcc.dg/compat/scalar-return-4_y.c index 3c96856975f..3ae0749bab8 100644 --- a/gcc/testsuite/gcc.dg/compat/scalar-return-4_y.c +++ b/gcc/testsuite/gcc.dg/compat/scalar-return-4_y.c @@ -2,14 +2,11 @@ #include "compat-common.h" -#ifdef SKIP_VA -const int test_va = 0; -#else -const int test_va = 1; -#endif - #define T(NAME, TYPE, INITVAL) \ -extern TYPE g01##NAME; \ +extern TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \ +extern TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \ +extern TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \ +extern TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \ \ extern void check##NAME (TYPE x, TYPE v); \ \ @@ -23,6 +20,21 @@ void \ checkg##NAME (void) \ { \ check##NAME (g01##NAME, 1+INITVAL); \ + check##NAME (g02##NAME, 2+INITVAL); \ + check##NAME (g03##NAME, 3+INITVAL); \ + check##NAME (g04##NAME, 4+INITVAL); \ + check##NAME (g05##NAME, 5+INITVAL); \ + check##NAME (g06##NAME, 6+INITVAL); \ + check##NAME (g07##NAME, 7+INITVAL); \ + check##NAME (g08##NAME, 8+INITVAL); \ + check##NAME (g09##NAME, 9+INITVAL); \ + check##NAME (g10##NAME, 10+INITVAL); \ + check##NAME (g11##NAME, 11+INITVAL); \ + check##NAME (g12##NAME, 12+INITVAL); \ + check##NAME (g13##NAME, 13+INITVAL); \ + check##NAME (g14##NAME, 14+INITVAL); \ + check##NAME (g15##NAME, 15+INITVAL); \ + check##NAME (g16##NAME, 16+INITVAL); \ } \ \ TYPE \ @@ -35,6 +47,19 @@ TYPE \ test1##NAME (TYPE x01) \ { \ return x01; \ +} \ + \ +TYPE \ +testva##NAME (int n, ...) \ +{ \ + int i; \ + TYPE rslt; \ + va_list ap; \ + va_start (ap, n); \ + for (i = 0; i < n; i++) \ + rslt = va_arg (ap, TYPE); \ + va_end (ap); \ + return rslt; \ } #ifndef SKIP_COMPLEX diff --git a/gcc/testsuite/gcc.dg/fold-reassoc-2.c b/gcc/testsuite/gcc.dg/fold-reassoc-2.c index 98890b10be3..a334ec6122a 100644 --- a/gcc/testsuite/gcc.dg/fold-reassoc-2.c +++ b/gcc/testsuite/gcc.dg/fold-reassoc-2.c @@ -1,13 +1,13 @@ -/* { dg-do compile } */
-/* { dg-options "-O -fdump-tree-original" } */
-
-int foo (int i)
-{
- return (i + 2) - (i + 1);
-}
-int bar (int i)
-{
- return (i + 2) + ~i;
-}
-
-/* { dg-final { scan-tree-dump "return 1;" "original" } } */
+/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-original" } */ + +int foo (int i) +{ + return (i + 2) - (i + 1); +} +int bar (int i) +{ + return (i + 2) + ~i; +} + +/* { dg-final { scan-tree-dump-times "return 1;" 2 "original" } } */ diff --git a/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c b/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c index 63075c80609..e5e6ade6bbe 100644 --- a/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c +++ b/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c @@ -30,7 +30,7 @@ void test_mismatching_types (const char *msg) /* { dg-begin-multiline-output "" } printf("hello %i", (long)0); ~^ - %ld + %li { dg-end-multiline-output "" } */ } @@ -88,7 +88,7 @@ void test_hex (const char *msg) /* { dg-begin-multiline-output "" } printf("hello \x25\x69", msg); ~~~~^~~~ - %s + \x25s { dg-end-multiline-output "" } */ } @@ -102,7 +102,7 @@ void test_oct (const char *msg) /* { dg-begin-multiline-output "" } printf("hello \045\151", msg); ~~~~^~~~ - %s + \045s { dg-end-multiline-output "" } */ } @@ -121,7 +121,7 @@ void test_multiple (const char *msg) /* { dg-begin-multiline-output "" } printf("prefix" "\x25" "\151" "suffix", ~~~~~~~~^~~~ - %s + \x25" "s { dg-end-multiline-output "" } */ } @@ -267,7 +267,7 @@ void test_non_contiguous_strings (void) /* { dg-begin-multiline-output "" } __builtin_printf(" %" "d ", 0.5); ~~~~^ - %f + %" "f { dg-end-multiline-output "" } */ } diff --git a/gcc/testsuite/gcc.dg/format/miss-7.c b/gcc/testsuite/gcc.dg/format/miss-7.c new file mode 100644 index 00000000000..828b781e0e6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/miss-7.c @@ -0,0 +1,36 @@ +/* PR77336 - -Wsuggest-attribute=format warning overly simplistic */ +/* { dg-do compile } */ +/* { dg-options "-Wsuggest-attribute=format" } */ + +#include "format.h" + +const char format[] = "%i"; + +void foo (char *d, unsigned n, va_list va) +{ + (void)&n; + + /* The following calls don't imply that the enclosing function is + a candiate for the format attribute because it uses a string + constant as the format. */ + vsnprintf (d, n, "%i", va); + + vsnprintf (d, n, format, va); + + /* In theory this should not trigger the warning either but GCC + doesn't treat the local static constant the same way as the + global and issues a false positive. + const char fmt[] = "%i"; + vsnprintf (d, n, fmt, va); + */ +} + +void bar (char *d, unsigned n, const char *f, va_list va) +{ + (void)&n; + + /* The following call suggests that the enclosing function might + be a candiate for the format attribute because it doesn't use + a string literal as the format. */ + vsnprintf (d, n, f, va); /* { dg-warning "function .bar. might be a candidate for .gnu_printf. format attribute" } */ +} diff --git a/gcc/testsuite/gcc.dg/format/pr72858.c b/gcc/testsuite/gcc.dg/format/pr72858.c new file mode 100644 index 00000000000..d8d0499b778 --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/pr72858.c @@ -0,0 +1,410 @@ +/* { dg-options "-Wformat -fdiagnostics-show-caret" } */ + +#include "format.h" + +/* Various format tests, some containing type mismatches. Verify that for + the type mismatch cases that we offer "good" suggestions. Specifically, + any suggestions should preserve flags characters, field width and precision, + and, if possible, the conversion specifier character, whilst giving a + corrected length modifier appropriate to the argument type. */ + +/* Tests of "x" without a length modifier, with various param types. + Suggestions should preserve the "x" for integer arguments. */ + +void +test_x (char *d, + int iexpr, unsigned int uiexpr, + long lexpr, unsigned long ulexpr, + long long llexpr, unsigned long long ullexpr, + float fexpr, double dexpr, long double ldexpr, + void *ptr) +{ + /* Integer arguments. */ + + sprintf (d, " %-8x ", iexpr); + sprintf (d, " %-8x ", uiexpr); + + sprintf (d, " %-8x ", lexpr); /* { dg-warning "20: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'long int'" } */ +/* TODO: ideally would also underline "lexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8x ", lexpr); + ~~~^ + %-8lx + { dg-end-multiline-output "" } */ + sprintf (d, " %-8x ", ulexpr); /* { dg-warning "20: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int'" } */ +/* TODO: ideally would also underline "lexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8x ", ulexpr); + ~~~^ + %-8lx + { dg-end-multiline-output "" } */ + + sprintf (d, " %-8x ", llexpr); /* { dg-warning "20: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'long long int'" } */ +/* TODO: ideally would also underline "lexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8x ", llexpr); + ~~~^ + %-8llx + { dg-end-multiline-output "" } */ + sprintf (d, " %-8x ", ullexpr); /* { dg-warning "20: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'long long unsigned int'" } */ +/* TODO: ideally would also underline "lexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8x ", ullexpr); + ~~~^ + %-8llx + { dg-end-multiline-output "" } */ + + /* Floating-point arguments. */ + + sprintf (d, " %-8x ", fexpr); /* { dg-warning "20: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'double'" } */ +/* TODO: ideally would also underline "fexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8x ", fexpr); + ~~~^ + %-8f + { dg-end-multiline-output "" } */ + sprintf (d, " %-8x ", dexpr); /* { dg-warning "20: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'double'" } */ +/* TODO: ideally would also underline "dexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8x ", dexpr); + ~~~^ + %-8f + { dg-end-multiline-output "" } */ + sprintf (d, " %-8x ", ldexpr); /* { dg-warning "20: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'long double'" } */ +/* TODO: ideally would also underline "ldexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8x ", ldexpr); + ~~~^ + %-8Lf + { dg-end-multiline-output "" } */ + + /* Pointer. */ + sprintf (d, " %-8x ", ptr); /* { dg-warning "20: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'void \\*'" } */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8x ", ptr); + ~~~^ + %-8p + { dg-end-multiline-output "" } */ + + /* Something unrecognized. */ + struct s { int i; }; + struct s s; + sprintf (d, " %-8x ", s); /* { dg-warning "20: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'struct s'" } */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8x ", s); + ~~~^ + { dg-end-multiline-output "" } */ +} + +/* Tests of "x" with "l", with various param types. + Suggestions should preserve the "x" for integer arguments. */ + +void +test_lx (char *d, + int iexpr, unsigned int uiexpr, + long lexpr, unsigned long ulexpr, + long long llexpr, unsigned long long ullexpr, + float fexpr, double dexpr, long double ldexpr) +{ + /* Integer arguments. */ + + sprintf (d, " %-8lx ", iexpr); /* { dg-warning "21: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'int'" } */ +/* TODO: ideally would also underline "iexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8lx ", iexpr); + ~~~~^ + %-8x + { dg-end-multiline-output "" } */ + sprintf (d, " %-8lx ", uiexpr); /* { dg-warning "21: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'unsigned int'" } */ +/* TODO: ideally would also underline "uiexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8lx ", uiexpr); + ~~~~^ + %-8x + { dg-end-multiline-output "" } */ + + sprintf (d, " %-8lx ", lexpr); + sprintf (d, " %-8lx ", ulexpr); + + sprintf (d, " %-8lx ", llexpr); /* { dg-warning "21: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long long int'" } */ +/* TODO: ideally would also underline "llexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8lx ", llexpr); + ~~~~^ + %-8llx + { dg-end-multiline-output "" } */ + sprintf (d, " %-8lx ", ullexpr); /* { dg-warning "21: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long long unsigned int'" } */ +/* TODO: ideally would also underline "ullexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8lx ", ullexpr); + ~~~~^ + %-8llx + { dg-end-multiline-output "" } */ + + /* Floating-point arguments. */ + + sprintf (d, " %-8lx ", fexpr); /* { dg-warning "21: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'double'" } */ +/* TODO: ideally would also underline "fexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8lx ", fexpr); + ~~~~^ + %-8f + { dg-end-multiline-output "" } */ + sprintf (d, " %-8lx ", dexpr); /* { dg-warning "21: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'double'" } */ +/* TODO: ideally would also underline "dexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8lx ", dexpr); + ~~~~^ + %-8f + { dg-end-multiline-output "" } */ + sprintf (d, " %-8lx ", ldexpr); /* { dg-warning "21: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long double'" } */ +/* TODO: ideally would also underline "ldexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8lx ", ldexpr); + ~~~~^ + %-8Lf + { dg-end-multiline-output "" } */ +} + +/* Tests of "o" without a length modifier, with various param types. + Suggestions should preserve the "o" for integer arguments. */ + +void +test_o (char *d, + int iexpr, unsigned int uiexpr, + long lexpr, unsigned long ulexpr, + long long llexpr, unsigned long long ullexpr) +{ + /* Integer arguments. */ + + sprintf (d, " %-8o ", iexpr); + sprintf (d, " %-8o ", uiexpr); + + sprintf (d, " %-8o ", lexpr); /* { dg-warning "20: format '%o' expects argument of type 'unsigned int', but argument 3 has type 'long int'" } */ +/* TODO: ideally would also underline "lexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8o ", lexpr); + ~~~^ + %-8lo + { dg-end-multiline-output "" } */ + sprintf (d, " %-8o ", ulexpr); /* { dg-warning "20: format '%o' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int'" } */ +/* TODO: ideally would also underline "lexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8o ", ulexpr); + ~~~^ + %-8lo + { dg-end-multiline-output "" } */ + + sprintf (d, " %-8o ", llexpr); /* { dg-warning "20: format '%o' expects argument of type 'unsigned int', but argument 3 has type 'long long int'" } */ +/* TODO: ideally would also underline "lexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8o ", llexpr); + ~~~^ + %-8llo + { dg-end-multiline-output "" } */ + sprintf (d, " %-8o ", ullexpr); /* { dg-warning "20: format '%o' expects argument of type 'unsigned int', but argument 3 has type 'long long unsigned int'" } */ +/* TODO: ideally would also underline "lexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8o ", ullexpr); + ~~~^ + %-8llo + { dg-end-multiline-output "" } */ +} + +/* Tests of "o" with "l", with various param types. + Suggestions should preserve the "o" for integer arguments. */ + +void +test_lo (char *d, + int iexpr, unsigned int uiexpr, + long lexpr, unsigned long ulexpr, + long long llexpr, unsigned long long ullexpr) +{ + /* Integer arguments. */ + + sprintf (d, " %-8lo ", iexpr); /* { dg-warning "21: format '%lo' expects argument of type 'long unsigned int', but argument 3 has type 'int'" } */ +/* TODO: ideally would also underline "iexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8lo ", iexpr); + ~~~~^ + %-8o + { dg-end-multiline-output "" } */ + sprintf (d, " %-8lo ", uiexpr); /* { dg-warning "21: format '%lo' expects argument of type 'long unsigned int', but argument 3 has type 'unsigned int'" } */ +/* TODO: ideally would also underline "uiexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8lo ", uiexpr); + ~~~~^ + %-8o + { dg-end-multiline-output "" } */ + + sprintf (d, " %-8lo ", lexpr); + sprintf (d, " %-8lo ", ulexpr); + + sprintf (d, " %-8lo ", llexpr); /* { dg-warning "21: format '%lo' expects argument of type 'long unsigned int', but argument 3 has type 'long long int'" } */ +/* TODO: ideally would also underline "llexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8lo ", llexpr); + ~~~~^ + %-8llo + { dg-end-multiline-output "" } */ + sprintf (d, " %-8lo ", ullexpr); /* { dg-warning "21: format '%lo' expects argument of type 'long unsigned int', but argument 3 has type 'long long unsigned int'" } */ +/* TODO: ideally would also underline "ullexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8lo ", ullexpr); + ~~~~^ + %-8llo + { dg-end-multiline-output "" } */ +} + +/* Tests of "e" without a length modifier, with various param types. + Suggestions should preserve the "e" for float arguments. */ + +void +test_e (char *d, int iexpr, float fexpr, double dexpr, long double ldexpr) +{ + /* Integer arguments. */ + + sprintf (d, " %-8e ", iexpr); /* { dg-warning "20: format '%e' expects argument of type 'double', but argument 3 has type 'int'" } */ +/* TODO: ideally would also underline "iexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8e ", iexpr); + ~~~^ + %-8d + { dg-end-multiline-output "" } */ + + /* Floating-point arguments. */ + + sprintf (d, " %-8e ", fexpr); + sprintf (d, " %-8e ", dexpr); + sprintf (d, " %-8e ", ldexpr); /* { dg-warning "20: format '%e' expects argument of type 'double', but argument 3 has type 'long double'" } */ +/* TODO: ideally would also underline "ldexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8e ", ldexpr); + ~~~^ + %-8Le + { dg-end-multiline-output "" } */ +} + +/* Tests of "e" with "L", with various param types. + Suggestions should preserve the "e" for float arguments. */ + +void +test_Le (char *d, int iexpr, float fexpr, double dexpr, long double ldexpr) +{ + /* Integer arguments. */ + + sprintf (d, " %-8Le ", iexpr); /* { dg-warning "21: format '%Le' expects argument of type 'long double', but argument 3 has type 'int'" } */ +/* TODO: ideally would also underline "iexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8Le ", iexpr); + ~~~~^ + %-8d + { dg-end-multiline-output "" } */ + + /* Floating-point arguments. */ + + sprintf (d, " %-8Le ", fexpr); /* { dg-warning "21: format '%Le' expects argument of type 'long double', but argument 3 has type 'double'" } */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8Le ", fexpr); + ~~~~^ + %-8e + { dg-end-multiline-output "" } */ + + sprintf (d, " %-8Le ", dexpr); /* { dg-warning "21: format '%Le' expects argument of type 'long double', but argument 3 has type 'double'" } */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8Le ", dexpr); + ~~~~^ + %-8e + { dg-end-multiline-output "" } */ + + sprintf (d, " %-8Le ", ldexpr); +} + +/* Tests of "E" without a length modifier, with various param types. + Suggestions should preserve the "E" for floating-point arguments. */ + +void +test_E (char *d, int iexpr, float fexpr, double dexpr, long double ldexpr) +{ + /* Integer arguments. */ + + sprintf (d, " %-8E ", iexpr); /* { dg-warning "20: format '%E' expects argument of type 'double', but argument 3 has type 'int'" } */ +/* TODO: ideally would also underline "iexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8E ", iexpr); + ~~~^ + %-8d + { dg-end-multiline-output "" } */ + + /* Floating-point arguments. */ + + sprintf (d, " %-8E ", fexpr); + sprintf (d, " %-8E ", dexpr); + sprintf (d, " %-8E ", ldexpr); /* { dg-warning "20: format '%E' expects argument of type 'double', but argument 3 has type 'long double'" } */ +/* TODO: ideally would also underline "ldexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8E ", ldexpr); + ~~~^ + %-8LE + { dg-end-multiline-output "" } */ +} + +/* Tests of "E" with "L", with various param types. + Suggestions should preserve the "E" for floating-point arguments. */ + +void +test_LE (char *d, int iexpr, float fexpr, double dexpr, long double ldexpr) +{ + /* Integer arguments. */ + + sprintf (d, " %-8LE ", iexpr); /* { dg-warning "21: format '%LE' expects argument of type 'long double', but argument 3 has type 'int'" } */ +/* TODO: ideally would also underline "iexpr". */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8LE ", iexpr); + ~~~~^ + %-8d + { dg-end-multiline-output "" } */ + + sprintf (d, " %-8LE ", fexpr); /* { dg-warning "21: format '%LE' expects argument of type 'long double', but argument 3 has type 'double'" } */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8LE ", fexpr); + ~~~~^ + %-8E + { dg-end-multiline-output "" } */ + + sprintf (d, " %-8LE ", dexpr); /* { dg-warning "21: format '%LE' expects argument of type 'long double', but argument 3 has type 'double'" } */ +/* { dg-begin-multiline-output "" } + sprintf (d, " %-8LE ", dexpr); + ~~~~^ + %-8E + { dg-end-multiline-output "" } */ + + sprintf (d, " %-8LE ", ldexpr); +} + +/* Test of a suggestion for a conversion specification containing + all features (flags, width, precision, length modifier), where + all the other arguments have mismatching types. */ + +void +test_everything (char *d, long lexpr) +{ + sprintf (d, "before %-+*.*lld after", lexpr, lexpr, lexpr); /* { dg-warning "26: field width specifier '\\*' expects argument of type 'int', but argument 3 has type 'long int'" } */ + /* { dg-begin-multiline-output "" } + sprintf (d, "before %-+*.*lld after", lexpr, lexpr, lexpr); + ~~~^~~~~~ + { dg-end-multiline-output "" } */ + + /* { dg-warning "28: field precision specifier '\\.\\*' expects argument of type 'int', but argument 4 has type 'long int'" "" { target *-*-* } 392 } */ + /* { dg-begin-multiline-output "" } + sprintf (d, "before %-+*.*lld after", lexpr, lexpr, lexpr); + ~~~~~^~~~ + { dg-end-multiline-output "" } */ + + /* { dg-warning "31: format '%lld' expects argument of type 'long long int', but argument 5 has type 'long int'" "" { target *-*-* } 392 } */ + /* { dg-begin-multiline-output "" } + sprintf (d, "before %-+*.*lld after", lexpr, lexpr, lexpr); + ~~~~~~~~^ + %-+*.*ld + { dg-end-multiline-output "" } */ +} diff --git a/gcc/testsuite/gcc.dg/gomp/_Atomic-1.c b/gcc/testsuite/gcc.dg/gomp/_Atomic-1.c new file mode 100644 index 00000000000..1f784524f67 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/_Atomic-1.c @@ -0,0 +1,103 @@ +/* PR c/65467 */ +/* { dg-do compile } */ +/* { dg-additional-options "-std=c11" } */ + +_Atomic int t; +#pragma omp threadprivate (t) + +void +foo (void) +{ + _Atomic int a = 4, b = 0, c, d = 3, e; + a++; + #pragma omp parallel sections num_threads (a) shared (b) private (c) firstprivate (d) lastprivate (e) + { + #pragma omp section + { + a++; + b++; + c = 5; + c++; + d++; + e = 9; + e++; + } + #pragma omp section + { + a++; + b++; + c = 5; + c++; + d++; + e = 3; + e++; + } + } + e++; + t++; + #pragma omp parallel copyin (t) private (e) + { + t++; + e = t; + #pragma omp single copyprivate (e) + { + e++; + } + e++; + } +} + +void +bar (void) +{ + int a[4]; + _Atomic int b = 1, c = 2, f = 8, g = 8, h = 0; + _Atomic int d, e[3]; + int *_Atomic p; + _Atomic int *_Atomic q; + int i, j; + p = a; + q = e; + #pragma omp target teams map (tofrom: a[b:c]) num_teams (b) thread_limit (c) + a[1]++; + #pragma omp target device(h) + ; + #pragma omp task depend (inout: a[b:c]) + ; + #pragma omp task depend (out: d, e[b:c]) priority (b) + ; + #pragma omp task depend (out: p[b:c]) + ; + #pragma omp task depend (out: q[b:c]) + ; + #pragma omp taskloop num_tasks (c) + for (i = 0; i < 16; i++) + ; + #pragma omp taskloop grainsize (c) + for (i = 0; i < 16; i++) + ; + #pragma omp parallel for schedule (dynamic, b) + for (i = 0; i < 16; i++) + ; + j = 0; + #pragma omp simd linear(j:b) + for (i = 0; i < 16; i++) + j += b; + j = 4; + #pragma omp atomic read + b = j; + #pragma omp atomic write + j = c; + #pragma omp atomic + j += c; + #pragma omp atomic capture + b = j += c; + #pragma omp atomic capture + b = ++j; + #pragma omp atomic capture + { b = j; j = c; } + #pragma omp atomic capture + { b = j; j++; } + #pragma omp atomic capture + { j *= c; b = j; } +} diff --git a/gcc/testsuite/gcc.dg/gomp/_Atomic-2.c b/gcc/testsuite/gcc.dg/gomp/_Atomic-2.c new file mode 100644 index 00000000000..159a5b3ee7d --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/_Atomic-2.c @@ -0,0 +1,76 @@ +/* PR c/65467 */ +/* { dg-do compile } */ +/* { dg-additional-options "-std=c11" } */ + +void +f1 (void) +{ + _Atomic int i; + #pragma omp for /* { dg-error "'_Atomic' iteration variable 'i'" } */ + for (i = 0; i < 64; i++) + ; + #pragma omp parallel for /* { dg-error "'_Atomic' iteration variable 'i'" } */ + for (i = 0; i < 64; i++) + ; + #pragma omp simd /* { dg-error "'_Atomic' iteration variable 'i'" } */ + for (i = 0; i < 64; i++) + ; + #pragma omp parallel for simd /* { dg-error "'_Atomic' iteration variable 'i'" } */ + for (i = 0; i < 64; i++) + ; + #pragma omp for simd /* { dg-error "'_Atomic' iteration variable 'i'" } */ + for (i = 0; i < 64; i++) + ; + #pragma omp for /* { dg-error "'_Atomic' iteration variable 'j'" } */ + for (_Atomic int j = 0; j < 64; j++) + ; + #pragma omp parallel for /* { dg-error "'_Atomic' iteration variable 'j'" } */ + for (_Atomic int j = 0; j < 64; j++) + ; + #pragma omp simd /* { dg-error "'_Atomic' iteration variable 'j'" } */ + for (_Atomic int j = 0; j < 64; j++) + ; + #pragma omp parallel for simd /* { dg-error "'_Atomic' iteration variable 'j'" } */ + for (_Atomic int j = 0; j < 64; j++) + ; + #pragma omp for simd /* { dg-error "'_Atomic' iteration variable 'j'" } */ + for (_Atomic int j = 0; j < 64; j++) + ; +} + +void +f2 (void) +{ + _Atomic int i; + #pragma omp distribute /* { dg-error "'_Atomic' iteration variable 'i'" } */ + for (i = 0; i < 64; i++) + ; + #pragma omp distribute parallel for /* { dg-error "'_Atomic' iteration variable 'i'" } */ + for (i = 0; i < 64; i++) + ; + #pragma omp distribute parallel for simd /* { dg-error "'_Atomic' iteration variable 'i'" } */ + for (i = 0; i < 64; i++) + ; + #pragma omp distribute /* { dg-error "'_Atomic' iteration variable 'j'" } */ + for (_Atomic int j = 0; j < 64; j++) + ; + #pragma omp distribute parallel for /* { dg-error "'_Atomic' iteration variable 'j'" } */ + for (_Atomic int j = 0; j < 64; j++) + ; + #pragma omp distribute parallel for simd /* { dg-error "'_Atomic' iteration variable 'j'" } */ + for (_Atomic int j = 0; j < 64; j++) + ; +} + +void +f3 (void) +{ + int i; + _Atomic int j = 0; + #pragma omp simd linear(j:2) /* { dg-error "'_Atomic' 'j' in 'linear' clause" } */ + for (i = 0; i < 64; i++) + j += 2; + #pragma omp parallel for linear(j:1) /* { dg-error "'_Atomic' 'j' in 'linear' clause" } */ + for (i = 0; i < 64; i++) + j++; +} diff --git a/gcc/testsuite/gcc.dg/gomp/_Atomic-3.c b/gcc/testsuite/gcc.dg/gomp/_Atomic-3.c new file mode 100644 index 00000000000..31dd1cb1122 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/_Atomic-3.c @@ -0,0 +1,65 @@ +/* PR c/65467 */ +/* { dg-do compile } */ +/* { dg-additional-options "-std=c11" } */ + +void +f1 (void) +{ + _Atomic int i = 0, k[4]; + int j = 0; + k[0] = 0; + k[1] = 0; + k[2] = 0; + k[3] = 0; + #pragma omp parallel reduction (+:i) /* { dg-error "'_Atomic' 'i' in 'reduction' clause" } */ + i++; + #pragma omp declare reduction (foo: _Atomic int: omp_out += omp_in) initializer (omp_priv = omp_orig * 0) /* { dg-error "'_Atomic' qualified type in '#pragma omp declare reduction'" } */ + #pragma omp declare reduction (bar: int: omp_out += omp_in) initializer (omp_priv = omp_orig * 0) + #pragma omp parallel reduction (bar:j) + j++; + #pragma omp parallel reduction (bar:i) /* { dg-error "'_Atomic' 'i' in 'reduction' clause" } */ + i++; + #pragma omp parallel reduction (+:k) /* { dg-error "'_Atomic' 'k' in 'reduction' clause" } */ + k[1]++; + #pragma omp parallel reduction (+:k[1:2]) /* { dg-error "'_Atomic' \[^\n\r]* in 'reduction' clause" } */ + k[1]++; +} + +void +f2 (int *_Atomic p) +{ + #pragma omp simd aligned (p : 16) /* { dg-error "'_Atomic' 'p' in 'aligned' clause" } */ + for (int i = 0; i < 16; i++) + p[i]++; +} + +_Atomic int x; + +void +f3 (_Atomic int *p) +{ + int i; + #pragma omp atomic write + x = 6; /* { dg-error "'_Atomic' expression in '#pragma omp atomic'" } */ + #pragma omp atomic read + i = x; /* { dg-error "'_Atomic' expression in '#pragma omp atomic'" } */ + #pragma omp atomic update + x += 6; /* { dg-error "'_Atomic' expression in '#pragma omp atomic'" } */ + #pragma omp atomic capture + i = x *= 2; /* { dg-error "'_Atomic' expression in '#pragma omp atomic'" } */ + #pragma omp atomic write + p[2] = 6; /* { dg-error "'_Atomic' expression in '#pragma omp atomic'" } */ + #pragma omp atomic read + i = p[2]; /* { dg-error "'_Atomic' expression in '#pragma omp atomic'" } */ + #pragma omp atomic update + p[2] += 6; /* { dg-error "'_Atomic' expression in '#pragma omp atomic'" } */ + #pragma omp atomic capture + i = p[2] *= 2; /* { dg-error "'_Atomic' expression in '#pragma omp atomic'" } */ +} + +#pragma omp declare simd linear(x:1) /* { dg-error "'_Atomic' 'x' in 'linear' clause" } */ +int +f4 (_Atomic int x, int y) +{ + return x + y; +} diff --git a/gcc/testsuite/gcc.dg/gomp/_Atomic-4.c b/gcc/testsuite/gcc.dg/gomp/_Atomic-4.c new file mode 100644 index 00000000000..f790dd094dc --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/_Atomic-4.c @@ -0,0 +1,18 @@ +/* PR c/65467 */ +/* { dg-do compile } */ +/* { dg-additional-options "-std=c11" } */ +/* { dg-require-effective-target vect_simd_clones } */ + +#pragma omp declare simd +int +f1 (_Atomic int x, int y) /* { dg-warning "ignoring '#pragma omp declare simd' on function with '_Atomic' qualified non-'uniform' argument" } */ +{ + return x + y; +} + +#pragma omp declare simd uniform(x) +int +f2 (_Atomic int x, int y) +{ + return x + y; +} diff --git a/gcc/testsuite/gcc.dg/gomp/_Atomic-5.c b/gcc/testsuite/gcc.dg/gomp/_Atomic-5.c new file mode 100644 index 00000000000..9b7f58f0329 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/_Atomic-5.c @@ -0,0 +1,74 @@ +/* PR c/65467 */ +/* { dg-do compile } */ +/* { dg-additional-options "-std=c11" } */ + +void +f1 (void) +{ + struct S { int a; int b[2]; _Atomic int *c; }; + _Atomic int a = 0, b[2]; + _Atomic int d[3]; + _Atomic struct S c = (struct S) { 3, { 4, 5 }, d }; + int *_Atomic p; + _Atomic int *q; + int e[3] = { 1, 2, 3 }; + b[0] = 1; + b[1] = 2; + d[0] = 6; + d[1] = 7; + d[2] = 8; + p = e; + #pragma omp target map(tofrom: a) /* { dg-error "'_Atomic' 'a' in 'map' clause" } */ + ; + #pragma omp target map(to: b) /* { dg-error "'_Atomic' 'b' in 'map' clause" } */ + ; + #pragma omp target map(from: b[1:1]) /* { dg-error "'_Atomic' 'b' in 'map' clause" } */ + ; + #pragma omp target map(to: c.a) /* { dg-error "'_Atomic' 'c.a' in 'map' clause" } */ + /* { dg-warning "accessing a member 'a' of an atomic structure 'c'" "" { target *-*-* } 27 } */ + ; + #pragma omp target map(to: c.b[1]) /* { dg-error "'_Atomic' 'c.b' in 'map' clause" } */ + /* { dg-warning "accessing a member 'b' of an atomic structure 'c'" "" { target *-*-* } 30 } */ + ; + #pragma omp target data map(c) /* { dg-error "'_Atomic' 'c' in 'map' clause" } */ + /* { dg-error "must contain at least one" "" { target *-*-* } 33 } */ + { + #pragma omp target update to (c.a) /* { dg-error "'_Atomic' 'c.a' in 'to' clause" } */ + /* { dg-error "must contain at least one" "" { target *-*-* } 36 } */ + /* { dg-warning "accessing a member 'a' of an atomic structure 'c'" "" { target *-*-* } 36 } */ + #pragma omp target update from (c.b[1]) /* { dg-error "'_Atomic' 'c.b' in 'from' clause" } */ + /* { dg-error "must contain at least one" "" { target *-*-* } 39 } */ + /* { dg-warning "accessing a member 'b' of an atomic structure 'c'" "" { target *-*-* } 39 } */ + #pragma omp target update to (c) /* { dg-error "'_Atomic' 'c' in 'to' clause" } */ + /* { dg-error "must contain at least one" "" { target *-*-* } 42 } */ + } + #pragma omp target map(to: c.c[0:]) /* { dg-error "'_Atomic' 'c.c' in 'map' clause" } */ + /* { dg-warning "accessing a member 'c' of an atomic structure 'c'" "" { target *-*-* } 45 } */ + ; + #pragma omp target map(to: p[1:2]) /* { dg-error "'_Atomic' 'p' in 'map' clause" } */ + ; + #pragma omp target map(to: q[1:2]) /* { dg-error "'_Atomic' '\[^\n\r]*' in 'map' clause" } */ + ; +} + +void +f2 (void) +{ + _Atomic int a = 0, b[2] = { 1, 2 }; + #pragma omp target defaultmap(tofrom:scalar) /* { dg-error "'_Atomic' 'a' in implicit 'map' clause" } */ + a++; + #pragma omp target /* { dg-error "'_Atomic' 'b' in implicit 'map' clause" } */ + b[0]++; +} + +void +f3 (void) +{ + _Atomic int a = 0, b[2] = { 1, 2 }; + #pragma omp target /* { dg-error "'_Atomic' 'a' in implicit 'firstprivate' clause on 'target' construct" } */ + a++; + #pragma omp target firstprivate (a) /* { dg-error "'_Atomic' 'a' in 'firstprivate' clause on 'target' construct" } */ + a++; + #pragma omp target firstprivate (b) /* { dg-error "'_Atomic' 'b' in 'firstprivate' clause on 'target' construct" } */ + b[0]++; +} diff --git a/gcc/testsuite/gcc.dg/ipa/pr63416.c b/gcc/testsuite/gcc.dg/ipa/pr63416.c new file mode 100644 index 00000000000..b5374c51fe9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/pr63416.c @@ -0,0 +1,56 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +#define _UNUSED_ __attribute__((__unused__)) + +typedef int TEST_F30 (int *v); +typedef void TEST_F31 (int *v); +typedef void TEST_F32 (int *v, int r); + +typedef struct TEST_T30_ { + TEST_F30 * pf30; + TEST_F31 * pf31; + TEST_F32 * pf32; +} TEST_T30; + +static inline +int test_f30 (int *v) +{ + *v = 1; + return 0; +}//test_f30() + +static inline +void test_f31 (int *v _UNUSED_) +{ +}//test_f31() + +static inline +void test_f32 (int *v, int r _UNUSED_) +{ + *v = 0; +}//test_f32() + +static const +TEST_T30 test_t30 = { + .pf30 = test_f30, + .pf31 = test_f31, + .pf32 = test_f32, +}; + +static inline +int test_f10 (const TEST_T30 *pt30, int *v) +{ + int r = pt30->pf30(v); + pt30->pf31(v); + pt30->pf32(v, r); + return 0; +}//test_f10() + +int test_f00 (int *v) +{ + return test_f10(&test_t30, v); +}//test_f00() + +/* Everything should be inlined and only test_f00 body should appear. */ +/* { dg-final { scan-tree-dump-not "test_f10" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "test_f3" "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/limits-width-1.c b/gcc/testsuite/gcc.dg/limits-width-1.c new file mode 100644 index 00000000000..7a87014526c --- /dev/null +++ b/gcc/testsuite/gcc.dg/limits-width-1.c @@ -0,0 +1,55 @@ +/* Test TS 18661-1 width macros in <limits.h>. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11" } */ + +#define __STDC_WANT_IEC_60559_BFP_EXT__ +#include <limits.h> + +#define CHECK_WIDTH(TYPE, MAX, WIDTH) \ + _Static_assert ((MAX >> ((TYPE) -1 < 0 ? (WIDTH - 2) : (WIDTH - 1))) == 1, \ + "width must match type") + +#ifndef CHAR_WIDTH +# error "missing CHAR_WIDTH" +#endif +CHECK_WIDTH (char, CHAR_MAX, CHAR_WIDTH); +#ifndef SCHAR_WIDTH +# error "missing SCHAR_WIDTH" +#endif +CHECK_WIDTH (signed char, SCHAR_MAX, SCHAR_WIDTH); +#ifndef UCHAR_WIDTH +# error "missing UCHAR_WIDTH" +#endif +CHECK_WIDTH (unsigned char, UCHAR_MAX, UCHAR_WIDTH); +#ifndef SHRT_WIDTH +# error "missing SHRT_WIDTH" +#endif +CHECK_WIDTH (signed short, SHRT_MAX, SHRT_WIDTH); +#ifndef USHRT_WIDTH +# error "missing USHRT_WIDTH" +#endif +CHECK_WIDTH (unsigned short, USHRT_MAX, USHRT_WIDTH); +#ifndef INT_WIDTH +# error "missing INT_WIDTH" +#endif +CHECK_WIDTH (signed int, INT_MAX, INT_WIDTH); +#ifndef UINT_WIDTH +# error "missing UINT_WIDTH" +#endif +CHECK_WIDTH (unsigned int, UINT_MAX, UINT_WIDTH); +#ifndef LONG_WIDTH +# error "missing LONG_WIDTH" +#endif +CHECK_WIDTH (signed long, LONG_MAX, LONG_WIDTH); +#ifndef ULONG_WIDTH +# error "missing ULONG_WIDTH" +#endif +CHECK_WIDTH (unsigned long, ULONG_MAX, ULONG_WIDTH); +#ifndef LLONG_WIDTH +# error "missing LLONG_WIDTH" +#endif +CHECK_WIDTH (signed long long, LLONG_MAX, LLONG_WIDTH); +#ifndef ULLONG_WIDTH +# error "missing ULLONG_WIDTH" +#endif +CHECK_WIDTH (unsigned long long, ULLONG_MAX, ULLONG_WIDTH); diff --git a/gcc/testsuite/gcc.dg/march-generic.c b/gcc/testsuite/gcc.dg/march-generic.c index 6b0923919e3..fb5b83c7d74 100644 --- a/gcc/testsuite/gcc.dg/march-generic.c +++ b/gcc/testsuite/gcc.dg/march-generic.c @@ -1,6 +1,6 @@ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ /* { dg-skip-if "" { *-*-* } { "-march=*" } { "" } } */ /* { dg-options "-march=generic" } */ -/* { dg-error "generic CPU can be used only for -mtune" "" { target *-*-* } 0 } */ +/* { dg-error "'generic' CPU can be used only for '-mtune=' switch" "" { target *-*-* } 0 } */ /* { dg-bogus "march" "" { target *-*-* } 0 } */ int i; diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-generate-patch.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-generate-patch.c new file mode 100644 index 00000000000..afbaf635401 --- /dev/null +++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-generate-patch.c @@ -0,0 +1,77 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdiagnostics-generate-patch" } */ + +/* This is a collection of unittests for diagnostic_show_locus; + see the overview in diagnostic_plugin_test_show_locus.c. + + In particular, note the discussion of why we need a very long line here: +01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 + and that we can't use macros in this file. */ + +/* Unit test for rendering of insertion fixit hints + (example taken from PR 62316). */ + +void test_fixit_insert (void) +{ +#if 0 + int a[2][2] = { 0, 1 , 2, 3 }; /* { dg-warning "insertion hints" } */ +#endif +} + +/* Unit test for rendering of "remove" fixit hints. */ + +void test_fixit_remove (void) +{ +#if 0 + int a;; /* { dg-warning "example of a removal hint" } */ +#endif +} + +/* Unit test for rendering of "replace" fixit hints. */ + +void test_fixit_replace (void) +{ +#if 0 + gtk_widget_showall (dlg); /* { dg-warning "example of a replacement hint" } */ +#endif +} + + + +/* Verify the output from -fdiagnostics-generate-patch. + We expect a header, containing the filename. This is the absolute path, + so we can only capture it via regexps. */ + +/* { dg-regexp "\\-\\-\\- .*" } */ +/* { dg-regexp "\\+\\+\\+ .*" } */ + +/* Next, we expect the diff itself. */ +/* { dg-begin-multiline-output "" } +@@ -14,7 +14,7 @@ + void test_fixit_insert (void) + { + #if 0 +- int a[2][2] = { 0, 1 , 2, 3 }; ++ int a[2][2] = { {0, 1} , 2, 3 }; + #endif + } + +@@ -23,7 +23,7 @@ + void test_fixit_remove (void) + { + #if 0 +- int a;; ++ int a; + #endif + } + +@@ -32,7 +32,7 @@ + void test_fixit_replace (void) + { + #if 0 +- gtk_widget_showall (dlg); ++ gtk_widget_show_all (dlg); + #endif + } + + { dg-end-multiline-output "" } */ diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_show_locus.c b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_show_locus.c index ea28f046e8d..3efc7dfa0b4 100644 --- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_show_locus.c +++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_show_locus.c @@ -263,8 +263,8 @@ test_show_locus (function *fun) location_t start = get_loc (line, 19); location_t finish = get_loc (line, 22); rich_location richloc (line_table, make_location (start, start, finish)); - richloc.add_fixit_insert (start, "{"); - richloc.add_fixit_insert (get_loc (line, 23), "}"); + richloc.add_fixit_insert_before ("{"); + richloc.add_fixit_insert_after ("}"); warning_at_rich_loc (&richloc, 0, "example of insertion hints"); } diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_string_literals.c b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_string_literals.c index dff999c3aa9..99a504dc541 100644 --- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_string_literals.c +++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_string_literals.c @@ -33,6 +33,7 @@ #include "print-tree.h" #include "cpplib.h" #include "c-family/c-pragma.h" +#include "substring-locations.h" int plugin_is_GPL_compatible; diff --git a/gcc/testsuite/gcc.dg/plugin/plugin.exp b/gcc/testsuite/gcc.dg/plugin/plugin.exp index 715038a0279..32ca748e2cb 100644 --- a/gcc/testsuite/gcc.dg/plugin/plugin.exp +++ b/gcc/testsuite/gcc.dg/plugin/plugin.exp @@ -65,7 +65,8 @@ set plugin_test_list [list \ { diagnostic_plugin_test_show_locus.c \ diagnostic-test-show-locus-bw.c \ diagnostic-test-show-locus-color.c \ - diagnostic-test-show-locus-parseable-fixits.c } \ + diagnostic-test-show-locus-parseable-fixits.c \ + diagnostic-test-show-locus-generate-patch.c } \ { diagnostic_plugin_test_tree_expression_range.c \ diagnostic-test-expressions-1.c } \ { diagnostic_plugin_show_trees.c \ diff --git a/gcc/testsuite/gcc.dg/pr64252.c b/gcc/testsuite/gcc.dg/pr64252.c index 71f9c7812a4..a813f5aedc4 100644 --- a/gcc/testsuite/gcc.dg/pr64252.c +++ b/gcc/testsuite/gcc.dg/pr64252.c @@ -1,6 +1,7 @@ /* PR target/64252 */ /* { dg-do run } */ /* { dg-options "-O2" } */ +/* { dg-require-effective-target int32plus } */ typedef unsigned int V __attribute__((vector_size (32))); diff --git a/gcc/testsuite/gcc.dg/pr66299-1.c b/gcc/testsuite/gcc.dg/pr66299-1.c index e75146bf3eb..df8476462f9 100644 --- a/gcc/testsuite/gcc.dg/pr66299-1.c +++ b/gcc/testsuite/gcc.dg/pr66299-1.c @@ -1,6 +1,7 @@ /* PR tree-optimization/66299 */ /* { dg-do run } */ /* { dg-options "-fdump-tree-original" } */ +/* { dg-require-effective-target int32plus } */ void test1 (int x) diff --git a/gcc/testsuite/gcc.dg/pr66299-2.c b/gcc/testsuite/gcc.dg/pr66299-2.c index 45e92184764..c75c539a41f 100644 --- a/gcc/testsuite/gcc.dg/pr66299-2.c +++ b/gcc/testsuite/gcc.dg/pr66299-2.c @@ -1,6 +1,7 @@ /* PR tree-optimization/66299 */ /* { dg-do run } */ /* { dg-options "-fdump-tree-optimized -O" } */ +/* { dg-require-effective-target int32plus } */ void test1 (int x, unsigned u) diff --git a/gcc/testsuite/gcc.dg/pr77450.c b/gcc/testsuite/gcc.dg/pr77450.c new file mode 100644 index 00000000000..7c19e86ca02 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr77450.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-std=gnu90" } */ + +typedef int V __attribute__((vector_size(4))); + +void +foo(void) +{ + (V){ 0 }[0] = 0; +} diff --git a/gcc/testsuite/gcc.dg/pr77454.c b/gcc/testsuite/gcc.dg/pr77454.c new file mode 100644 index 00000000000..1bb41c2b176 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr77454.c @@ -0,0 +1,28 @@ +/* PR tree-optimization/77454 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +void +foo (unsigned char x, char y) +{ + while (x != 0) + { + unsigned char *a = &x; + int b; + + if (y != 0) + a = (unsigned char *) &y; + else if (y + 1 != 0) + a = (unsigned char *) &y; + for (x = 0; x < 1; ++x) + b = 0; + for (y = 0; y < 3; ++y) + { + y = !!y; + if (y != 0) + x = y; + } + if ((b != 0 ? -1 : *a) < (y = b)) + b = 1; + } +} diff --git a/gcc/testsuite/gcc.dg/pr77520.c b/gcc/testsuite/gcc.dg/pr77520.c new file mode 100644 index 00000000000..b237639fb20 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr77520.c @@ -0,0 +1,10 @@ +/* PR c/77520 - wrong value for extended ASCII characters in -Wformat message + Verify that characters in the extended ASCII range are quoted and not + allowed to be printed raw. */ +/* { dg-do compile } */ +/* { dg-options "-Wformat" } */ + +void f (void) +{ + __builtin_printf ("%\x80"); /* { dg-warning "unknown conversion type character .\\\\x80. in format" } */ +} diff --git a/gcc/testsuite/gcc.dg/pr77521.c b/gcc/testsuite/gcc.dg/pr77521.c new file mode 100644 index 00000000000..f6b1e3ed269 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr77521.c @@ -0,0 +1,8 @@ +/* PR c/77521 - %qc format directive should quote non-printable characters. + Verify that non-printable characters in assembly constraints are quoted + and not allowed to be printed raw. */ + +void f (int a, int b) +{ + __asm__ ("combine %2, %0" : "=r" (a) : "0" (a), "\n" (b)); /* { dg-error "invalid punctuation .\\\\x0a. in constraint" } */ +} diff --git a/gcc/testsuite/gcc.dg/profile-update-warning.c b/gcc/testsuite/gcc.dg/profile-update-warning.c new file mode 100644 index 00000000000..0614fad960f --- /dev/null +++ b/gcc/testsuite/gcc.dg/profile-update-warning.c @@ -0,0 +1,7 @@ +/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-options "-fprofile-update=atomic -fprofile-generate -march=i386 -m32" } */ + +int main(int argc, char *argv[]) +{ + return 0; +} /* { dg-warning "target does not support atomic profile update, single mode is selected" } */ diff --git a/gcc/testsuite/gcc.dg/stdint-width-1.c b/gcc/testsuite/gcc.dg/stdint-width-1.c new file mode 100644 index 00000000000..a28feee38db --- /dev/null +++ b/gcc/testsuite/gcc.dg/stdint-width-1.c @@ -0,0 +1,175 @@ +/* Test TS 18661-1 width macros in <stdint.h>. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -ffreestanding" } */ + +#include <stddef.h> +#define __STDC_WANT_IEC_60559_BFP_EXT__ +#include <stdint.h> +#ifndef SIGNAL_SUPPRESS +#include <signal.h> +#endif +typedef __WINT_TYPE__ wint_t; + +#define CHECK_WIDTH(TYPE, MAX, WIDTH) \ + _Static_assert ((MAX >> ((TYPE) -1 < 0 ? (WIDTH - 2) : (WIDTH - 1))) == 1, \ + "width must match type") + +#ifdef INT8_MAX +# ifndef INT8_WIDTH +# error "missing INT8_WIDTH" +# endif +CHECK_WIDTH (int8_t, INT8_MAX, INT8_WIDTH); +#endif +#ifdef INT16_MAX +# ifndef INT16_WIDTH +# error "missing INT16_WIDTH" +# endif +CHECK_WIDTH (int16_t, INT16_MAX, INT16_WIDTH); +#endif +#ifdef INT32_MAX +# ifndef INT32_WIDTH +# error "missing INT32_WIDTH" +# endif +CHECK_WIDTH (int32_t, INT32_MAX, INT32_WIDTH); +#endif +#ifdef INT64_MAX +# ifndef INT64_WIDTH +# error "missing INT64_WIDTH" +# endif +CHECK_WIDTH (int64_t, INT64_MAX, INT64_WIDTH); +#endif +#ifdef UINT8_MAX +# ifndef UINT8_WIDTH +# error "missing UINT8_WIDTH" +# endif +CHECK_WIDTH (uint8_t, UINT8_MAX, UINT8_WIDTH); +#endif +#ifdef UINT16_MAX +# ifndef UINT16_WIDTH +# error "missing UINT16_WIDTH" +# endif +CHECK_WIDTH (uint16_t, UINT16_MAX, UINT16_WIDTH); +#endif +#ifdef UINT32_MAX +# ifndef UINT32_WIDTH +# error "missing UINT32_WIDTH" +# endif +CHECK_WIDTH (uint32_t, UINT32_MAX, UINT32_WIDTH); +#endif +#ifdef UINT64_MAX +# ifndef UINT64_WIDTH +# error "missing UINT64_WIDTH" +# endif +CHECK_WIDTH (uint64_t, UINT64_MAX, UINT64_WIDTH); +#endif + +#ifndef INT_LEAST8_WIDTH +# error "missing INT_LEAST8_WIDTH" +#endif +CHECK_WIDTH (int_least8_t, INT_LEAST8_MAX, INT_LEAST8_WIDTH); +#ifndef INT_LEAST16_WIDTH +# error "missing INT_LEAST16_WIDTH" +#endif +CHECK_WIDTH (int_least16_t, INT_LEAST16_MAX, INT_LEAST16_WIDTH); +#ifndef INT_LEAST32_WIDTH +# error "missing INT_LEAST32_WIDTH" +#endif +CHECK_WIDTH (int_least32_t, INT_LEAST32_MAX, INT_LEAST32_WIDTH); +#ifndef INT_LEAST64_WIDTH +# error "missing INT_LEAST64_WIDTH" +#endif +CHECK_WIDTH (int_least64_t, INT_LEAST64_MAX, INT_LEAST64_WIDTH); +#ifndef INT_LEAST8_WIDTH +# error "missing INT_LEAST8_WIDTH" +#endif +CHECK_WIDTH (uint_least8_t, UINT_LEAST8_MAX, UINT_LEAST8_WIDTH); +#ifndef UINT_LEAST16_WIDTH +# error "missing UINT_LEAST16_WIDTH" +#endif +CHECK_WIDTH (uint_least16_t, UINT_LEAST16_MAX, UINT_LEAST16_WIDTH); +#ifndef UINT_LEAST32_WIDTH +# error "missing UINT_LEAST32_WIDTH" +#endif +CHECK_WIDTH (uint_least32_t, UINT_LEAST32_MAX, UINT_LEAST32_WIDTH); +#ifndef UINT_LEAST64_WIDTH +# error "missing UINT_LEAST64_WIDTH" +#endif +CHECK_WIDTH (uint_least64_t, UINT_LEAST64_MAX, UINT_LEAST64_WIDTH); + +#ifndef INT_FAST8_WIDTH +# error "missing INT_FAST8_WIDTH" +#endif +CHECK_WIDTH (int_fast8_t, INT_FAST8_MAX, INT_FAST8_WIDTH); +#ifndef INT_FAST16_WIDTH +# error "missing INT_FAST16_WIDTH" +#endif +CHECK_WIDTH (int_fast16_t, INT_FAST16_MAX, INT_FAST16_WIDTH); +#ifndef INT_FAST32_WIDTH +# error "missing INT_FAST32_WIDTH" +#endif +CHECK_WIDTH (int_fast32_t, INT_FAST32_MAX, INT_FAST32_WIDTH); +#ifndef INT_FAST64_WIDTH +# error "missing INT_FAST64_WIDTH" +#endif +CHECK_WIDTH (int_fast64_t, INT_FAST64_MAX, INT_FAST64_WIDTH); +#ifndef INT_FAST8_WIDTH +# error "missing INT_FAST8_WIDTH" +#endif +CHECK_WIDTH (uint_fast8_t, UINT_FAST8_MAX, UINT_FAST8_WIDTH); +#ifndef UINT_FAST16_WIDTH +# error "missing UINT_FAST16_WIDTH" +#endif +CHECK_WIDTH (uint_fast16_t, UINT_FAST16_MAX, UINT_FAST16_WIDTH); +#ifndef UINT_FAST32_WIDTH +# error "missing UINT_FAST32_WIDTH" +#endif +CHECK_WIDTH (uint_fast32_t, UINT_FAST32_MAX, UINT_FAST32_WIDTH); +#ifndef UINT_FAST64_WIDTH +# error "missing UINT_FAST64_WIDTH" +#endif +CHECK_WIDTH (uint_fast64_t, UINT_FAST64_MAX, UINT_FAST64_WIDTH); + +#ifdef INTPTR_MAX +# ifndef INTPTR_WIDTH +# error "missing INTPTR_WIDTH" +# endif +CHECK_WIDTH (intptr_t, INTPTR_MAX, INTPTR_WIDTH); +#endif +#ifdef UINTPTR_MAX +# ifndef UINTPTR_WIDTH +# error "missing UINTPTR_WIDTH" +# endif +CHECK_WIDTH (uintptr_t, UINTPTR_MAX, UINTPTR_WIDTH); +#endif + +#ifndef INTMAX_WIDTH +# error "missing INTMAX_WIDTH" +#endif +CHECK_WIDTH (intmax_t, INTMAX_MAX, INTMAX_WIDTH); +#ifndef UINTMAX_WIDTH +# error "missing UINTMAX_WIDTH" +#endif +CHECK_WIDTH (uintmax_t, UINTMAX_MAX, UINTMAX_WIDTH); + +#ifndef PTRDIFF_WIDTH +# error "missing PTRDIFF_WIDTH" +#endif +CHECK_WIDTH (ptrdiff_t, PTRDIFF_MAX, PTRDIFF_WIDTH); +#ifndef SIGNAL_SUPPRESS +# ifndef SIG_ATOMIC_WIDTH +# error "missing SIG_ATOMIC_WIDTH" +# endif +CHECK_WIDTH (sig_atomic_t, SIG_ATOMIC_MAX, SIG_ATOMIC_WIDTH); +#endif +#ifndef SIZE_WIDTH +# error "missing SIZE_WIDTH" +#endif +CHECK_WIDTH (size_t, SIZE_MAX, SIZE_WIDTH); +#ifndef WCHAR_WIDTH +# error "missing WCHAR_WIDTH" +#endif +CHECK_WIDTH (wchar_t, WCHAR_MAX, WCHAR_WIDTH); +#ifndef WINT_WIDTH +# error "missing WINT_WIDTH" +#endif +CHECK_WIDTH (wint_t, WINT_MAX, WINT_WIDTH); diff --git a/gcc/testsuite/gcc.dg/torture/20131115-1.c b/gcc/testsuite/gcc.dg/torture/20131115-1.c index edb05f04c47..d0cdfa5a220 100644 --- a/gcc/testsuite/gcc.dg/torture/20131115-1.c +++ b/gcc/testsuite/gcc.dg/torture/20131115-1.c @@ -1,4 +1,5 @@ /* { dg-do run } */ +/* { dg-skip-if "RAM usage too large" { "avr-*-*" } } */ struct S { int i; }; __attribute__((const, noinline, noclone)) diff --git a/gcc/testsuite/gcc.dg/torture/float128-builtin.c b/gcc/testsuite/gcc.dg/torture/float128-builtin.c index e4a50ceecff..ea3497ce9a8 100644 --- a/gcc/testsuite/gcc.dg/torture/float128-builtin.c +++ b/gcc/testsuite/gcc.dg/torture/float128-builtin.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float128 } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float128_runtime } */ #define WIDTH 128 diff --git a/gcc/testsuite/gcc.dg/torture/float128-floath.c b/gcc/testsuite/gcc.dg/torture/float128-floath.c index 68147c35fb6..7b5b046e79f 100644 --- a/gcc/testsuite/gcc.dg/torture/float128-floath.c +++ b/gcc/testsuite/gcc.dg/torture/float128-floath.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float128 } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float128_runtime } */ #define WIDTH 128 diff --git a/gcc/testsuite/gcc.dg/torture/float128-ieee-nan.c b/gcc/testsuite/gcc.dg/torture/float128-ieee-nan.c index 5dfbff9e8ad..2f3b5c0d95e 100644 --- a/gcc/testsuite/gcc.dg/torture/float128-ieee-nan.c +++ b/gcc/testsuite/gcc.dg/torture/float128-ieee-nan.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "-fsignaling-nans" } */ /* { dg-add-options float128 } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float128_runtime } */ /* { dg-require-effective-target fenv_exceptions } */ diff --git a/gcc/testsuite/gcc.dg/torture/float128-tg-2.c b/gcc/testsuite/gcc.dg/torture/float128-tg-2.c index c7a32b176e8..eda98e58bbc 100644 --- a/gcc/testsuite/gcc.dg/torture/float128-tg-2.c +++ b/gcc/testsuite/gcc.dg/torture/float128-tg-2.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float128 } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float128_runtime } */ #define WIDTH 128 diff --git a/gcc/testsuite/gcc.dg/torture/float128-tg.c b/gcc/testsuite/gcc.dg/torture/float128-tg.c index c1b6398d92b..d252ec545c1 100644 --- a/gcc/testsuite/gcc.dg/torture/float128-tg.c +++ b/gcc/testsuite/gcc.dg/torture/float128-tg.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float128 } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float128_runtime } */ #define WIDTH 128 diff --git a/gcc/testsuite/gcc.dg/torture/float128x-builtin.c b/gcc/testsuite/gcc.dg/torture/float128x-builtin.c index 2e6bbaf28df..d75bc55a7dd 100644 --- a/gcc/testsuite/gcc.dg/torture/float128x-builtin.c +++ b/gcc/testsuite/gcc.dg/torture/float128x-builtin.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float128x } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float128x_runtime } */ #define WIDTH 128 diff --git a/gcc/testsuite/gcc.dg/torture/float128x-floath.c b/gcc/testsuite/gcc.dg/torture/float128x-floath.c index 0fc3db2744f..3ac96ce3177 100644 --- a/gcc/testsuite/gcc.dg/torture/float128x-floath.c +++ b/gcc/testsuite/gcc.dg/torture/float128x-floath.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float128x } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float128x_runtime } */ #define WIDTH 128 diff --git a/gcc/testsuite/gcc.dg/torture/float128x-nan.c b/gcc/testsuite/gcc.dg/torture/float128x-nan.c index ad0052fc434..c3eaf1218df 100644 --- a/gcc/testsuite/gcc.dg/torture/float128x-nan.c +++ b/gcc/testsuite/gcc.dg/torture/float128x-nan.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "-fsignaling-nans" } */ /* { dg-add-options float128x } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float128x_runtime } */ /* { dg-require-effective-target fenv_exceptions } */ diff --git a/gcc/testsuite/gcc.dg/torture/float128x-tg-2.c b/gcc/testsuite/gcc.dg/torture/float128x-tg-2.c index e5c1b0c6989..31fa34eec7e 100644 --- a/gcc/testsuite/gcc.dg/torture/float128x-tg-2.c +++ b/gcc/testsuite/gcc.dg/torture/float128x-tg-2.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float128x } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float128x_runtime } */ #define WIDTH 128 diff --git a/gcc/testsuite/gcc.dg/torture/float128x-tg.c b/gcc/testsuite/gcc.dg/torture/float128x-tg.c index 0dc1e0f6823..751a3c64ffa 100644 --- a/gcc/testsuite/gcc.dg/torture/float128x-tg.c +++ b/gcc/testsuite/gcc.dg/torture/float128x-tg.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float128x } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float128x_runtime } */ #define WIDTH 128 diff --git a/gcc/testsuite/gcc.dg/torture/float16-builtin.c b/gcc/testsuite/gcc.dg/torture/float16-builtin.c index 43f9b1936b5..4efe177c566 100644 --- a/gcc/testsuite/gcc.dg/torture/float16-builtin.c +++ b/gcc/testsuite/gcc.dg/torture/float16-builtin.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float16 } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float16_runtime } */ #define WIDTH 16 diff --git a/gcc/testsuite/gcc.dg/torture/float16-floath.c b/gcc/testsuite/gcc.dg/torture/float16-floath.c index 6857c2e9aa8..3748f4197df 100644 --- a/gcc/testsuite/gcc.dg/torture/float16-floath.c +++ b/gcc/testsuite/gcc.dg/torture/float16-floath.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float16 } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float16_runtime } */ #define WIDTH 16 diff --git a/gcc/testsuite/gcc.dg/torture/float16-nan.c b/gcc/testsuite/gcc.dg/torture/float16-nan.c index 859f30ca414..34cc50bdc20 100644 --- a/gcc/testsuite/gcc.dg/torture/float16-nan.c +++ b/gcc/testsuite/gcc.dg/torture/float16-nan.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "-fsignaling-nans" } */ /* { dg-add-options float16 } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float16_runtime } */ /* { dg-require-effective-target fenv_exceptions } */ diff --git a/gcc/testsuite/gcc.dg/torture/float16-tg-2.c b/gcc/testsuite/gcc.dg/torture/float16-tg-2.c index 4236018b0e7..ecb0fe448d1 100644 --- a/gcc/testsuite/gcc.dg/torture/float16-tg-2.c +++ b/gcc/testsuite/gcc.dg/torture/float16-tg-2.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float16 } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float16_runtime } */ #define WIDTH 16 diff --git a/gcc/testsuite/gcc.dg/torture/float16-tg.c b/gcc/testsuite/gcc.dg/torture/float16-tg.c index 39e8285b6e8..56c4e31394e 100644 --- a/gcc/testsuite/gcc.dg/torture/float16-tg.c +++ b/gcc/testsuite/gcc.dg/torture/float16-tg.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float16 } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float16_runtime } */ #define WIDTH 16 diff --git a/gcc/testsuite/gcc.dg/torture/float32-builtin.c b/gcc/testsuite/gcc.dg/torture/float32-builtin.c index fc14ad1e112..9b510266f82 100644 --- a/gcc/testsuite/gcc.dg/torture/float32-builtin.c +++ b/gcc/testsuite/gcc.dg/torture/float32-builtin.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float32 } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float32_runtime } */ #define WIDTH 32 diff --git a/gcc/testsuite/gcc.dg/torture/float32-floath.c b/gcc/testsuite/gcc.dg/torture/float32-floath.c index 795cb21082f..dd503bef51f 100644 --- a/gcc/testsuite/gcc.dg/torture/float32-floath.c +++ b/gcc/testsuite/gcc.dg/torture/float32-floath.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float32 } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float32_runtime } */ #define WIDTH 32 diff --git a/gcc/testsuite/gcc.dg/torture/float32-nan.c b/gcc/testsuite/gcc.dg/torture/float32-nan.c index c46b388a1c3..58ee6004a21 100644 --- a/gcc/testsuite/gcc.dg/torture/float32-nan.c +++ b/gcc/testsuite/gcc.dg/torture/float32-nan.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "-fsignaling-nans" } */ /* { dg-add-options float32 } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float32_runtime } */ /* { dg-require-effective-target fenv_exceptions } */ diff --git a/gcc/testsuite/gcc.dg/torture/float32-tg-2.c b/gcc/testsuite/gcc.dg/torture/float32-tg-2.c index 80441d720e2..c205ba2319e 100644 --- a/gcc/testsuite/gcc.dg/torture/float32-tg-2.c +++ b/gcc/testsuite/gcc.dg/torture/float32-tg-2.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float32 } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float32_runtime } */ #define WIDTH 32 diff --git a/gcc/testsuite/gcc.dg/torture/float32-tg.c b/gcc/testsuite/gcc.dg/torture/float32-tg.c index da480ca87c5..b5ea060f8a2 100644 --- a/gcc/testsuite/gcc.dg/torture/float32-tg.c +++ b/gcc/testsuite/gcc.dg/torture/float32-tg.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float32 } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float32_runtime } */ #define WIDTH 32 diff --git a/gcc/testsuite/gcc.dg/torture/float32x-builtin.c b/gcc/testsuite/gcc.dg/torture/float32x-builtin.c index 3a5c2d0aa67..71eb7e2cdc8 100644 --- a/gcc/testsuite/gcc.dg/torture/float32x-builtin.c +++ b/gcc/testsuite/gcc.dg/torture/float32x-builtin.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float32x } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float32x_runtime } */ #define WIDTH 32 diff --git a/gcc/testsuite/gcc.dg/torture/float32x-floath.c b/gcc/testsuite/gcc.dg/torture/float32x-floath.c index 49e7ba4ed3a..ef2005ca74c 100644 --- a/gcc/testsuite/gcc.dg/torture/float32x-floath.c +++ b/gcc/testsuite/gcc.dg/torture/float32x-floath.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float32x } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float32x_runtime } */ #define WIDTH 32 diff --git a/gcc/testsuite/gcc.dg/torture/float32x-nan.c b/gcc/testsuite/gcc.dg/torture/float32x-nan.c index 770499d0660..d976d379732 100644 --- a/gcc/testsuite/gcc.dg/torture/float32x-nan.c +++ b/gcc/testsuite/gcc.dg/torture/float32x-nan.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "-fsignaling-nans" } */ /* { dg-add-options float32x } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float32x_runtime } */ /* { dg-require-effective-target fenv_exceptions } */ diff --git a/gcc/testsuite/gcc.dg/torture/float32x-tg-2.c b/gcc/testsuite/gcc.dg/torture/float32x-tg-2.c index 897130a280f..6179aba7cdd 100644 --- a/gcc/testsuite/gcc.dg/torture/float32x-tg-2.c +++ b/gcc/testsuite/gcc.dg/torture/float32x-tg-2.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float32x } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float32x_runtime } */ #define WIDTH 32 diff --git a/gcc/testsuite/gcc.dg/torture/float32x-tg.c b/gcc/testsuite/gcc.dg/torture/float32x-tg.c index 9f9a3bf8682..b65b03f558b 100644 --- a/gcc/testsuite/gcc.dg/torture/float32x-tg.c +++ b/gcc/testsuite/gcc.dg/torture/float32x-tg.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float32x } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float32x_runtime } */ #define WIDTH 32 diff --git a/gcc/testsuite/gcc.dg/torture/float64-builtin.c b/gcc/testsuite/gcc.dg/torture/float64-builtin.c index ff3cb295676..413768443ae 100644 --- a/gcc/testsuite/gcc.dg/torture/float64-builtin.c +++ b/gcc/testsuite/gcc.dg/torture/float64-builtin.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float64 } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float64_runtime } */ #define WIDTH 64 diff --git a/gcc/testsuite/gcc.dg/torture/float64-floath.c b/gcc/testsuite/gcc.dg/torture/float64-floath.c index a03d2e7dab7..3fb443b3726 100644 --- a/gcc/testsuite/gcc.dg/torture/float64-floath.c +++ b/gcc/testsuite/gcc.dg/torture/float64-floath.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float64 } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float64_runtime } */ #define WIDTH 64 diff --git a/gcc/testsuite/gcc.dg/torture/float64-nan.c b/gcc/testsuite/gcc.dg/torture/float64-nan.c index 5f1a2e8f933..51a6437fd52 100644 --- a/gcc/testsuite/gcc.dg/torture/float64-nan.c +++ b/gcc/testsuite/gcc.dg/torture/float64-nan.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "-fsignaling-nans" } */ /* { dg-add-options float64 } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float64_runtime } */ /* { dg-require-effective-target fenv_exceptions } */ diff --git a/gcc/testsuite/gcc.dg/torture/float64-tg-2.c b/gcc/testsuite/gcc.dg/torture/float64-tg-2.c index dddaa82122a..d0e4316611f 100644 --- a/gcc/testsuite/gcc.dg/torture/float64-tg-2.c +++ b/gcc/testsuite/gcc.dg/torture/float64-tg-2.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float64 } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float64_runtime } */ #define WIDTH 64 diff --git a/gcc/testsuite/gcc.dg/torture/float64-tg.c b/gcc/testsuite/gcc.dg/torture/float64-tg.c index c970d53b5ec..a7188312d57 100644 --- a/gcc/testsuite/gcc.dg/torture/float64-tg.c +++ b/gcc/testsuite/gcc.dg/torture/float64-tg.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float64 } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float64_runtime } */ #define WIDTH 64 diff --git a/gcc/testsuite/gcc.dg/torture/float64x-builtin.c b/gcc/testsuite/gcc.dg/torture/float64x-builtin.c index 2f95e8ad6d7..cc78ac011ad 100644 --- a/gcc/testsuite/gcc.dg/torture/float64x-builtin.c +++ b/gcc/testsuite/gcc.dg/torture/float64x-builtin.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float64x } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float64x_runtime } */ #define WIDTH 64 diff --git a/gcc/testsuite/gcc.dg/torture/float64x-floath.c b/gcc/testsuite/gcc.dg/torture/float64x-floath.c index 11eddc7036b..7fce730f386 100644 --- a/gcc/testsuite/gcc.dg/torture/float64x-floath.c +++ b/gcc/testsuite/gcc.dg/torture/float64x-floath.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float64x } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float64x_runtime } */ #define WIDTH 64 diff --git a/gcc/testsuite/gcc.dg/torture/float64x-nan.c b/gcc/testsuite/gcc.dg/torture/float64x-nan.c index 3d6496dee02..30e24b11e57 100644 --- a/gcc/testsuite/gcc.dg/torture/float64x-nan.c +++ b/gcc/testsuite/gcc.dg/torture/float64x-nan.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "-fsignaling-nans" } */ /* { dg-add-options float64x } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float64x_runtime } */ /* { dg-require-effective-target fenv_exceptions } */ diff --git a/gcc/testsuite/gcc.dg/torture/float64x-tg-2.c b/gcc/testsuite/gcc.dg/torture/float64x-tg-2.c index 647d10406f0..8c3e4bdb802 100644 --- a/gcc/testsuite/gcc.dg/torture/float64x-tg-2.c +++ b/gcc/testsuite/gcc.dg/torture/float64x-tg-2.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float64x } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float64x_runtime } */ #define WIDTH 64 diff --git a/gcc/testsuite/gcc.dg/torture/float64x-tg.c b/gcc/testsuite/gcc.dg/torture/float64x-tg.c index ac14675a669..54a566c1e30 100644 --- a/gcc/testsuite/gcc.dg/torture/float64x-tg.c +++ b/gcc/testsuite/gcc.dg/torture/float64x-tg.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "" } */ /* { dg-add-options float64x } */ +/* { dg-add-options ieee } */ /* { dg-require-effective-target float64x_runtime } */ #define WIDTH 64 diff --git a/gcc/testsuite/gcc.dg/torture/pr70421.c b/gcc/testsuite/gcc.dg/torture/pr70421.c index 8f97acd42be..1aa4d534599 100644 --- a/gcc/testsuite/gcc.dg/torture/pr70421.c +++ b/gcc/testsuite/gcc.dg/torture/pr70421.c @@ -1,5 +1,6 @@ /* PR target/70421 */ /* { dg-do run } */ +/* { dg-require-effective-target int32plus } */ /* { dg-additional-options "-Wno-psabi -w" } */ typedef unsigned V __attribute__ ((vector_size (64))); diff --git a/gcc/testsuite/gcc.dg/torture/pr77436.c b/gcc/testsuite/gcc.dg/torture/pr77436.c new file mode 100644 index 00000000000..513867db7ce --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr77436.c @@ -0,0 +1,11 @@ +/* { dg-do run } */ + +int main() +{ + unsigned short sum = 0; + for (short x = -(__SHRT_MAX__ -1); x <= (__SHRT_MAX__ -1); x++) + sum += x; + if (sum != 0) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr77479.c b/gcc/testsuite/gcc.dg/torture/pr77479.c new file mode 100644 index 00000000000..354ae5986ce --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr77479.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fstrict-overflow -ftree-vrp" } */ + +void +vr (int of, unsigned char bw) +{ + int d1; + int lm = 0; + + for (d1 = 0; d1 < 3; ++d1) + { + const int vl = 2; + + while (bw < vl) + { + } + if (bw != vl) + lm -= vl; + } + while (++of < 1) + { + lm /= bw; + of += lm; + } +} diff --git a/gcc/testsuite/gcc.dg/torture/pr77514.c b/gcc/testsuite/gcc.dg/torture/pr77514.c new file mode 100644 index 00000000000..464841ce364 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr77514.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ + +void +m1 (char l0, char e8, int hw) +{ + char *rs = &l0; + +yu: + l0 = 1; + while (l0 != 0) + { + l0 = -l0; + l0 += (*rs ^ (l0 &= 1)); + } + for (;;) + { + if (hw != 0) + goto yu; + rs = &e8; + } +} diff --git a/gcc/testsuite/gcc.dg/torture/pr77605.c b/gcc/testsuite/gcc.dg/torture/pr77605.c new file mode 100644 index 00000000000..3f1a26bc8d5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr77605.c @@ -0,0 +1,15 @@ +/* { dg-do run } */ + +int a, b, c[2][8]; + +int main () +{ + for (a = 0; a < 8; a++) + for (b = 0; b < 2; b++) + c[b][a] = c[b][b + 6] ^ 1; + + if (c[0][7] != 0) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/tree-prof/val-profiler-threads-1.c b/gcc/testsuite/gcc.dg/tree-prof/val-profiler-threads-1.c index e9b04a0e67d..95d6ee3b4a3 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/val-profiler-threads-1.c +++ b/gcc/testsuite/gcc.dg/tree-prof/val-profiler-threads-1.c @@ -1,4 +1,6 @@ /* { dg-options "-O0 -pthread -fprofile-update=atomic" } */ +/* { dg-require-effective-target profile_update_atomic } */ + #include <pthread.h> #define NUM_THREADS 8 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr68198.c b/gcc/testsuite/gcc.dg/tree-ssa/pr68198.c index d678dc8c2cd..79e65aa01f4 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr68198.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr68198.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-thread1-details" } */ +/* { dg-options "-O2 -fdump-tree-thread1-details -fdisable-tree-ethread" } */ extern void abort (void); @@ -40,4 +40,4 @@ c_finish_omp_clauses (tree clauses) /* There are 3 FSM jump threading opportunities, two of which will get filtered out. */ /* { dg-final { scan-tree-dump-times "Registering FSM" 1 "thread1"} } */ -/* { dg-final { scan-tree-dump-times "FSM Thread through multiway branch without threading a multiway branch" 2 "thread1"} } */ +/* { dg-final { scan-tree-dump-times "FSM Thread through multiway branch without threading a multiway branch" 2 "ethread"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr69196-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr69196-1.c index 5842e28b94b..5f92447854b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr69196-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr69196-1.c @@ -1,5 +1,5 @@ /* { dg-do compile { target sparc*-*-* x86_64-*-* } } */ -/* { dg-options "-O2 -fdump-tree-thread1-details" } */ +/* { dg-options "-O2 -fdump-tree-thread1-details -fdisable-tree-ethread" } */ /* { dg-final { scan-tree-dump "FSM did not thread around loop and would copy too many statements" "thread1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-2b.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-2b.c index eb66136e47f..e1c33e86cd7 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-2b.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-2b.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-thread1-stats -fdump-tree-dom2-stats" } */ +/* { dg-options "-O2 -fdump-tree-thread1-stats -fdump-tree-dom2-stats -fdisable-tree-ethread" } */ void foo(); void bla(); diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-13.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-13.c index f5f338ba357..061f2235533 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-13.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-13.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-thread1-details" } */ -/* { dg-final { scan-tree-dump "FSM" "thread1" } } */ +/* { dg-options "-O2 -fdump-tree-ethread-details" } */ +/* { dg-final { scan-tree-dump "FSM" "ethread" } } */ typedef struct rtx_def *rtx; typedef const struct rtx_def *const_rtx; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp01.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp01.c index c6d10c2dbcf..f25f2761d47 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp01.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp01.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-vrp1" } */ +/* { dg-options "-O2 -fdump-tree-vrp1 -fdisable-tree-ethread" } */ int foo (int *p, int i) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp56.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp56.c index 3a64b017c18..c2870c45907 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp56.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp56.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-thread1-stats" } */ +/* { dg-options "-O2 -fdump-tree-ethread-stats" } */ typedef struct basic_block_def *basic_block; struct basic_block_def; struct edge_def; @@ -38,5 +38,5 @@ cleanup_empty_eh (basic_block bb) foo (); } } -/* { dg-final { scan-tree-dump "Jumps threaded: 1" "thread1"} } */ +/* { dg-final { scan-tree-dump "Jumps threaded: 1" "ethread"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp92.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp92.c index b096e9b3602..5d5375073e6 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp92.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp92.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-vrp1-details" } */ +/* { dg-options "-O2 -fdump-tree-vrp1-details -fdisable-tree-ethread" } */ void bar (void); int foo (int i, int j) diff --git a/gcc/testsuite/gcc.dg/uninit-15.c b/gcc/testsuite/gcc.dg/uninit-15.c index 20bea95acd8..6154f4b638a 100644 --- a/gcc/testsuite/gcc.dg/uninit-15.c +++ b/gcc/testsuite/gcc.dg/uninit-15.c @@ -1,16 +1,16 @@ /* PR tree-optimization/17506 We issue an uninitialized variable warning at a wrong location at line 11, which is very confusing. Make sure we print out a note to - make it less confusing. (xfailed alternative) + make it less confusing. (not xfailed alternative) But it is of course ok if we warn in bar about uninitialized use - of j. (not xfailed alternative) */ + of j. (xfailed alternative) */ /* { dg-do compile } */ /* { dg-options "-O1 -Wuninitialized" } */ inline int foo (int i) { - if (i) /* { dg-warning "used uninitialized in this function" "" { xfail *-*-* } } */ + if (i) /* { dg-warning "used uninitialized in this function" } */ return 1; return 0; } @@ -20,7 +20,7 @@ void baz (void); void bar (void) { - int j; /* { dg-message "note: 'j' was declared here" "" { xfail *-*-* } } */ - for (; foo (j); ++j) /* { dg-warning "'j' is used uninitialized" } */ + int j; /* { dg-message "note: 'j' was declared here" } */ + for (; foo (j); ++j) /* { dg-warning "'j' is used uninitialized" "" { xfail *-*-* } } */ baz (); } diff --git a/gcc/testsuite/gcc.dg/vect/pr77503.c b/gcc/testsuite/gcc.dg/vect/pr77503.c new file mode 100644 index 00000000000..609e7fb5fd7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr77503.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_condition } */ +/* { dg-skip-if "need vect_max_reduc support" { ! vect_max_reduc } } */ + +extern void d(void); +void a() { + char *b; + char c = 0; + for (; b < (char *)a; b++) { + if (*b) + c = 1; + *b = 0; + } + if (c) + d(); +} +/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } */ diff --git a/gcc/testsuite/gcc.misc-tests/gcov-13.c b/gcc/testsuite/gcc.misc-tests/gcov-13.c index e443f48532e..2c80559a34b 100644 --- a/gcc/testsuite/gcc.misc-tests/gcov-13.c +++ b/gcc/testsuite/gcc.misc-tests/gcov-13.c @@ -1,8 +1,8 @@ /* Test gcov weak ellision. */ +/* { dg-do run { target native } } */ /* { dg-options "-fprofile-arcs -ftest-coverage" } */ /* { dg-require-weak "" } */ -/* { dg-do run { target native } } */ /* { dg-additional-sources "gcovpart-13b.c" } */ /* { dg-skip-if "weak ellision not supported" { { hppa*-*-hpux* } && { ! lp64 } } { "*" } { "" } } */ diff --git a/gcc/testsuite/gcc.misc-tests/gcov-14.c b/gcc/testsuite/gcc.misc-tests/gcov-14.c index 78dd7bedd76..2bebf7e4a93 100644 --- a/gcc/testsuite/gcc.misc-tests/gcov-14.c +++ b/gcc/testsuite/gcc.misc-tests/gcov-14.c @@ -1,10 +1,10 @@ /* Test gcov extern inline. */ +/* { dg-do run { target native } } */ /* { dg-options "-O2 -fprofile-arcs -ftest-coverage -fgnu89-inline" } */ /* The following line arranges that Darwin has behavior like elf weak import. */ /* { dg-additional-options "-flat_namespace -undefined suppress" { target *-*-darwin* } } */ /* { dg-require-weak "" } */ -/* { dg-do run { target native } } */ /* { dg-skip-if "undefined weak not supported" { { hppa*-*-hpux* } && { ! lp64 } } } */ /* { dg-skip-if "undefined weak not supported" { powerpc-ibm-aix* } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/ands_3.c b/gcc/testsuite/gcc.target/aarch64/ands_3.c new file mode 100644 index 00000000000..42cb7f0f0bc --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/ands_3.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +int +f9 (unsigned char x, int y) +{ + if (y > 1 && x == 0) + return 10; + return x; +} + +/* { dg-final { scan-assembler "ands\t(x|w)\[0-9\]+,\[ \t\]*(x|w)\[0-9\]+,\[ \t\]*255" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/arch-diagnostics-1.c b/gcc/testsuite/gcc.target/aarch64/arch-diagnostics-1.c index a0f59825227..0d60ef59509 100644 --- a/gcc/testsuite/gcc.target/aarch64/arch-diagnostics-1.c +++ b/gcc/testsuite/gcc.target/aarch64/arch-diagnostics-1.c @@ -1,4 +1,4 @@ -/* { dg-error "unknown" "" {target "aarch64*-*-*" } } */ +/* { dg-error "unknown" "" {target "aarch64*-*-*" } 0 } */ /* { dg-options "-O2 -march=dummy" } */ void f () diff --git a/gcc/testsuite/gcc.target/aarch64/arch-diagnostics-2.c b/gcc/testsuite/gcc.target/aarch64/arch-diagnostics-2.c index f1f3ea38c2a..cecba918818 100644 --- a/gcc/testsuite/gcc.target/aarch64/arch-diagnostics-2.c +++ b/gcc/testsuite/gcc.target/aarch64/arch-diagnostics-2.c @@ -1,4 +1,4 @@ -/* { dg-error "missing" "" {target "aarch64*-*-*" } } */ +/* { dg-error "missing" "" {target "aarch64*-*-*" } 0 } */ /* { dg-options "-O2 -march=+dummy" } */ void f () diff --git a/gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-1.c b/gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-1.c index ddba6554471..4f330e8fda7 100644 --- a/gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-1.c +++ b/gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-1.c @@ -1,4 +1,4 @@ -/* { dg-error "unknown" "" {target "aarch64*-*-*" } } */ +/* { dg-error "unknown" "" {target "aarch64*-*-*" } 0 } */ /* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" } { "" } } */ /* { dg-options "-O2 -mcpu=dummy" } */ diff --git a/gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-2.c b/gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-2.c index ae42436031b..3701b10ac20 100644 --- a/gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-2.c +++ b/gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-2.c @@ -1,4 +1,4 @@ -/* { dg-error "missing" "" {target "aarch64*-*-*" } } */ +/* { dg-error "missing" "" {target "aarch64*-*-*" } 0 } */ /* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" } { "" } } */ /* { dg-options "-O2 -mcpu=cortex-a53+no" } */ diff --git a/gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-3.c b/gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-3.c index 8bc6e2fe049..04acba67353 100644 --- a/gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-3.c +++ b/gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-3.c @@ -1,4 +1,4 @@ -/* { dg-error "invalid feature" "" {target "aarch64*-*-*" } } */ +/* { dg-error "invalid feature" "" {target "aarch64*-*-*" } 0 } */ /* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" } { "" } } */ /* { dg-options "-O2 -mcpu=cortex-a53+dummy" } */ diff --git a/gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-4.c b/gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-4.c index 58355b42f84..268321e16e3 100644 --- a/gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-4.c +++ b/gcc/testsuite/gcc.target/aarch64/cpu-diagnostics-4.c @@ -1,4 +1,4 @@ -/* { dg-error "missing" "" {target "aarch64*-*-*" } } */ +/* { dg-error "missing" "" {target "aarch64*-*-*" } 0 } */ /* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" } { "" } } */ /* { dg-options "-O2 -mcpu=+dummy" } */ diff --git a/gcc/testsuite/gcc.target/aarch64/thunderxloadpair.c b/gcc/testsuite/gcc.target/aarch64/thunderxloadpair.c new file mode 100644 index 00000000000..14b1f736093 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/thunderxloadpair.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcpu=thunderx" } */ + +struct ldp +{ + long long c; + int a, b; +}; + + +int f(struct ldp *a) +{ + return a->a + a->b; +} + + +/* We know the alignement of a->a to be 8 byte aligned so it is profitable + to do ldp. */ +/* { dg-final { scan-assembler-times "ldp\tw\[0-9\]+, w\[0-9\]" 1 } } */ + diff --git a/gcc/testsuite/gcc.target/aarch64/thunderxnoloadpair.c b/gcc/testsuite/gcc.target/aarch64/thunderxnoloadpair.c new file mode 100644 index 00000000000..3093ad0e1f2 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/thunderxnoloadpair.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcpu=thunderx" } */ + +struct noldp +{ + int a, b; +}; + + +int f(struct noldp *a) +{ + return a->a + a->b; +} + +/* We know the alignement of a->a to be 4 byte aligned so it is not profitable + to do ldp. */ +/* { dg-final { scan-assembler-not "ldp\tw\[0-9\]+, w\[0-9\]" } } */ diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr77476.c b/gcc/testsuite/gcc.target/i386/avx512bw-pr77476.c new file mode 100644 index 00000000000..bae00e4ee51 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512bw-pr77476.c @@ -0,0 +1,9 @@ +/* PR target/77476 */ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx512bw" } */ +/* { dg-require-effective-target avx512bw } */ + +#include "avx512bw-check.h" +#define PR77476_TEST avx512bw_test + +#include "avx512f-pr77476.c" diff --git a/gcc/testsuite/gcc.target/i386/avx512dq-pr77476.c b/gcc/testsuite/gcc.target/i386/avx512dq-pr77476.c new file mode 100644 index 00000000000..77d024e053e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512dq-pr77476.c @@ -0,0 +1,9 @@ +/* PR target/77476 */ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx512dq" } */ +/* { dg-require-effective-target avx512dq } */ + +#include "avx512dq-check.h" +#define PR77476_TEST avx512dq_test + +#include "avx512f-pr77476.c" diff --git a/gcc/testsuite/gcc.target/i386/avx512f-klogic-2.c b/gcc/testsuite/gcc.target/i386/avx512f-klogic-2.c index feff9558a15..ec09e4c6182 100644 --- a/gcc/testsuite/gcc.target/i386/avx512f-klogic-2.c +++ b/gcc/testsuite/gcc.target/i386/avx512f-klogic-2.c @@ -51,7 +51,7 @@ avx512f_test (void) dst = _mm512_kunpackb (src1, src2); x = _mm512_mask_add_ps (x, dst, x, x); - dst_ref = ((src2 << 8) | src1) & 0xFFFF; + dst_ref = ((src1 << 8) | src2) & 0xFFFF; if (dst != dst_ref) abort (); diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr77476.c b/gcc/testsuite/gcc.target/i386/avx512f-pr77476.c new file mode 100644 index 00000000000..f3bd509535a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-pr77476.c @@ -0,0 +1,76 @@ +/* PR target/77476 */ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx512f" } */ +/* { dg-require-effective-target avx512f } */ + +#ifndef PR77476_TEST +#include "avx512f-check.h" +#define PR77476_TEST avx512f_test +#endif + +unsigned short s; +unsigned int i; +unsigned long long l; + +void +f1 (void) +{ + unsigned char a = 0xff; + asm volatile ("" : "+Yk" (a)); + s = a; +} + +void +f2 (void) +{ + unsigned char a = 0xff; + asm volatile ("" : "+Yk" (a)); + i = a; +} + +void +f3 (void) +{ + unsigned char a = 0xff; + asm volatile ("" : "+Yk" (a)); + l = a; +} + +void +f4 (void) +{ + unsigned short a = 0xffff; + asm volatile ("" : "+Yk" (a)); + i = a; +} + +void +f5 (void) +{ + unsigned short a = 0xffff; + asm volatile ("" : "+Yk" (a)); + l = a; +} + +#ifdef __AVX512BW__ +void +f6 (void) +{ + unsigned int a = 0xffffffff; + asm volatile ("" : "+Yk" (a)); + l = a; +} +#endif + +static void +PR77476_TEST () +{ + f1 (); if (s != 0xff) __builtin_abort (); s = 0; + f2 (); if (i != 0xff) __builtin_abort (); i = 0; + f3 (); if (l != 0xff) __builtin_abort (); l = 0; + f4 (); if (i != 0xffff) __builtin_abort (); i = 0; + f5 (); if (l != 0xffff) __builtin_abort (); l = 0; +#ifdef __AVX512BW__ + f6 (); if (l != 0xffffffff) __builtin_abort (); l = 0; +#endif +} diff --git a/gcc/testsuite/gcc.target/i386/pr65990.c b/gcc/testsuite/gcc.target/i386/pr65990.c index c0e5bb6fdf7..0ec8fadacf7 100644 --- a/gcc/testsuite/gcc.target/i386/pr65990.c +++ b/gcc/testsuite/gcc.target/i386/pr65990.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mtune=btver2 -mmemcpy-strategy=rep_8byte:-1:noalign" } -/* { dg-error "stringop strategy name rep_8byte specified for option -mmemcpy_strategy= not supported for 32-bit code" "" { target ia32 } 0 } */ +/* { dg-error "strategy name 'rep_8byte' specified for option '-mmemcpy_strategy=' not supported for 32-bit code" "" { target ia32 } 0 } */ struct U9 { diff --git a/gcc/testsuite/gcc.target/i386/pr68633.c b/gcc/testsuite/gcc.target/i386/pr68633.c index d7f513d276a..f2b594c3bc4 100644 --- a/gcc/testsuite/gcc.target/i386/pr68633.c +++ b/gcc/testsuite/gcc.target/i386/pr68633.c @@ -19,6 +19,6 @@ TEST () __asm__( "kmovw %1, %0" : "=k" (k2) : "r" (2) ); k3 = _mm512_kunpackb (k1, k2); - if (k3 != 0x201) + if (k3 != 0x102) abort (); } diff --git a/gcc/testsuite/gcc.target/i386/pr69255-1.c b/gcc/testsuite/gcc.target/i386/pr69255-1.c new file mode 100644 index 00000000000..7a666d34298 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr69255-1.c @@ -0,0 +1,17 @@ +/* PR target/69255 */ +/* { dg-do compile } */ +/* { dg-options "-msse4 -mno-avx" } */ + +#pragma GCC target "avx512vl" +#pragma GCC target "no-avx512vl" +__attribute__ ((__vector_size__ (32))) long long a; +__attribute__ ((__vector_size__ (16))) int b; + +void +foo (const long long *p) +{ + a = __builtin_ia32_gather3siv4di (a, p, b, 1, 1); /* { dg-error "needs isa option -m32 -mavx512vl" } */ +} + +/* { dg-warning "AVX vector return without AVX enabled changes the ABI" "" { target *-*-* } 13 } */ +/* { dg-warning "AVX vector argument without AVX enabled changes the ABI" "" { target *-*-* } 13 } */ diff --git a/gcc/testsuite/gcc.target/i386/pr69255-2.c b/gcc/testsuite/gcc.target/i386/pr69255-2.c new file mode 100644 index 00000000000..28eb57bbfcc --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr69255-2.c @@ -0,0 +1,17 @@ +/* PR target/69255 */ +/* { dg-do compile } */ +/* { dg-options "-msse4 -mno-avx" } */ + +#pragma GCC target "avx512vl" +#pragma GCC target "" +__attribute__ ((__vector_size__ (32))) long long a; +__attribute__ ((__vector_size__ (16))) int b; + +void +foo (const long long *p) +{ + __builtin_ia32_gather3siv4di (a, p, b, 1, 1); /* { dg-error "needs isa option -m32 -mavx512vl" } */ +} + +/* { dg-warning "AVX vector return without AVX enabled changes the ABI" "" { target *-*-* } 13 } */ +/* { dg-warning "AVX vector argument without AVX enabled changes the ABI" "" { target *-*-* } 13 } */ diff --git a/gcc/testsuite/gcc.target/i386/pr69255-3.c b/gcc/testsuite/gcc.target/i386/pr69255-3.c new file mode 100644 index 00000000000..41fb4a2cf50 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr69255-3.c @@ -0,0 +1,17 @@ +/* PR target/69255 */ +/* { dg-do compile } */ +/* { dg-options "-msse4 -mno-avx" } */ + +#pragma GCC target "avx512vl" +#pragma GCC target "" +__attribute__ ((__vector_size__ (32))) long long a; +__attribute__ ((__vector_size__ (16))) int b; + +void +foo (const long long *p, __attribute__ ((__vector_size__ (32))) long long *q) +{ + *q = __builtin_ia32_gather3siv4di (a, p, b, 1, 1); /* { dg-error "needs isa option -m32 -mavx512vl" } */ +} + +/* { dg-warning "AVX vector return without AVX enabled changes the ABI" "" { target *-*-* } 13 } */ +/* { dg-warning "AVX vector argument without AVX enabled changes the ABI" "" { target *-*-* } 13 } */ diff --git a/gcc/testsuite/gcc.target/i386/pr77452.c b/gcc/testsuite/gcc.target/i386/pr77452.c new file mode 100644 index 00000000000..89c5329ff89 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr77452.c @@ -0,0 +1,13 @@ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O -mavx512f -fno-split-wide-types --param max-combine-insns=2" } */ + +typedef unsigned int U __attribute__((vector_size(64))); +typedef unsigned __int128 V __attribute__((vector_size(64))); + +V +foo(V v) +{ + v[0] = 1u << (( ((V)(U){1, 1, v[0]})[0]) & 0xf) + >> ((-~((V)(U){1, 1, v[0]})[0]) & 0xf); + return v; +} diff --git a/gcc/testsuite/gcc.target/i386/pr77526.c b/gcc/testsuite/gcc.target/i386/pr77526.c new file mode 100644 index 00000000000..91b946a3660 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr77526.c @@ -0,0 +1,13 @@ +/* PR target/77526 */ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-Os -fno-forward-propagate -fno-gcse -fno-rerun-cse-after-loop -mstringop-strategy=byte_loop -Wno-psabi" } */ + +typedef char U __attribute__((vector_size(64))); +typedef __int128 V __attribute__((vector_size(64))); + +V +foo (int a, int b, __int128 c, U u) +{ + u = (u >> (u & 7)) | (u << -(u & 7)); + return a + b + c + (V)u; +} diff --git a/gcc/testsuite/gcc.target/i386/pr77594.c b/gcc/testsuite/gcc.target/i386/pr77594.c new file mode 100644 index 00000000000..96c51fd71fa --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr77594.c @@ -0,0 +1,11 @@ +/* PR middle-end/77594 */ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +int +foo (int a, int *b) +{ + return __builtin_sub_overflow (0, a, b); +} + +/* { dg-final { scan-assembler-times "\tjn?o\t" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/spellcheck-options-1.c b/gcc/testsuite/gcc.target/i386/spellcheck-options-1.c new file mode 100644 index 00000000000..275f86c178d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/spellcheck-options-1.c @@ -0,0 +1,7 @@ +/* Verify that we provide a hint if the user misspells an option argument + (PR middle-end/77475). */ + +/* { dg-do compile } */ +/* { dg-options "-march=hasvel" } */ +/* { dg-error "bad value .'hasvel'. for '-march=' switch" "" { target *-*-* } 0 } */ +/* { dg-message "valid arguments to '-march=' switch are: \[^\n\r]*; did you mean 'haswell'?" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.target/i386/spellcheck-options-2.c b/gcc/testsuite/gcc.target/i386/spellcheck-options-2.c new file mode 100644 index 00000000000..848906245af --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/spellcheck-options-2.c @@ -0,0 +1,7 @@ +/* Verify that we provide a hint if the user misspells an option argument + (PR middle-end/77475). */ + +/* { dg-do compile } */ +/* { dg-options "-mtune=hasvel" } */ +/* { dg-error "bad value .'hasvel'. for '-mtune=' switch" "" { target *-*-* } 0 } */ +/* { dg-message "valid arguments to '-mtune=' switch are: \[^\n\r]*; did you mean 'haswell'?" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.target/i386/spellcheck-options-3.c b/gcc/testsuite/gcc.target/i386/spellcheck-options-3.c new file mode 100644 index 00000000000..115cef178bd --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/spellcheck-options-3.c @@ -0,0 +1,7 @@ +/* Verify that we provide a hint if the user misspells an option argument + (PR middle-end/77475). */ + +/* { dg-do compile } */ +/* { dg-options "-mmemcpy-strategy=unroled_looop:8:align" } */ +/* { dg-error "wrong strategy name 'unroled_looop' specified for option '-mmemcpy_strategy='" "" { target *-*-* } 0 } */ +/* { dg-message "valid arguments to '-mmemcpy_strategy=' are: \[^\n\r]*; did you mean 'unrolled_loop'?" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.target/i386/spellcheck-options-4.c b/gcc/testsuite/gcc.target/i386/spellcheck-options-4.c new file mode 100644 index 00000000000..d39bd239f89 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/spellcheck-options-4.c @@ -0,0 +1,7 @@ +/* Verify that we provide a hint if the user misspells an option argument + (PR middle-end/77475). */ + +/* { dg-do compile } */ + +__attribute__((target ("arch=hasvel"))) void foo (void) {} /* { dg-error "bad value .'hasvel'. for 'target..arch=..' attribute" } */ +/* { dg-message "valid arguments to 'target..arch=..' attribute are: \[^\n\r]*; did you mean 'haswell'?" "" { target *-*-* } 6 } */ diff --git a/gcc/testsuite/gcc.target/msp430/function-attributes-1.c b/gcc/testsuite/gcc.target/msp430/function-attributes-1.c new file mode 100644 index 00000000000..7a3b7bea885 --- /dev/null +++ b/gcc/testsuite/gcc.target/msp430/function-attributes-1.c @@ -0,0 +1,9 @@ +void __attribute__((weak, interrupt)) +weak_interrupt (void) { +} + +void __attribute__((interrupt(11))) +interrupt_number (void) { +} + +/* { dg-final { scan-assembler-times "__interrupt_vector_" 1 } } */ diff --git a/gcc/testsuite/gcc.target/msp430/function-attributes-2.c b/gcc/testsuite/gcc.target/msp430/function-attributes-2.c new file mode 100644 index 00000000000..fcb2fb2f011 --- /dev/null +++ b/gcc/testsuite/gcc.target/msp430/function-attributes-2.c @@ -0,0 +1,3 @@ +void __attribute__((weak, interrupt(10))) +weak_interrupt_number (void) { +} /* { dg-error "argument to interrupt attribute is unsupported for weak functions" } */ diff --git a/gcc/testsuite/gcc.target/msp430/function-attributes-3.c b/gcc/testsuite/gcc.target/msp430/function-attributes-3.c new file mode 100644 index 00000000000..b0acf4aae52 --- /dev/null +++ b/gcc/testsuite/gcc.target/msp430/function-attributes-3.c @@ -0,0 +1,3 @@ +void __attribute__((interrupt("nmi"))) __attribute__((weak)) +interrupt_name_weak (void) { +} /* { dg-error "argument to interrupt attribute is unsupported for weak functions" } */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr77289.c b/gcc/testsuite/gcc.target/powerpc/pr77289.c new file mode 100644 index 00000000000..f8ebf1f9309 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr77289.c @@ -0,0 +1,31 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ +/* { dg-options "-O3 -mcpu=power7 -funroll-loops -ffast-math -mlra -mupdate -fno-auto-inc-dec" } */ + +/* PR 77289: LRA ICEs due to invalid constraint checking. */ + +void dummy0 (float *); +float bar0 (float); +void +foo0 (long a, long b) +{ + float c[0]; + b = 0; + for (; b < a; b++) + c[b] = bar0 (c[b]); + dummy0 (c); +} + +void dummy1 (long *); +long bar1 (long); +void +foo1 (long a, long b) +{ + long array[128]; + long *c = array; + for (b=0; b < a; b++) + c[b] = bar1 (c[b]); + dummy1 (c); +} diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-25.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-25.c new file mode 100644 index 00000000000..5b999488539 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-25.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target { powerpc64le-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O3 " } */ +/* { dg-final { scan-assembler "lxvd2x" } } */ +/* { dg-final { scan-assembler "stxvd2x" } } */ +/* { dg-final { scan-assembler-not "xxpermdi" } } */ + +/* Verify that swap optimization works correctly for a truncating splat. */ + +/* Test case to resolve PR77613. */ + +void pr77613 (signed short a, signed short *x, signed short *y) +{ + unsigned long i; + + for (i = 0; i < 1024; i++) + y[i] = a * x[i] + y[i]; +} diff --git a/gcc/testsuite/gfortran.dg/c_assoc_2.f03 b/gcc/testsuite/gfortran.dg/c_assoc_2.f03 index 275e88eadc3..fe6e5a9439a 100644 --- a/gcc/testsuite/gfortran.dg/c_assoc_2.f03 +++ b/gcc/testsuite/gfortran.dg/c_assoc_2.f03 @@ -20,7 +20,7 @@ contains call abort() end if - if(.not. c_associated()) then ! { dg-error "Missing actual argument 'C_PTR_1' in call to 'c_associated'" } + if(.not. c_associated()) then ! { dg-error "Missing actual argument" } call abort() end if diff --git a/gcc/testsuite/gfortran.dg/c_assoc_4.f90 b/gcc/testsuite/gfortran.dg/c_assoc_4.f90 index 5421a363f10..8a7fe736bc5 100644 --- a/gcc/testsuite/gfortran.dg/c_assoc_4.f90 +++ b/gcc/testsuite/gfortran.dg/c_assoc_4.f90 @@ -9,6 +9,6 @@ PROGRAM test TYPE (C_PTR) :: x, y - PRINT *, C_ASSOCIATED([x,y]) ! { dg-error "'C_PTR_1' argument of 'c_associated' intrinsic at .1. must be a scalar" } + PRINT *, C_ASSOCIATED([x,y]) ! { dg-error "'c_ptr_1' argument of 'c_associated' intrinsic at .1. must be a scalar" } END PROGRAM test diff --git a/gcc/testsuite/gfortran.dg/c_by_val_1.f b/gcc/testsuite/gfortran.dg/c_by_val_1.f index af1e25a6b88..3c5c3d7def7 100644 --- a/gcc/testsuite/gfortran.dg/c_by_val_1.f +++ b/gcc/testsuite/gfortran.dg/c_by_val_1.f @@ -9,8 +9,8 @@ C { dg-options "-ff2c -w -O0" } real(8) a8, b8, c8 integer(4) i, j, k integer(8) i8, j8, k8 - complex u, v, w, c_to_c - complex(8) u8, v8, w8, c_to_c8 + complex u, v, w + complex(8) u8, v8, w8 a = 42.0 b = 0.0 @@ -39,13 +39,13 @@ C { dg-options "-ff2c -w -O0" } u = (-1.0, 2.0) v = (1.0, -2.0) w = u - v = c_to_c (%VAL (u), %REF (w), %LOC (w)) + call c_to_c (v, %VAL (u), %REF (w), %LOC (w)) if ((4.0 * u).ne.v) call abort () u8 = (-1.0, 2.0) v8 = (1.0, -2.0) w8 = u8 - v8 = c_to_c8 (%VAL (u8), %REF (w8), %LOC (w8)) + call c_to_c8 (v8, %VAL (u8), %REF (w8), %LOC (w8)) if ((4.0 * u8).ne.v8) call abort () stop diff --git a/gcc/testsuite/gfortran.dg/dec_structure_14.f90 b/gcc/testsuite/gfortran.dg/dec_structure_14.f90 new file mode 100644 index 00000000000..4e271b7390f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dec_structure_14.f90 @@ -0,0 +1,18 @@ + ! { dg-do "compile" } + ! { dg-options "-fdec-structure" } + ! + ! Test that structures inside a common block do not require the + ! SEQUENCE attribute, as derived types do. + ! + +common var + +structure /s/ + integer i + integer j + real r +end structure + +record /s/ var + +end diff --git a/gcc/testsuite/gfortran.dg/dependency_47.f90 b/gcc/testsuite/gfortran.dg/dependency_47.f90 new file mode 100644 index 00000000000..4888771c183 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dependency_47.f90 @@ -0,0 +1,14 @@ +! { dg-do compile } +! Make sure there is only one instance of a temporary variable here. +! { dg-options "-fdump-tree-original" } + +SUBROUTINE prtdata(ilen) + INTEGER :: ilen + character(len=ilen), allocatable :: cline(:) + allocate(cline(2)) + cline(1) = 'a' + cline(1)(2:3) = cline(1)(1:2) + cline(2) = cline(1) + print *,c +END SUBROUTINE prtdata +! { dg-final { scan-tree-dump-not "__var_" "original" } } diff --git a/gcc/testsuite/gfortran.dg/dependency_49.f90 b/gcc/testsuite/gfortran.dg/dependency_49.f90 new file mode 100644 index 00000000000..73d517e8f76 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dependency_49.f90 @@ -0,0 +1,14 @@ +! { dg-do compile } +! { dg-options "-fdump-tree-original" } +! PR fortran/71902 - make sure that component references are followed +! for dependency analysis. +program main + type foo + character(len=:), allocatable :: x + end type foo + type(foo) :: a + a%x = 'asdf' + a%x = a%x(2:3) + print *,a%x +end program main +! { dg-final { scan-tree-dump-times "__var_1" 4 "original" } } diff --git a/gcc/testsuite/gfortran.dg/dtio_11.f90 b/gcc/testsuite/gfortran.dg/dtio_11.f90 new file mode 100644 index 00000000000..cf8dd365d3c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dtio_11.f90 @@ -0,0 +1,39 @@ +! { dg-do compile } +! +! Test fixes for PRs77532-4. +! +! Contributed by Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> +! +! PR77532 - used to ICE +module m1 + type t + end type + interface read(unformatted) + end interface +end + +! PR77533 - used to ICE after error +module m2 + type t + type(unknown), pointer :: next ! { dg-error "is a type that has not been declared" } + contains + procedure :: s + generic :: write(formatted) => s + end type +contains + subroutine s(x) + end +end + +! PR77533 comment #1 - gave warning that +module m3 + type t + contains + procedure :: s ! { dg-error "Non-polymorphic passed-object" } + generic :: write(formatted) => s + end type +contains + subroutine s(x) ! { dg-error "must be of type CLASS" } + class(t), intent(in) : x ! { dg-error "Invalid character in name" } + end +end diff --git a/gcc/testsuite/gfortran.dg/fmt_f0_2.f90 b/gcc/testsuite/gfortran.dg/fmt_f0_2.f90 index 6e679fcecb8..4afba91389e 100644 --- a/gcc/testsuite/gfortran.dg/fmt_f0_2.f90 +++ b/gcc/testsuite/gfortran.dg/fmt_f0_2.f90 @@ -1,15 +1,23 @@ ! { dg-do run } ! PR77393 program testbigf0 ! Can enormous numbers be printed with F0.0 format? + use ISO_FORTRAN_ENV implicit none + integer i + integer, parameter :: j(size(real_kinds)+4)=[REAL_KINDS, [4, 4, 4, 4]] character(10000) :: str - write(str, "(f0.0)") -huge(1.0) - if (len(trim(str)).lt.41) error stop "FAILED AT LINE 7" - write(str, "(f0.0)") -huge(1.0_8) - if (len(trim(str)).lt.311) error stop "FAILED AT LINE 9" - write(str, "(f0.0)") -huge(1.0_10) - if (len(trim(str)).lt.4935) error stop "FAILED AT LINE 11" - write(str, "(f0.10)") -huge(1.0_16) - if (len(trim(str)).lt.4945) error stop "FAILED AT LINE 13" + + do i=1,size(real_kinds) + select case (i) + case (1) + write(str, "(f0.0)") -huge(real(1.0,kind=j(1))) + case (2) + write(str, "(f0.0)") -huge(real(1.0,kind=j(2))) + case (3) + write(str, "(f0.0)") -huge(real(1.0,kind=j(3))) + case (4) + write(str, "(f0.10)") -huge(real(1.0,kind=j(4))) + end select + enddo end program testbigf0 diff --git a/gcc/testsuite/gfortran.dg/fmt_f0_3.f90 b/gcc/testsuite/gfortran.dg/fmt_f0_3.f90 new file mode 100644 index 00000000000..905fe73b6f6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/fmt_f0_3.f90 @@ -0,0 +1,23 @@ +! { dg-do run } +! PR77393, this segfaulted before +program testbigf0 + use ISO_FORTRAN_ENV + implicit none + integer i + integer, parameter :: j(size(real_kinds)+4)=[REAL_KINDS, [4, 4, 4, 4]] + character(10000) :: str + + do i=1,size(real_kinds) + select case (i) + case (1) + write(str, "(f8.0)") huge(real(1.0,kind=j(1))) + case (2) + write(str, "(f18.0)") huge(real(1.0,kind=j(2))) + case (3) + write(str, "(f20.0)") huge(real(1.0,kind=j(3))) + case (4) + write(str, "(f40.0)") huge(real(1.0,kind=j(4))) + end select + enddo +end program testbigf0 + diff --git a/gcc/testsuite/gfortran.dg/goacc/pr72743.f90 b/gcc/testsuite/gfortran.dg/goacc/pr72743.f90 new file mode 100644 index 00000000000..a29714bd43c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/pr72743.f90 @@ -0,0 +1,15 @@ +! { dg-do compile } +! { dg-additional-options "-O2" } + +program p + integer, parameter :: n = 8 + integer :: i, z(n) + z = [(i, i=1,n)] + print *, z +end +subroutine s + integer, parameter :: n = 8 + integer :: i, z(n) + z = [(i, i=1,n)] + print *, z +end diff --git a/gcc/testsuite/gfortran.dg/gomp/pr77500.f90 b/gcc/testsuite/gfortran.dg/gomp/pr77500.f90 new file mode 100644 index 00000000000..1572d5ceb24 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/pr77500.f90 @@ -0,0 +1,9 @@ +! PR fortran/77500 +! { dg-do compile } + +program pr77500 + real :: x +!$omp atomic write + x = f() +!$omp end atomic +end diff --git a/gcc/testsuite/gfortran.dg/gomp/pr77516.f90 b/gcc/testsuite/gfortran.dg/gomp/pr77516.f90 new file mode 100644 index 00000000000..7852abf8bcf --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/pr77516.f90 @@ -0,0 +1,12 @@ +! PR fortran/77516 +! { dg-do compile } + +program pr77516 + integer :: i, x + x = 0 +!$omp simd safelen(0) reduction(+:x) + do i = 1, 8 + x = x + 1 + end do + print *, x +end diff --git a/gcc/testsuite/gfortran.dg/ieee/pr77507.f90 b/gcc/testsuite/gfortran.dg/ieee/pr77507.f90 new file mode 100644 index 00000000000..a72a0915ca0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/ieee/pr77507.f90 @@ -0,0 +1,7 @@ +! { dg-do compile } +Program p + Use ieee_arithmetic + Use iso_c_binding + Print *, ieee_value(x=1.0, class=ieee_negative_inf) + Print *, c_associated(c_ptr_1=c_null_ptr) +End Program diff --git a/gcc/testsuite/gfortran.dg/misplaced_implicit_character.f90 b/gcc/testsuite/gfortran.dg/misplaced_implicit_character.f90 new file mode 100644 index 00000000000..8471d419eb0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/misplaced_implicit_character.f90 @@ -0,0 +1,8 @@ +! { dg-do compile } +! PR fortran/69963 +subroutine s + real x ! { dg-error "" } + implicit character (a) ! { dg-error "IMPLICIT statement at .1. cannot follow data declaration statement at .2." } + + a1 = 'z' ! { dg-error "Symbol .a1. at .1. has no IMPLICIT type" } +end subroutine s diff --git a/gcc/testsuite/gfortran.dg/pr68078.f90 b/gcc/testsuite/gfortran.dg/pr68078.f90 new file mode 100644 index 00000000000..4923ddd1830 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr68078.f90 @@ -0,0 +1,47 @@ +! { dg-do run } +! { dg-xfail-run-if "malloc issuing error messages" { *-*-darwin* } } +! { dg-additional-sources set_vm_limit.c } + +USE :: ISO_C_BINDING !, only: C_INT +IMPLICIT NONE + +INTERFACE + SUBROUTINE set_vm_limit(n) bind(C) + import + integer(C_INT), value, intent(in) :: n + END SUBROUTINE set_vm_limit +END INTERFACE + +TYPE foo + INTEGER, DIMENSION(10000) :: data = 42 +END TYPE +TYPE(foo), POINTER :: foo_ptr +TYPE(foo), ALLOCATABLE :: foo_obj +TYPE(foo), ALLOCATABLE, DIMENSION(:) :: foo_array + +INTEGER istat + +CALL set_vm_limit(1000000) + +DO + ALLOCATE(foo_ptr, stat = istat) + IF (istat .NE. 0) THEN + PRINT *, "foo_ptr allocation failed" + EXIT + ENDIF +ENDDO + +ALLOCATE(foo_obj, stat = istat) +IF (istat .NE. 0) THEN + PRINT *, "foo_obj allocation failed" +ENDIF + +ALLOCATE(foo_array(5), stat = istat) +IF (istat .NE. 0) THEN + PRINT *, "foo_array allocation failed" +ENDIF + +END +! { dg-output " *foo_ptr allocation failed(\n|\r\n|\r)" } +! { dg-output " *foo_obj allocation failed(\n|\r\n|\r)" } +! { dg-output " *foo_array allocation failed(\n|\r\n|\r)" } diff --git a/gcc/testsuite/gfortran.dg/pr69514_1.f90 b/gcc/testsuite/gfortran.dg/pr69514_1.f90 new file mode 100644 index 00000000000..d72a450dc58 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr69514_1.f90 @@ -0,0 +1,5 @@ +! { dg-do run } +program foo + real, parameter :: x(3) = 2.0 * [real :: 1, 2, 3 ] + if (any(x /= [2., 4., 6.])) call abort +end program foo diff --git a/gcc/testsuite/gfortran.dg/pr69514_2.f90 b/gcc/testsuite/gfortran.dg/pr69514_2.f90 new file mode 100644 index 00000000000..0a5e8166a01 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr69514_2.f90 @@ -0,0 +1,49 @@ +! { dg-do run } +program p + implicit none + + real , parameter :: arr(3) = [ real :: 2, 2.5, (1.5, 2.5) ] + real , parameter :: ari(3) = [ integer :: 2, 2.5, (1.5, 2.5) ] + real , parameter :: arc(3) = [ complex :: 2, 2.5, (1.5, 2.5) ] + integer, parameter :: air(3) = [ real :: 2, 2.5, (1.5, 2.5) ] + integer, parameter :: aii(3) = [ integer :: 2, 2.5, (1.5, 2.5) ] + integer, parameter :: aic(3) = [ complex :: 2, 2.5, (1.5, 2.5) ] + complex, parameter :: acr(3) = [ real :: 2, 2.5, (1.5, 2.5) ] + complex, parameter :: aci(3) = [ integer :: 2, 2.5, (1.5, 2.5) ] + complex, parameter :: acc(3) = [ complex :: 2, 2.5, (1.5, 2.5) ] + + real , parameter :: mrr(3) = 4.5 * [ real :: 2, 2.5, (3.5, 4.0) ] + real , parameter :: mri(3) = 4.5 * [ integer :: 2, 2.5, (3.5, 4.0) ] + real , parameter :: mrc(3) = 4.5 * [ complex :: 2, 2.5, (3.5, 4.0) ] + integer, parameter :: mir(3) = 4 * [ real :: 2, 2.5, (3.5, 4.0) ] + integer, parameter :: mii(3) = 4 * [ integer :: 2, 2.5, (3.5, 4.0) ] + integer, parameter :: mic(3) = 4 * [ complex :: 2, 2.5, (3.5, 4.0) ] + complex, parameter :: mcr(3) = (4.5, 5.5) * [ real :: 2, 2.5, (3.5, 4.0) ] + complex, parameter :: mci(3) = (4.5, 5.5) * [ integer :: 2, 2.5, (3.5, 4.0) ] + complex, parameter :: mcc(3) = (4.5, 5.5) * [ complex :: 2, 2.5, (3.5, 4.0) ] + + if (any(arr /= [2.00, 2.50, 1.50])) call abort + if (any(ari /= [2.00, 2.00, 1.00])) call abort + if (any(arc /= [2.00, 2.50, 1.50])) call abort + + if (any(air /= [2, 2, 1])) call abort + if (any(aii /= [2, 2, 1])) call abort + if (any(aic /= [2, 2, 1])) call abort + + if (any(acr /= [(2.00, 0.00), (2.50, 0.00), (1.50, 0.00)])) call abort + if (any(aci /= [(2.00, 0.00), (2.00, 0.00), (1.00, 0.00)])) call abort + if (any(acc /= [(2.00, 0.00), (2.50, 0.00), (1.50, 2.50)])) call abort + + if (any(mrr /= [9.00, 11.25, 15.75])) call abort + if (any(mri /= [9.00, 9.00, 13.50])) call abort + if (any(mrc /= [9.00, 11.25, 15.75])) call abort + + if (any(mir /= [8, 10, 14])) call abort + if (any(mii /= [8, 8, 12])) call abort + if (any(mic /= [8, 10, 14])) call abort + + if (any(mcr /= [(9.00, 11.00), (11.25, 13.75), (15.75, 19.25)])) call abort + if (any(mci /= [(9.00, 11.00), ( 9.00, 11.00), (13.50, 16.50)])) call abort + if (any(mcc /= [(9.00, 11.00), (11.25, 13.75), (-6.25, 37.25)])) call abort + +end program p diff --git a/gcc/testsuite/gfortran.dg/pr77391.f90 b/gcc/testsuite/gfortran.dg/pr77391.f90 new file mode 100644 index 00000000000..b3a455aa719 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr77391.f90 @@ -0,0 +1,7 @@ +! { dg-do compile } +program picky +character(len=:), parameter :: a="whoops" ! { dg-error "POINTER or ALLOCATABLE" } +character(len=:) :: b="whoops" ! { dg-error "POINTER or ALLOCATABLE" } +character(len=:) :: good +pointer good +end program picky diff --git a/gcc/testsuite/gfortran.dg/pr77460.f90 b/gcc/testsuite/gfortran.dg/pr77460.f90 new file mode 100644 index 00000000000..5e28a99c176 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr77460.f90 @@ -0,0 +1,7 @@ +! { dg-do compile } + double precision, parameter :: x = huge(1d0) + print*, sum((/x,-x/)) + print*, sum((/x,x,-x,-x/)) ! { dg-error "overflow" } + print*, sum((/x,-x,1d0/)) + print*, sum((/1d0,x,-x/)) +end diff --git a/gcc/testsuite/gfortran.dg/pr77506.f90 b/gcc/testsuite/gfortran.dg/pr77506.f90 new file mode 100644 index 00000000000..70d874e260b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr77506.f90 @@ -0,0 +1,4 @@ +! { dg-do compile } +program foo + print *, [character(len=*)::'ab','cd'] ! { dg-error "contain an asterisk" } +end program foo diff --git a/gcc/testsuite/gfortran.dg/pr77612.f90 b/gcc/testsuite/gfortran.dg/pr77612.f90 new file mode 100644 index 00000000000..7bc5a492c78 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr77612.f90 @@ -0,0 +1,13 @@ +! { dg-do compile } + +program bad_len + + implicit none + +contains + + subroutine sub + character(len = ICE) :: line ! { dg-error "INTEGER expression expected" } + end subroutine + +end program diff --git a/gcc/testsuite/gfortran.dg/set_vm_limit.c b/gcc/testsuite/gfortran.dg/set_vm_limit.c new file mode 100644 index 00000000000..30c4b43e0ed --- /dev/null +++ b/gcc/testsuite/gfortran.dg/set_vm_limit.c @@ -0,0 +1,22 @@ +/* Called by pr68078. */ + +#include <stdio.h> +#include <stdlib.h> +#include <sys/time.h> +#include <sys/resource.h> + +void +set_vm_limit (int vm_limit) +{ + struct rlimit rl = { vm_limit, RLIM_INFINITY }; + int r; + + r = setrlimit (RLIMIT_AS, &rl); + if (r) + { + perror ("set_vm_limit"); + exit (1); + } + + return; +} diff --git a/gcc/testsuite/gnat.dg/opt58.adb b/gcc/testsuite/gnat.dg/opt58.adb new file mode 100644 index 00000000000..ac39cc06056 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt58.adb @@ -0,0 +1,19 @@ +-- { dg-do compile }
+-- { dg-options "-O" }
+
+with Unchecked_Conversion;
+with System; use System;
+with Opt58_Pkg; use Opt58_Pkg;
+
+procedure Opt58 is
+
+ function Convert is new Unchecked_Conversion (Integer, Rec);
+
+ Dword : Integer := 0;
+ I : Small_Int := F1 (Convert (Dword));
+
+begin
+ if F2 (Null_Address, I = 0) then
+ null;
+ end if;
+end Opt58;
diff --git a/gcc/testsuite/gnat.dg/opt58_pkg.ads b/gcc/testsuite/gnat.dg/opt58_pkg.ads new file mode 100644 index 00000000000..9cb7f3a2540 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt58_pkg.ads @@ -0,0 +1,19 @@ +with System; use System;
+
+package Opt58_Pkg is
+
+ pragma Pure (Opt58_Pkg);
+
+ type Small_Int is range 0 .. 255;
+
+ type Rec is record
+ D1, D2, D3, D4 : Small_Int;
+ end record;
+ pragma Pack (Rec);
+ for Rec'Size use 32;
+
+ function F1 (R : Rec) return Small_Int;
+
+ function F2 (A : Address; B : Boolean) return Boolean;
+
+end Opt58_Pkg;
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 0dabea08501..6724a7fd214 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -2909,10 +2909,10 @@ proc check_effective_target_vect_simd_clones { } { } else { set et_vect_simd_clones_saved($et_index) 0 if { [istarget i?86-*-*] || [istarget x86_64-*-*] } { - # On i?86/x86_64 #pragma omp declare simd builds a sse2, avx and - # avx2 clone. Only the right clone for the specified arch will be - # chosen, but still we need to at least be able to assemble - # avx2. + # On i?86/x86_64 #pragma omp declare simd builds a sse2, avx, avx2 + # and avx512f clone. Only the right clone for the specified arch + # will be chosen, but still we need to at least be able to assemble + # avx512f. if { [check_effective_target_avx512f] } { set et_vect_simd_clones_saved($et_index) 1 } @@ -7699,3 +7699,10 @@ proc check_effective_target_offload_hsa { } { int main () {return 0;} } "-foffload=hsa" ] } + +# Return 1 if the target support -fprofile-update=atomic +proc check_effective_target_profile_update_atomic {} { + return [check_no_compiler_messages profile_update_atomic assembly { + int main (void) { return 0; } + } "-fprofile-update=atomic -fprofile-generate"] +} |