aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/c-c++-common')
-rw-r--r--gcc/testsuite/c-c++-common/Warray-bounds-11.c21
-rw-r--r--gcc/testsuite/c-c++-common/Wstringop-overflow.c4
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-parm-1.c50
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-parm-2.c50
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-parm-3.c50
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-parm-4.c50
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-parm-5.c50
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-parm-6.c50
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-19.c60
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-20.c60
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-21.c60
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-22.c60
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-23.c60
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-24.c60
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-7.c4
-rw-r--r--gcc/testsuite/c-c++-common/Wvarargs.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/analyzer-verbosity-2a.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/analyzer-verbosity-3a.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/attr-const-2.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/attr-malloc-4.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/attr-malloc-5.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/attr-malloc-6.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/attr-malloc-exception.c17
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/call-summaries-pr107158-2.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/call-summaries-pr107158.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/capacity-2.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/coreutils-sum-pr108666.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/data-model-22.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/data-model-5d.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/data-model-path-1.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/deref-before-check-pr108455-git-pack-revindex.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/deref-before-check-pr108475-haproxy-tcpcheck.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/edges-2.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/fd-2.c4
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/fd-3.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/fd-glibc-byte-stream-socket.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/fd-meaning.c5
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/file-1.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/file-3.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/file-meaning-1.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/hard-reg-1.c8
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/infinite-recursion.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/invalid-shift-1.c4
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/leak-3.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/malloc-dedupe-1.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/malloc-in-loop.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/malloc-many-paths-3.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/malloc-paths-5.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/malloc-paths-7.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/malloc-paths-8.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-1a.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-2.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-3.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c4
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/null-deref-pr108400-SoftEtherVPN-WebUi.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-1-json.c13
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/paths-7.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/pr110830.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/pr93032-mztools-simplified.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-feasibility-3.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-simplified.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/pr96650-1-trans.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/pr97072.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/pr98575-1.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/pr99716-1.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/pr99716-2.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/pr99716-3.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/pragma-2.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/realloc-1.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/rhbz1878600.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/sprintf-3.c44
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/strndup-1.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/strtok-cppreference.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-4-disabled.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-4.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-5.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/zlib-5.c1
-rw-r--r--gcc/testsuite/c-c++-common/asan/asan-stack-small.c16
-rw-r--r--gcc/testsuite/c-c++-common/asan/pr120608-1.c43
-rw-r--r--gcc/testsuite/c-c++-common/asan/pr120608-2.c39
-rw-r--r--gcc/testsuite/c-c++-common/asan/pr120608-3.c36
-rw-r--r--gcc/testsuite/c-c++-common/asan/pr120608-4.c30
-rw-r--r--gcc/testsuite/c-c++-common/asan/pr121389-1.c23
-rw-r--r--gcc/testsuite/c-c++-common/asan/pr121389-2.c37
-rw-r--r--gcc/testsuite/c-c++-common/asan/pr121389-3.c130
-rw-r--r--gcc/testsuite/c-c++-common/asan/pr121389-4.c6
-rw-r--r--gcc/testsuite/c-c++-common/asan/pr59063-2.c2
-rw-r--r--gcc/testsuite/c-c++-common/attr-warn-unused-result-2.c16
-rw-r--r--gcc/testsuite/c-c++-common/cpp/comment-ff-1.c12
-rw-r--r--gcc/testsuite/c-c++-common/cpp/comment-vtab-1.c12
-rw-r--r--gcc/testsuite/c-c++-common/cpp/has-builtin-4.c2
-rw-r--r--gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-1.c1
-rw-r--r--gcc/testsuite/c-c++-common/cpp/pr92296-2.c12
-rw-r--r--gcc/testsuite/c-c++-common/cpp/pragma-diagnostic-loc-2.c15
-rw-r--r--gcc/testsuite/c-c++-common/cpp/va-opt-6.c10
-rw-r--r--gcc/testsuite/c-c++-common/diagnostic-format-json-1.c22
-rw-r--r--gcc/testsuite/c-c++-common/diagnostic-format-json-2.c26
-rw-r--r--gcc/testsuite/c-c++-common/diagnostic-format-json-3.c26
-rw-r--r--gcc/testsuite/c-c++-common/diagnostic-format-json-4.c44
-rw-r--r--gcc/testsuite/c-c++-common/diagnostic-format-json-5.c38
-rw-r--r--gcc/testsuite/c-c++-common/diagnostic-format-json-file-1.c8
-rw-r--r--gcc/testsuite/c-c++-common/diagnostic-format-json-stderr-1.c24
-rw-r--r--gcc/testsuite/c-c++-common/goacc-gomp/nesting-1.c11
-rw-r--r--gcc/testsuite/c-c++-common/goacc/acc-wait-1.c51
-rw-r--r--gcc/testsuite/c-c++-common/goacc/cache-3-1.c4
-rw-r--r--gcc/testsuite/c-c++-common/goacc/cache-3-2.c8
-rw-r--r--gcc/testsuite/c-c++-common/goacc/data-clause-1.c66
-rw-r--r--gcc/testsuite/c-c++-common/goacc/data-clause-2.c8
-rw-r--r--gcc/testsuite/c-c++-common/goacc/data-clause-duplicate-1.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-decompose-2.c3
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr100280-1.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr100400-1-1.c1
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr100400-1-3.c1
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104061-1-1.c1
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104061-1-3.c1
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104061-1-4.c1
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104132-1.c1
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104133-1.c1
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104774-1.c1
-rw-r--r--gcc/testsuite/c-c++-common/goacc/mdc-1.c1
-rw-r--r--gcc/testsuite/c-c++-common/goacc/mdc-2.c12
-rw-r--r--gcc/testsuite/c-c++-common/goacc/pr69916.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc/readonly-1.c28
-rw-r--r--gcc/testsuite/c-c++-common/gomp/affinity-2.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/allocate-4.c4
-rw-r--r--gcc/testsuite/c-c++-common/gomp/append-args-1.c22
-rw-r--r--gcc/testsuite/c-c++-common/gomp/append-args-7.c4
-rw-r--r--gcc/testsuite/c-c++-common/gomp/append-args-8.c9
-rw-r--r--gcc/testsuite/c-c++-common/gomp/append-args-9.c7
-rw-r--r--gcc/testsuite/c-c++-common/gomp/append-args-interop.c44
-rw-r--r--gcc/testsuite/c-c++-common/gomp/assume-2.c4
-rw-r--r--gcc/testsuite/c-c++-common/gomp/assumes-2.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/attrs-metadirective-2.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/attrs-metadirective-3.c7
-rw-r--r--gcc/testsuite/c-c++-common/gomp/begin-assumes-2.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/clauses-3.c4
-rw-r--r--gcc/testsuite/c-c++-common/gomp/declare-mapper-10.c30
-rw-r--r--gcc/testsuite/c-c++-common/gomp/declare-mapper-11.c70
-rw-r--r--gcc/testsuite/c-c++-common/gomp/declare-mapper-12.c22
-rw-r--r--gcc/testsuite/c-c++-common/gomp/declare-mapper-3.c30
-rw-r--r--gcc/testsuite/c-c++-common/gomp/declare-mapper-4.c78
-rw-r--r--gcc/testsuite/c-c++-common/gomp/declare-mapper-5.c26
-rw-r--r--gcc/testsuite/c-c++-common/gomp/declare-mapper-6.c23
-rw-r--r--gcc/testsuite/c-c++-common/gomp/declare-mapper-7.c29
-rw-r--r--gcc/testsuite/c-c++-common/gomp/declare-mapper-8.c43
-rw-r--r--gcc/testsuite/c-c++-common/gomp/declare-mapper-9.c34
-rw-r--r--gcc/testsuite/c-c++-common/gomp/declare-variant-2.c15
-rw-r--r--gcc/testsuite/c-c++-common/gomp/delim-declare-variant-1.c55
-rw-r--r--gcc/testsuite/c-c++-common/gomp/delim-declare-variant-2.c66
-rw-r--r--gcc/testsuite/c-c++-common/gomp/delim-declare-variant-3.c49
-rw-r--r--gcc/testsuite/c-c++-common/gomp/delim-declare-variant-4.c31
-rw-r--r--gcc/testsuite/c-c++-common/gomp/delim-declare-variant-5.c26
-rw-r--r--gcc/testsuite/c-c++-common/gomp/delim-declare-variant-6.c70
-rw-r--r--gcc/testsuite/c-c++-common/gomp/delim-declare-variant-7.c27
-rw-r--r--gcc/testsuite/c-c++-common/gomp/delim-declare-variant-8.c54
-rw-r--r--gcc/testsuite/c-c++-common/gomp/delim-declare-variant-9.c47
-rw-r--r--gcc/testsuite/c-c++-common/gomp/depend-1.c48
-rw-r--r--gcc/testsuite/c-c++-common/gomp/depend-2.c6
-rw-r--r--gcc/testsuite/c-c++-common/gomp/depend-3.c12
-rw-r--r--gcc/testsuite/c-c++-common/gomp/depend-4.c4
-rw-r--r--gcc/testsuite/c-c++-common/gomp/depend-5.c4
-rw-r--r--gcc/testsuite/c-c++-common/gomp/depend-6.c4
-rw-r--r--gcc/testsuite/c-c++-common/gomp/dispatch-1.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/dispatch-11.c3
-rw-r--r--gcc/testsuite/c-c++-common/gomp/dyn_groupprivate-1.c28
-rw-r--r--gcc/testsuite/c-c++-common/gomp/dyn_groupprivate-2.c72
-rw-r--r--gcc/testsuite/c-c++-common/gomp/imperfect1.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/imperfect4.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/interop-1.c80
-rw-r--r--gcc/testsuite/c-c++-common/gomp/interop-2.c64
-rw-r--r--gcc/testsuite/c-c++-common/gomp/interop-3.c26
-rw-r--r--gcc/testsuite/c-c++-common/gomp/interop-4.c8
-rw-r--r--gcc/testsuite/c-c++-common/gomp/loop-5.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/map-1.c66
-rw-r--r--gcc/testsuite/c-c++-common/gomp/map-2.c8
-rw-r--r--gcc/testsuite/c-c++-common/gomp/map-4.c6
-rw-r--r--gcc/testsuite/c-c++-common/gomp/map-6.c20
-rw-r--r--gcc/testsuite/c-c++-common/gomp/map-7.c6
-rw-r--r--gcc/testsuite/c-c++-common/gomp/metadirective-2.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/metadirective-3.c7
-rw-r--r--gcc/testsuite/c-c++-common/gomp/metadirective-condition-constexpr.c13
-rw-r--r--gcc/testsuite/c-c++-common/gomp/metadirective-condition.c25
-rw-r--r--gcc/testsuite/c-c++-common/gomp/metadirective-device.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/metadirective-error-recovery.c25
-rw-r--r--gcc/testsuite/c-c++-common/gomp/metadirective-target-device-1.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/metadirective-target-device-2.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/omp_get_num_devices_initial_device-2.c29
-rw-r--r--gcc/testsuite/c-c++-common/gomp/omp_get_num_devices_initial_device.c32
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr100902-1.c4
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr103642.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr118965-1.c57
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr118965-2.c31
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr120052.c32
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr120180-1.c22
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr120180-2.c66
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr120564.c15
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr121452-1.c17
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr121452-2.c17
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr61486-1.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr81006.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr91920.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr96867.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr99928-16.c6
-rw-r--r--gcc/testsuite/c-c++-common/gomp/reduction-1.c18
-rw-r--r--gcc/testsuite/c-c++-common/gomp/scan-1.c6
-rw-r--r--gcc/testsuite/c-c++-common/gomp/target-data-1.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/target-enter-data-1.c6
-rw-r--r--gcc/testsuite/c-c++-common/gomp/target-has-device-addr-1.c14
-rw-r--r--gcc/testsuite/c-c++-common/gomp/target-implicit-map-2.c10
-rw-r--r--gcc/testsuite/c-c++-common/gomp/target-map-iterators-1.c23
-rw-r--r--gcc/testsuite/c-c++-common/gomp/target-map-iterators-2.c41
-rw-r--r--gcc/testsuite/c-c++-common/gomp/target-map-iterators-3.c23
-rw-r--r--gcc/testsuite/c-c++-common/gomp/target-map-iterators-4.c18
-rw-r--r--gcc/testsuite/c-c++-common/gomp/target-update-iterators-1.c21
-rw-r--r--gcc/testsuite/c-c++-common/gomp/target-update-iterators-2.c23
-rw-r--r--gcc/testsuite/c-c++-common/gomp/target-update-iterators-3.c17
-rw-r--r--gcc/testsuite/c-c++-common/hwasan/unprotected-allocas-0.c4
-rw-r--r--gcc/testsuite/c-c++-common/musttail14.c2
-rw-r--r--gcc/testsuite/c-c++-common/musttail15.c2
-rw-r--r--gcc/testsuite/c-c++-common/musttail16.c2
-rw-r--r--gcc/testsuite/c-c++-common/musttail17.c2
-rw-r--r--gcc/testsuite/c-c++-common/musttail18.c2
-rw-r--r--gcc/testsuite/c-c++-common/musttail19.c7
-rw-r--r--gcc/testsuite/c-c++-common/musttail20.c2
-rw-r--r--gcc/testsuite/c-c++-common/musttail21.c2
-rw-r--r--gcc/testsuite/c-c++-common/musttail22.c2
-rw-r--r--gcc/testsuite/c-c++-common/musttail28.c108
-rw-r--r--gcc/testsuite/c-c++-common/musttail29.c109
-rw-r--r--gcc/testsuite/c-c++-common/musttail30.c109
-rw-r--r--gcc/testsuite/c-c++-common/musttail31.c109
-rw-r--r--gcc/testsuite/c-c++-common/musttail32.c23
-rw-r--r--gcc/testsuite/c-c++-common/musttail8.c5
-rw-r--r--gcc/testsuite/c-c++-common/pr106133.c3
-rw-r--r--gcc/testsuite/c-c++-common/pr118442.c17
-rw-r--r--gcc/testsuite/c-c++-common/pr118868-1.c9
-rw-r--r--gcc/testsuite/c-c++-common/pr119483-1.c29
-rw-r--r--gcc/testsuite/c-c++-common/pr119483-2.c12
-rw-r--r--gcc/testsuite/c-c++-common/pr119484.c21
-rw-r--r--gcc/testsuite/c-c++-common/pr119535.c31
-rw-r--r--gcc/testsuite/c-c++-common/pr119537-1.c23
-rw-r--r--gcc/testsuite/c-c++-common/pr119537-2.c23
-rw-r--r--gcc/testsuite/c-c++-common/pr119614-1.c28
-rw-r--r--gcc/testsuite/c-c++-common/pr119614-2.c28
-rw-r--r--gcc/testsuite/c-c++-common/pr119614-3.c28
-rw-r--r--gcc/testsuite/c-c++-common/pr119616.c23
-rw-r--r--gcc/testsuite/c-c++-common/pr119618.c21
-rw-r--r--gcc/testsuite/c-c++-common/pr121159.c17
-rw-r--r--gcc/testsuite/c-c++-common/pr122188.c15
-rw-r--r--gcc/testsuite/c-c++-common/pragma-optimize-1.c10
-rw-r--r--gcc/testsuite/c-c++-common/restrict-2.c2
-rw-r--r--gcc/testsuite/c-c++-common/tls-attr-common.c20
-rw-r--r--gcc/testsuite/c-c++-common/tls-attr-le-pic.c15
-rw-r--r--gcc/testsuite/c-c++-common/tls-attr-le-pie.c15
-rw-r--r--gcc/testsuite/c-c++-common/toplevel-asm-9.c12
-rw-r--r--gcc/testsuite/c-c++-common/torture/asm-inline.c5
-rw-r--r--gcc/testsuite/c-c++-common/tsan/pr119801.c24
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/align-5.c9
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/align-5a.c18
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/nonnull-8.c32
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/nonnull-9.c41
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/vla-1.c2
-rw-r--r--gcc/testsuite/c-c++-common/uninit-17.c4
-rw-r--r--gcc/testsuite/c-c++-common/vector-subscript-4.c8
264 files changed, 4158 insertions, 632 deletions
diff --git a/gcc/testsuite/c-c++-common/Warray-bounds-11.c b/gcc/testsuite/c-c++-common/Warray-bounds-11.c
new file mode 100644
index 0000000..686a94d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Warray-bounds-11.c
@@ -0,0 +1,21 @@
+/* PR c++/120954 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Warray-bounds=2" } */
+
+static const int a[32] = { 11, 12, 13, 14, 15 };
+static const int b[32] = { 21, 22, 23, 24, 25 };
+static const int c[32] = { 31, 32, 33, 34, 35 };
+static const int d[32] = { 111, 112, 113, 114, 115 };
+static const int e[32] = { 121, 122, 123, 124, 125 };
+static const int f[32] = { 131, 132, 133, 134, 135 };
+
+int
+foo (int x, int y)
+{
+ int r = 0;
+ if (x >= 0 && x < 32)
+ r = (y >= 4 ? (y >= 0x65 ? a : b ) : c)[x];
+ else if (x >= 0x100 && x < 0x120)
+ r = (y >= 4 ? (y >= 0x65 ? d : e ) : f)[x - 0x100];
+ return r;
+}
diff --git a/gcc/testsuite/c-c++-common/Wstringop-overflow.c b/gcc/testsuite/c-c++-common/Wstringop-overflow.c
index 5757a23..9829fe1 100644
--- a/gcc/testsuite/c-c++-common/Wstringop-overflow.c
+++ b/gcc/testsuite/c-c++-common/Wstringop-overflow.c
@@ -90,8 +90,8 @@ void test_strncat (char **d, const char* s, int i)
}
{
- size_t n = i < strlen (s) ? i : strlen (s); /* { dg-message "length computed here" } */
- T (d, s, n); /* { dg-message ".strncat\[^\n\r\]* specified bound depends on the length of the source argument" } */
+ size_t n = i < strlen (s) ? i : strlen (s); /* { dg-message "length computed here" "PR122881" { xfail *-*-* } } */
+ T (d, s, n); /* { dg-message ".strncat\[^\n\r\]* specified bound depends on the length of the source argument" "PR122881" { xfail *-*-* } } */
}
}
diff --git a/gcc/testsuite/c-c++-common/Wunused-parm-1.c b/gcc/testsuite/c-c++-common/Wunused-parm-1.c
new file mode 100644
index 0000000..355fa4a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-parm-1.c
@@ -0,0 +1,50 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-parameter" } */
+
+void baz (int);
+
+void
+foo (int a, /* { dg-warning "parameter 'a' set but not used" } */
+ int b, /* { dg-warning "parameter 'b' set but not used" } */
+ int c, /* { dg-warning "parameter 'c' set but not used" } */
+ int d, /* { dg-warning "parameter 'd' set but not used" } */
+ int e, /* { dg-warning "parameter 'e' set but not used" } */
+ int f, /* { dg-warning "parameter 'f' set but not used" } */
+ int g, /* { dg-warning "parameter 'g' set but not used" } */
+ int h, /* { dg-warning "parameter 'h' set but not used" } */
+ int i, /* { dg-warning "parameter 'i' set but not used" } */
+ int j, /* { dg-warning "parameter 'j' set but not used" } */
+ int k, /* { dg-warning "parameter 'k' set but not used" } */
+ int l, /* { dg-warning "parameter 'l' set but not used" } */
+ int m) /* { dg-warning "parameter 'm' set but not used" } */
+{
+ a = 1;
+ ++b;
+ c++;
+ --d;
+ e--;
+ f += 2;
+ g |= 2;
+ h -= 2;
+ i &= 2;
+ j ^= 2;
+ k *= 2;
+ l %= 2;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j,
+ int k, int l, int m, int n)
+{
+ b = ++a;
+ d = --c;
+ f = e--;
+ h = g++;
+ j = i += 42;
+ l = k *= 4;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-parm-2.c b/gcc/testsuite/c-c++-common/Wunused-parm-2.c
new file mode 100644
index 0000000..2caea94
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-parm-2.c
@@ -0,0 +1,50 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused -Wextra" } */
+
+void baz (int);
+
+void
+foo (int a, /* { dg-warning "parameter 'a' set but not used" } */
+ int b, /* { dg-warning "parameter 'b' set but not used" } */
+ int c, /* { dg-warning "parameter 'c' set but not used" } */
+ int d, /* { dg-warning "parameter 'd' set but not used" } */
+ int e, /* { dg-warning "parameter 'e' set but not used" } */
+ int f, /* { dg-warning "parameter 'f' set but not used" } */
+ int g, /* { dg-warning "parameter 'g' set but not used" } */
+ int h, /* { dg-warning "parameter 'h' set but not used" } */
+ int i, /* { dg-warning "parameter 'i' set but not used" } */
+ int j, /* { dg-warning "parameter 'j' set but not used" } */
+ int k, /* { dg-warning "parameter 'k' set but not used" } */
+ int l, /* { dg-warning "parameter 'l' set but not used" } */
+ int m) /* { dg-warning "parameter 'm' set but not used" } */
+{
+ a = 1;
+ ++b;
+ c++;
+ --d;
+ e--;
+ f += 2;
+ g |= 2;
+ h -= 2;
+ i &= 2;
+ j ^= 2;
+ k *= 2;
+ l %= 2;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j,
+ int k, int l, int m, int n)
+{
+ b = ++a;
+ d = --c;
+ f = e--;
+ h = g++;
+ j = i += 42;
+ l = k *= 4;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-parm-3.c b/gcc/testsuite/c-c++-common/Wunused-parm-3.c
new file mode 100644
index 0000000..2978cd4
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-parm-3.c
@@ -0,0 +1,50 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-parameter=3" } */
+
+void baz (int);
+
+void
+foo (int a, /* { dg-warning "parameter 'a' set but not used" } */
+ int b, /* { dg-warning "parameter 'b' set but not used" } */
+ int c, /* { dg-warning "parameter 'c' set but not used" } */
+ int d, /* { dg-warning "parameter 'd' set but not used" } */
+ int e, /* { dg-warning "parameter 'e' set but not used" } */
+ int f, /* { dg-warning "parameter 'f' set but not used" } */
+ int g, /* { dg-warning "parameter 'g' set but not used" } */
+ int h, /* { dg-warning "parameter 'h' set but not used" } */
+ int i, /* { dg-warning "parameter 'i' set but not used" } */
+ int j, /* { dg-warning "parameter 'j' set but not used" } */
+ int k, /* { dg-warning "parameter 'k' set but not used" } */
+ int l, /* { dg-warning "parameter 'l' set but not used" } */
+ int m) /* { dg-warning "parameter 'm' set but not used" } */
+{
+ a = 1;
+ ++b;
+ c++;
+ --d;
+ e--;
+ f += 2;
+ g |= 2;
+ h -= 2;
+ i &= 2;
+ j ^= 2;
+ k *= 2;
+ l %= 2;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j,
+ int k, int l, int m, int n)
+{
+ b = ++a;
+ d = --c;
+ f = e--;
+ h = g++;
+ j = i += 42;
+ l = k *= 4;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-parm-4.c b/gcc/testsuite/c-c++-common/Wunused-parm-4.c
new file mode 100644
index 0000000..063b40f
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-parm-4.c
@@ -0,0 +1,50 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-parameter=2" } */
+
+void baz (int);
+
+void
+foo (int a, /* { dg-warning "parameter 'a' set but not used" } */
+ int b, /* { dg-warning "parameter 'b' set but not used" } */
+ int c, /* { dg-warning "parameter 'c' set but not used" } */
+ int d, /* { dg-warning "parameter 'd' set but not used" } */
+ int e, /* { dg-warning "parameter 'e' set but not used" } */
+ int f,
+ int g,
+ int h,
+ int i,
+ int j,
+ int k,
+ int l,
+ int m) /* { dg-warning "parameter 'm' set but not used" } */
+{
+ a = 1;
+ ++b;
+ c++;
+ --d;
+ e--;
+ f += 2;
+ g |= 2;
+ h -= 2;
+ i &= 2;
+ j ^= 2;
+ k *= 2;
+ l %= 2;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j,
+ int k, int l, int m, int n)
+{
+ b = ++a;
+ d = --c;
+ f = e--;
+ h = g++;
+ j = i += 42;
+ l = k *= 4;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-parm-5.c b/gcc/testsuite/c-c++-common/Wunused-parm-5.c
new file mode 100644
index 0000000..1c80a82
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-parm-5.c
@@ -0,0 +1,50 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-parameter=1" } */
+
+void baz (int);
+
+void
+foo (int a, /* { dg-warning "parameter 'a' set but not used" } */
+ int b,
+ int c,
+ int d,
+ int e,
+ int f,
+ int g,
+ int h,
+ int i,
+ int j,
+ int k,
+ int l,
+ int m)
+{
+ a = 1;
+ ++b;
+ c++;
+ --d;
+ e--;
+ f += 2;
+ g |= 2;
+ h -= 2;
+ i &= 2;
+ j ^= 2;
+ k *= 2;
+ l %= 2;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j,
+ int k, int l, int m, int n)
+{
+ b = ++a;
+ d = --c;
+ f = e--;
+ h = g++;
+ j = i += 42;
+ l = k *= 4;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-parm-6.c b/gcc/testsuite/c-c++-common/Wunused-parm-6.c
new file mode 100644
index 0000000..ee328bd
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-parm-6.c
@@ -0,0 +1,50 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-parameter=0" } */
+
+void baz (int);
+
+void
+foo (int a,
+ int b,
+ int c,
+ int d,
+ int e,
+ int f,
+ int g,
+ int h,
+ int i,
+ int j,
+ int k,
+ int l,
+ int m)
+{
+ a = 1;
+ ++b;
+ c++;
+ --d;
+ e--;
+ f += 2;
+ g |= 2;
+ h -= 2;
+ i &= 2;
+ j ^= 2;
+ k *= 2;
+ l %= 2;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j,
+ int k, int l, int m, int n)
+{
+ b = ++a;
+ d = --c;
+ f = e--;
+ h = g++;
+ j = i += 42;
+ l = k *= 4;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-19.c b/gcc/testsuite/c-c++-common/Wunused-var-19.c
new file mode 100644
index 0000000..32c47e6
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-19.c
@@ -0,0 +1,60 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-variable" } */
+
+void baz (int);
+
+void
+foo (void)
+{
+ int a = 0; /* { dg-warning "variable 'a' set but not used" } */
+ a = 1;
+ int b = 0; /* { dg-warning "variable 'b' set but not used" } */
+ ++b;
+ int c = 0; /* { dg-warning "variable 'c' set but not used" } */
+ c++;
+ int d = 0; /* { dg-warning "variable 'd' set but not used" } */
+ --d;
+ int e = 0; /* { dg-warning "variable 'e' set but not used" } */
+ e--;
+ int f = 0; /* { dg-warning "variable 'f' set but not used" } */
+ f += 2;
+ int g = 0; /* { dg-warning "variable 'g' set but not used" } */
+ g |= 2;
+ int h = 0; /* { dg-warning "variable 'h' set but not used" } */
+ h -= 2;
+ int i = 0; /* { dg-warning "variable 'i' set but not used" } */
+ i &= 2;
+ int j = 0; /* { dg-warning "variable 'j' set but not used" } */
+ j ^= 2;
+ int k = 0; /* { dg-warning "variable 'k' set but not used" } */
+ k *= 2;
+ int l = 0; /* { dg-warning "variable 'l' set but not used" } */
+ l %= 2;
+ int m = 0; /* { dg-warning "variable 'm' set but not used" } */
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (void)
+{
+ int a = 0;
+ int b = ++a;
+ int c = 0;
+ int d = --c;
+ int e = 0;
+ int f = e--;
+ int g = 0;
+ int h = g++;
+ int i = 0;
+ int j;
+ j = i += 42;
+ int k = 0;
+ int l;
+ l = k *= 4;
+ int m = 0;
+ int n;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-20.c b/gcc/testsuite/c-c++-common/Wunused-var-20.c
new file mode 100644
index 0000000..e25b26b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-20.c
@@ -0,0 +1,60 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused" } */
+
+void baz (int);
+
+void
+foo (void)
+{
+ int a = 0; /* { dg-warning "variable 'a' set but not used" } */
+ a = 1;
+ int b = 0; /* { dg-warning "variable 'b' set but not used" } */
+ ++b;
+ int c = 0; /* { dg-warning "variable 'c' set but not used" } */
+ c++;
+ int d = 0; /* { dg-warning "variable 'd' set but not used" } */
+ --d;
+ int e = 0; /* { dg-warning "variable 'e' set but not used" } */
+ e--;
+ int f = 0; /* { dg-warning "variable 'f' set but not used" } */
+ f += 2;
+ int g = 0; /* { dg-warning "variable 'g' set but not used" } */
+ g |= 2;
+ int h = 0; /* { dg-warning "variable 'h' set but not used" } */
+ h -= 2;
+ int i = 0; /* { dg-warning "variable 'i' set but not used" } */
+ i &= 2;
+ int j = 0; /* { dg-warning "variable 'j' set but not used" } */
+ j ^= 2;
+ int k = 0; /* { dg-warning "variable 'k' set but not used" } */
+ k *= 2;
+ int l = 0; /* { dg-warning "variable 'l' set but not used" } */
+ l %= 2;
+ int m = 0; /* { dg-warning "variable 'm' set but not used" } */
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (void)
+{
+ int a = 0;
+ int b = ++a;
+ int c = 0;
+ int d = --c;
+ int e = 0;
+ int f = e--;
+ int g = 0;
+ int h = g++;
+ int i = 0;
+ int j;
+ j = i += 42;
+ int k = 0;
+ int l;
+ l = k *= 4;
+ int m = 0;
+ int n;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-21.c b/gcc/testsuite/c-c++-common/Wunused-var-21.c
new file mode 100644
index 0000000..0732d98
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-21.c
@@ -0,0 +1,60 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-variable=3" } */
+
+void baz (int);
+
+void
+foo (void)
+{
+ int a = 0; /* { dg-warning "variable 'a' set but not used" } */
+ a = 1;
+ int b = 0; /* { dg-warning "variable 'b' set but not used" } */
+ ++b;
+ int c = 0; /* { dg-warning "variable 'c' set but not used" } */
+ c++;
+ int d = 0; /* { dg-warning "variable 'd' set but not used" } */
+ --d;
+ int e = 0; /* { dg-warning "variable 'e' set but not used" } */
+ e--;
+ int f = 0; /* { dg-warning "variable 'f' set but not used" } */
+ f += 2;
+ int g = 0; /* { dg-warning "variable 'g' set but not used" } */
+ g |= 2;
+ int h = 0; /* { dg-warning "variable 'h' set but not used" } */
+ h -= 2;
+ int i = 0; /* { dg-warning "variable 'i' set but not used" } */
+ i &= 2;
+ int j = 0; /* { dg-warning "variable 'j' set but not used" } */
+ j ^= 2;
+ int k = 0; /* { dg-warning "variable 'k' set but not used" } */
+ k *= 2;
+ int l = 0; /* { dg-warning "variable 'l' set but not used" } */
+ l %= 2;
+ int m = 0; /* { dg-warning "variable 'm' set but not used" } */
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (void)
+{
+ int a = 0;
+ int b = ++a;
+ int c = 0;
+ int d = --c;
+ int e = 0;
+ int f = e--;
+ int g = 0;
+ int h = g++;
+ int i = 0;
+ int j;
+ j = i += 42;
+ int k = 0;
+ int l;
+ l = k *= 4;
+ int m = 0;
+ int n;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-22.c b/gcc/testsuite/c-c++-common/Wunused-var-22.c
new file mode 100644
index 0000000..84f57c5
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-22.c
@@ -0,0 +1,60 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-variable=2" } */
+
+void baz (int);
+
+void
+foo (void)
+{
+ int a = 0; /* { dg-warning "variable 'a' set but not used" } */
+ a = 1;
+ int b = 0; /* { dg-warning "variable 'b' set but not used" } */
+ ++b;
+ int c = 0; /* { dg-warning "variable 'c' set but not used" } */
+ c++;
+ int d = 0; /* { dg-warning "variable 'd' set but not used" } */
+ --d;
+ int e = 0; /* { dg-warning "variable 'e' set but not used" } */
+ e--;
+ int f = 0;
+ f += 2;
+ int g = 0;
+ g |= 2;
+ int h = 0;
+ h -= 2;
+ int i = 0;
+ i &= 2;
+ int j = 0;
+ j ^= 2;
+ int k = 0;
+ k *= 2;
+ int l = 0;
+ l %= 2;
+ int m = 0; /* { dg-warning "variable 'm' set but not used" } */
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (void)
+{
+ int a = 0;
+ int b = ++a;
+ int c = 0;
+ int d = --c;
+ int e = 0;
+ int f = e--;
+ int g = 0;
+ int h = g++;
+ int i = 0;
+ int j;
+ j = i += 42;
+ int k = 0;
+ int l;
+ l = k *= 4;
+ int m = 0;
+ int n;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-23.c b/gcc/testsuite/c-c++-common/Wunused-var-23.c
new file mode 100644
index 0000000..b74c3f4
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-23.c
@@ -0,0 +1,60 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-variable=1" } */
+
+void baz (int);
+
+void
+foo (void)
+{
+ int a = 0; /* { dg-warning "variable 'a' set but not used" } */
+ a = 1;
+ int b = 0;
+ ++b;
+ int c = 0;
+ c++;
+ int d = 0;
+ --d;
+ int e = 0;
+ e--;
+ int f = 0;
+ f += 2;
+ int g = 0;
+ g |= 2;
+ int h = 0;
+ h -= 2;
+ int i = 0;
+ i &= 2;
+ int j = 0;
+ j ^= 2;
+ int k = 0;
+ k *= 2;
+ int l = 0;
+ l %= 2;
+ int m = 0;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (void)
+{
+ int a = 0;
+ int b = ++a;
+ int c = 0;
+ int d = --c;
+ int e = 0;
+ int f = e--;
+ int g = 0;
+ int h = g++;
+ int i = 0;
+ int j;
+ j = i += 42;
+ int k = 0;
+ int l;
+ l = k *= 4;
+ int m = 0;
+ int n;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-24.c b/gcc/testsuite/c-c++-common/Wunused-var-24.c
new file mode 100644
index 0000000..a59f50a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-24.c
@@ -0,0 +1,60 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-variable=0" } */
+
+void baz (int);
+
+void
+foo (void)
+{
+ int a = 0;
+ a = 1;
+ int b = 0;
+ ++b;
+ int c = 0;
+ c++;
+ int d = 0;
+ --d;
+ int e = 0;
+ e--;
+ int f = 0;
+ f += 2;
+ int g = 0;
+ g |= 2;
+ int h = 0;
+ h -= 2;
+ int i = 0;
+ i &= 2;
+ int j = 0;
+ j ^= 2;
+ int k = 0;
+ k *= 2;
+ int l = 0;
+ l %= 2;
+ int m = 0;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (void)
+{
+ int a = 0;
+ int b = ++a;
+ int c = 0;
+ int d = --c;
+ int e = 0;
+ int f = e--;
+ int g = 0;
+ int h = g++;
+ int i = 0;
+ int j;
+ j = i += 42;
+ int k = 0;
+ int l;
+ l = k *= 4;
+ int m = 0;
+ int n;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-7.c b/gcc/testsuite/c-c++-common/Wunused-var-7.c
index 7419643..ea6babd 100644
--- a/gcc/testsuite/c-c++-common/Wunused-var-7.c
+++ b/gcc/testsuite/c-c++-common/Wunused-var-7.c
@@ -24,7 +24,7 @@ foo (void)
void
bar (void)
{
- int a;
+ int a; /* { dg-warning "set but not used" } */
int b;
int c; /* { dg-warning "set but not used" } */
a = 1;
@@ -36,7 +36,7 @@ bar (void)
void
baz (void)
{
- int a;
+ int a; /* { dg-warning "set but not used" } */
int b;
int c;
int d;
diff --git a/gcc/testsuite/c-c++-common/Wvarargs.c b/gcc/testsuite/c-c++-common/Wvarargs.c
index ea86ba3..71f24f8 100644
--- a/gcc/testsuite/c-c++-common/Wvarargs.c
+++ b/gcc/testsuite/c-c++-common/Wvarargs.c
@@ -50,6 +50,6 @@ foo3 (int a, register int b, ...) // { dg-warning "ISO C\\+\\+17 does not allow
{
va_list vp;
/* 'b' is declared with register storage, so warn. */
- va_start (vp, b); /* { dg-warning "undefined behavior" } */
+ va_start (vp, b); /* { dg-warning "undefined behavior" "" { target { c || c++23_down } } } */
va_end (vp);
}
diff --git a/gcc/testsuite/c-c++-common/analyzer/analyzer-verbosity-2a.c b/gcc/testsuite/c-c++-common/analyzer/analyzer-verbosity-2a.c
index cf014b0..175d9c3 100644
--- a/gcc/testsuite/c-c++-common/analyzer/analyzer-verbosity-2a.c
+++ b/gcc/testsuite/c-c++-common/analyzer/analyzer-verbosity-2a.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-fanalyzer-verbosity=2" } */
+/* { dg-additional-options "-fanalyzer-verbosity=2 -fno-exceptions" } */
typedef struct FILE FILE;
diff --git a/gcc/testsuite/c-c++-common/analyzer/analyzer-verbosity-3a.c b/gcc/testsuite/c-c++-common/analyzer/analyzer-verbosity-3a.c
index b0ece20..8d66c8f 100644
--- a/gcc/testsuite/c-c++-common/analyzer/analyzer-verbosity-3a.c
+++ b/gcc/testsuite/c-c++-common/analyzer/analyzer-verbosity-3a.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-fanalyzer-verbosity=3" } */
+/* { dg-additional-options "-fanalyzer-verbosity=3 -fno-exceptions" } */
typedef struct FILE FILE;
diff --git a/gcc/testsuite/c-c++-common/analyzer/attr-const-2.c b/gcc/testsuite/c-c++-common/analyzer/attr-const-2.c
index ab79514..5329a89 100644
--- a/gcc/testsuite/c-c++-common/analyzer/attr-const-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/attr-const-2.c
@@ -1,5 +1,5 @@
extern int const_p (int) __attribute__((const));
-extern void do_stuff (void);
+extern void do_stuff (void) __attribute__((nothrow));
void test (int a)
{
diff --git a/gcc/testsuite/c-c++-common/analyzer/attr-malloc-4.c b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-4.c
index 1517667..1e2e1f9 100644
--- a/gcc/testsuite/c-c++-common/analyzer/attr-malloc-4.c
+++ b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-4.c
@@ -2,7 +2,7 @@
struct foo;
extern void foo_release (struct foo *)
- __attribute__((nonnull));
+ __attribute__((nonnull, nothrow));
extern struct foo *foo_acquire (void)
__attribute__ ((malloc (foo_release)));
diff --git a/gcc/testsuite/c-c++-common/analyzer/attr-malloc-5.c b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-5.c
index 7ff4e57..8b7ffc1 100644
--- a/gcc/testsuite/c-c++-common/analyzer/attr-malloc-5.c
+++ b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-5.c
@@ -1,7 +1,7 @@
/* Example of extra argument to "malloc" attribute. */
struct foo;
-extern void foo_release (int, struct foo *);
+extern void foo_release (int, struct foo *) __attribute__((nothrow));
extern struct foo *foo_acquire (void)
__attribute__ ((malloc (foo_release, 2)));
diff --git a/gcc/testsuite/c-c++-common/analyzer/attr-malloc-6.c b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-6.c
index 1665d41..45ee406f 100644
--- a/gcc/testsuite/c-c++-common/analyzer/attr-malloc-6.c
+++ b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-6.c
@@ -1,4 +1,5 @@
/* Adapted from gcc.dg/Wmismatched-dealloc.c. */
+/* { dg-additional-options "-fno-exceptions" } */
#define A(...) __attribute__ ((malloc (__VA_ARGS__)))
diff --git a/gcc/testsuite/c-c++-common/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c
index 87ad42a..fd51630 100644
--- a/gcc/testsuite/c-c++-common/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c
+++ b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c
@@ -1,6 +1,8 @@
/* Adapted from linux 5.3.11: drivers/net/wireless/ath/ath10k/usb.c
Reduced reproducer for CVE-2019-19078 (leak of struct urb). */
+/* { dg-additional-options "-fno-exceptions" } */
+
typedef unsigned char u8;
typedef unsigned short u16;
diff --git a/gcc/testsuite/c-c++-common/analyzer/attr-malloc-exception.c b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-exception.c
new file mode 100644
index 0000000..9f5e2e8
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-exception.c
@@ -0,0 +1,17 @@
+/* { dg-additional-options "-fexceptions" } */
+
+extern void free (void *);
+
+/* Not marked "nothrow", so assume it could throw. */
+char *xstrdup (const char *)
+ __attribute__((malloc (free), returns_nonnull));
+
+void test_1 (const char *s, const char *t)
+{
+ char *p = xstrdup (s); /* { dg-message "allocated here" } */
+ char *q = xstrdup (t); /* { dg-warning "leak of 'p'" } */
+ /* { dg-message "if .* throws an exception\.\.\." "" { target *-*-* } .-1 } */
+
+ free (q);
+ free (p);
+}
diff --git a/gcc/testsuite/c-c++-common/analyzer/call-summaries-pr107158-2.c b/gcc/testsuite/c-c++-common/analyzer/call-summaries-pr107158-2.c
index b395623..a15ab65 100644
--- a/gcc/testsuite/c-c++-common/analyzer/call-summaries-pr107158-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/call-summaries-pr107158-2.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-fanalyzer-call-summaries -Wno-analyzer-too-complex -Wno-analyzer-symbol-too-complex" } */
+/* { dg-additional-options "-fanalyzer-call-summaries -Wno-analyzer-too-complex -Wno-analyzer-symbol-too-complex -fno-exceptions" } */
/* { dg-skip-if "c++98 has no noreturn attribute" { c++98_only } } */
#ifdef __cplusplus
diff --git a/gcc/testsuite/c-c++-common/analyzer/call-summaries-pr107158.c b/gcc/testsuite/c-c++-common/analyzer/call-summaries-pr107158.c
index de70583..6fbbce4 100644
--- a/gcc/testsuite/c-c++-common/analyzer/call-summaries-pr107158.c
+++ b/gcc/testsuite/c-c++-common/analyzer/call-summaries-pr107158.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-fanalyzer-call-summaries -Wno-analyzer-symbol-too-complex" } */
+/* { dg-additional-options "-fanalyzer-call-summaries -Wno-analyzer-symbol-too-complex -fno-exceptions" } */
typedef __SIZE_TYPE__ size_t;
enum { _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)) };
diff --git a/gcc/testsuite/c-c++-common/analyzer/capacity-2.c b/gcc/testsuite/c-c++-common/analyzer/capacity-2.c
index 7d2de4e..3846239 100644
--- a/gcc/testsuite/c-c++-common/analyzer/capacity-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/capacity-2.c
@@ -1,5 +1,6 @@
/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-skip-if "requires hosted libstdc++ for stdlib size_t" { ! hostedlib } } */
+/* { dg-additional-options "-fno-exceptions" } */
#include <stdlib.h>
#include "analyzer-decls.h"
diff --git a/gcc/testsuite/c-c++-common/analyzer/coreutils-sum-pr108666.c b/gcc/testsuite/c-c++-common/analyzer/coreutils-sum-pr108666.c
index c41b61d..95091e7 100644
--- a/gcc/testsuite/c-c++-common/analyzer/coreutils-sum-pr108666.c
+++ b/gcc/testsuite/c-c++-common/analyzer/coreutils-sum-pr108666.c
@@ -1,5 +1,7 @@
/* Reduced from coreutils's sum.c: bsd_sum_stream */
+/* { dg-additional-options "-fno-exceptions" } */
+
typedef __SIZE_TYPE__ size_t;
typedef unsigned char __uint8_t;
typedef unsigned long int __uintmax_t;
diff --git a/gcc/testsuite/c-c++-common/analyzer/data-model-22.c b/gcc/testsuite/c-c++-common/analyzer/data-model-22.c
index 8429b2f..65bf346 100644
--- a/gcc/testsuite/c-c++-common/analyzer/data-model-22.c
+++ b/gcc/testsuite/c-c++-common/analyzer/data-model-22.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-fno-exceptions" } */
+
#include <string.h>
#include "analyzer-decls.h"
diff --git a/gcc/testsuite/c-c++-common/analyzer/data-model-5d.c b/gcc/testsuite/c-c++-common/analyzer/data-model-5d.c
index a86d506..bb45917 100644
--- a/gcc/testsuite/c-c++-common/analyzer/data-model-5d.c
+++ b/gcc/testsuite/c-c++-common/analyzer/data-model-5d.c
@@ -1,4 +1,5 @@
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
+/* { dg-additional-options "-fno-exceptions" } */
/* A toy re-implementation of CPython's object model. */
diff --git a/gcc/testsuite/c-c++-common/analyzer/data-model-path-1.c b/gcc/testsuite/c-c++-common/analyzer/data-model-path-1.c
index d7058ea..0609dc8 100644
--- a/gcc/testsuite/c-c++-common/analyzer/data-model-path-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/data-model-path-1.c
@@ -3,7 +3,7 @@
static int *__attribute__((noinline))
callee (void)
{
- return NULL;
+ return NULL; /* { dg-message "using NULL here" } */
}
void test_1 (void)
diff --git a/gcc/testsuite/c-c++-common/analyzer/deref-before-check-pr108455-git-pack-revindex.c b/gcc/testsuite/c-c++-common/analyzer/deref-before-check-pr108455-git-pack-revindex.c
index 7431bd1..b790997 100644
--- a/gcc/testsuite/c-c++-common/analyzer/deref-before-check-pr108455-git-pack-revindex.c
+++ b/gcc/testsuite/c-c++-common/analyzer/deref-before-check-pr108455-git-pack-revindex.c
@@ -1,4 +1,5 @@
/* Reduced from git-2.39.0's pack-revindex.c */
+/* { dg-additional-options "-fno-exceptions" } */
typedef unsigned int __uint32_t;
typedef unsigned long int __uintmax_t;
diff --git a/gcc/testsuite/c-c++-common/analyzer/deref-before-check-pr108475-haproxy-tcpcheck.c b/gcc/testsuite/c-c++-common/analyzer/deref-before-check-pr108475-haproxy-tcpcheck.c
index 7123cf5..a7f8049 100644
--- a/gcc/testsuite/c-c++-common/analyzer/deref-before-check-pr108475-haproxy-tcpcheck.c
+++ b/gcc/testsuite/c-c++-common/analyzer/deref-before-check-pr108475-haproxy-tcpcheck.c
@@ -1,6 +1,7 @@
/* Reduced from haproxy-2.7.1: src/tcpcheck.c. */
/* { dg-additional-options "-Wno-analyzer-too-complex" } */
+/* { dg-additional-options "-fno-exceptions" } */
typedef __SIZE_TYPE__ size_t;
diff --git a/gcc/testsuite/c-c++-common/analyzer/edges-2.c b/gcc/testsuite/c-c++-common/analyzer/edges-2.c
index 7e4543c..df4bfaa 100644
--- a/gcc/testsuite/c-c++-common/analyzer/edges-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/edges-2.c
@@ -1,5 +1,7 @@
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
+/* { dg-additional-options "-fno-exceptions" } */
+
#include <stdlib.h>
int foo ();
diff --git a/gcc/testsuite/c-c++-common/analyzer/fd-2.c b/gcc/testsuite/c-c++-common/analyzer/fd-2.c
index 10c9ecd..b6b0a57 100644
--- a/gcc/testsuite/c-c++-common/analyzer/fd-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/fd-2.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-fno-exceptions" } */
+
int open(const char *, int mode);
void close(int fd);
#define O_RDONLY 0
@@ -61,4 +63,4 @@ test_5 (const char *path, mode_t mode)
int fd = creat (path, mode);
close(fd);
close(fd); /* { dg-warning "double 'close' of file descriptor 'fd' \\\[CWE-1341\\\]" "warning" } */
-} \ No newline at end of file
+}
diff --git a/gcc/testsuite/c-c++-common/analyzer/fd-3.c b/gcc/testsuite/c-c++-common/analyzer/fd-3.c
index 8e71b14..4894b64 100644
--- a/gcc/testsuite/c-c++-common/analyzer/fd-3.c
+++ b/gcc/testsuite/c-c++-common/analyzer/fd-3.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-fno-exceptions" } */
+
int open(const char *, int mode);
void close(int fd);
int write (int fd, void *buf, int nbytes);
diff --git a/gcc/testsuite/c-c++-common/analyzer/fd-glibc-byte-stream-socket.c b/gcc/testsuite/c-c++-common/analyzer/fd-glibc-byte-stream-socket.c
index fd57d3b..2a44e45 100644
--- a/gcc/testsuite/c-c++-common/analyzer/fd-glibc-byte-stream-socket.c
+++ b/gcc/testsuite/c-c++-common/analyzer/fd-glibc-byte-stream-socket.c
@@ -5,6 +5,8 @@
/* { dg-additional-options "-fno-exceptions" } */
/* { dg-skip-if "" { hppa*-*-hpux* powerpc*-*-aix* } } */
+/* On vxworks, netinet/in.h indirectly includes atomic, that requires C++11. */
+/* { dg-skip-if "" { *-*-vxworks* && { c++ && { ! c++11 } } } } */
#include <stdio.h>
#include <string.h>
diff --git a/gcc/testsuite/c-c++-common/analyzer/fd-meaning.c b/gcc/testsuite/c-c++-common/analyzer/fd-meaning.c
index 6a9ec92..bd0d458a 100644
--- a/gcc/testsuite/c-c++-common/analyzer/fd-meaning.c
+++ b/gcc/testsuite/c-c++-common/analyzer/fd-meaning.c
@@ -1,4 +1,5 @@
- /* { dg-additional-options "-fanalyzer-verbose-state-changes" } */
+/* { dg-additional-options "-fno-exceptions" } */
+/* { dg-additional-options "-fanalyzer-verbose-state-changes" } */
int open(const char *, int mode);
void close(int fd);
@@ -34,4 +35,4 @@ void test_3 (const char* path)
close(fd); /* { dg-message "meaning: \\{verb: 'release', noun: 'resource'\\}" } */
close(fd); /* { dg-warning "double 'close' of file descriptor 'fd' \\\[CWE-1341\\\]" } */
}
-} \ No newline at end of file
+}
diff --git a/gcc/testsuite/c-c++-common/analyzer/file-1.c b/gcc/testsuite/c-c++-common/analyzer/file-1.c
index 316cbb3..e87cf73 100644
--- a/gcc/testsuite/c-c++-common/analyzer/file-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/file-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-fno-exceptions" } */
+
typedef struct FILE FILE;
FILE* fopen (const char*, const char*);
diff --git a/gcc/testsuite/c-c++-common/analyzer/file-3.c b/gcc/testsuite/c-c++-common/analyzer/file-3.c
index 8f93a98..ca992bf 100644
--- a/gcc/testsuite/c-c++-common/analyzer/file-3.c
+++ b/gcc/testsuite/c-c++-common/analyzer/file-3.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-fno-exceptions" } */
+
typedef struct _IO_FILE FILE;
extern struct _IO_FILE *stderr;
diff --git a/gcc/testsuite/c-c++-common/analyzer/file-meaning-1.c b/gcc/testsuite/c-c++-common/analyzer/file-meaning-1.c
index 66b72a7..c9aee5e 100644
--- a/gcc/testsuite/c-c++-common/analyzer/file-meaning-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/file-meaning-1.c
@@ -1,3 +1,4 @@
+/* { dg-additional-options "-fno-exceptions" } */
/* { dg-additional-options "-fanalyzer-verbose-state-changes" } */
typedef struct FILE FILE;
diff --git a/gcc/testsuite/c-c++-common/analyzer/hard-reg-1.c b/gcc/testsuite/c-c++-common/analyzer/hard-reg-1.c
new file mode 100644
index 0000000..d22a5b5
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/analyzer/hard-reg-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile { target x86_64-*-* } } */
+
+void *
+get_from_hard_reg (void)
+{
+ register void *sp asm ("sp");
+ return sp;
+}
diff --git a/gcc/testsuite/c-c++-common/analyzer/infinite-recursion.c b/gcc/testsuite/c-c++-common/analyzer/infinite-recursion.c
index 6b7d25c..bbbb68e 100644
--- a/gcc/testsuite/c-c++-common/analyzer/infinite-recursion.c
+++ b/gcc/testsuite/c-c++-common/analyzer/infinite-recursion.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-fno-exceptions" } */
+
extern void marker_A(void);
extern void marker_B(void);
extern void marker_C(void);
diff --git a/gcc/testsuite/c-c++-common/analyzer/invalid-shift-1.c b/gcc/testsuite/c-c++-common/analyzer/invalid-shift-1.c
index 08e5272..1b67c07 100644
--- a/gcc/testsuite/c-c++-common/analyzer/invalid-shift-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/invalid-shift-1.c
@@ -12,10 +12,10 @@ _dl_hwcaps_subdirs_build_bitmask (int subdirs, int active)
uint32_t mask;
if (subdirs != 32)
- mask = (1 << subdirs) - 1; /* { dg-message "shift by count \\('33'\\) >= precision of type \\('\[0-9\]+'\\)" } */
+ mask = (1 << subdirs) - 1; /* { dg-message "shift by count \\('33'\\) >= precision of type \\('\[0-9\]+'\\)" "" { xfail c++26 } } */
else
mask = -1;
- return mask ^ ((1U << inactive) - 1); /* { dg-message "shift by negative count \\('-1'\\)" } */
+ return mask ^ ((1U << inactive) - 1); /* { dg-message "shift by negative count \\('-1'\\)" "" { xfail c++26 } } */
}
void f1 (int);
diff --git a/gcc/testsuite/c-c++-common/analyzer/leak-3.c b/gcc/testsuite/c-c++-common/analyzer/leak-3.c
index a386d88..19d7501 100644
--- a/gcc/testsuite/c-c++-common/analyzer/leak-3.c
+++ b/gcc/testsuite/c-c++-common/analyzer/leak-3.c
@@ -1,4 +1,5 @@
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
+/* { dg-additional-options "-fno-exceptions" } */
#include <stdlib.h>
diff --git a/gcc/testsuite/c-c++-common/analyzer/malloc-dedupe-1.c b/gcc/testsuite/c-c++-common/analyzer/malloc-dedupe-1.c
index 8653c67..c296061 100644
--- a/gcc/testsuite/c-c++-common/analyzer/malloc-dedupe-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/malloc-dedupe-1.c
@@ -1,4 +1,5 @@
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
+/* { dg-additional-options "-fno-exceptions" } */
#include <stdlib.h>
diff --git a/gcc/testsuite/c-c++-common/analyzer/malloc-in-loop.c b/gcc/testsuite/c-c++-common/analyzer/malloc-in-loop.c
index e7179f0..0d86801 100644
--- a/gcc/testsuite/c-c++-common/analyzer/malloc-in-loop.c
+++ b/gcc/testsuite/c-c++-common/analyzer/malloc-in-loop.c
@@ -1,4 +1,5 @@
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
+/* { dg-additional-options "-fno-exceptions" } */
#include <stdlib.h>
#include "../../gcc.dg/analyzer/analyzer-decls.h"
diff --git a/gcc/testsuite/c-c++-common/analyzer/malloc-many-paths-3.c b/gcc/testsuite/c-c++-common/analyzer/malloc-many-paths-3.c
index 6ee30f3..5daa696 100644
--- a/gcc/testsuite/c-c++-common/analyzer/malloc-many-paths-3.c
+++ b/gcc/testsuite/c-c++-common/analyzer/malloc-many-paths-3.c
@@ -1,4 +1,5 @@
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
+/* { dg-additional-options "-fno-exceptions" } */
#include <stdlib.h>
diff --git a/gcc/testsuite/c-c++-common/analyzer/malloc-paths-5.c b/gcc/testsuite/c-c++-common/analyzer/malloc-paths-5.c
index f03f978..4a1870d 100644
--- a/gcc/testsuite/c-c++-common/analyzer/malloc-paths-5.c
+++ b/gcc/testsuite/c-c++-common/analyzer/malloc-paths-5.c
@@ -1,4 +1,5 @@
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
+/* { dg-additional-options "-fno-exceptions" } */
#include <stdio.h>
#include <stdlib.h>
diff --git a/gcc/testsuite/c-c++-common/analyzer/malloc-paths-7.c b/gcc/testsuite/c-c++-common/analyzer/malloc-paths-7.c
index 766bbe7..12b93b2 100644
--- a/gcc/testsuite/c-c++-common/analyzer/malloc-paths-7.c
+++ b/gcc/testsuite/c-c++-common/analyzer/malloc-paths-7.c
@@ -1,4 +1,5 @@
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
+/* { dg-additional-options "-fno-exceptions" } */
#include <stdlib.h>
diff --git a/gcc/testsuite/c-c++-common/analyzer/malloc-paths-8.c b/gcc/testsuite/c-c++-common/analyzer/malloc-paths-8.c
index 77e3e02..8af84ed 100644
--- a/gcc/testsuite/c-c++-common/analyzer/malloc-paths-8.c
+++ b/gcc/testsuite/c-c++-common/analyzer/malloc-paths-8.c
@@ -1,3 +1,4 @@
+/* { dg-additional-options "-fno-exceptions" } */
/* { dg-additional-options "-fanalyzer-transitivity" } */
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
diff --git a/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-1a.c b/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-1a.c
index 4e40833..ffb0ffe 100644
--- a/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-1a.c
+++ b/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-1a.c
@@ -1,3 +1,4 @@
+/* { dg-additional-options "-fno-exceptions" } */
/* { dg-additional-options "-fno-analyzer-call-summaries -fanalyzer-transitivity" } */
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
diff --git a/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-2.c b/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-2.c
index 36ec510..052b401 100644
--- a/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-2.c
@@ -1,4 +1,5 @@
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
+/* { dg-additional-options "-fno-exceptions" } */
#include <stdlib.h>
#include "analyzer-decls.h"
diff --git a/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-3.c b/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-3.c
index 70b3edd..258706c 100644
--- a/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-3.c
+++ b/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-3.c
@@ -1,4 +1,5 @@
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
+/* { dg-additional-options "-fno-exceptions" } */
#include <stdlib.h>
#include "analyzer-decls.h"
diff --git a/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c b/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c
index c5f1fa4..4f04e46 100644
--- a/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c
+++ b/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c
@@ -66,7 +66,7 @@ static inline struct connection *__objt_conn(enum obj_type *t)
static inline struct connection *objt_conn(enum obj_type *t)
{
if (!t || *t != OBJ_TYPE_CONN)
- return (struct connection *) ((void *)0);
+ return (struct connection *) ((void *)0); /* { dg-message "using NULL here" } */
return __objt_conn(t);
}
struct session {
@@ -85,7 +85,7 @@ smp_fetch_ssl_fc_has_early(const struct arg *args, struct sample *smp, const cha
SSL *ssl;
struct connection *conn;
- conn = objt_conn(smp->sess->origin);
+ conn = objt_conn(smp->sess->origin); /* { dg-message "return of NULL" } */
ssl = ssl_sock_get_ssl_object(conn);
if (!ssl)
return 0;
diff --git a/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108400-SoftEtherVPN-WebUi.c b/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108400-SoftEtherVPN-WebUi.c
index 9dcf7aa..0ebeeff 100644
--- a/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108400-SoftEtherVPN-WebUi.c
+++ b/gcc/testsuite/c-c++-common/analyzer/null-deref-pr108400-SoftEtherVPN-WebUi.c
@@ -60,7 +60,7 @@ void WuExpireSessionKey(WEBUI *wu)
for(i=0; i<LIST_NUM(wu->Contexts); i++)
{
- STRMAP_ENTRY *entry = (STRMAP_ENTRY*)LIST_DATA(wu->Contexts, i);
+ STRMAP_ENTRY *entry = (STRMAP_ENTRY*)LIST_DATA(wu->Contexts, i); /* { dg-message "'entry' is NULL" } */
WU_CONTEXT *context = (WU_CONTEXT*)entry->Value; /* { dg-bogus "dereference of NULL 'entry'" "PR analyzer/108400" { xfail *-*-* } } */
if(context->ExpireDate < Tick64())
{
diff --git a/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-1-json.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-1-json.c
deleted file mode 100644
index 0a2cc34..0000000
--- a/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-1-json.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/* { dg-additional-options "-fdiagnostics-format=json-file" } */
-
-/* The custom JSON format doesn't support text art, so this is just a simple
- smoketext. */
-
-#include <stdint.h>
-
-int32_t arr[10];
-
-void int_arr_write_element_after_end_off_by_one(int32_t x)
-{
- arr[10] = x;
-}
diff --git a/gcc/testsuite/c-c++-common/analyzer/paths-7.c b/gcc/testsuite/c-c++-common/analyzer/paths-7.c
index 2743de5..f7c5cbf 100644
--- a/gcc/testsuite/c-c++-common/analyzer/paths-7.c
+++ b/gcc/testsuite/c-c++-common/analyzer/paths-7.c
@@ -1,4 +1,5 @@
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
+/* { dg-additional-options "-fno-exceptions" } */
#include <stdlib.h>
#include "analyzer-decls.h"
diff --git a/gcc/testsuite/c-c++-common/analyzer/pr110830.c b/gcc/testsuite/c-c++-common/analyzer/pr110830.c
index f5a39b7..ebfd38d 100644
--- a/gcc/testsuite/c-c++-common/analyzer/pr110830.c
+++ b/gcc/testsuite/c-c++-common/analyzer/pr110830.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-fno-exceptions" } */
+
typedef __SIZE_TYPE__ size_t;
void free(void *);
diff --git a/gcc/testsuite/c-c++-common/analyzer/pr93032-mztools-simplified.c b/gcc/testsuite/c-c++-common/analyzer/pr93032-mztools-simplified.c
index 4a08f0f1..e389e43 100644
--- a/gcc/testsuite/c-c++-common/analyzer/pr93032-mztools-simplified.c
+++ b/gcc/testsuite/c-c++-common/analyzer/pr93032-mztools-simplified.c
@@ -1,4 +1,5 @@
/* { dg-do "compile" } */
+/* { dg-additional-options "-fno-exceptions" } */
/* Minimal replacement of system headers. */
#define NULL ((void *) 0)
diff --git a/gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-feasibility-3.c b/gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-feasibility-3.c
index 50d3388..19a3023 100644
--- a/gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-feasibility-3.c
+++ b/gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-feasibility-3.c
@@ -3,6 +3,7 @@
Adapted from intl/localealias.c, with all #includes removed. */
/* { dg-do "compile" } */
+/* { dg-additional-options "-fno-exceptions" } */
/* Handle aliases for locale names.
Copyright (C) 1995-1999, 2000-2001, 2003 Free Software Foundation, Inc.
diff --git a/gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-simplified.c b/gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-simplified.c
index 6f65add..45517468 100644
--- a/gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-simplified.c
+++ b/gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-simplified.c
@@ -3,6 +3,7 @@
Adapted from intl/localealias.c, with all #includes removed. */
/* { dg-do "compile" } */
+/* { dg-additional-options "-fno-exceptions" } */
/* Handle aliases for locale names.
Copyright (C) 1995-1999, 2000-2001, 2003 Free Software Foundation, Inc.
diff --git a/gcc/testsuite/c-c++-common/analyzer/pr96650-1-trans.c b/gcc/testsuite/c-c++-common/analyzer/pr96650-1-trans.c
index b20630b..fb194ad 100644
--- a/gcc/testsuite/c-c++-common/analyzer/pr96650-1-trans.c
+++ b/gcc/testsuite/c-c++-common/analyzer/pr96650-1-trans.c
@@ -1,4 +1,5 @@
/* { dg-additional-options "-O2 -fanalyzer-transitivity" } */
+/* { dg-additional-options "-fno-exceptions" } */
int *wf;
diff --git a/gcc/testsuite/c-c++-common/analyzer/pr97072.c b/gcc/testsuite/c-c++-common/analyzer/pr97072.c
index 4024124..82411a1 100644
--- a/gcc/testsuite/c-c++-common/analyzer/pr97072.c
+++ b/gcc/testsuite/c-c++-common/analyzer/pr97072.c
@@ -1,4 +1,4 @@
-void unknown_fn_1 (void *);
+void unknown_fn_1 (void *) __attribute__((nothrow));
void test_1 (int co, int y)
{
diff --git a/gcc/testsuite/c-c++-common/analyzer/pr98575-1.c b/gcc/testsuite/c-c++-common/analyzer/pr98575-1.c
index 6472e76..b8ddf77 100644
--- a/gcc/testsuite/c-c++-common/analyzer/pr98575-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/pr98575-1.c
@@ -4,7 +4,7 @@
void **g;
-extern void unknown_fn (void);
+extern void unknown_fn (void) __attribute__((nothrow));
/* Without a call to unknown_fn. */
diff --git a/gcc/testsuite/c-c++-common/analyzer/pr99716-1.c b/gcc/testsuite/c-c++-common/analyzer/pr99716-1.c
index 41be8ca..60f3a598 100644
--- a/gcc/testsuite/c-c++-common/analyzer/pr99716-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/pr99716-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-fno-exceptions" } */
+
typedef struct FILE FILE;
FILE* fopen (const char*, const char*);
diff --git a/gcc/testsuite/c-c++-common/analyzer/pr99716-2.c b/gcc/testsuite/c-c++-common/analyzer/pr99716-2.c
index ef7cc5f..caf5c86 100644
--- a/gcc/testsuite/c-c++-common/analyzer/pr99716-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/pr99716-2.c
@@ -1,4 +1,5 @@
/* { dg-skip-if "requires hosted libstdc++ for stdlib rand" { ! hostedlib } } */
+/* { dg-additional-options "-fno-exceptions" } */
/* Reduced from
https://github.com/libguestfs/libguestfs/blob/e0a11061035d47b118c95706240bcc17fd576edc/tests/mount-local/test-parallel-mount-local.c#L299-L335
diff --git a/gcc/testsuite/c-c++-common/analyzer/pr99716-3.c b/gcc/testsuite/c-c++-common/analyzer/pr99716-3.c
index 414d57e..98f656f 100644
--- a/gcc/testsuite/c-c++-common/analyzer/pr99716-3.c
+++ b/gcc/testsuite/c-c++-common/analyzer/pr99716-3.c
@@ -1,4 +1,5 @@
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
+/* { dg-additional-options "-fno-exceptions" } */
#include <stdlib.h>
diff --git a/gcc/testsuite/c-c++-common/analyzer/pragma-2.c b/gcc/testsuite/c-c++-common/analyzer/pragma-2.c
index bd96a25..f309876 100644
--- a/gcc/testsuite/c-c++-common/analyzer/pragma-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/pragma-2.c
@@ -1,6 +1,7 @@
/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* Verify that we can disable -Wanalyzer-too-complex via pragmas. */
/* { dg-additional-options "-Wanalyzer-too-complex -Werror=analyzer-too-complex -fno-analyzer-state-merge -g" } */
+/* { dg-additional-options "-fno-exceptions" } */
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
#include <stdlib.h>
diff --git a/gcc/testsuite/c-c++-common/analyzer/realloc-1.c b/gcc/testsuite/c-c++-common/analyzer/realloc-1.c
index 04925cf..0bb846c 100644
--- a/gcc/testsuite/c-c++-common/analyzer/realloc-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/realloc-1.c
@@ -92,5 +92,5 @@ void test_9 (void *p)
void test_10 (char *s, int n)
{
__builtin_realloc(s, n); /* { dg-warning "ignoring return value of '__builtin_realloc' declared with attribute 'warn_unused_result'" "" { target c } } */
- /* { dg-warning "ignoring return value of 'void\\* __builtin_realloc\\(void\\*, (long )?unsigned int\\)' declared with attribute 'warn_unused_result'" "" { target c++ } .-1 } */
+ /* { dg-warning "ignoring return value of 'void\\* __builtin_realloc\\(void\\*, (long )*unsigned int\\)' declared with attribute 'warn_unused_result'" "" { target c++ } .-1 } */
} /* { dg-warning "leak" } */
diff --git a/gcc/testsuite/c-c++-common/analyzer/rhbz1878600.c b/gcc/testsuite/c-c++-common/analyzer/rhbz1878600.c
index 9f6ccb6..9606044 100644
--- a/gcc/testsuite/c-c++-common/analyzer/rhbz1878600.c
+++ b/gcc/testsuite/c-c++-common/analyzer/rhbz1878600.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-fno-exceptions" } */
+
#include <stdio.h>
#define INI_MAX_LINE 200
diff --git a/gcc/testsuite/c-c++-common/analyzer/sprintf-3.c b/gcc/testsuite/c-c++-common/analyzer/sprintf-3.c
new file mode 100644
index 0000000..ac5169e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/analyzer/sprintf-3.c
@@ -0,0 +1,44 @@
+/* See e.g. https://en.cppreference.com/w/c/io/fprintf
+ and https://www.man7.org/linux/man-pages/man3/sprintf.3.html */
+
+extern int
+sprintf(char* dst, const char* fmt, ...)
+ __attribute__((__nothrow__));
+
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
+
+void test_text_ok (void)
+{
+ char buf[16];
+ sprintf (buf, "hello world");
+}
+
+void test_text_oob (void)
+{
+ char buf[3];
+ sprintf (buf, "hello world"); /* { dg-warning "out-of-bounds" "PR analyzer/107017" { xfail *-*-* } } */
+}
+
+void test_percent_s_ok (void)
+{
+ char buf[16];
+ sprintf (buf, "%s", "foo");
+}
+
+void test_percent_s_oob (void)
+{
+ char buf[3];
+ sprintf (buf, "%s", "foo"); /* { dg-warning "out-of-bounds" "PR analyzer/107017" { xfail *-*-* } } */
+}
+
+void test_percent_i_ok (void)
+{
+ char buf[16];
+ sprintf (buf, "%i", "42");
+}
+
+void test_percent_i_oob (void)
+{
+ char buf[4];
+ sprintf (buf, "%i", "1066"); /* { dg-warning "out-of-bounds" "PR analyzer/107017" { xfail *-*-* } } */
+}
diff --git a/gcc/testsuite/c-c++-common/analyzer/strndup-1.c b/gcc/testsuite/c-c++-common/analyzer/strndup-1.c
index 3f90afe..915f220 100644
--- a/gcc/testsuite/c-c++-common/analyzer/strndup-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/strndup-1.c
@@ -1,6 +1,7 @@
/* { dg-skip-if "no strndup in libc" { *-*-darwin[789]* *-*-darwin10* hppa*-*-hpux* *-*-mingw* *-*-vxworks* } } */
/* { dg-additional-options "-D_POSIX_C_SOURCE=200809L" } */
/* { dg-skip-if "requires hosted libstdc++ for stdlib free" { ! hostedlib } } */
+/* { dg-additional-options "-fno-exceptions" } */
#include <string.h>
#include <stdlib.h>
diff --git a/gcc/testsuite/c-c++-common/analyzer/strtok-cppreference.c b/gcc/testsuite/c-c++-common/analyzer/strtok-cppreference.c
index a396c64..9611727 100644
--- a/gcc/testsuite/c-c++-common/analyzer/strtok-cppreference.c
+++ b/gcc/testsuite/c-c++-common/analyzer/strtok-cppreference.c
@@ -13,7 +13,7 @@
/* { dg-additional-options " -Wno-analyzer-too-complex -Wno-analyzer-symbol-too-complex" } */
-#define __STDC_WANT_LIB_EXT1__ 0
+#define __STDC_WANT_LIB_EXT1__ 1
#include <string.h>
#include <stdio.h>
diff --git a/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-4-disabled.c b/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-4-disabled.c
index 868c393..1aa4159 100644
--- a/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-4-disabled.c
+++ b/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-4-disabled.c
@@ -2,6 +2,7 @@
region_model_context_decorator::add_note. */
/* { dg-additional-options "-Wno-analyzer-write-to-string-literal" } */
+/* { dg-additional-options "-fno-exceptions" } */
typedef __SIZE_TYPE__ size_t;
diff --git a/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-4.c b/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-4.c
index 971e8f3..b60fba0 100644
--- a/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-4.c
+++ b/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-4.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-fno-exceptions" } */
+
typedef __SIZE_TYPE__ size_t;
int getrandom (void *__buffer, size_t __length, /* { dg-line getrandom } */
diff --git a/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-5.c b/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-5.c
index 2ecad8c..78b2204 100644
--- a/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-5.c
+++ b/gcc/testsuite/c-c++-common/analyzer/write-to-string-literal-5.c
@@ -2,6 +2,7 @@
notes) works. */
/* { dg-additional-options "-fanalyzer-show-duplicate-count" } */
+/* { dg-additional-options "-fno-exceptions" } */
#include "../../gcc.dg/analyzer/analyzer-decls.h"
diff --git a/gcc/testsuite/c-c++-common/analyzer/zlib-5.c b/gcc/testsuite/c-c++-common/analyzer/zlib-5.c
index 1e3746d..fa82e43 100644
--- a/gcc/testsuite/c-c++-common/analyzer/zlib-5.c
+++ b/gcc/testsuite/c-c++-common/analyzer/zlib-5.c
@@ -1,4 +1,5 @@
/* { dg-additional-options "-O3" } */
+/* { dg-additional-options "-fno-exceptions" } */
#include "analyzer-decls.h"
diff --git a/gcc/testsuite/c-c++-common/asan/asan-stack-small.c b/gcc/testsuite/c-c++-common/asan/asan-stack-small.c
index 11a56b8..d045406 100644
--- a/gcc/testsuite/c-c++-common/asan/asan-stack-small.c
+++ b/gcc/testsuite/c-c++-common/asan/asan-stack-small.c
@@ -1,8 +1,9 @@
/* { dg-do run } */
-char *pa;
-char *pb;
-char *pc;
+char *volatile pa;
+char *volatile pb;
+char *volatile pc;
+typedef __UINTPTR_TYPE__ uintptr_t;
void access (volatile char *ptr)
{
@@ -22,7 +23,14 @@ int main (int argc, char **argv)
access (pb);
access (pc);
// access 'b' here
- access (pa + 32);
+ if ((uintptr_t) pb == (uintptr_t) pa + 32)
+ access (pa + 32);
+ else if ((uintptr_t) pb == (uintptr_t) pa - 32)
+ access (pa - 32);
+ else if ((uintptr_t) pb == (uintptr_t) pa + 64)
+ access (pa + 64);
+ else if ((uintptr_t) pb == (uintptr_t) pa - 64)
+ access (pa - 64);
return 0;
}
diff --git a/gcc/testsuite/c-c++-common/asan/pr120608-1.c b/gcc/testsuite/c-c++-common/asan/pr120608-1.c
new file mode 100644
index 0000000..114c42d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/pr120608-1.c
@@ -0,0 +1,43 @@
+/* PR middle-end/120608 */
+/* { dg-do run { target musttail } } */
+/* { dg-options "-O2 -fsanitize=address" } */
+
+__attribute__((noipa)) void
+foo (int *x, int *y, int *z)
+{
+ ++x[0];
+ ++y[0];
+ ++z[0];
+}
+
+__attribute__((noipa)) void
+bar (int *x, int *y, int *z)
+{
+ if (x || y || z)
+ __builtin_abort ();
+}
+
+__attribute__((noipa)) void
+baz (int *x, int *y, int *z)
+{
+ (void) x; (void) y; (void) z;
+ int a = 42, b = -42, c = 0;
+ foo (&a, &b, &c);
+ [[gnu::musttail]] return bar (0, 0, 0);
+}
+
+__attribute__((noipa)) void
+qux (int *x, int *y, int *z)
+{
+ (void) x; (void) y; (void) z;
+ int a = 42, b = -42, c = 0;
+ foo (&a, &b, &c);
+ [[gnu::musttail]] return bar (0, 0, 0);
+}
+
+int
+main ()
+{
+ baz (0, 0, 0);
+ qux (0, 0, 0);
+}
diff --git a/gcc/testsuite/c-c++-common/asan/pr120608-2.c b/gcc/testsuite/c-c++-common/asan/pr120608-2.c
new file mode 100644
index 0000000..251ff3a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/pr120608-2.c
@@ -0,0 +1,39 @@
+/* PR middle-end/120608 */
+/* { dg-do run { target musttail } } */
+/* { dg-options "-O2 -fsanitize=address" } */
+/* { dg-set-target-env-var ASAN_OPTIONS "detect_stack_use_after_return=1" } */
+/* { dg-shouldfail "asan" } */
+
+__attribute__((noipa)) void
+foo (int *x, int *y, int *z)
+{
+ ++x[0];
+ ++y[0];
+ ++z[0];
+}
+
+__attribute__((noipa)) void
+bar (int *x, int *y, int *z)
+{
+ volatile int a = x[0] + y[0] + z[0];
+}
+
+__attribute__((noipa)) void
+baz (int *x, int *y, int *z)
+{
+ (void) x; (void) y; (void) z;
+ int a = 42, b = -42, c = 0;
+ foo (&a, &b, &c);
+ [[gnu::musttail]] return bar (&a, &b, &c); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */
+} /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" "" { target *-*-* } .-1 } */
+ /* { dg-warning "address of automatic variable 'c' passed to 'musttail' call argument" "" { target *-*-* } .-2 } */
+
+int
+main ()
+{
+ baz (0, 0, 0);
+}
+
+// { dg-output "ERROR: AddressSanitizer: stack-use-after-return on address.*(\n|\r\n|\r)" }
+// { dg-output "READ of size .*" }
+// { dg-output ".*'a' \\(line 25\\) <== Memory access at offset \[0-9\]* is inside this variable.*" }
diff --git a/gcc/testsuite/c-c++-common/asan/pr120608-3.c b/gcc/testsuite/c-c++-common/asan/pr120608-3.c
new file mode 100644
index 0000000..8ea4468
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/pr120608-3.c
@@ -0,0 +1,36 @@
+/* PR middle-end/120608 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-fsanitize=address -fno-exceptions" } */
+
+[[gnu::noipa]] int
+foo (int x)
+{
+ return x;
+}
+
+[[gnu::noipa]] void
+bar (int *x, int *y, int *z)
+{
+ (void) x;
+ (void) y;
+ (void) z;
+}
+
+[[gnu::noipa]] int
+baz (int x)
+{
+ int a = 4;
+ {
+ int b = 8;
+ {
+ int c = 10;
+ bar (&a, &b, &c);
+ if (a + b + c == 22)
+ [[gnu::musttail]] return foo (x);
+ bar (&a, &b, &c);
+ }
+ bar (&a, &b, &a);
+ }
+ bar (&a, &a, &a);
+ return 42;
+}
diff --git a/gcc/testsuite/c-c++-common/asan/pr120608-4.c b/gcc/testsuite/c-c++-common/asan/pr120608-4.c
new file mode 100644
index 0000000..86891454
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/pr120608-4.c
@@ -0,0 +1,30 @@
+/* PR middle-end/120608 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-fsanitize=address -fno-exceptions" } */
+
+[[gnu::noipa]] void
+bar (int *x, int *y, int *z)
+{
+ (void) x;
+ (void) y;
+ (void) z;
+}
+
+[[gnu::noipa]] int
+baz (int x)
+{
+ int a = 4;
+ {
+ int b = 8;
+ {
+ int c = 10;
+ bar (&a, &b, &c);
+ if (a + b + c + x == 22)
+ [[gnu::musttail]] return baz (x - 1);
+ bar (&a, &b, &c);
+ }
+ bar (&a, &b, &a);
+ }
+ bar (&a, &a, &a);
+ return 42;
+}
diff --git a/gcc/testsuite/c-c++-common/asan/pr121389-1.c b/gcc/testsuite/c-c++-common/asan/pr121389-1.c
new file mode 100644
index 0000000..0116d7a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/pr121389-1.c
@@ -0,0 +1,23 @@
+// PR middle-end/121389
+// { dg-do compile { target musttail } }
+// { dg-options "-fsanitize=address" }
+
+int foo (void);
+int bar (void);
+int baz (unsigned *);
+
+int
+bar (void)
+{
+ do
+ {
+ unsigned t;
+ int u = baz (&t);
+ if (u == 42)
+ [[gnu::musttail]] return foo ();
+ if (u == -42)
+ break;
+ }
+ while (1);
+ return 42;
+}
diff --git a/gcc/testsuite/c-c++-common/asan/pr121389-2.c b/gcc/testsuite/c-c++-common/asan/pr121389-2.c
new file mode 100644
index 0000000..02914f8
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/pr121389-2.c
@@ -0,0 +1,37 @@
+// PR middle-end/121389
+// { dg-do compile { target musttail } }
+// { dg-options "-fsanitize=address" }
+
+int foo (void);
+int bar (void);
+int baz (unsigned *);
+
+int
+bar (void)
+{
+ for (int a = 0; a < 420; ++a)
+ {
+ for (int b = 0; b < 420; ++b)
+ {
+ for (int c = 0; c < 420; ++c)
+ {
+ unsigned t;
+ int u = baz (&t);
+ if (u == 42)
+ [[gnu::musttail]] return foo ();
+ if (u == -42)
+ break;
+ if (u == 16)
+ goto l1;
+ if (u == 18)
+ goto l2;
+ if (u == 20)
+ goto l3;
+ }
+ l3:;
+ }
+ l2:;
+ }
+ l1:;
+ return 42;
+}
diff --git a/gcc/testsuite/c-c++-common/asan/pr121389-3.c b/gcc/testsuite/c-c++-common/asan/pr121389-3.c
new file mode 100644
index 0000000..5f71e06
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/pr121389-3.c
@@ -0,0 +1,130 @@
+// PR middle-end/121389
+// { dg-do compile { target musttail } }
+// { dg-options "-fsanitize=address" }
+
+int foo (void);
+int bar (void);
+int baz (unsigned *);
+
+int
+bar (void)
+{
+ for (int a = 0; a < 420; ++a)
+ {
+ for (int b = 0; b < 420; ++b)
+ {
+ for (int c = 0; c < 420; ++c)
+ {
+ unsigned t;
+ int u = baz (&t);
+ if (u == 42)
+ [[gnu::musttail]] return foo ();
+ if (u == -42)
+ break;
+ if (u == 16)
+ goto l1;
+ if (u == 18)
+ goto l2;
+ if (u == 20)
+ goto l3;
+ switch (u)
+ {
+ case 100: goto l100;
+ case 101: goto l101;
+ case 102: goto l102;
+ case 103: goto l103;
+ case 104: goto l104;
+ case 105: goto l105;
+ case 106: goto l106;
+ case 107: goto l107;
+ case 108: goto l108;
+ case 109: goto l109;
+ case 110: goto l110;
+ case 111: goto l111;
+ case 112: goto l112;
+ case 113: goto l113;
+ case 114: goto l114;
+ case 115: goto l115;
+ case 116: goto l116;
+ case 117: goto l117;
+ case 118: goto l118;
+ case 119: goto l119;
+ case 120: goto l120;
+ case 121: goto l121;
+ case 122: goto l122;
+ case 123: goto l123;
+ case 124: goto l124;
+ case 125: goto l125;
+ case 126: goto l126;
+ case 127: goto l127;
+ case 128: goto l128;
+ case 129: goto l129;
+ }
+ }
+ l3:;
+ foo ();
+ l100:
+ foo ();
+ l101:
+ foo ();
+ l102:
+ foo ();
+ l103:
+ foo ();
+ l104:
+ foo ();
+ l105:
+ foo ();
+ l106:
+ foo ();
+ l107:
+ foo ();
+ l108:
+ foo ();
+ l109:;
+ }
+ l2:;
+ foo ();
+ l110:
+ foo ();
+ l111:
+ foo ();
+ l112:
+ foo ();
+ l113:
+ foo ();
+ l114:
+ foo ();
+ l115:
+ foo ();
+ l116:
+ foo ();
+ l117:
+ foo ();
+ l118:
+ foo ();
+ l119:;
+ }
+ l1:;
+ foo ();
+ l120:
+ foo ();
+ l121:
+ foo ();
+ l122:
+ foo ();
+ l123:
+ foo ();
+ l124:
+ foo ();
+ l125:
+ foo ();
+ l126:
+ foo ();
+ l127:
+ foo ();
+ l128:
+ foo ();
+ l129:;
+ return 42;
+}
diff --git a/gcc/testsuite/c-c++-common/asan/pr121389-4.c b/gcc/testsuite/c-c++-common/asan/pr121389-4.c
new file mode 100644
index 0000000..2f7b410
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/pr121389-4.c
@@ -0,0 +1,6 @@
+// PR middle-end/121389
+// { dg-do compile { target musttail } }
+// { dg-options "-fsanitize=address -fdisable-tree-switchlower_O0" }
+// { dg-skip-if "" { *-*-* } { "*" } { "-O0" } }
+
+#include "pr121389-3.c"
diff --git a/gcc/testsuite/c-c++-common/asan/pr59063-2.c b/gcc/testsuite/c-c++-common/asan/pr59063-2.c
index 63a547f..6458ea7 100644
--- a/gcc/testsuite/c-c++-common/asan/pr59063-2.c
+++ b/gcc/testsuite/c-c++-common/asan/pr59063-2.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { *-*-linux* *-*-freebsd* } } } */
+/* { dg-do run { target { *-*-linux* *-*-freebsd* *-*-solaris2* } } } */
/* { dg-options "-static-libasan" } */
#include <time.h>
diff --git a/gcc/testsuite/c-c++-common/attr-warn-unused-result-2.c b/gcc/testsuite/c-c++-common/attr-warn-unused-result-2.c
new file mode 100644
index 0000000..f35198d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-warn-unused-result-2.c
@@ -0,0 +1,16 @@
+/* PR c/82134 */
+/* { dg-do compile } */
+/* { dg-additional-options -Wno-c++-compat { target c } } */
+
+struct S {};
+
+__attribute__((warn_unused_result)) struct S foo();
+
+void use_s(struct S);
+
+void
+test (void)
+{
+ struct S s = foo(); /* { dg-bogus "ignoring return value of" } */
+ use_s(foo()); /* { dg-bogus "ignoring return value of" } */
+}
diff --git a/gcc/testsuite/c-c++-common/cpp/comment-ff-1.c b/gcc/testsuite/c-c++-common/cpp/comment-ff-1.c
new file mode 100644
index 0000000..0d071b1
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/comment-ff-1.c
@@ -0,0 +1,12 @@
+// C++26 P2843R3 - Preprocessing is never undefined
+// Test that form-feed followed by non-whitespace
+// in line comments are accepted.
+// { dg-do compile }
+// { dg-options "-pedantic-errors -Wall -W" }
+
+//
+int a;
+//
+int b;
+// comment
+int c;
diff --git a/gcc/testsuite/c-c++-common/cpp/comment-vtab-1.c b/gcc/testsuite/c-c++-common/cpp/comment-vtab-1.c
new file mode 100644
index 0000000..03feb73
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/comment-vtab-1.c
@@ -0,0 +1,12 @@
+// C++26 P2843R3 - Preprocessing is never undefined
+// Test that vertical tab followed by non-whitespace
+// in line comments are accepted.
+// { dg-do compile }
+// { dg-options "-pedantic-errors -Wall -W" }
+
+//
+int a;
+//
+int b;
+// comment
+int c;
diff --git a/gcc/testsuite/c-c++-common/cpp/has-builtin-4.c b/gcc/testsuite/c-c++-common/cpp/has-builtin-4.c
index 65d2b18..186e2f1 100644
--- a/gcc/testsuite/c-c++-common/cpp/has-builtin-4.c
+++ b/gcc/testsuite/c-c++-common/cpp/has-builtin-4.c
@@ -9,7 +9,7 @@
#if __has_builtin (__builtin_va_arg) != 1
#error "no __builtin_va_arg"
#endif
-#if __STDC_VERSION__ >= 202311L
+#if (__STDC_VERSION__ >= 202311L || __cplusplus >= 202400L)
#if __has_builtin (__builtin_c23_va_start) != 1
#error "no __builtin_c23_va_start"
#endif
diff --git a/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-1.c b/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-1.c
index 3651fdd..9ff93f9 100644
--- a/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-1.c
+++ b/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-1.c
@@ -168,6 +168,7 @@ typedef __CHAR32_TYPE__ char32_t;
|| U'\U0003134A' != U'\N{CJK UNIFIED IDEOGRAPH-3134A}' \
|| U'\U00031350' != U'\N{CJK UNIFIED IDEOGRAPH-31350}' \
|| U'\U000323AF' != U'\N{CJK UNIFIED IDEOGRAPH-323AF}' \
+ || U'\U0003340E' != U'\N{CJK UNIFIED IDEOGRAPH-3340E}' \
|| U'\U00013460' != U'\N{EGYPTIAN HIEROGLYPH-13460}' \
|| U'\U000143FA' != U'\N{EGYPTIAN HIEROGLYPH-143FA}' \
|| U'\U00017000' != U'\N{TANGUT IDEOGRAPH-17000}' \
diff --git a/gcc/testsuite/c-c++-common/cpp/pr92296-2.c b/gcc/testsuite/c-c++-common/cpp/pr92296-2.c
index e3f74cd..2594e47 100644
--- a/gcc/testsuite/c-c++-common/cpp/pr92296-2.c
+++ b/gcc/testsuite/c-c++-common/cpp/pr92296-2.c
@@ -39,42 +39,42 @@ filebase2 = __BASE_FILE__ /* { dg-final { scan-file-not pr92296-2.i "filebase2 =
#pragma push_macro("__LINE__")
#undef __LINE__ /* { dg-warning "undefining" } */
-#define __LINE__ 142
+#define __LINE__ 142 /* { dg-warning "defined" } */
line1 = __LINE__ /* { dg-final { scan-file pr92296-2.i "line1 = 142" } } */
#pragma pop_macro("__LINE__")
line2 = __LINE__ /* { dg-final { scan-file pr92296-2.i "line2 = 45" } } */
#pragma push_macro("__INCLUDE_LEVEL__")
#undef __INCLUDE_LEVEL__ /* { dg-warning "undefining" } */
-#define __INCLUDE_LEVEL__ 42
+#define __INCLUDE_LEVEL__ 42 /* { dg-warning "defined" } */
includelevel1 = __INCLUDE_LEVEL__ /* { dg-final { scan-file pr92296-2.i "includelevel1 = 42" } } */
#pragma pop_macro("__INCLUDE_LEVEL__")
includelevel2 = __INCLUDE_LEVEL__ /* { dg-final { scan-file pr92296-2.i "includelevel2 = 0" } } */
#pragma push_macro("__COUNTER__")
#undef __COUNTER__ /* { dg-warning "undefining" } */
-#define __COUNTER__ 172
+#define __COUNTER__ 172 /* { dg-warning "defined" } */
counter1 = __COUNTER__ /* { dg-final { scan-file pr92296-2.i "counter1 = 172" } } */
#pragma pop_macro("__COUNTER__")
counter2 = __COUNTER__ /* { dg-final { scan-file-not pr92296-2.i "counter2 = 172" } } */
#pragma push_macro("__has_attribute")
#undef __has_attribute /* { dg-warning "undefining" } */
-#define __has_attribute(x) 0
+#define __has_attribute(x) 0 /* { dg-warning "defined" } */
hasattr1 = __has_attribute(noreturn) /* { dg-final { scan-file pr92296-2.i "hasattr1 = 0" } } */
#pragma pop_macro("__has_attribute")
hasattr2 = __has_attribute(noreturn) /* { dg-final { scan-file-not pr92296-2.i "hasattr2 = 0" } } */
#pragma push_macro("__has_cpp_attribute")
#undef __has_cpp_attribute /* { dg-warning "undefining" } */
-#define __has_cpp_attribute(x) 0
+#define __has_cpp_attribute(x) 0 /* { dg-warning "defined" } */
hasattrcpp1 = __has_cpp_attribute(noreturn) /* { dg-final { scan-file pr92296-2.i "hasattrcpp1 = 0" } } */
#pragma pop_macro("__has_cpp_attribute")
hasattrcpp2 = __has_cpp_attribute(noreturn) /* { dg-final { scan-file-not pr92296-2.i "hasattrcpp2 = 0" } } */
#pragma push_macro("__has_builtin")
#undef __has_builtin /* { dg-warning "undefining" } */
-#define __has_builtin(x) 0
+#define __has_builtin(x) 0 /* { dg-warning "defined" } */
hasbuiltin1 = __has_builtin(__builtin_expect) /* { dg-final { scan-file pr92296-2.i "hasbuiltin1 = 0" } } */
#pragma pop_macro("__has_builtin")
hasbuiltin2 = __has_builtin(__builtin_expect) /* { dg-final { scan-file pr92296-2.i "hasbuiltin2 = 1" } } */
diff --git a/gcc/testsuite/c-c++-common/cpp/pragma-diagnostic-loc-2.c b/gcc/testsuite/c-c++-common/cpp/pragma-diagnostic-loc-2.c
new file mode 100644
index 0000000..734da21
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/pragma-diagnostic-loc-2.c
@@ -0,0 +1,15 @@
+/* PR c/118838 */
+/* { dg-do compile } */
+/* { dg-additional-options "-Wunknown-pragmas" } */
+
+/* Make sure the warnings are suppressed as expected. */
+
+/* The tokens need to be all on the same line here. */
+_Pragma ("GCC diagnostic push") _Pragma ("GCC diagnostic ignored \"-Wunknown-pragmas\"") _Pragma ("__unknown__") _Pragma ("GCC diagnostic pop")
+
+#define MACRO \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wunknown-pragmas\"") \
+ _Pragma ("__unknown__") \
+ _Pragma ("GCC diagnostic pop")
+MACRO
diff --git a/gcc/testsuite/c-c++-common/cpp/va-opt-6.c b/gcc/testsuite/c-c++-common/cpp/va-opt-6.c
index 8a7761b..9a92431 100644
--- a/gcc/testsuite/c-c++-common/cpp/va-opt-6.c
+++ b/gcc/testsuite/c-c++-common/cpp/va-opt-6.c
@@ -3,15 +3,15 @@
/* { dg-options "-std=c++20" { target c++ } } */
#define a ""
-#define b(...) a ## #__VA_OPT__(1) /* { dg-error "pasting \"a\" and \"\"\"\" does not give a valid preprocessing token" } */
-#define c(...) a ## #__VA_OPT__(1) /* { dg-error "pasting \"a\" and \"\"1\"\" does not give a valid preprocessing token" } */
+#define b(...) a ## #__VA_OPT__(1) /* { dg-error "pasting 'a' and '\"\"' does not give a valid preprocessing token" } */
+#define c(...) a ## #__VA_OPT__(1) /* { dg-error "pasting 'a' and '\"1\"' does not give a valid preprocessing token" } */
#define d(...) #__VA_OPT__(1) ## !
#define e(...) #__VA_OPT__(1) ## !
#define f(...) #__VA_OPT__(. ## !)
#define g(...) #__VA_OPT__(. ## !)
b()
c(1)
-d( ) /* { dg-error "pasting \"\"\"\" and \"!\" does not give a valid preprocessing token" } */
-e( 1 ) /* { dg-error "pasting \"\"1\"\" and \"!\" does not give a valid preprocessing token" } */
+d( ) /* { dg-error "pasting '\"\"' and '!' does not give a valid preprocessing token" } */
+e( 1 ) /* { dg-error "pasting '\"1\"' and '!' does not give a valid preprocessing token" } */
f()
-g(0) /* { dg-error "pasting \".\" and \"!\" does not give a valid preprocessing token" } */
+g(0) /* { dg-error "pasting '.' and '!' does not give a valid preprocessing token" } */
diff --git a/gcc/testsuite/c-c++-common/diagnostic-format-json-1.c b/gcc/testsuite/c-c++-common/diagnostic-format-json-1.c
deleted file mode 100644
index c95218c..0000000
--- a/gcc/testsuite/c-c++-common/diagnostic-format-json-1.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-fdiagnostics-format=json" } */
-
-#error message
-
-/* { dg-begin-multiline-output "" }
-[{"kind": "error",
- "message": "#error message",
- "children": [],
- "column-origin": 1,
- "locations": [{"caret": {"file":
- "line": 4,
- "display-column": 2,
- "byte-column": 2,
- "column": 2},
- "finish": {"file":
- "line": 4,
- "display-column": 6,
- "byte-column": 6,
- "column": 6}}],
- "escape-source": false}]
- { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/c-c++-common/diagnostic-format-json-2.c b/gcc/testsuite/c-c++-common/diagnostic-format-json-2.c
deleted file mode 100644
index a8828b7..0000000
--- a/gcc/testsuite/c-c++-common/diagnostic-format-json-2.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-fdiagnostics-format=json" } */
-
-#warning message
-
-/* { dg-begin-multiline-output "" }
-[{"kind": "warning",
- "message": "#warning message",
- "option": "-Wcpp",
- { dg-end-multiline-output "" } */
-/* { dg-regexp " \"option_url\": \"https:\[^\n\r\"\]*#index-Wcpp\",\n" } */
-/* { dg-begin-multiline-output "" }
- "children": [],
- "column-origin": 1,
- "locations": [{"caret": {"file":
- "line": 4,
- "display-column": 2,
- "byte-column": 2,
- "column": 2},
- "finish": {"file":
- "line": 4,
- "display-column": 8,
- "byte-column": 8,
- "column": 8}}],
- "escape-source": false}]
- { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/c-c++-common/diagnostic-format-json-3.c b/gcc/testsuite/c-c++-common/diagnostic-format-json-3.c
deleted file mode 100644
index 178bbf9..0000000
--- a/gcc/testsuite/c-c++-common/diagnostic-format-json-3.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-fdiagnostics-format=json -Werror" } */
-
-#warning message
-
-/* { dg-begin-multiline-output "" }
-[{"kind": "error",
- "message": "#warning message",
- "option": "-Werror=cpp",
- { dg-end-multiline-output "" } */
-/* { dg-regexp " \"option_url\": \"https:\[^\n\r\"\]*#index-Wcpp\",\n" } */
-/* { dg-begin-multiline-output "" }
- "children": [],
- "column-origin": 1,
- "locations": [{"caret": {"file":
- "line": 4,
- "display-column": 2,
- "byte-column": 2,
- "column": 2},
- "finish": {"file":
- "line": 4,
- "display-column": 8,
- "byte-column": 8,
- "column": 8}}],
- "escape-source": false}]
- { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/c-c++-common/diagnostic-format-json-4.c b/gcc/testsuite/c-c++-common/diagnostic-format-json-4.c
deleted file mode 100644
index 899a03f..0000000
--- a/gcc/testsuite/c-c++-common/diagnostic-format-json-4.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-fdiagnostics-format=json -Wmisleading-indentation" } */
-
-int test (void)
-{
- if (1)
- return 3;
- return 4;
- return 5;
-}
-
-/* { dg-begin-multiline-output "" }
-[{"kind": "warning",
- "message": "this 'if' clause does not guard...",
- "option": "-Wmisleading-indentation",
- { dg-end-multiline-output "" } */
-/* { dg-regexp " \"option_url\": \"https:\[^\n\r\"\]*#index-Wmisleading-indentation\",\n" } */
-/* { dg-begin-multiline-output "" }
- "children": [{"kind": "note",
- "message": "...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'",
- "locations": [{"caret": {"file":
- "line": 8,
- "display-column": 5,
- "byte-column": 5,
- "column": 5},
- "finish": {"file":
- "line": 8,
- "display-column": 10,
- "byte-column": 10,
- "column": 10}}],
- "escape-source": false}],
- "column-origin": 1,
- "locations": [{"caret": {"file":
- "line": 6,
- "display-column": 3,
- "byte-column": 3,
- "column": 3},
- "finish": {"file":
- "line": 6,
- "display-column": 4,
- "byte-column": 4,
- "column": 4}}],
- "escape-source": false}]
- { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/c-c++-common/diagnostic-format-json-5.c b/gcc/testsuite/c-c++-common/diagnostic-format-json-5.c
deleted file mode 100644
index ed3139c..0000000
--- a/gcc/testsuite/c-c++-common/diagnostic-format-json-5.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-fdiagnostics-format=json" } */
-
-struct s { int color; };
-
-int test (struct s *ptr)
-{
- return ptr->colour;
-}
-
-/* { dg-begin-multiline-output "" }
-[{"kind": "error",
- "message": "'struct s' has no member named 'colour'; did you mean 'color'?",
- "children": [],
- "column-origin": 1,
- "locations": [{"caret": {"file":
- "line": 8,
- "display-column": 15,
- "byte-column": 15,
- "column": 15},
- "finish": {"file":
- "line": 8,
- "display-column": 20,
- "byte-column": 20,
- "column": 20}}],
- "fixits": [{"start": {"file":
- "line": 8,
- "display-column": 15,
- "byte-column": 15,
- "column": 15},
- "next": {"file":
- "line": 8,
- "display-column": 21,
- "byte-column": 21,
- "column": 21},
- "string": "color"}],
- "escape-source": false}]
- { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/c-c++-common/diagnostic-format-json-file-1.c b/gcc/testsuite/c-c++-common/diagnostic-format-json-file-1.c
deleted file mode 100644
index ddac780..0000000
--- a/gcc/testsuite/c-c++-common/diagnostic-format-json-file-1.c
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Check that -fdiagnostics-format=json-file works. */
-/* { dg-do compile } */
-/* { dg-options "-fdiagnostics-format=json-file" } */
-
-#warning message
-
-/* Verify that some JSON was written to a file with the expected name. */
-/* { dg-final { scan-file "diagnostic-format-json-file-1.c.gcc.json" "\"message\": \"#warning message\"" } } */
diff --git a/gcc/testsuite/c-c++-common/diagnostic-format-json-stderr-1.c b/gcc/testsuite/c-c++-common/diagnostic-format-json-stderr-1.c
deleted file mode 100644
index e798c6b..0000000
--- a/gcc/testsuite/c-c++-common/diagnostic-format-json-stderr-1.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Check that "json" and "json-stderr" are synonymous when used as
- arguments to "-fdiagnostics-format=". */
-/* { dg-do compile } */
-/* { dg-options "-fdiagnostics-format=json-stderr" } */
-
-#error message
-
-/* { dg-begin-multiline-output "" }
-[{"kind": "error",
- "message": "#error message",
- "children": [],
- "column-origin": 1,
- "locations": [{"caret": {"file":
- "line": 6,
- "display-column": 2,
- "byte-column": 2,
- "column": 2},
- "finish": {"file":
- "line": 6,
- "display-column": 6,
- "byte-column": 6,
- "column": 6}}],
- "escape-source": false}]
- { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/c-c++-common/goacc-gomp/nesting-1.c b/gcc/testsuite/c-c++-common/goacc-gomp/nesting-1.c
index 9ef154e..929dfca 100644
--- a/gcc/testsuite/c-c++-common/goacc-gomp/nesting-1.c
+++ b/gcc/testsuite/c-c++-common/goacc-gomp/nesting-1.c
@@ -1,10 +1,9 @@
-/* { dg-additional-options "--param=openacc-kernels=decompose" }
-
+/* { dg-additional-options "--param=openacc-kernels=decompose" } */
/* { dg-additional-options "-fopt-info-omp-note" } */
-
-/* { dg-additional-options "--param=openacc-privatization=noisy" }
- Prune a few: uninteresting, and potentially varying depending on GCC configuration (data types):
- { dg-prune-output {note: variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} } */
+/* { dg-additional-options "--param=openacc-privatization=noisy" } */
+/* { dg-skip-if "PR121975" { c++26 } { "*" } { "" } } */
+/* Prune a few: uninteresting, and potentially varying depending on GCC configuration (data types): */
+/* { dg-prune-output {note: variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} } */
void
diff --git a/gcc/testsuite/c-c++-common/goacc/acc-wait-1.c b/gcc/testsuite/c-c++-common/goacc/acc-wait-1.c
new file mode 100644
index 0000000..bc7ff02
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/acc-wait-1.c
@@ -0,0 +1,51 @@
+// { dg-do compile }
+// { dg-additional-options "-fdump-tree-original" }
+
+void f0 (int x)
+{
+ #pragma acc wait(x) if(false) async
+}
+// { dg-final { scan-tree-dump-times "if \\(0\\)\[\\n\\r\]+ *\{\[\\n\\r\]+ *__builtin_GOACC_wait \\(-1, 1, x\\);" 1 "original" { target c } } }
+// { dg-final { scan-tree-dump-not "__builtin_GOACC_wait \\(-1, 1, x\\);" "original" { target c++ } } }
+
+
+void f1 (int y, int ia)
+{
+ #pragma acc wait(y) if(true) async(ia)
+}
+// { dg-final { scan-tree-dump-times "if \\(1\\)\[\\n\\r\]+ *\{\[\\n\\r\]+ *__builtin_GOACC_wait \\(ia, 1, y\\);" 1 "original" { target c } } }
+// { dg-final { scan-tree-dump-times "__builtin_GOACC_wait \\(ia, 1, y\\)" 1 "original" { target c++ } } }
+// { dg-final { scan-tree-dump-not "if \\(\[^\\n\\r\]+\\)\[\\n\\r\]+ *\{\[\\n\\r\]+ *__builtin_GOACC_wait \\(ia, 1, y\\);" "original" { target c++ } } }
+
+
+void fl (int z, bool ll)
+{
+ #pragma acc wait(z) if(ll) async(3)
+}
+// { dg-final { scan-tree-dump-times "if \\(ll != 0\\)\[\\n\\r\]+ *\{\[\\n\\r\]+ *__builtin_GOACC_wait \\(3, 1, z\\);" 1 "original" { target c } } }
+// { dg-final { scan-tree-dump-times "if \\(ll\\)\[\\n\\r\]+ *\{\[\\n\\r\]+ *__builtin_GOACC_wait \\(3, 1, z\\);" 1 "original" { target c++ } } }
+
+
+void a0 (int a)
+{
+ #pragma acc wait(a) if(false)
+}
+// { dg-final { scan-tree-dump-times "if \\(0\\)\[\\n\\r\]+ *\{\[\\n\\r\]+ *__builtin_GOACC_wait \\(-2, 1, a\\);" 1 "original" { target c } } }
+// { dg-final { scan-tree-dump-not "__builtin_GOACC_wait \\(-2, 1, a\\);" "original" { target c++ } } }
+
+
+void a1 (int b)
+{
+ #pragma acc wait(b) if(true)
+}
+// { dg-final { scan-tree-dump-times "if \\(1\\)\[\\n\\r\]+ *\{\[\\n\\r\]+ *__builtin_GOACC_wait \\(-2, 1, b\\);" 1 "original" { target c } } }
+// { dg-final { scan-tree-dump-times "__builtin_GOACC_wait \\(-2, 1, b\\)" 1 "original" { target c++ } } }
+// { dg-final { scan-tree-dump-not "if \\(\[^\\n\\r\]+\\)\[\\n\\r\]+ *\{\[\\n\\r\]+ *__builtin_GOACC_wait \\(-2, 1, b\\);" "original" { target c++ } } }
+
+
+void al (int c, bool qq)
+{
+ #pragma acc wait(c) if(qq)
+}
+// { dg-final { scan-tree-dump-times "if \\(qq != 0\\)\[\\n\\r\]+ *\{\[\\n\\r\]+ *__builtin_GOACC_wait \\(-2, 1, c\\);" 1 "original" { target c } } }
+// { dg-final { scan-tree-dump-times "if \\(qq\\)\[\\n\\r\]+ *\{\[\\n\\r\]+ *__builtin_GOACC_wait \\(-2, 1, c\\);" 1 "original" { target c++ } } }
diff --git a/gcc/testsuite/c-c++-common/goacc/cache-3-1.c b/gcc/testsuite/c-c++-common/goacc/cache-3-1.c
index 5318a57..5577d71 100644
--- a/gcc/testsuite/c-c++-common/goacc/cache-3-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/cache-3-1.c
@@ -6,6 +6,10 @@
/* { dg-additional-options "-fopenmp" } for '#pragma omp threadprivate'. */
+/* Array sections without spaces between [ and : or : and ] are incompatible
+ with C++26. */
+/* { dg-skip-if "array sections vs. C++26" { c++26 } } */
+
/* The current implementation doesn't restrict where a 'cache' directive may
appear, so we don't make any special arrangements. */
diff --git a/gcc/testsuite/c-c++-common/goacc/cache-3-2.c b/gcc/testsuite/c-c++-common/goacc/cache-3-2.c
index ea5222e7..0c651c6 100644
--- a/gcc/testsuite/c-c++-common/goacc/cache-3-2.c
+++ b/gcc/testsuite/c-c++-common/goacc/cache-3-2.c
@@ -19,25 +19,25 @@ foo (int *p, int (*q)[10], int r[10], int s[10][10])
;
#pragma acc cache (r[-1:2])
;
- #pragma acc cache (s[-1:2][:])
+ #pragma acc cache (s[-1:2][ : ])
;
#pragma acc cache (s[-1:2][-2:10]) /* { dg-error "negative low bound in array section in" } */
;
#pragma acc cache (a[-1:2]) /* { dg-error "negative low bound in array section in" } */
;
- #pragma acc cache (b[-1:2][0:]) /* { dg-error "negative low bound in array section in" } */
+ #pragma acc cache (b[-1:2][0: ]) /* { dg-error "negative low bound in array section in" } */
;
#pragma acc cache (b[1:2][-2:10]) /* { dg-error "negative low bound in array section in" } */
;
#pragma acc cache (p[2:-3]) /* { dg-error "negative length in array section in" } */
;
- #pragma acc cache (q[2:-3][:]) /* { dg-error "negative length in array section in" } */
+ #pragma acc cache (q[2:-3][ : ]) /* { dg-error "negative length in array section in" } */
;
#pragma acc cache (q[2:3][0:-1]) /* { dg-error "negative length in array section in" } */
;
#pragma acc cache (r[2:-5]) /* { dg-error "negative length in array section in" } */
;
- #pragma acc cache (s[2:-5][:]) /* { dg-error "negative length in array section in" } */
+ #pragma acc cache (s[2:-5][ : ]) /* { dg-error "negative length in array section in" } */
;
#pragma acc cache (s[2:5][0:-4]) /* { dg-error "negative length in array section in" } */
;
diff --git a/gcc/testsuite/c-c++-common/goacc/data-clause-1.c b/gcc/testsuite/c-c++-common/goacc/data-clause-1.c
index 9952ac4..b9871ec 100644
--- a/gcc/testsuite/c-c++-common/goacc/data-clause-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/data-clause-1.c
@@ -30,13 +30,13 @@ foo (int g[3][10], int h[4][8], int i[2][10], int j[][9],
;
#pragma acc parallel copyout(t[2:5]) /* { dg-error "is threadprivate variable" } */
;
- #pragma acc parallel copy(k[0.5:]) /* { dg-error "low bound \[^\n\r]* of array section does not have integral type" } */
+ #pragma acc parallel copy(k[0.5: ]) /* { dg-error "low bound \[^\n\r]* of array section does not have integral type" } */
;
- #pragma acc parallel copyout(l[:7.5f]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
+ #pragma acc parallel copyout(l[ :7.5f]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
;
- #pragma acc parallel copyin(m[p:]) /* { dg-error "low bound \[^\n\r]* of array section does not have integral type" } */
+ #pragma acc parallel copyin(m[p: ]) /* { dg-error "low bound \[^\n\r]* of array section does not have integral type" } */
;
- #pragma acc parallel copy(n[:p]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
+ #pragma acc parallel copy(n[ :p]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
;
#pragma acc parallel copyin(o[2:5]) /* { dg-error "does not have pointer or array type" } */
;
@@ -44,72 +44,72 @@ foo (int g[3][10], int h[4][8], int i[2][10], int j[][9],
;
#pragma acc parallel create(s2) /* { dg-error "'s2' does not have a mappable type in 'map' clause" } */
;
- #pragma acc parallel copyin(a[:][:]) /* { dg-error "array type length expression must be specified" } */
+ #pragma acc parallel copyin(a[ : ][ : ]) /* { dg-error "array type length expression must be specified" } */
bar (&a[0][0]); /* { dg-error "referenced in target region does not have a mappable type" } */
- #pragma acc parallel copy(b[-1:]) /* { dg-error "negative low bound in array section" } */
+ #pragma acc parallel copy(b[-1: ]) /* { dg-error "negative low bound in array section" } */
bar (b);
- #pragma acc parallel copy(c[:-3][:]) /* { dg-error "negative length in array section" } */
+ #pragma acc parallel copy(c[ :-3][ : ]) /* { dg-error "negative length in array section" } */
bar (&c[0][0]);
- #pragma acc parallel copyout(d[11:]) /* { dg-error "low bound \[^\n\r]* above array section size" } */
+ #pragma acc parallel copyout(d[11: ]) /* { dg-error "low bound \[^\n\r]* above array section size" } */
bar (d);
- #pragma acc parallel copyin(e[:11]) /* { dg-error "length \[^\n\r]* above array section size" } */
+ #pragma acc parallel copyin(e[ :11]) /* { dg-error "length \[^\n\r]* above array section size" } */
bar (e);
#pragma acc parallel copyin(f[1:10]) /* { dg-error "high bound \[^\n\r]* above array section size" } */
bar (f);
- #pragma acc parallel copyout(g[:][0:10]) /* { dg-error "for array function parameter length expression must be specified" } */
+ #pragma acc parallel copyout(g[ : ][0:10]) /* { dg-error "for array function parameter length expression must be specified" } */
bar (&g[0][0]);
- #pragma acc parallel copyout(h[2:1][-1:]) /* { dg-error "negative low bound in array section" } */
+ #pragma acc parallel copyout(h[2:1][-1: ]) /* { dg-error "negative low bound in array section" } */
bar (&h[0][0]);
- #pragma acc parallel copy(h[:1][:-3]) /* { dg-error "negative length in array section" } */
+ #pragma acc parallel copy(h[ :1][ :-3]) /* { dg-error "negative length in array section" } */
bar (&h[0][0]);
- #pragma acc parallel copy(i[:1][11:]) /* { dg-error "low bound \[^\n\r]* above array section size" } */
+ #pragma acc parallel copy(i[ :1][11: ]) /* { dg-error "low bound \[^\n\r]* above array section size" } */
bar (&i[0][0]);
- #pragma acc parallel copyout(j[3:1][:10]) /* { dg-error "length \[^\n\r]* above array section size" } */
+ #pragma acc parallel copyout(j[3:1][ :10]) /* { dg-error "length \[^\n\r]* above array section size" } */
bar (&j[0][0]);
#pragma acc parallel copyin(j[30:1][5:5]) /* { dg-error "high bound \[^\n\r]* above array section size" } */
bar (&j[0][0]);
- #pragma acc parallel copyin(a2[:1][2:4])
+ #pragma acc parallel copyin(a2[ :1][2:4])
bar (&a2[0][0]);
- #pragma acc parallel copy(a2[3:5][:])
+ #pragma acc parallel copy(a2[3:5][ : ])
bar (&a2[0][0]);
- #pragma acc parallel copyin(a2[3:5][:10])
+ #pragma acc parallel copyin(a2[3:5][ :10])
bar (&a2[0][0]);
- #pragma acc parallel copy(b2[0:])
+ #pragma acc parallel copy(b2[0: ])
bar (b2);
- #pragma acc parallel copy(c2[:3][:])
+ #pragma acc parallel copy(c2[ :3][ : ])
bar (&c2[0][0]);
- #pragma acc parallel copyout(d2[9:])
+ #pragma acc parallel copyout(d2[9: ])
bar (d2);
- #pragma acc parallel copyin(e2[:10])
+ #pragma acc parallel copyin(e2[ :10])
bar (e2);
#pragma acc parallel copyin(f2[1:9])
bar (f2);
- #pragma acc parallel copy(g2[:1][2:4])
+ #pragma acc parallel copy(g2[ :1][2:4])
bar (&g2[0][0]);
- #pragma acc parallel copyout(h2[2:2][0:])
+ #pragma acc parallel copyout(h2[2:2][0: ])
bar (&h2[0][0]);
- #pragma acc parallel copy(h2[:1][:3])
+ #pragma acc parallel copy(h2[ :1][ :3])
bar (&h2[0][0]);
- #pragma acc parallel copyin(i2[:1][9:])
+ #pragma acc parallel copyin(i2[ :1][9: ])
bar (&i2[0][0]);
- #pragma acc parallel copyout(j2[3:4][:9])
+ #pragma acc parallel copyout(j2[3:4][ :9])
bar (&j2[0][0]);
#pragma acc parallel copyin(j2[30:1][5:4])
bar (&j2[0][0]);
#pragma acc parallel copy(q[1:2])
;
- #pragma acc parallel copy(q[3:5][:10]) /* { dg-error "array section is not contiguous" } */
+ #pragma acc parallel copy(q[3:5][ :10]) /* { dg-error "array section is not contiguous" } */
;
- #pragma acc parallel copy(r[3:][2:1][1:2])
+ #pragma acc parallel copy(r[3: ][2:1][1:2])
;
- #pragma acc parallel copy(r[3:][2:1][1:2][:][0:4])
+ #pragma acc parallel copy(r[3: ][2:1][1:2][ : ][0:4])
;
- #pragma acc parallel copy(r[3:][2:1][1:2][1:][0:4]) /* { dg-error "array section is not contiguous" } */
+ #pragma acc parallel copy(r[3: ][2:1][1:2][1: ][0:4]) /* { dg-error "array section is not contiguous" } */
;
- #pragma acc parallel copy(r[3:][2:1][1:2][:3][0:4]) /* { dg-error "array section is not contiguous" } */
+ #pragma acc parallel copy(r[3: ][2:1][1:2][ :3][0:4]) /* { dg-error "array section is not contiguous" } */
;
- #pragma acc parallel copy(r[3:][2:1][1:2][:][1:]) /* { dg-error "array section is not contiguous" } */
+ #pragma acc parallel copy(r[3: ][2:1][1:2][ : ][1: ]) /* { dg-error "array section is not contiguous" } */
;
- #pragma acc parallel copy(r[3:][2:1][1:2][:][:3]) /* { dg-error "array section is not contiguous" } */
+ #pragma acc parallel copy(r[3: ][2:1][1:2][ : ][ :3]) /* { dg-error "array section is not contiguous" } */
;
}
diff --git a/gcc/testsuite/c-c++-common/goacc/data-clause-2.c b/gcc/testsuite/c-c++-common/goacc/data-clause-2.c
index d4603b0..84c7dac 100644
--- a/gcc/testsuite/c-c++-common/goacc/data-clause-2.c
+++ b/gcc/testsuite/c-c++-common/goacc/data-clause-2.c
@@ -18,25 +18,25 @@ foo (int *p, int (*q)[10], int r[10], int s[10][10])
;
#pragma acc parallel copy (r[-1:2])
;
- #pragma acc parallel copy (s[-1:2][:])
+ #pragma acc parallel copy (s[-1:2][ : ])
;
#pragma acc parallel copy (s[-1:2][-2:10]) /* { dg-error "negative low bound in array section in" } */
;
#pragma acc parallel copy (a[-1:2]) /* { dg-error "negative low bound in array section in" } */
;
- #pragma acc parallel copy (b[-1:2][0:]) /* { dg-error "negative low bound in array section in" } */
+ #pragma acc parallel copy (b[-1:2][0: ]) /* { dg-error "negative low bound in array section in" } */
;
#pragma acc parallel copy (b[1:2][-2:10]) /* { dg-error "negative low bound in array section in" } */
;
#pragma acc parallel copy (p[2:-3]) /* { dg-error "negative length in array section in" } */
;
- #pragma acc parallel copy (q[2:-3][:]) /* { dg-error "negative length in array section in" } */
+ #pragma acc parallel copy (q[2:-3][ : ]) /* { dg-error "negative length in array section in" } */
;
#pragma acc parallel copy (q[2:3][0:-1]) /* { dg-error "negative length in array section in" } */
;
#pragma acc parallel copy (r[2:-5]) /* { dg-error "negative length in array section in" } */
;
- #pragma acc parallel copy (s[2:-5][:]) /* { dg-error "negative length in array section in" } */
+ #pragma acc parallel copy (s[2:-5][ : ]) /* { dg-error "negative length in array section in" } */
;
#pragma acc parallel copy (s[2:5][0:-4]) /* { dg-error "negative length in array section in" } */
;
diff --git a/gcc/testsuite/c-c++-common/goacc/data-clause-duplicate-1.c b/gcc/testsuite/c-c++-common/goacc/data-clause-duplicate-1.c
index c87ef8b..3f7773d 100644
--- a/gcc/testsuite/c-c++-common/goacc/data-clause-duplicate-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/data-clause-duplicate-1.c
@@ -8,7 +8,7 @@ fun (void)
;
#pragma acc serial present(fp[0:2]) copyin(fp[0:2]) /* { dg-error "'fp' appears more than once in data clauses" } */
;
-#pragma acc data create(fp[:10]) deviceptr(fp) /* { dg-error "'fp' appears more than once in data clauses" } */
+#pragma acc data create(fp[ :10]) deviceptr(fp) /* { dg-error "'fp' appears more than once in data clauses" } */
;
#pragma acc data create(fp) present(fp) /* { dg-error "'fp' appears more than once in data clauses" } */
;
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-2.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-2.c
index 3ce9490..5aac40c 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-2.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-2.c
@@ -1,10 +1,13 @@
/* Test OpenACC 'kernels' construct decomposition. */
+/* { dg-skip-if "PR121975" { c++26 } { "*" } { "" } } */
/* { dg-additional-options "-fopt-info-omp-all" } */
/* { dg-additional-options "--param=openacc-kernels=decompose" }
/* { dg-additional-options "-O2" } for 'parloops'. */
+/* { dg-skip-if "PR121975" { c++26 } { "*" } { "" } } */
+
/* { dg-additional-options "--param=openacc-privatization=noisy" }
Prune a few: uninteresting, and potentially varying depending on GCC configuration (data types):
{ dg-prune-output {note: variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} } */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr100280-1.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr100280-1.c
index 1c1e22c..5198fc9 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr100280-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr100280-1.c
@@ -1,3 +1,5 @@
+/* { dg-skip-if "PR121975" { c++26 } { "*" } { "" } } */
+
/* Reduced from 'libgomp.oacc-c-c++-common/kernels-loop-2.c'. */
/* { dg-additional-options "--param openacc-kernels=decompose" } */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr100400-1-1.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr100400-1-1.c
index 57cb1a8..97fcaf7 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr100400-1-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr100400-1-1.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "PR121975" { c++26 } { "*" } { "" } } */
/* { dg-additional-options "--param openacc-kernels=decompose" } */
/* { dg-additional-options "-g0" } */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr100400-1-3.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr100400-1-3.c
index 9779f10..f7c8069 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr100400-1-3.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr100400-1-3.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "PR121975" { c++26 } { "*" } { "" } } */
/* { dg-additional-options "--param openacc-kernels=decompose" } */
/* { dg-additional-options "-fchecking" }
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104061-1-1.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104061-1-1.c
index aa0fca7..5bb68c1 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104061-1-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104061-1-1.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "PR121975" { c++26 } { "*" } { "" } } */
/* { dg-additional-options "--param openacc-kernels=decompose" } */
/* { dg-additional-options "-g0" } */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104061-1-3.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104061-1-3.c
index 70c2ac5..43e1cca 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104061-1-3.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104061-1-3.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "PR121975" { c++26 } { "*" } { "" } } */
/* { dg-additional-options "--param openacc-kernels=decompose" } */
/* { dg-additional-options "-fcompare-debug" } -- w/o debug compiled first.
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104061-1-4.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104061-1-4.c
index d1cc1a9..97d7bed 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104061-1-4.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104061-1-4.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "PR121975" { c++26 } { "*" } { "" } } */
/* { dg-additional-options "--param openacc-kernels=decompose" } */
/* { dg-additional-options "-g -fcompare-debug" } -- w/ debug compiled first.
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104132-1.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104132-1.c
index 2a663e0..9094a57 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104132-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104132-1.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "PR121975" { c++26 } { "*" } { "" } } */
/* { dg-additional-options "--param openacc-kernels=decompose" } */
/* { dg-additional-options "-fopt-info-all-omp" } */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104133-1.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104133-1.c
index 2724e22..aa5dd34 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104133-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104133-1.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "PR121975" { c++26 } { "*" } { "" } } */
/* { dg-additional-options "--param openacc-kernels=decompose" } */
/* { dg-additional-options "-fopt-info-all-omp" } */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104774-1.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104774-1.c
index 3ef0c897..e6d4c55 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104774-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-pr104774-1.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "PR121975" { c++26 } { "*" } { "" } } */
/* { dg-additional-options "--param openacc-kernels=decompose" } */
/* { dg-additional-options "-fopt-info-all-omp" } */
diff --git a/gcc/testsuite/c-c++-common/goacc/mdc-1.c b/gcc/testsuite/c-c++-common/goacc/mdc-1.c
index 923a4ea..8d3e7bf 100644
--- a/gcc/testsuite/c-c++-common/goacc/mdc-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/mdc-1.c
@@ -3,6 +3,7 @@
/* TODO The tree dump scanning has certain expectations.
{ dg-do compile { target { lp64 || llp64 } } } */
+/* { dg-skip-if "PR121975" { c++26 } { "*" } { "" } } */
/* { dg-additional-options "-fdump-tree-omplower" } */
/* { dg-additional-options -Wuninitialized } */
diff --git a/gcc/testsuite/c-c++-common/goacc/mdc-2.c b/gcc/testsuite/c-c++-common/goacc/mdc-2.c
index 246625c..8ddda08 100644
--- a/gcc/testsuite/c-c++-common/goacc/mdc-2.c
+++ b/gcc/testsuite/c-c++-common/goacc/mdc-2.c
@@ -24,17 +24,17 @@ t1 ()
#pragma acc exit data detach(a)
}
-#pragma acc enter data attach(z[:5]) /* { dg-error "expected single pointer in .attach. clause" } */
+#pragma acc enter data attach(z[ :5]) /* { dg-error "expected single pointer in .attach. clause" } */
/* { dg-error "has no data movement clause" "" { target *-*-* } .-1 } */
-#pragma acc exit data detach(z[:5]) /* { dg-error "expected single pointer in .detach. clause" } */
+#pragma acc exit data detach(z[ :5]) /* { dg-error "expected single pointer in .detach. clause" } */
/* { dg-error "has no data movement clause" "" { target *-*-* } .-1 } */
-#pragma acc enter data attach(z[1:]) /* { dg-error "expected single pointer in .attach. clause" } */
+#pragma acc enter data attach(z[1: ]) /* { dg-error "expected single pointer in .attach. clause" } */
/* { dg-error "has no data movement clause" "" { target *-*-* } .-1 } */
-#pragma acc exit data detach(z[1:]) /* { dg-error "expected single pointer in .detach. clause" } */
+#pragma acc exit data detach(z[1: ]) /* { dg-error "expected single pointer in .detach. clause" } */
/* { dg-error "has no data movement clause" "" { target *-*-* } .-1 } */
-#pragma acc enter data attach(z[:]) /* { dg-error "expected single pointer in .attach. clause" } */
+#pragma acc enter data attach(z[ : ]) /* { dg-error "expected single pointer in .attach. clause" } */
/* { dg-error "has no data movement clause" "" { target *-*-* } .-1 } */
-#pragma acc exit data detach(z[:]) /* { dg-error "expected single pointer in .detach. clause" } */
+#pragma acc exit data detach(z[ : ]) /* { dg-error "expected single pointer in .detach. clause" } */
/* { dg-error "has no data movement clause" "" { target *-*-* } .-1 } */
#pragma acc enter data attach(z[3]) /* { dg-error "expected pointer in .attach. clause" } */
/* { dg-error "has no data movement clause" "" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/c-c++-common/goacc/pr69916.c b/gcc/testsuite/c-c++-common/goacc/pr69916.c
index e037af3..5c46bb7 100644
--- a/gcc/testsuite/c-c++-common/goacc/pr69916.c
+++ b/gcc/testsuite/c-c++-common/goacc/pr69916.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-O2" } */
+/* { dg-additional-options "-O2" } */
/* PR 69916, an loop determined to be empty sometime after omp-lower
and before oacc-device-lower can evaporate leading to no GOACC_LOOP
diff --git a/gcc/testsuite/c-c++-common/goacc/readonly-1.c b/gcc/testsuite/c-c++-common/goacc/readonly-1.c
index 300464c..a2fae4c 100644
--- a/gcc/testsuite/c-c++-common/goacc/readonly-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/readonly-1.c
@@ -15,33 +15,33 @@ int main (void)
int x[32], y[32];
struct S s = {x, 0};
- #pragma acc declare copyin(readonly: x/*[:32]*/, s/*.ptr[:16]*/) copyin(y/*[:32]*/)
+ #pragma acc declare copyin(readonly: x/*[ :32]*/, s/*.ptr[ :16]*/) copyin(y/*[ :32]*/)
- #pragma acc parallel copyin(readonly: x[:32], s.ptr[:16]) copyin(y[:32])
+ #pragma acc parallel copyin(readonly: x[ :32], s.ptr[ :16]) copyin(y[ :32])
{
- #pragma acc cache (readonly: x[:32])
- #pragma acc cache (y[:32])
+ #pragma acc cache (readonly: x[ :32])
+ #pragma acc cache (y[ :32])
}
- #pragma acc kernels copyin(readonly: x[:32], s.ptr[:16]) copyin(y[:32])
+ #pragma acc kernels copyin(readonly: x[ :32], s.ptr[ :16]) copyin(y[ :32])
{
- #pragma acc cache (readonly: x[:32])
- #pragma acc cache (y[:32])
+ #pragma acc cache (readonly: x[ :32])
+ #pragma acc cache (y[ :32])
}
- #pragma acc serial copyin(readonly: x[:32], s.ptr[:16]) copyin(y[:32])
+ #pragma acc serial copyin(readonly: x[ :32], s.ptr[ :16]) copyin(y[ :32])
{
- #pragma acc cache (readonly: x[:32])
- #pragma acc cache (y[:32])
+ #pragma acc cache (readonly: x[ :32])
+ #pragma acc cache (y[ :32])
}
- #pragma acc data copyin(readonly: x[:32], s.ptr[:16]) copyin(y[:32])
+ #pragma acc data copyin(readonly: x[ :32], s.ptr[ :16]) copyin(y[ :32])
{
- #pragma acc cache (readonly: x[:32])
- #pragma acc cache (y[:32])
+ #pragma acc cache (readonly: x[ :32])
+ #pragma acc cache (y[ :32])
}
- #pragma acc enter data copyin(readonly: x[:32], s.ptr[:16]) copyin(y[:32])
+ #pragma acc enter data copyin(readonly: x[ :32], s.ptr[ :16]) copyin(y[ :32])
return 0;
}
diff --git a/gcc/testsuite/c-c++-common/gomp/affinity-2.c b/gcc/testsuite/c-c++-common/gomp/affinity-2.c
index 7f30296..78bd21d 100644
--- a/gcc/testsuite/c-c++-common/gomp/affinity-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/affinity-2.c
@@ -1,4 +1,4 @@
-/* { dg-do compile } */
+/* { dg-do compile { target { c || c++23_down } } } */
/* { dg-options "-fopenmp" } */
extern int a[][10], a2[][10];
diff --git a/gcc/testsuite/c-c++-common/gomp/allocate-4.c b/gcc/testsuite/c-c++-common/gomp/allocate-4.c
index 4e0f44a..2576d83 100644
--- a/gcc/testsuite/c-c++-common/gomp/allocate-4.c
+++ b/gcc/testsuite/c-c++-common/gomp/allocate-4.c
@@ -9,7 +9,7 @@ foo (void)
s[0]++;
#pragma omp parallel reduction (+: s[2:2]) allocate(s)
s[2]++;
-#pragma omp parallel reduction (+: p[:2]) allocate(p)
+#pragma omp parallel reduction (+: p[ :2]) allocate(p)
p[0]++;
#pragma omp parallel reduction (+: p[2:2]) allocate(p)
p[2]++;
@@ -30,7 +30,7 @@ bar (void)
#pragma omp teams distribute parallel for reduction (+: s[2:2]) allocate(s)
for (i = 0; i < 64; i++)
s[2]++;
-#pragma omp teams distribute parallel for reduction (+: p[:2]) allocate(p)
+#pragma omp teams distribute parallel for reduction (+: p[ :2]) allocate(p)
for (i = 0; i < 64; i++)
p[0]++;
#pragma omp teams distribute parallel for reduction (+: p[2:2]) allocate(p)
diff --git a/gcc/testsuite/c-c++-common/gomp/append-args-1.c b/gcc/testsuite/c-c++-common/gomp/append-args-1.c
index 2a47063..018a807 100644
--- a/gcc/testsuite/c-c++-common/gomp/append-args-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/append-args-1.c
@@ -23,32 +23,26 @@ float base0();
float repl1(omp_interop_t, omp_interop_t);
#pragma omp declare variant(repl1) match(construct={dispatch}) append_args(interop(target), interop(targetsync))
float base1();
-/* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'repl1', except when specifying all 2 objects in the 'interop' clause of the 'dispatch' directive" "" { target c } .-2 } */
-/* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'float repl1\\(omp_interop_t, omp_interop_t\\)', except when specifying all 2 objects in the 'interop' clause of the 'dispatch' directive" "" { target c++ } .-3 } */
void repl2(int *, int *, omp_interop_t, omp_interop_t);
#pragma omp declare variant(repl2) match(construct={dispatch}) adjust_args(need_device_ptr : y) \
append_args(interop(target, targetsync, prefer_type(1)), \
- interop(prefer_type({fr(3), attr("ompx_nop")},{fr(2)},{attr("ompx_all")})))
+ interop(target, prefer_type({fr(3), attr("ompx_nop")},{fr(2)},{attr("ompx_all")})))
void base2(int *x, int *y);
-/* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'repl2', except when specifying all 2 objects in the 'interop' clause of the 'dispatch' directive" "" { target c } .-3 } */
-/* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'void repl2\\(int\\*, int\\*, omp_interop_t, omp_interop_t\\)', except when specifying all 2 objects in the 'interop' clause of the 'dispatch' directive" "" { target c++ } .-4 } */
void repl3(int, omp_interop_t, ...);
#pragma omp declare variant(repl3) match(construct={dispatch}) \
- append_args(interop(prefer_type("cuda", "hsa")))
+ append_args(interop(target, prefer_type("cuda", "hsa")))
void base3(int, ...);
-/* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'repl3', except when specifying all 1 objects in the 'interop' clause of the 'dispatch' directive" "" { target c } .-2 } */
-/* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'void repl3\\(int, omp_interop_t, \\.\\.\\.\\)', except when specifying all 1 objects in the 'interop' clause of the 'dispatch' directive" "" { target c++ } .-3 } */
-/* { dg-note "'declare variant' candidate 'repl3' declared here" "" { target c } .-4 } */
-/* { dg-note "'declare variant' candidate 'void repl3\\(int, omp_interop_t, \\.\\.\\.\\)' declared here" "" { target c++ } .-5 } */
+/* { dg-note "'declare variant' candidate 'repl3' declared here" "" { target c } .-2 } */
+/* { dg-note "'declare variant' candidate 'void repl3\\(int, omp_interop_t, \\.\\.\\.\\)' declared here" "" { target c++ } .-3 } */
float repl4(short, short, omp_interop_t, short);
#pragma omp declare variant(repl4) match(construct={dispatch}) append_args(interop(target)) append_args(interop(targetsync)) /* { dg-error "too many 'append_args' clauses" } */
float base4(short, short);
/* { dg-error "variant 'repl4' and base 'base4' have incompatible types" "" { target c } .-2 } */
/* { dg-error "too few arguments to function 'float repl4\\(short int, short int, omp_interop_t, short int\\)'" "" { target c++ } .-3 } */
-/* { dg-note "declared here" "" { target c++ } .-5 } */
+/* { dg-note "declared here" "" { target *-*-*} .-5 } */
float repl5(short, short, omp_interop_t, short);
@@ -64,7 +58,7 @@ float repl6(short, short, omp_interop_t, short);
float base6(short, short);
/* { dg-error "variant 'repl6' and base 'base6' have incompatible types" "" { target c } .-2 } */
/* { dg-error "too few arguments to function 'float repl6\\(short int, short int, omp_interop_t, short int\\)'" "" { target c++ } .-3 } */
-/* { dg-note "declared here" "" { target c++ } .-5 } */
+/* { dg-note "declared here" "" { target *-*-*} .-5 } */
float
@@ -75,15 +69,12 @@ test (int *a, int *b)
#pragma omp dispatch interop ( obj1 )
x = base1 ();
- /* { dg-note "required by 'dispatch' construct" "" { target *-*-* } .-2 } */
#pragma omp dispatch interop ( obj1 )
base2 (a, b);
- /* { dg-note "required by 'dispatch' construct" "" { target *-*-* } .-2 } */
#pragma omp dispatch
base3 (5, 1, 2, 3);
- /* { dg-note "required by 'dispatch' construct" "" { target *-*-* } .-2 } */
#pragma omp dispatch interop (obj2)
base3 (5, 1, 2, 3);
@@ -92,7 +83,6 @@ test (int *a, int *b)
base3 (5, 1, 2, 3);
/* { dg-error "number of list items in 'interop' clause \\(2\\) exceeds the number of 'append_args' items \\(1\\) for 'declare variant' candidate 'repl3'" "" { target c } .-2 } */
/* { dg-error "number of list items in 'interop' clause \\(2\\) exceeds the number of 'append_args' items \\(1\\) for 'declare variant' candidate 'void repl3\\(int, omp_interop_t, \\.\\.\\.\\)'" "" { target c++ } .-3 } */
- /* { dg-note "required by 'dispatch' construct" "" { target *-*-* } .-4 } */
return x;
}
diff --git a/gcc/testsuite/c-c++-common/gomp/append-args-7.c b/gcc/testsuite/c-c++-common/gomp/append-args-7.c
index b7dff8a..d8a853e 100644
--- a/gcc/testsuite/c-c++-common/gomp/append-args-7.c
+++ b/gcc/testsuite/c-c++-common/gomp/append-args-7.c
@@ -20,14 +20,14 @@ void g1(...) { }
void f2(...) { }
/* { dg-error "argument 1 of 'f2' must be of 'omp_interop_t'" "" { target c } .-1 } */
/* { dg-error "argument 1 of 'void f2\\(\\.\\.\\.\\)' must be of 'omp_interop_t'" "" { target c++ } .-2 } */
-#pragma omp declare variant(f2) append_args(interop(target), interop(prefer_type("cuda"))) \
+#pragma omp declare variant(f2) append_args(interop(target), interop(target, prefer_type("cuda"))) \
match(construct={dispatch})
void g2(...) { }
/* { dg-note "'append_args' specified here" "" { target *-*-* } .-3 } */
void f3(omp_interop_t, omp_interop_t, ...) { }
-#pragma omp declare variant(f3) append_args(interop(target), interop(prefer_type("cuda"))) \
+#pragma omp declare variant(f3) append_args(interop(target), interop(target, prefer_type("cuda"))) \
match(construct={dispatch})
void g3(...) { }
diff --git a/gcc/testsuite/c-c++-common/gomp/append-args-8.c b/gcc/testsuite/c-c++-common/gomp/append-args-8.c
index fb442db..d47faa2 100644
--- a/gcc/testsuite/c-c++-common/gomp/append-args-8.c
+++ b/gcc/testsuite/c-c++-common/gomp/append-args-8.c
@@ -14,14 +14,15 @@ typedef enum omp_interop_t __GOMP_UINTPTR_T_ENUM
void f1(omp_interop_t) { }
#pragma omp declare variant(f1) match(construct={dispatch}) \
- append_args(interop(prefer_type({attr("ompx_fun")})))
+ append_args(interop(target, prefer_type({attr("ompx_fun")})))
void g1(void);
int f2(omp_interop_t, omp_interop_t);
-#pragma omp declare variant(f2) append_args(interop(prefer_type("cuda")), \
- interop(prefer_type({fr("hsa")}),target)) \
- match(construct={dispatch})
+#pragma omp declare variant(f2) \
+ append_args(interop(target, prefer_type("cuda")), \
+ interop(prefer_type({fr("hsa")}),target)) \
+ match(construct={dispatch})
int g2(void) { return 5; }
int foo (omp_interop_t obj1)
diff --git a/gcc/testsuite/c-c++-common/gomp/append-args-9.c b/gcc/testsuite/c-c++-common/gomp/append-args-9.c
index b8586e0..810ab36 100644
--- a/gcc/testsuite/c-c++-common/gomp/append-args-9.c
+++ b/gcc/testsuite/c-c++-common/gomp/append-args-9.c
@@ -14,14 +14,15 @@ void f1(omp_interop_t *) { }
/* { dg-error "argument 1 of 'f1' must be of 'omp_interop_t'" "" { target c } .-1 } */
/* { dg-note "initializing argument 1 of 'void f1\\(omp_interop_t\\*\\)'" "" { target c++ } .-2 } */
#pragma omp declare variant(f1) match(construct={dispatch}) \
- append_args(interop(prefer_type({attr("ompx_fun")})))
+ append_args(interop(targetsync, prefer_type({attr("ompx_fun")})))
void g1(void);
/* { dg-note "'append_args' specified here" "" { target c } .-2 } */
/* { dg-error "cannot convert 'omp_interop_t' to 'omp_interop_t\\*'" "" { target c++ } .-4 } */
int f2(omp_interop_t);
-#pragma omp declare variant(f2) append_args(interop(prefer_type("cuda"))) \
- match(construct={dispatch})
+#pragma omp declare variant(f2) \
+ append_args(interop(targetsync, prefer_type("cuda"))) \
+ match(construct={dispatch})
int g2(void) { return 5; }
int foo (omp_interop_t *obj1)
diff --git a/gcc/testsuite/c-c++-common/gomp/append-args-interop.c b/gcc/testsuite/c-c++-common/gomp/append-args-interop.c
new file mode 100644
index 0000000..e9b1ed4
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/append-args-interop.c
@@ -0,0 +1,44 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-gimple" } */
+
+/* Test that interop objects are implicitly created/destroyed when a dispatch
+ construct doesn't provide enough of them to satisfy the declare variant
+ append_args clause. */
+
+/* The following definitions are in omp_lib, which cannot be included
+ in gcc/testsuite/ */
+
+#if __cplusplus >= 201103L
+# define __GOMP_UINTPTR_T_ENUM : __UINTPTR_TYPE__
+#else
+# define __GOMP_UINTPTR_T_ENUM
+#endif
+
+typedef enum omp_interop_t __GOMP_UINTPTR_T_ENUM
+{
+ omp_interop_none = 0,
+ __omp_interop_t_max__ = __UINTPTR_MAX__
+} omp_interop_t;
+
+float repl1(omp_interop_t, omp_interop_t, omp_interop_t);
+
+#pragma omp declare variant(repl1) match(construct={dispatch}) append_args(interop(target), interop(targetsync), interop (target))
+float base1(void);
+
+float
+test (int *a, int *b)
+{
+ omp_interop_t obj1;
+ float x;
+
+ /* repl1 takes 3 interop arguments, one will come from the dispatch
+ construct and the other 2 will be consed up. */
+ #pragma omp dispatch interop ( obj1 )
+ x = base1 ();
+
+ return x;
+}
+
+/* { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(D\.\[0-9\]+, 2, &interopobjs\.\[0-9\]+, &tgt_tgtsync\.\[0-9\]+," "gimple" } } */
+/* { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(D\.\[0-9\]+, 0, 0B, 0B, 0B, 0, 0B, 2, &interopobjs\.\[0-9\]+," "gimple" } } */
+/* { dg-final { scan-tree-dump "repl1 \\(obj1, interop\.\[0-9\]+, interop\.\[0-9\]+\\)" "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/assume-2.c b/gcc/testsuite/c-c++-common/gomp/assume-2.c
index 95a65fd..2cc066f 100644
--- a/gcc/testsuite/c-c++-common/gomp/assume-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/assume-2.c
@@ -31,12 +31,14 @@ foo (int i, int *a)
;
#pragma omp assume contains (begin assumes) /* { dg-error "invalid OpenMP directive name in 'contains' clause argument" } */
;
- #pragma omp assume contains (end assumes) /* { dg-error "invalid OpenMP directive name in 'contains' clause argument" } */
+ #pragma omp assume contains (end assumes) /* { dg-error "unknown OpenMP directive name in 'contains' clause argument" } */
;
#pragma omp assume contains (foo) /* { dg-error "unknown OpenMP directive name in 'contains' clause argument" } */
;
#pragma omp assume absent (target enter something) /* { dg-error "unknown OpenMP directive name in 'absent' clause argument" } */
;
+ #pragma omp assume contains (declare mapper) /* { dg-error "invalid OpenMP directive name in 'contains' clause argument: declarative, informational, and meta directives not permitted" } */
+ ;
#pragma omp assume foobar /* { dg-error "expected assumption clause" } */
;
#pragma omp assume ext_GCC_foobarbaz, ext_GCC_baz (1, 12, 1 < 17), no_parallelism /* { dg-warning "unknown assumption clause 'ext_GCC_foobarbaz'" } */
diff --git a/gcc/testsuite/c-c++-common/gomp/assumes-2.c b/gcc/testsuite/c-c++-common/gomp/assumes-2.c
index 68b88be..ee03b09 100644
--- a/gcc/testsuite/c-c++-common/gomp/assumes-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/assumes-2.c
@@ -13,7 +13,7 @@
#pragma omp assumes absent (assume) /* { dg-error "invalid OpenMP directive name in 'absent' clause argument" } */
#pragma omp assumes absent (assumes) /* { dg-error "invalid OpenMP directive name in 'absent' clause argument" } */
#pragma omp assumes contains (begin assumes) /* { dg-error "invalid OpenMP directive name in 'contains' clause argument" } */
-#pragma omp assumes contains (end assumes) /* { dg-error "invalid OpenMP directive name in 'contains' clause argument" } */
+#pragma omp assumes contains (end assumes) /* { dg-error "unknown OpenMP directive name in 'contains' clause argument" } */
#pragma omp assumes contains (foo) /* { dg-error "unknown OpenMP directive name in 'contains' clause argument" } */
#pragma omp assumes absent (target enter something) /* { dg-error "unknown OpenMP directive name in 'absent' clause argument" } */
#pragma omp assumes foobar /* { dg-error "expected assumption clause" } */
diff --git a/gcc/testsuite/c-c++-common/gomp/attrs-metadirective-2.c b/gcc/testsuite/c-c++-common/gomp/attrs-metadirective-2.c
index ff401c8..bdb41e1 100644
--- a/gcc/testsuite/c-c++-common/gomp/attrs-metadirective-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/attrs-metadirective-2.c
@@ -62,7 +62,7 @@ main (void)
when (device={arch("gcn")}: teams num_teams(256)),
default (teams num_teams(4)))]]
{
- //__label__ l1, l2;
+ __label__ l1, l2;
if (x)
goto l1;
diff --git a/gcc/testsuite/c-c++-common/gomp/attrs-metadirective-3.c b/gcc/testsuite/c-c++-common/gomp/attrs-metadirective-3.c
index 31dd054..803bf0a 100644
--- a/gcc/testsuite/c-c++-common/gomp/attrs-metadirective-3.c
+++ b/gcc/testsuite/c-c++-common/gomp/attrs-metadirective-3.c
@@ -9,7 +9,7 @@ f (int x[], int y[], int z[])
{
int i;
- [[omp::sequence (directive (target map(to: x, y) map(from: z)),
+ [[omp::sequence (directive (target map(to: x, y) map(from: z)), /* { dg-bogus "'target' construct with nested 'teams' construct contains directives outside of the 'teams' construct" "PR118694" { xfail offload_nvptx } } */
directive (metadirective
when (device={arch("nvptx")}: teams loop)
default (parallel loop)))]]
@@ -20,5 +20,6 @@ f (int x[], int y[], int z[])
/* If offload device "nvptx" isn't supported, the front end can eliminate
that alternative and not produce a metadirective at all. Otherwise this
won't be resolved until late. */
-/* { dg-final { scan-tree-dump-not "#pragma omp metadirective" "gimple" { target { ! offload_nvptx } } } } */
-/* { dg-final { scan-tree-dump "#pragma omp metadirective" "gimple" { target { offload_nvptx } } } } */
+/* { dg-final { scan-tree-dump-not "#pragma omp metadirective" "gimple" } } */
+/* { dg-final { scan-tree-dump-not " teams" "gimple" { target { ! offload_nvptx } } } } */
+/* { dg-final { scan-tree-dump "variant.\[0-9\]+ = \\\[omp_next_variant\\\] OMP_NEXT_VARIANT <0,\[\r\n \]+construct context = 14\[\r\n \]+1: device = \\{arch \\(.nvptx.\\)\\}\[\r\n \]+2: >;" "gimple" { target { offload_nvptx } } } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/begin-assumes-2.c b/gcc/testsuite/c-c++-common/gomp/begin-assumes-2.c
index 66b9180..189026d 100644
--- a/gcc/testsuite/c-c++-common/gomp/begin-assumes-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/begin-assumes-2.c
@@ -43,7 +43,7 @@ void f14 (void) {}
#pragma omp begin assumes contains (begin assumes) /* { dg-error "invalid OpenMP directive name in 'contains' clause argument" } */
void f15 (void) {}
#pragma omp end assumes
-#pragma omp begin assumes contains (end assumes) /* { dg-error "invalid OpenMP directive name in 'contains' clause argument" } */
+#pragma omp begin assumes contains (end assumes) /* { dg-error "unknown OpenMP directive name in 'contains' clause argument" } */
void f16 (void) {}
#pragma omp end assumes
#pragma omp begin assumes contains (foo) /* { dg-error "unknown OpenMP directive name in 'contains' clause argument" } */
diff --git a/gcc/testsuite/c-c++-common/gomp/clauses-3.c b/gcc/testsuite/c-c++-common/gomp/clauses-3.c
index 5618a91..a1f505a 100644
--- a/gcc/testsuite/c-c++-common/gomp/clauses-3.c
+++ b/gcc/testsuite/c-c++-common/gomp/clauses-3.c
@@ -17,9 +17,9 @@ main ()
bar (&s.v.a);
#pragma omp target map (s.v.a) map (always, to: s.u) map (s.x)
;
- #pragma omp target map (s.s[0]) map (s.v.b[:3])
+ #pragma omp target map (s.s[0]) map (s.v.b[ :3])
;
- #pragma omp target map (s.s[0]) map (s.v.b[:3])
+ #pragma omp target map (s.s[0]) map (s.v.b[ :3])
baz (s.s);
return 0;
}
diff --git a/gcc/testsuite/c-c++-common/gomp/declare-mapper-10.c b/gcc/testsuite/c-c++-common/gomp/declare-mapper-10.c
new file mode 100644
index 0000000..4020c4b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/declare-mapper-10.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-gimple" } */
+
+struct S {
+ int x,y;
+};
+
+#pragma omp declare mapper(default : struct S var) map(mapper(default), tofrom: var)
+#pragma omp declare mapper(only_x : struct S var) map(mapper(default), tofrom: var.x)
+
+void f(){
+ struct S z = {1,2};
+#pragma omp target defaultmap(alloc)
+ z.x += 5;
+#pragma omp target map(z)
+ z.x += 7;
+#pragma omp target map(mapper(default), tofrom: z)
+ z.x += 8;
+#pragma omp target map(mapper(only_x), tofrom: z)
+ z.x += 9;
+if (z.x != 1+5+7+8+9) __builtin_abort ();
+}
+
+/* { dg-final { scan-tree-dump-times "#pragma omp target num_teams\\(-2\\) thread_limit\\(0\\) defaultmap\\(alloc\\) map\\(tofrom:z \\\[len: 8\\\]\\)" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "#pragma omp target num_teams\\(-2\\) thread_limit\\(0\\) map\\(tofrom:z \\\[len: 8\\\]\\)" 2 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "#pragma omp target num_teams\\(-2\\) thread_limit\\(0\\) map\\(struct:z \\\[len: 1\\\]\\) map\\(tofrom:z.x \\\[len: 4\\\]\\)" 1 "gimple" } } */
+
+int main() {
+ f();
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/declare-mapper-11.c b/gcc/testsuite/c-c++-common/gomp/declare-mapper-11.c
new file mode 100644
index 0000000..1f65bad
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/declare-mapper-11.c
@@ -0,0 +1,70 @@
+#pragma omp declare mapper (int v)
+// { dg-error "missing 'map' clause before end of line" "" { target c++ } .-1 }
+// { dg-error "'int' is not a struct or union type in '#pragma omp declare mapper'" "" { target c } .-2 }
+
+#pragma omp declare mapper (float v) map()
+// { dg-error "expected primary-expression before '\\)' token" "" { target c++ } .-1 }
+// { dg-error "'float' is not a struct, union or class type in '#pragma omp declare mapper'" "" { target c++ } .-2 }
+// { dg-error "'float' is not a struct or union type in '#pragma omp declare mapper'" "" { target c } .-3 }
+
+#pragma omp declare mapper (char v) map(v)
+// { dg-error "'char' is not a struct, union or class type in '#pragma omp declare mapper'" "" { target c++ } .-1 }
+// { dg-error "'char' is not a struct or union type in '#pragma omp declare mapper'" "" { target c } .-2 }
+
+struct XT {
+ int x;
+};
+#pragma omp declare mapper (XT y) map()
+// { dg-error "expected primary-expression before '\\)' token" "" { target c++ } .-1 }
+// { dg-error "unknown type name 'XT'" "" { target c } .-2 }
+// { dg-error "expected end of line before 'y'" "" { target c } .-3 }
+#pragma omp declare mapper ( bar : struct XT y) map()
+// { dg-error "expected primary-expression before '\\)' token" "" { target c++ } .-1 }
+// { dg-error "expected expression before '\\)' token" "" { target c } .-2 }
+
+struct t {
+ int x;
+};
+
+typedef struct t myStruct;
+
+#pragma omp declare mapper(t)
+// { dg-error "expected unqualified-id before '\\)' token" "" { target c++ } .-1 }
+// { dg-error "unknown type name 't'" "" { target c } .-2 }
+// { dg-error "expected end of line before '\\)' token" "" { target c } .-3 }
+#pragma omp declare mapper(struct t)
+// { dg-error "expected unqualified-id before '\\)' token" "" { target c++ } .-1 }
+// { dg-error "expected identifier" "" { target c } .-2 }
+// { dg-error "expected end of line before '\\)' token" "" { target c } .-3 }
+#pragma omp declare mapper(myStruct)
+// { dg-error "expected unqualified-id before '\\)' token" "" { target c++ } .-1 }
+// { dg-error "expected identifier" "" { target c } .-2 }
+// { dg-error "expected end of line before '\\)' token" "" { target c } .-3 }
+
+#pragma omp declare mapper(name : t v) map()
+// { dg-error "expected primary-expression before '\\)' token" "" { target c++ } .-1 }
+// { dg-error "unknown type name 't'" "" { target c } .-2 }
+// { dg-error "expected end of line before 'v'" "" { target c } .-3 }
+
+#pragma omp declare mapper(fancy : struct t v) map(always,present,close,mapper(d),tofrom: v) // { dg-error "in 'declare mapper' directives, parameter to 'mapper' modifier must be 'default'" }
+
+#pragma omp declare mapper(myStruct v) map(v, v.x)
+// { dg-note "'#pragma omp declare mapper \\(myStruct\\)' previously declared here" "" { target c++ } .-1 }
+// { dg-note "'#pragma omp declare mapper' previously declared here" "" { target c } .-2 }
+#pragma omp declare mapper(default : struct t v) map(v, v.x)
+// { dg-error "redefinition of '#pragma omp declare mapper \\(t\\)'" "" { target c++ } .-1 }
+// { dg-error "redeclaration of '<default>' '#pragma omp declare mapper' for type 'struct t'" "" { target c } .-2 }
+
+union u_t { };
+union u_q { };
+
+#pragma omp declare mapper(union u_t v) map()
+// { dg-error "expected primary-expression before '\\)' token" "" { target c++ } .-1 }
+// { dg-error "expected expression before '\\)' token" "" { target c } .-2 }
+
+#pragma omp declare mapper( one : union u_t v) map(v)
+// { dg-note "'#pragma omp declare mapper \\(one: u_t\\)' previously declared here" "" { target c++ } .-1 }
+// { dg-note "'#pragma omp declare mapper' previously declared here" "" { target c } .-2 }
+#pragma omp declare mapper( one : union u_t u) map( u )
+// { dg-error "redefinition of '#pragma omp declare mapper \\(one: u_t\\)'" "" { target c++ } .-1 }
+// { dg-error "redeclaration of 'one' '#pragma omp declare mapper' for type 'union u_t'" "" { target c } .-2 }
diff --git a/gcc/testsuite/c-c++-common/gomp/declare-mapper-12.c b/gcc/testsuite/c-c++-common/gomp/declare-mapper-12.c
new file mode 100644
index 0000000..dffb19d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/declare-mapper-12.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+
+struct XYZ {
+ int a;
+ int *b;
+ int c;
+};
+
+#pragma omp declare mapper(struct XYZ t)
+/* { dg-error "missing 'map' clause" "" { target c } .-1 } */
+/* { dg-error "missing 'map' clause before end of line" "" { target c++ } .-2 } */
+
+struct ABC {
+ int *a;
+ int b;
+ int c;
+};
+
+#pragma omp declare mapper(struct ABC d) firstprivate(d.b)
+/* { dg-error "unexpected clause" "" { target c } .-1 } */
+/* { dg-error "expected end of line before '\\(' token" "" { target c } .-2 } */
+/* { dg-error "unexpected clause before '\\(' token" "" { target c++ } .-3 } */
diff --git a/gcc/testsuite/c-c++-common/gomp/declare-mapper-3.c b/gcc/testsuite/c-c++-common/gomp/declare-mapper-3.c
new file mode 100644
index 0000000..c0ec21b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/declare-mapper-3.c
@@ -0,0 +1,30 @@
+// { dg-do compile }
+// { dg-additional-options "-fdump-tree-gimple" }
+
+#include <stdlib.h>
+
+// Test named mapper invocation.
+
+struct S {
+ int *ptr;
+ int size;
+};
+
+int main (int argc, char *argv[])
+{
+ int N = 1024;
+#pragma omp declare mapper (mapN:struct S s) map(to:s.ptr, s.size) \
+ map(s.ptr[ :N])
+
+ struct S s;
+ s.ptr = (int *) malloc (sizeof (int) * N);
+
+#pragma omp target map(mapper(mapN), tofrom: s)
+// { dg-final { scan-tree-dump {map\(struct:s \[len: 2\]\) map\(alloc:s\.ptr \[len: [0-9]+\]\) map\(to:s\.size \[len: [0-9]+\]\) map\(tofrom:\*_[0-9]+ \[len: _[0-9]+\]\) map\(attach:s\.ptr \[bias: 0\]\)} "gimple" } }
+ {
+ for (int i = 0; i < N; i++)
+ s.ptr[i]++;
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/declare-mapper-4.c b/gcc/testsuite/c-c++-common/gomp/declare-mapper-4.c
new file mode 100644
index 0000000..39e3ab1
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/declare-mapper-4.c
@@ -0,0 +1,78 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-original" } */
+
+/* Check mapper binding clauses. */
+
+struct Y {
+ int z;
+};
+
+struct Z {
+ int z;
+};
+
+#pragma omp declare mapper (struct Y y) map(tofrom: y)
+#pragma omp declare mapper (struct Z z) map(tofrom: z)
+
+int foo (void)
+{
+ struct Y yy;
+ struct Z zz;
+ int dummy;
+
+#pragma omp target data map(dummy)
+ {
+ #pragma omp target
+ {
+ yy.z++;
+ zz.z++;
+ }
+ yy.z++;
+ }
+ return yy.z;
+}
+
+struct P
+{
+ struct Z *zp;
+};
+
+int bar (void)
+{
+ struct Y yy;
+ struct Z zz;
+ struct P pp;
+ struct Z t;
+ int dummy;
+
+ pp.zp = &t;
+
+#pragma omp declare mapper (struct Y y) map(tofrom: y.z)
+#pragma omp declare mapper (struct Z z) map(tofrom: z.z)
+
+#pragma omp target data map(dummy)
+ {
+ #pragma omp target
+ {
+ yy.z++;
+ zz.z++;
+ }
+ yy.z++;
+ }
+
+ #pragma omp declare mapper(struct P x) map(to:x.zp) map(tofrom:*x.zp)
+
+ #pragma omp target
+ {
+ zz = *pp.zp;
+ }
+
+ return zz.z;
+}
+
+/* { dg-final { scan-tree-dump-times {mapper_binding\(struct Y,omp declare mapper ~1Y\) mapper_binding\(struct Z,omp declare mapper ~1Z\)} 2 "original" { target c++ } } } */
+/* { dg-final { scan-tree-dump {mapper_binding\(struct Z,omp declare mapper ~1Z\) mapper_binding\(struct P,omp declare mapper ~1P\)} "original" { target c++ } } } */
+
+/* { dg-final { scan-tree-dump {mapper_binding\(struct Z,#pragma omp declare mapper \(struct Z z\) map\(tofrom:z\)\) mapper_binding\(struct Y,#pragma omp declare mapper \(struct Y y\) map\(tofrom:y\)\)} "original" { target c } } } */
+/* { dg-final { scan-tree-dump {mapper_binding\(struct Z,#pragma omp declare mapper \(struct Z z\) map\(tofrom:z\.z\)\) mapper_binding\(struct Y,#pragma omp declare mapper \(struct Y y\) map\(tofrom:y\.z\)\)} "original" { target c } } } */
+/* { dg-final { scan-tree-dump {mapper_binding\(struct P,#pragma omp declare mapper \(struct P x\) map\(tofrom:\(x\.zp\)\[0:1\]\) map\(to:x.zp\)\) mapper_binding\(struct Z,#pragma omp declare mapper \(struct Z z\) map\(tofrom:z\.z\)\)} "original" { target c } } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/declare-mapper-5.c b/gcc/testsuite/c-c++-common/gomp/declare-mapper-5.c
new file mode 100644
index 0000000..e8ab159
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/declare-mapper-5.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+
+typedef struct S_ {
+ int *myarr;
+ int size;
+} S;
+
+#pragma omp declare mapper (named: struct S_ v) map(to:v.size, v.myarr) \
+ map(tofrom: v.myarr[0:v.size])
+/* { dg-note "'#pragma omp declare mapper' previously declared here" "" { target c } .-2 } */
+/* { dg-note "'#pragma omp declare mapper \\(named: S_\\)' previously defined here" "" { target c++ } .-3 } */
+
+#pragma omp declare mapper (named: S v) map(to:v.size, v.myarr) \
+ map(tofrom: v.myarr[0:v.size])
+/* { dg-error "redeclaration of 'named' '#pragma omp declare mapper' for type 'S' \\\{aka 'struct S_'\\\}" "" { target c } .-2 } */
+/* { dg-error "redefinition of '#pragma omp declare mapper \\(named: S\\)'" "" { target c++ } .-3 } */
+
+#pragma omp declare mapper (struct S_ v) map(to:v.size, v.myarr) \
+ map(tofrom: v.myarr[0:v.size])
+/* { dg-note "'#pragma omp declare mapper' previously declared here" "" { target c } .-2 } */
+/* { dg-note "'#pragma omp declare mapper \\(S_\\)' previously defined here" "" { target c++ } .-3 } */
+
+#pragma omp declare mapper (S v) map(to:v.size, v.myarr) \
+ map(tofrom: v.myarr[0:v.size])
+/* { dg-error "redeclaration of '<default>' '#pragma omp declare mapper' for type 'S' \\\{aka 'struct S_'\\\}" "" { target c } .-2 } */
+/* { dg-error "redefinition of '#pragma omp declare mapper \\(S\\)'" "" { target c++ } .-3 } */
diff --git a/gcc/testsuite/c-c++-common/gomp/declare-mapper-6.c b/gcc/testsuite/c-c++-common/gomp/declare-mapper-6.c
new file mode 100644
index 0000000..c13eb8b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/declare-mapper-6.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+
+int x = 5;
+
+struct Q {
+ int *arr1;
+ int *arr2;
+ int *arr3;
+};
+
+#pragma omp declare mapper (struct Q myq) map(myq.arr2[0:x])
+
+struct R {
+ int *arr1;
+ int *arr2;
+ int *arr3;
+};
+
+#pragma omp declare mapper (struct R myr) map(myr.arr3[0:y])
+/* { dg-error "'y' undeclared" "" { target c } .-1 } */
+/* { dg-error "'y' was not declared in this scope" "" { target c++ } .-2 } */
+
+int y = 7;
diff --git a/gcc/testsuite/c-c++-common/gomp/declare-mapper-7.c b/gcc/testsuite/c-c++-common/gomp/declare-mapper-7.c
new file mode 100644
index 0000000..0f8dd25
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/declare-mapper-7.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+
+struct Q {
+ int *arr1;
+ int *arr2;
+ int *arr3;
+};
+
+int foo (void)
+{
+ int x = 5;
+ #pragma omp declare mapper (struct Q myq) map(myq.arr2[0:x])
+ return x;
+}
+
+struct R {
+ int *arr1;
+ int *arr2;
+ int *arr3;
+};
+
+int bar (void)
+{
+ #pragma omp declare mapper (struct R myr) map(myr.arr3[0:y])
+ /* { dg-error "'y' undeclared" "" { target c } .-1 } */
+ /* { dg-error "'y' was not declared in this scope" "" { target c++ } .-2 } */
+ int y = 7;
+ return y;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/declare-mapper-8.c b/gcc/testsuite/c-c++-common/gomp/declare-mapper-8.c
new file mode 100644
index 0000000..dadca28
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/declare-mapper-8.c
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+
+struct Q {
+ int *arr1;
+ int *arr2;
+ int *arr3;
+ int len;
+};
+
+struct R {
+ struct Q qarr[5];
+};
+
+struct R2 {
+ struct Q *qptr;
+};
+
+#pragma omp declare mapper (struct Q myq) map(myq.arr1[0:myq.len]) \
+ map(myq.arr2[0:myq.len]) \
+ map(myq.arr3[0:myq.len])
+
+#pragma omp declare mapper (struct R myr) map(myr.qarr[2:3])
+
+#pragma omp declare mapper (struct R2 myr2) map(myr2.qptr[2:3])
+
+int main (int argc, char *argv[])
+{
+ struct R r;
+ struct R2 r2;
+ int N = 256;
+
+#pragma omp target
+/* { dg-message "sorry, unimplemented: user-defined mapper with non-unit length array section" "" { target *-*-* } .-1 } */
+ {
+ for (int i = 2; i < 5; i++)
+ for (int j = 0; j < N; j++)
+ {
+ r.qarr[i].arr1[j]++;
+ r2.qptr[i].arr2[j]++;
+ }
+ }
+}
+
diff --git a/gcc/testsuite/c-c++-common/gomp/declare-mapper-9.c b/gcc/testsuite/c-c++-common/gomp/declare-mapper-9.c
new file mode 100644
index 0000000..709bc0c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/declare-mapper-9.c
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+
+int x = 5;
+
+struct Q {
+ int *arr1;
+ int *arr2;
+ int *arr3;
+};
+
+int y = 5;
+
+#pragma omp declare mapper (struct Q myq) map(myq.arr2[0:x])
+/* { dg-note "'#pragma omp declare mapper' previously declared here" "" { target c } .-1 } */
+/* { dg-note "'#pragma omp declare mapper \\(Q\\)' previously defined here" "" { target c++ } .-2 } */
+
+#pragma omp declare mapper (struct Q myq) map(myq.arr2[0:y])
+/* { dg-error "redeclaration of '<default>' '#pragma omp declare mapper' for type 'struct Q'" "" { target c } .-1 } */
+/* { dg-error "redefinition of '#pragma omp declare mapper \\(Q\\)'" "" { target c++ } .-2 } */
+
+struct R {
+ int *arr1;
+};
+
+void foo (void)
+{
+#pragma omp declare mapper (struct R myr) map(myr.arr1[0:x])
+/* { dg-note "'#pragma omp declare mapper' previously declared here" "" { target c } .-1 } */
+/* { dg-note "'#pragma omp declare mapper \\(R\\)' previously declared here" "" { target c++ } .-2 } */
+
+#pragma omp declare mapper (struct R myr) map(myr.arr1[0:y])
+/* { dg-error "redeclaration of '<default>' '#pragma omp declare mapper' for type 'struct R'" "" { target c } .-1 } */
+/* { dg-error "redeclaration of '#pragma omp declare mapper \\(R\\)'" "" { target c++ } .-2 } */
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c b/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c
index 7711dbc..83e1bb1 100644
--- a/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c
@@ -38,7 +38,7 @@ void f18 (void);
void f19 (void);
#pragma omp declare variant (f1) match(user={condition()}) /* { dg-error "expected \[^\n\r]*expression before '\\)' token" } */
void f20 (void);
-#pragma omp declare variant (f1) match(user={condition(f1)}) /* { dg-error "property must be integer expression" } */
+#pragma omp declare variant (f1) match(user={condition(f1)})
void f21 (void);
#pragma omp declare variant (f1) match(user={condition(1, 2, 3)}) /* { dg-error "expected '\\)' before ',' token" } */
void f22 (void);
@@ -47,10 +47,9 @@ void f23 (void);
#pragma omp declare variant (f1) match(construct={teams,parallel,master,for}) /* { dg-warning "unknown selector 'master' for context selector set 'construct'" } */
void f24 (void);
#pragma omp declare variant (f1) match(construct={parallel(1 /* { dg-error "selector 'parallel' does not accept any properties" } */
-void f25 (void); /* { dg-error "expected '\\\}' before end of line" "" { target c++ } .-1 } */
- /* { dg-error "expected '\\\}' before '\\(' token" "" { target c } .-2 } */
+void f25 (void); /* { dg-error "expected '\\\}' before end of line" "" { target *-*-* } .-1 } */
#pragma omp declare variant (f1) match(construct={parallel(1)}) /* { dg-error "selector 'parallel' does not accept any properties" } */
-void f26 (void); /* { dg-error "expected '\\\}' before '\\(' token" "" { target c } .-1 } */
+void f26 (void);
#pragma omp declare variant (f0) match(construct={simd(12)}) /* { dg-error "expected \[^\n\r]* clause before" } */
void f27 (void); /* { dg-error "'\\)' before numeric constant" "" { target c++ } .-1 } */
#pragma omp declare variant (f1) match(construct={parallel},construct={for}) /* { dg-error "selector set 'construct' specified more than once" } */
@@ -96,13 +95,13 @@ void f46 (void);
#pragma omp declare variant (f1) match(implementation={vendor("foobar")}) /* { dg-warning "unknown property '.foobar.' of 'vendor' selector" } */
void f47 (void);
#pragma omp declare variant (f1) match(implementation={unified_address(yes)}) /* { dg-error "selector 'unified_address' does not accept any properties" } */
-void f48 (void); /* { dg-error "expected '\\\}' before '\\(' token" "" { target c } .-1 } */
+void f48 (void);
#pragma omp declare variant (f1) match(implementation={unified_shared_memory(no)}) /* { dg-error "selector 'unified_shared_memory' does not accept any properties" } */
-void f49 (void); /* { dg-error "expected '\\\}' before '\\(' token" "" { target c } .-1 } */
+void f49 (void);
#pragma omp declare variant (f1) match(implementation={dynamic_allocators(42)}) /* { dg-error "selector 'dynamic_allocators' does not accept any properties" } */
-void f50 (void); /* { dg-error "expected '\\\}' before '\\(' token" "" { target c } .-1 } */
+void f50 (void);
#pragma omp declare variant (f1) match(implementation={reverse_offload()}) /* { dg-error "selector 'reverse_offload' does not accept any properties" } */
-void f51 (void); /* { dg-error "expected '\\\}' before '\\(' token" "" { target c } .-1 } */
+void f51 (void);
#pragma omp declare variant (f1) match(implementation={atomic_default_mem_order}) /* { dg-error "expected '\\(' before '\\\}' token" } */
void f52 (void);
#pragma omp declare variant (f1) match(implementation={atomic_default_mem_order(acquire)})
diff --git a/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-1.c b/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-1.c
new file mode 100644
index 0000000..28cac0d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-1.c
@@ -0,0 +1,55 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-gimple" } */
+
+/* Check basic functionality for the delimited form of "declare variant"
+ - no error re duplicate definitions
+ - variants are registered and correctly resolved at call site. */
+
+int foo (int a)
+{
+ return a;
+}
+
+int bar (int x)
+{
+ return x;
+}
+
+#pragma omp begin declare variant match (construct={target})
+int foo (int a)
+{
+ return a + 1;
+}
+
+int bar (int x)
+{
+ return x * 2;
+}
+#pragma omp end declare variant
+
+/* Because of the high score value, this variant for "bar" should always be
+ selected even when the one above also matches. */
+#pragma omp begin declare variant match (implementation={vendor(score(10000):"gnu")})
+int bar (int x)
+{
+ return x * 4;
+}
+#pragma omp end declare variant
+
+int main (void)
+{
+ if (foo (42) != 42) __builtin_abort ();
+ if (bar (3) != 12) __builtin_abort ();
+#pragma omp target
+ {
+ if (foo (42) != 43) __builtin_abort ();
+ if (bar (3) != 12) __builtin_abort ();
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "omp declare variant base \\(foo.ompvariant." 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "omp declare variant base \\(bar.ompvariant." 2 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "foo \\(42\\)" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "foo\\.ompvariant. \\(42\\)" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "bar \\(3\\)" 0 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "bar\\.ompvariant. \\(3\\)" 2 "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-2.c b/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-2.c
new file mode 100644
index 0000000..03bfe27
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-2.c
@@ -0,0 +1,66 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-foffload=disable -fdump-tree-original" } */
+
+/* Check for elision of preprocessed code in a begin/end declare variant
+ construct when it can be determined at parse time that the selector
+ can never match. */
+
+int foobar (int x, int y)
+{
+ return x * y;
+}
+
+int baz (int x)
+{
+ return x;
+}
+
+#pragma omp begin declare variant match (implementation={vendor("acme")}) /* { dg-warning "unknown property" } */
+int foobar (int x, int y)
+{
+ random junk that would ordinarily cause a parse error;
+ return x + y;
+}
+#pragma omp end declare variant
+
+#pragma omp begin declare variant match (device={kind(fpga)})
+int foobar (int x, int y)
+{
+ random junk that would ordinarily cause a parse error;
+ return x + y;
+}
+#pragma omp end declare variant
+
+/* Per the OpenMP specification, elision only happens when the implementation
+ or device selectors cannot match; the user/condition selector doesn't
+ matter for this. */
+#pragma omp begin declare variant match (user={condition (0)})
+int foobar (int x, int y)
+{
+ return x + y;
+}
+#pragma omp end declare variant
+
+/* Check that we're finding the right "omp end declare variant" when
+ constructs are nested. */
+#pragma omp begin declare variant match (implementation={vendor("acme")}) /* { dg-warning "unknown property" } */
+ #pragma omp begin declare variant match (device={kind(fpga)})
+ int baz (int x)
+ {
+ random junk that would ordinarily cause a parse error;
+ return x + 1;
+ }
+ #pragma omp end declare variant
+ #pragma omp begin declare variant match (device={kind(host)})
+ int baz (int x)
+ {
+ random junk that would ordinarily cause a parse error;
+ return x + 2;
+ }
+ #pragma omp end declare variant
+#pragma omp end declare variant
+
+/* { dg-final { scan-tree-dump-times "foobar.ompvariant" 1 "original" } } */
+/* { dg-final { scan-tree-dump-not "baz.ompvariant" "original" } } */
+
+
diff --git a/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-3.c b/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-3.c
new file mode 100644
index 0000000..6b9d819
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-3.c
@@ -0,0 +1,49 @@
+/* { dg-do compile } */
+
+/* Check that an error is diagnosed when a function defined in a
+ "begin declare variant" construct doesn't have a visible declaration
+ at that point.
+
+ The spec is not completely clear on this; it says the base function must be
+ "declared elsewhere without an associated declare variant directive",
+ without defining what "elsewhere" means. Particularly in C++ it would be
+ incorrect to inject such a declaration at the point of the variant
+ definition (think of a variant for a class method that is defined with a
+ qualified name outside of the class declaration, for instance). The C++
+ front end could differentiate between cases where base declaration injection
+ is allowed vs not, but for now it seems simplest just to require that a
+ definition always be visible. */
+
+/* This declaration of baz is incompatible with the variant below. */
+extern double baz (double, double);
+
+/* This is not a function at all. */
+extern int quux;
+
+#pragma omp begin declare variant match (construct={target})
+int foo (int a)
+{
+ return a + 1;
+}
+
+int bar (int x) /* { dg-error "no declaration of base function" } */
+{
+ return x * 2;
+}
+
+int baz (int x) /* { dg-error "variant function definition does not match declaration of .baz." } */
+{
+ return x * 2;
+}
+
+int quux (int x, int y) /* { dg-error "variant function definition does not match declaration of .quux." } */
+{
+ return x + y;
+}
+#pragma omp end declare variant
+
+/* It's supposedly allowed to define the base function after the variant. */
+int foo (int a)
+{
+ return a;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-4.c b/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-4.c
new file mode 100644
index 0000000..f6726ab
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-4.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+
+/* Check that a proper error is diagnosed if an "omp begin declare variant"
+ construct has an invalid selector, and that this causes the whole variant
+ to be skipped over rather than a duplicate definition error. */
+
+int foo (int a)
+{
+ return a;
+}
+
+#pragma omp begin declare variant match (construct=target) /* { dg-error "expected '\{' before 'target'" } */
+int foo (int a)
+{
+ return a + 1;
+}
+
+#pragma omp end declare variant
+
+int bar (int x)
+{
+ return x;
+}
+
+#pragma omp begin declare variant match (gibberish = {blah(1)}) /* { dg-error "expected context selector set name" } */
+int bar (int x)
+{
+ return x + 2;
+}
+
+#pragma omp end declare variant
diff --git a/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-5.c b/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-5.c
new file mode 100644
index 0000000..4e1645b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-5.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+
+/* Check that the simd trait is rejected in the match clause for
+ "begin declare variant". */
+
+int foo (int a)
+{
+ return a;
+}
+
+int bar (int x)
+{
+ return x;
+}
+
+#pragma omp begin declare variant match (construct={target, simd}) /* { dg-error "the 'simd' selector is not permitted" } */
+int foo (int a)
+{
+ return a + 1;
+}
+
+int bar (int x)
+{
+ return x * 2;
+}
+#pragma omp end declare variant
diff --git a/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-6.c b/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-6.c
new file mode 100644
index 0000000..0850063
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-6.c
@@ -0,0 +1,70 @@
+/* { dg-do compile { target x86_64-*-* } } */
+/* { dg-additional-options "-fdump-tree-gimple -foffload=disable" } */
+
+/* Test merging of context selectors for nested "begin declare variant"
+ directives.
+
+ The OpenMP 6.0 spec says: "the effective context selectors of the outer
+ directive are appended do the context selector of the inner directive to
+ form the effective context selector of the inner directive. If a
+ trait-set-selector is present on both directives, the trait-selector list of
+ the outer directive is appended to the trait-selector list of the inner
+ directive after equivalent trait-selectors have been removed from the outer
+ list." */
+
+int f1 (int x) { return x; }
+int f2 (int x) { return x; }
+int f3 (int x) { return x; }
+int f4 (int x) { return x; }
+int f5 (int x) { return x; }
+
+/* Check that duplicate traits can be detected, even when the properties
+ use different forms. (If these were considered different, it would
+ trigger an error instead.) */
+#pragma omp begin declare variant match (implementation={vendor(gnu)})
+#pragma omp begin declare variant match (implementation={vendor("gnu")})
+int f1 (int x) { return -x; }
+#pragma omp end declare variant
+#pragma omp end declare variant
+
+#pragma omp begin declare variant match (implementation={vendor("gnu")})
+#pragma omp begin declare variant match (implementation={vendor(gnu)})
+int f2 (int x) { return -x; }
+#pragma omp end declare variant
+#pragma omp end declare variant
+
+/* Check that non-duplicate traits are collected from both inner and outer. */
+
+#pragma omp begin declare variant match (device={kind("host")})
+#pragma omp begin declare variant match (device={arch("x86")})
+int f3 (int x) { return -x; }
+#pragma omp end declare variant
+#pragma omp end declare variant
+/* { dg-final { scan-tree-dump "f3\\.ompvariant.*kind \\(.host.\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "f3\\.ompvariant.*arch \\(.x86.\\)" "gimple" } } */
+
+/* Check that traits for construct selectors merge as expected. */
+
+#pragma omp begin declare variant match (construct={parallel, for})
+#pragma omp begin declare variant match (construct={teams})
+int f4 (int x) { return -x; }
+#pragma omp end declare variant
+#pragma omp end declare variant
+/* { dg-final { scan-tree-dump "f4\\.ompvariant.*teams, parallel, for" "gimple" } } */
+
+/* Check that multiple trait sets are collected. */
+
+extern int flag;
+
+#pragma omp begin declare variant match (construct={parallel, for})
+#pragma omp begin declare variant match (construct={teams})
+#pragma omp begin declare variant match (user={condition(flag)})
+#pragma omp begin declare variant match (device={kind("host")})
+int f5 (int x) { return -x; }
+#pragma omp end declare variant
+#pragma omp end declare variant
+#pragma omp end declare variant
+#pragma omp end declare variant
+/* { dg-final { scan-tree-dump "f5\\.ompvariant.*teams, parallel, for" "gimple" } } */
+/* { dg-final { scan-tree-dump "f5\\.ompvariant.*flag" "gimple" } } */
+/* { dg-final { scan-tree-dump "f5\\.ompvariant.*kind \\(.host.\\)" "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-7.c b/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-7.c
new file mode 100644
index 0000000..49a1d53
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-7.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-gimple" } */
+
+/* Test that merging of context selectors from an enclosing "begin declare
+ variant" directive applies to nested regular "declare variant" directives
+ (not just nested "begin declare variant", which is tested elsewhere). */
+
+extern int foo1 (int);
+extern int foo2 (int);
+
+#pragma omp begin declare variant match (implementation={vendor(gnu)})
+
+#pragma omp declare variant (foo1) \
+ match (construct={parallel,for})
+#pragma omp declare variant (foo2) \
+ match (device={kind(any)})
+extern int foo (int);
+
+#pragma omp end declare variant
+
+int foo (int x)
+{
+ return x + 42;
+}
+
+/* { dg-final { scan-tree-dump-times "omp declare variant base" 2 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "vendor \\(.gnu.\\)" 2 "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-8.c b/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-8.c
new file mode 100644
index 0000000..33f601d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-8.c
@@ -0,0 +1,54 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-gimple" } */
+
+/* This is the same as delim-declare-variant-1.c, but using attribute
+ syntax. */
+
+int foo (int a)
+{
+ return a;
+}
+
+int bar (int x)
+{
+ return x;
+}
+
+[[omp::directive (begin declare variant, match (construct={target}))]];
+int foo (int a)
+{
+ return a + 1;
+}
+
+int bar (int x)
+{
+ return x * 2;
+}
+[[omp::directive (end declare variant)]];
+
+/* Because of the high score value, this variant for "bar" should always be
+ selected even when the one above also matches. */
+[[omp::directive (begin declare variant match (implementation={vendor(score(10000):"gnu")}))]];
+int bar (int x)
+{
+ return x * 4;
+}
+[[omp::directive (end declare variant)]];
+
+int main (void)
+{
+ if (foo (42) != 42) __builtin_abort ();
+ if (bar (3) != 12) __builtin_abort ();
+#pragma omp target
+ {
+ if (foo (42) != 43) __builtin_abort ();
+ if (bar (3) != 12) __builtin_abort ();
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "omp declare variant base \\(foo.ompvariant." 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "omp declare variant base \\(bar.ompvariant." 2 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "foo \\(42\\)" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "foo\\.ompvariant. \\(42\\)" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "bar \\(3\\)" 0 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "bar\\.ompvariant. \\(3\\)" 2 "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-9.c b/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-9.c
new file mode 100644
index 0000000..6bf783e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/delim-declare-variant-9.c
@@ -0,0 +1,47 @@
+/* { dg-do compile } */
+
+/* Check diagnostics for mismatched pragma/attribute forms of delimited
+ declare variant. */
+
+int foo (int a)
+{
+ return a;
+}
+
+int bar (int x)
+{
+ return x;
+}
+
+[[omp::directive (begin declare variant match (construct={target}))]];
+int foo (int a)
+{
+ return a + 1;
+}
+
+int bar (int x)
+{
+ return x * 2;
+}
+#pragma omp end declare variant /* { dg-error "'begin declare variant' in attribute syntax terminated with 'end declare variant' in pragma syntax" } */
+
+/* Because of the high score value, this variant for "bar" should always be
+ selected even when the one above also matches. */
+#pragma omp begin declare variant match (implementation={vendor(score(10000):"gnu")})
+int bar (int x)
+{
+ return x * 4;
+}
+[[omp::directive (end declare variant)]]; /* { dg-error "'begin declare variant' in pragma syntax terminated with 'end declare variant' in attribute syntax" } */
+
+int main (void)
+{
+ if (foo (42) != 42) __builtin_abort ();
+ if (bar (3) != 12) __builtin_abort ();
+#pragma omp target
+ {
+ if (foo (42) != 43) __builtin_abort ();
+ if (bar (3) != 12) __builtin_abort ();
+ }
+}
+
diff --git a/gcc/testsuite/c-c++-common/gomp/depend-1.c b/gcc/testsuite/c-c++-common/gomp/depend-1.c
index 599031f..575bde9 100644
--- a/gcc/testsuite/c-c++-common/gomp/depend-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/depend-1.c
@@ -18,61 +18,61 @@ foo (int g[3][10], int h[4][8], int i[2][10], int j[][9],
;
#pragma omp task depend(out: t[2:5])
;
- #pragma omp task depend(inout: k[0.5:]) /* { dg-error "low bound \[^\n\r]* of array section does not have integral type" } */
+ #pragma omp task depend(inout: k[0.5: ]) /* { dg-error "low bound \[^\n\r]* of array section does not have integral type" } */
;
- #pragma omp task depend(in: l[:7.5f]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
+ #pragma omp task depend(in: l[ :7.5f]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
;
- #pragma omp task depend(out: m[p:]) /* { dg-error "low bound \[^\n\r]* of array section does not have integral type" } */
+ #pragma omp task depend(out: m[p: ]) /* { dg-error "low bound \[^\n\r]* of array section does not have integral type" } */
;
- #pragma omp task depend(inout: n[:p]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
+ #pragma omp task depend(inout: n[ :p]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
;
#pragma omp task depend(in: o[2:5]) /* { dg-error "does not have pointer or array type" } */
;
- #pragma omp task depend(out: a[:][2:4]) /* { dg-error "array type length expression must be specified" } */
+ #pragma omp task depend(out: a[ : ][2:4]) /* { dg-error "array type length expression must be specified" } */
;
- #pragma omp task depend(inout: b[-1:]) /* { dg-error "negative low bound in array section" } */
+ #pragma omp task depend(inout: b[-1: ]) /* { dg-error "negative low bound in array section" } */
;
- #pragma omp task depend(inout: c[:-3][1:1]) /* { dg-error "negative length in array section" } */
+ #pragma omp task depend(inout: c[ :-3][1:1]) /* { dg-error "negative length in array section" } */
;
- #pragma omp task depend(in: d[11:]) /* { dg-error "low bound \[^\n\r]* above array section size" } */
+ #pragma omp task depend(in: d[11: ]) /* { dg-error "low bound \[^\n\r]* above array section size" } */
;
- #pragma omp task depend(out: e[:11]) /* { dg-error "length \[^\n\r]* above array section size" } */
+ #pragma omp task depend(out: e[ :11]) /* { dg-error "length \[^\n\r]* above array section size" } */
;
#pragma omp task depend(out: f[1:10]) /* { dg-error "high bound \[^\n\r]* above array section size" } */
;
- #pragma omp task depend(in: g[:][2:4]) /* { dg-error "for array function parameter length expression must be specified" } */
+ #pragma omp task depend(in: g[ : ][2:4]) /* { dg-error "for array function parameter length expression must be specified" } */
;
- #pragma omp task depend(in: h[2:2][-1:]) /* { dg-error "negative low bound in array section" } */
+ #pragma omp task depend(in: h[2:2][-1: ]) /* { dg-error "negative low bound in array section" } */
;
- #pragma omp task depend(inout: h[:1][:-3]) /* { dg-error "negative length in array section" } */
+ #pragma omp task depend(inout: h[ :1][ :-3]) /* { dg-error "negative length in array section" } */
;
- #pragma omp task depend(out: i[:1][11:]) /* { dg-error "low bound \[^\n\r]* above array section size" } */
+ #pragma omp task depend(out: i[ :1][11: ]) /* { dg-error "low bound \[^\n\r]* above array section size" } */
;
- #pragma omp task depend(in: j[3:4][:10]) /* { dg-error "length \[^\n\r]* above array section size" } */
+ #pragma omp task depend(in: j[3:4][ :10]) /* { dg-error "length \[^\n\r]* above array section size" } */
;
#pragma omp task depend(out: j[30:10][5:5]) /* { dg-error "high bound \[^\n\r]* above array section size" } */
;
- #pragma omp task depend(out: a2[:3][2:4])
+ #pragma omp task depend(out: a2[ :3][2:4])
;
- #pragma omp task depend(inout: b2[0:])
+ #pragma omp task depend(inout: b2[0: ])
;
- #pragma omp task depend(inout: c2[:3][1:1])
+ #pragma omp task depend(inout: c2[ :3][1:1])
;
- #pragma omp task depend(in: d2[9:])
+ #pragma omp task depend(in: d2[9: ])
;
- #pragma omp task depend(out: e2[:10])
+ #pragma omp task depend(out: e2[ :10])
;
#pragma omp task depend(out: f2[1:9])
;
- #pragma omp task depend(in: g2[:2][2:4])
+ #pragma omp task depend(in: g2[ :2][2:4])
;
- #pragma omp task depend(in: h2[2:2][0:])
+ #pragma omp task depend(in: h2[2:2][0: ])
;
- #pragma omp task depend(inout: h2[:1][:3])
+ #pragma omp task depend(inout: h2[ :1][ :3])
;
- #pragma omp task depend(out: i2[:1][9:])
+ #pragma omp task depend(out: i2[ :1][9: ])
;
- #pragma omp task depend(in: j2[3:4][:9])
+ #pragma omp task depend(in: j2[3:4][ :9])
;
#pragma omp task depend(out: j2[30:10][5:4])
;
diff --git a/gcc/testsuite/c-c++-common/gomp/depend-2.c b/gcc/testsuite/c-c++-common/gomp/depend-2.c
index 99bf8ae..b566847 100644
--- a/gcc/testsuite/c-c++-common/gomp/depend-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/depend-2.c
@@ -6,12 +6,12 @@ void
foo (int a[10][10][10], int **b)
{
int c[10][10][10];
- #pragma omp task depend(out: a[2:4][3:][:7], b[1:7][2:8])
+ #pragma omp task depend(out: a[2:4][3: ][ :7], b[1:7][2:8])
bar (a);
int i = 1, j = 3, k = 2, l = 6;
- #pragma omp task depend(in: a[++i:++j][++k:][:++l])
+ #pragma omp task depend(in: a[++i:++j][++k: ][ :++l])
bar (a);
- #pragma omp task depend(out: a[7:2][:][:], c[5:2][:][:])
+ #pragma omp task depend(out: a[7:2][ : ][ : ], c[5:2][ : ][ : ])
{
bar (c);
bar (a);
diff --git a/gcc/testsuite/c-c++-common/gomp/depend-3.c b/gcc/testsuite/c-c++-common/gomp/depend-3.c
index 22fcd8d..2cea43a 100644
--- a/gcc/testsuite/c-c++-common/gomp/depend-3.c
+++ b/gcc/testsuite/c-c++-common/gomp/depend-3.c
@@ -6,16 +6,16 @@ void
foo (int a[10][10][10], int **b, int x)
{
int c[10][10][10];
- #pragma omp task depend(out: a[2:4][3:0][:7]) /* { dg-error "zero length array section" } */
+ #pragma omp task depend(out: a[2:4][3:0][ :7]) /* { dg-error "zero length array section" } */
bar (a);
- #pragma omp task depend(inout: b[:7][0:0][:0]) /* { dg-error "zero length array section" } */
+ #pragma omp task depend(inout: b[ :7][0:0][ :0]) /* { dg-error "zero length array section" } */
bar (a);
- #pragma omp task depend(in: c[:][:][10:]) /* { dg-error "zero length array section" } */
+ #pragma omp task depend(in: c[ : ][ : ][10: ]) /* { dg-error "zero length array section" } */
bar (c);
- #pragma omp task depend(out: a[2:4][3:0][:x]) /* { dg-error "zero length array section" } */
+ #pragma omp task depend(out: a[2:4][3:0][ :x]) /* { dg-error "zero length array section" } */
bar (a);
- #pragma omp task depend(inout: b[:x][0:0][:0]) /* { dg-error "zero length array section" } */
+ #pragma omp task depend(inout: b[ :x][0:0][ :0]) /* { dg-error "zero length array section" } */
bar (a);
- #pragma omp task depend(in: c[:][x-2:x][10:]) /* { dg-error "zero length array section" } */
+ #pragma omp task depend(in: c[ : ][x-2:x][10: ]) /* { dg-error "zero length array section" } */
bar (c);
}
diff --git a/gcc/testsuite/c-c++-common/gomp/depend-4.c b/gcc/testsuite/c-c++-common/gomp/depend-4.c
index d40b1fa..0fd771e 100644
--- a/gcc/testsuite/c-c++-common/gomp/depend-4.c
+++ b/gcc/testsuite/c-c++-common/gomp/depend-4.c
@@ -25,13 +25,13 @@ foo (int *p, int (*q)[10], int r[10], int s[10][10])
;
#pragma omp task depend (inout: p[2:-3]) /* { dg-error "negative length in array section in" } */
;
- #pragma omp task depend (inout: q[2:-3][:]) /* { dg-error "negative length in array section in" } */
+ #pragma omp task depend (inout: q[2:-3][ : ]) /* { dg-error "negative length in array section in" } */
;
#pragma omp task depend (inout: q[2:3][0:-1]) /* { dg-error "negative length in array section in" } */
;
#pragma omp task depend (inout: r[2:-5]) /* { dg-error "negative length in array section in" } */
;
- #pragma omp task depend (inout: s[2:-5][:]) /* { dg-error "negative length in array section in" } */
+ #pragma omp task depend (inout: s[2:-5][ : ]) /* { dg-error "negative length in array section in" } */
;
#pragma omp task depend (inout: s[2:5][0:-4]) /* { dg-error "negative length in array section in" } */
;
diff --git a/gcc/testsuite/c-c++-common/gomp/depend-5.c b/gcc/testsuite/c-c++-common/gomp/depend-5.c
index 993987f..3a1b707 100644
--- a/gcc/testsuite/c-c++-common/gomp/depend-5.c
+++ b/gcc/testsuite/c-c++-common/gomp/depend-5.c
@@ -15,11 +15,11 @@ foo (void)
;
#pragma omp task depend(out: d[2])
;
- #pragma omp task depend(in: d[:])
+ #pragma omp task depend(in: d[ : ])
;
#pragma omp task depend(in: d[2:2])
;
- #pragma omp task depend(in: d[:2])
+ #pragma omp task depend(in: d[ :2])
;
#pragma omp task depend(inout: d[1].b->c[2])
;
diff --git a/gcc/testsuite/c-c++-common/gomp/depend-6.c b/gcc/testsuite/c-c++-common/gomp/depend-6.c
index 4684653..c365cf6 100644
--- a/gcc/testsuite/c-c++-common/gomp/depend-6.c
+++ b/gcc/testsuite/c-c++-common/gomp/depend-6.c
@@ -13,9 +13,9 @@ struct U i;
void
foo (void)
{
- #pragma omp task depend(in: d[:2].b->c[2]) /* { dg-error "expected" } */
+ #pragma omp task depend(in: d[ :2].b->c[2]) /* { dg-error "expected" } */
;
- #pragma omp task depend(inout: d[1:].b->c[2]) /* { dg-error "expected" } */
+ #pragma omp task depend(inout: d[1: ].b->c[2]) /* { dg-error "expected" } */
;
#pragma omp task depend(out: d[0:1].a) /* { dg-error "expected" } */
;
diff --git a/gcc/testsuite/c-c++-common/gomp/dispatch-1.c b/gcc/testsuite/c-c++-common/gomp/dispatch-1.c
index 2a4e939..35eb3b8 100644
--- a/gcc/testsuite/c-c++-common/gomp/dispatch-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/dispatch-1.c
@@ -64,7 +64,7 @@ void f1 (void)
f2 ();
#pragma omp dispatch depend(inout: sp)
f2 ();
-#pragma omp dispatch depend(inoutset: arr[:2])
+#pragma omp dispatch depend(inoutset: arr[ :2])
f2 ();
#pragma omp dispatch depend(out: arr)
f2 ();
diff --git a/gcc/testsuite/c-c++-common/gomp/dispatch-11.c b/gcc/testsuite/c-c++-common/gomp/dispatch-11.c
index e59985a..79dcd0a 100644
--- a/gcc/testsuite/c-c++-common/gomp/dispatch-11.c
+++ b/gcc/testsuite/c-c++-common/gomp/dispatch-11.c
@@ -87,12 +87,9 @@ test (int *a, int *b)
base3 (a, b);
/* { dg-error "number of list items in 'interop' clause \\(2\\) exceeds the number of 'append_args' items \\(1\\) for 'declare variant' candidate 'repl3'" "" { target c } .-2 } */
/* { dg-error "number of list items in 'interop' clause \\(2\\) exceeds the number of 'append_args' items \\(1\\) for 'declare variant' candidate 'void repl3\\(int\\*, int\\*, omp_interop_t\\)'" "" { target c++ } .-3 } */
- /* { dg-note "required by 'dispatch' construct" "" { target *-*-* } .-4 } */
#pragma omp dispatch interop(obj3)
base3 (a, b);
- /* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'repl3'" "" { target c } 28 } */
- /* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'void repl3\\(int\\*, int\\*, omp_interop_t\\)'" "" { target c++ } 28 } */
return x + y;
}
diff --git a/gcc/testsuite/c-c++-common/gomp/dyn_groupprivate-1.c b/gcc/testsuite/c-c++-common/gomp/dyn_groupprivate-1.c
new file mode 100644
index 0000000..c49189d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/dyn_groupprivate-1.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-original" } */
+
+void f()
+{
+ int N = 1024;
+
+ #pragma omp target dyn_groupprivate(1024) // { dg-message "sorry, unimplemented: 'dyn_groupprivate' clause" }
+ ;
+
+ #pragma omp target dyn_groupprivate (1024 * N) // { dg-message "sorry, unimplemented: 'dyn_groupprivate' clause" }
+ ;
+
+ #pragma omp target dyn_groupprivate ( fallback ( abort ) : N) // { dg-message "sorry, unimplemented: 'dyn_groupprivate' clause" }
+ ;
+
+ #pragma omp target dyn_groupprivate ( fallback ( null ) : N) // { dg-message "sorry, unimplemented: 'dyn_groupprivate' clause" }
+ ;
+
+ #pragma omp target dyn_groupprivate ( fallback ( default_mem ) : N) // { dg-message "sorry, unimplemented: 'dyn_groupprivate' clause" }
+ ;
+}
+
+/* { dg-final { scan-tree-dump-times "#pragma omp target dyn_groupprivate\\(1024\\)" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "#pragma omp target dyn_groupprivate\\(N \\* 1024\\)" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "#pragma omp target dyn_groupprivate\\(fallback\\(abort\\):N\\)" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "#pragma omp target dyn_groupprivate\\(fallback\\(null\\):N\\)" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "#pragma omp target dyn_groupprivate\\(fallback\\(default_mem\\):N\\)" 1 "original" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/dyn_groupprivate-2.c b/gcc/testsuite/c-c++-common/gomp/dyn_groupprivate-2.c
new file mode 100644
index 0000000..f12ff7b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/dyn_groupprivate-2.c
@@ -0,0 +1,72 @@
+/* { dg-do compile } */
+
+void f()
+{
+#if !defined(__cplusplus) || __cplusplus >= 201103L
+ constexpr int M = 1024; // C20 + C++11
+#endif
+ int N, A[1];
+ N = 1024;
+
+ #pragma omp target dyn_groupprivate(0)
+ ;
+
+ #pragma omp target dyn_groupprivate(0) dyn_groupprivate(0) // { dg-error "too many 'dyn_groupprivate' clauses" }
+ ;
+
+ #pragma omp target dyn_groupprivate(1,) // { dg-error "expected '\\)' before ',' token" }
+ ;
+
+ #pragma omp target dyn_groupprivate(-123) // { dg-warning "'dyn_groupprivate' value must be non-negative \\\[-Wopenmp\\\]" }
+ ;
+
+#if !defined(__cplusplus) || __cplusplus >= 201103L
+ #pragma omp target dyn_groupprivate (0 * M - 1) // { dg-warning "'dyn_groupprivate' value must be non-negative \\\[-Wopenmp\\\]" "" { target { ! c++98_only } } }
+#endif
+ ;
+
+ #pragma omp target dyn_groupprivate (- 4) // { dg-warning "'dyn_groupprivate' value must be non-negative \\\[-Wopenmp\\\]" }
+ ;
+
+ #pragma omp target dyn_groupprivate ( fallback ( other ) : N) // { dg-error "expected 'abort', 'default_mem', or 'null' as fallback mode before 'other'" }
+ // { dg-error "expected an OpenMP clause before ':' token" "" { target c++ } .-1 }
+ ;
+
+ #pragma omp target dyn_groupprivate ( A )
+ // { dg-error "expected integer expression" "" { target c } .-1 }
+ // { dg-error "'dyn_groupprivate' expression must be integral" "" { target c++ } .-2 }
+ ;
+
+ #pragma omp target dyn_groupprivate ( 1024. )
+ // { dg-error "expected integer expression" "" { target c } .-1 }
+ // { dg-error "'dyn_groupprivate' expression must be integral" "" { target c++ } .-2 }
+ ;
+
+ #pragma omp target dyn_groupprivate ( foo ( 4 ) : 10 ) // { dg-error "expected 'fallback' modifier before 'foo'" }
+ ;
+
+ #pragma omp target dyn_groupprivate ( foo2 ( ) : 10 ) // { dg-error "expected 'fallback' modifier before 'foo2'" }
+ ;
+
+ #pragma omp target dyn_groupprivate ( fallback ( ) : 10 ) // { dg-error "expected 'abort', 'default_mem', or 'null' as fallback mode before '\\)'" }
+ // { dg-error "expected an OpenMP clause before ':' token" "" { target c++ } .-1 }
+ ;
+
+ #pragma omp target dyn_groupprivate ( bar : 10 ) // { dg-error "expected 'fallback' modifier before 'bar'" }
+ ;
+
+ #pragma omp target dyn_groupprivate ( fallback : 10 ) // { dg-error "expected '\\(' before ':' token" }
+ // { dg-error "expected an OpenMP clause before ':' token" "" { target c++ } .-1 }
+ ;
+
+ #pragma omp target dyn_groupprivate ( fallback ( null,) : 10 ) // { dg-error "expected '\\)' before ',' token" }
+ // { dg-error "expected an OpenMP clause before '\\)' token" "" { target c++ } .-1 }
+ ;
+}
+
+// { dg-message "sorry, unimplemented: 'dyn_groupprivate' clause" "" { target *-*-* } 11 }
+// { dg-message "sorry, unimplemented: 'dyn_groupprivate' clause" "" { target *-*-* } 14 }
+// { dg-message "sorry, unimplemented: 'dyn_groupprivate' clause" "" { target *-*-* } 17 }
+// { dg-message "sorry, unimplemented: 'dyn_groupprivate' clause" "" { target *-*-* } 20 }
+// { dg-message "sorry, unimplemented: 'dyn_groupprivate' clause" "" { target { ! c++98_only } } 24 }
+// { dg-message "sorry, unimplemented: 'dyn_groupprivate' clause" "" { target *-*-* } 28 }
diff --git a/gcc/testsuite/c-c++-common/gomp/imperfect1.c b/gcc/testsuite/c-c++-common/gomp/imperfect1.c
index 705626a..bef783b 100644
--- a/gcc/testsuite/c-c++-common/gomp/imperfect1.c
+++ b/gcc/testsuite/c-c++-common/gomp/imperfect1.c
@@ -15,7 +15,7 @@ void s1 (int a1, int a2, int a3)
f1 (0, i);
for (j = 0; j < a2; j++)
{
-#pragma omp barrier /* { dg-error "intervening code must not contain OpenMP directives" } */
+#pragma omp barrier /* { dg-error "intervening code must not contain executable OpenMP directives" } */
f1 (1, j);
if (i == 2)
continue; /* { dg-error "invalid exit" } */
diff --git a/gcc/testsuite/c-c++-common/gomp/imperfect4.c b/gcc/testsuite/c-c++-common/gomp/imperfect4.c
index 1a0c07c..30d1cc6 100644
--- a/gcc/testsuite/c-c++-common/gomp/imperfect4.c
+++ b/gcc/testsuite/c-c++-common/gomp/imperfect4.c
@@ -21,7 +21,7 @@ void s1 (int a1, int a2, int a3)
/* According to the grammar, this is intervening code; we
don't know that we are also missing a nested for loop
until we have parsed this whole compound expression. */
-#pragma omp barrier /* { dg-error "intervening code must not contain OpenMP directives" } */
+#pragma omp barrier /* { dg-error "intervening code must not contain executable OpenMP directives" } */
f1 (2, k);
f2 (2, k);
}
diff --git a/gcc/testsuite/c-c++-common/gomp/interop-1.c b/gcc/testsuite/c-c++-common/gomp/interop-1.c
index d68611b..2a81d4b 100644
--- a/gcc/testsuite/c-c++-common/gomp/interop-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/interop-1.c
@@ -40,12 +40,12 @@ void f()
omp_interop_t obj1, obj2, obj3, obj4, obj5;
int x;
- #pragma omp interop init(obj1) init(target,targetsync : obj2, obj3) nowait // OK
- #pragma omp interop init(obj1) init (targetsync : obj2, obj3) nowait // OK
- #pragma omp interop init(obj1) init (targetsync , target : obj2, obj3) nowait // OK
+ #pragma omp interop init(targetsync: obj1) init(target,targetsync : obj2, obj3) nowait // OK
+ #pragma omp interop init(target: obj1) init (targetsync : obj2, obj3) nowait // OK
+ #pragma omp interop init(target: obj1) init (targetsync , target : obj2, obj3) nowait // OK
- #pragma omp interop init(obj1) init(target,targetsync,target: obj2, obj3) nowait // { dg-error "duplicate 'target' modifier" }
- #pragma omp interop init(obj1) init(target,targetsync, targetsync : obj2, obj3) nowait // { dg-error "duplicate 'targetsync' modifier" }
+ #pragma omp interop init(target: obj1) init(target,targetsync,target: obj2, obj3) nowait // { dg-error "duplicate 'target' modifier" }
+ #pragma omp interop init(target: obj1) init(target,targetsync, targetsync : obj2, obj3) nowait // { dg-error "duplicate 'targetsync' modifier" }
#pragma omp interop init(prefer_type("cuda", omp_ifr_opencl, omp_ifr_level_zero, "hsa"), targetsync : obj1) \
destroy(obj2, obj3) depend(inout: x) use(obj4, obj5) device(device_num: 0)
@@ -54,10 +54,10 @@ void f()
#pragma omp assume contains(interop)
{
- #pragma omp interop init(prefer_type("cuða") : obj3) // { dg-warning "unknown foreign runtime identifier 'cu\[^'\]*a'" }
+ #pragma omp interop init(target, prefer_type("cuða") : obj3) // { dg-warning "unknown foreign runtime identifier 'cu\[^'\]*a'" }
}
- #pragma omp interop init(prefer_type("cu\0da") : obj3) // { dg-error "string literal must not contain '\\\\0'" }
+#pragma omp interop init(target, prefer_type("cu\0da") : obj3) // { dg-error "string literal must not contain '\\\\0'" }
#pragma omp interop depend(inout: x) , use(obj2), destroy(obj3) // OK, use or destroy might have 'targetsync'
@@ -69,49 +69,47 @@ void f()
#pragma omp interop init ( target , prefer_type( { fr("hsa"), attr("ompx_nothing") , fr("hsa" ) }) :obj1) // { dg-error "duplicated 'fr' preference selector before '\\(' token" }
- #pragma omp interop init ( prefer_type( 4, omp_ifr_hip*4) : obj1) // { dg-warning "unknown foreign runtime identifier '20'" }
- #pragma omp interop init ( prefer_type( __builtin_sin(3.3) : obj1)
- // { dg-error "'prefer_type' undeclared \\(first use in this function\\)" "" { target c } .-1 }
- // { dg-error "'prefer_type' has not been declared" "" { target c++ } .-2 }
- // { dg-error "expected '\\)' before '\\(' token" "" { target *-*-* } .-3 }
-
- #pragma omp interop init ( prefer_type( __builtin_sin(3.3) ) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" }
- #pragma omp interop init ( prefer_type( {fr(4 ) }) : obj1) // OK
- #pragma omp interop init ( prefer_type( {fr("cu\0da" ) }) : obj1) // { dg-error "string literal must not contain '\\\\0'" }
- #pragma omp interop init ( prefer_type( {fr("cuda\0") }) : obj1) // { dg-error "string literal must not contain '\\\\0'" }
- #pragma omp interop init ( prefer_type( {fr("cuda" ) }) : obj1) // OK
- #pragma omp interop init ( prefer_type( {fr(omp_ifr_level_zero ) }, {fr(omp_ifr_hip)}) : obj1) // OK
- #pragma omp interop init ( prefer_type( {fr("cuda", "cuda_driver") }) : obj1) // { dg-error "53: expected '\\)' before ',' token" }
- #pragma omp interop init ( prefer_type( {fr(my_string) }) : obj1) // { dg-error "56: expected string literal or constant integer expression before '\\)' token" }
- #pragma omp interop init ( prefer_type( {fr("hello" }) : obj1) // { dg-error "expected '\\)' before '\\(' token" }
- // { dg-error "'prefer_type' has not been declared" "" { target c++ } .-1 }
- #pragma omp interop init ( prefer_type( {fr("hello") }) : obj1)
+ #pragma omp interop init (target, prefer_type( 4, omp_ifr_hip*4) : obj1) // { dg-warning "unknown foreign runtime identifier '20'" }
+ #pragma omp interop init (prefer_type( __builtin_sin(3.3), target : obj1)
+ // { dg-error "expected string literal or constant integer expression" "" { target *-*-* } .-1 }
+
+#pragma omp interop init (prefer_type( __builtin_sin(3.3)), target : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" }
+ #pragma omp interop init (target, prefer_type( {fr(4 ) }) : obj1) // OK
+ #pragma omp interop init (target, prefer_type( {fr("cu\0da" ) }) : obj1) // { dg-error "string literal must not contain '\\\\0'" }
+ #pragma omp interop init (target, prefer_type( {fr("cuda\0") }) : obj1) // { dg-error "string literal must not contain '\\\\0'" }
+ #pragma omp interop init (target, prefer_type( {fr("cuda" ) }) : obj1) // OK
+ #pragma omp interop init (target, prefer_type( {fr(omp_ifr_level_zero ) }, {fr(omp_ifr_hip)}) : obj1) // OK
+ #pragma omp interop init (target, prefer_type( {fr("cuda", "cuda_driver") }) : obj1) // { dg-error "60: expected '\\)' before ',' token" }
+ #pragma omp interop init (target, prefer_type( {fr(my_string) }) : obj1) // { dg-error "63: expected string literal or constant integer expression before '\\)' token" }
+ #pragma omp interop init (target, prefer_type( {fr("hello" }) : obj1) // { dg-error "expected '\\)' before '\}' token" }
+ /* { dg-warning "unknown foreign runtime identifier 'hello' \\\[-Wopenmp\\\]" "" { target *-*-* } .-1 } */
+ #pragma omp interop init (target, prefer_type( {fr("hello") }) : obj1)
/* { dg-warning "unknown foreign runtime identifier 'hello' \\\[-Wopenmp\\\]" "" { target *-*-* } .-1 } */
- #pragma omp interop init ( prefer_type( {fr(x) }) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" }
+ #pragma omp interop init (target, prefer_type( {fr(x) }) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" }
- #pragma omp interop init ( prefer_type( {fr(ifr_scalar ) }) : obj1) // OK
- #pragma omp interop init ( prefer_type( {fr(ifr_array ) }) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" }
+ #pragma omp interop init (target, prefer_type( {fr(ifr_scalar ) }) : obj1) // OK
+ #pragma omp interop init (target, prefer_type( {fr(ifr_array ) }) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" }
// OK in C++, for C: constexpr arrays are not part of C23; however, they are/were under consideration for C2y.
- #pragma omp interop init ( prefer_type( {fr(ifr_array[0] ) }) : obj1)
+ #pragma omp interop init (target, prefer_type( {fr(ifr_array[0] ) }) : obj1)
// { dg-error "expected string literal or constant integer expression before '\\)' token" "" { target c } .-1 }
- #pragma omp interop init ( prefer_type( omp_ifr_level_zero, omp_ifr_hip ) : obj1) // OK
- #pragma omp interop init ( prefer_type( omp_ifr_level_zero +1 ) : obj1) // OK
- #pragma omp interop init ( prefer_type( x ) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" }
+ #pragma omp interop init (target, prefer_type( omp_ifr_level_zero, omp_ifr_hip ) : obj1) // OK
+ #pragma omp interop init (target, prefer_type( omp_ifr_level_zero +1 ) : obj1) // OK
+ #pragma omp interop init (target, prefer_type( x ) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" }
- #pragma omp interop init ( prefer_type( ifr_scalar ) : obj1) // OK
- #pragma omp interop init ( prefer_type( ifr_array ) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" }
+ #pragma omp interop init (target, prefer_type( ifr_scalar ) : obj1) // OK
+ #pragma omp interop init (target, prefer_type( ifr_array ) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" }
// OK in C++, for C: constexpr arrays are not part of C23; however, they are/were under consideration for C2y.
- #pragma omp interop init ( prefer_type( ifr_array[1] ) : obj1)
+ #pragma omp interop init (target, prefer_type( ifr_array[1] ) : obj1)
// { dg-error "expected string literal or constant integer expression before '\\)' token" "" { target c } .-1 }
- #pragma omp interop init ( prefer_type( 4, omp_ifr_hip*4) : obj1) // { dg-warning "unknown foreign runtime identifier '20'" }
- #pragma omp interop init ( prefer_type( 4, 1, 3) : obj1)
+ #pragma omp interop init (target, prefer_type( 4, omp_ifr_hip*4) : obj1) // { dg-warning "unknown foreign runtime identifier '20'" }
+ #pragma omp interop init (target, prefer_type( 4, 1, 3) : obj1)
- #pragma omp interop init ( prefer_type( {fr("cuda") }, {fr(omp_ifr_hsa)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1)
- #pragma omp interop init ( prefer_type( {fr("cuda") }, {fr(omp_ifr_hsa,omp_ifr_level_zero)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1) // { dg-error "73: expected '\\)' before ',' token" }
- #pragma omp interop init ( prefer_type( {fr("cuda",5) }, {fr(omp_ifr_hsa,omp_ifr_level_zero)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1) // { dg-error "53: expected '\\)' before ',' token" }
- #pragma omp interop init ( prefer_type( {fr("sycl"), attr("ompx_1", "ompx_2"), attr("ompx_3") }, {attr("ompx_4", "ompx_5"),fr(omp_ifr_level_zero)} ) : obj1)
- #pragma omp interop init ( prefer_type( { fr(5), attr("ompx_1") }, {fr(omp_ifr_hsa)} , {attr("ompx_a") } ) : obj1)
+ #pragma omp interop init (target, prefer_type( {fr("cuda") }, {fr(omp_ifr_hsa)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1)
+ #pragma omp interop init (target, prefer_type( {fr("cuda") }, {fr(omp_ifr_hsa,omp_ifr_level_zero)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1) // { dg-error "80: expected '\\)' before ',' token" }
+ #pragma omp interop init (target, prefer_type( {fr("cuda",5) }, {fr(omp_ifr_hsa,omp_ifr_level_zero)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1) // { dg-error "60: expected '\\)' before ',' token" }
+ #pragma omp interop init (target, prefer_type( {fr("sycl"), attr("ompx_1", "ompx_2"), attr("ompx_3") }, {attr("ompx_4", "ompx_5"),fr(omp_ifr_level_zero)} ) : obj1)
+ #pragma omp interop init (target, prefer_type( { fr(5), attr("ompx_1") }, {fr(omp_ifr_hsa)} , {attr("ompx_a") } ) : obj1)
}
diff --git a/gcc/testsuite/c-c++-common/gomp/interop-2.c b/gcc/testsuite/c-c++-common/gomp/interop-2.c
index af81cc6..3e6ed81 100644
--- a/gcc/testsuite/c-c++-common/gomp/interop-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/interop-2.c
@@ -41,18 +41,18 @@ void f(const omp_interop_t ocp)
short o2;
float of;
- #pragma omp interop init (ocp) // { dg-error "'ocp' shall not be const" }
- #pragma omp interop init (oce) // { dg-error "'oce' shall not be const" }
- #pragma omp interop init (occ) // { dg-error "'occ' shall not be const" }
- #pragma omp interop init (od) // { dg-error "'od' must be of 'omp_interop_t'" }
- #pragma omp interop init (od[1])// { dg-error "expected '\\)' before '\\\[' token" }
+ #pragma omp interop init (targetsync: ocp) // { dg-error "'ocp' shall not be const" }
+ #pragma omp interop init (targetsync: oce) // { dg-error "'oce' shall not be const" }
+ #pragma omp interop init (targetsync: occ) // { dg-error "'occ' shall not be const" }
+ #pragma omp interop init (targetsync: od) // { dg-error "'od' must be of 'omp_interop_t'" }
+ #pragma omp interop init (targetsync: od[1])// { dg-error "expected '\\)' before '\\\[' token" }
// { dg-error "'od' must be of 'omp_interop_t'" "" { target *-*-* } .-1 }
- #pragma omp interop init (op) // { dg-error "'op' must be of 'omp_interop_t'" }
- #pragma omp interop init (*op)
+ #pragma omp interop init (targetsync: op) // { dg-error "'op' must be of 'omp_interop_t'" }
+ #pragma omp interop init (targetsync: *op)
// { dg-error "expected identifier before '\\*' token" "" { target c } .-1 }
// { dg-error "expected unqualified-id before '\\*' token" "" { target c++ } .-2 }
- #pragma omp interop init (o2) // { dg-error "'o2' must be of 'omp_interop_t'" }
- #pragma omp interop init (of) // { dg-error "'of' must be of 'omp_interop_t'" }
+ #pragma omp interop init (targetsync: o2) // { dg-error "'o2' must be of 'omp_interop_t'" }
+ #pragma omp interop init (targetsync: of) // { dg-error "'of' must be of 'omp_interop_t'" }
#pragma omp interop use (ocp) // OK
#pragma omp interop use (oce) // odd but okay
@@ -86,40 +86,26 @@ void g()
omp_interop_t obj1, obj2, obj3, obj4, obj5;
int x;
- #pragma omp interop init ( prefer_type( {fr("") }) : obj1) // { dg-error "non-empty string literal expected before '\\)' token" }
- #pragma omp interop init ( prefer_type( {fr("hip") , attr(omp_ifr_cuda) }) : obj1) ! { dg-error "expected string literal before 'omp_ifr_cuda'" }
+ #pragma omp interop init (target, prefer_type( {fr("") }) : obj1) // { dg-error "non-empty string literal expected before '\\)' token" }
+ #pragma omp interop init (target, prefer_type( {fr("hip") , attr(omp_ifr_cuda) }) : obj1) ! { dg-error "expected string literal before 'omp_ifr_cuda'" }
- #pragma omp interop init ( prefer_type( {fr("hip") , attr("myooption") }) : obj1) // { dg-error "'attr' string literal must start with 'ompx_'" }
- #pragma omp interop init ( prefer_type( {fr("hip") , attr("ompx_option") , attr("ompx_") } ) : obj1)
- #pragma omp interop init ( prefer_type( {fr("hip") , attr("ompx_option") }, { attr("ompx_") } ) : obj1)
- #pragma omp interop init ( prefer_type( {fr("hip") , attr("ompx_option") } { attr("ompx_") } ) : obj1) // { dg-error "expected '\\)' or ',' before '\{' token" }
- #pragma omp interop init ( prefer_type( {fr("hip") , attr("ompx_option") ) : obj1)
- // { dg-error "expected ',' or '\}' before '\\)' token" "" { target c } .-1 }
- // { dg-error "prefer_type' has not been declared" "" { target c++ } .-2 }
- // { dg-error "expected '\\)' before '\\(' token" "" { target c++ } .-3 }
+ #pragma omp interop init (target, prefer_type( {fr("hip") , attr("myooption") }) : obj1) // { dg-error "'attr' string literal must start with 'ompx_'" }
+ #pragma omp interop init (target, prefer_type( {fr("hip") , attr("ompx_option") , attr("ompx_") } ) : obj1)
+ #pragma omp interop init (target, prefer_type( {fr("hip") , attr("ompx_option") }, { attr("ompx_") } ) : obj1)
+ #pragma omp interop init (target, prefer_type( {fr("hip") , attr("ompx_option") } { attr("ompx_") } ) : obj1) // { dg-error "expected '\\)' or ',' before '\{' token" }
+ #pragma omp interop init (target, prefer_type( {fr("hip") , attr("ompx_option") ) : obj1) // { dg-error "expected ',' or '\}' before '\\)' token" }
- #pragma omp interop init ( prefer_type( {fr("hip") attr("ompx_option") ) : obj1)
- // { dg-error "expected ',' or '\}' before 'attr'" "" { target c } .-1 }
- // { dg-error "prefer_type' has not been declared" "" { target c++ } .-2 }
- // { dg-error "expected '\\)' before '\\(' token" "" { target c++ } .-3 }
- #pragma omp interop init ( prefer_type( {fr("hip")}), prefer_type("cuda") : obj1) // { dg-error "duplicate 'prefer_type' modifier" }
+ #pragma omp interop init (target, prefer_type( {fr("hip") attr("ompx_option") ) : obj1) // { dg-error "expected ',' or '\}' before 'attr'" }
+ #pragma omp interop init (target, prefer_type( {fr("hip")}), prefer_type("cuda") : obj1) // { dg-error "duplicate 'prefer_type' modifier" }
- #pragma omp interop init ( prefer_type( {attr("ompx_option1,ompx_option2") } ) : obj1) // { dg-error "'attr' string literal must not contain a comma" }
+ #pragma omp interop init (target, prefer_type( {attr("ompx_option1,ompx_option2") } ) : obj1) // { dg-error "'attr' string literal must not contain a comma" }
- #pragma omp interop init ( prefer_type( {attr("ompx_option1,ompx_option2") ) : obj1)
- // { dg-error "'attr' string literal must not contain a comma" "" { target c } .-1 }
- // { dg-error "prefer_type' has not been declared" "" { target c++ } .-2 }
- // { dg-error "expected '\\)' before '\\(' token" "" { target c++ } .-3 }
+ #pragma omp interop init (target, prefer_type( {attr("ompx_option1,ompx_option2") ) : obj1) // { dg-error "'attr' string literal must not contain a comma" }
#pragma omp interop init ( targetsync other ) : obj1)
- // { dg-error "'targetsync' undeclared \\(first use in this function\\)" "" { target c } .-1 }
- // { dg-error "'targetsync' has not been declared" "" { target c++ } .-2 }
- // { dg-error "expected '\\)' before 'other'" "" { target *-*-* } .-3 }
- // { dg-error "expected an OpenMP clause before ':' token" "" { target *-*-* } .-4 }
-
- #pragma omp interop init ( prefer_type( {fr("cuda") } ), other : obj1) // { dg-error "'init' clause with modifier other than 'prefer_type', 'target' or 'targetsync' before 'other'" }
- #pragma omp interop init ( prefer_type( {fr("cuda") } ), obj1)
- // { dg-error "'prefer_type' undeclared \\(first use in this function\\)" "" { target c } .-1 }
- // { dg-error "'prefer_type' has not been declared" "" { target c++ } .-2 }
- // { dg-error "expected '\\)' before '\\(' token" "" { target *-*-* } .-3 }
+ // { dg-error "expected an OpenMP clause before ':' token" "" { target *-*-* } .-1 }
+ // { dg-error "expected ':' before 'other'" "" { target *-*-* } .-2 }
+
+ #pragma omp interop init (target, prefer_type( {fr("cuda") } ), other : obj1) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" }
+ #pragma omp interop init (prefer_type( {fr("cuda") } ), obj1) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" }
}
diff --git a/gcc/testsuite/c-c++-common/gomp/interop-3.c b/gcc/testsuite/c-c++-common/gomp/interop-3.c
index 51d26dd..38d7f65 100644
--- a/gcc/testsuite/c-c++-common/gomp/interop-3.c
+++ b/gcc/testsuite/c-c++-common/gomp/interop-3.c
@@ -34,17 +34,17 @@ void f()
omp_interop_t target, targetsync, prefer_type;
int x;
- #pragma omp interop init(obj1) init(target,targetsync : obj2, obj3) nowait
+#pragma omp interop init(target: obj1) init(target,targetsync : obj2, obj3) nowait
#pragma omp interop init(prefer_type("cuda", omp_ifr_opencl, omp_ifr_level_zero, "hsa"), targetsync : obj1) \
destroy(obj2, obj3) depend(inout: x) use(obj4, obj5) device(device_num: 0)
#pragma omp assume contains(interop)
{
- #pragma omp interop init(prefer_type("cu da") : obj3) // { dg-warning "unknown foreign runtime identifier 'cu da'" }
+ #pragma omp interop init(prefer_type("cu da"), targetsync : obj3) // { dg-warning "unknown foreign runtime identifier 'cu da'" }
}
- #pragma omp interop init(obj1, obj2, obj1), use(obj4) destroy(obj4)
+ #pragma omp interop init(target: obj1, obj2, obj1), use(obj4) destroy(obj4)
// { dg-error "'obj4' appears more than once in action clauses" "" { target *-*-* } .-1 }
// { dg-error "'obj1' appears more than once in action clauses" "" { target *-*-* } .-2 }
@@ -54,27 +54,21 @@ void f()
#pragma omp interop depend(inout: x) use(obj2), destroy(obj3) // Likewise
- #pragma omp interop depend(inout: x) use(obj2), destroy(obj3) init(obj4) // { dg-error "'depend' clause requires action clauses with 'targetsync' interop-type" }
+ #pragma omp interop depend(inout: x) use(obj2), destroy(obj3) init(target: obj4) // { dg-error "'depend' clause requires action clauses with 'targetsync' interop-type" }
// { dg-note "69: 'init' clause lacks the 'targetsync' modifier" "" { target c } .-1 }
- // { dg-note "70: 'init' clause lacks the 'targetsync' modifier" "" { target c++ } .-2 }
+ // { dg-note "78: 'init' clause lacks the 'targetsync' modifier" "" { target c++ } .-2 }
- #pragma omp interop depend(inout: x) init(targetsync : obj5) use(obj2), destroy(obj3) init(obj4) // { dg-error "'depend' clause requires action clauses with 'targetsync' interop-type" }
+ #pragma omp interop depend(inout: x) init(targetsync : obj5) use(obj2), destroy(obj3) init(target : obj4) // { dg-error "'depend' clause requires action clauses with 'targetsync' interop-type" }
// { dg-note "'init' clause lacks the 'targetsync' modifier" "" { target *-*-* } .-1 }
#pragma omp interop depend(inout: x) init(targetsync : obj5) use(obj2), destroy(obj3) init(prefer_type("cuda"), targetsync : obj4) // OK
- #pragma omp interop init(target, targetsync, prefer_type, obj1)
- #pragma omp interop init(prefer_type, obj1, target, targetsync)
+ #pragma omp interop init(target, targetsync, prefer_type, obj1) // { dg-error "59: expected '\\(' before ',' token" }
+ #pragma omp interop init(prefer_type, obj1, target, targetsync) // { dg-error "39: expected '\\(' before ',' token" }
// Duplicated variable name or duplicated modifier:
#pragma omp interop init(target, targetsync,target : obj1) // { dg-error "duplicate 'target' modifier" }
- #pragma omp interop init(target, targetsync,target) // { dg-error "'target' appears more than once in action clauses" }
+#pragma omp interop init(target, targetsync,target: obj1) // { dg-error "duplicate 'target' modifier" }
#pragma omp interop init(target : target, targetsync,target) // { dg-error "'target' appears more than once in action clauses" }
- #pragma omp interop init(target, targetsync,targetsync : obj1) // { dg-error "duplicate 'targetsync' modifier" }
- #pragma omp interop init(target, targetsync,targetsync) // { dg-error "targetsync' appears more than once in action clause" }
- #pragma omp interop init(target : target, targetsync,targetsync) // { dg-error "targetsync' appears more than once in action clause" }
-
- #pragma omp interop init(, targetsync, prefer_type, obj1, target)
- // { dg-error "expected identifier before ',' token" "" { target c } .-1 }
- // { dg-error "expected unqualified-id before ',' token" "" { target c++ } .-2 }
+ #pragma omp interop init(, targetsync, prefer_type, obj1, target) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" }
}
diff --git a/gcc/testsuite/c-c++-common/gomp/interop-4.c b/gcc/testsuite/c-c++-common/gomp/interop-4.c
index bb0bf31..a6449f1 100644
--- a/gcc/testsuite/c-c++-common/gomp/interop-4.c
+++ b/gcc/testsuite/c-c++-common/gomp/interop-4.c
@@ -33,14 +33,14 @@ f()
omp_interop_t obj1, obj2, obj3, obj4, obj5, obj6, obj7;
int x[6];
- #pragma omp interop init ( obj1, obj2) use (obj3) destroy(obj4) init(obj5) destroy(obj6) use(obj7)
- /* { dg-final { scan-tree-dump-times "#pragma omp interop use\\(obj7\\) destroy\\(obj6\\) init\\(obj5\\) destroy\\(obj4\\) use\\(obj3\\) init\\(obj2\\) init\\(obj1\\)\[\r\n\]" 1 "original" } } */
+#pragma omp interop init (target: obj1, obj2) use (obj3) destroy(obj4) init(targetsync: obj5) destroy(obj6) use(obj7)
+ /* { dg-final { scan-tree-dump-times "#pragma omp interop use\\(obj7\\) destroy\\(obj6\\) init\\(targetsync: obj5\\) destroy\\(obj4\\) use\\(obj3\\) init\\(target: obj2\\) init\\(target: obj1\\)\[\r\n\]" 1 "original" } } */
#pragma omp interop nowait init (targetsync : obj1, obj2) use (obj3) destroy(obj4) init(target, targetsync : obj5) destroy(obj6) use(obj7) depend(inout: x)
/* { dg-final { scan-tree-dump-times "#pragma omp interop depend\\(inout:x\\) use\\(obj7\\) destroy\\(obj6\\) init\\(target, targetsync: obj5\\) destroy\\(obj4\\) use\\(obj3\\) init\\(targetsync: obj2\\) init\\(targetsync: obj1\\) nowait\[\r\n\]" 1 "original" } } */
- #pragma omp interop init ( obj1, obj2) init (target: obj3) init(targetsync : obj4) init(target,targetsync: obj5)
- /* { dg-final { scan-tree-dump-times "#pragma omp interop init\\(target, targetsync: obj5\\) init\\(targetsync: obj4\\) init\\(target: obj3\\) init\\(obj2\\) init\\(obj1\\)\[\r\n\]" 1 "original" } } */
+#pragma omp interop init (target: obj1, obj2) init (target: obj3) init(targetsync : obj4) init(target,targetsync: obj5)
+ /* { dg-final { scan-tree-dump-times "#pragma omp interop init\\(target, targetsync: obj5\\) init\\(targetsync: obj4\\) init\\(target: obj3\\) init\\(target: obj2\\) init\\(target: obj1\\)\[\r\n\]" 1 "original" } } */
/* -------------------------------------------- */
diff --git a/gcc/testsuite/c-c++-common/gomp/loop-5.c b/gcc/testsuite/c-c++-common/gomp/loop-5.c
index b9b2ad9..bfc7017 100644
--- a/gcc/testsuite/c-c++-common/gomp/loop-5.c
+++ b/gcc/testsuite/c-c++-common/gomp/loop-5.c
@@ -2,7 +2,7 @@ __attribute__((noipa)) int
foo (int *a, int *r3)
{
int r = 0, r2[2] = { 0, 0 }, i;
- #pragma omp parallel loop default (none) reduction (+:r, r2[:2], r3[:2]) shared (a) lastprivate (i)
+ #pragma omp parallel loop default (none) reduction (+:r, r2[ :2], r3[ :2]) shared (a) lastprivate (i)
for (i = 0; i < 1024; i++)
{
r += a[i];
diff --git a/gcc/testsuite/c-c++-common/gomp/map-1.c b/gcc/testsuite/c-c++-common/gomp/map-1.c
index ed88944..f7003d3 100644
--- a/gcc/testsuite/c-c++-common/gomp/map-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/map-1.c
@@ -27,13 +27,13 @@ foo (int g[3][10], int h[4][8], int i[2][10], int j[][9],
;
#pragma omp target map(from: t[2:5]) /* { dg-error "is threadprivate variable" } */
;
- #pragma omp target map(tofrom: k[0.5:]) /* { dg-error "low bound \[^\n\r]* of array section does not have integral type" } */
+ #pragma omp target map(tofrom: k[0.5: ]) /* { dg-error "low bound \[^\n\r]* of array section does not have integral type" } */
;
- #pragma omp target map(from: l[:7.5f]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
+ #pragma omp target map(from: l[ :7.5f]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
;
- #pragma omp target map(to: m[p:]) /* { dg-error "low bound \[^\n\r]* of array section does not have integral type" } */
+ #pragma omp target map(to: m[p: ]) /* { dg-error "low bound \[^\n\r]* of array section does not have integral type" } */
;
- #pragma omp target map(tofrom: n[:p]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
+ #pragma omp target map(tofrom: n[ :p]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
;
#pragma omp target map(to: o[2:5]) /* { dg-error "does not have pointer or array type" } */
;
@@ -41,72 +41,72 @@ foo (int g[3][10], int h[4][8], int i[2][10], int j[][9],
;
#pragma omp target map(alloc: s2) /* { dg-error "'s2' does not have a mappable type in 'map' clause" } */
;
- #pragma omp target map(to: a[:][:]) /* { dg-error "array type length expression must be specified" } */
+ #pragma omp target map(to: a[ : ][ : ]) /* { dg-error "array type length expression must be specified" } */
bar (&a[0][0]); /* { dg-error "referenced in target region does not have a mappable type" } */
- #pragma omp target map(tofrom: b[-1:]) /* { dg-error "negative low bound in array section" } */
+ #pragma omp target map(tofrom: b[-1: ]) /* { dg-error "negative low bound in array section" } */
bar (b);
- #pragma omp target map(tofrom: c[:-3][:]) /* { dg-error "negative length in array section" } */
+ #pragma omp target map(tofrom: c[ :-3][ : ]) /* { dg-error "negative length in array section" } */
bar (&c[0][0]);
- #pragma omp target map(from: d[11:]) /* { dg-error "low bound \[^\n\r]* above array section size" } */
+ #pragma omp target map(from: d[11: ]) /* { dg-error "low bound \[^\n\r]* above array section size" } */
bar (d);
- #pragma omp target map(to: e[:11]) /* { dg-error "length \[^\n\r]* above array section size" } */
+ #pragma omp target map(to: e[ :11]) /* { dg-error "length \[^\n\r]* above array section size" } */
bar (e);
#pragma omp target map(to: f[1:10]) /* { dg-error "high bound \[^\n\r]* above array section size" } */
bar (f);
- #pragma omp target map(from: g[:][0:10]) /* { dg-error "for array function parameter length expression must be specified" } */
+ #pragma omp target map(from: g[ : ][0:10]) /* { dg-error "for array function parameter length expression must be specified" } */
bar (&g[0][0]);
- #pragma omp target map(from: h[2:1][-1:]) /* { dg-error "negative low bound in array section" } */
+ #pragma omp target map(from: h[2:1][-1: ]) /* { dg-error "negative low bound in array section" } */
bar (&h[0][0]);
- #pragma omp target map(tofrom: h[:1][:-3]) /* { dg-error "negative length in array section" } */
+ #pragma omp target map(tofrom: h[ :1][ :-3]) /* { dg-error "negative length in array section" } */
bar (&h[0][0]);
- #pragma omp target map(i[:1][11:]) /* { dg-error "low bound \[^\n\r]* above array section size" } */
+ #pragma omp target map(i[ :1][11: ]) /* { dg-error "low bound \[^\n\r]* above array section size" } */
bar (&i[0][0]);
- #pragma omp target map(from: j[3:1][:10]) /* { dg-error "length \[^\n\r]* above array section size" } */
+ #pragma omp target map(from: j[3:1][ :10]) /* { dg-error "length \[^\n\r]* above array section size" } */
bar (&j[0][0]);
#pragma omp target map(to: j[30:1][5:5]) /* { dg-error "high bound \[^\n\r]* above array section size" } */
bar (&j[0][0]);
- #pragma omp target map(to: a2[:1][2:4])
+ #pragma omp target map(to: a2[ :1][2:4])
bar (&a2[0][0]);
- #pragma omp target map(a2[3:5][:])
+ #pragma omp target map(a2[3:5][ : ])
bar (&a2[0][0]);
- #pragma omp target map(to: a2[3:5][:10])
+ #pragma omp target map(to: a2[3:5][ :10])
bar (&a2[0][0]);
- #pragma omp target map(tofrom: b2[0:])
+ #pragma omp target map(tofrom: b2[0: ])
bar (b2);
- #pragma omp target map(tofrom: c2[:3][:])
+ #pragma omp target map(tofrom: c2[ :3][ : ])
bar (&c2[0][0]);
- #pragma omp target map(from: d2[9:])
+ #pragma omp target map(from: d2[9: ])
bar (d2);
- #pragma omp target map(to: e2[:10])
+ #pragma omp target map(to: e2[ :10])
bar (e2);
#pragma omp target map(to: f2[1:9])
bar (f2);
- #pragma omp target map(g2[:1][2:4])
+ #pragma omp target map(g2[ :1][2:4])
bar (&g2[0][0]);
- #pragma omp target map(from: h2[2:2][0:])
+ #pragma omp target map(from: h2[2:2][0: ])
bar (&h2[0][0]);
- #pragma omp target map(tofrom: h2[:1][:3])
+ #pragma omp target map(tofrom: h2[ :1][ :3])
bar (&h2[0][0]);
- #pragma omp target map(to: i2[:1][9:])
+ #pragma omp target map(to: i2[ :1][9: ])
bar (&i2[0][0]);
- #pragma omp target map(from: j2[3:4][:9])
+ #pragma omp target map(from: j2[3:4][ :9])
bar (&j2[0][0]);
#pragma omp target map(to: j2[30:1][5:4])
bar (&j2[0][0]);
#pragma omp target map(q[1:2])
;
- #pragma omp target map(tofrom: q[3:5][:10]) /* { dg-error "array section is not contiguous" } */
+ #pragma omp target map(tofrom: q[3:5][ :10]) /* { dg-error "array section is not contiguous" } */
;
- #pragma omp target map(r[3:][2:1][1:2])
+ #pragma omp target map(r[3: ][2:1][1:2])
;
- #pragma omp target map(r[3:][2:1][1:2][:][0:4])
+ #pragma omp target map(r[3: ][2:1][1:2][ : ][0:4])
;
- #pragma omp target map(r[3:][2:1][1:2][1:][0:4]) /* { dg-error "array section is not contiguous" } */
+ #pragma omp target map(r[3: ][2:1][1:2][1: ][0:4]) /* { dg-error "array section is not contiguous" } */
;
- #pragma omp target map(r[3:][2:1][1:2][:3][0:4]) /* { dg-error "array section is not contiguous" } */
+ #pragma omp target map(r[3: ][2:1][1:2][ :3][0:4]) /* { dg-error "array section is not contiguous" } */
;
- #pragma omp target map(r[3:][2:1][1:2][:][1:]) /* { dg-error "array section is not contiguous" } */
+ #pragma omp target map(r[3: ][2:1][1:2][ : ][1: ]) /* { dg-error "array section is not contiguous" } */
;
- #pragma omp target map(r[3:][2:1][1:2][:][:3]) /* { dg-error "array section is not contiguous" } */
+ #pragma omp target map(r[3: ][2:1][1:2][ : ][ :3]) /* { dg-error "array section is not contiguous" } */
;
}
diff --git a/gcc/testsuite/c-c++-common/gomp/map-2.c b/gcc/testsuite/c-c++-common/gomp/map-2.c
index 01fb4be..03a3ed7 100644
--- a/gcc/testsuite/c-c++-common/gomp/map-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/map-2.c
@@ -16,25 +16,25 @@ foo (int *p, int (*q)[10], int r[10], int s[10][10])
;
#pragma omp target map (tofrom: r[-1:2])
;
- #pragma omp target map (tofrom: s[-1:2][:])
+ #pragma omp target map (tofrom: s[-1:2][ : ])
;
#pragma omp target map (tofrom: s[-1:2][-2:10]) /* { dg-error "negative low bound in array section in" } */
;
#pragma omp target map (tofrom: a[-1:2]) /* { dg-error "negative low bound in array section in" } */
;
- #pragma omp target map (tofrom: b[-1:2][0:]) /* { dg-error "negative low bound in array section in" } */
+ #pragma omp target map (tofrom: b[-1:2][0: ]) /* { dg-error "negative low bound in array section in" } */
;
#pragma omp target map (tofrom: b[1:2][-2:10]) /* { dg-error "negative low bound in array section in" } */
;
#pragma omp target map (tofrom: p[2:-3]) /* { dg-error "negative length in array section in" } */
;
- #pragma omp target map (tofrom: q[2:-3][:]) /* { dg-error "negative length in array section in" } */
+ #pragma omp target map (tofrom: q[2:-3][ : ]) /* { dg-error "negative length in array section in" } */
;
#pragma omp target map (tofrom: q[2:3][0:-1]) /* { dg-error "negative length in array section in" } */
;
#pragma omp target map (tofrom: r[2:-5]) /* { dg-error "negative length in array section in" } */
;
- #pragma omp target map (tofrom: s[2:-5][:]) /* { dg-error "negative length in array section in" } */
+ #pragma omp target map (tofrom: s[2:-5][ : ]) /* { dg-error "negative length in array section in" } */
;
#pragma omp target map (tofrom: s[2:5][0:-4]) /* { dg-error "negative length in array section in" } */
;
diff --git a/gcc/testsuite/c-c++-common/gomp/map-4.c b/gcc/testsuite/c-c++-common/gomp/map-4.c
index 6c48636..79b61e4 100644
--- a/gcc/testsuite/c-c++-common/gomp/map-4.c
+++ b/gcc/testsuite/c-c++-common/gomp/map-4.c
@@ -5,7 +5,7 @@ typedef double Grid[SIZE];
void test (Grid src1)
{
- #pragma omp target map(alloc:src1[:]) /* { dg-error "for array function parameter length expression must be specified" } */
+ #pragma omp target map(alloc:src1[ : ]) /* { dg-error "for array function parameter length expression must be specified" } */
{
src1[0] = 5;
}
@@ -13,7 +13,7 @@ void test (Grid src1)
void test2 (double src2[])
{
- #pragma omp target map(alloc:src2[:]) /* { dg-error "for array function parameter length expression must be specified" } */
+ #pragma omp target map(alloc:src2[ : ]) /* { dg-error "for array function parameter length expression must be specified" } */
{
src2[0] = 5;
}
@@ -21,7 +21,7 @@ void test2 (double src2[])
void test3 (double *src3)
{
- #pragma omp target map(alloc:src3[:]) /* { dg-error "for pointer type length expression must be specified" } */
+ #pragma omp target map(alloc:src3[ : ]) /* { dg-error "for pointer type length expression must be specified" } */
{
src3[0] = 5;
}
diff --git a/gcc/testsuite/c-c++-common/gomp/map-6.c b/gcc/testsuite/c-c++-common/gomp/map-6.c
index 014ed35..d76f9ae 100644
--- a/gcc/testsuite/c-c++-common/gomp/map-6.c
+++ b/gcc/testsuite/c-c++-common/gomp/map-6.c
@@ -13,20 +13,20 @@ foo (void)
#pragma omp target map (to:a)
;
- #pragma omp target map (a to: b) /* { dg-error "'map' clause with map-type modifier other than 'always', 'close' or 'present'" } */
- ;
+ #pragma omp target map (a to: b) /* { dg-error "'map' clause with map-type modifier other than 'always', 'close', 'iterator', 'mapper' or 'present'" "" { target c++ } } */
+ ; /* { dg-error "'map' clause with map-type modifier other than 'always', 'close', 'iterator', 'mapper' or 'present' before 'a'" "" { target c } .-1 } */
- #pragma omp target map (close, a to: b) /* { dg-error "'map' clause with map-type modifier other than 'always', 'close' or 'present'" } */
- ;
+ #pragma omp target map (close, a to: b) /* { dg-error "'map' clause with map-type modifier other than 'always', 'close', 'iterator', 'mapper' or 'present'" "" { target c++ } } */
+ ; /* { dg-error "'map' clause with map-type modifier other than 'always', 'close', 'iterator', 'mapper' or 'present' before 'a'" "" { target c } .-1 } */
- #pragma omp target enter data map(b7) map (close, a to: b) /* { dg-error "'map' clause with map-type modifier other than 'always', 'close' or 'present'" } */
- ;
+ #pragma omp target enter data map(b7) map (close, a to: b) /* { dg-error "'map' clause with map-type modifier other than 'always', 'close', 'iterator', 'mapper' or 'present'" "" { target c++ } } */
+ ; /* { dg-error "'map' clause with map-type modifier other than 'always', 'close', 'iterator', 'mapper' or 'present' before 'a'" "" { target c } .-1 } */
- #pragma omp target exit data map(b7) map (close, a from: b) /* { dg-error "'map' clause with map-type modifier other than 'always', 'close' or 'present'" } */
- ;
+ #pragma omp target exit data map(b7) map (close, a from: b) /* { dg-error "'map' clause with map-type modifier other than 'always', 'close', 'iterator', 'mapper' or 'present'" "" { target c++ } } */
+ ; /* { dg-error "'map' clause with map-type modifier other than 'always', 'close', 'iterator', 'mapper' or 'present' before 'a'" "" { target c } .-1 } */
- #pragma omp target data map(b7) map (close, a from: b) /* { dg-error "'map' clause with map-type modifier other than 'always', 'close' or 'present'" } */
- ;
+ #pragma omp target data map(b7) map (close, a from: b) /* { dg-error "'map' clause with map-type modifier other than 'always', 'close', 'iterator', 'mapper' or 'present'" "" { target c++ } } */
+ ; /* { dg-error "'map' clause with map-type modifier other than 'always', 'close', 'iterator', 'mapper' or 'present' before 'a'" "" { target c } .-1 } */
#pragma omp target map (close a) /* { dg-error "'close' undeclared" "" { target c } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/map-7.c b/gcc/testsuite/c-c++-common/gomp/map-7.c
index 3f1e972..6d79718 100644
--- a/gcc/testsuite/c-c++-common/gomp/map-7.c
+++ b/gcc/testsuite/c-c++-common/gomp/map-7.c
@@ -9,12 +9,12 @@ foo (void)
int always[N];
int close;
- #pragma omp target map(always[:N])
+ #pragma omp target map(always[ :N])
;
- #pragma omp target map(close, always[:N])
+ #pragma omp target map(close, always[ :N])
;
- #pragma omp target map(always[:N], close)
+ #pragma omp target map(always[ :N], close)
;
}
diff --git a/gcc/testsuite/c-c++-common/gomp/metadirective-2.c b/gcc/testsuite/c-c++-common/gomp/metadirective-2.c
index 4b05cb9..9f8169a 100644
--- a/gcc/testsuite/c-c++-common/gomp/metadirective-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/metadirective-2.c
@@ -61,7 +61,7 @@ main (void)
when (device={arch("gcn")}: teams num_teams(256)) \
default (teams num_teams(4))
{
- //__label__ l1, l2;
+ __label__ l1, l2;
if (x)
goto l1;
diff --git a/gcc/testsuite/c-c++-common/gomp/metadirective-3.c b/gcc/testsuite/c-c++-common/gomp/metadirective-3.c
index 0ac0d1d..b6c1601 100644
--- a/gcc/testsuite/c-c++-common/gomp/metadirective-3.c
+++ b/gcc/testsuite/c-c++-common/gomp/metadirective-3.c
@@ -8,7 +8,7 @@ f (int x[], int y[], int z[])
{
int i;
- #pragma omp target map(to: x, y) map(from: z)
+ #pragma omp target map(to: x, y) map(from: z) /* { dg-bogus "'target' construct with nested 'teams' construct contains directives outside of the 'teams' construct" "PR118694" { xfail offload_nvptx } } */
#pragma omp metadirective \
when (device={arch("nvptx")}: teams loop) \
default (parallel loop)
@@ -19,5 +19,6 @@ f (int x[], int y[], int z[])
/* If offload device "nvptx" isn't supported, the front end can eliminate
that alternative and not produce a metadirective at all. Otherwise this
won't be resolved until late. */
-/* { dg-final { scan-tree-dump-not "#pragma omp metadirective" "gimple" { target { ! offload_nvptx } } } } */
-/* { dg-final { scan-tree-dump "#pragma omp metadirective" "gimple" { target { offload_nvptx } } } } */
+/* { dg-final { scan-tree-dump-not "#pragma omp metadirective" "gimple" } } */
+/* { dg-final { scan-tree-dump-not " teams" "gimple" { target { ! offload_nvptx } } } } */
+/* { dg-final { scan-tree-dump "variant.\[0-9\]+ = \\\[omp_next_variant\\\] OMP_NEXT_VARIANT <0,\[\r\n \]+construct context = 14\[\r\n \]+1: device = \\{arch \\(.nvptx.\\)\\}\[\r\n \]+2: >;" "gimple" { target { offload_nvptx } } } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/metadirective-condition-constexpr.c b/gcc/testsuite/c-c++-common/gomp/metadirective-condition-constexpr.c
new file mode 100644
index 0000000..3484478
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/metadirective-condition-constexpr.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target { c || c++11 } } } */
+/* { dg-additional-options "-std=c23" { target c } } */
+/* { dg-additional-options "-fdump-tree-original" } */
+
+constexpr int flag = 1;
+
+void f() {
+#pragma omp metadirective when(user={condition(flag)} : nothing) \
+ otherwise(error at(execution))
+}
+
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_error" "original" } } */
+
diff --git a/gcc/testsuite/c-c++-common/gomp/metadirective-condition.c b/gcc/testsuite/c-c++-common/gomp/metadirective-condition.c
new file mode 100644
index 0000000..099ad9d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/metadirective-condition.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-original" } */
+
+static int arr[10];
+static int g (int a) { return -a; }
+
+void f (int *ptr, float x) {
+
+ /* Implicit conversion float -> bool */
+ #pragma omp metadirective when(user={condition(x)} : nothing) otherwise(nothing)
+
+ /* Implicit conversion pointer -> bool */
+ #pragma omp metadirective when(user={condition(ptr)} : nothing) otherwise(nothing)
+
+ /* Array expression undergoes array->pointer conversion, OK but test is
+ always optimized away. */
+ #pragma omp metadirective when(user={condition(arr)} : nothing) otherwise(nothing)
+
+ /* Function reference has pointer-to-function type, OK but test is
+ always optimized away. */
+ #pragma omp metadirective when(user={condition(g)} : nothing) otherwise(nothing)
+}
+
+/* { dg-final { scan-tree-dump "x != 0.0" "original" } } */
+/* { dg-final { scan-tree-dump "ptr != 0B" "original" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/metadirective-device.c b/gcc/testsuite/c-c++-common/gomp/metadirective-device.c
index 3807624..d7f736d 100644
--- a/gcc/testsuite/c-c++-common/gomp/metadirective-device.c
+++ b/gcc/testsuite/c-c++-common/gomp/metadirective-device.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-additional-options "-foffload=disable -fdump-tree-optimized" } */
-/* { dg-additional-options "-DDEVICE_ARCH=x86_64 -DDEVICE_ISA=sse -msse" { target { x86_64-*-* && { ! ia32 } } } } */
+/* { dg-additional-options "-DDEVICE_ARCH=x86_64 -DDEVICE_ISA=sse -msse" { target { x86 && lp64 } } } */
#include <stdlib.h>
diff --git a/gcc/testsuite/c-c++-common/gomp/metadirective-error-recovery.c b/gcc/testsuite/c-c++-common/gomp/metadirective-error-recovery.c
new file mode 100644
index 0000000..92995a2
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/metadirective-error-recovery.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+
+/* This test used to ICE in C and only diagnose the first error in C++. */
+
+struct s {
+ int a, b;
+};
+
+void f (int aa, int bb)
+{
+ struct s s1, s2;
+ s1.a = aa;
+ s1.b = bb;
+ s2.a = aa + 1;
+ s2.b = bb + 1;
+
+ /* A struct is not a valid argument for the condition selector. */
+ #pragma omp metadirective when(user={condition(s1)} : nothing) otherwise(nothing)
+ /* { dg-error "used struct type value where scalar is required" "" { target c } .-1 } */
+ /* { dg-error "could not convert .s1. from .s. to .bool." "" { target c++ } .-2 } */
+ #pragma omp metadirective when(user={condition(s2)} : nothing) otherwise(nothing)
+ /* { dg-error "used struct type value where scalar is required" "" { target c } .-1 } */
+ /* { dg-error "could not convert .s2. from .s. to .bool." "" { target c++ } .-2 } */
+
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-1.c b/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-1.c
index 5d3a4c3..284f35f 100644
--- a/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-1.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-additional-options "-fdump-tree-optimized" } */
-/* { dg-additional-options "-DDEVICE_ARCH=x86_64 -DDEVICE_ISA=mmx -mmmx" { target { x86_64-*-* && { ! ia32 } } } } */
+/* { dg-additional-options "-DDEVICE_ARCH=x86_64 -DDEVICE_ISA=mmx -mmmx" { target { x86 && lp64 } } } */
#include <stdlib.h>
diff --git a/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-2.c b/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-2.c
index 24584f2..4de1921 100644
--- a/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-2.c
@@ -1,4 +1,4 @@
-/* { dg-do compile */
+/* { dg-do compile } */
/* { dg-additional-options "-fdump-tree-optimized" } */
/* In configurations without offloading configured, we can resolve many
diff --git a/gcc/testsuite/c-c++-common/gomp/omp_get_num_devices_initial_device-2.c b/gcc/testsuite/c-c++-common/gomp/omp_get_num_devices_initial_device-2.c
new file mode 100644
index 0000000..891f5cf
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/omp_get_num_devices_initial_device-2.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O1 -fdump-tree-optimized -fno-builtin-omp_get_num_devices -fno-builtin-omp_get_initial_device" } */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern int omp_get_initial_device ();
+extern int omp_get_num_devices ();
+#ifdef __cplusplus
+}
+#endif
+
+int f()
+{
+/* The following assumes that omp_get_initial_device () will not return
+ omp_initial_device (== -1), which is also permitted since OpenMP 6.0. */
+ if (omp_get_initial_device () != omp_get_num_devices ()) __builtin_abort ();
+
+ if (omp_get_num_devices () != omp_get_num_devices ()) __builtin_abort ();
+
+ if (omp_get_initial_device () != omp_get_initial_device ()) __builtin_abort ();
+
+ return omp_get_num_devices ();
+}
+
+/* { dg-final { scan-tree-dump-times "abort" 3 "optimized" } } */
+
+/* { dg-final { scan-tree-dump-times "omp_get_num_devices" 4 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "omp_get_initial_device" 3 "optimized" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/omp_get_num_devices_initial_device.c b/gcc/testsuite/c-c++-common/gomp/omp_get_num_devices_initial_device.c
new file mode 100644
index 0000000..6e2c1a8
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/omp_get_num_devices_initial_device.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O1 -fdump-tree-optimized" } */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern int omp_get_initial_device ();
+extern int omp_get_num_devices ();
+#ifdef __cplusplus
+}
+#endif
+
+int f()
+{
+/* The following assumes that omp_get_initial_device () will not return
+ omp_initial_device (== -1), which is also permitted since OpenMP 6.0. */
+ if (omp_get_initial_device () != omp_get_num_devices ()) __builtin_abort ();
+
+ if (omp_get_num_devices () != omp_get_num_devices ()) __builtin_abort ();
+
+ if (omp_get_initial_device () != omp_get_initial_device ()) __builtin_abort ();
+
+ return omp_get_num_devices ();
+}
+
+/* { dg-final { scan-tree-dump-not "abort" "optimized" } } */
+
+/* { dg-final { scan-tree-dump-not "omp_get_num_devices" "optimized" { target { ! offloading_enabled } } } } */
+/* { dg-final { scan-tree-dump "return 0;" "optimized" { target { ! offloading_enabled } } } } */
+
+/* { dg-final { scan-tree-dump-times "omp_get_num_devices" 1 "optimized" { target offloading_enabled } } } */
+/* { dg-final { scan-tree-dump "_1 = __builtin_omp_get_num_devices \\(\\);\[\\r\\n\]+\[ \]+return _1;" "optimized" { target offloading_enabled } } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/pr100902-1.c b/gcc/testsuite/c-c++-common/gomp/pr100902-1.c
index babd01a..e84aeb6 100644
--- a/gcc/testsuite/c-c++-common/gomp/pr100902-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/pr100902-1.c
@@ -3,7 +3,7 @@
void
foo (int *ptr)
{
- #pragma omp target map (ptr, ptr[:4])
+ #pragma omp target map (ptr, ptr[ :4])
#pragma omp parallel master
ptr[0] = 1;
}
@@ -11,7 +11,7 @@ foo (int *ptr)
void
bar (int *ptr)
{
- #pragma omp target parallel map (ptr[:4], ptr)
+ #pragma omp target parallel map (ptr[ :4], ptr)
#pragma omp master
ptr[0] = 1;
}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr103642.c b/gcc/testsuite/c-c++-common/gomp/pr103642.c
index bc6d7ac..f55b7b2 100644
--- a/gcc/testsuite/c-c++-common/gomp/pr103642.c
+++ b/gcc/testsuite/c-c++-common/gomp/pr103642.c
@@ -23,7 +23,7 @@ int main (void)
t.s = (S *) malloc (sizeof (S));
t.s->a = (int *) malloc (sizeof(int) * N);
- #pragma omp target map(from: t.s->a[:N])
+ #pragma omp target map(from: t.s->a[ :N])
{
t.s->a[0] = 1;
}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr118965-1.c b/gcc/testsuite/c-c++-common/gomp/pr118965-1.c
new file mode 100644
index 0000000..2014b94
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr118965-1.c
@@ -0,0 +1,57 @@
+/* { dg-do compile } */
+
+/* At least one of the target and/or targetsync modifiers must be provided.
+ This implies that there are always modifiers required, and the parser
+ should reject e.g. "init (var1, var2)"; the first thing in the list is
+ always an init_modifier in valid code. */
+
+/* The following definitions are in omp_lib, which cannot be included
+ in gcc/testsuite/ */
+
+#if __cplusplus >= 201103L
+# define __GOMP_UINTPTR_T_ENUM : __UINTPTR_TYPE__
+#else
+# define __GOMP_UINTPTR_T_ENUM
+#endif
+
+typedef enum omp_interop_t __GOMP_UINTPTR_T_ENUM
+{
+ omp_interop_none = 0,
+ __omp_interop_t_max__ = __UINTPTR_MAX__
+} omp_interop_t;
+
+typedef enum omp_interop_fr_t
+{
+ omp_ifr_cuda = 1,
+ omp_ifr_cuda_driver = 2,
+ omp_ifr_opencl = 3,
+ omp_ifr_sycl = 4,
+ omp_ifr_hip = 5,
+ omp_ifr_level_zero = 6,
+ omp_ifr_hsa = 7,
+ omp_ifr_last = omp_ifr_hsa
+} omp_interop_fr_t;
+
+// ---------------------------------
+
+void f()
+{
+ omp_interop_t obj1, obj2;
+
+ #pragma omp interop init (obj1) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" }
+ #pragma omp interop init (obj1, obj2) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" }
+ #pragma omp interop init (obj1, target) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" }
+ #pragma omp interop init (target, obj1) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" }
+ #pragma omp interop init (obj1, targetsync) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" }
+ #pragma omp interop init (targetsync, obj1) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" }
+ #pragma omp interop init (targetsync, target) // { dg-error "expected ':' before '\\)' token" }
+
+ #pragma omp interop init (target, prefer_type( {fr(4 ) }) : obj1) // OK
+ #pragma omp interop init (targetsync, prefer_type( {fr(4 ) }) : obj1) // OK
+ #pragma omp interop init (prefer_type( {fr(4 ) }), target : obj1) // OK
+
+ #pragma omp interop init (prefer_type( {fr(4 ) }) : obj1) // { dg-error "missing required 'target' and/or 'targetsync' modifier" }
+ #pragma omp interop init (prefer_type( {fr(4 ) }) : foobar) // { dg-error "missing required 'target' and/or 'targetsync' modifier" }
+ // { dg-error "'foobar' undeclared" "" { target c } .-1 }
+ // { dg-error "'foobar' has not been declared" "" { target c++ } .-2 }
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr118965-2.c b/gcc/testsuite/c-c++-common/gomp/pr118965-2.c
new file mode 100644
index 0000000..6e27179
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr118965-2.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+
+/* At least one of the target and/or targetsync modifiers must be provided. */
+
+#if __cplusplus >= 201103L
+# define __GOMP_UINTPTR_T_ENUM : __UINTPTR_TYPE__
+#else
+# define __GOMP_UINTPTR_T_ENUM
+#endif
+
+typedef enum omp_interop_t __GOMP_UINTPTR_T_ENUM
+{
+ omp_interop_none = 0,
+ __omp_interop_t_max__ = __UINTPTR_MAX__
+} omp_interop_t;
+
+void f1(omp_interop_t) { }
+#pragma omp declare variant(f1) match(construct={dispatch}) \
+ append_args(interop(prefer_type({attr("ompx_fun")})))
+// { dg-error "missing required 'target' and/or 'targetsync' modifier" "" { target *-*-* } .-1 }
+void g1(void);
+
+
+int f2(omp_interop_t, omp_interop_t);
+#pragma omp declare variant(f2) \
+ append_args(interop(prefer_type("cuda")), \
+ interop(prefer_type({fr("hsa")}))) \
+ match(construct={dispatch})
+// { dg-error "missing required 'target' and/or 'targetsync' modifier" "" { target *-*-* } .-3 }
+// { dg-error "missing required 'target' and/or 'targetsync' modifier" "" { target *-*-* } .-3 }
+int g2(void) { return 5; }
diff --git a/gcc/testsuite/c-c++-common/gomp/pr120052.c b/gcc/testsuite/c-c++-common/gomp/pr120052.c
new file mode 100644
index 0000000..c379739
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr120052.c
@@ -0,0 +1,32 @@
+/* PR middle-end/120052 */
+/* { dg-do compile } */
+/* { dg-additional-options "-fsanitize=undefined" } */
+
+void
+foo (unsigned long s, long indx)
+{
+ long counts[2][s];
+ #pragma omp parallel
+ #pragma omp masked
+ for (int i = 0; i < 2; i++)
+ counts[2][indx] = 1;
+}
+
+void
+bar (unsigned long s, long indx)
+{
+ long counts[2][s];
+ #pragma omp parallel shared(counts)
+ #pragma omp masked
+ for (int i = 0; i < 2; i++)
+ counts[2][indx] = 1;
+}
+
+void
+baz (unsigned long s, long indx)
+{
+ long counts[2][s];
+ #pragma omp parallel private(counts)
+ for (int i = 0; i < 2; i++)
+ counts[2][indx] = 1;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr120180-1.c b/gcc/testsuite/c-c++-common/gomp/pr120180-1.c
new file mode 100644
index 0000000..b563d5f
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr120180-1.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+
+/* This test case checks that the inner metadirective is accepted as intervening
+ code since it resolves to 'omp nothing'. */
+
+int main()
+{
+ int blksize = 15000;
+ double *qq;
+ int i, k, nq;
+
+ #pragma omp metadirective when(user={condition(0)}: target teams distribute parallel for collapse(2) map(qq[ :0]) private(i)) \
+ when(user={condition(0)}: target teams distribute parallel for map(qq[ :0]) private(i)) \
+ when(user={condition(1)}: target teams loop collapse(2) map(qq[ :0]) private(i))
+ for(k=0; k<blksize; k++)
+ {
+#pragma omp metadirective when(user={condition(0)}: simd) default()
+ for (i=0; i<nq; i++)
+ qq[k*nq + i] = 0.0;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr120180-2.c b/gcc/testsuite/c-c++-common/gomp/pr120180-2.c
new file mode 100644
index 0000000..9d9ef30
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr120180-2.c
@@ -0,0 +1,66 @@
+/* { dg-do compile } */
+
+/* This test case checks that a non-executable OpenMP directive is accepted
+ as intervening code. */
+
+int
+test1 ()
+{
+ int blksize = 15000;
+ double *qq;
+ int i, k, nq;
+#pragma omp target parallel for collapse(2) map(qq[ : 0]) private(i)
+ for (k = 0; k < blksize; k++)
+ {
+#pragma omp nothing
+ for (i = 0; i < nq; i++)
+ qq[k * nq + i] = 0.0;
+ }
+ return 0;
+}
+
+int
+test2 ()
+{
+ int i, k, m, n;
+ double *qq, x, z;
+#pragma omp for collapse(2)
+ for (i = 1; i < n; i++)
+ {
+#pragma omp assume holds(x > 1)
+ z = __builtin_fabs (x - i);
+ for (k = 0; k < m; k++)
+ qq[k * m + i] = z;
+ }
+ return 0;
+}
+
+int
+test3 ()
+{
+ int i, k, m, n;
+ double *qq, z;
+#pragma omp for collapse(2)
+ for (i = 1; i < n; i++)
+ {
+#pragma omp error at(compilation) /* { dg-error "'pragma omp error' encountered" } */
+ for (k = 0; k < m; k++)
+ qq[k * m + i] = z;
+ }
+ return 0;
+}
+
+int
+test4 ()
+{
+ int i, k, m, n;
+ double *qq, z;
+#pragma omp for collapse(2)
+ for (i = 1; i < n; i++)
+ {
+#pragma omp error at(execution) /* { dg-error "pragma omp error' with 'at\\(execution\\)' clause may not be used in intervening code" } */
+ for (k = 0; k < m; k++)
+ qq[k * m + i] = z;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr120564.c b/gcc/testsuite/c-c++-common/gomp/pr120564.c
new file mode 100644
index 0000000..4dfa4fc
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr120564.c
@@ -0,0 +1,15 @@
+/* PR middle-end/120564 */
+/* { dg-do compile } */
+
+void bar (unsigned long long, unsigned long long, unsigned long long);
+
+void
+foo (void)
+{
+ unsigned long long v1, v2, v3;
+#pragma omp parallel for schedule(static, 32) collapse(3)
+ for (v1 = 0; v1 < 20; v1 += 2)
+ for (v2 = __LONG_LONG_MAX__; v2 > __LONG_LONG_MAX__; v2 -= 3)
+ for (v3 = 10; v3 > 0; v3--)
+ bar (v1, v2, v3);
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr121452-1.c b/gcc/testsuite/c-c++-common/gomp/pr121452-1.c
new file mode 100644
index 0000000..d605919
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr121452-1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-original" } */
+
+/* Check that the OMP_STRUCTURED_BLOCK that wraps intervening code is accepted.
+ */
+
+void f(int *A, int *B, int *C)
+{
+ #pragma omp for simd collapse(2)
+ for (int i=0; i < 1; i++) {
+ for (int j=0; j < 1; j++)
+ A[i] += B[j];
+ C[i] = 4;
+ }
+}
+
+/* { dg-final { scan-tree-dump "#pragma omp __structured_block" "original" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/pr121452-2.c b/gcc/testsuite/c-c++-common/gomp/pr121452-2.c
new file mode 100644
index 0000000..35fb1c1
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr121452-2.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-original" } */
+
+/* Check that the OMP_STRUCTURED_BLOCK that wraps intervening code is accepted.
+ */
+
+void f(int *A, int *B, int *C)
+{
+ #pragma omp loop bind(teams) order(concurrent) collapse(2)
+ for (int i=0; i < 1; i++) {
+ for (int j=0; j < 1; j++)
+ A[i] += B[j];
+ C[i] = 4;
+ }
+}
+
+/* { dg-final { scan-tree-dump "#pragma omp __structured_block" "original" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/pr61486-1.c b/gcc/testsuite/c-c++-common/gomp/pr61486-1.c
index dbd621f..d09e19d 100644
--- a/gcc/testsuite/c-c++-common/gomp/pr61486-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/pr61486-1.c
@@ -6,7 +6,7 @@ int
foo (int *a)
{
int i, j = 0;
- #pragma omp target teams distribute simd linear(i) map(a[:10])
+ #pragma omp target teams distribute simd linear(i) map(a[ :10])
for (i = 0; i < 10; i++)
a[i] = j;
return i;
diff --git a/gcc/testsuite/c-c++-common/gomp/pr81006.c b/gcc/testsuite/c-c++-common/gomp/pr81006.c
index a826c5f..9a4ca41 100644
--- a/gcc/testsuite/c-c++-common/gomp/pr81006.c
+++ b/gcc/testsuite/c-c++-common/gomp/pr81006.c
@@ -5,6 +5,6 @@ int a[] = {};
void foo()
{
- #pragma omp task depend(out: a[:]) /* { dg-error "zero length array section in .depend. clause" } */
+ #pragma omp task depend(out: a[ : ]) /* { dg-error "zero length array section in .depend. clause" } */
{}
}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr91920.c b/gcc/testsuite/c-c++-common/gomp/pr91920.c
index 604fd59..016005e 100644
--- a/gcc/testsuite/c-c++-common/gomp/pr91920.c
+++ b/gcc/testsuite/c-c++-common/gomp/pr91920.c
@@ -7,7 +7,7 @@ foo (void)
{
int i;
float f[3] = { 0.0f, 0.0f, 0.0f };
-#pragma omp parallel for default(none) reduction(+:f[:3])
+#pragma omp parallel for default(none) reduction(+:f[ :3])
for (i = 0; i < 1000; i++)
{
int j;
diff --git a/gcc/testsuite/c-c++-common/gomp/pr96867.c b/gcc/testsuite/c-c++-common/gomp/pr96867.c
index f55d9cf..04f920c 100644
--- a/gcc/testsuite/c-c++-common/gomp/pr96867.c
+++ b/gcc/testsuite/c-c++-common/gomp/pr96867.c
@@ -5,5 +5,5 @@ int *v;
void
foo (int x)
{
- #pragma omp target update to (x, v[:]) /* { dg-error "for pointer type length expression must be specified" } */
+ #pragma omp target update to (x, v[ : ]) /* { dg-error "for pointer type length expression must be specified" } */
}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-16.c b/gcc/testsuite/c-c++-common/gomp/pr99928-16.c
index 84cd85d..d548b39 100644
--- a/gcc/testsuite/c-c++-common/gomp/pr99928-16.c
+++ b/gcc/testsuite/c-c++-common/gomp/pr99928-16.c
@@ -4,13 +4,13 @@ void
foo (void)
{
int a[6] = {};
- #pragma omp target simd reduction(+:a[:3])
+ #pragma omp target simd reduction(+:a[ :3])
for (int i = 0; i < 6; i++)
a[0]++;
- #pragma omp target simd reduction(+:a[:3]) map(always, tofrom: a)
+ #pragma omp target simd reduction(+:a[ :3]) map(always, tofrom: a)
for (int i = 0; i < 6; i++)
a[0]++;
- #pragma omp target simd reduction(+:a[:3]) map(always, tofrom: a[:6])
+ #pragma omp target simd reduction(+:a[ :3]) map(always, tofrom: a[ :6])
for (int i = 0; i < 6; i++)
a[0]++;
}
diff --git a/gcc/testsuite/c-c++-common/gomp/reduction-1.c b/gcc/testsuite/c-c++-common/gomp/reduction-1.c
index 897ed68..4ee1006d 100644
--- a/gcc/testsuite/c-c++-common/gomp/reduction-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/reduction-1.c
@@ -10,17 +10,17 @@ foo (int a[10][10][10], int **b, int x)
int c[10][10][0];
int d[0];
char e[12];
- #pragma omp parallel reduction(+: a[:4][:0][:7]) /* { dg-error "zero length array section" } */
+ #pragma omp parallel reduction(+: a[ :4][ :0][ :7]) /* { dg-error "zero length array section" } */
bar (a);
- #pragma omp parallel reduction(+: b[:7][0:0][:0]) /* { dg-error "zero length array section" } */
+ #pragma omp parallel reduction(+: b[ :7][0:0][ :0]) /* { dg-error "zero length array section" } */
bar (a);
- #pragma omp parallel reduction(+: c[:][:][0:]) /* { dg-error "zero length array section|for unknown bound array type length expression must be specified" } */
+ #pragma omp parallel reduction(+: c[ : ][ : ][0: ]) /* { dg-error "zero length array section|for unknown bound array type length expression must be specified" } */
bar (a);
- #pragma omp parallel reduction(+: a[:4][:0][:x]) /* { dg-error "zero length array section" } */
+ #pragma omp parallel reduction(+: a[ :4][ :0][ :x]) /* { dg-error "zero length array section" } */
bar (a);
- #pragma omp parallel reduction(+: b[:x][0:0][:0]) /* { dg-error "zero length array section" } */
+ #pragma omp parallel reduction(+: b[ :x][0:0][ :0]) /* { dg-error "zero length array section" } */
bar (a);
- #pragma omp parallel reduction(+: c[:][:x][0:]) /* { dg-error "zero length array section|for unknown bound array type length expression must be specified" } */
+ #pragma omp parallel reduction(+: c[ : ][ :x][0: ]) /* { dg-error "zero length array section|for unknown bound array type length expression must be specified" } */
bar (a);
#pragma omp parallel reduction(+: d) /* { dg-error "is a zero size array" } */
bar (a);
@@ -42,11 +42,11 @@ foo (int a[10][10][10], int **b, int x)
bar (a);
#pragma omp parallel reduction(+: a[0:2.5]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
bar (a);
- #pragma omp parallel reduction(+: f[:][0:2]) /* { dg-error "for unknown bound array type length expression must be specified" } */
+ #pragma omp parallel reduction(+: f[ : ][0:2]) /* { dg-error "for unknown bound array type length expression must be specified" } */
bar (a);
- #pragma omp parallel reduction(+: a[:][0:10]) /* { dg-error "for array function parameter length expression must be specified" } */
+ #pragma omp parallel reduction(+: a[ : ][0:10]) /* { dg-error "for array function parameter length expression must be specified" } */
bar (a);
- #pragma omp parallel reduction(+: a[:10][0:12]) /* { dg-error "above array section size" } */
+ #pragma omp parallel reduction(+: a[ :10][0:12]) /* { dg-error "above array section size" } */
bar (a);
#pragma omp parallel reduction(+: b[0:10][0:10]) /* { dg-error "array section is not contiguous" } */
bar (a);
diff --git a/gcc/testsuite/c-c++-common/gomp/scan-1.c b/gcc/testsuite/c-c++-common/gomp/scan-1.c
index 95b46cb..ecc0bd0 100644
--- a/gcc/testsuite/c-c++-common/gomp/scan-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/scan-1.c
@@ -25,11 +25,11 @@ f2 (int *c, int *d, int *e, int *f)
#pragma omp scan inclusive (b) /* { dg-error "" } */
d[i] = b;
}
- #pragma omp for reduction (inscan, +: e[:2]) /* { dg-error "'inscan' 'reduction' clause with array section" } */
+ #pragma omp for reduction (inscan, +: e[ :2]) /* { dg-error "'inscan' 'reduction' clause with array section" } */
for (i = 0; i < 64; ++i)
{
{ e[0] += c[i]; e[1] += c[i]; }
- #pragma omp scan inclusive (a, e[:2]) /* { dg-error "" } */
+ #pragma omp scan inclusive (a, e[ :2]) /* { dg-error "" } */
{ d[i] = e[0]; f[i] = e[1]; }
}
#pragma omp for reduction (inscan, +: a) ordered /* { dg-error "'ordered' clause specified together with 'inscan' 'reduction' clause" } */
@@ -91,7 +91,7 @@ f3 (int *c, int *d)
}
#pragma omp scope reduction (inscan, +: a) /* { dg-error "'inscan' 'reduction' clause on 'scope' construct" } */
;
- #pragma omp target parallel for reduction (inscan, +: a) map (c[:64], d[:64]) /* { dg-error "'inscan' 'reduction' clause on construct other than 'for', 'simd', 'for simd', 'parallel for', 'parallel for simd'" } */
+ #pragma omp target parallel for reduction (inscan, +: a) map (c[ :64], d[ :64]) /* { dg-error "'inscan' 'reduction' clause on construct other than 'for', 'simd', 'for simd', 'parallel for', 'parallel for simd'" } */
for (i = 0; i < 64; i++)
{
d[i] = a;
diff --git a/gcc/testsuite/c-c++-common/gomp/target-data-1.c b/gcc/testsuite/c-c++-common/gomp/target-data-1.c
index 7aa111a..3b8e980 100644
--- a/gcc/testsuite/c-c++-common/gomp/target-data-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/target-data-1.c
@@ -6,7 +6,7 @@ foo (void)
int a[4] = { 1, 2, 3, 4 };
int *p = &a[0];
int x = 5;
- #pragma omp target data map(to:p[:4])
+ #pragma omp target data map(to:p[ :4])
#pragma omp target data use_device_ptr(p)
#pragma omp target is_device_ptr(p)
{
diff --git a/gcc/testsuite/c-c++-common/gomp/target-enter-data-1.c b/gcc/testsuite/c-c++-common/gomp/target-enter-data-1.c
index 4dc5188..57161bc 100644
--- a/gcc/testsuite/c-c++-common/gomp/target-enter-data-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/target-enter-data-1.c
@@ -16,9 +16,9 @@ struct foo
void func (struct foo *f, int n, int m)
{
- #pragma omp target enter data map (to: f->vectors[m][:n])
- #pragma omp target enter data map (to: f->bars[n].vectors[:m])
- #pragma omp target enter data map (to: f->bars[n].vectors[:f->bars[n].num_vectors])
+ #pragma omp target enter data map (to: f->vectors[m][ :n])
+ #pragma omp target enter data map (to: f->bars[n].vectors[ :m])
+ #pragma omp target enter data map (to: f->bars[n].vectors[ :f->bars[n].num_vectors])
}
/* { dg-final { scan-tree-dump-times {map\(struct:\*f \[len: 1\]\) map\(alloc:[a-z0-9\._]+->vectors \[len: 0\]\) map\(to:\*_[0-9]+ \[len: _[0-9]+\]\) map\(attach:[a-z0-9\._]+->vectors \[bias: [^\]]+\]\) map\(attach:\*_[0-9]+ \[bias: [^\]]+\]\)} 1 "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/target-has-device-addr-1.c b/gcc/testsuite/c-c++-common/gomp/target-has-device-addr-1.c
index ebf55ee..c9520a3 100644
--- a/gcc/testsuite/c-c++-common/gomp/target-has-device-addr-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/target-has-device-addr-1.c
@@ -26,20 +26,20 @@ foo ()
;
int z[3] = { 2, 5, 7 };
- #pragma omp target data map(z[:3]) use_device_addr(z)
- #pragma omp target has_device_addr(z[1:])
+ #pragma omp target data map(z[ :3]) use_device_addr(z)
+ #pragma omp target has_device_addr(z[1: ])
;
- #pragma omp target data map(z[:3]) use_device_addr(z)
+ #pragma omp target data map(z[ :3]) use_device_addr(z)
#pragma omp target has_device_addr(z[1])
;
- #pragma omp target data map(z[:3]) use_device_addr(z)
+ #pragma omp target data map(z[ :3]) use_device_addr(z)
#pragma omp target has_device_addr(z[1:2])
;
- #pragma omp target data map(z[:3]) use_device_addr(z)
- #pragma omp target has_device_addr(z[:2])
+ #pragma omp target data map(z[ :3]) use_device_addr(z)
+ #pragma omp target has_device_addr(z[ :2])
;
int w[3][4];
@@ -48,7 +48,7 @@ foo ()
;
#pragma omp target data map(w) use_device_addr(w)
- #pragma omp target has_device_addr(w[:1][2:])
+ #pragma omp target has_device_addr(w[ :1][2: ])
;
int u[0];
diff --git a/gcc/testsuite/c-c++-common/gomp/target-implicit-map-2.c b/gcc/testsuite/c-c++-common/gomp/target-implicit-map-2.c
index a336c2d..cb8c9a7 100644
--- a/gcc/testsuite/c-c++-common/gomp/target-implicit-map-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/target-implicit-map-2.c
@@ -22,29 +22,29 @@ main (void)
for (int i = 0; i < N; i++)
a.ptr[i] = 0;
- #pragma omp target enter data map(to: a.ptr, a.ptr[:N])
+ #pragma omp target enter data map(to: a.ptr, a.ptr[ :N])
#pragma omp target
for (int i = 0; i < N; i++)
a.ptr[i] += 1;
- #pragma omp target update from(a.ptr[:N])
+ #pragma omp target update from(a.ptr[ :N])
for (int i = 0; i < N; i++)
if (a.ptr[i] != 1)
abort ();
- #pragma omp target map(a.ptr[:N])
+ #pragma omp target map(a.ptr[ :N])
for (int i = 0; i < N; i++)
a.ptr[i] += 1;
- #pragma omp target update from(a.ptr[:N])
+ #pragma omp target update from(a.ptr[ :N])
for (int i = 0; i < N; i++)
if (a.ptr[i] != 2)
abort ();
- #pragma omp target exit data map(from:a.ptr, a.ptr[:N])
+ #pragma omp target exit data map(from:a.ptr, a.ptr[ :N])
return 0;
}
diff --git a/gcc/testsuite/c-c++-common/gomp/target-map-iterators-1.c b/gcc/testsuite/c-c++-common/gomp/target-map-iterators-1.c
new file mode 100644
index 0000000..8071907
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/target-map-iterators-1.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+#define DIM1 17
+#define DIM2 39
+
+void f (int **x, int **y)
+{
+ #pragma omp target map(iterator(i=0:DIM1), to: x[i][ :DIM2])
+ ;
+
+ #pragma omp target map(iterator(i=0:DIM1), to: x[i][ :DIM2], y[i][ :DIM2])
+ ;
+
+ #pragma omp target map(iterator(i=0:DIM1), to: x[i][ :DIM2] + 2) /* { dg-message "unsupported map expression" } */
+ ;
+
+ #pragma omp target map(iterator(i=0:DIM1), iterator(j=0:DIM2), to: x[i][j]) /* { dg-error "too many 'iterator' modifiers" } */
+ ;
+
+ #pragma omp target map(iterator(i=0:DIM1), to: (i % 2 == 0) ? x[i] : y[i]) /* { dg-message "unsupported map expression" } */
+ ;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/target-map-iterators-2.c b/gcc/testsuite/c-c++-common/gomp/target-map-iterators-2.c
new file mode 100644
index 0000000..42c6d75
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/target-map-iterators-2.c
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+
+void f (int *x, float *y, double *z)
+{
+ #pragma omp target map(iterator(i=0:10), to: x) /* { dg-warning "iterator variable 'i' not used in clause expression" } */
+ /* Add a reference to x to ensure that the 'to' clause does not get
+ dropped. */
+ x[0] = 0;
+
+ #pragma omp target map(iterator(i2=0:10, j2=0:20), from: x[i2]) /* { dg-warning "iterator variable 'j2' not used in clause expression" } */
+ ;
+
+ #pragma omp target map(iterator(i3=0:10, j3=0:20, k3=0:30), to: x[i3+j3], y[j3+k3], z[k3+i3])
+ /* { dg-warning "iterator variable 'i3' not used in clause expression" "" { target *-*-* } .-1 } */
+ /* { dg-warning "iterator variable 'j3' not used in clause expression" "" { target *-*-* } .-2 } */
+ /* { dg-warning "iterator variable 'k3' not used in clause expression" "" { target *-*-* } .-3 } */
+ ;
+
+ /* Test iterator with zero iterations. */
+ #pragma omp target map(iterator(i4=0:0), to: x[i4]) /* { dg-warning "iteration count is zero" } */
+ ;
+
+ /* Test iterator where the beginning is greater than the end. */
+ #pragma omp target map(iterator(i5=10:0), to: x[i5]) /* { dg-warning "iteration count is zero" } */
+ ;
+
+ /* Test iterator where the beginning is greater than the end, but with a
+ negative step. */
+ #pragma omp target map(iterator(i6=10:0:-1), to: x[i6])
+ ;
+}
+
+/* { dg-final { scan-tree-dump-times "map\\\(to:x" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "map\\\(iterator\\\(int i2=0:10:1, loop_label=\[^\\\)\]+\\\):from:" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "map\\\(iterator\\\(int i3=0:10:1, int j3=0:20:1, loop_label=\[^\\\)\]+\\\):to:" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "map\\\(iterator\\\(int j3=0:20:1, int k3=0:30:1, loop_label=\[^\\\)\]+\\\):to:" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "map\\\(iterator\\\(int i3=0:10:1, int k3=0:30:1, loop_label=\[^\\\)\]+\\\):to:" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "map\\\(iterator\\\(int i4=0:0:1, loop_label=\[^\\\)\]+\\\):to:" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "map\\\(iterator\\\(int i5=10:0:1, loop_label=\[^\\\)\]+\\\):to:" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "map\\\(iterator\\\(int i6=10:0:-1, loop_label=\[^\\\)\]+\\\):to:" 1 "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/target-map-iterators-3.c b/gcc/testsuite/c-c++-common/gomp/target-map-iterators-3.c
new file mode 100644
index 0000000..c313365
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/target-map-iterators-3.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+
+#define DIM1 10
+#define DIM2 20
+#define DIM3 30
+
+void f (int ***x, float ***y, double **z)
+{
+ #pragma omp target \
+ map(to: x, y) \
+ map(iterator(i=0:DIM1, j=0:DIM2), to: x[i][j][ :DIM3], y[i][j][ :DIM3]) \
+ map(from: z) \
+ map(iterator(i=0:DIM1), from: z[i][ :DIM2])
+ ;
+}
+
+/* { dg-final { scan-tree-dump-times "if \\(i <= 9\\) goto <D\\\.\[0-9\]+>; else goto <D\\\.\[0-9\]+>;" 3 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "if \\(j <= 19\\) goto <D\\\.\[0-9\]+>; else goto <D\\\.\[0-9\]+>;" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "map\\(iterator\\(int i=0:10:1, loop_label=<D\\\.\[0-9\]+>, elems=omp_iter_data\\\.\[0-9\]+, index=D\\\.\[0-9\]+\\):from:\\*D\\\.\[0-9\]+" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "map\\(iterator\\(int i=0:10:1, loop_label=<D\\\.\[0-9\]+>, elems=omp_iter_data\\\.\[0-9\]+, index=D\\\.\[0-9\]+\\):attach:\\*D\\\.\[0-9\]+" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "map\\(iterator\\(int i=0:10:1, int j=0:20:1, loop_label=<D\\\.\[0-9\]+>, elems=omp_iter_data\\\.\[0-9\]+, index=D\\\.\[0-9\]+\\):to:\\*D\\\.\[0-9\]+" 2 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "map\\(iterator\\(int i=0:10:1, int j=0:20:1, loop_label=<D\\\.\[0-9\]+>, elems=omp_iter_data\\\.\[0-9\]+, index=D\\\.\[0-9\]+\\):attach:\\*D\\\.\[0-9\]+" 4 "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/target-map-iterators-4.c b/gcc/testsuite/c-c++-common/gomp/target-map-iterators-4.c
new file mode 100644
index 0000000..5dc5ad5
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/target-map-iterators-4.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+/* { dg-additional-options "-std=c++98" { target c++ } } */
+
+int bar (int, int);
+void baz (int, int *);
+#pragma omp declare target enter (baz)
+
+void
+foo (int x, int *p)
+{
+ #pragma omp target map (iterator (i=0:4), to: p[bar (x, i)])
+ baz (x, p);
+}
+
+/* { dg-final { scan-tree-dump "firstprivate\\\(x\\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump-times "bar \\\(x, i\\\)" 2 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "map\\\(iterator\\\(int i=0:4:1, loop_label=" 2 "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/target-update-iterators-1.c b/gcc/testsuite/c-c++-common/gomp/target-update-iterators-1.c
new file mode 100644
index 0000000..d69fe95
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/target-update-iterators-1.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+#define DIM1 17
+#define DIM2 39
+
+void f (int **x, float **y)
+{
+ #pragma omp target update to (iterator(i=0:DIM1): x[i][ :DIM2])
+
+ #pragma omp target update to (iterator(i=0:DIM1): x[i][ :DIM2], y[i][ :DIM2])
+
+ #pragma omp target update to (iterator(i=0:DIM1), present: x[i][ :DIM2])
+
+ #pragma omp target update to (iterator(i=0:DIM1), iterator(j=0:DIM2): x[i][j]) /* { dg-error "too many 'iterator' modifiers" } */
+ /* { dg-error "'#pragma omp target update' must contain at least one 'from' or 'to' clauses" "" { target *-*-* } .-1 } */
+
+ #pragma omp target update from (iterator(i=0:DIM1), something: x[i][j]) /* { dg-error "'from' clause with modifier other than 'iterator' or 'present'" } */
+ /* { dg-error "expected '\\)' before 'something'" "" { target c } .-1 } */
+ /* { dg-error "'#pragma omp target update' must contain at least one 'from' or 'to' clauses" "" { target *-*-* } .-2 } */
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/target-update-iterators-2.c b/gcc/testsuite/c-c++-common/gomp/target-update-iterators-2.c
new file mode 100644
index 0000000..dbd43e0
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/target-update-iterators-2.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+
+void f (int *x, float *y, double *z)
+{
+ #pragma omp target update to(iterator(i=0:10): x) /* { dg-warning "iterator variable 'i' not used in clause expression" }*/
+ ;
+
+ #pragma omp target update from(iterator(i2=0:10, j2=0:20): x[i2]) /* { dg-warning "iterator variable 'j2' not used in clause expression" }*/
+ ;
+
+ #pragma omp target update to(iterator(i3=0:10, j3=0:20, k3=0:30): x[i3+j3], y[j3+k3], z[k3+i3])
+ /* { dg-warning "iterator variable 'i3' not used in clause expression" "" { target *-*-* } .-1 } */
+ /* { dg-warning "iterator variable 'j3' not used in clause expression" "" { target *-*-* } .-2 } */
+ /* { dg-warning "iterator variable 'k3' not used in clause expression" "" { target *-*-* } .-3 } */
+ ;
+}
+
+/* { dg-final { scan-tree-dump "update to\\\(x " "gimple" } } */
+/* { dg-final { scan-tree-dump "update from\\\(iterator\\\(int i2=0:10:1, loop_label=" "gimple" } } */
+/* { dg-final { scan-tree-dump "to\\\(iterator\\\(int i3=0:10:1, int k3=0:30:1, loop_label=" "gimple" } } */
+/* { dg-final { scan-tree-dump "to\\\(iterator\\\(int j3=0:20:1, int k3=0:30:1, loop_label=" "gimple" } } */
+/* { dg-final { scan-tree-dump "to\\\(iterator\\\(int i3=0:10:1, int j3=0:20:1, loop_label=" "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/target-update-iterators-3.c b/gcc/testsuite/c-c++-common/gomp/target-update-iterators-3.c
new file mode 100644
index 0000000..0057cf7
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/target-update-iterators-3.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple" } */
+
+#define DIM1 10
+#define DIM2 20
+#define DIM3 30
+
+void f (int ***x, float ***y, double **z)
+{
+ #pragma omp target update to (iterator(i=0:DIM1, j=0:DIM2): x[i][j][ :DIM3], y[i][j][ :DIM3])
+ #pragma omp target update from (iterator(i=0:DIM1): z[i][ :DIM2])
+}
+
+/* { dg-final { scan-tree-dump-times "if \\(i <= 9\\) goto <D\.\[0-9\]+>; else goto <D\.\[0-9\]+>;" 2 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "if \\(j <= 19\\) goto <D\.\[0-9\]+>; else goto <D\.\[0-9\]+>;" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "to\\(iterator\\(int i=0:10:1, int j=0:20:1, loop_label=<D\.\[0-9\]+>, elems=omp_iter_data\.\[0-9\]+, index=D\.\[0-9\]+\\):\\*D\.\[0-9\]+" 2 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "from\\(iterator\\(int i=0:10:1, loop_label=<D\.\[0-9\]+>, elems=omp_iter_data\.\[0-9\]+, index=D\.\[0-9\]+\\):\\*D\.\[0-9\]+" 1 "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/hwasan/unprotected-allocas-0.c b/gcc/testsuite/c-c++-common/hwasan/unprotected-allocas-0.c
index 8846515..0feca6a 100644
--- a/gcc/testsuite/c-c++-common/hwasan/unprotected-allocas-0.c
+++ b/gcc/testsuite/c-c++-common/hwasan/unprotected-allocas-0.c
@@ -12,7 +12,7 @@
char tag_of (void * x) { return ((unsigned long long)x) >> 56; }
-int __attribute__ ((noinline))
+int __attribute__ ((noinline,noclone))
using_alloca (int num)
{
int retval = 0;
@@ -25,7 +25,7 @@ using_alloca (int num)
return retval;
}
-int __attribute__ ((noinline))
+int __attribute__ ((noinline,noclone))
using_vararray (int num)
{
int retval = 0;
diff --git a/gcc/testsuite/c-c++-common/musttail14.c b/gcc/testsuite/c-c++-common/musttail14.c
index 56a52b8..5bda742 100644
--- a/gcc/testsuite/c-c++-common/musttail14.c
+++ b/gcc/testsuite/c-c++-common/musttail14.c
@@ -1,5 +1,5 @@
/* PR tree-optimization/118430 */
-/* { dg-do compile { target musttail } } */
+/* { dg-do compile { target { musttail && { ! using_sjlj_exceptions } } } } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
/* { dg-final { scan-tree-dump-times " \[^\n\r]* = bar \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times " \[^\n\r]* = freddy \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
diff --git a/gcc/testsuite/c-c++-common/musttail15.c b/gcc/testsuite/c-c++-common/musttail15.c
index 2addc97..b8223d7 100644
--- a/gcc/testsuite/c-c++-common/musttail15.c
+++ b/gcc/testsuite/c-c++-common/musttail15.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { musttail && { c || c++11 } } } } */
+/* { dg-do compile { target musttail } } */
/* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */
int __attribute__((noinline,noclone,noipa))
diff --git a/gcc/testsuite/c-c++-common/musttail16.c b/gcc/testsuite/c-c++-common/musttail16.c
index b1e2ff3..f27a279 100644
--- a/gcc/testsuite/c-c++-common/musttail16.c
+++ b/gcc/testsuite/c-c++-common/musttail16.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { musttail && { c || c++11 } } } } */
+/* { dg-do compile { target musttail } } */
struct box { char field[256]; int i; };
diff --git a/gcc/testsuite/c-c++-common/musttail17.c b/gcc/testsuite/c-c++-common/musttail17.c
index 490f3c3..58fab84 100644
--- a/gcc/testsuite/c-c++-common/musttail17.c
+++ b/gcc/testsuite/c-c++-common/musttail17.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { musttail && { c || c++11 } } } } */
+/* { dg-do compile { target musttail } } */
struct box { char field[64]; int i; };
diff --git a/gcc/testsuite/c-c++-common/musttail18.c b/gcc/testsuite/c-c++-common/musttail18.c
index 4f34a8d..ab60887 100644
--- a/gcc/testsuite/c-c++-common/musttail18.c
+++ b/gcc/testsuite/c-c++-common/musttail18.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { musttail && { c || c++11 } } } } */
+/* { dg-do compile { target musttail } } */
/* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */
void __attribute__((noipa)) f() {}
diff --git a/gcc/testsuite/c-c++-common/musttail19.c b/gcc/testsuite/c-c++-common/musttail19.c
index 70f9eaf..a592b69 100644
--- a/gcc/testsuite/c-c++-common/musttail19.c
+++ b/gcc/testsuite/c-c++-common/musttail19.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { musttail && { c || c++11 } } } } */
+/* { dg-do compile { target musttail } } */
float f1(void);
@@ -10,8 +10,9 @@ int f2(void)
int f3(int *);
-int f4(void)
+int f4(int *p)
{
int x;
- __attribute__((musttail)) return f3(&x); /* { dg-error "\(refers to locals|other reasons\)" } */
+ (void) p;
+ __attribute__((musttail)) return f3(&x); /* { dg-warning "address of automatic variable 'x' passed to 'musttail' call argument" } */
}
diff --git a/gcc/testsuite/c-c++-common/musttail20.c b/gcc/testsuite/c-c++-common/musttail20.c
index 70f14ff..1931f2c 100644
--- a/gcc/testsuite/c-c++-common/musttail20.c
+++ b/gcc/testsuite/c-c++-common/musttail20.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { struct_musttail && { c || c++11 } } } } */
+/* { dg-do compile { target struct_musttail } } */
/* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */
struct str
diff --git a/gcc/testsuite/c-c++-common/musttail21.c b/gcc/testsuite/c-c++-common/musttail21.c
index 954209d..1a109e1 100644
--- a/gcc/testsuite/c-c++-common/musttail21.c
+++ b/gcc/testsuite/c-c++-common/musttail21.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { c || c++11 } } } */
+/* { dg-do compile { target musttail } } */
void f(void)
{
__attribute__((musttail)) return; /* { dg-error "cannot tail-call.*return value must be a call" } */
diff --git a/gcc/testsuite/c-c++-common/musttail22.c b/gcc/testsuite/c-c++-common/musttail22.c
index eb81249..7dc0f19 100644
--- a/gcc/testsuite/c-c++-common/musttail22.c
+++ b/gcc/testsuite/c-c++-common/musttail22.c
@@ -1,5 +1,5 @@
/* PR tree-optimization/118430 */
-/* { dg-do compile { target musttail } } */
+/* { dg-do compile { target { musttail && { ! using_sjlj_exceptions } } } } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
/* { dg-final { scan-tree-dump-times " \[^\n\r]* = bar \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times " \[^\n\r]* = freddy \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
diff --git a/gcc/testsuite/c-c++-common/musttail28.c b/gcc/testsuite/c-c++-common/musttail28.c
new file mode 100644
index 0000000..d84658a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/musttail28.c
@@ -0,0 +1,108 @@
+/* { dg-do compile { target { musttail && { c || c++11 } } } } */
+
+int foo (int, void *);
+int bar (int, int *);
+struct S { int a, b, c; };
+struct T { int d; struct S e; };
+
+int
+baz (int x, void *y)
+{
+ [[gnu::musttail]] return bar (2, &x); /* { dg-warning "address of parameter 'x' passed to 'musttail' call argument" } */
+}
+
+int
+qux (int x, void *y)
+{
+ __label__ lab;
+ lab:;
+ if (*(int *) y == 1)
+ [[gnu::musttail]] return foo (1, &&lab); /* { dg-warning "address of label passed to 'musttail' call argument" } */
+ if (x == 1)
+ [[gnu::musttail]] return foo (3, 0);
+ else if (x == 2)
+ {
+ {
+ int a = 42;
+ bar (4, &a);
+ }
+ [[gnu::musttail]] return bar (5, 0);
+ }
+ else if (x == 3)
+ {
+ int a = 42;
+ bar (4, &a);
+ [[gnu::musttail]] return bar (6, 0);
+ }
+ else if (x == 4)
+ {
+ int a = 42;
+ [[gnu::musttail]] return bar (7, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */
+ }
+ else if (x == 5)
+ {
+ struct T b;
+ [[gnu::musttail]] return bar (8, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */
+ }
+ else if (x == 6)
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ [[gnu::musttail]] return bar (10, 0);
+ }
+ else if (x == 7)
+ {
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ }
+ [[gnu::musttail]] return bar (11, 0);
+ }
+ else if (x == 8)
+ {
+ {
+ int a = 42;
+ bar (4, &a);
+ }
+ [[gnu::musttail]] return foo (12, 0);
+ }
+ else if (x == 9)
+ {
+ int a = 42;
+ bar (4, &a);
+ [[gnu::musttail]] return foo (13, 0);
+ }
+ else if (x == 10)
+ {
+ int a = 42;
+ [[gnu::musttail]] return foo (14, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */
+ }
+ else if (x == 11)
+ {
+ struct T b;
+ [[gnu::musttail]] return foo (15, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */
+ }
+ else if (x == 12)
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ [[gnu::musttail]] return foo (16, 0);
+ }
+ else if (x == 13)
+ {
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ }
+ [[gnu::musttail]] return foo (17, 0);
+ }
+ return 0;
+}
+
+int
+corge (int x, void *y)
+{
+ if (*(int *) y == 1)
+ bar (18, &x);
+ [[gnu::musttail]] return bar (2, 0);
+}
diff --git a/gcc/testsuite/c-c++-common/musttail29.c b/gcc/testsuite/c-c++-common/musttail29.c
new file mode 100644
index 0000000..f6b3d76
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/musttail29.c
@@ -0,0 +1,109 @@
+/* { dg-do compile { target { musttail && { c || c++11 } } } } */
+/* { dg-options "-O2 -Wmusttail-local-addr" } */
+
+int foo (int, void *);
+int bar (int, int *);
+struct S { int a, b, c; };
+struct T { int d; struct S e; };
+
+int
+baz (int x, void *y)
+{
+ [[gnu::musttail]] return bar (2, &x); /* { dg-warning "address of parameter 'x' passed to 'musttail' call argument" } */
+}
+
+int
+qux (int x, void *y)
+{
+ __label__ lab;
+ lab:;
+ if (*(int *) y == 1)
+ [[gnu::musttail]] return foo (1, &&lab); /* { dg-warning "address of label passed to 'musttail' call argument" } */
+ if (x == 1)
+ [[gnu::musttail]] return foo (3, 0);
+ else if (x == 2)
+ {
+ {
+ int a = 42;
+ bar (4, &a);
+ }
+ [[gnu::musttail]] return bar (5, 0);
+ }
+ else if (x == 3)
+ {
+ int a = 42;
+ bar (4, &a);
+ [[gnu::musttail]] return bar (6, 0);
+ }
+ else if (x == 4)
+ {
+ int a = 42;
+ [[gnu::musttail]] return bar (7, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */
+ }
+ else if (x == 5)
+ {
+ struct T b;
+ [[gnu::musttail]] return bar (8, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */
+ }
+ else if (x == 6)
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ [[gnu::musttail]] return bar (10, 0);
+ }
+ else if (x == 7)
+ {
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ }
+ [[gnu::musttail]] return bar (11, 0);
+ }
+ else if (x == 8)
+ {
+ {
+ int a = 42;
+ bar (4, &a);
+ }
+ [[gnu::musttail]] return foo (12, 0);
+ }
+ else if (x == 9)
+ {
+ int a = 42;
+ bar (4, &a);
+ [[gnu::musttail]] return foo (13, 0);
+ }
+ else if (x == 10)
+ {
+ int a = 42;
+ [[gnu::musttail]] return foo (14, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */
+ }
+ else if (x == 11)
+ {
+ struct T b;
+ [[gnu::musttail]] return foo (15, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */
+ }
+ else if (x == 12)
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ [[gnu::musttail]] return foo (16, 0);
+ }
+ else if (x == 13)
+ {
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ }
+ [[gnu::musttail]] return foo (17, 0);
+ }
+ return 0;
+}
+
+int
+corge (int x, void *y)
+{
+ if (*(int *) y == 1)
+ bar (18, &x);
+ [[gnu::musttail]] return bar (2, 0);
+}
diff --git a/gcc/testsuite/c-c++-common/musttail30.c b/gcc/testsuite/c-c++-common/musttail30.c
new file mode 100644
index 0000000..be1c3da
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/musttail30.c
@@ -0,0 +1,109 @@
+/* { dg-do compile { target { musttail && { c || c++11 } } } } */
+/* { dg-options "-Wextra" } */
+
+int foo (int, void *);
+int bar (int, int *);
+struct S { int a, b, c; };
+struct T { int d; struct S e; };
+
+int
+baz (int x, void *y)
+{
+ [[gnu::musttail]] return bar (2, &x); /* { dg-warning "address of parameter 'x' passed to 'musttail' call argument" } */
+}
+
+int
+qux (int x, void *y)
+{
+ __label__ lab;
+ lab:;
+ if (*(int *) y == 1)
+ [[gnu::musttail]] return foo (1, &&lab); /* { dg-warning "address of label passed to 'musttail' call argument" } */
+ if (x == 1)
+ [[gnu::musttail]] return foo (3, 0);
+ else if (x == 2)
+ {
+ {
+ int a = 42;
+ bar (4, &a);
+ }
+ [[gnu::musttail]] return bar (5, 0);
+ }
+ else if (x == 3)
+ {
+ int a = 42;
+ bar (4, &a);
+ [[gnu::musttail]] return bar (6, 0); /* { dg-warning "address of automatic variable 'a' can escape to 'musttail' call" } */
+ }
+ else if (x == 4)
+ {
+ int a = 42;
+ [[gnu::musttail]] return bar (7, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */
+ }
+ else if (x == 5)
+ {
+ struct T b;
+ [[gnu::musttail]] return bar (8, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */
+ }
+ else if (x == 6)
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ [[gnu::musttail]] return bar (10, 0); /* { dg-warning "address of automatic variable 'b' can escape to 'musttail' call" } */
+ }
+ else if (x == 7)
+ {
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ }
+ [[gnu::musttail]] return bar (11, 0);
+ }
+ else if (x == 8)
+ {
+ {
+ int a = 42;
+ bar (4, &a);
+ }
+ [[gnu::musttail]] return foo (12, 0);
+ }
+ else if (x == 9)
+ {
+ int a = 42;
+ bar (4, &a);
+ [[gnu::musttail]] return foo (13, 0); /* { dg-warning "address of automatic variable 'a' can escape to 'musttail' call" } */
+ }
+ else if (x == 10)
+ {
+ int a = 42;
+ [[gnu::musttail]] return foo (14, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */
+ }
+ else if (x == 11)
+ {
+ struct T b;
+ [[gnu::musttail]] return foo (15, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */
+ }
+ else if (x == 12)
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ [[gnu::musttail]] return foo (16, 0); /* { dg-warning "address of automatic variable 'b' can escape to 'musttail' call" } */
+ }
+ else if (x == 13)
+ {
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ }
+ [[gnu::musttail]] return foo (17, 0);
+ }
+ return 0;
+}
+
+int
+corge (int x, void *y)
+{
+ if (*(int *) y == 1)
+ bar (18, &x);
+ [[gnu::musttail]] return bar (2, 0); /* { dg-warning "address of parameter 'x' can escape to 'musttail' call" } */
+}
diff --git a/gcc/testsuite/c-c++-common/musttail31.c b/gcc/testsuite/c-c++-common/musttail31.c
new file mode 100644
index 0000000..f44ada4
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/musttail31.c
@@ -0,0 +1,109 @@
+/* { dg-do compile { target { musttail && { c || c++11 } } } } */
+/* { dg-options "-O2 -Wmaybe-musttail-local-addr" } */
+
+int foo (int, void *);
+int bar (int, int *);
+struct S { int a, b, c; };
+struct T { int d; struct S e; };
+
+int
+baz (int x, void *y)
+{
+ [[gnu::musttail]] return bar (2, &x); /* { dg-warning "address of parameter 'x' passed to 'musttail' call argument" } */
+}
+
+int
+qux (int x, void *y)
+{
+ __label__ lab;
+ lab:;
+ if (*(int *) y == 1)
+ [[gnu::musttail]] return foo (1, &&lab); /* { dg-warning "address of label passed to 'musttail' call argument" } */
+ if (x == 1)
+ [[gnu::musttail]] return foo (3, 0);
+ else if (x == 2)
+ {
+ {
+ int a = 42;
+ bar (4, &a);
+ }
+ [[gnu::musttail]] return bar (5, 0);
+ }
+ else if (x == 3)
+ {
+ int a = 42;
+ bar (4, &a);
+ [[gnu::musttail]] return bar (6, 0); /* { dg-warning "address of automatic variable 'a' can escape to 'musttail' call" } */
+ }
+ else if (x == 4)
+ {
+ int a = 42;
+ [[gnu::musttail]] return bar (7, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */
+ }
+ else if (x == 5)
+ {
+ struct T b;
+ [[gnu::musttail]] return bar (8, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */
+ }
+ else if (x == 6)
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ [[gnu::musttail]] return bar (10, 0); /* { dg-warning "address of automatic variable 'b' can escape to 'musttail' call" } */
+ }
+ else if (x == 7)
+ {
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ }
+ [[gnu::musttail]] return bar (11, 0);
+ }
+ else if (x == 8)
+ {
+ {
+ int a = 42;
+ bar (4, &a);
+ }
+ [[gnu::musttail]] return foo (12, 0);
+ }
+ else if (x == 9)
+ {
+ int a = 42;
+ bar (4, &a);
+ [[gnu::musttail]] return foo (13, 0); /* { dg-warning "address of automatic variable 'a' can escape to 'musttail' call" } */
+ }
+ else if (x == 10)
+ {
+ int a = 42;
+ [[gnu::musttail]] return foo (14, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */
+ }
+ else if (x == 11)
+ {
+ struct T b;
+ [[gnu::musttail]] return foo (15, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */
+ }
+ else if (x == 12)
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ [[gnu::musttail]] return foo (16, 0); /* { dg-warning "address of automatic variable 'b' can escape to 'musttail' call" } */
+ }
+ else if (x == 13)
+ {
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ }
+ [[gnu::musttail]] return foo (17, 0);
+ }
+ return 0;
+}
+
+int
+corge (int x, void *y)
+{
+ if (*(int *) y == 1)
+ bar (18, &x);
+ [[gnu::musttail]] return bar (2, 0); /* { dg-warning "address of parameter 'x' can escape to 'musttail' call" } */
+}
diff --git a/gcc/testsuite/c-c++-common/musttail32.c b/gcc/testsuite/c-c++-common/musttail32.c
new file mode 100644
index 0000000..f1b7052
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/musttail32.c
@@ -0,0 +1,23 @@
+/* PR ipa/121023 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-O2" } */
+
+struct S { int a, b; };
+
+[[gnu::noipa]] int
+foo (struct S x, int y, int z)
+{
+ return x.a + y + z;
+}
+
+[[gnu::noinline]] static int
+bar (struct S x, int y, int z)
+{
+ [[gnu::musttail]] return foo ((struct S) { x.a, 0 }, y, 1);
+}
+
+int
+baz (int x)
+{
+ return bar ((struct S) { 1, 2 }, x, 2) + bar ((struct S) { 2, 3 }, x + 1, 2);
+}
diff --git a/gcc/testsuite/c-c++-common/musttail8.c b/gcc/testsuite/c-c++-common/musttail8.c
index 50ca1ac..9a29030 100644
--- a/gcc/testsuite/c-c++-common/musttail8.c
+++ b/gcc/testsuite/c-c++-common/musttail8.c
@@ -10,8 +10,9 @@ int f2(void)
int f3(int *);
-int f4(void)
+int f4(int *p)
{
int x;
- [[gnu::musttail]] return f3(&x); /* { dg-error "\(refers to locals|other reasons\)" } */
+ (void) p;
+ [[gnu::musttail]] return f3(&x); /* { dg-warning "address of automatic variable 'x' passed to 'musttail' call argument" } */
}
diff --git a/gcc/testsuite/c-c++-common/pr106133.c b/gcc/testsuite/c-c++-common/pr106133.c
deleted file mode 100644
index 7d2c5af..0000000
--- a/gcc/testsuite/c-c++-common/pr106133.c
+++ /dev/null
@@ -1,3 +0,0 @@
-/* PR middle-end/106133 */
-/* { dg-do compile } */
-/* { dg-options "-fdiagnostics-format=json-file -E" } */
diff --git a/gcc/testsuite/c-c++-common/pr118442.c b/gcc/testsuite/c-c++-common/pr118442.c
new file mode 100644
index 0000000..2472aa6
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr118442.c
@@ -0,0 +1,17 @@
+/* PR118442 */
+/* { dg-do compile { target { struct_musttail && { external_musttail && { c || c++11 } } } } } */
+/* { dg-options "-fprofile-generate -O2" } */
+/* { dg-require-profiling "-fprofile-generate" } */
+
+struct Span {
+ int test[5];
+};
+
+extern void resolveToBufferSlow (struct Span *buffer);
+
+void
+resolveToBuffer (struct Span *buffer)
+{
+ buffer->test[0] = 4;
+ [[clang::musttail]] return resolveToBufferSlow (buffer);
+}
diff --git a/gcc/testsuite/c-c++-common/pr118868-1.c b/gcc/testsuite/c-c++-common/pr118868-1.c
new file mode 100644
index 0000000..d0a9e77f7
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr118868-1.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+
+/* PR middle-end/118868 */
+
+/* __builtin_assoc_barrier should work on pointers without any ICE */
+void *f(void *a)
+{
+ return __builtin_assoc_barrier(a);
+}
diff --git a/gcc/testsuite/c-c++-common/pr119483-1.c b/gcc/testsuite/c-c++-common/pr119483-1.c
new file mode 100644
index 0000000..b2d7b57
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119483-1.c
@@ -0,0 +1,29 @@
+/* PR tree-optimization/119483 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "bar\[.a-z0-9]* \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "baz \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
+
+[[gnu::noreturn]] extern void foo (void);
+
+[[gnu::noinline]] static int
+bar (int x)
+{
+ (void) x;
+ foo ();
+ return 0;
+}
+
+[[gnu::noipa]] int
+baz (int x)
+{
+ return x + 42;
+}
+
+int
+qux (int x)
+{
+ if (x == 1)
+ [[gnu::musttail]] return bar (1);
+ [[gnu::musttail]] return baz (x);
+}
diff --git a/gcc/testsuite/c-c++-common/pr119483-2.c b/gcc/testsuite/c-c++-common/pr119483-2.c
new file mode 100644
index 0000000..e7b692d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119483-2.c
@@ -0,0 +1,12 @@
+/* PR tree-optimization/119483 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-O2" } */
+
+[[noreturn]] int
+foo (int x)
+{
+ if (x > 10)
+ [[gnu::musttail]] return foo (x - 1); /* { dg-warning "function declared 'noreturn' has a 'return' statement" } */
+ for (;;)
+ ;
+}
diff --git a/gcc/testsuite/c-c++-common/pr119484.c b/gcc/testsuite/c-c++-common/pr119484.c
new file mode 100644
index 0000000..6ae7c9a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119484.c
@@ -0,0 +1,21 @@
+/* PR ipa/119484 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "bar\[.a-z0-9]* \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
+
+void foo (int);
+
+[[gnu::noinline]] static int
+bar (int x)
+{
+ foo (x);
+ return 0;
+}
+
+int
+baz (int x)
+{
+ if (x == 1)
+ [[gnu::musttail]] return bar (x);
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/pr119535.c b/gcc/testsuite/c-c++-common/pr119535.c
new file mode 100644
index 0000000..fd88cc4
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119535.c
@@ -0,0 +1,31 @@
+/* PR gcov-profile/119535
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-fprofile-generate -O2" } */
+/* { dg-require-profiling "-fprofile-generate" } */
+
+[[gnu::noipa]] int
+foo (int x)
+{
+ return 42 + x;
+}
+
+int
+bar (int x)
+{
+ foo (x);
+ foo (2);
+ [[clang::musttail]] return foo (3);
+}
+
+int
+baz (int x)
+{
+ if (x == 42)
+ return -1;
+ else if (x == 15)
+ return 25;
+ else if (x == 26)
+ [[clang::musttail]] return foo (4);
+ else
+ [[clang::musttail]] return foo (5);
+}
diff --git a/gcc/testsuite/c-c++-common/pr119537-1.c b/gcc/testsuite/c-c++-common/pr119537-1.c
new file mode 100644
index 0000000..7959826
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119537-1.c
@@ -0,0 +1,23 @@
+/* PR middle-end/119537 */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+volatile int v;
+void *bar (void *, void *);
+
+void
+foo (bool z)
+{
+ if (z)
+ goto *&&x; /* { dg-error "reference to label 'x' defined inside of 'assume' attribute expression from outside of the attribute" } */
+ /* { dg-message "as a possible target of computed goto" "" { target c++ } .-1 } */
+ [[gnu::assume (({ x: v += 1; true; }))]];/* { dg-message "'x' defined here" } */
+ /* { dg-warning "jump to label 'x'" "" { target c++ } .-1 } */
+ /* { dg-message "enters statement expression" "" { target c++ } .-2 } */
+ [[gnu::assume (({ y: v += 1; true; }))]];/* { dg-message "'y' defined here" } */
+ /* { dg-warning "jump to label 'y'" "" { target c++ } .-1 } */
+ goto *bar (&&x, &&y); /* { dg-error "reference to label 'x' defined inside of 'assume' attribute expression from outside of the attribute" } */
+ /* { dg-error "reference to label 'y' defined inside of 'assume' attribute expression from outside of the attribute" "" { target *-*-* } .-1 } */
+ /* { dg-message "as a possible target of computed goto" "" { target c++ } .-2 } */
+ /* { dg-message "enters statement expression" "" { target c++ } .-3 } */
+}
diff --git a/gcc/testsuite/c-c++-common/pr119537-2.c b/gcc/testsuite/c-c++-common/pr119537-2.c
new file mode 100644
index 0000000..7d65672
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119537-2.c
@@ -0,0 +1,23 @@
+/* PR middle-end/119537 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+volatile int v;
+void *bar (void *, void *);
+
+void
+foo (bool z)
+{
+ if (z)
+ goto *&&x; /* { dg-error "reference to label 'x' defined inside of 'assume' attribute expression from outside of the attribute" } */
+ /* { dg-message "as a possible target of computed goto" "" { target c++ } .-1 } */
+ [[gnu::assume (({ x: v += 1; true; }))]];/* { dg-message "'x' defined here" } */
+ /* { dg-warning "jump to label 'x'" "" { target c++ } .-1 } */
+ /* { dg-message "enters statement expression" "" { target c++ } .-2 } */
+ [[gnu::assume (({ y: v += 1; true; }))]];/* { dg-message "'y' defined here" } */
+ /* { dg-warning "jump to label 'y'" "" { target c++ } .-1 } */
+ goto *bar (&&x, &&y); /* { dg-error "reference to label 'x' defined inside of 'assume' attribute expression from outside of the attribute" } */
+ /* { dg-error "reference to label 'y' defined inside of 'assume' attribute expression from outside of the attribute" "" { target *-*-* } .-1 } */
+ /* { dg-message "as a possible target of computed goto" "" { target c++ } .-2 } */
+ /* { dg-message "enters statement expression" "" { target c++ } .-3 } */
+}
diff --git a/gcc/testsuite/c-c++-common/pr119614-1.c b/gcc/testsuite/c-c++-common/pr119614-1.c
new file mode 100644
index 0000000..89105a3
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119614-1.c
@@ -0,0 +1,28 @@
+/* PR tree-optimization/119614 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-O2" } */
+
+volatile int v;
+
+[[gnu::noinline]] const char *
+foo (int x)
+{
+ v += x;
+ return 0;
+}
+
+const char *
+bar (int x)
+{
+ if (x == 42)
+ [[gnu::musttail]] return foo (42);
+ [[gnu::musttail]] return foo (32);
+}
+
+const char *
+baz (int x)
+{
+ if (x == 5)
+ return foo (42);
+ return foo (32);
+}
diff --git a/gcc/testsuite/c-c++-common/pr119614-2.c b/gcc/testsuite/c-c++-common/pr119614-2.c
new file mode 100644
index 0000000..8833eee
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119614-2.c
@@ -0,0 +1,28 @@
+/* PR tree-optimization/119614 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-O2" } */
+
+volatile int v;
+
+[[gnu::noinline]] const char *
+foo (int x)
+{
+ v += x;
+ return (const char *) -42;
+}
+
+const char *
+bar (int x)
+{
+ if (x == 42)
+ [[gnu::musttail]] return foo (42);
+ [[gnu::musttail]] return foo (32);
+}
+
+const char *
+baz (int x)
+{
+ if (x == 5)
+ return foo (42);
+ return foo (32);
+}
diff --git a/gcc/testsuite/c-c++-common/pr119614-3.c b/gcc/testsuite/c-c++-common/pr119614-3.c
new file mode 100644
index 0000000..59ed36b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119614-3.c
@@ -0,0 +1,28 @@
+/* PR tree-optimization/119614 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-O2" } */
+
+volatile int v;
+
+[[gnu::noinline]] double
+foo (int x)
+{
+ v += x;
+ return 0.5;
+}
+
+double
+bar (int x)
+{
+ if (x == 42)
+ [[gnu::musttail]] return foo (42);
+ [[gnu::musttail]] return foo (32);
+}
+
+double
+baz (int x)
+{
+ if (x == 5)
+ return foo (42);
+ return foo (32);
+}
diff --git a/gcc/testsuite/c-c++-common/pr119616.c b/gcc/testsuite/c-c++-common/pr119616.c
new file mode 100644
index 0000000..5ffdb8c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119616.c
@@ -0,0 +1,23 @@
+/* PR tree-optimization/119616 */
+/* { dg-do compile { target external_musttail } } */
+/* { dg-options "-O2" } */
+
+int foo (int *);
+int bar (int);
+
+int
+baz (int x)
+{
+ if (!x)
+ [[gnu::musttail]] return bar (x);
+ return foo (&x);
+}
+
+int
+qux (int x)
+{
+ if (!x)
+ [[gnu::musttail]] return bar (x);
+ foo (&x);
+ return 1;
+}
diff --git a/gcc/testsuite/c-c++-common/pr119618.c b/gcc/testsuite/c-c++-common/pr119618.c
new file mode 100644
index 0000000..a56e669
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119618.c
@@ -0,0 +1,21 @@
+/* PR gcov-profile/119618 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-fcompare-debug -fprofile-generate -O1" } */
+/* { dg-require-profiling "-fprofile-generate" } */
+
+struct S { char s; };
+int foo (void);
+int *(*fn) (void);
+
+int *
+bar (void)
+{
+ if (foo ())
+ return 0;
+ {
+ struct S s;
+ do
+ [[gnu::musttail]] return fn ();
+ while (0);
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/pr121159.c b/gcc/testsuite/c-c++-common/pr121159.c
new file mode 100644
index 0000000..c8c5d67
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr121159.c
@@ -0,0 +1,17 @@
+/* PR middle-end/121159 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "foo \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
+
+[[noreturn, gnu::noipa]] void
+foo (void)
+{
+ for (;;)
+ ;
+}
+
+void
+bar (void)
+{
+ [[gnu::musttail]] return foo ();
+}
diff --git a/gcc/testsuite/c-c++-common/pr122188.c b/gcc/testsuite/c-c++-common/pr122188.c
new file mode 100644
index 0000000..8c3fa1c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr122188.c
@@ -0,0 +1,15 @@
+/* PR c/122188 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+foo (const unsigned x, int y)
+{
+ return __builtin_ctzg (x ? x : 4081577U, y);
+}
+
+int
+bar (const unsigned x, int y)
+{
+ return __builtin_clzg (x ? x : 4081577U, y);
+}
diff --git a/gcc/testsuite/c-c++-common/pragma-optimize-1.c b/gcc/testsuite/c-c++-common/pragma-optimize-1.c
new file mode 100644
index 0000000..1446e5a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pragma-optimize-1.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-Ofast" } */
+
+/* PR c++/48026 */
+/* Make sure `#pragma GCC optimize` affects the pre-defined macros too */
+
+#pragma GCC optimize ("no-fast-math")
+#ifdef __FAST_MATH__
+# error Hey yo, What you doing on FAST_MATH??
+#endif
diff --git a/gcc/testsuite/c-c++-common/restrict-2.c b/gcc/testsuite/c-c++-common/restrict-2.c
index ad19fb3..940365c 100644
--- a/gcc/testsuite/c-c++-common/restrict-2.c
+++ b/gcc/testsuite/c-c++-common/restrict-2.c
@@ -10,4 +10,4 @@ void foo (float * __restrict__ a, float * __restrict__ b, int n, int j)
/* We should move the RHS of the store out of the loop. */
-/* { dg-final { scan-tree-dump-times "Moving statement" 11 "lim2" } } */
+/* { dg-final { scan-tree-dump-times "Moving statement _\[0-9\]+ = \\\*_" 2 "lim2" } } */
diff --git a/gcc/testsuite/c-c++-common/tls-attr-common.c b/gcc/testsuite/c-c++-common/tls-attr-common.c
new file mode 100644
index 0000000..55153bb
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/tls-attr-common.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target pie } */
+/* { dg-require-effective-target tls } */
+/* { dg-options "-O2 -fdump-ipa-whole-program" } */
+/* Add -fPIE or -mno-direct-extern-access to disable direct access to
+ external symbol from executable. */
+/* { dg-additional-options "-fPIE" { target { ! { i?86-*-* x86_64-*-* } } } } */
+/* { dg-additional-options "-mno-direct-extern-access" { target { i?86-*-* x86_64-*-* } } } */
+
+__attribute__((common))
+__thread int i;
+
+int *
+foo (void)
+{
+ return &i;
+}
+
+/* tls_model should be tls-initial-exec due to common attribute. */
+/* { dg-final { scan-ipa-dump "Varpool flags: tls-initial-exec" "whole-program" } } */
diff --git a/gcc/testsuite/c-c++-common/tls-attr-le-pic.c b/gcc/testsuite/c-c++-common/tls-attr-le-pic.c
new file mode 100644
index 0000000..c02df69
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/tls-attr-le-pic.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target fpic } */
+/* { dg-require-effective-target tls } */
+/* { dg-options "-O2 -fpic -fdump-ipa-whole-program" } */
+
+__attribute__ ((tls_model ("local-exec"))) __thread int i;
+
+int *
+foo (void)
+{
+ return &i;
+}
+
+/* tls_model should be local-exec due to tls_model attribute. */
+/* { dg-final { scan-ipa-dump "Varpool flags: tls-local-exec" "whole-program" } } */
diff --git a/gcc/testsuite/c-c++-common/tls-attr-le-pie.c b/gcc/testsuite/c-c++-common/tls-attr-le-pie.c
new file mode 100644
index 0000000..b8ef784
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/tls-attr-le-pie.c
@@ -0,0 +1,15 @@
+/* { dg-do compile { target { tls && pie } } } */
+/* { dg-options "-O2 -fPIE -fdump-ipa-whole-program" } */
+
+extern const int afoo[3];
+
+__thread const int *pfoo __attribute__ ((tls_model ("initial-exec"))) = afoo;
+
+const int **
+ppfoo (void)
+{
+ return &pfoo;
+}
+
+/* tls_model should be local-exec due to -fPIE. */
+/* { dg-final { scan-ipa-dump "Varpool flags: initialized tls-local-exec" "whole-program" } } */
diff --git a/gcc/testsuite/c-c++-common/toplevel-asm-9.c b/gcc/testsuite/c-c++-common/toplevel-asm-9.c
new file mode 100644
index 0000000..a321878
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/toplevel-asm-9.c
@@ -0,0 +1,12 @@
+/* PR middle-end/122133 */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+extern int v[42], w;
+int x[42], y;
+void foo (void);
+void bar (void) {}
+
+asm ("# %cc[foo]: %cc[v]: %cc[w]: %cc[bar] %cc[x] %cc[y]"
+ :: [foo] ":" (foo), [v] ":" (v), [w] ":" (&w),
+ [bar] "-i" (bar), [x] "-s" (x), [y] "-s" (&y));
diff --git a/gcc/testsuite/c-c++-common/torture/asm-inline.c b/gcc/testsuite/c-c++-common/torture/asm-inline.c
index dea8965..03cb434 100644
--- a/gcc/testsuite/c-c++-common/torture/asm-inline.c
+++ b/gcc/testsuite/c-c++-common/torture/asm-inline.c
@@ -1,6 +1,7 @@
/* { dg-do compile } */
-/* -O0 does no inlining, and -O3 does it too aggressively for this test: */
-/* { dg-skip-if "" { *-*-* } { "-O0" "-O3" } { "" } }
+/* -O0 does no inlining, and -O3 does it too aggressively for this test:
+ -Og does not inline either. */
+/* { dg-skip-if "" { *-*-* } { "-O0" "-O3" "-Og" } { "" } }
/* The normal asm is not inlined: */
/* { dg-final { scan-assembler-times "w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w" 2 } } */
/* But the asm inline is inlined: */
diff --git a/gcc/testsuite/c-c++-common/tsan/pr119801.c b/gcc/testsuite/c-c++-common/tsan/pr119801.c
new file mode 100644
index 0000000..d3a6bb4
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/tsan/pr119801.c
@@ -0,0 +1,24 @@
+/* PR sanitizer/119801 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=thread" } */
+
+[[gnu::noipa]] int
+bar (int *p)
+{
+ return ++*p;
+}
+
+int
+foo (int *p)
+{
+ ++*p;
+ [[gnu::musttail]] return bar (p);
+}
+
+[[gnu::noinline]] int
+baz (int x)
+{
+ if (x < 10)
+ return x;
+ [[gnu::musttail]] return baz (x - 2);
+}
diff --git a/gcc/testsuite/c-c++-common/ubsan/align-5.c b/gcc/testsuite/c-c++-common/ubsan/align-5.c
index b94e167..6d2ac26 100644
--- a/gcc/testsuite/c-c++-common/ubsan/align-5.c
+++ b/gcc/testsuite/c-c++-common/ubsan/align-5.c
@@ -1,8 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-fno-sanitize=null -fsanitize=alignment -O2" } */
-/* Check that when optimizing if we know the alignment is right
- and we are not doing -fsanitize=null instrumentation we don't
- instrument the alignment check. */
+/* __builtin_assume_aligned should be instrumented too. UBSAN alignment
+ should not depend on it. */
__attribute__((noinline, noclone)) int
foo (char *p)
@@ -12,4 +11,6 @@ foo (char *p)
return *q;
}
-/* { dg-final { scan-assembler-not "__ubsan_handle" } } */
+/* xfail, see PR 122038 as __builtin_assume_aligned should be instrumented instead
+ of only the load. */
+/* { dg-final { scan-assembler "__ubsan_handle" { xfail *-*-* } } } */
diff --git a/gcc/testsuite/c-c++-common/ubsan/align-5a.c b/gcc/testsuite/c-c++-common/ubsan/align-5a.c
new file mode 100644
index 0000000..d86e537
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ubsan/align-5a.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-fno-sanitize=null -fsanitize=alignment -O2" } */
+/* Check that when optimizing if we know the alignment is right
+ and we are not doing -fsanitize=null instrumentation we don't
+ instrument the alignment check. */
+
+__attribute__((noinline, noclone)) int
+foo (int *p)
+{
+ /* Align the pointer explictly. */
+ __INTPTR_TYPE__ t = (__INTPTR_TYPE__)p;
+ t &= ~0xf;
+ p = (int*)t;
+
+ return *p;
+}
+
+/* { dg-final { scan-assembler-not "__ubsan_handle" } } */
diff --git a/gcc/testsuite/c-c++-common/ubsan/nonnull-8.c b/gcc/testsuite/c-c++-common/ubsan/nonnull-8.c
new file mode 100644
index 0000000..e2320df
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ubsan/nonnull-8.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=undefined -fno-sanitize-recover=undefined" } */
+
+__attribute__((noipa, nonnull_if_nonzero (1, 4, 7)))
+__attribute__((nonnull (3), nonnull_if_nonzero (5, 2, 6))) void
+foo (void *a, unsigned long b, void *c, int d, void *e, unsigned long f, int g)
+{
+ (void) a;
+ (void) b;
+ (void) c;
+ (void) d;
+ (void) e;
+ (void) f;
+ (void) g;
+}
+
+__attribute__((noipa))
+void
+bar (void *a, unsigned long b, void *c, int d, void *e, unsigned long f, int g)
+{
+ foo (a, b, c, d, e, f, g);
+}
+
+int
+main ()
+{
+ char x;
+ bar (&x, 42, &x, 1, &x, 2, 3);
+ bar (0, 0, &x, 0, 0, 0, 0);
+ bar (0, 5, &x, 4, 0, 0, 0);
+ bar (0, 0, &x, 0, 0, 6, 7);
+}
diff --git a/gcc/testsuite/c-c++-common/ubsan/nonnull-9.c b/gcc/testsuite/c-c++-common/ubsan/nonnull-9.c
new file mode 100644
index 0000000..68a4417
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ubsan/nonnull-9.c
@@ -0,0 +1,41 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=nonnull-attribute" } */
+
+__attribute__((noipa, nonnull_if_nonzero (1, 4, 7)))
+__attribute__((nonnull (3), nonnull_if_nonzero (5, 2, 6))) void
+foo (void *a, unsigned long b, void *c, int d, void *e, unsigned long f, int g)
+{
+ (void) a;
+ (void) b;
+ (void) c;
+ (void) d;
+ (void) e;
+ (void) f;
+ (void) g;
+}
+
+__attribute__((noipa))
+void
+bar (void *a, unsigned long b, void *c, int d, void *e, unsigned long f, int g)
+{
+ foo (a, b, c, d, e, f, g);
+}
+
+int
+main ()
+{
+ char x;
+ bar (&x, 42, 0, 1, &x, 17, 18);
+ bar (0, 25, &x, 7, &x, 0, 8);
+ bar (&x, -82, &x, 68, 0, 9, 0);
+ foo (&x, 42, 0, 1, &x, 17, 18);
+ foo (0, 25, &x, 7, &x, 0, 8);
+ foo (&x, -82, &x, 68, 0, 9, 0);
+}
+
+/* { dg-output "\.c:21:\[0-9]*:\[^\n\r]*null pointer passed as argument 3, which is declared to never be null\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*\.c:21:\[0-9]*:\[^\n\r]*null pointer passed as argument 1, which is declared to never be null\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*\.c:21:\[0-9]*:\[^\n\r]*null pointer passed as argument 5, which is declared to never be null\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*\.c:31:\[0-9]*:\[^\n\r]*null pointer passed as argument 3, which is declared to never be null\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*\.c:32:\[0-9]*:\[^\n\r]*null pointer passed as argument 1, which is declared to never be null\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*\.c:33:\[0-9]*:\[^\n\r]*null pointer passed as argument 5, which is declared to never be null" } */
diff --git a/gcc/testsuite/c-c++-common/ubsan/vla-1.c b/gcc/testsuite/c-c++-common/ubsan/vla-1.c
index b29d904..0073514 100644
--- a/gcc/testsuite/c-c++-common/ubsan/vla-1.c
+++ b/gcc/testsuite/c-c++-common/ubsan/vla-1.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-fsanitize=vla-bound -Wall -Wno-unused-variable -fno-stack-clash-protection" } */
+/* { dg-options "-fsanitize=vla-bound -Wall -Wno-unused-variable -fno-stack-clash-protection -ftrivial-auto-var-init=uninitialized" } */
typedef long int V;
int x = -1;
diff --git a/gcc/testsuite/c-c++-common/uninit-17.c b/gcc/testsuite/c-c++-common/uninit-17.c
index b549536..5dd49a9 100644
--- a/gcc/testsuite/c-c++-common/uninit-17.c
+++ b/gcc/testsuite/c-c++-common/uninit-17.c
@@ -10,10 +10,10 @@ static void bar(int a, int *ptr)
do
{
int b;
- if (b < 40) {
+ if (b < 40) { /* { dg-warning "is used uninitialized" "" { target c++26 } } */
ptr[0] = b;
}
- b += 1; /* { dg-warning "is used uninitialized" } */
+ b += 1; /* { dg-warning "is used uninitialized" "" { target { c || c++23_down } } } */
ptr++;
}
while (--a != 0);
diff --git a/gcc/testsuite/c-c++-common/vector-subscript-4.c b/gcc/testsuite/c-c++-common/vector-subscript-4.c
index 2c2481f..3138dc6 100644
--- a/gcc/testsuite/c-c++-common/vector-subscript-4.c
+++ b/gcc/testsuite/c-c++-common/vector-subscript-4.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-optimized -w -Wno-psabi" } */
+/* { dg-options "-O2 -fdump-tree-nrv -w -Wno-psabi" } */
#define foobar(n) \
typedef int v##n##si __attribute__ ((vector_size (4 * n))); \
@@ -25,5 +25,7 @@ foobar(16)
foobar(32)
foobar(64)
-/* Verify we don't have any vector temporaries in the IL. */
-/* { dg-final { scan-tree-dump-not "vector" "optimized" } } */
+/* Verify we don't have any vector temporaries in the IL at least until ISEL
+ which may introduce VEC_EXTRACTs on targets which support non-constant
+ indices (see PR116421). */
+/* { dg-final { scan-tree-dump-not "vector" "nrv" } } */