aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2022-09-22 06:29:20 -0700
committerIan Lance Taylor <iant@golang.org>2022-09-22 06:29:20 -0700
commit795cffe109e28b248a54b8ee583cbae48368c2a7 (patch)
tree0c12b075c51c0d5097f26953835ae540d9f2f501 /gcc/testsuite
parent9f62ed218fa656607740b386c0caa03e65dcd283 (diff)
parentf35be1268c996d993ab0b4ff329734d467474445 (diff)
downloadgcc-795cffe109e28b248a54b8ee583cbae48368c2a7.zip
gcc-795cffe109e28b248a54b8ee583cbae48368c2a7.tar.gz
gcc-795cffe109e28b248a54b8ee583cbae48368c2a7.tar.bz2
Merge from trunk revision f35be1268c996d993ab0b4ff329734d467474445.
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog2119
-rw-r--r--gcc/testsuite/c-c++-common/Waddress-7.c22
-rw-r--r--gcc/testsuite/c-c++-common/Wbidi-chars-24.c28
-rw-r--r--gcc/testsuite/c-c++-common/Wbidi-chars-25.c28
-rw-r--r--gcc/testsuite/c-c++-common/Winit-self1.c31
-rw-r--r--gcc/testsuite/c-c++-common/Winit-self2.c31
-rw-r--r--gcc/testsuite/c-c++-common/Wxor-used-as-pow-1.c57
-rw-r--r--gcc/testsuite/c-c++-common/Wxor-used-as-pow-fixits.c34
-rw-r--r--gcc/testsuite/c-c++-common/cpp/Winvalid-utf8-1.c43
-rw-r--r--gcc/testsuite/c-c++-common/cpp/Winvalid-utf8-2.c88
-rw-r--r--gcc/testsuite/c-c++-common/cpp/Winvalid-utf8-3.c27
-rw-r--r--gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-1.c92
-rw-r--r--gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-2.c18
-rw-r--r--gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-3.c33
-rw-r--r--gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-4.c13
-rw-r--r--gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-5.c13
-rw-r--r--gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-6.c13
-rw-r--r--gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-7.c13
-rw-r--r--gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-1.c174
-rw-r--r--gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-2.c18
-rw-r--r--gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-3.c22
-rw-r--r--gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-4.c60
-rw-r--r--gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-5.c17
-rw-r--r--gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-6.c17
-rw-r--r--gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-7.c17
-rw-r--r--gcc/testsuite/c-c++-common/goacc/classify-kernels-parloops.c6
-rw-r--r--gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized-parloops.c6
-rw-r--r--gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized.c6
-rw-r--r--gcc/testsuite/c-c++-common/goacc/classify-kernels.c6
-rw-r--r--gcc/testsuite/c-c++-common/goacc/classify-parallel.c4
-rw-r--r--gcc/testsuite/c-c++-common/goacc/classify-serial.c4
-rw-r--r--gcc/testsuite/c-c++-common/goacc/deep-copy-arrayofstruct.c83
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-counter-vars-function-scope.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-loop-2.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-loop-3.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-loop-data-2.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-loop-data-enter-exit-2.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-loop-data-enter-exit.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-loop-data-update.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-loop-data.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-loop-g.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-loop-mod-not-zero.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-loop-n.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-loop-nest.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-loop.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-one-counter-var.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc/kernels-parallel-loop-data-enter-exit.c2
-rw-r--r--gcc/testsuite/c-c++-common/goacc/mdc-2.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-32.c14
-rw-r--r--gcc/testsuite/c-c++-common/gomp/doacross-2.c18
-rw-r--r--gcc/testsuite/c-c++-common/gomp/doacross-5.c94
-rw-r--r--gcc/testsuite/c-c++-common/gomp/doacross-6.c106
-rw-r--r--gcc/testsuite/c-c++-common/gomp/doacross-7.c78
-rw-r--r--gcc/testsuite/c-c++-common/gomp/map-incomplete-type.c17
-rw-r--r--gcc/testsuite/c-c++-common/gomp/nesting-2.c11
-rw-r--r--gcc/testsuite/c-c++-common/gomp/ompx-1.c4
-rw-r--r--gcc/testsuite/c-c++-common/gomp/ompx-2.c5
-rw-r--r--gcc/testsuite/c-c++-common/gomp/ordered-3.c44
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr106836.c9
-rw-r--r--gcc/testsuite/c-c++-common/gomp/reverse-offload-1.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/sink-3.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/target-50.c23
-rw-r--r--gcc/testsuite/c-c++-common/gomp/target-device-ancestor-4.c2
-rw-r--r--gcc/testsuite/c-c++-common/pragma-diag-14.c9
-rw-r--r--gcc/testsuite/c-c++-common/pragma-diag-15.c13
-rw-r--r--gcc/testsuite/g++.dg/abi/anon1.C1
-rw-r--r--gcc/testsuite/g++.dg/abi/anon4.C2
-rw-r--r--gcc/testsuite/g++.dg/analyzer/out-of-bounds-placement-new.C19
-rw-r--r--gcc/testsuite/g++.dg/analyzer/pr100244.C5
-rw-r--r--gcc/testsuite/g++.dg/coroutines/pr106188.C34
-rw-r--r--gcc/testsuite/g++.dg/cpp/delimited-escape-seq-1.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp/delimited-escape-seq-2.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp/named-universal-char-escape-1.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp/named-universal-char-escape-2.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp/warning-1.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp/warning-2.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp/warning-3.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/Wpessimizing-move10.C30
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/Wpessimizing-move3.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/Wpessimizing-move7.C63
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/Wpessimizing-move8.C65
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/Wpessimizing-move9.C89
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/Wredundant-move1.C3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/Wredundant-move10.C61
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/Wredundant-move11.C32
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/Wredundant-move12.C36
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/Wredundant-move2.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/Wredundant-move9.C3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-debug-0.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-decltype5.C23
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-mutable3.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/gen-attrs-77.C17
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist-array17.C37
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist-const1.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/keywords2.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-array4.C29
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/auto-fn65.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/constexpr-complex1.C24
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/constexpr-mutable1.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction113.C5
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/constexpr-lambda27.C26
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/noexcept-type26.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-1.C43
-rw-r--r--gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-10.C25
-rw-r--r--gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-11.C25
-rw-r--r--gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-12.C25
-rw-r--r--gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-2.C43
-rw-r--r--gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-3.C43
-rw-r--r--gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-4.C43
-rw-r--r--gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-5.C80
-rw-r--r--gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-6.C80
-rw-r--r--gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-7.C80
-rw-r--r--gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-8.C80
-rw-r--r--gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-9.C25
-rw-r--r--gcc/testsuite/g++.dg/cpp23/auto-array2.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp23/feat-cxx2b.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp23/named-universal-char-escape1.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp23/named-universal-char-escape2.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp23/subscript8.C7
-rw-r--r--gcc/testsuite/g++.dg/cpp23/wchar-multi1.C42
-rw-r--r--gcc/testsuite/g++.dg/cpp23/wchar-multi2.C43
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/explicit19.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/keywords2.C13
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/lambda-uneval17.C17
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/volatile1.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/volatile3.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/volatile5.C8
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/utf-1.C9
-rw-r--r--gcc/testsuite/g++.dg/ext/array4.C3
-rw-r--r--gcc/testsuite/g++.dg/ext/char8_t-char-literal-1.C6
-rw-r--r--gcc/testsuite/g++.dg/ext/char8_t-char-literal-2.C4
-rw-r--r--gcc/testsuite/g++.dg/ext/has-builtin-1.C133
-rw-r--r--gcc/testsuite/g++.dg/ext/integer-pack6.C13
-rw-r--r--gcc/testsuite/g++.dg/ext/pr106877.C13
-rw-r--r--gcc/testsuite/g++.dg/ext/unary_trait_incomplete.C116
-rw-r--r--gcc/testsuite/g++.dg/gcov/gcov.exp4
-rw-r--r--gcc/testsuite/g++.dg/goacc/mdc.C2
-rw-r--r--gcc/testsuite/g++.dg/goacc/member-array-acc.C13
-rw-r--r--gcc/testsuite/g++.dg/gomp/map-3.C9
-rw-r--r--gcc/testsuite/g++.dg/gomp/member-array-omp.C13
-rw-r--r--gcc/testsuite/g++.dg/gomp/ompx-attrs-1.C7
-rw-r--r--gcc/testsuite/g++.dg/gomp/pr106492.C49
-rw-r--r--gcc/testsuite/g++.dg/gomp/pr106829.C15
-rw-r--r--gcc/testsuite/g++.dg/gomp/target-3.C4
-rw-r--r--gcc/testsuite/g++.dg/gomp/target-lambda-1.C6
-rw-r--r--gcc/testsuite/g++.dg/gomp/target-this-2.C2
-rw-r--r--gcc/testsuite/g++.dg/gomp/target-this-3.C4
-rw-r--r--gcc/testsuite/g++.dg/gomp/target-this-4.C4
-rw-r--r--gcc/testsuite/g++.dg/gomp/unmappable-1.C3
-rw-r--r--gcc/testsuite/g++.dg/init/elide8.C11
-rw-r--r--gcc/testsuite/g++.dg/init/static-cdtor1.C6
-rw-r--r--gcc/testsuite/g++.dg/modules/auto-3.h10
-rw-r--r--gcc/testsuite/g++.dg/modules/auto-3_a.H4
-rw-r--r--gcc/testsuite/g++.dg/modules/auto-3_b.C4
-rw-r--r--gcc/testsuite/g++.dg/modules/loc-prune-4.C4
-rw-r--r--gcc/testsuite/g++.dg/modules/partial-2_a.C43
-rw-r--r--gcc/testsuite/g++.dg/modules/partial-2_b.C21
-rw-r--r--gcc/testsuite/g++.dg/modules/pr106761.h22
-rw-r--r--gcc/testsuite/g++.dg/modules/pr106761_a.H5
-rw-r--r--gcc/testsuite/g++.dg/modules/pr106761_b.C7
-rw-r--r--gcc/testsuite/g++.dg/modules/typename-friend_a.C11
-rw-r--r--gcc/testsuite/g++.dg/modules/typename-friend_b.C6
-rw-r--r--gcc/testsuite/g++.dg/modules/xtreme-header-2.h3
-rw-r--r--gcc/testsuite/g++.dg/modules/xtreme-header-6.h10
-rw-r--r--gcc/testsuite/g++.dg/modules/xtreme-header.h59
-rw-r--r--gcc/testsuite/g++.dg/no-stack-protector-attr-3.C1
-rw-r--r--gcc/testsuite/g++.dg/opt/pr106860.C23
-rw-r--r--gcc/testsuite/g++.dg/other/PR23205.C17
-rw-r--r--gcc/testsuite/g++.dg/other/pr23205-2.C17
-rw-r--r--gcc/testsuite/g++.dg/parse/expr3.C2
-rw-r--r--gcc/testsuite/g++.dg/pr104992-1.C30
-rw-r--r--gcc/testsuite/g++.dg/pr106474.C16
-rw-r--r--gcc/testsuite/g++.dg/pr106687.C22
-rw-r--r--gcc/testsuite/g++.dg/pr106824.C76
-rw-r--r--gcc/testsuite/g++.dg/pr71694.C1
-rw-r--r--gcc/testsuite/g++.dg/stackprotectexplicit2.C1
-rw-r--r--gcc/testsuite/g++.dg/template/evaluated1.C17
-rw-r--r--gcc/testsuite/g++.dg/template/evaluated1a.C16
-rw-r--r--gcc/testsuite/g++.dg/template/evaluated1b.C17
-rw-r--r--gcc/testsuite/g++.dg/template/evaluated1c.C17
-rw-r--r--gcc/testsuite/g++.dg/torture/phi-1.C28
-rw-r--r--gcc/testsuite/g++.dg/torture/pr90994.C40
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/empty-loop.C2
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/pr101839.C53
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/pr106922.C90
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/pr106936.C14
-rw-r--r--gcc/testsuite/g++.dg/uninit-pr105937.C235
-rw-r--r--gcc/testsuite/g++.dg/uninit-pr106722-1.C65
-rw-r--r--gcc/testsuite/g++.dg/uninit-pred-5.C94
-rw-r--r--gcc/testsuite/g++.dg/vect/pr106794.cc40
-rw-r--r--gcc/testsuite/g++.dg/vect/pr106841.cc52
-rw-r--r--gcc/testsuite/g++.dg/warn/Wclass-memaccess.C2
-rw-r--r--gcc/testsuite/g++.dg/warn/Wconversion-real-integer2.C2
-rw-r--r--gcc/testsuite/g++.dg/warn/Wparentheses-10.C14
-rw-r--r--gcc/testsuite/g++.dg/warn/Wparentheses-18.C4
-rw-r--r--gcc/testsuite/g++.dg/warn/Wparentheses-19.C12
-rw-r--r--gcc/testsuite/g++.dg/warn/Wparentheses-9.C4
-rw-r--r--gcc/testsuite/g++.dg/warn/Wself-move1.C125
-rw-r--r--gcc/testsuite/g++.dg/warn/Wstringop-overflow-4.C2
-rw-r--r--gcc/testsuite/g++.dg/warn/Wsubobject-linkage-5.C7
-rw-r--r--gcc/testsuite/g++.dg/warn/Wuninitialized-33.C55
-rw-r--r--gcc/testsuite/g++.dg/warn/Wxor-used-as-pow-named-op.C8
-rw-r--r--gcc/testsuite/g++.dg/warn/anonymous-namespace-3.C3
-rw-r--r--gcc/testsuite/g++.target/aarch64/sve/pr96974.C4
-rw-r--r--gcc/testsuite/g++.target/i386/bfloat_cpp_typecheck.C10
-rw-r--r--gcc/testsuite/g++.target/i386/pr106627.C28
-rw-r--r--gcc/testsuite/g++.target/i386/vect-bfloat16-1.C13
-rw-r--r--gcc/testsuite/g++.target/loongarch/pr106828.C4
-rw-r--r--gcc/testsuite/g++.target/powerpc/pr101322.C17
-rw-r--r--gcc/testsuite/g++.target/powerpc/pr105485.C9
-rw-r--r--gcc/testsuite/g++.target/riscv/_Float16.C18
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr106101.c62
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr106878.c15
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr106958.c13
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr93776.c (renamed from gcc/testsuite/gcc.dg/tree-ssa/pr93776.c)4
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/hugeval.x3
-rw-r--r--gcc/testsuite/gcc.dg/20040813-1.c14
-rw-r--r--gcc/testsuite/gcc.dg/Wparentheses-6.c4
-rw-r--r--gcc/testsuite/gcc.dg/Wparentheses-7.c12
-rw-r--r--gcc/testsuite/gcc.dg/Wxor-used-as-pow-pr106830.c6
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/allocation-size-1.c10
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/allocation-size-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/data-model-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/error-uninit.c29
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/fd-1.c21
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/fd-2.c15
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/fd-4.c34
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/fd-dup-1.c259
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/fd-uninit-1.c19
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/file-uninit-1.c52
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/flexible-array-member-1.c100
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/fold-string-to-char.c8
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/function-ptr-5.c42
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/imprecise-floating-point-1.c74
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/memcpy-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-1.c120
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-2.c83
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-3.c91
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-4.c65
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-5.c156
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-container_of.c51
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-coreutils.c29
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-curl.c41
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-read-char-arr.c55
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-read-int-arr.c54
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-realloc-grow.c87
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-write-char-arr.c55
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-write-int-arr.c54
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-zero.c67
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr101962.c6
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr106181.c11
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr106539.c15
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr106845.c11
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr96764.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr97029.c4
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/putenv-1.c109
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/realloc-5.c45
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/strcpy-3.c23
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/symbolic-gt-1.c76
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/test-setjmp.h4
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/torture/pr93451.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/zlib-3.c4
-rw-r--r--gcc/testsuite/gcc.dg/atomic/c2x-stdatomic-lockfree-char8_t.c42
-rw-r--r--gcc/testsuite/gcc.dg/atomic/c2x-stdatomic-var-init-1.c9
-rw-r--r--gcc/testsuite/gcc.dg/atomic/gnu2x-stdatomic-lockfree-char8_t.c5
-rw-r--r--gcc/testsuite/gcc.dg/autopar/pr106737.c18
-rw-r--r--gcc/testsuite/gcc.dg/c11-empty-init-1.c25
-rw-r--r--gcc/testsuite/gcc.dg/c11-empty-init-2.c25
-rw-r--r--gcc/testsuite/gcc.dg/c11-empty-init-3.c25
-rw-r--r--gcc/testsuite/gcc.dg/c11-keywords-1.c11
-rw-r--r--gcc/testsuite/gcc.dg/c11-nullptr-1.c10
-rw-r--r--gcc/testsuite/gcc.dg/c11-unproto-3.c19
-rw-r--r--gcc/testsuite/gcc.dg/c11-unreachable-1.c9
-rw-r--r--gcc/testsuite/gcc.dg/c11-utf8str-type.c6
-rw-r--r--gcc/testsuite/gcc.dg/c17-nullptr-1.c10
-rw-r--r--gcc/testsuite/gcc.dg/c17-nullptr-2.c10
-rw-r--r--gcc/testsuite/gcc.dg/c17-utf8str-type.c6
-rw-r--r--gcc/testsuite/gcc.dg/c2x-align-1.c41
-rw-r--r--gcc/testsuite/gcc.dg/c2x-align-6.c8
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-deprecated-2.c9
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-fallthrough-2.c4
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-1.c13
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-nodiscard-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/c2x-bool-1.c14
-rw-r--r--gcc/testsuite/gcc.dg/c2x-bool-2.c42
-rw-r--r--gcc/testsuite/gcc.dg/c2x-empty-init-1.c80
-rw-r--r--gcc/testsuite/gcc.dg/c2x-empty-init-2.c18
-rw-r--r--gcc/testsuite/gcc.dg/c2x-empty-init-3.c25
-rw-r--r--gcc/testsuite/gcc.dg/c2x-float-11.c9
-rw-r--r--gcc/testsuite/gcc.dg/c2x-float-2.c4
-rw-r--r--gcc/testsuite/gcc.dg/c2x-has-c-attribute-2.c8
-rw-r--r--gcc/testsuite/gcc.dg/c2x-nullptr-1.c298
-rw-r--r--gcc/testsuite/gcc.dg/c2x-nullptr-2.c9
-rw-r--r--gcc/testsuite/gcc.dg/c2x-nullptr-3.c80
-rw-r--r--gcc/testsuite/gcc.dg/c2x-nullptr-4.c11
-rw-r--r--gcc/testsuite/gcc.dg/c2x-nullptr-5.c14
-rw-r--r--gcc/testsuite/gcc.dg/c2x-old-style-definition-6.c12
-rw-r--r--gcc/testsuite/gcc.dg/c2x-static-assert-3.c6
-rw-r--r--gcc/testsuite/gcc.dg/c2x-static-assert-4.c6
-rw-r--r--gcc/testsuite/gcc.dg/c2x-thread-local-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/c2x-unproto-1.c12
-rw-r--r--gcc/testsuite/gcc.dg/c2x-unproto-2.c12
-rw-r--r--gcc/testsuite/gcc.dg/c2x-unproto-3.c20
-rw-r--r--gcc/testsuite/gcc.dg/c2x-unproto-4.c15
-rw-r--r--gcc/testsuite/gcc.dg/c2x-unreachable-1.c29
-rw-r--r--gcc/testsuite/gcc.dg/c2x-utf8str-type.c6
-rw-r--r--gcc/testsuite/gcc.dg/c2x-utf8str.c34
-rw-r--r--gcc/testsuite/gcc.dg/cpp/c11-trigraphs-1.c5
-rw-r--r--gcc/testsuite/gcc.dg/cpp/c11-warning-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/c11-warning-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/c11-warning-3.c6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/c11-warning-4.c6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/c2x-trigraphs-1.c10
-rw-r--r--gcc/testsuite/gcc.dg/cpp/c2x-trigraphs-2.c5
-rw-r--r--gcc/testsuite/gcc.dg/cpp/c2x-warning-1.c5
-rw-r--r--gcc/testsuite/gcc.dg/cpp/c2x-warning-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/delimited-escape-seq-1.c10
-rw-r--r--gcc/testsuite/gcc.dg/cpp/delimited-escape-seq-2.c10
-rw-r--r--gcc/testsuite/gcc.dg/cpp/gnu11-warning-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/gnu11-warning-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/gnu11-warning-3.c6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/gnu11-warning-4.c6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/gnu2x-warning-1.c5
-rw-r--r--gcc/testsuite/gcc.dg/cpp/gnu2x-warning-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/named-universal-char-escape-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/cpp/named-universal-char-escape-2.c8
-rw-r--r--gcc/testsuite/gcc.dg/darwin-20040809-2.c15
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-function-4.c14
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-function-5.c14
-rw-r--r--gcc/testsuite/gcc.dg/debug/btf/btf-int-1.c18
-rw-r--r--gcc/testsuite/gcc.dg/debug/pr35154.c35
-rw-r--r--gcc/testsuite/gcc.dg/fold-eqandshift-4.c46
-rw-r--r--gcc/testsuite/gcc.dg/gnu2x-empty-init-1.c29
-rw-r--r--gcc/testsuite/gcc.dg/gnu2x-empty-init-2.c16
-rw-r--r--gcc/testsuite/gcc.dg/gnu2x-utf8str-type.c5
-rw-r--r--gcc/testsuite/gcc.dg/gnu2x-utf8str.c34
-rw-r--r--gcc/testsuite/gcc.dg/init-bad-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/pr71583.c2
-rw-r--r--gcc/testsuite/gcc.dg/plugin/analyzer_kernel_plugin.c237
-rw-r--r--gcc/testsuite/gcc.dg/plugin/analyzer_known_fns_plugin.c201
-rw-r--r--gcc/testsuite/gcc.dg/plugin/copy_from_user-1.c45
-rw-r--r--gcc/testsuite/gcc.dg/plugin/infoleak-1.c185
-rw-r--r--gcc/testsuite/gcc.dg/plugin/infoleak-2.c33
-rw-r--r--gcc/testsuite/gcc.dg/plugin/infoleak-3.c145
-rw-r--r--gcc/testsuite/gcc.dg/plugin/infoleak-CVE-2011-1078-1.c138
-rw-r--r--gcc/testsuite/gcc.dg/plugin/infoleak-CVE-2011-1078-2.c46
-rw-r--r--gcc/testsuite/gcc.dg/plugin/infoleak-CVE-2014-1446-1.c117
-rw-r--r--gcc/testsuite/gcc.dg/plugin/infoleak-CVE-2017-18549-1.c105
-rw-r--r--gcc/testsuite/gcc.dg/plugin/infoleak-CVE-2017-18550-1.c175
-rw-r--r--gcc/testsuite/gcc.dg/plugin/infoleak-antipatterns-1.c166
-rw-r--r--gcc/testsuite/gcc.dg/plugin/infoleak-fixit-1.c26
-rw-r--r--gcc/testsuite/gcc.dg/plugin/infoleak-net-ethtool-ioctl.c82
-rw-r--r--gcc/testsuite/gcc.dg/plugin/infoleak-vfio_iommu_type1.c44
-rw-r--r--gcc/testsuite/gcc.dg/plugin/known-fns-1.c61
-rw-r--r--gcc/testsuite/gcc.dg/plugin/plugin.exp26
-rw-r--r--gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-1-fixed.c115
-rw-r--r--gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-1.c115
-rw-r--r--gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-2-fixed.c98
-rw-r--r--gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-2.c95
-rw-r--r--gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-3-fixed.c61
-rw-r--r--gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-3.c59
-rw-r--r--gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-4.c45
-rw-r--r--gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-5-fixed.c46
-rw-r--r--gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-5.c45
-rw-r--r--gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-6.c42
-rw-r--r--gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521.h136
-rw-r--r--gcc/testsuite/gcc.dg/plugin/taint-antipatterns-1.c139
-rw-r--r--gcc/testsuite/gcc.dg/plugin/test-uaccess.h10
-rw-r--r--gcc/testsuite/gcc.dg/pr102892-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/pr104992.c57
-rw-r--r--gcc/testsuite/gcc.dg/pr106099.c10
-rw-r--r--gcc/testsuite/gcc.dg/pr106243-1.c18
-rw-r--r--gcc/testsuite/gcc.dg/pr106243.c43
-rw-r--r--gcc/testsuite/gcc.dg/pr106510.c10
-rw-r--r--gcc/testsuite/gcc.dg/pr106519.c11
-rw-r--r--gcc/testsuite/gcc.dg/pr106617.c36
-rw-r--r--gcc/testsuite/gcc.dg/pr106621.c30
-rw-r--r--gcc/testsuite/gcc.dg/pr106844.c16
-rw-r--r--gcc/testsuite/gcc.dg/pr106938.c36
-rw-r--r--gcc/testsuite/gcc.dg/pr61096-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr64992.c7
-rw-r--r--gcc/testsuite/gcc.dg/pr69471-2.c8
-rw-r--r--gcc/testsuite/gcc.dg/pr71343-1.c56
-rw-r--r--gcc/testsuite/gcc.dg/pr87052.c6
-rw-r--r--gcc/testsuite/gcc.dg/precedence-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/sibcall-11.c1
-rw-r--r--gcc/testsuite/gcc.dg/subnot.c9
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-issignaling-1.c130
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-issignaling-2.c73
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-self.c1
-rw-r--r--gcc/testsuite/gcc.dg/torture/dfp-default-init-1.c115
-rw-r--r--gcc/testsuite/gcc.dg/torture/dfp-default-init-2.c8
-rw-r--r--gcc/testsuite/gcc.dg/torture/dfp-default-init-3.c8
-rw-r--r--gcc/testsuite/gcc.dg/torture/float128-builtin-issignaling-1.c13
-rw-r--r--gcc/testsuite/gcc.dg/torture/float128x-builtin-issignaling-1.c13
-rw-r--r--gcc/testsuite/gcc.dg/torture/float16-builtin-issignaling-1.c13
-rw-r--r--gcc/testsuite/gcc.dg/torture/float32-builtin-issignaling-1.c13
-rw-r--r--gcc/testsuite/gcc.dg/torture/float32x-builtin-issignaling-1.c13
-rw-r--r--gcc/testsuite/gcc.dg/torture/float64-builtin-issignaling-1.c13
-rw-r--r--gcc/testsuite/gcc.dg/torture/float64x-builtin-issignaling-1.c13
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr106422.c14
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr106497.c20
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr106513.c26
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr106521.c17
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr106590.c75
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr106630.c13
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr106809.c28
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr106892.c30
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr47917.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/gen-vect-34.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ldist-39.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-10.c32
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-11.c34
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-12.c32
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-13.c32
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-14.c33
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-15.c34
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-16.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-3.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-4.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-5.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-6.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-7.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-8.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/minmax-9.c32
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr106819.c24
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr106867.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr106967.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr106970.c9
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/recip-3.c5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/split-path-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-100.c25
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-16.c24
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-17.c7
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-18.c20
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-19.c33
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-20.c15
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-1.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-11.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-3.c18
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-4.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-6.c20
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-7.c14
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-8.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-inf-1.c15
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-nan-1.c18
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-signbit-1.c12
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp-float-signbit-2.c24
-rw-r--r--gcc/testsuite/gcc.dg/tsan/pr106984.c7
-rw-r--r--gcc/testsuite/gcc.dg/ubsan/c-shift-1.c12
-rw-r--r--gcc/testsuite/gcc.dg/ubsan/pr106099.c10
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr106155-1.c40
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr106866.c38
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr106881.c16
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr63660.c58
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr65244-1.c20
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr65244-2.c20
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pred-10.c36
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pred-11.c27
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pred-12.c34
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pred-7_a.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-layout-1.c13
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-layout-10.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-layout-11.c34
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-layout-12.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-layout-13.c13
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-layout-14.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-layout-15.c13
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-layout-16.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-layout-17.c27
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-layout-18.c15
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-layout-19.c34
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-layout-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-layout-20.c33
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-layout-21.c23
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-layout-3.c13
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-layout-4.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-layout-5.c13
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-layout-6.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-layout-7.c17
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-layout-8.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-layout-9.c36
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr54400.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr106914.c15
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-11b.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s243.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-gather-5.c42
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-ifcvt-18.c38
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-simd-clone-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-simd-clone-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-simd-clone-3.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-simd-clone-4.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-simd-clone-5.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-simd-clone-8.c2
-rw-r--r--gcc/testsuite/gcc.dg/vla-init-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/vla-init-3.c1
-rw-r--r--gcc/testsuite/gcc.misc-tests/gcov.exp4
-rw-r--r--gcc/testsuite/gcc.target/aarch64/acle/ls64_asm_2.c9
-rw-r--r--gcc/testsuite/gcc.target/aarch64/ldp_stp_20.c7
-rw-r--r--gcc/testsuite/gcc.target/aarch64/ldp_stp_21.c7
-rw-r--r--gcc/testsuite/gcc.target/aarch64/ldp_stp_22.c13
-rw-r--r--gcc/testsuite/gcc.target/aarch64/ldp_stp_23.c16
-rw-r--r--gcc/testsuite/gcc.target/aarch64/ldp_stp_24.c16
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movdf_1.c53
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movdi_2.c61
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movhf_1.c53
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movhi_1.c61
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movqi_1.c61
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movsf_1.c53
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movsi_1.c61
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movtf_2.c81
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movti_2.c86
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movv16qi_1.c103
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movv16qi_2.c27
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movv16qi_3.c30
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movv2di_1.c103
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movv2x16qi_1.c40
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movv2x8qi_1.c38
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movv3x16qi_1.c44
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movv3x8qi_1.c41
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movv4x16qi_1.c44
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movv4x8qi_1.c42
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movv8qi_1.c70
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movv8qi_2.c27
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movv8qi_3.c30
-rw-r--r--gcc/testsuite/gcc.target/aarch64/nofp_2.c19
-rw-r--r--gcc/testsuite/gcc.target/aarch64/spellcheck_10.c13
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_1.c4
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_2.c4
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-1.c4
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c4
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr106524.c11
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/slp_15.c17
-rw-r--r--gcc/testsuite/gcc.target/aarch64/vect_unary_2.c5
-rw-r--r--gcc/testsuite/gcc.target/bpf/constant-calls-1.c (renamed from gcc/testsuite/gcc.target/bpf/constant-calls.c)1
-rw-r--r--gcc/testsuite/gcc.target/bpf/constant-calls-2.c16
-rw-r--r--gcc/testsuite/gcc.target/bpf/core-pr106745.c30
-rw-r--r--gcc/testsuite/gcc.target/i386/addr-space-typeck-1.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/addr-space-typeck-2.c25
-rw-r--r--gcc/testsuite/gcc.target/i386/avx2-dest-false-dep-for-glc.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bf16-cvtsbh2ss-1.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-1.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-3.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-5.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-7.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vcvtps2ph-sae.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-broadcast-1.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-pr101846.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2si-1a.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2usi-1a.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vcvttsh2si-1a.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vcvttsh2usi-1a.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512fp16-vmovsh-1a.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-1.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-3.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-5.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-pr106721.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/bfloat16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/builtin-issignaling-1.c80
-rw-r--r--gcc/testsuite/gcc.target/i386/cet-sjlj-6a.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/cet-sjlj-6b.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/cmpti1.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/cmpti2.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/cmpti3.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/interrupt-11.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/interrupt-12.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/interrupt-13.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/interrupt-15.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/interrupt-16.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/interrupt-17.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/interrupt-8.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pad-10.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100704-3.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-2.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-3.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-4a.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-4b.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-5a.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-5b.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-6a.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-6b.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-6c.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr100865-7b.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101796-1.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101846-2.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr101989-broadcast-1.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr102021.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr103144-mul-1.c51
-rw-r--r--gcc/testsuite/gcc.target/i386/pr103144-mul-2.c51
-rw-r--r--gcc/testsuite/gcc.target/i386/pr103144-neg-1.c51
-rw-r--r--gcc/testsuite/gcc.target/i386/pr103144-neg-2.c44
-rw-r--r--gcc/testsuite/gcc.target/i386/pr103144-shift-1.c70
-rw-r--r--gcc/testsuite/gcc.target/i386/pr103144-shift-2.c79
-rw-r--r--gcc/testsuite/gcc.target/i386/pr105735-1.c88
-rw-r--r--gcc/testsuite/gcc.target/i386/pr105735-2.c28
-rw-r--r--gcc/testsuite/gcc.target/i386/pr106322.c51
-rw-r--r--gcc/testsuite/gcc.target/i386/pr106450.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr106453.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr106481.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pr106704.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pr106707.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/pr106742.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/pr106748.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/pr106905.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr106910-1.c77
-rw-r--r--gcc/testsuite/gcc.target/i386/pr106963.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr106994.c24
-rw-r--r--gcc/testsuite/gcc.target/i386/pr15184-1.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr15184-2.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr27971.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr47949.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr54855-3.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr54855-7.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr70263-2.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/pr70321.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/pr78035.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr81563.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr81736-5.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr81736-7.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr83782-1.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/pr83782-2.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/pr83782-3.c32
-rw-r--r--gcc/testsuite/gcc.target/i386/pr84278.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/pr85620-6.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr85667-6.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-17.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-2.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr90773-3.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr93492-5.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr94913-2.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr95126-m32-1.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/pr95126-m32-2.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/pr95852-2.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/pr95852-4.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/pr96539.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/sse2-bfloat16-1.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/sse2-bfloat16-2.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/sse2-bfloat16-scalar-typecheck.c215
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-stv-7.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-stv-8.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-stv-9.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/stack-check-12.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/stack-check-17.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/stack-prot-sym.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-bfloat16-1.c30
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-bfloat16-2a.c121
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-bfloat16-2b.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-bfloat16-2c.c76
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-bfloat16-typecheck_1.c258
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-bfloat16-typecheck_2.c248
-rw-r--r--gcc/testsuite/gcc.target/ia64/pr106905.c20
-rw-r--r--gcc/testsuite/gcc.target/loongarch/attr-model-1.c6
-rw-r--r--gcc/testsuite/gcc.target/loongarch/attr-model-2.c6
-rw-r--r--gcc/testsuite/gcc.target/loongarch/attr-model-diag.c7
-rw-r--r--gcc/testsuite/gcc.target/loongarch/attr-model-test.c25
-rw-r--r--gcc/testsuite/gcc.target/loongarch/direct-extern-1.c6
-rw-r--r--gcc/testsuite/gcc.target/loongarch/direct-extern-2.c6
-rw-r--r--gcc/testsuite/gcc.target/loongarch/fmax-fmin.c30
-rw-r--r--gcc/testsuite/gcc.target/loongarch/func-call-1.c2
-rw-r--r--gcc/testsuite/gcc.target/loongarch/func-call-2.c2
-rw-r--r--gcc/testsuite/gcc.target/loongarch/func-call-3.c2
-rw-r--r--gcc/testsuite/gcc.target/loongarch/func-call-4.c2
-rw-r--r--gcc/testsuite/gcc.target/loongarch/func-call-5.c2
-rw-r--r--gcc/testsuite/gcc.target/loongarch/func-call-6.c2
-rw-r--r--gcc/testsuite/gcc.target/loongarch/func-call-7.c2
-rw-r--r--gcc/testsuite/gcc.target/loongarch/func-call-8.c2
-rw-r--r--gcc/testsuite/gcc.target/loongarch/func-call-extreme-1.c32
-rw-r--r--gcc/testsuite/gcc.target/loongarch/func-call-extreme-2.c32
-rw-r--r--gcc/testsuite/gcc.target/loongarch/func-call-medium-1.c41
-rw-r--r--gcc/testsuite/gcc.target/loongarch/func-call-medium-2.c41
-rw-r--r--gcc/testsuite/gcc.target/loongarch/func-call-medium-3.c41
-rw-r--r--gcc/testsuite/gcc.target/loongarch/func-call-medium-4.c41
-rw-r--r--gcc/testsuite/gcc.target/loongarch/func-call-medium-5.c42
-rw-r--r--gcc/testsuite/gcc.target/loongarch/func-call-medium-6.c42
-rw-r--r--gcc/testsuite/gcc.target/loongarch/func-call-medium-7.c43
-rw-r--r--gcc/testsuite/gcc.target/loongarch/func-call-medium-8.c43
-rw-r--r--gcc/testsuite/gcc.target/loongarch/pr106459.c13
-rw-r--r--gcc/testsuite/gcc.target/loongarch/relocs-symbol-noaddend.c2
-rw-r--r--gcc/testsuite/gcc.target/loongarch/tls-gd-noplt.c12
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-extract-1.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr103109-1.c10
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr103109-2.c96
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr103109.h12
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr103353.c22
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr104482.c16
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr105586.c19
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr106017.c19
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr106322.c50
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr106550.c14
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr106550_1.c22
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr106833.c14
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr86731-fwrapv-longlong.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/stabs-attrib-vect-darwin.c12
-rw-r--r--gcc/testsuite/gcc.target/pru/bitop-di.c25
-rw-r--r--gcc/testsuite/gcc.target/pru/mov-m1.c18
-rw-r--r--gcc/testsuite/gcc.target/pru/pr106564-1.c9
-rw-r--r--gcc/testsuite/gcc.target/pru/pr106564-2.c9
-rw-r--r--gcc/testsuite/gcc.target/pru/pr106564-3.c9
-rw-r--r--gcc/testsuite/gcc.target/pru/pr106564-4.c9
-rw-r--r--gcc/testsuite/gcc.target/riscv/_Float16-soft-1.c9
-rw-r--r--gcc/testsuite/gcc.target/riscv/_Float16-soft-2.c13
-rw-r--r--gcc/testsuite/gcc.target/riscv/_Float16-soft-3.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/_Float16-soft-4.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/_Float16-zfh-1.c8
-rw-r--r--gcc/testsuite/gcc.target/riscv/_Float16-zfh-2.c8
-rw-r--r--gcc/testsuite/gcc.target/riscv/_Float16-zfh-3.c8
-rw-r--r--gcc/testsuite/gcc.target/riscv/_Float16-zfhmin-1.c9
-rw-r--r--gcc/testsuite/gcc.target/riscv/_Float16-zfhmin-2.c9
-rw-r--r--gcc/testsuite/gcc.target/riscv/_Float16-zfhmin-3.c9
-rw-r--r--gcc/testsuite/gcc.target/riscv/_Float16.c19
-rw-r--r--gcc/testsuite/gcc.target/riscv/arch-16.c5
-rw-r--r--gcc/testsuite/gcc.target/riscv/arch-17.c5
-rw-r--r--gcc/testsuite/gcc.target/riscv/fle-ieee.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/fle-snan.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/fle.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/flef-ieee.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/flef-snan.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/flef.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/flt-ieee.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/flt-snan.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/flt.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/fltf-ieee.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/fltf-snan.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/fltf.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/fmax-snan.c1
-rw-r--r--gcc/testsuite/gcc.target/riscv/fmaxf-snan.c1
-rw-r--r--gcc/testsuite/gcc.target/riscv/fmin-snan.c1
-rw-r--r--gcc/testsuite/gcc.target/riscv/fminf-snan.c1
-rw-r--r--gcc/testsuite/gcc.target/riscv/predef-21.c59
-rw-r--r--gcc/testsuite/gcc.target/riscv/predef-22.c59
-rw-r--r--gcc/testsuite/gcc.target/riscv/zbb_32_bswap-1.c11
-rw-r--r--gcc/testsuite/gcc.target/riscv/zbb_32_bswap-2.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/zbb_bswap-1.c11
-rw-r--r--gcc/testsuite/gcc.target/riscv/zbb_bswap-2.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/zmmul-1.c20
-rw-r--r--gcc/testsuite/gcc.target/riscv/zmmul-2.c20
-rw-r--r--gcc/testsuite/gcc.target/s390/20041216-1.c23
-rw-r--r--gcc/testsuite/gcc.target/s390/ifcvt-one-insn-bool.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/ifcvt-one-insn-char.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/ifcvt-two-insns-bool.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/ifcvt-two-insns-int.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/ifcvt-two-insns-long.c13
-rw-r--r--gcc/testsuite/gcc.target/s390/s390.exp2
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/vec-copysign.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/vec-sum-across-no-lower-subreg-1.c18
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/vperm-rev-z14.c87
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/vperm-rev-z15.c118
-rw-r--r--gcc/testsuite/gcc.target/s390/zvector/autovec-double-quiet-uneq.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/zvector/autovec-double-signaling-ltgt.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/zvector/autovec-float-quiet-uneq.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/zvector/autovec-float-signaling-ltgt.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/zvector/vec-cmp-2.c2
-rw-r--r--gcc/testsuite/gcc.target/s390/zvector/vec-reve-int-long.c31
-rw-r--r--gcc/testsuite/gcc.target/s390/zvector/vec-reve-store-byte.c6
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/abi-bf16.exp46
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/args.h164
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/asm-support.S84
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/bf16-check.h24
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/bf16-helper.h45
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/defines.h163
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/abi-bf16-ymm.exp46
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/args.h152
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/asm-support.S84
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/bf16-ymm-check.h24
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/test_m256_returning.c38
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/test_passing_m256.c235
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/test_passing_structs.c69
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/test_passing_unions.c179
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/test_varargs-m256.c107
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/abi-bf16-zmm.exp46
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/args.h155
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/asm-support.S100
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/bf16-zmm-check.h24
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/test_m512_returning.c44
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/test_passing_m512.c243
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/test_passing_structs.c77
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/test_passing_unions.c222
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/test_varargs-m512.c111
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/macros.h53
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/test_3_element_struct_and_unions.c214
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_alignment.c14
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_array_size_and_align.c13
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_returning.c20
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_sizes.c14
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_struct_size_and_align.c14
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_union_size_and_align.c12
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/test_m128_returning.c38
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/test_passing_floats.c312
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/test_passing_m128.c238
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/test_passing_structs.c67
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/test_passing_unions.c160
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/test_struct_returning.c176
-rw-r--r--gcc/testsuite/gcc.target/x86_64/abi/bf16/test_varargs-m128.c111
-rw-r--r--gcc/testsuite/gcc.target/xtensa/constsynth_3insns.c11
-rw-r--r--gcc/testsuite/gcc.target/xtensa/sibcalls.c5
-rw-r--r--gcc/testsuite/gdc.dg/imports/pr106555.d10
-rw-r--r--gcc/testsuite/gdc.dg/pr106555.d4
-rw-r--r--gcc/testsuite/gdc.dg/torture/imports/pr106563math.d12
-rw-r--r--gcc/testsuite/gdc.dg/torture/imports/pr106563regex.d7
-rw-r--r--gcc/testsuite/gdc.dg/torture/imports/pr106563uni.d15
-rw-r--r--gcc/testsuite/gdc.dg/torture/pr106563.d16
-rw-r--r--gcc/testsuite/gdc.dg/torture/pr106623.d28
-rw-r--r--gcc/testsuite/gdc.dg/torture/simd_store.d2
-rw-r--r--gcc/testsuite/gdc.dg/torture/torture.exp9
-rw-r--r--gcc/testsuite/gdc.test/compilable/aliasassign.d105
-rw-r--r--gcc/testsuite/gdc.test/compilable/backendfloatoptim.d10
-rw-r--r--gcc/testsuite/gdc.test/compilable/cppmangle3.d4
-rw-r--r--gcc/testsuite/gdc.test/compilable/must_use_initialize.d16
-rw-r--r--gcc/testsuite/gdc.test/compilable/noreturn1.d28
-rw-r--r--gcc/testsuite/gdc.test/compilable/scope_infer_array_assign.d28
-rw-r--r--gcc/testsuite/gdc.test/compilable/test20832.d12
-rw-r--r--gcc/testsuite/gdc.test/compilable/test21177.d65
-rw-r--r--gcc/testsuite/gdc.test/compilable/test21197.d25
-rw-r--r--gcc/testsuite/gdc.test/compilable/test21432.d25
-rw-r--r--gcc/testsuite/gdc.test/compilable/test22390.d8
-rw-r--r--gcc/testsuite/gdc.test/compilable/test23082.d17
-rw-r--r--gcc/testsuite/gdc.test/compilable/test23166.d22
-rw-r--r--gcc/testsuite/gdc.test/compilable/test23172.d33
-rw-r--r--gcc/testsuite/gdc.test/compilable/test23235.d20
-rw-r--r--gcc/testsuite/gdc.test/compilable/test23256.d6
-rw-r--r--gcc/testsuite/gdc.test/compilable/test23262.d17
-rw-r--r--gcc/testsuite/gdc.test/compilable/testgotoskips.d17
-rw-r--r--gcc/testsuite/gdc.test/compilable/uda.d6
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/aliasassign2.d33
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/attributediagnostic.d39
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/chkformat.d18
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/diag10319.d20
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/diag11198.d14
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/diag12829.d10
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/diag23295.d40
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail10968.d29
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail118.d20
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail14669.d4
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail20547.d15
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail22134.d17
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail23181.d16
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail261.d5
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail58.d8
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail6889.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail7848.d8
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/ice11856_1.d7
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/ice8795.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/imports/import15525.d3
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/issue12652.d24
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/misc_parser_err_cov1.d3
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/newaa.d19
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/nogc3.d8
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/retscope.d4
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/retscope6.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/shared.d11
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test13786.d12
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test15525.d17
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test16193.d4
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test17423.d3
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test17764.d21
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test20245.d19
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test20809.d44
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test21443.d21
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test21912.d16
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test21939.d5
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test23022.d15
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test23073.d35
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test23112.d30
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test23170.d12
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test23216.d24
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/testsemi.d46
-rw-r--r--gcc/testsuite/gdc.test/runnable/closure.d8
-rw-r--r--gcc/testsuite/gdc.test/runnable/evalorder.d26
-rw-r--r--gcc/testsuite/gdc.test/runnable/lexer.d8
-rw-r--r--gcc/testsuite/gdc.test/runnable/noreturn1.d32
-rw-r--r--gcc/testsuite/gdc.test/runnable/test11.d37
-rw-r--r--gcc/testsuite/gdc.test/runnable/test18973.d25
-rw-r--r--gcc/testsuite/gdc.test/runnable/test19.d15
-rw-r--r--gcc/testsuite/gdc.test/runnable/test20365.d21
-rw-r--r--gcc/testsuite/gdc.test/runnable/test20734.d7
-rw-r--r--gcc/testsuite/gdc.test/runnable/test20809.d14
-rw-r--r--gcc/testsuite/gdc.test/runnable/test23181.d27
-rw-r--r--gcc/testsuite/gdc.test/runnable/test8.d39
-rw-r--r--gcc/testsuite/gdc.test/runnable/version.d23
-rw-r--r--gcc/testsuite/gdc.test/runnable/warning1.d9
-rw-r--r--gcc/testsuite/gfortran.dg/PR100132.f9075
-rw-r--r--gcc/testsuite/gfortran.dg/PR100136.f9039
-rw-r--r--gcc/testsuite/gfortran.dg/PR100245.f9028
-rw-r--r--gcc/testsuite/gfortran.dg/actual_array_offset_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/assumed_type_16.f9014
-rw-r--r--gcc/testsuite/gfortran.dg/assumed_type_17.f9018
-rw-r--r--gcc/testsuite/gfortran.dg/c-interop/c407b-2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/debug/pr35154-stabs.f35
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/classify-kernels-parloops.f956
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/classify-kernels-unparallelized-parloops.f956
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/classify-kernels-unparallelized.f956
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/classify-kernels.f956
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/classify-parallel.f954
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/classify-serial.f954
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/kernels-loop-2.f952
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/kernels-loop-data-2.f952
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/kernels-loop-data-enter-exit-2.f952
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/kernels-loop-data-enter-exit.f952
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/kernels-loop-data-update.f952
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/kernels-loop-data.f952
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/kernels-loop-n.f952
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/kernels-loop.f952
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/kernels-parallel-loop-data-enter-exit.f952
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/all-memory-1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/declare-simd-3.f9030
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/declare-simd-4.f9042
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/declare-simd-5.f9049
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/declare-simd-6.f9042
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/depend-4.f904
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/depend-6.f904
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/depend-iterator-2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/depobj-2.f906
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/doacross-5.f9088
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/doacross-6.f9077
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/nesting-2.f904
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/ompx-1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/omx-1.f7
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/omx-2.f9
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/strictly-structured-block-4.f9021
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-4.f902
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-5.f902
-rw-r--r--gcc/testsuite/gfortran.dg/ieee/fma_1.f90100
-rw-r--r--gcc/testsuite/gfortran.dg/ieee/modes_1.f9095
-rw-r--r--gcc/testsuite/gfortran.dg/ieee/rounding_2.f9020
-rw-r--r--gcc/testsuite/gfortran.dg/ieee/rounding_3.f9027
-rw-r--r--gcc/testsuite/gfortran.dg/ieee/signbit_1.f90166
-rw-r--r--gcc/testsuite/gfortran.dg/literal_constants.f20
-rw-r--r--gcc/testsuite/gfortran.dg/literal_constants.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/pdt_15.f032
-rw-r--r--gcc/testsuite/gfortran.dg/pointer_array_8.f904
-rw-r--r--gcc/testsuite/gfortran.dg/pr103694.f9011
-rw-r--r--gcc/testsuite/gfortran.dg/pr104314.f909
-rw-r--r--gcc/testsuite/gfortran.dg/pr106556.f9010
-rw-r--r--gcc/testsuite/gfortran.dg/pr106557.f9019
-rw-r--r--gcc/testsuite/gfortran.dg/pr106857.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/pr106934.f907
-rw-r--r--gcc/testsuite/gfortran.dg/pr106985.f908
-rw-r--r--gcc/testsuite/gfortran.dg/pr106986.f908
-rw-r--r--gcc/testsuite/gfortran.dg/pr99349.f909
-rw-r--r--gcc/testsuite/gnat.dg/aspect2.adb5
-rw-r--r--gcc/testsuite/gnat.dg/aspect2.ads30
-rw-r--r--gcc/testsuite/gnat.dg/config_pragma1.adb21
-rw-r--r--gcc/testsuite/gnat.dg/config_pragma1_pkg.ads21
-rw-r--r--gcc/testsuite/gnat.dg/equal8.adb6
-rw-r--r--gcc/testsuite/gnat.dg/equal8.ads36
-rw-r--r--gcc/testsuite/gnat.dg/equal8_pkg.ads58
-rw-r--r--gcc/testsuite/gnat.dg/formal_containers.adb23
-rw-r--r--gcc/testsuite/gnat.dg/iter1.adb20
-rw-r--r--gcc/testsuite/gnat.dg/iter1.ads8
-rw-r--r--gcc/testsuite/lib/g++.exp10
-rw-r--r--gcc/testsuite/lib/gcc-dg.exp2
-rw-r--r--gcc/testsuite/lib/gcc.exp21
-rw-r--r--gcc/testsuite/lib/gfortran-dg.exp2
-rw-r--r--gcc/testsuite/lib/target-supports.exp67
-rw-r--r--gcc/testsuite/lib/wrapper.exp7
-rw-r--r--gcc/testsuite/objc.dg/stabs-1.m19
959 files changed, 27432 insertions, 1236 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c846ad4..68f8231 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,2122 @@
+2022-09-21 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106984
+ * gcc.dg/tsan/pr106984.c: New testcase.
+
+2022-09-21 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ * gfortran.dg/ieee/rounding_3.f90: New test.
+
+2022-09-21 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/106967
+ * gcc.dg/tree-ssa/pr106967.c: New test.
+
+2022-09-21 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/pr106963.c: New test.
+
+2022-09-20 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/104143
+ * gfortran.dg/c-interop/c407b-2.f90: Remove dg-error.
+ * gfortran.dg/assumed_type_16.f90: New test.
+ * gfortran.dg/assumed_type_17.f90: New test.
+
+2022-09-20 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/106986
+ * gfortran.dg/pr106986.f90: New test.
+
+2022-09-20 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/106985
+ * gfortran.dg/pr106985.f90: New test.
+
+2022-09-20 Patrick Palka <ppalka@redhat.com>
+
+ * g++.dg/modules/xtreme-header-2.h: Include <execution>.
+ * g++.dg/modules/xtreme-header-6.h: Include implemented
+ C++20 library headers.
+ * g++.dg/modules/xtreme-header.h: Likewise. Remove
+ NO_ASSOCIATED_LAMBDA workaround. Include implemented C++23
+ library headers.
+
+2022-09-20 Patrick Palka <ppalka@redhat.com>
+
+ * g++.dg/modules/auto-3.h: New test.
+ * g++.dg/modules/auto-3_a.H: New test.
+ * g++.dg/modules/auto-3_b.C: New test.
+
+2022-09-20 José Rui Faustino de Sousa <jrfsousa@gmail.com>
+
+ PR fortran/100132
+ * gfortran.dg/PR100132.f90: New test.
+
+2022-09-20 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.dg/vect/pr106914.c: New test.
+ * g++.dg/vect/pr106794.cc: Likewise.
+
+2022-09-20 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.dg/vect/vect-gather-5.c: New test.
+
+2022-09-20 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/106970
+ * gcc.dg/tree-ssa/pr106970.c: New test.
+
+2022-09-20 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/106761
+ * g++.dg/modules/pr106761.h: New test.
+ * g++.dg/modules/pr106761_a.H: New test.
+ * g++.dg/modules/pr106761_b.C: New test.
+
+2022-09-20 Martin Liska <mliska@suse.cz>
+
+ * g++.dg/warn/Wclass-memaccess.C: Replace "the the" with "the".
+ * g++.dg/warn/Wconversion-real-integer2.C: Likewise.
+ * gcc.target/powerpc/p9-extract-1.c: Likewise.
+ * gcc.target/s390/s390.exp: Likewise.
+ * gcc.target/s390/zvector/vec-cmp-2.c: Likewise.
+ * gdc.dg/torture/simd_store.d: Likewise.
+ * gfortran.dg/actual_array_offset_1.f90: Likewise.
+ * gfortran.dg/pdt_15.f03: Likewise.
+ * gfortran.dg/pointer_array_8.f90: Likewise.
+
+2022-09-20 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/pr106910-1.c: New test.
+
+2022-09-20 konglin1 <lingling.kong@intel.com>
+
+ * gcc.target/i386/pr105735-1.c: New test.
+ * gcc.target/i386/pr105735-2.c: New test.
+
+2022-09-20 konglin1 <lingling.kong@intel.com>
+
+ PR target/106887
+ * gcc.target/i386/vect-bfloat16-2c.c: New test.
+
+2022-09-19 Marek Polacek <polacek@redhat.com>
+
+ PR c/106947
+ * c-c++-common/Waddress-7.c: New test.
+
+2022-09-19 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ * gfortran.dg/ieee/modes_1.f90: New test.
+
+2022-09-19 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ * gfortran.dg/ieee/rounding_2.f90: New test.
+
+2022-09-18 Julian Brown <julian@codesourcery.com>
+
+ * g++.dg/gomp/target-lambda-1.C: Adjust expected scan output.
+
+2022-09-18 Palmer Dabbelt <palmer@rivosinc.com>
+
+ * gcc.dg/tree-ssa/gen-vect-34.c: Skip RISC-V targets.
+
+2022-09-17 Patrick Palka <ppalka@redhat.com>
+
+ * g++.dg/modules/typename-friend_a.C: New test.
+ * g++.dg/modules/typename-friend_b.C: New test.
+
+2022-09-17 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/106958
+ * gcc.c-torture/compile/pr106958.c: New test.
+
+2022-09-16 Eugene Rozenfeld <erozen@microsoft.com>
+
+ * gcc.dg/tree-prof/indir-call-prof-2.c: Fix dg-final-use-autofdo.
+
+2022-09-16 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/92505
+ * g++.dg/cpp0x/constexpr-mutable3.C: New test.
+ * g++.dg/cpp1y/constexpr-mutable1.C: New test.
+
+2022-09-16 Jason Merrill <jason@redhat.com>
+
+ PR c++/106858
+ * g++.dg/gomp/map-3.C: New test.
+
+2022-09-15 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/106857
+ * gfortran.dg/pr106857.f90: New test.
+
+2022-09-15 Harald Anlauf <anlauf@gmx.de>
+ Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/104314
+ * gfortran.dg/pr104314.f90: New test.
+
+2022-09-15 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/c2x-float-2.c: Require inff effective-target.
+ * gcc.dg/c2x-float-11.c: New test.
+
+2022-09-15 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106922
+ * g++.dg/tree-ssa/pr106922.C: New testcase.
+
+2022-09-15 Julian Brown <julian@codesourcery.com>
+
+ * c-c++-common/gomp/target-50.c: Modify scan pattern.
+
+2022-09-15 Julian Brown <julian@codesourcery.com>
+
+ * c-c++-common/goacc/mdc-2.c: Update expected errors.
+ * g++.dg/goacc/mdc.C: Likewise.
+
+2022-09-15 Jiufu Guo <guojiufu@linux.ibm.com>
+
+ PR target/106550
+ * gcc.target/powerpc/pr106550.c: New test.
+ * gcc.target/powerpc/pr106550_1.c: New test.
+
+2022-09-14 Julian Brown <julian@codesourcery.com>
+
+ * g++.dg/goacc/member-array-acc.C: New test.
+ * g++.dg/gomp/member-array-omp.C: New test.
+ * g++.dg/gomp/target-3.C: Update expected output.
+ * g++.dg/gomp/target-lambda-1.C: Likewise.
+ * g++.dg/gomp/target-this-2.C: Likewise.
+ * c-c++-common/goacc/deep-copy-arrayofstruct.c: Move test from here.
+ * c-c++-common/gomp/target-50.c: New test.
+
+2022-09-14 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106938
+ * gcc.dg/pr106938.c: New testcase.
+
+2022-09-14 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/106936
+ * g++.dg/tree-ssa/pr106936.C: New test.
+
+2022-09-14 Julian Brown <julian@codesourcery.com>
+
+ * g++.dg/gomp/target-lambda-1.C: Adjust expected output.
+ * g++.dg/gomp/target-this-3.C: Likewise.
+ * g++.dg/gomp/target-this-4.C: Likewise.
+
+2022-09-14 Robin Dapp <rdapp@linux.ibm.com>
+
+ * gcc.target/s390/ifcvt-one-insn-bool.c: Add -mzarch.
+ * gcc.target/s390/ifcvt-one-insn-char.c: Dito.
+ * gcc.target/s390/ifcvt-two-insns-bool.c: Dito.
+ * gcc.target/s390/ifcvt-two-insns-int.c: Dito.
+ * gcc.target/s390/ifcvt-two-insns-long.c: Add -mzarch and change
+ long into long long.
+
+2022-09-14 Robin Dapp <rdapp@linux.ibm.com>
+
+ * gcc.target/s390/vector/vperm-rev-z14.c: Add -save-temps.
+ * gcc.target/s390/vector/vperm-rev-z15.c: Likewise.
+
+2022-09-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/106878
+ * gcc.c-torture/compile/pr106878.c: New test.
+
+2022-09-14 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106934
+ * gfortran.dg/pr106934.f90: New testcase.
+
+2022-09-14 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/pr106905.c: New test.
+ * gcc.target/ia64/pr106905.c: New test.
+
+2022-09-14 Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
+ Yvan ROUX <yvan.roux@foss.st.com>
+
+ PR target/95720
+ * lib/g++.exp: Moved gluefile block to after flags have been
+ prefixed for the target_compile call.
+ * lib/gcc.exp: Likewise.
+ * lib/wrapper.exp: Reset adjusted state flag.
+
+2022-09-13 Roger Sayle <roger@nextmovesoftware.com>
+
+ PR target/106877
+ * g++.dg/ext/pr106877.C: New test case.
+
+2022-09-13 Patrick Palka <ppalka@redhat.com>
+
+ * g++.dg/cpp1z/noexcept-type26.C: New test.
+ * g++.dg/cpp2a/explicit19.C: New test.
+ * g++.dg/ext/integer-pack6.C: New test.
+
+2022-09-13 Kewen Lin <linkw@linux.ibm.com>
+
+ PR target/104482
+ * gcc.target/powerpc/pr104482.c: New test.
+
+2022-09-13 Kewen.Lin <linkw@gcc.gnu.org>
+
+ PR target/105485
+ * g++.target/powerpc/pr105485.C: New test.
+
+2022-09-13 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/ldp_stp_20.c: New test.
+ * gcc.target/aarch64/ldp_stp_21.c: Likewise.
+ * gcc.target/aarch64/ldp_stp_22.c: Likewise.
+ * gcc.target/aarch64/ldp_stp_23.c: Likewise.
+ * gcc.target/aarch64/ldp_stp_24.c: Likewise.
+ * gcc.target/aarch64/movv16qi_1.c (gpr_to_gpr): New function.
+ * gcc.target/aarch64/movv8qi_1.c (gpr_to_gpr): Likewise.
+ * gcc.target/aarch64/movv16qi_2.c: New test.
+ * gcc.target/aarch64/movv16qi_3.c: Likewise.
+ * gcc.target/aarch64/movv2di_1.c: Likewise.
+ * gcc.target/aarch64/movv2x16qi_1.c: Likewise.
+ * gcc.target/aarch64/movv2x8qi_1.c: Likewise.
+ * gcc.target/aarch64/movv3x16qi_1.c: Likewise.
+ * gcc.target/aarch64/movv3x8qi_1.c: Likewise.
+ * gcc.target/aarch64/movv4x16qi_1.c: Likewise.
+ * gcc.target/aarch64/movv4x8qi_1.c: Likewise.
+ * gcc.target/aarch64/movv8qi_2.c: Likewise.
+ * gcc.target/aarch64/movv8qi_3.c: Likewise.
+ * gcc.target/aarch64/vect_unary_2.c: Likewise.
+
+2022-09-13 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/acle/ls64_asm_2.c: New test.
+
+2022-09-12 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/101906
+ * g++.dg/template/evaluated1.C: New test.
+ * g++.dg/template/evaluated1a.C: New test.
+ * g++.dg/template/evaluated1b.C: New test.
+ * g++.dg/template/evaluated1c.C: New test.
+
+2022-09-12 Jason Merrill <jason@redhat.com>
+
+ PR c++/106893
+ PR c++/90451
+ * g++.dg/cpp1y/auto-fn65.C: New test.
+
+2022-09-12 Jason Merrill <jason@redhat.com>
+
+ PR c++/93259
+ * g++.dg/cpp0x/initlist-array17.C: New test.
+
+2022-09-12 Jason Merrill <jason@redhat.com>
+
+ PR c++/106567
+ * g++.dg/cpp0x/lambda/lambda-array4.C: New test.
+
+2022-09-12 Jonathan Wakely <jwakely@redhat.com>
+
+ PR c++/86491
+ * g++.dg/warn/anonymous-namespace-3.C: Use separate dg-warning
+ directives for C++98 and everything else.
+ * g++.dg/warn/Wsubobject-linkage-5.C: New test.
+
+2022-09-12 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/atomic/c2x-stdatomic-var-init-1.c: New test.
+
+2022-09-12 Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
+
+ * g++.dg/gcov/gcov.exp: Respect triplet when looking for gcov.
+ * gcc.misc-tests/gcov.exp: Likewise.
+
+2022-09-12 Joffrey Huguet <huguet@adacore.com>
+
+ * gnat.dg/aspect2.adb: Removed.
+ * gnat.dg/aspect2.ads: Removed.
+ * gnat.dg/config_pragma1.adb: Removed.
+ * gnat.dg/config_pragma1_pkg.ads: Removed.
+ * gnat.dg/equal8.adb: Removed.
+ * gnat.dg/equal8.ads: Removed.
+ * gnat.dg/equal8_pkg.ads: Removed.
+ * gnat.dg/formal_containers.adb: Removed.
+ * gnat.dg/iter1.adb: Removed.
+ * gnat.dg/iter1.ads: Removed.
+
+2022-09-11 Tim Lange <mail@tim-lange.me>
+
+ PR analyzer/106845
+ * gcc.dg/analyzer/out-of-bounds-zero.c: New test.
+ * gcc.dg/analyzer/pr106845.c: New test.
+
+2022-09-10 Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
+
+ * gcc.target/xtensa/constsynth_3insns.c (test_4):
+ Add new test function.
+
+2022-09-10 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR fortran/95644
+ * gfortran.dg/ieee/fma_1.f90: New test.
+ * gfortran.dg/ieee/signbit_1.f90: New test.
+
+2022-09-09 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/plugin/analyzer_kernel_plugin.c: New test.
+ * gcc.dg/plugin/copy_from_user-1.c: New test.
+ * gcc.dg/plugin/infoleak-1.c: New test.
+ * gcc.dg/plugin/infoleak-2.c: New test.
+ * gcc.dg/plugin/infoleak-3.c: New test.
+ * gcc.dg/plugin/infoleak-CVE-2011-1078-1.c: New test.
+ * gcc.dg/plugin/infoleak-CVE-2011-1078-2.c: New test.
+ * gcc.dg/plugin/infoleak-CVE-2014-1446-1.c: New test.
+ * gcc.dg/plugin/infoleak-CVE-2017-18549-1.c: New test.
+ * gcc.dg/plugin/infoleak-CVE-2017-18550-1.c: New test.
+ * gcc.dg/plugin/infoleak-antipatterns-1.c: New test.
+ * gcc.dg/plugin/infoleak-fixit-1.c: New test.
+ * gcc.dg/plugin/infoleak-net-ethtool-ioctl.c: New test.
+ * gcc.dg/plugin/infoleak-vfio_iommu_type1.c: New test.
+ * gcc.dg/plugin/plugin.exp (plugin_test_list): Add
+ analyzer_kernel_plugin.c and the new test cases.
+ * gcc.dg/plugin/taint-CVE-2011-0521-1-fixed.c: New test.
+ * gcc.dg/plugin/taint-CVE-2011-0521-1.c: New test.
+ * gcc.dg/plugin/taint-CVE-2011-0521-2-fixed.c: New test.
+ * gcc.dg/plugin/taint-CVE-2011-0521-2.c: New test.
+ * gcc.dg/plugin/taint-CVE-2011-0521-3-fixed.c: New test.
+ * gcc.dg/plugin/taint-CVE-2011-0521-3.c: New test.
+ * gcc.dg/plugin/taint-CVE-2011-0521-4.c: New test.
+ * gcc.dg/plugin/taint-CVE-2011-0521-5-fixed.c: New test.
+ * gcc.dg/plugin/taint-CVE-2011-0521-5.c: New test.
+ * gcc.dg/plugin/taint-CVE-2011-0521-6.c: New test.
+ * gcc.dg/plugin/taint-CVE-2011-0521.h: New test.
+ * gcc.dg/plugin/taint-antipatterns-1.c: New test.
+ * gcc.dg/plugin/test-uaccess.h: New header for tests.
+
+2022-09-09 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/plugin/analyzer_known_fns_plugin.c: New test plugin.
+ * gcc.dg/plugin/known-fns-1.c: New test.
+ * gcc.dg/plugin/plugin.exp (plugin_test_list): Add the new plugin
+ and test.
+
+2022-09-09 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/98247
+ * gcc.dg/analyzer/flexible-array-member-1.c: New test.
+
+2022-09-09 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/c11-unreachable-1.c, gcc.dg/c2x-unreachable-1.c: New
+ tests.
+
+2022-09-09 Kewen Lin <linkw@linux.ibm.com>
+
+ PR middle-end/106833
+ * gcc.target/powerpc/pr106833.c: New test.
+
+2022-09-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106892
+ * gcc.dg/torture/pr106892.c: New testcase.
+
+2022-09-08 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/106670
+ * c-c++-common/gomp/ompx-1.c: New test.
+ * c-c++-common/gomp/ompx-2.c: New test.
+ * g++.dg/gomp/ompx-attrs-1.C: New test.
+ * gfortran.dg/gomp/ompx-1.f90: New test.
+ * gfortran.dg/gomp/omx-1.f: New test.
+ * gfortran.dg/gomp/omx-2.f: New test.
+
+2022-09-08 Jonathan Wakely <jwakely@redhat.com>
+
+ PR c++/106838
+ * g++.dg/ext/array4.C: Fix invalid use of __is_constructible.
+ * g++.dg/ext/unary_trait_incomplete.C: Fix tests for traits with
+ different requirements.
+
+2022-09-08 Tim Lange <mail@tim-lange.me>
+
+ PR analyzer/106625
+ * gcc.dg/analyzer/data-model-1.c: Change expected result.
+ * gcc.dg/analyzer/out-of-bounds-5.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-realloc-grow.c: New test.
+ * gcc.dg/analyzer/symbolic-gt-1.c: New test.
+
+2022-09-08 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR tree-optimization/106886
+ * gcc.dg/vect/bb-slp-layout-21.c: New test.
+
+2022-09-08 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/99209
+ * g++.dg/cpp2a/lambda-uneval17.C: New test.
+
+2022-09-08 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/99130
+ * g++.dg/cpp0x/constexpr-decltype5.C: New test.
+
+2022-09-08 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/gomp/doacross-7.c: New test.
+
+2022-09-08 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106881
+ * gcc.dg/uninit-pr106881.c: New testcase.
+
+2022-09-08 Richard Biener <rguenther@suse.de>
+
+ PR testsuite/106872
+ * gcc.dg/uninit-pred-12.c: Adjust.
+
+2022-09-07 Jason Merrill <jason@redhat.com>
+
+ PR c++/106793
+ * g++.dg/cpp23/auto-array2.C: Adjust.
+ * g++.dg/cpp1z/class-deduction113.C: New test.
+
+2022-09-07 Surya Kumari Jangala <jskumari@linux.ibm.com>
+
+ PR rtl-optimization/105586
+ * gcc.target/powerpc/pr105586.c: New test.
+
+2022-09-07 Arsen Arsenović <arsen@aarsen.me>
+
+ PR c++/106188
+ PR c++/106713
+ * g++.dg/coroutines/pr106188.C: New test.
+
+2022-09-07 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/c11-keywords-1.c, gcc.dg/c2x-align-1.c,
+ gcc.dg/c2x-align-6.c, gcc.dg/c2x-bool-2.c,
+ gcc.dg/c2x-static-assert-3.c, gcc.dg/c2x-static-assert-4.c,
+ gcc.dg/c2x-thread-local-1.c: New tests.
+ * gcc.dg/c2x-bool-1.c: Update expectations.
+
+2022-09-07 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106866
+ * gcc.dg/uninit-pr106866.c: New testcase.
+
+2022-09-07 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/106867
+ * gcc.dg/tree-ssa/pr106867.c: New test.
+
+2022-09-07 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106860
+ * g++.dg/opt/pr106860.C: New testcase.
+
+2022-09-07 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/movqi_1.c: New test.
+ * gcc.target/aarch64/movhi_1.c: Likewise.
+ * gcc.target/aarch64/movsi_1.c: Likewise.
+ * gcc.target/aarch64/movdi_2.c: Likewise.
+ * gcc.target/aarch64/movti_2.c: Likewise.
+ * gcc.target/aarch64/movhf_1.c: Likewise.
+ * gcc.target/aarch64/movsf_1.c: Likewise.
+ * gcc.target/aarch64/movdf_1.c: Likewise.
+ * gcc.target/aarch64/movtf_2.c: Likewise.
+ * gcc.target/aarch64/movv8qi_1.c: Likewise.
+ * gcc.target/aarch64/movv16qi_1.c: Likewise.
+
+2022-09-07 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/nofp_2.c: New test.
+
+2022-09-07 Lulu Cheng <chenglulu@loongson.cn>
+
+ PR target/106828
+ * g++.target/loongarch/pr106828.C: New test.
+
+2022-09-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/106829
+ * g++.dg/gomp/pr106829.C: New test.
+
+2022-09-07 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/cpp/delimited-escape-seq-4.c: New test.
+ * c-c++-common/cpp/delimited-escape-seq-5.c: New test.
+ * c-c++-common/cpp/delimited-escape-seq-6.c: New test.
+ * c-c++-common/cpp/delimited-escape-seq-7.c: New test.
+ * c-c++-common/cpp/named-universal-char-escape-5.c: New test.
+ * c-c++-common/cpp/named-universal-char-escape-6.c: New test.
+ * c-c++-common/cpp/named-universal-char-escape-7.c: New test.
+ * g++.dg/cpp23/named-universal-char-escape1.C: New test.
+ * g++.dg/cpp23/named-universal-char-escape2.C: New test.
+
+2022-09-07 Kewen Lin <linkw@linux.ibm.com>
+
+ PR testsuite/106345
+ * lib/target-supports.exp (check_effective_target_powerpc_sqrt): Add
+ a function definition to avoid pedwarn about empty translation unit.
+ (check_effective_target_has_arch_pwr5): Likewise.
+ (check_effective_target_has_arch_pwr6): Likewise.
+ (check_effective_target_has_arch_pwr7): Likewise.
+ (check_effective_target_has_arch_pwr8): Likewise.
+ (check_effective_target_has_arch_pwr9): Likewise.
+ (check_effective_target_has_arch_pwr10): Likewise.
+ (check_effective_target_has_arch_ppc64): Likewise.
+ (check_effective_target_ppc_float128): Likewise.
+ (check_effective_target_ppc_float128_insns): Likewise.
+ (check_effective_target_powerpc_vsx): Likewise.
+
+2022-09-07 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/pr103144-mul-1.c: New test.
+ * gcc.target/i386/pr103144-mul-2.c: New test.
+ * gcc.target/i386/pr103144-neg-1.c: New test.
+ * gcc.target/i386/pr103144-neg-2.c: New test.
+ * gcc.target/i386/pr103144-shift-1.c: New test.
+ * gcc.target/i386/pr103144-shift-2.c: New test.
+
+2022-09-06 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp23/subscript8.C: New test.
+
+2022-09-06 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106754
+ * gcc.dg/uninit-pred-12.c: New testcase.
+ * gcc.dg/uninit-pr106155-1.c: Likewise.
+
+2022-09-06 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/tree-ssa/vrp-float-inf-1.c: New test.
+
+2022-09-06 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106844
+ * gcc.dg/pr106844.c: New testcase.
+
+2022-09-06 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106841
+ * g++.dg/vect/pr106841.cc: New testcase.
+
+2022-09-06 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/gomp/doacross-6.c (corge): Don't expect an error here.
+ Add a few further tests.
+
+2022-09-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/106836
+ * c-c++-common/gomp/pr106836.c: New test.
+
+2022-09-06 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/gomp/sink-3.c: Don't expect a superfluous error during
+ error recovery.
+ * c-c++-common/gomp/doacross-6.c (foo): Add further tests.
+
+2022-09-06 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/avx512f-vcvtps2ph-sae.c: New test.
+
+2022-09-05 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/cpp/c11-trigraphs-1.c, gcc.dg/cpp/c2x-trigraphs-1.c,
+ gcc.dg/cpp/c2x-trigraphs-2.c: New tests.
+
+2022-09-05 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/tree-ssa/vrp-float-signbit-2.c: New test.
+
+2022-09-05 Alexander Monakov <amonakov@ispras.ru>
+
+ PR target/106453
+ * gcc.target/i386/pr106453.c: New test.
+
+2022-09-05 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/gomp/all-memory-1.f90: Update dg-error.
+ * gfortran.dg/gomp/depend-iterator-2.f90: Likewise.
+ * gfortran.dg/gomp/depobj-2.f90: Likewise.
+ * gfortran.dg/gomp/doacross-5.f90: New test.
+ * gfortran.dg/gomp/doacross-6.f90: New test.
+
+2022-09-05 Aldy Hernandez <aldyh@redhat.com>
+
+ PR middle-end/106824
+ * g++.dg/pr106824.C: New test.
+
+2022-09-05 Tim Lange <mail@tim-lange.me>
+
+ * gcc.dg/analyzer/out-of-bounds-4.c: New test.
+ * gcc.dg/analyzer/strcpy-3.c: New test.
+
+2022-09-05 Tim Lange <mail@tim-lange.me>
+
+ * gcc.dg/analyzer/fold-string-to-char.c: New test.
+
+2022-09-05 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * gcc.target/aarch64/spellcheck_10.c: New test.
+
+2022-09-05 LiaoShihua <shihua@iscas.ac.cn>
+
+ * gcc.target/riscv/zmmul-1.c: New test.
+ * gcc.target/riscv/zmmul-2.c: New test.
+
+2022-09-05 Xi Ruoyao <xry111@xry111.site>
+
+ * gcc.target/loongarch/direct-extern-1.c: New test.
+ * gcc.target/loongarch/direct-extern-2.c: New test.
+
+2022-09-05 konglin1 <lingling.kong@intel.com>
+
+ * gcc.target/i386/pr106742.c: New test.
+
+2022-09-04 José Rui Faustino de Sousa <jrfsousa@gmail.com>
+
+ PR fortran/100136
+ * gfortran.dg/PR100136.f90: New test.
+
+2022-09-03 José Rui Faustino de Sousa <jrfsousa@gmail.com>
+
+ PR fortran/100245
+ * gfortran.dg/PR100245.f90: New test.
+
+2022-09-03 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/tree-ssa/pr106819.c: New test.
+
+2022-09-03 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/gomp/doacross-2.c: Adjust expected diagnostics.
+ * c-c++-common/gomp/doacross-5.c: New test.
+ * c-c++-common/gomp/doacross-6.c: New test.
+ * c-c++-common/gomp/nesting-2.c: Adjust expected diagnostics.
+ * c-c++-common/gomp/ordered-3.c: Likewise.
+ * c-c++-common/gomp/sink-3.c: Likewise.
+ * gfortran.dg/gomp/nesting-2.f90: Likewise.
+
+2022-09-02 David Malcolm <dmalcolm@redhat.com>
+
+ PR c/90885
+ * c-c++-common/Wxor-used-as-pow-1.c: New test.
+ * c-c++-common/Wxor-used-as-pow-fixits.c: New test.
+ * g++.dg/parse/expr3.C: Convert 2 to 0x2 to suppress
+ -Wxor-used-as-pow.
+ * g++.dg/warn/Wparentheses-10.C: Likewise.
+ * g++.dg/warn/Wparentheses-18.C: Likewise.
+ * g++.dg/warn/Wparentheses-19.C: Likewise.
+ * g++.dg/warn/Wparentheses-9.C: Likewise.
+ * g++.dg/warn/Wxor-used-as-pow-named-op.C: New test.
+ * gcc.dg/Wparentheses-6.c: Convert 2 to 0x2 to suppress
+ -Wxor-used-as-pow.
+ * gcc.dg/Wparentheses-7.c: Likewise.
+ * gcc.dg/precedence-1.c: Likewise.
+
+2022-09-02 Harald Anlauf <anlauf@gmx.de>
+ Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/99349
+ * gfortran.dg/pr99349.f90: New test.
+
+2022-09-02 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.dg/vect/bb-slp-layout-20.c: New test.
+
+2022-09-02 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.dg/vect/bb-slp-layout-19.c: New test.
+
+2022-09-02 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106809
+ * gcc.dg/torture/pr106809.c: New testcase.
+
+2022-09-02 Martin Liska <mliska@suse.cz>
+
+ * lib/gcc-dg.exp: Remove -gstabs option support, DBX-related
+ macros and DBX debugging info support.
+ * lib/gfortran-dg.exp: Likewise.
+ * lib/target-supports.exp: Likewise.
+ * g++.dg/cpp0x/alias-decl-debug-0.C: Removed.
+ * g++.dg/other/PR23205.C: Removed.
+ * g++.dg/other/pr23205-2.C: Removed.
+ * gcc.dg/20040813-1.c: Removed.
+ * gcc.dg/darwin-20040809-2.c: Removed.
+ * gcc.dg/debug/pr35154.c: Removed.
+ * gcc.dg/pr69471-2.c: Removed.
+ * gcc.target/powerpc/stabs-attrib-vect-darwin.c: Removed.
+ * gcc.target/s390/20041216-1.c: Removed.
+ * gfortran.dg/debug/pr35154-stabs.f: Removed.
+ * objc.dg/stabs-1.m: Removed.
+
+2022-09-02 Simon Rainer <gcc.gnu@vvalter.com>
+
+ PR ipa/106627
+ * g++.target/i386/pr106627.C: New test.
+
+2022-09-01 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/106707
+ * gcc.target/i386/pr106707.c (foo): Replace long with long long.
+
+2022-09-01 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/c11-unproto-3.c, gcc.dg/c2x-unproto-3.c,
+ gcc.dg/c2x-unproto-4.c: New tests.
+ * gcc.dg/c2x-old-style-definition-6.c, gcc.dg/c2x-unproto-1.c,
+ gcc.dg/c2x-unproto-2.c: Update for removal of unprototyped
+ functions.
+
+2022-09-01 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.dg/vect/bb-slp-pr54400.c: Extend to aarch64.
+ * gcc.dg/vect/bb-slp-layout-18.c: New test.
+
+2022-09-01 Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/106707
+ * gcc.target/i386/pr106707.c: New test.
+
+2022-09-01 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/tree-ssa/vrp-float-signbit-1.c: New test.
+
+2022-09-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/106655
+ * c-c++-common/cpp/Winvalid-utf8-1.c: New test.
+ * c-c++-common/cpp/Winvalid-utf8-2.c: New test.
+ * c-c++-common/cpp/Winvalid-utf8-3.c: New test.
+ * g++.dg/cpp23/Winvalid-utf8-1.C: New test.
+ * g++.dg/cpp23/Winvalid-utf8-2.C: New test.
+ * g++.dg/cpp23/Winvalid-utf8-3.C: New test.
+ * g++.dg/cpp23/Winvalid-utf8-4.C: New test.
+ * g++.dg/cpp23/Winvalid-utf8-5.C: New test.
+ * g++.dg/cpp23/Winvalid-utf8-6.C: New test.
+ * g++.dg/cpp23/Winvalid-utf8-7.C: New test.
+ * g++.dg/cpp23/Winvalid-utf8-8.C: New test.
+ * g++.dg/cpp23/Winvalid-utf8-9.C: New test.
+ * g++.dg/cpp23/Winvalid-utf8-10.C: New test.
+ * g++.dg/cpp23/Winvalid-utf8-11.C: New test.
+ * g++.dg/cpp23/Winvalid-utf8-12.C: New test.
+
+2022-09-01 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/106785
+ * gcc.dg/tree-ssa/vrp-float-nan-1.c: New test.
+
+2022-09-01 konglin1 <lingling.kong@intel.com>
+
+ * gcc.dg/tree-ssa/gen-vect-34.c: New test.
+ * gcc.dg/vect/vect-ifcvt-18.c: New test.
+
+2022-09-01 Kewen Lin <linkw@linux.ibm.com>
+
+ PR testsuite/106682
+ * gcc.target/powerpc/pr86731-fwrapv-longlong.c: Fix typo.
+
+2022-09-01 Peter Bergner <bergner@linux.ibm.com>
+
+ PR target/101322
+ * g++.target/powerpc/pr101322.C: New test.
+
+2022-08-31 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/c2x-attr-deprecated-2.c, gcc.dg/c2x-attr-fallthrough-2.c,
+ gcc.dg/c2x-attr-maybe_unused-1.c, gcc.dg/c2x-attr-nodiscard-2.c:
+ Add tests of attributes on labels.
+ * gcc.dg/c2x-has-c-attribute-2.c: Update expected results for
+ maybe_unused and fallthrough.
+
+2022-08-31 Martin Liska <mliska@suse.cz>
+
+ * g++.dg/cpp0x/lambda/lambda-conv.C: Remove useless test.
+ * gcc.c-torture/execute/ieee/hugeval.x: Likewise.
+ * gcc.dg/torture/pr47917.c: Likewise.
+ * lib/target-supports.exp: Likewise.
+
+2022-08-31 Jonathan Wakely <jwakely@redhat.com>
+
+ PR testsuite/106795
+ * g++.dg/tree-ssa/empty-loop.C: Use -Wno-unused-result.
+
+2022-08-31 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/sve/acle/general-c/gnu_vectors_1.c: Update
+ tests for empty initializers.
+ * gcc.target/aarch64/sve/acle/general-c/gnu_vectors_2.c: Likewise.
+ * gcc.target/aarch64/sve/acle/general-c/sizeless-1.c: Likewise.
+ * gcc.target/aarch64/sve/acle/general-c/sizeless-2.c: Likewise.
+
+2022-08-31 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/90994
+ * g++.dg/torture/pr90994.C: New testcase.
+
+2022-08-31 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/65244
+ * gcc.dg/uninit-pr65244-2.c: New testcase.
+
+2022-08-31 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/65244
+ * gcc.dg/uninit-pr65244-1.c: New testcase.
+
+2022-08-30 Andrew Stubbs <ams@codesourcery.com>
+
+ * gcc.dg/vect/vect-simd-clone-1.c: Add dg-warning.
+ * gcc.dg/vect/vect-simd-clone-2.c: Add dg-warning.
+ * gcc.dg/vect/vect-simd-clone-3.c: Add dg-warning.
+ * gcc.dg/vect/vect-simd-clone-4.c: Add dg-warning.
+ * gcc.dg/vect/vect-simd-clone-5.c: Add dg-warning.
+ * gcc.dg/vect/vect-simd-clone-8.c: Add dg-warning.
+
+2022-08-30 Richard Sandiford <richard.sandiford@arm.com>
+
+ * lib/target-supports.exp (check_effective_target_vect_var_shift):
+ Return true for aarch64.
+ * gcc.dg/vect/bb-slp-layout-1.c: New test.
+ * gcc.dg/vect/bb-slp-layout-2.c: New test.
+ * gcc.dg/vect/bb-slp-layout-3.c: New test.
+ * gcc.dg/vect/bb-slp-layout-4.c: New test.
+ * gcc.dg/vect/bb-slp-layout-5.c: New test.
+ * gcc.dg/vect/bb-slp-layout-6.c: New test.
+ * gcc.dg/vect/bb-slp-layout-7.c: New test.
+ * gcc.dg/vect/bb-slp-layout-8.c: New test.
+ * gcc.dg/vect/bb-slp-layout-9.c: New test.
+ * gcc.dg/vect/bb-slp-layout-10.c: New test.
+ * gcc.dg/vect/bb-slp-layout-11.c: New test.
+ * gcc.dg/vect/bb-slp-layout-13.c: New test.
+ * gcc.dg/vect/bb-slp-layout-14.c: New test.
+ * gcc.dg/vect/bb-slp-layout-15.c: New test.
+ * gcc.dg/vect/bb-slp-layout-16.c: New test.
+ * gcc.dg/vect/bb-slp-layout-17.c: New test.
+ * gcc.dg/vect/slp-11b.c: XFAIL SLP test for load-lanes targets.
+ * gcc.dg/vect/bb-slp-layout-12.c: New file.
+
+2022-08-30 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/sve/slp_15.c: New test.
+ * g++.target/aarch64/sve/pr96974.C: Remove scan test.
+
+2022-08-30 Marek Polacek <polacek@redhat.com>
+
+ PR c++/106759
+ * g++.dg/ext/has-builtin-1.C: New test.
+
+2022-08-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/67196
+ * gcc.dg/uninit-pred-7_a.c: Un-XFAIL.
+
+2022-08-30 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/tree-ssa/recip-3.c: Avoid premature optimization so test
+ has a chance to succeed.
+
+2022-08-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/63660
+ * gcc.dg/uninit-pr63660.c: New testcase.
+
+2022-08-30 Richard Biener <rguenther@suse.de>
+
+ * g++.dg/uninit-pred-5.C: New testcase.
+
+2022-08-30 Tamar Christina <tamar.christina@arm.com>
+
+ PR tree-optimization/106744
+ * gcc.dg/tree-ssa/minmax-10.c: Make runtime test.
+ * gcc.dg/tree-ssa/minmax-11.c: Likewise.
+ * gcc.dg/tree-ssa/minmax-12.c: Likewise.
+ * gcc.dg/tree-ssa/minmax-13.c: Likewise.
+ * gcc.dg/tree-ssa/minmax-14.c: Likewise.
+ * gcc.dg/tree-ssa/minmax-15.c: Likewise.
+ * gcc.dg/tree-ssa/minmax-16.c: Likewise.
+ * gcc.dg/tree-ssa/minmax-3.c: Likewise.
+ * gcc.dg/tree-ssa/minmax-4.c: Likewise.
+ * gcc.dg/tree-ssa/minmax-5.c: Likewise.
+ * gcc.dg/tree-ssa/minmax-6.c: Likewise.
+ * gcc.dg/tree-ssa/minmax-7.c: Likewise.
+ * gcc.dg/tree-ssa/minmax-8.c: Likewise.
+ * gcc.dg/tree-ssa/minmax-9.c: Likewise.
+
+2022-08-29 Marek Polacek <polacek@redhat.com>
+
+ PR c++/106712
+ * g++.dg/cpp0x/gen-attrs-77.C: New test.
+
+2022-08-29 David Faust <david.faust@oracle.com>
+
+ PR target/106745
+ * gcc.target/bpf/core-pr106745.c: New test.
+
+2022-08-29 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/106748
+ * gcc.target/i386/pr106748.c: New test.
+
+2022-08-29 Xi Ruoyao <xry111@xry111.site>
+
+ * gcc.target/loongarch/func-call-medium-1.c: Refine test
+ depending on __tls_get_addr with { target tls_native }.
+ * gcc.target/loongarch/func-call-medium-2.c: Likewise.
+ * gcc.target/loongarch/func-call-medium-3.c: Likewise.
+ * gcc.target/loongarch/func-call-medium-4.c: Likewise.
+ * gcc.target/loongarch/func-call-medium-5.c: Likewise.
+ * gcc.target/loongarch/func-call-medium-6.c: Likewise.
+ * gcc.target/loongarch/func-call-medium-7.c: Likewise.
+ * gcc.target/loongarch/func-call-medium-8.c: Likewise.
+ * gcc.target/loongarch/tls-gd-noplt.c: Likewise.
+
+2022-08-29 Robin Dapp <rdapp@linux.ibm.com>
+
+ * gcc.target/s390/vector/vec-sum-across-no-lower-subreg-1.c: New test.
+
+2022-08-29 Robin Dapp <rdapp@linux.ibm.com>
+
+ * gcc.target/s390/vector/vperm-rev-z14.c: New test.
+ * gcc.target/s390/vector/vperm-rev-z15.c: New test.
+ * gcc.target/s390/zvector/vec-reve-store-byte.c: Adjust test
+ expectation.
+
+2022-08-29 Robin Dapp <rdapp@linux.ibm.com>
+
+ * gcc.target/s390/zvector/vec-reve-int-long.c: New test.
+
+2022-08-29 Robin Dapp <rdapp@linux.ibm.com>
+
+ * gcc.target/s390/vector/vec-copysign.c: Do not unroll.
+ * gcc.target/s390/zvector/autovec-double-quiet-uneq.c: Dito.
+ * gcc.target/s390/zvector/autovec-double-signaling-ltgt.c: Dito.
+ * gcc.target/s390/zvector/autovec-float-quiet-uneq.c: Dito.
+ * gcc.target/s390/zvector/autovec-float-signaling-ltgt.c: Dito.
+
+2022-08-28 Peter Bergner <bergner@linux.ibm.com>
+
+ PR target/106017
+ * gcc.target/powerpc/pr106017.c: New test.
+
+2022-08-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/106737
+ * gcc.dg/autopar/pr106737.c: Require fgraphite effective target.
+
+2022-08-26 Marek Polacek <polacek@redhat.com>
+
+ PR c++/81159
+ * g++.dg/warn/Wself-move1.C: New test.
+
+2022-08-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/106647
+ * g++.dg/cpp23/wchar-multi1.C: New test.
+ * g++.dg/cpp23/wchar-multi2.C: New test.
+
+2022-08-26 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/uninit-pred-11.c: New testcase.
+
+2022-08-26 Tobias Burnus <tobias@codesourcery.com>
+
+ * c-c++-common/gomp/reverse-offload-1.c: Remove dg-sorry.
+ * c-c++-common/gomp/target-device-ancestor-4.c: Likewise.
+ * gfortran.dg/gomp/target-device-ancestor-4.f90: Likewise.
+ * gfortran.dg/gomp/target-device-ancestor-5.f90: Likewise.
+ * c-c++-common/goacc/classify-kernels-parloops.c: Add 'noclone' to
+ scan-tree-dump-times.
+ * c-c++-common/goacc/classify-kernels-unparallelized-parloops.c:
+ Likewise.
+ * c-c++-common/goacc/classify-kernels-unparallelized.c: Likewise.
+ * c-c++-common/goacc/classify-kernels.c: Likewise.
+ * c-c++-common/goacc/classify-parallel.c: Likewise.
+ * c-c++-common/goacc/classify-serial.c: Likewise.
+ * c-c++-common/goacc/kernels-counter-vars-function-scope.c: Likewise.
+ * c-c++-common/goacc/kernels-loop-2.c: Likewise.
+ * c-c++-common/goacc/kernels-loop-3.c: Likewise.
+ * c-c++-common/goacc/kernels-loop-data-2.c: Likewise.
+ * c-c++-common/goacc/kernels-loop-data-enter-exit-2.c: Likewise.
+ * c-c++-common/goacc/kernels-loop-data-enter-exit.c: Likewise.
+ * c-c++-common/goacc/kernels-loop-data-update.c: Likewise.
+ * c-c++-common/goacc/kernels-loop-data.c: Likewise.
+ * c-c++-common/goacc/kernels-loop-g.c: Likewise.
+ * c-c++-common/goacc/kernels-loop-mod-not-zero.c: Likewise.
+ * c-c++-common/goacc/kernels-loop-n.c: Likewise.
+ * c-c++-common/goacc/kernels-loop-nest.c: Likewise.
+ * c-c++-common/goacc/kernels-loop.c: Likewise.
+ * c-c++-common/goacc/kernels-one-counter-var.c: Likewise.
+ * c-c++-common/goacc/kernels-parallel-loop-data-enter-exit.c: Likewise.
+ * gfortran.dg/goacc/classify-kernels-parloops.f95: Likewise.
+ * gfortran.dg/goacc/classify-kernels-unparallelized-parloops.f95:
+ Likewise.
+ * gfortran.dg/goacc/classify-kernels-unparallelized.f95: Likewise.
+ * gfortran.dg/goacc/classify-kernels.f95: Likewise.
+ * gfortran.dg/goacc/classify-parallel.f95: Likewise.
+ * gfortran.dg/goacc/classify-serial.f95: Likewise.
+ * gfortran.dg/goacc/kernels-loop-2.f95: Likewise.
+ * gfortran.dg/goacc/kernels-loop-data-2.f95: Likewise.
+ * gfortran.dg/goacc/kernels-loop-data-enter-exit-2.f95: Likewise.
+ * gfortran.dg/goacc/kernels-loop-data-enter-exit.f95: Likewise.
+ * gfortran.dg/goacc/kernels-loop-data-update.f95: Likewise.
+ * gfortran.dg/goacc/kernels-loop-data.f95: Likewise.
+ * gfortran.dg/goacc/kernels-loop-n.f95: Likewise.
+ * gfortran.dg/goacc/kernels-loop.f95: Likewise.
+ * gfortran.dg/goacc/kernels-parallel-loop-data-enter-exit.f95: Likewise.
+
+2022-08-26 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/torture/builtin-issignaling-1.c: New test.
+ * gcc.dg/torture/builtin-issignaling-2.c: New test.
+ * gcc.dg/torture/float16-builtin-issignaling-1.c: New test.
+ * gcc.dg/torture/float32-builtin-issignaling-1.c: New test.
+ * gcc.dg/torture/float32x-builtin-issignaling-1.c: New test.
+ * gcc.dg/torture/float64-builtin-issignaling-1.c: New test.
+ * gcc.dg/torture/float64x-builtin-issignaling-1.c: New test.
+ * gcc.dg/torture/float128-builtin-issignaling-1.c: New test.
+ * gcc.dg/torture/float128x-builtin-issignaling-1.c: New test.
+ * gcc.target/i386/builtin-issignaling-1.c: New test.
+
+2022-08-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/106099
+ * gcc.dg/pr106099.c: New test.
+
+2022-08-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/106648
+ * c-c++-common/cpp/named-universal-char-escape-1.c: New test.
+ * c-c++-common/cpp/named-universal-char-escape-2.c: New test.
+ * c-c++-common/cpp/named-universal-char-escape-3.c: New test.
+ * c-c++-common/cpp/named-universal-char-escape-4.c: New test.
+ * c-c++-common/Wbidi-chars-25.c: New test.
+ * gcc.dg/cpp/named-universal-char-escape-1.c: New test.
+ * gcc.dg/cpp/named-universal-char-escape-2.c: New test.
+ * g++.dg/cpp/named-universal-char-escape-1.C: New test.
+ * g++.dg/cpp/named-universal-char-escape-2.C: New test.
+ * g++.dg/cpp23/feat-cxx2b.C: Test __cpp_named_character_escapes.
+
+2022-08-26 Martin Liska <mliska@suse.cz>
+
+ * lib/target-supports.exp: Remove cr16 related stuff.
+
+2022-08-26 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/pr106704.c: New test.
+
+2022-08-25 Marek Polacek <polacek@redhat.com>
+
+ * gcc.dg/c11-nullptr-1.c: New test.
+ * gcc.dg/c17-nullptr-1.c: New test.
+ * gcc.dg/c17-nullptr-2.c: New test.
+ * gcc.dg/c2x-nullptr-1.c: New test.
+ * gcc.dg/c2x-nullptr-2.c: New test.
+ * gcc.dg/c2x-nullptr-3.c: New test.
+ * gcc.dg/c2x-nullptr-4.c: New test.
+ * gcc.dg/c2x-nullptr-5.c: New test.
+
+2022-08-25 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/c11-empty-init-1.c, gcc.dg/c11-empty-init-2.c,
+ gcc.dg/c11-empty-init-3.c, gcc.dg/c2x-empty-init-1.c,
+ gcc.dg/c2x-empty-init-2.c, gcc.dg/c2x-empty-init-3.c,
+ gcc.dg/gnu2x-empty-init-1.c, gcc.dg/gnu2x-empty-init-2.c: New
+ tests.
+ * gcc.dg/torture/dfp-default-init-1.c: Also test empty
+ initializers.
+ * gcc.dg/init-bad-1.c, gcc.dg/noncompile/pr71583.c,
+ gcc.dg/pr61096-1.c, gcc.dg/vla-init-2.c, gcc.dg/vla-init-3.c,
+ gcc.target/i386/sse2-bfloat16-scalar-typecheck.c: Update expected
+ diagnostics.
+ * gcc.dg/ubsan/c-shift-1.c: Use nonempty initializers for VLA
+ initializations expected to be diagnosed.
+
+2022-08-25 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/init/elide8.C: New test.
+
+2022-08-25 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/debug/dwarf2/utf-1.C: New test.
+
+2022-08-25 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ PR target/106101
+ * gcc.c-torture/compile/pr106101.c: New test.
+
+2022-08-25 Xi Ruoyao <xry111@xry111.site>
+
+ * gcc.target/loongarch/attr-model-test.c: New test.
+ * gcc.target/loongarch/attr-model-1.c: New test.
+ * gcc.target/loongarch/attr-model-2.c: New test.
+ * gcc.target/loongarch/attr-model-diag.c: New test.
+
+2022-08-25 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106737
+ * gcc.dg/autopar/pr106737.c: New testcase.
+
+2022-08-25 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/gomp/strictly-structured-block-4.f90: New test.
+
+2022-08-25 Chenghua Xu <xuchenghua@loongson.cn>
+
+ * gcc.target/loongarch/pr106459.c: New test.
+
+2022-08-24 Andrew Pinski <apinski@marvell.com>
+
+ * lib/target-supports.exp (check_effective_target_bswap):
+ Return true if riscv and ZBB ISA extension is enabled.
+
+2022-08-24 Andrew Pinski <apinski@marvell.com>
+
+ PR target/106601
+ * gcc.target/riscv/zbb_32_bswap-2.c: New test.
+ * gcc.target/riscv/zbb_bswap-2.c: New test.
+
+2022-08-24 Andrew Pinski <apinski@marvell.com>
+
+ PR target/106600
+ * gcc.target/riscv/zbb_32_bswap-1.c: New test.
+ * gcc.target/riscv/zbb_bswap-1.c: New test.
+
+2022-08-24 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/103694
+ * gfortran.dg/pr103694.f90: New test.
+
+2022-08-24 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/torture/dfp-default-init-1.c,
+ gcc.dg/torture/dfp-default-init-2.c,
+ gcc.dg/torture/dfp-default-init-3.c: New tests.
+
+2022-08-24 Jose E. Marchesi <jose.marchesi@oracle.com>
+
+ PR target/106733
+ * gcc.target/bpf/constant-calls.c: Rename to ...
+ * gcc.target/bpf/constant-calls-1.c: and modify to not expect
+ failure anymore.
+ * gcc.target/bpf/constant-calls-2.c: New test.
+
+2022-08-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/106721
+ * gcc.target/i386/avx512vl-pr106721.c: New test.
+
+2022-08-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/106646
+ * g++.dg/cpp/warning-1.C: New test.
+ * g++.dg/cpp/warning-2.C: New test.
+ * g++.dg/cpp/warning-3.C: New test.
+
+2022-08-24 Lulu Cheng <chenglulu@loongson.cn>
+
+ * gcc.target/loongarch/func-call-medium-1.c: New test.
+ * gcc.target/loongarch/func-call-medium-2.c: New test.
+ * gcc.target/loongarch/func-call-medium-3.c: New test.
+ * gcc.target/loongarch/func-call-medium-4.c: New test.
+ * gcc.target/loongarch/func-call-medium-5.c: New test.
+ * gcc.target/loongarch/func-call-medium-6.c: New test.
+ * gcc.target/loongarch/func-call-medium-7.c: New test.
+ * gcc.target/loongarch/func-call-medium-8.c: New test.
+ * gcc.target/loongarch/tls-gd-noplt.c: Add compile parameter '-mexplicit-relocs'.
+
+2022-08-23 Marek Polacek <polacek@redhat.com>
+
+ * g++.dg/cpp0x/Wpessimizing-move10.C: New test.
+ * g++.dg/cpp0x/Wredundant-move12.C: New test.
+
+2022-08-23 H.J. Lu <hjl.tools@gmail.com>
+
+ * gcc.target/x86_64/abi/bf16/asm-support.S: Replace vmovdqu with
+ movdqu.
+
+2022-08-23 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106722
+ * g++.dg/uninit-pr106722-1.C: New testcase.
+
+2022-08-23 Marek Polacek <polacek@redhat.com>
+
+ * g++.dg/torture/phi-1.C: New test.
+
+2022-08-23 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/uninit-pred-10.c: New testcase.
+
+2022-08-23 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/gomp/depend-6.f90: Fix array index use for
+ depobj var + update scan-tree-dump-times.
+
+2022-08-23 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/gomp/depend-4.f90: Fix array index use for
+ depobj var + update scan-tree-dump-times.
+
+2022-08-23 Haochen Jiang <haochen.jiang@intel.com>
+
+ * gcc.target/x86_64/abi/bf16/bf16-helper.h:
+ Add _m128bf16/m256bf16/_m512bf16.
+ * gcc.target/x86_64/abi/bf16/m512bf16/bf16-zmm-check.h:
+ Include bf16-helper.h.
+
+2022-08-23 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/106687
+ * g++.dg/pr106687.C: New.
+
+2022-08-22 Dimitar Dimitrov <dimitar@dinux.eu>
+
+ * gcc.target/pru/bitop-di.c: New test.
+
+2022-08-22 Dimitar Dimitrov <dimitar@dinux.eu>
+
+ * gcc.target/pru/mov-m1.c: New test.
+
+2022-08-22 Dimitar Dimitrov <dimitar@dinux.eu>
+
+ PR target/106564
+ * gcc.target/pru/pr106564-1.c: New test.
+ * gcc.target/pru/pr106564-2.c: New test.
+ * gcc.target/pru/pr106564-3.c: New test.
+ * gcc.target/pru/pr106564-4.c: New test.
+
+2022-08-22 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/106557
+ * gfortran.dg/pr106557.f90: New test.
+
+2022-08-22 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/105937
+ * g++.dg/uninit-pr105937.C: New testcase.
+
+2022-08-20 Lulu Cheng <chenglulu@loongson.cn>
+
+ * gcc.target/loongarch/func-call-1.c: Add option '-mcmodel=normal'.
+ * gcc.target/loongarch/func-call-2.c: Likewise.
+ * gcc.target/loongarch/func-call-3.c: Likewise.
+ * gcc.target/loongarch/func-call-4.c: Likewise.
+ * gcc.target/loongarch/func-call-5.c: Likewise.
+ * gcc.target/loongarch/func-call-6.c: Likewise.
+ * gcc.target/loongarch/func-call-7.c: Likewise.
+ * gcc.target/loongarch/func-call-8.c: Likewise.
+ * gcc.target/loongarch/relocs-symbol-noaddend.c: Likewise.
+ * gcc.target/loongarch/func-call-extreme-1.c: New test.
+ * gcc.target/loongarch/func-call-extreme-2.c: New test.
+
+2022-08-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/106645
+ * c-c++-common/cpp/delimited-escape-seq-1.c: New test.
+ * c-c++-common/cpp/delimited-escape-seq-2.c: New test.
+ * c-c++-common/cpp/delimited-escape-seq-3.c: New test.
+ * c-c++-common/Wbidi-chars-24.c: New test.
+ * gcc.dg/cpp/delimited-escape-seq-1.c: New test.
+ * gcc.dg/cpp/delimited-escape-seq-2.c: New test.
+ * g++.dg/cpp/delimited-escape-seq-1.C: New test.
+ * g++.dg/cpp/delimited-escape-seq-2.C: New test.
+
+2022-08-19 Haochen Jiang <haochen.jiang@intel.com>
+
+ * gcc.target/x86_64/abi/bf16/abi-bf16.exp: New test.
+ * gcc.target/x86_64/abi/bf16/args.h: Ditto.
+ * gcc.target/x86_64/abi/bf16/asm-support.S: Ditto.
+ * gcc.target/x86_64/abi/bf16/bf16-check.h: Ditto.
+ * gcc.target/x86_64/abi/bf16/bf16-helper.h: Ditto.
+ * gcc.target/x86_64/abi/bf16/defines.h: Ditto.
+ * gcc.target/x86_64/abi/bf16/m256bf16/abi-bf16-ymm.exp: Ditto.
+ * gcc.target/x86_64/abi/bf16/m256bf16/args.h: Ditto.
+ * gcc.target/x86_64/abi/bf16/m256bf16/asm-support.S: Ditto.
+ * gcc.target/x86_64/abi/bf16/m256bf16/bf16-ymm-check.h: Ditto.
+ * gcc.target/x86_64/abi/bf16/m256bf16/test_m256_returning.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/m256bf16/test_passing_m256.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/m256bf16/test_passing_structs.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/m256bf16/test_passing_unions.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/m256bf16/test_varargs-m256.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/m512bf16/abi-bf16-zmm.exp: Ditto.
+ * gcc.target/x86_64/abi/bf16/m512bf16/args.h: Ditto.
+ * gcc.target/x86_64/abi/bf16/m512bf16/asm-support.S: Ditto.
+ * gcc.target/x86_64/abi/bf16/m512bf16/bf16-zmm-check.h: Ditto.
+ * gcc.target/x86_64/abi/bf16/m512bf16/test_m512_returning.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/m512bf16/test_passing_m512.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/m512bf16/test_passing_structs.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/m512bf16/test_passing_unions.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/m512bf16/test_varargs-m512.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/macros.h: Ditto.
+ * gcc.target/x86_64/abi/bf16/test_3_element_struct_and_unions.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/test_basic_alignment.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/test_basic_array_size_and_align.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/test_basic_returning.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/test_basic_sizes.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/test_basic_struct_size_and_align.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/test_basic_union_size_and_align.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/test_m128_returning.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/test_passing_floats.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/test_passing_m128.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/test_passing_structs.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/test_passing_unions.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/test_struct_returning.c: Ditto.
+ * gcc.target/x86_64/abi/bf16/test_varargs-m128.c: Ditto.
+
+2022-08-18 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/cpp/c11-warning-1.c, gcc.dg/cpp/c11-warning-2.c,
+ gcc.dg/cpp/c11-warning-3.c, gcc.dg/cpp/c11-warning-4.c,
+ gcc.dg/cpp/c2x-warning-1.c, gcc.dg/cpp/c2x-warning-2.c,
+ gcc.dg/cpp/gnu11-warning-1.c, gcc.dg/cpp/gnu11-warning-2.c,
+ gcc.dg/cpp/gnu11-warning-3.c, gcc.dg/cpp/gnu11-warning-4.c,
+ gcc.dg/cpp/gnu2x-warning-1.c, gcc.dg/cpp/gnu2x-warning-2.c: New
+ tests.
+
+2022-08-18 Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
+
+ * gcc.target/xtensa/sibcalls.c: Add a new test function to ensure
+ that registers for arguments (occupy from A2 to A7) and for indirect
+ sibcall (should be assigned to A8) neither conflict nor spill out.
+
+2022-08-18 Harald Anlauf <anlauf@gmx.de>
+
+ Revert:
+ 2022-08-18 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/77652
+ * gfortran.dg/associated_target_9a.f90: New test.
+ * gfortran.dg/associated_target_9b.f90: New test.
+
+2022-08-18 Tim Lange <mail@tim-lange.me>
+
+ PR analyzer/106181
+ * gcc.dg/analyzer/allocation-size-1.c: New test.
+ * gcc.dg/analyzer/imprecise-floating-point-1.c: New test.
+ * gcc.dg/analyzer/pr106181.c: New test.
+
+2022-08-18 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/106617
+ * gcc.dg/pr106617.c: New testcase.
+
+2022-08-18 konglin1 <lingling.kong@intel.com>
+
+ * g++.target/i386/vect-bfloat16-1.C: New test.
+ * gcc.target/i386/vect-bfloat16-1.c: New test.
+ * gcc.target/i386/vect-bfloat16-2a.c: New test.
+ * gcc.target/i386/vect-bfloat16-2b.c: New test.
+ * gcc.target/i386/vect-bfloat16-typecheck_1.c: New test.
+ * gcc.target/i386/vect-bfloat16-typecheck_2.c: New test.
+
+2022-08-18 Haochen Gui <guihaoc@gcc.gnu.org>
+
+ PR target/103109
+ * gcc.target/powerpc/pr103109.h: New.
+ * gcc.target/powerpc/pr103109-1.c: New.
+ * gcc.target/powerpc/pr103109-2.c: New.
+
+2022-08-18 Lulu Cheng <chenglulu@loongson.cn>
+
+ * gcc.target/loongarch/tls-gd-noplt.c: New test.
+
+2022-08-17 Maciej W. Rozycki <macro@embecosm.com>
+
+ * gcc.target/riscv/fmax-snan.c: Add `dg-require-effective-target
+ hard_float'.
+ * gcc.target/riscv/fmaxf-snan.c: Likewise.
+ * gcc.target/riscv/fmin-snan.c: Likewise.
+ * gcc.target/riscv/fminf-snan.c: Likewise.
+
+2022-08-17 Marek Polacek <polacek@redhat.com>
+
+ PR c++/67906
+ * g++.dg/cpp0x/Wredundant-move11.C: New test.
+
+2022-08-17 Marek Polacek <polacek@redhat.com>
+
+ PR c++/90428
+ * g++.dg/cpp0x/Wredundant-move1.C: Adjust dg-warning.
+ * g++.dg/cpp0x/Wredundant-move9.C: Likewise.
+ * g++.dg/cpp0x/Wredundant-move10.C: New test.
+
+2022-08-17 Marek Polacek <polacek@redhat.com>
+
+ PR c++/89780
+ * g++.dg/cpp0x/Wpessimizing-move3.C: Remove dg-warning.
+ * g++.dg/cpp0x/Wredundant-move2.C: Likewise.
+ * g++.dg/cpp0x/Wpessimizing-move9.C: New file.
+
+2022-08-17 Marek Polacek <polacek@redhat.com>
+
+ PR c++/106276
+ * g++.dg/cpp0x/Wpessimizing-move7.C: Add dg-warning.
+ * g++.dg/cpp0x/Wpessimizing-move8.C: New test.
+
+2022-08-17 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/106566
+ * gfortran.dg/gomp/declare-simd-4.f90: New test.
+ * gfortran.dg/gomp/declare-simd-5.f90: New test.
+ * gfortran.dg/gomp/declare-simd-6.f90: New test.
+
+2022-08-17 Tobias Burnus <tobias@codesourcery.com>
+ Chung-Lin Tang <cltang@codesourcery.com>
+
+ PR c++/104493
+ * g++.dg/gomp/unmappable-1.C: Remove dg-error; remove dg-note no
+ longer shown as TYPE_MAIN_DECL is NULL.
+ * c-c++-common/gomp/map-incomplete-type.c: New test.
+
+2022-08-17 Xi Ruoyao <xry111@xry111.site>
+
+ * gcc.target/loongarch/fmax-fmin.c: New test.
+
+2022-08-16 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/warn/Wstringop-overflow-4.C: Only xfail for C++98.
+ * g++.target/i386/bfloat_cpp_typecheck.C: Remove xfail.
+
+2022-08-16 Tom Honermann <tom@honermann.net>
+
+ PR c++/106423
+ * g++.dg/cpp0x/keywords2.C: New test.
+ * g++.dg/cpp2a/keywords2.C: New test.
+
+2022-08-16 Kito Cheng <kito.cheng@sifive.com>
+
+ * gcc.target/riscv/_Float16-zfh-1.c: New.
+ * gcc.target/riscv/_Float16-zfh-2.c: Ditto.
+ * gcc.target/riscv/_Float16-zfh-3.c: Ditto.
+ * gcc.target/riscv/_Float16-zfhmin-1.c: Ditto.
+ * gcc.target/riscv/_Float16-zfhmin-2.c: Ditto.
+ * gcc.target/riscv/_Float16-zfhmin-3.c: Ditto.
+ * gcc.target/riscv/arch-16.c: Ditto.
+ * gcc.target/riscv/arch-17.c: Ditto.
+ * gcc.target/riscv/predef-21.c: Ditto.
+ * gcc.target/riscv/predef-22.c: Ditto.
+
+2022-08-16 Kito Cheng <kito.cheng@sifive.com>
+
+ * g++.target/riscv/_Float16.C: New.
+ * gcc.target/riscv/_Float16-soft-1.c: Ditto.
+ * gcc.target/riscv/_Float16-soft-2.c: Ditto.
+ * gcc.target/riscv/_Float16-soft-3.c: Ditto.
+ * gcc.target/riscv/_Float16-soft-4.c: Ditto.
+ * gcc.target/riscv/_Float16.c: Ditto.
+
+2022-08-16 Jakub Jelinek <jakub@redhat.com>
+
+ * g++.dg/cpp2a/volatile1.C: Adjust for de-deprecation of volatile
+ compound |=, &= and ^= operations.
+ * g++.dg/cpp2a/volatile3.C: Likewise.
+ * g++.dg/cpp2a/volatile5.C: Likewise.
+
+2022-08-16 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/106630
+ * gcc.dg/torture/pr106630.c: New testcase.
+
+2022-08-16 Kewen.Lin <linkw@gcc.gnu.org>
+
+ PR target/103353
+ * gcc.target/powerpc/pr103353.c: New test.
+
+2022-08-16 Kewen Lin <linkw@linux.ibm.com>
+
+ PR tree-optimization/106322
+ * gcc.target/i386/pr106322.c: New test.
+ * gcc.target/powerpc/pr106322.c: New test.
+
+2022-08-15 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/106623
+ * gdc.dg/torture/pr106623.d: New test.
+
+2022-08-15 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/106626
+ * gcc.dg/analyzer/out-of-bounds-read-char-arr.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-read-int-arr.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-write-char-arr.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-write-int-arr.c: New test.
+
+2022-08-15 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/106621
+ * gcc.dg/pr106621.c
+
+2022-08-15 Immad Mir <mirimmad@outlook.com>
+
+ PR analyzer/106551
+ * gcc.dg/analyzer/fd-dup-1.c: New testcase.
+
+2022-08-15 Roger Sayle <roger@nextmovesoftware.com>
+
+ * gcc.target/i386/sse4_1-stv-9.c: New test case.
+
+2022-08-15 Roger Sayle <roger@nextmovesoftware.com>
+
+ PR tree-optimization/64992
+ * gcc.dg/pr64992.c: New test case.
+
+2022-08-15 Roger Sayle <roger@nextmovesoftware.com>
+ Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/71343
+ * gcc.dg/pr71343-1.c: New test case.
+
+2022-08-15 Nathan Sidwell <nathan@acm.org>
+
+ * g++.dg/modules/loc-prune-4.C: Adjust regexp
+
+2022-08-15 Marek Polacek <polacek@redhat.com>
+
+ PR c++/106276
+ * g++.dg/cpp0x/Wpessimizing-move7.C: New test.
+
+2022-08-15 Alexandre Oliva <oliva@adacore.com>
+
+ * g++.dg/abi/anon1.C: Disable pie on ia32.
+ * g++.dg/abi/anon4.C: Likewise.
+ * g++.dg/cpp0x/initlist-const1.C: Likewise.
+ * g++.dg/no-stack-protector-attr-3.C: Likewise.
+ * g++.dg/stackprotectexplicit2.C: Likewise.
+ * g++.dg/pr71694.C: Likewise.
+ * gcc.dg/pr102892-1.c: Likewise.
+ * gcc.dg/sibcall-11.c: Likewise.
+ * gcc.dg/torture/builtin-self.c: Likewise.
+ * gcc.target/i386/avx2-dest-false-dep-for-glc.c: Likewise.
+ * gcc.target/i386/avx512bf16-cvtsbh2ss-1.c: Likewise.
+ * gcc.target/i386/avx512f-broadcast-pr87767-1.c: Likewise.
+ * gcc.target/i386/avx512f-broadcast-pr87767-3.c: Likewise.
+ * gcc.target/i386/avx512f-broadcast-pr87767-5.c: Likewise.
+ * gcc.target/i386/avx512f-broadcast-pr87767-7.c: Likewise.
+ * gcc.target/i386/avx512fp16-broadcast-1.c: Likewise.
+ * gcc.target/i386/avx512fp16-pr101846.c: Likewise.
+ * gcc.target/i386/avx512vl-broadcast-pr87767-1.c: Likewise.
+ * gcc.target/i386/avx512vl-broadcast-pr87767-3.c: Likewise.
+ * gcc.target/i386/avx512vl-broadcast-pr87767-5.c: Likewise.
+ * gcc.target/i386/pr100865-2.c: Likewise.
+ * gcc.target/i386/pr100865-3.c: Likewise.
+ * gcc.target/i386/pr100865-4a.c: Likewise.
+ * gcc.target/i386/pr100865-4b.c: Likewise.
+ * gcc.target/i386/pr100865-5a.c: Likewise.
+ * gcc.target/i386/pr100865-5b.c: Likewise.
+ * gcc.target/i386/pr100865-6a.c: Likewise.
+ * gcc.target/i386/pr100865-6b.c: Likewise.
+ * gcc.target/i386/pr100865-6c.c: Likewise.
+ * gcc.target/i386/pr100865-7b.c: Likewise.
+ * gcc.target/i386/pr101796-1.c: Likewise.
+ * gcc.target/i386/pr101846-2.c: Likewise.
+ * gcc.target/i386/pr101989-broadcast-1.c: Likewise.
+ * gcc.target/i386/pr102021.c: Likewise.
+ * gcc.target/i386/pr90773-17.c: Likewise.
+ * gcc.target/i386/pr54855-3.c: Likewise.
+ * gcc.target/i386/pr54855-7.c: Likewise.
+ * gcc.target/i386/pr15184-1.c: Likewise.
+ * gcc.target/i386/pr15184-2.c: Likewise.
+ * gcc.target/i386/pr27971.c: Likewise.
+ * gcc.target/i386/pr70263-2.c: Likewise.
+ * gcc.target/i386/pr78035.c: Likewise.
+ * gcc.target/i386/pr81736-5.c: Likewise.
+ * gcc.target/i386/pr81736-7.c: Likewise.
+ * gcc.target/i386/pr85620-6.c: Likewise.
+ * gcc.target/i386/pr85667-6.c: Likewise.
+ * gcc.target/i386/pr93492-5.c: Likewise.
+ * gcc.target/i386/pr96539.c: Likewise.
+ PR target/81708 (%gs:my_guard)
+ * gcc.target/i386/stack-prot-sym.c: Likewise.
+ * g++.dg/init/static-cdtor1.C: Add alternate patterns for PIC.
+ * gcc.target/i386/avx512fp16-vcvtsh2si-1a.c: Extend patterns
+ for PIC/PIE register allocation.
+ * gcc.target/i386/pr100704-3.c: Likewise.
+ * gcc.target/i386/avx512fp16-vcvtsh2usi-1a.c: Likewise.
+ * gcc.target/i386/avx512fp16-vcvttsh2si-1a.c: Likewise.
+ * gcc.target/i386/avx512fp16-vcvttsh2usi-1a.c: Likewise.
+ * gcc.target/i386/avx512fp16-vmovsh-1a.c: Likewise.
+ * gcc.target/i386/interrupt-11.c: Likewise, allowing for
+ preservation of the PIC register.
+ * gcc.target/i386/interrupt-12.c: Likewise.
+ * gcc.target/i386/interrupt-13.c: Likewise.
+ * gcc.target/i386/interrupt-15.c: Likewise.
+ * gcc.target/i386/interrupt-16.c: Likewise.
+ * gcc.target/i386/interrupt-17.c: Likewise.
+ * gcc.target/i386/interrupt-8.c: Likewise.
+ * gcc.target/i386/cet-sjlj-6a.c: Combine patterns from
+ previous change.
+ * gcc.target/i386/cet-sjlj-6b.c: Likewise.
+ * gcc.target/i386/pad-10.c: Accept insns in get_pc_thunk.
+ * gcc.target/i386/pr70321.c: Likewise.
+ * gcc.target/i386/pr81563.c: Likewise.
+ * gcc.target/i386/pr84278.c: Likewise.
+ * gcc.target/i386/pr90773-2.c: Likewise, plus extra loads from
+ the GOT.
+ * gcc.target/i386/pr90773-3.c: Likewise.
+ * gcc.target/i386/pr94913-2.c: Accept additional PIC insns.
+ * gcc.target/i386/stack-check-17.c: Likewise.
+ * gcc.target/i386/stack-check-12.c: Do not require dummy stack
+ probing obviated with PIC.
+ * gcc.target/i386/pr95126-m32-1.c: Expect missed optimization
+ with PIC.
+ * gcc.target/i386/pr95126-m32-2.c: Likewise.
+ * gcc.target/i386/pr95852-2.c: Accept different optimization
+ with PIC.
+ * gcc.target/i386/pr95852-4.c: Likewise.
+
+2022-08-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/106590
+ * gcc.dg/torture/pr106590.c: New test.
+
+2022-08-15 konglin1 <lingling.kong@intel.com>
+
+ * g++.target/i386/bfloat_cpp_typecheck.C: New test.
+ * gcc.target/i386/bfloat16-1.c: Ditto.
+ * gcc.target/i386/sse2-bfloat16-1.c: Ditto.
+ * gcc.target/i386/sse2-bfloat16-2.c: Ditto.
+ * gcc.target/i386/sse2-bfloat16-scalar-typecheck.c: Ditto.
+
+2022-08-13 Tim Lange <mail@tim-lange.me>
+
+ * gcc.dg/analyzer/torture/pr93451.c:
+ Disable Wanalyzer-out-of-bounds.
+
+2022-08-12 Jan Hubicka <hubicka@ucw.cz>
+
+ PR middle-end/106057
+ * g++.dg/tree-ssa/pr101839.C: New test.
+
+2022-08-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/106506
+ * g++.dg/opt/pr94589-2.C: New test.
+
+2022-08-12 Tamar Christina <tamar.christina@arm.com>
+
+ PR target/106524
+ * gcc.target/aarch64/sve/pr106524.c: New test.
+
+2022-08-12 Tim Lange <mail@tim-lange.me>
+
+ PR analyzer/106000
+ * g++.dg/analyzer/pr100244.C: Disable out-of-bounds warning.
+ * gcc.dg/analyzer/allocation-size-3.c:
+ Disable out-of-bounds warning.
+ * gcc.dg/analyzer/memcpy-2.c: Disable out-of-bounds warning.
+ * gcc.dg/analyzer/pr101962.c: Add dg-warning.
+ * gcc.dg/analyzer/pr96764.c: Disable out-of-bounds warning.
+ * gcc.dg/analyzer/pr97029.c:
+ Add dummy buffer to prevent an out-of-bounds warning.
+ * gcc.dg/analyzer/realloc-5.c: Add dg-warning.
+ * gcc.dg/analyzer/test-setjmp.h:
+ Add dummy buffer to prevent an out-of-bounds warning.
+ * gcc.dg/analyzer/zlib-3.c: Add dg-bogus.
+ * g++.dg/analyzer/out-of-bounds-placement-new.C: New test.
+ * gcc.dg/analyzer/out-of-bounds-1.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-2.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-3.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-container_of.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-coreutils.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-curl.c: New test.
+
+2022-08-12 Tim Lange <mail@tim-lange.me>
+
+ PR analyzer/106539
+ * gcc.dg/analyzer/pr106539.c: New test.
+ * gcc.dg/analyzer/realloc-5.c: New test.
+
+2022-08-11 David Edelsohn <dje.gcc@gmail.com>
+
+ * gcc.dg/analyzer/fd-4.c: Define _MODE_T on AIX.
+
+2022-08-11 David Edelsohn <dje.gcc@gmail.com>
+
+ * g++.dg/cpp0x/initlist-const1.C: XFAIL on AIX.
+
+2022-08-11 Immad Mir <mirimmad@outlook.com>
+
+ * gcc.dg/analyzer/fd-dup-1.c: New testcases.
+ * gcc.dg/analyzer/fd-uninit-1.c: Remove bogus
+ warning.
+
+2022-08-11 Marek Polacek <polacek@redhat.com>
+
+ PR middle-end/102633
+ * c-c++-common/Winit-self1.c: New test.
+ * c-c++-common/Winit-self2.c: New test.
+
+2022-08-11 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106514
+ * gcc.dg/tree-ssa/ssa-thread-19.c: Un-XFAIL.
+ * gcc.dg/tree-ssa/ssa-thread-20.c: New testcase.
+
+2022-08-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/106243
+ * gcc.dg/pr106243.c: Add -Wno-psabi to dg-options.
+ * gcc.dg/pr106243-1.c: Likewise.
+
+2022-08-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/104992
+ * gcc.dg/pr104992.c: Add -Wno-psabi to dg-options.
+ * g++.dg/pr104992-1.C: Likewise. Add space between " and } in
+ dg-options.
+
+2022-08-11 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/ssa-thread-18.c: New testcase.
+ * gcc.dg/tree-ssa/ssa-thread-19.c: Likewise, but XFAILed.
+
+2022-08-10 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106513
+ * gcc.dg/torture/pr106513.c: New testcase.
+
+2022-08-10 Roger Sayle <roger@nextmovesoftware.com>
+
+ PR other/106575
+ * gcc.dg/fold-eqandshift-4.c: Use "signed char" explicitly.
+
+2022-08-09 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/106573
+ * gcc.dg/analyzer/error-uninit.c: New test.
+ * gcc.dg/analyzer/fd-uninit-1.c: New test.
+ * gcc.dg/analyzer/file-uninit-1.c: New test.
+
+2022-08-09 Roger Sayle <roger@nextmovesoftware.com>
+
+ * gcc.target/i386/sse4_1-stv-8.c: New test case.
+
+2022-08-09 Roger Sayle <roger@nextmovesoftware.com>
+ Richard Biener <rguenther@suse.de>
+
+ PR middle-end/21137
+ PR tree-optimization/98954
+ * gcc.dg/fold-eqandshift-4.c: New test case.
+
+2022-08-09 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/106563
+ * gdc.dg/torture/torture.exp (srcdir): New proc.
+ * gdc.dg/torture/imports/pr106563math.d: New test.
+ * gdc.dg/torture/imports/pr106563regex.d: New test.
+ * gdc.dg/torture/imports/pr106563uni.d: New test.
+ * gdc.dg/torture/pr106563.d: New test.
+
+2022-08-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106514
+ * gcc.dg/tree-ssa/ssa-thread-16.c: New testcase.
+ * gcc.dg/tree-ssa/ssa-thread-17.c: Likewise.
+ * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Adjust.
+
+2022-08-09 Tobias Burnus <tobias@codesourcery.com>
+
+ PR middle-end/106492
+ * g++.dg/gomp/pr106492.C: New test.
+
+2022-08-08 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/106556
+ * gfortran.dg/pr106556.f90: New.
+
+2022-08-08 Tom Honermann <tom@honermann.net>
+
+ PR preprocessor/106426
+ * g++.dg/ext/char8_t-char-literal-1.C: Check signedness of u8 literals.
+ * g++.dg/ext/char8_t-char-literal-2.C: Check signedness of u8 literals.
+
+2022-08-08 Tom Honermann <tom@honermann.net>
+
+ * gcc.dg/atomic/c2x-stdatomic-lockfree-char8_t.c: New test.
+ * gcc.dg/atomic/gnu2x-stdatomic-lockfree-char8_t.c: New test.
+ * gcc.dg/c11-utf8str-type.c: New test.
+ * gcc.dg/c17-utf8str-type.c: New test.
+ * gcc.dg/c2x-utf8str-type.c: New test.
+ * gcc.dg/c2x-utf8str.c: New test.
+ * gcc.dg/gnu2x-utf8str-type.c: New test.
+ * gcc.dg/gnu2x-utf8str.c: New test.
+
+2022-08-08 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/106555
+ * gdc.dg/imports/pr106555.d: New test.
+ * gdc.dg/pr106555.d: New test.
+
+2022-08-08 Andrew Pinski <apinski@marvell.com>
+
+ * gcc.dg/pr87052.c: Update d var to expect nothing.
+
+2022-08-08 Andrew Pinski <apinski@marvell.com>
+
+ * gcc.dg/tree-ssa/pr93776.c: Moved to...
+ * gcc.c-torture/compile/pr93776.c: ...here.
+
+2022-08-07 Roger Sayle <roger@nextmovesoftware.com>
+
+ * gcc.target/i386/cmpti2.c: Add -mno-stv to dg-options.
+
+2022-08-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/88174
+ * g++.dg/cpp1y/constexpr-complex1.C: New test.
+
+2022-08-07 Roger Sayle <roger@nextmovesoftware.com>
+
+ * gcc.target/i386/cmpti1.c: New test case.
+ * gcc.target/i386/cmpti2.c: Likewise.
+ * gcc.target/i386/cmpti3.c: Likewise.
+
+2022-08-05 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/105947
+ * gcc.dg/analyzer/function-ptr-5.c: New test.
+
+2022-08-05 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106533
+ * gcc.dg/tree-ssa/ldist-39.c: New testcase.
+
+2022-08-05 Haochen Gui <guihaoc@gcc.gnu.org>
+
+ * lib/target-supports.exp (check_p9modulo_hw_available): Correct return
+ value.
+
+2022-08-04 Tamar Christina <tamar.christina@arm.com>
+
+ * gcc.dg/subnot.c: New test.
+
+2022-08-04 Tamar Christina <tamar.christina@arm.com>
+
+ PR middle-end/106519
+ * gcc.dg/pr106519.c: New test.
+
+2022-08-04 Sam Feifer <sfeifer@redhat.com>
+
+ PR tree-optimization/106243
+ * gcc.dg/pr106243-1.c: New test.
+ * gcc.dg/pr106243.c: New test.
+
+2022-08-04 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106521
+ * gcc.dg/torture/pr106521.c: New testcase.
+
+2022-08-03 Jose E. Marchesi <jose.marchesi@oracle.com>
+
+ PR testsuite/106515
+ * gcc.dg/debug/btf/btf-int-1.c: Fix regexps in
+ scan-assembler-times.
+
+2022-08-03 Tamar Christina <tamar.christina@arm.com>
+
+ * gcc.dg/tree-ssa/split-path-1.c: Disable phi-opts so we don't optimize
+ code away.
+ * gcc.dg/tree-ssa/minmax-10.c: New test.
+ * gcc.dg/tree-ssa/minmax-11.c: New test.
+ * gcc.dg/tree-ssa/minmax-12.c: New test.
+ * gcc.dg/tree-ssa/minmax-13.c: New test.
+ * gcc.dg/tree-ssa/minmax-14.c: New test.
+ * gcc.dg/tree-ssa/minmax-15.c: New test.
+ * gcc.dg/tree-ssa/minmax-16.c: New test.
+ * gcc.dg/tree-ssa/minmax-3.c: New test.
+ * gcc.dg/tree-ssa/minmax-4.c: New test.
+ * gcc.dg/tree-ssa/minmax-5.c: New test.
+ * gcc.dg/tree-ssa/minmax-6.c: New test.
+ * gcc.dg/tree-ssa/minmax-7.c: New test.
+ * gcc.dg/tree-ssa/minmax-8.c: New test.
+ * gcc.dg/tree-ssa/minmax-9.c: New test.
+
+2022-08-03 Roger Sayle <roger@nextmovesoftware.com>
+ Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/47949
+ * gcc.target/i386/pr47949.c: New test case.
+
+2022-08-03 Roger Sayle <roger@nextmovesoftware.com>
+
+ * gcc.target/i386/sse4_1-stv-7.c: New test case.
+
+2022-08-02 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/106510
+ * gcc.dg/pr106510.c: New.
+
+2022-08-02 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/tree-ssa/vrp-float-1.c: Adjust test so it passes.
+
+2022-08-02 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/106474
+ * g++.dg/pr106474.C: New.
+
+2022-08-02 Jose E. Marchesi <jose.marchesi@oracle.com>
+
+ * gcc.dg/debug/btf/btf-int-1.c: Do not check for char bits in
+ bti_encoding and check for bool bits.
+
+2022-08-02 Immad Mir <mirimmad@outlook.com>
+
+ PR analyzer/106298
+ * gcc.dg/analyzer/fd-1.c: Add tests for 'creat'.
+ * gcc.dg/analyzer/fd-2.c: Likewise.
+ * gcc.dg/analyzer/fd-4.c: Likewise.
+ * gcc.dg/analyzer/fd-dup-1.c: New tests.
+
+2022-08-02 Aldy Hernandez <aldyh@redhat.com>
+
+ * g++.dg/opt/pr94589-2.C: XFAIL.
+ * gcc.dg/tree-ssa/vrp-float-1.c: New test.
+ * gcc.dg/tree-ssa/vrp-float-11.c: New test.
+ * gcc.dg/tree-ssa/vrp-float-3.c: New test.
+ * gcc.dg/tree-ssa/vrp-float-4.c: New test.
+ * gcc.dg/tree-ssa/vrp-float-6.c: New test.
+ * gcc.dg/tree-ssa/vrp-float-7.c: New test.
+ * gcc.dg/tree-ssa/vrp-float-8.c: New test.
+
+2022-08-02 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106497
+ * gcc.dg/torture/pr106497.c: New testcase.
+
+2022-08-01 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.target/i386/addr-space-typeck-1.c: New test.
+ * gcc.target/i386/addr-space-typeck-2.c: New test.
+
+2022-08-01 Roger Sayle <roger@nextmovesoftware.com>
+ Uroš Bizjak <ubizjak@gmail.com>
+
+ PR target/106481
+ * gcc.target/i386/pr106481.c: New test case.
+
+2022-08-01 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/83782
+ * gcc.target/i386/pr83782-1.c: Require non-ia32.
+ * gcc.target/i386/pr83782-2.c: Likewise.
+ * gcc.target/i386/pr83782-3.c: New test.
+
+2022-08-01 Jose E. Marchesi <jose.marchesi@oracle.com>
+
+ PR debug/106263
+ * gcc.dg/debug/btf/btf-function-4.c: New test.
+ * gcc.dg/debug/btf/btf-function-5.c: Likewise.
+
+2022-08-01 Sam Feifer <sfeifer@redhat.com>
+
+ PR tree-optimization/104992
+ * g++.dg/pr104992-1.C: New test.
+ * gcc.dg/pr104992.c: New test.
+
+2022-07-31 Roger Sayle <roger@nextmovesoftware.com>
+ H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/106450
+ * gcc.target/i386/pr106450.c: New test case.
+
+2022-07-31 Harald Anlauf <anlauf@gmx.de>
+ Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/92805
+ * gfortran.dg/literal_constants.f: New test.
+ * gfortran.dg/literal_constants.f90: New test.
+
+2022-07-31 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/77652
+ * gfortran.dg/associated_target_9a.f90: New test.
+ * gfortran.dg/associated_target_9b.f90: New test.
+
+2022-07-31 Lewis Hyatt <lhyatt@gmail.com>
+
+ PR c++/66290
+ * c-c++-common/pragma-diag-15.c: Remove xfail for C++.
+
+2022-07-31 Jason Merrill <jason@redhat.com>
+
+ PR c++/106369
+ * g++.dg/cpp1z/constexpr-lambda27.C: New test.
+
+2022-07-29 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/gomp/declare-simd-3.f90: New test.
+
+2022-07-29 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106422
+ * gcc.dg/torture/pr106422.c: New testcase.
+
+2022-07-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/106448
+ * c-c++-common/gomp/atomic-32.c: New test.
+
+2022-07-28 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/105893
+ * gcc.dg/analyzer/putenv-1.c: New test.
+
+2022-07-28 Maciej W. Rozycki <macro@embecosm.com>
+
+ * gcc.target/riscv/fle-ieee.c: New test.
+ * gcc.target/riscv/fle-snan.c: New test.
+ * gcc.target/riscv/fle.c: New test.
+ * gcc.target/riscv/flef-ieee.c: New test.
+ * gcc.target/riscv/flef-snan.c: New test.
+ * gcc.target/riscv/flef.c: New test.
+ * gcc.target/riscv/flt-ieee.c: New test.
+ * gcc.target/riscv/flt-snan.c: New test.
+ * gcc.target/riscv/flt.c: New test.
+ * gcc.target/riscv/fltf-ieee.c: New test.
+ * gcc.target/riscv/fltf-snan.c: New test.
+ * gcc.target/riscv/fltf.c: New test.
+
+2022-07-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/106099
+ * gcc.dg/ubsan/pr106099.c: New test.
+
+2022-07-27 Lewis Hyatt <lhyatt@gmail.com>
+
+ * c-c++-common/pragma-diag-14.c: New test.
+ * c-c++-common/pragma-diag-15.c: New test.
+
+2022-07-27 Immad Mir <mirimmad@outlook.com>
+
+ PR analyzer/106286
+ * gcc.dg/analyzer/fd-meaning.c: New test.
+
+2022-07-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/106261
+ * g++.dg/debug/pr106261.C: New test.
+
+2022-07-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/94920
+ * g++.dg/pr94920.C: Add -Wno-psabi to dg-options.
+ * g++.dg/pr94920-1.C: Add dg-additional-options -Wno-psabi.
+
+2022-07-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/106397
+ * gcc.dg/pr106397.c: For ia32, add dg-additional-options
+ -march=i686 -msse.
+
2022-07-26 David Malcolm <dmalcolm@redhat.com>
PR analyzer/106319
diff --git a/gcc/testsuite/c-c++-common/Waddress-7.c b/gcc/testsuite/c-c++-common/Waddress-7.c
new file mode 100644
index 0000000..1799485
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Waddress-7.c
@@ -0,0 +1,22 @@
+/* PR c/106947 */
+/* { dg-do compile } */
+/* { dg-options "-Waddress" } */
+
+#ifndef __cplusplus
+# define bool _Bool
+#endif
+
+#pragma GCC diagnostic ignored "-Waddress"
+int s; /* { dg-bogus "declared" } */
+bool e = &s;
+int
+main ()
+{
+ int error = 0;
+ {
+ bool e1 = &s;
+ if (!e1)
+ error = 1;
+ }
+ return error;
+}
diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-24.c b/gcc/testsuite/c-c++-common/Wbidi-chars-24.c
new file mode 100644
index 0000000..608a5d6
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wbidi-chars-24.c
@@ -0,0 +1,28 @@
+/* PR preprocessor/103026 */
+/* { dg-do compile } */
+/* { dg-options "-Wbidi-chars=ucn,unpaired" } */
+/* Test nesting of bidi chars in various contexts. */
+
+void
+g1 ()
+{
+ const char *s1 = "a b c LRE\u{202a} 1 2 3 PDI\u{00000000000000000000000002069} x y z";
+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
+ const char *s2 = "a b c RLE\u{00202b} 1 2 3 PDI\u{2069} x y z";
+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
+ const char *s3 = "a b c LRO\u{000000202d} 1 2 3 PDI\u{02069} x y z";
+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
+ const char *s4 = "a b c RLO\u{202e} 1 2 3 PDI\u{00000002069} x y z";
+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
+ const char *s5 = "a b c LRI\u{002066} 1 2 3 PDF\u{202C} x y z";
+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
+ const char *s6 = "a b c RLI\u{02067} 1 2 3 PDF\u{202c} x y z";
+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
+ const char *s7 = "a b c FSI\u{0002068} 1 2 3 PDF\u{0202c} x y z";
+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
+}
+
+int A\u{202a}B\u{2069}C;
+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
+int a\u{00000202b}B\u{000000002069}c;
+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-25.c b/gcc/testsuite/c-c++-common/Wbidi-chars-25.c
new file mode 100644
index 0000000..58d6a29
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wbidi-chars-25.c
@@ -0,0 +1,28 @@
+/* PR preprocessor/103026 */
+/* { dg-do compile } */
+/* { dg-options "-Wbidi-chars=ucn,unpaired" } */
+/* Test nesting of bidi chars in various contexts. */
+
+void
+g1 ()
+{
+ const char *s1 = "a b c LRE\N{LEFT-TO-RIGHT EMBEDDING} 1 2 3 PDI\N{POP DIRECTIONAL ISOLATE} x y z";
+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
+ const char *s2 = "a b c RLE\N{RIGHT-TO-LEFT EMBEDDING} 1 2 3 PDI\N{POP DIRECTIONAL ISOLATE} x y z";
+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
+ const char *s3 = "a b c LRO\N{LEFT-TO-RIGHT OVERRIDE} 1 2 3 PDI\N{POP DIRECTIONAL ISOLATE} x y z";
+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
+ const char *s4 = "a b c RLO\N{RIGHT-TO-LEFT OVERRIDE} 1 2 3 PDI\N{POP DIRECTIONAL ISOLATE} x y z";
+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
+ const char *s5 = "a b c LRI\N{LEFT-TO-RIGHT ISOLATE} 1 2 3 PDF\N{POP DIRECTIONAL FORMATTING} x y z";
+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
+ const char *s6 = "a b c RLI\N{RIGHT-TO-LEFT ISOLATE} 1 2 3 PDF\N{POP DIRECTIONAL FORMATTING} x y z";
+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
+ const char *s7 = "a b c FSI\N{FIRST STRONG ISOLATE} 1 2 3 PDF\N{POP DIRECTIONAL FORMATTING} x y z";
+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
+}
+
+int A\N{LEFT-TO-RIGHT EMBEDDING}B\N{POP DIRECTIONAL ISOLATE}C;
+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
+int a\N{RIGHT-TO-LEFT EMBEDDING}B\N{POP DIRECTIONAL ISOLATE}c;
+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/c-c++-common/Winit-self1.c b/gcc/testsuite/c-c++-common/Winit-self1.c
new file mode 100644
index 0000000..740b83b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Winit-self1.c
@@ -0,0 +1,31 @@
+/* PR middle-end/102633 */
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized -Wno-init-self" } */
+
+int
+fn1 (void)
+{
+ int i = i;
+ return i;
+}
+
+int
+fn2 ()
+{
+ const int j = j;
+ return j;
+}
+
+int
+fn3 ()
+{
+ volatile int k = k;
+ return k;
+}
+
+int
+fn4 ()
+{
+ const volatile int l = l;
+ return l;
+}
diff --git a/gcc/testsuite/c-c++-common/Winit-self2.c b/gcc/testsuite/c-c++-common/Winit-self2.c
new file mode 100644
index 0000000..13aa9ef
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Winit-self2.c
@@ -0,0 +1,31 @@
+/* PR middle-end/102633 */
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized -Winit-self" } */
+
+int
+fn1 (void)
+{
+ int i = i; /* { dg-warning "used uninitialized" } */
+ return i;
+}
+
+int
+fn2 ()
+{
+ const int j = j; /* { dg-warning "used uninitialized" } */
+ return j;
+}
+
+int
+fn3 ()
+{
+ volatile int k = k; /* { dg-warning "used uninitialized" } */
+ return k;
+}
+
+int
+fn4 ()
+{
+ const volatile int l = l; /* { dg-warning "used uninitialized" } */
+ return l;
+}
diff --git a/gcc/testsuite/c-c++-common/Wxor-used-as-pow-1.c b/gcc/testsuite/c-c++-common/Wxor-used-as-pow-1.c
new file mode 100644
index 0000000..962902c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wxor-used-as-pow-1.c
@@ -0,0 +1,57 @@
+/* The precise output depends of sizeof(int) and sizeof(long long), so
+ filter by target. */
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+
+/* Apparent uses of ^ for powers of 2. */
+
+short t2_16 = 2^16; /* { dg-warning "result of '2\\^16' is 18; did you mean '1 << 16' \\(65536\\)\\? \\\[-Wxor-used-as-pow\\\]" } */
+int t2_17 = 2^17; /* { dg-warning "result of '2\\^17' is 19; did you mean '1 << 17' \\(131072\\)\\?" } */
+int t2_30 = 2^30; /* { dg-warning "result of '2\\^30' is 28; did you mean '1 << 30' \\(1073741824\\)\\?" } */
+
+/* Should be 1LL at 31 and above, due to overflow. */
+int t2_31 = 2^31; /* { dg-warning "result of '2\\^31' is 29; did you mean '1LL << 31'\\?" } */
+int t2_32 = 2^32; /* { dg-warning "result of '2\\^32' is 34; did you mean '1LL << 32'\\?" } */
+
+long t2_63 = 2^63; /* { dg-warning "result of '2\\^63' is 61; did you mean exponentiation\\?" } */
+long t2_64 = 2^64; /* { dg-warning "result of '2\\^64' is 66; did you mean exponentiation\\?" } */
+
+/* ...but don't warn when RHS is large enough. */
+long t2_65 = 2^65;
+long t2_127 = 2^127;
+long t2_128 = 2^128;
+long t2_129 = 2^129;
+
+/* Verify that -Wxor-used-as-pow happens before folding. */
+long t2_32_m1 = ((2^32)-1); /* { dg-warning "result of '2\\^32' is 34; did you mean '1LL << 32'\\?" } */
+
+
+/* Apparent uses of ^ for powers of 10. */
+
+long t10_2 = 10^2; /* { dg-warning "result of '10\\^2' is 8; did you mean '1e2'\\?" } */
+long t10_9 = 10^9; /* { dg-warning "result of '10\\^9' is 3; did you mean '1e9'\\?" } */
+long t10_10 = 10^10; /* { dg-warning "result of '10\\^10' is 0; did you mean '1e10'\\?" } */
+long t10_100 = 10^100; /* { dg-warning "result of '10\\^100' is 110; did you mean '1e100'\\?" } */
+
+/* Don't warn on negatives. */
+long tm2_2 = -2^2;
+long t2_m2 = 2^-2;
+long tm10_10 = -10^10;
+long t10_m10 = 10^-10;
+
+/* If LHS is not 2 or 10, we shouldn't complain. */
+int t0_0 = 0 ^ 0;
+int t6_7 = 6 ^ 7;
+
+/* Floating point is already covered by type-checking. */
+float f10_10 = 10.f^10; /* { dg-error "invalid operands to binary \\^ \\(have 'float' and 'int'\\)" "" { target c } } */
+/* { dg-error "invalid operands of types 'float' and 'int' to binary 'operator\\^'" "" { target c++ } .-1 } */
+
+/* Don't complain if the LHS isn't literal decimal 2 or 10. */
+int t1p1_16 = (1 + 1) ^ 16;
+int t5p5_6 = (5 + 5) ^ 6;
+int h2_8 = 0x2 ^ 8;
+int h10_3 = 0xa ^ 3;
+
+/* Don't complain if the RHS isn't literal decimal. */
+int t2_x16 = 2^0x10;
+int h10_x3 = 10 ^ 0x3;
diff --git a/gcc/testsuite/c-c++-common/Wxor-used-as-pow-fixits.c b/gcc/testsuite/c-c++-common/Wxor-used-as-pow-fixits.c
new file mode 100644
index 0000000..f612b76
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wxor-used-as-pow-fixits.c
@@ -0,0 +1,34 @@
+/* { dg-options "-fdiagnostics-show-caret" } */
+
+/* Test fixit hints for -Wxor-used-as-pow. */
+
+int t2_8 = 2^8; /* { dg-line line_a } */
+/* { dg-warning "result of '2\\^8' is 10; did you mean '1 << 8' \\(256\\)\\?" "warn" { target *-*-* } line_a } */
+/* { dg-begin-multiline-output "" }
+ int t2_8 = 2^8;
+ ^
+ --
+ 1<<
+ { dg-end-multiline-output "" } */
+/* { dg-message "you can silence this warning by using a hexadecimal constant \\(0x2 rather than 2\\)" "note" { target *-*-* } line_a } */
+/* { dg-begin-multiline-output "" }
+ int t2_8 = 2^8;
+ ^
+ 0x2
+ { dg-end-multiline-output "" } */
+
+
+int t10_6 = 10^6; /* { dg-line line_b } */
+/* { dg-warning "result of '10\\^6' is 12; did you mean '1e6'\\?" "warn" { target *-*-* } line_b } */
+/* { dg-begin-multiline-output "" }
+ int t10_6 = 10^6;
+ ^
+ ---
+ 1e
+ { dg-end-multiline-output "" } */
+/* { dg-message "you can silence this warning by using a hexadecimal constant \\(0xa rather than 10\\)" "note" { target *-*-* } line_b } */
+/* { dg-begin-multiline-output "" }
+ int t10_6 = 10^6;
+ ^~
+ 0xa
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/c-c++-common/cpp/Winvalid-utf8-1.c b/gcc/testsuite/c-c++-common/cpp/Winvalid-utf8-1.c
new file mode 100644
index 0000000..0d5a6a7
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/Winvalid-utf8-1.c
@@ -0,0 +1,43 @@
+// P2295R6 - Support for UTF-8 as a portable source file encoding
+// This test intentionally contains various byte sequences which are not valid UTF-8
+// { dg-do preprocess }
+// { dg-options "-finput-charset=UTF-8 -Winvalid-utf8" }
+
+// a€߿ࠀ퟿ð€€ô¿¿a { dg-bogus "invalid UTF-8 character" }
+// a€a { dg-warning "invalid UTF-8 character <80>" }
+// a¿a { dg-warning "invalid UTF-8 character <bf>" }
+// aÀa { dg-warning "invalid UTF-8 character <c0>" }
+// aÁa { dg-warning "invalid UTF-8 character <c1>" }
+// aõa { dg-warning "invalid UTF-8 character <f5>" }
+// aÿa { dg-warning "invalid UTF-8 character <ff>" }
+// aÂa { dg-warning "invalid UTF-8 character <c2>" }
+// aàa { dg-warning "invalid UTF-8 character <e0>" }
+// aà€¿a { dg-warning "invalid UTF-8 character <e0><80><bf>" }
+// aàŸ€a { dg-warning "invalid UTF-8 character <e0><9f><80>" }
+// aà¿a { dg-warning "invalid UTF-8 character <e0><bf>" }
+// aì€a { dg-warning "invalid UTF-8 character <ec><80>" }
+// aí €a { dg-warning "invalid UTF-8 character <ed><a0><80>" }
+// að€€€a { dg-warning "invalid UTF-8 character <f0><80><80><80>" }
+// að¿¿a { dg-warning "invalid UTF-8 character <f0><8f><bf><bf>" }
+// aô€€a { dg-warning "invalid UTF-8 character <f4><90><80><80>" }
+// aý¿¿¿¿¿a { dg-warning "invalid UTF-8 character <fd><bf><bf><bf>" }
+// { dg-warning "invalid UTF-8 character <bf>" "" { target *-*-* } .-1 }
+/* a€߿ࠀ퟿ð€€ô¿¿a { dg-bogus "invalid UTF-8 character" } */
+/* a€a { dg-warning "invalid UTF-8 character <80>" } */
+/* a¿a { dg-warning "invalid UTF-8 character <bf>" } */
+/* aÀa { dg-warning "invalid UTF-8 character <c0>" } */
+/* aÁa { dg-warning "invalid UTF-8 character <c1>" } */
+/* aõa { dg-warning "invalid UTF-8 character <f5>" } */
+/* aÿa { dg-warning "invalid UTF-8 character <ff>" } */
+/* aÂa { dg-warning "invalid UTF-8 character <c2>" } */
+/* aàa { dg-warning "invalid UTF-8 character <e0>" } */
+/* aà€¿a { dg-warning "invalid UTF-8 character <e0><80><bf>" } */
+/* aàŸ€a { dg-warning "invalid UTF-8 character <e0><9f><80>" } */
+/* aà¿a { dg-warning "invalid UTF-8 character <e0><bf>" } */
+/* aì€a { dg-warning "invalid UTF-8 character <ec><80>" } */
+/* aí €a { dg-warning "invalid UTF-8 character <ed><a0><80>" } */
+/* að€€€a { dg-warning "invalid UTF-8 character <f0><80><80><80>" } */
+/* að¿¿a { dg-warning "invalid UTF-8 character <f0><8f><bf><bf>" } */
+/* aô€€a { dg-warning "invalid UTF-8 character <f4><90><80><80>" } */
+/* aý¿¿¿¿¿a { dg-warning "invalid UTF-8 character <fd><bf><bf><bf>" } */
+/* { dg-warning "invalid UTF-8 character <bf>" "" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/c-c++-common/cpp/Winvalid-utf8-2.c b/gcc/testsuite/c-c++-common/cpp/Winvalid-utf8-2.c
new file mode 100644
index 0000000..9ab69e1
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/Winvalid-utf8-2.c
@@ -0,0 +1,88 @@
+// P2295R6 - Support for UTF-8 as a portable source file encoding
+// This test intentionally contains various byte sequences which are not valid UTF-8
+// { dg-do preprocess { target { c || c++11 } } }
+// { dg-require-effective-target wchar }
+// { dg-options "-finput-charset=UTF-8 -Winvalid-utf8" }
+// { dg-additional-options "-std=gnu99" { target c } }
+
+#ifndef __cplusplus
+#include <wchar.h>
+typedef __CHAR16_TYPE__ char16_t;
+typedef __CHAR32_TYPE__ char32_t;
+#endif
+
+char32_t a = U'€'; // { dg-warning "invalid UTF-8 character <80>" }
+char32_t b = U'¿'; // { dg-warning "invalid UTF-8 character <bf>" }
+char32_t c = U'À'; // { dg-warning "invalid UTF-8 character <c0>" }
+char32_t d = U'Á'; // { dg-warning "invalid UTF-8 character <c1>" }
+char32_t e = U'õ'; // { dg-warning "invalid UTF-8 character <f5>" }
+char32_t f = U'ÿ'; // { dg-warning "invalid UTF-8 character <ff>" }
+char32_t g = U'Â'; // { dg-warning "invalid UTF-8 character <c2>" }
+char32_t h = U'à'; // { dg-warning "invalid UTF-8 character <e0>" }
+char32_t i = U'à€¿'; // { dg-warning "invalid UTF-8 character <e0><80><bf>" }
+char32_t j = U'àŸ€'; // { dg-warning "invalid UTF-8 character <e0><9f><80>" }
+char32_t k = U'à¿'; // { dg-warning "invalid UTF-8 character <e0><bf>" }
+char32_t l = U'ì€'; // { dg-warning "invalid UTF-8 character <ec><80>" }
+char32_t m = U'í €'; // { dg-warning "invalid UTF-8 character <ed><a0><80>" }
+char32_t n = U'ð€€€'; // { dg-warning "invalid UTF-8 character <f0><80><80><80>" }
+char32_t o = U'ð¿¿'; // { dg-warning "invalid UTF-8 character <f0><8f><bf><bf>" }
+char32_t p = U'ô€€'; // { dg-warning "invalid UTF-8 character <f4><90><80><80>" }
+char32_t q = U'ý¿¿¿¿¿'; // { dg-warning "invalid UTF-8 character <fd><bf><bf><bf>" }
+ // { dg-warning "invalid UTF-8 character <bf>" "" { target *-*-* } .-1 }
+const char32_t *A = U"€߿ࠀ퟿ð€€ô¿¿"; // { dg-bogus "invalid UTF-8 character" }
+const char32_t *B = U"€"; // { dg-warning "invalid UTF-8 character <80>" }
+const char32_t *C = U"¿"; // { dg-warning "invalid UTF-8 character <bf>" }
+const char32_t *D = U"À"; // { dg-warning "invalid UTF-8 character <c0>" }
+const char32_t *E = U"Á"; // { dg-warning "invalid UTF-8 character <c1>" }
+const char32_t *F = U"õ"; // { dg-warning "invalid UTF-8 character <f5>" }
+const char32_t *G = U"ÿ"; // { dg-warning "invalid UTF-8 character <ff>" }
+const char32_t *H = U"Â"; // { dg-warning "invalid UTF-8 character <c2>" }
+const char32_t *I = U"à"; // { dg-warning "invalid UTF-8 character <e0>" }
+const char32_t *J = U"à€¿"; // { dg-warning "invalid UTF-8 character <e0><80><bf>" }
+const char32_t *K = U"àŸ€"; // { dg-warning "invalid UTF-8 character <e0><9f><80>" }
+const char32_t *L = U"à¿"; // { dg-warning "invalid UTF-8 character <e0><bf>" }
+const char32_t *M = U"ì€"; // { dg-warning "invalid UTF-8 character <ec><80>" }
+const char32_t *N = U"í €"; // { dg-warning "invalid UTF-8 character <ed><a0><80>" }
+const char32_t *O = U"ð€€€"; // { dg-warning "invalid UTF-8 character <f0><80><80><80>" }
+const char32_t *P = U"ð¿¿"; // { dg-warning "invalid UTF-8 character <f0><8f><bf><bf>" }
+const char32_t *Q = U"ô€€"; // { dg-warning "invalid UTF-8 character <f4><90><80><80>" }
+const char32_t *R = U"ý¿¿¿¿¿"; // { dg-warning "invalid UTF-8 character <fd><bf><bf><bf>" }
+ // { dg-warning "invalid UTF-8 character <bf>" "" { target *-*-* } .-1 }
+const char32_t *A1 = UR"(€߿ࠀ퟿ð€€ô¿¿)"; // { dg-bogus "invalid UTF-8 character" }
+const char32_t *B1 = UR"(€)"; // { dg-warning "invalid UTF-8 character <80>" }
+const char32_t *C1 = UR"(¿)"; // { dg-warning "invalid UTF-8 character <bf>" }
+const char32_t *D1 = UR"(À)"; // { dg-warning "invalid UTF-8 character <c0>" }
+const char32_t *E1 = UR"(Á)"; // { dg-warning "invalid UTF-8 character <c1>" }
+const char32_t *F1 = UR"(õ)"; // { dg-warning "invalid UTF-8 character <f5>" }
+const char32_t *G1 = UR"(ÿ)"; // { dg-warning "invalid UTF-8 character <ff>" }
+const char32_t *H1 = UR"(Â)"; // { dg-warning "invalid UTF-8 character <c2>" }
+const char32_t *I1 = UR"(à)"; // { dg-warning "invalid UTF-8 character <e0>" }
+const char32_t *J1 = UR"(à€¿)"; // { dg-warning "invalid UTF-8 character <e0><80><bf>" }
+const char32_t *K1 = UR"(àŸ€)"; // { dg-warning "invalid UTF-8 character <e0><9f><80>" }
+const char32_t *L1 = UR"(à¿)"; // { dg-warning "invalid UTF-8 character <e0><bf>" }
+const char32_t *M1 = UR"(ì€)"; // { dg-warning "invalid UTF-8 character <ec><80>" }
+const char32_t *N1 = UR"(í €)"; // { dg-warning "invalid UTF-8 character <ed><a0><80>" }
+const char32_t *O1 = UR"(ð€€€)"; // { dg-warning "invalid UTF-8 character <f0><80><80><80>" }
+const char32_t *P1 = UR"(ð¿¿)"; // { dg-warning "invalid UTF-8 character <f0><8f><bf><bf>" }
+const char32_t *Q1 = UR"(ô€€)"; // { dg-warning "invalid UTF-8 character <f4><90><80><80>" }
+const char32_t *R1 = UR"(ý¿¿¿¿¿)"; // { dg-warning "invalid UTF-8 character <fd><bf><bf><bf>" }
+ // { dg-warning "invalid UTF-8 character <bf>" "" { target *-*-* } .-1 }
+const char *A2 = u8"€߿ࠀ퟿ð€€ô¿¿"; // { dg-bogus "invalid UTF-8 character" }
+const char *B2 = u8"€"; // { dg-warning "invalid UTF-8 character <80>" }
+const char *C2 = u8"¿"; // { dg-warning "invalid UTF-8 character <bf>" }
+const char *D2 = u8"À"; // { dg-warning "invalid UTF-8 character <c0>" }
+const char *E2 = u8"Á"; // { dg-warning "invalid UTF-8 character <c1>" }
+const char *F2 = u8"õ"; // { dg-warning "invalid UTF-8 character <f5>" }
+const char *G2 = u8"ÿ"; // { dg-warning "invalid UTF-8 character <ff>" }
+const char *H2 = u8"Â"; // { dg-warning "invalid UTF-8 character <c2>" }
+const char *I2 = u8"à"; // { dg-warning "invalid UTF-8 character <e0>" }
+const char *J2 = u8"à€¿"; // { dg-warning "invalid UTF-8 character <e0><80><bf>" }
+const char *K2 = u8"àŸ€"; // { dg-warning "invalid UTF-8 character <e0><9f><80>" }
+const char *L2 = u8"à¿"; // { dg-warning "invalid UTF-8 character <e0><bf>" }
+const char *M2 = u8"ì€"; // { dg-warning "invalid UTF-8 character <ec><80>" }
+const char *N2 = u8"í €"; // { dg-warning "invalid UTF-8 character <ed><a0><80>" }
+const char *O2 = u8"ð€€€"; // { dg-warning "invalid UTF-8 character <f0><80><80><80>" }
+const char *P2 = u8"ð¿¿"; // { dg-warning "invalid UTF-8 character <f0><8f><bf><bf>" }
+const char *Q2 = u8"ô€€"; // { dg-warning "invalid UTF-8 character <f4><90><80><80>" }
+const char *R2 = u8"ý¿¿¿¿¿"; // { dg-warning "invalid UTF-8 character <fd><bf><bf><bf>" }
+ // { dg-warning "invalid UTF-8 character <bf>" "" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/c-c++-common/cpp/Winvalid-utf8-3.c b/gcc/testsuite/c-c++-common/cpp/Winvalid-utf8-3.c
new file mode 100644
index 0000000..4cb230f
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/Winvalid-utf8-3.c
@@ -0,0 +1,27 @@
+// P2295R6 - Support for UTF-8 as a portable source file encoding
+// This test intentionally contains various byte sequences which are not valid UTF-8
+// { dg-do preprocess }
+// { dg-options "-finput-charset=UTF-8 -Winvalid-utf8" }
+
+#define I(x)
+I(€߿ࠀ퟿ð€€ô¿¿) // { dg-bogus "invalid UTF-8 character" }
+ // { dg-error "is not valid in an identifier" "" { target c++ } .-1 }
+I(€) // { dg-warning "invalid UTF-8 character <80>" }
+I(¿) // { dg-warning "invalid UTF-8 character <bf>" }
+I(À) // { dg-warning "invalid UTF-8 character <c0>" }
+I(Á) // { dg-warning "invalid UTF-8 character <c1>" }
+I(õ) // { dg-warning "invalid UTF-8 character <f5>" }
+I(ÿ) // { dg-warning "invalid UTF-8 character <ff>" }
+I(Â) // { dg-warning "invalid UTF-8 character <c2>" }
+I(à) // { dg-warning "invalid UTF-8 character <e0>" }
+I(à€¿) // { dg-warning "invalid UTF-8 character <e0><80><bf>" }
+I(àŸ€) // { dg-warning "invalid UTF-8 character <e0><9f><80>" }
+I(à¿) // { dg-warning "invalid UTF-8 character <e0><bf>" }
+I(ì€) // { dg-warning "invalid UTF-8 character <ec><80>" }
+I(í €) // { dg-warning "invalid UTF-8 character <ed><a0><80>" }
+I(ð€€€) // { dg-warning "invalid UTF-8 character <f0><80><80><80>" }
+I(ð¿¿) // { dg-warning "invalid UTF-8 character <f0><8f><bf><bf>" }
+I(ô€€) // { dg-warning "invalid UTF-8 character <f4><90><80><80>" "" { target c } }
+ // { dg-error "is not valid in an identifier" "" { target c++ } .-1 }
+I(ý¿¿¿¿¿) // { dg-warning "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c } }
+ // { dg-error "is not valid in an identifier" "" { target c++ } .-1 }
diff --git a/gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-1.c b/gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-1.c
new file mode 100644
index 0000000..04d822d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-1.c
@@ -0,0 +1,92 @@
+/* P2290R3 - Delimited escape sequences */
+/* { dg-do run } */
+/* { dg-require-effective-target wchar } */
+/* { dg-options "-std=gnu99 -Wno-c++-compat" { target c } } */
+/* { dg-options "-std=c++23" { target c++ } } */
+
+#ifndef __cplusplus
+#include <wchar.h>
+typedef __CHAR16_TYPE__ char16_t;
+typedef __CHAR32_TYPE__ char32_t;
+#endif
+
+const char32_t *a = U"\u{1234}\u{10fffd}\u{000000000000000000000000000000000000000000000000000000000001234}\u{10FFFD}";
+const char32_t *b = U"\x{1234}\x{10fffd}\x{000000000000000000000000000000000000000000000000000000000001234}";
+const char32_t *c = U"\o{1234}\o{4177775}\o{000000000000000000000000000000000000000000000000000000000000000000000000004177775}";
+const char16_t *d = u"\u{1234}\u{bFFd}\u{00000000000000000000000000000001234}";
+const char16_t *e = u"\x{1234}\x{BffD}\x{000001234}";
+const char16_t *f = u"\o{1234}\o{137775}\o{000000000000000137775}";
+const wchar_t *g = L"\u{1234}\u{bFFd}\u{00000000000000000000000000000001234}";
+const wchar_t *h = L"\x{1234}\x{bFFd}\x{000001234}";
+const wchar_t *i = L"\o{1234}\o{137775}\o{000000000000000137775}";
+#ifdef __cplusplus
+const char *j = "\u{34}\u{000000000000000003D}";
+#endif
+const char *k = "\x{34}\x{000000000000000003D}";
+const char *l = "\o{34}\o{000000000000000176}";
+
+#if U'\u{1234}' != U'\u1234' || U'\u{10fffd}' != U'\U0010FFFD' \
+ || U'\x{00000001234}' != U'\x1234' || U'\x{010fffd}' != U'\x10FFFD' \
+ || U'\o{1234}' != U'\x29c' || U'\o{004177775}' != U'\x10FFFD' \
+ || u'\u{1234}' != u'\u1234' || u'\u{0bffd}' != u'\uBFFD' \
+ || u'\x{00000001234}' != u'\x1234' || u'\x{0Bffd}' != u'\x0bFFD' \
+ || u'\o{1234}' != u'\x29c' || u'\o{00137775}' != u'\xBFFD' \
+ || L'\u{1234}' != L'\u1234' || L'\u{0bffd}' != L'\uBFFD' \
+ || L'\x{00000001234}' != L'\x1234' || L'\x{0bffd}' != L'\x0bFFD' \
+ || L'\o{1234}' != L'\x29c' || L'\o{00137775}' != L'\xBFFD' \
+ || '\x{34}' != '\x034' || '\x{0003d}' != '\x003D' \
+ || '\o{34}' != '\x1C' || '\o{176}' != '\x007E'
+#error Bad
+#endif
+#ifdef __cplusplus
+#if '\u{0000000034}' != '\u0034' || '\u{3d}' != '\u003D'
+#error Bad
+#endif
+#endif
+
+int
+main ()
+{
+ if (a[0] != U'\u1234' || a[0] != U'\u{1234}'
+ || a[1] != U'\U0010FFFD' || a[1] != U'\u{000010fFfD}'
+ || a[2] != a[0]
+ || a[3] != a[1]
+ || b[0] != U'\x1234' || b[0] != U'\x{001234}'
+ || b[1] != U'\x10FFFD' || b[1] != U'\x{0010fFfD}'
+ || b[2] != b[0]
+ || c[0] != U'\x29c' || c[0] != U'\o{001234}'
+ || c[1] != U'\x10FFFD' || c[1] != U'\o{4177775}'
+ || c[2] != c[1])
+ __builtin_abort ();
+ if (d[0] != u'\u1234' || d[0] != u'\u{1234}'
+ || d[1] != u'\U0000BFFD' || d[1] != u'\u{00000bFfD}'
+ || d[2] != d[0]
+ || e[0] != u'\x1234' || e[0] != u'\x{001234}'
+ || e[1] != u'\xBFFD' || e[1] != u'\x{00bFfD}'
+ || e[2] != e[0]
+ || f[0] != u'\x29c' || f[0] != u'\o{001234}'
+ || f[1] != u'\xbFFD' || f[1] != u'\o{137775}'
+ || f[2] != f[1])
+ __builtin_abort ();
+ if (g[0] != L'\u1234' || g[0] != L'\u{1234}'
+ || g[1] != L'\U0000BFFD' || g[1] != L'\u{00000bFfD}'
+ || g[2] != g[0]
+ || h[0] != L'\x1234' || h[0] != L'\x{001234}'
+ || h[1] != L'\xBFFD' || h[1] != L'\x{00bFfD}'
+ || h[2] != h[0]
+ || i[0] != L'\x29c' || i[0] != L'\o{001234}'
+ || i[1] != L'\xbFFD' || i[1] != L'\o{137775}'
+ || i[2] != i[1])
+ __builtin_abort ();
+#ifdef __cplusplus
+ if (j[0] != '\u0034' || j[0] != '\u{034}'
+ || j[1] != '\U0000003D' || j[1] != '\u{000003d}')
+ __builtin_abort ();
+#endif
+ if (k[0] != '\x034' || k[0] != '\x{0034}'
+ || k[1] != '\x3D' || k[1] != '\x{3d}'
+ || l[0] != '\x1c' || l[0] != '\o{0034}'
+ || l[1] != '\x07e' || l[1] != '\o{176}' || l[1] != '\176')
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-2.c b/gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-2.c
new file mode 100644
index 0000000..b23b83f
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-2.c
@@ -0,0 +1,18 @@
+/* P2290R3 - Delimited escape sequences */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -Wno-c++-compat" { target c } } */
+/* { dg-options "-std=c++23" { target c++ } } */
+
+int jalape\u{f1}o = 42;
+
+int
+caf\u{000e9} (void)
+{
+ return jalape\u00F1o;
+}
+
+int
+test (void)
+{
+ return caf\u00e9 ();
+}
diff --git a/gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-3.c b/gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-3.c
new file mode 100644
index 0000000..ef9e5b5
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-3.c
@@ -0,0 +1,33 @@
+/* P2290R3 - Delimited escape sequences */
+/* { dg-do compile } */
+/* { dg-require-effective-target wchar } */
+/* { dg-options "-std=gnu99 -Wno-c++-compat" { target c } } */
+/* { dg-options "-std=c++23" { target c++ } } */
+
+#ifndef __cplusplus
+typedef __CHAR32_TYPE__ char32_t;
+#endif
+
+const char32_t *a = U"\u{}"; /* { dg-error "empty delimited escape sequence" } */
+ /* { dg-error "is not a valid universal character" "" { target c } .-1 } */
+const char32_t *b = U"\u{12" "34}"; /* { dg-error "'\\\\u\\{' not terminated with '\\}' after" } */
+const char32_t *c = U"\u{0000ffffffff}"; /* { dg-error "is not a valid universal character" } */
+const char32_t *d = U"\u{010000edcb}"; /* { dg-error "is not a valid universal character" } */
+const char32_t *e = U"\u{02000000000000000000edcb}"; /* { dg-error "is not a valid universal character" } */
+const char32_t *f = U"\u{123ghij}"; /* { dg-error "'\\\\u\\{' not terminated with '\\}' after" } */
+const char32_t *g = U"\u{123.}"; /* { dg-error "'\\\\u\\{' not terminated with '\\}' after" } */
+const char32_t *h = U"\u{.}"; /* { dg-error "'\\\\u\\{' not terminated with '\\}' after" } */
+const char32_t *i = U"\x{}"; /* { dg-error "empty delimited escape sequence" } */
+const char32_t *j = U"\x{12" "34}"; /* { dg-error "'\\\\x\\{' not terminated with '\\}' after" } */
+const char32_t *k = U"\x{0000ffffffff}";
+const char32_t *l = U"\x{010000edcb}"; /* { dg-warning "hex escape sequence out of range" } */
+const char32_t *m = U"\x{02000000000000000000edcb}"; /* { dg-warning "hex escape sequence out of range" } */
+const char32_t *n = U"\x{123ghij}"; /* { dg-error "'\\\\x\\{' not terminated with '\\}' after" } */
+const char32_t *o = U"\x{123.}"; /* { dg-error "'\\\\x\\{' not terminated with '\\}' after" } */
+const char32_t *p = U"\o{}"; /* { dg-error "empty delimited escape sequence" } */
+const char32_t *q = U"\o{12" "34}"; /* { dg-error "'\\\\o\\{' not terminated with '\\}' after" } */
+const char32_t *r = U"\o{0000037777777777}";
+const char32_t *s = U"\o{040000166713}"; /* { dg-warning "octal escape sequence out of range" } */
+const char32_t *t = U"\o{02000000000000000000000166713}";/* { dg-warning "octal escape sequence out of range" } */
+const char32_t *u = U"\o{1238}"; /* { dg-error "'\\\\o\\{' not terminated with '\\}' after" } */
+const char32_t *v = U"\o{.}"; /* { dg-error "'\\\\o\\{' not terminated with '\\}' after" } */
diff --git a/gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-4.c b/gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-4.c
new file mode 100644
index 0000000..107051f
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-4.c
@@ -0,0 +1,13 @@
+/* P2290R3 - Delimited escape sequences */
+/* { dg-do compile } */
+/* { dg-require-effective-target wchar } */
+/* { dg-options "-std=gnu99 -Wno-c++-compat" { target c } } */
+/* { dg-options "-std=gnu++20" { target c++ } } */
+
+#define z(x) 0
+#define a z(
+int b = a\u{}); /* { dg-warning "empty delimited escape sequence; treating it as separate tokens" } */
+int c = a\u{); /* { dg-warning "'\\\\u\\\{' not terminated with '\\\}' after \\\\u\\\{; treating it as separate tokens" } */
+int d = a\u{12XYZ}); /* { dg-warning "'\\\\u\\\{' not terminated with '\\\}' after \\\\u\\\{12; treating it as separate tokens" } */
+int e = a\u123);
+int f = a\U1234567);
diff --git a/gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-5.c b/gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-5.c
new file mode 100644
index 0000000..e04f519
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-5.c
@@ -0,0 +1,13 @@
+/* P2290R3 - Delimited escape sequences */
+/* { dg-do compile } */
+/* { dg-require-effective-target wchar } */
+/* { dg-options "-std=c17 -Wno-c++-compat" { target c } } */
+/* { dg-options "-std=c++23" { target c++ } } */
+
+#define z(x) 0
+#define a z(
+int b = a\u{}); /* { dg-warning "empty delimited escape sequence; treating it as separate tokens" "" { target c++23 } } */
+int c = a\u{); /* { dg-warning "'\\\\u\\\{' not terminated with '\\\}' after \\\\u\\\{; treating it as separate tokens" "" { target c++23 } } */
+int d = a\u{12XYZ}); /* { dg-warning "'\\\\u\\\{' not terminated with '\\\}' after \\\\u\\\{12; treating it as separate tokens" "" { target c++23 } } */
+int e = a\u123);
+int f = a\U1234567);
diff --git a/gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-6.c b/gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-6.c
new file mode 100644
index 0000000..f2a4e93
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-6.c
@@ -0,0 +1,13 @@
+/* P2290R3 - Delimited escape sequences */
+/* { dg-do compile } */
+/* { dg-require-effective-target wchar } */
+/* { dg-options "-std=gnu99 -Wno-c++-compat -Wno-unicode" { target c } } */
+/* { dg-options "-std=gnu++20 -Wno-unicode" { target c++ } } */
+
+#define z(x) 0
+#define a z(
+int b = a\u{}); /* { dg-bogus "empty delimited escape sequence; treating it as separate tokens" } */
+int c = a\u{); /* { dg-bogus "'\\\\u\\\{' not terminated with '\\\}' after \\\\u\\\{; treating it as separate tokens" } */
+int d = a\u{12XYZ}); /* { dg-bogus "'\\\\u\\\{' not terminated with '\\\}' after \\\\u\\\{12; treating it as separate tokens" } */
+int e = a\u123);
+int f = a\U1234567);
diff --git a/gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-7.c b/gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-7.c
new file mode 100644
index 0000000..e2f0da4
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/delimited-escape-seq-7.c
@@ -0,0 +1,13 @@
+/* P2290R3 - Delimited escape sequences */
+/* { dg-do compile } */
+/* { dg-require-effective-target wchar } */
+/* { dg-options "-std=c17 -Wno-c++-compat -Wno-unicode" { target c } } */
+/* { dg-options "-std=c++23 -Wno-unicode" { target c++ } } */
+
+#define z(x) 0
+#define a z(
+int b = a\u{}); /* { dg-bogus "empty delimited escape sequence; treating it as separate tokens" } */
+int c = a\u{); /* { dg-bogus "'\\\\u\\\{' not terminated with '\\\}' after \\\\u\\\{; treating it as separate tokens" } */
+int d = a\u{12XYZ}); /* { dg-bogus "'\\\\u\\\{' not terminated with '\\\}' after \\\\u\\\{12; treating it as separate tokens" } */
+int e = a\u123);
+int f = a\U1234567);
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
new file mode 100644
index 0000000..3c692f45
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-1.c
@@ -0,0 +1,174 @@
+/* P2071R2 - Named universal character escapes */
+/* { dg-do run } */
+/* { dg-require-effective-target wchar } */
+/* { dg-options "-std=gnu99 -Wno-c++-compat" { target c } } */
+/* { dg-options "-std=c++23" { target c++ } } */
+
+#ifndef __cplusplus
+#include <wchar.h>
+typedef __CHAR16_TYPE__ char16_t;
+typedef __CHAR32_TYPE__ char32_t;
+#endif
+
+#ifdef __cplusplus
+#if U'\u0000' != U'\N{NULL}' \
+ || U'\u0001' != U'\N{START OF HEADING}' \
+ || U'\u0002' != U'\N{START OF TEXT}' \
+ || U'\u0003' != U'\N{END OF TEXT}' \
+ || U'\u0004' != U'\N{END OF TRANSMISSION}' \
+ || U'\u0005' != U'\N{ENQUIRY}' \
+ || U'\u0006' != U'\N{ACKNOWLEDGE}' \
+ || U'\u0007' != U'\N{ALERT}' \
+ || U'\u0008' != U'\N{BACKSPACE}' \
+ || U'\u0009' != U'\N{CHARACTER TABULATION}' \
+ || U'\u0009' != U'\N{HORIZONTAL TABULATION}' \
+ || U'\u000A' != U'\N{LINE FEED}' \
+ || U'\u000A' != U'\N{NEW LINE}' \
+ || U'\u000A' != U'\N{END OF LINE}' \
+ || U'\u000B' != U'\N{LINE TABULATION}' \
+ || U'\u000B' != U'\N{VERTICAL TABULATION}' \
+ || U'\u000C' != U'\N{FORM FEED}' \
+ || U'\u000D' != U'\N{CARRIAGE RETURN}' \
+ || U'\u000E' != U'\N{SHIFT OUT}' \
+ || U'\u000E' != U'\N{LOCKING-SHIFT ONE}' \
+ || U'\u000F' != U'\N{SHIFT IN}' \
+ || U'\u000F' != U'\N{LOCKING-SHIFT ZERO}' \
+ || U'\u0010' != U'\N{DATA LINK ESCAPE}' \
+ || U'\u0011' != U'\N{DEVICE CONTROL ONE}' \
+ || U'\u0012' != U'\N{DEVICE CONTROL TWO}' \
+ || U'\u0013' != U'\N{DEVICE CONTROL THREE}' \
+ || U'\u0014' != U'\N{DEVICE CONTROL FOUR}' \
+ || U'\u0015' != U'\N{NEGATIVE ACKNOWLEDGE}' \
+ || U'\u0016' != U'\N{SYNCHRONOUS IDLE}' \
+ || U'\u0017' != U'\N{END OF TRANSMISSION BLOCK}' \
+ || U'\u0018' != U'\N{CANCEL}' \
+ || U'\u0019' != U'\N{END OF MEDIUM}' \
+ || U'\u001A' != U'\N{SUBSTITUTE}' \
+ || U'\u001B' != U'\N{ESCAPE}' \
+ || U'\u001C' != U'\N{INFORMATION SEPARATOR FOUR}' \
+ || U'\u001C' != U'\N{FILE SEPARATOR}' \
+ || U'\u001D' != U'\N{INFORMATION SEPARATOR THREE}' \
+ || U'\u001D' != U'\N{GROUP SEPARATOR}' \
+ || U'\u001E' != U'\N{INFORMATION SEPARATOR TWO}' \
+ || U'\u001E' != U'\N{RECORD SEPARATOR}' \
+ || U'\u001F' != U'\N{INFORMATION SEPARATOR ONE}' \
+ || U'\u001F' != U'\N{UNIT SEPARATOR}' \
+ || U'\u007F' != U'\N{DELETE}' \
+ || U'\u0082' != U'\N{BREAK PERMITTED HERE}' \
+ || U'\u0083' != U'\N{NO BREAK HERE}' \
+ || U'\u0084' != U'\N{INDEX}' \
+ || U'\u0085' != U'\N{NEXT LINE}' \
+ || U'\u0086' != U'\N{START OF SELECTED AREA}' \
+ || U'\u0087' != U'\N{END OF SELECTED AREA}' \
+ || U'\u0088' != U'\N{CHARACTER TABULATION SET}' \
+ || U'\u0088' != U'\N{HORIZONTAL TABULATION SET}' \
+ || U'\u0089' != U'\N{CHARACTER TABULATION WITH JUSTIFICATION}' \
+ || U'\u0089' != U'\N{HORIZONTAL TABULATION WITH JUSTIFICATION}' \
+ || U'\u008A' != U'\N{LINE TABULATION SET}' \
+ || U'\u008A' != U'\N{VERTICAL TABULATION SET}' \
+ || U'\u008B' != U'\N{PARTIAL LINE FORWARD}' \
+ || U'\u008B' != U'\N{PARTIAL LINE DOWN}' \
+ || U'\u008C' != U'\N{PARTIAL LINE BACKWARD}' \
+ || U'\u008C' != U'\N{PARTIAL LINE UP}' \
+ || U'\u008D' != U'\N{REVERSE LINE FEED}' \
+ || U'\u008D' != U'\N{REVERSE INDEX}' \
+ || U'\u008E' != U'\N{SINGLE SHIFT TWO}' \
+ || U'\u008E' != U'\N{SINGLE-SHIFT-2}' \
+ || U'\u008F' != U'\N{SINGLE SHIFT THREE}' \
+ || U'\u008F' != U'\N{SINGLE-SHIFT-3}' \
+ || U'\u0090' != U'\N{DEVICE CONTROL STRING}' \
+ || U'\u0091' != U'\N{PRIVATE USE ONE}' \
+ || U'\u0091' != U'\N{PRIVATE USE-1}' \
+ || U'\u0092' != U'\N{PRIVATE USE TWO}' \
+ || U'\u0092' != U'\N{PRIVATE USE-2}' \
+ || U'\u0093' != U'\N{SET TRANSMIT STATE}' \
+ || U'\u0094' != U'\N{CANCEL CHARACTER}' \
+ || U'\u0095' != U'\N{MESSAGE WAITING}' \
+ || U'\u0096' != U'\N{START OF GUARDED AREA}' \
+ || U'\u0096' != U'\N{START OF PROTECTED AREA}' \
+ || U'\u0097' != U'\N{END OF GUARDED AREA}' \
+ || U'\u0097' != U'\N{END OF PROTECTED AREA}' \
+ || U'\u0098' != U'\N{START OF STRING}' \
+ || U'\u009A' != U'\N{SINGLE CHARACTER INTRODUCER}' \
+ || U'\u009B' != U'\N{CONTROL SEQUENCE INTRODUCER}' \
+ || U'\u009C' != U'\N{STRING TERMINATOR}' \
+ || U'\u009D' != U'\N{OPERATING SYSTEM COMMAND}' \
+ || U'\u009E' != U'\N{PRIVACY MESSAGE}' \
+ || U'\u009F' != U'\N{APPLICATION PROGRAM COMMAND}' \
+ || U'\u0020' != U'\N{SPACE}' \
+ || U'\u0030' != U'\N{DIGIT ZERO}' \
+ || U'\u0053' != U'\N{LATIN CAPITAL LETTER S}'
+#error Bad
+#endif
+#endif
+#if U'\U0001F402' != U'\N{OX}' \
+ || U'\U0001FBA9' != U'\N{BOX DRAWINGS LIGHT DIAGONAL UPPER CENTRE TO MIDDLE RIGHT AND MIDDLE LEFT TO LOWER CENTRE}' \
+ || U'\u01FD' != U'\N{LATIN SMALL LETTER AE WITH ACUTE}' \
+ || U'\u2118' != U'\N{WEIERSTRASS ELLIPTIC FUNCTION}' \
+ || U'\u2118' != U'\N{SCRIPT CAPITAL P}' \
+ || U'\uFEFF' != U'\N{BYTE ORDER MARK}' \
+ || U'\uFEFF' != U'\N{ZERO WIDTH NO-BREAK SPACE}' \
+ || U'\u116C' != U'\N{HANGUL JUNGSEONG OE}' \
+ || U'\u1180' != U'\N{HANGUL JUNGSEONG O-E}' \
+ || U'\u0F60' != U'\N{TIBETAN LETTER -A}' \
+ || U'\u0F68' != U'\N{TIBETAN LETTER A}' \
+ || U'\u0F0A' != U'\N{TIBETAN MARK BKA- SHOG YIG MGO}' \
+ || U'\u0FD0' != U'\N{TIBETAN MARK BKA- SHOG GI MGO RGYAN}' \
+ || U'\u0FD0' != U'\N{TIBETAN MARK BSKA- SHOG GI MGO RGYAN}' \
+ || U'\uFE18' != U'\N{PRESENTATION FORM FOR VERTICAL RIGHT WHITE LENTICULAR BRAKCET}' \
+ || U'\uFE18' != U'\N{PRESENTATION FORM FOR VERTICAL RIGHT WHITE LENTICULAR BRACKET}' \
+ || U'\uAC00' != U'\N{HANGUL SYLLABLE GA}' \
+ || U'\uAC02' != U'\N{HANGUL SYLLABLE GAGG}' \
+ || U'\uAD8D' != U'\N{HANGUL SYLLABLE GWEONJ}' \
+ || U'\uAE4D' != U'\N{HANGUL SYLLABLE GGAG}' \
+ || U'\uAE4E' != U'\N{HANGUL SYLLABLE GGAGG}' \
+ || U'\uC544' != U'\N{HANGUL SYLLABLE A}' \
+ || U'\uC55F' != U'\N{HANGUL SYLLABLE AH}' \
+ || U'\uC560' != U'\N{HANGUL SYLLABLE AE}' \
+ || U'\uD7A3' != U'\N{HANGUL SYLLABLE HIH}' \
+ || U'\u3400' != U'\N{CJK UNIFIED IDEOGRAPH-3400}' \
+ || U'\u4DBF' != U'\N{CJK UNIFIED IDEOGRAPH-4DBF}' \
+ || U'\u4E00' != U'\N{CJK UNIFIED IDEOGRAPH-4E00}' \
+ || U'\u9FFC' != U'\N{CJK UNIFIED IDEOGRAPH-9FFC}' \
+ || U'\U00020000' != U'\N{CJK UNIFIED IDEOGRAPH-20000}' \
+ || U'\U0002A6DD' != U'\N{CJK UNIFIED IDEOGRAPH-2A6DD}' \
+ || U'\U00020700' != U'\N{CJK UNIFIED IDEOGRAPH-20700}' \
+ || U'\U0002B734' != U'\N{CJK UNIFIED IDEOGRAPH-2B734}' \
+ || U'\U0002B740' != U'\N{CJK UNIFIED IDEOGRAPH-2B740}' \
+ || U'\U0002B81D' != U'\N{CJK UNIFIED IDEOGRAPH-2B81D}' \
+ || U'\U0002B820' != U'\N{CJK UNIFIED IDEOGRAPH-2B820}' \
+ || U'\U0002CEA1' != U'\N{CJK UNIFIED IDEOGRAPH-2CEA1}' \
+ || U'\U0002CEB0' != U'\N{CJK UNIFIED IDEOGRAPH-2CEB0}' \
+ || U'\U0002EBE0' != U'\N{CJK UNIFIED IDEOGRAPH-2EBE0}' \
+ || U'\U00030000' != U'\N{CJK UNIFIED IDEOGRAPH-30000}' \
+ || U'\U0003134A' != U'\N{CJK UNIFIED IDEOGRAPH-3134A}' \
+ || U'\U00017000' != U'\N{TANGUT IDEOGRAPH-17000}' \
+ || U'\U000187F7' != U'\N{TANGUT IDEOGRAPH-187F7}' \
+ || U'\U00018D00' != U'\N{TANGUT IDEOGRAPH-18D00}' \
+ || U'\U00018D08' != U'\N{TANGUT IDEOGRAPH-18D08}' \
+ || U'\U00018B00' != U'\N{KHITAN SMALL SCRIPT CHARACTER-18B00}' \
+ || U'\U00018CD5' != U'\N{KHITAN SMALL SCRIPT CHARACTER-18CD5}' \
+ || U'\U0001B170' != U'\N{NUSHU CHARACTER-1B170}' \
+ || U'\U0001B2FB' != U'\N{NUSHU CHARACTER-1B2FB}' \
+ || U'\uF900' != U'\N{CJK COMPATIBILITY IDEOGRAPH-F900}' \
+ || U'\uFA6D' != U'\N{CJK COMPATIBILITY IDEOGRAPH-FA6D}' \
+ || U'\uFA70' != U'\N{CJK COMPATIBILITY IDEOGRAPH-FA70}' \
+ || U'\uFAD9' != U'\N{CJK COMPATIBILITY IDEOGRAPH-FAD9}' \
+ || U'\U0002F800' != U'\N{CJK COMPATIBILITY IDEOGRAPH-2F800}' \
+ || U'\U0002FA1D' != U'\N{CJK COMPATIBILITY IDEOGRAPH-2FA1D}'
+#error Bad
+#endif
+
+const char32_t *a = U"\N{HEBREW LETTER KAF}\N{HEBREW LETTER FINAL NUN}";
+const char32_t *b = U"\N{OX}\N{BOX DRAWINGS LIGHT DIAGONAL UPPER CENTRE TO MIDDLE RIGHT AND MIDDLE LEFT TO LOWER CENTRE}";
+
+#define b\N{LATIN SMALL LETTER O WITH ACUTE}x U'\U0001FBA9'
+
+int
+main ()
+{
+ if (a[0] != U'\u05DB' || a[1] != U'\U000005DF' || a[2]
+ || b[0] != U'\U0001F402' || b[1] != b\u{f3}x || b[2])
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-2.c b/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-2.c
new file mode 100644
index 0000000..4b1af84
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-2.c
@@ -0,0 +1,18 @@
+/* P2071R2 - Named universal character escapes */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -Wno-c++-compat" { target c } } */
+/* { dg-options "-std=c++23" { target c++ } } */
+
+int jalape\N{LATIN SMALL LETTER N WITH TILDE}o = 42;
+
+int
+caf\N{LATIN SMALL LETTER E WITH ACUTE} (void)
+{
+ return jalape\u00F1o;
+}
+
+int
+test (void)
+{
+ return caf\u00e9 ();
+}
diff --git a/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-3.c b/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-3.c
new file mode 100644
index 0000000..5985c03
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-3.c
@@ -0,0 +1,22 @@
+/* P2071R2 - Named universal character escapes */
+/* { dg-do compile } */
+/* { dg-require-effective-target wchar } */
+/* { dg-options "-std=gnu99 -Wno-c++-compat" { target c } } */
+/* { dg-options "-std=c++23" { target c++ } } */
+
+#ifndef __cplusplus
+typedef __CHAR32_TYPE__ char32_t;
+#endif
+
+const char32_t *a = U"\N{}"; /* { dg-error "empty named universal character escape sequence" } */
+const char32_t *b = U"\N{NU" "LL}"; /* { dg-error "'\\\\N\\{' not terminated with '\\}' after" } */
+ /* { dg-error "is not a valid universal character" "" { target c } .-1 } */
+const char32_t *c = U"\N{ I've just made it up }"; /* { dg-error "'\\\\N\\{' not terminated with '\\}' after" } */
+ /* { dg-error "is not a valid universal character" "" { target c } .-1 } */
+const char32_t *d = U"\N{_________ _______}"; /* { dg-error "is not a valid universal character" } */
+const char32_t *e = U"\N{O.X}"; /* { dg-error "'\\\\N\\{' not terminated with '\\}' after" } */
+ /* { dg-error "is not a valid universal character" "" { target c } .-1 } */
+const char32_t *f = U"\N{.}"; /* { dg-error "'\\\\N\\{' not terminated with '\\}' after" } */
+ /* { dg-error "is not a valid universal character" "" { target c } .-1 } */
+const char32_t *g = U"\N{BOM}"; /* { dg-error "is not a valid universal character" } */
+const char32_t *h = U"\N{ZWNBSP}"; /* { dg-error "is not a valid universal character" } */
diff --git a/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-4.c b/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-4.c
new file mode 100644
index 0000000..75fdeff
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-4.c
@@ -0,0 +1,60 @@
+/* P2071R2 - Named universal character escapes */
+/* { dg-do compile } */
+/* { dg-require-effective-target wchar } */
+/* { dg-options "-std=gnu99 -Wno-c++-compat" { target c } } */
+/* { dg-options "-std=c++23" { target c++ } } */
+
+#ifndef __cplusplus
+typedef __CHAR32_TYPE__ char32_t;
+#endif
+
+const char32_t *a = U"\N{ZERO WIDTH NO BREAK SPACE}"; /* { dg-error "is not a valid universal character" } */
+ /* { dg-message "did you mean \\\\N\\{ZERO WIDTH NO-BREAK SPACE\\}\\?" "" { target *-*-* } .-1 } */
+const char32_t *b = U"\N{giraffe face}"; /* { dg-error "is not a valid universal character" } */
+ /* { dg-message "did you mean \\\\N\\{GIRAFFE FACE\\}\\?" "" { target *-*-* } .-1 } */
+const char32_t *c = U"\N{Giraffe Face}"; /* { dg-error "is not a valid universal character" } */
+ /* { dg-message "did you mean \\\\N\\{GIRAFFE FACE\\}\\?" "" { target *-*-* } .-1 } */
+const char32_t *d = U"\N{ GiRaFfE_fAcE__ ___}"; /* { dg-error "is not a valid universal character" } */
+ /* { dg-message "did you mean \\\\N\\{GIRAFFE FACE\\}\\?" "" { target *-*-* } .-1 } */
+const char32_t *e = U"\N{GIRAFFE}"; /* { dg-error "is not a valid universal character" } */
+const char32_t *f = U"\N{Hangul_Syllable_gAgg_}"; /* { dg-error "is not a valid universal character" } */
+ /* { dg-message "did you mean \\\\N\\{HANGUL SYLLABLE GAGG\\}\\?" "" { target *-*-* } .-1 } */
+const char32_t *g = U"\N{HANGUL SYLLABLE gagg}"; /* { dg-error "is not a valid universal character" } */
+ /* { dg-message "did you mean \\\\N\\{HANGUL SYLLABLE GAGG\\}\\?" "" { target *-*-* } .-1 } */
+const char32_t *h = U"\N{HANGULSYLLABLEGAGG}"; /* { dg-error "is not a valid universal character" } */
+ /* { dg-message "did you mean \\\\N\\{HANGUL SYLLABLE GAGG\\}\\?" "" { target *-*-* } .-1 } */
+const char32_t *i = U"\N{HANGUL_SYLLABLE_GAGG}"; /* { dg-error "is not a valid universal character" } */
+ /* { dg-message "did you mean \\\\N\\{HANGUL SYLLABLE GAGG\\}\\?" "" { target *-*-* } .-1 } */
+const char32_t *j = U"\N{HANGUL SYLLABLE }"; /* { dg-error "is not a valid universal character" } */
+const char32_t *k = U"\N{CJK-COMPATIBILITY-IDEOGRAPH-2F801}"; /* { dg-error "is not a valid universal character" } */
+ /* { dg-message "did you mean \\\\N\\{CJK COMPATIBILITY IDEOGRAPH-2F801\\}\\?" "" { target *-*-* } .-1 } */
+const char32_t *l = U"\N{CjK_COMPATIBILITY IDEOGRAPH 2f801}"; /* { dg-error "is not a valid universal character" } */
+ /* { dg-message "did you mean \\\\N\\{CJK COMPATIBILITY IDEOGRAPH-2F801\\}\\?" "" { target *-*-* } .-1 } */
+const char32_t *m = U"\N{CjK_COMPATIBILITY IDEOGRAPH 2f80}"; /* { dg-error "is not a valid universal character" } */
+const char32_t *n = U"\N{CJK COMPATIBILITY IDEOGRAPH-}"; /* { dg-error "is not a valid universal character" } */
+const char32_t *o = U"\N{CJK COMPATIBILITY IDEOGRAPH-X}"; /* { dg-error "is not a valid universal character" } */
+const char32_t *p = U"\N{Tibetan Letter A}"; /* { dg-error "is not a valid universal character" } */
+ /* { dg-message "did you mean \\\\N\\{TIBETAN LETTER A\\}\\?" "" { target *-*-* } .-1 } */
+const char32_t *q = U"\N{Tibetan LetterA}"; /* { dg-error "is not a valid universal character" } */
+ /* { dg-message "did you mean \\\\N\\{TIBETAN LETTER A\\}\\?" "" { target *-*-* } .-1 } */
+const char32_t *r = U"\N{Tibetan Letter-A}"; /* { dg-error "is not a valid universal character" } */
+ /* { dg-message "did you mean \\\\N\\{TIBETAN LETTER A\\}\\?" "" { target *-*-* } .-1 } */
+const char32_t *s = U"\N{Tibetan Letter -A}"; /* { dg-error "is not a valid universal character" } */
+ /* { dg-message "did you mean \\\\N\\{TIBETAN LETTER -A\\}\\?" "" { target *-*-* } .-1 } */
+const char32_t *t = U"\N{TibetanLetter -A}"; /* { dg-error "is not a valid universal character" } */
+ /* { dg-message "did you mean \\\\N\\{TIBETAN LETTER -A\\}\\?" "" { target *-*-* } .-1 } */
+const char32_t *u = U"\N{Hangul Jungseong oe}"; /* { dg-error "is not a valid universal character" } */
+ /* { dg-message "did you mean \\\\N\\{HANGUL JUNGSEONG OE\\}\\?" "" { target *-*-* } .-1 } */
+const char32_t *v = U"\N{Hangul Jungseong o- e}"; /* { dg-error "is not a valid universal character" } */
+ /* { dg-message "did you mean \\\\N\\{HANGUL JUNGSEONG O-E\\}\\?" "" { target *-*-* } .-1 } */
+const char32_t *w = U"\N{HangulJungseongo-e}"; /* { dg-error "is not a valid universal character" } */
+ /* { dg-message "did you mean \\\\N\\{HANGUL JUNGSEONG O-E\\}\\?" "" { target *-*-* } .-1 } */
+const char32_t *x = U"\N{Hangul Jungseong oe __ }"; /* { dg-error "is not a valid universal character" } */
+ /* { dg-message "did you mean \\\\N\\{HANGUL JUNGSEONG OE\\}\\?" "" { target *-*-* } .-1 } */
+const char32_t *y = U"\N{Hangul Jungseong o- e __ }"; /* { dg-error "is not a valid universal character" } */
+ /* { dg-message "did you mean \\\\N\\{HANGUL JUNGSEONG O-E\\}\\?" "" { target *-*-* } .-1 } */
+const char32_t *z = U"\N{Hangul Jungseong o -e}"; /* { dg-error "is not a valid universal character" } */
+ /* { dg-message "did you mean \\\\N\\{HANGUL JUNGSEONG O-E\\}\\?" "" { target *-*-* } .-1 } */
+const char32_t *A = U"\N{Hangul Jungseong o -e __ }"; /* { dg-error "is not a valid universal character" } */
+ /* { dg-message "did you mean \\\\N\\{HANGUL JUNGSEONG O-E\\}\\?" "" { target *-*-* } .-1 } */
+const char32_t *B = U"\N{O}"; /* { dg-error "is not a valid universal character" } */
diff --git a/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-5.c b/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-5.c
new file mode 100644
index 0000000..a1c53c7
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-5.c
@@ -0,0 +1,17 @@
+/* P2071R2 - Named universal character escapes */
+/* { dg-do compile } */
+/* { dg-require-effective-target wchar } */
+/* { dg-options "-std=gnu99 -Wno-c++-compat" { target c } } */
+/* { dg-options "-std=gnu++20" { target c++ } } */
+
+#define z(x) 0
+#define a z(
+int b = a\N{}); /* { dg-warning "empty named universal character escape sequence; treating it as separate tokens" } */
+int c = a\N{); /* { dg-warning "'\\\\N\\\{' not terminated with '\\\}' after \\\\N\\\{; treating it as separate tokens" } */
+int d = a\N);
+int e = a\NARG);
+int f = a\N{abc}); /* { dg-warning "\\\\N\\\{abc\\\} is not a valid universal character; treating it as separate tokens" } */
+int g = a\N{ABC.123}); /* { dg-warning "'\\\\N\\\{' not terminated with '\\\}' after \\\\N\\\{ABC; treating it as separate tokens" } */
+int h = a\N{NON-EXISTENT CHAR}); /* { dg-warning "\\\\N\\\{NON-EXISTENT CHAR\\\} is not a valid universal character; treating it as separate tokens" } */
+int i = a\N{Latin_Small_Letter_A_With_Acute}); /* { dg-warning "\\\\N\\\{Latin_Small_Letter_A_With_Acute\\\} is not a valid universal character; treating it as separate tokens" } */
+ /* { dg-message "did you mean \\\\N\\\{LATIN SMALL LETTER A WITH ACUTE\\\}\\?" "" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-6.c b/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-6.c
new file mode 100644
index 0000000..a6a5a10
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-6.c
@@ -0,0 +1,17 @@
+/* P2071R2 - Named universal character escapes */
+/* { dg-do compile } */
+/* { dg-require-effective-target wchar } */
+/* { dg-options "-std=c17 -Wno-c++-compat" { target c } } */
+/* { dg-options "-std=c++20" { target c++ } } */
+
+#define z(x) 0
+#define a z(
+int b = a\N{});
+int c = a\N{);
+int d = a\N);
+int e = a\NARG);
+int f = a\N{abc});
+int g = a\N{ABC.123});
+int h = a\N{NON-EXISTENT CHAR}); /* { dg-bogus "is not a valid universal character" } */
+int i = a\N{Latin_Small_Letter_A_With_Acute});
+int j = a\N{LATIN SMALL LETTER A WITH ACUTE});
diff --git a/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-7.c b/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-7.c
new file mode 100644
index 0000000..e6142bf
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/named-universal-char-escape-7.c
@@ -0,0 +1,17 @@
+/* P2071R2 - Named universal character escapes */
+/* { dg-do compile } */
+/* { dg-require-effective-target wchar } */
+/* { dg-options "-std=gnu99 -Wno-c++-compat -Wno-unicode" { target c } } */
+/* { dg-options "-std=gnu++20 -Wno-unicode" { target c++ } } */
+
+#define z(x) 0
+#define a z(
+int b = a\N{}); /* { dg-bogus "empty named universal character escape sequence; treating it as separate tokens" } */
+int c = a\N{); /* { dg-bogus "'\\\\N\\\{' not terminated with '\\\}' after \\\\N\\\{; treating it as separate tokens" } */
+int d = a\N);
+int e = a\NARG);
+int f = a\N{abc}); /* { dg-bogus "\\\\N\\\{abc\\\} is not a valid universal character; treating it as separate tokens" } */
+int g = a\N{ABC.123}); /* { dg-bogus "'\\\\N\\\{' not terminated with '\\\}' after \\\\N\\\{ABC; treating it as separate tokens" } */
+int h = a\N{NON-EXISTENT CHAR}); /* { dg-bogus "\\\\N\\\{NON-EXISTENT CHAR\\\} is not a valid universal character; treating it as separate tokens" } */
+int i = a\N{Latin_Small_Letter_A_With_Acute}); /* { dg-bogus "\\\\N\\\{Latin_Small_Letter_A_With_Acute\\\} is not a valid universal character; treating it as separate tokens" } */
+ /* { dg-bogus "did you mean \\\\N\\\{LATIN SMALL LETTER A WITH ACUTE\\\}\\?" "" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/c-c++-common/goacc/classify-kernels-parloops.c b/gcc/testsuite/c-c++-common/goacc/classify-kernels-parloops.c
index 5f470eb..fc2b637 100644
--- a/gcc/testsuite/c-c++-common/goacc/classify-kernels-parloops.c
+++ b/gcc/testsuite/c-c++-common/goacc/classify-kernels-parloops.c
@@ -27,16 +27,16 @@ void KERNELS ()
}
/* Check the offloaded function's attributes.
- { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint\\)\\)" 1 "ompexp" } } */
+ { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "ompexp" } } */
/* Check that exactly one OpenACC kernels construct is analyzed, and that it
can be parallelized.
{ dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } }
- { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } }
+ { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "parloops1" } }
{ dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } */
/* Check the offloaded function's classification and compute dimensions (will
always be 1 x 1 x 1 for non-offloading compilation).
{ dg-final { scan-tree-dump-times "(?n)Function is parallelized OpenACC kernels offload" 1 "oaccloops" } }
{ dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
- { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "oaccloops" } } */
+ { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "oaccloops" } } */
diff --git a/gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized-parloops.c b/gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized-parloops.c
index 06c70fb..08e69c4 100644
--- a/gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized-parloops.c
+++ b/gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized-parloops.c
@@ -31,16 +31,16 @@ void KERNELS ()
}
/* Check the offloaded function's attributes.
- { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint\\)\\)" 1 "ompexp" } } */
+ { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "ompexp" } } */
/* Check that exactly one OpenACC kernels construct is analyzed, and that it
can't be parallelized.
{ dg-final { scan-tree-dump-times "FAILED:" 1 "parloops1" } }
- { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } }
+ { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "parloops1" } }
{ dg-final { scan-tree-dump-not "SUCCESS: may be parallelized" "parloops1" } } */
/* Check the offloaded function's classification and compute dimensions (will
always be 1 x 1 x 1 for non-offloading compilation).
{ dg-final { scan-tree-dump-times "(?n)Function is unparallelized OpenACC kernels offload" 1 "oaccloops" } }
{ dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
- { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels, omp target entrypoint\\)\\)" 1 "oaccloops" } } */
+ { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "oaccloops" } } */
diff --git a/gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized.c b/gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized.c
index 61871d1..ce38079 100644
--- a/gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized.c
+++ b/gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized.c
@@ -40,16 +40,16 @@ void KERNELS ()
}
/* Check the offloaded function's attributes.
- { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint\\)\\)" 1 "ompexp" } } */
+ { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "ompexp" } } */
/* Check that exactly one OpenACC kernels construct is analyzed, and that it
can't be parallelized.
{ dg-final { scan-tree-dump-times "FAILED:" 1 "parloops1" } }
- { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } }
+ { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "parloops1" } }
{ dg-final { scan-tree-dump-not "SUCCESS: may be parallelized" "parloops1" } } */
/* Check the offloaded function's classification and compute dimensions (will
always be 1 x 1 x 1 for non-offloading compilation).
{ dg-final { scan-tree-dump-times "(?n)Function is unparallelized OpenACC kernels offload" 1 "oaccloops" } }
{ dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
- { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels, omp target entrypoint\\)\\)" 1 "oaccloops" } } */
+ { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "oaccloops" } } */
diff --git a/gcc/testsuite/c-c++-common/goacc/classify-kernels.c b/gcc/testsuite/c-c++-common/goacc/classify-kernels.c
index 1473337..31c1200 100644
--- a/gcc/testsuite/c-c++-common/goacc/classify-kernels.c
+++ b/gcc/testsuite/c-c++-common/goacc/classify-kernels.c
@@ -36,16 +36,16 @@ void KERNELS ()
}
/* Check the offloaded function's attributes.
- { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint\\)\\)" 1 "ompexp" } } */
+ { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "ompexp" } } */
/* Check that exactly one OpenACC kernels construct is analyzed, and that it
can be parallelized.
{ dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } }
- { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } }
+ { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "parloops1" } }
{ dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } */
/* Check the offloaded function's classification and compute dimensions (will
always be 1 x 1 x 1 for non-offloading compilation).
{ dg-final { scan-tree-dump-times "(?n)Function is parallelized OpenACC kernels offload" 1 "oaccloops" } }
{ dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
- { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "oaccloops" } } */
+ { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "oaccloops" } } */
diff --git a/gcc/testsuite/c-c++-common/goacc/classify-parallel.c b/gcc/testsuite/c-c++-common/goacc/classify-parallel.c
index 61d03c0..19101fa 100644
--- a/gcc/testsuite/c-c++-common/goacc/classify-parallel.c
+++ b/gcc/testsuite/c-c++-common/goacc/classify-parallel.c
@@ -24,10 +24,10 @@ void PARALLEL ()
}
/* Check the offloaded function's attributes.
- { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc parallel, omp target entrypoint\\)\\)" 1 "ompexp" } } */
+ { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc parallel, omp target entrypoint, noclone\\)\\)" 1 "ompexp" } } */
/* Check the offloaded function's classification and compute dimensions (will
always be 1 x 1 x 1 for non-offloading compilation).
{ dg-final { scan-tree-dump-times "(?n)Function is OpenACC parallel offload" 1 "oaccloops" } }
{ dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
- { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc parallel, omp target entrypoint\\)\\)" 1 "oaccloops" } } */
+ { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc parallel, omp target entrypoint, noclone\\)\\)" 1 "oaccloops" } } */
diff --git a/gcc/testsuite/c-c++-common/goacc/classify-serial.c b/gcc/testsuite/c-c++-common/goacc/classify-serial.c
index 71b8c72..6480fe3 100644
--- a/gcc/testsuite/c-c++-common/goacc/classify-serial.c
+++ b/gcc/testsuite/c-c++-common/goacc/classify-serial.c
@@ -29,10 +29,10 @@ void SERIAL ()
}
/* Check the offloaded function's attributes.
- { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc serial, omp target entrypoint\\)\\)" 1 "ompexp" } } */
+ { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc serial, omp target entrypoint, noclone\\)\\)" 1 "ompexp" } } */
/* Check the offloaded function's classification and compute dimensions (will
always be 1 x 1 x 1 for non-offloading compilation).
{ dg-final { scan-tree-dump-times "(?n)Function is OpenACC serial offload" 1 "oaccloops" } }
{ dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
- { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc serial, omp target entrypoint\\)\\)" 1 "oaccloops" } } */
+ { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc serial, omp target entrypoint, noclone\\)\\)" 1 "oaccloops" } } */
diff --git a/gcc/testsuite/c-c++-common/goacc/deep-copy-arrayofstruct.c b/gcc/testsuite/c-c++-common/goacc/deep-copy-arrayofstruct.c
deleted file mode 100644
index 4247607..0000000
--- a/gcc/testsuite/c-c++-common/goacc/deep-copy-arrayofstruct.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/* { dg-do compile } */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-typedef struct {
- int *a;
- int *b;
- int *c;
-} mystruct;
-
-int main(int argc, char* argv[])
-{
- const int N = 1024;
- const int S = 32;
- mystruct *m = (mystruct *) calloc (S, sizeof (*m));
- int i, j;
-
- for (i = 0; i < S; i++)
- {
- m[i].a = (int *) malloc (N * sizeof (int));
- m[i].b = (int *) malloc (N * sizeof (int));
- m[i].c = (int *) malloc (N * sizeof (int));
- }
-
- for (j = 0; j < S; j++)
- for (i = 0; i < N; i++)
- {
- m[j].a[i] = 0;
- m[j].b[i] = 0;
- m[j].c[i] = 0;
- }
-
-#pragma acc enter data copyin(m[0:1])
-
- for (int i = 0; i < 99; i++)
- {
- int j, k;
- for (k = 0; k < S; k++)
-#pragma acc parallel loop copy(m[k].a[0:N])
- for (j = 0; j < N; j++)
- m[k].a[j]++;
-
- for (k = 0; k < S; k++)
-#pragma acc parallel loop copy(m[k].b[0:N], m[k].c[5:N-10])
- for (j = 0; j < N; j++)
- {
- m[k].b[j]++;
- if (j > 5 && j < N - 5)
- m[k].c[j]++;
- }
- }
-
-#pragma acc exit data copyout(m[0:1])
-
- for (j = 0; j < S; j++)
- {
- for (i = 0; i < N; i++)
- {
- if (m[j].a[i] != 99)
- abort ();
- if (m[j].b[i] != 99)
- abort ();
- if (i > 5 && i < N-5)
- {
- if (m[j].c[i] != 99)
- abort ();
- }
- else
- {
- if (m[j].c[i] != 0)
- abort ();
- }
- }
-
- free (m[j].a);
- free (m[j].b);
- free (m[j].c);
- }
- free (m);
-
- return 0;
-}
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-counter-vars-function-scope.c b/gcc/testsuite/c-c++-common/goacc/kernels-counter-vars-function-scope.c
index c475333..bce17a1 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-counter-vars-function-scope.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-counter-vars-function-scope.c
@@ -45,7 +45,7 @@ main (void)
/* Check that only one loop is analyzed, and that it can be parallelized. */
/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } } */
-/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } } */
+/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "parloops1" } } */
/* { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } */
/* Check that the loop has been split off into a function. */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-loop-2.c b/gcc/testsuite/c-c++-common/goacc/kernels-loop-2.c
index acef6a1..456a954 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-loop-2.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-loop-2.c
@@ -59,7 +59,7 @@ main (void)
/* Check that only three loops are analyzed, and that all can be
parallelized. */
/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 3 "parloops1" } } */
-/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 3 "parloops1" } } */
+/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 3 "parloops1" } } */
/* { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } */
/* Check that the loop has been split off into a function. */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-loop-3.c b/gcc/testsuite/c-c++-common/goacc/kernels-loop-3.c
index 75e2bb7..ef0c481 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-loop-3.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-loop-3.c
@@ -39,7 +39,7 @@ main (void)
/* Check that only one loop is analyzed, and that it can be parallelized. */
/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } } */
-/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } } */
+/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "parloops1" } } */
/* { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } */
/* Check that the loop has been split off into a function. */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-loop-data-2.c b/gcc/testsuite/c-c++-common/goacc/kernels-loop-data-2.c
index 7180021..a640078 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-loop-data-2.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-loop-data-2.c
@@ -59,7 +59,7 @@ main (void)
/* Check that only three loops are analyzed, and that all can be
parallelized. */
/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 3 "parloops1" } } */
-/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 3 "parloops1" } } */
+/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 3 "parloops1" } } */
/* { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } */
/* Check that the loop has been split off into a function. */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-loop-data-enter-exit-2.c b/gcc/testsuite/c-c++-common/goacc/kernels-loop-data-enter-exit-2.c
index 0c9f833..d46bba8 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-loop-data-enter-exit-2.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-loop-data-enter-exit-2.c
@@ -57,7 +57,7 @@ main (void)
/* Check that only three loops are analyzed, and that all can be
parallelized. */
/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 3 "parloops1" } } */
-/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 3 "parloops1" } } */
+/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 3 "parloops1" } } */
/* { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } */
/* Check that the loop has been split off into a function. */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-loop-data-enter-exit.c b/gcc/testsuite/c-c++-common/goacc/kernels-loop-data-enter-exit.c
index 0bd21b6..6698980 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-loop-data-enter-exit.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-loop-data-enter-exit.c
@@ -54,7 +54,7 @@ main (void)
/* Check that only three loops are analyzed, and that all can be
parallelized. */
/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 3 "parloops1" } } */
-/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 3 "parloops1" } } */
+/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 3 "parloops1" } } */
/* { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } */
/* Check that the loop has been split off into a function. */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-loop-data-update.c b/gcc/testsuite/c-c++-common/goacc/kernels-loop-data-update.c
index dd5a841..9c6997f 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-loop-data-update.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-loop-data-update.c
@@ -55,7 +55,7 @@ main (void)
/* Check that only two loops are analyzed, and that both can be
parallelized. */
/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 2 "parloops1" } } */
-/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 2 "parloops1" } } */
+/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 2 "parloops1" } } */
/* { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } */
/* Check that the loop has been split off into a function. */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-loop-data.c b/gcc/testsuite/c-c++-common/goacc/kernels-loop-data.c
index a658182..0ef5765 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-loop-data.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-loop-data.c
@@ -53,7 +53,7 @@ main (void)
/* Check that only three loops are analyzed, and that all can be
parallelized. */
/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 3 "parloops1" } } */
-/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 3 "parloops1" } } */
+/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 3 "parloops1" } } */
/* { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } */
/* Check that the loop has been split off into a function. */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-loop-g.c b/gcc/testsuite/c-c++-common/goacc/kernels-loop-g.c
index 5bdaa40..cf9f1ee 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-loop-g.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-loop-g.c
@@ -10,7 +10,7 @@
/* Check that only one loop is analyzed, and that it can be parallelized. */
/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } } */
-/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } } */
+/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "parloops1" } } */
/* { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } */
/* Check that the loop has been split off into a function. */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-loop-mod-not-zero.c b/gcc/testsuite/c-c++-common/goacc/kernels-loop-mod-not-zero.c
index 5592623..eea9a73 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-loop-mod-not-zero.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-loop-mod-not-zero.c
@@ -43,7 +43,7 @@ main (void)
/* Check that only one loop is analyzed, and that it can be parallelized. */
/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } } */
-/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } } */
+/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "parloops1" } } */
/* { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } */
/* Check that the loop has been split off into a function. */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-loop-n.c b/gcc/testsuite/c-c++-common/goacc/kernels-loop-n.c
index e86be1b..a63ed8a 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-loop-n.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-loop-n.c
@@ -46,7 +46,7 @@ foo (COUNTERTYPE n)
/* Check that only one loop is analyzed, and that it can be parallelized. */
/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } } */
-/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } } */
+/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "parloops1" } } */
/* { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } */
/* Check that the loop has been split off into a function. */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-loop-nest.c b/gcc/testsuite/c-c++-common/goacc/kernels-loop-nest.c
index 2b0e186..b3bb5ca 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-loop-nest.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-loop-nest.c
@@ -30,7 +30,7 @@ main (void)
/* Check that only one loop is analyzed, and that it can be parallelized. */
/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } } */
-/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } } */
+/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "parloops1" } } */
/* { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } */
/* Check that the loop has been split off into a function. */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-loop.c b/gcc/testsuite/c-c++-common/goacc/kernels-loop.c
index 9619d53..2602081 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-loop.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-loop.c
@@ -46,7 +46,7 @@ main (void)
/* Check that only one loop is analyzed, and that it can be parallelized. */
/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } } */
-/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } } */
+/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "parloops1" } } */
/* { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } */
/* Check that the loop has been split off into a function. */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-one-counter-var.c b/gcc/testsuite/c-c++-common/goacc/kernels-one-counter-var.c
index 69539b2..0d9c875 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-one-counter-var.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-one-counter-var.c
@@ -44,7 +44,7 @@ main (void)
/* Check that only one loop is analyzed, and that it can be parallelized. */
/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } } */
-/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } } */
+/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "parloops1" } } */
/* { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } */
/* Check that the loop has been split off into a function. */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-parallel-loop-data-enter-exit.c b/gcc/testsuite/c-c++-common/goacc/kernels-parallel-loop-data-enter-exit.c
index 81b0fee..1dcd32f 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-parallel-loop-data-enter-exit.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-parallel-loop-data-enter-exit.c
@@ -57,7 +57,7 @@ main (void)
// FIXME: OpenACC kernels stopped working with the firstprivate subarray
// changes.
/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 2 "parloops1" { xfail *-*-* } } } */
-/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 2 "parloops1" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 2 "parloops1" { xfail *-*-* } } } */
/* { dg-final { scan-tree-dump-not "FAILED:" "parloops1" { xfail *-*-* } } } */
/* Check that the loop has been split off into a function. */
diff --git a/gcc/testsuite/c-c++-common/goacc/mdc-2.c b/gcc/testsuite/c-c++-common/goacc/mdc-2.c
index df3ce54..246625c 100644
--- a/gcc/testsuite/c-c++-common/goacc/mdc-2.c
+++ b/gcc/testsuite/c-c++-common/goacc/mdc-2.c
@@ -37,7 +37,9 @@ t1 ()
#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 } */
#pragma acc exit data detach(z[3]) /* { dg-error "expected pointer in .detach. clause" } */
+/* { dg-error "has no data movement clause" "" { target *-*-* } .-1 } */
#pragma acc enter data attach(s.e)
#pragma acc exit data detach(s.e) attach(z) /* { dg-error ".attach. is not valid for" } */
diff --git a/gcc/testsuite/c-c++-common/gomp/atomic-32.c b/gcc/testsuite/c-c++-common/gomp/atomic-32.c
new file mode 100644
index 0000000..e39a967
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-32.c
@@ -0,0 +1,14 @@
+/* PR c++/106448 */
+
+int x, expr;
+
+void
+foo (void)
+{
+ #pragma omp atomic compare
+ x = (expr > x) ? expr : x; /* { dg-error "invalid (form|operator)" } */
+ #pragma omp atomic compare
+ x = (x < expr) ? expr : x; /* { dg-error "invalid (form|operator)" } */
+ #pragma omp atomic compare
+ x = (x == expr) ? expr : x; /* { dg-error "invalid (form|operator)" } */
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/doacross-2.c b/gcc/testsuite/c-c++-common/gomp/doacross-2.c
index cc45487..44c5c21 100644
--- a/gcc/testsuite/c-c++-common/gomp/doacross-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/doacross-2.c
@@ -7,13 +7,13 @@ foo (void)
#pragma omp for ordered(1)
for (i = 0; i < 64; i++)
{
- #pragma omp ordered /* { dg-error "'ordered' region without 'depend' clause may not be closely nested inside a loop region with an 'ordered' clause with a parameter" } */
+ #pragma omp ordered
;
}
#pragma omp for ordered(1)
for (i = 0; i < 64; i++)
{
- #pragma omp ordered threads /* { dg-error "'ordered' region without 'depend' clause may not be closely nested inside a loop region with an 'ordered' clause with a parameter" } */
+ #pragma omp ordered threads
;
}
}
@@ -25,14 +25,20 @@ bar (void)
#pragma omp for ordered
for (i = 0; i < 64; i++)
{
- #pragma omp ordered depend(source) /* { dg-error "'ordered' construct with 'depend' clause must be closely nested inside a loop with 'ordered' clause with a parameter" } */
- #pragma omp ordered depend(sink: i - 1) /* { dg-error "'ordered' construct with 'depend' clause must be closely nested inside a loop with 'ordered' clause with a parameter" } */
+ #pragma omp ordered depend(source)
+ #pragma omp ordered depend(sink: i - 1)
+ }
+ #pragma omp for ordered
+ for (i = 0; i < 64; i++)
+ {
+ #pragma omp ordered doacross(source:)
+ #pragma omp ordered doacross(sink: i - 1)
}
#pragma omp for
for (i = 0; i < 64; i++)
{
- #pragma omp ordered depend(source) /* { dg-error "'ordered' construct with 'depend' clause must be closely nested inside a loop with 'ordered' clause with a parameter" } */
- #pragma omp ordered depend(sink: i - 1) /* { dg-error "'ordered' construct with 'depend' clause must be closely nested inside a loop with 'ordered' clause with a parameter" } */
+ #pragma omp ordered depend(source) /* { dg-error "'ordered' construct with 'depend' clause must be closely nested inside a loop with 'ordered' clause" } */
+ #pragma omp ordered depend(sink: i - 1) /* { dg-error "'ordered' construct with 'depend' clause must be closely nested inside a loop with 'ordered' clause" } */
}
#pragma omp for
for (i = 0; i < 64; i++)
diff --git a/gcc/testsuite/c-c++-common/gomp/doacross-5.c b/gcc/testsuite/c-c++-common/gomp/doacross-5.c
new file mode 100644
index 0000000..9dd6dbf
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/doacross-5.c
@@ -0,0 +1,94 @@
+void
+foo (int n)
+{
+ int i;
+ #pragma omp for ordered
+ for (i = 0; i < 8; i += n)
+ {
+ #pragma omp ordered doacross(source:)
+ #pragma omp ordered doacross(sink: i - 2)
+ }
+}
+
+void
+bar (int n)
+{
+ int i, j;
+ #pragma omp for collapse(2) ordered(2)
+ for (i = 0; i < 8; i += n)
+ for (j = 0; j < 8; j += n)
+ {
+ #pragma omp ordered doacross(source:omp_cur_iteration)
+ #pragma omp ordered doacross(sink: i - 2, j + 2)
+ }
+}
+
+void
+baz (void)
+{
+ int i, j;
+ #pragma omp for ordered(1)
+ for (i = 0; i < 64; i++)
+ {
+ #pragma omp ordered /* { dg-error "'ordered' construct without 'doacross' or 'depend' clauses must not have the same binding region as 'ordered' construct with those clauses" } */
+ ;
+ #pragma omp ordered doacross(source:)
+ #pragma omp ordered doacross(sink: i - 1)
+ }
+ #pragma omp for ordered
+ for (i = 0; i < 64; i++)
+ {
+ #pragma omp ordered doacross(source: omp_cur_iteration )
+ #pragma omp ordered doacross(sink: i - 1)
+ #pragma omp ordered threads /* { dg-error "'ordered' construct without 'doacross' or 'depend' clauses must not have the same binding region as 'ordered' construct with those clauses" } */
+ ;
+ }
+ #pragma omp for ordered(2)
+ for (i = 0; i < 8; i++)
+ for (j = 0; j < 8; j++)
+ {
+ #pragma omp ordered /* { dg-error "'ordered' construct without 'doacross' or 'depend' clauses binds to loop where 'collapse' argument 1 is different from 'ordered' argument 2" } */
+ ;
+ }
+ #pragma omp for ordered(2) collapse(1)
+ for (i = 0; i < 8; i++)
+ for (j = 0; j < 8; j++)
+ {
+ #pragma omp ordered threads /* { dg-error "'ordered' construct without 'doacross' or 'depend' clauses binds to loop where 'collapse' argument 1 is different from 'ordered' argument 2" } */
+ ;
+ }
+}
+
+void
+qux (void)
+{
+ int i, j = 0;
+ #pragma omp for ordered linear(j)
+ for (i = 0; i < 64; i++)
+ {
+ ++j;
+ #pragma omp ordered
+ ;
+ }
+ #pragma omp for ordered linear(j) /* { dg-error "'linear' clause may not be specified together with 'ordered' clause if stand-alone 'ordered' construct is nested in it" } */
+ for (i = 0; i < 64; i++)
+ {
+ ++j;
+ #pragma omp ordered doacross(source:)
+ #pragma omp ordered doacross(sink:i-1)
+ }
+ #pragma omp for ordered(1) linear(j)
+ for (i = 0; i < 64; i++)
+ {
+ ++j;
+ #pragma omp ordered
+ ;
+ }
+ #pragma omp for ordered(1) linear(j) /* { dg-error "'linear' clause may not be specified together with 'ordered' clause if stand-alone 'ordered' construct is nested in it" } */
+ for (i = 0; i < 64; i++)
+ {
+ ++j;
+ #pragma omp ordered doacross(source:)
+ #pragma omp ordered doacross(sink:i-1)
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/doacross-6.c b/gcc/testsuite/c-c++-common/gomp/doacross-6.c
new file mode 100644
index 0000000..65ee897
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/doacross-6.c
@@ -0,0 +1,106 @@
+void
+foo (int n)
+{
+ int i;
+ #pragma omp for ordered
+ for (i = 0; i < 8; i += n)
+ {
+ #pragma omp ordered doacross(source) /* { dg-error "expected ':' before '\\\)' token" } */
+ }
+ #pragma omp for ordered
+ for (i = 0; i < 8; i += n)
+ {
+ #pragma omp ordered doacross(source:omp_current_iteration) /* { dg-error "expected '\\\)' before 'omp_current_iteration'" } */
+ }
+ #pragma omp for ordered
+ for (i = 0; i < 8; i += n)
+ {
+ #pragma omp ordered doacross(source:i - 2) /* { dg-error "expected '\\\)' before 'i'" } */
+ }
+ #pragma omp for ordered
+ for (i = 0; i < 8; i += n)
+ {
+ #pragma omp ordered doacross(sink) /* { dg-error "expected ':' before '\\\)' token" } */
+ }
+ #pragma omp for ordered
+ for (i = 0; i < 8; i += n)
+ {
+ #pragma omp ordered doacross(source) /* { dg-error "expected ':' before '\\\)' token" } */
+ #pragma omp ordered doacross(sink:i-1)
+ }
+ #pragma omp for ordered
+ for (i = 0; i < 8; i += n)
+ {
+ #pragma omp ordered doacross(source:)
+ #pragma omp ordered doacross(sink) /* { dg-error "expected ':' before '\\\)' token" } */
+ }
+}
+
+void
+bar (int n)
+{
+ int i;
+ #pragma omp for ordered
+ for (i = 0; i < 8; i += n)
+ {
+ #pragma omp ordered doacross(sink:omp_current_iteration - 1) /* { dg-error "'omp_current_iteration' undeclared \\\(first use in this function\\\)" "" { target c } } */
+ } /* { dg-error "'omp_current_iteration' has not been declared" "" { target c++ } .-1 } */
+ #pragma omp for ordered
+ for (i = 0; i < 8; i += n)
+ {
+ #pragma omp ordered doacross(sink:omp_cur_iteration) /* { dg-error "'omp_cur_iteration' undeclared \\\(first use in this function\\\)" "" { target c } } */
+ } /* { dg-error "'omp_cur_iteration' has not been declared" "" { target c++ } .-1 } */
+}
+
+void
+baz (int n)
+{
+ int i;
+ #pragma omp for ordered
+ for (i = 0; i < 8; i += n)
+ {
+ #pragma omp ordered doacross(sink:omp_cur_iteration + 1) /* { dg-error "'omp_cur_iteration' undeclared \\\(first use in this function\\\)" "" { target c } } */
+ } /* { dg-error "'omp_cur_iteration' has not been declared" "" { target c++ } .-1 } */
+}
+
+void
+qux (int n)
+{
+ int i;
+ #pragma omp for ordered
+ for (i = 0; i < 8; i += n)
+ {
+ #pragma omp ordered doacross(sink:omp_cur_iteration - (2 - 1)) /* { dg-error "'omp_cur_iteration' undeclared \\\(first use in this function\\\)" "" { target c } } */
+ } /* { dg-error "expected integer before '\\\(' token" "" { target *-*-* } .-1 } */
+} /* { dg-error "'omp_cur_iteration' has not been declared" "" { target c++ } .-2 } */
+ /* { dg-error "expected '\\\)' before '\\\(' token" "" { target c++ } .-3 } */
+void
+corge (int n)
+{
+ int i;
+ #pragma omp for ordered
+ for (i = 0; i < 8; i += n)
+ {
+ #pragma omp ordered doacross(sink:omp_cur_iteration - 1)
+ }
+ #pragma omp for ordered
+ for (i = 0; i < 8; i += n)
+ {
+ #pragma omp ordered doacross(sink:omp_cur_iteration - 1LL)
+ }
+ #pragma omp for ordered
+ for (i = 0; i < 8; i += n)
+ {
+ #pragma omp ordered doacross(sink:omp_cur_iteration - 0x00001)
+ }
+ #pragma omp for ordered
+ for (i = 0; i < 8; i += n)
+ {
+ #pragma omp ordered doacross(sink:omp_cur_iteration - 001)
+ }
+ #pragma omp for ordered
+ for (i = 0; i < 8; i += n)
+ {
+ #pragma omp ordered doacross(sink:omp_cur_iteration - 1ULL)
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/doacross-7.c b/gcc/testsuite/c-c++-common/gomp/doacross-7.c
new file mode 100644
index 0000000..8ead167
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/doacross-7.c
@@ -0,0 +1,78 @@
+void
+foo (int l)
+{
+ int i, j, k;
+ #pragma omp parallel
+ {
+ #pragma omp for schedule(static) ordered (3)
+ for (i = 2; i < 256 / 16 - 1; i++)
+ for (j = 0; j < 8; j += 2)
+ for (k = 1; k <= 3; k++)
+ {
+ #pragma omp ordered doacross(sink: omp_cur_iteration - 1)
+ #pragma omp ordered doacross(source:)
+ }
+ #pragma omp for schedule(static) ordered (3) collapse(2)
+ for (i = 2; i < 256 / 16 - 1; i++)
+ for (j = 0; j < 8; j += 2)
+ for (k = 1; k <= 3; k++)
+ {
+ #pragma omp ordered doacross(sink: omp_cur_iteration - 1)
+ #pragma omp ordered doacross(source:)
+ }
+ #pragma omp for schedule(static) ordered (3) collapse(3)
+ for (i = 2; i < 256 / 16 - 1; i++)
+ for (j = 0; j < 8; j += 2)
+ for (k = 1; k <= 3; k++)
+ {
+ #pragma omp ordered doacross(sink: omp_cur_iteration - 1)
+ #pragma omp ordered doacross(source: omp_cur_iteration)
+ }
+ #pragma omp for schedule(static) ordered (1) nowait
+ for (i = 2; i < 256 / 16 - 1; i += l)
+ {
+ #pragma omp ordered doacross(sink: omp_cur_iteration - 1)
+ #pragma omp ordered doacross(source:)
+ }
+ }
+}
+
+void
+bar (int l, int m, int n, int o)
+{
+ int i, j, k;
+ #pragma omp for schedule(static) ordered (3)
+ for (i = 2; i < 256 / 16 - 1; i++)
+ for (j = 0; j < m; j += n)
+ for (k = o; k <= 3; k++)
+ {
+ foo (l);
+ #pragma omp ordered doacross(sink: omp_cur_iteration - 1)
+ #pragma omp ordered doacross(source:omp_cur_iteration)
+ }
+ #pragma omp for schedule(static) ordered (3) collapse(2)
+ for (i = 2; i < 256 / 16 - m; i += n)
+ for (j = 0; j < 8; j += o)
+ for (k = 1; k <= 3; k++)
+ {
+ foo (l);
+ #pragma omp ordered doacross(sink: omp_cur_iteration - 1)
+ #pragma omp ordered doacross(source : omp_cur_iteration)
+ }
+ #pragma omp for schedule(static) ordered (3) collapse(3)
+ for (i = m; i < 256 / 16 - 1; i++)
+ for (j = 0; j < n; j += 2)
+ for (k = 1; k <= o; k++)
+ {
+ foo (l);
+ #pragma omp ordered doacross(sink: omp_cur_iteration - 1)
+ #pragma omp ordered doacross(source :)
+ }
+ #pragma omp for schedule(static) ordered
+ for (i = m; i < n / 16 - 1; i += l)
+ {
+ foo (l);
+ #pragma omp ordered doacross(sink: omp_cur_iteration - 1)
+ #pragma omp ordered doacross(source: omp_cur_iteration)
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/map-incomplete-type.c b/gcc/testsuite/c-c++-common/gomp/map-incomplete-type.c
new file mode 100644
index 0000000..29702de
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/map-incomplete-type.c
@@ -0,0 +1,17 @@
+struct incomplete_t;
+/* { dg-note "forward declaration of 'struct incomplete_t'" "" { target c++ } .-1 } */
+
+/* Note: This note is only printed with C++ (trice); the loc is available due to TYPE_MAIN_DECL. */
+
+struct incomplete_t *ptr;
+int i;
+
+void
+foo (void)
+{
+ #pragma omp target enter data map(to: i) map(to: ptr[0])
+ /* All apply to the line above. The first error is printed twice. */
+ /* { dg-error "invalid use of undefined type 'struct incomplete_t'" "" { target c } .-2 } */
+ /* { dg-error "invalid use of incomplete type 'struct incomplete_t'" "" { target c++ } .-3 } */
+ /* { dg-error "array section does not have mappable type in 'map' clause" "" { target *-*-* } .-4 } */
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/nesting-2.c b/gcc/testsuite/c-c++-common/gomp/nesting-2.c
index 420cfd3..6ce560d 100644
--- a/gcc/testsuite/c-c++-common/gomp/nesting-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/nesting-2.c
@@ -160,7 +160,14 @@ foo (void)
for (i = 0; i < 64; i++)
#pragma omp parallel
{
- #pragma omp ordered depend(source) /* { dg-error ".ordered. construct with .depend. clause must be closely nested inside a loop with .ordered. clause with a parameter" } */
- #pragma omp ordered depend(sink: i - 1) /* { dg-error ".ordered. construct with .depend. clause must be closely nested inside a loop with .ordered. clause with a parameter" } */
+ #pragma omp ordered depend(source) /* { dg-error ".ordered. construct with .depend. clause must be closely nested inside a loop with .ordered. clause" } */
+ #pragma omp ordered depend(sink: i - 1) /* { dg-error ".ordered. construct with .depend. clause must be closely nested inside a loop with .ordered. clause" } */
+ }
+ #pragma omp for ordered(1)
+ for (i = 0; i < 64; i++)
+ #pragma omp parallel
+ {
+ #pragma omp ordered doacross(source:) /* { dg-error ".ordered. construct with .doacross. clause must be closely nested inside a loop with .ordered. clause" } */
+ #pragma omp ordered doacross(sink: i - 1) /* { dg-error ".ordered. construct with .doacross. clause must be closely nested inside a loop with .ordered. clause" } */
}
}
diff --git a/gcc/testsuite/c-c++-common/gomp/ompx-1.c b/gcc/testsuite/c-c++-common/gomp/ompx-1.c
new file mode 100644
index 0000000..9758d0f
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/ompx-1.c
@@ -0,0 +1,4 @@
+void f(void)
+{
+ #pragma ompx some_vendor_extension
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/ompx-2.c b/gcc/testsuite/c-c++-common/gomp/ompx-2.c
new file mode 100644
index 0000000..4b66b0e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/ompx-2.c
@@ -0,0 +1,5 @@
+/* { dg-additional-options "-Wunknown-pragmas" } */
+void f(void)
+{
+ #pragma ompx some_vendor_extension /* { dg-warning "-:ignoring '#pragma ompx some_vendor_extension'" } */
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/ordered-3.c b/gcc/testsuite/c-c++-common/gomp/ordered-3.c
index e7fd738..b007ca7 100644
--- a/gcc/testsuite/c-c++-common/gomp/ordered-3.c
+++ b/gcc/testsuite/c-c++-common/gomp/ordered-3.c
@@ -47,29 +47,53 @@ foo (void)
#pragma omp ordered threads, simd, threads, simd /* { dg-error "too many .threads. clauses" } */
; /* { dg-error "too many .simd. clauses" "" { target *-*-* } .-1 } */
}
- #pragma omp for simd ordered(1) /* { dg-error ".ordered. clause with parameter may not be specified on .#pragma omp for simd. construct" } */
+ #pragma omp for simd ordered(1)
for (i = 0; i < 64; i++)
{
- #pragma omp ordered depend(sink: i - 1) /* { dg-error "clause must be closely nested inside a loop with .ordered. clause with a parameter" } */
- #pragma omp ordered depend(source) /* { dg-error "clause must be closely nested inside a loop with .ordered. clause with a parameter" } */
+ #pragma omp ordered depend(sink: i - 1) /* { dg-error "clause must be closely nested inside a loop with .ordered. clause" } */
+ #pragma omp ordered depend(source) /* { dg-error "clause must be closely nested inside a loop with .ordered. clause" } */
}
- #pragma omp parallel for simd ordered(1) /* { dg-error ".ordered. clause with parameter may not be specified on .#pragma omp parallel for simd. construct" } */
+ #pragma omp for simd ordered(1)
for (i = 0; i < 64; i++)
{
- #pragma omp ordered depend(sink: i - 1) /* { dg-error "clause must be closely nested inside a loop with .ordered. clause with a parameter" } */
- #pragma omp ordered depend(source) /* { dg-error "clause must be closely nested inside a loop with .ordered. clause with a parameter" } */
+ #pragma omp ordered doacross(sink: i - 1) /* { dg-error "clause must be closely nested inside a loop with .ordered. clause" } */
+ #pragma omp ordered doacross(source:omp_cur_iteration) /* { dg-error "clause must be closely nested inside a loop with .ordered. clause" } */
+ }
+ #pragma omp parallel for simd ordered(1)
+ for (i = 0; i < 64; i++)
+ {
+ #pragma omp ordered depend(sink: i - 1) /* { dg-error "clause must be closely nested inside a loop with .ordered. clause" } */
+ #pragma omp ordered depend(source) /* { dg-error "clause must be closely nested inside a loop with .ordered. clause" } */
+ }
+ #pragma omp parallel for simd ordered(1)
+ for (i = 0; i < 64; i++)
+ {
+ #pragma omp ordered doacross(sink: i - 1) /* { dg-error "clause must be closely nested inside a loop with .ordered. clause" } */
+ #pragma omp ordered doacross(source:) /* { dg-error "clause must be closely nested inside a loop with .ordered. clause" } */
+ }
+ #pragma omp parallel for ordered
+ for (i = 0; i < 64; i++)
+ {
+ #pragma omp ordered depend(sink: i - 1)
+ #pragma omp ordered depend(source)
}
#pragma omp parallel for ordered
for (i = 0; i < 64; i++)
{
- #pragma omp ordered depend(sink: i - 1) /* { dg-error "clause must be closely nested inside a loop with .ordered. clause with a parameter" } */
- #pragma omp ordered depend(source) /* { dg-error "clause must be closely nested inside a loop with .ordered. clause with a parameter" } */
+ #pragma omp ordered doacross(sink: i - 1)
+ #pragma omp ordered doacross(source:)
+ }
+ #pragma omp parallel for
+ for (i = 0; i < 64; i++)
+ {
+ #pragma omp ordered depend(sink: i - 1) /* { dg-error "clause must be closely nested inside a loop with .ordered. clause" } */
+ #pragma omp ordered depend(source) /* { dg-error "clause must be closely nested inside a loop with .ordered. clause" } */
}
#pragma omp parallel for
for (i = 0; i < 64; i++)
{
- #pragma omp ordered depend(sink: i - 1) /* { dg-error "clause must be closely nested inside a loop with .ordered. clause with a parameter" } */
- #pragma omp ordered depend(source) /* { dg-error "clause must be closely nested inside a loop with .ordered. clause with a parameter" } */
+ #pragma omp ordered doacross(sink: i - 1) /* { dg-error "clause must be closely nested inside a loop with .ordered. clause" } */
+ #pragma omp ordered doacross(source:) /* { dg-error "clause must be closely nested inside a loop with .ordered. clause" } */
}
}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr106836.c b/gcc/testsuite/c-c++-common/gomp/pr106836.c
new file mode 100644
index 0000000..6df8250
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr106836.c
@@ -0,0 +1,9 @@
+/* PR c/106836 */
+
+void
+foo (void)
+{
+#pragma omp target parallel depend (source) /* { dg-error "'depend\\\(source\\\)' is only allowed in 'omp ordered'" } */
+ ;
+#pragma omp taskwait
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/reverse-offload-1.c b/gcc/testsuite/c-c++-common/gomp/reverse-offload-1.c
index 3452156..9a3fa52 100644
--- a/gcc/testsuite/c-c++-common/gomp/reverse-offload-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/reverse-offload-1.c
@@ -43,7 +43,7 @@ tg_fn (int *x, int *y)
x2 = x2 + 2 + called_in_target1 ();
y2 = y2 + 7;
- #pragma omp target device(ancestor : 1) map(tofrom: x2) /* { dg-message "sorry, unimplemented: 'ancestor' not yet supported" } */
+ #pragma omp target device(ancestor : 1) map(tofrom: x2)
check_offload(&x2, &y2);
if (x2 != 2+2+3+42 || y2 != 3 + 7)
diff --git a/gcc/testsuite/c-c++-common/gomp/sink-3.c b/gcc/testsuite/c-c++-common/gomp/sink-3.c
index 588aea2..7cb16ed 100644
--- a/gcc/testsuite/c-c++-common/gomp/sink-3.c
+++ b/gcc/testsuite/c-c++-common/gomp/sink-3.c
@@ -14,7 +14,7 @@ foo ()
for (i=0; i < 100; ++i)
{
#pragma omp ordered depend(sink:poo-1,paa+1) /* { dg-error "poo.*declared.*paa.*declared" } */
- bar(&i); /* { dg-error "may not be closely nested" "" { target *-*-* } .-1 } */
+ bar(&i);
#pragma omp ordered depend(source)
}
}
diff --git a/gcc/testsuite/c-c++-common/gomp/target-50.c b/gcc/testsuite/c-c++-common/gomp/target-50.c
new file mode 100644
index 0000000..41f1d37
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/target-50.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-gimple" } */
+
+typedef struct
+{
+ int *arr;
+} L;
+
+int main()
+{
+ L *tmp;
+
+ /* There shouldn't be an order dependency here... */
+
+ #pragma omp target map(to: tmp->arr) map(tofrom: tmp->arr[0:10])
+ { }
+
+ #pragma omp target map(tofrom: tmp->arr[0:10]) map(to: tmp->arr)
+ { }
+/* { dg-final { scan-tree-dump-times {map\(struct:\*tmp \[len: 1\]\) map\(to:tmp[._0-9]*->arr \[len: [0-9]+\]\) map\(tofrom:\*_[0-9]+ \[len: [0-9]+\]\) map\(attach:tmp[._0-9]*->arr \[bias: 0\]\)} 2 "gimple" { target { ! { nvptx*-*-* amdgcn*-*-* } } } } } */
+
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/target-device-ancestor-4.c b/gcc/testsuite/c-c++-common/gomp/target-device-ancestor-4.c
index 241234f..87ac754 100644
--- a/gcc/testsuite/c-c++-common/gomp/target-device-ancestor-4.c
+++ b/gcc/testsuite/c-c++-common/gomp/target-device-ancestor-4.c
@@ -9,7 +9,7 @@
void
foo (void)
{
- #pragma omp target device (ancestor: 1) /* { dg-message "sorry, unimplemented: 'ancestor' not yet supported" } */
+ #pragma omp target device (ancestor: 1)
;
}
diff --git a/gcc/testsuite/c-c++-common/pragma-diag-14.c b/gcc/testsuite/c-c++-common/pragma-diag-14.c
new file mode 100644
index 0000000..618e7e1
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pragma-diag-14.c
@@ -0,0 +1,9 @@
+/* { dg-do preprocess } */
+/* { dg-additional-options "-Wunused-macros" } */
+
+/* In the past, the pragma has erroneously disabled the warning because the
+ location was not tracked properly with -E or -save-temps; check that it works
+ now. */
+
+#define X /* { dg-warning "-:-Wunused-macros" } */
+#pragma GCC diagnostic ignored "-Wunused-macros"
diff --git a/gcc/testsuite/c-c++-common/pragma-diag-15.c b/gcc/testsuite/c-c++-common/pragma-diag-15.c
new file mode 100644
index 0000000..8ffff88
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pragma-diag-15.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Wunused-macros" } */
+
+/* In the past, the pragma has erroneously disabled the warning because the
+ location was not tracked properly with -E or -save-temps; check that it works
+ now.
+
+ This test currently fails for C++ but it's not because of the pragma, it's
+ because the location of the macro definition is incorrectly set. This is a
+ separate issue, will resolve it in a later patch. */
+
+#define X /* { dg-warning "-:-Wunused-macros" } */
+#pragma GCC diagnostic ignored "-Wunused-macros"
diff --git a/gcc/testsuite/g++.dg/abi/anon1.C b/gcc/testsuite/g++.dg/abi/anon1.C
index 0fb4ae8..52018c3 100644
--- a/gcc/testsuite/g++.dg/abi/anon1.C
+++ b/gcc/testsuite/g++.dg/abi/anon1.C
@@ -1,4 +1,5 @@
// PR c++/54883
+// { dg-additional-options "-fno-pie" { target ia32 } }
namespace { enum E { E1 }; } void f(E e) { }
diff --git a/gcc/testsuite/g++.dg/abi/anon4.C b/gcc/testsuite/g++.dg/abi/anon4.C
index 8200f4b..517cc52 100644
--- a/gcc/testsuite/g++.dg/abi/anon4.C
+++ b/gcc/testsuite/g++.dg/abi/anon4.C
@@ -1,5 +1,5 @@
// PR c++/65209
-// { dg-additional-options "-fno-pie" { target sparc*-*-* } }
+// { dg-additional-options "-fno-pie" { target { ia32 || sparc*-*-* } } }
// { dg-final { scan-assembler-not "comdat" } }
// Everything involving the anonymous namespace bits should be private, not
diff --git a/gcc/testsuite/g++.dg/analyzer/out-of-bounds-placement-new.C b/gcc/testsuite/g++.dg/analyzer/out-of-bounds-placement-new.C
new file mode 100644
index 0000000..d3076c3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/analyzer/out-of-bounds-placement-new.C
@@ -0,0 +1,19 @@
+/* Reduced from pr100244.C. */
+inline void *operator new (__SIZE_TYPE__, void *__p) { return __p; }
+
+struct int_container {
+ int i;
+ int *addr () { return &i; }
+};
+
+struct int_and_addr {
+ int i;
+ int *addr;
+ int_and_addr () { addr = &i; } /* { dg-warning "overflow" } */
+};
+
+int test (int_container ic)
+{
+ int_and_addr *iaddr = new (ic.addr ()) int_and_addr;
+ return iaddr->i;
+}
diff --git a/gcc/testsuite/g++.dg/analyzer/pr100244.C b/gcc/testsuite/g++.dg/analyzer/pr100244.C
index 1d5e13d..6e2ac4c 100644
--- a/gcc/testsuite/g++.dg/analyzer/pr100244.C
+++ b/gcc/testsuite/g++.dg/analyzer/pr100244.C
@@ -1,4 +1,7 @@
-// { dg-additional-options "-O1 -Wno-free-nonheap-object" }
+// { dg-additional-options "-O1 -Wno-free-nonheap-object -Wno-analyzer-out-of-bounds" }
+/* Disabled out-of-bounds checker because the output relied
+ on optimizations. out-of-bounds-placement-new.C tests
+ the same pattern but without optimizations. */
inline void *operator new (__SIZE_TYPE__, void *__p) { return __p; }
diff --git a/gcc/testsuite/g++.dg/coroutines/pr106188.C b/gcc/testsuite/g++.dg/coroutines/pr106188.C
new file mode 100644
index 0000000..9db3778
--- /dev/null
+++ b/gcc/testsuite/g++.dg/coroutines/pr106188.C
@@ -0,0 +1,34 @@
+// { dg-do run { target c++20 } }
+// test case from pr106188, w/o workaround
+#include <coroutine>
+
+struct task {
+ struct promise_type {
+ task get_return_object() { return task{}; }
+ void return_void() {}
+ void unhandled_exception() {}
+ auto initial_suspend() noexcept { return std::suspend_never{}; }
+ auto final_suspend() noexcept { return std::suspend_never{}; }
+ };
+};
+
+struct suspend_and_resume {
+ bool await_ready() const { return false; }
+ void await_suspend(std::coroutine_handle<> h) { h.resume(); }
+ void await_resume() {}
+};
+
+task f() {
+ if (co_await suspend_and_resume{}, false) {}
+}
+
+task g() {
+ switch (co_await suspend_and_resume{}, 0) {
+ default: break;
+ }
+}
+
+int main() {
+ f();
+ g();
+}
diff --git a/gcc/testsuite/g++.dg/cpp/delimited-escape-seq-1.C b/gcc/testsuite/g++.dg/cpp/delimited-escape-seq-1.C
new file mode 100644
index 0000000..a9c8a0c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp/delimited-escape-seq-1.C
@@ -0,0 +1,8 @@
+// P2290R3 - Delimited escape sequences
+// { dg-do compile { target c++11 } }
+// { dg-require-effective-target wchar }
+// { dg-options "-pedantic" }
+
+const char32_t *a = U"\u{1234}"; // { dg-warning "delimited escape sequences are only valid in" "" { target c++20_down } }
+const char32_t *b = U"\x{1234}"; // { dg-warning "delimited escape sequences are only valid in" "" { target c++20_down } }
+const char32_t *c = U"\o{1234}"; // { dg-warning "delimited escape sequences are only valid in" "" { target c++20_down } }
diff --git a/gcc/testsuite/g++.dg/cpp/delimited-escape-seq-2.C b/gcc/testsuite/g++.dg/cpp/delimited-escape-seq-2.C
new file mode 100644
index 0000000..51af741
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp/delimited-escape-seq-2.C
@@ -0,0 +1,8 @@
+// P2290R3 - Delimited escape sequences
+// { dg-do compile { target c++11 } }
+// { dg-require-effective-target wchar }
+// { dg-options "-pedantic-errors" }
+
+const char32_t *a = U"\u{1234}"; // { dg-error "delimited escape sequences are only valid in" "" { target c++20_down } }
+const char32_t *b = U"\x{1234}"; // { dg-error "delimited escape sequences are only valid in" "" { target c++20_down } }
+const char32_t *c = U"\o{1234}"; // { dg-error "delimited escape sequences are only valid in" "" { target c++20_down } }
diff --git a/gcc/testsuite/g++.dg/cpp/named-universal-char-escape-1.C b/gcc/testsuite/g++.dg/cpp/named-universal-char-escape-1.C
new file mode 100644
index 0000000..d33fd53
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp/named-universal-char-escape-1.C
@@ -0,0 +1,6 @@
+// P2071R2 - Named universal character escapes
+// { dg-do compile { target c++11 } }
+// { dg-require-effective-target wchar }
+// { dg-options "-pedantic" }
+
+const char32_t *a = U"\N{ETHIOPIC SYLLABLE SEE}"; // { dg-warning "named universal character escapes are only valid in" "" { target c++20_down } }
diff --git a/gcc/testsuite/g++.dg/cpp/named-universal-char-escape-2.C b/gcc/testsuite/g++.dg/cpp/named-universal-char-escape-2.C
new file mode 100644
index 0000000..b98a29d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp/named-universal-char-escape-2.C
@@ -0,0 +1,6 @@
+// P2071R2 - Named universal character escapes
+// { dg-do compile { target c++11 } }
+// { dg-require-effective-target wchar }
+// { dg-options "-pedantic-errors" }
+
+const char32_t *a = U"\N{ETHIOPIC SYLLABLE SEE}"; // { dg-error "named universal character escapes are only valid in" "" { target c++20_down } }
diff --git a/gcc/testsuite/g++.dg/cpp/warning-1.C b/gcc/testsuite/g++.dg/cpp/warning-1.C
new file mode 100644
index 0000000..2d857cf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp/warning-1.C
@@ -0,0 +1,6 @@
+// P2437R1 - Support for #warning
+// { dg-do preprocess }
+// { dg-options "-pedantic-errors" }
+
+#warning example text /* { dg-warning "example text" } */
+// { dg-error "#warning before C\\\+\\\+23 is a GCC extension" "pedantic" { target c++20_down } .-1 }
diff --git a/gcc/testsuite/g++.dg/cpp/warning-2.C b/gcc/testsuite/g++.dg/cpp/warning-2.C
new file mode 100644
index 0000000..d6d5d9f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp/warning-2.C
@@ -0,0 +1,6 @@
+// P2437R1 - Support for #warning
+// { dg-do preprocess }
+// { dg-options "-pedantic" }
+
+#warning example text /* { dg-warning "example text" } */
+// { dg-warning "#warning before C\\\+\\\+23 is a GCC extension" "pedantic" { target c++20_down } .-1 }
diff --git a/gcc/testsuite/g++.dg/cpp/warning-3.C b/gcc/testsuite/g++.dg/cpp/warning-3.C
new file mode 100644
index 0000000..1595b4d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp/warning-3.C
@@ -0,0 +1,6 @@
+// P2437R1 - Support for #warning
+// { dg-do preprocess }
+// { dg-options "" }
+
+#warning example text /* { dg-warning "example text" } */
+// { dg-bogus "#warning before C\\\+\\\+23 is a GCC extension" "" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/cpp0x/Wpessimizing-move10.C b/gcc/testsuite/g++.dg/cpp0x/Wpessimizing-move10.C
new file mode 100644
index 0000000..7731414
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/Wpessimizing-move10.C
@@ -0,0 +1,30 @@
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wpessimizing-move" }
+
+// Define std::move.
+namespace std {
+ template<typename _Tp>
+ struct remove_reference
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_reference<_Tp&>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_reference<_Tp&&>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ constexpr typename std::remove_reference<_Tp>::type&&
+ move(_Tp&& __t) noexcept
+ { return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }
+}
+
+struct S { };
+
+S
+f ()
+{
+ return {std::move(S())}; // { dg-warning "moving a temporary object prevents copy elision" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/Wpessimizing-move3.C b/gcc/testsuite/g++.dg/cpp0x/Wpessimizing-move3.C
index a1af123..c81f29a 100644
--- a/gcc/testsuite/g++.dg/cpp0x/Wpessimizing-move3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/Wpessimizing-move3.C
@@ -39,7 +39,7 @@ Tp1
fn2 ()
{
Tp2 t;
- return std::move (t); // { dg-warning "moving a local object in a return statement prevents copy elision" }
+ return std::move (t);
}
template<typename Tp1, typename Tp2>
diff --git a/gcc/testsuite/g++.dg/cpp0x/Wpessimizing-move7.C b/gcc/testsuite/g++.dg/cpp0x/Wpessimizing-move7.C
new file mode 100644
index 0000000..a17c7a8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/Wpessimizing-move7.C
@@ -0,0 +1,63 @@
+// PR c++/106276
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wpessimizing-move" }
+
+// Define std::move.
+namespace std {
+ template<typename _Tp>
+ struct remove_reference
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_reference<_Tp&>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_reference<_Tp&&>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ constexpr typename std::remove_reference<_Tp>::type&&
+ move(_Tp&& __t) noexcept
+ { return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }
+}
+
+struct A { A(); A(const A&) = delete; A(A&&); };
+struct B { B(A); };
+
+static A foo ();
+
+A
+fn1 ()
+{
+ return std::move (A{}); // { dg-warning "moving a temporary object prevents copy elision" }
+ return std::move (A()); // { dg-warning "moving a temporary object prevents copy elision" }
+ return std::move (foo ()); // { dg-warning "moving a temporary object prevents copy elision" }
+}
+
+B fn2 ()
+{
+ return std::move (A()); // { dg-warning "moving a temporary object prevents copy elision" }
+ return std::move (A{}); // { dg-warning "moving a temporary object prevents copy elision" }
+ return std::move (foo ()); // { dg-warning "moving a temporary object prevents copy elision" }
+}
+
+template <typename T1, typename T2>
+T1
+fn3 ()
+{
+ return std::move (T2{}); // { dg-warning "moving a temporary object prevents copy elision" }
+}
+
+void
+do_fn3 ()
+{
+ fn3<A, A>();
+ fn3<B, A>();
+}
+
+char take_buffer;
+struct label_text {
+ label_text take() { return std::move(label_text(&take_buffer)); } // { dg-warning "moving a temporary object prevents copy elision" }
+ label_text(char *);
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/Wpessimizing-move8.C b/gcc/testsuite/g++.dg/cpp0x/Wpessimizing-move8.C
new file mode 100644
index 0000000..51406c8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/Wpessimizing-move8.C
@@ -0,0 +1,65 @@
+// PR c++/106276
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wpessimizing-move" }
+
+// Define std::move.
+namespace std {
+ template<typename _Tp>
+ struct remove_reference
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_reference<_Tp&>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_reference<_Tp&&>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ constexpr typename std::remove_reference<_Tp>::type&&
+ move(_Tp&& __t) noexcept
+ { return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }
+}
+
+struct A { A(); A(const A&) = delete; A(A&&); };
+struct B { B(A); };
+struct X { };
+
+void foo (A);
+void bar (X);
+
+void
+fn1 ()
+{
+ A a1 = std::move (A()); // { dg-warning "moving a temporary object prevents copy elision" }
+ A a2 = std::move (A{}); // { dg-warning "moving a temporary object prevents copy elision" }
+ A a3(std::move (A())); // { dg-warning "moving a temporary object prevents copy elision" }
+ A a4(std::move (A{})); // { dg-warning "moving a temporary object prevents copy elision" }
+ A a5{std::move (A())}; // { dg-warning "moving a temporary object prevents copy elision" }
+ A a6{std::move (A{})}; // { dg-warning "moving a temporary object prevents copy elision" }
+ A a7 = {std::move (A())}; // { dg-warning "moving a temporary object prevents copy elision" }
+ A a8 = {std::move (A{})}; // { dg-warning "moving a temporary object prevents copy elision" }
+
+ B b1 = std::move (A()); // { dg-warning "moving a temporary object prevents copy elision" }
+ B b2(std::move (A())); // { dg-warning "moving a temporary object prevents copy elision" }
+ B b3{std::move (A())}; // { dg-warning "moving a temporary object prevents copy elision" }
+ B b4 = {std::move (A())}; // { dg-warning "moving a temporary object prevents copy elision" }
+
+ X x1 = std::move (X()); // { dg-warning "moving a temporary object prevents copy elision" }
+ X x2 = std::move (X{}); // { dg-warning "moving a temporary object prevents copy elision" }
+ X x3(std::move (X())); // { dg-warning "moving a temporary object prevents copy elision" }
+ X x4(std::move (X{})); // { dg-warning "moving a temporary object prevents copy elision" }
+ X x5{std::move (X())}; // { dg-warning "moving a temporary object prevents copy elision" }
+ X x6{std::move (X{})}; // { dg-warning "moving a temporary object prevents copy elision" }
+ X x7 = {std::move (X())}; // { dg-warning "moving a temporary object prevents copy elision" }
+ X x8 = {std::move (X{})}; // { dg-warning "moving a temporary object prevents copy elision" }
+
+ foo (std::move (A())); // { dg-warning "moving a temporary object prevents copy elision" }
+ foo (std::move (A{})); // { dg-warning "moving a temporary object prevents copy elision" }
+ bar (std::move (X())); // { dg-warning "moving a temporary object prevents copy elision" }
+ bar (std::move (X{})); // { dg-warning "moving a temporary object prevents copy elision" }
+
+ foo (std::move (a1));
+ bar (std::move (x1));
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/Wpessimizing-move9.C b/gcc/testsuite/g++.dg/cpp0x/Wpessimizing-move9.C
new file mode 100644
index 0000000..898040e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/Wpessimizing-move9.C
@@ -0,0 +1,89 @@
+// PR c++/89780
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wpessimizing-move -Wredundant-move" }
+
+// Define std::move.
+namespace std {
+ template<typename _Tp>
+ struct remove_reference
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_reference<_Tp&>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_reference<_Tp&&>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ constexpr typename std::remove_reference<_Tp>::type&&
+ move(_Tp&& __t) noexcept
+ { return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }
+}
+
+struct Dest {
+ Dest() = default;
+ Dest(Dest&&);
+ Dest(const Dest&);
+};
+struct Source : Dest {};
+
+template <typename T>
+Dest withMove() {
+ T x;
+ return std::move(x);
+}
+
+template Dest withMove<Dest>();
+template Dest withMove<Source>();
+
+template<typename T>
+Dest bar () {
+ return std::move(T()); // { dg-warning "moving a temporary object prevents copy elision" }
+}
+
+template Dest bar<Dest>();
+template Dest bar<Source>();
+
+template<typename T>
+Dest baz (T x) {
+ return std::move(x);
+}
+
+void
+call_baz ()
+{
+ Dest d;
+ Source s;
+ baz (d);
+ baz (s);
+}
+
+template<typename>
+Dest foo ()
+{
+ Dest d;
+ return std::move(d); // { dg-warning "moving a local object in a return statement prevents copy elision" }
+}
+
+template Dest foo<int>();
+
+template<typename>
+Dest qux () {
+ return std::move(Dest()); // { dg-warning "moving a temporary object prevents copy elision" }
+}
+
+template Dest qux<int>();
+
+template<typename>
+Dest qui (Dest x) {
+ return std::move(x); // { dg-warning "redundant move in return statement" }
+}
+
+void
+call_qui ()
+{
+ Dest d;
+ qui<int> (d);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/Wredundant-move1.C b/gcc/testsuite/g++.dg/cpp0x/Wredundant-move1.C
index ce4087b4..c227019 100644
--- a/gcc/testsuite/g++.dg/cpp0x/Wredundant-move1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/Wredundant-move1.C
@@ -60,7 +60,8 @@ fn4 (const T t)
{
// t is const: will decay into copy despite std::move, so it's redundant.
// We used to warn about this, but no longer since c++/87378.
- return std::move (t); // { dg-warning "redundant move" "" { target c++20 } }
+ // Now we warn again since c++/90428.
+ return std::move (t); // { dg-warning "redundant move" }
}
int
diff --git a/gcc/testsuite/g++.dg/cpp0x/Wredundant-move10.C b/gcc/testsuite/g++.dg/cpp0x/Wredundant-move10.C
new file mode 100644
index 0000000..a215a47
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/Wredundant-move10.C
@@ -0,0 +1,61 @@
+// PR c++/90428
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wredundant-move" }
+
+// Define std::move.
+namespace std {
+ template<typename _Tp>
+ struct remove_reference
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_reference<_Tp&>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_reference<_Tp&&>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ constexpr typename std::remove_reference<_Tp>::type&&
+ move(_Tp&& __t) noexcept
+ { return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }
+}
+
+struct T { T(); T(const T&); T(T&&) = delete; };
+struct S : T { };
+struct W { W(const W&); W(W&&) = delete; W(const W&&); };
+
+T f1(T t)
+{
+ const T& rt = t;
+ return std::move(rt); // { dg-warning "redundant move" }
+}
+
+T f2(const T& t)
+{
+ return std::move(t); // { dg-warning "redundant move" }
+}
+
+W f3(const W& w)
+{
+ return std::move(w);
+}
+
+T f4(const S& s)
+{
+ return std::move(s);
+}
+
+T f5(const T t)
+{
+ return std::move(t); // { dg-warning "redundant move" }
+}
+
+struct S1 { S1(S1 &&) = delete; S1(const S1&); };
+struct S2: S1 {};
+
+S1 f3(const S2 s)
+{
+ return std::move(s); // { dg-warning "redundant move" "" { target c++20 } }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/Wredundant-move11.C b/gcc/testsuite/g++.dg/cpp0x/Wredundant-move11.C
new file mode 100644
index 0000000..5dfa37f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/Wredundant-move11.C
@@ -0,0 +1,32 @@
+// PR c++/67906
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wall -Wextra" }
+
+// Define std::move.
+namespace std {
+ template<typename _Tp>
+ struct remove_reference
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_reference<_Tp&>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_reference<_Tp&&>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ constexpr typename std::remove_reference<_Tp>::type&&
+ move(_Tp&& __t) noexcept
+ { return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }
+}
+
+struct X {
+ X() { }
+ X(const X&) { }
+ X(const X&&) { }
+};
+
+const X x;
+const X y = std::move(x);
diff --git a/gcc/testsuite/g++.dg/cpp0x/Wredundant-move12.C b/gcc/testsuite/g++.dg/cpp0x/Wredundant-move12.C
new file mode 100644
index 0000000..192d981
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/Wredundant-move12.C
@@ -0,0 +1,36 @@
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wredundant-move" }
+
+// Define std::move.
+namespace std {
+ template<typename _Tp>
+ struct remove_reference
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_reference<_Tp&>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_reference<_Tp&&>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ constexpr typename std::remove_reference<_Tp>::type&&
+ move(_Tp&& __t) noexcept
+ { return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }
+}
+
+struct S1 {
+ S1();
+ S1(S1 const &) = delete;
+ S1(S1 &&);
+ S1 operator =(S1 const &) = delete;
+ S1 operator =(S1 &&);
+};
+
+struct S2 { S2(S1); };
+S2 f() {
+ S1 s;
+ return { std::move(s) }; // { dg-bogus "redundant move" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/Wredundant-move2.C b/gcc/testsuite/g++.dg/cpp0x/Wredundant-move2.C
index f181afe..6e0aa4b 100644
--- a/gcc/testsuite/g++.dg/cpp0x/Wredundant-move2.C
+++ b/gcc/testsuite/g++.dg/cpp0x/Wredundant-move2.C
@@ -37,14 +37,14 @@ template<typename Tp1, typename Tp2>
Tp1
fn2 (Tp2 t)
{
- return std::move (t); // { dg-warning "redundant move in return statement" }
+ return std::move (t);
}
template<typename Tp1, typename Tp2>
Tp1
fn3 (Tp2 t)
{
- return std::move (t); // { dg-warning "redundant move in return statement" }
+ return std::move (t);
}
int
diff --git a/gcc/testsuite/g++.dg/cpp0x/Wredundant-move9.C b/gcc/testsuite/g++.dg/cpp0x/Wredundant-move9.C
index ca1e23b..489ecd2 100644
--- a/gcc/testsuite/g++.dg/cpp0x/Wredundant-move9.C
+++ b/gcc/testsuite/g++.dg/cpp0x/Wredundant-move9.C
@@ -61,7 +61,8 @@ fn4 (const T<int> t)
{
// t is const: will decay into copy despite std::move, so it's redundant.
// We used to warn about this, but no longer since c++/87378.
- return std::move (t); // { dg-warning "redundant move" "" { target c++20 } }
+ // Now we warn again since c++/90428.
+ return std::move (t); // { dg-warning "redundant move" }
}
int
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-debug-0.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-debug-0.C
deleted file mode 100644
index 8464aa3..0000000
--- a/gcc/testsuite/g++.dg/cpp0x/alias-decl-debug-0.C
+++ /dev/null
@@ -1,12 +0,0 @@
-// Origin: PR c++/51032
-// { dg-do compile { target { c++11 && stabs } } }
-// { dg-options "-gstabs+" }
-
-template <class C>
-struct A {
- template<class U> using B = U*;
- int a;
-};
-
-A<int> a;
-
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-decltype5.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-decltype5.C
new file mode 100644
index 0000000..5411226
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-decltype5.C
@@ -0,0 +1,23 @@
+// PR c++/99130
+// { dg-do compile { target c++11 } }
+
+template<class T>
+struct A {
+ static constexpr int value = T::nonexistent;
+};
+
+using type = const int;
+using type = decltype(A<int>::value);
+
+#if __cpp_variable_templates
+struct B {
+ template<class T>
+ static constexpr int value = T::nonexistent;
+};
+
+template<class T>
+constexpr int value = T::nonexistent;
+
+using type = decltype(B::value<int>);
+using type = decltype(value<int>);
+#endif
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-mutable3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-mutable3.C
new file mode 100644
index 0000000..51499fa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-mutable3.C
@@ -0,0 +1,9 @@
+// PR c++/92505
+// { dg-do compile { target c++11 } }
+
+struct A { mutable int m; };
+
+constexpr int f(A a) { return a.m; }
+
+static_assert(f({42}) == 42, "");
+// { dg-error "non-constant|mutable" "" { target c++11_only } .-1 }
diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-77.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-77.C
new file mode 100644
index 0000000..2c41c62
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-77.C
@@ -0,0 +1,17 @@
+// PR c++/106712
+// { dg-do compile { target c++11 } }
+
+[[noreturn]] int f1 [[nodiscard]](), f2 ();
+[[nodiscard]] int f3 (), f4 ();
+int f5 [[nodiscard]](), f6 ();
+
+int
+main ()
+{
+ f1 (); // { dg-warning "ignoring" }
+ f2 ();
+ f3 (); // { dg-warning "ignoring" }
+ f4 (); // { dg-warning "ignoring" }
+ f5 (); // { dg-warning "ignoring" }
+ f6 ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-array17.C b/gcc/testsuite/g++.dg/cpp0x/initlist-array17.C
new file mode 100644
index 0000000..c4284a7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist-array17.C
@@ -0,0 +1,37 @@
+// PR c++/93259
+// { dg-do compile { target c++11 } }
+
+template <class T, class U> struct is_same;
+template <class T> struct is_same<T,T> { };
+
+using Array = int[];
+
+template <typename ...Ts>
+void bar1(Ts ...)
+{
+ auto && array = Array{ 1, 2, 3 };
+
+ is_same<int (&&)[3], decltype(array)>{}; // this fails, deduces array as int (&&) []
+}
+
+template <typename T>
+void bar2()
+{
+ auto && array = Array{ 1, 2, 3 };
+
+ is_same<int (&&)[3], decltype(array)>{}; // this fails, deduces array as int (&&) []
+}
+
+void bar3()
+{
+ auto && array = Array{ 1, 2, 3 };
+
+ is_same<int (&&)[3], decltype(array)>{}; // OK
+}
+
+int main()
+{
+ bar1<int>(1, 2, 3);
+ bar2<int>();
+ bar3();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-const1.C b/gcc/testsuite/g++.dg/cpp0x/initlist-const1.C
index de80731..0da0759 100644
--- a/gcc/testsuite/g++.dg/cpp0x/initlist-const1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist-const1.C
@@ -1,7 +1,9 @@
// { dg-do compile { target c++11 } }
+/* PIC uses .data.rel.ro.local rather than .rodata. */
+/* { dg-additional-options "-fno-PIE" } */
#include <initializer_list>
const auto x = { 1, 2 };
-// { dg-final { scan-assembler-not {\.data} } }
+// { dg-final { scan-assembler-not {\.data} { xfail powerpc-ibm-aix* } } }
diff --git a/gcc/testsuite/g++.dg/cpp0x/keywords2.C b/gcc/testsuite/g++.dg/cpp0x/keywords2.C
new file mode 100644
index 0000000..d67d01e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/keywords2.C
@@ -0,0 +1,16 @@
+// { dg-do compile { target c++98_only } }
+// { dg-options "-Wc++11-compat" }
+
+// Validate suppression of -Wc++11-compat diagnostics.
+#pragma GCC diagnostic ignored "-Wc++11-compat"
+int alignof;
+int alignas;
+int constexpr;
+int decltype;
+int noexcept;
+int nullptr;
+int static_assert;
+int thread_local;
+int _Alignas;
+int _Alignof;
+int _Thread_local;
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-array4.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-array4.C
new file mode 100644
index 0000000..94ec7f8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-array4.C
@@ -0,0 +1,29 @@
+// PR c++/106567
+// { dg-do compile { target c++11 } }
+
+template <class V>
+void urgh()
+{
+ const V x[] = {V(0), V(1), V(2), V(0)};
+
+ [&]() {
+ for (auto& v : x) {}
+ }();
+}
+
+void no_urgh()
+{
+ using V = int;
+
+ const V x[] = {V(0), V(1), V(2), V(0)};
+
+ [&]() {
+ for (auto& v : x) {}
+ }();
+}
+
+int main()
+{
+ no_urgh();
+ urgh<int>();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv.C
index 417c185..9f1b89a 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv.C
@@ -1,7 +1,7 @@
// Test for conversion from stateless lambda to function pointer.
// { dg-do compile { target c++11_only } }
-// { dg-final { scan-assembler "weak\[^\n\r\]*_?_ZZ1fvENKUlvE_cvPFvvEEv" { target { ! { *-*-darwin* *-*-mingw* *-*-cygwin *-*-hpux10* } } } } }
+// { dg-final { scan-assembler "weak\[^\n\r\]*_?_ZZ1fvENKUlvE_cvPFvvEEv" { target { ! { *-*-darwin* *-*-mingw* *-*-cygwin } } } } }
inline void f()
{
diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn65.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn65.C
new file mode 100644
index 0000000..78bb004
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn65.C
@@ -0,0 +1,10 @@
+// PR c++/106893
+// { dg-do compile { target c++14 } }
+
+template <typename T>
+struct CoordTraits
+{
+ static auto GetX(T const &p) { return 1; }
+};
+typedef CoordTraits<int> Traits;
+static constexpr auto GetX = Traits::GetX;
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-complex1.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-complex1.C
new file mode 100644
index 0000000..8bb24cb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-complex1.C
@@ -0,0 +1,24 @@
+// PR c++/88174
+// { dg-do compile { target c++14 } }
+
+constexpr bool
+foo (double x, double y, double z, double w)
+{
+ __complex__ double a = 0;
+ __real__ a = x;
+ __imag__ a = y;
+#if __cpp_constexpr >= 201907L
+ __complex__ double b;
+ __real__ b = z;
+#else
+ __complex__ double b = z;
+#endif
+ __imag__ b = w;
+ a += b;
+ a -= b;
+ a *= b;
+ a /= b;
+ return __real__ a == x && __imag__ a == y;
+}
+
+static_assert (foo (1.0, 2.0, 3.0, 4.0), "");
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-mutable1.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-mutable1.C
new file mode 100644
index 0000000..6c47988
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-mutable1.C
@@ -0,0 +1,16 @@
+// PR c++/92505
+// { dg-do compile { target c++14 } }
+
+struct S { mutable int m; };
+
+static_assert(S{42}.m == 42, "");
+
+constexpr int f() {
+ S s = {40};
+ s.m++;
+ const auto& cs = s;
+ ++cs.m;
+ return cs.m;
+}
+
+static_assert(f() == 42, "");
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction113.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction113.C
new file mode 100644
index 0000000..8f6908e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction113.C
@@ -0,0 +1,5 @@
+// PR c++/106793
+
+template <class T> struct A { A(T); };
+template <class T> void f(A *a); // { dg-error "placeholder.*parameter" "" { target c++17 } }
+// { dg-error "" "" { target c++14_down } .-1 }
diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda27.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda27.C
new file mode 100644
index 0000000..24e2e9b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda27.C
@@ -0,0 +1,26 @@
+// PR c++/106369
+// { dg-do compile { target c++17 } }
+
+struct A {
+ int a[256];
+ constexpr int &operator[] (int n) noexcept { return a[n]; }
+ constexpr const int &operator[] (int n) const noexcept { return a[n]; }
+};
+struct B {};
+template <typename T>
+struct C {
+ constexpr T &foo (const char x) noexcept { c = T::d[x]; return static_cast<T &>(*this); }
+ int c;
+};
+struct D : public C<D>, public B
+{
+ D () noexcept = default;
+ static constexpr char e[9] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I' };
+ static constexpr A d = [] () constexpr {
+ A f {};
+ for (int i = 0; i < 9; ++i)
+ f[e[i]] = 1;
+ return f;
+ } ();
+};
+constexpr auto g = D{}.foo ('E');
diff --git a/gcc/testsuite/g++.dg/cpp1z/noexcept-type26.C b/gcc/testsuite/g++.dg/cpp1z/noexcept-type26.C
new file mode 100644
index 0000000..491df4d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/noexcept-type26.C
@@ -0,0 +1,12 @@
+// Verify a non-constant conditional noexcept-specifier in a function type
+// respects SFINAE.
+// { dg-do compile { target c++17 } }
+
+template<class T> void f(void() noexcept(T::value)) = delete;
+template<class T> void f(...);
+
+struct B { static bool value; };
+
+int main() {
+ f<B>(nullptr);
+}
diff --git a/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-1.C b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-1.C
new file mode 100644
index 0000000..95e3827
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-1.C
@@ -0,0 +1,43 @@
+// P2295R6 - Support for UTF-8 as a portable source file encoding
+// This test intentionally contains various byte sequences which are not valid UTF-8
+// { dg-do preprocess }
+// { dg-options "-finput-charset=UTF-8" }
+
+// a€߿ࠀ퟿ð€€ô¿¿a { dg-bogus "invalid UTF-8 character" }
+// a€a { dg-warning "invalid UTF-8 character <80>" "" { target c++23 } }
+// a¿a { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } }
+// aÀa { dg-warning "invalid UTF-8 character <c0>" "" { target c++23 } }
+// aÁa { dg-warning "invalid UTF-8 character <c1>" "" { target c++23 } }
+// aõa { dg-warning "invalid UTF-8 character <f5>" "" { target c++23 } }
+// aÿa { dg-warning "invalid UTF-8 character <ff>" "" { target c++23 } }
+// aÂa { dg-warning "invalid UTF-8 character <c2>" "" { target c++23 } }
+// aàa { dg-warning "invalid UTF-8 character <e0>" "" { target c++23 } }
+// aà€¿a { dg-warning "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } }
+// aàŸ€a { dg-warning "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } }
+// aà¿a { dg-warning "invalid UTF-8 character <e0><bf>" "" { target c++23 } }
+// aì€a { dg-warning "invalid UTF-8 character <ec><80>" "" { target c++23 } }
+// aí €a { dg-warning "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } }
+// að€€€a { dg-warning "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } }
+// að¿¿a { dg-warning "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } }
+// aô€€a { dg-warning "invalid UTF-8 character <f4><90><80><80>" "" { target c++23 } }
+// aý¿¿¿¿¿a { dg-warning "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c++23 } }
+// { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } .-1 }
+/* a€߿ࠀ퟿ð€€ô¿¿a { dg-bogus "invalid UTF-8 character" } */
+/* a€a { dg-warning "invalid UTF-8 character <80>" "" { target c++23 } } */
+/* a¿a { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } } */
+/* aÀa { dg-warning "invalid UTF-8 character <c0>" "" { target c++23 } } */
+/* aÁa { dg-warning "invalid UTF-8 character <c1>" "" { target c++23 } } */
+/* aõa { dg-warning "invalid UTF-8 character <f5>" "" { target c++23 } } */
+/* aÿa { dg-warning "invalid UTF-8 character <ff>" "" { target c++23 } } */
+/* aÂa { dg-warning "invalid UTF-8 character <c2>" "" { target c++23 } } */
+/* aàa { dg-warning "invalid UTF-8 character <e0>" "" { target c++23 } } */
+/* aà€¿a { dg-warning "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } } */
+/* aàŸ€a { dg-warning "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } } */
+/* aà¿a { dg-warning "invalid UTF-8 character <e0><bf>" "" { target c++23 } } */
+/* aì€a { dg-warning "invalid UTF-8 character <ec><80>" "" { target c++23 } } */
+/* aí €a { dg-warning "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } } */
+/* að€€€a { dg-warning "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } } */
+/* að¿¿a { dg-warning "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } } */
+/* aô€€a { dg-warning "invalid UTF-8 character <f4><90><80><80>" "" { target c++23 } } */
+/* aý¿¿¿¿¿a { dg-warning "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c++23 } } */
+/* { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } .-1 } */
diff --git a/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-10.C b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-10.C
new file mode 100644
index 0000000..4684b9d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-10.C
@@ -0,0 +1,25 @@
+// P2295R6 - Support for UTF-8 as a portable source file encoding
+// This test intentionally contains various byte sequences which are not valid UTF-8
+// { dg-do preprocess }
+// { dg-options "-finput-charset=UTF-8 -pedantic" }
+
+#define I(x)
+I(€߿ࠀ퟿ð€€ô¿¿) // { dg-bogus "invalid UTF-8 character" }
+ // { dg-error "is not valid in an identifier" "" { target *-*-* } .-1 }
+I(€) // { dg-warning "invalid UTF-8 character <80>" "" { target c++23 } }
+I(¿) // { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } }
+I(À) // { dg-warning "invalid UTF-8 character <c0>" "" { target c++23 } }
+I(Á) // { dg-warning "invalid UTF-8 character <c1>" "" { target c++23 } }
+I(õ) // { dg-warning "invalid UTF-8 character <f5>" "" { target c++23 } }
+I(ÿ) // { dg-warning "invalid UTF-8 character <ff>" "" { target c++23 } }
+I(Â) // { dg-warning "invalid UTF-8 character <c2>" "" { target c++23 } }
+I(à) // { dg-warning "invalid UTF-8 character <e0>" "" { target c++23 } }
+I(à€¿) // { dg-warning "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } }
+I(àŸ€) // { dg-warning "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } }
+I(à¿) // { dg-warning "invalid UTF-8 character <e0><bf>" "" { target c++23 } }
+I(ì€) // { dg-warning "invalid UTF-8 character <ec><80>" "" { target c++23 } }
+I(í €) // { dg-warning "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } }
+I(ð€€€) // { dg-warning "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } }
+I(ð¿¿) // { dg-warning "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } }
+I(ô€€) // { dg-error "is not valid in an identifier" }
+I(ý¿¿¿¿¿) // { dg-error "is not valid in an identifier" }
diff --git a/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-11.C b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-11.C
new file mode 100644
index 0000000..85f04bf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-11.C
@@ -0,0 +1,25 @@
+// P2295R6 - Support for UTF-8 as a portable source file encoding
+// This test intentionally contains various byte sequences which are not valid UTF-8
+// { dg-do preprocess }
+// { dg-options "-finput-charset=UTF-8 -pedantic-errors" }
+
+#define I(x)
+I(€߿ࠀ퟿ð€€ô¿¿) // { dg-bogus "invalid UTF-8 character" }
+ // { dg-error "is not valid in an identifier" "" { target *-*-* } .-1 }
+I(€) // { dg-error "invalid UTF-8 character <80>" "" { target c++23 } }
+I(¿) // { dg-error "invalid UTF-8 character <bf>" "" { target c++23 } }
+I(À) // { dg-error "invalid UTF-8 character <c0>" "" { target c++23 } }
+I(Á) // { dg-error "invalid UTF-8 character <c1>" "" { target c++23 } }
+I(õ) // { dg-error "invalid UTF-8 character <f5>" "" { target c++23 } }
+I(ÿ) // { dg-error "invalid UTF-8 character <ff>" "" { target c++23 } }
+I(Â) // { dg-error "invalid UTF-8 character <c2>" "" { target c++23 } }
+I(à) // { dg-error "invalid UTF-8 character <e0>" "" { target c++23 } }
+I(à€¿) // { dg-error "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } }
+I(àŸ€) // { dg-error "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } }
+I(à¿) // { dg-error "invalid UTF-8 character <e0><bf>" "" { target c++23 } }
+I(ì€) // { dg-error "invalid UTF-8 character <ec><80>" "" { target c++23 } }
+I(í €) // { dg-error "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } }
+I(ð€€€) // { dg-error "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } }
+I(ð¿¿) // { dg-error "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } }
+I(ô€€) // { dg-error "is not valid in an identifier" }
+I(ý¿¿¿¿¿) // { dg-error "is not valid in an identifier" }
diff --git a/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-12.C b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-12.C
new file mode 100644
index 0000000..6a4091f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-12.C
@@ -0,0 +1,25 @@
+// P2295R6 - Support for UTF-8 as a portable source file encoding
+// This test intentionally contains various byte sequences which are not valid UTF-8
+// { dg-do preprocess }
+// { dg-options "-finput-charset=UTF-8 -pedantic-errors -Wno-invalid-utf8" }
+
+#define I(x)
+I(€߿ࠀ퟿ð€€ô¿¿) // { dg-bogus "invalid UTF-8 character" }
+ // { dg-error "is not valid in an identifier" "" { target *-*-* } .-1 }
+I(€) // { dg-bogus "invalid UTF-8 character <80>" }
+I(¿) // { dg-bogus "invalid UTF-8 character <bf>" }
+I(À) // { dg-bogus "invalid UTF-8 character <c0>" }
+I(Á) // { dg-bogus "invalid UTF-8 character <c1>" }
+I(õ) // { dg-bogus "invalid UTF-8 character <f5>" }
+I(ÿ) // { dg-bogus "invalid UTF-8 character <ff>" }
+I(Â) // { dg-bogus "invalid UTF-8 character <c2>" }
+I(à) // { dg-bogus "invalid UTF-8 character <e0>" }
+I(à€¿) // { dg-bogus "invalid UTF-8 character <e0><80><bf>" }
+I(àŸ€) // { dg-bogus "invalid UTF-8 character <e0><9f><80>" }
+I(à¿) // { dg-bogus "invalid UTF-8 character <e0><bf>" }
+I(ì€) // { dg-bogus "invalid UTF-8 character <ec><80>" }
+I(í €) // { dg-bogus "invalid UTF-8 character <ed><a0><80>" }
+I(ð€€€) // { dg-bogus "invalid UTF-8 character <f0><80><80><80>" }
+I(ð¿¿) // { dg-bogus "invalid UTF-8 character <f0><8f><bf><bf>" }
+I(ô€€) // { dg-error "is not valid in an identifier" }
+I(ý¿¿¿¿¿) // { dg-error "is not valid in an identifier" }
diff --git a/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-2.C b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-2.C
new file mode 100644
index 0000000..70ab8e5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-2.C
@@ -0,0 +1,43 @@
+// P2295R6 - Support for UTF-8 as a portable source file encoding
+// This test intentionally contains various byte sequences which are not valid UTF-8
+// { dg-do preprocess }
+// { dg-options "-finput-charset=UTF-8 -pedantic" }
+
+// a€߿ࠀ퟿ð€€ô¿¿a { dg-bogus "invalid UTF-8 character" }
+// a€a { dg-warning "invalid UTF-8 character <80>" "" { target c++23 } }
+// a¿a { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } }
+// aÀa { dg-warning "invalid UTF-8 character <c0>" "" { target c++23 } }
+// aÁa { dg-warning "invalid UTF-8 character <c1>" "" { target c++23 } }
+// aõa { dg-warning "invalid UTF-8 character <f5>" "" { target c++23 } }
+// aÿa { dg-warning "invalid UTF-8 character <ff>" "" { target c++23 } }
+// aÂa { dg-warning "invalid UTF-8 character <c2>" "" { target c++23 } }
+// aàa { dg-warning "invalid UTF-8 character <e0>" "" { target c++23 } }
+// aà€¿a { dg-warning "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } }
+// aàŸ€a { dg-warning "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } }
+// aà¿a { dg-warning "invalid UTF-8 character <e0><bf>" "" { target c++23 } }
+// aì€a { dg-warning "invalid UTF-8 character <ec><80>" "" { target c++23 } }
+// aí €a { dg-warning "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } }
+// að€€€a { dg-warning "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } }
+// að¿¿a { dg-warning "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } }
+// aô€€a { dg-warning "invalid UTF-8 character <f4><90><80><80>" "" { target c++23 } }
+// aý¿¿¿¿¿a { dg-warning "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c++23 } }
+// { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } .-1 }
+/* a€߿ࠀ퟿ð€€ô¿¿a { dg-bogus "invalid UTF-8 character" } */
+/* a€a { dg-warning "invalid UTF-8 character <80>" "" { target c++23 } } */
+/* a¿a { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } } */
+/* aÀa { dg-warning "invalid UTF-8 character <c0>" "" { target c++23 } } */
+/* aÁa { dg-warning "invalid UTF-8 character <c1>" "" { target c++23 } } */
+/* aõa { dg-warning "invalid UTF-8 character <f5>" "" { target c++23 } } */
+/* aÿa { dg-warning "invalid UTF-8 character <ff>" "" { target c++23 } } */
+/* aÂa { dg-warning "invalid UTF-8 character <c2>" "" { target c++23 } } */
+/* aàa { dg-warning "invalid UTF-8 character <e0>" "" { target c++23 } } */
+/* aà€¿a { dg-warning "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } } */
+/* aàŸ€a { dg-warning "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } } */
+/* aà¿a { dg-warning "invalid UTF-8 character <e0><bf>" "" { target c++23 } } */
+/* aì€a { dg-warning "invalid UTF-8 character <ec><80>" "" { target c++23 } } */
+/* aí €a { dg-warning "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } } */
+/* að€€€a { dg-warning "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } } */
+/* að¿¿a { dg-warning "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } } */
+/* aô€€a { dg-warning "invalid UTF-8 character <f4><90><80><80>" "" { target c++23 } } */
+/* aý¿¿¿¿¿a { dg-warning "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c++23 } } */
+/* { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } .-1 } */
diff --git a/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-3.C b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-3.C
new file mode 100644
index 0000000..c0f748b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-3.C
@@ -0,0 +1,43 @@
+// P2295R6 - Support for UTF-8 as a portable source file encoding
+// This test intentionally contains various byte sequences which are not valid UTF-8
+// { dg-do preprocess }
+// { dg-options "-finput-charset=UTF-8 -pedantic-errors" }
+
+// a€߿ࠀ퟿ð€€ô¿¿a { dg-bogus "invalid UTF-8 character" }
+// a€a { dg-error "invalid UTF-8 character <80>" "" { target c++23 } }
+// a¿a { dg-error "invalid UTF-8 character <bf>" "" { target c++23 } }
+// aÀa { dg-error "invalid UTF-8 character <c0>" "" { target c++23 } }
+// aÁa { dg-error "invalid UTF-8 character <c1>" "" { target c++23 } }
+// aõa { dg-error "invalid UTF-8 character <f5>" "" { target c++23 } }
+// aÿa { dg-error "invalid UTF-8 character <ff>" "" { target c++23 } }
+// aÂa { dg-error "invalid UTF-8 character <c2>" "" { target c++23 } }
+// aàa { dg-error "invalid UTF-8 character <e0>" "" { target c++23 } }
+// aà€¿a { dg-error "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } }
+// aàŸ€a { dg-error "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } }
+// aà¿a { dg-error "invalid UTF-8 character <e0><bf>" "" { target c++23 } }
+// aì€a { dg-error "invalid UTF-8 character <ec><80>" "" { target c++23 } }
+// aí €a { dg-error "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } }
+// að€€€a { dg-error "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } }
+// að¿¿a { dg-error "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } }
+// aô€€a { dg-error "invalid UTF-8 character <f4><90><80><80>" "" { target c++23 } }
+// aý¿¿¿¿¿a { dg-error "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c++23 } }
+// { dg-error "invalid UTF-8 character <bf>" "" { target c++23 } .-1 }
+/* a€߿ࠀ퟿ð€€ô¿¿a { dg-bogus "invalid UTF-8 character" } */
+/* a€a { dg-error "invalid UTF-8 character <80>" "" { target c++23 } } */
+/* a¿a { dg-error "invalid UTF-8 character <bf>" "" { target c++23 } } */
+/* aÀa { dg-error "invalid UTF-8 character <c0>" "" { target c++23 } } */
+/* aÁa { dg-error "invalid UTF-8 character <c1>" "" { target c++23 } } */
+/* aõa { dg-error "invalid UTF-8 character <f5>" "" { target c++23 } } */
+/* aÿa { dg-error "invalid UTF-8 character <ff>" "" { target c++23 } } */
+/* aÂa { dg-error "invalid UTF-8 character <c2>" "" { target c++23 } } */
+/* aàa { dg-error "invalid UTF-8 character <e0>" "" { target c++23 } } */
+/* aà€¿a { dg-error "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } } */
+/* aàŸ€a { dg-error "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } } */
+/* aà¿a { dg-error "invalid UTF-8 character <e0><bf>" "" { target c++23 } } */
+/* aì€a { dg-error "invalid UTF-8 character <ec><80>" "" { target c++23 } } */
+/* aí €a { dg-error "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } } */
+/* að€€€a { dg-error "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } } */
+/* að¿¿a { dg-error "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } } */
+/* aô€€a { dg-error "invalid UTF-8 character <f4><90><80><80>" "" { target c++23 } } */
+/* aý¿¿¿¿¿a { dg-error "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c++23 } } */
+/* { dg-error "invalid UTF-8 character <bf>" "" { target c++23 } .-1 } */
diff --git a/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-4.C b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-4.C
new file mode 100644
index 0000000..1dc65e3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-4.C
@@ -0,0 +1,43 @@
+// P2295R6 - Support for UTF-8 as a portable source file encoding
+// This test intentionally contains various byte sequences which are not valid UTF-8
+// { dg-do preprocess }
+// { dg-options "-finput-charset=UTF-8 -pedantic-errors -Wno-invalid-utf8" }
+
+// a€߿ࠀ퟿ð€€ô¿¿a { dg-bogus "invalid UTF-8 character" }
+// a€a { dg-bogus "invalid UTF-8 character <80>" }
+// a¿a { dg-bogus "invalid UTF-8 character <bf>" }
+// aÀa { dg-bogus "invalid UTF-8 character <c0>" }
+// aÁa { dg-bogus "invalid UTF-8 character <c1>" }
+// aõa { dg-bogus "invalid UTF-8 character <f5>" }
+// aÿa { dg-bogus "invalid UTF-8 character <ff>" }
+// aÂa { dg-bogus "invalid UTF-8 character <c2>" }
+// aàa { dg-bogus "invalid UTF-8 character <e0>" }
+// aà€¿a { dg-bogus "invalid UTF-8 character <e0><80><bf>" }
+// aàŸ€a { dg-bogus "invalid UTF-8 character <e0><9f><80>" }
+// aà¿a { dg-bogus "invalid UTF-8 character <e0><bf>" }
+// aì€a { dg-bogus "invalid UTF-8 character <ec><80>" }
+// aí €a { dg-bogus "invalid UTF-8 character <ed><a0><80>" }
+// að€€€a { dg-bogus "invalid UTF-8 character <f0><80><80><80>" }
+// að¿¿a { dg-bogus "invalid UTF-8 character <f0><8f><bf><bf>" }
+// aô€€a { dg-bogus "invalid UTF-8 character <f4><90><80><80>" }
+// aý¿¿¿¿¿a { dg-bogus "invalid UTF-8 character <fd><bf><bf><bf>" }
+// { dg-bogus "invalid UTF-8 character <bf>" "" { target *-*-* } .-1 }
+/* a€߿ࠀ퟿ð€€ô¿¿a { dg-bogus "invalid UTF-8 character" } */
+/* a€a { dg-bogus "invalid UTF-8 character <80>" } */
+/* a¿a { dg-bogus "invalid UTF-8 character <bf>" } */
+/* aÀa { dg-bogus "invalid UTF-8 character <c0>" } */
+/* aÁa { dg-bogus "invalid UTF-8 character <c1>" } */
+/* aõa { dg-bogus "invalid UTF-8 character <f5>" } */
+/* aÿa { dg-bogus "invalid UTF-8 character <ff>" } */
+/* aÂa { dg-bogus "invalid UTF-8 character <c2>" } */
+/* aàa { dg-bogus "invalid UTF-8 character <e0>" } */
+/* aà€¿a { dg-bogus "invalid UTF-8 character <e0><80><bf>" } */
+/* aàŸ€a { dg-bogus "invalid UTF-8 character <e0><9f><80>" } */
+/* aà¿a { dg-bogus "invalid UTF-8 character <e0><bf>" } */
+/* aì€a { dg-bogus "invalid UTF-8 character <ec><80>" } */
+/* aí €a { dg-bogus "invalid UTF-8 character <ed><a0><80>" } */
+/* að€€€a { dg-bogus "invalid UTF-8 character <f0><80><80><80>" } */
+/* að¿¿a { dg-bogus "invalid UTF-8 character <f0><8f><bf><bf>" } */
+/* aô€€a { dg-bogus "invalid UTF-8 character <f4><90><80><80>" } */
+/* aý¿¿¿¿¿a { dg-bogus "invalid UTF-8 character <fd><bf><bf><bf>" } */
+/* { dg-bogus "invalid UTF-8 character <bf>" "" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-5.C b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-5.C
new file mode 100644
index 0000000..f0140ba
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-5.C
@@ -0,0 +1,80 @@
+// P2295R6 - Support for UTF-8 as a portable source file encoding
+// This test intentionally contains various byte sequences which are not valid UTF-8
+// { dg-do preprocess { target c++11 } }
+// { dg-options "-finput-charset=UTF-8" }
+
+char32_t a = U'€'; // { dg-warning "invalid UTF-8 character <80>" "" { target c++23 } }
+char32_t b = U'¿'; // { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } }
+char32_t c = U'À'; // { dg-warning "invalid UTF-8 character <c0>" "" { target c++23 } }
+char32_t d = U'Á'; // { dg-warning "invalid UTF-8 character <c1>" "" { target c++23 } }
+char32_t e = U'õ'; // { dg-warning "invalid UTF-8 character <f5>" "" { target c++23 } }
+char32_t f = U'ÿ'; // { dg-warning "invalid UTF-8 character <ff>" "" { target c++23 } }
+char32_t g = U'Â'; // { dg-warning "invalid UTF-8 character <c2>" "" { target c++23 } }
+char32_t h = U'à'; // { dg-warning "invalid UTF-8 character <e0>" "" { target c++23 } }
+char32_t i = U'à€¿'; // { dg-warning "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } }
+char32_t j = U'àŸ€'; // { dg-warning "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } }
+char32_t k = U'à¿'; // { dg-warning "invalid UTF-8 character <e0><bf>" "" { target c++23 } }
+char32_t l = U'ì€'; // { dg-warning "invalid UTF-8 character <ec><80>" "" { target c++23 } }
+char32_t m = U'í €'; // { dg-warning "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } }
+char32_t n = U'ð€€€'; // { dg-warning "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } }
+char32_t o = U'ð¿¿'; // { dg-warning "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } }
+char32_t p = U'ô€€'; // { dg-warning "invalid UTF-8 character <f4><90><80><80>" "" { target c++23 } }
+char32_t q = U'ý¿¿¿¿¿'; // { dg-warning "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c++23 } }
+ // { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } .-1 }
+auto A = U"€߿ࠀ퟿ð€€ô¿¿"; // { dg-bogus "invalid UTF-8 character" }
+auto B = U"€"; // { dg-warning "invalid UTF-8 character <80>" "" { target c++23 } }
+auto C = U"¿"; // { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } }
+auto D = U"À"; // { dg-warning "invalid UTF-8 character <c0>" "" { target c++23 } }
+auto E = U"Á"; // { dg-warning "invalid UTF-8 character <c1>" "" { target c++23 } }
+auto F = U"õ"; // { dg-warning "invalid UTF-8 character <f5>" "" { target c++23 } }
+auto G = U"ÿ"; // { dg-warning "invalid UTF-8 character <ff>" "" { target c++23 } }
+auto H = U"Â"; // { dg-warning "invalid UTF-8 character <c2>" "" { target c++23 } }
+auto I = U"à"; // { dg-warning "invalid UTF-8 character <e0>" "" { target c++23 } }
+auto J = U"à€¿"; // { dg-warning "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } }
+auto K = U"àŸ€"; // { dg-warning "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } }
+auto L = U"à¿"; // { dg-warning "invalid UTF-8 character <e0><bf>" "" { target c++23 } }
+auto M = U"ì€"; // { dg-warning "invalid UTF-8 character <ec><80>" "" { target c++23 } }
+auto N = U"í €"; // { dg-warning "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } }
+auto O = U"ð€€€"; // { dg-warning "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } }
+auto P = U"ð¿¿"; // { dg-warning "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } }
+auto Q = U"ô€€"; // { dg-warning "invalid UTF-8 character <f4><90><80><80>" "" { target c++23 } }
+auto R = U"ý¿¿¿¿¿"; // { dg-warning "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c++23 } }
+ // { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } .-1 }
+auto A1 = UR"(€߿ࠀ퟿ð€€ô¿¿)"; // { dg-bogus "invalid UTF-8 character" }
+auto B1 = UR"(€)"; // { dg-warning "invalid UTF-8 character <80>" "" { target c++23 } }
+auto C1 = UR"(¿)"; // { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } }
+auto D1 = UR"(À)"; // { dg-warning "invalid UTF-8 character <c0>" "" { target c++23 } }
+auto E1 = UR"(Á)"; // { dg-warning "invalid UTF-8 character <c1>" "" { target c++23 } }
+auto F1 = UR"(õ)"; // { dg-warning "invalid UTF-8 character <f5>" "" { target c++23 } }
+auto G1 = UR"(ÿ)"; // { dg-warning "invalid UTF-8 character <ff>" "" { target c++23 } }
+auto H1 = UR"(Â)"; // { dg-warning "invalid UTF-8 character <c2>" "" { target c++23 } }
+auto I1 = UR"(à)"; // { dg-warning "invalid UTF-8 character <e0>" "" { target c++23 } }
+auto J1 = UR"(à€¿)"; // { dg-warning "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } }
+auto K1 = UR"(àŸ€)"; // { dg-warning "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } }
+auto L1 = UR"(à¿)"; // { dg-warning "invalid UTF-8 character <e0><bf>" "" { target c++23 } }
+auto M1 = UR"(ì€)"; // { dg-warning "invalid UTF-8 character <ec><80>" "" { target c++23 } }
+auto N1 = UR"(í €)"; // { dg-warning "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } }
+auto O1 = UR"(ð€€€)"; // { dg-warning "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } }
+auto P1 = UR"(ð¿¿)"; // { dg-warning "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } }
+auto Q1 = UR"(ô€€)"; // { dg-warning "invalid UTF-8 character <f4><90><80><80>" "" { target c++23 } }
+auto R1 = UR"(ý¿¿¿¿¿)"; // { dg-warning "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c++23 } }
+ // { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } .-1 }
+auto A2 = u8"€߿ࠀ퟿ð€€ô¿¿"; // { dg-bogus "invalid UTF-8 character" }
+auto B2 = u8"€"; // { dg-warning "invalid UTF-8 character <80>" "" { target c++23 } }
+auto C2 = u8"¿"; // { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } }
+auto D2 = u8"À"; // { dg-warning "invalid UTF-8 character <c0>" "" { target c++23 } }
+auto E2 = u8"Á"; // { dg-warning "invalid UTF-8 character <c1>" "" { target c++23 } }
+auto F2 = u8"õ"; // { dg-warning "invalid UTF-8 character <f5>" "" { target c++23 } }
+auto G2 = u8"ÿ"; // { dg-warning "invalid UTF-8 character <ff>" "" { target c++23 } }
+auto H2 = u8"Â"; // { dg-warning "invalid UTF-8 character <c2>" "" { target c++23 } }
+auto I2 = u8"à"; // { dg-warning "invalid UTF-8 character <e0>" "" { target c++23 } }
+auto J2 = u8"à€¿"; // { dg-warning "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } }
+auto K2 = u8"àŸ€"; // { dg-warning "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } }
+auto L2 = u8"à¿"; // { dg-warning "invalid UTF-8 character <e0><bf>" "" { target c++23 } }
+auto M2 = u8"ì€"; // { dg-warning "invalid UTF-8 character <ec><80>" "" { target c++23 } }
+auto N2 = u8"í €"; // { dg-warning "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } }
+auto O2 = u8"ð€€€"; // { dg-warning "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } }
+auto P2 = u8"ð¿¿"; // { dg-warning "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } }
+auto Q2 = u8"ô€€"; // { dg-warning "invalid UTF-8 character <f4><90><80><80>" "" { target c++23 } }
+auto R2 = u8"ý¿¿¿¿¿"; // { dg-warning "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c++23 } }
+ // { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } .-1 }
diff --git a/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-6.C b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-6.C
new file mode 100644
index 0000000..01023d3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-6.C
@@ -0,0 +1,80 @@
+// P2295R6 - Support for UTF-8 as a portable source file encoding
+// This test intentionally contains various byte sequences which are not valid UTF-8
+// { dg-do preprocess { target c++11 } }
+// { dg-options "-finput-charset=UTF-8 -pedantic" }
+
+char32_t a = U'€'; // { dg-warning "invalid UTF-8 character <80>" "" { target c++23 } }
+char32_t b = U'¿'; // { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } }
+char32_t c = U'À'; // { dg-warning "invalid UTF-8 character <c0>" "" { target c++23 } }
+char32_t d = U'Á'; // { dg-warning "invalid UTF-8 character <c1>" "" { target c++23 } }
+char32_t e = U'õ'; // { dg-warning "invalid UTF-8 character <f5>" "" { target c++23 } }
+char32_t f = U'ÿ'; // { dg-warning "invalid UTF-8 character <ff>" "" { target c++23 } }
+char32_t g = U'Â'; // { dg-warning "invalid UTF-8 character <c2>" "" { target c++23 } }
+char32_t h = U'à'; // { dg-warning "invalid UTF-8 character <e0>" "" { target c++23 } }
+char32_t i = U'à€¿'; // { dg-warning "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } }
+char32_t j = U'àŸ€'; // { dg-warning "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } }
+char32_t k = U'à¿'; // { dg-warning "invalid UTF-8 character <e0><bf>" "" { target c++23 } }
+char32_t l = U'ì€'; // { dg-warning "invalid UTF-8 character <ec><80>" "" { target c++23 } }
+char32_t m = U'í €'; // { dg-warning "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } }
+char32_t n = U'ð€€€'; // { dg-warning "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } }
+char32_t o = U'ð¿¿'; // { dg-warning "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } }
+char32_t p = U'ô€€'; // { dg-warning "invalid UTF-8 character <f4><90><80><80>" "" { target c++23 } }
+char32_t q = U'ý¿¿¿¿¿'; // { dg-warning "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c++23 } }
+ // { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } .-1 }
+auto A = U"€߿ࠀ퟿ð€€ô¿¿"; // { dg-bogus "invalid UTF-8 character" }
+auto B = U"€"; // { dg-warning "invalid UTF-8 character <80>" "" { target c++23 } }
+auto C = U"¿"; // { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } }
+auto D = U"À"; // { dg-warning "invalid UTF-8 character <c0>" "" { target c++23 } }
+auto E = U"Á"; // { dg-warning "invalid UTF-8 character <c1>" "" { target c++23 } }
+auto F = U"õ"; // { dg-warning "invalid UTF-8 character <f5>" "" { target c++23 } }
+auto G = U"ÿ"; // { dg-warning "invalid UTF-8 character <ff>" "" { target c++23 } }
+auto H = U"Â"; // { dg-warning "invalid UTF-8 character <c2>" "" { target c++23 } }
+auto I = U"à"; // { dg-warning "invalid UTF-8 character <e0>" "" { target c++23 } }
+auto J = U"à€¿"; // { dg-warning "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } }
+auto K = U"àŸ€"; // { dg-warning "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } }
+auto L = U"à¿"; // { dg-warning "invalid UTF-8 character <e0><bf>" "" { target c++23 } }
+auto M = U"ì€"; // { dg-warning "invalid UTF-8 character <ec><80>" "" { target c++23 } }
+auto N = U"í €"; // { dg-warning "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } }
+auto O = U"ð€€€"; // { dg-warning "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } }
+auto P = U"ð¿¿"; // { dg-warning "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } }
+auto Q = U"ô€€"; // { dg-warning "invalid UTF-8 character <f4><90><80><80>" "" { target c++23 } }
+auto R = U"ý¿¿¿¿¿"; // { dg-warning "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c++23 } }
+ // { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } .-1 }
+auto A1 = UR"(€߿ࠀ퟿ð€€ô¿¿)"; // { dg-bogus "invalid UTF-8 character" }
+auto B1 = UR"(€)"; // { dg-warning "invalid UTF-8 character <80>" "" { target c++23 } }
+auto C1 = UR"(¿)"; // { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } }
+auto D1 = UR"(À)"; // { dg-warning "invalid UTF-8 character <c0>" "" { target c++23 } }
+auto E1 = UR"(Á)"; // { dg-warning "invalid UTF-8 character <c1>" "" { target c++23 } }
+auto F1 = UR"(õ)"; // { dg-warning "invalid UTF-8 character <f5>" "" { target c++23 } }
+auto G1 = UR"(ÿ)"; // { dg-warning "invalid UTF-8 character <ff>" "" { target c++23 } }
+auto H1 = UR"(Â)"; // { dg-warning "invalid UTF-8 character <c2>" "" { target c++23 } }
+auto I1 = UR"(à)"; // { dg-warning "invalid UTF-8 character <e0>" "" { target c++23 } }
+auto J1 = UR"(à€¿)"; // { dg-warning "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } }
+auto K1 = UR"(àŸ€)"; // { dg-warning "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } }
+auto L1 = UR"(à¿)"; // { dg-warning "invalid UTF-8 character <e0><bf>" "" { target c++23 } }
+auto M1 = UR"(ì€)"; // { dg-warning "invalid UTF-8 character <ec><80>" "" { target c++23 } }
+auto N1 = UR"(í €)"; // { dg-warning "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } }
+auto O1 = UR"(ð€€€)"; // { dg-warning "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } }
+auto P1 = UR"(ð¿¿)"; // { dg-warning "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } }
+auto Q1 = UR"(ô€€)"; // { dg-warning "invalid UTF-8 character <f4><90><80><80>" "" { target c++23 } }
+auto R1 = UR"(ý¿¿¿¿¿)"; // { dg-warning "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c++23 } }
+ // { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } .-1 }
+auto A2 = u8"€߿ࠀ퟿ð€€ô¿¿"; // { dg-bogus "invalid UTF-8 character" }
+auto B2 = u8"€"; // { dg-warning "invalid UTF-8 character <80>" "" { target c++23 } }
+auto C2 = u8"¿"; // { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } }
+auto D2 = u8"À"; // { dg-warning "invalid UTF-8 character <c0>" "" { target c++23 } }
+auto E2 = u8"Á"; // { dg-warning "invalid UTF-8 character <c1>" "" { target c++23 } }
+auto F2 = u8"õ"; // { dg-warning "invalid UTF-8 character <f5>" "" { target c++23 } }
+auto G2 = u8"ÿ"; // { dg-warning "invalid UTF-8 character <ff>" "" { target c++23 } }
+auto H2 = u8"Â"; // { dg-warning "invalid UTF-8 character <c2>" "" { target c++23 } }
+auto I2 = u8"à"; // { dg-warning "invalid UTF-8 character <e0>" "" { target c++23 } }
+auto J2 = u8"à€¿"; // { dg-warning "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } }
+auto K2 = u8"àŸ€"; // { dg-warning "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } }
+auto L2 = u8"à¿"; // { dg-warning "invalid UTF-8 character <e0><bf>" "" { target c++23 } }
+auto M2 = u8"ì€"; // { dg-warning "invalid UTF-8 character <ec><80>" "" { target c++23 } }
+auto N2 = u8"í €"; // { dg-warning "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } }
+auto O2 = u8"ð€€€"; // { dg-warning "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } }
+auto P2 = u8"ð¿¿"; // { dg-warning "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } }
+auto Q2 = u8"ô€€"; // { dg-warning "invalid UTF-8 character <f4><90><80><80>" "" { target c++23 } }
+auto R2 = u8"ý¿¿¿¿¿"; // { dg-warning "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c++23 } }
+ // { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } .-1 }
diff --git a/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-7.C b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-7.C
new file mode 100644
index 0000000..7991a64
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-7.C
@@ -0,0 +1,80 @@
+// P2295R6 - Support for UTF-8 as a portable source file encoding
+// This test intentionally contains various byte sequences which are not valid UTF-8
+// { dg-do preprocess { target c++11 } }
+// { dg-options "-finput-charset=UTF-8 -pedantic-errors" }
+
+char32_t a = U'€'; // { dg-error "invalid UTF-8 character <80>" "" { target c++23 } }
+char32_t b = U'¿'; // { dg-error "invalid UTF-8 character <bf>" "" { target c++23 } }
+char32_t c = U'À'; // { dg-error "invalid UTF-8 character <c0>" "" { target c++23 } }
+char32_t d = U'Á'; // { dg-error "invalid UTF-8 character <c1>" "" { target c++23 } }
+char32_t e = U'õ'; // { dg-error "invalid UTF-8 character <f5>" "" { target c++23 } }
+char32_t f = U'ÿ'; // { dg-error "invalid UTF-8 character <ff>" "" { target c++23 } }
+char32_t g = U'Â'; // { dg-error "invalid UTF-8 character <c2>" "" { target c++23 } }
+char32_t h = U'à'; // { dg-error "invalid UTF-8 character <e0>" "" { target c++23 } }
+char32_t i = U'à€¿'; // { dg-error "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } }
+char32_t j = U'àŸ€'; // { dg-error "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } }
+char32_t k = U'à¿'; // { dg-error "invalid UTF-8 character <e0><bf>" "" { target c++23 } }
+char32_t l = U'ì€'; // { dg-error "invalid UTF-8 character <ec><80>" "" { target c++23 } }
+char32_t m = U'í €'; // { dg-error "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } }
+char32_t n = U'ð€€€'; // { dg-error "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } }
+char32_t o = U'ð¿¿'; // { dg-error "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } }
+char32_t p = U'ô€€'; // { dg-error "invalid UTF-8 character <f4><90><80><80>" "" { target c++23 } }
+char32_t q = U'ý¿¿¿¿¿'; // { dg-error "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c++23 } }
+ // { dg-error "invalid UTF-8 character <bf>" "" { target c++23 } .-1 }
+auto A = U"€߿ࠀ퟿ð€€ô¿¿"; // { dg-bogus "invalid UTF-8 character" }
+auto B = U"€"; // { dg-error "invalid UTF-8 character <80>" "" { target c++23 } }
+auto C = U"¿"; // { dg-error "invalid UTF-8 character <bf>" "" { target c++23 } }
+auto D = U"À"; // { dg-error "invalid UTF-8 character <c0>" "" { target c++23 } }
+auto E = U"Á"; // { dg-error "invalid UTF-8 character <c1>" "" { target c++23 } }
+auto F = U"õ"; // { dg-error "invalid UTF-8 character <f5>" "" { target c++23 } }
+auto G = U"ÿ"; // { dg-error "invalid UTF-8 character <ff>" "" { target c++23 } }
+auto H = U"Â"; // { dg-error "invalid UTF-8 character <c2>" "" { target c++23 } }
+auto I = U"à"; // { dg-error "invalid UTF-8 character <e0>" "" { target c++23 } }
+auto J = U"à€¿"; // { dg-error "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } }
+auto K = U"àŸ€"; // { dg-error "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } }
+auto L = U"à¿"; // { dg-error "invalid UTF-8 character <e0><bf>" "" { target c++23 } }
+auto M = U"ì€"; // { dg-error "invalid UTF-8 character <ec><80>" "" { target c++23 } }
+auto N = U"í €"; // { dg-error "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } }
+auto O = U"ð€€€"; // { dg-error "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } }
+auto P = U"ð¿¿"; // { dg-error "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } }
+auto Q = U"ô€€"; // { dg-error "invalid UTF-8 character <f4><90><80><80>" "" { target c++23 } }
+auto R = U"ý¿¿¿¿¿"; // { dg-error "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c++23 } }
+ // { dg-error "invalid UTF-8 character <bf>" "" { target c++23 } .-1 }
+auto A1 = UR"(€߿ࠀ퟿ð€€ô¿¿)"; // { dg-bogus "invalid UTF-8 character" }
+auto B1 = UR"(€)"; // { dg-error "invalid UTF-8 character <80>" "" { target c++23 } }
+auto C1 = UR"(¿)"; // { dg-error "invalid UTF-8 character <bf>" "" { target c++23 } }
+auto D1 = UR"(À)"; // { dg-error "invalid UTF-8 character <c0>" "" { target c++23 } }
+auto E1 = UR"(Á)"; // { dg-error "invalid UTF-8 character <c1>" "" { target c++23 } }
+auto F1 = UR"(õ)"; // { dg-error "invalid UTF-8 character <f5>" "" { target c++23 } }
+auto G1 = UR"(ÿ)"; // { dg-error "invalid UTF-8 character <ff>" "" { target c++23 } }
+auto H1 = UR"(Â)"; // { dg-error "invalid UTF-8 character <c2>" "" { target c++23 } }
+auto I1 = UR"(à)"; // { dg-error "invalid UTF-8 character <e0>" "" { target c++23 } }
+auto J1 = UR"(à€¿)"; // { dg-error "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } }
+auto K1 = UR"(àŸ€)"; // { dg-error "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } }
+auto L1 = UR"(à¿)"; // { dg-error "invalid UTF-8 character <e0><bf>" "" { target c++23 } }
+auto M1 = UR"(ì€)"; // { dg-error "invalid UTF-8 character <ec><80>" "" { target c++23 } }
+auto N1 = UR"(í €)"; // { dg-error "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } }
+auto O1 = UR"(ð€€€)"; // { dg-error "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } }
+auto P1 = UR"(ð¿¿)"; // { dg-error "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } }
+auto Q1 = UR"(ô€€)"; // { dg-error "invalid UTF-8 character <f4><90><80><80>" "" { target c++23 } }
+auto R1 = UR"(ý¿¿¿¿¿)"; // { dg-error "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c++23 } }
+ // { dg-error "invalid UTF-8 character <bf>" "" { target c++23 } .-1 }
+auto A2 = u8"€߿ࠀ퟿ð€€ô¿¿"; // { dg-bogus "invalid UTF-8 character" }
+auto B2 = u8"€"; // { dg-error "invalid UTF-8 character <80>" "" { target c++23 } }
+auto C2 = u8"¿"; // { dg-error "invalid UTF-8 character <bf>" "" { target c++23 } }
+auto D2 = u8"À"; // { dg-error "invalid UTF-8 character <c0>" "" { target c++23 } }
+auto E2 = u8"Á"; // { dg-error "invalid UTF-8 character <c1>" "" { target c++23 } }
+auto F2 = u8"õ"; // { dg-error "invalid UTF-8 character <f5>" "" { target c++23 } }
+auto G2 = u8"ÿ"; // { dg-error "invalid UTF-8 character <ff>" "" { target c++23 } }
+auto H2 = u8"Â"; // { dg-error "invalid UTF-8 character <c2>" "" { target c++23 } }
+auto I2 = u8"à"; // { dg-error "invalid UTF-8 character <e0>" "" { target c++23 } }
+auto J2 = u8"à€¿"; // { dg-error "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } }
+auto K2 = u8"àŸ€"; // { dg-error "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } }
+auto L2 = u8"à¿"; // { dg-error "invalid UTF-8 character <e0><bf>" "" { target c++23 } }
+auto M2 = u8"ì€"; // { dg-error "invalid UTF-8 character <ec><80>" "" { target c++23 } }
+auto N2 = u8"í €"; // { dg-error "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } }
+auto O2 = u8"ð€€€"; // { dg-error "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } }
+auto P2 = u8"ð¿¿"; // { dg-error "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } }
+auto Q2 = u8"ô€€"; // { dg-error "invalid UTF-8 character <f4><90><80><80>" "" { target c++23 } }
+auto R2 = u8"ý¿¿¿¿¿"; // { dg-error "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c++23 } }
+ // { dg-error "invalid UTF-8 character <bf>" "" { target c++23 } .-1 }
diff --git a/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-8.C b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-8.C
new file mode 100644
index 0000000..95c8a91
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-8.C
@@ -0,0 +1,80 @@
+// P2295R6 - Support for UTF-8 as a portable source file encoding
+// This test intentionally contains various byte sequences which are not valid UTF-8
+// { dg-do preprocess { target c++11 } }
+// { dg-options "-finput-charset=UTF-8 -pedantic-errors -Wno-invalid-utf8" }
+
+char32_t a = U'€'; // { dg-bogus "invalid UTF-8 character <80>" "" { target c++23 } }
+char32_t b = U'¿'; // { dg-bogus "invalid UTF-8 character <bf>" "" { target c++23 } }
+char32_t c = U'À'; // { dg-bogus "invalid UTF-8 character <c0>" "" { target c++23 } }
+char32_t d = U'Á'; // { dg-bogus "invalid UTF-8 character <c1>" "" { target c++23 } }
+char32_t e = U'õ'; // { dg-bogus "invalid UTF-8 character <f5>" "" { target c++23 } }
+char32_t f = U'ÿ'; // { dg-bogus "invalid UTF-8 character <ff>" "" { target c++23 } }
+char32_t g = U'Â'; // { dg-bogus "invalid UTF-8 character <c2>" "" { target c++23 } }
+char32_t h = U'à'; // { dg-bogus "invalid UTF-8 character <e0>" "" { target c++23 } }
+char32_t i = U'à€¿'; // { dg-bogus "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } }
+char32_t j = U'àŸ€'; // { dg-bogus "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } }
+char32_t k = U'à¿'; // { dg-bogus "invalid UTF-8 character <e0><bf>" "" { target c++23 } }
+char32_t l = U'ì€'; // { dg-bogus "invalid UTF-8 character <ec><80>" "" { target c++23 } }
+char32_t m = U'í €'; // { dg-bogus "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } }
+char32_t n = U'ð€€€'; // { dg-bogus "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } }
+char32_t o = U'ð¿¿'; // { dg-bogus "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } }
+char32_t p = U'ô€€'; // { dg-bogus "invalid UTF-8 character <f4><90><80><80>" "" { target c++23 } }
+char32_t q = U'ý¿¿¿¿¿'; // { dg-bogus "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c++23 } }
+ // { dg-bogus "invalid UTF-8 character <bf>" "" { target c++23 } .-1 }
+auto A = U"€߿ࠀ퟿ð€€ô¿¿"; // { dg-bogus "invalid UTF-8 character" }
+auto B = U"€"; // { dg-bogus "invalid UTF-8 character <80>" "" { target c++23 } }
+auto C = U"¿"; // { dg-bogus "invalid UTF-8 character <bf>" "" { target c++23 } }
+auto D = U"À"; // { dg-bogus "invalid UTF-8 character <c0>" "" { target c++23 } }
+auto E = U"Á"; // { dg-bogus "invalid UTF-8 character <c1>" "" { target c++23 } }
+auto F = U"õ"; // { dg-bogus "invalid UTF-8 character <f5>" "" { target c++23 } }
+auto G = U"ÿ"; // { dg-bogus "invalid UTF-8 character <ff>" "" { target c++23 } }
+auto H = U"Â"; // { dg-bogus "invalid UTF-8 character <c2>" "" { target c++23 } }
+auto I = U"à"; // { dg-bogus "invalid UTF-8 character <e0>" "" { target c++23 } }
+auto J = U"à€¿"; // { dg-bogus "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } }
+auto K = U"àŸ€"; // { dg-bogus "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } }
+auto L = U"à¿"; // { dg-bogus "invalid UTF-8 character <e0><bf>" "" { target c++23 } }
+auto M = U"ì€"; // { dg-bogus "invalid UTF-8 character <ec><80>" "" { target c++23 } }
+auto N = U"í €"; // { dg-bogus "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } }
+auto O = U"ð€€€"; // { dg-bogus "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } }
+auto P = U"ð¿¿"; // { dg-bogus "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } }
+auto Q = U"ô€€"; // { dg-bogus "invalid UTF-8 character <f4><90><80><80>" "" { target c++23 } }
+auto R = U"ý¿¿¿¿¿"; // { dg-bogus "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c++23 } }
+ // { dg-bogus "invalid UTF-8 character <bf>" "" { target c++23 } .-1 }
+auto A1 = UR"(€߿ࠀ퟿ð€€ô¿¿)"; // { dg-bogus "invalid UTF-8 character" }
+auto B1 = UR"(€)"; // { dg-bogus "invalid UTF-8 character <80>" "" { target c++23 } }
+auto C1 = UR"(¿)"; // { dg-bogus "invalid UTF-8 character <bf>" "" { target c++23 } }
+auto D1 = UR"(À)"; // { dg-bogus "invalid UTF-8 character <c0>" "" { target c++23 } }
+auto E1 = UR"(Á)"; // { dg-bogus "invalid UTF-8 character <c1>" "" { target c++23 } }
+auto F1 = UR"(õ)"; // { dg-bogus "invalid UTF-8 character <f5>" "" { target c++23 } }
+auto G1 = UR"(ÿ)"; // { dg-bogus "invalid UTF-8 character <ff>" "" { target c++23 } }
+auto H1 = UR"(Â)"; // { dg-bogus "invalid UTF-8 character <c2>" "" { target c++23 } }
+auto I1 = UR"(à)"; // { dg-bogus "invalid UTF-8 character <e0>" "" { target c++23 } }
+auto J1 = UR"(à€¿)"; // { dg-bogus "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } }
+auto K1 = UR"(àŸ€)"; // { dg-bogus "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } }
+auto L1 = UR"(à¿)"; // { dg-bogus "invalid UTF-8 character <e0><bf>" "" { target c++23 } }
+auto M1 = UR"(ì€)"; // { dg-bogus "invalid UTF-8 character <ec><80>" "" { target c++23 } }
+auto N1 = UR"(í €)"; // { dg-bogus "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } }
+auto O1 = UR"(ð€€€)"; // { dg-bogus "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } }
+auto P1 = UR"(ð¿¿)"; // { dg-bogus "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } }
+auto Q1 = UR"(ô€€)"; // { dg-bogus "invalid UTF-8 character <f4><90><80><80>" "" { target c++23 } }
+auto R1 = UR"(ý¿¿¿¿¿)"; // { dg-bogus "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c++23 } }
+ // { dg-bogus "invalid UTF-8 character <bf>" "" { target c++23 } .-1 }
+auto A2 = u8"€߿ࠀ퟿ð€€ô¿¿"; // { dg-bogus "invalid UTF-8 character" }
+auto B2 = u8"€"; // { dg-bogus "invalid UTF-8 character <80>" "" { target c++23 } }
+auto C2 = u8"¿"; // { dg-bogus "invalid UTF-8 character <bf>" "" { target c++23 } }
+auto D2 = u8"À"; // { dg-bogus "invalid UTF-8 character <c0>" "" { target c++23 } }
+auto E2 = u8"Á"; // { dg-bogus "invalid UTF-8 character <c1>" "" { target c++23 } }
+auto F2 = u8"õ"; // { dg-bogus "invalid UTF-8 character <f5>" "" { target c++23 } }
+auto G2 = u8"ÿ"; // { dg-bogus "invalid UTF-8 character <ff>" "" { target c++23 } }
+auto H2 = u8"Â"; // { dg-bogus "invalid UTF-8 character <c2>" "" { target c++23 } }
+auto I2 = u8"à"; // { dg-bogus "invalid UTF-8 character <e0>" "" { target c++23 } }
+auto J2 = u8"à€¿"; // { dg-bogus "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } }
+auto K2 = u8"àŸ€"; // { dg-bogus "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } }
+auto L2 = u8"à¿"; // { dg-bogus "invalid UTF-8 character <e0><bf>" "" { target c++23 } }
+auto M2 = u8"ì€"; // { dg-bogus "invalid UTF-8 character <ec><80>" "" { target c++23 } }
+auto N2 = u8"í €"; // { dg-bogus "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } }
+auto O2 = u8"ð€€€"; // { dg-bogus "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } }
+auto P2 = u8"ð¿¿"; // { dg-bogus "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } }
+auto Q2 = u8"ô€€"; // { dg-bogus "invalid UTF-8 character <f4><90><80><80>" "" { target c++23 } }
+auto R2 = u8"ý¿¿¿¿¿"; // { dg-bogus "invalid UTF-8 character <fd><bf><bf><bf>" "" { target c++23 } }
+ // { dg-bogus "invalid UTF-8 character <bf>" "" { target c++23 } .-1 }
diff --git a/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-9.C b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-9.C
new file mode 100644
index 0000000..0afc945
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/Winvalid-utf8-9.C
@@ -0,0 +1,25 @@
+// P2295R6 - Support for UTF-8 as a portable source file encoding
+// This test intentionally contains various byte sequences which are not valid UTF-8
+// { dg-do preprocess }
+// { dg-options "-finput-charset=UTF-8" }
+
+#define I(x)
+I(€߿ࠀ퟿ð€€ô¿¿) // { dg-bogus "invalid UTF-8 character" }
+ // { dg-error "is not valid in an identifier" "" { target *-*-* } .-1 }
+I(€) // { dg-warning "invalid UTF-8 character <80>" "" { target c++23 } }
+I(¿) // { dg-warning "invalid UTF-8 character <bf>" "" { target c++23 } }
+I(À) // { dg-warning "invalid UTF-8 character <c0>" "" { target c++23 } }
+I(Á) // { dg-warning "invalid UTF-8 character <c1>" "" { target c++23 } }
+I(õ) // { dg-warning "invalid UTF-8 character <f5>" "" { target c++23 } }
+I(ÿ) // { dg-warning "invalid UTF-8 character <ff>" "" { target c++23 } }
+I(Â) // { dg-warning "invalid UTF-8 character <c2>" "" { target c++23 } }
+I(à) // { dg-warning "invalid UTF-8 character <e0>" "" { target c++23 } }
+I(à€¿) // { dg-warning "invalid UTF-8 character <e0><80><bf>" "" { target c++23 } }
+I(àŸ€) // { dg-warning "invalid UTF-8 character <e0><9f><80>" "" { target c++23 } }
+I(à¿) // { dg-warning "invalid UTF-8 character <e0><bf>" "" { target c++23 } }
+I(ì€) // { dg-warning "invalid UTF-8 character <ec><80>" "" { target c++23 } }
+I(í €) // { dg-warning "invalid UTF-8 character <ed><a0><80>" "" { target c++23 } }
+I(ð€€€) // { dg-warning "invalid UTF-8 character <f0><80><80><80>" "" { target c++23 } }
+I(ð¿¿) // { dg-warning "invalid UTF-8 character <f0><8f><bf><bf>" "" { target c++23 } }
+I(ô€€) // { dg-error "is not valid in an identifier" }
+I(ý¿¿¿¿¿) // { dg-error "is not valid in an identifier" }
diff --git a/gcc/testsuite/g++.dg/cpp23/auto-array2.C b/gcc/testsuite/g++.dg/cpp23/auto-array2.C
index 0643168..3fc2eae 100644
--- a/gcc/testsuite/g++.dg/cpp23/auto-array2.C
+++ b/gcc/testsuite/g++.dg/cpp23/auto-array2.C
@@ -5,7 +5,7 @@ template<class T> struct A { A(); };
A<int> a[3];
auto (*p)[3] = &a;
A<int> (*p2)[3] = &a;
-A (*p3)[3] = &a; // { dg-error "template placeholder type" }
+A (*p3)[3] = &a; // { dg-error "template placeholder" }
auto (&r)[3] = a;
A<int> (&r2)[3] = a;
-A (&r3)[3] = a; // { dg-error "template placeholder type" }
+A (&r3)[3] = a; // { dg-error "template placeholder" }
diff --git a/gcc/testsuite/g++.dg/cpp23/feat-cxx2b.C b/gcc/testsuite/g++.dg/cpp23/feat-cxx2b.C
index c1f91e7..d3e4072 100644
--- a/gcc/testsuite/g++.dg/cpp23/feat-cxx2b.C
+++ b/gcc/testsuite/g++.dg/cpp23/feat-cxx2b.C
@@ -557,3 +557,9 @@
#elif __cpp_multidimensional_subscript != 202110
# error "__cpp_multidimensional_subscript != 202110"
#endif
+
+#ifndef __cpp_named_character_escapes
+# error "__cpp_named_character_escapes"
+#elif __cpp_named_character_escapes != 202207
+# error "__cpp_named_character_escapes != 202207"
+#endif
diff --git a/gcc/testsuite/g++.dg/cpp23/named-universal-char-escape1.C b/gcc/testsuite/g++.dg/cpp23/named-universal-char-escape1.C
new file mode 100644
index 0000000..fe49482
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/named-universal-char-escape1.C
@@ -0,0 +1,16 @@
+// P2071R2 - Named universal character escapes
+// { dg-do compile }
+// { dg-require-effective-target wchar }
+
+#define z(x) 0
+#define a z(
+int b = a\N{}); // { dg-warning "empty named universal character escape sequence; treating it as separate tokens" "" { target c++23 } }
+int c = a\N{); // { dg-warning "'\\\\N\\\{' not terminated with '\\\}' after \\\\N\\\{; treating it as separate tokens" "" { target c++23 } }
+int d = a\N);
+int e = a\NARG);
+int f = a\N{abc}); // { dg-warning "\\\\N\\\{abc\\\} is not a valid universal character; treating it as separate tokens" "" { target c++23 } }
+int g = a\N{ABC.123}); // { dg-warning "'\\\\N\\\{' not terminated with '\\\}' after \\\\N\\\{ABC; treating it as separate tokens" "" { target c++23 } }
+int h = a\N{NON-EXISTENT CHAR}); // { dg-error "is not a valid universal character" "" { target c++23 } }
+ // { dg-error "was not declared in this scope" "" { target c++23 } .-1 }
+int i = a\N{Latin_Small_Letter_A_With_Acute}); // { dg-warning "\\\\N\\\{Latin_Small_Letter_A_With_Acute\\\} is not a valid universal character; treating it as separate tokens" "" { target c++23 } }
+ // { dg-message "did you mean \\\\N\\\{LATIN SMALL LETTER A WITH ACUTE\\\}\\?" "" { target c++23 } .-1 }
diff --git a/gcc/testsuite/g++.dg/cpp23/named-universal-char-escape2.C b/gcc/testsuite/g++.dg/cpp23/named-universal-char-escape2.C
new file mode 100644
index 0000000..8699e09
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/named-universal-char-escape2.C
@@ -0,0 +1,18 @@
+// P2071R2 - Named universal character escapes
+// { dg-do compile }
+// { dg-require-effective-target wchar }
+// { dg-options "" }
+
+#define z(x) 0
+#define a z(
+int b = a\N{}); // { dg-warning "empty named universal character escape sequence; treating it as separate tokens" }
+int c = a\N{); // { dg-warning "'\\\\N\\\{' not terminated with '\\\}' after \\\\N\\\{; treating it as separate tokens" }
+int d = a\N);
+int e = a\NARG);
+int f = a\N{abc}); // { dg-warning "\\\\N\\\{abc\\\} is not a valid universal character; treating it as separate tokens" }
+int g = a\N{ABC.123}); // { dg-warning "'\\\\N\\\{' not terminated with '\\\}' after \\\\N\\\{ABC; treating it as separate tokens" }
+int h = a\N{NON-EXISTENT CHAR}); // { dg-error "is not a valid universal character" "" { target c++23 } }
+ // { dg-error "was not declared in this scope" "" { target c++23 } .-1 }
+ // { dg-warning "\\\\N\\\{NON-EXISTENT CHAR\\\} is not a valid universal character; treating it as separate tokens" "" { target c++20_down } .-2 }
+int i = a\N{Latin_Small_Letter_A_With_Acute}); // { dg-warning "\\\\N\\\{Latin_Small_Letter_A_With_Acute\\\} is not a valid universal character; treating it as separate tokens" }
+ // { dg-message "did you mean \\\\N\\\{LATIN SMALL LETTER A WITH ACUTE\\\}\\?" "" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/cpp23/subscript8.C b/gcc/testsuite/g++.dg/cpp23/subscript8.C
new file mode 100644
index 0000000..fe00035
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/subscript8.C
@@ -0,0 +1,7 @@
+// DR2507: Allow default arguments
+// { dg-additional-options {-std=c++23} }
+
+struct A
+{
+ void operator[](int, int = 42);
+};
diff --git a/gcc/testsuite/g++.dg/cpp23/wchar-multi1.C b/gcc/testsuite/g++.dg/cpp23/wchar-multi1.C
new file mode 100644
index 0000000..77fa3a6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/wchar-multi1.C
@@ -0,0 +1,42 @@
+// P2362R3 - Remove non-encodable wide character literals and multicharacter
+// wide character literals.
+// { dg-do compile }
+
+char a = 'a';
+int b = 'ab'; // { dg-warning "multi-character character constant" }
+int c = '\u05D9'; // { dg-warning "multi-character character constant" }
+#if __SIZEOF_INT__ > 2
+int d = '\U0001F525'; // { dg-warning "multi-character character constant" "" { target int32 } }
+#endif
+int e = 'abcd'; // { dg-warning "multi-character character constant" }
+wchar_t f = L'f';
+wchar_t g = L'gh'; // { dg-error "character constant too long for its type" "" { target c++23 } }
+ // { dg-warning "character constant too long for its type" "" { target c++20_down } .-1 }
+wchar_t h = L'ijkl'; // { dg-error "character constant too long for its type" "" { target c++23 } }
+ // { dg-warning "character constant too long for its type" "" { target c++20_down } .-1 }
+wchar_t i = L'\U0001F525'; // { dg-error "character constant too long for its type" "" { target { c++23 && { ! 4byte_wchar_t } } } }
+ // { dg-warning "character constant too long for its type" "" { target { c++20_down && { ! 4byte_wchar_t } } } .-1 }
+#ifdef __cpp_char8_t
+typedef char8_t u8;
+#else
+typedef char u8;
+#endif
+#if __cpp_unicode_characters >= 201411
+u8 j = u8'j';
+u8 k = u8'kl'; // { dg-error "character constant too long for its type" "" { target c++17 } }
+u8 l = u8'\U0001F525'; // { dg-error "character constant too long for its type" "" { target c++17 } }
+#endif
+#if __cpp_unicode_characters >= 200704
+char16_t m = u'm';
+char16_t n = u'no'; // { dg-error "character constant too long for its type" "" { target c++11 } }
+char16_t o = u'\u05D9';
+char16_t p = u'\U0001F525'; // { dg-error "character constant too long for its type" "" { target c++11 } }
+char32_t q = U'm';
+char32_t r = U'no'; // { dg-error "character constant too long for its type" "" { target c++11 } }
+char32_t s = U'\u05D9';
+char32_t t = U'\U0001F525';
+#endif
+wchar_t u = L'\u0065\u0301'; // { dg-error "character constant too long for its type" "" { target c++23 } }
+ // { dg-warning "character constant too long for its type" "" { target c++20_down } .-1 }
+wchar_t v = L'eÌ'; // { dg-error "character constant too long for its type" "" { target c++23 } }
+ // { dg-warning "character constant too long for its type" "" { target c++20_down } .-1 }
diff --git a/gcc/testsuite/g++.dg/cpp23/wchar-multi2.C b/gcc/testsuite/g++.dg/cpp23/wchar-multi2.C
new file mode 100644
index 0000000..a63e0ff
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/wchar-multi2.C
@@ -0,0 +1,43 @@
+// P2362R3 - Remove non-encodable wide character literals and multicharacter
+// wide character literals.
+// { dg-do compile }
+// { dg-options "-fshort-wchar" }
+
+char a = 'a';
+int b = 'ab'; // { dg-warning "multi-character character constant" }
+int c = '\u05D9'; // { dg-warning "multi-character character constant" }
+#if __SIZEOF_INT__ > 2
+int d = '\U0001F525'; // { dg-warning "multi-character character constant" "" { target int32 } }
+#endif
+int e = 'abcd'; // { dg-warning "multi-character character constant" }
+wchar_t f = L'f';
+wchar_t g = L'gh'; // { dg-error "character constant too long for its type" "" { target c++23 } }
+ // { dg-warning "character constant too long for its type" "" { target c++20_down } .-1 }
+wchar_t h = L'ijkl'; // { dg-error "character constant too long for its type" "" { target c++23 } }
+ // { dg-warning "character constant too long for its type" "" { target c++20_down } .-1 }
+wchar_t i = L'\U0001F525'; // { dg-error "character constant too long for its type" "" { target { c++23 } } }
+ // { dg-warning "character constant too long for its type" "" { target { c++20_down } } .-1 }
+#ifdef __cpp_char8_t
+typedef char8_t u8;
+#else
+typedef char u8;
+#endif
+#if __cpp_unicode_characters >= 201411
+u8 j = u8'j';
+u8 k = u8'kl'; // { dg-error "character constant too long for its type" "" { target c++17 } }
+u8 l = u8'\U0001F525'; // { dg-error "character constant too long for its type" "" { target c++17 } }
+#endif
+#if __cpp_unicode_characters >= 200704
+char16_t m = u'm';
+char16_t n = u'no'; // { dg-error "character constant too long for its type" "" { target c++11 } }
+char16_t o = u'\u05D9';
+char16_t p = u'\U0001F525'; // { dg-error "character constant too long for its type" "" { target c++11 } }
+char32_t q = U'm';
+char32_t r = U'no'; // { dg-error "character constant too long for its type" "" { target c++11 } }
+char32_t s = U'\u05D9';
+char32_t t = U'\U0001F525';
+#endif
+wchar_t u = L'\u0065\u0301'; // { dg-error "character constant too long for its type" "" { target c++23 } }
+ // { dg-warning "character constant too long for its type" "" { target c++20_down } .-1 }
+wchar_t v = L'eÌ'; // { dg-error "character constant too long for its type" "" { target c++23 } }
+ // { dg-warning "character constant too long for its type" "" { target c++20_down } .-1 }
diff --git a/gcc/testsuite/g++.dg/cpp2a/explicit19.C b/gcc/testsuite/g++.dg/cpp2a/explicit19.C
new file mode 100644
index 0000000..4790381
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/explicit19.C
@@ -0,0 +1,12 @@
+// Verify a conditional explicit-specifier is a SFINAE context.
+// { dg-do compile { target c++20 } }
+
+struct A {
+ template<class T> explicit(T::value) A(T) = delete;
+ A(...);
+};
+
+struct B { static bool value; };
+
+A x(0);
+A y(B{});
diff --git a/gcc/testsuite/g++.dg/cpp2a/keywords2.C b/gcc/testsuite/g++.dg/cpp2a/keywords2.C
new file mode 100644
index 0000000..8714a7b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/keywords2.C
@@ -0,0 +1,13 @@
+// { dg-do compile { target c++17_down } }
+// { dg-options "-Wc++20-compat" }
+
+// Validate suppression of -Wc++20-compat diagnostics.
+#pragma GCC diagnostic ignored "-Wc++20-compat"
+int constinit;
+int consteval;
+int requires;
+int concept;
+int co_await;
+int co_yield;
+int co_return;
+int char8_t;
diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-uneval17.C b/gcc/testsuite/g++.dg/cpp2a/lambda-uneval17.C
new file mode 100644
index 0000000..74e0f87
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/lambda-uneval17.C
@@ -0,0 +1,17 @@
+// PR c++/99209
+// { dg-do compile { target c++20 } }
+
+constexpr char f(...) = delete;
+constexpr decltype(auto) f_adl(auto a) { return f(a); }
+
+namespace A {
+ constexpr char f(auto) { return 'A'; }
+ template<char TemplateParam = f_adl([]{})> void g(char FunctionParam = f_adl([]{})) {
+ char Local = f_adl([]{});
+ }
+}
+
+namespace B {
+ constexpr char f(auto) = delete;
+ void call() { A::g(); }
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/volatile1.C b/gcc/testsuite/g++.dg/cpp2a/volatile1.C
index 7ea6b47..a0264a4 100644
--- a/gcc/testsuite/g++.dg/cpp2a/volatile1.C
+++ b/gcc/testsuite/g++.dg/cpp2a/volatile1.C
@@ -56,6 +56,9 @@ fn2 ()
vi = i;
vi = i = 42;
i = vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ i = vi |= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ i = vi &= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ i = vi ^= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
&(vi = i); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
(vi = 42, 45);
(i = vi = 42, 10); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
@@ -74,8 +77,9 @@ fn2 ()
vi += i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
vi -= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
vi %= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
- vi ^= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
- vi |= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ vi ^= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
+ vi |= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
+ vi &= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
vi /= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
vi = vi += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
vi += vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
@@ -131,7 +135,8 @@ void raccoon ()
volatile T t, u;
t = 42;
u = t = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
- t &= 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ t += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ t &= 42; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
}
void
diff --git a/gcc/testsuite/g++.dg/cpp2a/volatile3.C b/gcc/testsuite/g++.dg/cpp2a/volatile3.C
index f10a297..58816dc 100644
--- a/gcc/testsuite/g++.dg/cpp2a/volatile3.C
+++ b/gcc/testsuite/g++.dg/cpp2a/volatile3.C
@@ -57,6 +57,9 @@ fn2 ()
vi = i;
vi = i = 42;
i = vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
+ i = vi |= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" }
+ i = vi &= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" }
+ i = vi ^= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" }
&(vi = i); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
(vi = 42, 45);
(i = vi = 42, 10); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
@@ -75,8 +78,9 @@ fn2 ()
vi += i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
vi -= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
vi %= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
- vi ^= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
- vi |= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
+ vi ^= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
+ vi |= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
+ vi &= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
vi /= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
vi = vi += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
vi += vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
@@ -132,7 +136,8 @@ void raccoon ()
volatile T t, u;
t = 42;
u = t = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
- t &= 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
+ t += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
+ t &= 42; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
}
void
diff --git a/gcc/testsuite/g++.dg/cpp2a/volatile5.C b/gcc/testsuite/g++.dg/cpp2a/volatile5.C
index 1f9d238..3684be9 100644
--- a/gcc/testsuite/g++.dg/cpp2a/volatile5.C
+++ b/gcc/testsuite/g++.dg/cpp2a/volatile5.C
@@ -8,8 +8,8 @@ f (bool b)
{
(b ? x : y) = 1;
(b ? x : y) += 1; // { dg-warning "compound assignment" "" { target c++20 } }
- z = (b ? x : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } }
- ((z = 2) ? x : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } }
- (b ? (x = 2) : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } }
- (b ? x : (y = 5)) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } }
+ z = (b ? x : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
+ ((z = 2) ? x : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
+ (b ? (x = 2) : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
+ (b ? x : (y = 5)) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
}
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/utf-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/utf-1.C
new file mode 100644
index 0000000..43b354f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/utf-1.C
@@ -0,0 +1,9 @@
+// { dg-do compile { target c++20 } }
+// { dg-options { -gdwarf -dA } }
+
+// Test that all three use DW_ATE_UTF.
+// { dg-final { scan-assembler-times {DW_AT_encoding \(0x10\)} 3 } }
+
+char8_t c8;
+char16_t c16;
+char32_t c32;
diff --git a/gcc/testsuite/g++.dg/ext/array4.C b/gcc/testsuite/g++.dg/ext/array4.C
index 0068ea8..6adf9a3 100644
--- a/gcc/testsuite/g++.dg/ext/array4.C
+++ b/gcc/testsuite/g++.dg/ext/array4.C
@@ -16,7 +16,6 @@ template <typename _Tp>
constexpr integral_constant<true> __is_complete_or_unbounded(_Tp) {
return {};
}
-struct Trans_NS_std_formatter;
template <typename _Tp>
struct is_default_constructible : integral_constant<false> {
static_assert(__is_complete_or_unbounded(_Tp{}), "");
@@ -53,7 +52,7 @@ template <typename> struct basic_string_view { basic_string_view(int, int); };
template <typename, typename> struct formatter;
template <typename, typename>
using has_formatter =
- __bool_constant<__is_constructible(Trans_NS_std_formatter)>;
+ __bool_constant<__is_constructible(void)>;
struct fallback_formatter;
template <typename Context> struct custom_value {
using parse_context = typename Context::parse_context_type;
diff --git a/gcc/testsuite/g++.dg/ext/char8_t-char-literal-1.C b/gcc/testsuite/g++.dg/ext/char8_t-char-literal-1.C
index 8ed85cc..2994dd3 100644
--- a/gcc/testsuite/g++.dg/ext/char8_t-char-literal-1.C
+++ b/gcc/testsuite/g++.dg/ext/char8_t-char-literal-1.C
@@ -1,6 +1,6 @@
// Test that UTF-8 character literals have type char if -fchar8_t is not enabled.
// { dg-do compile }
-// { dg-options "-std=c++17 -fno-char8_t" }
+// { dg-options "-std=c++17 -fsigned-char -fno-char8_t" }
template<typename T1, typename T2>
struct is_same
@@ -10,3 +10,7 @@ template<typename T>
{ static const bool value = true; };
static_assert(is_same<decltype(u8'x'), char>::value, "Error");
+
+#if u8'\0' - 1 > 0
+#error "UTF-8 character literals not signed in preprocessor"
+#endif
diff --git a/gcc/testsuite/g++.dg/ext/char8_t-char-literal-2.C b/gcc/testsuite/g++.dg/ext/char8_t-char-literal-2.C
index 7861736..db4fe70 100644
--- a/gcc/testsuite/g++.dg/ext/char8_t-char-literal-2.C
+++ b/gcc/testsuite/g++.dg/ext/char8_t-char-literal-2.C
@@ -10,3 +10,7 @@ template<typename T>
{ static const bool value = true; };
static_assert(is_same<decltype(u8'x'), char8_t>::value, "Error");
+
+#if u8'\0' - 1 < 0
+#error "UTF-8 character literals not unsigned in preprocessor"
+#endif
diff --git a/gcc/testsuite/g++.dg/ext/has-builtin-1.C b/gcc/testsuite/g++.dg/ext/has-builtin-1.C
new file mode 100644
index 0000000..fe25cb2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/has-builtin-1.C
@@ -0,0 +1,133 @@
+// PR c++/106759
+// { dg-do compile }
+// Verify that __has_builtin gives the correct answer for C++ built-ins.
+
+#if !__has_builtin (__builtin_addressof)
+# error "__has_builtin (__builtin_addressof) failed"
+#endif
+#if !__has_builtin (__builtin_bit_cast)
+# error "__has_builtin (__builtin_bit_cast) failed"
+#endif
+#if !__has_builtin (__builtin_launder)
+# error "__has_builtin (__builtin_launder) failed"
+#endif
+#if !__has_builtin (__has_nothrow_assign)
+# error "__has_builtin (__has_nothrow_assign) failed"
+#endif
+#if !__has_builtin (__has_nothrow_constructor)
+# error "__has_builtin (__has_nothrow_constructor) failed"
+#endif
+#if !__has_builtin (__has_nothrow_copy)
+# error "__has_builtin (__has_nothrow_copy) failed"
+#endif
+#if !__has_builtin (__has_trivial_assign)
+# error "__has_builtin (__has_trivial_assign) failed"
+#endif
+#if !__has_builtin (__has_trivial_constructor)
+# error "__has_builtin (__has_trivial_constructor) failed"
+#endif
+#if !__has_builtin (__has_trivial_copy)
+# error "__has_builtin (__has_trivial_copy) failed"
+#endif
+#if !__has_builtin (__has_trivial_destructor)
+# error "__has_builtin (__has_trivial_destructor) failed"
+#endif
+#if !__has_builtin (__has_unique_object_representations)
+# error "__has_builtin (__has_unique_object_representations) failed"
+#endif
+#if !__has_builtin (__has_virtual_destructor)
+# error "__has_builtin (__has_virtual_destructor) failed"
+#endif
+#if !__has_builtin (__is_abstract)
+# error "__has_builtin (__is_abstract) failed"
+#endif
+#if !__has_builtin (__is_aggregate)
+# error "__has_builtin (__is_aggregate) failed"
+#endif
+#if !__has_builtin (__is_base_of)
+# error "__has_builtin (__is_base_of) failed"
+#endif
+#if !__has_builtin (__is_class)
+# error "__has_builtin (__is_class) failed"
+#endif
+#if !__has_builtin (__is_empty)
+# error "__has_builtin (__is_empty) failed"
+#endif
+#if !__has_builtin (__is_enum)
+# error "__has_builtin (__is_enum) failed"
+#endif
+#if !__has_builtin (__is_final)
+# error "__has_builtin (__is_final) failed"
+#endif
+#if !__has_builtin (__is_layout_compatible)
+# error "__has_builtin (__is_layout_compatible) failed"
+#endif
+#if !__has_builtin (__is_literal_type)
+# error "__has_builtin (__is_literal_type) failed"
+#endif
+#if !__has_builtin (__is_pointer_interconvertible_base_of)
+# error "__has_builtin (__is_pointer_interconvertible_base_of) failed"
+#endif
+#if !__has_builtin (__is_pod)
+# error "__has_builtin (__is_pod) failed"
+#endif
+#if !__has_builtin (__is_polymorphic)
+# error "__has_builtin (__is_polymorphic) failed"
+#endif
+#if !__has_builtin (__is_same)
+# error "__has_builtin (__is_same) failed"
+#endif
+#if !__has_builtin (__is_same_as)
+# error "__has_builtin (__is_same_as) failed"
+#endif
+#if !__has_builtin (__is_standard_layout)
+# error "__has_builtin (__is_standard_layout) failed"
+#endif
+#if !__has_builtin (__is_trivial)
+# error "__has_builtin (__is_trivial) failed"
+#endif
+#if !__has_builtin (__is_trivially_assignable)
+# error "__has_builtin (__is_trivially_assignable) failed"
+#endif
+#if !__has_builtin (__is_trivially_constructible)
+# error "__has_builtin (__is_trivially_constructible) failed"
+#endif
+#if !__has_builtin (__is_trivially_copyable)
+# error "__has_builtin (__is_trivially_copyable) failed"
+#endif
+#if !__has_builtin (__is_union)
+# error "__has_builtin (__is_union) failed"
+#endif
+#if !__has_builtin (__underlying_type)
+# error "__has_builtin (__underlying_type) failed"
+#endif
+#if !__has_builtin (__is_assignable)
+# error "__has_builtin (__is_assignable) failed"
+#endif
+#if !__has_builtin (__is_constructible)
+# error "__has_builtin (__is_constructible) failed"
+#endif
+#if !__has_builtin (__is_nothrow_assignable)
+# error "__has_builtin (__is_nothrow_assignable) failed"
+#endif
+#if !__has_builtin (__is_nothrow_constructible)
+# error "__has_builtin (__is_nothrow_constructible) failed"
+#endif
+#if !__has_builtin (__reference_constructs_from_temporary)
+# error "__has_builtin (__reference_constructs_from_temporary) failed"
+#endif
+#if !__has_builtin (__reference_converts_from_temporary)
+# error "__has_builtin (__reference_converts_from_temporary) failed"
+#endif
+#if !__has_builtin (__builtin_is_constant_evaluated)
+# error "__has_builtin (__builtin_is_constant_evaluated) failed"
+#endif
+#if !__has_builtin (__builtin_source_location)
+# error "__has_builtin (__builtin_source_location) failed"
+#endif
+#if !__has_builtin (__builtin_is_corresponding_member)
+# error "__has_builtin (__builtin_is_corresponding_member) failed"
+#endif
+#if !__has_builtin (__builtin_is_pointer_interconvertible_with_class)
+# error "__has_builtin (__builtin_is_pointer_interconvertible_with_class) failed"
+#endif
diff --git a/gcc/testsuite/g++.dg/ext/integer-pack6.C b/gcc/testsuite/g++.dg/ext/integer-pack6.C
new file mode 100644
index 0000000..dc43116
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/integer-pack6.C
@@ -0,0 +1,13 @@
+// Verify a non-constant argument to __integer_pack respects SFINAE.
+// { dg-do compile { target c++11 } }
+
+template<int...> struct A { };
+
+template<class T> auto f(int) -> A<__integer_pack(T::value)...> = delete;
+template<class T> void f(...);
+
+struct B { static int value; };
+
+int main() {
+ f<B>(0);
+}
diff --git a/gcc/testsuite/g++.dg/ext/pr106877.C b/gcc/testsuite/g++.dg/ext/pr106877.C
new file mode 100644
index 0000000..6bffed9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/pr106877.C
@@ -0,0 +1,13 @@
+// PR target/106877
+// { dg-do compile { target i?86-*-* x86_64-*-* } }
+// { dg-options "-O1 -m16 -mtune=sandybridge -flive-range-shrinkage -fno-dce" }
+
+void
+foo (float b, double c)
+{
+ for (int e = 0; e < 2; e++)
+ {
+ asm volatile ("" : "+f" (c)); // { dg-error "must specify a single register" }
+ asm ("" : "+rm" (c = b));
+ }
+}
diff --git a/gcc/testsuite/g++.dg/ext/unary_trait_incomplete.C b/gcc/testsuite/g++.dg/ext/unary_trait_incomplete.C
index 6c83279..1dfa449 100644
--- a/gcc/testsuite/g++.dg/ext/unary_trait_incomplete.C
+++ b/gcc/testsuite/g++.dg/ext/unary_trait_incomplete.C
@@ -2,6 +2,7 @@
struct I; // { dg-message "forward declaration" }
struct C { };
+union U; // { dg-message "forward declaration" }
bool nas1 = __has_nothrow_assign(I); // { dg-error "incomplete type" }
bool nas2 = __has_nothrow_assign(C[]);
@@ -39,38 +40,105 @@ bool tcp3 = __has_trivial_copy(I[]);
bool tcp4 = __has_trivial_copy(void);
bool tcp5 = __has_trivial_copy(const void);
-bool vde1 = __has_virtual_destructor(I); // { dg-error "incomplete type" }
-bool vde2 = __has_virtual_destructor(C[]);
-bool vde3 = __has_virtual_destructor(I[]);
-bool vde4 = __has_virtual_destructor(void);
-bool vde5 = __has_virtual_destructor(const void);
-
bool tde1 = __has_trivial_destructor(I); // { dg-error "incomplete type" }
bool tde2 = __has_trivial_destructor(C[]);
bool tde3 = __has_trivial_destructor(I[]);
bool tde4 = __has_trivial_destructor(void);
bool tde5 = __has_trivial_destructor(const void);
-bool abs1 = __is_abstract(I); // { dg-error "incomplete type" }
-bool abs2 = __is_abstract(C[]);
-bool abs3 = __is_abstract(I[]);
-bool abs4 = __is_abstract(void);
-bool abs5 = __is_abstract(const void);
+// T shall be a complete type, cv void, or an array of unknown bound.
-bool pod1 = __is_pod(I); // { dg-error "incomplete type" }
-bool pod2 = __is_pod(C[]);
-bool pod3 = __is_pod(I[]);
-bool pod4 = __is_pod(void);
-bool pod5 = __is_pod(const void);
+bool con1 = __is_constructible(C);
+bool con2 = __is_constructible(I); // { dg-error "incomplete type" }
+bool con3 = __is_constructible(U); // { dg-error "incomplete type" }
+bool con4 = __is_constructible(C[]);
+bool con5 = __is_constructible(I[]);
+bool con6 = __is_constructible(U[]);
+bool con7 = __is_constructible(C[1]);
+bool con8 = __is_constructible(I[1]); // { dg-error "incomplete type" }
+bool con9 = __is_constructible(U[1]); // { dg-error "incomplete type" }
+bool con10 = __is_constructible(void);
+bool con11 = __is_constructible(const void);
+
+// If T is a non-union class type, T shall be a complete type.
+
+bool vde1 = __has_virtual_destructor(I); // { dg-error "incomplete type" }
+bool vde2 = __has_virtual_destructor(U);
+bool vde3 = __has_virtual_destructor(C[]);
+bool vde4 = __has_virtual_destructor(I[]);
+bool vde5 = __has_virtual_destructor(U[]);
+bool vde6 = __has_virtual_destructor(C[1]);
+bool vde7 = __has_virtual_destructor(I[1]);
+bool vde8 = __has_virtual_destructor(U[1]);
+bool vde9 = __has_virtual_destructor(void);
+bool vde10 = __has_virtual_destructor(const void);
+
+bool abs1 = __is_abstract(I); // { dg-error "incomplete type" }
+bool abs2 = __is_abstract(U);
+bool abs3 = __is_abstract(C[]);
+bool abs4 = __is_abstract(I[]);
+bool abs5 = __is_abstract(U[]);
+bool abs6 = __is_abstract(C[1]);
+bool abs7 = __is_abstract(I[1]);
+bool abs8 = __is_abstract(U[1]);
+bool abs9 = __is_abstract(void);
+bool abs10 = __is_abstract(const void);
bool emp1 = __is_empty(I); // { dg-error "incomplete type" }
-bool emp2 = __is_empty(C[]);
-bool emp3 = __is_empty(I[]);
-bool emp4 = __is_empty(void);
-bool emp5 = __is_empty(const void);
+bool emp2 = __is_empty(U);
+bool emp3 = __is_empty(C[]);
+bool emp4 = __is_empty(I[]);
+bool emp5 = __is_empty(U[]);
+bool emp6 = __is_empty(C[1]);
+bool emp7 = __is_empty(I[1]);
+bool emp8 = __is_empty(U[1]);
+bool emp9 = __is_empty(void);
+bool emp10 = __is_empty(const void);
bool pol1 = __is_polymorphic(I); // { dg-error "incomplete type" }
-bool pol2 = __is_polymorphic(C[]);
-bool pol3 = __is_polymorphic(I[]);
-bool pol4 = __is_polymorphic(void);
-bool pol5 = __is_polymorphic(const void);
+bool pol2 = __is_polymorphic(U);
+bool pol3 = __is_polymorphic(C[]);
+bool pol4 = __is_polymorphic(I[]);
+bool pol5 = __is_polymorphic(U[]);
+bool pol6 = __is_polymorphic(C[1]);
+bool pol7 = __is_polymorphic(I[1]);
+bool pol8 = __is_polymorphic(U[1]);
+bool pol9 = __is_polymorphic(void);
+bool pol10 = __is_polymorphic(const void);
+
+// If T is a class type, T shall be a complete type.
+
+bool agg1 = __is_aggregate(I); // { dg-error "incomplete type" }
+bool agg2 = __is_aggregate(U); // { dg-error "incomplete type" }
+bool agg3 = __is_aggregate(C[]);
+bool agg4 = __is_aggregate(I[]);
+bool agg5 = __is_aggregate(U[]);
+bool agg6 = __is_aggregate(C[1]);
+bool agg7 = __is_aggregate(I[1]);
+bool agg8 = __is_aggregate(U[1]);
+bool agg9 = __is_aggregate(void);
+bool agg10 = __is_aggregate(const void);
+
+bool fin1 = __is_final(I); // { dg-error "incomplete type" }
+bool fin2 = __is_final(U); // { dg-error "incomplete type" }
+bool fin3 = __is_final(C[]);
+bool fin4 = __is_final(I[]);
+bool fin5 = __is_final(U[]);
+bool fin6 = __is_final(C[1]);
+bool fin7 = __is_final(I[1]);
+bool fin8 = __is_final(U[1]);
+bool fin9 = __is_final(void);
+bool fin10 = __is_final(const void);
+
+// remove_all_extents_t<T> shall be a complete type or cv void.
+
+bool pod1 = __is_pod(I); // { dg-error "incomplete type" }
+bool pod2 = __is_pod(U); // { dg-error "incomplete type" }
+bool pod3 = __is_pod(C[]);
+bool pod4 = __is_pod(I[]); // { dg-error "incomplete type" }
+bool pod5 = __is_pod(U[]); // { dg-error "incomplete type" }
+bool pod6 = __is_pod(C[1]);
+bool pod7 = __is_pod(I[1]); // { dg-error "incomplete type" }
+bool pod8 = __is_pod(U[1]); // { dg-error "incomplete type" }
+bool pod9 = __is_pod(void);
+bool pod10 = __is_pod(const void);
diff --git a/gcc/testsuite/g++.dg/gcov/gcov.exp b/gcc/testsuite/g++.dg/gcov/gcov.exp
index 88acd95..04e7a01 100644
--- a/gcc/testsuite/g++.dg/gcov/gcov.exp
+++ b/gcc/testsuite/g++.dg/gcov/gcov.exp
@@ -24,9 +24,9 @@ global GXX_UNDER_TEST
# Find gcov in the same directory as $GXX_UNDER_TEST.
if { ![is_remote host] && [string match "*/*" [lindex $GXX_UNDER_TEST 0]] } {
- set GCOV [file dirname [lindex $GXX_UNDER_TEST 0]]/gcov
+ set GCOV [file dirname [lindex $GXX_UNDER_TEST 0]]/[transform gcov]
} else {
- set GCOV gcov
+ set GCOV [transform gcov]
}
# Initialize harness.
diff --git a/gcc/testsuite/g++.dg/goacc/mdc.C b/gcc/testsuite/g++.dg/goacc/mdc.C
index e8ba1cc..9d460f2 100644
--- a/gcc/testsuite/g++.dg/goacc/mdc.C
+++ b/gcc/testsuite/g++.dg/goacc/mdc.C
@@ -43,7 +43,9 @@ t1 ()
#pragma acc exit data detach(rz[:]) /* { dg-error "expected single pointer in .detach. clause" } */
/* { dg-error "has no data movement clause" "" { target *-*-* } .-1 } */
#pragma acc enter data attach(rz[3]) /* { dg-error "expected pointer in .attach. clause" } */
+/* { dg-error "has no data movement clause" "" { target *-*-* } .-1 } */
#pragma acc exit data detach(rz[3]) /* { dg-error "expected pointer in .detach. clause" } */
+/* { dg-error "has no data movement clause" "" { target *-*-* } .-1 } */
#pragma acc enter data attach(rs.e)
#pragma acc exit data detach(rs.e) attach(rz) /* { dg-error ".attach. is not valid for" } */
diff --git a/gcc/testsuite/g++.dg/goacc/member-array-acc.C b/gcc/testsuite/g++.dg/goacc/member-array-acc.C
new file mode 100644
index 0000000..9993768
--- /dev/null
+++ b/gcc/testsuite/g++.dg/goacc/member-array-acc.C
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-gimple" } */
+
+struct Foo {
+ float *a;
+ void init(int N) {
+ a = new float[N];
+ #pragma acc enter data create(a[0:N])
+ }
+};
+int main() { Foo x; x.init(1024); }
+
+/* { dg-final { scan-tree-dump {struct:\*\(struct Foo \*\) this \[len: 1\]\) map\(alloc:this->a \[len: [0-9]+\]\) map\(alloc:\*_[0-9]+ \[len: _[0-9]+\]\) map\(attach:this->a \[bias: 0\]\)} "gimple" } } */
diff --git a/gcc/testsuite/g++.dg/gomp/map-3.C b/gcc/testsuite/g++.dg/gomp/map-3.C
new file mode 100644
index 0000000..c45f850
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/map-3.C
@@ -0,0 +1,9 @@
+// PR c++/106858
+// { dg-additional-options "-fopenmp -fsanitize=undefined" }
+
+class A {
+ void f() {
+ #pragma omp target map(this->f) // { dg-error "member function" }
+ ;
+ }
+};
diff --git a/gcc/testsuite/g++.dg/gomp/member-array-omp.C b/gcc/testsuite/g++.dg/gomp/member-array-omp.C
new file mode 100644
index 0000000..a53aa44
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/member-array-omp.C
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-gimple" } */
+
+struct Foo {
+ float *a;
+ void init(int N) {
+ a = new float[N];
+ #pragma omp target enter data map(alloc:a[0:N])
+ }
+};
+int main() { Foo x; x.init(1024); }
+
+/* { dg-final { scan-tree-dump {map\(alloc:\*_[0-9]+ \[len: _[0-9]+\]\) map\(attach:this->a \[bias: 0\]\)} "gimple" } } */
diff --git a/gcc/testsuite/g++.dg/gomp/ompx-attrs-1.C b/gcc/testsuite/g++.dg/gomp/ompx-attrs-1.C
new file mode 100644
index 0000000..2e9fc0b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/ompx-attrs-1.C
@@ -0,0 +1,7 @@
+// { dg-do compile { target c++11 } }
+
+void
+foo ()
+{
+ [[ompx::directive(some_vendor_extension)]]; /* { dg-warning "attributes at the beginning of statement are ignored" } */
+}
diff --git a/gcc/testsuite/g++.dg/gomp/pr106492.C b/gcc/testsuite/g++.dg/gomp/pr106492.C
new file mode 100644
index 0000000..f263bb4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/pr106492.C
@@ -0,0 +1,49 @@
+/* PR middle-end/106492 */
+
+template <typename T>
+struct S {
+ T a : 12;
+ S () : a(0)
+ {
+#pragma omp for simd linear(a)
+ for (int k = 0; k < 64; ++k)
+ a++;
+ }
+};
+struct U {
+ int a : 12;
+ U () : a(0)
+ {
+#pragma omp for simd linear(a)
+ for (int k = 0; k < 64; ++k)
+ a++;
+ }
+};
+
+S<int> s;
+U u;
+
+
+template <typename T>
+struct Sptr {
+ T a;
+ Sptr (T init) : a(init)
+ {
+#pragma omp for simd linear(a)
+ for (int k = 0; k < 64; ++k)
+ a++;
+ }
+};
+struct Uptr {
+ int *a;
+ Uptr (int *init) : a(init)
+ {
+#pragma omp for simd linear(a)
+ for (int k = 0; k < 64; ++k)
+ a++;
+ }
+};
+
+int i[1024];
+Sptr<int *> sptr(i);
+Uptr uptr(&i[100]);
diff --git a/gcc/testsuite/g++.dg/gomp/pr106829.C b/gcc/testsuite/g++.dg/gomp/pr106829.C
new file mode 100644
index 0000000..0295efb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/pr106829.C
@@ -0,0 +1,15 @@
+// PR c++/106829
+
+namespace std
+{
+ template <typename> class complex;
+ template <> struct complex<double> { complex (double); _Complex double d; };
+}
+struct S { void static foo (); };
+
+void
+S::foo ()
+{
+#pragma omp target
+ std::complex<double> c = 0.0;
+}
diff --git a/gcc/testsuite/g++.dg/gomp/target-3.C b/gcc/testsuite/g++.dg/gomp/target-3.C
index f4d40ec..432f026 100644
--- a/gcc/testsuite/g++.dg/gomp/target-3.C
+++ b/gcc/testsuite/g++.dg/gomp/target-3.C
@@ -33,4 +33,6 @@ T<N>::bar (int x)
template struct T<0>;
-/* { dg-final { scan-tree-dump-times "map\\(struct:\\*this \\\[len: 2\\\]\\) map\\(alloc:this->a \\\[len: \[0-9\]+\\\]\\) map\\(alloc:this->b \\\[len: \[0-9\]+\\\]\\)" 4 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "map\\(struct:\\*\\(struct S \\*\\) this \\\[len: 2\\\]\\) map\\(alloc:this->a \\\[len: \[0-9\]+\\\]\\) map\\(alloc:this->b \\\[len: \[0-9\]+\\\]\\)" 2 "gimple" } } */
+
+/* { dg-final { scan-tree-dump-times "map\\(struct:\\*\\(struct T \\*\\) this \\\[len: 2\\\]\\) map\\(alloc:this->a \\\[len: \[0-9\]+\\\]\\) map\\(alloc:this->b \\\[len: \[0-9\]+\\\]\\)" 2 "gimple" } } */
diff --git a/gcc/testsuite/g++.dg/gomp/target-lambda-1.C b/gcc/testsuite/g++.dg/gomp/target-lambda-1.C
index 7f83f92..5ce8cea 100644
--- a/gcc/testsuite/g++.dg/gomp/target-lambda-1.C
+++ b/gcc/testsuite/g++.dg/gomp/target-lambda-1.C
@@ -87,8 +87,8 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* firstprivate\(b\) map\(alloc:MEM.* \[len: 0\]\) map\(firstprivate:iptr \[pointer assign, bias: 0\]\) map\(alloc:MEM.* \[len: 0\]\) map\(firstprivate:this \[pointer assign, bias: 0\]\) map\(to:\*__closure \[len: [0-9]+\]\) map\(firstprivate:__closure \[pointer assign, bias: 0\]\) map\(tofrom:\*_[0-9]+ \[len: [0-9]+\]\) map\(always_pointer:__closure->__this \[pointer assign, bias: 0\]\) map\(attach_zero_length_array_section:__closure->__iptr \[bias: 0\]\) map\(attach_zero_length_array_section:_[0-9]+->ptr \[bias: 0\]\) map\(from:mapped \[len: [0-9]+\]\) map\(alloc:\*_[0-9]+ \[len: 0\]\) map\(alloc:\*_[0-9]+ \[len: 0\]\)} "gimple" } } */
+/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* firstprivate\(b\) map\(alloc:MEM.* \[len: 0\]\) map\(firstprivate:iptr \[pointer assign, bias: 0\]\) map\(alloc:MEM.* \[len: 0\]\) map\(firstprivate:this \[pointer assign, bias: 0\]\) map\(to:\*__closure \[len: [0-9]+\]\) map\(firstprivate:__closure \[pointer assign, bias: 0\]\) map\(tofrom:\*_[0-9]+ \[len: [0-9]+\]\) map\(always_pointer:__closure->__this \[pointer assign, bias: 0\]\) map\(from:mapped \[len: [0-9]+\]\) map\(alloc:\*_[0-9]+ \[len: 0\]\) map\(alloc:\*_[0-9]+ \[len: 0\]\) map\(attach_zero_length_array_section:__closure->__iptr \[bias: 0\]\) map\(attach_zero_length_array_section:_[0-9]+->ptr \[bias: 0\]\)} "gimple" } } */
-/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* firstprivate\(end\) firstprivate\(begin\) map\(to:loop \[len: [0-9]+\]\) map\(attach_zero_length_array_section:loop\.__data1 \[bias: 0\]\) map\(alloc:\*_[0-9]+ \[len: 0\]\)} "gimple" } } */
+/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* firstprivate\(end\) firstprivate\(begin\) map\(to:loop \[len: [0-9]+\]\) map\(alloc:\*_[0-9]+ \[len: 0\]\) map\(attach_zero_length_array_section:loop\.__data1 \[bias: 0\]\)} "gimple" } } */
-/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* firstprivate\(end\) firstprivate\(begin\) map\(to:loop \[len: [0-9]+\]\) map\(attach_zero_length_array_section:loop\.__data2 \[bias: 0\]\) map\(alloc:\*_[0-9]+ \[len: 0\]\)} "gimple" } } */
+/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* firstprivate\(end\) firstprivate\(begin\) map\(to:loop \[len: [0-9]+\]\) map\(alloc:\*_[0-9]+ \[len: 0\]\) map\(attach_zero_length_array_section:loop\.__data2 \[bias: 0\]\)} "gimple" } } */
diff --git a/gcc/testsuite/g++.dg/gomp/target-this-2.C b/gcc/testsuite/g++.dg/gomp/target-this-2.C
index 8a76bb8..cc08e7e 100644
--- a/gcc/testsuite/g++.dg/gomp/target-this-2.C
+++ b/gcc/testsuite/g++.dg/gomp/target-this-2.C
@@ -46,4 +46,4 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* firstprivate\(n\) map\(alloc:MEM.* \[len: 0\]\) map\(firstprivate:this \[pointer assign, bias: 0\]\) firstprivate\(m\) map\(to:\*__closure \[len: [0-9]+\]\) map\(firstprivate:__closure \[pointer assign, bias: 0\]\) map\(tofrom:\*_[0-9]+ \[len: [0-9]+\]\) map\(always_pointer:__closure->__this \[pointer assign, bias: 0\]\) map\(from:v \[len: [0-9]+\]\)} "gimple" } } */
+/* { dg-final { scan-tree-dump {map\(alloc:MEM\[\(char \*\)_[0-9]+\] \[len: [0-9]+\]\) map\(firstprivate:this \[pointer assign, bias: 0\]\) firstprivate\(m\) map\(to:\*__closure \[len: [0-9]+\]\) map\(firstprivate:__closure \[pointer assign, bias: 0\]\) map\(tofrom:\*_[0-9]+ \[len: [0-9]+\]\) map\(always_pointer:__closure->__this \[pointer assign, bias: 0\]\) map\(from:v \[len: [0-9]+\]\)} "gimple" } } */
diff --git a/gcc/testsuite/g++.dg/gomp/target-this-3.C b/gcc/testsuite/g++.dg/gomp/target-this-3.C
index 91cfbd6..bc2cc0b 100644
--- a/gcc/testsuite/g++.dg/gomp/target-this-3.C
+++ b/gcc/testsuite/g++.dg/gomp/target-this-3.C
@@ -100,6 +100,6 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* map\(alloc:MEM.* \[len: 0\]\) map\(firstprivate:this \[pointer assign, bias: 0\]\) firstprivate\(n\) map\(tofrom:\*this \[len: [0-9]+\]\) map\(firstprivate:this \[pointer assign, bias: 0\]\) map\(alloc:\*_[0-9]+ \[pointer assign, zero-length array section, bias: 0\]\) map\(attach:this->refptr \[bias: 0\]\) map\(from:mapped \[len: [0-9]+\]\)} "gimple" } } */
+/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* firstprivate\(n\) map\(tofrom:\*this \[len: [0-9]+\]\) map\(firstprivate:this \[pointer assign, bias: 0\]\) map\(from:mapped \[len: [0-9]+\]\) map\(alloc:\*_[0-9+] \[len: 0\]\) map\(alloc:\*_[0-9]+ \[pointer assign, zero-length array section, bias: 0\]\) map\(attach:this->refptr \[bias: 0\]\)} "gimple" } } */
-/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* map\(alloc:MEM.* \[len: 0\]\) map\(firstprivate:this \[pointer assign, bias: 0\]\) firstprivate\(n\) map\(tofrom:\*this \[len: [0-9]+\]\) map\(firstprivate:this \[pointer assign, bias: 0\]\) map\(attach_zero_length_array_section:this->ptr \[bias: 0\]\) map\(from:mapped \[len: [0-9]+\]\) map\(alloc:\*_[0-9]+ \[len: 0\]\)} "gimple" } } */
+/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* firstprivate\(n\) map\(tofrom:\*this \[len: [0-9]+\]\) map\(firstprivate:this \[pointer assign, bias: 0\]\) map\(from:mapped \[len: [0-9]+\]\) map\(alloc:\*_[0-9]+ \[len: 0\]\) map\(attach_zero_length_array_section:this->ptr \[bias: 0\]\)} "gimple" } } */
diff --git a/gcc/testsuite/g++.dg/gomp/target-this-4.C b/gcc/testsuite/g++.dg/gomp/target-this-4.C
index e4b2a71..9ade3cc 100644
--- a/gcc/testsuite/g++.dg/gomp/target-this-4.C
+++ b/gcc/testsuite/g++.dg/gomp/target-this-4.C
@@ -102,6 +102,6 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* firstprivate\(n\) map\(alloc:MEM.* \[len: 0\]\) map\(firstprivate:this \[pointer assign, bias: 0\]\) map\(to:\*__closure \[len: [0-9]+\]\) map\(firstprivate:__closure \[pointer assign, bias: 0\]\) map\(tofrom:\*_[0-9]+ \[len: [0-9]+\]\) map\(always_pointer:__closure->__this \[pointer assign, bias: 0\]\) map\(attach_zero_length_array_section:_[0-9]+->ptr \[bias: 0\]\) map\(from:mapped \[len: [0-9]+\]\) map\(alloc:\*_[0-9]+ \[len: 0\]\)} "gimple" } } */
+/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* firstprivate\(n\) map\(alloc:MEM.* \[len: 0\]\) map\(firstprivate:this \[pointer assign, bias: 0\]\) map\(to:\*__closure \[len: [0-9]+\]\) map\(firstprivate:__closure \[pointer assign, bias: 0\]\) map\(tofrom:\*_[0-9]+ \[len: [0-9]+\]\) map\(always_pointer:__closure->__this \[pointer assign, bias: 0\]\) map\(from:mapped \[len: 1\]\) map\(alloc:\*_[0-9]+ \[len: 0\]\) map\(attach_zero_length_array_section:_[0-9]+->ptr \[bias: 0\]\)} "gimple" } } */
-/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* firstprivate\(n\) map\(alloc:MEM.* \[len: 0\]\) map\(firstprivate:this \[pointer assign, bias: 0\]\) map\(to:\*__closure \[len: [0-9]+\]\) map\(firstprivate:__closure \[pointer assign, bias: 0\]\) map\(tofrom:\*_[0-9]+ \[len: [0-9]+\]\) map\(always_pointer:__closure->__this \[pointer assign, bias: 0\]\) map\(alloc:\*_[0-9]+ \[pointer assign, zero-length array section, bias: 0\]\) map\(attach:_[0-9]+->refptr \[bias: 0\]\) map\(from:mapped \[len: [0-9]+\]\) map\(alloc:\*_[0-9]+ \[len: 0\]\)} "gimple" } } */
+/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* firstprivate\(n\) map\(alloc:MEM.* \[len: 0\]\) map\(firstprivate:this \[pointer assign, bias: 0\]\) map\(to:\*__closure \[len: [0-9]+\]\) map\(firstprivate:__closure \[pointer assign, bias: 0\]\) map\(tofrom:\*_[0-9]+ \[len: [0-9]+\]\) map\(always_pointer:__closure->__this \[pointer assign, bias: 0\]\) map\(from:mapped \[len: [0-9]+\]\) map\(alloc:\*_[0-9]+ \[len: 0\]\) map\(alloc:\*_[0-9]+ \[pointer assign, zero-length array section, bias: 0\]\) map\(attach:_[0-9]+->refptr \[bias: 0\]\)} "gimple" } } */
diff --git a/gcc/testsuite/g++.dg/gomp/unmappable-1.C b/gcc/testsuite/g++.dg/gomp/unmappable-1.C
index 364f884..28ba184 100644
--- a/gcc/testsuite/g++.dg/gomp/unmappable-1.C
+++ b/gcc/testsuite/g++.dg/gomp/unmappable-1.C
@@ -4,7 +4,7 @@
class C
{
public:
- static int static_member; /* { dg-message "static field .C::static_member. is not mappable" } */
+ static int static_member;
virtual void f() {}
};
@@ -14,7 +14,6 @@ int
main ()
{
#pragma omp target map(v) /* { dg-error ".v. does not have a mappable type in .map. clause" } */
- /* { dg-message "incomplete type .C \\\[\\\]. is not mappable" "" { target *-*-* } .-1 } */
{
}
}
diff --git a/gcc/testsuite/g++.dg/init/elide8.C b/gcc/testsuite/g++.dg/init/elide8.C
new file mode 100644
index 0000000..31f899b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/elide8.C
@@ -0,0 +1,11 @@
+// CWG 2403 case 3: we can't elide this copy because the delegating constructor
+// might be used to initialize a base.
+// { dg-do compile { target c++11 } }
+
+struct Noncopyable {
+ Noncopyable() = default;
+ Noncopyable(const Noncopyable &) = delete;
+ Noncopyable(int) : Noncopyable(make()) {} // { dg-error "deleted" }
+
+ static Noncopyable make();
+};
diff --git a/gcc/testsuite/g++.dg/init/static-cdtor1.C b/gcc/testsuite/g++.dg/init/static-cdtor1.C
index 343178a..d4d85f9 100644
--- a/gcc/testsuite/g++.dg/init/static-cdtor1.C
+++ b/gcc/testsuite/g++.dg/init/static-cdtor1.C
@@ -3,9 +3,11 @@
// Make sure we emit initializers in the correct order.
// ctors
-// { dg-final { scan-assembler {_Z41__static_initialization_and_destruction_0v:.*movl \$var1[^\n]*\n[^\n]*_ZN5LeelaC1Ev[^\n]*\n[^\n]*movl \$var2[^\n]*\n[^\n]*_ZN5LeelaC1Ev[^\n]*\n[^\n]*movl \$var3[^\n]*\n[^\n]*_ZN5LeelaC1Ev} } }
+// { dg-final { scan-assembler {_Z41__static_initialization_and_destruction_0v:.*movl \$var1[^\n]*\n[^\n]*_ZN5LeelaC1Ev[^\n]*\n[^\n]*movl \$var2[^\n]*\n[^\n]*_ZN5LeelaC1Ev[^\n]*\n[^\n]*movl \$var3[^\n]*\n[^\n]*_ZN5LeelaC1Ev} { target nonpic } } }
+// { dg-final { scan-assembler {_Z41__static_initialization_and_destruction_0v:.*leaq var1[^\n]*\n[^\n]*(?:|movq[^\n]*\n[^\n]*)_ZN5LeelaC1Ev[^\n]*\n[^\n]*leaq var2[^\n]*\n[^\n]*(?:|movq[^\n]*\n[^\n]*)_ZN5LeelaC1Ev[^\n]*\n[^\n]*leaq var3[^\n]*\n[^\n]*(?:|movq[^\n]*\n[^\n]*)_ZN5LeelaC1Ev} { target { ! nonpic } } } }
// dtors
-// { dg-final { scan-assembler {_Z41__static_initialization_and_destruction_1v:.*movl \$var3[^\n]*\n[^\n]*_ZN5LeelaD1Ev[^\n]*\n[^\n]*movl \$var2[^\n]*\n[^\n]*_ZN5LeelaD1Ev[^\n]*\n[^\n]*movl \$var1[^\n]*\n[^\n]*_ZN5LeelaD1Ev} } }
+// { dg-final { scan-assembler {_Z41__static_initialization_and_destruction_1v:.*movl \$var3[^\n]*\n[^\n]*_ZN5LeelaD1Ev[^\n]*\n[^\n]*movl \$var2[^\n]*\n[^\n]*_ZN5LeelaD1Ev[^\n]*\n[^\n]*movl \$var1[^\n]*\n[^\n]*_ZN5LeelaD1Ev} { target nonpic } } }
+// { dg-final { scan-assembler {_Z41__static_initialization_and_destruction_1v:.*leaq var3[^\n]*\n[^\n]*(?:|movq[^\n]*\n[^\n]*)_ZN5LeelaD1Ev[^\n]*\n[^\n]*leaq var2[^\n]*\n[^\n]*(?:|movq[^\n]*\n[^\n]*)_ZN5LeelaD1Ev[^\n]*\n[^\n]*leaq var1[^\n]*\n[^\n]*(?:|movq[^\n]*\n[^\n]*)_ZN5LeelaD1Ev} { target { ! nonpic } } } }
struct Leela {
Leela ();
diff --git a/gcc/testsuite/g++.dg/modules/auto-3.h b/gcc/testsuite/g++.dg/modules/auto-3.h
new file mode 100644
index 0000000..f129433
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/auto-3.h
@@ -0,0 +1,10 @@
+template<class>
+struct __tree_barrier {
+ static const auto __phase_alignment_1 = 0;
+
+ template<class>
+ static const auto __phase_alignment_2 = 0;
+};
+
+template<class>
+inline auto __phase_alignment_3 = 0;
diff --git a/gcc/testsuite/g++.dg/modules/auto-3_a.H b/gcc/testsuite/g++.dg/modules/auto-3_a.H
new file mode 100644
index 0000000..25a7a73
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/auto-3_a.H
@@ -0,0 +1,4 @@
+// { dg-additional-options "-fmodule-header" }
+// { dg-module-cmi {} }
+
+#include "auto-3.h"
diff --git a/gcc/testsuite/g++.dg/modules/auto-3_b.C b/gcc/testsuite/g++.dg/modules/auto-3_b.C
new file mode 100644
index 0000000..03b6d46
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/auto-3_b.C
@@ -0,0 +1,4 @@
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+#include "auto-3.h"
+import "auto-3_a.H";
diff --git a/gcc/testsuite/g++.dg/modules/loc-prune-4.C b/gcc/testsuite/g++.dg/modules/loc-prune-4.C
index 765c378..aa8f248 100644
--- a/gcc/testsuite/g++.dg/modules/loc-prune-4.C
+++ b/gcc/testsuite/g++.dg/modules/loc-prune-4.C
@@ -18,5 +18,5 @@ int baz (int);
// { dg-final { scan-lang-dump {Ordinary maps:2 locs:12288 range_bits:5} module } }
// { dg-final { scan-lang-dump { 1 source file names\n Source file...=[^\n]*loc-prune-4.C\n} module } }
-// { dg-final { scan-lang-dump { Span:0 ordinary \[2.....\+12288,\+4096\)->\[0,\+4096\)} module } }
-// { dg-final { scan-lang-dump { Span:1 ordinary \[2.....\+40960,\+8192\)->\[4096,\+8192\)} module } }
+// { dg-final { scan-lang-dump { Span:0 ordinary \[[0-9]+\+12288,\+4096\)->\[0,\+4096\)} module } }
+// { dg-final { scan-lang-dump { Span:1 ordinary \[[0-9]+\+40960,\+8192\)->\[4096,\+8192\)} module } }
diff --git a/gcc/testsuite/g++.dg/modules/partial-2_a.C b/gcc/testsuite/g++.dg/modules/partial-2_a.C
new file mode 100644
index 0000000..2681bb5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/partial-2_a.C
@@ -0,0 +1,43 @@
+// PR c++/106826
+// { dg-additional-options -fmodules-ts }
+// { dg-module-cmi pr106826 }
+export module pr106826;
+
+template<class T> constexpr bool is_reference_v = false;
+template<class T> constexpr bool is_reference_v<T&> = true;
+template<class T> constexpr bool is_reference_v<T&&> = true;
+
+struct A {
+ template<class T> static constexpr bool is_reference_v = false;
+};
+
+template<class T> constexpr bool A::is_reference_v<T&> = true;
+template<class T> constexpr bool A::is_reference_v<T&&> = true;
+
+#if __cpp_concepts
+namespace concepts {
+ template<class T> bool is_reference_v;
+
+ template<class T> requires __is_same(T, T&)
+ constexpr bool is_reference_v<T> = true;
+
+ template<class T> requires __is_same(T, T&&) && (!__is_same(T, T&))
+ constexpr bool is_reference_v<T> = true;
+
+ template<class T> requires (!__is_same(T, T&)) && (!__is_same(T, T&&))
+ constexpr bool is_reference_v<T> = false;
+
+ struct A {
+ template<class T> static bool is_reference_v;
+ };
+
+ template<class T> requires __is_same(T, T&)
+ constexpr bool A::is_reference_v<T> = true;
+
+ template<class T> requires __is_same(T, T&&) && (!__is_same(T, T&))
+ constexpr bool A::is_reference_v<T> = true;
+
+ template<class T> requires (!__is_same(T, T&)) && (!__is_same(T, T&&))
+ constexpr bool A::is_reference_v<T> = false;
+}
+#endif
diff --git a/gcc/testsuite/g++.dg/modules/partial-2_b.C b/gcc/testsuite/g++.dg/modules/partial-2_b.C
new file mode 100644
index 0000000..0af41ef
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/partial-2_b.C
@@ -0,0 +1,21 @@
+// PR c++/106826
+// { dg-additional-options -fmodules-ts }
+module pr106826;
+
+static_assert(is_reference_v<int&>);
+static_assert(is_reference_v<int&&>);
+static_assert(!is_reference_v<int>);
+
+static_assert(A::is_reference_v<long&>);
+static_assert(A::is_reference_v<long&&>);
+static_assert(!A::is_reference_v<long>);
+
+#if __cpp_concepts
+static_assert(concepts::is_reference_v<char&>);
+static_assert(concepts::is_reference_v<char&&>);
+static_assert(!concepts::is_reference_v<char>);
+
+static_assert(concepts::A::is_reference_v<bool&>);
+static_assert(concepts::A::is_reference_v<bool&&>);
+static_assert(!concepts::A::is_reference_v<bool>);
+#endif
diff --git a/gcc/testsuite/g++.dg/modules/pr106761.h b/gcc/testsuite/g++.dg/modules/pr106761.h
new file mode 100644
index 0000000..9f22a22
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr106761.h
@@ -0,0 +1,22 @@
+// PR c++/106761
+
+template<class...>
+struct __and_;
+
+template<class, class>
+struct is_convertible;
+
+template<class... Ts>
+struct _TupleConstraints {
+ template<class... Us>
+ using __constructible = __and_<is_convertible<Ts, Us>...>;
+};
+
+template<class... Ts>
+struct tuple {
+ template<class... Us>
+ using __constructible
+ = typename _TupleConstraints<Ts...>::template __constructible<Us...>;
+};
+
+tuple<int, int> t;
diff --git a/gcc/testsuite/g++.dg/modules/pr106761_a.H b/gcc/testsuite/g++.dg/modules/pr106761_a.H
new file mode 100644
index 0000000..8ad1164
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr106761_a.H
@@ -0,0 +1,5 @@
+// PR c++/106761
+// { dg-additional-options -fmodule-header }
+
+// { dg-module-cmi {} }
+#include "pr106761.h"
diff --git a/gcc/testsuite/g++.dg/modules/pr106761_b.C b/gcc/testsuite/g++.dg/modules/pr106761_b.C
new file mode 100644
index 0000000..418991b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr106761_b.C
@@ -0,0 +1,7 @@
+// PR c++/106761
+// { dg-additional-options -fmodules-ts }
+
+#include "pr106761.h"
+import "pr106761_a.H";
+
+tuple<int, int> u = t;
diff --git a/gcc/testsuite/g++.dg/modules/typename-friend_a.C b/gcc/testsuite/g++.dg/modules/typename-friend_a.C
new file mode 100644
index 0000000..aa426fe
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/typename-friend_a.C
@@ -0,0 +1,11 @@
+// { dg-additional-options "-fmodules-ts" }
+export module foo;
+// { dg-module-cmi foo }
+
+template<class T>
+struct A {
+ friend typename T::type;
+ friend void f(A) { }
+private:
+ static constexpr int value = 42;
+};
diff --git a/gcc/testsuite/g++.dg/modules/typename-friend_b.C b/gcc/testsuite/g++.dg/modules/typename-friend_b.C
new file mode 100644
index 0000000..97da9d8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/typename-friend_b.C
@@ -0,0 +1,6 @@
+// { dg-additional-options "-fmodules-ts" }
+module foo;
+
+struct C;
+struct B { using type = C; };
+struct C { static_assert(A<B>::value == 42); };
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-2.h b/gcc/testsuite/g++.dg/modules/xtreme-header-2.h
index ded093e..dfe94aa 100644
--- a/gcc/testsuite/g++.dg/modules/xtreme-header-2.h
+++ b/gcc/testsuite/g++.dg/modules/xtreme-header-2.h
@@ -1,8 +1,7 @@
// Everything that transitively includes <ranges>
#include <algorithm>
-// FIXME: PR 97549
-// #include <execution>
+#include <execution>
#include <functional>
#include <future>
#include <memory>
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-6.h b/gcc/testsuite/g++.dg/modules/xtreme-header-6.h
index 85894b2..8d024b6 100644
--- a/gcc/testsuite/g++.dg/modules/xtreme-header-6.h
+++ b/gcc/testsuite/g++.dg/modules/xtreme-header-6.h
@@ -1,22 +1,22 @@
// C++20 headers
#if __cplusplus > 201703
#include <version>
+#include <barrier>
#include <bit>
#include <compare>
#include <concepts>
#if __cpp_coroutines
#include <coroutine>
#endif
+#include <latch>
#include <numbers>
+#include <semaphore>
+#include <source_location>
#include <span>
#include <stop_token>
+#include <syncstream>
#if 0
// Unimplemented
-#include <barrier>
#include <format>
-#include <latch>
-#include <semaphore>
-#include <source_location>
-#include <syncstream>
#endif
#endif
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header.h b/gcc/testsuite/g++.dg/modules/xtreme-header.h
index 41302c7..3147aaf 100644
--- a/gcc/testsuite/g++.dg/modules/xtreme-header.h
+++ b/gcc/testsuite/g++.dg/modules/xtreme-header.h
@@ -1,17 +1,8 @@
// All the headers!
-#if __cplusplus > 201703L
-// FIXME: if we include everything, something goes wrong with location
-// information. We used to not handle lambdas attached to global
-// vars, and this is a convienient flag to stop including everything.
-#define NO_ASSOCIATED_LAMBDA 1
-#endif
-
// C++ 17 and below
#if 1
-#if !NO_ASSOCIATED_LAMBDA
#include <algorithm>
-#endif
#include <any>
#include <array>
#include <atomic>
@@ -26,19 +17,12 @@
#include <cwctype>
#include <deque>
#include <exception>
-#if !NO_ASSOCIATED_LAMBDA
-// FIXME: PR 97549
-//#include <execution>
-#endif
+#include <execution>
#include <filesystem>
#include <forward_list>
#include <fstream>
-#if !NO_ASSOCIATED_LAMBDA
#include <functional>
-#endif
-#if !NO_ASSOCIATED_LAMBDA
#include <future>
-#endif
#include <initializer_list>
#include <iomanip>
#include <ios>
@@ -49,12 +33,8 @@
#include <list>
#include <locale>
#include <map>
-#if !NO_ASSOCIATED_LAMBDA
#include <memory>
-#endif
-#if !NO_ASSOCIATED_LAMBDA
#include <memory_resource>
-#endif
#include <mutex>
#include <new>
#include <numeric>
@@ -63,12 +43,8 @@
#include <queue>
#include <random>
#include <ratio>
-#if !NO_ASSOCIATED_LAMBDA
#include <regex>
-#endif
-#if !NO_ASSOCIATED_LAMBDA
#include <scoped_allocator>
-#endif
#include <set>
#include <shared_mutex>
#include <sstream>
@@ -78,9 +54,7 @@
#include <string>
#include <string_view>
#include <system_error>
-#if !NO_ASSOCIATED_LAMBDA
#include <thread>
-#endif
#include <tuple>
#include <type_traits>
#include <typeindex>
@@ -88,9 +62,7 @@
#include <unordered_map>
#include <unordered_set>
#include <utility>
-#if !NO_ASSOCIATED_LAMBDA
#include <valarray>
-#endif
#include <variant>
#include <vector>
#endif
@@ -119,26 +91,39 @@
#if __cplusplus > 201703
#if 1
#include <version>
+#include <barrier>
#include <bit>
#include <compare>
#include <concepts>
#if __cpp_coroutines
#include <coroutine>
#endif
-#if !NO_ASSOCIATED_LAMBDA
-#include <ranges>
-#endif
+#include <latch>
#include <numbers>
+#include <ranges>
+#include <semaphore>
+#include <source_location>
#include <span>
#include <stop_token>
+#include <syncstream>
#if 0
// Unimplemented
-#include <barrier>
#include <format>
-#include <latch>
-#include <semaphore>
-#include <source_location>
-#include <syncstream>
#endif
#endif
#endif
+
+// C++23
+#if __cplusplus > 202002L
+#include <expected>
+#include <spanstream>
+#include <stacktrace>
+#if 0
+// Unimplemented
+#include <flat_map>
+#include <flat_set>
+#include <generator>
+#include <mdspan>
+#include <print>
+#endif
+#endif
diff --git a/gcc/testsuite/g++.dg/no-stack-protector-attr-3.C b/gcc/testsuite/g++.dg/no-stack-protector-attr-3.C
index 76a5ec0..147c2b7 100644
--- a/gcc/testsuite/g++.dg/no-stack-protector-attr-3.C
+++ b/gcc/testsuite/g++.dg/no-stack-protector-attr-3.C
@@ -3,6 +3,7 @@
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -fstack-protector-explicit" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* { dg-do compile { target { ! hppa*-*-* } } } */
diff --git a/gcc/testsuite/g++.dg/opt/pr106860.C b/gcc/testsuite/g++.dg/opt/pr106860.C
new file mode 100644
index 0000000..a0209dc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr106860.C
@@ -0,0 +1,23 @@
+// { dg-do compile }
+// { dg-options "-Ofast -ftrapv -fnon-call-exceptions -fno-tree-fre" }
+
+static const int N = 12;
+int nSlip;
+
+int main ()
+{
+ int i, j, k, fdot = 0;
+ int a[N][N];
+
+ for ( i = 1; i < nSlip; i++)
+ {
+ for ( j = i+1; j < nSlip; j++)
+ {
+ for ( k = 0; k < i; k++)
+ fdot += a[i][k] * a[k][j];
+ a[i][j] = a[i][j] - fdot;
+ }
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/other/PR23205.C b/gcc/testsuite/g++.dg/other/PR23205.C
deleted file mode 100644
index 65ba1f6..0000000
--- a/gcc/testsuite/g++.dg/other/PR23205.C
+++ /dev/null
@@ -1,17 +0,0 @@
-/* { dg-do compile { target stabs } } */
-/* { dg-options "-gstabs+ -fno-eliminate-unused-debug-types" } */
-
-const int foobar = 4;
-int foo ()
-{
- return foobar + 1;
-}
-
-int main()
-{
- int i;
- i = foo();
- return i;
-}
-
-/* { dg-final { scan-assembler ".stabs.*foobar:(c=i|S)" } } */
diff --git a/gcc/testsuite/g++.dg/other/pr23205-2.C b/gcc/testsuite/g++.dg/other/pr23205-2.C
deleted file mode 100644
index 7b25c07..0000000
--- a/gcc/testsuite/g++.dg/other/pr23205-2.C
+++ /dev/null
@@ -1,17 +0,0 @@
-/* { dg-do compile { target stabs } } */
-/* { dg-options "-gstabs+ -fno-eliminate-unused-debug-types -ftoplevel-reorder" } */
-
-const int foobar = 4;
-int foo ()
-{
- return foobar + 1;
-}
-
-int main()
-{
- int i;
- i = foo();
- return i;
-}
-
-/* { dg-final { scan-assembler ".stabs.*foobar:c=i" } } */
diff --git a/gcc/testsuite/g++.dg/parse/expr3.C b/gcc/testsuite/g++.dg/parse/expr3.C
index 95d332f..1e16673 100644
--- a/gcc/testsuite/g++.dg/parse/expr3.C
+++ b/gcc/testsuite/g++.dg/parse/expr3.C
@@ -23,7 +23,7 @@
test (||, &&, 1, 1, 0, 0)
test (&&, |, 5, 1, 1, 19)
-test (|, ^, 1, 2, 2, 1)
+test (|, ^, 1, 2, 0x2, 1)
test (^, &, 1, 3, 2, 6)
test (&, ==, 1, 3, 2, 0)
test (==, <, 2, 0, 0, 0)
diff --git a/gcc/testsuite/g++.dg/pr104992-1.C b/gcc/testsuite/g++.dg/pr104992-1.C
new file mode 100644
index 0000000..02b2882
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr104992-1.C
@@ -0,0 +1,30 @@
+/* PR tree-optimization/104992 */
+/* { dg-do run } */
+/* { dg-options "-O2 -Wno-psabi" } */
+
+#include "../gcc.dg/pr104992.c"
+
+int main () {
+
+ /* Should be true. */
+ if (!foo(6, 3)
+ || !bar(12, 2)
+ || !baz(34, 17)
+ || !qux(50, 10)
+ || !fred(16, 8)
+ || !baz(-9, 3)
+ || !baz(9, -3)
+ || !baz(-9, -3)
+ ) {
+ __builtin_abort();
+ }
+
+ /* Should be false. */
+ if (foo(5, 30)
+ || bar(72, 27)
+ || baz(42, 15)) {
+ __builtin_abort();
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/pr106474.C b/gcc/testsuite/g++.dg/pr106474.C
new file mode 100644
index 0000000..6cd37a2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr106474.C
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-evrp " } */
+
+void foo();
+static void __attribute__ ((noinline)) DCEMarker0_() {foo ();}
+
+void f(bool s, bool c) {
+ if ((!c == !s) && !c) {
+ if (s) {
+ DCEMarker0_();
+ }
+ }
+}
+
+// With equivalences, vrp should be able to remove all IFs.
+/* { dg-final { scan-tree-dump-not "goto" "evrp" } } */
diff --git a/gcc/testsuite/g++.dg/pr106687.C b/gcc/testsuite/g++.dg/pr106687.C
new file mode 100644
index 0000000..75ac81c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr106687.C
@@ -0,0 +1,22 @@
+// { dg-do run }
+// { dg-options "-O2" }
+
+bool var_0 = (bool)0;
+unsigned int var_7 = 42;
+char var_215;
+
+int main() {
+ unsigned b = var_0;
+ unsigned p2 = var_7;
+ unsigned *tp;
+ if (b < p2)
+ tp = &p2;
+ else
+ tp = &b;
+ unsigned tt = *tp;
+ unsigned t = tt ^ (var_7 - var_0);
+ var_215 = t ? t : 42;
+ if (var_215 != 42)
+ __builtin_abort();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/pr106824.C b/gcc/testsuite/g++.dg/pr106824.C
new file mode 100644
index 0000000..bd80be0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr106824.C
@@ -0,0 +1,76 @@
+// { dg-do compile }
+// { dg-options "-O2 -w -std=c++11" }
+
+using int32 = int;
+int ShortestPath_distance;
+struct FloatWeightTpl {
+ FloatWeightTpl(float f) : value_(f) {}
+ float Value() { return value_; }
+ float value_;
+};
+template <class T> bool operator!=(FloatWeightTpl w1, T w2) {
+ bool __trans_tmp_2;
+ FloatWeightTpl __trans_tmp_3 = w1;
+ __trans_tmp_2 = __trans_tmp_3.Value() == w2.Value();
+ return __trans_tmp_2;
+}
+struct TropicalWeightTpl : FloatWeightTpl {
+ TropicalWeightTpl(float f) : FloatWeightTpl(f) {}
+ static TropicalWeightTpl Zero();
+ static TropicalWeightTpl NoWeight() {
+ float __trans_tmp_5 = __builtin_nanf("");
+ return __trans_tmp_5;
+ }
+ bool Member() { return value_; }
+};
+TropicalWeightTpl Plus(TropicalWeightTpl w1, TropicalWeightTpl &w2) {
+ return w1.Member() || w2.Member() ? TropicalWeightTpl::NoWeight() : w2.Value() ? : w2;
+}
+TropicalWeightTpl Times();
+struct ArcTpl {
+ using Weight = TropicalWeightTpl;
+};
+template <class, class, class> struct ShortestPathOptions {
+ ShortestPathOptions(int, int, int32, bool, bool);
+};
+template <class Arc, class Queue, class ArcFilter>
+void SingleShortestPath(ShortestPathOptions<Arc, Queue, ArcFilter>) {
+ using Weight = typename Arc::Weight;
+ auto f_distance = Weight::Zero();
+ while (!0) {
+ TropicalWeightTpl __trans_tmp_1 = Times(),
+ plus = Plus(f_distance, __trans_tmp_1);
+ if (f_distance != plus)
+ f_distance = plus;
+ }
+}
+template <class Arc, class Queue, class ArcFilter>
+void ShortestPath(int, int *, int *,
+ ShortestPathOptions<Arc, Queue, ArcFilter> opts) {
+ SingleShortestPath(opts);
+}
+struct ShortestDistanceOptions {
+ float delta;
+};
+struct Trans_NS_script_ShortestPathOptions : ShortestDistanceOptions {
+ int32 nshortest;
+ bool unique;
+};
+namespace internal {
+template <class, class>
+void ShortestPath(int ifst, int *ofst, int *distance,
+ Trans_NS_script_ShortestPathOptions opts) {
+ using ArcFilter = int;
+ ShortestPathOptions<ArcTpl, int, ArcFilter> sopts(opts.nshortest, opts.unique,
+ false, opts.delta, 0);
+ ShortestPath(ifst, ofst, distance, sopts);
+}
+int ShortestPath_ifst;
+int ShortestPath_ofst;
+Trans_NS_script_ShortestPathOptions ShortestPath_opts;
+void ShortestPath() {
+ using StateId = int;
+ ShortestPath<ArcTpl, StateId>(ShortestPath_ifst, &ShortestPath_ofst,
+ &ShortestPath_distance, ShortestPath_opts);
+}
+} // namespace internal
diff --git a/gcc/testsuite/g++.dg/pr71694.C b/gcc/testsuite/g++.dg/pr71694.C
index 5b59f87..60f246f 100644
--- a/gcc/testsuite/g++.dg/pr71694.C
+++ b/gcc/testsuite/g++.dg/pr71694.C
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fno-store-merging" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* { dg-additional-options "-fno-common -mdynamic-no-pic" { target { ia32 && { x86_64-*-darwin* i?86-*-darwin* } } } } */
struct B {
diff --git a/gcc/testsuite/g++.dg/stackprotectexplicit2.C b/gcc/testsuite/g++.dg/stackprotectexplicit2.C
index 35d9e88..70d8df4 100644
--- a/gcc/testsuite/g++.dg/stackprotectexplicit2.C
+++ b/gcc/testsuite/g++.dg/stackprotectexplicit2.C
@@ -2,6 +2,7 @@
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -fstack-protector-explicit" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
int A()
{
diff --git a/gcc/testsuite/g++.dg/template/evaluated1.C b/gcc/testsuite/g++.dg/template/evaluated1.C
new file mode 100644
index 0000000..41845c6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/evaluated1.C
@@ -0,0 +1,17 @@
+// PR c++/101906
+// Verify the template arguments of an alias template-id are evaluated even
+// in an unevaluated context.
+// { dg-do compile { target c++11 } }
+
+template<int, class T> using skip = T;
+
+template<class T>
+constexpr unsigned sizeof_() {
+ return sizeof(skip<(T(), 0), T>);
+}
+
+struct A {
+ int m = -1;
+};
+
+static_assert(sizeof_<A>() == sizeof(A), "");
diff --git a/gcc/testsuite/g++.dg/template/evaluated1a.C b/gcc/testsuite/g++.dg/template/evaluated1a.C
new file mode 100644
index 0000000..7828687
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/evaluated1a.C
@@ -0,0 +1,16 @@
+// PR c++/101906
+// Like unevaluated1.C, but where the unevaluated context is a
+// constraint instead of sizeof.
+// { dg-do compile { target c++20 } }
+
+template<int> using voidify = void;
+
+template<class T>
+concept constant_value_initializable
+ = requires { typename voidify<(T(), 0)>; };
+
+struct A {
+ int m = -1;
+};
+
+static_assert(constant_value_initializable<A>);
diff --git a/gcc/testsuite/g++.dg/template/evaluated1b.C b/gcc/testsuite/g++.dg/template/evaluated1b.C
new file mode 100644
index 0000000..7994065
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/evaluated1b.C
@@ -0,0 +1,17 @@
+// PR c++/101906
+// Like unevaluated1.C, but using a function template instead of an
+// alias template.
+// { dg-do compile { target c++14 } }
+
+template<int, class T> T skip();
+
+template<class T>
+constexpr unsigned sizeof_() {
+ return sizeof(skip<(T(), 0), T>());
+}
+
+struct A {
+ int m = -1;
+};
+
+static_assert(sizeof_<A>() == sizeof(A), "");
diff --git a/gcc/testsuite/g++.dg/template/evaluated1c.C b/gcc/testsuite/g++.dg/template/evaluated1c.C
new file mode 100644
index 0000000..15c5582
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/evaluated1c.C
@@ -0,0 +1,17 @@
+// PR c++/101906
+// Like unevaluated1b.C, but using a variable template instead of a
+// function template.
+// { dg-do compile { target c++14 } }
+
+template<int, class T> T skip;
+
+template<class T>
+constexpr unsigned sizeof_() {
+ return sizeof(skip<(T(), 0), T>);
+}
+
+struct A {
+ int m = -1;
+};
+
+static_assert(sizeof_<A>() == sizeof(A), "");
diff --git a/gcc/testsuite/g++.dg/torture/phi-1.C b/gcc/testsuite/g++.dg/torture/phi-1.C
new file mode 100644
index 0000000..69fb3d7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/phi-1.C
@@ -0,0 +1,28 @@
+// { dg-do compile { target c++11 } }
+// { dg-options "--param early-inlining-insns=14" }
+
+struct Element;
+template <int _Nm> struct __array_traits { typedef Element _Type[_Nm]; };
+template <int _Nm> struct array {
+ typename __array_traits<_Nm>::_Type _M_elems;
+};
+bool logLevel();
+struct LogCapture {
+ void stream();
+};
+struct Element {
+ Element();
+ long data_;
+};
+using ElementArray = array<6>;
+struct ElementManager {
+ ElementManager();
+ ElementArray array_;
+};
+static ElementArray makeArray() {
+ if (logLevel())
+ LogCapture().stream();
+ ElementArray foo;
+ return foo;
+}
+ElementManager::ElementManager() : array_(makeArray()) {}
diff --git a/gcc/testsuite/g++.dg/torture/pr90994.C b/gcc/testsuite/g++.dg/torture/pr90994.C
new file mode 100644
index 0000000..8feb36f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr90994.C
@@ -0,0 +1,40 @@
+// { dg-do compile }
+// { dg-additional-options "-fnon-call-exceptions -Wuninitialized" }
+
+extern void printval(unsigned char v);
+
+inline int readbyte(unsigned char *__restrict presult,
+ unsigned char volatile *ptr)
+{
+ unsigned char v;
+ try {
+ v = *ptr;
+ } catch (...) {
+ return -1;
+ }
+ *presult = v;
+ return 0;
+}
+
+int incorrectWarning(unsigned char volatile *ptr)
+{
+ int error;
+ unsigned char first;
+ unsigned char second;
+
+ error = readbyte(&first, ptr);
+ asm("\n\n\n\n\n" : : "X" (error != 0));
+ if (error != 0)
+ goto err;
+
+ error = readbyte(&second, ptr);
+ if (error != 0)
+ goto err;
+
+ printval(first); // { dg-bogus "uninitialized" }
+ printval(second);
+ return 0;
+
+err:
+ return error;
+}
diff --git a/gcc/testsuite/g++.dg/tree-ssa/empty-loop.C b/gcc/testsuite/g++.dg/tree-ssa/empty-loop.C
index 6b1e879..dca7868 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/empty-loop.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/empty-loop.C
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-cddce2 -ffinite-loops" } */
+/* { dg-options "-O2 -fdump-tree-cddce2 -ffinite-loops -Wno-unused-result" } */
#include <string>
#include <vector>
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr101839.C b/gcc/testsuite/g++.dg/tree-ssa/pr101839.C
new file mode 100644
index 0000000..bb7b61c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr101839.C
@@ -0,0 +1,53 @@
+// { dg-do run }
+// { dg-options "-O2 -fdump-tree-optimized" }
+// { dg-require-effective-target c++11 }
+
+#include <string.h>
+#include <iostream>
+#include <map>
+namespace {
+ struct Buf {
+ char * buf; int a{0}; int b{0};
+ Buf(char * b) : buf(b) { }
+ void add(int v) {
+ ::memcpy(buf, &v, sizeof(v));
+ a += sizeof(v);
+ b += sizeof(v);
+ }
+ };
+ struct A {
+ virtual void fill(Buf &buf) {
+ buf.add(type());
+ buf.add(type());
+ }
+ virtual ~A() {}
+ virtual int type() = 0;
+ };
+ struct BA : A {
+ void fill(Buf &buf) {
+ A::fill(buf);
+ buf.add(type());
+ buf.add(type());
+ }
+ int type() final {
+ return 1;
+ }
+ };
+ struct CBA final : BA {
+ };
+ struct CA final : A {
+ ::std::map<int, int> m;
+ int type() final {
+ return 2;
+ }
+ };
+}
+int main(int argc, char ** ) {
+ char d[1024];
+ CBA cba;
+ Buf buf(d);
+ cba.fill(buf);
+ CA ca;
+ return 0;
+}
+// { dg-final { scan-tree-dump-not "__builtin_unreachable" "optimized" } }
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr106922.C b/gcc/testsuite/g++.dg/tree-ssa/pr106922.C
new file mode 100644
index 0000000..14fa061
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr106922.C
@@ -0,0 +1,90 @@
+// { dg-require-effective-target c++20 }
+// { dg-options "-O2 -fdump-tree-pre-details -fdump-tree-cddce3" }
+
+template <typename> struct __new_allocator {
+ void deallocate(int *, int) { operator delete(0); }
+};
+template <typename _Tp> using __allocator_base = __new_allocator<_Tp>;
+template <typename> struct allocator : __allocator_base<int> {
+ [[__gnu__::__always_inline__]] void deallocate(int *__p, int __n) {
+ __allocator_base<int>::deallocate(__p, __n);
+ }
+};
+template <typename> struct allocator_traits;
+template <typename _Tp> struct allocator_traits<allocator<_Tp>> {
+ using allocator_type = allocator<_Tp>;
+ using pointer = _Tp *;
+ using size_type = int;
+ template <typename _Up> using rebind_alloc = allocator<_Up>;
+ static void deallocate(allocator_type &__a, pointer __p, size_type __n) {
+ __a.deallocate(__p, __n);
+ }
+};
+template <typename _Alloc> struct __alloc_traits : allocator_traits<_Alloc> {
+ typedef allocator_traits<_Alloc> _Base_type;
+ template <typename _Tp> struct rebind {
+ typedef _Base_type::template rebind_alloc<_Tp> other;
+ };
+};
+long _M_deallocate___n;
+struct _Vector_base {
+ typedef __alloc_traits<allocator<int>>::rebind<int>::other _Tp_alloc_type;
+ typedef __alloc_traits<_Tp_alloc_type>::pointer pointer;
+ struct _Vector_impl_data {
+ pointer _M_start;
+ };
+ struct _Vector_impl : _Tp_alloc_type, _Vector_impl_data {};
+ ~_Vector_base() { _M_deallocate(_M_impl._M_start); }
+ _Vector_impl _M_impl;
+ void _M_deallocate(pointer __p) {
+ if (__p)
+ __alloc_traits<_Tp_alloc_type>::deallocate(_M_impl, __p,
+ _M_deallocate___n);
+ }
+};
+struct vector : _Vector_base {};
+struct aligned_storage {
+ int dummy_;
+ int *ptr_ref0;
+ vector &ref() {
+ vector *__trans_tmp_2;
+ void *__trans_tmp_1 = &dummy_;
+ union {
+ void *ap_pvoid;
+ vector *as_ptype;
+ } caster{__trans_tmp_1};
+ __trans_tmp_2 = caster.as_ptype;
+ return *__trans_tmp_2;
+ }
+};
+struct optional_base {
+ optional_base operator=(optional_base &) {
+ bool __trans_tmp_3 = m_initialized;
+ if (__trans_tmp_3)
+ m_initialized = false;
+ return *this;
+ }
+ ~optional_base() {
+ if (m_initialized)
+ m_storage.ref().~vector();
+ }
+ bool m_initialized;
+ aligned_storage m_storage;
+};
+struct optional : optional_base {
+ optional() : optional_base() {}
+};
+template <class> using Optional = optional;
+struct Trans_NS___cxx11_basic_stringstream {};
+void operator<<(Trans_NS___cxx11_basic_stringstream, int);
+int testfunctionfoo_myStructs[10];
+void testfunctionfoo() {
+ Optional<char> external, internal;
+ for (auto myStruct : testfunctionfoo_myStructs) {
+ Trans_NS___cxx11_basic_stringstream address_stream;
+ address_stream << myStruct;
+ external = internal;
+ }
+}
+
+// { dg-final { scan-tree-dump-not "m_initialized" "dce3" } }
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr106936.C b/gcc/testsuite/g++.dg/tree-ssa/pr106936.C
new file mode 100644
index 0000000..c3096e0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr106936.C
@@ -0,0 +1,14 @@
+// { dg-do compile } */
+// { dg-options "-O2 -fno-tree-ccp -fno-tree-forwprop -fno-tree-fre" }
+
+namespace testPointerToMemberMiscCasts2 {
+struct B {
+ int f;
+};
+struct L : public B { };
+struct R : public B { };
+struct D : public L, R { };
+ int B::* pb = &B::f;
+ int R::* pr = pb;
+ int D::* pdr = pr;
+}
diff --git a/gcc/testsuite/g++.dg/uninit-pr105937.C b/gcc/testsuite/g++.dg/uninit-pr105937.C
new file mode 100644
index 0000000..26b4f74
--- /dev/null
+++ b/gcc/testsuite/g++.dg/uninit-pr105937.C
@@ -0,0 +1,235 @@
+// { dg-do compile }
+// { dg-require-effective-target c++17 }
+// { dg-options "-O2 -Wall" }
+
+#include <stdint.h>
+#include <optional>
+#include <string_view>
+
+using utf8 = char;
+
+enum
+{
+ FONT_SIZE_TINY = 2,
+ FONT_SIZE_SMALL = 0,
+ FONT_SIZE_MEDIUM = 1,
+ FONT_SIZE_COUNT = 3
+};
+
+constexpr const uint16_t FONT_SPRITE_GLYPH_COUNT = 224;
+
+enum class FontSpriteBase : int16_t
+{
+ MEDIUM_EXTRA_DARK = -2,
+ MEDIUM_DARK = -1,
+
+ TINY = FONT_SIZE_TINY * FONT_SPRITE_GLYPH_COUNT,
+ SMALL = FONT_SIZE_SMALL * FONT_SPRITE_GLYPH_COUNT,
+ MEDIUM = FONT_SIZE_MEDIUM * FONT_SPRITE_GLYPH_COUNT,
+};
+
+struct TTFSurface;
+
+class CodepointView
+{
+private:
+ std::string_view _str;
+
+public:
+ class iterator
+ {
+ private:
+ std::string_view _str;
+ size_t _index;
+
+ public:
+ iterator(std::string_view str, size_t index)
+ : _str(str)
+ , _index(index)
+ {
+ }
+
+ bool operator==(const iterator& rhs) const
+ {
+ return _index == rhs._index;
+ }
+ bool operator!=(const iterator& rhs) const
+ {
+ return _index != rhs._index;
+ }
+ char32_t operator*() const
+ {
+ return GetNextCodepoint(&_str[_index], nullptr);
+ }
+ iterator& operator++()
+ {
+ return *this;
+ }
+ iterator operator++(int)
+ {
+ auto result = *this;
+ if (_index < _str.size())
+ {
+ const utf8* nextch;
+ GetNextCodepoint(&_str[_index], &nextch);
+ _index = nextch - _str.data();
+ }
+ return result;
+ }
+
+ size_t GetIndex() const
+ {
+ return _index;
+ }
+
+ static char32_t GetNextCodepoint(const char* ch, const char** next);
+ };
+
+ CodepointView(std::string_view str)
+ : _str(str)
+ {
+ }
+
+ iterator begin() const
+ {
+ return iterator(_str, 0);
+ }
+
+ iterator end() const
+ {
+ return iterator(_str, _str.size());
+ }
+};
+
+struct InternalTTFFont;
+using TTF_Font = InternalTTFFont;
+struct TTFFontDescriptor
+{
+ const utf8* filename;
+ const utf8* font_name;
+ int32_t ptSize;
+ int32_t offset_x;
+ int32_t offset_y;
+ int32_t line_height;
+ int32_t hinting_threshold;
+ TTF_Font* font;
+};
+using codepoint_t = uint32_t;
+
+#define abstract = 0
+
+struct ITTF
+{
+ virtual ~ITTF() = default;
+ virtual TTFFontDescriptor* ttf_get_font_from_sprite_base(FontSpriteBase spriteBase) abstract;
+ virtual TTFSurface* ttf_surface_cache_get_or_add(TTF_Font* font, std::string_view text) abstract;
+};
+
+namespace OpenRCT2 {
+ struct IContext
+ {
+ virtual ~IContext() = default;
+
+ virtual ITTF* GetTTF() abstract;
+ };
+}
+
+static void ttf_draw_string_raw_ttf(OpenRCT2::IContext* context, std::string_view text)
+{
+ TTFFontDescriptor* fontDesc = context->GetTTF()->ttf_get_font_from_sprite_base(FontSpriteBase::MEDIUM_EXTRA_DARK);
+ if (fontDesc->font == nullptr)
+ {
+ return;
+ }
+
+ TTFSurface* surface = context->GetTTF()->ttf_surface_cache_get_or_add(fontDesc->font, text);
+ if (surface == nullptr)
+ return;
+}
+
+namespace UnicodeChar
+{
+ // Punctuation
+ constexpr char32_t leftguillemet = 0xAB;
+ constexpr char32_t rightguillemet = 0xBB;
+ constexpr char32_t german_quote_open = 0x201E;
+ constexpr char32_t quote_open = 0x201C;
+ constexpr char32_t quote_close = 0x201D;
+
+ // Dingbats
+ constexpr char32_t up = 0x25B2;
+ constexpr char32_t small_up = 0x25B4;
+ constexpr char32_t right = 0x25B6;
+ constexpr char32_t down = 0x25BC;
+ constexpr char32_t small_down = 0x25BE;
+ constexpr char32_t left = 0x25C0;
+ constexpr char32_t tick = 0x2713;
+ constexpr char32_t plus = 0x2795;
+ constexpr char32_t minus = 0x2796;
+
+ // Emoji
+ constexpr char32_t cross = 0x274C;
+ constexpr char32_t variation_selector = 0xFE0F;
+ constexpr char32_t eye = 0x1F441;
+ constexpr char32_t road = 0x1F6E3;
+ constexpr char32_t railway = 0x1F6E4;
+}; // namespace UnicodeChar
+
+
+static bool ShouldUseSpriteForCodepoint(char32_t codepoint)
+{
+ switch (codepoint)
+ {
+ case UnicodeChar::up:
+ case UnicodeChar::down:
+ case UnicodeChar::leftguillemet:
+ case UnicodeChar::tick:
+ case UnicodeChar::cross:
+ case UnicodeChar::right:
+ case UnicodeChar::rightguillemet:
+ case UnicodeChar::small_up:
+ case UnicodeChar::small_down:
+ case UnicodeChar::left:
+ case UnicodeChar::quote_open:
+ case UnicodeChar::quote_close:
+ case UnicodeChar::german_quote_open:
+ case UnicodeChar::plus:
+ case UnicodeChar::minus:
+ case UnicodeChar::variation_selector:
+ case UnicodeChar::eye:
+ case UnicodeChar::road:
+ case UnicodeChar::railway:
+ return true;
+ default:
+ return false;
+ }
+}
+
+void ttf_process_string_literal(OpenRCT2::IContext* context, std::string_view text)
+{
+ CodepointView codepoints(text);
+ std::optional<size_t> ttfRunIndex;
+ for (auto it = codepoints.begin(); it != codepoints.end(); it++)
+ {
+ auto codepoint = *it;
+ if (ShouldUseSpriteForCodepoint(codepoint))
+ {
+ if (ttfRunIndex.has_value())
+ {
+ // Draw the TTF run
+ auto len = it.GetIndex() - ttfRunIndex.value(); // { dg-bogus "may be used uninitialized" }
+ ttf_draw_string_raw_ttf(context, text.substr(ttfRunIndex.value(), len));
+ ttfRunIndex = std::nullopt;
+ }
+
+ // Draw the sprite font glyph
+ }
+ else
+ {
+ if (!ttfRunIndex.has_value())
+ {
+ ttfRunIndex = it.GetIndex();
+ }
+ }
+ }
+}
diff --git a/gcc/testsuite/g++.dg/uninit-pr106722-1.C b/gcc/testsuite/g++.dg/uninit-pr106722-1.C
new file mode 100644
index 0000000..a10f8dd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/uninit-pr106722-1.C
@@ -0,0 +1,65 @@
+// { dg-do compile }
+// { dg-require-effective-target c++11 }
+// { dg-options "-O2 -Wmaybe-uninitialized --param logical-op-non-short-circuit=0" }
+long pow2p_hwi_x;
+bool exact_log2___trans_tmp_5, exact_log2___trans_tmp_4;
+int exact_log2(long x) {
+ exact_log2___trans_tmp_5 = pow2p_hwi_x && exact_log2___trans_tmp_4;
+ return exact_log2___trans_tmp_5 ? x : 1;
+}
+enum signop {};
+template <typename T1, typename T2> void rshift(T1, T2, signop);
+struct generic_wide_int {
+ template <typename T> generic_wide_int(T);
+};
+template <unsigned N, typename> struct poly_int_pod {
+ bool is_constant() const;
+ template <typename T> bool is_constant(T *) const;
+ int coeffs[N];
+};
+template <unsigned N, typename C>
+template <typename T>
+bool poly_int_pod<N, C>::is_constant(T *const_value) const {
+ if (is_constant()) {
+ *const_value = coeffs[0];
+ return true;
+ }
+ return false;
+}
+struct poly_int : poly_int_pod<1, int> {
+ template <typename C0> poly_int(C0);
+};
+enum tree_code_class {} tree_code_type;
+void tree_class_check_failed(int *, tree_code_class, char *, int, char *)
+ __attribute__((__noreturn__));
+int tree_class_check___t, tree_class_check___l,
+ vect_gen_vector_loop_niters_loop_vinfo;
+char tree_class_check___f, tree_class_check___g;
+tree_code_class tree_class_check___class;
+int *tree_class_check() {
+ if (tree_code_type)
+ tree_class_check_failed(&tree_class_check___t, tree_class_check___class,
+ &tree_class_check___f, tree_class_check___l,
+ &tree_class_check___g);
+ return &tree_class_check___t;
+}
+int *build_int_cst(int, long);
+bool is_gimple_val(int);
+void force_gimple_operand(int, int *, bool, int);
+void vect_gen_vector_loop_niters(bool niters_no_overflow) {
+ poly_int vf(vect_gen_vector_loop_niters_loop_vinfo);
+ int *log_vf = nullptr;
+ long const_vf;
+ if (vf.is_constant(&const_vf))
+ log_vf = build_int_cst(0, 0);
+ if (is_gimple_val(0)) {
+ int stmts;
+ force_gimple_operand(0, &stmts, true, 0);
+ if (stmts && log_vf)
+ if (niters_no_overflow) {
+ generic_wide_int __trans_tmp_1(tree_class_check());
+ int __trans_tmp_2 = exact_log2(const_vf); // { dg-bogus "uninitialized" }
+ rshift(__trans_tmp_1, __trans_tmp_2, (signop)0);
+ }
+ }
+}
diff --git a/gcc/testsuite/g++.dg/uninit-pred-5.C b/gcc/testsuite/g++.dg/uninit-pred-5.C
new file mode 100644
index 0000000..8dfd987
--- /dev/null
+++ b/gcc/testsuite/g++.dg/uninit-pred-5.C
@@ -0,0 +1,94 @@
+// { dg-do compile }
+// { dg-options "-O2 -Wuninitialized" }
+
+typedef int size_t;
+typedef struct {
+} max_align_t;
+typedef struct tree_node *tree;
+struct ht_identifier {
+ char str;
+ int len;
+};
+struct cpp_hashnode {
+ ht_identifier ident;
+};
+tree get_identifier_with_length(char *, size_t);
+struct cpp_reader *parse_in;
+typedef int edit_distance_t;
+edit_distance_t get_edit_distance(char *);
+template < typename > struct edit_distance_traits;
+edit_distance_t get_edit_distance_cutoff(size_t);
+template < typename GOAL_TYPE, typename CANDIDATE_TYPE > class best_match {
+public:
+ typedef CANDIDATE_TYPE candidate_t;
+ typedef edit_distance_traits< candidate_t > candidate_traits;
+ best_match(GOAL_TYPE)
+ : m_goal(), m_goal_len(), m_best_candidate(), m_best_distance() {}
+ void consider(candidate_t candidate) {
+ size_t candidate_len = candidate_traits::get_length(candidate);
+ char candidate_str;
+ edit_distance_t dist = get_edit_distance(&candidate_str);
+ bool is_better = false;
+ if (dist)
+ is_better = true;
+ if (is_better) {
+ m_best_candidate = candidate;
+ m_best_candidate_len = candidate_len;
+ }
+ }
+ void set_best_so_far(CANDIDATE_TYPE) {}
+ candidate_t get_best_meaningful_candidate() {
+ edit_distance_t __trans_tmp_1;
+ if (m_best_candidate) {
+ size_t candidate_len = m_best_candidate_len;
+ __trans_tmp_1 = get_edit_distance_cutoff(candidate_len); // { dg-warning "may be used uninitialized" }
+ }
+ edit_distance_t cutoff = __trans_tmp_1;
+ if (cutoff)
+ ;
+ return m_best_candidate;
+ }
+ char m_goal;
+ size_t m_goal_len;
+ candidate_t m_best_candidate;
+ edit_distance_t m_best_distance;
+ size_t m_best_candidate_len;
+};
+template <> struct edit_distance_traits< tree > {
+ static size_t get_length(tree);
+};
+class name_hint {};
+class best_macro_match : public best_match< tree, cpp_hashnode * > {
+public:
+ best_macro_match(cpp_reader *);
+};
+struct c_binding {
+ tree id;
+ c_binding *prev;
+};
+struct c_scope {
+ c_scope *outer;
+ c_binding bindings;
+} * current_scope;
+tree lookup_name_fuzzy_name;
+void lookup_name_fuzzy() {
+ bool consider_implementation_names = 0;
+ best_match< tree, tree > bm(lookup_name_fuzzy_name);
+ for (c_scope *scope = current_scope; current_scope;
+ scope = scope->outer)
+ for (c_binding *binding = &scope->bindings; binding;
+ binding = binding->prev)
+ if (!consider_implementation_names)
+ bm.consider(binding->id);
+ best_macro_match bmm(parse_in);
+ cpp_hashnode *best_macro = bmm.get_best_meaningful_candidate();
+ if (best_macro) {
+ char id = best_macro->ident.str;
+ tree macro_as_identifier =
+ get_identifier_with_length(&id, best_macro->ident.len);
+ bm.set_best_so_far(macro_as_identifier);
+ }
+ tree best = bm.get_best_meaningful_candidate();
+ if (best)
+ name_hint();
+}
diff --git a/gcc/testsuite/g++.dg/vect/pr106794.cc b/gcc/testsuite/g++.dg/vect/pr106794.cc
new file mode 100644
index 0000000..f056563
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr106794.cc
@@ -0,0 +1,40 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Ofast" } */
+/* { dg-additional-options "-march=bdver2" { target x86_64-*-* i?86-*-* } } */
+
+template <class T> struct Vector3 {
+ Vector3();
+ Vector3(T, T, T);
+ T length() const;
+ T x, y, z;
+};
+template <class T>
+Vector3<T>::Vector3(T _x, T _y, T _z) : x(_x), y(_y), z(_z) {}
+Vector3<float> cross(Vector3<float> a, Vector3<float> b) {
+ return Vector3<float>(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z,
+ a.x * b.y - a.y * b.x);
+}
+template <class T> T Vector3<T>::length() const { return z; }
+int generateNormals_i;
+float generateNormals_p2_0, generateNormals_p0_0;
+struct SphereMesh {
+ void generateNormals();
+ float vertices;
+};
+void SphereMesh::generateNormals() {
+ Vector3<float> *faceNormals = new Vector3<float>;
+ for (int j; j; j++) {
+ float *p0 = &vertices + 3, *p1 = &vertices + j * 3, *p2 = &vertices + 3,
+ *p3 = &vertices + generateNormals_i + j * 3;
+ Vector3<float> v0(p1[0] - generateNormals_p0_0, p1[1] - 1, p1[2] - 2),
+ v1(0, 1, 2);
+ if (v0.length())
+ v1 = Vector3<float>(p3[0] - generateNormals_p2_0, p3[1] - p2[1],
+ p3[2] - p2[2]);
+ else
+ v1 = Vector3<float>(generateNormals_p0_0 - p3[0], p0[1] - p3[1],
+ p0[2] - p3[2]);
+ Vector3<float> faceNormal = cross(v0, v1);
+ faceNormals[j] = faceNormal;
+ }
+}
diff --git a/gcc/testsuite/g++.dg/vect/pr106841.cc b/gcc/testsuite/g++.dg/vect/pr106841.cc
new file mode 100644
index 0000000..7458bc1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr106841.cc
@@ -0,0 +1,52 @@
+// { dg-do compile }
+// { dg-additional-options "-O3 -ffast-math" }
+// { dg-additional-options "-march=bdver2" { target x86_64-*-* } }
+
+struct R3 {
+ double z;
+ R3(R3 A, R3 B) : z(B.z - A.z) {}
+ double norme() { return z; }
+};
+struct TBoundaryEdge {
+ int *vertices[2];
+ int &operator[](int i) { return *vertices[i]; }
+};
+struct Mesh {
+ int vertices;
+ TBoundaryEdge *bedges;
+ int operator()(int &vv) { return &vv - &vertices; }
+ TBoundaryEdge be(int i) { return bedges[i]; }
+};
+template <typename Data> struct GenericElement {
+ typedef typename Data::V Vertex;
+ static const int nv = Data::NbOfVertices;
+ Vertex *vertices[nv];
+ double mes;
+ void set(int *iv, Vertex *v0) {
+ for (int i = 0; i < nv; ++i)
+ vertices[i] = v0 + iv[i];
+ mes = Data::mesure(vertices);
+ }
+};
+struct DataSeg3 {
+ static const int NbOfVertices = 2;
+ typedef R3 V;
+ static double mesure(V *pv[]) { return R3(*pv[0], *pv[1]).norme(); }
+};
+struct MeshS {
+ MeshS();
+};
+template <class> struct Movemesh_Op { void foo(Mesh, DataSeg3::V *) const; };
+template <> void Movemesh_Op<int>::foo(Mesh pTh, DataSeg3::V *v0) const {
+ GenericElement<DataSeg3> *bS = new GenericElement<DataSeg3>[8];
+ for (int ibe = 0; ibe < 8; ibe++) {
+ TBoundaryEdge K(pTh.be(ibe));
+ int iv[2];
+ for (int i = 0; i < 2; i++) {
+ int &__trans_tmp_2 = K[i];
+ iv[i] = pTh(__trans_tmp_2);
+ }
+ bS[ibe].set(iv, v0);
+ }
+ MeshS T_Th;
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wclass-memaccess.C b/gcc/testsuite/g++.dg/warn/Wclass-memaccess.C
index 1dc23df..87aaa79 100644
--- a/gcc/testsuite/g++.dg/warn/Wclass-memaccess.C
+++ b/gcc/testsuite/g++.dg/warn/Wclass-memaccess.C
@@ -1144,7 +1144,7 @@ void test (HasVolRefAssign *p, const HasVolRefAssign &x,
/* HasVirtuals should only be manipulated by the special member functions
and not by bzero, memcpy, or any other raw memory function. Doing
- otherwse might corrupt the the vtable pointer. */
+ otherwse might corrupt the vtable pointer. */
struct HasVirtuals { int i; virtual void foo (); };
void test (HasVirtuals *p, const HasVirtuals &x,
diff --git a/gcc/testsuite/g++.dg/warn/Wconversion-real-integer2.C b/gcc/testsuite/g++.dg/warn/Wconversion-real-integer2.C
index 7386525..404c066 100644
--- a/gcc/testsuite/g++.dg/warn/Wconversion-real-integer2.C
+++ b/gcc/testsuite/g++.dg/warn/Wconversion-real-integer2.C
@@ -4,7 +4,7 @@
// Before the fix that came with this test, we'd output an error for
// the __INT_MAX__ token. That token has a BUILTINS_LOCATION
-// location, so the the location prefix in the warning message would
+// location, so the location prefix in the warning message would
// be:
// <built-in>:0:0: warning: conversion to 'float' alters 'int' constant value
//
diff --git a/gcc/testsuite/g++.dg/warn/Wparentheses-10.C b/gcc/testsuite/g++.dg/warn/Wparentheses-10.C
index 557db09..a5d28ef 100644
--- a/gcc/testsuite/g++.dg/warn/Wparentheses-10.C
+++ b/gcc/testsuite/g++.dg/warn/Wparentheses-10.C
@@ -16,7 +16,7 @@ bar (int a, int b, int c)
foo (1 & (2 ^ c));
foo (1 & 2 ^ 3); // { dg-warning "parentheses" "correct warning" }
foo ((1 & 2) ^ 3);
- foo (1 & (2 ^ 3));
+ foo (1 & (0x2 ^ 3));
foo (a ^ b & c); // { dg-warning "parentheses" "correct warning" }
foo ((a ^ b) & c);
foo (a ^ (b & c));
@@ -34,7 +34,7 @@ bar (int a, int b, int c)
foo (1 + (2 ^ c));
foo (1 + 2 ^ 3); // { dg-warning "parentheses" "correct warning" }
foo ((1 + 2) ^ 3);
- foo (1 + (2 ^ 3));
+ foo (1 + (0x2 ^ 3));
foo (a ^ b + c); // { dg-warning "parentheses" "correct warning" }
foo ((a ^ b) + c);
foo (a ^ (b + c));
@@ -52,7 +52,7 @@ bar (int a, int b, int c)
foo (1 - (2 ^ c));
foo (1 - 2 ^ 3); // { dg-warning "parentheses" "correct warning" }
foo ((1 - 2) ^ 3);
- foo (1 - (2 ^ 3));
+ foo (1 - (0x2 ^ 3));
foo (a ^ b - c); // { dg-warning "parentheses" "correct warning" }
foo ((a ^ b) - c);
foo (a ^ (b - c));
@@ -70,7 +70,7 @@ bar (int a, int b, int c)
foo (1 >= (2 ^ c));
foo (1 >= 2 ^ 3); // { dg-warning "parentheses" "correct warning" }
foo ((1 >= 2) ^ 3);
- foo (1 >= (2 ^ 3));
+ foo (1 >= (0x2 ^ 3));
foo (a ^ b >= c); // { dg-warning "parentheses" "correct warning" }
foo ((a ^ b) >= c);
foo (a ^ (b >= c));
@@ -88,7 +88,7 @@ bar (int a, int b, int c)
foo (1 == (2 ^ c));
foo (1 == 2 ^ 3); // { dg-warning "parentheses" "correct warning" }
foo ((1 == 2) ^ 3);
- foo (1 == (2 ^ 3));
+ foo (1 == (0x2 ^ 3));
foo (a ^ b == c); // { dg-warning "parentheses" "correct warning" }
foo ((a ^ b) == c);
foo (a ^ (b == c));
@@ -104,9 +104,9 @@ bar (int a, int b, int c)
foo (1 < 2 ^ c); // { dg-warning "parentheses" "correct warning" }
foo ((1 < 2) ^ c);
foo (1 < (2 ^ c));
- foo (1 < 2 ^ 3); // { dg-warning "parentheses" "correct warning" }
+ foo (1 < 0x2 ^ 3); // { dg-warning "parentheses" "correct warning" }
foo ((1 < 2) ^ 3);
- foo (1 < (2 ^ 3));
+ foo (1 < (0x2 ^ 3));
foo (a ^ b < c); // { dg-warning "parentheses" "correct warning" }
foo ((a ^ b) < c);
foo (a ^ (b < c));
diff --git a/gcc/testsuite/g++.dg/warn/Wparentheses-18.C b/gcc/testsuite/g++.dg/warn/Wparentheses-18.C
index 83efaff..d50fad8 100644
--- a/gcc/testsuite/g++.dg/warn/Wparentheses-18.C
+++ b/gcc/testsuite/g++.dg/warn/Wparentheses-18.C
@@ -42,9 +42,9 @@ bar (T a, T b, T c)
foo (1 | 2 ^ c); // { dg-warning "parentheses" "correct warning" }
foo ((1 | 2) ^ c);
foo (1 | (2 ^ c));
- foo (1 | 2 ^ 3); // { dg-warning "parentheses" "correct warning" }
+ foo (1 | 0x2 ^ 3); // { dg-warning "parentheses" "correct warning" }
foo ((1 | 2) ^ 3);
- foo (1 | (2 ^ 3));
+ foo (1 | (0x2 ^ 3));
foo (a + b | c); // { dg-warning "parentheses" "correct warning" }
foo ((a + b) | c);
foo (a + (b | c));
diff --git a/gcc/testsuite/g++.dg/warn/Wparentheses-19.C b/gcc/testsuite/g++.dg/warn/Wparentheses-19.C
index f0e2b80..2ad8036 100644
--- a/gcc/testsuite/g++.dg/warn/Wparentheses-19.C
+++ b/gcc/testsuite/g++.dg/warn/Wparentheses-19.C
@@ -17,7 +17,7 @@ bar (T a, T b, T c)
foo (1 & (2 ^ c));
foo (1 & 2 ^ 3); // { dg-warning "parentheses" "correct warning" }
foo ((1 & 2) ^ 3);
- foo (1 & (2 ^ 3));
+ foo (1 & (0x2 ^ 3));
foo (a ^ b & c); // { dg-warning "parentheses" "correct warning" }
foo ((a ^ b) & c);
foo (a ^ (b & c));
@@ -35,7 +35,7 @@ bar (T a, T b, T c)
foo (1 + (2 ^ c));
foo (1 + 2 ^ 3); // { dg-warning "parentheses" "correct warning" }
foo ((1 + 2) ^ 3);
- foo (1 + (2 ^ 3));
+ foo (1 + (0x2 ^ 3));
foo (a ^ b + c); // { dg-warning "parentheses" "correct warning" }
foo ((a ^ b) + c);
foo (a ^ (b + c));
@@ -53,7 +53,7 @@ bar (T a, T b, T c)
foo (1 - (2 ^ c));
foo (1 - 2 ^ 3); // { dg-warning "parentheses" "correct warning" }
foo ((1 - 2) ^ 3);
- foo (1 - (2 ^ 3));
+ foo (1 - (0x2 ^ 3));
foo (a ^ b - c); // { dg-warning "parentheses" "correct warning" }
foo ((a ^ b) - c);
foo (a ^ (b - c));
@@ -71,7 +71,7 @@ bar (T a, T b, T c)
foo (1 >= (2 ^ c));
foo (1 >= 2 ^ 3); // { dg-warning "parentheses" "correct warning" }
foo ((1 >= 2) ^ 3);
- foo (1 >= (2 ^ 3));
+ foo (1 >= (0x2 ^ 3));
foo (a ^ b >= c); // { dg-warning "parentheses" "correct warning" }
foo ((a ^ b) >= c);
foo (a ^ (b >= c));
@@ -89,7 +89,7 @@ bar (T a, T b, T c)
foo (1 == (2 ^ c));
foo (1 == 2 ^ 3); // { dg-warning "parentheses" "correct warning" }
foo ((1 == 2) ^ 3);
- foo (1 == (2 ^ 3));
+ foo (1 == (0x2 ^ 3));
foo (a ^ b == c); // { dg-warning "parentheses" "correct warning" }
foo ((a ^ b) == c);
foo (a ^ (b == c));
@@ -107,7 +107,7 @@ bar (T a, T b, T c)
foo (1 < (2 ^ c));
foo (1 < 2 ^ 3); // { dg-warning "parentheses" "correct warning" }
foo ((1 < 2) ^ 3);
- foo (1 < (2 ^ 3));
+ foo (1 < (0x2 ^ 3));
foo (a ^ b < c); // { dg-warning "parentheses" "correct warning" }
foo ((a ^ b) < c);
foo (a ^ (b < c));
diff --git a/gcc/testsuite/g++.dg/warn/Wparentheses-9.C b/gcc/testsuite/g++.dg/warn/Wparentheses-9.C
index 7c8f01d..69976b3b 100644
--- a/gcc/testsuite/g++.dg/warn/Wparentheses-9.C
+++ b/gcc/testsuite/g++.dg/warn/Wparentheses-9.C
@@ -41,9 +41,9 @@ bar (int a, int b, int c)
foo (1 | 2 ^ c); // { dg-warning "parentheses" "correct warning" }
foo ((1 | 2) ^ c);
foo (1 | (2 ^ c));
- foo (1 | 2 ^ 3); // { dg-warning "parentheses" "correct warning" }
+ foo (1 | 0x2 ^ 3); // { dg-warning "parentheses" "correct warning" }
foo ((1 | 2) ^ 3);
- foo (1 | (2 ^ 3));
+ foo (1 | (0x2 ^ 3));
foo (a + b | c); // { dg-warning "parentheses" "correct warning" }
foo ((a + b) | c);
foo (a + (b | c));
diff --git a/gcc/testsuite/g++.dg/warn/Wself-move1.C b/gcc/testsuite/g++.dg/warn/Wself-move1.C
new file mode 100644
index 0000000..5c9fc92
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wself-move1.C
@@ -0,0 +1,125 @@
+// PR c++/81159
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wself-move" }
+
+// Define std::move.
+namespace std {
+ template<typename _Tp>
+ struct remove_reference
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_reference<_Tp&>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_reference<_Tp&&>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ constexpr typename std::remove_reference<_Tp>::type&&
+ move(_Tp&& __t) noexcept
+ { return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }
+}
+
+int g;
+
+struct S {
+ int x;
+ S(S&& o) {
+ x = std::move (x); // { dg-warning "moving '\[^\n\r]*S::x' of type .int. to itself" }
+ x = std::move (o.x);
+ o.x = std::move (x);
+ o.x = std::move (o.x); // { dg-warning "moving 'o.S::x' of type .int. to itself" }
+ }
+ void foo (int x) {
+ x = std::move (x); // { dg-warning "moving 'x' of type .int. to itself" }
+ }
+};
+
+struct X {
+ int x;
+ X(int x) : x(std::move (x)) { }
+};
+
+struct A {};
+struct B { A a; };
+struct C { C(); ~C(); };
+struct D { D(); D(const D&); D(D&&); D& operator=(const D&); };
+
+void
+test ()
+{
+ int i = 42;
+ i = std::move (i); // { dg-warning "moving 'i' of type .int. to itself" }
+ (i) = std::move (i); // { dg-warning "moving 'i' of type .int. to itself" }
+
+ g = std::move (g); // { dg-warning "moving 'g' of type .int. to itself" }
+ (g) = std::move (g); // { dg-warning "moving 'g' of type .int. to itself" }
+
+ A a;
+ a = std::move (a); // { dg-warning "moving 'a' of type .A. to itself" }
+ (a) = std::move (a); // { dg-warning "moving 'a' of type .A. to itself" }
+
+ B b;
+ b = std::move (b); // { dg-warning "moving 'b' of type .B. to itself" }
+ (b) = std::move (b); // { dg-warning "moving 'b' of type .B. to itself" }
+ b.a = std::move (b.a); // { dg-warning "moving 'b.B::a' of type .A. to itself" }
+ (b.a) = std::move (b.a); // { dg-warning "moving 'b.B::a' of type .A. to itself" }
+
+ C c;
+ c = std::move (c); // { dg-warning "moving 'c' of type .C. to itself" }
+ D d;
+ d = std::move (d); // { dg-warning "moving 'd' of type .D. to itself" }
+}
+
+template<typename T>
+void ttest ()
+{
+ T t;
+ t = std::move (t); // { dg-warning "moving 't' of type .A. to itself" }
+}
+
+template void ttest<A>();
+
+void
+testref (int &r, int &&rr)
+{
+ r = std::move (r); // { dg-warning "moving 'r' of type .int. to itself" }
+ rr = std::move (rr); // { dg-warning "moving 'rr' of type .int. to itself" }
+}
+
+// Test various other arguments to std::move.
+template<typename T>
+void
+testargs (T *Tptr, T **Tpptr, T& Tref, T&& Trref, const T *Tcptr)
+{
+ Tptr = std::move (Tptr); // { dg-warning "moving 'Tptr' of type 'int\\*' to itself" }
+ *Tptr = std::move (*Tptr); // { dg-warning "moving '\\* Tptr' of type 'int' to itself" }
+ *Tptr = std::move (*(Tptr)); // { dg-warning "moving '\\* Tptr' of type 'int' to itself" }
+ *(Tptr) = std::move (*Tptr); // { dg-warning "moving '\\* Tptr' of type 'int' to itself" }
+ *(Tptr + 1) = std::move (*(Tptr + 1)); // { dg-warning "moving '\[^\n\r]*Tptr\[^\n\r]*' of type 'int' to itself" }
+ *(Tptr + 1) = std::move (*(Tptr + 2));
+ (*(Tptr)) = std::move (*Tptr); // { dg-warning "moving '\\* Tptr' of type 'int' to itself" }
+ *Tpptr = std::move (*Tpptr); // { dg-warning "moving '\\* Tpptr' of type 'int\\*' to itself" }
+ **Tpptr = std::move (**Tpptr); // { dg-warning "moving '\\* \\* Tpptr' of type 'int' to itself" }
+ Tref = std::move (Tref); // { dg-warning "moving 'Tref' of type 'int' to itself" }
+ Trref = std::move (Trref); // { dg-warning "moving 'Trref' of type 'int' to itself" }
+ Tcptr = std::move (Tcptr); // { dg-warning "moving 'Tcptr' of type 'const int\\*' to itself" }
+ (Tptr) = std::move (Tptr); // { dg-warning "moving 'Tptr' of type 'int\\*' to itself" }
+ (*Tptr) = std::move (*Tptr); // { dg-warning "moving '\\* Tptr' of type 'int' to itself" }
+ (*Tpptr) = std::move (*Tpptr); // { dg-warning "moving '\\* Tpptr' of type 'int\\*' to itself" }
+ (**Tpptr) = std::move (**Tpptr); // { dg-warning "moving '\\* \\* Tpptr' of type 'int' to itself" }
+ (*(*(Tpptr))) = std::move (**Tpptr); // { dg-warning "moving '\\* \\* Tpptr' of type 'int' to itself" }
+ (Tref) = std::move (Tref); // { dg-warning "moving 'Tref' of type 'int' to itself" }
+ (Trref) = std::move (Trref); // { dg-warning "moving 'Trref' of type 'int' to itself" }
+ (Tcptr) = std::move (Tcptr); // { dg-warning "moving 'Tcptr' of type 'const int\\*' to itself" }
+}
+
+void
+call_testargs ()
+{
+ int i = 42;
+ int *p = &i;
+ testargs<int>(&i, &p, i, 42, &i);
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wstringop-overflow-4.C b/gcc/testsuite/g++.dg/warn/Wstringop-overflow-4.C
index c9d6393..3716d2d 100644
--- a/gcc/testsuite/g++.dg/warn/Wstringop-overflow-4.C
+++ b/gcc/testsuite/g++.dg/warn/Wstringop-overflow-4.C
@@ -195,7 +195,7 @@ void test_strcpy_new_int16_t (size_t n, const size_t vals[])
iftmp.2_33 = _45 * 2; ;; iftmp.2_33 = 0
_34 = operator new [] (iftmp.2_33); ;; new [] (0)
*/
- T (S (2), new int16_t[r_dmin_dmax + 1]); // { dg-bogus "into a region of size" "" { xfail *-*-*} }
+ T (S (2), new int16_t[r_dmin_dmax + 1]); // { dg-bogus "into a region of size" "" { xfail c++98_only } }
T (S (9), new int16_t[r_dmin_dmax * 2 + 1]);
}
diff --git a/gcc/testsuite/g++.dg/warn/Wsubobject-linkage-5.C b/gcc/testsuite/g++.dg/warn/Wsubobject-linkage-5.C
new file mode 100644
index 0000000..e2c2fd9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wsubobject-linkage-5.C
@@ -0,0 +1,7 @@
+// PR c++/86491
+// { dg-do compile { target c++11 } }
+
+template <int *> struct NT{};
+#line 6 "tM.C"
+static int d;
+struct D : NT<&d> {}; // { dg-warning "internal linkage" }
diff --git a/gcc/testsuite/g++.dg/warn/Wuninitialized-33.C b/gcc/testsuite/g++.dg/warn/Wuninitialized-33.C
new file mode 100644
index 0000000..1bb0639
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wuninitialized-33.C
@@ -0,0 +1,55 @@
+// PR102801
+// { dg-do compile }
+// { dg-require-effective-target c++17 }
+// { dg-options "-O2 -Wall" }
+
+#include <algorithm>
+#include <memory>
+#include <optional>
+#include <string>
+#include <utility>
+#include <vector>
+
+class C {
+ bool b{}; // { dg-bogus "uninitialized" }
+
+ struct Shared {};
+ using SharedPtr = std::shared_ptr<const Shared>;
+
+ SharedPtr shared;
+
+public:
+ C() = delete;
+ C(bool bIn) : b(bIn) {}
+ ~C();
+ int someMethod() const;
+};
+
+using OptC = std::optional<C>;
+
+class C2 {
+ OptC c;
+public:
+ C2() = default;
+ C2(const C &cIn) : c(cIn) {}
+ ~C2();
+ void operator()() const;
+ void swap(C2 &o) { std::swap(c, o.c); }
+};
+
+
+template <typename T>
+class Q {
+ std::vector<T> queue;
+public:
+ void Add(std::vector<T> &items) {
+ for (T & item : items) {
+ queue.push_back(T());
+ item.swap(queue.back());
+ }
+ }
+ void Exec();
+};
+
+extern void foo(Q<C2> & q, std::vector<C2> &items);
+void foo(Q<C2> & q, std::vector<C2> &items) { q.Add(items); q.Exec(); }
diff --git a/gcc/testsuite/g++.dg/warn/Wxor-used-as-pow-named-op.C b/gcc/testsuite/g++.dg/warn/Wxor-used-as-pow-named-op.C
new file mode 100644
index 0000000..4899d72
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wxor-used-as-pow-named-op.C
@@ -0,0 +1,8 @@
+/* Verify that -Wxor-used-as-pow only warns with ^ and not with
+ named "xor". */
+
+int t2_16 = 2^16; /* { dg-warning "result of '2\\^16' is 18; did you mean '1 << 16' \\(65536\\)\\?" } */
+int t2x16 = 2 xor 16;
+
+int t10_6 = 10^6; /* { dg-warning "result of '10\\^6' is 12; did you mean '1e6'\\?" } */
+int t10x6 = 10 xor 6;
diff --git a/gcc/testsuite/g++.dg/warn/anonymous-namespace-3.C b/gcc/testsuite/g++.dg/warn/anonymous-namespace-3.C
index 8b72abd..ce5745b 100644
--- a/gcc/testsuite/g++.dg/warn/anonymous-namespace-3.C
+++ b/gcc/testsuite/g++.dg/warn/anonymous-namespace-3.C
@@ -7,7 +7,8 @@
struct B { std::auto_ptr<A> p; };
#line 10 "foo.C"
-struct C // { dg-warning "uses the anonymous namespace" }
+struct C // { dg-warning "has internal linkage" "" { target c++11 } }
+// { dg-warning "uses the anonymous namespace" "" { target c++98_only } .-1 }
{
std::auto_ptr<A> p;
};
diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr96974.C b/gcc/testsuite/g++.target/aarch64/sve/pr96974.C
index 54000f5..2f6ebd6 100644
--- a/gcc/testsuite/g++.target/aarch64/sve/pr96974.C
+++ b/gcc/testsuite/g++.target/aarch64/sve/pr96974.C
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-Ofast -march=armv8.2-a+sve -fdisable-tree-fre4 -fdump-tree-slp-details" } */
+/* { dg-options "-Ofast -march=armv8.2-a+sve -fdisable-tree-fre4" } */
float a;
int
@@ -14,5 +14,3 @@ struct c {
}
int coeffs[10];
} f;
-
-/* { dg-final { scan-tree-dump "Not vectorized: Incompatible number of vector subparts between" "slp1" { target lp64 } } } */
diff --git a/gcc/testsuite/g++.target/i386/bfloat_cpp_typecheck.C b/gcc/testsuite/g++.target/i386/bfloat_cpp_typecheck.C
new file mode 100644
index 0000000..b800a6d
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/bfloat_cpp_typecheck.C
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-msse2 -O3 --save-temps" } */
+
+void foo (void)
+{
+ __bf16 (); /* { dg-bogus {invalid conversion to type '__bf16'} } */
+ __bf16 a = __bf16(); /* { dg-bogus {invalid conversion to type '__bf16'} } */
+ __bf16 (0x1234); /* { dg-error {invalid conversion to type '__bf16'} } */
+ __bf16 (0.1); /* { dg-error {invalid conversion to type '__bf16'} } */
+}
diff --git a/gcc/testsuite/g++.target/i386/pr106627.C b/gcc/testsuite/g++.target/i386/pr106627.C
new file mode 100644
index 0000000..e993d82
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr106627.C
@@ -0,0 +1,28 @@
+/* PR c++/103012 Exception handling with multiversioned functions */
+/* { dg-do run } */
+/* { dg-require-ifunc "" } */
+
+extern "C" void abort (void);
+
+__attribute__((target("default")))
+void f() {
+ throw 1;
+}
+
+__attribute__((target("sse4.2,bmi")))
+void f() {
+ throw 2;
+}
+
+int main()
+{
+ try {
+ f();
+ }
+ catch(...)
+ {
+ return 0;
+ }
+
+ abort ();
+}
diff --git a/gcc/testsuite/g++.target/i386/vect-bfloat16-1.C b/gcc/testsuite/g++.target/i386/vect-bfloat16-1.C
new file mode 100644
index 0000000..71b4d86
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/vect-bfloat16-1.C
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "vpblendmw" 1 } } */
+
+typedef short v8hi __attribute__((vector_size(16)));
+typedef __bf16 v8bf __attribute__((vector_size(16)));
+
+v8bf
+foo (v8hi a, v8hi b, v8bf c, v8bf d)
+{
+ return a > b ? c : d;
+}
+
diff --git a/gcc/testsuite/g++.target/loongarch/pr106828.C b/gcc/testsuite/g++.target/loongarch/pr106828.C
new file mode 100644
index 0000000..190c1db
--- /dev/null
+++ b/gcc/testsuite/g++.target/loongarch/pr106828.C
@@ -0,0 +1,4 @@
+/* { dg-do-preprocess } */
+/* { dg-options "-mabi=lp64d -fsanitize=address" } */
+
+/* Tests whether the compiler supports compile option '-fsanitize=address'. */
diff --git a/gcc/testsuite/g++.target/powerpc/pr101322.C b/gcc/testsuite/g++.target/powerpc/pr101322.C
new file mode 100644
index 0000000..43eaf3a
--- /dev/null
+++ b/gcc/testsuite/g++.target/powerpc/pr101322.C
@@ -0,0 +1,17 @@
+/* PR target/101322 */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+
+/* Verify we don't ICE on the following test cases. */
+
+void
+foo (char *resp, char *vpp)
+{
+ __builtin_vsx_disassemble_pair (resp, (__vector_pair *) vpp);
+}
+
+void
+bar (char *resp, char *vpp)
+{
+ __builtin_mma_disassemble_acc (resp, (__vector_quad *)vpp);
+}
diff --git a/gcc/testsuite/g++.target/powerpc/pr105485.C b/gcc/testsuite/g++.target/powerpc/pr105485.C
new file mode 100644
index 0000000..db1bd94
--- /dev/null
+++ b/gcc/testsuite/g++.target/powerpc/pr105485.C
@@ -0,0 +1,9 @@
+/* It's to verify no ICE here, ignore error/warning messages
+ since they are not test points here. */
+/* { dg-excess-errors "pr105485" } */
+
+template <class> void __builtin_vec_vslv();
+typedef __attribute__((altivec(vector__))) char T;
+T b (T c, T d) {
+ return __builtin_vec_vslv(c, d);
+}
diff --git a/gcc/testsuite/g++.target/riscv/_Float16.C b/gcc/testsuite/g++.target/riscv/_Float16.C
new file mode 100644
index 0000000..b97d1fb
--- /dev/null
+++ b/gcc/testsuite/g++.target/riscv/_Float16.C
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+_Float16 x;
+
+_Float16 foo1 (_Float16 a, _Float16 b)
+{
+ return a + b;
+}
+
+_Float16 foo2 (_Float16 a, _Float16 b)
+{
+ return a * b;
+}
+
+int foo3 (_Float16 a, _Float16 b)
+{
+ return a > b;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr106101.c b/gcc/testsuite/gcc.c-torture/compile/pr106101.c
new file mode 100644
index 0000000..dec6608
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr106101.c
@@ -0,0 +1,62 @@
+/* { dg-do compile } */
+
+extern char *globerr;
+char **ftpglob();
+
+static const int yypgoto[] =
+{
+ -82, -82, -82, -82
+};
+
+static const int yydefgoto[] =
+{
+ 0, 1, 36, 37
+};
+
+static const int yytable[] =
+{
+ 43, 129, 88, 89
+};
+
+static const int yycheck[] =
+{
+ 8, 82, 4, 5
+};
+
+
+int yyparse (void)
+{
+ int yystate = 0;
+ int *yyvsp = 0;
+
+ int yyn;
+ int yyresult;
+ int yyval;
+
+yyreduce:
+
+ switch (yyn)
+ {
+ case 72: {
+
+ if (strncmp( yyvsp[0], "~", 1) == 0) {
+ *(char **)&(yyval) = *ftpglob(yyvsp[0]);
+ if (globerr != 0) {
+ yyval = 0;
+ }
+ free(yyvsp[0]);
+ }
+ }
+ break;
+ }
+
+ *++yyvsp = yyval;
+
+ {
+ const int yyi = yypgoto[0] + *yyvsp;
+ yystate = (yycheck[yyi] == *yyvsp ? 0 : 0);
+ }
+
+ return yyresult;
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr106878.c b/gcc/testsuite/gcc.c-torture/compile/pr106878.c
new file mode 100644
index 0000000..c845718
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr106878.c
@@ -0,0 +1,15 @@
+/* PR tree-optimization/106878 */
+
+typedef __INTPTR_TYPE__ intptr_t;
+typedef __UINTPTR_TYPE__ uintptr_t;
+int a;
+
+int
+foo (const int *c)
+{
+ uintptr_t d = ((intptr_t) c | (intptr_t) &a) & 65535 << 16;
+ intptr_t e = (intptr_t) c;
+ if (d != (e & 65535 << 16))
+ return 1;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr106958.c b/gcc/testsuite/gcc.c-torture/compile/pr106958.c
new file mode 100644
index 0000000..98e6554
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr106958.c
@@ -0,0 +1,13 @@
+/* PR tree-optimization/106958 */
+
+int a;
+void bar (int);
+
+void
+foo (char *x, char *y)
+{
+ int b = a != 0;
+ int c = x != 0;
+ int d = y != 0;
+ bar (b | c | d);
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr93776.c b/gcc/testsuite/gcc.c-torture/compile/pr93776.c
index c407a62..3852736 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr93776.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr93776.c
@@ -1,5 +1,5 @@
-/* { dg-do compile } */
-/* { dg-options "-O1" } */
+/* This used to ICE in SRA as SRA got
+ confused by the zero signed assigment. */
struct empty {};
struct s { int i; };
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/hugeval.x b/gcc/testsuite/gcc.c-torture/execute/ieee/hugeval.x
index c66de1c..a6dad81 100644
--- a/gcc/testsuite/gcc.c-torture/execute/ieee/hugeval.x
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/hugeval.x
@@ -2,9 +2,6 @@
# instead of +Infinity.
global target_triplet
-if { [istarget "hppa*-*-hpux9*"] || [istarget "hppa*-*-hpux10*"] } {
- set torture_execute_xfail "$target_triplet"
-}
# VxWorks kernel mode has the same problem.
if {[istarget "*-*-vxworks*"]} {
diff --git a/gcc/testsuite/gcc.dg/20040813-1.c b/gcc/testsuite/gcc.dg/20040813-1.c
deleted file mode 100644
index 9cf664d..0000000
--- a/gcc/testsuite/gcc.dg/20040813-1.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/* Test lang in N_SO stab. */
-/* Contributed by Devang Patel <dpatel@apple.com> */
-
-/* { dg-do compile { target stabs } } */
-/* { dg-options "-gstabs" } */
-
-int
-main ()
-{
- return 0;
-}
-
-/* { dg-final { scan-assembler ".stabs.*100,0,2" } } */
-
diff --git a/gcc/testsuite/gcc.dg/Wparentheses-6.c b/gcc/testsuite/gcc.dg/Wparentheses-6.c
index 2d2cc16..260b6ad 100644
--- a/gcc/testsuite/gcc.dg/Wparentheses-6.c
+++ b/gcc/testsuite/gcc.dg/Wparentheses-6.c
@@ -43,9 +43,9 @@ bar (int a, int b, int c)
foo (1 | 2 ^ c); /* { dg-warning "parentheses" "correct warning" } */
foo ((1 | 2) ^ c);
foo (1 | (2 ^ c));
- foo (1 | 2 ^ 3); /* { dg-warning "parentheses" "correct warning" } */
+ foo (1 | 0x2 ^ 3); /* { dg-warning "parentheses" "correct warning" } */
foo ((1 | 2) ^ 3);
- foo (1 | (2 ^ 3));
+ foo (1 | (0x2 ^ 3));
foo (a + b | c); /* { dg-warning "parentheses" "correct warning" } */
foo ((a + b) | c);
foo (a + (b | c));
diff --git a/gcc/testsuite/gcc.dg/Wparentheses-7.c b/gcc/testsuite/gcc.dg/Wparentheses-7.c
index f351696..6805094 100644
--- a/gcc/testsuite/gcc.dg/Wparentheses-7.c
+++ b/gcc/testsuite/gcc.dg/Wparentheses-7.c
@@ -18,7 +18,7 @@ bar (int a, int b, int c)
foo (1 & (2 ^ c));
foo (1 & 2 ^ 3); /* { dg-warning "parentheses" "correct warning" } */
foo ((1 & 2) ^ 3);
- foo (1 & (2 ^ 3));
+ foo (1 & (0x2 ^ 3));
foo (a ^ b & c); /* { dg-warning "parentheses" "correct warning" } */
foo ((a ^ b) & c);
foo (a ^ (b & c));
@@ -36,7 +36,7 @@ bar (int a, int b, int c)
foo (1 + (2 ^ c));
foo (1 + 2 ^ 3); /* { dg-warning "parentheses" "correct warning" } */
foo ((1 + 2) ^ 3);
- foo (1 + (2 ^ 3));
+ foo (1 + (0x2 ^ 3));
foo (a ^ b + c); /* { dg-warning "parentheses" "correct warning" } */
foo ((a ^ b) + c);
foo (a ^ (b + c));
@@ -54,7 +54,7 @@ bar (int a, int b, int c)
foo (1 - (2 ^ c));
foo (1 - 2 ^ 3); /* { dg-warning "parentheses" "correct warning" } */
foo ((1 - 2) ^ 3);
- foo (1 - (2 ^ 3));
+ foo (1 - (0x2 ^ 3));
foo (a ^ b - c); /* { dg-warning "parentheses" "correct warning" } */
foo ((a ^ b) - c);
foo (a ^ (b - c));
@@ -72,7 +72,7 @@ bar (int a, int b, int c)
foo (1 >= (2 ^ c));
foo (1 >= 2 ^ 3); /* { dg-warning "parentheses" "correct warning" } */
foo ((1 >= 2) ^ 3);
- foo (1 >= (2 ^ 3));
+ foo (1 >= (0x2 ^ 3));
foo (a ^ b >= c); /* { dg-warning "parentheses" "correct warning" } */
foo ((a ^ b) >= c);
foo (a ^ (b >= c));
@@ -90,7 +90,7 @@ bar (int a, int b, int c)
foo (1 == (2 ^ c));
foo (1 == 2 ^ 3); /* { dg-warning "parentheses" "correct warning" } */
foo ((1 == 2) ^ 3);
- foo (1 == (2 ^ 3));
+ foo (1 == (0x2 ^ 3));
foo (a ^ b == c); /* { dg-warning "parentheses" "correct warning" } */
foo ((a ^ b) == c);
foo (a ^ (b == c));
@@ -108,7 +108,7 @@ bar (int a, int b, int c)
foo (1 < (2 ^ c));
foo (1 < 2 ^ 3); /* { dg-warning "parentheses" "correct warning" } */
foo ((1 < 2) ^ 3);
- foo (1 < (2 ^ 3));
+ foo (1 < (0x2 ^ 3));
foo (a ^ b < c); /* { dg-warning "parentheses" "correct warning" } */
foo ((a ^ b) < c);
foo (a ^ (b < c));
diff --git a/gcc/testsuite/gcc.dg/Wxor-used-as-pow-pr106830.c b/gcc/testsuite/gcc.dg/Wxor-used-as-pow-pr106830.c
new file mode 100644
index 0000000..104897a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wxor-used-as-pow-pr106830.c
@@ -0,0 +1,6 @@
+/* { dg-require-effective-target int128 }
+ { dg-options "-Wno-pedantic" } */
+
+void foo0_u16_0() {
+ (__int128)(18302628885633695743 << 4) ^ 0; /* { dg-warning "integer constant is so large that it is unsigned" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/allocation-size-1.c b/gcc/testsuite/gcc.dg/analyzer/allocation-size-1.c
index b5bed53..003914e 100644
--- a/gcc/testsuite/gcc.dg/analyzer/allocation-size-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/allocation-size-1.c
@@ -115,3 +115,13 @@ void test_10 (int32_t n)
char *ptr = malloc (7 * n);
free (ptr);
}
+
+void test_11 ()
+{
+ /* 3.0 is folded to an int before the analyzer runs. */
+ int32_t *ptr = malloc (3.0); /* { dg-line malloc11 } */
+ free (ptr);
+
+ /* { dg-warning "allocated buffer size is not a multiple of the pointee's size \\\[CWE-131\\\]" "warning" { target *-*-* } malloc11 } */
+ /* { dg-message "'int32_t \\*' (\\\{aka '(long )?int \\*'\\\})? here; 'sizeof \\(int32_t (\\\{aka (long )?int\\\})?\\)' is '4'" "note" { target *-*-* } malloc11 } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/allocation-size-3.c b/gcc/testsuite/gcc.dg/analyzer/allocation-size-3.c
index 0c86f09..9590e31 100644
--- a/gcc/testsuite/gcc.dg/analyzer/allocation-size-3.c
+++ b/gcc/testsuite/gcc.dg/analyzer/allocation-size-3.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options -Wno-analyzer-out-of-bounds } */
+
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-1.c b/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
index 4318191..d8930d1 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
@@ -624,8 +624,7 @@ void test_29a (struct coord p[])
__analyzer_eval (q[-2].y == 107025); /* { dg-warning "TRUE" } */
q -= 2;
- __analyzer_eval (q == &p[7]); /* { dg-warning "UNKNOWN" } */
- // TODO: make this be TRUE
+ __analyzer_eval (q == &p[7]); /* { dg-warning "TRUE" } */
__analyzer_eval (q->x == 107024); /* { dg-warning "TRUE" } */
__analyzer_eval (q->y == 107025); /* { dg-warning "TRUE" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/error-uninit.c b/gcc/testsuite/gcc.dg/analyzer/error-uninit.c
new file mode 100644
index 0000000..8d52a17
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/error-uninit.c
@@ -0,0 +1,29 @@
+/* Verify that we check for uninitialized values passed to functions
+ that we have special-cased region-model handling for. */
+
+extern void error (int __status, int __errnum, const char *__format, ...)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+
+void test_uninit_status (int arg)
+{
+ int st;
+ error (st, 42, "test: %s", arg); /* { dg-warning "use of uninitialized value 'st'" } */
+}
+
+void test_uninit_errnum (int st)
+{
+ int num;
+ error (st, num, "test"); /* { dg-warning "use of uninitialized value 'num'" } */
+}
+
+void test_uninit_fmt (int st)
+{
+ const char *fmt;
+ error (st, 42, fmt); /* { dg-warning "use of uninitialized value 'fmt'" } */
+}
+
+void test_uninit_vargs (int st)
+{
+ int arg;
+ error (st, 42, "test: %s", arg); /* { dg-warning "use of uninitialized value 'arg'" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/fd-1.c b/gcc/testsuite/gcc.dg/analyzer/fd-1.c
index 8a72e63..5b85a33 100644
--- a/gcc/testsuite/gcc.dg/analyzer/fd-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/fd-1.c
@@ -3,6 +3,13 @@ int open(const char *, int mode);
#define O_WRONLY 1
#define O_RDWR 2
+typedef enum {
+ S_IRWXU
+ // etc
+} mode_t;
+
+int creat (const char *, mode_t mode);
+
void
test_1 (const char *path)
{
@@ -37,3 +44,17 @@ void test_4 (const char *path)
/* { dg-message "\\(1\\) leaks here" "" { target *-*-* } .-1 } */
}
+void
+test_5 (const char *path, mode_t mode)
+{
+ creat (path, mode); /* { dg-warning "leak of file descriptor \\\[CWE-775\\\]" } */
+}
+
+void
+test_6 (const char *path, mode_t mode)
+{
+ int fd = creat (path, mode);
+ return; /* { dg-warning "leak of file descriptor 'fd' \\\[CWE-775\\\]" } */
+}
+
+
diff --git a/gcc/testsuite/gcc.dg/analyzer/fd-2.c b/gcc/testsuite/gcc.dg/analyzer/fd-2.c
index d794b46..10c9ecd 100644
--- a/gcc/testsuite/gcc.dg/analyzer/fd-2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/fd-2.c
@@ -5,6 +5,13 @@ void close(int fd);
#define O_RDWR 2
#define STDIN 0
+typedef enum {
+ S_IRWXU
+ // etc
+} mode_t;
+
+int creat (const char *, mode_t mode);
+
void
test_1 (const char *path)
{
@@ -46,4 +53,12 @@ test_4 ()
int fd = -1;
close(fd);
close(fd);
+}
+
+void
+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/gcc.dg/analyzer/fd-4.c b/gcc/testsuite/gcc.dg/analyzer/fd-4.c
index ecd787c..842a26b 100644
--- a/gcc/testsuite/gcc.dg/analyzer/fd-4.c
+++ b/gcc/testsuite/gcc.dg/analyzer/fd-4.c
@@ -1,3 +1,6 @@
+#ifdef _AIX
+#define _MODE_T
+#endif
#include <stdio.h>
int open(const char *, int mode);
@@ -9,6 +12,12 @@ int read (int fd, void *buf, int nbytes);
#define O_WRONLY 1
#define O_RDWR 2
+typedef enum {
+ S_IRWXU
+ // etc
+} mode_t;
+
+int creat (const char *, mode_t mode);
void
test_1 (const char *path, void *buf)
@@ -69,4 +78,27 @@ test_5 (const char *path)
int fd = open (path, O_RDWR);
close(fd);
printf("%d", fd); /* { dg-bogus "'printf' on a closed file descriptor 'fd'" } */
-} \ No newline at end of file
+}
+
+
+void
+test_6 (const char *path, mode_t mode, void *buf)
+{
+ int fd = creat (path, mode);
+ if (fd != -1)
+ {
+ read (fd, buf, 1); /* { dg-warning "'read' on write-only file descriptor 'fd'" } */
+ close(fd);
+ }
+}
+
+void
+test_7 (const char *path, mode_t mode, void *buf)
+{
+ int fd = creat (path, mode);
+ if (fd != -1)
+ {
+ write (fd, buf, 1);
+ close(fd);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/fd-dup-1.c b/gcc/testsuite/gcc.dg/analyzer/fd-dup-1.c
new file mode 100644
index 0000000..b4f43e7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/fd-dup-1.c
@@ -0,0 +1,259 @@
+int open(const char *, int mode);
+void close(int fd);
+int dup (int old_fd);
+int dup2 (int old_fd, int new_fd);
+int dup3 (int old_fd, int new_fd, int flags);
+int write (int fd, void *buf, int nbytes);
+int read (int fd, void *buf, int nbytes);
+#define O_RDONLY 0
+#define O_WRONLY 1
+#define O_RDWR 2
+
+void test_1 (const char *path)
+{
+ int old_fd = open (path, O_RDWR);
+ int new_fd = dup (old_fd); /* { dg-warning "'dup' on possibly invalid file descriptor 'old_fd'" } */
+ close(old_fd);
+ close(new_fd);
+}
+
+void test_2 (const char *path)
+{
+ int old_fd = open (path, O_RDWR);
+ if (old_fd != -1)
+ {
+ int new_fd = dup (old_fd);
+ close(old_fd);
+ return; /* { dg-warning "leak of file descriptor 'new_fd' \\\[CWE-775\\\]" } */
+ }
+}
+
+void test_3 (const char *path, void *buf)
+{
+ int old_fd = open (path, O_RDWR);
+ if (old_fd != -1)
+ {
+ int new_fd = dup (old_fd);
+ write (new_fd, buf, 1); /* { dg-warning "'write' on possibly invalid file descriptor 'new_fd'" } */
+ close (new_fd);
+ close(old_fd);
+ }
+}
+
+
+void test_5 (const char *path, void *buf)
+{
+ int old_fd = open (path, O_RDWR);
+ if (old_fd != -1)
+ {
+ int new_fd = dup (old_fd);
+ if (new_fd != -1)
+ {
+ write (new_fd, buf, 1);
+ close (new_fd);
+
+ }
+ close(old_fd);
+ }
+}
+
+
+void test_7 (const char *path)
+{
+ int old_fd = open (path, O_RDWR);
+ dup2 (old_fd, 4); /* { dg-warning "'dup2' on possibly invalid file descriptor 'old_fd'" } */
+ close(old_fd);
+}
+
+void test_8 (const char *path)
+{
+ int old_fd = open (path, O_RDWR);
+ int new_fd = open (path, O_RDWR);
+ if (old_fd != -1)
+ {
+ dup2 (old_fd, new_fd); /* { dg-warning "'dup2' on possibly invalid file descriptor 'new_fd'" } */
+ close (old_fd);
+ }
+ close (new_fd);
+}
+
+void test_9 (const char *path, void *buf)
+{
+ int old_fd = open (path, O_RDWR);
+
+ if (old_fd != -1)
+ {
+ int new_fd = open (path, O_RDWR);
+ if (new_fd != -1)
+ {
+ int lhs = dup2 (old_fd, new_fd);
+ write (lhs, buf, 1); /* { dg-warning "'write' on possibly invalid file descriptor 'lhs'" } */
+ close(new_fd);
+ close(lhs);
+ }
+ close(old_fd);
+ }
+}
+
+void test_10 (const char *path, int flags)
+{
+ int old_fd = open (path, O_RDWR);
+ int new_fd = open (path, O_RDWR);
+ if (old_fd != -1)
+ {
+ dup3 (old_fd, new_fd, flags); /* { dg-warning "'dup3' on possibly invalid file descriptor 'new_fd'" } */
+ close(old_fd);
+
+ }
+ close(new_fd);
+}
+
+void test_11 (const char *path, int flags)
+{
+ int old_fd = open (path, O_RDWR);
+ int new_fd = open (path, O_RDWR);
+ if (new_fd != -1)
+ {
+ dup3 (old_fd, new_fd, flags); /* { dg-warning "'dup3' on possibly invalid file descriptor 'old_fd'" } */
+ close(new_fd);
+
+ }
+ close(old_fd);
+}
+
+void test_12 (const char *path, void *buf)
+{
+ int old_fd = open (path, O_RDONLY);
+ if (old_fd != -1)
+ {
+ int new_fd = dup (old_fd);
+ if (new_fd != -1)
+ {
+ write (new_fd, buf, 1); /* { dg-warning "'write' on read-only file descriptor 'new_fd'" } */
+ close(new_fd);
+ }
+ close(old_fd);
+ }
+}
+
+void test_13 (const char *path, void *buf)
+{
+ int old_fd = open (path, O_WRONLY);
+ if (old_fd != -1)
+ {
+ int new_fd = dup (old_fd);
+ if (new_fd != -1)
+ {
+ read (new_fd, buf, 1); /* { dg-warning "'read' on write-only file descriptor 'new_fd'" } */
+ close(new_fd);
+ }
+ close(old_fd);
+ }
+}
+
+void test_14 (const char *path, void *buf)
+{
+ int old_fd = open (path, O_RDWR);
+ if (old_fd != -1)
+ {
+ int new_fd = dup (old_fd);
+ if (new_fd != -1)
+ {
+ write (new_fd, buf, 1);
+ read (new_fd, buf, 1);
+ close(new_fd);
+ }
+ close(old_fd);
+ }
+}
+
+void test_15 (void *buf)
+{
+ int fd = dup(0);
+ read (fd, buf, 1); /* { dg-warning "'read' on possibly invalid file descriptor 'fd'" } */
+ close(fd);
+}
+
+void test_16 (void *buf)
+{
+ int fd = dup(1);
+ if (fd != -1)
+ {
+ write (fd, buf, 1);
+ close (fd);
+ }
+}
+
+void test_17 (const char *path)
+{
+ int fd = open (path, O_RDWR);
+ close(fd);
+ dup (fd); /* { dg-warning "'dup' on closed file descriptor 'fd'" } */
+ dup2 (fd, 4); /* { dg-warning "'dup2' on closed file descriptor 'fd'" } */
+}
+
+void
+test_18 (const char *path, void *buf)
+{
+ int fd = open (path, O_RDWR);
+ if (fd != -1)
+ {
+ int fd2 = dup2 (fd, 3);
+ read (fd2, buf, 1); /* { dg-warning "'read' on possibly invalid file descriptor 'fd2'" } */
+ close(fd);
+ close(fd2);
+ }
+}
+
+void
+test_19 (const char *path, void *buf)
+{
+ int fd = open (path, O_WRONLY);
+ if (fd != -1)
+ {
+ int fd2 = dup2 (fd, 4);
+ if (fd2 != -1)
+ {
+ read (fd2, buf, 1); /* { dg-warning "'read' on write-only file descriptor 'fd2'" } */
+ close(fd2);
+ }
+ close (fd);
+ }
+
+}
+
+extern int m;
+
+void
+test_20 ()
+{
+ int fd = dup (m);
+ close (fd);
+}
+
+void
+test_21 ()
+{
+ int fd = dup2 (m, 1);
+ close (fd);
+}
+
+void
+test_22 (int flags)
+{
+ int fd = dup3 (m, 1, flags);
+ close (fd);
+}
+
+void do_something();
+void
+test_23 ()
+{
+ int nullfd = -1;
+ int fd = 1;
+ if (dup2 (nullfd, fd) < 0) /* { dg-warning "'dup2' on possibly invalid file descriptor 'nullfd'" } */
+ {
+ do_something();
+ }
+}
+
diff --git a/gcc/testsuite/gcc.dg/analyzer/fd-uninit-1.c b/gcc/testsuite/gcc.dg/analyzer/fd-uninit-1.c
new file mode 100644
index 0000000..1084d1b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/fd-uninit-1.c
@@ -0,0 +1,19 @@
+/* Verify that we check for uninitialized values passed to functions
+ that we have special-cased state-machine handling for. */
+
+int dup (int old_fd);
+int not_dup (int old_fd);
+
+int
+test_1 ()
+{
+ int m;
+ return dup (m); /* { dg-warning "use of uninitialized value 'm'" "uninit" } */
+}
+
+int
+test_2 ()
+{
+ int m;
+ return not_dup (m); /* { dg-warning "use of uninitialized value 'm'" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/file-uninit-1.c b/gcc/testsuite/gcc.dg/analyzer/file-uninit-1.c
new file mode 100644
index 0000000..0f8ac54
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/file-uninit-1.c
@@ -0,0 +1,52 @@
+/* Verify that we check for uninitialized values passed to functions
+ that we have special-cased state-machine handling for. */
+
+typedef struct FILE FILE;
+
+FILE* fopen (const char*, const char*);
+int fclose (FILE*);
+int fseek (FILE *, long, int);
+
+FILE *
+test_fopen_uninit_path (void)
+{
+ const char *path;
+ FILE *f = fopen (path, "r"); /* { dg-warning "use of uninitialized value 'path'" } */
+ return f;
+}
+
+FILE *
+test_fopen_uninit_mode (const char *path)
+{
+ const char *mode;
+ FILE *f = fopen (path, mode); /* { dg-warning "use of uninitialized value 'mode'" } */
+ return f;
+}
+
+void
+test_fclose_uninit (void)
+{
+ FILE *f;
+ fclose (f); /* { dg-warning "use of uninitialized value 'f'" } */
+}
+
+int
+test_fseek_uninit_stream (void)
+{
+ FILE *stream;
+ return fseek (stream, 0, 0); /* { dg-warning "use of uninitialized value 'stream'" } */
+}
+
+int
+test_fseek_uninit_offset (FILE *stream, int whence)
+{
+ long offset;
+ return fseek (stream, offset, whence); /* { dg-warning "use of uninitialized value 'offset'" } */
+}
+
+int
+test_fseek_uninit_whence (FILE *stream, long offset)
+{
+ int whence;
+ return fseek (stream, offset, whence); /* { dg-warning "use of uninitialized value 'whence'" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/flexible-array-member-1.c b/gcc/testsuite/gcc.dg/analyzer/flexible-array-member-1.c
new file mode 100644
index 0000000..2df085a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/flexible-array-member-1.c
@@ -0,0 +1,100 @@
+#include <stdlib.h>
+#include <string.h>
+
+struct str {
+ size_t len;
+ char data[];
+};
+
+struct str *
+test_const_size (void)
+{
+ struct str *str = malloc(sizeof(str) + 10);
+ if (str) {
+ str->len = 10;
+ memset(str->data, 'x', 10);
+ return str;
+ }
+ return NULL;
+}
+
+struct str *
+test_const_size_oob_1 (void)
+{
+ /* Forgetting to add space for the trailing array. */
+ struct str *str = malloc(sizeof(str));
+ if (str) {
+ str->len = 10;
+ memset(str->data, 'x', 10); /* { dg-warning "heap-based buffer overflow" "Wanalyzer-out-of-bounds" } */
+ /* { dg-warning "'memset' writing 10 bytes into a region of size 0 overflows the destination" "Wstringop-overflow" { target *-*-* } .-1 } */
+ return str;
+ }
+ return NULL;
+}
+
+struct str *
+test_const_size_oob_2 (void)
+{
+ struct str *str = malloc(sizeof(str) + 10);
+ if (str) {
+ str->len = 10;
+ /* Using the wrong size here. */
+ memset(str->data, 'x', 11); /* { dg-warning "heap-based buffer overflow" "Wanalyzer-out-of-bounds" } */
+ /* { dg-warning "'memset' writing 11 bytes into a region of size 10 overflows the destination" "Wstringop-overflow" { target *-*-* } .-1 } */
+ return str;
+ }
+ return NULL;
+}
+
+struct str *
+test_symbolic_size (size_t len)
+{
+ struct str *str = malloc(sizeof(str) + len);
+ if (str) {
+ str->len = len;
+ memset(str->data, 'x', len);
+ return str;
+ }
+ return NULL;
+}
+
+struct str *
+test_symbolic_size_oob (size_t len)
+{
+ /* Forgetting to add space for the trailing array. */
+ struct str *str = malloc(sizeof(str));
+ if (str) {
+ str->len = len;
+ memset(str->data, 'x', len); /* { dg-warning "heap-based buffer overflow" "PR analyzer/98247" { xfail *-*-* } } */
+ // TODO(xfail): we don't yet complain about this case, which occurs when len > 0
+ return str;
+ }
+ return NULL;
+}
+
+struct str *
+test_symbolic_size_with_terminator (size_t len)
+{
+ struct str *str = malloc(sizeof(str) + len + 1);
+ if (str) {
+ str->len = len;
+ memset(str->data, 'x', len);
+ str->data[len] = '\0';
+ return str;
+ }
+ return NULL;
+}
+
+struct str *
+test_symbolic_size_with_terminator_oob (size_t len)
+{
+ /* Forgetting to add 1 for the terminator. */
+ struct str *str = malloc(sizeof(str) + len);
+ if (str) {
+ str->len = len;
+ memset(str->data, 'x', len);
+ str->data[len] = '\0'; /* { dg-warning "heap-based buffer overflow" } */
+ return str;
+ }
+ return NULL;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/fold-string-to-char.c b/gcc/testsuite/gcc.dg/analyzer/fold-string-to-char.c
new file mode 100644
index 0000000..4613921
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/fold-string-to-char.c
@@ -0,0 +1,8 @@
+#include "analyzer-decls.h"
+
+void test_1 (void)
+{
+ char str[] = "Hello";
+ char *ptr = str;
+ __analyzer_eval (ptr[0] == 'H'); /* { dg-warning "TRUE" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/function-ptr-5.c b/gcc/testsuite/gcc.dg/analyzer/function-ptr-5.c
new file mode 100644
index 0000000..3c46f28
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/function-ptr-5.c
@@ -0,0 +1,42 @@
+#define NULL ((void *)0)
+
+void calling_null_fn_ptr_1 (void)
+{
+ void (*fn_ptr) (void) = NULL;
+ fn_ptr (); /* { dg-warning "jump through null pointer" } */
+}
+
+int calling_null_fn_ptr_2 (void)
+{
+ int (*fn_ptr) (void) = NULL;
+ return fn_ptr (); /* { dg-warning "jump through null pointer" } */
+}
+
+typedef void (*void_void_fn_ptr) (void);
+
+void calling_const_fn_ptr (void)
+{
+ void_void_fn_ptr fn_ptr = (void_void_fn_ptr)0xffd2;
+ return fn_ptr ();
+}
+
+void skipping_init (int flag)
+{
+ void_void_fn_ptr fn_ptr = NULL;
+ if (flag) /* { dg-message "branch" } */
+ fn_ptr = (void_void_fn_ptr)0xffd2;
+ fn_ptr (); /* { dg-warning "jump through null pointer" } */
+}
+
+struct callbacks
+{
+ void_void_fn_ptr on_redraw;
+ void_void_fn_ptr on_cleanup;
+};
+
+void test_callbacks (void)
+{
+ struct callbacks cb;
+ __builtin_memset (&cb, 0, sizeof (cb));
+ cb.on_cleanup (); /* { dg-warning "jump through null pointer" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/imprecise-floating-point-1.c b/gcc/testsuite/gcc.dg/analyzer/imprecise-floating-point-1.c
new file mode 100644
index 0000000..d8a3f48
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/imprecise-floating-point-1.c
@@ -0,0 +1,74 @@
+#include <stdlib.h>
+
+/* Tests warn on use of floating-point operands inside the calculation
+ of an allocation size.
+
+ The test cases here only test for warnings. The test cases inside
+ allocation-size-X.c should be plently enough to test for false positives. */
+
+void test_1 (float f)
+{
+ int *ptr = malloc (sizeof (int) * f); /* { dg-line test_1 } */
+ free (ptr);
+
+ /* { dg-warning "use of floating-point arithmetic here might yield unexpected results" "warning" { target *-*-* } test_1 } */
+ /* { dg-message "operand 'f' is of type 'float'" "note" { target *-*-* } test_1 } */
+ /* { dg-message "only use operands of an integer type inside the size argument" "note" { target *-*-* } test_1 } */
+}
+
+void test_2 (int n)
+{
+ int *ptr = malloc (n * 3.1); /* { dg-line test_2 } */
+ free (ptr);
+
+ /* { dg-warning "use of floating-point arithmetic here might yield unexpected results" "warning" { target *-*-* } test_2 } */
+ /* { dg-message "operand '\(\\d|e|f|\\.|\\+|\)+' is of type 'double'" "note" { target *-*-* } test_2 } */
+ /* { dg-message "only use operands of an integer type inside the size argument" "note" { target *-*-* } test_2 } */
+}
+
+void *alloc_me (size_t size)
+{
+ return malloc (size); /* { dg-line test_3 } */
+
+ /* { dg-warning "use of floating-point arithmetic here might yield unexpected results" "warning" { target *-*-* } test_3 } */
+ /* { dg-message "operand 'f' is of type 'float'" "note" { target *-*-* } test_3 } */
+ /* { dg-message "only use operands of an integer type inside the size argument" "note" { target *-*-* } test_3 } */
+}
+
+void test_3 (float f)
+{
+ void *ptr = alloc_me (f); /* { dg-message "calling 'alloc_me' from 'test_3'" } */
+ free (ptr);
+}
+
+void test_4 (int n)
+{
+ int *ptr = calloc(1.7 * n, sizeof (int)); /* { dg-line test_4 } */
+ free (ptr);
+
+ /* { dg-warning "use of floating-point arithmetic here might yield unexpected results" "warning" { target *-*-* } test_4 } */
+ /* { dg-message "operand '\(\\d|e|f|\\.|\\+|\)+' is of type 'double'" "note" { target *-*-* } test_4 } */
+ /* { dg-message "only use operands of an integer type inside the size argument" "note" { target *-*-* } test_4 } */
+}
+
+int test_5 (float f)
+{
+ int *ptr = __builtin_alloca (sizeof (int) * f); /* { dg-line test_5 } */
+ *ptr = 4;
+ return *ptr;
+
+ /* { dg-warning "use of floating-point arithmetic here might yield unexpected results" "warning" { target *-*-* } test_5 } */
+ /* { dg-message "operand 'f' is of type 'float'" "note" { target *-*-* } test_5 } */
+ /* { dg-message "only use operands of an integer type inside the size argument" "note" { target *-*-* } test_5 } */
+}
+
+int test_6 (float f)
+{
+ int *ptr = __builtin_alloca (1.7f * f * 2.3f); /* { dg-line test_6 } */
+ *ptr = 4;
+ return *ptr;
+
+ /* { dg-warning "use of floating-point arithmetic here might yield unexpected results" "warning" { target *-*-* } test_6 } */
+ /* { dg-message "operand 'f' is of type 'float'" "note" { target *-*-* } test_6 } */
+ /* { dg-message "only use operands of an integer type inside the size argument" "note" { target *-*-* } test_6 } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/memcpy-2.c b/gcc/testsuite/gcc.dg/analyzer/memcpy-2.c
index 88ec84c..51e4a69 100644
--- a/gcc/testsuite/gcc.dg/analyzer/memcpy-2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/memcpy-2.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-Wno-stringop-overflow" } */
+/* { dg-additional-options "-Wno-stringop-overflow -Wno-analyzer-out-of-bounds" } */
void
main (int c, void *v)
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-1.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-1.c
new file mode 100644
index 0000000..9f3cda6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-1.c
@@ -0,0 +1,120 @@
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+#include <stdio.h>
+
+/* Wanalyzer-out-of-bounds tests for buffer overflows. */
+
+/* Avoid folding of memcpy. */
+typedef void * (*memcpy_t) (void *dst, const void *src, size_t n);
+
+static memcpy_t __attribute__((noinline))
+get_memcpy (void)
+{
+ return memcpy;
+}
+
+
+/* Taken from CWE-787. */
+void test1 (void)
+{
+ int id_sequence[3];
+
+ id_sequence[0] = 123;
+ id_sequence[1] = 234;
+ id_sequence[2] = 345;
+ id_sequence[3] = 456; /* { dg-line test1 } */
+
+ /* { dg-warning "overflow" "warning" { target *-*-* } test1 } */
+ /* { dg-message "" "note" { target *-*-* } test1 } */
+}
+
+void test2 (void)
+{
+ int n = 4;
+ int arr[4];
+
+ for (int i = n - 1; i >= 0; i--)
+ arr[i] = i;
+}
+
+void test3 (void)
+{
+ int n = 4;
+ int arr[4];
+
+ for (int i = n; i >= 0; i--)
+ arr[i] = i; /* { dg-line test3 } */
+
+ /* { dg-warning "overflow" "warning" { target *-*-* } test3 } */
+ /* { dg-message "" "note" { target *-*-* } test3 } */
+}
+
+void test4 (void)
+{
+ int *arr = malloc (4 * sizeof (int));
+ if (!arr)
+ return;
+
+ int *last_el = arr + 3;
+ *last_el = 3;
+
+ free (arr);
+}
+
+void test5 (void)
+{
+ int *arr = malloc (4 * sizeof (int));
+ if (!arr)
+ return;
+
+ int *last_el = arr + 4;
+ *last_el = 4; /* { dg-line test5 } */
+
+ free (arr);
+ /* { dg-warning "overflow" "warning" { target *-*-* } test5 } */
+ /* { dg-message "" "note" { target *-*-* } test5 } */
+}
+
+/* Taken from "A Provenance-aware Memory Object Model for C". */
+int y = 2, x = 1; /* { dg-message "capacity" } */
+void test6 (void)
+{
+ int *p = &x + 1;
+ int *q = &y;
+ printf ("Addresses: p=% p q=% p \n" , (void *) p, (void *) q);
+ if (memcmp (&p , &q , sizeof (p)) == 0)
+ {
+ *p = 11; /* { dg-line test6b } */
+ printf ("x=%d y=%d *p=%d *q=%d\n" , x, y, *p, *q); /* { dg-line test6c } */
+ }
+
+ /* { dg-warning "overflow" "warning" { target *-*-* } test6b } */
+ /* { dg-message "" "note" { target *-*-* } test6b } */
+ /* { dg-warning "overread" "warning" { target *-*-* } test6c } */
+ /* { dg-message "" "note" { target *-*-* } test6c } */
+}
+
+extern int is_valid (void);
+
+int returnChunkSize (void *ptr)
+{
+ /* If chunk info is valid, return the size of usable memory,
+ else, return -1 to indicate an error. */
+ return is_valid () ? sizeof (*ptr) : -1;
+}
+
+/* Taken from CWE-787. */
+void test7 (void)
+{
+ memcpy_t fn = get_memcpy ();
+
+ int destBuf[4];
+ int srcBuf[4];
+ fn (destBuf, srcBuf, returnChunkSize (destBuf)); /* { dg-line test7 } */
+
+ // TODO: Should we handle widening_svalues as a follow-up?
+ /* { dg-warning "overread" "warning" { xfail *-*-* } test7 } */
+ /* { dg-warning "overflow" "warning" { xfail *-*-* } test7 } */
+ /* { dg-message "" "note" { xfail *-*-* } test7 } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-2.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-2.c
new file mode 100644
index 0000000..0df9364
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-2.c
@@ -0,0 +1,83 @@
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdint.h>
+
+/* Wanalyzer-out-of-bounds tests for buffer overreads. */
+
+/* Avoid folding of memcpy. */
+typedef void * (*memcpy_t) (void *dst, const void *src, size_t n);
+
+static memcpy_t __attribute__((noinline))
+get_memcpy (void)
+{
+ return memcpy;
+}
+
+
+void test1 (void)
+{
+ int id_sequence[3];
+ memset (id_sequence, 0, 3 * sizeof(int));
+ printf ("%i", id_sequence[3]); /* { dg-line test1 } */
+
+ /* { dg-warning "overread" "warning" { target *-*-* } test1 } */
+ /* { dg-message "" "note" { target *-*-* } test1 } */
+}
+
+void test2 (void)
+{
+ int n = 4;
+ int arr[n];
+ memset (arr, 0, n * sizeof (int));
+
+ int sum = 0;
+ for (int i = n - 1; i >= 0; i--)
+ sum += arr[i];
+}
+
+void test3 (void)
+{
+ int n = 4;
+ int arr[4];
+ memset (arr, 0, n * sizeof (int));
+
+ int sum = 0;
+ for (int i = n; i > 0; i--)
+ sum += arr[i]; /* { dg-line test3 } */
+
+ /* { dg-warning "overread" "warning" { target *-*-* } test3 } */
+ /* { dg-message "" "note" { target *-*-* } test3 } */
+}
+
+void test4 (void)
+{
+ int n = 4;
+ int *arr = malloc (n * sizeof (int));
+ if (!arr)
+ return;
+ memset (arr, 0, n * sizeof(int));
+
+ int sum = 0;
+ for (int i = n - 1; i >= 0; i--)
+ sum += *(arr + i);
+
+ free (arr);
+}
+
+void test5 (void)
+{
+ int n = 4;
+ int *arr = malloc (n * sizeof (int));
+ if (!arr)
+ return;
+ memset (arr, 0, n * sizeof(int));
+
+ int sum = 0;
+ for (int i = n; i > 0; i--)
+ sum += *(arr + i); /* { dg-line test5 } */
+
+ free (arr);
+ /* { dg-warning "overread" "warning" { target *-*-* } test5 } */
+ /* { dg-message "" "note" { target *-*-* } test5 } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-3.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-3.c
new file mode 100644
index 0000000..7446b18
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-3.c
@@ -0,0 +1,91 @@
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+
+/* Wanalyzer-out-of-bounds tests for buffer underreads and writes. */
+
+/* Avoid folding of memcpy. */
+typedef void * (*memcpy_t) (void *dst, const void *src, size_t n);
+static memcpy_t __attribute__((noinline))
+get_memcpy (void)
+{
+ return memcpy;
+}
+
+
+void test1 (void)
+{
+ int buf[4];
+ int *e = buf - 1;
+ *e = 42; /* { dg-line test1 } */
+
+ /* { dg-warning "underflow" "warning" { target *-*-* } test1 } */
+ /* { dg-message "" "note" { target *-*-* } test1 } */
+}
+
+void test2 (void)
+{
+ int buf[4];
+ int *e = buf + 1;
+ *e = 123;
+ *(e - 1) = 321;
+}
+
+void test3 (void)
+{
+ int buf[4];
+ int *e = buf + 1;
+ *e = 123;
+ *(e - 2) = 321; /* { dg-line test3 } */
+
+ /* { dg-warning "underflow" "warning" { target *-*-* } test3 } */
+ /* { dg-message "" "note" { target *-*-* } test3 } */
+}
+
+void test4 (void)
+{
+ memcpy_t fn = get_memcpy ();
+ int buf[4];
+ memset (buf, 1, 4 * sizeof (int));
+ int n = -4;
+ fn (&(buf[n]), buf, sizeof (int)); /* { dg-line test4 } */
+
+ /* { dg-warning "underflow" "warning" { target *-*-* } test4 } */
+ /* { dg-message "" "note" { target *-*-* } test4 } */
+}
+
+void test5 (void)
+{
+ int buf[4];
+ memset (buf, 1, 4 * sizeof (int));
+
+ int sum = 0;
+ for (int i = 4; i >= 0; i++)
+ sum += *(buf - i); /* { dg-line test5 } */
+
+ /* { dg-warning "underread" "warning" { target *-*-* } test5 } */
+ /* { dg-message "" "note" { target *-*-* } test5 } */
+}
+
+void test6 (void)
+{
+ int buf[4];
+ memset (buf, 1, 4 * sizeof (int));
+
+ int *view = buf + 1;
+ int sum = 0;
+ for (int i = 0; i < 4; i++)
+ sum += *(view++);
+}
+
+void test8 (void)
+{
+ memcpy_t fn = get_memcpy ();
+ int buf[4];
+ memset (buf, 1, 4 * sizeof (int));
+ int n = -4;
+ fn (buf, &(buf[n]), sizeof (int)); /* { dg-line test8 } */
+
+ /* { dg-warning "underread" "warning" { target *-*-* } test8 } */
+ /* { dg-message "" "note" { target *-*-* } test8 } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-4.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-4.c
new file mode 100644
index 0000000..46f600d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-4.c
@@ -0,0 +1,65 @@
+/* { dg-additional-options "-Wno-stringop-overflow -Wno-stringop-truncation" } */
+#include <string.h>
+
+/* Wanalyzer-out-of-bounds tests for strpy-related overflows.
+
+ The intra-procedural tests are all caught by Wstringop-overflow.
+ The inter-procedural out-of-bounds are only found by the analyzer. */
+
+void test1 (void)
+{
+ char dst[5];
+ strcpy (dst, "Hello"); /* { dg-line test1 } */
+
+ /* { dg-warning "overflow" "warning" { target *-*-* } test1 } */
+ /* { dg-message "dst" "note" { target *-*-* } test1 } */
+}
+
+void test2 (void)
+{
+ char dst[6];
+ strcpy (dst, "Hello");
+}
+
+void test3 (void)
+{
+ char *src = "Hello";
+ char dst[5];
+ strcpy (dst, src); /* { dg-line test3 } */
+
+ /* { dg-warning "overflow" "warning" { target *-*-* } test3 } */
+ /* { dg-message "dst" "note" { target *-*-* } test3 } */
+}
+
+void test4 (void)
+{
+ char *src = "Hello";
+ char dst[6];
+ strcpy (dst, src);
+}
+
+const char *return_hello (void)
+{
+ return "hello";
+}
+
+void test5 (void)
+{
+ const char *str = return_hello ();
+ if (!str)
+ return;
+ char dst[5];
+ strcpy (dst, str); /* { dg-line test5 } */
+
+ /* { dg-warning "overflow" "warning" { target *-*-* } test5 } */
+ /* { dg-message "dst" "note" { target *-*-* } test5 } */
+}
+
+void test6 (void)
+{
+ const char *str = return_hello ();
+ if (!str)
+ return;
+ char dst[6];
+ strcpy (dst, str);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-5.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-5.c
new file mode 100644
index 0000000..7dc0bc5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-5.c
@@ -0,0 +1,156 @@
+/* { dg-additional-options "-Wno-unused-but-set-variable" } */
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <alloca.h>
+#include <stdint.h>
+
+/* Tests with symbolic values. */
+
+void test1 (size_t size)
+{
+ char *buf = __builtin_malloc (size);
+ if (!buf) return;
+
+ buf[size] = '\0'; /* { dg-warning "overflow" } */
+ free (buf);
+}
+
+void test2 (size_t size)
+{
+ char *buf = __builtin_malloc (size);
+ if (!buf) return;
+
+ buf[size + 1] = '\0'; /* { dg-warning "overflow" } */
+ free (buf);
+}
+
+void test3 (size_t size, size_t op)
+{
+ char *buf = __builtin_malloc (size);
+ if (!buf) return;
+
+ buf[size + op] = '\0'; /* { dg-warning "overflow" } */
+ free (buf);
+}
+
+void test4 (size_t size, unsigned short s)
+{
+ char *buf = __builtin_alloca (size);
+ buf[size + s] = '\0'; /* { dg-warning "overflow" } */
+}
+
+void test5 (size_t size)
+{
+ int32_t *buf = __builtin_alloca (4 * size);
+ buf[size] = 42; /* { dg-warning "overflow" } */
+}
+
+void test6 (size_t size)
+{
+ int32_t *buf = __builtin_alloca (4 * size);
+ memset (buf, 0, 4 * size);
+ int32_t last = *(buf + 4 * size); /* { dg-warning "overread" } */
+}
+
+void test7 (size_t size)
+{
+ int32_t *buf = __builtin_alloca (4 * size + 3); /* { dg-warning "allocated buffer size is not a multiple of the pointee's size" } */
+ buf[size] = 42; /* { dg-warning "overflow" } */
+}
+
+/* Test where the offset itself is not out-of-bounds
+ but multiple bytes are read. */
+
+void test8 (size_t size, size_t offset)
+{
+ char src[size];
+ char dst[size];
+ memcpy (dst, src, size + offset); /* { dg-line test8 } */
+ /* { dg-warning "overread" "warning" { target *-*-* } test8 } */
+ /* { dg-warning "overflow" "warning" { target *-*-* } test8 } */
+}
+
+void test9 (size_t size, size_t offset)
+{
+ int32_t src[size];
+ int32_t dst[size];
+ memcpy (dst, src, 4 * size + 1); /* { dg-line test9 } */
+ /* { dg-warning "overread" "warning" { target *-*-* } test9 } */
+ /* { dg-warning "overflow" "warning" { target *-*-* } test9 } */
+}
+
+/* Test for no false-positives. */
+
+void test10 (size_t size)
+{
+ int32_t buf[4 * size];
+ /* 4 * size is smaller than 4 * 4 * size. */
+ buf[size] = 42;
+}
+
+void test11 (size_t size)
+{
+ int32_t *buf = __builtin_alloca (4 * size + 5); /* { dg-warning "allocated buffer size is not a multiple of the pointee's size" } */
+ buf[size] = 42;
+}
+
+void test12 (size_t size, size_t offset)
+{
+ int buf[size];
+ buf[offset] = 42;
+}
+
+void test13 (size_t size, int offset)
+{
+ int buf[size];
+ /* We don't know whether offset is positive or not. */
+ buf[size + offset] = 42;
+}
+
+void test14 (size_t size, size_t offset, size_t offset2)
+{
+ int buf[size];
+ /* We don't know whether offset > offset2. */
+ buf[size + offset - offset2] = 42;
+}
+
+void test15 (size_t a, size_t b)
+{
+ int buf[a * b];
+ /* We can't reason about a*b < a+b either. */
+ buf[a + b] = 42;
+}
+
+/* Misc. */
+
+char *test98 (const char *x, const char *y)
+{
+ size_t len_x = __builtin_strlen (x);
+ size_t len_y = __builtin_strlen (y);
+ size_t sz = len_x + len_y + 1;
+ char *result = __builtin_malloc (sz);
+ if (!result)
+ return NULL;
+ __builtin_memcpy (result, x, len_x);
+ __builtin_memcpy (result + len_x, y, len_y);
+ result[len_x + len_y] = '\0';
+ return result;
+}
+
+char *test99 (const char *x, const char *y)
+{
+ size_t len_x = __builtin_strlen (x);
+ size_t len_y = __builtin_strlen (y);
+ /* BUG (root cause): forgot to add 1 for terminator. */
+ size_t sz = len_x + len_y;
+ char *result = __builtin_malloc (sz);
+ if (!result)
+ return NULL;
+ __builtin_memcpy (result, x, len_x);
+ __builtin_memcpy (result + len_x, y, len_y);
+ /* BUG (symptom): off-by-one out-of-bounds write to heap. */
+ result[len_x + len_y] = '\0'; /* { dg-warning "overflow" } */
+ return result;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-container_of.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-container_of.c
new file mode 100644
index 0000000..172ec47
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-container_of.c
@@ -0,0 +1,51 @@
+/* Further reduced container_of pattern from the Linux Kernel. */
+
+struct inner {
+ /* Don't care */
+};
+
+struct outer {
+ int i;
+ struct inner inner_struct;
+};
+
+struct outer *container_of (struct inner *ptr_to_inner)
+{
+ struct outer *ptr_to_outer = ((struct outer *) (((void *) ptr_to_inner) - __builtin_offsetof(struct outer, inner_struct)));
+ return ptr_to_outer;
+}
+
+int test (struct outer *outer_p, struct inner *inner_p)
+{
+ struct outer test;
+ test.i = 42;
+ struct inner test2;
+ int sum = 0;
+ struct outer *o;
+
+ /* Symbolic inner struct. */
+ o = container_of (inner_p);
+ sum += o->i; // ok
+ /* Not ok, but we can't be sure that outer
+ is actually the container of inner. */
+ sum += (o - 1)->i;
+ /* Symbolic outer struct. */
+ o = container_of (&(outer_p->inner_struct));
+ sum += o->i; // ok
+ /* Not ok, but indistinguishable from the case above. */
+ sum += (o - 1)->i;
+ /* Concrete outer struct. */
+ o = container_of (&(test.inner_struct));
+ sum += o->i; // ok
+ /* Not ok and we do have a concrete region. */
+ sum += (o - 1)->i; /* { dg-line testA } */
+ /* Concrete inner struct, has no container. */
+ o = container_of (&test2);
+ sum += o->i; /* { dg-line testB } */
+
+ return sum;
+ /* { dg-warning "underread" "warning" { target *-*-* } testA } */
+ /* { dg-message "" "note" { target *-*-* } testA } */
+ /* { dg-warning "underread" "warning" { target *-*-* } testB } */
+ /* { dg-message "" "note" { target *-*-* } testB } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-coreutils.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-coreutils.c
new file mode 100644
index 0000000..cd0f4b7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-coreutils.c
@@ -0,0 +1,29 @@
+/* Reduced from coreutils/ls.c attach. */
+
+void add_zero_terminator (char *buf)
+{
+ char *end = buf;
+ while (end++);
+ if (buf < end)
+ end[-1] = '\0';
+}
+
+/* Reduced from coreutils/cat.c. */
+
+#define LINE_COUNTER_BUF_LEN 20
+static char line_buf[LINE_COUNTER_BUF_LEN] =
+ {
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '0',
+ '\t', '\0'
+ };
+
+/* Position of the first digit in 'line_buf'. */
+static char *line_num_start = line_buf + LINE_COUNTER_BUF_LEN - 3;
+
+static void
+next_line_num (void)
+{
+ if (line_num_start > line_buf)
+ *--line_num_start = '1';
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-curl.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-curl.c
new file mode 100644
index 0000000..e34b572
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-curl.c
@@ -0,0 +1,41 @@
+/* { dg-additional-options "-O2" } */
+#include <string.h>
+
+/* Reduced from curl lib/smb.c. */
+typedef int CURLcode;
+
+struct smb_conn {
+ // [...]
+ char *user;
+};
+
+struct smb_setup {
+ // [...]
+ char bytes[48];
+} __attribute__((packed));
+
+struct connectdata {
+ // [...]
+ struct smb_conn *smbc;
+};
+
+CURLcode smb_send_setup (struct connectdata *conn)
+{
+ struct smb_conn *smbc = conn->smbc;
+ struct smb_setup msg;
+ char *p = msg.bytes;
+ unsigned char lm[24];
+
+ /* Init to prevent uninit warning. */
+ memset(&msg, 0, sizeof(msg));
+ memset (&lm, 0, sizeof(lm));
+
+ memcpy(p, lm, sizeof(lm));
+ p += sizeof(lm);
+ /* Had a false-positive overflow at p. Checker had a number of bytes copied
+ relative to the start but offset points in the middle the field. */
+ strcpy(p, (smbc->user));
+ p += strlen(smbc->user) + 1;
+
+ return 1;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-read-char-arr.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-read-char-arr.c
new file mode 100644
index 0000000..61cbfc7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-read-char-arr.c
@@ -0,0 +1,55 @@
+char arr[10]; /* { dg-message "capacity is 10 bytes" } */
+
+char int_arr_read_element_before_start_far(void)
+{
+ return arr[-100]; /* { dg-warning "buffer underread" "warning" } */
+ /* { dg-message "out-of-bounds read at byte -100 but 'arr' starts at byte 0" "final event" { target *-*-* } .-1 } */
+}
+
+char int_arr_read_element_before_start_near(void)
+{
+ return arr[-2]; /* { dg-warning "buffer underread" "warning" } */
+ /* { dg-message "out-of-bounds read at byte -2 but 'arr' starts at byte 0" "final event" { target *-*-* } .-1 } */
+}
+
+char int_arr_read_element_before_start_off_by_one(void)
+{
+ return arr[-1]; /* { dg-warning "buffer underread" "warning" } */
+ /* { dg-message "out-of-bounds read at byte -1 but 'arr' starts at byte 0" "final event" { target *-*-* } .-1 } */
+}
+
+char int_arr_read_element_at_start(void)
+{
+ return arr[0];
+}
+
+char int_arr_read_element_at_end(void)
+{
+ return arr[9];
+}
+
+char int_arr_read_element_after_end_off_by_one(void)
+{
+ return arr[10]; /* { dg-warning "buffer overread" "warning" } */
+ /* { dg-message "out-of-bounds read at byte 10 but 'arr' ends at byte 10" "final event" { target *-*-* } .-1 } */
+ /* { dg-message "read is 1 bytes past the end of 'arr'" "note" { target *-*-* } .-2 } */
+ // FIXME(PR 106626): "1 bytes"
+}
+
+char int_arr_read_element_after_end_near(void)
+{
+ return arr[11]; /* { dg-warning "buffer overread" "warning" } */
+ /* { dg-message "out-of-bounds read at byte 11 but 'arr' ends at byte 10" "final event" { target *-*-* } .-1 } */
+ /* { dg-message "read is 1 bytes past the end of 'arr'" "note" { target *-*-* } .-2 } */
+ // FIXME(PR 106626): is the note correct?
+ // FIXME(PR 106626): "1 bytes"
+}
+
+char int_arr_read_element_after_end_far(void)
+{
+ return arr[100]; /* { dg-warning "buffer overread" "warning" } */
+ /* { dg-message "out-of-bounds read at byte 100 but 'arr' ends at byte 10" "final event" { target *-*-* } .-1 } */
+ /* { dg-message "read is 1 bytes past the end of 'arr'" "note" { target *-*-* } .-2 } */
+ // FIXME(PR 106626): the note seems incorrect (size of access is 1 byte, but magnitude beyond boundary is 90)
+ // FIXME(PR 106626): "1 bytes"
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-read-int-arr.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-read-int-arr.c
new file mode 100644
index 0000000..0bb30d2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-read-int-arr.c
@@ -0,0 +1,54 @@
+#include <stdint.h>
+
+int32_t arr[10]; /* { dg-message "capacity is 40 bytes" } */
+
+int32_t int_arr_read_element_before_start_far(void)
+{
+ return arr[-100]; /* { dg-warning "buffer underread" "warning" } */
+ /* { dg-message "out-of-bounds read from byte -400 till byte -397 but 'arr' starts at byte 0" "final event" { target *-*-* } .-1 } */
+}
+
+int32_t int_arr_read_element_before_start_near(void)
+{
+ return arr[-2]; /* { dg-warning "buffer underread" "warning" } */
+ /* { dg-message "out-of-bounds read from byte -8 till byte -5 but 'arr' starts at byte 0" "final event" { target *-*-* } .-1 } */
+}
+
+int32_t int_arr_read_element_before_start_off_by_one(void)
+{
+ return arr[-1]; /* { dg-warning "buffer underread" "warning" } */
+ /* { dg-message "out-of-bounds read from byte -4 till byte -1 but 'arr' starts at byte 0" "final event" { target *-*-* } .-1 } */
+}
+
+int32_t int_arr_read_element_at_start(void)
+{
+ return arr[0];
+}
+
+int32_t int_arr_read_element_at_end(void)
+{
+ return arr[9];
+}
+
+int32_t int_arr_read_element_after_end_off_by_one(void)
+{
+ return arr[10]; /* { dg-warning "buffer overread" "warning" } */
+ /* { dg-message "out-of-bounds read from byte 40 till byte 43 but 'arr' ends at byte 40" "final event" { target *-*-* } .-1 } */
+ /* { dg-message "read is 4 bytes past the end of 'arr'" "note" { target *-*-* } .-2 } */
+}
+
+int32_t int_arr_read_element_after_end_near(void)
+{
+ return arr[11]; /* { dg-warning "buffer overread" "warning" } */
+ /* { dg-message "out-of-bounds read from byte 44 till byte 47 but 'arr' ends at byte 40" "final event" { target *-*-* } .-1 } */
+ /* { dg-message "read is 4 bytes past the end of 'arr'" "note" { target *-*-* } .-2 } */
+ // FIXME(PR 106626): is the note correct?
+}
+
+int32_t int_arr_read_element_after_end_far(void)
+{
+ return arr[100]; /* { dg-warning "buffer overread" "warning" } */
+ /* { dg-message "out-of-bounds read from byte 400 till byte 403 but 'arr' ends at byte 40" "final event" { target *-*-* } .-1 } */
+ /* { dg-message "read is 4 bytes past the end of 'arr'" "note" { target *-*-* } .-2 } */
+ // FIXME(PR 106626): the note seems incorrect (size of access is 4 bytes, but magnitude beyond boundary is 390-393)
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-realloc-grow.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-realloc-grow.c
new file mode 100644
index 0000000..707611e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-realloc-grow.c
@@ -0,0 +1,87 @@
+/* { dg-additional-options "-Wno-analyzer-too-complex" } */
+
+/* Reduced from gnulib/read-file.c.
+
+ Tests that there is no false-positive on
+ realloc when the buffer is growing. */
+
+#include <stdlib.h>
+
+/* Indicate that the file is treated as binary. */
+#define RF_BINARY 0x1
+
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <errno.h>
+
+char *
+fread_file (FILE *stream, int flags, size_t *length)
+{
+ char *buf = NULL;
+ size_t alloc = BUFSIZ;
+
+ if (!(buf = malloc (alloc)))
+ return NULL; /* errno is ENOMEM. */
+
+ {
+ size_t size = 0; /* number of bytes read so far */
+ int save_errno;
+
+ for (;;)
+ {
+ /* This reads 1 more than the size of a regular file
+ so that we get eof immediately. */
+ size_t requested = alloc - size;
+ size_t count = fread (buf + size, 1, requested, stream);
+ size += count;
+
+ {
+ char *new_buf;
+
+ if (alloc < PTRDIFF_MAX - alloc / 2)
+ alloc = alloc + alloc / 2;
+ else
+ alloc = PTRDIFF_MAX;
+
+ if (!(new_buf = realloc (buf, alloc)))
+ {
+ save_errno = errno;
+ break;
+ }
+
+ buf = new_buf;
+ }
+ }
+
+ free (buf);
+ errno = save_errno;
+ return NULL;
+ }
+}
+
+/* Open and read the contents of FILENAME, and return a newly
+ allocated string with the content, and set *LENGTH to the length of
+ the string. The string is zero-terminated, but the terminating
+ zero byte is not counted in *LENGTH. On errors, *LENGTH is
+ undefined, errno preserves the values set by system functions (if
+ any), and NULL is returned.
+ If the RF_BINARY flag is set in FLAGS, the file is opened in binary
+ mode. If the RF_SENSITIVE flag is set in FLAGS, the memory buffer
+ internally allocated will be cleared upon failure. */
+char *
+read_file (const char *filename, int flags, size_t *length)
+{
+ const char *mode = (flags & RF_BINARY) ? "rbe" : "re";
+ FILE *stream = fopen (filename, mode);
+ char *out;
+
+ if (!stream)
+ return NULL;
+
+ out = fread_file (stream, flags, length);
+
+ fclose (stream);
+
+ return out;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-write-char-arr.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-write-char-arr.c
new file mode 100644
index 0000000..47fbc52
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-write-char-arr.c
@@ -0,0 +1,55 @@
+char arr[10]; /* { dg-message "capacity is 10 bytes" } */
+
+void int_arr_write_element_before_start_far(char x)
+{
+ arr[-100] = x; /* { dg-warning "buffer underflow" "warning" } */
+ /* { dg-message "out-of-bounds write at byte -100 but 'arr' starts at byte 0" "final event" { target *-*-* } .-1 } */
+}
+
+void int_arr_write_element_before_start_near(char x)
+{
+ arr[-2] = x; /* { dg-warning "buffer underflow" "warning" } */
+ /* { dg-message "out-of-bounds write at byte -2 but 'arr' starts at byte 0" "final event" { target *-*-* } .-1 } */
+}
+
+void int_arr_write_element_before_start_off_by_one(char x)
+{
+ arr[-1] = x; /* { dg-warning "buffer underflow" "warning" } */
+ /* { dg-message "out-of-bounds write at byte -1 but 'arr' starts at byte 0" "final event" { target *-*-* } .-1 } */
+}
+
+void int_arr_write_element_at_start(char x)
+{
+ arr[0] = x;
+}
+
+void int_arr_write_element_at_end(char x)
+{
+ arr[9] = x;
+}
+
+void int_arr_write_element_after_end_off_by_one(char x)
+{
+ arr[10] = x; /* { dg-warning "buffer overflow" "warning" } */
+ /* { dg-message "out-of-bounds write at byte 10 but 'arr' ends at byte 10" "final event" { target *-*-* } .-1 } */
+ /* { dg-message "write is 1 bytes past the end of 'arr'" "note" { target *-*-* } .-2 } */
+ // FIXME(PR 106626): "1 bytes"
+}
+
+void int_arr_write_element_after_end_near(char x)
+{
+ arr[11] = x; /* { dg-warning "buffer overflow" "warning" } */
+ /* { dg-message "out-of-bounds write at byte 11 but 'arr' ends at byte 10" "final event" { target *-*-* } .-1 } */
+ /* { dg-message "write is 1 bytes past the end of 'arr'" "note" { target *-*-* } .-2 } */
+ // FIXME(PR 106626): is the note correct?
+ // FIXME(PR 106626): "1 bytes"
+}
+
+void int_arr_write_element_after_end_far(char x)
+{
+ arr[100] = x; /* { dg-warning "buffer overflow" "warning" } */
+ /* { dg-message "out-of-bounds write at byte 100 but 'arr' ends at byte 10" "final event" { target *-*-* } .-1 } */
+ /* { dg-message "write is 1 bytes past the end of 'arr'" "note" { target *-*-* } .-2 } */
+ // FIXME(PR 106626): the note seems incorrect (size of access is 1 byte, but magnitude beyond boundary is 90)
+ // FIXME(PR 106626): "1 bytes"
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-write-int-arr.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-write-int-arr.c
new file mode 100644
index 0000000..bf9760e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-write-int-arr.c
@@ -0,0 +1,54 @@
+#include <stdint.h>
+
+int32_t arr[10]; /* { dg-message "capacity is 40 bytes" } */
+
+void int_arr_write_element_before_start_far(int32_t x)
+{
+ arr[-100] = x; /* { dg-warning "buffer underflow" "warning" } */
+ /* { dg-message "out-of-bounds write from byte -400 till byte -397 but 'arr' starts at byte 0" "final event" { target *-*-* } .-1 } */
+}
+
+void int_arr_write_element_before_start_near(int32_t x)
+{
+ arr[-2] = x; /* { dg-warning "buffer underflow" "warning" } */
+ /* { dg-message "out-of-bounds write from byte -8 till byte -5 but 'arr' starts at byte 0" "final event" { target *-*-* } .-1 } */
+}
+
+void int_arr_write_element_before_start_off_by_one(int32_t x)
+{
+ arr[-1] = x; /* { dg-warning "buffer underflow" "warning" } */
+ /* { dg-message "out-of-bounds write from byte -4 till byte -1 but 'arr' starts at byte 0" "final event" { target *-*-* } .-1 } */
+}
+
+void int_arr_write_element_at_start(int32_t x)
+{
+ arr[0] = x;
+}
+
+void int_arr_write_element_at_end(int32_t x)
+{
+ arr[9] = x;
+}
+
+void int_arr_write_element_after_end_off_by_one(int32_t x)
+{
+ arr[10] = x; /* { dg-warning "buffer overflow" "warning" } */
+ /* { dg-message "out-of-bounds write from byte 40 till byte 43 but 'arr' ends at byte 40" "final event" { target *-*-* } .-1 } */
+ /* { dg-message "write is 4 bytes past the end of 'arr'" "note" { target *-*-* } .-2 } */
+}
+
+void int_arr_write_element_after_end_near(int32_t x)
+{
+ arr[11] = x; /* { dg-warning "buffer overflow" "warning" } */
+ /* { dg-message "out-of-bounds write from byte 44 till byte 47 but 'arr' ends at byte 40" "final event" { target *-*-* } .-1 } */
+ /* { dg-message "write is 4 bytes past the end of 'arr'" "note" { target *-*-* } .-2 } */
+ // FIXME(PR 106626): is the note correct?
+}
+
+void int_arr_write_element_after_end_far(int32_t x)
+{
+ arr[100] = x; /* { dg-warning "buffer overflow" "warning" } */
+ /* { dg-message "out-of-bounds write from byte 400 till byte 403 but 'arr' ends at byte 40" "final event" { target *-*-* } .-1 } */
+ /* { dg-message "write is 4 bytes past the end of 'arr'" "note" { target *-*-* } .-2 } */
+ // FIXME(PR 106626): the note seems incorrect (size of access is 4 bytes, but magnitude beyond boundary is 390-393)
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-zero.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-zero.c
new file mode 100644
index 0000000..201ca00
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-zero.c
@@ -0,0 +1,67 @@
+/* { dg-additional-options "-Wno-stringop-overflow"} */
+/* -Wstringop-overflow= triggers on test5. */
+
+#include <stdint.h>
+#include <stdlib.h>
+
+void test1 (void)
+{
+ int32_t buf[1];
+ /* Zero bytes written on non-zero allocation. */
+ __builtin_memset (buf, 0, 0);
+}
+
+void test2 (void)
+{
+ /* ISO C forbids zero-size arrays but GCC compiles this to an
+ zero-sized array without -Wpedantic. */
+ int32_t buf[0];
+ /* Write on zero capacity. */
+ __builtin_memset (buf, 0, sizeof (int32_t)); /* { dg-line test2 } */
+
+ /* { dg-warning "overflow" "warning" { target *-*-* } test2 } */
+ /* { dg-message "from byte 0 till byte 3" "final event" { target *-*-* } test2 } */
+}
+
+void test3 (void)
+{
+ int32_t buf[0];
+ /* Zero bytes written on zero capacity. */
+ __builtin_memset (buf, 0, 0);
+}
+
+void test4 (void)
+{
+ int32_t *buf = malloc (sizeof (int32_t));
+ if (!buf)
+ return;
+
+ /* Zero bytes written on non-zero allocation. */
+ __builtin_memset (buf, 0, 0);
+ free (buf);
+}
+
+void test5 (void)
+{
+ int32_t *buf = malloc (0);
+ if (!buf)
+ return;
+
+ /* Write on zero capacity. */
+ __builtin_memset (buf, 0, sizeof (int32_t)); /* { dg-line test5 } */
+ free (buf);
+
+ /* { dg-warning "overflow" "warning" { target *-*-* } test5 } */
+ /* { dg-message "from byte 0 till byte 3" "final event" { target *-*-* } test5 } */
+}
+
+void test6 (void)
+{
+ int32_t *buf = malloc (0);
+ if (!buf)
+ return;
+
+ /* Zero bytes written on zero capacity. */
+ __builtin_memset (buf, 0, 0);
+ free (buf);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr101962.c b/gcc/testsuite/gcc.dg/analyzer/pr101962.c
index d15820a..cf0041b 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pr101962.c
+++ b/gcc/testsuite/gcc.dg/analyzer/pr101962.c
@@ -22,8 +22,10 @@ test_1 (void)
a = maybe_inc_int_ptr (a);
__analyzer_eval (a == NULL); /* { dg-warning "FALSE" } */
__analyzer_eval (a != NULL); /* { dg-warning "TRUE" } */
- return *a; /* { dg-warning "use of uninitialized value '\\*a'" } */
- /* TODO: a complaint about out-of-bounds would be a better warning. */
+ return *a; /* { dg-line test_1 } */
+
+ /* { dg-warning "use of uninitialized value '\\*a'" "warning" { target *-*-* } test_1 } */
+ /* { dg-warning "overread" "warning" { target *-*-* } test_1 } */
}
static const char * __attribute__((noinline))
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr106181.c b/gcc/testsuite/gcc.dg/analyzer/pr106181.c
new file mode 100644
index 0000000..6a78b78
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr106181.c
@@ -0,0 +1,11 @@
+#include <stdint.h>
+
+void *
+foo (int x)
+{
+ return __builtin_calloc (x * 1.1, 1); /* { dg-line calloc } */
+
+ /* { dg-warning "use of floating-point arithmetic here might yield unexpected results" "warning" { target *-*-* } calloc } */
+ /* { dg-message "operand '\(\\d|e|f|\\.|\\+|\)+' is of type 'double'" "note" { target *-*-* } calloc } */
+ /* { dg-message "only use operands of an integer type inside the size argument" "note" { target *-*-* } calloc } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr106539.c b/gcc/testsuite/gcc.dg/analyzer/pr106539.c
new file mode 100644
index 0000000..fd27086
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr106539.c
@@ -0,0 +1,15 @@
+#include <stdlib.h>
+
+void *test (void)
+{
+ void **p = (void **)malloc (sizeof (void *) * 2);
+ if (!p)
+ return NULL;
+ p[0] = malloc(10);
+ p[1] = malloc(20); /* { dg-message "allocated here" } */
+ void *q = realloc (p, sizeof (void *)); /* { dg-message "when 'realloc' succeeds, moving buffer" } */
+ if (!q)
+ /* { dg-warning "leak of '<unknown>'" "leak of unknown" { target *-*-* } .-1 } */
+ return p;
+ return q;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr106845.c b/gcc/testsuite/gcc.dg/analyzer/pr106845.c
new file mode 100644
index 0000000..528c7b3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr106845.c
@@ -0,0 +1,11 @@
+int buf_size;
+
+int
+main (void)
+{
+ char buf[buf_size];
+
+ __builtin_memset (&buf[1], 0, buf_size);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr96764.c b/gcc/testsuite/gcc.dg/analyzer/pr96764.c
index 70b25d3..6024eba 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pr96764.c
+++ b/gcc/testsuite/gcc.dg/analyzer/pr96764.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-Wno-analyzer-out-of-bounds" } */
+
void
ar (int *hd)
{
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr97029.c b/gcc/testsuite/gcc.dg/analyzer/pr97029.c
index ff83ad4..e3b4531 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pr97029.c
+++ b/gcc/testsuite/gcc.dg/analyzer/pr97029.c
@@ -1,4 +1,6 @@
-struct vj {};
+struct vj {
+ char buf[1];
+};
void
setjmp (struct vj pl)
diff --git a/gcc/testsuite/gcc.dg/analyzer/putenv-1.c b/gcc/testsuite/gcc.dg/analyzer/putenv-1.c
new file mode 100644
index 0000000..4c3f0ae
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/putenv-1.c
@@ -0,0 +1,109 @@
+/* { dg-additional-options "-Wno-analyzer-null-argument" } */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+extern void populate (char *buf);
+
+void test_passthrough (char *s)
+{
+ putenv (s);
+}
+
+void test_str_lit (void)
+{
+ putenv ("NAME=value");
+}
+
+/* glibc allows strings without an equal sign. */
+
+void test_no_eq (void)
+{
+ putenv ("NAME");
+}
+
+void test_empty_string (void)
+{
+ putenv ("");
+}
+
+void test_NULL (void)
+{
+ putenv (NULL); /* possibly -Wanalyzer-null-argument */
+}
+
+void test_auto_buf_name_and_value (const char *name, const char *value)
+{
+ char buf[100]; /* { dg-message "'buf' declared on stack here" } */
+ snprintf (buf, sizeof (buf), "%s=%s", name, value);
+ putenv (buf); /* { dg-warning "'putenv' on a pointer to automatic variable 'buf' \\\[POS34-C\\\]" "warning" } */
+ /* { dg-message "perhaps use 'setenv' rather than 'putenv'" "setenv suggestion" { target *-*-* } .-1 } */
+}
+
+void test_auto_buf_value (const char *value)
+{
+ char buf[100]; /* { dg-message "'buf' declared on stack here" } */
+ snprintf (buf, sizeof (buf), "NAME=%s", value);
+ putenv (buf); /* { dg-warning "'putenv' on a pointer to automatic variable 'buf' \\\[POS34-C\\\]" } */
+}
+
+void test_static_buf (const char *value)
+{
+ static char buf[100];
+ snprintf (buf, sizeof (buf), "NAME=%s", value);
+ putenv (buf);
+}
+
+static char global_buf[1024];
+
+void test_global (const char *value)
+{
+ snprintf (global_buf, sizeof (global_buf), "NAME=%s", value);
+ putenv (global_buf);
+}
+
+void test_alloca (void)
+{
+ char *buf = __builtin_alloca (256); /* { dg-message "region created on stack here" } */
+ populate (buf);
+ putenv (buf); /* { dg-warning "'putenv' on a pointer to an on-stack buffer \\\[POS34-C\\\]" } */
+}
+
+void test_malloc_1 (void)
+{
+ char *buf = malloc (1024);
+ if (!buf)
+ return;
+ populate (buf);
+ putenv (buf);
+}
+
+void test_malloc_2 (void)
+{
+ const char *kvstr = "NAME=value";
+ size_t len = __builtin_strlen (kvstr);
+ char *buf = __builtin_malloc (len + 1);
+ if (!buf)
+ return;
+ __builtin_memcpy (buf, kvstr, len);
+ buf[len] = '\0';
+ putenv (buf); /* { dg-bogus "leak" } */
+}
+
+void test_arr (void)
+{
+ char arr[] = "NAME=VALUE"; /* { dg-message "'arr' declared on stack here" } */
+ putenv (arr); /* { dg-warning "'putenv' on a pointer to automatic variable 'arr' \\\[POS34-C\\\]" } */
+}
+
+static void __attribute__((noinline))
+__analyzer_test_inner (char *kvstr)
+{
+ putenv (kvstr); /* { dg-warning "'putenv' on a pointer to automatic variable 'arr_outer' \\\[POS34-C\\\]" } */
+}
+
+void test_outer (void)
+{
+ char arr_outer[] = "NAME=VALUE"; /* { dg-message "'arr_outer' declared on stack here" } */
+ __analyzer_test_inner (arr_outer);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/realloc-5.c b/gcc/testsuite/gcc.dg/analyzer/realloc-5.c
new file mode 100644
index 0000000..2efe337
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/realloc-5.c
@@ -0,0 +1,45 @@
+#include "analyzer-decls.h"
+
+typedef __SIZE_TYPE__ size_t;
+
+#define NULL ((void *)0)
+
+extern void *malloc (size_t __size)
+ __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__malloc__))
+ __attribute__ ((__alloc_size__ (1)));
+extern void *realloc (void *__ptr, size_t __size)
+ __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__warn_unused_result__))
+ __attribute__ ((__alloc_size__ (2)));
+extern void free (void *__ptr)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern void *memset (void *__ptr, int __value, size_t __size);
+
+/* realloc where the region shrinks on success_with_move. */
+
+void test_1 ()
+{
+ char *p = malloc (16);
+ if (!p)
+ return;
+ memset (p, 1, 16);
+
+ char *q = realloc (p, 8);
+ if (!q)
+ {
+ free (p);
+ return;
+ }
+ else if (p != q)
+ {
+ __analyzer_dump_capacity (q); /* { dg-warning "capacity: '\\(\[^\n\r\]*\\)8'" } */
+ __analyzer_eval (q[8] == 1); /* { dg-line eval } */
+
+ /* { dg-warning "UNKNOWN" "warning" { target *-*-* } eval } */
+ /* { dg-warning "overread" "warning" { target *-*-* } eval } */
+ /* { dg-warning "use of uninitialized value" "warning" { target *-*-* } eval } */
+ }
+
+ free (q);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/strcpy-3.c b/gcc/testsuite/gcc.dg/analyzer/strcpy-3.c
new file mode 100644
index 0000000..a38f9a7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/strcpy-3.c
@@ -0,0 +1,23 @@
+#include <string.h>
+#include "analyzer-decls.h"
+
+void test_1 (void)
+{
+ char str[] = "Hello";
+ char buf[6];
+ char *result = strcpy (buf, str);
+ __analyzer_describe (1, result); /* { dg-warning "region_svalue.*?'buf'" } */
+ __analyzer_eval (result == buf); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[0] == 'H'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[1] == 'e'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[2] == 'l'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[3] == 'l'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[4] == 'o'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (buf[5] == 0); /* { dg-warning "TRUE" } */
+ __analyzer_eval (result[0] == 'H'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (result[1] == 'e'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (result[2] == 'l'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (result[3] == 'l'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (result[4] == 'o'); /* { dg-warning "TRUE" } */
+ __analyzer_eval (result[5] == 0); /* { dg-warning "TRUE" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/symbolic-gt-1.c b/gcc/testsuite/gcc.dg/analyzer/symbolic-gt-1.c
new file mode 100644
index 0000000..140abce
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/symbolic-gt-1.c
@@ -0,0 +1,76 @@
+#include <string.h>
+#include "analyzer-decls.h"
+
+/* Test GT_EXPR comparison of symbolic values. */
+
+void test1 (size_t size)
+{
+ size_t a = 4 * size + 1;
+ size_t b = 4 * size;
+ __analyzer_eval (a > b); /* { dg-warning "TRUE" } */
+}
+
+void test2 (size_t size, size_t offset)
+{
+ size_t a = size + offset;
+ size_t b = size;
+ __analyzer_eval (a > b); /* { dg-warning "TRUE" } */
+}
+
+void test3 (size_t size, size_t offset)
+{
+ size_t a = size * offset;
+ size_t b = size;
+ __analyzer_eval (a > b); /* { dg-warning "TRUE" } */
+}
+
+void test4 (size_t size)
+{
+ size_t op = -1;
+ size_t a = size + op;
+ size_t b = size;
+ __analyzer_eval (a > b); /* { dg-warning "UNKNOWN" } */
+}
+
+void test5 (size_t size)
+{
+ size_t a = size - 1;
+ size_t b = size;
+ __analyzer_eval (a > b); /* { dg-warning "UNKNOWN" } */
+}
+
+void test6 (size_t size, int offset)
+{
+ /* OFFSET is a symbolic integer, thus could be negative. */
+ size_t a = size + offset;
+ size_t b = size;
+ __analyzer_eval (a > b); /* { dg-warning "UNKNOWN" } */
+}
+
+void test7 (size_t size, size_t mul)
+{
+ size_t a = mul * size + 1;
+ size_t b = mul * size;
+ __analyzer_eval (a > b); /* { dg-warning "TRUE" } */
+}
+
+void test8 (size_t size)
+{
+ size_t a = size - 5;
+ size_t b = size - 1;
+ __analyzer_eval (a > b); /* { dg-warning "UNKNOWN" } */
+}
+
+void test9 (size_t size)
+{
+ size_t a = size + 1;
+ size_t b = size + 2;
+ __analyzer_eval (a > b); /* { dg-warning "UNKNOWN" } */
+}
+
+void test10 (size_t size)
+{
+ size_t a = size + 2;
+ size_t b = size + 1;
+ __analyzer_eval (a > b); /* { dg-warning "TRUE" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/test-setjmp.h b/gcc/testsuite/gcc.dg/analyzer/test-setjmp.h
index db24227..52c57d0 100644
--- a/gcc/testsuite/gcc.dg/analyzer/test-setjmp.h
+++ b/gcc/testsuite/gcc.dg/analyzer/test-setjmp.h
@@ -12,7 +12,9 @@
#pragma GCC system_header
-struct __jmp_buf_tag {};
+struct __jmp_buf_tag {
+ char buf[1];
+};
typedef struct __jmp_buf_tag jmp_buf[1];
typedef struct __jmp_buf_tag sigjmp_buf[1];
diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/pr93451.c b/gcc/testsuite/gcc.dg/analyzer/torture/pr93451.c
index 5908bc4..daac745 100644
--- a/gcc/testsuite/gcc.dg/analyzer/torture/pr93451.c
+++ b/gcc/testsuite/gcc.dg/analyzer/torture/pr93451.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-Wno-analyzer-out-of-bounds" } */
+
void
mt (double);
diff --git a/gcc/testsuite/gcc.dg/analyzer/zlib-3.c b/gcc/testsuite/gcc.dg/analyzer/zlib-3.c
index 5098b4f..b05b862 100644
--- a/gcc/testsuite/gcc.dg/analyzer/zlib-3.c
+++ b/gcc/testsuite/gcc.dg/analyzer/zlib-3.c
@@ -182,7 +182,9 @@ static int huft_build(uInt *b, uInt n, uInt s, const uInt *d, const uInt *e,
q[j] = r; /* { dg-warning "use of uninitialized value 'r.base'" } */
mask = (1 << w) - 1;
- while ((i & mask) != x[h]) {
+ /* The analyzer thinks that h can be -1 here.
+ This is probably a false positive. */
+ while ((i & mask) != x[h]) { /* { dg-bogus "underread" "" { xfail *-*-* } } */
h--;
w -= l;
mask = (1 << w) - 1;
diff --git a/gcc/testsuite/gcc.dg/atomic/c2x-stdatomic-lockfree-char8_t.c b/gcc/testsuite/gcc.dg/atomic/c2x-stdatomic-lockfree-char8_t.c
new file mode 100644
index 0000000..1b692f5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic/c2x-stdatomic-lockfree-char8_t.c
@@ -0,0 +1,42 @@
+/* Test atomic_is_lock_free for char8_t. */
+/* { dg-do run } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+#include <stdatomic.h>
+#include <stdint.h>
+
+extern void abort (void);
+
+_Atomic __CHAR8_TYPE__ ac8a;
+atomic_char8_t ac8t;
+
+#define CHECK_TYPE(MACRO, V1, V2) \
+ do \
+ { \
+ int r1 = MACRO; \
+ int r2 = atomic_is_lock_free (&V1); \
+ int r3 = atomic_is_lock_free (&V2); \
+ if (r1 != 0 && r1 != 1 && r1 != 2) \
+ abort (); \
+ if (r2 != 0 && r2 != 1) \
+ abort (); \
+ if (r3 != 0 && r3 != 1) \
+ abort (); \
+ if (r1 == 2 && r2 != 1) \
+ abort (); \
+ if (r1 == 2 && r3 != 1) \
+ abort (); \
+ if (r1 == 0 && r2 != 0) \
+ abort (); \
+ if (r1 == 0 && r3 != 0) \
+ abort (); \
+ } \
+ while (0)
+
+int
+main ()
+{
+ CHECK_TYPE (ATOMIC_CHAR8_T_LOCK_FREE, ac8a, ac8t);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/atomic/c2x-stdatomic-var-init-1.c b/gcc/testsuite/gcc.dg/atomic/c2x-stdatomic-var-init-1.c
new file mode 100644
index 0000000..1978a410
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic/c2x-stdatomic-var-init-1.c
@@ -0,0 +1,9 @@
+/* Test ATOMIC_VAR_INIT not in C2x. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+#include <stdatomic.h>
+
+#ifdef ATOMIC_VAR_INIT
+#error "ATOMIC_VAR_INIT defined"
+#endif
diff --git a/gcc/testsuite/gcc.dg/atomic/gnu2x-stdatomic-lockfree-char8_t.c b/gcc/testsuite/gcc.dg/atomic/gnu2x-stdatomic-lockfree-char8_t.c
new file mode 100644
index 0000000..27a3cfe
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic/gnu2x-stdatomic-lockfree-char8_t.c
@@ -0,0 +1,5 @@
+/* Test atomic_is_lock_free for char8_t with -std=gnu2x. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu2x -pedantic-errors" } */
+
+#include "c2x-stdatomic-lockfree-char8_t.c"
diff --git a/gcc/testsuite/gcc.dg/autopar/pr106737.c b/gcc/testsuite/gcc.dg/autopar/pr106737.c
new file mode 100644
index 0000000..1aa65f5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/autopar/pr106737.c
@@ -0,0 +1,18 @@
+/* { dg-do compile { target fgraphite } } */
+/* { dg-options "-O -floop-parallelize-all -ftree-parallelize-loops=2 -fno-tree-dce" } */
+
+void
+foo (int x)
+{
+ int a[2];
+ int b, c = 0;
+
+ for (b = 0; b < 2; ++b)
+ a[b] = 0;
+ for (b = 0; b < 2; ++b)
+ a[b] = 0;
+
+ while (c < 1)
+ while (x < 1)
+ ++x;
+}
diff --git a/gcc/testsuite/gcc.dg/c11-empty-init-1.c b/gcc/testsuite/gcc.dg/c11-empty-init-1.c
new file mode 100644
index 0000000..120c282
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-empty-init-1.c
@@ -0,0 +1,25 @@
+/* Test C11 does not support empty initializers. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+struct s { int a; };
+struct s s = {}; /* { dg-error "empty initializer" } */
+int x = {}; /* { dg-error "empty initializer" } */
+float y = {}; /* { dg-error "empty initializer" } */
+void *p = {}; /* { dg-error "empty initializer" } */
+union u { int a; long b; };
+union u z = {}; /* { dg-error "empty initializer" } */
+int aa[2] = {}; /* { dg-error "empty initializer" } */
+
+void
+f (int a)
+{
+ int vla[a] = {}; /* { dg-error "empty initializer" } */
+ struct s as = {}; /* { dg-error "empty initializer" } */
+ int ax = {}; /* { dg-error "empty initializer" } */
+ float ay = {}; /* { dg-error "empty initializer" } */
+ void *ap = {}; /* { dg-error "empty initializer" } */
+ union u az = {}; /* { dg-error "empty initializer" } */
+ int aaa[2] = {}; /* { dg-error "empty initializer" } */
+ int t = (int) {}; /* { dg-error "empty initializer" } */
+}
diff --git a/gcc/testsuite/gcc.dg/c11-empty-init-2.c b/gcc/testsuite/gcc.dg/c11-empty-init-2.c
new file mode 100644
index 0000000..3ec7c51
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-empty-init-2.c
@@ -0,0 +1,25 @@
+/* Test C11 does not support empty initializers. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic" } */
+
+struct s { int a; };
+struct s s = {}; /* { dg-warning "empty initializer" } */
+int x = {}; /* { dg-warning "empty initializer" } */
+float y = {}; /* { dg-warning "empty initializer" } */
+void *p = {}; /* { dg-warning "empty initializer" } */
+union u { int a; long b; };
+union u z = {}; /* { dg-warning "empty initializer" } */
+int aa[2] = {}; /* { dg-warning "empty initializer" } */
+
+void
+f (int a)
+{
+ int vla[a] = {}; /* { dg-warning "empty initializer" } */
+ struct s as = {}; /* { dg-warning "empty initializer" } */
+ int ax = {}; /* { dg-warning "empty initializer" } */
+ float ay = {}; /* { dg-warning "empty initializer" } */
+ void *ap = {}; /* { dg-warning "empty initializer" } */
+ union u az = {}; /* { dg-warning "empty initializer" } */
+ int aaa[2] = {}; /* { dg-warning "empty initializer" } */
+ int t = (int) {}; /* { dg-warning "empty initializer" } */
+}
diff --git a/gcc/testsuite/gcc.dg/c11-empty-init-3.c b/gcc/testsuite/gcc.dg/c11-empty-init-3.c
new file mode 100644
index 0000000..fd43fa7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-empty-init-3.c
@@ -0,0 +1,25 @@
+/* Test C11 does not support empty initializers. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -Wc11-c2x-compat" } */
+
+struct s { int a; };
+struct s s = {}; /* { dg-warning "empty initializer" } */
+int x = {}; /* { dg-warning "empty initializer" } */
+float y = {}; /* { dg-warning "empty initializer" } */
+void *p = {}; /* { dg-warning "empty initializer" } */
+union u { int a; long b; };
+union u z = {}; /* { dg-warning "empty initializer" } */
+int aa[2] = {}; /* { dg-warning "empty initializer" } */
+
+void
+f (int a)
+{
+ int vla[a] = {}; /* { dg-warning "empty initializer" } */
+ struct s as = {}; /* { dg-warning "empty initializer" } */
+ int ax = {}; /* { dg-warning "empty initializer" } */
+ float ay = {}; /* { dg-warning "empty initializer" } */
+ void *ap = {}; /* { dg-warning "empty initializer" } */
+ union u az = {}; /* { dg-warning "empty initializer" } */
+ int aaa[2] = {}; /* { dg-warning "empty initializer" } */
+ int t = (int) {}; /* { dg-warning "empty initializer" } */
+}
diff --git a/gcc/testsuite/gcc.dg/c11-keywords-1.c b/gcc/testsuite/gcc.dg/c11-keywords-1.c
new file mode 100644
index 0000000..974ccfc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-keywords-1.c
@@ -0,0 +1,11 @@
+/* Test new C2x keywords not keywords in C11. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+int alignas;
+int alignof;
+int bool;
+int false;
+int true;
+int static_assert;
+int thread_local;
diff --git a/gcc/testsuite/gcc.dg/c11-nullptr-1.c b/gcc/testsuite/gcc.dg/c11-nullptr-1.c
new file mode 100644
index 0000000..c4faedc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-nullptr-1.c
@@ -0,0 +1,10 @@
+/* Test that in pre-C23 modes, nullptr is a normal identifier,
+ not a keyword. */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+int nullptr;
+
+void
+f (int nullptr)
+{
+}
diff --git a/gcc/testsuite/gcc.dg/c11-unproto-3.c b/gcc/testsuite/gcc.dg/c11-unproto-3.c
new file mode 100644
index 0000000..b0e4bf3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-unproto-3.c
@@ -0,0 +1,19 @@
+/* Test function declarations without prototypes for C11. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+void f1 ();
+void
+f1a (void)
+{
+ f1 (1, 2);
+}
+
+void f2 ();
+void f2 (int);
+
+void f3 ();
+
+_Static_assert (_Generic (f3,
+ void (*) (int) : 1,
+ default : 3) == 1, "unprototyped test");
diff --git a/gcc/testsuite/gcc.dg/c11-unreachable-1.c b/gcc/testsuite/gcc.dg/c11-unreachable-1.c
new file mode 100644
index 0000000..28e4839
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-unreachable-1.c
@@ -0,0 +1,9 @@
+/* Test unreachable not defined in <stddef.h> for C11. */
+/* { dg-do preprocess } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+#include <stddef.h>
+
+#ifdef unreachable
+#error "unreachable defined"
+#endif
diff --git a/gcc/testsuite/gcc.dg/c11-utf8str-type.c b/gcc/testsuite/gcc.dg/c11-utf8str-type.c
new file mode 100644
index 0000000..8be9abb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-utf8str-type.c
@@ -0,0 +1,6 @@
+/* Test C11 UTF-8 string literal type. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11" } */
+
+_Static_assert (_Generic (u8"text", char*: 1, default: 2) == 1, "UTF-8 string literals have an unexpected type");
+_Static_assert (_Generic (u8"x"[0], char: 1, default: 2) == 1, "UTF-8 string literal elements have an unexpected type");
diff --git a/gcc/testsuite/gcc.dg/c17-nullptr-1.c b/gcc/testsuite/gcc.dg/c17-nullptr-1.c
new file mode 100644
index 0000000..92e43b9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c17-nullptr-1.c
@@ -0,0 +1,10 @@
+/* Test that in pre-C23 modes, nullptr is a normal identifier,
+ not a keyword. */
+/* { dg-options "-std=c17 -pedantic-errors" } */
+
+int nullptr;
+
+void
+f (int nullptr)
+{
+}
diff --git a/gcc/testsuite/gcc.dg/c17-nullptr-2.c b/gcc/testsuite/gcc.dg/c17-nullptr-2.c
new file mode 100644
index 0000000..a6ad770
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c17-nullptr-2.c
@@ -0,0 +1,10 @@
+/* Test that we don't predefine `nullptr' pre-C2X. */
+/* { dg-do compile } */
+/* { dg-options "-std=c17 -pedantic-errors" } */
+
+int *
+fn (int *p)
+{
+ p = nullptr; /* { dg-error "'nullptr' undeclared" } */
+ return p;
+}
diff --git a/gcc/testsuite/gcc.dg/c17-utf8str-type.c b/gcc/testsuite/gcc.dg/c17-utf8str-type.c
new file mode 100644
index 0000000..515c6db
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c17-utf8str-type.c
@@ -0,0 +1,6 @@
+/* Test C17 UTF-8 string literal type. */
+/* { dg-do compile } */
+/* { dg-options "-std=c17" } */
+
+_Static_assert (_Generic (u8"text", char*: 1, default: 2) == 1, "UTF-8 string literals have an unexpected type");
+_Static_assert (_Generic (u8"x"[0], char: 1, default: 2) == 1, "UTF-8 string literal elements have an unexpected type");
diff --git a/gcc/testsuite/gcc.dg/c2x-align-1.c b/gcc/testsuite/gcc.dg/c2x-align-1.c
new file mode 100644
index 0000000..25dbd62
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-align-1.c
@@ -0,0 +1,41 @@
+/* Test C2x alignment support. Test valid code. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+#include <stddef.h>
+
+alignas (alignof (max_align_t)) char c;
+extern alignas (max_align_t) char c;
+extern char c;
+
+extern alignas (max_align_t) short s;
+alignas (max_align_t) short s;
+
+alignas (int) int i;
+extern int i;
+
+alignas (max_align_t) long l;
+
+alignas (max_align_t) long long ll;
+
+alignas (max_align_t) float f;
+
+alignas (max_align_t) double d;
+
+alignas (max_align_t) _Complex long double cld;
+
+alignas (0) alignas (int) alignas (char) char ca[10];
+
+alignas ((int) alignof (max_align_t) + 0) int x;
+
+enum e { E = alignof (max_align_t) };
+alignas (E) int y;
+
+void
+func (void)
+{
+ alignas (max_align_t) long long auto_ll;
+}
+
+/* Valid, but useless. */
+alignas (0) struct s; /* { dg-warning "useless" } */
diff --git a/gcc/testsuite/gcc.dg/c2x-align-6.c b/gcc/testsuite/gcc.dg/c2x-align-6.c
new file mode 100644
index 0000000..8559a58
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-align-6.c
@@ -0,0 +1,8 @@
+/* Test C2x alignof returning minimum alignment for a type. */
+/* { dg-do run } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+#define _Alignas alignas
+#define _Alignof alignof
+
+#include "c11-align-6.c"
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-deprecated-2.c b/gcc/testsuite/gcc.dg/c2x-attr-deprecated-2.c
index 44f2cc9..7c01317 100644
--- a/gcc/testsuite/gcc.dg/c2x-attr-deprecated-2.c
+++ b/gcc/testsuite/gcc.dg/c2x-attr-deprecated-2.c
@@ -3,7 +3,8 @@
/* { dg-options "-std=c2x -pedantic-errors" } */
/* This attribute is not valid in most cases on types other than their
- definitions, or on statements, or as an attribute-declaration. */
+ definitions, or on labels, or on statements, or as an
+ attribute-declaration. */
[[deprecated]]; /* { dg-error "ignored" } */
@@ -21,4 +22,10 @@ f (void)
int a;
[[deprecated]]; /* { dg-error "ignored" } */
[[deprecated]] a = 1; /* { dg-error "ignored" } */
+ [[deprecated]] label: ; /* { dg-error "ignored" } */
+ switch (var)
+ {
+ [[deprecated]] case 1: ; /* { dg-error "ignored" } */
+ [[deprecated]] default: ; /* { dg-error "ignored" } */
+ }
}
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-fallthrough-2.c b/gcc/testsuite/gcc.dg/c2x-attr-fallthrough-2.c
index 9d69959..b65bcbe 100644
--- a/gcc/testsuite/gcc.dg/c2x-attr-fallthrough-2.c
+++ b/gcc/testsuite/gcc.dg/c2x-attr-fallthrough-2.c
@@ -33,6 +33,10 @@ f (int a)
case 5:
b += 5;
break;
+ [[fallthrough]] case 6: break; /* { dg-error "ignored" } */
+ [[fallthrough]] default: break; /* { dg-error "ignored" } */
}
[[fallthrough]] return b; /* { dg-error "ignored" } */
+ [[fallthrough]] label: ; /* { dg-error "ignored" } */
+ goto label;
}
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-1.c b/gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-1.c
index 477f30d..7090a3f 100644
--- a/gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-1.c
+++ b/gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-1.c
@@ -14,7 +14,9 @@ g ([[maybe_unused]] int x, int y)
[[maybe_unused]] int a;
int b [[__maybe_unused__]];
int c [[maybe_unused]];
+ [[__maybe_unused__]] label1:
c = y;
+ [[maybe_unused]] label2:
return y;
}
@@ -29,3 +31,14 @@ union [[maybe_unused]] u { int x; };
enum [[maybe_unused]] eu { E2 };
union u2 { [[maybe_unused]] int a; int b [[maybe_unused]]; } y;
+
+void
+g2 (int x)
+{
+ switch (x)
+ {
+ [[maybe_unused]] case 1: ;
+ [[__maybe_unused__]] case 2: ;
+ [[maybe_unused]] default: ;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-2.c b/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-2.c
index 45c4d50..0ed2ebe 100644
--- a/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-2.c
+++ b/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-2.c
@@ -39,4 +39,10 @@ f (void)
[[nodiscard ("reason")]] int b = 1; /* { dg-error "can only be applied" } */
[[nodiscard]]; /* { dg-error "ignored" } */
[[nodiscard]] a = 1; /* { dg-error "ignored" } */
+ [[nodiscard]] label: ; /* { dg-error "can only be applied" } */
+ switch (var)
+ {
+ [[nodiscard]] case 1: ; /* { dg-error "can only be applied" } */
+ [[nodiscard]] default: ; /* { dg-error "can only be applied" } */
+ }
}
diff --git a/gcc/testsuite/gcc.dg/c2x-bool-1.c b/gcc/testsuite/gcc.dg/c2x-bool-1.c
index b64da1f..992fb31 100644
--- a/gcc/testsuite/gcc.dg/c2x-bool-1.c
+++ b/gcc/testsuite/gcc.dg/c2x-bool-1.c
@@ -11,16 +11,16 @@ extern void abort (void);
extern void exit (int);
extern int strcmp (const char *, const char *);
-#if false - 1 < 0
-#error "false signed in #if"
+#if false - 1 >= 0
+#error "false unsigned in #if"
#endif
#if false != 0
#error "false not 0 in #if"
#endif
-#if true - 2 < 0
-#error "true signed in #if"
+#if true - 2 >= 0
+#error "true unsigned in #if"
#endif
#if true != 1
@@ -30,20 +30,14 @@ extern int strcmp (const char *, const char *);
int
main (void)
{
- if (strcmp (str (bool), "_Bool") != 0)
- abort ();
if (_Generic (true, _Bool : 1) != 1)
abort ();
if (true != 1)
abort ();
- if (strcmp (str (true), "((_Bool)+1u)") != 0)
- abort ();
if (_Generic (false, _Bool : 1) != 1)
abort ();
if (false != 0)
abort ();
- if (strcmp (str (false), "((_Bool)+0u)") != 0)
- abort ();
if (strcmp (str (__bool_true_false_are_defined), "1") != 0)
abort ();
exit (0);
diff --git a/gcc/testsuite/gcc.dg/c2x-bool-2.c b/gcc/testsuite/gcc.dg/c2x-bool-2.c
new file mode 100644
index 0000000..4edb34e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-bool-2.c
@@ -0,0 +1,42 @@
+/* Test bool, true and false keywords in C2x. */
+/* { dg-do run } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+extern void abort (void);
+extern void exit (int);
+
+#if false - 1 >= 0
+#error "false unsigned in #if"
+#endif
+
+#if false != 0
+#error "false not 0 in #if"
+#endif
+
+#if true - 2 >= 0
+#error "true unsigned in #if"
+#endif
+
+#if true != 1
+#error "true not 1 in #if"
+#endif
+
+extern bool b;
+extern _Bool b;
+
+_Static_assert (false == 0);
+_Static_assert (true == 1);
+
+int
+main (void)
+{
+ if (_Generic (true, bool : 1) != 1)
+ abort ();
+ if (true != 1)
+ abort ();
+ if (_Generic (false, bool : 1) != 1)
+ abort ();
+ if (false != 0)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-empty-init-1.c b/gcc/testsuite/gcc.dg/c2x-empty-init-1.c
new file mode 100644
index 0000000..1487a2b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-empty-init-1.c
@@ -0,0 +1,80 @@
+/* Test C2X support for empty initializers: valid use cases. */
+/* { dg-do run } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+extern void exit (int);
+extern void abort (void);
+
+struct s { int a; };
+struct s s = {};
+int x = {};
+float y = {};
+void *p = {};
+union u { int a; long b; };
+union u z = {};
+int aa[2] = {};
+
+void
+f (int a)
+{
+ volatile int vla[a] = {};
+ struct s as = {};
+ int ax = {};
+ float ay = {};
+ void *ap = {};
+ union u az = {};
+ int aaa[2] = {};
+ for (int i = 0; i < a; i++)
+ if (vla[i] != 0)
+ abort ();
+ if (as.a != 0)
+ abort ();
+ if (ax != 0)
+ abort ();
+ if (ay != 0)
+ abort ();
+ if (ap != 0)
+ abort ();
+ if (az.a != 0)
+ abort ();
+ if (aaa[0] != 0)
+ abort ();
+ if (aaa[1] != 0)
+ abort ();
+ if ((int) {} != 0)
+ abort ();
+ if ((float) {} != 0)
+ abort ();
+ if ((struct s) {}.a != 0)
+ abort ();
+ if ((union u) {}.a != 0)
+ abort ();
+ if ((int [5]) {}[2] != 0)
+ abort ();
+ /* Overwrite contents of vla before second call to make it more likely stack
+ contents are nonzero if proper initialization did not occur. */
+ for (int i = 0; i < a; i++)
+ vla[i] = -1;
+}
+
+int
+main (void)
+{
+ f (100);
+ f (100);
+ if (s.a != 0)
+ abort ();
+ if (x != 0)
+ abort ();
+ if (y != 0)
+ abort ();
+ if (p != 0)
+ abort ();
+ if (z.a != 0)
+ abort ();
+ if (aa[0] != 0)
+ abort ();
+ if (aa[1] != 0)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-empty-init-2.c b/gcc/testsuite/gcc.dg/c2x-empty-init-2.c
new file mode 100644
index 0000000..0dc81ce
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-empty-init-2.c
@@ -0,0 +1,18 @@
+/* Test C2X support for empty initializers: invalid use cases. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+/* Empty initialization is invalid for arrays of unknown size. This is
+ diagnosed via the diagnostic for zero-size arrays. */
+int x[] = {}; /* { dg-error "zero or negative size array" } */
+
+void
+f (int a)
+{
+ int x1[] = {}; /* { dg-error "zero or negative size array" } */
+ int x2[][a] = {}; /* { dg-error "zero or negative size array" } */
+ /* Nonempty VLA initializers are still invalid. */
+ int x3[a] = { 0 }; /* { dg-error "variable-sized object may not be initialized except with an empty initializer" } */
+ /* Variable-size compound literals are still invalid. */
+ (void) (int [a]) {}; /* { dg-error "compound literal has variable size" } */
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-empty-init-3.c b/gcc/testsuite/gcc.dg/c2x-empty-init-3.c
new file mode 100644
index 0000000..472f816
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-empty-init-3.c
@@ -0,0 +1,25 @@
+/* Test empty initializers diagnosed in C2X mode with -Wc11-c2x-compat. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -Wc11-c2x-compat" } */
+
+struct s { int a; };
+struct s s = {}; /* { dg-warning "empty initializer" } */
+int x = {}; /* { dg-warning "empty initializer" } */
+float y = {}; /* { dg-warning "empty initializer" } */
+void *p = {}; /* { dg-warning "empty initializer" } */
+union u { int a; long b; };
+union u z = {}; /* { dg-warning "empty initializer" } */
+int aa[2] = {}; /* { dg-warning "empty initializer" } */
+
+void
+f (int a)
+{
+ int vla[a] = {}; /* { dg-warning "empty initializer" } */
+ struct s as = {}; /* { dg-warning "empty initializer" } */
+ int ax = {}; /* { dg-warning "empty initializer" } */
+ float ay = {}; /* { dg-warning "empty initializer" } */
+ void *ap = {}; /* { dg-warning "empty initializer" } */
+ union u az = {}; /* { dg-warning "empty initializer" } */
+ int aaa[2] = {}; /* { dg-warning "empty initializer" } */
+ int t = (int) {}; /* { dg-warning "empty initializer" } */
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-float-11.c b/gcc/testsuite/gcc.dg/c2x-float-11.c
new file mode 100644
index 0000000..0e2f3c0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-float-11.c
@@ -0,0 +1,9 @@
+/* Test INFINITY macro. Test when infinities not supported. */
+/* { dg-do compile { target { ! inff } } } */
+/* { dg-options "-std=c2x" } */
+
+#include <float.h>
+
+#ifdef INFINITY
+#error "INFINITY defined"
+#endif
diff --git a/gcc/testsuite/gcc.dg/c2x-float-2.c b/gcc/testsuite/gcc.dg/c2x-float-2.c
index 4f669fd..61a77f6 100644
--- a/gcc/testsuite/gcc.dg/c2x-float-2.c
+++ b/gcc/testsuite/gcc.dg/c2x-float-2.c
@@ -1,8 +1,8 @@
-/* Test INFINITY macro. Generic test even if infinities not
- supported. */
+/* Test INFINITY macro. Generic test. */
/* { dg-do run } */
/* { dg-options "-std=c2x -w" } */
/* { dg-add-options ieee } */
+/* { dg-require-effective-target inff } */
#include <float.h>
diff --git a/gcc/testsuite/gcc.dg/c2x-has-c-attribute-2.c b/gcc/testsuite/gcc.dg/c2x-has-c-attribute-2.c
index d6c4c6d..6a379e9 100644
--- a/gcc/testsuite/gcc.dg/c2x-has-c-attribute-2.c
+++ b/gcc/testsuite/gcc.dg/c2x-has-c-attribute-2.c
@@ -10,11 +10,11 @@
#error "bad result for __nodiscard__"
#endif
-#if __has_c_attribute(maybe_unused) != 201904L
+#if __has_c_attribute(maybe_unused) != 202106L
#error "bad result for maybe_unused"
#endif
-#if __has_c_attribute(__maybe_unused__) != 201904L
+#if __has_c_attribute(__maybe_unused__) != 202106L
#error "bad result for __maybe_unused__"
#endif
@@ -26,11 +26,11 @@
#error "bad result for __deprecated__"
#endif
-#if __has_c_attribute (fallthrough) != 201904L
+#if __has_c_attribute (fallthrough) != 201910L
#error "bad result for fallthrough"
#endif
-#if __has_c_attribute (__fallthrough__) != 201904L
+#if __has_c_attribute (__fallthrough__) != 201910L
#error "bad result for __fallthrough__"
#endif
diff --git a/gcc/testsuite/gcc.dg/c2x-nullptr-1.c b/gcc/testsuite/gcc.dg/c2x-nullptr-1.c
new file mode 100644
index 0000000..9501b51
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-nullptr-1.c
@@ -0,0 +1,298 @@
+/* Test valid usage of C23 nullptr. */
+/* { dg-do run } */
+/* { dg-options "-std=c2x -pedantic-errors -Wall -Wextra -Wno-unused-variable" } */
+
+#include <stdarg.h>
+
+typedef __typeof__(nullptr) nullptr_t;
+
+void f1 (nullptr_t) { }
+void f2 (int *) { }
+void f3 (_Bool) { }
+nullptr_t cmp (void) { return nullptr; }
+
+/* The type nullptr_t shall not be converted to any type other than void, bool or
+ a pointer type. No type other than nullptr_t shall be converted to nullptr_t. */
+void
+test1 (void)
+{
+ const nullptr_t nptr = nullptr;
+ static nullptr_t static_nptr;
+ int *p1 = nullptr;
+ void *p2 = nullptr;
+ float *p3 = nullptr;
+ void (*p4)(int) = nullptr;
+ int (*p5)[10] = nullptr;
+ int *p6 = nptr;
+ void *p7 = nptr;
+ float *p8 = nptr;
+ void (*p9)(int) = nptr;
+ int (*p10)[10] = nptr;
+ int *p11 = (int *) nullptr;
+ int *p12 = (int *) nptr;
+ int *p13 = (nullptr);
+ int *p14 = _Generic(0, int : nullptr);
+ if (nullptr || p1 || p2 || p3 || p4 || p5 || p6 || p7 || p8 || p9 || p10
+ || p11 || p12 || p13 || p14)
+ __builtin_abort ();
+
+ _Bool b1 = nullptr;
+ _Bool b2 = (_Bool) nullptr;
+ _Bool b3 = nptr;
+ _Bool b4 = (_Bool) nptr;
+ _Bool b5 = _Generic(0, int : nullptr);
+ if (b1 || b2 || b3 || b4 || b5 || (_Bool) nullptr || (_Bool) nptr)
+ __builtin_abort ();
+
+ __auto_type a1 = nullptr;
+ __auto_type a2 = nptr;
+
+ /* We can convert nullptr_t to nullptr_t. */
+ __typeof__(nullptr) x = nullptr;
+ f1 (x);
+ f1 (nullptr);
+ f1 (_Generic(0, int : nullptr));
+ f2 (x);
+ f2 (nullptr);
+ f3 (nullptr);
+
+ const nullptr_t np1 = nullptr;
+ const nullptr_t np2 = np1;
+ (void) nullptr;
+ (void) np1;
+ (void) np2;
+ (void) cmp ();
+ (void)(nullptr_t) nullptr;
+}
+
+/* Test valid comparison. */
+void
+test2 (int *p)
+{
+ /* If both operands have type nullptr_t or one operand has type nullptr_t
+ and the other is a null pointer constant, they compare equal. */
+ const nullptr_t nptr = nullptr;
+ int r = 0;
+
+ /* Both operands have type nullptr_t. */
+ r |= nullptr != nullptr;
+ r |= cmp () != nullptr;
+ r |= nullptr != cmp ();
+ r |= !(nullptr == nullptr);
+ r |= !(cmp () == nullptr);
+ r |= !(nullptr == cmp ());
+ r |= nptr != nptr;
+ r |= cmp () != nptr;
+ r |= nptr != cmp ();
+ r |= !(nptr == nptr);
+ r |= !(cmp () == nptr);
+ r |= !(nptr == cmp ());
+
+ /* One operand has type nullptr_t and the other is a null pointer constant. */
+ r |= nullptr != (void *) 0;
+ r |= _Generic(0, int : nullptr) != (void *) 0;
+ r |= (nullptr) != (void *) 0;
+ r |= !(nullptr == (void *) 0);
+ r |= (void *) 0 != nullptr;
+ r |= (void *) 0 != (nullptr);
+ r |= !((void *) 0 == nullptr);
+ r |= nullptr != 0;
+ r |= _Generic(0, int : nullptr) != 0;
+ r |= (nullptr) != 0;
+ r |= 0 != nullptr;
+ r |= 0 != (nullptr);
+ r |= !(nullptr == 0);
+ r |= !(0 == nullptr);
+ r |= nullptr != 0u;
+ r |= 0u != nullptr;
+ r |= !(nullptr == 0u);
+ r |= !(0u == nullptr);
+ r |= nptr != (void *) 0;
+ r |= !(nptr == (void *) 0);
+ r |= (void *) 0 != nptr;
+ r |= !((void *) 0 == nptr);
+ r |= nptr != 0;
+ r |= 0 != nptr;
+ r |= !(nptr == 0);
+ r |= !(0 == nptr);
+ r |= nptr != 0u;
+ r |= 0u != nptr;
+ r |= !(nptr == 0u);
+ r |= !(0u == nptr);
+ r |= nptr != _Generic(0, int : nullptr);
+ r |= _Generic(0, int : nullptr) != nptr;
+ if (r)
+ __builtin_abort ();
+
+ /* One operand is a pointer and the other is a null pointer constant. */
+ (void) (p == nullptr);
+ (void) (p != nullptr);
+ (void) (nullptr == p);
+ (void) (nullptr != p);
+ (void) (p == (nullptr));
+ (void) (p != (nullptr));
+ (void) ((nullptr) == p);
+ (void) ((nullptr) != p);
+ (void) ((void *)nullptr == nullptr);
+ (void) ((void *)nullptr != nullptr);
+ (void) (nullptr == (void *)nullptr);
+ (void) (nullptr != (void *)nullptr);
+ (void) (p == _Generic(0, int : nullptr));
+ (void) (p != _Generic(0, int : nullptr));
+ (void) (_Generic(0, int : nullptr) == p);
+ (void) (_Generic(0, int : nullptr) != p);
+}
+
+/* Test ?:. */
+void
+test3 (int *p, _Bool b)
+{
+ int x = nullptr ? 1 : 2;
+ (void) x;
+ const nullptr_t nptr = nullptr;
+ /* One of the following shall hold for the second and third operands:
+ -- both operands have nullptr_t type. */
+ __auto_type r1 = b ? nullptr : nullptr;
+ __auto_type r2 = b ? nptr : nptr;
+ /* -- one operand is a pointer and the other is a null pointer constant
+ or has type nullptr_t; */
+ __auto_type r3 = b ? p : nullptr;
+ __auto_type r4 = b ? nullptr : p;
+ __auto_type r5 = b ? nptr : p;
+ __auto_type r6 = b ? p : nptr;
+ __auto_type r7 = b ? 0 : p;
+ __auto_type r8 = b ? p : 0;
+ __auto_type r9 = b ? p : cmp ();
+ __auto_type r10 = b ? cmp () : p;
+ __auto_type r11 = b ? p : _Generic(0, int : nullptr);
+ __auto_type r12 = b ? _Generic(0, int : nullptr) : p;
+}
+
+void test_arg1 (const nullptr_t, _Atomic nullptr_t, volatile nullptr_t) { }
+void test_arg2 (_Atomic int *, const int *, volatile int *) { }
+void test_arg3 (_Atomic _Bool, const _Bool, volatile _Bool) { }
+nullptr_t retn (void) { return nullptr; }
+_Atomic int *ai (void) { return nullptr; }
+const int *ci (void) { return nullptr; }
+volatile int *vi (void) { return nullptr; }
+_Bool retb (void) { return nullptr; }
+
+/* Simple assignment. */
+void
+test4 (void)
+{
+ /* -- the left operand has an atomic, qualified, or unqualified version of
+ the nullptr_t type and the type of the right is nullptr_t; */
+ nullptr_t n1;
+ const nullptr_t n2 = nullptr;
+ _Atomic nullptr_t n3 = nullptr;
+ volatile nullptr_t n4 = nullptr;
+ _Atomic volatile nullptr_t n5 = nullptr;
+ n1 = nullptr;
+ n3 = nullptr;
+ n4 = nullptr;
+ n5 = nullptr;
+ n5 = _Generic(0, int : nullptr);
+ /* -- the left operand is an atomic, qualified, or unqualified pointer,
+ and the type of the right is nullptr_t; */
+ int *p1 = cmp ();
+ _Atomic int *p2 = cmp ();
+ const int *volatile p3 = cmp ();
+ const int *const *const p4 = cmp ();
+ double (*const p5)(void) = n1;
+ p2 = _Generic(0, int : nullptr);
+ p3 = nullptr;
+ /* -- the left operand is an atomic, qualified, or unqualified bool, and
+ the type of the right is nullptr_t; */
+ _Bool b1;
+ b1 = cmp ();
+ const _Bool b2 = nullptr;
+ _Atomic _Bool b3;
+ b3 = n1;
+ (void) b1;
+ (void) b3;
+ (void) n3;
+ (void) n4;
+ (void) n5;
+ (void) p2;
+ (void) p3;
+
+ test_arg1 (nullptr, nullptr, nullptr);
+ test_arg2 (nullptr, nullptr, nullptr);
+ test_arg3 (nullptr, nullptr, nullptr);
+}
+
+/* var_arg etc. */
+static void
+test5 (int i, ...)
+{
+ va_list ap;
+ va_start (ap, i);
+ if (va_arg (ap, void *))
+ __builtin_abort ();
+}
+
+/* Operand of alignas, sizeof or typeof operators. */
+void
+test6 (void)
+{
+ _Static_assert (sizeof (nullptr) == sizeof (void *), "sizeof (nullptr)");
+ _Static_assert (sizeof (nullptr_t) == sizeof (void *), "sizeof (nullptr_t)");
+ _Static_assert (sizeof (nullptr) == sizeof (char *), "sizeof (nullptr)");
+ _Static_assert (sizeof (nullptr_t) == sizeof (char *), "sizeof (nullptr_t)");
+ _Static_assert (_Alignof (nullptr_t) == _Alignof (char *), "_Alignof (nullptr_t)");
+ __typeof__(nullptr) t = nullptr;
+ f1 (t);
+ _Alignas (nullptr_t) char i1 = 'q';
+
+ _Static_assert (_Generic (nullptr, nullptr_t: 1, default: 0) == 1, "_Generic");
+ _Static_assert (_Generic (t, nullptr_t: 1, default: 0) == 1, "_Generic");
+ _Static_assert (_Generic (cmp (), nullptr_t: 1, default: 0) == 1, "_Generic");
+ _Static_assert (_Generic (0, nullptr_t: 1, int: 2, default: 0) == 2, "_Generic");
+ _Static_assert (_Generic ((void *)0, nullptr_t: 1, void *: 2, default: 0) == 2, "_Generic");
+ _Static_assert (_Generic (nullptr, nullptr_t: 1, void *: 2, default: 0) == 1, "_Generic");
+}
+
+/* Play with !, ||, &&. */
+void
+test7 (void)
+{
+ if (nullptr)
+ __builtin_abort ();
+ if (1 && nullptr)
+ __builtin_abort ();
+ if (0 || nullptr)
+ __builtin_abort ();
+ if (nullptr && 1)
+ __builtin_abort ();
+ if (nullptr || 0)
+ __builtin_abort ();
+ if (!nullptr)
+ {
+ }
+ else
+ __builtin_abort ();
+ while (nullptr)
+ __builtin_abort ();
+ int i = 0;
+ do
+ ++i;
+ while (nullptr);
+ if (i != 1)
+ __builtin_abort ();
+ for (;nullptr;)
+ __builtin_abort ();
+}
+
+int
+main (void)
+{
+ int i = 42;
+ test1 ();
+ test2 (&i);
+ test3 (&i, 0);
+ test4 ();
+ test5 (42, nullptr);
+ test6 ();
+ test7 ();
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-nullptr-2.c b/gcc/testsuite/gcc.dg/c2x-nullptr-2.c
new file mode 100644
index 0000000..b610565
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-nullptr-2.c
@@ -0,0 +1,9 @@
+/* Test nullptr_t from <stddef.h>. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+#include <stddef.h>
+
+void f(nullptr_t);
+_Static_assert (sizeof (nullptr_t) == sizeof (char *), "sizeof (nullptr_t)");
+_Static_assert (_Alignof (nullptr_t) == _Alignof (char *), "_Alignof (nullptr_t)");
diff --git a/gcc/testsuite/gcc.dg/c2x-nullptr-3.c b/gcc/testsuite/gcc.dg/c2x-nullptr-3.c
new file mode 100644
index 0000000..34e3e03
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-nullptr-3.c
@@ -0,0 +1,80 @@
+/* Test wrong usage of C23 nullptr. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors -Wall -Wextra -Wno-unused-variable" } */
+
+typedef __typeof__(nullptr) nullptr_t;
+
+void g (nullptr_t); /* { dg-message "expected .nullptr_t. but argument is of type .int." } */
+nullptr_t cmp (void);
+
+void
+test1 (int *p)
+{
+ (void) (p > nullptr); /* { dg-error "ordered comparison" } */
+ (void) (p >= nullptr); /* { dg-error "ordered comparison" } */
+ (void) (p < nullptr); /* { dg-error "ordered comparison" } */
+ (void) (p <= nullptr); /* { dg-error "ordered comparison" } */
+ (void) (nullptr == 1); /* { dg-error "invalid operands" } */
+ (void) (1 == nullptr); /* { dg-error "invalid operands" } */
+ (void) (nullptr != 1); /* { dg-error "invalid operands" } */
+ (void) (1 != nullptr); /* { dg-error "invalid operands" } */
+ (void) (1 > nullptr); /* { dg-error "invalid operands" } */
+
+ /* "(nullptr_t)nullptr" has type nullptr_t but isn't an NPC. */
+ (void) ((nullptr_t)nullptr == p); /* { dg-error "invalid operands" } */
+ (void) ((nullptr_t)nullptr != p); /* { dg-error "invalid operands" } */
+ (void) (p == (nullptr_t)nullptr); /* { dg-error "invalid operands" } */
+ (void) (p != (nullptr_t)nullptr); /* { dg-error "invalid operands" } */
+ (void) (cmp () == p); /* { dg-error "invalid operands" } */
+ (void) (cmp () != p); /* { dg-error "invalid operands" } */
+ (void) (p == cmp ()); /* { dg-error "invalid operands" } */
+ (void) (p != cmp ()); /* { dg-error "invalid operands" } */
+ /* "(void *)nullptr" is not an NPC, either. */
+ (void) ((void *)nullptr == cmp ()); /* { dg-error "invalid operands" } */
+ (void) ((void *)nullptr != cmp ()); /* { dg-error "invalid operands" } */
+ (void) (cmp () == (void *)nullptr); /* { dg-error "invalid operands" } */
+ (void) (cmp () != (void *)nullptr); /* { dg-error "invalid operands" } */
+}
+
+void
+test2 (void)
+{
+ const nullptr_t nptr = nullptr;
+ int p = nullptr; /* { dg-error "incompatible types" } */
+ float d = nullptr; /* { dg-error "incompatible types" } */
+ char arr[10] = { nullptr }; /* { dg-error "incompatible types" } */
+
+ /* No type other than nullptr_t shall be converted to nullptr_t. */
+ const nullptr_t n = 0; /* { dg-error "invalid initializer" } */
+ +(nullptr_t) 0; /* { dg-error "conversion from .int. to .nullptr_t." } */
+
+ g (0); /* { dg-error "incompatible type" } */
+
+ int i = 42 + nullptr; /* { dg-error "invalid operands" } */
+
+ /* The assignment of an object of type nullptr_t with a value of another
+ type, even if the value is a null pointer constant, is a constraint
+ violation. */
+ nullptr_t m;
+ m = 0; /* { dg-error "incompatible types" } */
+ (void) m;
+ nullptr_t o = 0; /* { dg-error "invalid initializer" } */
+
+ switch (nullptr); /* { dg-error "switch quantity not an integer" } */
+}
+
+/* If a second or third operand of type nullptr_t is used that is not a null
+ pointer constant and the other operand is not a pointer or does not have
+ itself nullptr_t, a constraint is violated even if that other operand is
+ a null pointer constant such as 0. */
+void
+test3 (_Bool b, int i)
+{
+ const nullptr_t nptr = nullptr;
+ __auto_type a1 = b ? nptr : i; /* { dg-error "type mismatch" } */
+ __auto_type a2 = b ? i : nptr; /* { dg-error "type mismatch" } */
+ __auto_type a3 = b ? nptr : 0; /* { dg-error "type mismatch" } */
+ __auto_type a4 = b ? 0 : nptr; /* { dg-error "type mismatch" } */
+ __auto_type a5 = b ? 0 : nullptr; /* { dg-error "type mismatch" } */
+ __auto_type a6 = b ? nullptr : 0; /* { dg-error "type mismatch" } */
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-nullptr-4.c b/gcc/testsuite/gcc.dg/c2x-nullptr-4.c
new file mode 100644
index 0000000..7479ab4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-nullptr-4.c
@@ -0,0 +1,11 @@
+/* Test that -Wc11-c2x-compat issues a warning (not a pedwarn) about
+ `nullptr' in C2X. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors -Wc11-c2x-compat" } */
+
+int *
+fn (int *p)
+{
+ p = nullptr; /* { dg-warning "ISO C does not support .nullptr. before C2X" } */
+ return p;
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-nullptr-5.c b/gcc/testsuite/gcc.dg/c2x-nullptr-5.c
new file mode 100644
index 0000000..27803f7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-nullptr-5.c
@@ -0,0 +1,14 @@
+/* Test that we don't lose side-effects when converting from nullptr_t. */
+/* { dg-do run } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+int i;
+nullptr_t fn () { ++i; return nullptr; }
+
+int
+main ()
+{
+ int *p = fn ();
+ if (i != 1)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-old-style-definition-6.c b/gcc/testsuite/gcc.dg/c2x-old-style-definition-6.c
index fc0e778..72bfd56 100644
--- a/gcc/testsuite/gcc.dg/c2x-old-style-definition-6.c
+++ b/gcc/testsuite/gcc.dg/c2x-old-style-definition-6.c
@@ -1,16 +1,16 @@
-/* Test old-style function definitions not in C2x: () does not give
- type with a prototype except for function definitions. */
+/* Test old-style function definitions not in C2x: () gives a type with
+ a prototype for all declarations. */
/* { dg-do compile } */
/* { dg-options "-std=c2x" } */
-void f1 ();
+void f1 (); /* { dg-message "declared here" } */
-/* Prototyped function returning a pointer to unprototyped function. */
+/* Prototyped function returning a pointer to a function with no arguments. */
void (*f2 (void))() { return f1; }
void
g (void)
{
- f1 (1);
- f2 () (1);
+ f1 (1); /* { dg-error "too many arguments" } */
+ f2 () (1); /* { dg-error "too many arguments" } */
}
diff --git a/gcc/testsuite/gcc.dg/c2x-static-assert-3.c b/gcc/testsuite/gcc.dg/c2x-static-assert-3.c
new file mode 100644
index 0000000..5d84a6a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-static-assert-3.c
@@ -0,0 +1,6 @@
+/* Test C2x static assertions. static_assert keyword. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic" } */
+
+static_assert (1);
+static_assert (1, "message");
diff --git a/gcc/testsuite/gcc.dg/c2x-static-assert-4.c b/gcc/testsuite/gcc.dg/c2x-static-assert-4.c
new file mode 100644
index 0000000..b3bcfb4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-static-assert-4.c
@@ -0,0 +1,6 @@
+/* Test C2x static assertions. static_assert keyword. Failed assertions. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic" } */
+
+static_assert (0); /* { dg-error "static assertion failed" } */
+static_assert (0, "message"); /* { dg-error "message" } */
diff --git a/gcc/testsuite/gcc.dg/c2x-thread-local-1.c b/gcc/testsuite/gcc.dg/c2x-thread-local-1.c
new file mode 100644
index 0000000..e1917bd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-thread-local-1.c
@@ -0,0 +1,6 @@
+/* Test C2x thread_local keyword. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+thread_local int a;
+thread_local void f (void); /* { dg-error "storage class" } */
diff --git a/gcc/testsuite/gcc.dg/c2x-unproto-1.c b/gcc/testsuite/gcc.dg/c2x-unproto-1.c
index aa87d78..d21c6a7 100644
--- a/gcc/testsuite/gcc.dg/c2x-unproto-1.c
+++ b/gcc/testsuite/gcc.dg/c2x-unproto-1.c
@@ -1,25 +1,21 @@
-/* Test compatibility of unprototyped and prototyped function types (C2x made
- the case of types affected by default argument promotions compatible, before
- removing unprototyped functions completely). Test affected usages are not
- accepted for C2x. */
+/* Test compatibility of prototyped function types with and without arguments
+ (C2x made the case of types affected by default argument promotions
+ compatible, before removing unprototyped functions completely). Test
+ affected usages are not accepted for C2x. */
/* { dg-do compile } */
/* { dg-options "-std=c2x -pedantic-errors" } */
void f1 (); /* { dg-message "previous declaration" } */
void f1 (float); /* { dg-error "conflicting types" } */
-/* { dg-message "default promotion" "" { target *-*-* } .-1 } */
void f2 (float); /* { dg-message "previous declaration" } */
void f2 (); /* { dg-error "conflicting types" } */
-/* { dg-message "default promotion" "" { target *-*-* } .-1 } */
void f3 (); /* { dg-message "previous declaration" } */
void f3 (char); /* { dg-error "conflicting types" } */
-/* { dg-message "default promotion" "" { target *-*-* } .-1 } */
void f4 (char); /* { dg-message "previous declaration" } */
void f4 (); /* { dg-error "conflicting types" } */
-/* { dg-message "default promotion" "" { target *-*-* } .-1 } */
/* Built-in function case. */
float sqrtf (); /* { dg-warning "conflicting types for built-in function" } */
diff --git a/gcc/testsuite/gcc.dg/c2x-unproto-2.c b/gcc/testsuite/gcc.dg/c2x-unproto-2.c
index 3d5ae9d..533fb74 100644
--- a/gcc/testsuite/gcc.dg/c2x-unproto-2.c
+++ b/gcc/testsuite/gcc.dg/c2x-unproto-2.c
@@ -1,22 +1,18 @@
-/* Test compatibility of unprototyped and prototyped function types (C2x made
- the case of types affected by default argument promotions compatible, before
- removing unprototyped functions completely). Test always-invalid-in-C2x
- usages, in C2X mode. */
+/* Test compatibility of prototyped function types without arguments and with
+ variable arguments (C2x made the case of types affected by default argument
+ promotions compatible, before removing unprototyped functions completely).
+ Test always-invalid-in-C2x usages, in C2X mode. */
/* { dg-do compile } */
/* { dg-options "-std=c2x -pedantic-errors" } */
void f1 (); /* { dg-message "previous declaration" } */
void f1 (int, ...); /* { dg-error "conflicting types" } */
-/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */
void f2 (int, ...); /* { dg-message "previous declaration" } */
void f2 (); /* { dg-error "conflicting types" } */
-/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */
void f3 (); /* { dg-message "previous declaration" } */
void f3 (char, ...); /* { dg-error "conflicting types" } */
-/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */
void f4 (char, ...); /* { dg-message "previous declaration" } */
void f4 (); /* { dg-error "conflicting types" } */
-/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/gcc.dg/c2x-unproto-3.c b/gcc/testsuite/gcc.dg/c2x-unproto-3.c
new file mode 100644
index 0000000..762f8b2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-unproto-3.c
@@ -0,0 +1,20 @@
+/* Test that declaring a function with () is the same as (void) in C2X. Valid
+ use cases. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors -Wstrict-prototypes" } */
+
+void f1 ();
+void f1 (void);
+
+void f2 (void);
+void f2 ();
+
+typedef void T1 ();
+typedef void T1 (void);
+
+void f3 ();
+
+_Static_assert (_Generic (f3,
+ void (*) (int) : 1,
+ void (*) (void) : 2,
+ default : 3) == 2);
diff --git a/gcc/testsuite/gcc.dg/c2x-unproto-4.c b/gcc/testsuite/gcc.dg/c2x-unproto-4.c
new file mode 100644
index 0000000..fceff22
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-unproto-4.c
@@ -0,0 +1,15 @@
+/* Test that declaring a function with () is the same as (void) in C2X.
+ Invalid use cases. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+void f1 (); /* { dg-message "previous declaration" } */
+void f1 (int); /* { dg-error "conflicting types" } */
+
+void f2 (); /* { dg-message "declared here" } */
+
+void
+f3 (void)
+{
+ f2 (1); /* { dg-error "too many arguments" } */
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-unreachable-1.c b/gcc/testsuite/gcc.dg/c2x-unreachable-1.c
new file mode 100644
index 0000000..468f1f8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-unreachable-1.c
@@ -0,0 +1,29 @@
+/* Test unreachable in <stddef.h> for C2x. */
+/* { dg-do run } */
+/* { dg-options "-std=c2x -pedantic-errors -O2" } */
+
+#include <stddef.h>
+
+#ifndef unreachable
+#error "unreachable not defined"
+#endif
+
+extern void *p;
+extern __typeof__ (unreachable ()) *p;
+
+volatile int x = 1;
+
+extern void not_defined (void);
+
+extern void exit (int);
+
+int
+main ()
+{
+ if (x == 2)
+ {
+ unreachable ();
+ not_defined ();
+ }
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-utf8str-type.c b/gcc/testsuite/gcc.dg/c2x-utf8str-type.c
new file mode 100644
index 0000000..ebdde97
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-utf8str-type.c
@@ -0,0 +1,6 @@
+/* Test C2X UTF-8 string literal type. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x" } */
+
+_Static_assert (_Generic (u8"text", unsigned char*: 1, default: 2) == 1, "UTF-8 string literals have an unexpected type");
+_Static_assert (_Generic (u8"x"[0], unsigned char: 1, default: 2) == 1, "UTF-8 string literal elements have an unexpected type");
diff --git a/gcc/testsuite/gcc.dg/c2x-utf8str.c b/gcc/testsuite/gcc.dg/c2x-utf8str.c
new file mode 100644
index 0000000..2e4c392
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-utf8str.c
@@ -0,0 +1,34 @@
+/* Test initialization by UTF-8 string literal in C2X. */
+/* { dg-do compile } */
+/* { dg-require-effective-target wchar } */
+/* { dg-options "-std=c2x" } */
+
+typedef __CHAR8_TYPE__ char8_t;
+typedef __CHAR16_TYPE__ char16_t;
+typedef __CHAR32_TYPE__ char32_t;
+typedef __WCHAR_TYPE__ wchar_t;
+
+/* Test that char, signed char, unsigned char, and char8_t arrays can be
+ initialized by a UTF-8 string literal. */
+const char cbuf1[] = u8"text";
+const char cbuf2[] = { u8"text" };
+const signed char scbuf1[] = u8"text";
+const signed char scbuf2[] = { u8"text" };
+const unsigned char ucbuf1[] = u8"text";
+const unsigned char ucbuf2[] = { u8"text" };
+const char8_t c8buf1[] = u8"text";
+const char8_t c8buf2[] = { u8"text" };
+
+/* Test that a diagnostic is issued for attempted initialization of
+ other character types by a UTF-8 string literal. */
+const char16_t c16buf1[] = u8"text"; /* { dg-error "from a string literal with type array of .unsigned char." } */
+const char16_t c16buf2[] = { u8"text" }; /* { dg-error "from a string literal with type array of .unsigned char." } */
+const char32_t c32buf1[] = u8"text"; /* { dg-error "from a string literal with type array of .unsigned char." } */
+const char32_t c32buf2[] = { u8"text" }; /* { dg-error "from a string literal with type array of .unsigned char." } */
+const wchar_t wbuf1[] = u8"text"; /* { dg-error "from a string literal with type array of .unsigned char." } */
+const wchar_t wbuf2[] = { u8"text" }; /* { dg-error "from a string literal with type array of .unsigned char." } */
+
+/* Test that char8_t arrays can be initialized by an ordinary string
+ literal. */
+const char8_t c8buf3[] = "text";
+const char8_t c8buf4[] = { "text" };
diff --git a/gcc/testsuite/gcc.dg/cpp/c11-trigraphs-1.c b/gcc/testsuite/gcc.dg/cpp/c11-trigraphs-1.c
new file mode 100644
index 0000000..efd011a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/c11-trigraphs-1.c
@@ -0,0 +1,5 @@
+/* Test trigraphs supported in C11. */
+/* { dg-do run } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+#include "trigraphs.c"
diff --git a/gcc/testsuite/gcc.dg/cpp/c11-warning-1.c b/gcc/testsuite/gcc.dg/cpp/c11-warning-1.c
new file mode 100644
index 0000000..45d1ff8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/c11-warning-1.c
@@ -0,0 +1,6 @@
+/* Test #warning not in C11. */
+/* { dg-do preprocess } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+#warning example text /* { dg-warning "example text" } */
+/* { dg-error "#warning before C2X is a GCC extension" "pedantic" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/gcc.dg/cpp/c11-warning-2.c b/gcc/testsuite/gcc.dg/cpp/c11-warning-2.c
new file mode 100644
index 0000000..ba385bf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/c11-warning-2.c
@@ -0,0 +1,6 @@
+/* Test #warning not in C11. */
+/* { dg-do preprocess } */
+/* { dg-options "-std=c11 -pedantic" } */
+
+#warning example text /* { dg-warning "example text" } */
+/* { dg-warning "#warning before C2X is a GCC extension" "pedantic" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/gcc.dg/cpp/c11-warning-3.c b/gcc/testsuite/gcc.dg/cpp/c11-warning-3.c
new file mode 100644
index 0000000..8d74fcd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/c11-warning-3.c
@@ -0,0 +1,6 @@
+/* Test #warning not in C11. */
+/* { dg-do preprocess } */
+/* { dg-options "-std=c11 -Wc11-c2x-compat" } */
+
+#warning example text /* { dg-warning "example text" } */
+/* { dg-warning "#warning before C2X is a GCC extension" "compat" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/gcc.dg/cpp/c11-warning-4.c b/gcc/testsuite/gcc.dg/cpp/c11-warning-4.c
new file mode 100644
index 0000000..0af93f3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/c11-warning-4.c
@@ -0,0 +1,6 @@
+/* Test #warning not in C11. */
+/* { dg-do preprocess } */
+/* { dg-options "-std=c11" } */
+
+#warning example text /* { dg-warning "example text" } */
+/* Not diagnosed by default. */
diff --git a/gcc/testsuite/gcc.dg/cpp/c2x-trigraphs-1.c b/gcc/testsuite/gcc.dg/cpp/c2x-trigraphs-1.c
new file mode 100644
index 0000000..bbc2152
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/c2x-trigraphs-1.c
@@ -0,0 +1,10 @@
+/* Test trigraphs not supported in C2x. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+const char a[] = "??=??(??/??/??)??'??<??!??>??-";
+const char b[] = "?""?=?""?(?""?/?""?/?""?)?""?'?""?<?""?!?""?>?""?-";
+
+_Static_assert (sizeof a == sizeof b, "checking trigraph conversions");
+
+/* { dg-prune-output "\\\[-Wtrigraphs" } */
diff --git a/gcc/testsuite/gcc.dg/cpp/c2x-trigraphs-2.c b/gcc/testsuite/gcc.dg/cpp/c2x-trigraphs-2.c
new file mode 100644
index 0000000..38ee489
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/c2x-trigraphs-2.c
@@ -0,0 +1,5 @@
+/* Test trigraphs supported in C2x with -trigraphs used. */
+/* { dg-do run } */
+/* { dg-options "-std=c2x -pedantic-errors -trigraphs" } */
+
+#include "trigraphs.c"
diff --git a/gcc/testsuite/gcc.dg/cpp/c2x-warning-1.c b/gcc/testsuite/gcc.dg/cpp/c2x-warning-1.c
new file mode 100644
index 0000000..696a0cd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/c2x-warning-1.c
@@ -0,0 +1,5 @@
+/* Test #warning in C2x. */
+/* { dg-do preprocess } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+#warning example text /* { dg-warning "example text" } */
diff --git a/gcc/testsuite/gcc.dg/cpp/c2x-warning-2.c b/gcc/testsuite/gcc.dg/cpp/c2x-warning-2.c
new file mode 100644
index 0000000..3042e7a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/c2x-warning-2.c
@@ -0,0 +1,6 @@
+/* Test #warning in C2x: -Wc11-c2x-comapt. */
+/* { dg-do preprocess } */
+/* { dg-options "-std=c2x -pedantic-errors -Wc11-c2x-compat" } */
+
+#warning example text /* { dg-warning "example text" } */
+/* { dg-warning "#warning before C2X is a GCC extension" "compat" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/gcc.dg/cpp/delimited-escape-seq-1.c b/gcc/testsuite/gcc.dg/cpp/delimited-escape-seq-1.c
new file mode 100644
index 0000000..e08775f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/delimited-escape-seq-1.c
@@ -0,0 +1,10 @@
+/* P2290R3 - Delimited escape sequences */
+/* { dg-do compile } */
+/* { dg-require-effective-target wchar } */
+/* { dg-options "-std=gnu99 -Wno-c++-compat -pedantic" } */
+
+typedef __CHAR32_TYPE__ char32_t;
+
+const char32_t *a = U"\u{1234}"; /* { dg-warning "delimited escape sequences are only valid in" } */
+const char32_t *b = U"\x{1234}"; /* { dg-warning "delimited escape sequences are only valid in" } */
+const char32_t *c = U"\o{1234}"; /* { dg-warning "delimited escape sequences are only valid in" } */
diff --git a/gcc/testsuite/gcc.dg/cpp/delimited-escape-seq-2.c b/gcc/testsuite/gcc.dg/cpp/delimited-escape-seq-2.c
new file mode 100644
index 0000000..71c9865
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/delimited-escape-seq-2.c
@@ -0,0 +1,10 @@
+/* P2290R3 - Delimited escape sequences */
+/* { dg-do compile } */
+/* { dg-require-effective-target wchar } */
+/* { dg-options "-std=gnu99 -Wno-c++-compat -pedantic-errors" } */
+
+typedef __CHAR32_TYPE__ char32_t;
+
+const char32_t *a = U"\u{1234}"; /* { dg-error "delimited escape sequences are only valid in" } */
+const char32_t *b = U"\x{1234}"; /* { dg-error "delimited escape sequences are only valid in" } */
+const char32_t *c = U"\o{1234}"; /* { dg-error "delimited escape sequences are only valid in" } */
diff --git a/gcc/testsuite/gcc.dg/cpp/gnu11-warning-1.c b/gcc/testsuite/gcc.dg/cpp/gnu11-warning-1.c
new file mode 100644
index 0000000..7dda115
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/gnu11-warning-1.c
@@ -0,0 +1,6 @@
+/* Test #warning not in C11. */
+/* { dg-do preprocess } */
+/* { dg-options "-std=gnu11 -pedantic-errors" } */
+
+#warning example text /* { dg-warning "example text" } */
+/* { dg-error "#warning before C2X is a GCC extension" "pedantic" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/gcc.dg/cpp/gnu11-warning-2.c b/gcc/testsuite/gcc.dg/cpp/gnu11-warning-2.c
new file mode 100644
index 0000000..af2cc34
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/gnu11-warning-2.c
@@ -0,0 +1,6 @@
+/* Test #warning not in C11. */
+/* { dg-do preprocess } */
+/* { dg-options "-std=gnu11 -pedantic" } */
+
+#warning example text /* { dg-warning "example text" } */
+/* { dg-warning "#warning before C2X is a GCC extension" "pedantic" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/gcc.dg/cpp/gnu11-warning-3.c b/gcc/testsuite/gcc.dg/cpp/gnu11-warning-3.c
new file mode 100644
index 0000000..22b7b50
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/gnu11-warning-3.c
@@ -0,0 +1,6 @@
+/* Test #warning not in C11. */
+/* { dg-do preprocess } */
+/* { dg-options "-std=gnu11 -Wc11-c2x-compat" } */
+
+#warning example text /* { dg-warning "example text" } */
+/* { dg-warning "#warning before C2X is a GCC extension" "compat" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/gcc.dg/cpp/gnu11-warning-4.c b/gcc/testsuite/gcc.dg/cpp/gnu11-warning-4.c
new file mode 100644
index 0000000..fd8ecfb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/gnu11-warning-4.c
@@ -0,0 +1,6 @@
+/* Test #warning not in C11. */
+/* { dg-do preprocess } */
+/* { dg-options "-std=gnu11" } */
+
+#warning example text /* { dg-warning "example text" } */
+/* Not diagnosed by default. */
diff --git a/gcc/testsuite/gcc.dg/cpp/gnu2x-warning-1.c b/gcc/testsuite/gcc.dg/cpp/gnu2x-warning-1.c
new file mode 100644
index 0000000..c8e5290
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/gnu2x-warning-1.c
@@ -0,0 +1,5 @@
+/* Test #warning in C2x. */
+/* { dg-do preprocess } */
+/* { dg-options "-std=gnu2x -pedantic-errors" } */
+
+#warning example text /* { dg-warning "example text" } */
diff --git a/gcc/testsuite/gcc.dg/cpp/gnu2x-warning-2.c b/gcc/testsuite/gcc.dg/cpp/gnu2x-warning-2.c
new file mode 100644
index 0000000..3aef4b3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/gnu2x-warning-2.c
@@ -0,0 +1,6 @@
+/* Test #warning in C2x: -Wc11-c2x-comapt. */
+/* { dg-do preprocess } */
+/* { dg-options "-std=gnu2x -pedantic-errors -Wc11-c2x-compat" } */
+
+#warning example text /* { dg-warning "example text" } */
+/* { dg-warning "#warning before C2X is a GCC extension" "compat" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/gcc.dg/cpp/named-universal-char-escape-1.c b/gcc/testsuite/gcc.dg/cpp/named-universal-char-escape-1.c
new file mode 100644
index 0000000..45193ac
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/named-universal-char-escape-1.c
@@ -0,0 +1,8 @@
+/* P2071R2 - Named universal character escapes */
+/* { dg-do compile } */
+/* { dg-require-effective-target wchar } */
+/* { dg-options "-std=gnu99 -Wno-c++-compat -pedantic" } */
+
+typedef __CHAR32_TYPE__ char32_t;
+
+const char32_t *a = U"\N{ETHIOPIC SYLLABLE SEE}"; /* { dg-warning "named universal character escapes are only valid in" } */
diff --git a/gcc/testsuite/gcc.dg/cpp/named-universal-char-escape-2.c b/gcc/testsuite/gcc.dg/cpp/named-universal-char-escape-2.c
new file mode 100644
index 0000000..253620a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/named-universal-char-escape-2.c
@@ -0,0 +1,8 @@
+/* P2071R2 - Named universal character escapes */
+/* { dg-do compile } */
+/* { dg-require-effective-target wchar } */
+/* { dg-options "-std=gnu99 -Wno-c++-compat -pedantic-errors" } */
+
+typedef __CHAR32_TYPE__ char32_t;
+
+const char32_t *a = U"\N{ETHIOPIC SYLLABLE SEE}"; /* { dg-error "named universal character escapes are only valid in" } */
diff --git a/gcc/testsuite/gcc.dg/darwin-20040809-2.c b/gcc/testsuite/gcc.dg/darwin-20040809-2.c
deleted file mode 100644
index 98d5712..0000000
--- a/gcc/testsuite/gcc.dg/darwin-20040809-2.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Test dead code strip support. */
-/* Contributed by Devang Patel <dpatel@apple.com> */
-
-/* { dg-do compile { target { *-*-darwin* && stabs } } } */
-/* { dg-options "-gstabs+ -fno-eliminate-unused-debug-symbols" } */
-
-int
-main ()
-{
- return 0;
-}
-
-/* { dg-final { scan-assembler ".stabd.46,0,0" } } */
-/* { dg-final { scan-assembler ".stabd.78,0,0" } } */
-
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-function-4.c b/gcc/testsuite/gcc.dg/debug/btf/btf-function-4.c
new file mode 100644
index 0000000..fd31244
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-function-4.c
@@ -0,0 +1,14 @@
+/* Test BTF linkage for functions.
+
+ We expect to see one BTF_KIND_FUNC type with static linkage encoded in the
+ BTF type's vlen field. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* { dg-final { scan-assembler-times "btt_info: kind=12, kflag=0, linkage=0" 1 } } */
+
+static int funfoo (void)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-function-5.c b/gcc/testsuite/gcc.dg/debug/btf/btf-function-5.c
new file mode 100644
index 0000000..12ee97f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-function-5.c
@@ -0,0 +1,14 @@
+/* Test BTF linkage for functions.
+
+ We expect to see one BTF_KIND_FUNC type with global linkage encoded in the
+ BTF type's vlen field. */
+
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA" } */
+
+/* { dg-final { scan-assembler-times "btt_info: kind=12, kflag=0, linkage=1" 1 } } */
+
+int funfoo (void)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-int-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-int-1.c
index 2381dec..e1ed198 100644
--- a/gcc/testsuite/gcc.dg/debug/btf/btf-int-1.c
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-int-1.c
@@ -4,7 +4,8 @@
| 0 | encoding | offset | 00 | bits |
encoding:
signed 1 << 24
- char 2 << 24
+ char 2 << 24 (not used)
+ bool 4 << 24
All offsets in this test should be 0.
This test does _not_ check number of bits, as it may vary between targets.
@@ -13,13 +14,14 @@
/* { dg-do compile } */
/* { dg-options "-O0 -gbtf -dA" } */
-/* Check for 8 BTF_KIND_INT types. */
-/* { dg-final { scan-assembler-times "\[\t \]0x1000000\[\t \]+\[^\n\]*btt_info" 8 } } */
+/* Check for 9 BTF_KIND_INT types. */
+/* { dg-final { scan-assembler-times "\[\t \]0x1000000\[\t \]+\[^\n\]*btt_info" 9 } } */
-/* Check the signed/char flags, but not bit size. */
-/* { dg-final { scan-assembler-times "\[\t \]0x10000..\[\t \]+\[^\n\]*bti_encoding" 3 } } */
-/* { dg-final { scan-assembler-times "\[\t \]0x20000..\[\t \]+\[^\n\]*bti_encoding" 1 } } */
-/* { dg-final { scan-assembler-times "\[\t \]0x30000..\[\t \]+\[^\n\]*bti_encoding" 1 } } */
+/* Check the signed flags, but not bit size. */
+/* { dg-final { scan-assembler-times "\[\t \]0x10000\[0-9a-zA-Z\]{2}\[\t \]+\[^\n\]*bti_encoding" 4 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x\[0-9a-zA-Z\]{2}\[\t \]+\[^\n\]*bti_encoding" 3 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x\[0-9a-zA-Z\]\[\t \]+\[^\n\]*bti_encoding" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x40000\[0-9a-zA-Z\]{2}\[\t \]+\[^\n\]*bti_encoding" 1 } } */
/* Check that there is a string entry for each type name. */
/* { dg-final { scan-assembler-times "ascii \"unsigned char.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
@@ -42,3 +44,5 @@ signed int f = -66;
unsigned long int g = 77;
signed long int h = 88;
+
+_Bool x = 1;
diff --git a/gcc/testsuite/gcc.dg/debug/pr35154.c b/gcc/testsuite/gcc.dg/debug/pr35154.c
deleted file mode 100644
index 08eefaf..0000000
--- a/gcc/testsuite/gcc.dg/debug/pr35154.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Test to make sure that stabs for C symbols that go into .comm have the
- proper structure. These should be lettered G for the struct that gives
- the name to the .comm, and should be V or S for .lcomm symbols. */
-
-__attribute__ ((used))
-static char i_outer;
-struct {
- char f1;
- char f2;
-} opta;
-struct {
- char f1;
- char f2;
-} optb;
-
-int
-main()
-{
- static char i_inner[2] __attribute__ ((used));
- i_inner[0] = 'a'; i_inner[1] = 'b';
- opta.f1 = 'c';
- opta.f2 = 'd';
- optb.f1 = 'C';
- optb.f2 = 'D';
- i_outer = 'e';
-/* { dg-do compile } */
-/* { dg-skip-if "No stabs" { mmix-*-* alpha*-*-* hppa*64*-*-* ia64-*-* *-*-vxworks* } } */
-/* { dg-skip-if "stabs only" { *-*-* } { "*" } { "-gstabs" } } */
- return 0;
-}
-
-/* { dg-final { scan-assembler ".stabs.*i_inner:V" } } */
-/* { dg-final { scan-assembler ".stabs.*i_outer:S" } } */
-/* { dg-final { scan-assembler ".stabs.*opta:G" } } */
-/* { dg-final { scan-assembler ".stabs.*optb:G" } } */
diff --git a/gcc/testsuite/gcc.dg/fold-eqandshift-4.c b/gcc/testsuite/gcc.dg/fold-eqandshift-4.c
new file mode 100644
index 0000000..fbba438
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fold-eqandshift-4.c
@@ -0,0 +1,46 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+int sr30eq00(signed char x) { return ((x >> 4) & 0x30) == 0; }
+int sr30ne00(signed char x) { return ((x >> 4) & 0x30) != 0; }
+int sr30eq20(signed char z) { return ((z >> 4) & 0x30) == 0x20; }
+int sr30ne20(signed char z) { return ((z >> 4) & 0x30) != 0x20; }
+int sr30eq30(signed char x) { return ((x >> 4) & 0x30) == 0x30; }
+int sr30ne30(signed char x) { return ((x >> 4) & 0x30) != 0x30; }
+int sr33eq33(signed char x) { return ((x >> 4) & 0x33) == 0x33; }
+int sr33ne33(signed char x) { return ((x >> 4) & 0x33) != 0x33; }
+
+int ur30eq00(unsigned char z) { return ((z >> 4) & 0x30) == 0; }
+int ur30ne00(unsigned char z) { return ((z >> 4) & 0x30) != 0; }
+int ur30eq30(unsigned char z) { return ((z >> 4) & 0x30) == 0x30; }
+int ur30ne30(unsigned char z) { return ((z >> 4) & 0x30) != 0x30; }
+int ur33eq03(unsigned char x) { return ((x >> 4) & 0x33) == 0x03; }
+int ur33ne03(unsigned char x) { return ((x >> 4) & 0x33) != 0x03; }
+int ur33eq30(unsigned char z) { return ((z >> 4) & 0x33) == 0x30; }
+int ur33ne30(unsigned char z) { return ((z >> 4) & 0x33) != 0x30; }
+int ur33eq33(unsigned char z) { return ((z >> 4) & 0x33) == 0x33; }
+int ur33ne33(unsigned char z) { return ((z >> 4) & 0x33) != 0x33; }
+
+int sl30eq00(char x) { return ((char)(x << 4) & 0x30) == 0; }
+int sl30ne00(char x) { return ((char)(x << 4) & 0x30) != 0; }
+int sl30eq20(char x) { return ((char)(x << 4) & 0x30) == 0x20; }
+int sl30ne20(char x) { return ((char)(x << 4) & 0x30) != 0x20; }
+int sl30eq30(char x) { return ((char)(x << 4) & 0x30) == 0x30; }
+int sl30ne30(char x) { return ((char)(x << 4) & 0x30) != 0x30; }
+int sl33eq00(char x) { return ((char)(x << 4) & 0x33) == 0; }
+int sl33ne00(char x) { return ((char)(x << 4) & 0x33) != 0; }
+int sl33eq03(char z) { return ((char)(z << 4) & 0x33) == 0x03; }
+int sl33ne03(char z) { return ((char)(z << 4) & 0x33) != 0x03; }
+int sl33eq30(char x) { return ((char)(x << 4) & 0x33) == 0x30; }
+int sl33ne30(char x) { return ((char)(x << 4) & 0x33) != 0x30; }
+int sl33eq33(char z) { return ((char)(z << 4) & 0x33) == 0x33; }
+int sl33ne33(char z) { return ((char)(z << 4) & 0x33) != 0x33; }
+
+/* { dg-final { scan-tree-dump-not " >> " "optimized" } } */
+/* { dg-final { scan-tree-dump-not " << " "optimized" } } */
+/* { dg-final { scan-tree-dump-not "z_\[0-9\]\\(D\\)" "optimized" } } */
+/* { dg-final { scan-tree-dump-times "return \[01\]" 14 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "char z\\)" 14 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "x_\[0-9\]\\(D\\)" 18 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "char x\\)" 18 "optimized" } } */
+
diff --git a/gcc/testsuite/gcc.dg/gnu2x-empty-init-1.c b/gcc/testsuite/gcc.dg/gnu2x-empty-init-1.c
new file mode 100644
index 0000000..e7dc9df
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gnu2x-empty-init-1.c
@@ -0,0 +1,29 @@
+/* Test C2X support for empty initializers: valid use cases with GNU
+ extensions. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu2x" } */
+
+extern void exit (int);
+extern void abort (void);
+
+void
+f (int a)
+{
+ struct s { volatile int x[a]; };
+ struct s b = {};
+ for (int i = 0; i < a; i++)
+ if (b.x[i] != 0)
+ abort ();
+ /* Overwrite contents of b.x before second call to make it more likely stack
+ contents are nonzero if proper initialization did not occur. */
+ for (int i = 0; i < a; i++)
+ b.x[i] = -1;
+}
+
+int
+main (void)
+{
+ f (100);
+ f (100);
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/gnu2x-empty-init-2.c b/gcc/testsuite/gcc.dg/gnu2x-empty-init-2.c
new file mode 100644
index 0000000..69ee4e3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gnu2x-empty-init-2.c
@@ -0,0 +1,16 @@
+/* Test C2X support for empty initializers: invalid use cases with GNU
+ extensions. */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu2x" } */
+
+void
+f (int a)
+{
+ /* Make sure a non-braced initializer for a VLA-in-struct is still not
+ allowed. */
+ struct s { int x[a]; };
+ struct s b;
+ for (int i = 0; i < a; i++)
+ b.x[i] = 0;
+ struct s c = b; /* { dg-error "variable-sized object may not be initialized except with an empty initializer" } */
+}
diff --git a/gcc/testsuite/gcc.dg/gnu2x-utf8str-type.c b/gcc/testsuite/gcc.dg/gnu2x-utf8str-type.c
new file mode 100644
index 0000000..efe16ff
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gnu2x-utf8str-type.c
@@ -0,0 +1,5 @@
+/* Test C2X UTF-8 string literal type with -std=gnu2x. */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu2x" } */
+
+#include "c2x-utf8str-type.c"
diff --git a/gcc/testsuite/gcc.dg/gnu2x-utf8str.c b/gcc/testsuite/gcc.dg/gnu2x-utf8str.c
new file mode 100644
index 0000000..f3719ea
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gnu2x-utf8str.c
@@ -0,0 +1,34 @@
+/* Test initialization by UTF-8 string literal in C2X with -std=gnu2x. */
+/* { dg-do compile } */
+/* { dg-require-effective-target wchar } */
+/* { dg-options "-std=gnu2x" } */
+
+typedef __CHAR8_TYPE__ char8_t;
+typedef __CHAR16_TYPE__ char16_t;
+typedef __CHAR32_TYPE__ char32_t;
+typedef __WCHAR_TYPE__ wchar_t;
+
+/* Test that char, signed char, unsigned char, and char8_t arrays can be
+ initialized by a UTF-8 string literal. */
+const char cbuf1[] = u8"text";
+const char cbuf2[] = { u8"text" };
+const signed char scbuf1[] = u8"text";
+const signed char scbuf2[] = { u8"text" };
+const unsigned char ucbuf1[] = u8"text";
+const unsigned char ucbuf2[] = { u8"text" };
+const char8_t c8buf1[] = u8"text";
+const char8_t c8buf2[] = { u8"text" };
+
+/* Test that a diagnostic is issued for attempted initialization of
+ other character types by a UTF-8 string literal. */
+const char16_t c16buf1[] = u8"text"; /* { dg-error "from a string literal with type array of .unsigned char." } */
+const char16_t c16buf2[] = { u8"text" }; /* { dg-error "from a string literal with type array of .unsigned char." } */
+const char32_t c32buf1[] = u8"text"; /* { dg-error "from a string literal with type array of .unsigned char." } */
+const char32_t c32buf2[] = { u8"text" }; /* { dg-error "from a string literal with type array of .unsigned char." } */
+const wchar_t wbuf1[] = u8"text"; /* { dg-error "from a string literal with type array of .unsigned char." } */
+const wchar_t wbuf2[] = { u8"text" }; /* { dg-error "from a string literal with type array of .unsigned char." } */
+
+/* Test that char8_t arrays can be initialized by an ordinary string
+ literal. */
+const char8_t c8buf3[] = "text";
+const char8_t c8buf4[] = { "text" };
diff --git a/gcc/testsuite/gcc.dg/init-bad-1.c b/gcc/testsuite/gcc.dg/init-bad-1.c
index 6173404..0da10c3 100644
--- a/gcc/testsuite/gcc.dg/init-bad-1.c
+++ b/gcc/testsuite/gcc.dg/init-bad-1.c
@@ -21,8 +21,7 @@ char t1[1] = { "xy" }; /* { dg-warning "initializer-string for array of 'char' i
char u[1] = { "x", "x" }; /* { dg-error "excess elements in 'char' array initializer" } */
/* { dg-message "near init" "near" { target *-*-* } .-1 } */
-int i = { }; /* { dg-error "empty scalar initializer" } */
-/* { dg-message "near init" "near" { target *-*-* } .-1 } */
+int i = { };
int j = { 1 };
diff --git a/gcc/testsuite/gcc.dg/noncompile/pr71583.c b/gcc/testsuite/gcc.dg/noncompile/pr71583.c
index 5045b88..fe6e556 100644
--- a/gcc/testsuite/gcc.dg/noncompile/pr71583.c
+++ b/gcc/testsuite/gcc.dg/noncompile/pr71583.c
@@ -5,7 +5,7 @@ void
f (int i)
{
(int (*)[++i]) { int }; /* { dg-error "expected" } */
- (int (*)[++i]) { }; /* { dg-error "empty" } */
+ (int (*)[++i]) { };
(int (*)[++i]) { , }; /* { dg-error "expected" } */
(int (*)[++i]) { f () }; /* { dg-error "too few" } */
}
diff --git a/gcc/testsuite/gcc.dg/plugin/analyzer_kernel_plugin.c b/gcc/testsuite/gcc.dg/plugin/analyzer_kernel_plugin.c
new file mode 100644
index 0000000..6ec08bf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/analyzer_kernel_plugin.c
@@ -0,0 +1,237 @@
+/* Proof-of-concept of a -fanalyzer plugin for the Linux kernel. */
+/* { dg-options "-g" } */
+
+#include "gcc-plugin.h"
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tree.h"
+#include "function.h"
+#include "basic-block.h"
+#include "gimple.h"
+#include "gimple-iterator.h"
+#include "diagnostic-core.h"
+#include "graphviz.h"
+#include "options.h"
+#include "cgraph.h"
+#include "tree-dfa.h"
+#include "stringpool.h"
+#include "convert.h"
+#include "target.h"
+#include "fold-const.h"
+#include "tree-pretty-print.h"
+#include "diagnostic-color.h"
+#include "diagnostic-metadata.h"
+#include "tristate.h"
+#include "bitmap.h"
+#include "selftest.h"
+#include "function.h"
+#include "json.h"
+#include "analyzer/analyzer.h"
+#include "analyzer/analyzer-logging.h"
+#include "ordered-hash-map.h"
+#include "options.h"
+#include "cgraph.h"
+#include "cfg.h"
+#include "digraph.h"
+#include "analyzer/supergraph.h"
+#include "sbitmap.h"
+#include "analyzer/call-string.h"
+#include "analyzer/program-point.h"
+#include "analyzer/store.h"
+#include "analyzer/region-model.h"
+#include "analyzer/call-info.h"
+
+int plugin_is_GPL_compatible;
+
+#if ENABLE_ANALYZER
+
+namespace ana {
+
+/* Implementation of "copy_from_user" and "copy_to_user". */
+
+class copy_across_boundary_fn : public known_function
+{
+ public:
+ virtual bool untrusted_source_p () const = 0;
+ virtual bool untrusted_destination_p () const = 0;
+
+ void impl_call_pre (const call_details &cd) const final override
+ {
+ region_model_manager *mgr = cd.get_manager ();
+ region_model *model = cd.get_model ();
+ region_model_context *ctxt = cd.get_ctxt ();
+
+ const svalue *dest_sval = cd.get_arg_svalue (0);
+ const svalue *src_sval = cd.get_arg_svalue (1);
+ const svalue *num_bytes_sval = cd.get_arg_svalue (2);
+
+ const region *dest_reg = model->deref_rvalue (dest_sval,
+ cd.get_arg_tree (0),
+ ctxt);
+ const region *src_reg = model->deref_rvalue (src_sval,
+ cd.get_arg_tree (1),
+ ctxt);
+ if (const svalue *bounded_sval
+ = model->maybe_get_copy_bounds (src_reg, num_bytes_sval))
+ num_bytes_sval = bounded_sval;
+
+ if (tree cst = num_bytes_sval->maybe_get_constant ())
+ if (zerop (cst))
+ /* No-op. */
+ return;
+
+ const region *sized_src_reg = mgr->get_sized_region (src_reg,
+ NULL_TREE,
+ num_bytes_sval);
+
+ const svalue *copied_sval
+ = model->get_store_value (sized_src_reg, ctxt);
+ const region *sized_dest_reg = mgr->get_sized_region (dest_reg,
+ NULL_TREE,
+ num_bytes_sval);
+
+ if (ctxt)
+ {
+ /* Bifurcate state, creating a "failure" out-edge. */
+ ctxt->bifurcate (new copy_failure (cd));
+
+ /* The "unbifurcated" state is the "success" case. */
+ copy_success success (cd,
+ sized_dest_reg,
+ copied_sval,
+ sized_src_reg,
+ untrusted_source_p (),
+ untrusted_destination_p ());
+ success.update_model (model, NULL, ctxt);
+ }
+ }
+
+ private:
+ class copy_success : public success_call_info
+ {
+ public:
+ copy_success (const call_details &cd,
+ const region *sized_dest_reg,
+ const svalue *copied_sval,
+ const region *sized_src_reg,
+ bool untrusted_source,
+ bool untrusted_destination)
+ : success_call_info (cd),
+ m_sized_dest_reg (sized_dest_reg),
+ m_copied_sval (copied_sval),
+ m_sized_src_reg (sized_src_reg),
+ m_untrusted_source (untrusted_source),
+ m_untrusted_destination (untrusted_destination)
+ {}
+
+ bool update_model (region_model *model,
+ const exploded_edge *,
+ region_model_context *ctxt) const final override
+ {
+ call_details cd (get_call_details (model, ctxt));
+ model->update_for_zero_return (cd, true);
+ model->set_value (m_sized_dest_reg, m_copied_sval, ctxt);
+ if (ctxt && m_untrusted_source)
+ model->mark_as_tainted (m_copied_sval, ctxt);
+ if (m_untrusted_destination)
+ model->maybe_complain_about_infoleak (m_sized_dest_reg,
+ m_copied_sval,
+ m_sized_src_reg,
+ ctxt);
+ return true;
+ }
+
+ const region *m_sized_dest_reg;
+ const svalue *m_copied_sval;
+ const region *m_sized_src_reg;
+ bool m_untrusted_source;
+ bool m_untrusted_destination;
+ };
+
+ class copy_failure : public failed_call_info
+ {
+ public:
+ copy_failure (const call_details &cd)
+ : failed_call_info (cd)
+ {}
+
+ bool update_model (region_model *model,
+ const exploded_edge *,
+ region_model_context *ctxt) const final override
+ {
+ call_details cd (get_call_details (model, ctxt));
+ model->update_for_nonzero_return (cd);
+ /* Leave the destination region untouched. */
+ return true;
+ }
+ };
+};
+
+/* "copy_from_user". */
+
+class known_function_copy_from_user : public copy_across_boundary_fn
+{
+public:
+ bool untrusted_source_p () const final override
+ {
+ return true;
+ }
+ bool untrusted_destination_p () const final override
+ {
+ return false;
+ }
+};
+
+/* "copy_to_user". */
+
+class known_function_copy_to_user : public copy_across_boundary_fn
+{
+public:
+ bool untrusted_source_p () const final override
+ {
+ return false;
+ }
+ bool untrusted_destination_p () const final override
+ {
+ return true;
+ }
+};
+
+/* Callback handler for the PLUGIN_ANALYZER_INIT event. */
+
+static void
+kernel_analyzer_init_cb (void *gcc_data, void */*user_data*/)
+{
+ ana::plugin_analyzer_init_iface *iface
+ = (ana::plugin_analyzer_init_iface *)gcc_data;
+ LOG_SCOPE (iface->get_logger ());
+ if (0)
+ inform (input_location, "got here: kernel_analyzer_init_cb");
+ iface->register_known_function ("copy_from_user",
+ new known_function_copy_from_user ());
+ iface->register_known_function ("copy_to_user",
+ new known_function_copy_to_user ());
+}
+
+} // namespace ana
+
+#endif /* #if ENABLE_ANALYZER */
+
+int
+plugin_init (struct plugin_name_args *plugin_info,
+ struct plugin_gcc_version *version)
+{
+#if ENABLE_ANALYZER
+ const char *plugin_name = plugin_info->base_name;
+ if (0)
+ inform (input_location, "got here; %qs", plugin_name);
+ register_callback (plugin_info->base_name,
+ PLUGIN_ANALYZER_INIT,
+ ana::kernel_analyzer_init_cb,
+ NULL); /* void *user_data */
+#else
+ sorry_no_analyzer ();
+#endif
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/analyzer_known_fns_plugin.c b/gcc/testsuite/gcc.dg/plugin/analyzer_known_fns_plugin.c
new file mode 100644
index 0000000..060a308
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/analyzer_known_fns_plugin.c
@@ -0,0 +1,201 @@
+/* Proof-of-concept of a -fanalyzer plugin to handle known functions. */
+/* { dg-options "-g" } */
+
+#include "gcc-plugin.h"
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tree.h"
+#include "function.h"
+#include "basic-block.h"
+#include "gimple.h"
+#include "gimple-iterator.h"
+#include "diagnostic-core.h"
+#include "graphviz.h"
+#include "options.h"
+#include "cgraph.h"
+#include "tree-dfa.h"
+#include "stringpool.h"
+#include "convert.h"
+#include "target.h"
+#include "fold-const.h"
+#include "tree-pretty-print.h"
+#include "diagnostic-color.h"
+#include "diagnostic-metadata.h"
+#include "tristate.h"
+#include "bitmap.h"
+#include "selftest.h"
+#include "function.h"
+#include "json.h"
+#include "analyzer/analyzer.h"
+#include "analyzer/analyzer-logging.h"
+#include "ordered-hash-map.h"
+#include "options.h"
+#include "cgraph.h"
+#include "cfg.h"
+#include "digraph.h"
+#include "analyzer/supergraph.h"
+#include "sbitmap.h"
+#include "analyzer/call-string.h"
+#include "analyzer/program-point.h"
+#include "analyzer/store.h"
+#include "analyzer/region-model.h"
+#include "analyzer/call-info.h"
+
+int plugin_is_GPL_compatible;
+
+#if ENABLE_ANALYZER
+
+namespace ana {
+
+/* Basic example of known fn behavior. */
+
+class known_function_returns_42 : public known_function
+{
+public:
+ void impl_call_pre (const call_details &cd) const final override
+ {
+ if (cd.get_lhs_type ())
+ {
+ const svalue *result
+ = cd.get_manager ()->get_or_create_int_cst (cd.get_lhs_type (), 42);
+ cd.maybe_set_lhs (result);
+ }
+ }
+};
+
+/* Example of bifurcation, with a copy that can fail. */
+
+class known_function_attempt_to_copy : public known_function
+{
+public:
+ class copy_success : public success_call_info
+ {
+ public:
+ copy_success (const call_details &cd,
+ const region *sized_dest_reg,
+ const svalue *copied_sval)
+ : success_call_info (cd),
+ m_sized_dest_reg (sized_dest_reg),
+ m_copied_sval (copied_sval)
+ {}
+
+ bool update_model (region_model *model,
+ const exploded_edge *,
+ region_model_context *ctxt) const final override
+ {
+ call_details cd (get_call_details (model, ctxt));
+ model->update_for_zero_return (cd, true);
+ model->set_value (m_sized_dest_reg, m_copied_sval, ctxt);
+ return true;
+ }
+
+ const region *m_sized_dest_reg;
+ const svalue *m_copied_sval;
+ const region *m_sized_src_reg;
+ };
+
+ class copy_failure : public failed_call_info
+ {
+ public:
+ copy_failure (const call_details &cd)
+ : failed_call_info (cd)
+ {}
+
+ bool update_model (region_model *model,
+ const exploded_edge *,
+ region_model_context *ctxt) const final override
+ {
+ call_details cd (get_call_details (model, ctxt));
+ model->update_for_nonzero_return (cd);
+ /* Leave the destination region untouched. */
+ return true;
+ }
+ };
+
+ void impl_call_pre (const call_details &cd) const final override
+ {
+ region_model_manager *mgr = cd.get_manager ();
+ region_model *model = cd.get_model ();
+
+ const svalue *dest_sval = cd.get_arg_svalue (0);
+ const svalue *src_sval = cd.get_arg_svalue (1);
+ const svalue *num_bytes_sval = cd.get_arg_svalue (2);
+
+ const region *dest_reg = model->deref_rvalue (dest_sval,
+ cd.get_arg_tree (0),
+ cd.get_ctxt ());
+ const region *src_reg = model->deref_rvalue (src_sval,
+ cd.get_arg_tree (1),
+ cd.get_ctxt ());
+ if (const svalue * bounded_sval
+ = model->maybe_get_copy_bounds (src_reg, num_bytes_sval))
+ num_bytes_sval = bounded_sval;
+
+ if (tree cst = num_bytes_sval->maybe_get_constant ())
+ if (zerop (cst))
+ /* No-op. */
+ return;
+
+ const region *sized_src_reg = mgr->get_sized_region (src_reg,
+ NULL_TREE,
+ num_bytes_sval);
+
+ const svalue *copied_sval
+ = model->get_store_value (sized_src_reg, cd.get_ctxt ());
+
+ const region *sized_dest_reg = mgr->get_sized_region (dest_reg,
+ NULL_TREE,
+ num_bytes_sval);
+
+ if (cd.get_ctxt ())
+ {
+ /* Bifurcate state, creating a "failure" out-edge. */
+ cd.get_ctxt ()->bifurcate (new copy_failure (cd));
+
+ /* The "unbifurcated" state is the "success" case. */
+ copy_success success (cd,
+ sized_dest_reg,
+ copied_sval);
+ success.update_model (model, NULL, cd.get_ctxt ());
+ }
+ }
+};
+
+/* Callback handler for the PLUGIN_ANALYZER_INIT event. */
+
+static void
+known_fn_analyzer_init_cb (void *gcc_data, void */*user_data*/)
+{
+ ana::plugin_analyzer_init_iface *iface
+ = (ana::plugin_analyzer_init_iface *)gcc_data;
+ LOG_SCOPE (iface->get_logger ());
+ if (0)
+ inform (input_location, "got here: known_fn_analyzer_init_cb");
+ iface->register_known_function ("returns_42",
+ new known_function_returns_42 ());
+ iface->register_known_function ("attempt_to_copy",
+ new known_function_attempt_to_copy ());
+}
+
+} // namespace ana
+
+#endif /* #if ENABLE_ANALYZER */
+
+int
+plugin_init (struct plugin_name_args *plugin_info,
+ struct plugin_gcc_version *version)
+{
+#if ENABLE_ANALYZER
+ const char *plugin_name = plugin_info->base_name;
+ if (0)
+ inform (input_location, "got here; %qs", plugin_name);
+ register_callback (plugin_info->base_name,
+ PLUGIN_ANALYZER_INIT,
+ ana::known_fn_analyzer_init_cb,
+ NULL); /* void *user_data */
+#else
+ sorry_no_analyzer ();
+#endif
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/copy_from_user-1.c b/gcc/testsuite/gcc.dg/plugin/copy_from_user-1.c
new file mode 100644
index 0000000..a1415f3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/copy_from_user-1.c
@@ -0,0 +1,45 @@
+typedef __SIZE_TYPE__ size_t;
+
+#define __user
+
+extern int copy_from_user(void *to, const void __user *from, long n)
+ __attribute__((access (write_only, 1, 3),
+ access (read_only, 2, 3)
+ ));
+
+#define EFAULT 14
+#define EINVAL 22
+
+/* Taken from Linux: fs/binfmt_misc.c (GPL-2.0-only). */
+
+int parse_command(const char __user *buffer, size_t count)
+{
+ char s[4];
+
+ if (count > 3)
+ return -EINVAL;
+ if (copy_from_user(s, buffer, count))
+ return -EFAULT;
+ if (!count)
+ return 0;
+ if (s[count - 1] == '\n') /* { dg-bogus "uninit" } */
+ count--;
+ if (count == 1 && s[0] == '0') /* { dg-bogus "uninit" } */
+ return 1;
+ if (count == 1 && s[0] == '1') /* { dg-bogus "uninit" } */
+ return 2;
+ if (count == 2 && s[0] == '-' && s[1] == '1') /* { dg-bogus "uninit" } */
+ return 3;
+ return -EINVAL;
+}
+
+/* Not using return value from copy_from_user. */
+
+int test_2 (const char __user *buffer, size_t count)
+{
+ char s[4];
+ if (count > 3)
+ return -EINVAL;
+ copy_from_user(s, buffer, count);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/infoleak-1.c b/gcc/testsuite/gcc.dg/plugin/infoleak-1.c
new file mode 100644
index 0000000..b4958e7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/infoleak-1.c
@@ -0,0 +1,185 @@
+/* { dg-do compile } */
+/* { dg-options "-fanalyzer" } */
+/* { dg-require-effective-target analyzer } */
+
+#include <string.h>
+
+#include "test-uaccess.h"
+
+typedef unsigned char u8;
+typedef unsigned __INT16_TYPE__ u16;
+typedef unsigned __INT32_TYPE__ u32;
+
+struct s1
+{
+ u32 i;
+};
+
+void test_1a (void __user *dst, u32 a)
+{
+ struct s1 s;
+ s.i = a;
+ copy_to_user(dst, &s, sizeof (struct s1)); /* { dg-bogus "" } */
+}
+
+void test_1b (void __user *dst, u32 a)
+{
+ struct s1 s;
+ copy_to_user(dst, &s, sizeof (struct s1)); /* { dg-warning "potential exposure of sensitive information by copying uninitialized data from stack" "warning" } */
+ /* { dg-message "4 bytes are uninitialized" "note how much" { target *-*-* } .-1 } */
+}
+
+void test_1c (void __user *dst, u32 a)
+{
+ struct s1 s;
+ memset (&s, 0, sizeof (struct s1));
+ copy_to_user(dst, &s, sizeof (struct s1)); /* { dg-bogus "" } */
+}
+
+void test_1d (void __user *dst, u32 a)
+{
+ struct s1 s = {0};
+ copy_to_user(dst, &s, sizeof (struct s1)); /* { dg-bogus "" } */
+}
+
+struct s2
+{
+ u32 i;
+ u32 j; /* { dg-message "field 'j' is uninitialized \\(4 bytes\\)" } */
+};
+
+void test_2a (void __user *dst, u32 a)
+{
+ struct s2 s; /* { dg-message "region created on stack here" "where" } */
+ /* { dg-message "capacity: 8 bytes" "capacity" { target *-*-* } .-1 } */
+ s.i = a;
+ copy_to_user(dst, &s, sizeof (struct s2)); /* { dg-warning "potential exposure of sensitive information by copying uninitialized data from stack" "warning" } */
+ /* { dg-message "4 bytes are uninitialized" "note how much" { target *-*-* } .-1 } */
+}
+
+void test_2b (void __user *dst, u32 a)
+{
+ struct s2 s;
+ s.i = a;
+ /* Copy with wrong size (only part of s2). */
+ copy_to_user(dst, &s, sizeof (struct s1));
+}
+
+void test_2d (void __user *dst, u32 a)
+{
+ struct s2 s = {0};
+ s.i = a;
+ copy_to_user(dst, &s, sizeof (struct s2)); /* { dg-bogus" } */
+}
+
+struct empty {};
+
+void test_empty (void __user *dst)
+{
+ struct empty e;
+ copy_to_user(dst, &e, sizeof (struct empty));
+}
+
+union un_a
+{
+ u32 i;
+ u8 j;
+};
+
+/* As above, but in a different order. */
+
+union un_b
+{
+ u8 j;
+ u32 i;
+};
+
+void test_union_1a (void __user *dst, u8 v)
+{
+ union un_a u; /* { dg-message "region created on stack here" "where" } */
+ /* { dg-message "capacity: 4 bytes" "capacity" { target *-*-* } .-1 } */
+ u.j = v;
+ copy_to_user(dst, &u, sizeof (union un_a)); /* { dg-warning "potential exposure of sensitive information by copying uninitialized data from stack" "warning" } */
+ /* { dg-message "3 bytes are uninitialized" "note how much" { target *-*-* } .-1 } */
+ /* { dg-message "bytes 1 - 3 are uninitialized" "note how much" { target *-*-* } .-2 } */
+}
+
+void test_union_1b (void __user *dst, u8 v)
+{
+ union un_b u; /* { dg-message "region created on stack here" "where" } */
+ /* { dg-message "capacity: 4 bytes" "capacity" { target *-*-* } .-1 } */
+ u.j = v;
+ copy_to_user(dst, &u, sizeof (union un_b)); /* { dg-warning "potential exposure of sensitive information by copying uninitialized data from stack" "warning" } */
+ /* { dg-message "3 bytes are uninitialized" "note how much" { target *-*-* } .-1 } */
+ /* { dg-message "bytes 1 - 3 are uninitialized" "note how much" { target *-*-* } .-2 } */
+}
+
+void test_union_2a (void __user *dst, u8 v)
+{
+ union un_a u = {0};
+ u.j = v;
+ copy_to_user(dst, &u, sizeof (union un_a));
+}
+
+void test_union_2b (void __user *dst, u8 v)
+{
+ union un_b u = {0};
+ u.j = v;
+ copy_to_user(dst, &u, sizeof (union un_b));
+}
+
+void test_union_3a (void __user *dst, u32 v)
+{
+ union un_a u;
+ u.i = v;
+ copy_to_user(dst, &u, sizeof (union un_a)); /* { dg-bogus "" } */
+}
+
+void test_union_3b (void __user *dst, u32 v)
+{
+ union un_b u;
+ u.i = v;
+ copy_to_user(dst, &u, sizeof (union un_b)); /* { dg-bogus "" } */
+}
+
+void test_union_4a (void __user *dst, u8 v)
+{
+ union un_a u = {0};
+ copy_to_user(dst, &u, sizeof (union un_a)); /* { dg-bogus "" } */
+}
+
+void test_union_4b (void __user *dst, u8 v)
+{
+ union un_b u = {0};
+ copy_to_user(dst, &u, sizeof (union un_b)); /* { dg-bogus "" } */
+}
+
+struct st_union_5
+{
+ union {
+ u8 f1;
+ u32 f2;
+ } u; /* { dg-message "field 'u' is partially uninitialized" } */
+};
+
+void test_union_5 (void __user *dst, u8 v)
+{
+ struct st_union_5 st; /* { dg-message "region created on stack here" "where" } */
+ /* { dg-message "capacity: 4 bytes" "capacity" { target *-*-* } .-1 } */
+
+ /* This write only initializes the u8 within the union "u",
+ leaving the remaining 3 bytes uninitialized. */
+ st.u.f1 = v;
+
+ copy_to_user (dst, &st, sizeof(st)); /* { dg-warning "potential exposure of sensitive information by copying uninitialized data from stack" "warning" } */
+ /* { dg-message "3 bytes are uninitialized" "note how much" { target *-*-* } .-1 } */
+}
+
+void test_one_byte (void __user *dst)
+{
+ char src; /* { dg-message "region created on stack here" "where" } */
+ /* { dg-message "capacity: 1 byte" "capacity" { target *-*-* } .-1 } */
+
+ copy_to_user (dst, &src, sizeof(src)); /* { dg-warning "potential exposure of sensitive information by copying uninitialized data from stack" "warning" } */
+ /* { dg-message "1 byte is uninitialized" "note how much" { target *-*-* } .-1 } */
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/infoleak-2.c b/gcc/testsuite/gcc.dg/plugin/infoleak-2.c
new file mode 100644
index 0000000..252f8f2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/infoleak-2.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-fanalyzer" } */
+/* { dg-require-effective-target analyzer } */
+
+#include <string.h>
+
+#include "test-uaccess.h"
+
+typedef unsigned char u8;
+typedef unsigned __INT16_TYPE__ u16;
+typedef unsigned __INT32_TYPE__ u32;
+
+/* Coverage for the various singular and plural forms of bits, bytes, and fields vs padding. */
+
+struct st
+{
+ u32 a; /* { dg-message "field 'a' is uninitialized \\(4 bytes\\)" } */
+ int b:1; /* { dg-message "field 'b' is uninitialized \\(1 bit\\)" "field" } */
+ /* { dg-message "padding after field 'b' is uninitialized \\(7 bits\\)" "padding" { target *-*-* } .-1 } */
+ u8 d; /* { dg-message "field 'd' is uninitialized \\(1 byte\\)" } */
+ int c:7; /* { dg-message "padding after field 'c' is uninitialized \\(9 bits\\)" } */
+ u16 e; /* { dg-message "padding after field 'e' is uninitialized \\(2 bytes\\)" } */
+};
+
+void test (void __user *dst, u16 v)
+{
+ struct st s; /* { dg-message "region created on stack here" "where" } */
+ /* { dg-message "capacity: 12 bytes" "capacity" { target *-*-* } .-1 } */
+ /* { dg-message "suggest forcing zero-initialization by providing a '\\{0\\}' initializer" "fix-it" { target *-*-* } .-2 } */
+ s.e = v;
+ copy_to_user(dst, &s, sizeof (struct st)); /* { dg-warning "potential exposure of sensitive information by copying uninitialized data from stack" "warning" } */
+ /* { dg-message "10 bytes are uninitialized" "note how much" { target *-*-* } .-1 } */
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/infoleak-3.c b/gcc/testsuite/gcc.dg/plugin/infoleak-3.c
new file mode 100644
index 0000000..097a0d8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/infoleak-3.c
@@ -0,0 +1,145 @@
+/* Verify that -Wanalyzer-exposure-through-uninit-copy doesn't get confused
+ if size argument to copy_to_user is an upper bound, rather than a
+ constant. */
+
+/* { dg-do compile } */
+/* { dg-options "-fanalyzer" } */
+/* { dg-require-effective-target analyzer } */
+
+#include "../analyzer/analyzer-decls.h"
+
+typedef __SIZE_TYPE__ size_t;
+
+#include "test-uaccess.h"
+
+typedef unsigned __INT32_TYPE__ u32;
+
+/* min_t adapted from include/linux/kernel.h. */
+
+#define min_t(type, x, y) ({ \
+ type __min1 = (x); \
+ type __min2 = (y); \
+ __min1 < __min2 ? __min1: __min2; })
+
+struct st
+{
+ u32 a;
+ u32 b;
+};
+
+/* Verify that we cope with min_t. */
+
+void test_1_full_init (void __user *dst, u32 x, u32 y, unsigned long in_sz)
+{
+ struct st s;
+ s.a = x;
+ s.b = y;
+ unsigned long copy_sz = min_t(unsigned long, in_sz, sizeof(s));
+ copy_to_user(dst, &s, copy_sz); /* { dg-bogus "exposure" } */
+}
+
+void test_1_partial_init (void __user *dst, u32 x, u32 y, unsigned long in_sz)
+{
+ struct st s;
+ s.a = x;
+ /* s.y not initialized. */
+ unsigned long copy_sz = min_t(unsigned long, in_sz, sizeof(s));
+ copy_to_user(dst, &s, copy_sz); /* { dg-warning "exposure" } */
+}
+
+/* Constant on LHS rather than RHS. */
+
+void test_2_full_init (void __user *dst, u32 x, u32 y, unsigned long in_sz)
+{
+ struct st s;
+ s.a = x;
+ s.b = y;
+ unsigned long copy_sz = min_t(unsigned long, sizeof(s), in_sz);
+ copy_to_user(dst, &s, copy_sz); /* { dg-bogus "exposure" } */
+}
+
+void test_2_partial_init (void __user *dst, u32 x, u32 y, unsigned long in_sz)
+{
+ struct st s;
+ s.a = x;
+ /* s.y not initialized. */
+ unsigned long copy_sz = min_t(unsigned long, sizeof(s), in_sz);
+ copy_to_user(dst, &s, copy_sz); /* { dg-warning "exposure" } */
+}
+
+/* min_t with various casts. */
+
+void test_3_full_init (void __user *dst, u32 x, u32 y, int in_sz)
+{
+ struct st s;
+ s.a = x;
+ s.b = y;
+ int copy_sz = min_t(unsigned int, in_sz, sizeof(s));
+ copy_to_user(dst, &s, copy_sz); /* { dg-bogus "exposure" } */
+}
+
+void test_3_partial_init (void __user *dst, u32 x, u32 y, int in_sz)
+{
+ struct st s;
+ s.a = x;
+ /* s.y not initialized. */
+ int copy_sz = min_t(unsigned int, in_sz, sizeof(s));
+ copy_to_user(dst, &s, copy_sz); /* { dg-warning "exposure" } */
+}
+
+/* Comparison against an upper bound. */
+
+void test_4_full_init (void __user *dst, u32 x, u32 y, size_t in_sz)
+{
+ struct st s;
+ s.a = x;
+ s.b = y;
+
+ size_t copy_sz = in_sz;
+ if (copy_sz > sizeof(s))
+ copy_sz = sizeof(s);
+
+ copy_to_user(dst, &s, copy_sz); /* { dg-bogus "exposure" } */
+}
+
+void test_4_partial_init (void __user *dst, u32 x, u32 y, size_t in_sz)
+{
+ struct st s;
+ s.a = x;
+ /* s.y not initialized. */
+
+ size_t copy_sz = in_sz;
+ if (copy_sz > sizeof(s))
+ copy_sz = sizeof(s);
+
+ copy_to_user(dst, &s, copy_sz); /* { dg-warning "exposure" } */
+}
+
+/* Comparison against an upper bound with casts. */
+
+void test_5_full_init (void __user *dst, u32 x, u32 y, int in_sz)
+{
+ struct st s;
+ s.a = x;
+ s.b = y;
+
+ int copy_sz = in_sz;
+ if (copy_sz > sizeof(s))
+ copy_sz = sizeof(s);
+ copy_to_user(dst, &s, copy_sz); /* { dg-bogus "exposure" } */
+}
+
+/* Comparison against an upper bound with casts. */
+
+void test_5_partial_init (void __user *dst, u32 x, u32 y, int in_sz)
+{
+ struct st s;
+ s.a = x;
+ /* s.y not initialized. */
+
+ int copy_sz = in_sz;
+ if (copy_sz > sizeof(s))
+ copy_sz = sizeof(s);
+
+ copy_to_user(dst, &s, copy_sz); /* { dg-warning "exposure" "" } */
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/infoleak-CVE-2011-1078-1.c b/gcc/testsuite/gcc.dg/plugin/infoleak-CVE-2011-1078-1.c
new file mode 100644
index 0000000..3616fbe
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/infoleak-CVE-2011-1078-1.c
@@ -0,0 +1,138 @@
+/* "The sco_sock_getsockopt_old function in net/bluetooth/sco.c in the
+ Linux kernel before 2.6.39 does not initialize a certain structure,
+ which allows local users to obtain potentially sensitive information
+ from kernel stack memory via the SCO_CONNINFO option."
+
+ Fixed e.g. by c4c896e1471aec3b004a693c689f60be3b17ac86 on linux-2.6.39.y
+ in linux-stable. */
+
+/* { dg-do compile } */
+/* { dg-options "-fanalyzer" } */
+/* { dg-require-effective-target analyzer } */
+
+#include <string.h>
+
+typedef unsigned char __u8;
+typedef unsigned short __u16;
+
+#include "test-uaccess.h"
+
+/* Adapted from include/asm-generic/uaccess.h. */
+
+#define get_user(x, ptr) \
+({ \
+ /* [...snip...] */ \
+ __get_user_fn(sizeof (*(ptr)), ptr, &(x)); \
+ /* [...snip...] */ \
+})
+
+static inline int __get_user_fn(size_t size, const void __user *ptr, void *x)
+{
+ size = copy_from_user(x, ptr, size);
+ return size ? -1 : size;
+}
+
+/* Adapted from include/linux/kernel.h. */
+
+#define min_t(type, x, y) ({ \
+ type __min1 = (x); \
+ type __min2 = (y); \
+ __min1 < __min2 ? __min1: __min2; })
+
+/* Adapted from include/linux/net.h. */
+
+struct socket {
+ /* [...snip...] */
+ struct sock *sk;
+ /* [...snip...] */
+};
+
+/* Adapted from include/net/bluetooth/sco.h. */
+
+struct sco_conninfo {
+ __u16 hci_handle;
+ __u8 dev_class[3]; /* { dg-message "padding after field 'dev_class' is uninitialized \\(1 byte\\)" } */
+};
+
+struct sco_conn {
+
+ struct hci_conn *hcon;
+ /* [...snip...] */
+};
+
+#define sco_pi(sk) ((struct sco_pinfo *) sk)
+
+struct sco_pinfo {
+ /* [...snip...] */
+ struct sco_conn *conn;
+};
+
+/* Adapted from include/net/bluetooth/hci_core.h. */
+
+struct hci_conn {
+ /* [...snip...] */
+ __u16 handle;
+ /* [...snip...] */
+ __u8 dev_class[3];
+ /* [...snip...] */
+};
+
+/* Adapted from sco_sock_getsockopt_old in net/bluetooth/sco.c. */
+
+static int sco_sock_getsockopt_old_broken(struct socket *sock, int optname, char __user *optval, int __user *optlen)
+{
+ struct sock *sk = sock->sk;
+ /* [...snip...] */
+ struct sco_conninfo cinfo; /* { dg-message "region created on stack here" "where" } */
+ /* { dg-message "capacity: 6 bytes" "capacity" { target *-*-* } .-1 } */
+ /* Note: 40 bits of fields, padded to 48. */
+
+ int len, err = 0;
+
+ /* [...snip...] */
+
+ if (get_user(len, optlen))
+ return -1;
+
+ /* [...snip...] */
+
+ /* case SCO_CONNINFO: */
+ cinfo.hci_handle = sco_pi(sk)->conn->hcon->handle;
+ memcpy(cinfo.dev_class, sco_pi(sk)->conn->hcon->dev_class, 3);
+
+ len = min_t(unsigned int, len, sizeof(cinfo));
+ if (copy_to_user(optval, (char *)&cinfo, len)) /* { dg-warning "potential exposure of sensitive information by copying uninitialized data from stack" "warning" { target *-*-* } } */
+ /* { dg-message "1 byte is uninitialized" "how much note" { target *-*-* } .-1 } */
+ err = -1;
+
+ /* [...snip...] */
+}
+
+static int sco_sock_getsockopt_fixed(struct socket *sock, int optname, char __user *optval, int __user *optlen)
+{
+ struct sock *sk = sock->sk;
+ /* [...snip...] */
+ struct sco_conninfo cinfo;
+ /* Note: 40 bits of fields, padded to 48. */
+
+ int len, err = 0;
+
+ /* [...snip...] */
+
+ if (get_user(len, optlen))
+ return -1;
+
+ /* [...snip...] */
+
+ /* case SCO_CONNINFO: */
+ /* Infoleak fixed by this memset call. */
+ memset(&cinfo, 0, sizeof(cinfo));
+ cinfo.hci_handle = sco_pi(sk)->conn->hcon->handle;
+ memcpy(cinfo.dev_class, sco_pi(sk)->conn->hcon->dev_class, 3);
+
+ len = min_t(unsigned int, len, sizeof(cinfo));
+ if (copy_to_user(optval, (char *)&cinfo, len)) /* { dg-bogus "exposure" } */
+ err = -1;
+
+ /* [...snip...] */
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/infoleak-CVE-2011-1078-2.c b/gcc/testsuite/gcc.dg/plugin/infoleak-CVE-2011-1078-2.c
new file mode 100644
index 0000000..2096bda
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/infoleak-CVE-2011-1078-2.c
@@ -0,0 +1,46 @@
+/* Simplified versions of infoleak-CVE-2011-1078-1.c. */
+
+/* { dg-do compile } */
+/* { dg-options "-fanalyzer" } */
+/* { dg-require-effective-target analyzer } */
+
+#include <string.h>
+
+typedef unsigned char __u8;
+typedef unsigned short __u16;
+
+#include "test-uaccess.h"
+
+/* Adapted from include/net/bluetooth/sco.h. */
+
+struct sco_conninfo {
+ __u16 hci_handle;
+ __u8 dev_class[3]; /* { dg-message "padding after field 'dev_class' is uninitialized \\(1 byte\\)" } */
+};
+
+/* Adapted from sco_sock_getsockopt_old in net/bluetooth/sco.c. */
+
+int test_1 (char __user *optval, const struct sco_conninfo *in)
+{
+ struct sco_conninfo cinfo; /* { dg-message "region created on stack here" "where" } */
+ /* { dg-message "capacity: 6 bytes" "capacity" { target *-*-* } .-1 } */
+ /* Note: 40 bits of fields, padded to 48. */
+
+ cinfo.hci_handle = in->hci_handle;
+ memcpy(cinfo.dev_class, in->dev_class, 3);
+
+ copy_to_user(optval, &cinfo, sizeof(cinfo)); /* { dg-warning "potential exposure of sensitive information by copying uninitialized data from stack" "warning" } */
+ /* { dg-message "1 byte is uninitialized" "how much note" { target *-*-* } .-1 } */
+}
+
+int test_2 (char __user *optval, const struct sco_conninfo *in)
+{
+ struct sco_conninfo cinfo;
+ /* Note: 40 bits of fields, padded to 48. */
+
+ memset(&cinfo, 0, sizeof(cinfo));
+ cinfo.hci_handle = in->hci_handle;
+ memcpy(cinfo.dev_class, in->dev_class, 3);
+
+ copy_to_user(optval, &cinfo, sizeof(cinfo)); /* { dg-bogus "" } */
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/infoleak-CVE-2014-1446-1.c b/gcc/testsuite/gcc.dg/plugin/infoleak-CVE-2014-1446-1.c
new file mode 100644
index 0000000..2726a9c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/infoleak-CVE-2014-1446-1.c
@@ -0,0 +1,117 @@
+/* "The yam_ioctl function in drivers/net/hamradio/yam.c in the Linux kernel
+ before 3.12.8 does not initialize a certain structure member, which allows
+ local users to obtain sensitive information from kernel memory by
+ leveraging the CAP_NET_ADMIN capability for an SIOCYAMGCFG ioctl call."
+
+ Fixed e.g. by e7834c71c2cacc621ddc64bd71f83ef2054f6539 on linux-3.12.y
+ in linux-stable. */
+
+#include <string.h>
+
+#include "test-uaccess.h"
+
+/* Adapted from include/linux/yam.h */
+
+struct yamcfg {
+ unsigned int mask; /* Mask of commands */
+ unsigned int iobase; /* IO Base of COM port */
+ unsigned int irq; /* IRQ of COM port */
+ unsigned int bitrate; /* Bit rate of radio port */
+ unsigned int baudrate; /* Baud rate of the RS232 port */
+ unsigned int txdelay; /* TxDelay */
+ unsigned int txtail; /* TxTail */
+ unsigned int persist; /* Persistence */
+ unsigned int slottime; /* Slottime */
+ unsigned int mode; /* mode 0 (simp), 1(Dupl), 2(Dupl+delay) */
+ unsigned int holddly; /* PTT delay in FullDuplex 2 mode */
+};
+
+struct yamdrv_ioctl_cfg {
+ int cmd; /* { dg-message "field 'cmd' is uninitialized \\(4 bytes\\)" } */
+ struct yamcfg cfg;
+};
+
+/* Adapted from include/asm-generic/errno-base.h */
+
+#define EFAULT 14 /* Bad address */
+
+/* Adapted from drivers/net/hamradio/yam.c */
+
+struct yam_port {
+ /* [...snip...] */
+
+ int bitrate;
+ int baudrate;
+ int iobase;
+ int irq;
+ int dupmode;
+
+ /* [...snip...] */
+
+ int txd; /* tx delay */
+ int holdd; /* duplex ptt delay */
+ int txtail; /* txtail delay */
+ int slot; /* slottime */
+ int pers; /* persistence */
+
+ /* [...snip...] */
+};
+
+/* Broken version, leaving yi.cmd uninitialized. */
+
+static int yam_ioctl(/* [...snip...] */
+ void __user *dst, struct yam_port *yp)
+{
+ struct yamdrv_ioctl_cfg yi; /* { dg-message "region created on stack here" "memspace event" } */
+ /* { dg-message "capacity: 48 bytes" "capacity event" { target *-*-* } .-1 } */
+
+ /* [...snip...] */
+
+ /* case SIOCYAMGCFG: */
+ yi.cfg.mask = 0xffffffff;
+ yi.cfg.iobase = yp->iobase;
+ yi.cfg.irq = yp->irq;
+ yi.cfg.bitrate = yp->bitrate;
+ yi.cfg.baudrate = yp->baudrate;
+ yi.cfg.mode = yp->dupmode;
+ yi.cfg.txdelay = yp->txd;
+ yi.cfg.holddly = yp->holdd;
+ yi.cfg.txtail = yp->txtail;
+ yi.cfg.persist = yp->pers;
+ yi.cfg.slottime = yp->slot;
+ if (copy_to_user(dst, &yi, sizeof(struct yamdrv_ioctl_cfg))) /* { dg-warning "potential exposure of sensitive information by copying uninitialized data from stack" "warning" } */
+ /* { dg-message "4 bytes are uninitialized" "how much note" { target *-*-* } .-1 } */
+ return -EFAULT;
+ /* [...snip...] */
+
+ return 0;
+}
+
+/* Fixed version, with a memset. */
+
+static int yam_ioctl_fixed(/* [...snip...] */
+ void __user *dst, struct yam_port *yp)
+{
+ struct yamdrv_ioctl_cfg yi;
+
+ /* [...snip...] */
+
+ /* case SIOCYAMGCFG: */
+ memset(&yi, 0, sizeof(yi));
+ yi.cfg.mask = 0xffffffff;
+ yi.cfg.iobase = yp->iobase;
+ yi.cfg.irq = yp->irq;
+ yi.cfg.bitrate = yp->bitrate;
+ yi.cfg.baudrate = yp->baudrate;
+ yi.cfg.mode = yp->dupmode;
+ yi.cfg.txdelay = yp->txd;
+ yi.cfg.holddly = yp->holdd;
+ yi.cfg.txtail = yp->txtail;
+ yi.cfg.persist = yp->pers;
+ yi.cfg.slottime = yp->slot;
+ if (copy_to_user(dst, &yi, sizeof(struct yamdrv_ioctl_cfg))) /* { dg-bogus "" } */
+ return -EFAULT;
+ /* [...snip...] */
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/infoleak-CVE-2017-18549-1.c b/gcc/testsuite/gcc.dg/plugin/infoleak-CVE-2017-18549-1.c
new file mode 100644
index 0000000..8a1c816
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/infoleak-CVE-2017-18549-1.c
@@ -0,0 +1,105 @@
+/* "An issue was discovered in drivers/scsi/aacraid/commctrl.c in the
+ Linux kernel before 4.13. There is potential exposure of kernel stack
+ memory because aac_send_raw_srb does not initialize the reply structure."
+
+ Fixed e.g. by 342ffc26693b528648bdc9377e51e4f2450b4860 on linux-4.13.y
+ in linux-stable.
+
+ This is a very simplified version of that code (before and after the fix). */
+
+/* { dg-do compile } */
+/* { dg-options "-fanalyzer" } */
+/* { dg-require-effective-target analyzer } */
+
+#include <string.h>
+
+typedef unsigned int __u32;
+typedef unsigned int u32;
+typedef unsigned char u8;
+
+#include "test-uaccess.h"
+
+/* Adapted from include/uapi/linux/types.h */
+
+#define __bitwise
+typedef __u32 __bitwise __le32;
+
+/* Adapted from drivers/scsi/aacraid/aacraid.h */
+
+#define AAC_SENSE_BUFFERSIZE 30
+
+struct aac_srb_reply
+{
+ __le32 status;
+ __le32 srb_status;
+ __le32 scsi_status;
+ __le32 data_xfer_length;
+ __le32 sense_data_size;
+ u8 sense_data[AAC_SENSE_BUFFERSIZE]; /* { dg-message "padding after field 'sense_data' is uninitialized \\(2 bytes\\)" } */
+};
+
+#define ST_OK 0
+#define SRB_STATUS_SUCCESS 0x01
+
+/* Adapted from drivers/scsi/aacraid/commctrl.c */
+
+static int aac_send_raw_srb(/* [...snip...] */
+ void __user *user_reply)
+{
+ u32 byte_count = 0;
+
+ /* [...snip...] */
+
+ struct aac_srb_reply reply; /* { dg-message "region created on stack here" "memspace message" } */
+ /* { dg-message "capacity: 52 bytes" "capacity message" { target *-*-* } .-1 } */
+
+ reply.status = ST_OK;
+
+ /* [...snip...] */
+
+ reply.srb_status = SRB_STATUS_SUCCESS;
+ reply.scsi_status = 0;
+ reply.data_xfer_length = byte_count;
+ reply.sense_data_size = 0;
+ memset(reply.sense_data, 0, AAC_SENSE_BUFFERSIZE);
+
+ /* [...snip...] */
+
+ if (copy_to_user(user_reply, &reply, /* { dg-warning "potential exposure of sensitive information by copying uninitialized data from stack" } */
+ /* { dg-message "2 bytes are uninitialized" "note how much" { target *-*-* } .-1 } */
+ sizeof(struct aac_srb_reply))) {
+ /* [...snip...] */
+ }
+ /* [...snip...] */
+}
+
+static int aac_send_raw_srb_fixed(/* [...snip...] */
+ void __user *user_reply)
+{
+ u32 byte_count = 0;
+
+ /* [...snip...] */
+
+ struct aac_srb_reply reply;
+
+ /* This is the fix. */
+ memset(&reply, 0, sizeof(reply));
+
+ reply.status = ST_OK;
+
+ /* [...snip...] */
+
+ reply.srb_status = SRB_STATUS_SUCCESS;
+ reply.scsi_status = 0;
+ reply.data_xfer_length = byte_count;
+ reply.sense_data_size = 0;
+ memset(reply.sense_data, 0, AAC_SENSE_BUFFERSIZE);
+
+ /* [...snip...] */
+
+ if (copy_to_user(user_reply, &reply, /* { dg-bogus "" } */
+ sizeof(struct aac_srb_reply))) {
+ /* [...snip...] */
+ }
+ /* [...snip...] */
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/infoleak-CVE-2017-18550-1.c b/gcc/testsuite/gcc.dg/plugin/infoleak-CVE-2017-18550-1.c
new file mode 100644
index 0000000..4272da9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/infoleak-CVE-2017-18550-1.c
@@ -0,0 +1,175 @@
+/* "An issue was discovered in drivers/scsi/aacraid/commctrl.c in the
+ Linux kernel before 4.13. There is potential exposure of kernel stack
+ memory because aac_get_hba_info does not initialize the hbainfo structure."
+
+ Fixed e.g. by 342ffc26693b528648bdc9377e51e4f2450b4860 on linux-4.13.y
+ in linux-stable.
+
+ This is a simplified version of that code (before and after the fix). */
+
+/* { dg-do compile } */
+/* { dg-options "-fanalyzer" } */
+/* { dg-require-effective-target analyzer } */
+
+#include <string.h>
+
+typedef unsigned int __u32;
+typedef unsigned int u32;
+typedef unsigned char u8;
+
+#include "test-uaccess.h"
+
+/* Adapted from include/uapi/linux/types.h */
+
+#define __bitwise
+typedef __u32 __bitwise __le32;
+
+/* Adapted from drivers/scsi/aacraid/aacraid.h */
+
+struct aac_hba_info {
+
+ u8 driver_name[50]; /* { dg-message "field 'driver_name' is uninitialized \\(50 bytes\\)" } */
+ u8 adapter_number;
+ u8 system_io_bus_number;
+ u8 device_number; /* { dg-message "padding after field 'device_number' is uninitialized \\(3 bytes\\)" } */
+ u32 function_number;
+ u32 vendor_id;
+ u32 device_id;
+ u32 sub_vendor_id;
+ u32 sub_system_id;
+ u32 mapped_base_address_size; /* { dg-message "field 'mapped_base_address_size' is uninitialized \\(4 bytes\\)" } */
+ u32 base_physical_address_high_part;
+ u32 base_physical_address_low_part;
+
+ u32 max_command_size;
+ u32 max_fib_size;
+ u32 max_scatter_gather_from_os;
+ u32 max_scatter_gather_to_fw;
+ u32 max_outstanding_fibs;
+
+ u32 queue_start_threshold;
+ u32 queue_dump_threshold;
+ u32 max_io_size_queued;
+ u32 outstanding_io;
+
+ u32 firmware_build_number;
+ u32 bios_build_number;
+ u32 driver_build_number;
+ u32 serial_number_high_part;
+ u32 serial_number_low_part;
+ u32 supported_options;
+ u32 feature_bits;
+ u32 currentnumber_ports;
+
+ u8 new_comm_interface:1; /* { dg-message "field 'new_comm_interface' is uninitialized \\(1 bit\\)" } */
+ u8 new_commands_supported:1;
+ u8 disable_passthrough:1;
+ u8 expose_non_dasd:1;
+ u8 queue_allowed:1;
+ u8 bled_check_enabled:1;
+ u8 reserved1:1;
+ u8 reserted2:1;
+
+ u32 reserved3[10]; /* { dg-message "field 'reserved3' is uninitialized \\(40 bytes\\)" } */
+
+};
+
+struct aac_dev
+{
+ /* [...snip...] */
+ int id;
+ /* [...snip...] */
+ struct pci_dev *pdev; /* Our PCI interface */
+ /* [...snip...] */
+};
+
+/* Adapted from include/linux/pci.h */
+
+struct pci_dev {
+ /* [...snip...] */
+ struct pci_bus *bus; /* bus this device is on */
+ /* [...snip...] */
+ unsigned int devfn; /* encoded device & function index */
+ unsigned short vendor;
+ unsigned short device;
+ unsigned short subsystem_vendor;
+ unsigned short subsystem_device;
+ /* [...snip...] */
+};
+
+struct pci_bus {
+ /* [...snip...] */
+ unsigned char number; /* bus number */
+ /* [...snip...] */
+};
+
+/* Adapted from drivers/scsi/aacraid/commctrl.c */
+
+static int aac_get_hba_info(struct aac_dev *dev, void __user *arg)
+{
+ struct aac_hba_info hbainfo; /* { dg-message "region created on stack here" "memspace message" } */
+ /* { dg-message "capacity: 200 bytes" "capacity message" { target *-*-* } .-1 } */
+
+ hbainfo.adapter_number = (u8) dev->id;
+ hbainfo.system_io_bus_number = dev->pdev->bus->number;
+ hbainfo.device_number = (dev->pdev->devfn >> 3);
+ hbainfo.function_number = (dev->pdev->devfn & 0x0007);
+
+ hbainfo.vendor_id = dev->pdev->vendor;
+ hbainfo.device_id = dev->pdev->device;
+ hbainfo.sub_vendor_id = dev->pdev->subsystem_vendor;
+ hbainfo.sub_system_id = dev->pdev->subsystem_device;
+
+ if (copy_to_user(arg, &hbainfo, sizeof(struct aac_hba_info))) { /* { dg-warning "potential exposure of sensitive information by copying uninitialized data from stack" "warning" } */
+ /* { dg-message "177 bytes are uninitialized" "how much" { target *-*-* } .-1 } */
+ /* [...snip...] */
+ }
+
+ return 0;
+}
+
+static int aac_get_hba_info_fixed(struct aac_dev *dev, void __user *arg)
+{
+ struct aac_hba_info hbainfo;
+
+ memset(&hbainfo, 0, sizeof(hbainfo));
+ hbainfo.adapter_number = (u8) dev->id;
+ hbainfo.system_io_bus_number = dev->pdev->bus->number;
+ hbainfo.device_number = (dev->pdev->devfn >> 3);
+ hbainfo.function_number = (dev->pdev->devfn & 0x0007);
+
+ hbainfo.vendor_id = dev->pdev->vendor;
+ hbainfo.device_id = dev->pdev->device;
+ hbainfo.sub_vendor_id = dev->pdev->subsystem_vendor;
+ hbainfo.sub_system_id = dev->pdev->subsystem_device;
+
+ if (copy_to_user(arg, &hbainfo, sizeof(struct aac_hba_info))) { /* { dg-bogus "" } */
+ /* [...snip...] */
+ }
+
+ return 0;
+}
+
+/* An alternate fix using "= {0}" rather than memset. */
+
+static int aac_get_hba_info_fixed_alt(struct aac_dev *dev, void __user *arg)
+{
+ struct aac_hba_info hbainfo = {0};
+
+ memset(&hbainfo, 0, sizeof(hbainfo));
+ hbainfo.adapter_number = (u8) dev->id;
+ hbainfo.system_io_bus_number = dev->pdev->bus->number;
+ hbainfo.device_number = (dev->pdev->devfn >> 3);
+ hbainfo.function_number = (dev->pdev->devfn & 0x0007);
+
+ hbainfo.vendor_id = dev->pdev->vendor;
+ hbainfo.device_id = dev->pdev->device;
+ hbainfo.sub_vendor_id = dev->pdev->subsystem_vendor;
+ hbainfo.sub_system_id = dev->pdev->subsystem_device;
+
+ if (copy_to_user(arg, &hbainfo, sizeof(struct aac_hba_info))) { /* { dg-bogus "" } */
+ /* [...snip...] */
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/infoleak-antipatterns-1.c b/gcc/testsuite/gcc.dg/plugin/infoleak-antipatterns-1.c
new file mode 100644
index 0000000..5008453
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/infoleak-antipatterns-1.c
@@ -0,0 +1,166 @@
+/* Adapted and simplified decls from linux kernel headers. */
+
+/* { dg-do compile } */
+/* { dg-options "-fanalyzer" } */
+/* { dg-require-effective-target analyzer } */
+
+typedef unsigned char u8;
+typedef unsigned __INT16_TYPE__ u16;
+typedef unsigned __INT32_TYPE__ u32;
+typedef __SIZE_TYPE__ size_t;
+
+#define EFAULT 14
+
+#include "test-uaccess.h"
+
+typedef unsigned int gfp_t;
+#define GFP_KERNEL 0
+
+void kfree(const void *);
+void *kmalloc(size_t size, gfp_t flags)
+ __attribute__((malloc (kfree)));
+
+/* Adapted from antipatterns.ko:infoleak.c (GPL-v2.0). */
+
+struct infoleak_buf
+{
+ char buf[256];
+};
+
+int infoleak_stack_no_init(void __user *dst)
+{
+ struct infoleak_buf st; /* { dg-message "region created on stack here" "where" } */
+ /* { dg-message "capacity: 256 bytes" "capacity" { target *-*-* } .-1 } */
+
+ /* No initialization of "st" at all. */
+ if (copy_to_user(dst, &st, sizeof(st))) /* { dg-warning "potential exposure of sensitive information by copying uninitialized data from stack" "warning" } */
+ /* { dg-message "256 bytes are uninitialized" "note how much" { target *-*-* } .-1 } */
+ return -EFAULT;
+ return 0;
+}
+
+int infoleak_heap_no_init(void __user *dst)
+{
+ struct infoleak_buf *heapbuf = kmalloc(sizeof(*heapbuf), GFP_KERNEL);
+ /* No initialization of "heapbuf" at all. */
+
+ /* TODO: we also don't check that heapbuf could be NULL when copying
+ from it. */
+ if (copy_to_user(dst, heapbuf, sizeof(*heapbuf))) /* { dg-warning "exposure" "warning" { xfail *-*-* } } */
+ /* TODO(xfail). */
+ return -EFAULT; /* { dg-warning "leak of 'heapbuf'" } */
+
+ kfree(heapbuf);
+ return 0;
+}
+
+struct infoleak_2
+{
+ u32 a;
+ u32 b; /* { dg-message "field 'b' is uninitialized \\(4 bytes\\)" } */
+};
+
+int infoleak_stack_missing_a_field(void __user *dst, u32 v)
+{
+ struct infoleak_2 st; /* { dg-message "region created on stack here" "where" } */
+ /* { dg-message "capacity: 8 bytes" "capacity" { target *-*-* } .-1 } */
+
+ st.a = v;
+ /* No initialization of "st.b". */
+ if (copy_to_user(dst, &st, sizeof(st))) /* { dg-warning "potential exposure of sensitive information by copying uninitialized data from stack" "warning" } */
+ /* { dg-message "4 bytes are uninitialized" "note how much" { target *-*-* } .-1 } */
+ return -EFAULT;
+ return 0;
+}
+
+int infoleak_heap_missing_a_field(void __user *dst, u32 v)
+{
+ struct infoleak_2 *heapbuf = kmalloc(sizeof(*heapbuf), GFP_KERNEL);
+ heapbuf->a = v; /* { dg-warning "dereference of possibly-NULL 'heapbuf'" } */
+ /* No initialization of "heapbuf->b". */
+ if (copy_to_user(dst, heapbuf, sizeof(*heapbuf))) /* { dg-warning "exposure" "warning" { xfail *-*-* } } */
+ /* TODO(xfail). */
+ {
+ kfree(heapbuf);
+ return -EFAULT;
+ }
+ kfree(heapbuf);
+ return 0;
+}
+
+struct infoleak_3
+{
+ u8 a; /* { dg-message "padding after field 'a' is uninitialized \\(3 bytes\\)" } */
+ /* padding here */
+ u32 b;
+};
+
+int infoleak_stack_padding(void __user *dst, u8 p, u32 q)
+{
+ struct infoleak_3 st; /* { dg-message "region created on stack here" "where" } */
+ /* { dg-message "capacity: 8 bytes" "capacity" { target *-*-* } .-1 } */
+
+ st.a = p;
+ st.b = q;
+ /* No initialization of padding. */
+ if (copy_to_user(dst, &st, sizeof(st))) /* { dg-warning "potential exposure of sensitive information by copying uninitialized data from stack" "warning" } */
+ /* { dg-message "3 bytes are uninitialized" "note how much" { target *-*-* } .-1 } */
+ return -EFAULT;
+ return 0;
+}
+
+int infoleak_stack_unchecked_err(void __user *dst, void __user *src)
+{
+ struct infoleak_buf st; /* { dg-message "region created on stack here" "where" } */
+ /* { dg-message "capacity: 256 bytes" "capacity" { target *-*-* } .-1 } */
+
+ /*
+ * If the copy_from_user call fails, then st is still uninitialized,
+ * and if the copy_to_user call succeds, we have an infoleak.
+ */
+ int err = copy_from_user (&st, src, sizeof(st)); /* { dg-message "when 'copy_from_user' fails" } */
+ err |= copy_to_user (dst, &st, sizeof(st)); /* { dg-warning "exposure" "warning" } */
+ /* { dg-message "256 bytes are uninitialized" "note how much" { target *-*-* } .-1 } */
+ /* Actually, it's *up to* 256 bytes. */
+
+ if (err)
+ return -EFAULT;
+ return 0;
+}
+
+struct infoleak_4
+{
+ union {
+ u8 f1;
+ u32 f2;
+ } u;
+};
+
+int infoleak_stack_union(void __user *dst, u8 v)
+{
+ struct infoleak_4 st;
+ /*
+ * This write only initializes the u8 within the union "u",
+ * leaving the remaining 3 bytes uninitialized.
+ */
+ st.u.f1 = v;
+ if (copy_to_user(dst, &st, sizeof(st))) /* { dg-warning "potential exposure of sensitive information by copying uninitialized data from stack" "warning" } */
+ /* { dg-message "3 bytes are uninitialized" "note how much" { target *-*-* } .-1 } */
+ return -EFAULT;
+ return 0;
+}
+
+struct infoleak_5
+{
+ void *ptr;
+};
+
+int infoleak_stack_kernel_ptr(void __user *dst, void *kp)
+{
+ struct infoleak_5 st;
+ /* This writes a kernel-space pointer into a user space buffer. */
+ st.ptr = kp;
+ if (copy_to_user(dst, &st, sizeof(st))) // TODO: we don't complain about this yet
+ return -EFAULT;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/infoleak-fixit-1.c b/gcc/testsuite/gcc.dg/plugin/infoleak-fixit-1.c
new file mode 100644
index 0000000..6961b44
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/infoleak-fixit-1.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-fanalyzer" } */
+/* { dg-require-effective-target analyzer } */
+
+#include <string.h>
+
+#include "test-uaccess.h"
+
+typedef unsigned char u8;
+typedef unsigned int u32;
+
+struct st
+{
+ u8 i; /* { dg-message "padding after field 'i' is uninitialized \\(3 bytes\\)" } */
+ u32 j; /* { dg-message "field 'j' is uninitialized \\(4 bytes\\)" } */
+};
+
+void test (void __user *dst, u8 a)
+{
+ struct st s; /* { dg-message "region created on stack here" "where" } */
+ /* { dg-message "capacity: 8 bytes" "capacity" { target *-*-* } .-1 } */
+ /* { dg-message "suggest forcing zero-initialization by providing a '.0.' initializer" "fix-it hint" { target *-*-* } .-2 } */
+ s.i = a;
+ copy_to_user(dst, &s, sizeof (struct st)); /* { dg-warning "potential exposure of sensitive information by copying uninitialized data from stack" "warning" } */
+ /* { dg-message "7 bytes are uninitialized" "note how much" { target *-*-* } .-1 } */
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/infoleak-net-ethtool-ioctl.c b/gcc/testsuite/gcc.dg/plugin/infoleak-net-ethtool-ioctl.c
new file mode 100644
index 0000000..dce6e44
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/infoleak-net-ethtool-ioctl.c
@@ -0,0 +1,82 @@
+/* Reduced from infoleak false positive seen on Linux kernel with
+ net/ethtool/ioctl.c */
+
+/* { dg-do compile } */
+/* { dg-options "-fanalyzer" } */
+/* { dg-require-effective-target analyzer } */
+
+typedef signed char __s8;
+typedef unsigned char __u8;
+typedef unsigned int __u32;
+typedef __s8 s8;
+typedef __u32 u32;
+enum { false = 0, true = 1 };
+typedef unsigned long __kernel_ulong_t;
+typedef __kernel_ulong_t __kernel_size_t;
+typedef _Bool bool;
+typedef __kernel_size_t size_t;
+
+void *memset(void *s, int c, size_t n);
+
+extern bool
+check_copy_size(const void *addr, size_t bytes, bool is_source);
+extern unsigned long
+_copy_from_user(void *, const void *, unsigned long);
+extern unsigned long
+_copy_to_user(void *, const void *, unsigned long);
+
+static inline
+__attribute__((__always_inline__)) unsigned long
+copy_from_user(void *to, const void *from, unsigned long n) {
+ if (__builtin_expect(!!(check_copy_size(to, n, false)), 1))
+ n = _copy_from_user(to, from, n);
+ return n;
+}
+static inline
+__attribute__((__always_inline__)) unsigned long
+copy_to_user(void *to, const void *from, unsigned long n) {
+ if (__builtin_expect(!!(check_copy_size(from, n, true)), 1))
+ n = _copy_to_user(to, from, n);
+ return n;
+}
+enum ethtool_link_mode_bit_indices {
+ __ETHTOOL_LINK_MODE_MASK_NBITS = 92
+};
+struct ethtool_link_settings {
+ __u32 cmd;
+ /* [...snip...] */
+ __s8 link_mode_masks_nwords;
+ /* [...snip...] */
+};
+
+struct ethtool_link_ksettings {
+ struct ethtool_link_settings base;
+ u32 lanes;
+};
+
+int ethtool_get_link_ksettings(void *useraddr) {
+ int err = 0;
+ struct ethtool_link_ksettings link_ksettings;
+
+ if (copy_from_user(&link_ksettings.base, useraddr,
+ sizeof(link_ksettings.base)))
+ return -14;
+
+ if ((((__ETHTOOL_LINK_MODE_MASK_NBITS) + (32) - 1) / (32)) !=
+ link_ksettings.base.link_mode_masks_nwords) {
+
+ memset(&link_ksettings, 0, sizeof(link_ksettings));
+ link_ksettings.base.cmd = 0x0000004c;
+
+ link_ksettings.base.link_mode_masks_nwords =
+ -((s8)(((__ETHTOOL_LINK_MODE_MASK_NBITS) + (32) - 1) / (32)));
+
+ if (copy_to_user(useraddr, &link_ksettings.base,
+ sizeof(link_ksettings.base)))
+ return -14;
+
+ return 0;
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/infoleak-vfio_iommu_type1.c b/gcc/testsuite/gcc.dg/plugin/infoleak-vfio_iommu_type1.c
new file mode 100644
index 0000000..51ad5db
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/infoleak-vfio_iommu_type1.c
@@ -0,0 +1,44 @@
+/* Reduced from infoleak false positive in drivers/vfio/vfio_iommu_type1.c */
+
+/* { dg-do compile } */
+/* { dg-options "-fanalyzer" } */
+/* { dg-require-effective-target analyzer } */
+
+typedef unsigned int u32;
+typedef unsigned long long u64;
+
+unsigned long
+copy_from_user(void *to, const void *from, unsigned long n);
+
+unsigned long
+copy_to_user(void *to, const void *from, unsigned long n);
+
+struct vfio_iommu_type1_info {
+ u32 argsz;
+ u32 flags;
+ u64 iova_pgsizes;
+ u32 cap_offset;
+ /* bytes 20-23 are padding. */
+};
+
+int vfio_iommu_type1_get_info(unsigned long arg)
+{
+ struct vfio_iommu_type1_info info;
+ unsigned long minsz = 16;
+
+ if (copy_from_user(&info, (void *)arg, 16))
+ return -14;
+
+ if (info.argsz < 16)
+ return -22;
+
+ if (info.argsz >= 20) {
+ minsz = 20;
+ info.cap_offset = 0;
+ }
+
+ /* The padding bytes (20-23) are uninitialized, but can't be written
+ back, since minsz is either 16 or 20. */
+ return copy_to_user((void *)arg, &info, minsz) ? -14 : 0; /* { dg-bogus "exposure" "" { xfail *-*-* } } */
+ // TODO: false +ve due to not handling minsz being either 16 or 20
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/known-fns-1.c b/gcc/testsuite/gcc.dg/plugin/known-fns-1.c
new file mode 100644
index 0000000..5fa49f6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/known-fns-1.c
@@ -0,0 +1,61 @@
+/* { dg-do compile } */
+/* { dg-options "-fanalyzer" } */
+/* { dg-require-effective-target analyzer } */
+
+#include "../analyzer/analyzer-decls.h"
+
+/* Basic example of known fn behavior. */
+
+extern int returns_42 (void);
+
+void test_1 (void)
+{
+ int val = returns_42 ();
+ __analyzer_eval (val == 42); /* { dg-warning "TRUE" } */
+}
+
+/* Example of bifurcation, with a copy that can fail. */
+
+extern int
+attempt_to_copy (void *to, const void *from, int sz);
+
+void test_copy_success (void *to, const void *from, int sz)
+{
+ if (!attempt_to_copy (to, from, sz))
+ {
+ /* Success */
+ }
+}
+
+void test_copy_failure (void *to, const void *from, int sz)
+{
+ if (attempt_to_copy (to, from, sz)) /* { dg-message "when 'attempt_to_copy' fails" } */
+ __analyzer_dump_path (); /* { dg-message "path" } */
+}
+
+struct coord
+{
+ int x;
+ int y;
+ int z;
+};
+
+void test_copy_2 (void)
+{
+ struct coord to = {1, 2, 3};
+ struct coord from = {4, 5, 6};
+ if (attempt_to_copy (&to, &from, sizeof (struct coord)))
+ {
+ /* Failure. */
+ __analyzer_eval (to.x == 1); /* { dg-warning "TRUE" } */
+ __analyzer_eval (to.y == 2); /* { dg-warning "TRUE" } */
+ __analyzer_eval (to.z == 3); /* { dg-warning "TRUE" } */
+ }
+ else
+ {
+ /* Success. */
+ __analyzer_eval (to.x == 4); /* { dg-warning "TRUE" } */
+ __analyzer_eval (to.y == 5); /* { dg-warning "TRUE" } */
+ __analyzer_eval (to.z == 6); /* { dg-warning "TRUE" } */
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/plugin.exp b/gcc/testsuite/gcc.dg/plugin/plugin.exp
index 63b117d..5b7efa4 100644
--- a/gcc/testsuite/gcc.dg/plugin/plugin.exp
+++ b/gcc/testsuite/gcc.dg/plugin/plugin.exp
@@ -123,6 +123,32 @@ set plugin_test_list [list \
dump-2.c } \
{ analyzer_gil_plugin.c \
gil-1.c } \
+ { analyzer_known_fns_plugin.c \
+ known-fns-1.c } \
+ { analyzer_kernel_plugin.c \
+ copy_from_user-1.c \
+ infoleak-1.c \
+ infoleak-2.c \
+ infoleak-3.c \
+ infoleak-CVE-2011-1078-1.c \
+ infoleak-CVE-2011-1078-2.c \
+ infoleak-CVE-2017-18549-1.c \
+ infoleak-CVE-2017-18550-1.c \
+ infoleak-antipatterns-1.c \
+ infoleak-fixit-1.c \
+ infoleak-net-ethtool-ioctl.c \
+ infoleak-vfio_iommu_type1.c \
+ taint-CVE-2011-0521-1-fixed.c \
+ taint-CVE-2011-0521-1.c \
+ taint-CVE-2011-0521-2-fixed.c \
+ taint-CVE-2011-0521-2.c \
+ taint-CVE-2011-0521-3-fixed.c \
+ taint-CVE-2011-0521-3.c \
+ taint-CVE-2011-0521-4.c \
+ taint-CVE-2011-0521-5.c \
+ taint-CVE-2011-0521-5-fixed.c \
+ taint-CVE-2011-0521-6.c \
+ taint-antipatterns-1.c } \
]
foreach plugin_test $plugin_test_list {
diff --git a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-1-fixed.c b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-1-fixed.c
new file mode 100644
index 0000000..0ca8137
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-1-fixed.c
@@ -0,0 +1,115 @@
+/* { dg-do compile } */
+// TODO: remove need for -fanalyzer-checker=taint here:
+/* { dg-options "-fanalyzer -fanalyzer-checker=taint" } */
+/* { dg-require-effective-target analyzer } */
+
+/* See notes in this header. */
+#include "taint-CVE-2011-0521.h"
+
+/* Adapted from drivers/media/dvb/ttpci/av7110_ca.c */
+
+int dvb_ca_ioctl(struct file *file, unsigned int cmd, void *parg)
+{
+ struct dvb_device *dvbdev = file->private_data;
+ struct av7110 *av7110 = dvbdev->priv;
+ unsigned long arg = (unsigned long) parg;
+
+ /* case CA_GET_SLOT_INFO: */
+ {
+ ca_slot_info_t *info=(ca_slot_info_t *)parg;
+
+ if (info->num < 0 || info->num > 1)
+ return -EINVAL;
+ av7110->ci_slot[info->num].num = info->num; /* { dg-bogus "attacker-controlled value" } */
+ av7110->ci_slot[info->num].type = FW_CI_LL_SUPPORT(av7110->arm_app) ?
+ CA_CI_LINK : CA_CI;
+ memcpy(info, &av7110->ci_slot[info->num], sizeof(ca_slot_info_t));
+ }
+ return 0;
+}
+
+static struct dvb_device dvbdev_ca = {
+ .priv = NULL,
+ /* [...snip...] */
+ .kernel_ioctl = dvb_ca_ioctl,
+};
+
+/* Adapted from drivers/media/dvb/dvb-core/dvbdev.c */
+
+static DEFINE_MUTEX(dvbdev_mutex);
+
+int dvb_usercopy(struct file *file,
+ unsigned int cmd, unsigned long arg,
+ int (*func)(struct file *file,
+ unsigned int cmd, void *arg))
+{
+ char sbuf[128];
+ void *mbuf = NULL;
+ void *parg = NULL;
+ int err = -1;
+
+ /* Copy arguments into temp kernel buffer */
+ switch (_IOC_DIR(cmd)) {
+ case _IOC_NONE:
+ /*
+ * For this command, the pointer is actually an integer
+ * argument.
+ */
+ parg = (void *) arg;
+ break;
+ case _IOC_READ: /* some v4l ioctls are marked wrong ... */
+ case _IOC_WRITE:
+ case (_IOC_WRITE | _IOC_READ):
+ if (_IOC_SIZE(cmd) <= sizeof(sbuf)) {
+ parg = sbuf;
+ } else {
+ /* too big to allocate from stack */
+ mbuf = kmalloc(_IOC_SIZE(cmd),GFP_KERNEL);
+ if (NULL == mbuf)
+ return -ENOMEM;
+ parg = mbuf;
+ }
+
+ err = -EFAULT;
+ if (copy_from_user(parg, (void __user *)arg, _IOC_SIZE(cmd)))
+ goto out;
+ break;
+ }
+
+ /* call driver */
+ mutex_lock(&dvbdev_mutex);
+ if ((err = func(file, cmd, parg)) == -ENOIOCTLCMD)
+ err = -EINVAL;
+ mutex_unlock(&dvbdev_mutex);
+
+ if (err < 0)
+ goto out;
+
+ /* Copy results into user buffer */
+ switch (_IOC_DIR(cmd))
+ {
+ case _IOC_READ:
+ case (_IOC_WRITE | _IOC_READ):
+ if (copy_to_user((void __user *)arg, parg, _IOC_SIZE(cmd)))
+ err = -EFAULT;
+ break;
+ }
+
+out:
+ kfree(mbuf);
+ return err;
+}
+
+long dvb_generic_ioctl(struct file *file,
+ unsigned int cmd, unsigned long arg)
+{
+ struct dvb_device *dvbdev = file->private_data;
+
+ if (!dvbdev)
+ return -ENODEV;
+
+ if (!dvbdev->kernel_ioctl)
+ return -EINVAL;
+
+ return dvb_usercopy(file, cmd, arg, dvbdev->kernel_ioctl);
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-1.c b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-1.c
new file mode 100644
index 0000000..cde12b3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-1.c
@@ -0,0 +1,115 @@
+/* { dg-do compile } */
+// TODO: remove need for -fanalyzer-checker=taint here:
+/* { dg-options "-fanalyzer -fanalyzer-checker=taint" } */
+/* { dg-require-effective-target analyzer } */
+
+/* See notes in this header. */
+#include "taint-CVE-2011-0521.h"
+
+/* Adapted from drivers/media/dvb/ttpci/av7110_ca.c */
+
+int dvb_ca_ioctl(struct file *file, unsigned int cmd, void *parg)
+{
+ struct dvb_device *dvbdev = file->private_data;
+ struct av7110 *av7110 = dvbdev->priv;
+ unsigned long arg = (unsigned long) parg;
+
+ /* case CA_GET_SLOT_INFO: */
+ {
+ ca_slot_info_t *info=(ca_slot_info_t *)parg;
+
+ if (info->num > 1)
+ return -EINVAL;
+ av7110->ci_slot[info->num].num = info->num; /* { dg-warning "attacker-controlled value" "" { xfail *-*-* } } */
+ av7110->ci_slot[info->num].type = FW_CI_LL_SUPPORT(av7110->arm_app) ?
+ CA_CI_LINK : CA_CI;
+ memcpy(info, &av7110->ci_slot[info->num], sizeof(ca_slot_info_t));
+ }
+ return 0;
+}
+
+static struct dvb_device dvbdev_ca = {
+ .priv = NULL,
+ /* [...snip...] */
+ .kernel_ioctl = dvb_ca_ioctl,
+};
+
+/* Adapted from drivers/media/dvb/dvb-core/dvbdev.c */
+
+static DEFINE_MUTEX(dvbdev_mutex);
+
+int dvb_usercopy(struct file *file,
+ unsigned int cmd, unsigned long arg,
+ int (*func)(struct file *file,
+ unsigned int cmd, void *arg))
+{
+ char sbuf[128];
+ void *mbuf = NULL;
+ void *parg = NULL;
+ int err = -1;
+
+ /* Copy arguments into temp kernel buffer */
+ switch (_IOC_DIR(cmd)) {
+ case _IOC_NONE:
+ /*
+ * For this command, the pointer is actually an integer
+ * argument.
+ */
+ parg = (void *) arg;
+ break;
+ case _IOC_READ: /* some v4l ioctls are marked wrong ... */
+ case _IOC_WRITE:
+ case (_IOC_WRITE | _IOC_READ):
+ if (_IOC_SIZE(cmd) <= sizeof(sbuf)) {
+ parg = sbuf;
+ } else {
+ /* too big to allocate from stack */
+ mbuf = kmalloc(_IOC_SIZE(cmd),GFP_KERNEL);
+ if (NULL == mbuf)
+ return -ENOMEM;
+ parg = mbuf;
+ }
+
+ err = -EFAULT;
+ if (copy_from_user(parg, (void __user *)arg, _IOC_SIZE(cmd)))
+ goto out;
+ break;
+ }
+
+ /* call driver */
+ mutex_lock(&dvbdev_mutex);
+ if ((err = func(file, cmd, parg)) == -ENOIOCTLCMD)
+ err = -EINVAL;
+ mutex_unlock(&dvbdev_mutex);
+
+ if (err < 0)
+ goto out;
+
+ /* Copy results into user buffer */
+ switch (_IOC_DIR(cmd))
+ {
+ case _IOC_READ:
+ case (_IOC_WRITE | _IOC_READ):
+ if (copy_to_user((void __user *)arg, parg, _IOC_SIZE(cmd)))
+ err = -EFAULT;
+ break;
+ }
+
+out:
+ kfree(mbuf);
+ return err;
+}
+
+long dvb_generic_ioctl(struct file *file,
+ unsigned int cmd, unsigned long arg)
+{
+ struct dvb_device *dvbdev = file->private_data;
+
+ if (!dvbdev)
+ return -ENODEV;
+
+ if (!dvbdev->kernel_ioctl)
+ return -EINVAL;
+
+ return dvb_usercopy(file, cmd, arg, dvbdev->kernel_ioctl);
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-2-fixed.c b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-2-fixed.c
new file mode 100644
index 0000000..8a211ce
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-2-fixed.c
@@ -0,0 +1,98 @@
+/* { dg-do compile } */
+// TODO: remove need for -fanalyzer-checker=taint here:
+/* { dg-options "-fanalyzer -fanalyzer-checker=taint" } */
+/* { dg-require-effective-target analyzer } */
+
+/* See notes in this header. */
+#include "taint-CVE-2011-0521.h"
+
+// TODO: remove need for this option
+/* { dg-additional-options "-fanalyzer-checker=taint" } */
+
+/* Adapted from drivers/media/dvb/ttpci/av7110_ca.c */
+
+int dvb_ca_ioctl(struct file *file, unsigned int cmd, void *parg)
+{
+ struct dvb_device *dvbdev = file->private_data;
+ struct av7110 *av7110 = dvbdev->priv;
+ unsigned long arg = (unsigned long) parg;
+
+ /* case CA_GET_SLOT_INFO: */
+ {
+ ca_slot_info_t *info=(ca_slot_info_t *)parg;
+
+ if (info->num < 0 || info->num > 1)
+ return -EINVAL;
+ av7110->ci_slot[info->num].num = info->num; /* { dg-bogus "attacker-controlled value" } */
+ av7110->ci_slot[info->num].type = FW_CI_LL_SUPPORT(av7110->arm_app) ?
+ CA_CI_LINK : CA_CI;
+ memcpy(info, &av7110->ci_slot[info->num], sizeof(ca_slot_info_t));
+ }
+ return 0;
+}
+
+/* Adapted from drivers/media/dvb/dvb-core/dvbdev.c
+ Somewhat simplified: rather than pass in a callback that can
+ be dvb_ca_ioctl, call dvb_ca_ioctl directly. */
+
+static DEFINE_MUTEX(dvbdev_mutex);
+
+int dvb_usercopy(struct file *file,
+ unsigned int cmd, unsigned long arg)
+{
+ char sbuf[128];
+ void *mbuf = NULL;
+ void *parg = NULL;
+ int err = -1;
+
+ /* Copy arguments into temp kernel buffer */
+ switch (_IOC_DIR(cmd)) {
+ case _IOC_NONE:
+ /*
+ * For this command, the pointer is actually an integer
+ * argument.
+ */
+ parg = (void *) arg;
+ break;
+ case _IOC_READ: /* some v4l ioctls are marked wrong ... */
+ case _IOC_WRITE:
+ case (_IOC_WRITE | _IOC_READ):
+ if (_IOC_SIZE(cmd) <= sizeof(sbuf)) {
+ parg = sbuf;
+ } else {
+ /* too big to allocate from stack */
+ mbuf = kmalloc(_IOC_SIZE(cmd),GFP_KERNEL);
+ if (NULL == mbuf)
+ return -ENOMEM;
+ parg = mbuf;
+ }
+
+ err = -EFAULT;
+ if (copy_from_user(parg, (void __user *)arg, _IOC_SIZE(cmd)))
+ goto out;
+ break;
+ }
+
+ /* call driver */
+ mutex_lock(&dvbdev_mutex);
+ if ((err = dvb_ca_ioctl(file, cmd, parg)) == -ENOIOCTLCMD)
+ err = -EINVAL;
+ mutex_unlock(&dvbdev_mutex);
+
+ if (err < 0)
+ goto out;
+
+ /* Copy results into user buffer */
+ switch (_IOC_DIR(cmd))
+ {
+ case _IOC_READ:
+ case (_IOC_WRITE | _IOC_READ):
+ if (copy_to_user((void __user *)arg, parg, _IOC_SIZE(cmd)))
+ err = -EFAULT;
+ break;
+ }
+
+out:
+ kfree(mbuf);
+ return err;
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-2.c b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-2.c
new file mode 100644
index 0000000..30cab38
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-2.c
@@ -0,0 +1,95 @@
+/* { dg-do compile } */
+// TODO: remove need for -fanalyzer-checker=taint here:
+/* { dg-options "-fanalyzer -fanalyzer-checker=taint" } */
+/* { dg-require-effective-target analyzer } */
+
+/* See notes in this header. */
+#include "taint-CVE-2011-0521.h"
+
+/* Adapted from drivers/media/dvb/ttpci/av7110_ca.c */
+
+int dvb_ca_ioctl(struct file *file, unsigned int cmd, void *parg)
+{
+ struct dvb_device *dvbdev = file->private_data;
+ struct av7110 *av7110 = dvbdev->priv;
+ unsigned long arg = (unsigned long) parg;
+
+ /* case CA_GET_SLOT_INFO: */
+ {
+ ca_slot_info_t *info=(ca_slot_info_t *)parg;
+
+ if (info->num > 1)
+ return -EINVAL;
+ av7110->ci_slot[info->num].num = info->num; /* { dg-warning "attacker-controlled value" "" { xfail *-*-* } } */
+ av7110->ci_slot[info->num].type = FW_CI_LL_SUPPORT(av7110->arm_app) ?
+ CA_CI_LINK : CA_CI;
+ memcpy(info, &av7110->ci_slot[info->num], sizeof(ca_slot_info_t));
+ }
+ return 0;
+}
+
+/* Adapted from drivers/media/dvb/dvb-core/dvbdev.c
+ Somewhat simplified: rather than pass in a callback that can
+ be dvb_ca_ioctl, call dvb_ca_ioctl directly. */
+
+static DEFINE_MUTEX(dvbdev_mutex);
+
+int dvb_usercopy(struct file *file,
+ unsigned int cmd, unsigned long arg)
+{
+ char sbuf[128];
+ void *mbuf = NULL;
+ void *parg = NULL;
+ int err = -1;
+
+ /* Copy arguments into temp kernel buffer */
+ switch (_IOC_DIR(cmd)) {
+ case _IOC_NONE:
+ /*
+ * For this command, the pointer is actually an integer
+ * argument.
+ */
+ parg = (void *) arg;
+ break;
+ case _IOC_READ: /* some v4l ioctls are marked wrong ... */
+ case _IOC_WRITE:
+ case (_IOC_WRITE | _IOC_READ):
+ if (_IOC_SIZE(cmd) <= sizeof(sbuf)) {
+ parg = sbuf;
+ } else {
+ /* too big to allocate from stack */
+ mbuf = kmalloc(_IOC_SIZE(cmd),GFP_KERNEL);
+ if (NULL == mbuf)
+ return -ENOMEM;
+ parg = mbuf;
+ }
+
+ err = -EFAULT;
+ if (copy_from_user(parg, (void __user *)arg, _IOC_SIZE(cmd)))
+ goto out;
+ break;
+ }
+
+ /* call driver */
+ mutex_lock(&dvbdev_mutex);
+ if ((err = dvb_ca_ioctl(file, cmd, parg)) == -ENOIOCTLCMD)
+ err = -EINVAL;
+ mutex_unlock(&dvbdev_mutex);
+
+ if (err < 0)
+ goto out;
+
+ /* Copy results into user buffer */
+ switch (_IOC_DIR(cmd))
+ {
+ case _IOC_READ:
+ case (_IOC_WRITE | _IOC_READ):
+ if (copy_to_user((void __user *)arg, parg, _IOC_SIZE(cmd)))
+ err = -EFAULT;
+ break;
+ }
+
+out:
+ kfree(mbuf);
+ return err;
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-3-fixed.c b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-3-fixed.c
new file mode 100644
index 0000000..b7852b4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-3-fixed.c
@@ -0,0 +1,61 @@
+/* { dg-do compile } */
+// TODO: remove need for -fanalyzer-checker=taint here:
+/* { dg-options "-fanalyzer -fanalyzer-checker=taint" } */
+/* { dg-require-effective-target analyzer } */
+
+/* See notes in this header. */
+#include "taint-CVE-2011-0521.h"
+
+// TODO: remove need for this option
+/* { dg-additional-options "-fanalyzer-checker=taint" } */
+
+/* Adapted from drivers/media/dvb/ttpci/av7110_ca.c */
+
+int dvb_ca_ioctl(struct file *file, unsigned int cmd, void *parg)
+{
+ struct dvb_device *dvbdev = file->private_data;
+ struct av7110 *av7110 = dvbdev->priv;
+ unsigned long arg = (unsigned long) parg;
+
+ /* case CA_GET_SLOT_INFO: */
+ {
+ ca_slot_info_t *info=(ca_slot_info_t *)parg;
+
+ if (info->num < 0 || info->num > 1)
+ return -EINVAL;
+ av7110->ci_slot[info->num].num = info->num; /* { dg-bogus "attacker-controlled value" } */
+ av7110->ci_slot[info->num].type = FW_CI_LL_SUPPORT(av7110->arm_app) ?
+ CA_CI_LINK : CA_CI;
+ memcpy(info, &av7110->ci_slot[info->num], sizeof(ca_slot_info_t));
+ }
+ return 0;
+}
+
+/* Adapted from drivers/media/dvb/dvb-core/dvbdev.c
+ Further simplified from -2; always use an on-stack buffer. */
+
+static DEFINE_MUTEX(dvbdev_mutex);
+
+int dvb_usercopy(struct file *file,
+ unsigned int cmd, unsigned long arg)
+{
+ char sbuf[128];
+ void *parg = sbuf;
+ int err = -EFAULT;
+ if (copy_from_user(parg, (void __user *)arg, sizeof(sbuf)))
+ goto out;
+
+ mutex_lock(&dvbdev_mutex);
+ if ((err = dvb_ca_ioctl(file, cmd, parg)) == -ENOIOCTLCMD)
+ err = -EINVAL;
+ mutex_unlock(&dvbdev_mutex);
+
+ if (err < 0)
+ goto out;
+
+ if (copy_to_user((void __user *)arg, parg, sizeof(sbuf)))
+ err = -EFAULT;
+
+out:
+ return err;
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-3.c b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-3.c
new file mode 100644
index 0000000..6b9e034
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-3.c
@@ -0,0 +1,59 @@
+/* { dg-do compile } */
+// TODO: remove need for -fanalyzer-checker=taint here:
+/* { dg-options "-fanalyzer -fanalyzer-checker=taint" } */
+/* { dg-require-effective-target analyzer } */
+
+/* See notes in this header. */
+#include "taint-CVE-2011-0521.h"
+
+/* Adapted from drivers/media/dvb/ttpci/av7110_ca.c */
+
+int dvb_ca_ioctl(struct file *file, unsigned int cmd, void *parg)
+{
+ struct dvb_device *dvbdev = file->private_data;
+ struct av7110 *av7110 = dvbdev->priv;
+ unsigned long arg = (unsigned long) parg;
+
+ /* case CA_GET_SLOT_INFO: */
+ {
+ ca_slot_info_t *info=(ca_slot_info_t *)parg;
+
+ if (info->num > 1)
+ return -EINVAL;
+ av7110->ci_slot[info->num].num = info->num; /* { dg-warning "attacker-controlled value" "" { xfail *-*-* } } */
+ // TODO(xfail)
+ av7110->ci_slot[info->num].type = FW_CI_LL_SUPPORT(av7110->arm_app) ?
+ CA_CI_LINK : CA_CI;
+ memcpy(info, &av7110->ci_slot[info->num], sizeof(ca_slot_info_t));
+ }
+ return 0;
+}
+
+/* Adapted from drivers/media/dvb/dvb-core/dvbdev.c
+ Further simplified from -2; always use an on-stack buffer. */
+
+static DEFINE_MUTEX(dvbdev_mutex);
+
+int dvb_usercopy(struct file *file,
+ unsigned int cmd, unsigned long arg)
+{
+ char sbuf[128];
+ void *parg = sbuf;
+ int err = -EFAULT;
+ if (copy_from_user(parg, (void __user *)arg, sizeof(sbuf)))
+ goto out;
+
+ mutex_lock(&dvbdev_mutex);
+ if ((err = dvb_ca_ioctl(file, cmd, parg)) == -ENOIOCTLCMD)
+ err = -EINVAL;
+ mutex_unlock(&dvbdev_mutex);
+
+ if (err < 0)
+ goto out;
+
+ if (copy_to_user((void __user *)arg, parg, sizeof(sbuf)))
+ err = -EFAULT;
+
+out:
+ return err;
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-4.c b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-4.c
new file mode 100644
index 0000000..f314c64
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-4.c
@@ -0,0 +1,45 @@
+/* { dg-do compile } */
+// TODO: remove need for -fanalyzer-checker=taint here:
+// TODO: remove need for --param=analyzer-max-svalue-depth=25 here:
+/* { dg-options "-fanalyzer -fanalyzer-checker=taint --param=analyzer-max-svalue-depth=25" } */
+/* { dg-options "-fanalyzer -fanalyzer-checker=taint" } */
+/* { dg-require-effective-target analyzer } */
+
+/* See notes in this header. */
+#include "taint-CVE-2011-0521.h"
+
+/* Adapted from dvb_ca_ioctl in drivers/media/dvb/ttpci/av7110_ca.c and
+ dvb_usercopy in drivers/media/dvb/dvb-core/dvbdev.c
+
+ Further simplified from -3; merge into a single function; drop the mutex,
+ remove control flow. */
+
+int test_1(struct file *file, unsigned int cmd, unsigned long arg)
+{
+ char sbuf[128];
+ void *parg = sbuf;
+
+ if (copy_from_user(parg, (void __user *)arg, sizeof(sbuf)))
+ return -1;
+
+ {
+ struct dvb_device *dvbdev = file->private_data;
+ struct av7110 *av7110 = dvbdev->priv;
+ unsigned long arg = (unsigned long) parg;
+
+ /* case CA_GET_SLOT_INFO: */
+ ca_slot_info_t *info=(ca_slot_info_t *)parg;
+
+ if (info->num > 1)
+ return -EINVAL;
+ av7110->ci_slot[info->num].num = info->num; /* { dg-warning "attacker-controlled value" "" { xfail *-*-* } } */
+ // TODO(xfail)
+ av7110->ci_slot[info->num].type = FW_CI_LL_SUPPORT(av7110->arm_app) ?
+ CA_CI_LINK : CA_CI;
+ memcpy(info, &av7110->ci_slot[info->num], sizeof(ca_slot_info_t));
+ }
+
+ copy_to_user((void __user *)arg, parg, sizeof(sbuf));
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-5-fixed.c b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-5-fixed.c
new file mode 100644
index 0000000..8cb067c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-5-fixed.c
@@ -0,0 +1,46 @@
+/* { dg-do compile } */
+// TODO: remove need for -fanalyzer-checker=taint here:
+// TODO: remove need for --param=analyzer-max-svalue-depth=25 here:
+/* { dg-options "-fanalyzer -fanalyzer-checker=taint --param=analyzer-max-svalue-depth=25" } */
+/* { dg-require-effective-target analyzer } */
+
+/* See notes in this header. */
+#include "taint-CVE-2011-0521.h"
+
+/* Adapted from dvb_ca_ioctl in drivers/media/dvb/ttpci/av7110_ca.c and
+ dvb_usercopy in drivers/media/dvb/dvb-core/dvbdev.c
+
+ Further simplified from -4; avoid parg and the cast to char[128]. */
+
+int test_1(struct file *file, unsigned int cmd, unsigned long arg)
+{
+ ca_slot_info_t sbuf;
+
+ if (copy_from_user(&sbuf, (void __user *)arg, sizeof(sbuf)) != 0)
+ return -1;
+
+ {
+ struct dvb_device *dvbdev = file->private_data;
+ struct av7110 *av7110 = dvbdev->priv;
+
+ /* case CA_GET_SLOT_INFO: */
+ ca_slot_info_t *info= &sbuf;
+
+ __analyzer_dump_state ("taint", info->num); /* { dg-warning "tainted" } */
+
+ if (info->num < 0 || info->num > 1)
+ return -EINVAL;
+
+ __analyzer_dump_state ("taint", info->num); /* { dg-warning "stop" } */
+
+ av7110->ci_slot[info->num].num = info->num;
+ av7110->ci_slot[info->num].type = FW_CI_LL_SUPPORT(av7110->arm_app) ?
+ CA_CI_LINK : CA_CI;
+ memcpy(info, &av7110->ci_slot[info->num], sizeof(ca_slot_info_t)); /* { dg-bogus "use of attacker-controlled value in array lookup without bounds checking" "" { xfail *-*-* } } */
+ // FIXME: why the above false +ve?
+ }
+
+ copy_to_user((void __user *)arg, &sbuf, sizeof(sbuf));
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-5.c b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-5.c
new file mode 100644
index 0000000..4ce0479
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-5.c
@@ -0,0 +1,45 @@
+/* { dg-do compile } */
+// TODO: remove need for -fanalyzer-checker=taint here:
+// TODO: remove need for --param=analyzer-max-svalue-depth=25 here:
+/* { dg-options "-fanalyzer -fanalyzer-checker=taint --param=analyzer-max-svalue-depth=25" } */
+/* { dg-require-effective-target analyzer } */
+
+/* See notes in this header. */
+#include "taint-CVE-2011-0521.h"
+
+/* Adapted from dvb_ca_ioctl in drivers/media/dvb/ttpci/av7110_ca.c and
+ dvb_usercopy in drivers/media/dvb/dvb-core/dvbdev.c
+
+ Further simplified from -4; avoid parg and the cast to char[128]. */
+
+int test_1(struct file *file, unsigned int cmd, unsigned long arg)
+{
+ ca_slot_info_t sbuf;
+
+ if (copy_from_user(&sbuf, (void __user *)arg, sizeof(sbuf)) != 0)
+ return -1;
+
+ {
+ struct dvb_device *dvbdev = file->private_data;
+ struct av7110 *av7110 = dvbdev->priv;
+
+ /* case CA_GET_SLOT_INFO: */
+ ca_slot_info_t *info= &sbuf;
+
+ __analyzer_dump_state ("taint", info->num); /* { dg-warning "tainted" } */
+
+ if (info->num > 1)
+ return -EINVAL;
+
+ __analyzer_dump_state ("taint", info->num); /* { dg-warning "has_ub" } */
+
+ av7110->ci_slot[info->num].num = info->num; /* { dg-warning "use of attacker-controlled value '\\*info\\.num' in array lookup without checking for negative" } */
+ av7110->ci_slot[info->num].type = FW_CI_LL_SUPPORT(av7110->arm_app) ? /* { dg-warning "use of attacker-controlled value '\\*info\\.num' in array lookup without checking for negative" } */
+ CA_CI_LINK : CA_CI;
+ memcpy(info, &av7110->ci_slot[info->num], sizeof(ca_slot_info_t)); /* { dg-warning "use of attacker-controlled value in array lookup without bounds checking" } */
+ }
+
+ copy_to_user((void __user *)arg, &sbuf, sizeof(sbuf));
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-6.c b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-6.c
new file mode 100644
index 0000000..c54af79
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-6.c
@@ -0,0 +1,42 @@
+/* { dg-do compile } */
+// TODO: remove need for -fanalyzer-checker=taint here:
+// TODO: remove need for --param=analyzer-max-svalue-depth=25 here:
+/* { dg-options "-fanalyzer -fanalyzer-checker=taint --param=analyzer-max-svalue-depth=25" } */
+/* { dg-require-effective-target analyzer } */
+
+/* See notes in this header. */
+#include "taint-CVE-2011-0521.h"
+
+/* Adapted from dvb_ca_ioctl in drivers/media/dvb/ttpci/av7110_ca.c and
+ dvb_usercopy in drivers/media/dvb/dvb-core/dvbdev.c
+
+ Further simplified from -5; remove all control flow. */
+
+int test_1(struct file *file, unsigned int cmd, unsigned long arg)
+{
+ ca_slot_info_t sbuf;
+
+ if (copy_from_user(&sbuf, (void __user *)arg, sizeof(sbuf)) != 0)
+ return -1;
+
+ {
+ struct dvb_device *dvbdev = file->private_data;
+ struct av7110 *av7110 = dvbdev->priv;
+
+ /* case CA_GET_SLOT_INFO: */
+ ca_slot_info_t *info= &sbuf;
+
+ __analyzer_dump_state ("taint", info->num); /* { dg-warning "tainted" } */
+
+ //__analyzer_break ();
+
+ av7110->ci_slot[info->num].num = info->num; /* { dg-warning "use of attacker-controlled value '\\*info\\.num' in array lookup without bounds checking" } */
+ av7110->ci_slot[info->num].type = FW_CI_LL_SUPPORT(av7110->arm_app) ? /* { dg-warning "use of attacker-controlled value '\\*info\\.num' in array lookup without bounds checking" } */
+ CA_CI_LINK : CA_CI;
+ memcpy(info, &av7110->ci_slot[info->num], sizeof(ca_slot_info_t)); /* { dg-warning "use of attacker-controlled value in array lookup without bounds checking" } */
+ }
+
+ copy_to_user((void __user *)arg, &sbuf, sizeof(sbuf));
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521.h b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521.h
new file mode 100644
index 0000000..29f66b6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521.h
@@ -0,0 +1,136 @@
+/* Shared header for the various taint-CVE-2011-0521-*.c tests.
+ These are a series of successively simpler reductions of the reproducer.
+ Ideally the analyzer would detect the issue in all of the testcases,
+ but currently requires some simplification of the code to do so.
+
+ "The dvb_ca_ioctl function in drivers/media/dvb/ttpci/av7110_ca.c in the
+ Linux kernel before 2.6.38-rc2 does not check the sign of a certain integer
+ field, which allows local users to cause a denial of service (memory
+ corruption) or possibly have unspecified other impact via a negative value."
+
+ Adapted from Linux 2.6.38, which is under the GPLv2.
+
+ Fixed in e.g. cb26a24ee9706473f31d34cc259f4dcf45cd0644 on linux-2.6.38.y */
+
+#include <string.h>
+#include "test-uaccess.h"
+#include "../analyzer/analyzer-decls.h"
+
+typedef unsigned int u32;
+
+/* Adapted from include/linux/compiler.h */
+
+#define __force
+
+/* Adapted from include/asm-generic/errno-base.h */
+
+#define ENOMEM 12 /* Out of memory */
+#define EFAULT 14 /* Bad address */
+#define ENODEV 19 /* No such device */
+#define EINVAL 22 /* Invalid argument */
+
+/* Adapted from include/linux/errno.h */
+
+#define ENOIOCTLCMD 515 /* No ioctl command */
+
+/* Adapted from include/linux/fs.h */
+
+struct file {
+ /* [...snip...] */
+ void *private_data;
+ /* [...snip...] */
+};
+
+/* Adapted from drivers/media/dvb/dvb-core/dvbdev.h */
+
+struct dvb_device {
+ /* [...snip...] */
+ int (*kernel_ioctl)(struct file *file, unsigned int cmd, void *arg);
+
+ void *priv;
+};
+
+
+/* Adapted from include/linux/dvb/ca.h */
+
+typedef struct ca_slot_info {
+ int num; /* slot number */
+
+ int type; /* CA interface this slot supports */
+#define CA_CI 1 /* CI high level interface */
+#define CA_CI_LINK 2 /* CI link layer level interface */
+ /* [...snip...] */
+} ca_slot_info_t;
+
+
+/* Adapted from drivers/media/dvb/ttpci/av7110.h */
+
+struct av7110 {
+ /* [...snip...] */
+ ca_slot_info_t ci_slot[2];
+ /* [...snip...] */
+ u32 arm_app;
+ /* [...snip...] */
+};
+
+/* Adapted from drivers/media/dvb/ttpci/av7110_hw.h */
+
+#define FW_CI_LL_SUPPORT(arm_app) ((arm_app) & 0x80000000)
+
+/* Adapted from include/asm-generic/ioctl.h */
+
+#define _IOC_NRBITS 8
+#define _IOC_TYPEBITS 8
+
+#define _IOC_SIZEBITS 14
+#define _IOC_DIRBITS 2
+
+#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
+#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
+#define _IOC_NRSHIFT 0
+#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
+#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
+#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
+
+#define _IOC_NONE 0U
+#define _IOC_WRITE 1U
+#define _IOC_READ 2U
+
+#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
+#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
+
+/* Adapted from include/linux/mutex.h */
+
+struct mutex {
+ /* [...snip...] */
+};
+
+#define __MUTEX_INITIALIZER(lockname) \
+ { /* [...snip...] */ }
+
+#define DEFINE_MUTEX(mutexname) \
+ struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
+
+extern void mutex_lock(struct mutex *lock);
+extern void mutex_unlock(struct mutex *lock);
+
+/* Adapted from include/linux/types.h */
+
+#define __bitwise__
+typedef unsigned __bitwise__ gfp_t;
+
+/* Adapted from include/linux/gfp.h */
+
+#define ___GFP_WAIT 0x10u
+#define ___GFP_IO 0x40u
+#define ___GFP_FS 0x80u
+#define __GFP_WAIT ((__force gfp_t)___GFP_WAIT)
+#define __GFP_IO ((__force gfp_t)___GFP_IO)
+#define __GFP_FS ((__force gfp_t)___GFP_FS)
+#define GFP_KERNEL (__GFP_WAIT | __GFP_IO | __GFP_FS)
+
+/* Adapted from include/linux/slab.h */
+
+void kfree(const void *);
+void *kmalloc(size_t size, gfp_t flags)
+ __attribute__((malloc (kfree)));
diff --git a/gcc/testsuite/gcc.dg/plugin/taint-antipatterns-1.c b/gcc/testsuite/gcc.dg/plugin/taint-antipatterns-1.c
new file mode 100644
index 0000000..6bb6f1b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/taint-antipatterns-1.c
@@ -0,0 +1,139 @@
+/* { dg-do compile } */
+// TODO: remove need for -fanalyzer-checker=taint here:
+/* { dg-options "-fanalyzer -fanalyzer-checker=taint" } */
+/* { dg-require-effective-target analyzer } */
+
+#include "test-uaccess.h"
+
+/* Adapted and simplified decls from linux kernel headers. */
+
+typedef unsigned char u8;
+typedef unsigned __INT16_TYPE__ u16;
+typedef unsigned __INT32_TYPE__ u32;
+typedef signed __INT32_TYPE__ s32;
+typedef __SIZE_TYPE__ size_t;
+
+#define EFAULT 14
+
+typedef unsigned int gfp_t;
+#define GFP_KERNEL 0
+
+void kfree(const void *);
+void *kmalloc(size_t size, gfp_t flags)
+ __attribute__((malloc (kfree)));
+
+/* Adapted from antipatterns.ko:taint.c (GPL-v2.0). */
+
+struct cmd_1
+{
+ u32 idx;
+ u32 val;
+};
+
+static u32 arr[16];
+
+int taint_array_access(void __user *src)
+{
+ struct cmd_1 cmd;
+ if (copy_from_user(&cmd, src, sizeof(cmd)))
+ return -EFAULT;
+ /*
+ * cmd.idx is an unsanitized value from user-space, hence
+ * this is an arbitrary kernel memory access.
+ */
+ arr[cmd.idx] = cmd.val; /* { dg-warning "use of attacker-controlled value 'cmd.idx' in array lookup without upper-bounds checking" } */
+ return 0;
+}
+
+struct cmd_2
+{
+ s32 idx;
+ u32 val;
+};
+
+int taint_signed_array_access(void __user *src)
+{
+ struct cmd_2 cmd;
+ if (copy_from_user(&cmd, src, sizeof(cmd)))
+ return -EFAULT;
+ if (cmd.idx >= 16)
+ return -EFAULT;
+
+ /*
+ * cmd.idx hasn't been checked for being negative, hence
+ * this is an arbitrary kernel memory access.
+ */
+ arr[cmd.idx] = cmd.val; /* { dg-warning "use of attacker-controlled value 'cmd.idx' in array lookup without checking for negative" } */
+ return 0;
+}
+
+struct cmd_s32_binop
+{
+ s32 a;
+ s32 b;
+ s32 result;
+};
+
+int taint_divide_by_zero_direct(void __user *uptr)
+{
+ struct cmd_s32_binop cmd;
+ if (copy_from_user(&cmd, uptr, sizeof(cmd)))
+ return -EFAULT;
+
+ /* cmd.b is attacker-controlled and could be zero */
+ cmd.result = cmd.a / cmd.b; /* { dg-warning "use of attacker-controlled value 'cmd.b' as divisor without checking for zero" } */
+
+ if (copy_to_user (uptr, &cmd, sizeof(cmd)))
+ return -EFAULT;
+ return 0;
+}
+
+int taint_divide_by_zero_compound(void __user *uptr)
+{
+ struct cmd_s32_binop cmd;
+ if (copy_from_user(&cmd, uptr, sizeof(cmd)))
+ return -EFAULT;
+
+ /*
+ * cmd.b is attacker-controlled and could be -1, hence
+ * the divisor could be zero
+ */
+ cmd.result = cmd.a / (cmd.b + 1); /* { dg-warning "use of attacker-controlled value 'cmd.b \\+ 1' as divisor without checking for zero" } */
+
+ if (copy_to_user (uptr, &cmd, sizeof(cmd)))
+ return -EFAULT;
+ return 0;
+}
+
+int taint_mod_by_zero_direct(void __user *uptr)
+{
+ struct cmd_s32_binop cmd;
+ if (copy_from_user(&cmd, uptr, sizeof(cmd)))
+ return -EFAULT;
+
+ /* cmd.b is attacker-controlled and could be zero */
+ cmd.result = cmd.a % cmd.b; /* { dg-warning "use of attacker-controlled value 'cmd.b' as divisor without checking for zero" } */
+
+ if (copy_to_user (uptr, &cmd, sizeof(cmd)))
+ return -EFAULT;
+ return 0;
+}
+
+int taint_mod_by_zero_compound(void __user *uptr)
+{
+ struct cmd_s32_binop cmd;
+ if (copy_from_user(&cmd, uptr, sizeof(cmd)))
+ return -EFAULT;
+
+ /*
+ * cmd.b is attacker-controlled and could be -1, hence
+ * the divisor could be zero
+ */
+ cmd.result = cmd.a % (cmd.b + 1); /* { dg-warning "use of attacker-controlled value 'cmd.b \\+ 1' as divisor without checking for zero" } */
+
+ if (copy_to_user (uptr, &cmd, sizeof(cmd)))
+ return -EFAULT;
+ return 0;
+}
+
+/* TODO: etc. */
diff --git a/gcc/testsuite/gcc.dg/plugin/test-uaccess.h b/gcc/testsuite/gcc.dg/plugin/test-uaccess.h
new file mode 100644
index 0000000..42eac98
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/test-uaccess.h
@@ -0,0 +1,10 @@
+/* Shared header for testcases for copy_from_user/copy_to_user. */
+
+/* Adapted from include/linux/compiler.h */
+
+#define __user
+
+/* Adapted from include/asm-generic/uaccess.h */
+
+extern long copy_from_user(void *to, const void __user *from, long n);
+extern long copy_to_user(void __user *to, const void *from, long n);
diff --git a/gcc/testsuite/gcc.dg/pr102892-1.c b/gcc/testsuite/gcc.dg/pr102892-1.c
index a9302b5..f08b2b8 100644
--- a/gcc/testsuite/gcc.dg/pr102892-1.c
+++ b/gcc/testsuite/gcc.dg/pr102892-1.c
@@ -1,5 +1,6 @@
/* { dg-do link } */
/* { dg-options "-O3" } */
+/* { dg-additional-options "-fno-PIC" { target ia32 } } */
/* { dg-additional-sources "pr102892-2.c" } */
static long b[2][1] = {0};
diff --git a/gcc/testsuite/gcc.dg/pr104992.c b/gcc/testsuite/gcc.dg/pr104992.c
new file mode 100644
index 0000000..217c89a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr104992.c
@@ -0,0 +1,57 @@
+/* PR tree-optimization/104992 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wno-psabi -fdump-tree-optimized" } */
+
+#define vector __attribute__((vector_size(4*sizeof(int))))
+
+/* Form from PR. */
+__attribute__((noipa)) unsigned foo(unsigned x, unsigned y)
+{
+ return x / y * y == x;
+}
+
+__attribute__((noipa)) unsigned bar(unsigned x, unsigned y) {
+ return x == x / y * y;
+}
+
+/* Signed test case. */
+__attribute__((noipa)) unsigned baz (int x, int y) {
+ return x / y * y == x;
+}
+
+/* Changed order. */
+__attribute__((noipa)) unsigned qux (unsigned x, unsigned y) {
+ return y * (x / y) == x;
+}
+
+/* Test for forward propogation. */
+__attribute__((noipa)) unsigned corge(unsigned x, unsigned y) {
+ int z = x / y;
+ int q = z * y;
+ return q == x;
+}
+
+/* Test vector case. */
+__attribute__((noipa)) vector int thud(vector int x, vector int y) {
+ return x / y * y == x;
+}
+
+/* Complex type should not simplify because mod is different. */
+__attribute__((noipa)) int goo(_Complex int x, _Complex int y)
+{
+ _Complex int z = x / y;
+ _Complex int q = z * y;
+ return q == x;
+}
+
+/* Wrong order. */
+__attribute__((noipa)) unsigned fred (unsigned x, unsigned y) {
+ return y * x / y == x;
+}
+
+/* Wrong pattern. */
+__attribute__((noipa)) unsigned waldo (unsigned x, unsigned y, unsigned z) {
+ return x / y * z == x;
+}
+
+/* { dg-final {scan-tree-dump-times " % " 9 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/pr106099.c b/gcc/testsuite/gcc.dg/pr106099.c
new file mode 100644
index 0000000..01b1144
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr106099.c
@@ -0,0 +1,10 @@
+/* PR tree-optimization/106099 */
+/* { dg-do compile } */
+/* { dg-options "-O -fharden-compares -fno-tree-forwprop -fno-tree-ch -fno-tree-dominator-opts -fno-tree-ccp -funreachable-traps --param=scev-max-expr-size=1" } */
+
+void
+foo (void)
+{
+ for (unsigned i = 0; i == 0; i++)
+ __builtin_printf ("%d", i);
+}
diff --git a/gcc/testsuite/gcc.dg/pr106243-1.c b/gcc/testsuite/gcc.dg/pr106243-1.c
new file mode 100644
index 0000000..cb3b74c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr106243-1.c
@@ -0,0 +1,18 @@
+/* PR tree-optimization/106243 */
+/* { dg-do run } */
+/* { dg-options "-O2 -Wno-psabi" } */
+
+#include "pr106243.c"
+
+int main () {
+
+ if (foo(3) != 1
+ || bar(-6) != 0
+ || baz(17) != 1
+ || qux(-128) != 0
+ || foo(127) != 1) {
+ __builtin_abort();
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr106243.c b/gcc/testsuite/gcc.dg/pr106243.c
new file mode 100644
index 0000000..8a7e0bf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr106243.c
@@ -0,0 +1,43 @@
+/* PR tree-optimization/106243 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wno-psabi -fdump-tree-optimized" } */
+
+#define vector __attribute__((vector_size(4*sizeof(int))))
+
+/* Test from PR. */
+__attribute__((noipa)) int foo (int x) {
+ return -x & 1;
+}
+
+/* Other test from PR. */
+__attribute__((noipa)) int bar (int x) {
+ return (0 - x) & 1;
+}
+
+/* Forward propogation. */
+__attribute__((noipa)) int baz (int x) {
+ x = -x;
+ return x & 1;
+}
+
+/* Commutative property. */
+__attribute__((noipa)) int qux (int x) {
+ return 1 & -x;
+}
+
+/* Vector test case. */
+__attribute__((noipa)) vector int waldo (vector int x) {
+ return -x & 1;
+}
+
+/* Should not simplify. */
+__attribute__((noipa)) int thud (int x) {
+ return -x & 2;
+}
+
+/* Should not simplify. */
+__attribute__((noipa)) int corge (int x) {
+ return -x & -1;
+}
+
+/* { dg-final {scan-tree-dump-times "-" 2 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/pr106510.c b/gcc/testsuite/gcc.dg/pr106510.c
new file mode 100644
index 0000000..24e9112
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr106510.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void foo ();
+void ine_ok() {
+ float y, x;
+ if (x < y || x > y || y)
+ foo ();
+}
+
diff --git a/gcc/testsuite/gcc.dg/pr106519.c b/gcc/testsuite/gcc.dg/pr106519.c
new file mode 100644
index 0000000..3d4662d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr106519.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+
+int bytestart, bytemem_0_0, modlookup_l_p;
+
+void
+modlookup_l() {
+ long j;
+ while (modlookup_l_p)
+ while (bytestart && j && bytemem_0_0)
+ j = j + 1;
+}
diff --git a/gcc/testsuite/gcc.dg/pr106617.c b/gcc/testsuite/gcc.dg/pr106617.c
new file mode 100644
index 0000000..4274b55
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr106617.c
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+
+int nr_cpu_ids;
+void fc_setup_exch_mgr() {
+ (((((((1UL << (((0, 0)
+ ? ((1)
+ ? (((nr_cpu_ids)) ? 0
+ : ((nr_cpu_ids)) & (21) ? 21
+ : ((nr_cpu_ids)) ? 20
+ : ((nr_cpu_ids)) & (19) ? 19
+ : ((nr_cpu_ids)) ? 18
+ : ((nr_cpu_ids)) & (17) ? 17
+ : ((nr_cpu_ids)) ? 16
+ : ((nr_cpu_ids)) & (15) ? 15
+ : ((nr_cpu_ids)) ? 14
+ : ((nr_cpu_ids)) & (13) ? 13
+ : ((nr_cpu_ids)) ? 12
+ : ((nr_cpu_ids)) & (11) ? 11
+ : ((nr_cpu_ids)) ? 10
+ : ((nr_cpu_ids)) & (9) ? 9
+ : ((nr_cpu_ids)) ? 8
+ : ((nr_cpu_ids)) & (7) ? 7
+ : ((nr_cpu_ids)) ? 6
+ : ((nr_cpu_ids)) & (5) ? 5
+ : ((nr_cpu_ids)) ? 4
+ : ((nr_cpu_ids)) & (3)
+ ? 3
+ : ((nr_cpu_ids)-1) & 1)
+ : 1)
+ : 0) +
+ 1))))) &
+ (1UL << 2)
+ ? 2
+ : 1))
+ );
+}
diff --git a/gcc/testsuite/gcc.dg/pr106621.c b/gcc/testsuite/gcc.dg/pr106621.c
new file mode 100644
index 0000000..0465de4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr106621.c
@@ -0,0 +1,30 @@
+/* { dg-do compile { target aarch64*-*-* } } */
+/* { dg-options "-mcpu=neoverse-v1 -O2 -fvect-cost-model=dynamic -fno-tree-scev-cprop" } */
+
+int m, n;
+
+void
+foo (unsigned int x, short int y)
+{
+ if (m)
+ for (;;)
+ {
+ ++m;
+ while (m < 1)
+ {
+ n += m + x;
+ ++m;
+ }
+ }
+
+ for (;;)
+ if (y)
+ {
+ ++x;
+ if (x)
+ for (y = 0; y < 75; y += 2)
+ {
+ }
+ }
+}
+
diff --git a/gcc/testsuite/gcc.dg/pr106844.c b/gcc/testsuite/gcc.dg/pr106844.c
new file mode 100644
index 0000000..df68d76
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr106844.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized --param uninit-control-dep-attempts=1" } */
+
+struct {
+ int count;
+ int array[8];
+} fde_merge_v1;
+
+void
+fde_merge_i2() {
+ unsigned i1;
+ do
+ while (i1 && fde_merge_v1.array[i1 - 1]) /* { dg-warning "uninitialized" } */
+ i1--;
+ while (fde_merge_i2);
+}
diff --git a/gcc/testsuite/gcc.dg/pr106938.c b/gcc/testsuite/gcc.dg/pr106938.c
new file mode 100644
index 0000000..7365a8c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr106938.c
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fno-ipa-pure-const -fno-tree-ccp -Wuninitialized" } */
+
+int n;
+
+void
+undefined (void);
+
+__attribute__ ((returns_twice)) int
+zero (void)
+{
+ return 0;
+}
+
+void
+bar (int)
+{
+ int i;
+
+ for (i = 0; i < -1; ++i)
+ n = 0;
+}
+
+__attribute__ ((simd)) void
+foo (void)
+{
+ int uninitialized;
+
+ undefined ();
+
+ while (uninitialized < 1) /* { dg-warning "uninitialized" } */
+ {
+ bar (zero ());
+ ++uninitialized;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pr61096-1.c b/gcc/testsuite/gcc.dg/pr61096-1.c
index e707904..f41789c 100644
--- a/gcc/testsuite/gcc.dg/pr61096-1.c
+++ b/gcc/testsuite/gcc.dg/pr61096-1.c
@@ -36,7 +36,7 @@ struct S s = { { 1 }, { 3 } }; /* { dg-error "23:extra brace group at end of ini
struct g g1 = { {0, { 1 } } }; /* { dg-error "21:initialization of flexible array member in a nested context" } */
struct g g2 = { .f[0] = 1 }; /* { dg-error "20:array index in non-array initializer" } */
-__extension__ int a8 = { }; /* { dg-error "24:empty scalar initializer" } */
+__extension__ int a8 = { };
int a9[10] = {[1.2] = 2 }; /* { dg-error "16:array index in initializer not of integer type" } */
int a10[10] = {[e] = 2 }; /* { dg-error "17:nonconstant array index in initializer" } */
__extension__ int a11[10] = {[1 ... e] = 1 }; /* { dg-error "31:nonconstant array index in initializer" } */
diff --git a/gcc/testsuite/gcc.dg/pr64992.c b/gcc/testsuite/gcc.dg/pr64992.c
new file mode 100644
index 0000000..43fbcf7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr64992.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+_Bool foo(_Bool x) { return (x << 2) != 0; }
+_Bool bar(_Bool x) { return (x << 2) == 0; }
+
+/* { dg-final { scan-tree-dump-not " << " "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/pr69471-2.c b/gcc/testsuite/gcc.dg/pr69471-2.c
deleted file mode 100644
index d579960..0000000
--- a/gcc/testsuite/gcc.dg/pr69471-2.c
+++ /dev/null
@@ -1,8 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-gstabs2 -gdwarf-4 -gstabs3" } */
-/* { dg-error "conflicts with prior selectio" "" { target *-*-* } 0 } */
-
-void
-foo (void)
-{
-}
diff --git a/gcc/testsuite/gcc.dg/pr71343-1.c b/gcc/testsuite/gcc.dg/pr71343-1.c
new file mode 100644
index 0000000..146f5fc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr71343-1.c
@@ -0,0 +1,56 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+unsigned int foo_plus(unsigned int a, unsigned int b)
+{
+ return (a << 2) + (b << 2);
+}
+
+unsigned int foo_and(unsigned int a, unsigned int b)
+{
+ return (a << 2) & (b << 2);
+}
+
+unsigned int foo_ior(unsigned int a, unsigned int b)
+{
+ return (a << 2) | (b << 2);
+}
+
+unsigned int foo_xor(unsigned int a, unsigned int b)
+{
+ return (a << 2) ^ (b << 2);
+}
+
+unsigned int bar_and(unsigned int a, unsigned int b)
+{
+ return (a >> 2) & (b >> 2);
+}
+
+unsigned int bar_ior(unsigned int a, unsigned int b)
+{
+ return (a >> 2) | (b >> 2);
+}
+
+unsigned int bar_xor(unsigned int a, unsigned int b)
+{
+ return (a >> 2) ^ (b >> 2);
+}
+
+int baz_and(int a, int b)
+{
+ return (a >> 2) & (b >> 2);
+}
+
+int baz_ior(int a, int b)
+{
+ return (a >> 2) | (b >> 2);
+}
+
+int baz_xor(int a, int b)
+{
+ return (a >> 2) ^ (b >> 2);
+}
+
+/* { dg-final { scan-tree-dump-times " << " 4 "optimized" } } */
+/* { dg-final { scan-tree-dump-times " >> " 6 "optimized" } } */
+
diff --git a/gcc/testsuite/gcc.dg/pr87052.c b/gcc/testsuite/gcc.dg/pr87052.c
index 18e092c..796fe64 100644
--- a/gcc/testsuite/gcc.dg/pr87052.c
+++ b/gcc/testsuite/gcc.dg/pr87052.c
@@ -23,8 +23,7 @@ void test (void)
const char d[0] = { };
- /* Expect the following:
- d = ""; */
+ /* Expect nothing. */
const char e[0] = "";
@@ -36,6 +35,7 @@ void test (void)
/* { dg-final { scan-tree-dump-times "a = \"\\\\x00ab\";" 1 "gimple" } }
{ dg-final { scan-tree-dump-times "b = \"a\\\\x00bc\";" 1 "gimple" } }
{ dg-final { scan-tree-dump-times "c = \"\";" 1 "gimple" } }
- { dg-final { scan-tree-dump-times "d = { *};" 1 "gimple" } }
+ { dg-final { scan-tree-dump-times "d = " 1 "gimple" } }
+ { dg-final { scan-tree-dump-times "d = {CLOBBER\\(eol\\)}" 1 "gimple" } }
{ dg-final { scan-tree-dump-times "e = " 1 "gimple" } }
{ dg-final { scan-tree-dump-times "e = {CLOBBER\\(eol\\)}" 1 "gimple" } } */
diff --git a/gcc/testsuite/gcc.dg/precedence-1.c b/gcc/testsuite/gcc.dg/precedence-1.c
index f3f1e35..089cdfc 100644
--- a/gcc/testsuite/gcc.dg/precedence-1.c
+++ b/gcc/testsuite/gcc.dg/precedence-1.c
@@ -135,10 +135,10 @@ f (void)
ASSERT_BIN (0, !=, 2, &, 1, 1, 1, 0);
ASSERT_BIN (1, &, 2, ==, 0, 0, 1, 0);
ASSERT_BIN (1, &, 2, !=, 0, 1, 0, 1);
- ASSERT_BIN (1, &, 2, ^, 3, 3, 3, 1);
+ ASSERT_BIN (1, &, 0x2, ^, 3, 3, 3, 1);
ASSERT_BIN (3, ^, 2, &, 1, 3, 1, 3);
ASSERT_BIN (3, ^, 2, |, 1, 1, 1, 0);
- ASSERT_BIN (3, |, 2, ^, 1, 3, 2, 3);
+ ASSERT_BIN (3, |, 0x2, ^, 1, 3, 2, 3);
ASSERT_BIN (2, |, 0, &&, 2, 1, 1, 2);
ASSERT_BIN (2, &&, 0, |, 2, 1, 2, 1);
ASSERT_BIN (0, &&, 0, ||, 1, 1, 1, 0);
diff --git a/gcc/testsuite/gcc.dg/sibcall-11.c b/gcc/testsuite/gcc.dg/sibcall-11.c
index ae58770..12f6d9c9 100644
--- a/gcc/testsuite/gcc.dg/sibcall-11.c
+++ b/gcc/testsuite/gcc.dg/sibcall-11.c
@@ -1,5 +1,6 @@
// Test for sibcall optimization with empty struct.
// { dg-options "-O2" }
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
// { dg-final { scan-assembler "jmp" { target i?86-*-* x86_64-*-* } } }
struct A { };
diff --git a/gcc/testsuite/gcc.dg/subnot.c b/gcc/testsuite/gcc.dg/subnot.c
new file mode 100644
index 0000000..d621bac
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/subnot.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-optimized" } */
+
+float g(float a, float b)
+{
+ return ~(int)a - ~(int)b;
+}
+
+/* { dg-final { scan-tree-dump-not "~" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-issignaling-1.c b/gcc/testsuite/gcc.dg/torture/builtin-issignaling-1.c
new file mode 100644
index 0000000..fddca6c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/builtin-issignaling-1.c
@@ -0,0 +1,130 @@
+/* { dg-do run } */
+/* { dg-add-options ieee } */
+/* { dg-additional-options "-fsignaling-nans" } */
+/* Workaround for PR57484 on ia32: */
+/* { dg-additional-options "-msse2 -mfpmath=sse" { target { ia32 && sse2_runtime } } } */
+
+#ifndef EXT
+int
+f1 (void)
+{
+ return __builtin_issignaling (__builtin_nansf (""));
+}
+
+int
+f2 (void)
+{
+ return __builtin_issignaling (__builtin_nan (""));
+}
+
+int
+f3 (void)
+{
+ return __builtin_issignaling (0.0L);
+}
+
+int
+f4 (float x)
+{
+ return __builtin_issignaling (x);
+}
+
+int
+f5 (double x)
+{
+ return __builtin_issignaling (x);
+}
+
+int
+f6 (long double x)
+{
+ return __builtin_issignaling (x);
+}
+#else
+#define CONCATX(X, Y) X ## Y
+#define CONCAT(X, Y) CONCATX (X, Y)
+#define CONCAT3(X, Y, Z) CONCAT (CONCAT (X, Y), Z)
+#define CONCAT4(W, X, Y, Z) CONCAT (CONCAT (CONCAT (W, X), Y), Z)
+
+#if EXT
+# define TYPE CONCAT3 (_Float, WIDTH, x)
+# define CST(C) CONCAT4 (C, f, WIDTH, x)
+# define FN(F) CONCAT4 (F, f, WIDTH, x)
+#else
+# define TYPE CONCAT (_Float, WIDTH)
+# define CST(C) CONCAT3 (C, f, WIDTH)
+# define FN(F) CONCAT3 (F, f, WIDTH)
+#endif
+
+int
+f1 (void)
+{
+ return __builtin_issignaling (FN (__builtin_nans) (""));
+}
+
+int
+f2 (void)
+{
+ return __builtin_issignaling (FN (__builtin_nan) (""));
+}
+
+int
+f3 (void)
+{
+ return __builtin_issignaling (CST (0.0));
+}
+
+int
+f4 (TYPE x)
+{
+ return __builtin_issignaling (x);
+}
+#endif
+
+#ifndef EXT
+float x;
+double y;
+long double z;
+#else
+TYPE w;
+#endif
+
+int
+main ()
+{
+ if (!f1 () || f2 () || f3 ())
+ __builtin_abort ();
+ asm volatile ("" : : : "memory");
+#ifndef EXT
+ if (f4 (x) || !f4 (__builtin_nansf ("0x123")) || f4 (42.0f) || f4 (__builtin_nanf ("0x234"))
+ || f4 (__builtin_inff ()) || f4 (-__builtin_inff ()) || f4 (-42.0f) || f4 (-0.0f) || f4 (0.0f))
+ __builtin_abort ();
+ x = __builtin_nansf ("");
+ asm volatile ("" : : : "memory");
+ if (!f4 (x))
+ __builtin_abort ();
+ if (f5 (y) || !f5 (__builtin_nans ("0x123")) || f5 (42.0) || f5 (__builtin_nan ("0x234"))
+ || f5 (__builtin_inf ()) || f5 (-__builtin_inf ()) || f5 (-42.0) || f5 (-0.0) || f5 (0.0))
+ __builtin_abort ();
+ y = __builtin_nans ("");
+ asm volatile ("" : : : "memory");
+ if (!f5 (y))
+ __builtin_abort ();
+ if (f6 (z) || !f6 (__builtin_nansl ("0x123")) || f6 (42.0L) || f6 (__builtin_nanl ("0x234"))
+ || f6 (__builtin_infl ()) || f6 (-__builtin_infl ()) || f6 (-42.0L) || f6 (-0.0L) || f6 (0.0L))
+ __builtin_abort ();
+ z = __builtin_nansl ("");
+ asm volatile ("" : : : "memory");
+ if (!f6 (z))
+ __builtin_abort ();
+#else
+ if (f4 (w) || !f4 (FN (__builtin_nans) ("0x123")) || f4 (CST (42.0)) || f4 (FN (__builtin_nan) ("0x234"))
+ || f4 (FN (__builtin_inf) ()) || f4 (-FN (__builtin_inf) ()) || f4 (CST (-42.0)) || f4 (CST (-0.0)) || f4 (CST (0.0)))
+ __builtin_abort ();
+ w = FN (__builtin_nans) ("");
+ asm volatile ("" : : : "memory");
+ if (!f4 (w))
+ __builtin_abort ();
+#endif
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-issignaling-2.c b/gcc/testsuite/gcc.dg/torture/builtin-issignaling-2.c
new file mode 100644
index 0000000..4209a21
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/builtin-issignaling-2.c
@@ -0,0 +1,73 @@
+/* { dg-do run } */
+/* { dg-require-effective-target dfp } */
+/* { dg-additional-options "-fsignaling-nans" } */
+
+int
+f1 (void)
+{
+ return __builtin_issignaling (__builtin_nansd32 (""));
+}
+
+int
+f2 (void)
+{
+ return __builtin_issignaling (__builtin_nand64 (""));
+}
+
+int
+f3 (void)
+{
+ return __builtin_issignaling (0.0DD);
+}
+
+int
+f4 (_Decimal32 x)
+{
+ return __builtin_issignaling (x);
+}
+
+int
+f5 (_Decimal64 x)
+{
+ return __builtin_issignaling (x);
+}
+
+int
+f6 (_Decimal128 x)
+{
+ return __builtin_issignaling (x);
+}
+
+_Decimal32 x;
+_Decimal64 y;
+_Decimal128 z;
+
+int
+main ()
+{
+ if (!f1 () || f2 () || f3 ())
+ __builtin_abort ();
+ asm volatile ("" : : : "memory");
+ if (f4 (x) || !f4 (__builtin_nansd32 ("0x123")) || f4 (42.0DF) || f4 (__builtin_nand32 ("0x234"))
+ || f4 (__builtin_infd32 ()) || f4 (-__builtin_infd32 ()) || f4 (-42.0DF) || f4 (-0.0DF) || f4 (0.0DF))
+ __builtin_abort ();
+ x = __builtin_nansd32 ("");
+ asm volatile ("" : : : "memory");
+ if (!f4 (x))
+ __builtin_abort ();
+ if (f5 (y) || !f5 (__builtin_nansd64 ("0x123")) || f5 (42.0DD) || f5 (__builtin_nand64 ("0x234"))
+ || f5 (__builtin_infd64 ()) || f5 (-__builtin_infd64 ()) || f5 (-42.0DD) || f5 (-0.0DD) || f5 (0.0DD))
+ __builtin_abort ();
+ y = __builtin_nansd64 ("");
+ asm volatile ("" : : : "memory");
+ if (!f5 (y))
+ __builtin_abort ();
+ if (f6 (z) || !f6 (__builtin_nansd128 ("0x123")) || f6 (42.0DL) || f6 (__builtin_nand128 ("0x234"))
+ || f6 (__builtin_infd128 ()) || f6 (-__builtin_infd128 ()) || f6 (-42.0DL) || f6 (-0.0DL) || f6 (0.0DL))
+ __builtin_abort ();
+ z = __builtin_nansd128 ("");
+ asm volatile ("" : : : "memory");
+ if (!f6 (z))
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-self.c b/gcc/testsuite/gcc.dg/torture/builtin-self.c
index 6d1719f..56188fc 100644
--- a/gcc/testsuite/gcc.dg/torture/builtin-self.c
+++ b/gcc/testsuite/gcc.dg/torture/builtin-self.c
@@ -1,4 +1,5 @@
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* Check that we can use this idiom to define out-of-line copies of built-in
functions. This is used by libgcc/sync.c, for example. */
void __sync_synchronize (void)
diff --git a/gcc/testsuite/gcc.dg/torture/dfp-default-init-1.c b/gcc/testsuite/gcc.dg/torture/dfp-default-init-1.c
new file mode 100644
index 0000000..7bb903b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/dfp-default-init-1.c
@@ -0,0 +1,115 @@
+/* Test that default-initialized DFP values consistently have the least quantum
+ exponent. */
+/* { dg-do run } */
+/* { dg-require-effective-target dfp } */
+
+extern void exit (int);
+extern void abort (void);
+void *memset (void *, int, __SIZE_TYPE__);
+int memcmp (const void *, const void *, __SIZE_TYPE__);
+
+#ifndef TYPE
+#define TYPE _Decimal32
+#endif
+
+#ifndef ZEROFP
+#define ZEROFP 0e-101DF
+#endif
+
+TYPE zero_int = 0;
+TYPE zero_fp = ZEROFP;
+TYPE default_init;
+TYPE empty_init = {};
+TYPE zero_bytes;
+TYPE x;
+
+struct s { TYPE a, b; };
+struct s s_default_init;
+struct s s_empty_init = {};
+struct s s_first_int = { 0 };
+struct s s_both_int = { 0, 0 };
+struct s sx;
+
+const TYPE a_default_init[10];
+const TYPE a_empty_init[10] = {};
+const TYPE a_first_int[10] = { 0 };
+const TYPE a_two_int[10] = { 0, 0 };
+
+#define CHECK_ZERO_BYTES(expr) \
+ do \
+ { \
+ if (memcmp (expr, &zero_bytes, sizeof zero_bytes) != 0) \
+ abort (); \
+ TYPE tmp = *expr; \
+ if (memcmp (&tmp, &zero_bytes, sizeof zero_bytes) != 0) \
+ abort (); \
+ } \
+ while (0)
+
+#define CHECK_INT_BYTES(expr) \
+ do \
+ { \
+ if (memcmp (expr, &zero_int, sizeof zero_int) != 0) \
+ abort (); \
+ TYPE tmp = *expr; \
+ if (memcmp (&tmp, &zero_int, sizeof zero_int) != 0) \
+ abort (); \
+ } \
+ while (0)
+
+int
+main (void)
+{
+ memset (&zero_bytes, 0, sizeof zero_bytes);
+ if (memcmp (&zero_bytes, &zero_int, sizeof zero_int) == 0)
+ abort ();
+ CHECK_ZERO_BYTES (&zero_fp);
+ CHECK_ZERO_BYTES (&default_init);
+ CHECK_ZERO_BYTES (&empty_init);
+ CHECK_ZERO_BYTES (&s_default_init.a);
+ CHECK_ZERO_BYTES (&s_default_init.b);
+ CHECK_ZERO_BYTES (&s_empty_init.a);
+ CHECK_ZERO_BYTES (&s_empty_init.b);
+ CHECK_INT_BYTES (&s_first_int.a);
+ CHECK_ZERO_BYTES (&s_first_int.b);
+ CHECK_INT_BYTES (&s_both_int.a);
+ CHECK_INT_BYTES (&s_both_int.b);
+ CHECK_ZERO_BYTES (&a_default_init[0]);
+ CHECK_ZERO_BYTES (&a_default_init[1]);
+ CHECK_ZERO_BYTES (&a_default_init[2]);
+ CHECK_ZERO_BYTES (&a_default_init[9]);
+ CHECK_ZERO_BYTES (&a_empty_init[0]);
+ CHECK_ZERO_BYTES (&a_empty_init[1]);
+ CHECK_ZERO_BYTES (&a_empty_init[2]);
+ CHECK_ZERO_BYTES (&a_empty_init[9]);
+ CHECK_INT_BYTES (&a_first_int[0]);
+ CHECK_ZERO_BYTES (&a_first_int[1]);
+ CHECK_ZERO_BYTES (&a_first_int[2]);
+ CHECK_ZERO_BYTES (&a_first_int[9]);
+ CHECK_INT_BYTES (&a_two_int[0]);
+ CHECK_INT_BYTES (&a_two_int[1]);
+ CHECK_ZERO_BYTES (&a_two_int[2]);
+ CHECK_ZERO_BYTES (&a_two_int[9]);
+ struct s s2 = {};
+ CHECK_ZERO_BYTES (&s2.a);
+ CHECK_ZERO_BYTES (&s2.b);
+ struct s s3 = { 0 };
+ CHECK_INT_BYTES (&s3.a);
+ CHECK_ZERO_BYTES (&s3.b);
+ struct s s4 = { 0, 0 };
+ CHECK_INT_BYTES (&s4.a);
+ CHECK_INT_BYTES (&s4.b);
+ struct s s5 = { 0 };
+ sx = s5;
+ CHECK_INT_BYTES (&sx.a);
+ CHECK_ZERO_BYTES (&sx.b);
+ x = default_init;
+ CHECK_ZERO_BYTES (&x);
+ x = zero_int;
+ CHECK_INT_BYTES (&x);
+ x = s_default_init.a;
+ CHECK_ZERO_BYTES (&x);
+ x = s_default_init.b;
+ CHECK_ZERO_BYTES (&x);
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/dfp-default-init-2.c b/gcc/testsuite/gcc.dg/torture/dfp-default-init-2.c
new file mode 100644
index 0000000..30f850b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/dfp-default-init-2.c
@@ -0,0 +1,8 @@
+/* Test that default-initialized DFP values consistently have the least quantum
+ exponent. */
+/* { dg-do run } */
+/* { dg-require-effective-target dfp } */
+
+#define TYPE _Decimal64
+#define ZEROFP 0e-398DD
+#include "dfp-default-init-1.c"
diff --git a/gcc/testsuite/gcc.dg/torture/dfp-default-init-3.c b/gcc/testsuite/gcc.dg/torture/dfp-default-init-3.c
new file mode 100644
index 0000000..cdf7350
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/dfp-default-init-3.c
@@ -0,0 +1,8 @@
+/* Test that default-initialized DFP values consistently have the least quantum
+ exponent. */
+/* { dg-do run } */
+/* { dg-require-effective-target dfp } */
+
+#define TYPE _Decimal128
+#define ZEROFP 0e-6176DL
+#include "dfp-default-init-1.c"
diff --git a/gcc/testsuite/gcc.dg/torture/float128-builtin-issignaling-1.c b/gcc/testsuite/gcc.dg/torture/float128-builtin-issignaling-1.c
new file mode 100644
index 0000000..3299ffd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/float128-builtin-issignaling-1.c
@@ -0,0 +1,13 @@
+/* Test _Float128 __builtin_issignaling. */
+/* { dg-do run } */
+/* { dg-options "" } */
+/* { dg-add-options float128 } */
+/* { dg-add-options ieee } */
+/* { dg-require-effective-target float128_runtime } */
+/* { dg-additional-options "-fsignaling-nans" } */
+/* Workaround for PR57484 on ia32: */
+/* { dg-additional-options "-msse2 -mfpmath=sse" { target { ia32 && sse2_runtime } } } */
+
+#define WIDTH 128
+#define EXT 0
+#include "builtin-issignaling-1.c"
diff --git a/gcc/testsuite/gcc.dg/torture/float128x-builtin-issignaling-1.c b/gcc/testsuite/gcc.dg/torture/float128x-builtin-issignaling-1.c
new file mode 100644
index 0000000..af0b25a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/float128x-builtin-issignaling-1.c
@@ -0,0 +1,13 @@
+/* Test _Float128x __builtin_issignaling. */
+/* { dg-do run } */
+/* { dg-options "" } */
+/* { dg-add-options float128x } */
+/* { dg-add-options ieee } */
+/* { dg-require-effective-target float128x_runtime } */
+/* { dg-additional-options "-fsignaling-nans" } */
+/* Workaround for PR57484 on ia32: */
+/* { dg-additional-options "-msse2 -mfpmath=sse" { target { ia32 && sse2_runtime } } } */
+
+#define WIDTH 128
+#define EXT 1
+#include "builtin-issignaling-1.c"
diff --git a/gcc/testsuite/gcc.dg/torture/float16-builtin-issignaling-1.c b/gcc/testsuite/gcc.dg/torture/float16-builtin-issignaling-1.c
new file mode 100644
index 0000000..a0747e4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/float16-builtin-issignaling-1.c
@@ -0,0 +1,13 @@
+/* Test _Float16 __builtin_issignaling. */
+/* { dg-do run } */
+/* { dg-options "" } */
+/* { dg-add-options float16 } */
+/* { dg-add-options ieee } */
+/* { dg-require-effective-target float16_runtime } */
+/* { dg-additional-options "-fsignaling-nans" } */
+/* Workaround for PR57484 on ia32: */
+/* { dg-additional-options "-msse2 -mfpmath=sse" { target { ia32 && sse2_runtime } } } */
+
+#define WIDTH 16
+#define EXT 0
+#include "builtin-issignaling-1.c"
diff --git a/gcc/testsuite/gcc.dg/torture/float32-builtin-issignaling-1.c b/gcc/testsuite/gcc.dg/torture/float32-builtin-issignaling-1.c
new file mode 100644
index 0000000..38e56c2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/float32-builtin-issignaling-1.c
@@ -0,0 +1,13 @@
+/* Test _Float32 __builtin_issignaling. */
+/* { dg-do run } */
+/* { dg-options "" } */
+/* { dg-add-options float32 } */
+/* { dg-add-options ieee } */
+/* { dg-require-effective-target float32_runtime } */
+/* { dg-additional-options "-fsignaling-nans" } */
+/* Workaround for PR57484 on ia32: */
+/* { dg-additional-options "-msse2 -mfpmath=sse" { target { ia32 && sse2_runtime } } } */
+
+#define WIDTH 32
+#define EXT 0
+#include "builtin-issignaling-1.c"
diff --git a/gcc/testsuite/gcc.dg/torture/float32x-builtin-issignaling-1.c b/gcc/testsuite/gcc.dg/torture/float32x-builtin-issignaling-1.c
new file mode 100644
index 0000000..88eefdb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/float32x-builtin-issignaling-1.c
@@ -0,0 +1,13 @@
+/* Test _Float32x __builtin_issignaling. */
+/* { dg-do run } */
+/* { dg-options "" } */
+/* { dg-add-options float32x } */
+/* { dg-add-options ieee } */
+/* { dg-require-effective-target float32x_runtime } */
+/* { dg-additional-options "-fsignaling-nans" } */
+/* Workaround for PR57484 on ia32: */
+/* { dg-additional-options "-msse2 -mfpmath=sse" { target { ia32 && sse2_runtime } } } */
+
+#define WIDTH 32
+#define EXT 1
+#include "builtin-issignaling-1.c"
diff --git a/gcc/testsuite/gcc.dg/torture/float64-builtin-issignaling-1.c b/gcc/testsuite/gcc.dg/torture/float64-builtin-issignaling-1.c
new file mode 100644
index 0000000..07d755b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/float64-builtin-issignaling-1.c
@@ -0,0 +1,13 @@
+/* Test _Float64 __builtin_issignaling. */
+/* { dg-do run } */
+/* { dg-options "" } */
+/* { dg-add-options float64 } */
+/* { dg-add-options ieee } */
+/* { dg-require-effective-target float64_runtime } */
+/* { dg-additional-options "-fsignaling-nans" } */
+/* Workaround for PR57484 on ia32: */
+/* { dg-additional-options "-msse2 -mfpmath=sse" { target { ia32 && sse2_runtime } } } */
+
+#define WIDTH 64
+#define EXT 0
+#include "builtin-issignaling-1.c"
diff --git a/gcc/testsuite/gcc.dg/torture/float64x-builtin-issignaling-1.c b/gcc/testsuite/gcc.dg/torture/float64x-builtin-issignaling-1.c
new file mode 100644
index 0000000..fe6420a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/float64x-builtin-issignaling-1.c
@@ -0,0 +1,13 @@
+/* Test _Float64x __builtin_issignaling. */
+/* { dg-do run } */
+/* { dg-options "" } */
+/* { dg-add-options float64x } */
+/* { dg-add-options ieee } */
+/* { dg-require-effective-target float64x_runtime } */
+/* { dg-additional-options "-fsignaling-nans" } */
+/* Workaround for PR57484 on ia32: */
+/* { dg-additional-options "-msse2 -mfpmath=sse" { target { ia32 && sse2_runtime } } } */
+
+#define WIDTH 64
+#define EXT 1
+#include "builtin-issignaling-1.c"
diff --git a/gcc/testsuite/gcc.dg/torture/pr106422.c b/gcc/testsuite/gcc.dg/torture/pr106422.c
new file mode 100644
index 0000000..a2cef1a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr106422.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+void vfork() __attribute__((__leaf__));
+void semanage_reload_policy(char *arg, void cb(void))
+{
+ if (!arg)
+ {
+ cb();
+ return;
+ }
+ vfork();
+ if (arg)
+ __builtin_free(arg);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr106497.c b/gcc/testsuite/gcc.dg/torture/pr106497.c
new file mode 100644
index 0000000..601200d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr106497.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fno-tree-dce" } */
+
+int n;
+
+__attribute__ ((pure,returns_twice)) int
+bar (void);
+
+int
+foo (int x)
+{
+ n = 0;
+
+ bar ();
+
+ if (x && n)
+ return 0;
+
+ foo (x);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr106513.c b/gcc/testsuite/gcc.dg/torture/pr106513.c
new file mode 100644
index 0000000..aa4f4d5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr106513.c
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+
+typedef __INT64_TYPE__ int64_t;
+
+__attribute__((noinline)) int64_t
+swap64 (int64_t n)
+{
+ return (((n & (((int64_t) 0xff) )) << 56) |
+ ((n & (((int64_t) 0xff) << 8)) << 40) |
+ ((n & (((int64_t) 0xff) << 16)) << 24) |
+ ((n & (((int64_t) 0xff) << 24)) << 8) |
+ ((n & (((int64_t) 0xff) << 32)) >> 8) |
+ ((n & (((int64_t) 0xff) << 40)) >> 24) |
+ ((n & (((int64_t) 0xff) << 48)) >> 40) |
+ ((n & ((int64_t)(0xffull << 56))) >> 56));
+}
+
+int main (void)
+{
+ volatile int64_t n = 0x8000000000000000ll;
+
+ if (swap64(n) != 0xffffffffffffff80ll)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr106521.c b/gcc/testsuite/gcc.dg/torture/pr106521.c
new file mode 100644
index 0000000..05c8ce5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr106521.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-floop-unroll-and-jam --param unroll-jam-min-percent=0" } */
+
+short a, b, e;
+volatile long c;
+long d;
+int main() {
+ for (; d; d++) {
+ long g = a = 1;
+ for (; a; a++) {
+ g++;
+ c;
+ }
+ g && (b = e);
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr106590.c b/gcc/testsuite/gcc.dg/torture/pr106590.c
new file mode 100644
index 0000000..b7b8472
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr106590.c
@@ -0,0 +1,75 @@
+/* PR rtl-optimization/106590 } */
+/* { dg-do run } */
+/* { dg-additional-options "-mtune=skylake" { target { i?86-*-* x86_64-*-* } } } */
+
+typedef struct A { short a; } A;
+typedef A *B;
+typedef struct C { int c, d; } C;
+typedef C *D;
+
+B
+foo (void)
+{
+ static A r = { .a = 1 };
+ return &r;
+}
+
+D
+bar (void)
+{
+ static C r = { .c = 1, .d = 23 };
+ return &r;
+}
+
+static inline int __attribute__((always_inline))
+baz (short a)
+{
+ int e = 1, f;
+ short g;
+ D h;
+
+ switch (a)
+ {
+ case 1:
+ f = 23;
+ g = 1;
+ break;
+ case 2:
+ f = 20;
+ g = 2;
+ break;
+ }
+
+ h = bar ();
+
+ if (h->d != f || h->c != g)
+ __builtin_abort ();
+ return e;
+}
+
+int
+qux (void)
+{
+ B i = foo ();
+ int e = 1;
+
+ switch (i->a)
+ {
+ case 1:
+ case 2:
+ e = baz (i->a);
+ break;
+ case 3:
+ e = 0;
+ break;
+ }
+
+ return e;
+}
+
+int
+main ()
+{
+ qux ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr106630.c b/gcc/testsuite/gcc.dg/torture/pr106630.c
new file mode 100644
index 0000000..d608b91
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr106630.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+short d, e;
+int f;
+extern short g[][24];
+char c;
+void h() {
+ char a = 6;
+ c = a;
+ for (unsigned long a = (d || e) - 1; a < c; a += f)
+ for (signed b = 0; b < 24; b++)
+ g[a][b] = 4;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr106809.c b/gcc/testsuite/gcc.dg/torture/pr106809.c
new file mode 100644
index 0000000..11e1581
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr106809.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Wuninitialized" } */
+
+int foo (int x, int *val)
+{
+ switch (x)
+ {
+#define C(n) \
+ case n + 0: return *val; \
+ case n + 1: return *val; \
+ case n + 2: return *val; \
+ case n + 3: return *val; \
+ case n + 4: return *val; \
+ case n + 5: return *val; \
+ case n + 6: return *val; \
+ case n + 7: return *val; \
+ case n + 8: return *val; \
+ case n + 9: return *val;
+#define C1(n) \
+ C(n+00) C(n+10) C(n+20) C(n+30) C(n+40) \
+ C(n+50) C(n+60) C(n+70) C(n+80) C(n+90)
+#define C10(n) \
+ C1(n+000) C1(n+100) C1(n+200) C1(n+300) C1(n+400) \
+ C1(n+500) C1(n+600) C1(n+700) C1(n+800) C1(n+900)
+ C10(1000)
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr106892.c b/gcc/testsuite/gcc.dg/torture/pr106892.c
new file mode 100644
index 0000000..73a66a0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr106892.c
@@ -0,0 +1,30 @@
+/* { dg-do run } */
+
+int a, b, c, d, e;
+int f[8];
+static int g() {
+ while (a)
+ a >>= 4;
+ return 0;
+}
+static int h(int i) {
+ if (i >= '0')
+ return i - '0';
+ //__builtin_unreachable ();
+}
+void __attribute__((noipa)) j(int i) {
+ for (b = 2; g() <= 7; b++)
+ if (i) {
+ for (; e <= 7; e++)
+ for (c = 1; c <= 7; c++) {
+ d = h(b + '0');
+ f[-d + 4] ^= 3;
+ }
+ return;
+ }
+}
+int main() {
+ j(1);
+ if (f[2] != 0)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr47917.c b/gcc/testsuite/gcc.dg/torture/pr47917.c
index 0b45e06..5724907 100644
--- a/gcc/testsuite/gcc.dg/torture/pr47917.c
+++ b/gcc/testsuite/gcc.dg/torture/pr47917.c
@@ -2,7 +2,6 @@
/* { dg-options "-std=c99" } */
/* { dg-options "-std=gnu99" { target *-*-hpux* } } */
/* { dg-additional-options "-D__USE_MINGW_ANSI_STDIO=1" { target *-*-mingw* } } */
-/* { dg-xfail-run-if "no C99 snprintf function" { *-*-hpux10* } } */
/* { dg-xfail-run-if "non-conforming C99 snprintf" { *-*-hpux11.[012]* } } */
/* PR middle-end/47917 */
diff --git a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c
index 594c3f3..1d64d9f 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof-2.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -fno-early-inlining -fdump-ipa-profile-optimized -fdump-tree-einline-optimized" } */
+/* { dg-options "-O2 -fno-early-inlining -fdump-ipa-profile-optimized -fdump-ipa-afdo-optimized" } */
volatile int one;
static int
add1 (int val)
@@ -31,5 +31,5 @@ main (void)
}
/* { dg-final-use-not-autofdo { scan-ipa-dump "Indirect call -> direct call.* add1 .will resolve by ipa-profile" "profile"} } */
/* { dg-final-use-not-autofdo { scan-ipa-dump "Indirect call -> direct call.* sub1 .will resolve by ipa-profile" "profile"} } */
-/* { dg-final-use-autofdo { scan-tree-dump "Inlining add1/1 into main/4." "einline"} } */
-/* { dg-final-use-autofdo { scan-tree-dump "Inlining sub1/2 into main/4." "einline"} } */
+/* { dg-final-use-autofdo { scan-ipa-dump "Inlining add1/1 into main/4." "afdo"} } */
+/* { dg-final-use-autofdo { scan-ipa-dump "Inlining sub1/2 into main/4." "afdo"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-34.c b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-34.c
new file mode 100644
index 0000000..41877e0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-34.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-Ofast -fdump-tree-vect-details" } */
+/* { dg-additional-options "-mavx2" { target { x86_64-*-* i?86-*-* } } } */
+
+float summul(int n, float *arg1, float *arg2)
+{
+ int i;
+ float res1 = 1.0;
+ for(i = 0; i < n; i++) {
+ if(arg2[i])
+ res1 *= arg1[i];
+ }
+ return res1;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! { avr-*-* pru-*-* riscv*-*-* } } } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-39.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-39.c
new file mode 100644
index 0000000..3ef7286
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-39.c
@@ -0,0 +1,16 @@
+/* PR/106533 */
+/* { dg-options "-O2 -fdump-tree-ldist-optimized" } */
+
+void bar (int *a, int * __restrict b)
+{
+ for (int k = 0; k < 10; k++)
+ {
+ for (int j = 0; j < 100000; ++j)
+ a[j] = b[j];
+ __builtin_printf ("Foo!");
+ }
+}
+
+/* The stmt with side-effects in the outer loop should not prevent
+ distribution of the inner loop of the loop nest. */
+/* { dg-final { scan-tree-dump "optimized: Loop . distributed: split to 0 loops and 1 library calls" "ldist" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-10.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-10.c
new file mode 100644
index 0000000..c9322a1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-10.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-optimized" } */
+
+#include <stdint.h>
+
+__attribute__ ((noipa, noinline))
+uint8_t three_max (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ xc=~xc;
+ xm=~xm;
+ xy=~xy;
+ if (xc > xm) {
+ xk = (uint8_t) (xc > xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm > xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_max (xc, xm, xy) != 255)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 2 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "= ~" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-11.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-11.c
new file mode 100644
index 0000000..b1da417
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-11.c
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-optimized" } */
+
+#include <stdint.h>
+
+
+__attribute__ ((noipa, noinline))
+uint8_t three_minmax1 (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ xc=~xc;
+ xm=~xm;
+ xy=~xy;
+ if (xc > xm) {
+ xk = (uint8_t) (xc < xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm < xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_minmax1 (xc, xm, xy) != 0)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "= ~" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-12.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-12.c
new file mode 100644
index 0000000..cb9188f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-12.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-phiopt" } */
+
+#include <stdint.h>
+
+__attribute__ ((noinline, noipa))
+uint8_t three_minmax3 (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ xc=~xc;
+ xm=~xm;
+ xy=~xy;
+ if (xc > xm) {
+ xk = (uint8_t) (xy < xc ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm < xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_minmax3 (xc, xm, xy) != 0)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 1 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 1 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-13.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-13.c
new file mode 100644
index 0000000..62ba71e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-13.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-phiopt" } */
+
+#include <stdint.h>
+
+__attribute__ ((noipa, noinline))
+uint8_t three_minmax2 (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ xc=~xc;
+ xm=~xm;
+ xy=~xy;
+ if (xc > xm) {
+ xk = (uint8_t) (xc > xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm < xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 127;
+ volatile uint8_t xc = 0;
+ if (three_minmax2 (xc, xm, xy) != 255)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 1 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 1 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-14.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-14.c
new file mode 100644
index 0000000..a3ec584
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-14.c
@@ -0,0 +1,33 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-optimized" } */
+
+#include <stdint.h>
+
+__attribute__ ((noipa, noinline))
+uint8_t three_minmax11 (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ xc=~xc;
+ xm=~xm;
+ xy=~xy;
+ if (xc < xm) {
+ xk = (uint8_t) (xc > xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm > xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_minmax11 (xc, xm, xy) != 128)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "= ~" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-15.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-15.c
new file mode 100644
index 0000000..8a39871
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-15.c
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-phiopt" } */
+
+#include <stdint.h>
+#include <stdbool.h>
+
+__attribute__ ((noinline, noipa))
+uint8_t three_min (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ if (xc)
+ {
+ if (xc < xm) {
+ xk = (uint8_t) (xc < xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm < xy ? xm : xy);
+ }
+ }
+
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_min (xc, xm, xy) != 0)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 3 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 0 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-16.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-16.c
new file mode 100644
index 0000000..4febd09
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-16.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-phiopt -g" } */
+
+#include <stdint.h>
+
+__attribute__ ((noipa, noinline))
+uint8_t three_min (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ if (xc < xm) {
+ xk = (uint8_t) (xc < xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm < xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_min (xc, xm, xy) != 0)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 3 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 0 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-3.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-3.c
new file mode 100644
index 0000000..2af1077
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-3.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-phiopt" } */
+
+#include <stdint.h>
+
+__attribute__ ((noipa, noinline))
+uint8_t three_min (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ if (xc < xm) {
+ xk = (uint8_t) (xc < xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm < xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_min (xc, xm, xy) != 0)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 3 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 0 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-4.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-4.c
new file mode 100644
index 0000000..973f39b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-4.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-phiopt" } */
+
+#include <stdint.h>
+
+__attribute__ ((noipa, noinline))
+uint8_t three_max (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ if (xc > xm) {
+ xk = (uint8_t) (xc > xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm > xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_max (xc, xm, xy) != 255)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 0 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 3 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-5.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-5.c
new file mode 100644
index 0000000..34e4e72
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-5.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-phiopt" } */
+
+#include <stdint.h>
+
+__attribute__ ((noipa, noinline))
+uint8_t three_minmax1 (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ if (xc > xm) {
+ xk = (uint8_t) (xc < xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm < xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_minmax1 (xc, xm, xy) != 127)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 2 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 1 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-6.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-6.c
new file mode 100644
index 0000000..443d68f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-6.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-phiopt" } */
+
+#include <stdint.h>
+
+__attribute__ ((noipa, noinline))
+uint8_t three_minmax3 (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ if (xc > xm) {
+ xk = (uint8_t) (xy < xc ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm < xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_minmax3 (xc, xm, xy) != 255)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 1 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 1 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-7.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-7.c
new file mode 100644
index 0000000..7e2a3f0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-7.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-phiopt" } */
+
+#include <stdint.h>
+
+__attribute__ ((noipa, noinline))
+uint8_t three_minmax2 (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ if (xc > xm) {
+ xk = (uint8_t) (xc > xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm < xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_minmax2 (xc, xm, xy) != 255)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 1 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 1 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-8.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-8.c
new file mode 100644
index 0000000..0160e57
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-8.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-phiopt" } */
+
+#include <stdint.h>
+
+__attribute__ ((noinline, noipa))
+uint8_t three_minmax11 (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ if (xc < xm) {
+ xk = (uint8_t) (xc > xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm > xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_minmax11 (xc, xm, xy) != 255)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 1 "phiopt1" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 2 "phiopt1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-9.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-9.c
new file mode 100644
index 0000000..0cfb658
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-9.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-optimized" } */
+
+#include <stdint.h>
+
+__attribute__ ((noipa, noinline))
+uint8_t three_min (uint8_t xc, uint8_t xm, uint8_t xy) {
+ uint8_t xk;
+ xc=~xc;
+ xm=~xm;
+ xy=~xy;
+ if (xc < xm) {
+ xk = (uint8_t) (xc < xy ? xc : xy);
+ } else {
+ xk = (uint8_t) (xm < xy ? xm : xy);
+ }
+ return xk;
+}
+
+int
+main (void)
+{
+ volatile uint8_t xy = 255;
+ volatile uint8_t xm = 0;
+ volatile uint8_t xc = 127;
+ if (three_min (xc, xm, xy) != 0)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "= ~" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 2 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr106819.c b/gcc/testsuite/gcc.dg/tree-ssa/pr106819.c
new file mode 100644
index 0000000..1272d4b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr106819.c
@@ -0,0 +1,24 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdump-tree-evrp-details" }
+
+static int isNaN(double x)
+{
+ return x != x;
+}
+
+static double opCmpProper(int lhs, double rhs)
+{
+ return lhs < rhs ? -1.0
+ : lhs > rhs ? 1.0
+ : lhs == rhs ? 0.0
+ : __builtin_nan("");
+}
+
+int main()
+{
+ if (!isNaN(opCmpProper(41, __builtin_nan(""))))
+ __builtin_abort();
+ return 0;
+}
+
+// { dg-final {scan-tree-dump-not "Folds to: 0.0" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr106867.c b/gcc/testsuite/gcc.dg/tree-ssa/pr106867.c
new file mode 100644
index 0000000..68773d9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr106867.c
@@ -0,0 +1,16 @@
+// { dg-do compile }
+// { dg-options "-O2 -fno-tree-fre" }
+
+double m;
+int n;
+
+void
+foo (void)
+{
+ static double a[] = { 0.0 / 0.0, 0.0 };
+ int i;
+
+ for (i = 0; i < n; ++i)
+ if (m >= a[i])
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr106967.c b/gcc/testsuite/gcc.dg/tree-ssa/pr106967.c
new file mode 100644
index 0000000..bff2795
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr106967.c
@@ -0,0 +1,16 @@
+// { dg-do compile }
+// { dg-options "-O2 -ffinite-math-only -fno-trapping-math -fno-tree-dominator-opts" }
+
+void
+foo (float x, int *y)
+{
+ int i;
+ float sum2 = 0.0;
+
+ for (i = 0; i < *y; ++i)
+ sum2 += x;
+
+ sum2 = 1.0 / sum2;
+ if (sum2 * 0.0 < 5.E-5)
+ *y = 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr106970.c b/gcc/testsuite/gcc.dg/tree-ssa/pr106970.c
new file mode 100644
index 0000000..cda9bd4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr106970.c
@@ -0,0 +1,9 @@
+// { dg-do compile }
+// { dg-options "-O1 -fno-signed-zeros" }
+
+void
+foo (double x, double y)
+{
+ if (!x == !y * -1.0)
+ __builtin_trap ();
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/recip-3.c b/gcc/testsuite/gcc.dg/tree-ssa/recip-3.c
index 410b280..036f32a 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/recip-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/recip-3.c
@@ -1,6 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-O1 -fno-trapping-math -funsafe-math-optimizations -fdump-tree-recip" } */
+/* The recip pass has a threshold of 3 reciprocal operations before it attempts
+ to optimize a sequence. With a FP enabled ranger, we eliminate one of them
+ earlier, causing the pass to skip this optimization. */
+/* { dg-additional-options "-fno-thread-jumps -fno-tree-dominator-opts" } */
+
double F[5] = { 0.0, 0.0 }, e;
/* In this case the optimization is interesting. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/split-path-1.c b/gcc/testsuite/gcc.dg/tree-ssa/split-path-1.c
index 8b23ef4..902dde4 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/split-path-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/split-path-1.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-O2 -fsplit-paths -fdump-tree-split-paths-details --param max-jump-thread-duplication-stmts=20" } */
+/* { dg-options "-O2 -fsplit-paths -fdump-tree-split-paths-details --param max-jump-thread-duplication-stmts=20 -fno-ssa-phiopt" } */
#include <stdio.h>
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
index aa06db5..47b8fdf 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
@@ -11,7 +11,7 @@
to change decisions in switch expansion which in turn can expose new
jump threading opportunities. Skip the later tests on aarch64. */
/* { dg-final { scan-tree-dump-not "Jumps threaded" "dom3" { target { ! aarch64*-*-* } } } } */
-/* { dg-final { scan-tree-dump "Jumps threaded: 8" "thread2" { target { ! aarch64*-*-* } } } } */
+/* { dg-final { scan-tree-dump "Jumps threaded: 9" "thread2" { target { ! aarch64*-*-* } } } } */
/* { dg-final { scan-tree-dump "Jumps threaded: 18" "thread2" { target { aarch64*-*-* } } } } */
enum STATE {
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-100.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-100.c
new file mode 100644
index 0000000..ead7654
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-100.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-fre1" } */
+
+float bar, baz;
+void foo (int *p, int n)
+{
+ *p = 0;
+ do
+ {
+ bar = 1.;
+ /* When iterating we should have optimistically value-numbered
+ *p to zero, on the second iteration we have to prove the
+ store below does not affect the value of this load though.
+ We can compare the stored value against the value from the
+ previous iteration instead relying on a non-walking lookup. */
+ if (*p)
+ {
+ baz = 2.;
+ *p = 0;
+ }
+ }
+ while (--n);
+}
+
+/* { dg-final { scan-tree-dump-not "baz" "fre1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-16.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-16.c
new file mode 100644
index 0000000..f96170b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-16.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-threadfull1-details" } */
+
+int res;
+void foo (int a, int b, int c, int d, int e)
+{
+ if (a > 100)
+ res = 3;
+ if (b != 5)
+ res = 5;
+ if (c == 29)
+ res = 7;
+ if (d < 2)
+ res = 9;
+ /* Accounting whoes makes this not catched. */
+#if 0
+ if (e != 37)
+ res = 11;
+#endif
+ if (a < 10)
+ res = 13;
+}
+
+/* { dg-final { scan-tree-dump "SUCCESS" "threadfull1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-17.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-17.c
new file mode 100644
index 0000000..94ee666
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-17.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-threadfull1-details --param max-jump-thread-paths=15" } */
+
+#include "ssa-thread-16.c"
+
+/* With limiting the search space we should no longer consider this path. */
+/* { dg-final { scan-tree-dump-not "SUCCESS" "threadfull1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-18.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-18.c
new file mode 100644
index 0000000..a899f4f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-18.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-threadfull1-stats" } */
+
+void foo (int nest, int print_nest)
+{
+ _Bool t0 = nest != 0;
+ _Bool t1 = nest == print_nest;
+ _Bool t2 = t0 & t1;
+ if (t2)
+ __builtin_puts ("x");
+ nest++;
+ if (nest > 2)
+ __builtin_abort ();
+ if (print_nest == nest)
+ __builtin_puts ("y");
+}
+
+/* We should be able to thread (t2) to !(print_nest == nest) using the
+ nest == print_nest relation implied by the entry block. */
+/* { dg-final { scan-tree-dump "Jumps threaded: 1" "threadfull1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-19.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-19.c
new file mode 100644
index 0000000..62912f3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-19.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-threadfull1-stats" } */
+
+struct S;
+struct S { struct S *next; };
+int foo (struct S *chain, _Bool is_ctor, _Bool is_dtor)
+{
+ int num_args = 0;
+ if (chain) /* A */
+ {
+ do {
+ num_args++;
+ chain = chain->next;
+ if (!chain)
+ break;
+ } while (1);
+ }
+ if (is_ctor)
+ num_args++; /* B */
+ if (is_dtor)
+ num_args++;
+ else
+ {
+ if (num_args > 2) /* C */
+ __builtin_puts ("x");
+ }
+ return num_args;
+}
+
+/* We want to thread both paths from A with NULL chain to C, the one through
+ B and one around it.
+ ??? Ideally we'd thread one "path" containing the half-diamond with B. */
+/* { dg-final { scan-tree-dump "Jumps threaded: 2" "threadfull1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-20.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-20.c
new file mode 100644
index 0000000..c652965
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-20.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-ethread-stats" } */
+
+struct S { int base; };
+void foo (struct S *p)
+{
+ if (p)
+ {
+ int *q = &p->base;
+ if (q)
+ __builtin_puts ("x");
+ }
+}
+
+/* { dg-final { scan-tree-dump "Jumps threaded: 1" "ethread" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-1.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-1.c
new file mode 100644
index 0000000..5be5426
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-1.c
@@ -0,0 +1,19 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdisable-tree-ethread -fdisable-tree-fre1 -fdump-tree-evrp-details" }
+
+void bar ();
+void george ();
+
+float
+foo (float x, float y)
+{
+ if (x == x)
+ {
+ if (x > y)
+ bar();
+ if (x == x)
+ george();
+ }
+}
+
+// { dg-final { scan-tree-dump-times "Folded into: if \\(1 != 0\\)" 1 "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-11.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-11.c
new file mode 100644
index 0000000..2f4dc87
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-11.c
@@ -0,0 +1,26 @@
+// { dg-do compile }
+// { dg-options "-O2 -fno-thread-jumps -fdump-tree-evrp" }
+
+extern void link_error ();
+
+void fast_sqrt (float);
+
+float test (float x)
+{
+ float y = x*x;
+ if (y >= 0.f)
+ {
+ if (__builtin_isnan (y))
+ link_error ();
+ else
+ fast_sqrt (y);
+
+ if (!__builtin_isnan (y))
+ fast_sqrt (y);
+ else
+ link_error ();
+ }
+}
+
+// { dg-final { scan-tree-dump-times "fast_sqrt" 2 "evrp" } }
+// { dg-final { scan-tree-dump-not "link_error" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-3.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-3.c
new file mode 100644
index 0000000..c659abb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-3.c
@@ -0,0 +1,18 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdisable-tree-ethread -fdump-tree-evrp" }
+
+void link_error ();
+
+void
+foo (double x, double y)
+{
+ if (x == y)
+ {
+ if (__builtin_isnan (x))
+ link_error ();
+ if (__builtin_isnan (y))
+ link_error ();
+ }
+}
+
+// { dg-final { scan-tree-dump-not "link_error" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-4.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-4.c
new file mode 100644
index 0000000..8643674
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-4.c
@@ -0,0 +1,16 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdisable-tree-ethread -fdump-tree-evrp" }
+
+void link_error ();
+
+void
+foo (double x, double y)
+{
+ if (x > y)
+ {
+ if (__builtin_isnan (x) || __builtin_isnan (y))
+ link_error ();
+ }
+}
+
+// { dg-final { scan-tree-dump-not "link_error" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-6.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-6.c
new file mode 100644
index 0000000..145d186
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-6.c
@@ -0,0 +1,20 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdisable-tree-ethread -fdump-tree-evrp" }
+
+void bar ();
+
+void
+foo (double x, double y)
+{
+ if (x > y)
+ ;
+ else if (!__builtin_isnan (x) && !__builtin_isnan (y))
+ {
+ // If x and y are not NAN, the x <= y relationship holds, and the
+ // following conditional can be folded away.
+ if (x <= y)
+ bar ();
+ }
+}
+
+// { dg-final { scan-tree-dump-times "Folding predicate x_.* <= y_.* to 1" 1 "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-7.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-7.c
new file mode 100644
index 0000000..92af870
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-7.c
@@ -0,0 +1,14 @@
+// { dg-do compile }
+// { dg-options "-O2 -fno-tree-forwprop -fno-tree-ccp -fno-tree-fre -fdump-tree-evrp" }
+
+extern void link_error ();
+
+void
+foo ()
+{
+ float z = 0.0;
+ if (__builtin_isnan (z))
+ link_error ();
+}
+
+// { dg-final { scan-tree-dump-not "link_error" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-8.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-8.c
new file mode 100644
index 0000000..9170150
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-8.c
@@ -0,0 +1,26 @@
+// { dg-do compile }
+// { dg-options "-O2 -fno-thread-jumps -fdump-tree-evrp" }
+
+extern void link_error ();
+
+void fast_sqrt (float);
+
+float test (float x)
+{
+ float y = x*x;
+ if (y >= 0.f)
+ {
+ if (__builtin_isnan (y))
+ link_error ();
+ else
+ fast_sqrt (y);
+
+ if (!__builtin_isnan (y))
+ fast_sqrt (y);
+ else
+ link_error ();
+ }
+}
+
+// { dg-final { scan-tree-dump-times "fast_sqrt" 2 "evrp" } }
+// { dg-final { scan-tree-dump-not "link_error" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-inf-1.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-inf-1.c
new file mode 100644
index 0000000..1d21cce4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-inf-1.c
@@ -0,0 +1,15 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdump-tree-evrp-details" }
+
+void foo ();
+void bar (double);
+
+void funky(double f, double g)
+{
+ if (f <= __builtin_inf ())
+ foo ();
+ else
+ bar (f);
+}
+
+// { dg-final { scan-tree-dump-not " Inf, Inf" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-nan-1.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-nan-1.c
new file mode 100644
index 0000000..126949b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-nan-1.c
@@ -0,0 +1,18 @@
+// { dg-do compile }
+// { dg-options "-O2 -ffinite-math-only -fdump-tree-evrp" }
+
+void bar(float);
+
+void funk(int cond)
+{
+ float x;
+
+ if (cond)
+ x = __builtin_nan ("");
+ else
+ x = 1.24;
+
+ bar(x);
+}
+
+// { dg-final { scan-tree-dump-times "bar \\(1.24" 1 "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-signbit-1.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-signbit-1.c
new file mode 100644
index 0000000..3fa783e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-signbit-1.c
@@ -0,0 +1,12 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdump-tree-evrp" }
+
+int num;
+
+void func(float x)
+{
+ if (x > 5.0)
+ num = __builtin_signbit (x);
+}
+
+// { dg-final { scan-tree-dump-times "num = 0;" 1 "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-signbit-2.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-signbit-2.c
new file mode 100644
index 0000000..954c7eb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-signbit-2.c
@@ -0,0 +1,24 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdump-tree-evrp" }
+
+// Test that the only thing we know about the signbit about negative number is
+// that it's not 0.
+
+void link_error ();
+
+int num;
+
+void func(float x)
+{
+ if (x < -5.0)
+ {
+ num = __builtin_signbit (x);
+
+ // We may not know the exact signbit, but we know it's not 0.
+ if (!__builtin_signbit (x))
+ link_error ();
+ }
+}
+
+// { dg-final { scan-tree-dump-not "num = \[-0-9\];" "evrp" } }
+// { dg-final { scan-tree-dump-not "link_error" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/tsan/pr106984.c b/gcc/testsuite/gcc.dg/tsan/pr106984.c
new file mode 100644
index 0000000..69cf83d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tsan/pr106984.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=thread" } */
+
+int svcsw (int *ptr, int oldval, int newval)
+{
+ return __sync_val_compare_and_swap (ptr, oldval, newval);
+}
diff --git a/gcc/testsuite/gcc.dg/ubsan/c-shift-1.c b/gcc/testsuite/gcc.dg/ubsan/c-shift-1.c
index 9d56101..f88ee2d 100644
--- a/gcc/testsuite/gcc.dg/ubsan/c-shift-1.c
+++ b/gcc/testsuite/gcc.dg/ubsan/c-shift-1.c
@@ -7,12 +7,12 @@ int
main (void)
{
/* None of the following should pass. */
- int A[1 >> -1] = {}; /* { dg-error "variable-sized object may not be initialized" } */
- int B[-1 >> -1] = {}; /* { dg-error "variable-sized object may not be initialized" } */
- int D[1 << -1] = {}; /* { dg-error "variable-sized object may not be initialized" } */
- int E[-1 << -1] = {}; /* { dg-error "variable-sized object may not be initialized" } */
- int F[-1 >> 200] = {}; /* { dg-error "variable-sized object may not be initialized" } */
- int G[1 << 200] = {}; /* { dg-error "variable-sized object may not be initialized" } */
+ int A[1 >> -1] = { 0 }; /* { dg-error "variable-sized object may not be initialized" } */
+ int B[-1 >> -1] = { 0 }; /* { dg-error "variable-sized object may not be initialized" } */
+ int D[1 << -1] = { 0 }; /* { dg-error "variable-sized object may not be initialized" } */
+ int E[-1 << -1] = { 0 }; /* { dg-error "variable-sized object may not be initialized" } */
+ int F[-1 >> 200] = { 0 }; /* { dg-error "variable-sized object may not be initialized" } */
+ int G[1 << 200] = { 0 }; /* { dg-error "variable-sized object may not be initialized" } */
return 0;
}
diff --git a/gcc/testsuite/gcc.dg/ubsan/pr106099.c b/gcc/testsuite/gcc.dg/ubsan/pr106099.c
new file mode 100644
index 0000000..e3f17b3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ubsan/pr106099.c
@@ -0,0 +1,10 @@
+/* PR tree-optimization/106099 */
+/* { dg-do compile } */
+/* { dg-options "-O -fsanitize=unreachable -fsanitize-undefined-trap-on-error -fno-tree-ccp -fno-tree-dominator-opts" } */
+
+void
+foo (void)
+{
+ for (unsigned i = 0; i == 0; i++)
+ ;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr106155-1.c b/gcc/testsuite/gcc.dg/uninit-pr106155-1.c
new file mode 100644
index 0000000..5c4410d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr106155-1.c
@@ -0,0 +1,40 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fno-ivopts -Wuninitialized" } */
+
+int *e;
+int f1 (void);
+void f2 (int);
+long f3 (void *, long, int *);
+void f4 (void *);
+int *fh;
+
+void tst (void)
+{
+ int status;
+ unsigned char badData[3][3] = { { 7 }, { 16 }, { 23 } };
+ int badDataSize[3] = { 1, 1, 1 };
+ int i;
+
+ for (i = 0; i < 3; i++)
+ {
+ int emax;
+ if (i == 2)
+ emax = f1 ();
+ status = f3 (&badData[i][0], badDataSize[i], fh);
+ if (status)
+ {
+ f1 ();
+ f1 ();
+ f1 ();
+ }
+ f4 (fh);
+ *e = 0;
+ f1 ();
+ /* When threading the following out of the loop uninit
+ analysis needs to pick up the loop exit condition
+ to match up with this guard.
+ ??? This doesn't work reliably when IVOPTs is run. */
+ if (i == 2)
+ f2 (emax); /* { dg-bogus "uninitialized" } */
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr106866.c b/gcc/testsuite/gcc.dg/uninit-pr106866.c
new file mode 100644
index 0000000..530e274
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr106866.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fno-ipa-pure-const -Wuninitialized" } */
+
+int n;
+
+void
+empty (int)
+{
+}
+
+int
+bar (int x)
+{
+ return n + x + 1;
+}
+
+__attribute__ ((pure, returns_twice)) int
+foo (void)
+{
+ int uninitialized;
+
+ if (n)
+ {
+ if (bar (0))
+ return 0;
+
+ __builtin_unreachable ();
+ }
+
+ while (uninitialized < 1) /* { dg-warning "uninitialized" } */
+ {
+ foo ();
+ empty (bar (0) == foo ());
+ ++uninitialized;
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr106881.c b/gcc/testsuite/gcc.dg/uninit-pr106881.c
new file mode 100644
index 0000000..343b13e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr106881.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fexceptions -Wuninitialized" } */
+
+void l_free (void *);
+char *l_settings_get_string ();
+void eap_append_secret ();
+inline void auto_free(void *a) {
+ void **p = a;
+ l_free(*p); /* { dg-warning "uninitialized" } */
+}
+void eap_gtc_check_settings() {
+ char *identity __attribute__((cleanup(auto_free)));
+ char password __attribute__((cleanup(auto_free)));
+ identity = l_settings_get_string();
+ eap_append_secret();
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr63660.c b/gcc/testsuite/gcc.dg/uninit-pr63660.c
new file mode 100644
index 0000000..eab7c74
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr63660.c
@@ -0,0 +1,58 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized" } */
+
+typedef struct
+{
+ int a;
+ int b;
+ int c;
+ int d;
+ int e;
+ int f;
+ int g;
+ int h;
+ int i;
+ int j;
+} X;
+
+X *XX(int);
+
+int G();
+
+static void F()
+{
+ X *x;
+ int m, n;
+ int xa, xb, xc, xd, xe, xf, xg, xh, xi, xj;
+
+ m = G();
+ n = G();
+ if ( n & 1 ) xa = G();
+ if ( n & 2 ) xb = G();
+ if ( n & 4 ) xc = G();
+ if ( n & 32 ) xd = G();
+ if ( n & 16 ) xe = G();
+ if ( n & 64 ) xf = G();
+ if ( n & 256 ) xg = G();
+ if ( n & 512 ) xh = G();
+ if ( n & 1024 ) xi = G();
+ if ( n & 2048 ) xj = G();
+
+ if ( m >= 64 ) return;
+ x = XX(m);
+ if ( n & 1 ) x->a = xa;
+ if ( n & 2 ) x->b = xb;
+ if ( n & 4 ) x->c = xc;
+ if ( n & 32 ) x->d = xd;
+ if ( n & 16 ) x->e = xe;
+ if ( n & 64 ) x->f = xf;
+ if ( n & 256 ) x->g = xg;
+ if ( n & 512 ) x->h = xh;
+ if ( n & 1024 ) x->i = xi;
+ if ( n & 2048 ) x->j = xj; /* { dg-bogus "uninitialized" } */
+}
+
+void H()
+{
+ F();
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr65244-1.c b/gcc/testsuite/gcc.dg/uninit-pr65244-1.c
new file mode 100644
index 0000000..7c1d910
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr65244-1.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized" } */
+
+extern void __attribute__((noreturn)) abort (void);
+
+int foo (int flag, int val)
+{
+ int tem;
+ if (flag)
+ {
+ if (val == 0)
+ abort ();
+ tem = val;
+ }
+ /* large - prevent jump threading */
+ __asm__ volatile ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
+ if (flag)
+ return tem; /* { dg-bogus "uninitialized" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr65244-2.c b/gcc/testsuite/gcc.dg/uninit-pr65244-2.c
new file mode 100644
index 0000000..a28893c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr65244-2.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-Og -Wuninitialized -ftree-bit-ccp -fno-thread-jumps -fdump-tree-uninit2" } */
+
+void exit(int __status) __attribute__ ((__noreturn__));
+int posix_memalign(void **__memptr, __SIZE_TYPE__ __alignment,
+ __SIZE_TYPE__ __size);
+
+void *f(void)
+{
+ void *ptr;
+
+ if (posix_memalign(&ptr, 16, 256) != 0)
+ exit(1);
+
+ return ptr; /* { dg-bogus "uninitialized" } */
+}
+
+/* Make sure the uninit pass has something to do, add to the set of
+ disabled optimizations if not. */
+/* { dg-final { scan-tree-dump "# ptr_. = PHI" "uninit2" } } */
diff --git a/gcc/testsuite/gcc.dg/uninit-pred-10.c b/gcc/testsuite/gcc.dg/uninit-pred-10.c
new file mode 100644
index 0000000..468b4d3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pred-10.c
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wuninitialized" } */
+
+enum demangle_component_type {
+ DEMANGLE_COMPONENT_NAME,
+ DEMANGLE_COMPONENT_REFERENCE
+};
+struct demangle_component {
+ enum demangle_component_type type;
+} d_print_comp_inner_mod_inner, *d_print_comp_inner_dc;
+struct d_print_mod {
+ struct d_print_mod *next;
+};
+struct d_print_info {
+ int templates;
+ struct d_print_mod *modifiers;
+};
+void d_print_comp_inner(struct d_print_info *dpi)
+{
+ int saved_templates, need_template_restore = 0;
+ switch (d_print_comp_inner_dc->type) {
+ case DEMANGLE_COMPONENT_NAME:
+ goto modifier;
+ case DEMANGLE_COMPONENT_REFERENCE:
+ saved_templates = dpi->templates;
+ need_template_restore = 1;
+ modifier:
+ struct d_print_mod dpm;
+ dpm.next = dpi->modifiers;
+ d_print_comp_inner_mod_inner = *d_print_comp_inner_dc;
+ d_print_comp_inner(dpi);
+ dpi->modifiers = dpm.next;
+ if (need_template_restore)
+ dpi->templates = saved_templates; /* { dg-bogus "uninitialized" } */
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pred-11.c b/gcc/testsuite/gcc.dg/uninit-pred-11.c
new file mode 100644
index 0000000..734df37
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pred-11.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wmaybe-uninitialized" } */
+
+extern unsigned bar (void);
+extern void quux (void);
+int z;
+unsigned foo (unsigned v, int y)
+{
+ unsigned u;
+ if (v != 1)
+ u = bar ();
+
+ // Prevent the "dom" pass from changing the CFG layout based on the inference
+ // 'if (v != 1) is false then (v != 2) is true'. (Now it would have to
+ // duplicate the loop in order to do so, which is deemed expensive.)
+ for (int i = 0; i < 10; i++)
+ quux ();
+
+ // This variation from uninit-25.c causes compute_control_dep_chain
+ // to run into a defect but simple_control_dep_chain saves us here
+ if (y)
+ z = 1;
+ if (v != 1)
+ return u; /* { dg-bogus "may be used uninitialized" } */
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-pred-12.c b/gcc/testsuite/gcc.dg/uninit-pred-12.c
new file mode 100644
index 0000000..4c66486
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pred-12.c
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wmaybe-uninitialized -fdump-tree-uninit1" } */
+
+extern unsigned bar (void);
+extern void quux (void);
+int z;
+unsigned foo (unsigned v, int y, int w)
+{
+ unsigned u;
+ if (v != 1)
+ u = bar ();
+
+ // Prevent the "dom" pass from changing the CFG layout based on the inference
+ // 'if (v != 1) is false then (v != 2) is true'. (Now it would have to
+ // duplicate the loop in order to do so, which is deemed expensive.)
+ for (int i = 0; i < 10; i++)
+ quux ();
+
+ // This variantion from uninit-pred-11.c caused compute_control_dep_chain
+ // to run into a defect, producing z != 0 && v != 1, omitting !(i<10)
+ // from the path predicate
+ if (w)
+ {
+ if (y)
+ z = 1;
+ if (v != 1)
+ return u; /* { dg-bogus "may be used uninitialized" } */
+ }
+
+ return 0;
+}
+
+/* Make sure predicate analysis picked up the loop exit condition. */
+/* { dg-final { scan-tree-dump "AND \\(NOT \\((ivtmp|doloop)" "uninit1" } } */
diff --git a/gcc/testsuite/gcc.dg/uninit-pred-7_a.c b/gcc/testsuite/gcc.dg/uninit-pred-7_a.c
index 434d90a..c2ba2a4 100644
--- a/gcc/testsuite/gcc.dg/uninit-pred-7_a.c
+++ b/gcc/testsuite/gcc.dg/uninit-pred-7_a.c
@@ -23,7 +23,7 @@ int foo (int n, int l, int m, int r)
blah(v); /* { dg-bogus "uninitialized" "bogus warning" } */
if ( l )
- blah(v); /* { dg-bogus "uninitialized" "bogus warning" { xfail *-*-* } } */
+ blah(v); /* { dg-bogus "uninitialized" "bogus warning" } */
return 0;
}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-layout-1.c b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-1.c
new file mode 100644
index 0000000..c1d4ba3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-1.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+int a[4], b[4], c[4], d[4];
+
+void f1()
+{
+ a[0] = (b[1] << c[3]) - d[1];
+ a[1] = (b[0] << c[2]) - d[0];
+ a[2] = (b[3] << c[1]) - d[3];
+ a[3] = (b[2] << c[0]) - d[2];
+}
+
+/* { dg-final { scan-tree-dump-times "add new stmt: \[^\\n\\r\]* = VEC_PERM_EXPR" 3 "slp2" { target { vect_var_shift && vect_perm } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-layout-10.c b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-10.c
new file mode 100644
index 0000000..e2c86f3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-10.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Os -fno-tree-loop-vectorize" } */
+
+#include "bb-slp-layout-9.c"
+
+/* { dg-final { scan-tree-dump-times "add new stmt: \[^\\n\\r\]* = VEC_PERM_EXPR" 1 "slp1" { target { vect_int && { vect_perm && vect_hw_misalign } } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-layout-11.c b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-11.c
new file mode 100644
index 0000000..d9b5349
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-11.c
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fno-tree-loop-vectorize" } */
+
+int a[4], b[4], c[400], d[400];
+
+void f1()
+{
+ int a0 = a[0] - b[0];
+ int a1 = a[1] + b[1];
+ int a2 = a[2] - b[2];
+ int a3 = a[3] + b[3];
+ int b0 = a0;
+ int b1 = a1;
+ int b2 = a2;
+ int b3 = a3;
+ for (int i = 0; i < 100; ++i)
+ {
+ a0 += c[i * 4 + 1];
+ a1 += c[i * 4 + 0];
+ a2 += c[i * 4 + 3];
+ a3 += c[i * 4 + 2];
+ b0 ^= d[i * 4 + 3];
+ b1 ^= d[i * 4 + 2];
+ b2 ^= d[i * 4 + 1];
+ b3 ^= d[i * 4 + 0];
+ }
+ a[0] = a0 ^ b0;
+ a[1] = a1 ^ b1;
+ a[2] = a2 ^ b2;
+ a[3] = a3 ^ b3;
+}
+
+/* { dg-final { scan-tree-dump-times "add new stmt: \[^\\n\\r\]* = VEC_PERM_EXPR" 4 "slp1" { target { vect_int && vect_perm } } } } */
+/* { dg-final { scan-tree-dump "duplicating permutation node" "slp1" { target { vect_int && vect_perm } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-layout-12.c b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-12.c
new file mode 100644
index 0000000..3bf48af
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-12.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Os -fno-tree-loop-vectorize" } */
+
+#include "bb-slp-layout-11.c"
+
+/* It would be better to keep the original three permutations. */
+/* { dg-final { scan-tree-dump-times "add new stmt: \[^\\n\\r\]* = VEC_PERM_EXPR" 3 "slp1" { target { vect_int && { vect_perm && vect_hw_misalign } } xfail { *-*-* } } } } */
+/* { dg-final { scan-tree-dump-not "duplicating permutation node" "slp1" { target { vect_int && { vect_perm && vect_hw_misalign } } xfail { *-*-* } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-layout-13.c b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-13.c
new file mode 100644
index 0000000..9669ade
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-13.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+int a[4], b[4], c[4], d[4];
+
+void f1()
+{
+ a[0] = (b[1] << c[3]) - (d[1] >> c[3]);
+ a[1] = (b[0] << c[2]) - (d[0] >> c[2]);
+ a[2] = (b[3] << c[1]) - (d[3] >> c[1]);
+ a[3] = (b[2] << c[0]) - (d[2] >> c[0]);
+}
+
+/* { dg-final { scan-tree-dump-times "add new stmt: \[^\\n\\r\]* = VEC_PERM_EXPR" 3 "slp2" { target { vect_var_shift && vect_perm } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-layout-14.c b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-14.c
new file mode 100644
index 0000000..159bb15
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-14.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Os" } */
+
+#include "bb-slp-layout-13.c"
+
+/* { dg-final { scan-tree-dump-times "add new stmt: \[^\\n\\r\]* = VEC_PERM_EXPR" 2 "slp2" { target { vect_var_shift && { vect_perm && vect_hw_misalign } } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-layout-15.c b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-15.c
new file mode 100644
index 0000000..d87fc1e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-15.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+int a[4], b[4], c[4], d[4];
+
+void f1()
+{
+ a[0] = (b[3] << c[3]) - d[0];
+ a[1] = (b[2] << c[2]) - d[2];
+ a[2] = (b[1] << c[1]) - d[4];
+ a[3] = (b[0] << c[0]) - d[6];
+}
+
+/* { dg-final { scan-tree-dump-times "add new stmt: \[^\\n\\r\]* = VEC_PERM_EXPR" 1 "slp2" { target { vect_var_shift && vect_perm } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-layout-16.c b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-16.c
new file mode 100644
index 0000000..559583a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-16.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Os" } */
+
+#include "bb-slp-layout-15.c"
+
+/* { dg-final { scan-tree-dump-times "add new stmt: \[^\\n\\r\]* = VEC_PERM_EXPR" 1 "slp2" { target { vect_var_shift && { vect_perm && vect_hw_misalign } } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-layout-17.c b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-17.c
new file mode 100644
index 0000000..f64a2d9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-17.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+
+int a[8], b[8];
+
+int f1()
+{
+ a[0] = b[4] + 1;
+ a[1] = b[5] + 1;
+ a[2] = b[6] + 1;
+ a[3] = b[7] + 1;
+ a[4] = b[0] + 1;
+ a[5] = b[1] + 1;
+ a[6] = b[2] + 1;
+ a[7] = b[3] + 1;
+}
+
+unsigned short c[2], d[2];
+void f2() {
+ c[0] += d[1];
+ c[1] += d[0];
+}
+
+typedef int v4si __attribute__((vector_size(16)));
+void f3(v4si x) {
+ a[0] = b[1] + x[1];
+ a[1] = b[0] + x[3];
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-layout-18.c b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-18.c
new file mode 100644
index 0000000..ff46272
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-18.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_float} */
+/* { dg-additional-options "-w -Wno-psabi -ffast-math" } */
+
+typedef float v4sf __attribute__((vector_size(sizeof(float)*4)));
+
+float __attribute__((noipa))
+f(v4sf v0, v4sf v1)
+{
+ return v0[0]*v1[0]+v0[1]*v1[1]+v0[2]*v1[2]+v0[3]*v1[3];
+}
+
+/* We are lacking an effective target for .REDUC_PLUS support. */
+/* { dg-final { scan-tree-dump-times "basic block part vectorized" 1 "slp2" { target x86_64-*-* aarch64*-*-* } } } */
+/* { dg-final { scan-tree-dump-not " = VEC_PERM_EXPR" "slp2" { target x86_64-*-* aarch64*-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-layout-19.c b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-19.c
new file mode 100644
index 0000000..f075a83
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-19.c
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fno-tree-loop-vectorize" } */
+
+extern int a[][4], b[][4], c[][4], d[4], e[4];
+void f()
+{
+ int t0 = a[0][3];
+ int t1 = a[1][3];
+ int t2 = a[2][3];
+ int t3 = a[3][3];
+ int a0 = 0, a1 = 0, a2 = 0, a3 = 0, b0 = 0, b1 = 0, b2 = 0, b3 = 0;
+ for (int j = 0; j < 100; ++j)
+ for (int i = 0; i < 400; i += 4)
+ {
+ a0 += b[i][3] * t0;
+ a1 += b[i][2] * t1;
+ a2 += b[i][1] * t2;
+ a3 += b[i][0] * t3;
+ b0 += c[i][3] * t0;
+ b1 += c[i][2] * t1;
+ b2 += c[i][1] * t2;
+ b3 += c[i][0] * t3;
+ }
+ d[0] = a0;
+ d[1] = a1;
+ d[2] = a2;
+ d[3] = a3;
+ e[0] = b0;
+ e[1] = b1;
+ e[2] = b2;
+ e[3] = b3;
+}
+
+/* { dg-final { scan-tree-dump-times "add new stmt: \[^\\n\\r\]* = VEC_PERM_EXPR" 3 "slp1" { target { vect_int_mult && vect_perm } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-layout-2.c b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-2.c
new file mode 100644
index 0000000..f12290b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-2.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Os" } */
+
+#include "bb-slp-layout-1.c"
+
+/* { dg-final { scan-tree-dump-times "add new stmt: \[^\\n\\r\]* = VEC_PERM_EXPR" 2 "slp2" { target { vect_var_shift && { vect_perm && vect_hw_misalign } } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-layout-20.c b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-20.c
new file mode 100644
index 0000000..ed7816b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-20.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fno-tree-loop-vectorize" } */
+
+extern int a[][4], b[][4], c[][4], d[4], e[4];
+void f()
+{
+ int t0 = a[0][3];
+ int t1 = a[1][3];
+ int t2 = a[2][3];
+ int t3 = a[3][3];
+ int a0 = 0, a1 = 0, a2 = 0, a3 = 0, b0 = 0, b1 = 0, b2 = 0, b3 = 0;
+ for (int i = 0; i < 400; i += 4)
+ {
+ a0 += b[i][3] * t0;
+ a1 += b[i][2] * t1;
+ a2 += b[i][1] * t2;
+ a3 += b[i][0] * t3;
+ b0 += c[i][3] * t0;
+ b1 += c[i][2] * t1;
+ b2 += c[i][1] * t2;
+ b3 += c[i][0] * t3;
+ }
+ d[0] = a0;
+ d[1] = a1;
+ d[2] = a2;
+ d[3] = a3;
+ e[0] = b0;
+ e[1] = b1;
+ e[2] = b2;
+ e[3] = b3;
+}
+
+/* { dg-final { scan-tree-dump-times "add new stmt: \[^\\n\\r\]* = VEC_PERM_EXPR" 3 "slp1" { target { vect_int_mult && vect_perm } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-layout-21.c b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-21.c
new file mode 100644
index 0000000..c851d58
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-21.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=bdver2" { target x86_64-*-* i?86-*-* } } */
+
+int rl2GeomExport64_little_endian, rl2GeomExport64_little_endian_arch;
+void rl2GeomExport64(unsigned char *p, double value) {
+ union {
+ unsigned char byte[8];
+ double double_value;
+ } convert;
+ convert.double_value = value;
+ if (rl2GeomExport64_little_endian_arch)
+ if (rl2GeomExport64_little_endian) {
+ *(p + 7) = convert.byte[0];
+ *(p + 6) = convert.byte[1];
+ *(p + 5) = convert.byte[2];
+ *(p + 4) = convert.byte[3];
+ *(p + 3) = convert.byte[4];
+ *(p + 2) = convert.byte[5];
+ *(p + 1) = convert.byte[6];
+ *p = convert.byte[7];
+ } else
+ *p = convert.byte[7];
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-layout-3.c b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-3.c
new file mode 100644
index 0000000..82c2720
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-3.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+int a[4], b[4], c[4], d[4];
+
+void f1()
+{
+ a[0] = (b[3] << c[3]) - d[3];
+ a[1] = (b[2] << c[2]) - d[2];
+ a[2] = (b[1] << c[1]) - d[1];
+ a[3] = (b[0] << c[0]) - d[0];
+}
+
+/* { dg-final { scan-tree-dump-times "add new stmt: \[^\\n\\r\]* = VEC_PERM_EXPR" 1 "slp2" { target { vect_var_shift && vect_perm } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-layout-4.c b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-4.c
new file mode 100644
index 0000000..45bd6c8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-4.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Os" } */
+
+#include "bb-slp-layout-3.c"
+
+/* { dg-final { scan-tree-dump-times "add new stmt: \[^\\n\\r\]* = VEC_PERM_EXPR" 1 "slp2" { target { vect_var_shift && { vect_perm && vect_hw_misalign } } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-layout-5.c b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-5.c
new file mode 100644
index 0000000..b59a159
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-5.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+int a[4], b[4], c[4];
+
+void f1()
+{
+ a[0] = b[3] - c[3];
+ a[1] = b[2] + c[2];
+ a[2] = b[1] - c[1];
+ a[3] = b[0] + c[0];
+}
+
+/* { dg-final { scan-tree-dump "absorbing input layouts" "slp2" { target { vect_int && vect_perm } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-layout-6.c b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-6.c
new file mode 100644
index 0000000..06f5308
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-6.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Os" } */
+
+#include "bb-slp-layout-5.c"
+
+/* { dg-final { scan-tree-dump "absorbing input layouts" "slp2" { target { vect_int && { vect_perm && vect_hw_misalign } } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-layout-7.c b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-7.c
new file mode 100644
index 0000000..7a20c60
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-7.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fno-tree-loop-vectorize" } */
+
+int a[4], b[400];
+
+void f1()
+{
+ for (int i = 0; i < 100; ++i)
+ {
+ a[0] += b[i * 4 + 3];
+ a[1] += b[i * 4 + 2];
+ a[2] += b[i * 4 + 1];
+ a[3] += b[i * 4 + 0];
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "add new stmt: \[^\\n\\r\]* = VEC_PERM_EXPR" 2 "slp1" { target { vect_int && vect_perm } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-layout-8.c b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-8.c
new file mode 100644
index 0000000..ef2f0c6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-8.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Os -fno-tree-loop-vectorize" } */
+
+#include "bb-slp-layout-7.c"
+
+/* { dg-final { scan-tree-dump-times "add new stmt: \[^\\n\\r\]* = VEC_PERM_EXPR" 1 "slp1" { target { vect_int && { vect_perm && vect_hw_misalign } } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-layout-9.c b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-9.c
new file mode 100644
index 0000000..c841862
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-layout-9.c
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fno-tree-loop-vectorize" } */
+
+int a[4], b[400], c[400], d[40000];
+
+void f1()
+{
+ int a0 = a[0];
+ int a1 = a[1];
+ int a2 = a[2];
+ int a3 = a[3];
+ for (int i = 0; i < 100; ++i)
+ {
+ a0 ^= c[i * 4 + 0];
+ a1 ^= c[i * 4 + 1];
+ a2 ^= c[i * 4 + 2];
+ a3 ^= c[i * 4 + 3];
+ for (int j = 0; j < 100; ++j)
+ {
+ a0 += d[i * 400 + j * 4 + 1];
+ a1 += d[i * 400 + j * 4 + 0];
+ a2 += d[i * 400 + j * 4 + 3];
+ a3 += d[i * 400 + j * 4 + 2];
+ }
+ b[i * 4 + 0] = a0;
+ b[i * 4 + 1] = a1;
+ b[i * 4 + 2] = a2;
+ b[i * 4 + 3] = a3;
+ }
+ a[0] = a0;
+ a[1] = a1;
+ a[2] = a2;
+ a[3] = a3;
+}
+
+/* { dg-final { scan-tree-dump-times "add new stmt: \[^\\n\\r\]* = VEC_PERM_EXPR" 2 "slp1" { target { vect_int && vect_perm } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr54400.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr54400.c
index 6b427aa..8aec209 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-pr54400.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr54400.c
@@ -39,5 +39,5 @@ main ()
}
/* We are lacking an effective target for .REDUC_PLUS support. */
-/* { dg-final { scan-tree-dump-times "basic block part vectorized" 3 "slp2" { target x86_64-*-* } } } */
-/* { dg-final { scan-tree-dump-not " = VEC_PERM_EXPR" "slp2" { target x86_64-*-* } } } */
+/* { dg-final { scan-tree-dump-times "basic block part vectorized" 3 "slp2" { target x86_64-*-* aarch64*-*-* } } } */
+/* { dg-final { scan-tree-dump-not " = VEC_PERM_EXPR" "slp2" { target x86_64-*-* aarch64*-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr106914.c b/gcc/testsuite/gcc.dg/vect/pr106914.c
new file mode 100644
index 0000000..9d9b3e3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr106914.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fprofile-generate" } */
+/* { dg-additional-options "-mavx512vl" { target x86_64-*-* i?86-*-* } } */
+
+int *mask_slp_int64_t_8_2_x, *mask_slp_int64_t_8_2_y, *mask_slp_int64_t_8_2_z;
+
+void
+__attribute__mask_slp_int64_t_8_2() {
+ for (int i; i; i += 8) {
+ mask_slp_int64_t_8_2_x[i + 6] =
+ mask_slp_int64_t_8_2_y[i + 6] ? mask_slp_int64_t_8_2_z[i] : 1;
+ mask_slp_int64_t_8_2_x[i + 7] =
+ mask_slp_int64_t_8_2_y[i + 7] ? mask_slp_int64_t_8_2_z[i + 7] : 2;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/vect/slp-11b.c b/gcc/testsuite/gcc.dg/vect/slp-11b.c
index c4d9ab0..d0b972f 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-11b.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-11b.c
@@ -44,4 +44,4 @@ int main (void)
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { { vect_strided4 || vect_perm } && vect_int_mult } } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm && vect_int_mult } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm && vect_int_mult } xfail vect_load_lanes } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s243.c b/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s243.c
index 9361821..6eb0240 100644
--- a/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s243.c
+++ b/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s243.c
@@ -38,4 +38,4 @@ int main (int argc, char **argv)
return 0;
}
-/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-gather-5.c b/gcc/testsuite/gcc.dg/vect/vect-gather-5.c
new file mode 100644
index 0000000..8b5074b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-gather-5.c
@@ -0,0 +1,42 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+
+#ifdef __aarch64__
+#pragma GCC target "+sve"
+#endif
+
+long a[100], b[100], c[100];
+
+void g1 ()
+{
+ for (int i = 0; i < 100; i += 2)
+ {
+ c[i] += a[b[i]] + 1;
+ c[i + 1] += a[b[i + 1]] + 2;
+ }
+}
+
+long g2 ()
+{
+ long res = 0;
+ for (int i = 0; i < 100; i += 2)
+ {
+ res += a[b[i + 1]];
+ res += a[b[i]];
+ }
+ return res;
+}
+
+long g3 ()
+{
+ long res = 0;
+ for (int i = 0; i < 100; i += 2)
+ {
+ res += a[b[i]];
+ res += a[b[i + 1]];
+ }
+ return res;
+}
+
+/* { dg-final { scan-tree-dump-times {add new stmt[^\n]*GATHER_LOAD} 3 "vect" { target aarch64*-*-* } } } */
+/* { dg-final { scan-tree-dump-not {add new stmt[^\n]*VEC_PERM_EXPR} "vect" { target aarch64*-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-18.c b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-18.c
new file mode 100644
index 0000000..c1d3c27
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-18.c
@@ -0,0 +1,38 @@
+/* { dg-require-effective-target vect_condition } */
+/* { dg-require-effective-target vect_float } */
+/* { dg-additional-options "-Ofast -mavx" { target avx_runtime } } */
+
+
+int A0[4] = {36,39,42,45};
+int B0[4] = {42,42,0,42};
+float A1[8] = {36,39,42,45,43,32,21,12};
+float B1[8] = {42,42,0,42,42,42,0,42};
+double A2[16] = {36,39,42,45,43,32,21,12,23,34,45,56,42,78,89,11};
+double B2[16] = {42,42,0,42,42,42,42,42,42,42,42,42,0,42,42,42};
+
+int main ()
+{
+ int i, j;
+ int res0 = 1;
+ float res1 = 1.0;
+ double res2 = 1.0;
+
+ for (i = 0; i < 4; i++)
+ if (B0[i])
+ res0 *= A0[i];
+
+ for (i = 0; i < 8; i++)
+ if (B1[i])
+ res1 *= A1[i];
+
+ for (i = 0; i < 16; i++)
+ if (B2[i])
+ res2 *= A2[i];
+ /* check results: */
+ if (res0 != 63180 || res1 != 1043228160.000000
+ ||res2 != 3296728515318523101184.000000)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump "vectorized 3 loops" "vect" { target i?86-*-* x86_64-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-1.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-1.c
index 5042904..cd65fc3 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-1.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-1.c
@@ -56,3 +56,5 @@ main ()
return 0;
}
+/* { dg-warning {unsupported simdlen 8 \(amdgcn\)} "" { target amdgcn*-*-* } 18 } */
+/* { dg-warning {unsupported simdlen 4 \(amdgcn\)} "" { target amdgcn*-*-* } 18 } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-2.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-2.c
index f89c73a..ffcbf93 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-2.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-2.c
@@ -50,3 +50,5 @@ main ()
return 0;
}
+/* { dg-warning {unsupported simdlen 8 \(amdgcn\)} "" { target amdgcn*-*-* } 18 } */
+/* { dg-warning {unsupported simdlen 4 \(amdgcn\)} "" { target amdgcn*-*-* } 18 } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-3.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-3.c
index 75ce696..18d6877 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-3.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-3.c
@@ -43,3 +43,4 @@ main ()
return 0;
}
+/* { dg-warning {unsupported simdlen 4 \(amdgcn\)} "" { target amdgcn*-*-* } 15 } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-4.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-4.c
index debbe77..e9af0b8 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-4.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-4.c
@@ -46,3 +46,4 @@ main ()
return 0;
}
+/* { dg-warning {unsupported simdlen 8 \(amdgcn\)} "" { target amdgcn*-*-* } 17 } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-5.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-5.c
index 6a098d9..46da496 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-5.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-5.c
@@ -41,3 +41,4 @@ main ()
return 0;
}
+/* { dg-warning {unsupported simdlen 4 \(amdgcn\)} "" { target amdgcn*-*-* } 15 } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-8.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-8.c
index 1bfd19d..f414285 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-8.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-8.c
@@ -92,3 +92,5 @@ main ()
return 0;
}
+/* { dg-warning {unsupported simdlen 8 \(amdgcn\)} "" { target amdgcn*-*-* } 17 } */
+/* { dg-warning {unsupported simdlen 8 \(amdgcn\)} "" { target amdgcn*-*-* } 24 } */
diff --git a/gcc/testsuite/gcc.dg/vla-init-2.c b/gcc/testsuite/gcc.dg/vla-init-2.c
index 19fbffc..f23630a 100644
--- a/gcc/testsuite/gcc.dg/vla-init-2.c
+++ b/gcc/testsuite/gcc.dg/vla-init-2.c
@@ -7,4 +7,3 @@
const int i = 1;
void foo() { char a[][i] = {""}; } /* { dg-error "variable-sized object may not be initialized" } */
-/* { dg-error "array size missing in 'a'" "extra error" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/gcc.dg/vla-init-3.c b/gcc/testsuite/gcc.dg/vla-init-3.c
index 55e1de6..a854f12 100644
--- a/gcc/testsuite/gcc.dg/vla-init-3.c
+++ b/gcc/testsuite/gcc.dg/vla-init-3.c
@@ -6,4 +6,3 @@
/* { dg-options "" } */
void foo(int i) { char a[][i] = {""}; } /* { dg-error "variable-sized object may not be initialized" } */
-/* { dg-error "array size missing in 'a'" "extra error" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/gcc.misc-tests/gcov.exp b/gcc/testsuite/gcc.misc-tests/gcov.exp
index 82376d9..b8e9661 100644
--- a/gcc/testsuite/gcc.misc-tests/gcov.exp
+++ b/gcc/testsuite/gcc.misc-tests/gcov.exp
@@ -24,9 +24,9 @@ global GCC_UNDER_TEST
# For now find gcov in the same directory as $GCC_UNDER_TEST.
if { ![is_remote host] && [string match "*/*" [lindex $GCC_UNDER_TEST 0]] } {
- set GCOV [file dirname [lindex $GCC_UNDER_TEST 0]]/gcov
+ set GCOV [file dirname [lindex $GCC_UNDER_TEST 0]]/[transform gcov]
} else {
- set GCOV gcov
+ set GCOV [transform gcov]
}
# Initialize harness.
diff --git a/gcc/testsuite/gcc.target/aarch64/acle/ls64_asm_2.c b/gcc/testsuite/gcc.target/aarch64/acle/ls64_asm_2.c
new file mode 100644
index 0000000..1b42771
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/acle/ls64_asm_2.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+#pragma GCC target "+ls64+nofp"
+
+#include "ls64_asm.c"
+
+/* { dg-final { scan-assembler-times {\tldp\t} 12 } } */
+/* { dg-final { scan-assembler-times {\tstp\t} 4 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/ldp_stp_20.c b/gcc/testsuite/gcc.target/aarch64/ldp_stp_20.c
new file mode 100644
index 0000000..7e705e1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/ldp_stp_20.c
@@ -0,0 +1,7 @@
+/* { dg-options "-O2" } */
+
+#pragma GCC target "+nosimd+fp"
+
+#include "ldp_stp_6.c"
+
+/* { dg-final { scan-assembler "stp\td\[0-9\]+, d\[0-9\]+, \\\[x\[0-9\]+\\\]" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/ldp_stp_21.c b/gcc/testsuite/gcc.target/aarch64/ldp_stp_21.c
new file mode 100644
index 0000000..462e3c9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/ldp_stp_21.c
@@ -0,0 +1,7 @@
+/* { dg-options "-O2" } */
+
+#pragma GCC target "+nosimd+fp"
+
+#include "ldp_stp_8.c"
+
+/* { dg-final { scan-assembler-times "ldp\td\[0-9\], d\[0-9\]+, \\\[x\[0-9\]+\\\]" 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/ldp_stp_22.c b/gcc/testsuite/gcc.target/aarch64/ldp_stp_22.c
new file mode 100644
index 0000000..283c56d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/ldp_stp_22.c
@@ -0,0 +1,13 @@
+/* { dg-options "-O2" } */
+
+#pragma GCC target "+nosimd+fp"
+
+void
+foo (__Float32x4_t *ptr)
+{
+ ptr[0] = ptr[2];
+ ptr[1] = ptr[3];
+}
+
+/* { dg-final { scan-assembler {\tldp\tq[0-9]+, q[0-9]+} } } */
+/* { dg-final { scan-assembler {\tstp\tq[0-9]+, q[0-9]+} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/ldp_stp_23.c b/gcc/testsuite/gcc.target/aarch64/ldp_stp_23.c
new file mode 100644
index 0000000..b14976c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/ldp_stp_23.c
@@ -0,0 +1,16 @@
+/* { dg-options "-O2" } */
+
+#pragma GCC target "+nosimd+fp"
+
+void
+foo (char *char_ptr)
+{
+ __Float64x2_t *ptr = (__Float64x2_t *)(char_ptr + 1);
+ asm volatile ("" ::
+ "w" (ptr[1]),
+ "w" (ptr[2]),
+ "w" (ptr[3]),
+ "w" (ptr[4]));
+}
+
+/* { dg-final { scan-assembler-times {\tldp\tq[0-9]+, q[0-9]+} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/ldp_stp_24.c b/gcc/testsuite/gcc.target/aarch64/ldp_stp_24.c
new file mode 100644
index 0000000..a99426e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/ldp_stp_24.c
@@ -0,0 +1,16 @@
+/* { dg-options "-O2" } */
+
+#pragma GCC target "+nosimd+fp"
+
+void
+foo (char *char_ptr)
+{
+ __Float64x2_t *ptr = (__Float64x2_t *)(char_ptr + 1);
+ asm volatile ("" :
+ "=w" (ptr[1]),
+ "=w" (ptr[2]),
+ "=w" (ptr[3]),
+ "=w" (ptr[4]));
+}
+
+/* { dg-final { scan-assembler-times {\tstp\tq[0-9]+, q[0-9]+} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/movdf_1.c b/gcc/testsuite/gcc.target/aarch64/movdf_1.c
new file mode 100644
index 0000000..a51ded1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movdf_1.c
@@ -0,0 +1,53 @@
+/* { dg-do assemble } */
+/* { dg-options "-O --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#pragma GCC target "+nothing+nosimd+fp"
+
+/*
+** fpr_to_fpr:
+** fmov d0, d1
+** ret
+*/
+double
+fpr_to_fpr (double q0, double q1)
+{
+ return q1;
+}
+
+/*
+** gpr_to_fpr:
+** fmov d0, x0
+** ret
+*/
+double
+gpr_to_fpr ()
+{
+ register double x0 asm ("x0");
+ asm volatile ("" : "=r" (x0));
+ return x0;
+}
+
+/*
+** zero_to_fpr:
+** fmov d0, xzr
+** ret
+*/
+double
+zero_to_fpr ()
+{
+ return 0;
+}
+
+/*
+** fpr_to_gpr:
+** fmov x0, d0
+** ret
+*/
+void
+fpr_to_gpr (double q0)
+{
+ register double x0 asm ("x0");
+ x0 = q0;
+ asm volatile ("" :: "r" (x0));
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/movdi_2.c b/gcc/testsuite/gcc.target/aarch64/movdi_2.c
new file mode 100644
index 0000000..dd3fc3e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movdi_2.c
@@ -0,0 +1,61 @@
+/* { dg-do assemble } */
+/* { dg-options "-O --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#pragma GCC target "+nothing+nosimd+fp"
+
+#include <stdint.h>
+
+/*
+** fpr_to_fpr:
+** fmov d0, d1
+** ret
+*/
+void
+fpr_to_fpr (void)
+{
+ register uint64_t q0 asm ("q0");
+ register uint64_t q1 asm ("q1");
+ asm volatile ("" : "=w" (q1));
+ q0 = q1;
+ asm volatile ("" :: "w" (q0));
+}
+
+/*
+** gpr_to_fpr:
+** fmov d0, x0
+** ret
+*/
+void
+gpr_to_fpr (uint64_t x0)
+{
+ register uint64_t q0 asm ("q0");
+ q0 = x0;
+ asm volatile ("" :: "w" (q0));
+}
+
+/*
+** zero_to_fpr:
+** fmov d0, xzr
+** ret
+*/
+void
+zero_to_fpr ()
+{
+ register uint64_t q0 asm ("q0");
+ q0 = 0;
+ asm volatile ("" :: "w" (q0));
+}
+
+/*
+** fpr_to_gpr:
+** fmov x0, d0
+** ret
+*/
+uint64_t
+fpr_to_gpr ()
+{
+ register uint64_t q0 asm ("q0");
+ asm volatile ("" : "=w" (q0));
+ return q0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/movhf_1.c b/gcc/testsuite/gcc.target/aarch64/movhf_1.c
new file mode 100644
index 0000000..cae25d4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movhf_1.c
@@ -0,0 +1,53 @@
+/* { dg-do assemble } */
+/* { dg-options "-O --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#pragma GCC target "+nothing+nosimd+fp"
+
+/*
+** fpr_to_fpr:
+** fmov s0, s1
+** ret
+*/
+_Float16
+fpr_to_fpr (_Float16 q0, _Float16 q1)
+{
+ return q1;
+}
+
+/*
+** gpr_to_fpr:
+** fmov s0, w0
+** ret
+*/
+_Float16
+gpr_to_fpr ()
+{
+ register _Float16 w0 asm ("w0");
+ asm volatile ("" : "=r" (w0));
+ return w0;
+}
+
+/*
+** zero_to_fpr:
+** fmov s0, wzr
+** ret
+*/
+_Float16
+zero_to_fpr ()
+{
+ return 0;
+}
+
+/*
+** fpr_to_gpr:
+** fmov w0, s0
+** ret
+*/
+void
+fpr_to_gpr (_Float16 q0)
+{
+ register _Float16 w0 asm ("w0");
+ w0 = q0;
+ asm volatile ("" :: "r" (w0));
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/movhi_1.c b/gcc/testsuite/gcc.target/aarch64/movhi_1.c
new file mode 100644
index 0000000..8017abc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movhi_1.c
@@ -0,0 +1,61 @@
+/* { dg-do assemble } */
+/* { dg-options "-O --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#pragma GCC target "+nothing+nosimd+fp"
+
+#include <stdint.h>
+
+/*
+** fpr_to_fpr:
+** fmov s0, s1
+** ret
+*/
+void
+fpr_to_fpr (void)
+{
+ register uint16_t q0 asm ("q0");
+ register uint16_t q1 asm ("q1");
+ asm volatile ("" : "=w" (q1));
+ q0 = q1;
+ asm volatile ("" :: "w" (q0));
+}
+
+/*
+** gpr_to_fpr:
+** fmov s0, w0
+** ret
+*/
+void
+gpr_to_fpr (uint16_t w0)
+{
+ register uint16_t q0 asm ("q0");
+ q0 = w0;
+ asm volatile ("" :: "w" (q0));
+}
+
+/*
+** zero_to_fpr:
+** fmov s0, wzr
+** ret
+*/
+void
+zero_to_fpr ()
+{
+ register uint16_t q0 asm ("q0");
+ q0 = 0;
+ asm volatile ("" :: "w" (q0));
+}
+
+/*
+** fpr_to_gpr:
+** fmov w0, s0
+** ret
+*/
+uint16_t
+fpr_to_gpr ()
+{
+ register uint16_t q0 asm ("q0");
+ asm volatile ("" : "=w" (q0));
+ return q0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/movqi_1.c b/gcc/testsuite/gcc.target/aarch64/movqi_1.c
new file mode 100644
index 0000000..401a796
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movqi_1.c
@@ -0,0 +1,61 @@
+/* { dg-do assemble } */
+/* { dg-options "-O --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#pragma GCC target "+nothing+nosimd+fp"
+
+#include <stdint.h>
+
+/*
+** fpr_to_fpr:
+** fmov s0, s1
+** ret
+*/
+void
+fpr_to_fpr (void)
+{
+ register uint8_t q0 asm ("q0");
+ register uint8_t q1 asm ("q1");
+ asm volatile ("" : "=w" (q1));
+ q0 = q1;
+ asm volatile ("" :: "w" (q0));
+}
+
+/*
+** gpr_to_fpr:
+** fmov s0, w0
+** ret
+*/
+void
+gpr_to_fpr (uint8_t w0)
+{
+ register uint8_t q0 asm ("q0");
+ q0 = w0;
+ asm volatile ("" :: "w" (q0));
+}
+
+/*
+** zero_to_fpr:
+** fmov s0, wzr
+** ret
+*/
+void
+zero_to_fpr ()
+{
+ register uint8_t q0 asm ("q0");
+ q0 = 0;
+ asm volatile ("" :: "w" (q0));
+}
+
+/*
+** fpr_to_gpr:
+** fmov w0, s0
+** ret
+*/
+uint8_t
+fpr_to_gpr ()
+{
+ register uint8_t q0 asm ("q0");
+ asm volatile ("" : "=w" (q0));
+ return q0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/movsf_1.c b/gcc/testsuite/gcc.target/aarch64/movsf_1.c
new file mode 100644
index 0000000..09715aa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movsf_1.c
@@ -0,0 +1,53 @@
+/* { dg-do assemble } */
+/* { dg-options "-O --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#pragma GCC target "+nothing+nosimd+fp"
+
+/*
+** fpr_to_fpr:
+** fmov s0, s1
+** ret
+*/
+float
+fpr_to_fpr (float q0, float q1)
+{
+ return q1;
+}
+
+/*
+** gpr_to_fpr:
+** fmov s0, w0
+** ret
+*/
+float
+gpr_to_fpr ()
+{
+ register float w0 asm ("w0");
+ asm volatile ("" : "=r" (w0));
+ return w0;
+}
+
+/*
+** zero_to_fpr:
+** fmov s0, wzr
+** ret
+*/
+float
+zero_to_fpr ()
+{
+ return 0;
+}
+
+/*
+** fpr_to_gpr:
+** fmov w0, s0
+** ret
+*/
+void
+fpr_to_gpr (float q0)
+{
+ register float w0 asm ("w0");
+ w0 = q0;
+ asm volatile ("" :: "r" (w0));
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/movsi_1.c b/gcc/testsuite/gcc.target/aarch64/movsi_1.c
new file mode 100644
index 0000000..5314139
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movsi_1.c
@@ -0,0 +1,61 @@
+/* { dg-do assemble } */
+/* { dg-options "-O --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#pragma GCC target "+nothing+nosimd+fp"
+
+#include <stdint.h>
+
+/*
+** fpr_to_fpr:
+** fmov s0, s1
+** ret
+*/
+void
+fpr_to_fpr (void)
+{
+ register uint32_t q0 asm ("q0");
+ register uint32_t q1 asm ("q1");
+ asm volatile ("" : "=w" (q1));
+ q0 = q1;
+ asm volatile ("" :: "w" (q0));
+}
+
+/*
+** gpr_to_fpr:
+** fmov s0, w0
+** ret
+*/
+void
+gpr_to_fpr (uint32_t w0)
+{
+ register uint32_t q0 asm ("q0");
+ q0 = w0;
+ asm volatile ("" :: "w" (q0));
+}
+
+/*
+** zero_to_fpr:
+** fmov s0, wzr
+** ret
+*/
+void
+zero_to_fpr ()
+{
+ register uint32_t q0 asm ("q0");
+ q0 = 0;
+ asm volatile ("" :: "w" (q0));
+}
+
+/*
+** fpr_to_gpr:
+** fmov w0, s0
+** ret
+*/
+uint32_t
+fpr_to_gpr ()
+{
+ register uint32_t q0 asm ("q0");
+ asm volatile ("" : "=w" (q0));
+ return q0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/movtf_2.c b/gcc/testsuite/gcc.target/aarch64/movtf_2.c
new file mode 100644
index 0000000..38b1635
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movtf_2.c
@@ -0,0 +1,81 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target large_long_double } */
+/* { dg-options "-O -mtune=neoverse-v1 --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#pragma GCC target "+nothing+nosimd+fp"
+
+/*
+** fpr_to_fpr:
+** sub sp, sp, #16
+** str q1, \[sp\]
+** ldr q0, \[sp\]
+** add sp, sp, #?16
+** ret
+*/
+long double
+fpr_to_fpr (long double q0, long double q1)
+{
+ return q1;
+}
+
+/*
+** gpr_to_fpr: { target aarch64_little_endian }
+** fmov d0, x0
+** fmov v0.d\[1\], x1
+** ret
+*/
+/*
+** gpr_to_fpr: { target aarch64_big_endian }
+** fmov d0, x1
+** fmov v0.d\[1\], x0
+** ret
+*/
+long double
+gpr_to_fpr ()
+{
+ register long double x0 asm ("x0");
+ asm volatile ("" : "=r" (x0));
+ return x0;
+}
+
+/*
+** zero_to_fpr:
+** fmov s0, wzr
+** ret
+*/
+long double
+zero_to_fpr ()
+{
+ return 0;
+}
+
+/*
+** fpr_to_gpr: { target aarch64_little_endian }
+** (
+** fmov x0, d0
+** fmov x1, v0.d\[1\]
+** |
+** fmov x1, v0.d\[1\]
+** fmov x0, d0
+** )
+** ret
+*/
+/*
+** fpr_to_gpr: { target aarch64_big_endian }
+** (
+** fmov x1, d0
+** fmov x0, v0.d\[1\]
+** |
+** fmov x0, v0.d\[1\]
+** fmov x1, d0
+** )
+** ret
+*/
+void
+fpr_to_gpr (long double q0)
+{
+ register long double x0 asm ("x0");
+ x0 = q0;
+ asm volatile ("" :: "r" (x0));
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/movti_2.c b/gcc/testsuite/gcc.target/aarch64/movti_2.c
new file mode 100644
index 0000000..c393b12
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movti_2.c
@@ -0,0 +1,86 @@
+/* { dg-do assemble } */
+/* { dg-options "-O -mtune=neoverse-v1 --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#pragma GCC target "+nothing+nosimd+fp"
+
+/*
+** fpr_to_fpr:
+** sub sp, sp, #16
+** str q1, \[sp\]
+** ldr q0, \[sp\]
+** add sp, sp, #?16
+** ret
+*/
+void
+fpr_to_fpr (void)
+{
+ register __int128_t q0 asm ("q0");
+ register __int128_t q1 asm ("q1");
+ asm volatile ("" : "=w" (q1));
+ q0 = q1;
+ asm volatile ("" :: "w" (q0));
+}
+
+/*
+** gpr_to_fpr: { target aarch64_little_endian }
+** fmov d0, x0
+** fmov v0.d\[1\], x1
+** ret
+*/
+/*
+** gpr_to_fpr: { target aarch64_big_endian }
+** fmov d0, x1
+** fmov v0.d\[1\], x0
+** ret
+*/
+void
+gpr_to_fpr (__int128_t x0)
+{
+ register __int128_t q0 asm ("q0");
+ q0 = x0;
+ asm volatile ("" :: "w" (q0));
+}
+
+/*
+** zero_to_fpr:
+** fmov d0, xzr
+** ret
+*/
+void
+zero_to_fpr ()
+{
+ register __int128_t q0 asm ("q0");
+ q0 = 0;
+ asm volatile ("" :: "w" (q0));
+}
+
+/*
+** fpr_to_gpr: { target aarch64_little_endian }
+** (
+** fmov x0, d0
+** fmov x1, v0.d\[1\]
+** |
+** fmov x1, v0.d\[1\]
+** fmov x0, d0
+** )
+** ret
+*/
+/*
+** fpr_to_gpr: { target aarch64_big_endian }
+** (
+** fmov x1, d0
+** fmov x0, v0.d\[1\]
+** |
+** fmov x0, v0.d\[1\]
+** fmov x1, d0
+** )
+** ret
+*/
+__int128_t
+fpr_to_gpr ()
+{
+ register __int128_t q0 asm ("q0");
+ asm volatile ("" : "=w" (q0));
+ return q0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/movv16qi_1.c b/gcc/testsuite/gcc.target/aarch64/movv16qi_1.c
new file mode 100644
index 0000000..cac4241
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movv16qi_1.c
@@ -0,0 +1,103 @@
+/* { dg-do assemble } */
+/* { dg-options "-O -mtune=neoverse-v1 --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#pragma GCC target "+nothing+nosimd+fp"
+
+typedef unsigned char v16qi __attribute__((vector_size(16)));
+
+/*
+** fpr_to_fpr:
+** sub sp, sp, #16
+** str q1, \[sp\]
+** ldr q0, \[sp\]
+** add sp, sp, #?16
+** ret
+*/
+v16qi
+fpr_to_fpr (v16qi q0, v16qi q1)
+{
+ return q1;
+}
+
+/*
+** gpr_to_fpr: { target aarch64_little_endian }
+** fmov d0, x0
+** fmov v0.d\[1\], x1
+** ret
+*/
+/*
+** gpr_to_fpr: { target aarch64_big_endian }
+** fmov d0, x1
+** fmov v0.d\[1\], x0
+** ret
+*/
+v16qi
+gpr_to_fpr ()
+{
+ register v16qi x0 asm ("x0");
+ asm volatile ("" : "=r" (x0));
+ return x0;
+}
+
+/*
+** zero_to_fpr:
+** fmov d0, xzr
+** ret
+*/
+v16qi
+zero_to_fpr ()
+{
+ return (v16qi) {};
+}
+
+/*
+** fpr_to_gpr: { target aarch64_little_endian }
+** (
+** fmov x0, d0
+** fmov x1, v0.d\[1\]
+** |
+** fmov x1, v0.d\[1\]
+** fmov x0, d0
+** )
+** ret
+*/
+/*
+** fpr_to_gpr: { target aarch64_big_endian }
+** (
+** fmov x1, d0
+** fmov x0, v0.d\[1\]
+** |
+** fmov x0, v0.d\[1\]
+** fmov x1, d0
+** )
+** ret
+*/
+void
+fpr_to_gpr (v16qi q0)
+{
+ register v16qi x0 asm ("x0");
+ x0 = q0;
+ asm volatile ("" :: "r" (x0));
+}
+
+/*
+** gpr_to_gpr:
+** (
+** mov x0, x2
+** mov x1, x3
+** |
+** mov x1, x3
+** mov x0, x2
+** )
+** ret
+*/
+void
+gpr_to_gpr ()
+{
+ register v16qi x0 asm ("x0");
+ register v16qi x2 asm ("x2");
+ asm volatile ("" : "=r" (x2));
+ x0 = x2;
+ asm volatile ("" :: "r" (x0));
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/movv16qi_2.c b/gcc/testsuite/gcc.target/aarch64/movv16qi_2.c
new file mode 100644
index 0000000..08a0a19
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movv16qi_2.c
@@ -0,0 +1,27 @@
+/* { dg-do assemble } */
+/* { dg-options "-O --save-temps" } */
+
+#pragma GCC target "+nosimd+fp"
+
+#define TEST_GENERAL(TYPE) \
+ TYPE mov_##TYPE (TYPE a, TYPE b) { return b; } \
+ TYPE zero_##TYPE () { return (TYPE) {}; } \
+ TYPE load_##TYPE (TYPE *ptr) { return *ptr; } \
+ void store_##TYPE (TYPE *ptr, TYPE a) { *ptr = a; }
+
+TEST_GENERAL (__Int8x16_t)
+TEST_GENERAL (__Int16x8_t)
+TEST_GENERAL (__Int32x4_t)
+TEST_GENERAL (__Int64x2_t)
+TEST_GENERAL (__Bfloat16x8_t)
+TEST_GENERAL (__Float16x8_t)
+TEST_GENERAL (__Float32x4_t)
+TEST_GENERAL (__Float64x2_t)
+
+__Int8x16_t const_s8x8 () { return (__Int8x16_t) { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; }
+__Int16x8_t const_s16x4 () { return (__Int16x8_t) { 1, 0, 1, 0, 1, 0, 1, 0 }; }
+__Int32x4_t const_s32x2 () { return (__Int32x4_t) { 1, 2, 3, 4 }; }
+__Int64x2_t const_s64x1 () { return (__Int64x2_t) { 100, 100 }; }
+__Float16x8_t const_f16x4 () { return (__Float16x8_t) { 2, 2, 2, 2, 2, 2, 2, 2 }; }
+__Float32x4_t const_f32x2 () { return (__Float32x4_t) { 1, 2, 1, 2 }; }
+__Float64x2_t const_f64x1 () { return (__Float64x2_t) { 32, 32 }; }
diff --git a/gcc/testsuite/gcc.target/aarch64/movv16qi_3.c b/gcc/testsuite/gcc.target/aarch64/movv16qi_3.c
new file mode 100644
index 0000000..d43b994
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movv16qi_3.c
@@ -0,0 +1,30 @@
+/* { dg-do assemble } */
+/* { dg-options "-O --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#pragma GCC target "+nosimd+fp"
+
+#define TEST_VECTOR(TYPE) \
+ TYPE \
+ test_##TYPE (void) \
+ { \
+ typedef TYPE v __attribute__((aligned(1))); \
+ register v *ptr asm ("x0"); \
+ asm volatile ("" : "=r" (ptr)); \
+ return *ptr; \
+ }
+
+TEST_VECTOR (__Int8x16_t)
+TEST_VECTOR (__Int16x8_t)
+TEST_VECTOR (__Int32x4_t)
+TEST_VECTOR (__Int64x2_t)
+TEST_VECTOR (__Bfloat16x8_t)
+TEST_VECTOR (__Float16x8_t)
+TEST_VECTOR (__Float32x4_t)
+TEST_VECTOR (__Float64x2_t)
+
+/*
+** test___Int8x16_t:
+** ldr q0, \[x0\]
+** ret
+*/
diff --git a/gcc/testsuite/gcc.target/aarch64/movv2di_1.c b/gcc/testsuite/gcc.target/aarch64/movv2di_1.c
new file mode 100644
index 0000000..e3b55fd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movv2di_1.c
@@ -0,0 +1,103 @@
+/* { dg-do assemble } */
+/* { dg-options "-O -mtune=neoverse-v1 --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#pragma GCC target "+nothing+nosimd+fp"
+
+typedef long long v2di __attribute__((vector_size(16)));
+
+/*
+** fpr_to_fpr:
+** sub sp, sp, #16
+** str q1, \[sp\]
+** ldr q0, \[sp\]
+** add sp, sp, #?16
+** ret
+*/
+v2di
+fpr_to_fpr (v2di q0, v2di q1)
+{
+ return q1;
+}
+
+/*
+** gpr_to_fpr: { target aarch64_little_endian }
+** fmov d0, x0
+** fmov v0.d\[1\], x1
+** ret
+*/
+/*
+** gpr_to_fpr: { target aarch64_big_endian }
+** fmov d0, x1
+** fmov v0.d\[1\], x0
+** ret
+*/
+v2di
+gpr_to_fpr ()
+{
+ register v2di x0 asm ("x0");
+ asm volatile ("" : "=r" (x0));
+ return x0;
+}
+
+/*
+** zero_to_fpr:
+** fmov d0, xzr
+** ret
+*/
+v2di
+zero_to_fpr ()
+{
+ return (v2di) {};
+}
+
+/*
+** fpr_to_gpr: { target aarch64_little_endian }
+** (
+** fmov x0, d0
+** fmov x1, v0.d\[1\]
+** |
+** fmov x1, v0.d\[1\]
+** fmov x0, d0
+** )
+** ret
+*/
+/*
+** fpr_to_gpr: { target aarch64_big_endian }
+** (
+** fmov x1, d0
+** fmov x0, v0.d\[1\]
+** |
+** fmov x0, v0.d\[1\]
+** fmov x1, d0
+** )
+** ret
+*/
+void
+fpr_to_gpr (v2di q0)
+{
+ register v2di x0 asm ("x0");
+ x0 = q0;
+ asm volatile ("" :: "r" (x0));
+}
+
+/*
+** gpr_to_gpr:
+** (
+** mov x0, x2
+** mov x1, x3
+** |
+** mov x1, x3
+** mov x0, x2
+** )
+** ret
+*/
+void
+gpr_to_gpr ()
+{
+ register v2di x0 asm ("x0");
+ register v2di x2 asm ("x2");
+ asm volatile ("" : "=r" (x2));
+ x0 = x2;
+ asm volatile ("" :: "r" (x0));
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/movv2x16qi_1.c b/gcc/testsuite/gcc.target/aarch64/movv2x16qi_1.c
new file mode 100644
index 0000000..90e3b42
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movv2x16qi_1.c
@@ -0,0 +1,40 @@
+/* { dg-do assemble } */
+/* { dg-options "-O --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#pragma GCC aarch64 "arm_neon.h"
+
+#pragma GCC target "+nosimd+fp"
+
+#define TEST_VECTOR(TYPE) \
+ TYPE mov_##TYPE (TYPE a, TYPE b) { return b; } \
+ TYPE load_##TYPE (TYPE *ptr) { return *ptr; } \
+ void store_##TYPE (TYPE *ptr, TYPE a) { *ptr = a; }
+
+TEST_VECTOR (int8x16x2_t)
+TEST_VECTOR (int16x8x2_t)
+TEST_VECTOR (int32x4x2_t)
+TEST_VECTOR (int64x2x2_t)
+TEST_VECTOR (float16x8x2_t)
+TEST_VECTOR (bfloat16x8x2_t)
+TEST_VECTOR (float32x4x2_t)
+TEST_VECTOR (float64x2x2_t)
+
+/*
+** mov_int8x16x2_t:
+** sub sp, sp, #32
+** stp q2, q3, \[sp\]
+** ldp q0, q1, \[sp\]
+** add sp, sp, #?32
+** ret
+*/
+/*
+** load_int8x16x2_t:
+** ldp q0, q1, \[x0\]
+** ret
+*/
+/*
+** store_int8x16x2_t: { xfail *-*-* }
+** stp q0, q1, \[x0\]
+** ret
+*/
diff --git a/gcc/testsuite/gcc.target/aarch64/movv2x8qi_1.c b/gcc/testsuite/gcc.target/aarch64/movv2x8qi_1.c
new file mode 100644
index 0000000..883a0ea
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movv2x8qi_1.c
@@ -0,0 +1,38 @@
+/* { dg-do assemble } */
+/* { dg-options "-O --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#pragma GCC aarch64 "arm_neon.h"
+
+#pragma GCC target "+nosimd+fp"
+
+#define TEST_VECTOR(TYPE) \
+ TYPE mov_##TYPE (TYPE a, TYPE b) { return b; } \
+ TYPE load_##TYPE (TYPE *ptr) { return *ptr; } \
+ void store_##TYPE (TYPE *ptr, TYPE a) { *ptr = a; }
+
+TEST_VECTOR (int8x8x2_t)
+TEST_VECTOR (int16x4x2_t)
+TEST_VECTOR (int32x2x2_t)
+TEST_VECTOR (int64x1x2_t)
+TEST_VECTOR (float16x4x2_t)
+TEST_VECTOR (bfloat16x4x2_t)
+TEST_VECTOR (float32x2x2_t)
+TEST_VECTOR (float64x1x2_t)
+
+/*
+** mov_int8x8x2_t:
+** fmov d0, d2
+** fmov d1, d3
+** ret
+*/
+/*
+** load_int8x8x2_t:
+** ldp d0, d1, \[x0\]
+** ret
+*/
+/*
+** store_int8x8x2_t:
+** stp d0, d1, \[x0\]
+** ret
+*/
diff --git a/gcc/testsuite/gcc.target/aarch64/movv3x16qi_1.c b/gcc/testsuite/gcc.target/aarch64/movv3x16qi_1.c
new file mode 100644
index 0000000..070a596
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movv3x16qi_1.c
@@ -0,0 +1,44 @@
+/* { dg-do assemble } */
+/* { dg-options "-O --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#pragma GCC aarch64 "arm_neon.h"
+
+#pragma GCC target "+nosimd+fp"
+
+#define TEST_VECTOR(TYPE) \
+ TYPE mov_##TYPE (TYPE a, TYPE b) { return b; } \
+ TYPE load_##TYPE (TYPE *ptr) { return *ptr; } \
+ void store_##TYPE (TYPE *ptr, TYPE a) { *ptr = a; }
+
+TEST_VECTOR (int8x16x3_t)
+TEST_VECTOR (int16x8x3_t)
+TEST_VECTOR (int32x4x3_t)
+TEST_VECTOR (int64x2x3_t)
+TEST_VECTOR (float16x8x3_t)
+TEST_VECTOR (bfloat16x8x3_t)
+TEST_VECTOR (float32x4x3_t)
+TEST_VECTOR (float64x2x3_t)
+
+/*
+** mov_int8x16x3_t:
+** sub sp, sp, #48
+** stp q3, q4, \[sp\]
+** str q5, \[sp, #?32\]
+** ldp q0, q1, \[sp\]
+** ldr q2, \[sp, #?32\]
+** add sp, sp, #?48
+** ret
+*/
+/*
+** load_int8x16x3_t:
+** ldp q0, q1, \[x0\]
+** ldr q2, \[x0, #?32\]
+** ret
+*/
+/*
+** store_int8x16x3_t: { xfail *-*-* }
+** stp q0, q1, \[x0\]
+** stp q2, \[x0, #?32\]
+** ret
+*/
diff --git a/gcc/testsuite/gcc.target/aarch64/movv3x8qi_1.c b/gcc/testsuite/gcc.target/aarch64/movv3x8qi_1.c
new file mode 100644
index 0000000..4b873d7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movv3x8qi_1.c
@@ -0,0 +1,41 @@
+/* { dg-do assemble } */
+/* { dg-options "-O --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#pragma GCC aarch64 "arm_neon.h"
+
+#pragma GCC target "+nosimd+fp"
+
+#define TEST_VECTOR(TYPE) \
+ TYPE mov_##TYPE (TYPE a, TYPE b) { return b; } \
+ TYPE load_##TYPE (TYPE *ptr) { return *ptr; } \
+ void store_##TYPE (TYPE *ptr, TYPE a) { *ptr = a; }
+
+TEST_VECTOR (int8x8x3_t)
+TEST_VECTOR (int16x4x3_t)
+TEST_VECTOR (int32x2x3_t)
+TEST_VECTOR (int64x1x3_t)
+TEST_VECTOR (float16x4x3_t)
+TEST_VECTOR (bfloat16x4x3_t)
+TEST_VECTOR (float32x2x3_t)
+TEST_VECTOR (float64x1x3_t)
+
+/*
+** mov_int8x8x3_t:
+** fmov d0, d3
+** fmov d1, d4
+** fmov d2, d5
+** ret
+*/
+/*
+** load_int8x8x3_t:
+** ldp d0, d1, \[x0\]
+** ldr d2, \[x0, #?16\]
+** ret
+*/
+/*
+** store_int8x8x3_t:
+** stp d0, d1, \[x0\]
+** str d2, \[x0, #?16\]
+** ret
+*/
diff --git a/gcc/testsuite/gcc.target/aarch64/movv4x16qi_1.c b/gcc/testsuite/gcc.target/aarch64/movv4x16qi_1.c
new file mode 100644
index 0000000..6a517b4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movv4x16qi_1.c
@@ -0,0 +1,44 @@
+/* { dg-do assemble } */
+/* { dg-options "-O --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#pragma GCC aarch64 "arm_neon.h"
+
+#pragma GCC target "+nosimd+fp"
+
+#define TEST_VECTOR(TYPE) \
+ TYPE mov_##TYPE (TYPE a, TYPE b) { return b; } \
+ TYPE load_##TYPE (TYPE *ptr) { return *ptr; } \
+ void store_##TYPE (TYPE *ptr, TYPE a) { *ptr = a; }
+
+TEST_VECTOR (int8x16x4_t)
+TEST_VECTOR (int16x8x4_t)
+TEST_VECTOR (int32x4x4_t)
+TEST_VECTOR (int64x2x4_t)
+TEST_VECTOR (float16x8x4_t)
+TEST_VECTOR (bfloat16x8x4_t)
+TEST_VECTOR (float32x4x4_t)
+TEST_VECTOR (float64x2x4_t)
+
+/*
+** mov_int8x16x4_t:
+** sub sp, sp, #64
+** stp q4, q5, \[sp\]
+** stp q6, q7, \[sp, #?32\]
+** ldp q0, q1, \[sp\]
+** ldp q2, q3, \[sp, #?32\]
+** add sp, sp, #?64
+** ret
+*/
+/*
+** load_int8x16x4_t:
+** ldp q0, q1, \[x0\]
+** ldp q2, q3, \[x0, #?32\]
+** ret
+*/
+/*
+** store_int8x16x4_t: { xfail *-*-* }
+** stp q0, q1, \[x0\]
+** stp q2, q3, \[x0, #?32\]
+** ret
+*/
diff --git a/gcc/testsuite/gcc.target/aarch64/movv4x8qi_1.c b/gcc/testsuite/gcc.target/aarch64/movv4x8qi_1.c
new file mode 100644
index 0000000..f096be4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movv4x8qi_1.c
@@ -0,0 +1,42 @@
+/* { dg-do assemble } */
+/* { dg-options "-O --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#pragma GCC aarch64 "arm_neon.h"
+
+#pragma GCC target "+nosimd+fp"
+
+#define TEST_VECTOR(TYPE) \
+ TYPE mov_##TYPE (TYPE a, TYPE b) { return b; } \
+ TYPE load_##TYPE (TYPE *ptr) { return *ptr; } \
+ void store_##TYPE (TYPE *ptr, TYPE a) { *ptr = a; }
+
+TEST_VECTOR (int8x8x4_t)
+TEST_VECTOR (int16x4x4_t)
+TEST_VECTOR (int32x2x4_t)
+TEST_VECTOR (int64x1x4_t)
+TEST_VECTOR (float16x4x4_t)
+TEST_VECTOR (bfloat16x4x4_t)
+TEST_VECTOR (float32x2x4_t)
+TEST_VECTOR (float64x1x4_t)
+
+/*
+** mov_int8x8x4_t:
+** fmov d0, d4
+** fmov d1, d5
+** fmov d2, d6
+** fmov d3, d7
+** ret
+*/
+/*
+** load_int8x8x4_t:
+** ldp d0, d1, \[x0\]
+** ldp d2, d3, \[x0, #?16\]
+** ret
+*/
+/*
+** store_int8x8x4_t:
+** stp d0, d1, \[x0\]
+** stp d2, d3, \[x0, #?16\]
+** ret
+*/
diff --git a/gcc/testsuite/gcc.target/aarch64/movv8qi_1.c b/gcc/testsuite/gcc.target/aarch64/movv8qi_1.c
new file mode 100644
index 0000000..d2b5d80
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movv8qi_1.c
@@ -0,0 +1,70 @@
+/* { dg-do assemble } */
+/* { dg-options "-O -mtune=neoverse-v1 --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#pragma GCC target "+nothing+nosimd+fp"
+
+typedef unsigned char v8qi __attribute__((vector_size(8)));
+
+/*
+** fpr_to_fpr:
+** fmov d0, d1
+** ret
+*/
+v8qi
+fpr_to_fpr (v8qi q0, v8qi q1)
+{
+ return q1;
+}
+
+/*
+** gpr_to_fpr:
+** fmov d0, x0
+** ret
+*/
+v8qi
+gpr_to_fpr ()
+{
+ register v8qi x0 asm ("x0");
+ asm volatile ("" : "=r" (x0));
+ return x0;
+}
+
+/*
+** zero_to_fpr:
+** fmov d0, xzr
+** ret
+*/
+v8qi
+zero_to_fpr ()
+{
+ return (v8qi) {};
+}
+
+/*
+** fpr_to_gpr:
+** fmov x0, d0
+** ret
+*/
+void
+fpr_to_gpr (v8qi q0)
+{
+ register v8qi x0 asm ("x0");
+ x0 = q0;
+ asm volatile ("" :: "r" (x0));
+}
+
+/*
+** gpr_to_gpr:
+** mov x0, x1
+** ret
+*/
+void
+gpr_to_gpr ()
+{
+ register v8qi x0 asm ("x0");
+ register v8qi x1 asm ("x1");
+ asm volatile ("" : "=r" (x1));
+ x0 = x1;
+ asm volatile ("" :: "r" (x0));
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/movv8qi_2.c b/gcc/testsuite/gcc.target/aarch64/movv8qi_2.c
new file mode 100644
index 0000000..0d8576f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movv8qi_2.c
@@ -0,0 +1,27 @@
+/* { dg-do assemble } */
+/* { dg-options "-O --save-temps" } */
+
+#pragma GCC target "+nosimd+fp"
+
+#define TEST_GENERAL(TYPE) \
+ TYPE mov_##TYPE (TYPE a, TYPE b) { return b; } \
+ TYPE zero_##TYPE () { return (TYPE) {}; } \
+ TYPE load_##TYPE (TYPE *ptr) { return *ptr; } \
+ void store_##TYPE (TYPE *ptr, TYPE a) { *ptr = a; }
+
+TEST_GENERAL (__Int8x8_t)
+TEST_GENERAL (__Int16x4_t)
+TEST_GENERAL (__Int32x2_t)
+TEST_GENERAL (__Int64x1_t)
+TEST_GENERAL (__Bfloat16x4_t)
+TEST_GENERAL (__Float16x4_t)
+TEST_GENERAL (__Float32x2_t)
+TEST_GENERAL (__Float64x1_t)
+
+__Int8x8_t const_s8x8 () { return (__Int8x8_t) { 1, 1, 1, 1, 1, 1, 1, 1 }; }
+__Int16x4_t const_s16x4 () { return (__Int16x4_t) { 1, 0, 1, 0 }; }
+__Int32x2_t const_s32x2 () { return (__Int32x2_t) { 1, 2 }; }
+__Int64x1_t const_s64x1 () { return (__Int64x1_t) { 100 }; }
+__Float16x4_t const_f16x4 () { return (__Float16x4_t) { 2, 2, 2, 2 }; }
+__Float32x2_t const_f32x2 () { return (__Float32x2_t) { 1, 2 }; }
+__Float64x1_t const_f64x1 () { return (__Float64x1_t) { 32 }; }
diff --git a/gcc/testsuite/gcc.target/aarch64/movv8qi_3.c b/gcc/testsuite/gcc.target/aarch64/movv8qi_3.c
new file mode 100644
index 0000000..1caa1a7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movv8qi_3.c
@@ -0,0 +1,30 @@
+/* { dg-do assemble } */
+/* { dg-options "-O --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#pragma GCC target "+nosimd+fp"
+
+#define TEST_VECTOR(TYPE) \
+ TYPE \
+ test_##TYPE (void) \
+ { \
+ typedef TYPE v __attribute__((aligned(1))); \
+ register v *ptr asm ("x0"); \
+ asm volatile ("" : "=r" (ptr)); \
+ return *ptr; \
+ }
+
+TEST_VECTOR (__Int8x8_t)
+TEST_VECTOR (__Int16x4_t)
+TEST_VECTOR (__Int32x2_t)
+TEST_VECTOR (__Int64x1_t)
+TEST_VECTOR (__Bfloat16x4_t)
+TEST_VECTOR (__Float16x4_t)
+TEST_VECTOR (__Float32x2_t)
+TEST_VECTOR (__Float64x1_t)
+
+/*
+** test___Int8x8_t:
+** ldr d0, \[x0\]
+** ret
+*/
diff --git a/gcc/testsuite/gcc.target/aarch64/nofp_2.c b/gcc/testsuite/gcc.target/aarch64/nofp_2.c
new file mode 100644
index 0000000..8a262cc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/nofp_2.c
@@ -0,0 +1,19 @@
+/* { dg-options "" } */
+
+#pragma GCC target "+nothing+nofp"
+
+void
+test (void)
+{
+ register int q0 asm ("q0"); // { dg-error "not general enough" }
+ register int q1 asm ("q1"); // { dg-error "not general enough" }
+ asm volatile ("" : "=w" (q0));
+ q1 = q0;
+ asm volatile ("" :: "w" (q1));
+}
+
+void
+ok (void)
+{
+ asm volatile ("" ::: "q0");
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/spellcheck_10.c b/gcc/testsuite/gcc.target/aarch64/spellcheck_10.c
new file mode 100644
index 0000000..08540c9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/spellcheck_10.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-march=*" } { "" } } */
+/* { dg-skip-if "" { *-*-* } { "-mcpu=*" } { "" } } */
+/* { dg-options "-march=neoverse-n1" } */
+
+void
+foo ()
+{
+}
+
+/* { dg-error "unknown value .neoverse-n1. for .-march." "" { target *-*-* } 0 } */
+/* { dg-message "valid arguments are: \[^\n\r]*" "" { target *-*-* } 0 } */
+/* { dg-message "did you mean .-mcpu=neoverse-n1.?" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_1.c
index 285751e..9db9535 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_1.c
@@ -12,7 +12,7 @@ f (svuint8_t sve_u1, svint8_t sve_s1,
/* Initialization. */
svuint8_t init_sve_u1 = 0; /* { dg-error {incompatible types when initializing type 'svuint8_t' using type 'int'} } */
- svuint8_t init_sve_u2 = {}; /* { dg-error {empty scalar initializer} } */
+ svuint8_t init_sve_u2 = {};
svuint8_t init_sve_u3 = { sve_u1 };
svuint8_t init_sve_u4 = { gnu_u1 };
svuint8_t init_sve_u5 = { sve_s1 }; /* { dg-error {incompatible types when initializing type 'svuint8_t' using type 'svint8_t'} } */
@@ -31,7 +31,7 @@ f (svuint8_t sve_u1, svint8_t sve_s1,
/* Compound literals. */
- (svuint8_t) {}; /* { dg-error {empty scalar initializer} } */
+ (svuint8_t) {};
(svuint8_t) { 0 }; /* { dg-error {incompatible types when initializing type 'svuint8_t' using type 'int'} } */
(svuint8_t) { sve_u1 };
(svuint8_t) { gnu_u1 };
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_2.c
index 306fd47..c05b164 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_2.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_2.c
@@ -12,7 +12,7 @@ f (svuint8_t sve_u1, svint8_t sve_s1,
/* Initialization. */
svuint8_t init_sve_u1 = 0; /* { dg-error {incompatible types when initializing type 'svuint8_t' using type 'int'} } */
- svuint8_t init_sve_u2 = {}; /* { dg-error {empty scalar initializer} } */
+ svuint8_t init_sve_u2 = {};
svuint8_t init_sve_u3 = { sve_u1 };
svuint8_t init_sve_u4 = { gnu_u1 };
svuint8_t init_sve_u5 = { sve_s1 };
@@ -31,7 +31,7 @@ f (svuint8_t sve_u1, svint8_t sve_s1,
/* Compound literals. */
- (svuint8_t) {}; /* { dg-error {empty scalar initializer} } */
+ (svuint8_t) {};
(svuint8_t) { 0 }; /* { dg-error {incompatible types when initializing type 'svuint8_t' using type 'int'} } */
(svuint8_t) { sve_u1 };
(svuint8_t) { gnu_u1 };
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-1.c
index 7fc51e7..4b34a71 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-1.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-1.c
@@ -66,14 +66,14 @@ statements (int n)
svint8_t init_sve_sc1 = sve_sc1;
svint8_t init_sve_sc2 = sve_sh1; /* { dg-error {incompatible types when initializing type 'svint8_t' using type 'svint16_t'} } */
- svint8_t init_sve_sc3 = {}; /* { dg-error {empty scalar initializer} } */
+ svint8_t init_sve_sc3 = {};
int initi_a = sve_sc1; /* { dg-error {incompatible types when initializing type 'int' using type 'svint8_t'} } */
int initi_b = { sve_sc1 }; /* { dg-error {incompatible types when initializing type 'int' using type 'svint8_t'} } */
/* Compound literals. */
- (svint8_t) {}; /* { dg-error {empty scalar initializer} } */
+ (svint8_t) {};
(svint8_t) { sve_sc1 };
(int) { sve_sc1 }; /* { dg-error {incompatible types when initializing type 'int' using type 'svint8_t'} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c
index c575492..34dfd59 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c
@@ -66,14 +66,14 @@ statements (int n)
svint8_t init_sve_sc1 = sve_sc1;
svint8_t init_sve_sc2 = sve_sh1; /* { dg-error {incompatible types when initializing type 'svint8_t' using type 'svint16_t'} } */
- svint8_t init_sve_sc3 = {}; /* { dg-error {empty scalar initializer} } */
+ svint8_t init_sve_sc3 = {};
int initi_a = sve_sc1; /* { dg-error {incompatible types when initializing type 'int' using type 'svint8_t'} } */
int initi_b = { sve_sc1 }; /* { dg-error {incompatible types when initializing type 'int' using type 'svint8_t'} } */
/* Compound literals. */
- (svint8_t) {}; /* { dg-error {empty scalar initializer} } */
+ (svint8_t) {};
(svint8_t) { sve_sc1 };
(int) { sve_sc1 }; /* { dg-error {incompatible types when initializing type 'int' using type 'svint8_t'} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr106524.c b/gcc/testsuite/gcc.target/aarch64/sve/pr106524.c
new file mode 100644
index 0000000..a9f650f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr106524.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-march=armv8-a+sve -O2 -fno-move-loop-invariants" } */
+
+void
+test__zero (int *restrict dest, int *restrict src, float *a, int count)
+{
+ int i;
+
+ for (i = 0; i < count; ++i)
+ dest[i] = !__builtin_isunordered (a[i], 0) ? src[i] : 0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/slp_15.c b/gcc/testsuite/gcc.target/aarch64/sve/slp_15.c
new file mode 100644
index 0000000..23f6d56
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/slp_15.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+
+struct foo
+{
+ void *handle;
+ void *arg;
+};
+
+void
+dlinfo_doit (struct foo *args)
+{
+ __UINTPTR_TYPE__ **l = args->handle;
+
+ *(__UINTPTR_TYPE__ *) args->arg = 0;
+ *(__UINTPTR_TYPE__ *) args->arg = **l;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/vect_unary_2.c b/gcc/testsuite/gcc.target/aarch64/vect_unary_2.c
new file mode 100644
index 0000000..454ac27
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/vect_unary_2.c
@@ -0,0 +1,5 @@
+/* { dg-options "-O3 -fno-math-errno --save-temps" } */
+
+#pragma GCC target "+nosimd+fp"
+
+#include "vect_unary_1.c"
diff --git a/gcc/testsuite/gcc.target/bpf/constant-calls.c b/gcc/testsuite/gcc.target/bpf/constant-calls-1.c
index 84612a9..6effc7d 100644
--- a/gcc/testsuite/gcc.target/bpf/constant-calls.c
+++ b/gcc/testsuite/gcc.target/bpf/constant-calls-1.c
@@ -1,5 +1,4 @@
/* { dg-do compile } */
-/* { dg-xfail-if "" { bpf-*-* } } */
typedef void *(*T)(void);
f1 ()
diff --git a/gcc/testsuite/gcc.target/bpf/constant-calls-2.c b/gcc/testsuite/gcc.target/bpf/constant-calls-2.c
new file mode 100644
index 0000000..836ab67
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/constant-calls-2.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c89 -O2" } */
+
+static void * (*bpf_map_lookup_elem)(void *map, const void *key) = (void *) 666;
+
+int foo ()
+{
+ char *ret;
+
+ ret = bpf_map_lookup_elem (ret, ret);
+ if (ret)
+ return 0;
+ return 1;
+}
+
+/* { dg-final { scan-assembler "call\t666" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/core-pr106745.c b/gcc/testsuite/gcc.target/bpf/core-pr106745.c
new file mode 100644
index 0000000..9d34700
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-pr106745.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -gbtf -dA -mco-re" } */
+
+struct weird
+{
+ struct
+ {
+ int b;
+ };
+
+ char x;
+
+ union
+ {
+ int a;
+ int c;
+ };
+};
+
+
+int test (struct weird *arg) {
+ int *x = __builtin_preserve_access_index (&arg->b);
+ int *y = __builtin_preserve_access_index (&arg->c);
+
+ return *x + *y;
+}
+
+
+/* { dg-final { scan-assembler-times "ascii \"0:0:0.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"0:2:1.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/addr-space-typeck-1.c b/gcc/testsuite/gcc.target/i386/addr-space-typeck-1.c
new file mode 100644
index 0000000..84d27b0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/addr-space-typeck-1.c
@@ -0,0 +1,22 @@
+/* { dg-options "-std=gnu90" } */
+
+void *
+test_gs_to_generic (void __seg_gs *p)
+{
+ return p; /* { dg-error "return from pointer to non-enclosed address space" "error" } */
+ /* { dg-message "expected 'void \\*' but pointer is of type '__seg_gs void \\*'" "note" { target *-*-* } .-1 } */
+}
+
+void __seg_gs *
+test_generic_to_gs (void *q)
+{
+ return q; /* { dg-error "return from pointer to non-enclosed address space" "error" } */
+ /* { dg-message "expected '__seg_gs void \\*' but pointer is of type 'void \\*'" "note" { target *-*-* } .-1 } */
+}
+
+extern void use_double_deref (char __seg_gs **buffer);
+
+void test_double_deref (char __seg_gs *buf)
+{
+ use_double_deref (&buf);
+}
diff --git a/gcc/testsuite/gcc.target/i386/addr-space-typeck-2.c b/gcc/testsuite/gcc.target/i386/addr-space-typeck-2.c
new file mode 100644
index 0000000..d9fb9a7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/addr-space-typeck-2.c
@@ -0,0 +1,25 @@
+/* Tests of C frontend's address space type-checking. */
+/* { dg-options "-std=gnu90 -fdiagnostics-show-caret" } */
+
+/* Verify that we emit helpful diagnostics at a mismatching address space
+ at a function call, and that the underlined locations are correct. */
+
+extern void expects_seg_gs (int i, void __seg_gs *param, int j); /* { dg-line "decl_line" } */
+
+void
+test_bad_call (void *ptr)
+{
+ expects_seg_gs (0, ptr, 1); /* { dg-line "err_line" } */
+}
+
+/* { dg-error "passing argument 2 of 'expects_seg_gs' from pointer to non-enclosed address space" "" { target *-*-* } err_line } */
+/* { dg-begin-multiline-output "" }
+ expects_seg_gs (0, ptr, 1);
+ ^~~
+ { dg-end-multiline-output "" } */
+
+/* { dg-message "expected '__seg_gs void \\*' but argument is of type 'void \\*'" "" { target *-*-* } decl_line } */
+/* { dg-begin-multiline-output "" }
+ extern void expects_seg_gs (int i, void __seg_gs *param, int j);
+ ~~~~~~~~~~~~~~~^~~~~
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.target/i386/avx2-dest-false-dep-for-glc.c b/gcc/testsuite/gcc.target/i386/avx2-dest-false-dep-for-glc.c
index 787b1d0..fe331fe 100644
--- a/gcc/testsuite/gcc.target/i386/avx2-dest-false-dep-for-glc.c
+++ b/gcc/testsuite/gcc.target/i386/avx2-dest-false-dep-for-glc.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-mavx2 -mtune=generic -mtune-ctrl=dest_false_dep_for_glc -O2" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx512bf16-cvtsbh2ss-1.c b/gcc/testsuite/gcc.target/i386/avx512bf16-cvtsbh2ss-1.c
index bf29a69..831abd3 100644
--- a/gcc/testsuite/gcc.target/i386/avx512bf16-cvtsbh2ss-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512bf16-cvtsbh2ss-1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-mavx512bf16 -O2" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* { dg-final { scan-assembler-times "sall\[ \\t\]+\[^\{\n\]*16" 1 } } */
/* { dg-final { scan-assembler-times "movl" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-1.c b/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-1.c
index a2664d8..0fa93e0 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-1.c
@@ -1,6 +1,7 @@
/* PR target/87767 */
/* { dg-do compile } */
/* { dg-options "-O2 -mavx512f -mavx512dq" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* { dg-additional-options "-mdynamic-no-pic" { target { *-*-darwin* && ia32 } } }
/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to8\\\}" 2 { target { ! ia32 } } } } */
/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to8\\\}" 5 { target ia32 } } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-3.c b/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-3.c
index e57a568..b1a75f2 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-3.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-3.c
@@ -1,6 +1,7 @@
/* PR target/87767 */
/* { dg-do compile } */
/* { dg-options "-O2 -mavx512f" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* { dg-additional-options "-mdynamic-no-pic" { target { *-*-darwin* && ia32 } } }
/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to8\\\}" 4 } } */
/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to16\\\}" 4 } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-5.c b/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-5.c
index 477f9ca..f1b672a 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-5.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-5.c
@@ -1,6 +1,7 @@
/* PR target/87767 */
/* { dg-do compile } */
/* { dg-options "-O2 -mavx512f" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* { dg-additional-options "-mdynamic-no-pic" { target { *-*-darwin* && ia32 } } }
/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to8\\\}" 4 { target ia32 } } } */
/* { dg-final { scan-assembler-times "vpbroadcastd\[\\t \]+%(?:r|e)\[^\n\]*, %zmm\[0-9\]+" 4 } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-7.c b/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-7.c
index 194d888..1f141d0 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-7.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-broadcast-pr87767-7.c
@@ -1,6 +1,7 @@
/* PR target/87767 */
/* { dg-do compile } */
/* { dg-options "-O2 -mavx512f -mavx512vl" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* { dg-additional-options "-mdynamic-no-pic" { target { *-*-darwin* && ia32 } } }
/* { dg-final { scan-assembler-times "vadd\[^\n\]*\\\{1to2\\\}" 1 } } */
/* { dg-final { scan-assembler-times "vadd\[^\n\]*\\\{1to4\\\}" 2 } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vcvtps2ph-sae.c b/gcc/testsuite/gcc.target/i386/avx512f-vcvtps2ph-sae.c
new file mode 100644
index 0000000..e0714d4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vcvtps2ph-sae.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512f" } */
+/* { dg-final { scan-assembler-times "vcvtps2ph\[ \\t\]+\[^\{\n\]*\{sae\}\[^\{\n\]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtps2ph\[ \\t\]+\[^\{\n\]*\{sae\}\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtps2ph\[ \\t\]+\[^\{\n\]*\{sae\}\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m512 x;
+volatile __m256i y;
+
+void extern
+avx512f_test (void)
+{
+ y = _mm512_cvtps_ph (x, 8);
+ y = _mm512_maskz_cvtps_ph (4, x, 9);
+ y = _mm512_mask_cvtps_ph (y, 2, x, 10);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-broadcast-1.c b/gcc/testsuite/gcc.target/i386/avx512fp16-broadcast-1.c
index 3e2397f..1e9b8f3 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16-broadcast-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-broadcast-1.c
@@ -1,6 +1,7 @@
/* PR target/87767 */
/* { dg-do compile } */
/* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* { dg-additional-options "-mdynamic-no-pic" { target { *-*-darwin* && ia32 } } }
/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to8\\\}" 4 } } */
/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to16\\\}" 4 } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-pr101846.c b/gcc/testsuite/gcc.target/i386/avx512fp16-pr101846.c
index abd9156..01571d2 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16-pr101846.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-pr101846.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-mavx512fp16 -mavx512vl -O2" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* { dg-final { scan-assembler-times "vpmovzxwd" "3" } } */
/* { dg-final { scan-assembler-times "vpmovdw" "3" } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2si-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2si-1a.c
index f29c953..7200f29 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2si-1a.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2si-1a.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-mavx512fp16 -O2" } */
-/* { dg-final { scan-assembler-times "vcvtsh2si\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%eax" 1 } } */
-/* { dg-final { scan-assembler-times "vcvtsh2si\[ \\t\]+\{rn-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%eax" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsh2si\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%e\[ad]x" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsh2si\[ \\t\]+\{rn-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%e\[ad]x" 1 } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2usi-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2usi-1a.c
index 7d00867..0d00803 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2usi-1a.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2usi-1a.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-mavx512fp16 -O2" } */
-/* { dg-final { scan-assembler-times "vcvtsh2usi\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%eax" 1 } } */
-/* { dg-final { scan-assembler-times "vcvtsh2usi\[ \\t\]+\{rn-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%eax" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsh2usi\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%e\[ad]x" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsh2usi\[ \\t\]+\{rn-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%e\[ad]x" 1 } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vcvttsh2si-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvttsh2si-1a.c
index 80d84fc..4fb0684 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16-vcvttsh2si-1a.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvttsh2si-1a.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-mavx512fp16 -O2" } */
-/* { dg-final { scan-assembler-times "vcvttsh2si\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%eax" 1 } } */
-/* { dg-final { scan-assembler-times "vcvttsh2si\[ \\t\]+\{sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%eax" 1 } } */
+/* { dg-final { scan-assembler-times "vcvttsh2si\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%e\[ad]x" 1 } } */
+/* { dg-final { scan-assembler-times "vcvttsh2si\[ \\t\]+\{sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%e\[ad]x" 1 } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vcvttsh2usi-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvttsh2usi-1a.c
index 5956457..3d408f1 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16-vcvttsh2usi-1a.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvttsh2usi-1a.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-mavx512fp16 -O2" } */
-/* { dg-final { scan-assembler-times "vcvttsh2usi\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%eax" 1 } } */
-/* { dg-final { scan-assembler-times "vcvttsh2usi\[ \\t\]+\{sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%eax" 1 } } */
+/* { dg-final { scan-assembler-times "vcvttsh2usi\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%e\[ad]x" 1 } } */
+/* { dg-final { scan-assembler-times "vcvttsh2usi\[ \\t\]+\{sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%e\[ad]x" 1 } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vmovsh-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vmovsh-1a.c
index e35be10..ba10096 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16-vmovsh-1a.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vmovsh-1a.c
@@ -1,8 +1,8 @@
/* { dg-do compile } */
/* { dg-options "-mavx512fp16 -O2" } */
-/* { dg-final { scan-assembler-times "vmovsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r\]*%\[er\]ax+\[^\n\r]*\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vmovsh\[ \\t\]+\[^\n\r\]*%\[er\]ax+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vmovsh\[ \\t\]+\[^\n\r\]*%\[er\]ax+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmovsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r\]*%\[er\]\[ad]x+\[^\n\r]*\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmovsh\[ \\t\]+\[^\n\r\]*%\[er\]\[ad]x+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmovsh\[ \\t\]+\[^\n\r\]*%\[er\]\[ad]x+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vmovsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vmovsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\[^z\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vmovsh\[ \\t\]+%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-1.c
index f8eb99f..0304b9d 100644
--- a/gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-1.c
@@ -1,6 +1,7 @@
/* PR target/87767 */
/* { dg-do compile } */
/* { dg-options "-O2 -mavx512f -mavx512vl -mavx512dq" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* { dg-additional-options "-mdynamic-no-pic" { target { *-*-darwin* && ia32 } } }
/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to2\\\}" 2 { target { ! ia32 } } } } */
/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to4\\\}" 4 { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-3.c b/gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-3.c
index 3b27def..8ad8fd7 100644
--- a/gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-3.c
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-3.c
@@ -1,6 +1,7 @@
/* PR target/87767 */
/* { dg-do compile } */
/* { dg-options "-O2 -mavx512f -mavx512vl" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* { dg-additional-options "-mdynamic-no-pic" { target { *-*-darwin* && ia32 } } }
/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to2\\\}" 4 } } */
/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to4\\\}" 8 } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-5.c b/gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-5.c
index 32f6ac8..0ba0cd9 100644
--- a/gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-5.c
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-broadcast-pr87767-5.c
@@ -1,6 +1,7 @@
/* PR target/87767 */
/* { dg-do compile } */
/* { dg-options "-O2 -mavx512f -mavx512vl" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* { dg-additional-options "-mdynamic-no-pic" { target { *-*-darwin* && ia32 } } }
/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to2\\\}" 4 { target ia32 } } } */
/* { dg-final { scan-assembler-times "\[^\n\]*\\\{1to4\\\}" 4 { target ia32 } } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-pr106721.c b/gcc/testsuite/gcc.target/i386/avx512vl-pr106721.c
new file mode 100644
index 0000000..8248d14
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-pr106721.c
@@ -0,0 +1,19 @@
+/* PR target/106721 */
+/* { dg-do assemble { target avx512vl } } */
+/* { dg-options "-O3 -mavx512vl" } */
+
+typedef __bf16 __m256bf16 __attribute__((__vector_size__(32)));
+void (*bar) (__m256bf16, __m256bf16, __m256bf16);
+__m256bf16 a;
+volatile __bf16 b, c, d, e, f, g, h;
+
+void
+foo (void)
+{
+ __m256bf16 x[8];
+ int i;
+ for (i = 0; i < 8; i++)
+ x[i] = (__m256bf16) { b, c, d, e, f, g, h };
+ a = x[6];
+ bar (x[0], x[6], x[7]);
+}
diff --git a/gcc/testsuite/gcc.target/i386/bfloat16-1.c b/gcc/testsuite/gcc.target/i386/bfloat16-1.c
new file mode 100644
index 0000000..6aaec28
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/bfloat16-1.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-msse2 -O2" } */
+__bf16
+foo (int a)
+{
+ union {
+ int a;
+ __bf16 b;
+ }c;
+ c.a = a;
+ return c.b;
+}
diff --git a/gcc/testsuite/gcc.target/i386/builtin-issignaling-1.c b/gcc/testsuite/gcc.target/i386/builtin-issignaling-1.c
new file mode 100644
index 0000000..8f170c4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/builtin-issignaling-1.c
@@ -0,0 +1,80 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fsignaling-nans" } */
+
+#if __LDBL_MANT_DIG__ == 64
+union U { struct { unsigned long long m; unsigned short e; } p; long double l; };
+union U zero = { { 0, 0 } };
+union U mzero = { { 0, 0x8000 } };
+union U denorm = { { 42, 0 } };
+union U mdenorm = { { 42, 0x8000 } };
+union U pseudodenorm = { { 0x8000000000000000ULL, 0 } };
+union U mpseudodenorm = { { 0x8000000000000000ULL, 0x8000 } };
+union U pseudodenorm1 = { { 0x8000000000000042ULL, 0 } };
+union U mpseudodenorm1 = { { 0x8000000000000042ULL, 0x8000 } };
+union U pseudoinf = { { 0, 0x7fff } };
+union U mpseudoinf = { { 0, 0xffff } };
+union U pseudonan = { { 42, 0x7fff } };
+union U mpseudonan = { { 42, 0xffff } };
+union U pseudonan1 = { { 0x4000000000000000ULL, 0x7fff } };
+union U mpseudonan1 = { { 0x4000000000000000ULL, 0xffff } };
+union U pseudonan2 = { { 0x4000000000000042ULL, 0x7fff } };
+union U mpseudonan2 = { { 0x4000000000000042ULL, 0xffff } };
+union U inf = { { 0x8000000000000000ULL, 0x7fff } };
+union U minf = { { 0x8000000000000000ULL, 0xffff } };
+union U snan = { { 0x8000000000000042ULL, 0x7fff } };
+union U msnan = { { 0x8000000000000042ULL, 0xffff } };
+union U indefinite = { { 0xc000000000000000ULL, 0x7fff } };
+union U mindefinite = { { 0xc000000000000000ULL, 0xffff } };
+union U qnan = { { 0xc000000000000042ULL, 0x7fff } };
+union U mqnan = { { 0xc000000000000042ULL, 0xffff } };
+union U unnormal = { { 0, 0x42 } };
+union U munnormal = { { 0, 0x8042 } };
+union U unnormal1 = { { 42, 0x42 } };
+union U munnormal1 = { { 42, 0x8042 } };
+union U normal = { { 0x8000000000000000ULL, 0x42 } };
+union U mnormal = { { 0x8000000000000000ULL, 0x8042 } };
+union U normal1 = { { 0x8000000000000042ULL, 0x42 } };
+union U mnormal1 = { { 0x8000000000000042ULL, 0x8042 } };
+#endif
+
+int
+main ()
+{
+#if __LDBL_MANT_DIG__ == 64
+ asm volatile ("" : : : "memory");
+ if (__builtin_issignaling (zero.l)
+ || __builtin_issignaling (mzero.l)
+ || __builtin_issignaling (denorm.l)
+ || __builtin_issignaling (mdenorm.l)
+ || __builtin_issignaling (pseudodenorm.l)
+ || __builtin_issignaling (mpseudodenorm.l)
+ || __builtin_issignaling (pseudodenorm1.l)
+ || __builtin_issignaling (mpseudodenorm1.l)
+ || !__builtin_issignaling (pseudoinf.l)
+ || !__builtin_issignaling (mpseudoinf.l)
+ || !__builtin_issignaling (pseudonan.l)
+ || !__builtin_issignaling (mpseudonan.l)
+ || !__builtin_issignaling (pseudonan1.l)
+ || !__builtin_issignaling (mpseudonan1.l)
+ || !__builtin_issignaling (pseudonan2.l)
+ || !__builtin_issignaling (mpseudonan2.l)
+ || __builtin_issignaling (inf.l)
+ || __builtin_issignaling (minf.l)
+ || !__builtin_issignaling (snan.l)
+ || !__builtin_issignaling (msnan.l)
+ || __builtin_issignaling (indefinite.l)
+ || __builtin_issignaling (mindefinite.l)
+ || __builtin_issignaling (qnan.l)
+ || __builtin_issignaling (mqnan.l)
+ || !__builtin_issignaling (unnormal.l)
+ || !__builtin_issignaling (munnormal.l)
+ || !__builtin_issignaling (unnormal1.l)
+ || !__builtin_issignaling (munnormal1.l)
+ || __builtin_issignaling (normal.l)
+ || __builtin_issignaling (mnormal.l)
+ || __builtin_issignaling (normal1.l)
+ || __builtin_issignaling (mnormal1.l))
+ __builtin_abort ();
+#endif
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/cet-sjlj-6a.c b/gcc/testsuite/gcc.target/i386/cet-sjlj-6a.c
index c3d0eb9..6cc88ad 100644
--- a/gcc/testsuite/gcc.target/i386/cet-sjlj-6a.c
+++ b/gcc/testsuite/gcc.target/i386/cet-sjlj-6a.c
@@ -2,10 +2,8 @@
/* { dg-require-effective-target maybe_x32 } */
/* { dg-options "-O -maddress-mode=short -fcf-protection -mx32" } */
/* { dg-final { scan-assembler-times "endbr64" 2 } } */
-/* { dg-final { scan-assembler-times "movq\t\[^\n\]*buf\\+8" 1 { target nonpic } } } */
-/* { dg-final { scan-assembler-times "movq\t\[^\n\]*8\\+buf" 1 { target { ! nonpic } } } } */
-/* { dg-final { scan-assembler-times "subq\tbuf\\+8" 1 { target nonpic } } } */
-/* { dg-final { scan-assembler-times "subq\t8\\+buf" 1 { target { ! nonpic } } } } */
+/* { dg-final { scan-assembler-times "movq\t\[^\n\]*(?:8\\+buf|buf\\+8)" 1 } } */
+/* { dg-final { scan-assembler-times "subq\t(?:8\\+buf|buf\\+8)" 1 } } */
/* { dg-final { scan-assembler-times "shrl\t\\\$3," 1 } } */
/* { dg-final { scan-assembler-times "rdsspq" 2 } } */
/* { dg-final { scan-assembler-times "incsspq" 2 } } */
diff --git a/gcc/testsuite/gcc.target/i386/cet-sjlj-6b.c b/gcc/testsuite/gcc.target/i386/cet-sjlj-6b.c
index 4c52685..b80acfd 100644
--- a/gcc/testsuite/gcc.target/i386/cet-sjlj-6b.c
+++ b/gcc/testsuite/gcc.target/i386/cet-sjlj-6b.c
@@ -2,10 +2,8 @@
/* { dg-require-effective-target maybe_x32 } */
/* { dg-options "-O -maddress-mode=long -fcf-protection -mx32" } */
/* { dg-final { scan-assembler-times "endbr64" 2 } } */
-/* { dg-final { scan-assembler-times "movq\t\[^\n\]*buf\\+16" 1 { target nonpic } } } */
-/* { dg-final { scan-assembler-times "movq\t\[^\n\]*16\\+buf" 1 { target { ! nonpic } } } } */
-/* { dg-final { scan-assembler-times "subq\tbuf\\+16" 1 { target nonpic } } } */
-/* { dg-final { scan-assembler-times "subq\t16\\+buf" 1 { target { ! nonpic } } } } */
+/* { dg-final { scan-assembler-times "movq\t\[^\n\]*(?:16\\+buf|buf\\+16)" 1 } } */
+/* { dg-final { scan-assembler-times "subq\t(?:16\\+buf|buf\\+16)" 1 } } */
/* { dg-final { scan-assembler-times "shrl\t\\\$3," 1 } } */
/* { dg-final { scan-assembler-times "rdsspq" 2 } } */
/* { dg-final { scan-assembler-times "incsspq" 2 } } */
diff --git a/gcc/testsuite/gcc.target/i386/cmpti1.c b/gcc/testsuite/gcc.target/i386/cmpti1.c
new file mode 100644
index 0000000..1c5f121
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cmpti1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O2" } */
+int eq(__int128 x, __int128 y) { return x == y; }
+int ne(__int128 x, __int128 y) { return x != y; }
+/* { dg-final { scan-assembler-times "xorq" 4 } } */
+/* { dg-final { scan-assembler-times "setne" 1 } } */
+/* { dg-final { scan-assembler-times "sete" 1 } } */
+
diff --git a/gcc/testsuite/gcc.target/i386/cmpti2.c b/gcc/testsuite/gcc.target/i386/cmpti2.c
new file mode 100644
index 0000000..ba7dd72
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cmpti2.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O2 -mno-stv" } */
+
+__int128 x;
+__int128 y;
+
+int eq() { return x == y; }
+int ne() { return x != y; }
+
+/* { dg-final { scan-assembler-times "xorq" 4 } } */
+/* { dg-final { scan-assembler-times "setne" 1 } } */
+/* { dg-final { scan-assembler-times "sete" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/cmpti3.c b/gcc/testsuite/gcc.target/i386/cmpti3.c
new file mode 100644
index 0000000..302efd2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cmpti3.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O2" } */
+
+__int128 x;
+int foo()
+{
+ __int128 t = 0x1234567890abcdefLL;
+ return x == t;
+}
+
+/* { dg-final { scan-assembler-times "movabsq" 1 } } */
+/* { dg-final { scan-assembler-times "xorq" 1 } } */
+/* { dg-final { scan-assembler-not "xorl" } } */
diff --git a/gcc/testsuite/gcc.target/i386/interrupt-11.c b/gcc/testsuite/gcc.target/i386/interrupt-11.c
index ded589e..4a119b9 100644
--- a/gcc/testsuite/gcc.target/i386/interrupt-11.c
+++ b/gcc/testsuite/gcc.target/i386/interrupt-11.c
@@ -15,7 +15,7 @@ foo (void *frame)
/* { dg-final { scan-assembler-not "kmov.\[\\t \]*\[0-9\]*\\(%\[re\]?sp\\),\[\\t \]*%k\[0-7\]+" } } */
/* { dg-final { scan-assembler-not "pushq\[\\t \]*%rbx" { target { ! ia32 } } } } */
/* { dg-final { scan-assembler-not "pushq\[\\t \]*%r1\[2-5\]+" { target { ! ia32 } } } } */
-/* { dg-final { scan-assembler-not "pushl\[\\t \]*%ebx" { target ia32 } } } */
+/* { dg-final { scan-assembler-not "pushl\[\\t \]*%ebx" { target { ia32 && nonpic } } } } */
/* { dg-final { scan-assembler-not "pushl\[\\t \]*%edi" { target ia32 } } } */
/* { dg-final { scan-assembler-not "pushl\[\\t \]*%esi" { target ia32 } } } */
/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:e|r)ax" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/interrupt-12.c b/gcc/testsuite/gcc.target/i386/interrupt-12.c
index 078bbcf..4e91a27 100644
--- a/gcc/testsuite/gcc.target/i386/interrupt-12.c
+++ b/gcc/testsuite/gcc.target/i386/interrupt-12.c
@@ -12,7 +12,8 @@ fn1 (void *frame, uword_t error)
}
/* { dg-final { scan-assembler-not "movups\[\\t .\]*%(x|y|z)mm\[0-9\]+" } } */
-/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(b|c|d)x" } } */
+/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)bx" { target { nonpic || { ! ia32 } } } } } */
+/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(c|d)x" } } */
/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)si" } } */
/* { dg-final { scan-assembler-not "(push|pop)l\[\\t \]*%edi" { target ia32 } } } */
/* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%rax" { target { { ! ia32 } && nonpic } } } } */
@@ -20,7 +21,8 @@ fn1 (void *frame, uword_t error)
/* { dg-final { scan-assembler-times "pushl\[\\t \]*%ebp" 1 { target ia32 } } } */
/* { dg-final { scan-assembler-times "leave" 1 { target { ia32 && nonpic } } } } */
/* { dg-final { scan-assembler-times "pushl\[\\t \]*%eax" 1 { target ia32 } } } */
-/* { dg-final { scan-assembler-times "movl\[\\t \]*-4\\(%ebp\\),\[\\t \]*%eax" 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]*-4\\(%ebp\\),\[\\t \]*%eax" 1 { target { ia32 && nonpic } } } } */
+/* { dg-final { scan-assembler-times "popl\[\\t \]*%eax" 1 { target { ia32 && { ! nonpic } } } } } */
/* { dg-final { scan-assembler-times "pushq\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */
/* { dg-final { scan-assembler-times "popq\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */
/* { dg-final { scan-assembler "(addl|leal).*4.*%esp" { target ia32 } } } */
diff --git a/gcc/testsuite/gcc.target/i386/interrupt-13.c b/gcc/testsuite/gcc.target/i386/interrupt-13.c
index 77ee3a5..4afd1b0 100644
--- a/gcc/testsuite/gcc.target/i386/interrupt-13.c
+++ b/gcc/testsuite/gcc.target/i386/interrupt-13.c
@@ -12,7 +12,8 @@ fn1 (void *frame, uword_t error)
}
/* { dg-final { scan-assembler-not "movups\[\\t .\]*%(x|y|z)mm\[0-9\]+" } } */
-/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(b|c|d)x" } } */
+/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)bx" { target { nonpic || { ! ia32 } } } } } */
+/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(c|d)x" } } */
/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)si" } } */
/* { dg-final { scan-assembler-not "(push|pop)l\[\\t \]*%edi" { target ia32 } } } */
/* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%rax" { target { { ! ia32 } && nonpic } } } } */
@@ -20,7 +21,8 @@ fn1 (void *frame, uword_t error)
/* { dg-final { scan-assembler-times "pushl\[\\t \]*%ebp" 1 { target ia32 } } } */
/* { dg-final { scan-assembler-times "leave" 1 { target { ia32 && nonpic } } } } */
/* { dg-final { scan-assembler-times "pushl\[\\t \]*%eax" 1 { target ia32 } } } */
-/* { dg-final { scan-assembler-times "movl\[\\t \]*-4\\(%ebp\\),\[\\t \]*%eax" 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]*-4\\(%ebp\\),\[\\t \]*%eax" 1 { target { ia32 && nonpic } } } } */
+/* { dg-final { scan-assembler-times "popl\[\\t \]*%eax" 1 { target { ia32 && { ! nonpic } } } } } */
/* { dg-final { scan-assembler-times "pushq\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */
/* { dg-final { scan-assembler-times "popq\[\\t \]*%rdi" 1 { target { ! ia32 } } } } */
/* { dg-final { scan-assembler "(addl|leal).*4.*%esp" { target ia32 } } } */
diff --git a/gcc/testsuite/gcc.target/i386/interrupt-15.c b/gcc/testsuite/gcc.target/i386/interrupt-15.c
index 2a0d260..f43aabc 100644
--- a/gcc/testsuite/gcc.target/i386/interrupt-15.c
+++ b/gcc/testsuite/gcc.target/i386/interrupt-15.c
@@ -19,7 +19,8 @@ fn2 (void *frame, uword_t error)
}
/* { dg-final { scan-assembler-not "movups\[\\t .\]*%(x|y|z)mm\[0-9\]+" } } */
-/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(b|c|d)x" } } */
+/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)ax" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(c|d)x" } } */
/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)si" } } */
/* { dg-final { scan-assembler-not "(push|pop)l\[\\t \]*%edi" { target ia32 } } } */
/* { dg-final { scan-assembler-not "(push|pop)q\[\\t \]*%rax" { target { { ! ia32 } && nonpic } } } } */
@@ -27,7 +28,7 @@ fn2 (void *frame, uword_t error)
/* { dg-final { scan-assembler-times "pushl\[\\t \]*%ebp" 2 { target ia32 } } } */
/* { dg-final { scan-assembler-times "leave" 2 { target { ia32 && nonpic } } } } */
/* { dg-final { scan-assembler-times "pushl\[\\t \]*%eax" 2 { target ia32 } } } */
-/* { dg-final { scan-assembler-times "movl\[\\t \]*-4\\(%ebp\\),\[\\t \]*%eax" 2 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]*-4\\(%ebp\\),\[\\t \]*%eax" 2 { target { ia32 && nonpic } } } } */
/* { dg-final { scan-assembler-times "pushq\[\\t \]*%rdi" 2 { target { ! ia32 } } } } */
/* { dg-final { scan-assembler-times "popq\[\\t \]*%rdi" 2 { target { ! ia32 } } } } */
/* { dg-final { scan-assembler "(addl|leal).*4.*%esp" { target ia32 } } } */
diff --git a/gcc/testsuite/gcc.target/i386/interrupt-16.c b/gcc/testsuite/gcc.target/i386/interrupt-16.c
index bc929c6..cb45ba5 100644
--- a/gcc/testsuite/gcc.target/i386/interrupt-16.c
+++ b/gcc/testsuite/gcc.target/i386/interrupt-16.c
@@ -12,7 +12,8 @@ foo (int i)
/* { dg-final { scan-assembler-not "movups\[\\t \]*%(x|y|z)mm\[0-9\]+,\[\\t \]-*\[0-9\]*\\(%\[re\]?bp\\)" } } */
/* { dg-final { scan-assembler-not "movups\[\\t \]*-\[0-9\]*\\(%\[re\]?bp\\),\[\\t \]*%(x|y|z)mm\[0-9\]+" } } */
-/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(a|b|c|d)x" } } */
+/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)bx" { target { nonpic || { ! ia32 } } } } } */
+/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(a|c|d)x" } } */
/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)si" } } */
/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)bp" } } */
/* { dg-final { scan-assembler-not "(push|pop)l\[\\t \]*%edi" { target ia32 } } } */
diff --git a/gcc/testsuite/gcc.target/i386/interrupt-17.c b/gcc/testsuite/gcc.target/i386/interrupt-17.c
index 5d5b59e..218ed60 100644
--- a/gcc/testsuite/gcc.target/i386/interrupt-17.c
+++ b/gcc/testsuite/gcc.target/i386/interrupt-17.c
@@ -11,7 +11,8 @@ foo (int i)
}
/* { dg-final { scan-assembler-not "movups\[\\t \]*%(x|y|z)mm\[0-9\]+" } } */
-/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(a|b|c|d)x" } } */
+/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)bx" { target { nonpic || { ! ia32 } } } } } */
+/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)(a|c|d)x" } } */
/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)si" } } */
/* { dg-final { scan-assembler-not "(push|pop)(l|q)\[\\t \]*%(r|e)bp" } } */
/* { dg-final { scan-assembler-not "(push|pop)l\[\\t \]*%edi" { target ia32 } } } */
diff --git a/gcc/testsuite/gcc.target/i386/interrupt-8.c b/gcc/testsuite/gcc.target/i386/interrupt-8.c
index 34536d1..039ccd5 100644
--- a/gcc/testsuite/gcc.target/i386/interrupt-8.c
+++ b/gcc/testsuite/gcc.target/i386/interrupt-8.c
@@ -15,7 +15,7 @@ foo (void *frame)
/* { dg-final { scan-assembler-not "kmov.\[\\t \]*\[0-9\]*\\(%\[re\]?sp\\),\[\\t \]*%k\[0-7\]+" } } */
/* { dg-final { scan-assembler-not "pushq\[\\t \]*%rbx" { target { ! ia32 } } } } */
/* { dg-final { scan-assembler-not "pushq\[\\t \]*%r1\[2-5\]+" { target { ! ia32 } } } } */
-/* { dg-final { scan-assembler-not "pushl\[\\t \]*%ebx" { target ia32 } } } */
+/* { dg-final { scan-assembler-not "pushl\[\\t \]*%ebx" { target { ia32 && nonpic } } } } */
/* { dg-final { scan-assembler-not "pushl\[\\t \]*%e(s|d)i" { target ia32 } } } */
/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:e|r)ax" 1 } } */
/* { dg-final { scan-assembler-times "push(?:l|q)\[\\t \]*%(?:e|r)cx" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pad-10.c b/gcc/testsuite/gcc.target/i386/pad-10.c
index 3d003a8..ac015f2 100644
--- a/gcc/testsuite/gcc.target/i386/pad-10.c
+++ b/gcc/testsuite/gcc.target/i386/pad-10.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-skip-if "" { *-*-* } { "-march=*" } { "-march=atom" } } */
/* { dg-options "-O2 -fomit-frame-pointer -march=atom" } */
-/* { dg-final { scan-assembler-not "nop" } } */
+/* { dg-final { scan-assembler-not "nop" { target { nonpic || { ! ia32 } } } } } */
/* { dg-final { scan-assembler-not "rep" } } */
extern void bar ();
diff --git a/gcc/testsuite/gcc.target/i386/pr100704-3.c b/gcc/testsuite/gcc.target/i386/pr100704-3.c
index 65f9745..6f7a3e5 100644
--- a/gcc/testsuite/gcc.target/i386/pr100704-3.c
+++ b/gcc/testsuite/gcc.target/i386/pr100704-3.c
@@ -17,4 +17,6 @@ foo (void)
bar (1, 2, 3, 4, 5, 6, foooo[0]);
}
-/* { dg-final { scan-assembler "push\[lq\]\tfoooo\+" } } */
+/* { dg-final { scan-assembler "push\[lq\]\tfoooo\+" { target { nonpic || { ! ia32 } } } } }*/
+/* { dg-final { scan-assembler "movl\tfoooo@GOT\\(%ebx\\), %eax" { target { ia32 && { ! nonpic } } } } } */
+/* { dg-final { scan-assembler-times "pushl\t(?:|4|8|12)\\(%eax\\)" 4 { target { ia32 && { ! nonpic } } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-2.c b/gcc/testsuite/gcc.target/i386/pr100865-2.c
index f3ea775..090a010 100644
--- a/gcc/testsuite/gcc.target/i386/pr100865-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr100865-2.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -march=skylake" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
extern char *dst;
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-3.c b/gcc/testsuite/gcc.target/i386/pr100865-3.c
index 714c43e..cde4b1c 100644
--- a/gcc/testsuite/gcc.target/i386/pr100865-3.c
+++ b/gcc/testsuite/gcc.target/i386/pr100865-3.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -march=skylake-avx512" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
extern char *dst;
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-4a.c b/gcc/testsuite/gcc.target/i386/pr100865-4a.c
index 8609d11..bd99945 100644
--- a/gcc/testsuite/gcc.target/i386/pr100865-4a.c
+++ b/gcc/testsuite/gcc.target/i386/pr100865-4a.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -march=skylake -mtune-ctrl=avx256_store_by_pieces" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
extern char array[64];
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-4b.c b/gcc/testsuite/gcc.target/i386/pr100865-4b.c
index 6d9cb91..1814306 100644
--- a/gcc/testsuite/gcc.target/i386/pr100865-4b.c
+++ b/gcc/testsuite/gcc.target/i386/pr100865-4b.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -march=skylake-avx512" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
#include "pr100865-4a.c"
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-5a.c b/gcc/testsuite/gcc.target/i386/pr100865-5a.c
index 4149797..b023fca 100644
--- a/gcc/testsuite/gcc.target/i386/pr100865-5a.c
+++ b/gcc/testsuite/gcc.target/i386/pr100865-5a.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=skylake" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
extern short array[64];
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-5b.c b/gcc/testsuite/gcc.target/i386/pr100865-5b.c
index ded41b68..5bccfd0 100644
--- a/gcc/testsuite/gcc.target/i386/pr100865-5b.c
+++ b/gcc/testsuite/gcc.target/i386/pr100865-5b.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=skylake-avx512" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
#include "pr100865-5a.c"
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-6a.c b/gcc/testsuite/gcc.target/i386/pr100865-6a.c
index 3fde549..34951a9 100644
--- a/gcc/testsuite/gcc.target/i386/pr100865-6a.c
+++ b/gcc/testsuite/gcc.target/i386/pr100865-6a.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=skylake" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
extern int array[64];
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-6b.c b/gcc/testsuite/gcc.target/i386/pr100865-6b.c
index 9588249..09b0e71 100644
--- a/gcc/testsuite/gcc.target/i386/pr100865-6b.c
+++ b/gcc/testsuite/gcc.target/i386/pr100865-6b.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=skylake-avx512" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
#include "pr100865-6a.c"
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-6c.c b/gcc/testsuite/gcc.target/i386/pr100865-6c.c
index 46d3103..bab7c88 100644
--- a/gcc/testsuite/gcc.target/i386/pr100865-6c.c
+++ b/gcc/testsuite/gcc.target/i386/pr100865-6c.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=skylake -mno-avx2" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
extern int array[64];
diff --git a/gcc/testsuite/gcc.target/i386/pr100865-7b.c b/gcc/testsuite/gcc.target/i386/pr100865-7b.c
index 3b20c68..49f752e 100644
--- a/gcc/testsuite/gcc.target/i386/pr100865-7b.c
+++ b/gcc/testsuite/gcc.target/i386/pr100865-7b.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=skylake-avx512" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
#include "pr100865-7a.c"
diff --git a/gcc/testsuite/gcc.target/i386/pr101796-1.c b/gcc/testsuite/gcc.target/i386/pr101796-1.c
index 3a5f50d..b25464d 100644
--- a/gcc/testsuite/gcc.target/i386/pr101796-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr101796-1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mavx512bw" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* { dg-final {scan-assembler-times "vpsrlw\[ \\t\]" 1 } } */
/* { dg-final {scan-assembler-times "vpsllw\[ \\t\]" 1 } } */
/* { dg-final {scan-assembler-times "vpsraw\[ \\t\]" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr101846-2.c b/gcc/testsuite/gcc.target/i386/pr101846-2.c
index 26c9ed5..bc2b466 100644
--- a/gcc/testsuite/gcc.target/i386/pr101846-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr101846-2.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-mavx512vl -mavx512vbmi -O2" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* { dg-final { scan-assembler-times "vpmovwb" "3" } } */
/* { dg-final { scan-assembler-times "vpmovdw" "3" } } */
/* { dg-final { scan-assembler-times "vpmovqd" "3" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr101989-broadcast-1.c b/gcc/testsuite/gcc.target/i386/pr101989-broadcast-1.c
index d03d192..428c40c 100644
--- a/gcc/testsuite/gcc.target/i386/pr101989-broadcast-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr101989-broadcast-1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mavx512vl" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* { dg-final { scan-assembler-times "vpternlog" 4 } } */
/* { dg-final { scan-assembler-times "\\\{1to4\\\}" 4 } } */
#include<immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/pr102021.c b/gcc/testsuite/gcc.target/i386/pr102021.c
index 6db3f57..a5012a4 100644
--- a/gcc/testsuite/gcc.target/i386/pr102021.c
+++ b/gcc/testsuite/gcc.target/i386/pr102021.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O3 -march=skylake-avx512" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
#include<immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/pr103144-mul-1.c b/gcc/testsuite/gcc.target/i386/pr103144-mul-1.c
new file mode 100644
index 0000000..640c34f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr103144-mul-1.c
@@ -0,0 +1,51 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx2 -ftree-vectorize -fvect-cost-model=unlimited -fdump-tree-vect-details -mprefer-vector-width=256" } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 4 "vect" } } */
+
+#define N 10000
+
+void
+__attribute__((noipa))
+foo_mul (int* a, int b)
+{
+ for (int i = 0; i != N; i++)
+ {
+ a[i] = b;
+ b *= 3;
+ }
+}
+
+void
+__attribute__((noipa))
+foo_mul_const (int* a)
+{
+ int b = 1;
+ for (int i = 0; i != N; i++)
+ {
+ a[i] = b;
+ b *= 3;
+ }
+}
+
+void
+__attribute__((noipa))
+foo_mul_peel (int* a, int b)
+{
+ for (int i = 0; i != 39; i++)
+ {
+ a[i] = b;
+ b *= 3;
+ }
+}
+
+void
+__attribute__((noipa))
+foo_mul_peel_const (int* a)
+{
+ int b = 1;
+ for (int i = 0; i != 39; i++)
+ {
+ a[i] = b;
+ b *= 3;
+ }
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr103144-mul-2.c b/gcc/testsuite/gcc.target/i386/pr103144-mul-2.c
new file mode 100644
index 0000000..39fdea3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr103144-mul-2.c
@@ -0,0 +1,51 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx2 -ftree-vectorize -fvect-cost-model=unlimited -mprefer-vector-width=256" } */
+/* { dg-require-effective-target avx2 } */
+
+#include "avx2-check.h"
+#include <string.h>
+#include "pr103144-mul-1.c"
+
+typedef int v8si __attribute__((vector_size(32)));
+
+void
+avx2_test (void)
+{
+ int* epi32_exp = (int*) malloc (N * sizeof (int));
+ int* epi32_dst = (int*) malloc (N * sizeof (int));
+
+ __builtin_memset (epi32_exp, 0, N * sizeof (int));
+ int b = 8;
+ v8si init = __extension__(v8si) { b, b * 3, b * 9, b * 27, b * 81, b * 243, b * 729, b * 2187 };
+
+ for (int i = 0; i != N / 8; i++)
+ {
+ memcpy (epi32_exp + i * 8, &init, 32);
+ init *= 6561;
+ }
+
+ foo_mul (epi32_dst, b);
+ if (__builtin_memcmp (epi32_dst, epi32_exp, N * sizeof (int)) != 0)
+ __builtin_abort ();
+
+ foo_mul_peel (epi32_dst, b);
+ if (__builtin_memcmp (epi32_dst, epi32_exp, 39 * 4) != 0)
+ __builtin_abort ();
+
+ init = __extension__(v8si) { 1, 3, 9, 27, 81, 243, 729, 2187 };
+ for (int i = 0; i != N / 8; i++)
+ {
+ memcpy (epi32_exp + i * 8, &init, 32);
+ init *= 6561;
+ }
+
+ foo_mul_const (epi32_dst);
+ if (__builtin_memcmp (epi32_dst, epi32_exp, N * sizeof (int)) != 0)
+ __builtin_abort ();
+
+ foo_mul_peel_const (epi32_dst);
+ if (__builtin_memcmp (epi32_dst, epi32_exp, 39 * 4) != 0)
+ __builtin_abort ();
+
+ return;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr103144-neg-1.c b/gcc/testsuite/gcc.target/i386/pr103144-neg-1.c
new file mode 100644
index 0000000..f87b1d6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr103144-neg-1.c
@@ -0,0 +1,51 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx2 -ftree-vectorize -fvect-cost-model=unlimited -fdump-tree-vect-details -mprefer-vector-width=256" } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 4 "vect" } } */
+
+#define N 10000
+
+void
+__attribute__((noipa))
+foo_neg (int* a, int b)
+{
+ for (int i = 0; i != N; i++)
+ {
+ a[i] = b;
+ b = -b;
+ }
+}
+
+void
+__attribute__((noipa))
+foo_neg_const (int* a)
+{
+ int b = 1;
+ for (int i = 0; i != N; i++)
+ {
+ a[i] = b;
+ b = -b;
+ }
+}
+
+void
+__attribute__((noipa))
+foo_neg_peel (int* a, int b, int n)
+{
+ for (int i = 0; i != n; i++)
+ {
+ a[i] = b;
+ b = -b;
+ }
+}
+
+void
+__attribute__((noipa))
+foo_neg_const_peel (int* a, int n)
+{
+ int b = 1;
+ for (int i = 0; i != n; i++)
+ {
+ a[i] = b;
+ b = -b;
+ }
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr103144-neg-2.c b/gcc/testsuite/gcc.target/i386/pr103144-neg-2.c
new file mode 100644
index 0000000..bb8c22b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr103144-neg-2.c
@@ -0,0 +1,44 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx2 -ftree-vectorize -fvect-cost-model=unlimited -mprefer-vector-width=256" } */
+/* { dg-require-effective-target avx2 } */
+
+#include "avx2-check.h"
+#include <string.h>
+#include "pr103144-neg-1.c"
+
+void
+avx2_test (void)
+{
+ int* epi32_exp = (int*) malloc (N * sizeof (int));
+ int* epi32_dst = (int*) malloc (N * sizeof (int));
+ long long* epi64_exp = (long long*) malloc (N * sizeof (int));
+
+ __builtin_memset (epi32_exp, 0, N * sizeof (int));
+ int b = 100;
+
+ for (int i = 0; i != N / 2; i++)
+ epi64_exp[i] = ((long long) b) | (((long long) -b) << 32);
+
+ memcpy (epi32_exp, epi64_exp, N * sizeof (int));
+ foo_neg (epi32_dst, b);
+ if (__builtin_memcmp (epi32_dst, epi32_exp, N * sizeof (int)) != 0)
+ __builtin_abort ();
+
+ foo_neg_peel (epi32_dst, b, 39);
+ if (__builtin_memcmp (epi32_dst, epi32_exp, 39 * sizeof (int)) != 0)
+ __builtin_abort ();
+
+ for (int i = 0; i != N / 2; i++)
+ epi64_exp[i] = ((long long) 1) | (((long long) -1) << 32);
+
+ memcpy (epi32_exp, epi64_exp, N * sizeof (int));
+ foo_neg_const (epi32_dst);
+ if (__builtin_memcmp (epi32_dst, epi32_exp, N * sizeof (int)) != 0)
+ __builtin_abort ();
+
+ foo_neg_const_peel (epi32_dst, 39);
+ if (__builtin_memcmp (epi32_dst, epi32_exp, 39 * sizeof (int)) != 0)
+ __builtin_abort ();
+
+ return;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr103144-shift-1.c b/gcc/testsuite/gcc.target/i386/pr103144-shift-1.c
new file mode 100644
index 0000000..2a69203
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr103144-shift-1.c
@@ -0,0 +1,70 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx2 -ftree-vectorize -fvect-cost-model=unlimited -fdump-tree-vect-details -mprefer-vector-width=256" } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 6 "vect" } } */
+
+#define N 10000
+void
+__attribute__((noipa))
+foo_shl (int* a, int b)
+{
+ for (int i = 0; i != N; i++)
+ {
+ a[i] = b;
+ b <<= 1;
+ }
+}
+
+void
+__attribute__((noipa))
+foo_ashr (int* a, int b)
+{
+ for (int i = 0; i != N; i++)
+ {
+ a[i] = b;
+ b >>= 1;
+ }
+}
+
+void
+__attribute__((noipa))
+foo_lshr (unsigned int* a, unsigned int b)
+{
+ for (int i = 0; i != N; i++)
+ {
+ a[i] = b;
+ b >>= 1U;
+ }
+}
+
+void
+__attribute__((noipa))
+foo_shl_peel (int* a, int b)
+{
+ for (int i = 0; i != 39; i++)
+ {
+ a[i] = b;
+ b <<= 1;
+ }
+}
+
+void
+__attribute__((noipa))
+foo_ashr_peel (int* a, int b)
+{
+ for (int i = 0; i != 39; i++)
+ {
+ a[i] = b;
+ b >>= 1;
+ }
+}
+
+void
+__attribute__((noipa))
+foo_lshr_peel (unsigned int* a, unsigned int b)
+{
+ for (int i = 0; i != 39; i++)
+ {
+ a[i] = b;
+ b >>= 1U;
+ }
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr103144-shift-2.c b/gcc/testsuite/gcc.target/i386/pr103144-shift-2.c
new file mode 100644
index 0000000..6f47719
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr103144-shift-2.c
@@ -0,0 +1,79 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx2 -ftree-vectorize -fvect-cost-model=unlimited -mprefer-vector-width=256" } */
+/* { dg-require-effective-target avx2 } */
+
+#include "avx2-check.h"
+#include <string.h>
+#include "pr103144-shift-1.c"
+
+typedef int v8si __attribute__((vector_size(32)));
+typedef unsigned int v8usi __attribute__((vector_size(32)));
+
+void
+avx2_test (void)
+{
+ int* epi32_exp = (int*) malloc (N * sizeof (int));
+ int* epi32_dst = (int*) malloc (N * sizeof (int));
+ unsigned int* epu32_exp = (unsigned int*) malloc (N * sizeof (int));
+ unsigned int* epu32_dst = (unsigned int*) malloc (N * sizeof (int));
+
+ __builtin_memset (epi32_exp, 0, N * sizeof (int));
+ int b = 8;
+ v8si init = __extension__(v8si) { b, b << 1, b << 2, b << 3, b << 4, b << 5, b << 6, b << 7 };
+
+ for (int i = 0; i != N / 8; i++)
+ {
+ memcpy (epi32_exp + i * 8, &init, 32);
+ init <<= 8;
+ }
+
+ foo_shl (epi32_dst, b);
+ if (__builtin_memcmp (epi32_dst, epi32_exp, N * sizeof (int)) != 0)
+ __builtin_abort ();
+
+ foo_shl_peel (epi32_dst, b);
+ if (__builtin_memcmp (epi32_dst, epi32_exp, 39 * sizeof (int)) != 0)
+ __builtin_abort ();
+
+ b = -11111;
+ init = __extension__(v8si) { b, b >> 1, b >> 2, b >> 3, b >> 4, b >> 5, b >> 6, b >> 7 };
+ for (int i = 0; i != N / 8; i++)
+ {
+ memcpy (epi32_exp + i * 8, &init, 32);
+ init >>= 8;
+ }
+
+ foo_ashr (epi32_dst, b);
+ if (__builtin_memcmp (epi32_dst, epi32_exp, N * sizeof (int)) != 0)
+ __builtin_abort ();
+
+ foo_ashr_peel (epi32_dst, b);
+ if (__builtin_memcmp (epi32_dst, epi32_exp, 39 * sizeof (int)) != 0)
+ {
+ for (int i = 0; i != 39; i++)
+ {
+ printf ("epi32_dst[%d] is %d ----", i, epi32_dst[i]);
+ printf ("epi32_exp[%d] is %d\n", i, epi32_exp[i]);
+ }
+ __builtin_abort ();
+ }
+
+ __builtin_memset (epu32_exp, 0, N * sizeof (int));
+ unsigned int c = 11111111;
+ v8usi initu = __extension__(v8usi) { c, c >> 1U, c >> 2U, c >> 3U, c >> 4U, c >> 5U, c >> 6U, c >> 7U };
+ for (int i = 0; i != N / 8; i++)
+ {
+ memcpy (epu32_exp + i * 8, &initu, 32);
+ initu >>= 8U;
+ }
+
+ foo_lshr (epu32_dst, c);
+ if (__builtin_memcmp (epu32_dst, epu32_exp, N * sizeof (int)) != 0)
+ __builtin_abort ();
+
+ foo_lshr_peel (epu32_dst, c);
+ if (__builtin_memcmp (epu32_dst, epu32_exp, 39 * sizeof (int)) != 0)
+ __builtin_abort ();
+
+ return;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr105735-1.c b/gcc/testsuite/gcc.target/i386/pr105735-1.c
new file mode 100644
index 0000000..69de6b2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr105735-1.c
@@ -0,0 +1,88 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-sccp-details" } */
+/* { dg-final { scan-tree-dump-times {final value replacement} 8 "sccp" } } */
+
+unsigned int
+__attribute__((noipa))
+foo (unsigned int tmp, unsigned int bit2)
+{
+ for (int bit = 0; bit < 64; bit++)
+ tmp &= bit2;
+ return tmp;
+}
+
+unsigned int
+__attribute__((noipa))
+foo1 (unsigned int tmp, unsigned int bit2)
+{
+ for (int bit = 63; bit >= 0; bit -=3)
+ tmp &= bit2;
+ return tmp;
+}
+
+unsigned int
+__attribute__((noipa))
+foo2 (unsigned int tmp, unsigned int bit2)
+{
+ for (int bit = 0; bit < 64; bit++)
+ tmp |= bit2;
+ return tmp;
+}
+
+unsigned int
+__attribute__((noipa))
+foo3 (unsigned int tmp, unsigned int bit2)
+{
+ for (int bit = 63; bit >= 0; bit -=3)
+ tmp |= bit2;
+ return tmp;
+}
+
+unsigned int
+__attribute__((noipa))
+foo4 (unsigned int tmp, unsigned int bit2)
+{
+ for (int bit = 0; bit < 64; bit++)
+ tmp ^= bit2;
+ return tmp;
+}
+
+unsigned int
+__attribute__((noipa))
+foo5 (unsigned int tmp, unsigned int bit2)
+{
+ for (int bit = 0; bit < 63; bit++)
+ tmp ^= bit2;
+ return tmp;
+}
+
+unsigned int
+__attribute__((noipa))
+f (unsigned int tmp, int bit, unsigned int bit2)
+{
+ unsigned int res = tmp;
+ for (int i = 0; i < bit; i++)
+ res &= bit2;
+ return res;
+}
+
+unsigned int
+__attribute__((noipa))
+f1 (unsigned int tmp, int bit, unsigned int bit2)
+{
+ unsigned int res = tmp;
+ for (int i = 0; i < bit; i++)
+ res |= bit2;
+ return res;
+}
+
+unsigned int
+__attribute__((noipa))
+f2 (unsigned int tmp, int bit, unsigned int bit2)
+{
+ unsigned int res = tmp;
+ for (int i = 0; i < bit; i++)
+ res ^= bit2;
+ return res;
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/pr105735-2.c b/gcc/testsuite/gcc.target/i386/pr105735-2.c
new file mode 100644
index 0000000..66cc5fb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr105735-2.c
@@ -0,0 +1,28 @@
+/* { dg-do run } */
+/* { dg-options "-O1" } */
+
+#include "pr105735-1.c"
+
+int main()
+{
+ unsigned int tmp = 0x1101;
+ unsigned int bit2 = 0x111101;
+ if (foo (tmp, bit2) != 0x1101)
+ __builtin_abort ();
+ if (foo1 (tmp, bit2) != 0x1101)
+ __builtin_abort ();
+ if (foo2 (tmp, bit2) != 0x111101)
+ __builtin_abort ();
+ if (foo3 (tmp, bit2) != 0x111101)
+ __builtin_abort ();
+ if (foo4 (tmp, bit2) != 0x1101)
+ __builtin_abort ();
+ if (foo5 (tmp, bit2) != 0x110000)
+ __builtin_abort ();
+ if (f (tmp, 64, bit2) != 0x1101)
+ __builtin_abort ();
+ if (f1 (tmp, 64, bit2) != 0x111101)
+ __builtin_abort ();
+ if (f2 (tmp, 64, bit2) != 0x1101)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr106322.c b/gcc/testsuite/gcc.target/i386/pr106322.c
new file mode 100644
index 0000000..31333c5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr106322.c
@@ -0,0 +1,51 @@
+/* { dg-do run } */
+/* { dg-require-effective-target ia32 } */
+/* { dg-options "-O2 -mtune=generic -march=i686" } */
+
+/* As PR106322, verify this can execute well (not abort). */
+
+#define N 64
+typedef unsigned short int uh;
+typedef unsigned short int uw;
+uh a[N];
+uh b[N];
+uh c[N];
+uh e[N];
+
+__attribute__ ((noipa)) void
+foo ()
+{
+ for (int i = 0; i < N; i++)
+ c[i] = ((uw) b[i] * (uw) a[i]) >> 16;
+}
+
+__attribute__ ((optimize ("-O0"))) void
+init ()
+{
+ for (int i = 0; i < N; i++)
+ {
+ a[i] = (uh) (0x7ABC - 0x5 * i);
+ b[i] = (uh) (0xEAB + 0xF * i);
+ e[i] = ((uw) b[i] * (uw) a[i]) >> 16;
+ }
+}
+
+__attribute__ ((optimize ("-O0"))) void
+check ()
+{
+ for (int i = 0; i < N; i++)
+ {
+ if (c[i] != e[i])
+ __builtin_abort ();
+ }
+}
+
+int
+main ()
+{
+ init ();
+ foo ();
+ check ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr106450.c b/gcc/testsuite/gcc.target/i386/pr106450.c
new file mode 100644
index 0000000..d16231f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr106450.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O2 -fsplit-paths" } */
+
+__int128 n;
+
+__attribute__ ((simd)) void
+foo (void)
+{
+ __int128 uninitialized;
+ unsigned __int128 *p = &n;
+
+ n >>= *p ? : 2;
+ n |= uninitialized;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr106453.c b/gcc/testsuite/gcc.target/i386/pr106453.c
new file mode 100644
index 0000000..bd2e728
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr106453.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mcrc32 -dp" } */
+/* { dg-final { scan-assembler-not "zero_extendsidi" } } */
+
+#include <immintrin.h>
+#include <stdint.h>
+
+uint32_t f(uint32_t c, uint64_t *p, size_t n)
+{
+ for (size_t i = 0; i < n; i++)
+ c = _mm_crc32_u64(c, p[i]);
+ return c;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr106481.c b/gcc/testsuite/gcc.target/i386/pr106481.c
new file mode 100644
index 0000000..8cc7048
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr106481.c
@@ -0,0 +1,17 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O2 -fno-dce -fno-forward-propagate -fno-rerun-cse-after-loop -Wno-psabi" } */
+
+typedef int V __attribute__((vector_size (64)));
+typedef __int128 W __attribute__((vector_size (64)));
+
+W w;
+V bar (void);
+
+void
+foo (V v, W)
+{
+ foo ((V){4, ~0}, (W) v);
+ foo (v, w);
+ bar ();
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/pr106704.c b/gcc/testsuite/gcc.target/i386/pr106704.c
new file mode 100644
index 0000000..44e052a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr106704.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx -O2 -mno-avx2" } */
+/* { dg-final { scan-assembler-times {vblendvps[ \t]+%ymm[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vblendvpd[ \t]+%ymm[0-9]+} 1 } } */
+
+#include <immintrin.h>
+
+__m256 bend_stuff( __m256 a, __m256 b, __m256 mask)
+{
+ return _mm256_blendv_ps(a, b, mask);
+}
+
+__m256d bend_stuff1( __m256d a, __m256d b, __m256d mask)
+{
+ return _mm256_blendv_pd(a, b, mask);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr106707.c b/gcc/testsuite/gcc.target/i386/pr106707.c
new file mode 100644
index 0000000..2e8ebaa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr106707.c
@@ -0,0 +1,19 @@
+/* PR target/106707 */
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-Oz -g -fno-cprop-registers -fno-dce" } */
+
+typedef unsigned __attribute__((__vector_size__ (8))) V;
+
+unsigned __int128 ii;
+unsigned x, y;
+
+V v;
+
+void
+foo (long long a)
+{
+ long long l = a != x;
+ int i = __builtin_add_overflow_p (y * ii, 0, 0);
+ V u = ii < x | v, w = x <= u < i & y <= x / ii;
+ v = __builtin_shufflevector (v, w, 1, 2) + (V) l;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr106742.c b/gcc/testsuite/gcc.target/i386/pr106742.c
new file mode 100644
index 0000000..36ac93c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr106742.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-msse2 -mno-sse4 -O1" } */
+typedef __bf16 v8bf __attribute__ ((__vector_size__ (16)));
+
+v8bf
+vec_init_dup_v8bf (__bf16 a1)
+{
+ return __extension__ (v8bf) { a1, a1, a1, a1, a1, a1, a1, a1 };
+}
+/* { dg-final { scan-assembler-times "pinsrw" 1} } */
diff --git a/gcc/testsuite/gcc.target/i386/pr106748.c b/gcc/testsuite/gcc.target/i386/pr106748.c
new file mode 100644
index 0000000..6388b1d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr106748.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -mavx256-split-unaligned-store -mavx -fpack-struct" } */
+
+typedef __bf16 __m256bf16 __attribute__((__vector_size__(32)));
+typedef struct {
+ __m256bf16 _m256bf16[1];
+} YMM_T;
+
+struct {
+ YMM_T ymm0;
+} fregs;
+
+__m256bf16 do_test_u3b_0_0;
+int do_test_i;
+
+void
+do_test()
+{
+ (&fregs.ymm0)[do_test_i]._m256bf16[0] = do_test_u3b_0_0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr106905.c b/gcc/testsuite/gcc.target/i386/pr106905.c
new file mode 100644
index 0000000..a190a1c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr106905.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-march=silvermont -O2 -fvect-cost-model=dynamic" } */
+
+void
+foo_mul_peel (int *a, int b)
+{
+ int i;
+
+ for (i = 0; i < 7; ++i)
+ {
+ b *= 2;
+ a[i] = b;
+ }
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr106910-1.c b/gcc/testsuite/gcc.target/i386/pr106910-1.c
new file mode 100644
index 0000000..c7685a3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr106910-1.c
@@ -0,0 +1,77 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-msse4.1 -O2 -Ofast" } */
+/* { dg-final { scan-assembler-times "roundps" 9 } } */
+/* { dg-final { scan-assembler-times "cvtps2dq" 1 } } */
+/* { dg-final { scan-assembler-times "cvttps2dq" 3 } } */
+
+#include<math.h>
+
+void
+foo (float* p, float* __restrict q)
+{
+ p[0] = truncf (q[0]);
+ p[1] = truncf (q[1]);
+}
+
+void
+foo1 (float* p, float* __restrict q)
+{
+ p[0] = floorf (q[0]);
+ p[1] = floorf (q[1]);
+}
+
+void
+foo1i (int* p, float* __restrict q)
+{
+ p[0] = (int) floorf (q[0]);
+ p[1] = (int) floorf (q[1]);
+}
+
+void
+foo2 (float* p, float* __restrict q)
+{
+ p[0] = ceilf (q[0]);
+ p[1] = ceilf (q[1]);
+}
+
+void
+foo2i (int* p, float* __restrict q)
+{
+ p[0] = (int) ceilf (q[0]);
+ p[1] = (int) ceilf (q[1]);
+}
+
+void
+foo3 (float* p, float* __restrict q)
+{
+ p[0] = rintf (q[0]);
+ p[1] = rintf (q[1]);
+}
+
+void
+foo3i (int* p, float* __restrict q)
+{
+ p[0] = (int) rintf (q[0]);
+ p[1] = (int) rintf (q[1]);
+}
+
+void
+foo4 (float* p, float* __restrict q)
+{
+ p[0] = nearbyintf (q[0]);
+ p[1] = nearbyintf (q[1]);
+}
+
+void
+foo5(float* p, float* __restrict q)
+{
+ p[0] = roundf (q[0]);
+ p[1] = roundf (q[1]);
+}
+
+void
+foo5i(int* p, float* __restrict q)
+{
+ p[0] = (int) roundf (q[0]);
+ p[1] = (int) roundf (q[1]);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr106963.c b/gcc/testsuite/gcc.target/i386/pr106963.c
new file mode 100644
index 0000000..9f2d20e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr106963.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx -mno-avx2" } */
+
+void
+foo_neg_const (int *a)
+{
+ int i, b = 1;
+
+ for (i = 0; i < 1000; i++)
+ {
+ a[i] = b;
+ b = -b;
+ }
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr106994.c b/gcc/testsuite/gcc.target/i386/pr106994.c
new file mode 100644
index 0000000..0803311
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr106994.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-march=skylake -Ofast" } */
+
+typedef struct {
+ float ymin, ymax;
+} rctf;
+
+rctf view2d_map_cur_using_maskUI_view2d_view_ortho_curmasked;
+float view2d_map_cur_using_maskUI_view2d_view_ortho_yofs;
+
+void BLI_rctf_translate();
+void glLoadIdentity();
+
+void
+view2d_map_cur_using_maskUI_view2d_view_ortho() {
+ BLI_rctf_translate(&view2d_map_cur_using_maskUI_view2d_view_ortho_curmasked);
+ view2d_map_cur_using_maskUI_view2d_view_ortho_curmasked.ymin =
+ __builtin_floor(view2d_map_cur_using_maskUI_view2d_view_ortho_curmasked.ymin) -
+ view2d_map_cur_using_maskUI_view2d_view_ortho_yofs;
+ view2d_map_cur_using_maskUI_view2d_view_ortho_curmasked.ymax =
+ __builtin_floor(view2d_map_cur_using_maskUI_view2d_view_ortho_curmasked.ymax) -
+ view2d_map_cur_using_maskUI_view2d_view_ortho_yofs;
+ glLoadIdentity();
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr15184-1.c b/gcc/testsuite/gcc.target/i386/pr15184-1.c
index 8c19e47..756183d 100644
--- a/gcc/testsuite/gcc.target/i386/pr15184-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr15184-1.c
@@ -1,6 +1,7 @@
/* PR 15184 first two tests, plus two addition ones. */
/* { dg-do compile { target ia32 } } */
/* { dg-options "-O2 -march=pentiumpro" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
#define regparm __attribute__((__regparm__(1)))
diff --git a/gcc/testsuite/gcc.target/i386/pr15184-2.c b/gcc/testsuite/gcc.target/i386/pr15184-2.c
index a6cb9eb..cb8201f 100644
--- a/gcc/testsuite/gcc.target/i386/pr15184-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr15184-2.c
@@ -1,6 +1,7 @@
/* PR 15184 second two tests
/* { dg-do compile { target ia32 } } */
/* { dg-options "-O2 -march=pentiumpro" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
#define regparm __attribute__((__regparm__(1)))
diff --git a/gcc/testsuite/gcc.target/i386/pr27971.c b/gcc/testsuite/gcc.target/i386/pr27971.c
index f80cb65..19eb354 100644
--- a/gcc/testsuite/gcc.target/i386/pr27971.c
+++ b/gcc/testsuite/gcc.target/i386/pr27971.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mno-tbm" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* { dg-additional-options "-mdynamic-no-pic" { target { *-*-darwin* && ia32 } } } */
unsigned array[4];
@@ -17,4 +18,3 @@ unsigned foo(TYPE x)
/* { dg-final { scan-assembler-not "shr\[^\\n\]*2" } } */
/* { dg-final { scan-assembler "and\[^\\n\]*12" } } */
- \ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/i386/pr47949.c b/gcc/testsuite/gcc.target/i386/pr47949.c
new file mode 100644
index 0000000..a0524b1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr47949.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-Oz" } */
+/* { dg-additional-options "-mregparm=2" { target ia32 } } */
+
+int foo(int x, int y)
+{
+ return y;
+}
+
+long bar(long x, long y)
+{
+ return y;
+}
+
+/* { dg-final { scan-assembler-times "xchg" 2 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr54855-3.c b/gcc/testsuite/gcc.target/i386/pr54855-3.c
index 3c15dfc9..a58a8ba 100644
--- a/gcc/testsuite/gcc.target/i386/pr54855-3.c
+++ b/gcc/testsuite/gcc.target/i386/pr54855-3.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -msse2 -mfpmath=sse" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* { dg-final { scan-assembler-times "subsd" 1 } } */
/* { dg-final { scan-assembler-not "movapd" } } */
/* { dg-final { scan-assembler-not "movsd" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr54855-7.c b/gcc/testsuite/gcc.target/i386/pr54855-7.c
index a551bd5..d9ef66a 100644
--- a/gcc/testsuite/gcc.target/i386/pr54855-7.c
+++ b/gcc/testsuite/gcc.target/i386/pr54855-7.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -msse -mfpmath=sse" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* { dg-final { scan-assembler-times "divss" 1 } } */
/* { dg-final { scan-assembler-not "movaps" } } */
/* { dg-final { scan-assembler-not "movss" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr70263-2.c b/gcc/testsuite/gcc.target/i386/pr70263-2.c
index 19f79fd..20447ed 100644
--- a/gcc/testsuite/gcc.target/i386/pr70263-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr70263-2.c
@@ -1,5 +1,8 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-rtl-ira" } */
+/* ia32 PIC prevents tail-calling, which forces bar's arg to be pushed, which
+ drops the equivalence. */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* { dg-final { scan-rtl-dump "Adding REG_EQUIV to insn \[0-9\]+ for source of insn \[0-9\]+" "ira" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr70321.c b/gcc/testsuite/gcc.target/i386/pr70321.c
index eaba728..57552ef 100644
--- a/gcc/testsuite/gcc.target/i386/pr70321.c
+++ b/gcc/testsuite/gcc.target/i386/pr70321.c
@@ -7,4 +7,6 @@ void foo (long long ixi)
__builtin_abort ();
}
-/* { dg-final { scan-assembler-times "mov" 1 } } */
+/* { dg-final { scan-assembler-times "mov" 1 { target nonpic } } } */
+/* get_pc_thunk adds an extra mov insn. */
+/* { dg-final { scan-assembler-times "mov" 2 { target { ! nonpic } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr78035.c b/gcc/testsuite/gcc.target/i386/pr78035.c
index 2e673a8..7d3a983 100644
--- a/gcc/testsuite/gcc.target/i386/pr78035.c
+++ b/gcc/testsuite/gcc.target/i386/pr78035.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
extern int a;
extern int b;
diff --git a/gcc/testsuite/gcc.target/i386/pr81563.c b/gcc/testsuite/gcc.target/i386/pr81563.c
index f0efcf9..3d3f959 100644
--- a/gcc/testsuite/gcc.target/i386/pr81563.c
+++ b/gcc/testsuite/gcc.target/i386/pr81563.c
@@ -10,4 +10,4 @@ fn1 (long long int x)
return x;
}
-/* { dg-final { scan-assembler-not "movl\[ \\t\]+\[0-9]*\\(%esp\\)" } } */
+/* { dg-final { scan-assembler-not "movl\[ \\t\]+\[0-9]+\\(%esp\\)" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr81736-5.c b/gcc/testsuite/gcc.target/i386/pr81736-5.c
index e1602cf..0dcf17b 100644
--- a/gcc/testsuite/gcc.target/i386/pr81736-5.c
+++ b/gcc/testsuite/gcc.target/i386/pr81736-5.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fno-omit-frame-pointer -mavx" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
typedef int v8si __attribute__ ((vector_size (32)));
diff --git a/gcc/testsuite/gcc.target/i386/pr81736-7.c b/gcc/testsuite/gcc.target/i386/pr81736-7.c
index f947886..95b380d 100644
--- a/gcc/testsuite/gcc.target/i386/pr81736-7.c
+++ b/gcc/testsuite/gcc.target/i386/pr81736-7.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fno-omit-frame-pointer" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
extern int foo (void);
diff --git a/gcc/testsuite/gcc.target/i386/pr83782-1.c b/gcc/testsuite/gcc.target/i386/pr83782-1.c
index ce97b12..8567434 100644
--- a/gcc/testsuite/gcc.target/i386/pr83782-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr83782-1.c
@@ -1,4 +1,4 @@
-/* { dg-do compile } */
+/* { dg-do compile { target { ! ia32 } } } */
/* { dg-require-ifunc "" } */
/* { dg-options "-O2 -fpic" } */
@@ -20,7 +20,5 @@ bar(void)
return foo;
}
-/* { dg-final { scan-assembler {leal[ \t]foo@GOTOFF\(%[^,]*\),[ \t]%eax} { target ia32 } } } */
-/* { dg-final { scan-assembler {lea(?:l|q)[ \t]foo\(%rip\),[ \t]%(?:e|r)ax} { target { ! ia32 } } } } */
-/* { dg-final { scan-assembler-not "foo@GOT\\\(" { target ia32 } } } */
-/* { dg-final { scan-assembler-not "foo@GOTPCREL\\\(" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler {lea(?:l|q)[ \t]foo\(%rip\),[ \t]%(?:e|r)ax} } } */
+/* { dg-final { scan-assembler-not "foo@GOTPCREL\\\(" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr83782-2.c b/gcc/testsuite/gcc.target/i386/pr83782-2.c
index e25d258..a654ded 100644
--- a/gcc/testsuite/gcc.target/i386/pr83782-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr83782-2.c
@@ -1,4 +1,4 @@
-/* { dg-do compile } */
+/* { dg-do compile { target { ! ia32 } } } */
/* { dg-require-ifunc "" } */
/* { dg-options "-O2 -fpic" } */
@@ -20,7 +20,5 @@ bar(void)
return foo;
}
-/* { dg-final { scan-assembler {leal[ \t]foo@GOTOFF\(%[^,]*\),[ \t]%eax} { target ia32 } } } */
/* { dg-final { scan-assembler {lea(?:l|q)[ \t]foo\(%rip\),[ \t]%(?:e|r)ax} { target { ! ia32 } } } } */
-/* { dg-final { scan-assembler-not "foo@GOT\\\(" { target ia32 } } } */
/* { dg-final { scan-assembler-not "foo@GOTPCREL\\\(" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr83782-3.c b/gcc/testsuite/gcc.target/i386/pr83782-3.c
new file mode 100644
index 0000000..1536481
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr83782-3.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+/* { dg-require-ifunc "" } */
+/* { dg-require-effective-target pie } */
+/* { dg-options "-fpie -pie" } */
+
+#include <stdio.h>
+
+static int __attribute__((noinline))
+implementation (void)
+{
+ printf ("'ere I am JH\n");
+ return 0;
+}
+
+static __typeof__ (implementation) *resolver (void)
+{
+ return (void *)implementation;
+}
+
+extern int magic (void) __attribute__ ((ifunc ("resolver")));
+
+__attribute__ ((weak))
+int
+call_magic (int (*ptr) (void))
+{
+ return ptr ();
+}
+
+int main ()
+{
+ return call_magic (magic);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr84278.c b/gcc/testsuite/gcc.target/i386/pr84278.c
index d100dff..2fa8480 100644
--- a/gcc/testsuite/gcc.target/i386/pr84278.c
+++ b/gcc/testsuite/gcc.target/i386/pr84278.c
@@ -15,4 +15,6 @@ void foo(void)
}
}
-/* { dg-final { scan-assembler-not "\\\(%.sp\\\)" } } */
+/* { dg-final { scan-assembler-not "\\\(%.sp\\\)" { target { nonpic || { ! ia32 } } } } } */
+/* ia32's get_pc_thunk variants all load from %(esp). */
+/* { dg-final { scan-assembler-times "movl\[ \t]*\\\(%.sp\\\)" 1 { target { ! { nonpic || { ! ia32 } } } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr85620-6.c b/gcc/testsuite/gcc.target/i386/pr85620-6.c
index 0b6a64e..4f04ba0 100644
--- a/gcc/testsuite/gcc.target/i386/pr85620-6.c
+++ b/gcc/testsuite/gcc.target/i386/pr85620-6.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fcf-protection" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* { dg-final { scan-assembler "jmp" } } */
struct ucontext;
diff --git a/gcc/testsuite/gcc.target/i386/pr85667-6.c b/gcc/testsuite/gcc.target/i386/pr85667-6.c
index 5d2c66e..06570dd 100644
--- a/gcc/testsuite/gcc.target/i386/pr85667-6.c
+++ b/gcc/testsuite/gcc.target/i386/pr85667-6.c
@@ -1,5 +1,6 @@
/* { dg-do compile { target ia32 } } */
/* { dg-options "-O2" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* { dg-final { scan-assembler-times "movl\[^\n\r]*, %eax" 1 } } */
/* { dg-final { scan-assembler-times "flds\[^\n\r]*" 1 } } */
typedef struct
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-17.c b/gcc/testsuite/gcc.target/i386/pr90773-17.c
index 57074836..3036085 100644
--- a/gcc/testsuite/gcc.target/i386/pr90773-17.c
+++ b/gcc/testsuite/gcc.target/i386/pr90773-17.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -march=skylake-avx512" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
extern char *dst;
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-2.c b/gcc/testsuite/gcc.target/i386/pr90773-2.c
index 6449575..b5373ca 100644
--- a/gcc/testsuite/gcc.target/i386/pr90773-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr90773-2.c
@@ -13,7 +13,10 @@ foo (void)
/* { dg-final { scan-assembler-times "movdqu\[\\t \]+\\(%\[\^,\]+\\)," 1 { target { ! ia32 } } } } */
/* { dg-final { scan-assembler-times "movl\[\\t \]+15\\(%\[\^,\]+\\)," 1 { target { ! ia32 } } } } */
-/* { dg-final { scan-assembler-times "movl\[\\t \]+\\(%\[\^,\]+\\)," 1 { target ia32 } } } */
+/* PIC gets one extra match in get_pc_thunk, and two extra matches to load
+ dst's and src's values after loading their addresses from the GOT. */
+/* { dg-final { scan-assembler-times "movl\[\\t \]+\\(%\[\^,\]+\\)," 1 { target { ia32 && nonpic } } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]+\\(%\[\^,\]+\\)," 4 { target { ia32 && { ! nonpic } } } } } */
/* { dg-final { scan-assembler-times "movl\[\\t \]+4\\(%\[\^,\]+\\)," 1 { target ia32 } } } */
/* { dg-final { scan-assembler-times "movl\[\\t \]+8\\(%\[\^,\]+\\)," 1 { target ia32 } } } */
/* { dg-final { scan-assembler-times "movl\[\\t \]+12\\(%\[\^,\]+\\)," 1 { target ia32 } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr90773-3.c b/gcc/testsuite/gcc.target/i386/pr90773-3.c
index 84747c9..dd2430f 100644
--- a/gcc/testsuite/gcc.target/i386/pr90773-3.c
+++ b/gcc/testsuite/gcc.target/i386/pr90773-3.c
@@ -13,7 +13,10 @@ foo (void)
/* { dg-final { scan-assembler-times "movdqu\[\\t \]+\\(%\[\^,\]+\\)," 1 { target { ! ia32 } } } } */
/* { dg-final { scan-assembler-times "movdqu\[\\t \]+15\\(%\[\^,\]+\\)," 1 { target { ! ia32 } } } } */
-/* { dg-final { scan-assembler-times "movl\[\\t \]+\\(%\[\^,\]+\\)," 1 { target ia32 } } } */
+/* PIC gets one extra match in get_pc_thunk, and two extra matches to load
+ dst's and src's values after loading their addresses from the GOT. */
+/* { dg-final { scan-assembler-times "movl\[\\t \]+\\(%\[\^,\]+\\)," 1 { target { ia32 && nonpic } } } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]+\\(%\[\^,\]+\\)," 4 { target { ia32 && { ! nonpic } } } } } */
/* { dg-final { scan-assembler-times "movl\[\\t \]+4\\(%\[\^,\]+\\)," 1 { target ia32 } } } */
/* { dg-final { scan-assembler-times "movl\[\\t \]+8\\(%\[\^,\]+\\)," 1 { target ia32 } } } */
/* { dg-final { scan-assembler-times "movl\[\\t \]+12\\(%\[\^,\]+\\)," 1 { target ia32 } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr93492-5.c b/gcc/testsuite/gcc.target/i386/pr93492-5.c
index 5aebb38..1ca5ba1 100644
--- a/gcc/testsuite/gcc.target/i386/pr93492-5.c
+++ b/gcc/testsuite/gcc.target/i386/pr93492-5.c
@@ -1,5 +1,6 @@
/* { dg-do "compile" { target *-*-linux* } } */
/* { dg-options "-O1 -fpatchable-function-entry=1 -mfentry -pg -fasynchronous-unwind-tables" } */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* Test the placement of the .LPFE1 label. */
diff --git a/gcc/testsuite/gcc.target/i386/pr94913-2.c b/gcc/testsuite/gcc.target/i386/pr94913-2.c
index 22bca2b..199f3fe 100644
--- a/gcc/testsuite/gcc.target/i386/pr94913-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr94913-2.c
@@ -21,4 +21,8 @@ void fooi (unsigned long x, unsigned long y)
}
/* { dg-final { scan-assembler-not "cmp" } } */
-/* { dg-final { scan-assembler-times "add" 3 } } */
+/* On IA32, PIC adds one add per function to compute the PIC register, and
+ another add to adjust %esp in the epilogue needed to restore the PIC
+ register. */
+/* { dg-final { scan-assembler-times "add" 3 { target { ! { ia32 && { ! nonpic } } } } } } */
+/* { dg-final { scan-assembler-times "add" 9 { target { ia32 && { ! nonpic } } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr95126-m32-1.c b/gcc/testsuite/gcc.target/i386/pr95126-m32-1.c
index 1d6acd6..9dfe15d 100644
--- a/gcc/testsuite/gcc.target/i386/pr95126-m32-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr95126-m32-1.c
@@ -10,7 +10,8 @@ void call_func(void)
func(s);
}
-/* { dg-final { scan-assembler "movl\[ \\t]*\\\$" } } */
-/* { dg-final { scan-assembler "movb\[ \\t]*\\\$0, " } } */
-/* { dg-final { scan-assembler-not "movzwl" } } */
-
+/* The @GOTOFF addressing seems to prevent the optimization of the loads to
+ known constants. */
+/* { dg-final { scan-assembler "movl\[ \\t]*\\\$" { xfail { ! nonpic } } } } */
+/* { dg-final { scan-assembler "movb\[ \\t]*\\\$0, " { xfail { ! nonpic } } } } */
+/* { dg-final { scan-assembler-not "movzwl" { xfail { ! nonpic } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr95126-m32-2.c b/gcc/testsuite/gcc.target/i386/pr95126-m32-2.c
index b46be9d..f4d9123 100644
--- a/gcc/testsuite/gcc.target/i386/pr95126-m32-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr95126-m32-2.c
@@ -10,7 +10,8 @@ void call_func(void)
func(s);
}
-/* { dg-final { scan-assembler "movl\[ \\t]*\\\$" } } */
-/* { dg-final { scan-assembler "movb\[ \\t]*\\\$0, " } } */
-/* { dg-final { scan-assembler-not "movzwl" } } */
-
+/* The @GOTOFF addressing seems to prevent the optimization of the loads to
+ known constants. */
+/* { dg-final { scan-assembler "movl\[ \\t]*\\\$" { xfail { ! nonpic } } } } */
+/* { dg-final { scan-assembler "movb\[ \\t]*\\\$0, " { xfail { ! nonpic } } } } */
+/* { dg-final { scan-assembler-not "movzwl" { xfail { ! nonpic } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr95852-2.c b/gcc/testsuite/gcc.target/i386/pr95852-2.c
index de85cec..558308f 100644
--- a/gcc/testsuite/gcc.target/i386/pr95852-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr95852-2.c
@@ -3,7 +3,13 @@
/* { dg-options "-O2 -fdump-tree-optimized -masm=att" } */
/* { dg-final { scan-tree-dump-times " = \.MUL_OVERFLOW " 32 "optimized" } } */
/* { dg-final { scan-assembler-times "\tmull\t" 32 } } */
-/* { dg-final { scan-assembler-times "\tseto\t" 8 } } */
+/* In functions that return 0 on non-overflow (f2, f10, f18, f26), the overflow
+ flag is propagated to the return value's PHI node in the non-call path; on
+ ia32 PIC, sibcalls are not viable, so the known value of the flag can't be
+ propagated to the return block, that is only duplicated in bbro, too late
+ for fwprop2 or even cprop_hardreg. */
+/* { dg-final { scan-assembler-times "\tseto\t" 12 { target { ia32 && { ! nonpic } } } } } */
+/* { dg-final { scan-assembler-times "\tseto\t" 8 { target { nonpic || { ! ia32 } } } } } */
/* { dg-final { scan-assembler-times "\tsetno\t" 8 } } */
/* { dg-final { scan-assembler-times "\tjn\?o\t" 16 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr95852-4.c b/gcc/testsuite/gcc.target/i386/pr95852-4.c
index f8b4656..cb48b61 100644
--- a/gcc/testsuite/gcc.target/i386/pr95852-4.c
+++ b/gcc/testsuite/gcc.target/i386/pr95852-4.c
@@ -3,7 +3,13 @@
/* { dg-options "-O2 -fdump-tree-optimized -masm=att" } */
/* { dg-final { scan-tree-dump-times " = \.MUL_OVERFLOW " 32 "optimized" } } */
/* { dg-final { scan-assembler-times "\timull\t" 32 } } */
-/* { dg-final { scan-assembler-times "\tseto\t" 8 } } */
+/* In functions that return 0 on non-overflow (f2, f10, f18, f26), the overflow
+ flag is propagated to the return value's PHI node in the non-call path; on
+ ia32 PIC, sibcalls are not viable, so the known value of the flag can't be
+ propagated to the return block, that is only duplicated in bbro, too late
+ for fwprop2 or even cprop_hardreg. */
+/* { dg-final { scan-assembler-times "\tseto\t" 12 { target { ia32 && { ! nonpic } } } } } */
+/* { dg-final { scan-assembler-times "\tseto\t" 8 { target { nonpic || { ! ia32 } } } } } */
/* { dg-final { scan-assembler-times "\tsetno\t" 8 } } */
/* { dg-final { scan-assembler-times "\tjn\?o\t" 16 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr96539.c b/gcc/testsuite/gcc.target/i386/pr96539.c
index fc164f8..696929b 100644
--- a/gcc/testsuite/gcc.target/i386/pr96539.c
+++ b/gcc/testsuite/gcc.target/i386/pr96539.c
@@ -1,6 +1,9 @@
/* PR rtl-optimization/96539 */
/* { dg-do compile } *
/* { dg-options "-Os" } */
+/* The need to restore the PIC register prevents PLT tail-calls on ia32,
+ so S has to be copied to call baz. */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
/* { dg-final { scan-assembler-not "rep\[^\n\r]\*movs" } } */
struct A { int a, b, c, d, e, f; void *g, *h, *i, *j, *k, *l, *m; };
diff --git a/gcc/testsuite/gcc.target/i386/sse2-bfloat16-1.c b/gcc/testsuite/gcc.target/i386/sse2-bfloat16-1.c
new file mode 100644
index 0000000..612d55b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse2-bfloat16-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-sse2" } */
+
+__bf16/* { dg-error "unknown type name '__bf16'" } */
+foo (__bf16 x) /* { dg-error "unknown type name '__bf16'" } */
+{
+ return x;
+}
diff --git a/gcc/testsuite/gcc.target/i386/sse2-bfloat16-2.c b/gcc/testsuite/gcc.target/i386/sse2-bfloat16-2.c
new file mode 100644
index 0000000..a3286e2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse2-bfloat16-2.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2 -mno-avx512f" } */
+
+union flt
+{
+ __bf16 flt;
+ short s;
+};
+
+__bf16
+foo (union flt x)
+{
+ return x.flt;
+}
+
+/* { dg-final { scan-assembler {(?n)pinsrw[\t ].*%xmm0} { target ia32 } } } */
+/* { dg-final { scan-assembler {(?n)movd[\t ].*%xmm0} { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/sse2-bfloat16-scalar-typecheck.c b/gcc/testsuite/gcc.target/i386/sse2-bfloat16-scalar-typecheck.c
new file mode 100644
index 0000000..52b53b9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse2-bfloat16-scalar-typecheck.c
@@ -0,0 +1,215 @@
+/* { dg-do compile } */
+/* { dg-options "-msse2 -O2" } */
+
+
+__bf16 glob_bfloat;
+
+int is_an_int;
+short is_a_short_int;
+float is_a_float;
+float is_a_float16;
+double is_a_double;
+
+float *float_ptr;
+
+__bf16 foo1 (void) { return (__bf16) 0x1234; } /* { dg-error {invalid conversion to type '__bf16'} } */
+__bf16 foo2 (void) { return (__bf16) (short) 0x1234; } /* { dg-error {invalid conversion to type '__bf16'} } */
+
+__bf16 footest (__bf16 scalar0)
+{
+
+ /* Initialisation */
+
+ __bf16 scalar1_1;
+ __bf16 scalar1_2 = glob_bfloat;
+ __bf16 scalar1_3 = 0; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __bf16 scalar1_4 = 0.1; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __bf16 scalar1_5 = is_a_float; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __bf16 scalar1_6 = is_an_int; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __bf16 scalar1_7 = is_a_float16; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __bf16 scalar1_8 = is_a_double; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __bf16 scalar1_9 = is_a_short_int; /* { dg-error {invalid conversion to type '__bf16'} } */
+
+ int initi_1_1 = glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */
+ float initi_1_2 = glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */
+ _Float16 initi_1_3 = glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */
+ short initi_1_4 = glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */
+ double initi_1_5 = glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */
+
+ __bf16 scalar2_1 = {};
+ __bf16 scalar2_2 = { glob_bfloat };
+ __bf16 scalar2_3 = { 0 }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __bf16 scalar2_4 = { 0.1 }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __bf16 scalar2_5 = { is_a_float }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __bf16 scalar2_6 = { is_an_int }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __bf16 scalar2_7 = { is_a_float16 }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __bf16 scalar2_8 = { is_a_double }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __bf16 scalar2_9 = { is_a_short_int }; /* { dg-error {invalid conversion to type '__bf16'} } */
+
+ int initi_2_1 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */
+ float initi_2_2 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */
+ _Float16 initi_2_3 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */
+ short initi_2_4 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */
+ double initi_2_5 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */
+
+ /* Assignments. */
+
+ glob_bfloat = glob_bfloat;
+ glob_bfloat = 0; /* { dg-error {invalid conversion to type '__bf16'} } */
+ glob_bfloat = 0.1; /* { dg-error {invalid conversion to type '__bf16'} } */
+ glob_bfloat = is_a_float; /* { dg-error {invalid conversion to type '__bf16'} } */
+ glob_bfloat = is_an_int; /* { dg-error {invalid conversion to type '__bf16'} } */
+ glob_bfloat = is_a_float16; /* { dg-error {invalid conversion to type '__bf16'} } */
+ glob_bfloat = is_a_double; /* { dg-error {invalid conversion to type '__bf16'} } */
+ glob_bfloat = is_a_short_int; /* { dg-error {invalid conversion to type '__bf16'} } */
+
+ is_an_int = glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */
+ is_a_float = glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */
+ is_a_float16 = glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */
+ is_a_double = glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */
+ is_a_short_int = glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */
+
+ /* Casting. */
+
+ (void) glob_bfloat;
+ (__bf16) glob_bfloat;
+
+ (int) glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */
+ (float) glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */
+ (_Float16) glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */
+ (double) glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */
+ (short) glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */
+
+ (__bf16) is_an_int; /* { dg-error {invalid conversion to type '__bf16'} } */
+ (__bf16) is_a_float; /* { dg-error {invalid conversion to type '__bf16'} } */
+ (__bf16) is_a_float16; /* { dg-error {invalid conversion to type '__bf16'} } */
+ (__bf16) is_a_double; /* { dg-error {invalid conversion to type '__bf16'} } */
+ (__bf16) is_a_short_int; /* { dg-error {invalid conversion to type '__bf16'} } */
+
+ /* Compound literals. */
+
+ (__bf16) {};
+ (__bf16) { glob_bfloat };
+ (__bf16) { 0 }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ (__bf16) { 0.1 }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ (__bf16) { is_a_float }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ (__bf16) { is_an_int }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ (__bf16) { is_a_float16 }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ (__bf16) { is_a_double }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ (__bf16) { is_a_short_int }; /* { dg-error {invalid conversion to type '__bf16'} } */
+
+ (int) { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */
+ (float) { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */
+ (_Float16) { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */
+ (double) { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */
+ (short) { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */
+
+ /* Arrays and Structs. */
+
+ typedef __bf16 array_type[2];
+ extern __bf16 extern_array[];
+
+ __bf16 array[2];
+ __bf16 zero_length_array[0];
+ __bf16 empty_init_array[] = {};
+ typedef __bf16 some_other_type[is_an_int];
+
+ struct struct1 {
+ __bf16 a;
+ };
+
+ union union1 {
+ __bf16 a;
+ };
+
+ /* Addressing and dereferencing. */
+
+ __bf16 *bfloat_ptr = &scalar0;
+ scalar0 = *bfloat_ptr;
+
+ /* Pointer assignment. */
+
+ __bf16 *bfloat_ptr2 = bfloat_ptr;
+ __bf16 *bfloat_ptr3 = array;
+
+ /* Pointer arithmetic. */
+
+ ++bfloat_ptr;
+ --bfloat_ptr;
+ bfloat_ptr++;
+ bfloat_ptr--;
+ bfloat_ptr += 1;
+ bfloat_ptr -= 1;
+ bfloat_ptr - bfloat_ptr2;
+ bfloat_ptr = &bfloat_ptr3[0];
+ bfloat_ptr = &bfloat_ptr3[1];
+
+ /* Simple comparison. */
+ scalar0 > glob_bfloat; /* { dg-error {operation not permitted on type '__bf16'} } */
+ glob_bfloat == scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ scalar0 > is_a_float; /* { dg-error {operation not permitted on type '__bf16'} } */
+ is_a_float == scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ scalar0 > 0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ 0 == scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ scalar0 > 0.1; /* { dg-error {operation not permitted on type '__bf16'} } */
+ 0.1 == scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ scalar0 > is_an_int; /* { dg-error {operation not permitted on type '__bf16'} } */
+ is_an_int == scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */
+
+ /* Pointer comparison. */
+
+ bfloat_ptr == &scalar0;
+ bfloat_ptr != &scalar0;
+ bfloat_ptr < &scalar0;
+ bfloat_ptr <= &scalar0;
+ bfloat_ptr > &scalar0;
+ bfloat_ptr >= &scalar0;
+ bfloat_ptr == bfloat_ptr2;
+ bfloat_ptr != bfloat_ptr2;
+ bfloat_ptr < bfloat_ptr2;
+ bfloat_ptr <= bfloat_ptr2;
+ bfloat_ptr > bfloat_ptr2;
+ bfloat_ptr >= bfloat_ptr2;
+
+ /* Conditional expressions. */
+
+ 0 ? scalar0 : scalar0;
+ 0 ? scalar0 : is_a_float; /* { dg-error {invalid conversion from type '__bf16'} } */
+ 0 ? is_a_float : scalar0; /* { dg-error {invalid conversion from type '__bf16'} } */
+ 0 ? scalar0 : 0; /* { dg-error {invalid conversion to type '__bf16'} } */
+ 0 ? 0 : scalar0; /* { dg-error {invalid conversion to type '__bf16'} } */
+ 0 ? 0.1 : scalar0; /* { dg-error {invalid conversion from type '__bf16'} } */
+ 0 ? scalar0 : 0.1; /* { dg-error {invalid conversion from type '__bf16'} } */
+ 0 ? bfloat_ptr : bfloat_ptr2;
+ 0 ? bfloat_ptr : float_ptr; /* { dg-warning {pointer type mismatch in conditional expression} } */
+ 0 ? float_ptr : bfloat_ptr; /* { dg-warning {pointer type mismatch in conditional expression} } */
+
+ scalar0 ? scalar0 : scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ scalar0 ? is_a_float : scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ scalar0 ? scalar0 : is_a_float; /* { dg-error {operation not permitted on type '__bf16'} } */
+ scalar0 ? is_a_float : is_a_float; /* { dg-error {operation not permitted on type '__bf16'} } */
+
+ /* Unary operators. */
+
+ +scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ -scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ ~scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ !scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ *scalar0; /* { dg-error {invalid type argument of unary '\*'} } */
+ __real scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ __imag scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ ++scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ --scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ scalar0++; /* { dg-error {operation not permitted on type '__bf16'} } */
+ scalar0--; /* { dg-error {operation not permitted on type '__bf16'} } */
+
+ /* Binary arithmetic operations. */
+
+ scalar0 = glob_bfloat + *bfloat_ptr; /* { dg-error {operation not permitted on type '__bf16'} } */
+ scalar0 = glob_bfloat + 0.1; /* { dg-error {operation not permitted on type '__bf16'} } */
+ scalar0 = glob_bfloat + 0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ scalar0 = glob_bfloat + is_a_float; /* { dg-error {operation not permitted on type '__bf16'} } */
+
+ return scalar0;
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-stv-7.c b/gcc/testsuite/gcc.target/i386/sse4_1-stv-7.c
new file mode 100644
index 0000000..b0d5fce
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-stv-7.c
@@ -0,0 +1,18 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O2 -msse4.1 -mstv -mno-stackrealign" } */
+
+unsigned __int128 a;
+unsigned __int128 b;
+
+void foo()
+{
+ a = b << 16;
+}
+
+void bar()
+{
+ a = b >> 16;
+}
+
+/* { dg-final { scan-assembler "pslldq" } } */
+/* { dg-final { scan-assembler "psrldq" } } */
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-stv-8.c b/gcc/testsuite/gcc.target/i386/sse4_1-stv-8.c
new file mode 100644
index 0000000..5c5d803
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-stv-8.c
@@ -0,0 +1,11 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O2 -msse4.1 -mstv -mno-stackrealign" } */
+
+__int128 a,b;
+int foo()
+{
+ return (a & b) != 0;
+}
+
+/* { dg-final { scan-assembler-not "pand" } } */
+/* { dg-final { scan-assembler "ptest" } } */
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-stv-9.c b/gcc/testsuite/gcc.target/i386/sse4_1-stv-9.c
new file mode 100644
index 0000000..ee5af3c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-stv-9.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O2 -msse4.1 -mstv -mno-stackrealign" } */
+
+unsigned __int128 a, b;
+void rot1() { a = (b >> 1) | (b << 127); }
+void rot4() { a = (b >> 4) | (b << 124); }
+void rot8() { a = (b >> 8) | (b << 120); }
+void rot32() { a = (b >> 32) | (b << 96); }
+void rot64() { a = (b >> 64) | (b << 64); }
+
+/* { dg-final { scan-assembler-not "shrdq" } } */
+/* { dg-final { scan-assembler "pshufd" } } */
diff --git a/gcc/testsuite/gcc.target/i386/stack-check-12.c b/gcc/testsuite/gcc.target/i386/stack-check-12.c
index 74d3a26..aa9c233 100644
--- a/gcc/testsuite/gcc.target/i386/stack-check-12.c
+++ b/gcc/testsuite/gcc.target/i386/stack-check-12.c
@@ -11,8 +11,9 @@ f (void)
}
/* { dg-final { scan-assembler-not "or\[ql\]" } } */
-/* { dg-final { scan-assembler "pushl %esi" { target ia32 } } } */
-/* { dg-final { scan-assembler "popl %esi" { target ia32 } } }*/
+/* On ia32 PIC, saving the PIC register requires a stack frame, which does away
+ with the need for the dummy %esi pushing and popping for stack probing. */
+/* { dg-final { scan-assembler "pushl %esi" { target { ia32 && nonpic } } } } */
+/* { dg-final { scan-assembler "popl %esi" { target { ia32 && nonpic } } } } */
/* { dg-final { scan-assembler "pushq %rax" { target { ! ia32 } } } } */
-/* { dg-final { scan-assembler "popq %rax" { target { ! ia32 } } } }*/
-
+/* { dg-final { scan-assembler "popq %rax" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/stack-check-17.c b/gcc/testsuite/gcc.target/i386/stack-check-17.c
index 25ae977..b3e41cb 100644
--- a/gcc/testsuite/gcc.target/i386/stack-check-17.c
+++ b/gcc/testsuite/gcc.target/i386/stack-check-17.c
@@ -31,9 +31,11 @@ f3 (void)
into either a stack slot or callee saved register. The former
would be rather dumb. So assume it does not happen.
- So search for two/four pushes for the callee register saves/argument
- pushes and no pops (since the function has no reachable epilogue). */
+ So search for two/four pushes for the callee register saves/argument pushes
+ (plus one for the PIC register if needed on ia32) and no pops (since the
+ function has no reachable epilogue). */
/* { dg-final { scan-assembler-times "push\[ql\]" 2 { target { ! ia32 } } } } */
-/* { dg-final { scan-assembler-times "push\[ql\]" 4 { target { ia32 } } } } */
+/* { dg-final { scan-assembler-times "push\[ql\]" 4 { target { ia32 && nonpic } } } } */
+/* { dg-final { scan-assembler-times "push\[ql\]" 5 { target { ia32 && { ! nonpic } } } } } */
/* { dg-final { scan-assembler-not "pop" } } */
diff --git a/gcc/testsuite/gcc.target/i386/stack-prot-sym.c b/gcc/testsuite/gcc.target/i386/stack-prot-sym.c
index dcd7cbd..81790f6 100644
--- a/gcc/testsuite/gcc.target/i386/stack-prot-sym.c
+++ b/gcc/testsuite/gcc.target/i386/stack-prot-sym.c
@@ -1,6 +1,8 @@
/* { dg-do compile } */
/* { dg-require-effective-target tls_native } */
/* { dg-options "-O2 -fstack-protector-all -mstack-protector-guard=tls -mstack-protector-guard-reg=gs -mstack-protector-guard-symbol=my_guard" } */
+/* We don't expect GOT relocations; should we? */
+/* { dg-additional-options "-fno-PIE" { target ia32 } } */
void f(void) { }
diff --git a/gcc/testsuite/gcc.target/i386/vect-bfloat16-1.c b/gcc/testsuite/gcc.target/i386/vect-bfloat16-1.c
new file mode 100644
index 0000000..dd33f1a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-bfloat16-1.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+
+/* { dg-final { scan-assembler-times "vpbroadcastw" 1 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "vpblendw" 1 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "vmovsh" 1 { target { ! ia32 } } } } */
+
+/* { dg-final { scan-assembler-times "vpinsrw" 2 { target ia32 } } } */
+#include <immintrin.h>
+
+typedef __bf16 __v8bf __attribute__ ((__vector_size__ (16)));
+typedef __bf16 __m128bf16 __attribute__ ((__vector_size__ (16), __may_alias__));
+
+__m128bf16
+__attribute__ ((noinline, noclone))
+foo1 (__m128bf16 a, __bf16 f)
+{
+ __v8bf x = (__v8bf) a;
+ x[2] = f;
+ return (__m128bf16) x;
+}
+
+__m128bf16
+__attribute__ ((noinline, noclone))
+foo2 (__m128bf16 a, __bf16 f)
+{
+ __v8bf x = (__v8bf) a;
+ x[0] = f;
+ return (__m128bf16) x;
+}
diff --git a/gcc/testsuite/gcc.target/i386/vect-bfloat16-2a.c b/gcc/testsuite/gcc.target/i386/vect-bfloat16-2a.c
new file mode 100644
index 0000000..70152d0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-bfloat16-2a.c
@@ -0,0 +1,121 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+
+typedef __bf16 v8bf __attribute__ ((__vector_size__ (16)));
+typedef __bf16 v16bf __attribute__ ((__vector_size__ (32)));
+typedef __bf16 v32bf __attribute__ ((__vector_size__ (64)));
+
+#define VEC_EXTRACT(V,S,IDX) \
+ S \
+ __attribute__((noipa)) \
+ vec_extract_##V##_##IDX (V v) \
+ { \
+ return v[IDX]; \
+ }
+
+#define VEC_SET(V,S,IDX) \
+ V \
+ __attribute__((noipa)) \
+ vec_set_##V##_##IDX (V v, S s) \
+ { \
+ v[IDX] = s; \
+ return v; \
+ }
+
+v8bf
+vec_init_v8bf (__bf16 a1, __bf16 a2, __bf16 a3, __bf16 a4,
+ __bf16 a5, __bf16 a6, __bf16 a7, __bf16 a8)
+{
+ return __extension__ (v8bf) {a1, a2, a3, a4, a5, a6, a7, a8};
+}
+
+v16bf
+vec_init_v16bf (__bf16 a1, __bf16 a2, __bf16 a3, __bf16 a4,
+ __bf16 a5, __bf16 a6, __bf16 a7, __bf16 a8,
+ __bf16 a9, __bf16 a10, __bf16 a11, __bf16 a12,
+ __bf16 a13, __bf16 a14, __bf16 a15, __bf16 a16)
+{
+ return __extension__ (v16bf) {a1, a2, a3, a4, a5, a6, a7, a8,
+ a9, a10, a11, a12, a13, a14, a15, a16};
+}
+
+v32bf
+vec_init_v32bf (__bf16 a1, __bf16 a2, __bf16 a3, __bf16 a4,
+ __bf16 a5, __bf16 a6, __bf16 a7, __bf16 a8,
+ __bf16 a9, __bf16 a10, __bf16 a11, __bf16 a12,
+ __bf16 a13, __bf16 a14, __bf16 a15, __bf16 a16,
+ __bf16 a17, __bf16 a18, __bf16 a19, __bf16 a20,
+ __bf16 a21, __bf16 a22, __bf16 a23, __bf16 a24,
+ __bf16 a25, __bf16 a26, __bf16 a27, __bf16 a28,
+ __bf16 a29, __bf16 a30, __bf16 a31, __bf16 a32)
+{
+ return __extension__ (v32bf) {a1, a2, a3, a4, a5, a6, a7, a8,
+ a9, a10, a11, a12, a13, a14, a15, a16,
+ a17, a18, a19, a20, a21, a22, a23, a24,
+ a25, a26, a27, a28, a29, a30, a31, a32};
+}
+
+v8bf
+vec_init_dup_v8bf (__bf16 a1)
+{
+ return __extension__ (v8bf) {a1, a1, a1, a1, a1, a1, a1, a1};
+}
+
+v16bf
+vec_init_dup_v16bf (__bf16 a1)
+{
+ return __extension__ (v16bf) {a1, a1, a1, a1, a1, a1, a1, a1,
+ a1, a1, a1, a1, a1, a1, a1, a1};
+}
+
+v32bf
+vec_init_dup_v32bf (__bf16 a1)
+{
+ return __extension__ (v32bf) {a1, a1, a1, a1, a1, a1, a1, a1,
+ a1, a1, a1, a1, a1, a1, a1, a1,
+ a1, a1, a1, a1, a1, a1, a1, a1,
+ a1, a1, a1, a1, a1, a1, a1, a1};
+}
+
+/* { dg-final { scan-assembler-times "vpunpcklwd" 28 } } */
+/* { dg-final { scan-assembler-times "vpunpckldq" 14 } } */
+/* { dg-final { scan-assembler-times "vpunpcklqdq" 7 } } */
+
+VEC_EXTRACT (v8bf, __bf16, 0);
+VEC_EXTRACT (v8bf, __bf16, 4);
+VEC_EXTRACT (v16bf, __bf16, 0);
+VEC_EXTRACT (v16bf, __bf16, 3);
+VEC_EXTRACT (v16bf, __bf16, 8);
+VEC_EXTRACT (v16bf, __bf16, 15);
+VEC_EXTRACT (v32bf, __bf16, 0);
+VEC_EXTRACT (v32bf, __bf16, 5);
+VEC_EXTRACT (v32bf, __bf16, 8);
+VEC_EXTRACT (v32bf, __bf16, 14);
+VEC_EXTRACT (v32bf, __bf16, 16);
+VEC_EXTRACT (v32bf, __bf16, 24);
+VEC_EXTRACT (v32bf, __bf16, 28);
+/* { dg-final { scan-assembler-times "vpsrldq\[\t ]*\\\$8" 2 } } */
+/* { dg-final { scan-assembler-times "vpsrldq\[\t ]*\\\$6" 1 } } */
+/* { dg-final { scan-assembler-times "vpsrldq\[\t ]*\\\$14" 1 } } */
+/* { dg-final { scan-assembler-times "vpsrldq\[\t ]*\\\$10" 1 } } */
+/* { dg-final { scan-assembler-times "vpsrldq\[\t ]*\\\$12" 1 } } */
+/* { dg-final { scan-assembler-times "vextract" 9 } } */
+
+VEC_SET (v8bf, __bf16, 4);
+VEC_SET (v16bf, __bf16, 3);
+VEC_SET (v16bf, __bf16, 8);
+VEC_SET (v16bf, __bf16, 15);
+VEC_SET (v32bf, __bf16, 5);
+VEC_SET (v32bf, __bf16, 8);
+VEC_SET (v32bf, __bf16, 14);
+VEC_SET (v32bf, __bf16, 16);
+VEC_SET (v32bf, __bf16, 24);
+VEC_SET (v32bf, __bf16, 28);
+/* { dg-final { scan-assembler-times "vpbroadcastw" 13 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "vpblendw" 4 { target { ! ia32 } } } } */
+
+/* { dg-final { scan-assembler-times "vpbroadcastw" 12 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "vpblendw" 3 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "vpinsrw" 1 { target ia32 } } } */
+
+/* { dg-final { scan-assembler-times "vpblendd" 3 } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-bfloat16-2b.c b/gcc/testsuite/gcc.target/i386/vect-bfloat16-2b.c
new file mode 100644
index 0000000..29bf601
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-bfloat16-2b.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -mno-avx512bw -O2" } */
+
+#include "vect-bfloat16-2a.c"
+
+/* { dg-final { scan-assembler-times "vpunpcklwd" 28 } } */
+/* { dg-final { scan-assembler-times "vpunpckldq" 14 } } */
+/* { dg-final { scan-assembler-times "vpunpcklqdq" 7 } } */
+
+/* { dg-final { scan-assembler-times "vpsrldq\[\t ]*\\\$8" 1 } } */
+/* { dg-final { scan-assembler-times "vpsrldq\[\t ]*\\\$6" 1 } } */
+/* { dg-final { scan-assembler-times "vpsrldq\[\t ]*\\\$14" 1 } } */
+/* { dg-final { scan-assembler-times "vextract" 2 } } */
+
+/* { dg-final { scan-assembler-times "vpbroadcastw" 7 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "vpblendw" 4 { target { ! ia32 } } } } */
+
+/* { dg-final { scan-assembler-times "vpbroadcastw" 6 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "vpblendw" 3 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "vpinsrw" 63 { target ia32 } } } */
+
+/* { dg-final { scan-assembler-times "vpblendd" 3 } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-bfloat16-2c.c b/gcc/testsuite/gcc.target/i386/vect-bfloat16-2c.c
new file mode 100644
index 0000000..bead94e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-bfloat16-2c.c
@@ -0,0 +1,76 @@
+/* { dg-do compile } */
+/* { dg-options "-mf16c -msse2 -mno-avx2 -O2" } */
+
+typedef __bf16 v8bf __attribute__ ((__vector_size__ (16)));
+typedef __bf16 v16bf __attribute__ ((__vector_size__ (32)));
+
+#define VEC_EXTRACT(V,S,IDX) \
+ S \
+ __attribute__((noipa)) \
+ vec_extract_##V##_##IDX (V v) \
+ { \
+ return v[IDX]; \
+ }
+
+#define VEC_SET(V,S,IDX) \
+ V \
+ __attribute__((noipa)) \
+ vec_set_##V##_##IDX (V v, S s) \
+ { \
+ v[IDX] = s; \
+ return v; \
+ }
+
+v8bf
+vec_init_v8bf (__bf16 a1, __bf16 a2, __bf16 a3, __bf16 a4,
+ __bf16 a5, __bf16 a6, __bf16 a7, __bf16 a8)
+{
+ return __extension__ (v8bf) {a1, a2, a3, a4, a5, a6, a7, a8};
+}
+
+v16bf
+vec_init_v16bf (__bf16 a1, __bf16 a2, __bf16 a3, __bf16 a4,
+ __bf16 a5, __bf16 a6, __bf16 a7, __bf16 a8,
+ __bf16 a9, __bf16 a10, __bf16 a11, __bf16 a12,
+ __bf16 a13, __bf16 a14, __bf16 a15, __bf16 a16)
+{
+ return __extension__ (v16bf) {a1, a2, a3, a4, a5, a6, a7, a8,
+ a9, a10, a11, a12, a13, a14, a15, a16};
+}
+
+v8bf
+vec_init_dup_v8bf (__bf16 a1)
+{
+ return __extension__ (v8bf) {a1, a1, a1, a1, a1, a1, a1, a1};
+}
+
+v16bf
+vec_init_dup_v16bf (__bf16 a1)
+{
+ return __extension__ (v16bf) {a1, a1, a1, a1, a1, a1, a1, a1,
+ a1, a1, a1, a1, a1, a1, a1, a1};
+}
+
+/* { dg-final { scan-assembler-times "vpunpcklwd" 12 } } */
+/* { dg-final { scan-assembler-times "vpunpckldq" 6 } } */
+/* { dg-final { scan-assembler-times "vpunpcklqdq" 3 } } */
+
+VEC_EXTRACT (v8bf, __bf16, 0);
+VEC_EXTRACT (v8bf, __bf16, 4);
+VEC_EXTRACT (v16bf, __bf16, 0);
+VEC_EXTRACT (v16bf, __bf16, 3);
+VEC_EXTRACT (v16bf, __bf16, 8);
+VEC_EXTRACT (v16bf, __bf16, 15);
+/* { dg-final { scan-assembler-times "vpsrldq\[\t ]*\\\$8" 1 } } */
+/* { dg-final { scan-assembler-times "vpsrldq\[\t ]*\\\$6" 1 } } */
+/* { dg-final { scan-assembler-times "vpsrldq\[\t ]*\\\$14" 1 } } */
+/* { dg-final { scan-assembler-times "vextract" 4 } } */
+
+VEC_SET (v8bf, __bf16, 4);
+VEC_SET (v16bf, __bf16, 3);
+VEC_SET (v16bf, __bf16, 8);
+VEC_SET (v16bf, __bf16, 15);
+/* { dg-final { scan-assembler-times "vpblendw" 3 { target { ! ia32 } } } } */
+
+/* { dg-final { scan-assembler-times "vpinsrw" 30 { target ia32 } } } */
+
diff --git a/gcc/testsuite/gcc.target/i386/vect-bfloat16-typecheck_1.c b/gcc/testsuite/gcc.target/i386/vect-bfloat16-typecheck_1.c
new file mode 100644
index 0000000..3804bac
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-bfloat16-typecheck_1.c
@@ -0,0 +1,258 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+
+#include <immintrin.h>
+
+typedef __bf16 __v8bf __attribute__ ((__vector_size__ (16)));
+typedef __bf16 __m128bf16 __attribute__ ((__vector_size__ (16), __may_alias__));
+
+__bf16 glob_bfloat;
+__m128bf16 glob_bfloat_vec;
+
+__m256 is_a_float_vec;
+__m128 is_a_float_pair;
+
+__m128h *float_ptr;
+__m128h is_a_float16_vec;
+
+__v8si is_an_int_vec;
+__v4si is_an_int_pair;
+__v8hi is_a_short_vec;
+
+int is_an_int;
+short is_a_short_int;
+float is_a_float;
+float is_a_float16;
+double is_a_double;
+
+__m128bf16 footest (__m128bf16 vector0)
+{
+ /* Initialisation */
+
+ __m128bf16 vector1_1;
+ __m128bf16 vector1_2 = glob_bfloat_vec;
+ __m128bf16 vector1_3 = is_a_float_vec; /* { dg-error {incompatible types when initializing type '__m128bf16' {aka '__vector\(8\) __bf16'} using type '__m256'} }*/
+ __m128bf16 vector1_4 = is_an_int_vec; /* { dg-error {incompatible types when initializing type '__m128bf16' {aka '__vector\(8\) __bf16'} using type '__v8si'} } */
+ __m128bf16 vector1_5 = is_a_float16_vec; /* { dg-error {incompatible types when initializing type '__m128bf16' {aka '__vector\(8\) __bf16'} using type '__m128h'} } */
+ __m128bf16 vector1_6 = is_a_float_pair; /* { dg-error {incompatible types when initializing type '__m128bf16' {aka '__vector\(8\) __bf16'} using type '__m128'} } */
+ __m128bf16 vector1_7 = is_an_int_pair; /* { dg-error {incompatible types when initializing type '__m128bf16' {aka '__vector\(8\) __bf16'} using type '__v4si'} } */
+ __m128bf16 vector1_8 = is_a_short_vec; /* { dg-error {incompatible types when initializing type '__m128bf16' {aka '__vector\(8\) __bf16'} using type '__v8hi'} } */
+
+ __v8si initi_1_1 = glob_bfloat_vec; /* { dg-error {incompatible types when initializing type '__v8si' using type '__m128bf16' {aka '__vector\(8\) __bf16'}} } */
+ __m256 initi_1_2 = glob_bfloat_vec; /* { dg-error {incompatible types when initializing type '__m256' using type '__m128bf16' {aka '__vector\(8\) __bf16'}} } */
+ __m128h initi_1_3 = glob_bfloat_vec; /* { dg-error {incompatible types when initializing type '__m128h' using type '__m128bf16' {aka '__vector\(8\) __bf16'}} } */
+ __m128 initi_1_4 = glob_bfloat_vec; /* { dg-error {incompatible types when initializing type '__m128' using type '__m128bf16' {aka '__vector\(8\) __bf16'}} } */
+ __v4si initi_1_5 = glob_bfloat_vec; /* { dg-error {incompatible types when initializing type '__v4si' using type '__m128bf16' {aka '__vector\(8\) __bf16'}} } */
+ __v4hi initi_1_6 = glob_bfloat_vec; /* { dg-error {incompatible types when initializing type '__v4hi' using type '__m128bf16' {aka '__vector\(8\) __bf16'}} } */
+
+ __m128bf16 vector2_1 = {};
+ __m128bf16 vector2_2 = { glob_bfloat };
+ __m128bf16 vector2_3 = { glob_bfloat, glob_bfloat, glob_bfloat, glob_bfloat };
+ __m128bf16 vector2_4 = { 0 }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __m128bf16 vector2_5 = { 0.1 }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __m128bf16 vector2_6 = { is_a_float16 }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __m128bf16 vector2_7 = { is_a_float }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __m128bf16 vector2_8 = { is_an_int }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __m128bf16 vector2_9 = { is_a_short_int }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __m128bf16 vector2_10 = { 0.0, 0, is_a_short_int, is_a_float }; /* { dg-error {invalid conversion to type '__bf16'} } */
+
+ __v8si initi_2_1 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */
+ __m256 initi_2_2 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */
+ __m128h initi_2_3 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */
+ __m128 initi_2_4 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */
+ __v4si initi_2_5 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */
+ __v4hi initi_2_6 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */
+
+ /* Assignments to/from vectors. */
+
+ glob_bfloat_vec = glob_bfloat_vec;
+ glob_bfloat_vec = 0; /* { dg-error {incompatible types when assigning to type '__m128bf16' {aka '__vector\(8\) __bf16'} from type 'int'} } */
+ glob_bfloat_vec = 0.1; /* { dg-error {incompatible types when assigning to type '__m128bf16' {aka '__vector\(8\) __bf16'} from type 'double'} } */
+ glob_bfloat_vec = is_a_float_vec; /* { dg-error {incompatible types when assigning to type '__m128bf16' {aka '__vector\(8\) __bf16'} from type '__m256'} } */
+ glob_bfloat_vec = is_an_int_vec; /* { dg-error {incompatible types when assigning to type '__m128bf16' {aka '__vector\(8\) __bf16'} from type '__v8si'} } */
+ glob_bfloat_vec = is_a_float16_vec; /* { dg-error {incompatible types when assigning to type '__m128bf16' {aka '__vector\(8\) __bf16'} from type '__m128h'} } */
+ glob_bfloat_vec = is_a_float_pair; /* { dg-error {incompatible types when assigning to type '__m128bf16' {aka '__vector\(8\) __bf16'} from type '__m128'} } */
+ glob_bfloat_vec = is_an_int_pair; /* { dg-error {incompatible types when assigning to type '__m128bf16' {aka '__vector\(8\) __bf16'} from type '__v4si'} } */
+ glob_bfloat_vec = is_a_short_vec; /* { dg-error {incompatible types when assigning to type '__m128bf16' {aka '__vector\(8\) __bf16'} from type '__v8hi'} } */
+
+ is_an_int_vec = glob_bfloat_vec; /* { dg-error {incompatible types when assigning to type '__v8si' from type '__m128bf16' {aka '__vector\(8\) __bf16'}} } */
+ is_a_float_vec = glob_bfloat_vec; /* { dg-error {incompatible types when assigning to type '__m256' from type '__m128bf16' {aka '__vector\(8\) __bf16'}} } */
+ is_a_float16_vec = glob_bfloat_vec; /* { dg-error {incompatible types when assigning to type '__m128h' from type '__m128bf16' {aka '__vector\(8\) __bf16'}} } */
+ is_a_float_pair = glob_bfloat_vec; /* { dg-error {incompatible types when assigning to type '__m128' from type '__m128bf16' {aka '__vector\(8\) __bf16'}} } */
+ is_an_int_pair = glob_bfloat_vec; /* { dg-error {incompatible types when assigning to type '__v4si' from type '__m128bf16' {aka '__vector\(8\) __bf16'}} } */
+ is_a_short_vec = glob_bfloat_vec;/* { dg-error {incompatible types when assigning to type '__v8hi' from type '__m128bf16' {aka '__vector\(8\) __bf16'}} } */
+
+ /* Assignments to/from elements. */
+
+ vector2_3[0] = glob_bfloat;
+ vector2_3[0] = is_an_int; /* { dg-error {invalid conversion to type '__bf16'} } */
+ vector2_3[0] = is_a_short_int; /* { dg-error {invalid conversion to type '__bf16'} } */
+ vector2_3[0] = is_a_float; /* { dg-error {invalid conversion to type '__bf16'} } */
+ vector2_3[0] = is_a_float16; /* { dg-error {invalid conversion to type '__bf16'} } */
+ vector2_3[0] = 0; /* { dg-error {invalid conversion to type '__bf16'} } */
+ vector2_3[0] = 0.1; /* { dg-error {invalid conversion to type '__bf16'} } */
+
+ glob_bfloat = vector2_3[0];
+ is_an_int = vector2_3[0]; /* { dg-error {invalid conversion from type '__bf16'} } */
+ is_a_short_int = vector2_3[0]; /* { dg-error {invalid conversion from type '__bf16'} } */
+ is_a_float = vector2_3[0]; /* { dg-error {invalid conversion from type '__bf16'} } */
+ is_a_float16 = vector2_3[0]; /* { dg-error {invalid conversion from type '__bf16'} } */
+
+ /* Compound literals. */
+
+ (__m128bf16) {};
+
+ (__m128bf16) { 0 }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ (__m128bf16) { 0.1 }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ (__m128bf16) { is_a_float_vec }; /* { dg-error {incompatible types when initializing type '__bf16' using type '__m256'} } */
+ (__m128bf16) { is_an_int_vec }; /* { dg-error {incompatible types when initializing type '__bf16' using type '__v8si'} } */
+ (__m128bf16) { is_a_float_pair }; /* { dg-error {incompatible types when initializing type '__bf16' using type '__m128'} } */
+ (__m128bf16) { is_an_int_pair }; /* { dg-error {incompatible types when initializing type '__bf16' using type '__v4si'} } */
+ (__m128bf16) { is_a_float16_vec }; /* { dg-error {incompatible types when initializing type '__bf16' using type '__m128h'} } */
+ (__m128bf16) { is_a_short_vec }; /* { dg-error {incompatible types when initializing type '__bf16' using type '__v8hi'} } */
+
+ (__m128bf16) { glob_bfloat_vec }; /* { dg-error {incompatible types when initializing type '__bf16' using type '__m128bf16' {aka '__vector\(8\) __bf16'}} } */
+ (__v8si) { glob_bfloat_vec }; /* { dg-error {incompatible types when initializing type 'int' using type '__m128bf16' {aka '__vector\(8\) __bf16'}} } */
+ (__m256) { glob_bfloat_vec }; /* { dg-error {incompatible types when initializing type 'float' using type '__m128bf16' {aka '__vector\(8\) __bf16'}} } */
+ (__v4si) { glob_bfloat_vec }; /* { dg-error {incompatible types when initializing type 'int' using type '__m128bf16' {aka '__vector\(8\) __bf16'}} } */
+ (__m256h) { glob_bfloat_vec }; /* { dg-error {incompatible types when initializing type '_Float16' using type '__m128bf16' {aka '__vector\(8\) __bf16'}} } */
+ (__v8hi) { glob_bfloat_vec }; /* { dg-error {incompatible types when initializing type 'short int' using type '__m128bf16' {aka '__vector\(8\) __bf16'}} } */
+
+ /* Casting. */
+
+ (void) glob_bfloat_vec;
+ (__m128bf16) glob_bfloat_vec;
+
+ (__bf16) glob_bfloat_vec; /* { dg-error {aggregate value used where a floating-point was expected} } */
+ (short) glob_bfloat_vec; /* { dg-error {cannot convert a vector of type '__m128bf16' {aka '__vector\(8\) __bf16'} to type 'short int' which has different size} } */
+ (int) glob_bfloat_vec; /* { dg-error {cannot convert a vector of type '__m128bf16' {aka '__vector\(8\) __bf16'} to type 'int' which has different size} } */
+ (_Float16) glob_bfloat_vec; /* { dg-error {aggregate value used where a floating-point was expected} } */
+ (float) glob_bfloat_vec; /* { dg-error {aggregate value used where a floating-point was expected} } */
+ (double) glob_bfloat_vec; /* { dg-error {aggregate value used where a floating-point was expected} } */
+
+ (__v8si) glob_bfloat_vec; /* { dg-error {cannot convert a value of type '__m128bf16' {aka '__vector\(8\) __bf16'} to vector type '__vector\(8\) int' which has different size} } */
+ (__m256) glob_bfloat_vec; /* { dg-error {cannot convert a value of type '__m128bf16' {aka '__vector\(8\) __bf16'} to vector type '__vector\(8\) float' which has different size} } */
+ (__m128h) glob_bfloat_vec;
+ (__v4si) glob_bfloat_vec;
+ (__m128) glob_bfloat_vec;
+ (__v8hi) glob_bfloat_vec;
+
+ (__m128bf16) is_an_int_vec; /* { dg-error {cannot convert a value of type '__v8si' to vector type '__vector\(8\) __bf16' which has different size} } */
+ (__m128bf16) is_a_float_vec; /* { dg-error {cannot convert a value of type '__m256' to vector type '__vector\(8\) __bf16' which has different size} } */
+ (__m128bf16) is_a_float16_vec;
+ (__m128bf16) is_an_int_pair;
+ (__m128bf16) is_a_float_pair;
+ (__m128bf16) is_a_short_vec;
+ (__m128bf16) is_a_double; /* { dg-error {cannot convert value to a vector} } */
+
+ /* Arrays and Structs. */
+
+ typedef __m128bf16 array_type[2];
+ extern __m128bf16 extern_array[];
+
+ __m128bf16 array[2];
+ __m128bf16 zero_length_array[0];
+ __m128bf16 empty_init_array[] = {};
+ typedef __m128bf16 some_other_type[is_an_int];
+
+ struct struct1 {
+ __m128bf16 a;
+ };
+
+ union union1 {
+ __m128bf16 a;
+ };
+
+ /* Addressing and dereferencing. */
+
+ __m128bf16 *bfloat_ptr = &vector0;
+ vector0 = *bfloat_ptr;
+
+ /* Pointer assignment. */
+
+ __m128bf16 *bfloat_ptr2 = bfloat_ptr;
+ __m128bf16 *bfloat_ptr3 = array;
+
+ /* Pointer arithmetic. */
+
+ ++bfloat_ptr;
+ --bfloat_ptr;
+ bfloat_ptr++;
+ bfloat_ptr--;
+ bfloat_ptr += 1;
+ bfloat_ptr -= 1;
+ bfloat_ptr - bfloat_ptr2;
+ bfloat_ptr = &bfloat_ptr3[0];
+ bfloat_ptr = &bfloat_ptr3[1];
+
+ /* Simple comparison. */
+ vector0 > glob_bfloat_vec; /* { dg-error {operation not permitted on type '__bf16'} } */
+ glob_bfloat_vec == vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ vector0 > is_a_float_vec; /* { dg-error {operation not permitted on type '__bf16'} } */
+ is_a_float_vec == vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ vector0 > 0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ 0 == vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ vector0 > 0.1; /* { dg-error {operation not permitted on type '__bf16'} } */
+ 0.1 == vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ vector0 > is_an_int_vec; /* { dg-error {operation not permitted on type '__bf16'} } */
+ is_an_int_vec == vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+
+ /* Pointer comparison. */
+
+ bfloat_ptr == &vector0;
+ bfloat_ptr != &vector0;
+ bfloat_ptr < &vector0;
+ bfloat_ptr <= &vector0;
+ bfloat_ptr > &vector0;
+ bfloat_ptr >= &vector0;
+ bfloat_ptr == bfloat_ptr2;
+ bfloat_ptr != bfloat_ptr2;
+ bfloat_ptr < bfloat_ptr2;
+ bfloat_ptr <= bfloat_ptr2;
+ bfloat_ptr > bfloat_ptr2;
+ bfloat_ptr >= bfloat_ptr2;
+
+ /* Conditional expressions. */
+
+ 0 ? vector0 : vector0;
+ 0 ? vector0 : is_a_float_vec; /* { dg-error {type mismatch in conditional expression} } */
+ 0 ? is_a_float_vec : vector0; /* { dg-error {type mismatch in conditional expression} } */
+ 0 ? vector0 : is_a_float16_vec; /* { dg-error {type mismatch in conditional expression} } */
+ 0 ? is_a_float16_vec : vector0; /* { dg-error {type mismatch in conditional expression} } */
+ 0 ? vector0 : 0; /* { dg-error {type mismatch in conditional expression} } */
+ 0 ? 0 : vector0; /* { dg-error {type mismatch in conditional expression} } */
+ 0 ? 0.1 : vector0; /* { dg-error {type mismatch in conditional expression} } */
+ 0 ? vector0 : 0.1; /* { dg-error {type mismatch in conditional expression} } */
+ 0 ? bfloat_ptr : bfloat_ptr2;
+ 0 ? bfloat_ptr : float_ptr; /* { dg-warning {pointer type mismatch in conditional expression} } */
+ 0 ? float_ptr : bfloat_ptr; /* { dg-warning {pointer type mismatch in conditional expression} } */
+
+ vector0 ? vector0 : vector0; /* { dg-error {used vector type where scalar is required} } */
+ vector0 ? is_a_float16_vec : vector0; /* { dg-error {used vector type where scalar is required} } */
+ vector0 ? vector0 : is_a_float16_vec; /* { dg-error {used vector type where scalar is required} } */
+ vector0 ? is_a_float16_vec : is_a_float16_vec; /* { dg-error {used vector type where scalar is required} } */
+
+ /* Unary operators. */
+
+ +vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ -vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ ~vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ !vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ *vector0; /* { dg-error {invalid type argument of unary '\*'} } */
+ __real vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ __imag vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ ++vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ --vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ vector0++; /* { dg-error {operation not permitted on type '__bf16'} } */
+ vector0--; /* { dg-error {operation not permitted on type '__bf16'} } */
+
+ /* Binary arithmetic operations. */
+
+ vector0 = glob_bfloat_vec + *bfloat_ptr; /* { dg-error {operation not permitted on type '__bf16'} } */
+ vector0 = glob_bfloat_vec + 0.1; /* { dg-error {operation not permitted on type '__bf16'} } */
+ vector0 = glob_bfloat_vec + 0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ vector0 = glob_bfloat_vec + is_a_float_vec; /* { dg-error {operation not permitted on type '__bf16'} } */
+
+ return vector0;
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/vect-bfloat16-typecheck_2.c b/gcc/testsuite/gcc.target/i386/vect-bfloat16-typecheck_2.c
new file mode 100644
index 0000000..f63b41d8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-bfloat16-typecheck_2.c
@@ -0,0 +1,248 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+
+#include <immintrin.h>
+
+typedef __bf16 __v16bf __attribute__ ((__vector_size__ (32)));
+typedef __bf16 __m256bf16 __attribute__ ((__vector_size__ (32), __may_alias__));
+
+__bf16 glob_bfloat;
+__m256bf16 glob_bfloat_vec;
+
+__m256 is_a_float_vec;
+
+__m256h *float_ptr;
+__m256h is_a_float16_vec;
+
+__v8si is_an_int_vec;
+__m256i is_a_long_int_pair;
+__v16hi is_a_short_vec;
+
+int is_an_int;
+short is_a_short_int;
+float is_a_float;
+float is_a_float16;
+double is_a_double;
+
+__m256bf16 footest (__m256bf16 vector0)
+{
+ /* Initialisation */
+
+ __m256bf16 vector1_1;
+ __m256bf16 vector1_2 = glob_bfloat_vec;
+ __m256bf16 vector1_3 = is_a_float_vec; /* { dg-error {incompatible types when initializing type '__m256bf16' {aka '__vector\(16\) __bf16'} using type '__m256'} } */
+ __m256bf16 vector1_4 = is_an_int_vec; /* { dg-error {incompatible types when initializing type '__m256bf16' {aka '__vector\(16\) __bf16'} using type '__v8si'} } */
+ __m256bf16 vector1_5 = is_a_float16_vec; /* { dg-error {incompatible types when initializing type '__m256bf16' {aka '__vector\(16\) __bf16'} using type '__m256h'} } */
+ __m256bf16 vector1_7 = is_a_long_int_pair; /* { dg-error {incompatible types when initializing type '__m256bf16' {aka '__vector\(16\) __bf16'} using type '__m256i'} } */
+ __m256bf16 vector1_8 = is_a_short_vec; /* { dg-error {incompatible types when initializing type '__m256bf16' {aka '__vector\(16\) __bf16'} using type '__v16hi'} } */
+
+ __v8si initi_1_1 = glob_bfloat_vec; /* { dg-error {incompatible types when initializing type '__v8si' using type '__m256bf16' {aka '__vector\(16\) __bf16'}} } */
+ __m256 initi_1_2 = glob_bfloat_vec; /* { dg-error {incompatible types when initializing type '__m256' using type '__m256bf16' {aka '__vector\(16\) __bf16'}} } */
+ __m256h initi_1_3 = glob_bfloat_vec; /* { dg-error {incompatible types when initializing type '__m256h' using type '__m256bf16' {aka '__vector\(16\) __bf16'}} } */
+ __m256i initi_1_5 = glob_bfloat_vec; /* { dg-error {incompatible types when initializing type '__m256i' using type '__m256bf16' {aka '__vector\(16\) __bf16'}} } */
+ __v16hi initi_1_6 = glob_bfloat_vec; /* { dg-error {incompatible types when initializing type '__v16hi' using type '__m256bf16' {aka '__vector\(16\) __bf16'}} } */
+
+ __m256bf16 vector2_1 = {};
+ __m256bf16 vector2_2 = { glob_bfloat };
+ __m256bf16 vector2_3 = { glob_bfloat, glob_bfloat, glob_bfloat, glob_bfloat };
+ __m256bf16 vector2_4 = { 0 }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __m256bf16 vector2_5 = { 0.1 }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __m256bf16 vector2_6 = { is_a_float16 }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __m256bf16 vector2_7 = { is_a_float }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __m256bf16 vector2_8 = { is_an_int }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __m256bf16 vector2_9 = { is_a_short_int }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ __m256bf16 vector2_10 = { 0.0, 0, is_a_short_int, is_a_float }; /* { dg-error "invalid conversion to type '__bf16'" } */
+
+ __v8si initi_2_1 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */
+ __m256 initi_2_2 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */
+ __m256h initi_2_3 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */
+ __m256i initi_2_5 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */
+ __v16hi initi_2_6 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */
+
+ /* Assignments to/from vectors. */
+
+ glob_bfloat_vec = glob_bfloat_vec;
+ glob_bfloat_vec = 0; /* { dg-error {incompatible types when assigning to type '__m256bf16' {aka '__vector\(16\) __bf16'} from type 'int'} } */
+ glob_bfloat_vec = 0.1; /* { dg-error {incompatible types when assigning to type '__m256bf16' {aka '__vector\(16\) __bf16'} from type 'double'} } */
+ glob_bfloat_vec = is_a_float_vec; /* { dg-error {incompatible types when assigning to type '__m256bf16' {aka '__vector\(16\) __bf16'} from type '__m256'} } */
+ glob_bfloat_vec = is_an_int_vec; /* { dg-error {incompatible types when assigning to type '__m256bf16' {aka '__vector\(16\) __bf16'} from type '__v8si'} } */
+ glob_bfloat_vec = is_a_float16_vec; /* { dg-error {incompatible types when assigning to type '__m256bf16' {aka '__vector\(16\) __bf16'} from type '__m256h'} } */
+ glob_bfloat_vec = is_a_long_int_pair; /* { dg-error {incompatible types when assigning to type '__m256bf16' {aka '__vector\(16\) __bf16'} from type '__m256i'} } */
+ glob_bfloat_vec = is_a_short_vec; /* { dg-error {incompatible types when assigning to type '__m256bf16' {aka '__vector\(16\) __bf16'} from type '__v16hi'} } */
+
+ is_an_int_vec = glob_bfloat_vec; /* { dg-error {incompatible types when assigning to type '__v8si' from type '__m256bf16' {aka '__vector\(16\) __bf16'}} } */
+ is_a_float_vec = glob_bfloat_vec; /* { dg-error {incompatible types when assigning to type '__m256' from type '__m256bf16' {aka '__vector\(16\) __bf16'}} } */
+ is_a_float16_vec = glob_bfloat_vec; /* { dg-error {incompatible types when assigning to type '__m256h' from type '__m256bf16' {aka '__vector\(16\) __bf16'}} } */
+ is_a_long_int_pair = glob_bfloat_vec; /* { dg-error {incompatible types when assigning to type '__m256i' from type '__m256bf16' {aka '__vector\(16\) __bf16'}} } */
+ is_a_short_vec = glob_bfloat_vec;/* { dg-error {incompatible types when assigning to type '__v16hi' from type '__m256bf16' {aka '__vector\(16\) __bf16'}} } */
+
+ /* Assignments to/from elements. */
+
+ vector2_3[0] = glob_bfloat;
+ vector2_3[0] = is_an_int; /* { dg-error {invalid conversion to type '__bf16'} } */
+ vector2_3[0] = is_a_short_int; /* { dg-error {invalid conversion to type '__bf16'} } */
+ vector2_3[0] = is_a_float; /* { dg-error {invalid conversion to type '__bf16'} } */
+ vector2_3[0] = is_a_float16; /* { dg-error {invalid conversion to type '__bf16'} } */
+ vector2_3[0] = 0; /* { dg-error {invalid conversion to type '__bf16'} } */
+ vector2_3[0] = 0.1; /* { dg-error {invalid conversion to type '__bf16'} } */
+
+ glob_bfloat = vector2_3[0];
+ is_an_int = vector2_3[0]; /* { dg-error {invalid conversion from type '__bf16'} } */
+ is_a_short_int = vector2_3[0]; /* { dg-error {invalid conversion from type '__bf16'} } */
+ is_a_float = vector2_3[0]; /* { dg-error {invalid conversion from type '__bf16'} } */
+ is_a_float16 = vector2_3[0]; /* { dg-error {invalid conversion from type '__bf16'} } */
+
+ /* Compound literals. */
+
+ (__m256bf16) {};
+
+ (__m256bf16) { 0 }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ (__m256bf16) { 0.1 }; /* { dg-error {invalid conversion to type '__bf16'} } */
+ (__m256bf16) { is_a_float_vec }; /* { dg-error {incompatible types when initializing type '__bf16' using type '__m256'} } */
+ (__m256bf16) { is_an_int_vec }; /* { dg-error {incompatible types when initializing type '__bf16' using type '__v8si'} } */
+ (__m256bf16) { is_a_long_int_pair }; /* { dg-error {incompatible types when initializing type '__bf16' using type '__m256i'} } */
+ (__m256bf16) { is_a_float16_vec }; /* { dg-error {incompatible types when initializing type '__bf16' using type '__m256h'} } */
+ (__m256bf16) { is_a_short_vec }; /* { dg-error {incompatible types when initializing type '__bf16' using type '__v16hi'} } */
+
+ (__m256bf16) { glob_bfloat_vec }; /* { dg-error {incompatible types when initializing type '__bf16' using type '__m256bf16' {aka '__vector\(16\) __bf16'}} } */
+ (__v8si) { glob_bfloat_vec }; /* { dg-error {incompatible types when initializing type 'int' using type '__m256bf16' {aka '__vector\(16\) __bf16'}} } */
+ (__m256) { glob_bfloat_vec }; /* { dg-error {incompatible types when initializing type 'float' using type '__m256bf16' {aka '__vector\(16\) __bf16'}} } */
+ (__m256i) { glob_bfloat_vec }; /* { dg-error {incompatible types when initializing type 'long long int' using type '__m256bf16' {aka '__vector\(16\) __bf16'}} } */
+ (__m256h) { glob_bfloat_vec }; /* { dg-error {incompatible types when initializing type '_Float16' using type '__m256bf16' {aka '__vector\(16\) __bf16'}} } */
+ (__v16hi) { glob_bfloat_vec }; /* { dg-error {incompatible types when initializing type 'short int' using type '__m256bf16' {aka '__vector\(16\) __bf16'}} } */
+
+ /* Casting. */
+
+ (void) glob_bfloat_vec;
+ (__m256bf16) glob_bfloat_vec;
+
+ (__bf16) glob_bfloat_vec; /* { dg-error {aggregate value used where a floating-point was expected} } */
+ (short) glob_bfloat_vec; /* { dg-error {cannot convert a vector of type '__m256bf16' {aka '__vector\(16\) __bf16'} to type 'short int' which has different size} } */
+ (int) glob_bfloat_vec; /* { dg-error {cannot convert a vector of type '__m256bf16' {aka '__vector\(16\) __bf16'} to type 'int' which has different size} } */
+ (_Float16) glob_bfloat_vec; /* { dg-error {aggregate value used where a floating-point was expected} } */
+ (float) glob_bfloat_vec; /* { dg-error {aggregate value used where a floating-point was expected} } */
+ (double) glob_bfloat_vec; /* { dg-error {aggregate value used where a floating-point was expected} } */
+
+ (__v8si) glob_bfloat_vec;
+ (__m256) glob_bfloat_vec;
+ (__m256h) glob_bfloat_vec;
+ (__m256i) glob_bfloat_vec;
+ (__v16hi) glob_bfloat_vec;
+
+ (__m256bf16) is_an_int_vec;
+ (__m256bf16) is_a_float_vec;
+ (__m256bf16) is_a_float16_vec;
+ (__m256bf16) is_a_long_int_pair;
+ (__m256bf16) is_a_short_vec;
+
+ /* Arrays and Structs. */
+
+ typedef __m256bf16 array_type[2];
+ extern __m256bf16 extern_array[];
+
+ __m256bf16 array[2];
+ __m256bf16 zero_length_array[0];
+ __m256bf16 empty_init_array[] = {};
+ typedef __m256bf16 some_other_type[is_an_int];
+
+ struct struct1 {
+ __m256bf16 a;
+ };
+
+ union union1 {
+ __m256bf16 a;
+ };
+
+ /* Addressing and dereferencing. */
+
+ __m256bf16 *bfloat_ptr = &vector0;
+ vector0 = *bfloat_ptr;
+
+ /* Pointer assignment. */
+
+ __m256bf16 *bfloat_ptr2 = bfloat_ptr;
+ __m256bf16 *bfloat_ptr3 = array;
+
+ /* Pointer arithmetic. */
+
+ ++bfloat_ptr;
+ --bfloat_ptr;
+ bfloat_ptr++;
+ bfloat_ptr--;
+ bfloat_ptr += 1;
+ bfloat_ptr -= 1;
+ bfloat_ptr - bfloat_ptr2;
+ bfloat_ptr = &bfloat_ptr3[0];
+ bfloat_ptr = &bfloat_ptr3[1];
+
+ /* Simple comparison. */
+ vector0 > glob_bfloat_vec; /* { dg-error {operation not permitted on type '__bf16'} } */
+ glob_bfloat_vec == vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ vector0 > is_a_float_vec; /* { dg-error {operation not permitted on type '__bf16'} } */
+ is_a_float_vec == vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ vector0 > 0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ 0 == vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ vector0 > 0.1; /* { dg-error {operation not permitted on type '__bf16'} } */
+ 0.1 == vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ vector0 > is_an_int_vec; /* { dg-error {operation not permitted on type '__bf16'} } */
+ is_an_int_vec == vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+
+ /* Pointer comparison. */
+
+ bfloat_ptr == &vector0;
+ bfloat_ptr != &vector0;
+ bfloat_ptr < &vector0;
+ bfloat_ptr <= &vector0;
+ bfloat_ptr > &vector0;
+ bfloat_ptr >= &vector0;
+ bfloat_ptr == bfloat_ptr2;
+ bfloat_ptr != bfloat_ptr2;
+ bfloat_ptr < bfloat_ptr2;
+ bfloat_ptr <= bfloat_ptr2;
+ bfloat_ptr > bfloat_ptr2;
+ bfloat_ptr >= bfloat_ptr2;
+
+ /* Conditional expressions. */
+
+ 0 ? vector0 : vector0;
+ 0 ? vector0 : is_a_float_vec; /* { dg-error {type mismatch in conditional expression} } */
+ 0 ? is_a_float_vec : vector0; /* { dg-error {type mismatch in conditional expression} } */
+ 0 ? vector0 : is_a_float16_vec; /* { dg-error {type mismatch in conditional expression} } */
+ 0 ? is_a_float16_vec : vector0; /* { dg-error {type mismatch in conditional expression} } */
+ 0 ? vector0 : 0; /* { dg-error {type mismatch in conditional expression} } */
+ 0 ? 0 : vector0; /* { dg-error {type mismatch in conditional expression} } */
+ 0 ? 0.1 : vector0; /* { dg-error {type mismatch in conditional expression} } */
+ 0 ? vector0 : 0.1; /* { dg-error {type mismatch in conditional expression} } */
+ 0 ? bfloat_ptr : bfloat_ptr2;
+ 0 ? bfloat_ptr : float_ptr; /* { dg-warning {pointer type mismatch in conditional expression} } */
+ 0 ? float_ptr : bfloat_ptr; /* { dg-warning {pointer type mismatch in conditional expression} } */
+
+ vector0 ? vector0 : vector0; /* { dg-error {used vector type where scalar is required} } */
+ vector0 ? is_a_float16_vec : vector0; /* { dg-error {used vector type where scalar is required} } */
+ vector0 ? vector0 : is_a_float16_vec; /* { dg-error {used vector type where scalar is required} } */
+ vector0 ? is_a_float16_vec : is_a_float16_vec; /* { dg-error {used vector type where scalar is required} } */
+
+ /* Unary operators. */
+
+ +vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ -vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ ~vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ !vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ *vector0; /* { dg-error {invalid type argument of unary '\*'} } */
+ __real vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ __imag vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ ++vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ --vector0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ vector0++; /* { dg-error {operation not permitted on type '__bf16'} } */
+ vector0--; /* { dg-error {operation not permitted on type '__bf16'} } */
+
+ /* Binary arithmetic operations. */
+
+ vector0 = glob_bfloat_vec + *bfloat_ptr; /* { dg-error {operation not permitted on type '__bf16'} } */
+ vector0 = glob_bfloat_vec + 0.1; /* { dg-error {operation not permitted on type '__bf16'} } */
+ vector0 = glob_bfloat_vec + 0; /* { dg-error {operation not permitted on type '__bf16'} } */
+ vector0 = glob_bfloat_vec + is_a_float_vec; /* { dg-error {operation not permitted on type '__bf16'} } */
+
+ return vector0;
+}
+
diff --git a/gcc/testsuite/gcc.target/ia64/pr106905.c b/gcc/testsuite/gcc.target/ia64/pr106905.c
new file mode 100644
index 0000000..1b9656e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/ia64/pr106905.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c99 -O3 -fPIC" } */
+long ZDICT_fillNoise_p, ZDICT_trainFromBuffer_legacy_result;
+unsigned ZDICT_fillNoise_acc;
+int ZDICT_totalSampleSize_nbFiles;
+static void ZDICT_fillNoise(void *buffer, long length) {
+ unsigned prime2 = 9;
+ for (ZDICT_fillNoise_p = 0; ZDICT_fillNoise_p < length; ZDICT_fillNoise_p++)
+ ZDICT_fillNoise_acc *= ((char *)buffer)[ZDICT_fillNoise_p] = prime2;
+}
+long ZDICT_trainFromBuffer_legacy() {
+ void *newBuff;
+ long total = 0;
+ for (; ZDICT_totalSampleSize_nbFiles;)
+ total += 0;
+ long sBuffSize = total;
+ newBuff = 0;
+ ZDICT_fillNoise(newBuff + sBuffSize, 32);
+ return ZDICT_trainFromBuffer_legacy_result;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/attr-model-1.c b/gcc/testsuite/gcc.target/loongarch/attr-model-1.c
new file mode 100644
index 0000000..916d715
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/attr-model-1.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-mexplicit-relocs -mcmodel=normal -O2" } */
+/* { dg-final { scan-assembler-times "%pc64_hi12" 2 } } */
+
+#define ATTR_MODEL_TEST
+#include "attr-model-test.c"
diff --git a/gcc/testsuite/gcc.target/loongarch/attr-model-2.c b/gcc/testsuite/gcc.target/loongarch/attr-model-2.c
new file mode 100644
index 0000000..a74c795
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/attr-model-2.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-mexplicit-relocs -mcmodel=extreme -O2" } */
+/* { dg-final { scan-assembler-times "%pc64_hi12" 3 } } */
+
+#define ATTR_MODEL_TEST
+#include "attr-model-test.c"
diff --git a/gcc/testsuite/gcc.target/loongarch/attr-model-diag.c b/gcc/testsuite/gcc.target/loongarch/attr-model-diag.c
new file mode 100644
index 0000000..88beede
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/attr-model-diag.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-mexplicit-relocs" } */
+
+__thread int x __attribute__((model("extreme"))); /* { dg-error "attribute cannot be specified for thread-local variables" } */
+register int y __asm__("tp") __attribute__((model("extreme"))); /* { dg-error "attribute cannot be specified for register variables" } */
+int z __attribute__((model(114))); /* { dg-error "invalid argument" } */
+int t __attribute__((model("good"))); /* { dg-error "invalid argument" } */
diff --git a/gcc/testsuite/gcc.target/loongarch/attr-model-test.c b/gcc/testsuite/gcc.target/loongarch/attr-model-test.c
new file mode 100644
index 0000000..5b61a7a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/attr-model-test.c
@@ -0,0 +1,25 @@
+#ifdef ATTR_MODEL_TEST
+int x __attribute__((model("extreme")));
+int y __attribute__((model("normal")));
+int z;
+
+int
+test(void)
+{
+ return x + y + z;
+}
+
+/* The following will be used for kernel per-cpu storage implemention. */
+
+register char *per_cpu_base __asm__("r21");
+static int counter __attribute__((section(".data..percpu"), model("extreme")));
+
+void
+inc_counter(void)
+{
+ int *ptr = (int *)(per_cpu_base + (long)&counter);
+ (*ptr)++;
+}
+#endif
+
+int dummy;
diff --git a/gcc/testsuite/gcc.target/loongarch/direct-extern-1.c b/gcc/testsuite/gcc.target/loongarch/direct-extern-1.c
new file mode 100644
index 0000000..85c6c1e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/direct-extern-1.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-mexplicit-relocs -mdirect-extern-access" } */
+/* { dg-final { scan-assembler-not "got" } } */
+
+extern int x;
+int f() { return x; }
diff --git a/gcc/testsuite/gcc.target/loongarch/direct-extern-2.c b/gcc/testsuite/gcc.target/loongarch/direct-extern-2.c
new file mode 100644
index 0000000..58d8bd6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/direct-extern-2.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-mno-explicit-relocs -mdirect-extern-access" } */
+/* { dg-final { scan-assembler-not "la.global" } } */
+
+extern int x;
+int f() { return x; }
diff --git a/gcc/testsuite/gcc.target/loongarch/fmax-fmin.c b/gcc/testsuite/gcc.target/loongarch/fmax-fmin.c
new file mode 100644
index 0000000..92cf8a1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/fmax-fmin.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-mdouble-float -fno-finite-math-only" } */
+/* { dg-final { scan-assembler "fmin\\.s" } } */
+/* { dg-final { scan-assembler "fmin\\.d" } } */
+/* { dg-final { scan-assembler "fmax\\.s" } } */
+/* { dg-final { scan-assembler "fmax\\.d" } } */
+
+double
+_fmax(double a, double b)
+{
+ return __builtin_fmax(a, b);
+}
+
+float
+_fmaxf(float a, float b)
+{
+ return __builtin_fmaxf(a, b);
+}
+
+double
+_fmin(double a, double b)
+{
+ return __builtin_fmin(a, b);
+}
+
+float
+_fminf(float a, float b)
+{
+ return __builtin_fminf(a, b);
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/func-call-1.c b/gcc/testsuite/gcc.target/loongarch/func-call-1.c
index 01b8ea2..76bf11b 100644
--- a/gcc/testsuite/gcc.target/loongarch/func-call-1.c
+++ b/gcc/testsuite/gcc.target/loongarch/func-call-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-mabi=lp64d -O0 -fpic -fplt -mno-explicit-relocs" } */
+/* { dg-options "-mabi=lp64d -O0 -fpic -fplt -mno-explicit-relocs -mcmodel=normal" } */
/* { dg-final { scan-assembler "test:.*bl\t%plt\\(g\\)\n" } } */
/* { dg-final { scan-assembler "test1:.*bl\t%plt\\(f\\)\n" } } */
/* { dg-final { scan-assembler "test2:.*bl\tl\n" } } */
diff --git a/gcc/testsuite/gcc.target/loongarch/func-call-2.c b/gcc/testsuite/gcc.target/loongarch/func-call-2.c
index 4565baa..4b468fe 100644
--- a/gcc/testsuite/gcc.target/loongarch/func-call-2.c
+++ b/gcc/testsuite/gcc.target/loongarch/func-call-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-mabi=lp64d -O0 -fno-pic -fplt -mno-explicit-relocs" } */
+/* { dg-options "-mabi=lp64d -O0 -fno-pic -fplt -mno-explicit-relocs -mcmodel=normal" } */
/* { dg-final { scan-assembler "test:.*bl\t%plt\\(g\\)\n" } } */
/* { dg-final { scan-assembler "test1:.*bl\tf\n" } } */
/* { dg-final { scan-assembler "test2:.*bl\tl\n" } } */
diff --git a/gcc/testsuite/gcc.target/loongarch/func-call-3.c b/gcc/testsuite/gcc.target/loongarch/func-call-3.c
index 4f669a0..dd3a488 100644
--- a/gcc/testsuite/gcc.target/loongarch/func-call-3.c
+++ b/gcc/testsuite/gcc.target/loongarch/func-call-3.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-mabi=lp64d -O0 -fpic -fno-plt -mno-explicit-relocs" } */
+/* { dg-options "-mabi=lp64d -O0 -fpic -fno-plt -mno-explicit-relocs -mcmodel=normal" } */
/* { dg-final { scan-assembler "test:.*la\.global\t.*g\n\tjirl" } } */
/* { dg-final { scan-assembler "test1:.*la\.global\t.*f\n\tjirl" } } */
/* { dg-final { scan-assembler "test2:.*bl\tl\n" } } */
diff --git a/gcc/testsuite/gcc.target/loongarch/func-call-4.c b/gcc/testsuite/gcc.target/loongarch/func-call-4.c
index 943adb6..f8158ec 100644
--- a/gcc/testsuite/gcc.target/loongarch/func-call-4.c
+++ b/gcc/testsuite/gcc.target/loongarch/func-call-4.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-mabi=lp64d -O0 -fno-pic -fno-plt -mno-explicit-relocs" } */
+/* { dg-options "-mabi=lp64d -O0 -fno-pic -fno-plt -mno-explicit-relocs -mcmodel=normal" } */
/* { dg-final { scan-assembler "test:.*la\.global\t.*g\n\tjirl" } } */
/* { dg-final { scan-assembler "test1:.*bl\tf\n" } } */
/* { dg-final { scan-assembler "test2:.*bl\tl\n" } } */
diff --git a/gcc/testsuite/gcc.target/loongarch/func-call-5.c b/gcc/testsuite/gcc.target/loongarch/func-call-5.c
index 2c2a1c8..37994af 100644
--- a/gcc/testsuite/gcc.target/loongarch/func-call-5.c
+++ b/gcc/testsuite/gcc.target/loongarch/func-call-5.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-mabi=lp64d -O0 -fpic -fplt -mexplicit-relocs" } */
+/* { dg-options "-mabi=lp64d -O0 -fpic -fplt -mexplicit-relocs -mcmodel=normal" } */
/* { dg-final { scan-assembler "test:.*bl\t%plt\\(g\\)\n" } } */
/* { dg-final { scan-assembler "test1:.*bl\t%plt\\(f\\)\n" } } */
/* { dg-final { scan-assembler "test2:.*bl\tl\n" } } */
diff --git a/gcc/testsuite/gcc.target/loongarch/func-call-6.c b/gcc/testsuite/gcc.target/loongarch/func-call-6.c
index 4b0e426..8e366e3 100644
--- a/gcc/testsuite/gcc.target/loongarch/func-call-6.c
+++ b/gcc/testsuite/gcc.target/loongarch/func-call-6.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-mabi=lp64d -O0 -fno-pic -fplt -mexplicit-relocs" } */
+/* { dg-options "-mabi=lp64d -O0 -fno-pic -fplt -mexplicit-relocs -mcmodel=normal" } */
/* { dg-final { scan-assembler "test:.*bl\t%plt\\(g\\)\n" } } */
/* { dg-final { scan-assembler "test1:.*bl\tf\n" } } */
/* { dg-final { scan-assembler "test2:.*bl\tl\n" } } */
diff --git a/gcc/testsuite/gcc.target/loongarch/func-call-7.c b/gcc/testsuite/gcc.target/loongarch/func-call-7.c
index 5179271..4177c3d 100644
--- a/gcc/testsuite/gcc.target/loongarch/func-call-7.c
+++ b/gcc/testsuite/gcc.target/loongarch/func-call-7.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-mabi=lp64d -O0 -fpic -fno-plt -mexplicit-relocs" } */
+/* { dg-options "-mabi=lp64d -O0 -fpic -fno-plt -mexplicit-relocs -mcmodel=normal" } */
/* { dg-final { scan-assembler "test:.*pcalau12i\t.*%got_pc_hi20\\(g\\)\n\tld\.d\t.*%got_pc_lo12\\(g\\)\n\tjirl" } } */
/* { dg-final { scan-assembler "test1:.*pcalau12i\t.*%got_pc_hi20\\(f\\)\n\tld\.d\t.*%got_pc_lo12\\(f\\)\n\tjirl" } } */
/* { dg-final { scan-assembler "test2:.*bl\tl\n" } } */
diff --git a/gcc/testsuite/gcc.target/loongarch/func-call-8.c b/gcc/testsuite/gcc.target/loongarch/func-call-8.c
index 330140d..4254eaa 100644
--- a/gcc/testsuite/gcc.target/loongarch/func-call-8.c
+++ b/gcc/testsuite/gcc.target/loongarch/func-call-8.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-mabi=lp64d -O0 -fno-pic -fno-plt -mexplicit-relocs" } */
+/* { dg-options "-mabi=lp64d -O0 -fno-pic -fno-plt -mexplicit-relocs -mcmodel=normal" } */
/* { dg-final { scan-assembler "test:.*pcalau12i\t.*%got_pc_hi20\\(g\\)\n\tld\.d\t.*%got_pc_lo12\\(g\\)\n\tjirl" } } */
/* { dg-final { scan-assembler "test1:.*bl\tf\n" } } */
/* { dg-final { scan-assembler "test2:.*bl\tl\n" } } */
diff --git a/gcc/testsuite/gcc.target/loongarch/func-call-extreme-1.c b/gcc/testsuite/gcc.target/loongarch/func-call-extreme-1.c
new file mode 100644
index 0000000..db1e0f8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/func-call-extreme-1.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-options "-mabi=lp64d -O0 -fno-pic -fno-plt -mexplicit-relocs -mcmodel=extreme" } */
+/* { dg-final { scan-assembler "test:.*pcalau12i.*%got_pc_hi20.*\n\taddi\.d.*%got_pc_lo12.*\n\tlu32i\.d.*%got64_pc_lo20.*\n\tlu52i\.d.*%got64_pc_hi12.*\n\tldx\.d" } } */
+/* { dg-final { scan-assembler "test1:.*pcalau12i.*%pc_hi20.*\n\taddi\.d.*%pc_lo12.*\n\tlu32i\.d.*%pc64_lo20.*\n\tlu52i\.d.*pc64_hi12.*\n\tadd\.d" } } */
+/* { dg-final { scan-assembler "test2:.*pcalau12i.*%pc_hi20.*\n\taddi\.d.*%pc_lo12.*\n\tlu32i\.d.*%pc64_lo20.*\n\tlu52i\.d.*pc64_hi12.*\n\tadd\.d" } } */
+
+extern void g (void);
+void
+f (void)
+{}
+
+static void
+l (void)
+{}
+
+void
+test (void)
+{
+ g ();
+}
+
+void
+test1 (void)
+{
+ f ();
+}
+
+void
+test2 (void)
+{
+ l ();
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/func-call-extreme-2.c b/gcc/testsuite/gcc.target/loongarch/func-call-extreme-2.c
new file mode 100644
index 0000000..21bf81a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/func-call-extreme-2.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-options "-mabi=lp64d -O0 -fpic -fno-plt -mexplicit-relocs -mcmodel=extreme" } */
+/* { dg-final { scan-assembler "test:.*pcalau12i.*%got_pc_hi20.*\n\taddi\.d.*%got_pc_lo12.*\n\tlu32i\.d.*%got64_pc_lo20.*\n\tlu52i\.d.*%got64_pc_hi12.*\n\tldx\.d" } } */
+/* { dg-final { scan-assembler "test1:.*pcalau12i.*%got_pc_hi20.*\n\taddi\.d.*%got_pc_lo12.*\n\tlu32i\.d.*%got64_pc_lo20.*\n\tlu52i\.d.*%got64_pc_hi12.*\n\tldx\.d" } } */
+/* { dg-final { scan-assembler "test2:.*pcalau12i.*%pc_hi20.*\n\taddi\.d.*%pc_lo12.*\n\tlu32i\.d.*%pc64_lo20.*\n\tlu52i\.d.*pc64_hi12.*\n\tadd\.d" } } */
+
+extern void g (void);
+void
+f (void)
+{}
+
+static void
+l (void)
+{}
+
+void
+test (void)
+{
+ g ();
+}
+
+void
+test1 (void)
+{
+ f ();
+}
+
+void
+test2 (void)
+{
+ l ();
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/func-call-medium-1.c b/gcc/testsuite/gcc.target/loongarch/func-call-medium-1.c
new file mode 100644
index 0000000..6339e83
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/func-call-medium-1.c
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+/* { dg-options "-mabi=lp64d -O0 -fpic -fplt -mno-explicit-relocs -mcmodel=medium" } */
+/* { dg-final { scan-assembler "test:.*la\.global\t.*g\n\tjirl" } } */
+/* { dg-final { scan-assembler "test1:.*la\.global\t.*f\n\tjirl" } } */
+/* { dg-final { scan-assembler "test2:.*la\.local\t.*l\n\tjirl" } } */
+/* { dg-final { scan-assembler "test3:.*la\.global\t.*\_\_tls\_get\_addr" { target tls_native } } } */
+
+extern void g (void);
+void
+f (void)
+{}
+
+static void
+l (void)
+{}
+
+void
+test (void)
+{
+ g ();
+}
+
+void
+test1 (void)
+{
+ f ();
+}
+
+void
+test2 (void)
+{
+ l ();
+}
+
+__attribute__ ((tls_model ("global-dynamic"))) __thread int a;
+
+void
+test3 (void)
+{
+ a = 10;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/func-call-medium-2.c b/gcc/testsuite/gcc.target/loongarch/func-call-medium-2.c
new file mode 100644
index 0000000..a53e75e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/func-call-medium-2.c
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+/* { dg-options "-mabi=lp64d -O0 -fno-pic -fplt -mno-explicit-relocs -mcmodel=medium" } */
+/* { dg-final { scan-assembler "test:.*la\.global\t.*g\n\tjirl" } } */
+/* { dg-final { scan-assembler "test1:.*la\.local\t.*f\n\tjirl" } } */
+/* { dg-final { scan-assembler "test2:.*la\.local\t.*l\n\tjirl" } } */
+/* { dg-final { scan-assembler "test3:.*la\.global\t.*\_\_tls\_get\_addr" { target tls_native } } } */
+
+extern void g (void);
+void
+f (void)
+{}
+
+static void
+l (void)
+{}
+
+void
+test (void)
+{
+ g ();
+}
+
+void
+test1 (void)
+{
+ f ();
+}
+
+void
+test2 (void)
+{
+ l ();
+}
+
+__attribute__ ((tls_model ("global-dynamic"))) __thread int a;
+
+void
+test3 (void)
+{
+ a = 10;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/func-call-medium-3.c b/gcc/testsuite/gcc.target/loongarch/func-call-medium-3.c
new file mode 100644
index 0000000..0da7bf9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/func-call-medium-3.c
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+/* { dg-options "-mabi=lp64d -O0 -fpic -fno-plt -mno-explicit-relocs -mcmodel=medium" } */
+/* { dg-final { scan-assembler "test:.*la\.global\t.*g\n\tjirl" } } */
+/* { dg-final { scan-assembler "test1:.*la\.global\t.*f\n\tjirl" } } */
+/* { dg-final { scan-assembler "test2:.*la\.local\t.*l\n\tjirl" } } */
+/* { dg-final { scan-assembler "test3:.*la\.global\t.*\_\_tls\_get\_addr" { target tls_native } } } */
+
+extern void g (void);
+void
+f (void)
+{}
+
+static void
+l (void)
+{}
+
+void
+test (void)
+{
+ g ();
+}
+
+void
+test1 (void)
+{
+ f ();
+}
+
+void
+test2 (void)
+{
+ l ();
+}
+
+__attribute__ ((tls_model ("global-dynamic"))) __thread int a;
+
+void
+test3 (void)
+{
+ a = 10;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/func-call-medium-4.c b/gcc/testsuite/gcc.target/loongarch/func-call-medium-4.c
new file mode 100644
index 0000000..0219688
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/func-call-medium-4.c
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+/* { dg-options "-mabi=lp64d -O0 -fno-pic -fno-plt -mno-explicit-relocs -mcmodel=medium" } */
+/* { dg-final { scan-assembler "test:.*la\.global\t.*g\n\tjirl" } } */
+/* { dg-final { scan-assembler "test1:.*la\.local\t.*f\n\tjirl" } } */
+/* { dg-final { scan-assembler "test2:.*la\.local\t.*l\n\tjirl" } } */
+/* { dg-final { scan-assembler "test3:.*la\.global\t.*\_\_tls\_get\_addr" { target tls_native } } } */
+
+extern void g (void);
+void
+f (void)
+{}
+
+static void
+l (void)
+{}
+
+void
+test (void)
+{
+ g ();
+}
+
+void
+test1 (void)
+{
+ f ();
+}
+
+void
+test2 (void)
+{
+ l ();
+}
+
+__attribute__ ((tls_model ("global-dynamic"))) __thread int a;
+
+void
+test3 (void)
+{
+ a = 10;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/func-call-medium-5.c b/gcc/testsuite/gcc.target/loongarch/func-call-medium-5.c
new file mode 100644
index 0000000..8a47b5a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/func-call-medium-5.c
@@ -0,0 +1,42 @@
+/* { dg-do compile } */
+/* { dg-options "-mabi=lp64d -O0 -fpic -fplt -mexplicit-relocs -mcmodel=medium" } */
+/* { dg-final { scan-assembler "test:.*pcalau12i.*%pc_hi20\\(g\\)\n\tjirl.*pc_lo12\\(g\\)" } } */
+/* { dg-final { scan-assembler "test1:.*pcalau12i.*%pc_hi20\\(f\\)\n\tjirl.*%pc_lo12\\(f\\)" } } */
+/* { dg-final { scan-assembler "test2:.*pcalau12i.*%pc_hi20\\(l\\)\n\tjirl.*%pc_lo12\\(l\\)" } } */
+/* { dg-final { scan-assembler "test3:.*pcalau12i.*%pc_hi20\\(__tls_get_addr\\)\n\t.*\n\tjirl.*%pc_lo12\\(__tls_get_addr\\)" { target tls_native } } } */
+
+extern void g (void);
+
+void
+f (void)
+{}
+
+static void
+l (void)
+{}
+
+void
+test (void)
+{
+ g ();
+}
+
+void
+test1 (void)
+{
+ f ();
+}
+
+void
+test2 (void)
+{
+ l ();
+}
+
+__attribute__ ((tls_model ("global-dynamic"))) __thread int a;
+
+void
+test3 (void)
+{
+ a = 10;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/func-call-medium-6.c b/gcc/testsuite/gcc.target/loongarch/func-call-medium-6.c
new file mode 100644
index 0000000..1e75e60
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/func-call-medium-6.c
@@ -0,0 +1,42 @@
+/* { dg-do compile } */
+/* { dg-options "-mabi=lp64d -O0 -fno-pic -fplt -mexplicit-relocs -mcmodel=medium" } */
+/* { dg-final { scan-assembler "test:.*pcalau12i.*%pc_hi20\\(g\\)\n\tjirl.*pc_lo12\\(g\\)" } } */
+/* { dg-final { scan-assembler "test1:.*pcalau12i.*%pc_hi20\\(f\\)\n\tjirl.*%pc_lo12\\(f\\)" } } */
+/* { dg-final { scan-assembler "test2:.*pcalau12i.*%pc_hi20\\(l\\)\n\tjirl.*%pc_lo12\\(l\\)" } } */
+/* { dg-final { scan-assembler "test3:.*pcalau12i.*%pc_hi20\\(__tls_get_addr\\)\n\t.*\n\tjirl.*%pc_lo12\\(__tls_get_addr\\)" { target tls_native } } } */
+
+extern void g (void);
+
+void
+f (void)
+{}
+
+static void
+l (void)
+{}
+
+void
+test (void)
+{
+ g ();
+}
+
+void
+test1 (void)
+{
+ f ();
+}
+
+void
+test2 (void)
+{
+ l ();
+}
+
+__attribute__ ((tls_model ("global-dynamic"))) __thread int a;
+
+void
+test3 (void)
+{
+ a = 10;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/func-call-medium-7.c b/gcc/testsuite/gcc.target/loongarch/func-call-medium-7.c
new file mode 100644
index 0000000..9e89085
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/func-call-medium-7.c
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-options "-mabi=lp64d -O0 -fpic -fno-plt -mexplicit-relocs -mcmodel=medium" } */
+/* { dg-final { scan-assembler "test:.*pcalau12i\t.*%got_pc_hi20\\(g\\)\n\tld\.d\t.*%got_pc_lo12\\(g\\)\n\tjirl" } } */
+/* { dg-final { scan-assembler "test1:.*pcalau12i\t.*%got_pc_hi20\\(f\\)\n\tld\.d\t.*%got_pc_lo12\\(f\\)\n\tjirl" } } */
+/* { dg-final { scan-assembler "test2:.*pcalau12i\t.*%pc_hi20\\(l\\)\n\tjirl.*%pc_lo12\\(l\\)" } } */
+/* { dg-final { scan-assembler "test3:.*pcalau12i.*%got_pc_hi20\\(__tls_get_addr\\)\n\tld\.d.*%got_pc_lo12\\(__tls_get_addr\\)" { target tls_native } } } */
+
+
+extern void g (void);
+
+void
+f (void)
+{}
+
+static void
+l (void)
+{}
+
+void
+test (void)
+{
+ g ();
+}
+
+void
+test1 (void)
+{
+ f ();
+}
+
+void
+test2 (void)
+{
+ l ();
+}
+
+__attribute__ ((tls_model ("global-dynamic"))) __thread int a;
+
+void
+test3 (void)
+{
+ a = 10;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/func-call-medium-8.c b/gcc/testsuite/gcc.target/loongarch/func-call-medium-8.c
new file mode 100644
index 0000000..fde9c6e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/func-call-medium-8.c
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-options "-mabi=lp64d -O0 -fno-pic -fno-plt -mexplicit-relocs -mcmodel=medium" } */
+/* { dg-final { scan-assembler "test:.*pcalau12i\t.*%got_pc_hi20\\(g\\)\n\tld\.d\t.*%got_pc_lo12\\(g\\)\n\tjirl" } } */
+/* { dg-final { scan-assembler "test1:.*pcalau12i\t.*%pc_hi20\\(f\\)\n\tjirl.*%pc_lo12\\(f\\)" } } */
+/* { dg-final { scan-assembler "test2:.*pcalau12i\t.*%pc_hi20\\(l\\)\n\tjirl.*%pc_lo12\\(l\\)" } } */
+/* { dg-final { scan-assembler "test3:.*pcalau12i.*%got_pc_hi20\\(__tls_get_addr\\)\n\tld\.d.*%got_pc_lo12\\(__tls_get_addr\\)" { target tls_native } } } */
+/* { dg-final { scan-assembler "test3:.*pcalau12i.*%got_pc_hi20\\(__tls_get_addr\\)\n\tld\.d.*%got_pc_lo12\\(__tls_get_addr\\)" { target tls_native } } } */
+
+extern void g (void);
+
+void
+f (void)
+{}
+
+static void
+l (void)
+{}
+
+void
+test (void)
+{
+ g ();
+}
+
+void
+test1 (void)
+{
+ f ();
+}
+
+void
+test2 (void)
+{
+ l ();
+}
+
+__attribute__ ((tls_model ("global-dynamic"))) __thread int a;
+
+void
+test3 (void)
+{
+ a = 10;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/pr106459.c b/gcc/testsuite/gcc.target/loongarch/pr106459.c
new file mode 100644
index 0000000..eb737dc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/pr106459.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106459 */
+
+typedef unsigned int UDItype __attribute__((mode(DI)));
+int foo(UDItype x) {
+ x = x & (((UDItype)(((UDItype)(((UDItype)0x0F << 8) | 0x0F) << (2 * 8)) |
+ (((UDItype)0x0F << 8) | 0x0F))
+ << (4 * 8)) |
+ (((UDItype)(((UDItype)0x0F << 8) | 0x0F) << (2 * 8)) |
+ (((UDItype)0x0F << 8) | 0x0F)));
+ return x;
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/relocs-symbol-noaddend.c b/gcc/testsuite/gcc.target/loongarch/relocs-symbol-noaddend.c
index bfcc9bc..3ec8bd2 100644
--- a/gcc/testsuite/gcc.target/loongarch/relocs-symbol-noaddend.c
+++ b/gcc/testsuite/gcc.target/loongarch/relocs-symbol-noaddend.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-mabi=lp64d -mexplicit-relocs -fno-pic -O2" } */
+/* { dg-options "-mabi=lp64d -mexplicit-relocs -fno-pic -O2 -mcmodel=normal" } */
/* { dg-final { scan-assembler "pcalau12i.*%pc_hi20\\(\.LANCHOR0\\)\n" } } */
/* { dg-final { scan-assembler "addi\.d.*%pc_lo12\\(\.LANCHOR0\\)\n" } } */
/* { dg-final { scan-assembler "ldptr.d\t\\\$r4,.*,0\n" } } */
diff --git a/gcc/testsuite/gcc.target/loongarch/tls-gd-noplt.c b/gcc/testsuite/gcc.target/loongarch/tls-gd-noplt.c
new file mode 100644
index 0000000..9432c47
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/tls-gd-noplt.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -fno-plt -mcmodel=normal -mexplicit-relocs" } */
+/* { dg-final { scan-assembler "pcalau12i\t.*%got_pc_hi20\\(__tls_get_addr\\)\n\tld\.d.*%got_pc_lo12\\(__tls_get_addr\\)" { target tls_native } } } */
+
+__attribute__ ((tls_model ("global-dynamic"))) __thread int a;
+
+void
+test (void)
+{
+ a = 10;
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-extract-1.c b/gcc/testsuite/gcc.target/powerpc/p9-extract-1.c
index 2b79145..d7d3ad7 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-extract-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-extract-1.c
@@ -4,7 +4,7 @@
/* Test to make sure VEXTU{B,H,W}{L,R}X is generated for various vector extract
operations for ISA 3.0 (-mcpu=power9). In addition, make sure that neither
- of the the the old methods of doing vector extracts are done either by
+ of the old methods of doing vector extracts are done either by
explict stores to the stack or by using direct move instructions. */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/pr103109-1.c b/gcc/testsuite/gcc.target/powerpc/pr103109-1.c
new file mode 100644
index 0000000..097a44e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr103109-1.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mdejagnu-cpu=power9" } */
+/* { dg-require-effective-target int128 } */
+/* { dg-require-effective-target powerpc_p9modulo_ok } */
+/* { dg-require-effective-target has_arch_ppc64 } */
+/* { dg-final { scan-assembler-times {\mmaddld\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mmaddhd\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mmaddhdu\M} 1 } } */
+
+#include "pr103109.h"
diff --git a/gcc/testsuite/gcc.target/powerpc/pr103109-2.c b/gcc/testsuite/gcc.target/powerpc/pr103109-2.c
new file mode 100644
index 0000000..4b93519
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr103109-2.c
@@ -0,0 +1,96 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mdejagnu-cpu=power9" } */
+/* { dg-require-effective-target int128 } */
+/* { dg-require-effective-target p9modulo_hw } */
+/* { dg-require-effective-target has_arch_ppc64 } */
+
+#include "pr103109.h"
+
+union U {
+ __int128 i128;
+ struct {
+ long l1;
+ long l2;
+ } s;
+};
+
+__int128
+create_i128 (long most_sig, long least_sig)
+{
+ union U u;
+
+#if __LITTLE_ENDIAN__
+ u.s.l1 = least_sig;
+ u.s.l2 = most_sig;
+#else
+ u.s.l1 = most_sig;
+ u.s.l2 = least_sig;
+#endif
+ return u.i128;
+}
+
+#define DEBUG 0
+
+#if DEBUG
+#include <stdio.h>
+#include <stdlib.h>
+
+void print_i128(__int128 val, int unsignedp)
+{
+ if (unsignedp)
+ printf(" %llu ", (unsigned long long)(val >> 64));
+ else
+ printf(" %lld ", (signed long long)(val >> 64));
+
+ printf("%llu (0x%llx %llx)",
+ (unsigned long long)(val & 0xFFFFFFFFFFFFFFFF),
+ (unsigned long long)(val >> 64),
+ (unsigned long long)(val & 0xFFFFFFFFFFFFFFFF));
+}
+#endif
+
+void abort (void);
+
+int main ()
+{
+ long a = 0xFEDCBA9876543210L;
+ long b = 0x1000000L;
+ long c = 0x123456L;
+ __int128 expected_result = create_i128 (0xFFFFFFFFFFFEDCBAL,
+ 0x9876543210123456L);
+
+ __int128 result = multiply_add (a, b, c);
+
+ if (result != expected_result)
+ {
+#if DEBUG
+ printf ("ERROR: multiply_add (%lld, %lld, %lld) = ", a, b, c);
+ print_i128 (result, 0);
+ printf ("\n does not match expected_result = ");
+ print_i128 (expected_result, 0);
+ printf ("\n\n");
+#else
+ abort();
+#endif
+ }
+
+ unsigned long au = 0xFEDCBA9876543210UL;
+ unsigned long bu = 0x1000000UL;
+ unsigned long cu = 0x123456UL;
+ unsigned __int128 expected_resultu = create_i128 (0x0000000000FEDCBAL,
+ 0x9876543210123456L);
+
+ unsigned __int128 resultu = multiply_addu (au, bu, cu);
+ if (resultu != expected_resultu)
+ {
+#if DEBUG
+ printf ("ERROR: multiply_addu (%llu, %llu, %llu) = ", au, bu, cu);
+ print_i128 (resultu, 1);
+ printf ("\n does not match expected_result = ");
+ print_i128 (expected_resultu, 1);
+ printf ("\n\n");
+#else
+ abort();
+#endif
+ }
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr103109.h b/gcc/testsuite/gcc.target/powerpc/pr103109.h
new file mode 100644
index 0000000..d16a5dd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr103109.h
@@ -0,0 +1,12 @@
+__attribute__((noinline))
+__int128 multiply_add (long a, long b, long c)
+{
+ return (__int128) a * b + c;
+}
+
+__attribute__((noinline))
+unsigned __int128 multiply_addu (unsigned long a, unsigned long b,
+ unsigned long c)
+{
+ return (unsigned __int128) a * b + c;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr103353.c b/gcc/testsuite/gcc.target/powerpc/pr103353.c
new file mode 100644
index 0000000..5d519fb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr103353.c
@@ -0,0 +1,22 @@
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* If the default cpu type is power10 or later, MMA is enabled by default.
+ To keep the test point available all the time, this case specifies
+ -mdejagnu-cpu=power6 to make it be tested without MMA. */
+/* { dg-options "-maltivec -mdejagnu-cpu=power6" } */
+
+/* Verify there is no ICE and don't check the error messages on MMA
+ requirement since they could be fragile and are not test points
+ of this case. */
+/* { dg-excess-errors "pr103353" } */
+
+void
+foo (__vector_pair *dst, double *x)
+{
+ dst[0] = __builtin_vsx_lxvp (0, (__vector_pair *)(void *)x);
+}
+
+void
+bar (__vector_pair *src, double *x)
+{
+ __builtin_vsx_stxvp (src[0], 0, (__vector_pair *)(void *)x);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr104482.c b/gcc/testsuite/gcc.target/powerpc/pr104482.c
new file mode 100644
index 0000000..9219126
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr104482.c
@@ -0,0 +1,16 @@
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-mvsx" } */
+
+/* It's to verify no ICE here, ignore error messages about
+ mismatch argument number since they are not test points
+ here. */
+/* { dg-excess-errors "pr104482" } */
+
+__attribute__ ((altivec (vector__))) int vsi;
+
+double
+testXXPERMDI (void)
+{
+ return __builtin_vsx_xxpermdi (vsi, vsi, 2, 4);
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/pr105586.c b/gcc/testsuite/gcc.target/powerpc/pr105586.c
new file mode 100644
index 0000000..bd397f5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr105586.c
@@ -0,0 +1,19 @@
+/* { dg-options "-mdejagnu-tune=power4 -O2 -fcompare-debug -fno-if-conversion -fno-guess-branch-probability" } */
+
+extern int bar(int i);
+
+typedef unsigned long u64;
+int g;
+
+__int128 h;
+
+void
+foo(int a, int b) {
+ int i;
+ char u8_1 = g, u8_3 = a;
+ u64 u64_1 = bar(0), u64_3 = u8_3 * u64_1;
+ __int128 u128_1 = h ^ __builtin_expect(i, 0);
+ u64 u64_4 = u64_1 << ((__builtin_sub_overflow_p(0, u8_1, (u64)0) ^ u128_1) & 8);
+ u64 u64_r = b + u64_3 + u64_4;
+ bar((short)u64_r + u8_3);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr106017.c b/gcc/testsuite/gcc.target/powerpc/pr106017.c
new file mode 100644
index 0000000..46d6c7a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr106017.c
@@ -0,0 +1,19 @@
+/* PR target/106017 */
+/* { dg-options "-O1 -mdejagnu-cpu=power10" } */
+/* { dg-require-effective-target power10_ok } */
+
+/* Make sure we do not flag any errors on the following test cases. */
+
+void takeacc(__vector_quad *);
+void
+foo (void)
+{
+ __vector_quad arr[4];
+ takeacc (arr);
+}
+
+unsigned char *
+bar (__vector_quad *a)
+{
+ return (unsigned char *)a;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr106322.c b/gcc/testsuite/gcc.target/powerpc/pr106322.c
new file mode 100644
index 0000000..c05072d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr106322.c
@@ -0,0 +1,50 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mdejagnu-cpu=power4" } */
+
+/* As PR106322, verify this can execute well (not abort). */
+
+#define N 64
+typedef unsigned short int uh;
+typedef unsigned short int uw;
+uh a[N];
+uh b[N];
+uh c[N];
+uh e[N];
+
+__attribute__ ((noipa)) void
+foo ()
+{
+ for (int i = 0; i < N; i++)
+ c[i] = ((uw) b[i] * (uw) a[i]) >> 16;
+}
+
+__attribute__ ((optimize ("-O0"))) void
+init ()
+{
+ for (int i = 0; i < N; i++)
+ {
+ a[i] = (uh) (0x7ABC - 0x5 * i);
+ b[i] = (uh) (0xEAB + 0xF * i);
+ e[i] = ((uw) b[i] * (uw) a[i]) >> 16;
+ }
+}
+
+__attribute__ ((optimize ("-O0"))) void
+check ()
+{
+ for (int i = 0; i < N; i++)
+ {
+ if (c[i] != e[i])
+ __builtin_abort ();
+ }
+}
+
+int
+main ()
+{
+ init ();
+ foo ();
+ check ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr106550.c b/gcc/testsuite/gcc.target/powerpc/pr106550.c
new file mode 100644
index 0000000..74e3953
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr106550.c
@@ -0,0 +1,14 @@
+/* PR target/106550 */
+/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+/* { dg-require-effective-target power10_ok } */
+
+void
+foo (unsigned long long *a)
+{
+ *a++ = 0x020805006106003; /* pli+pli+rldimi */
+ *a++ = 0x2351847027482577;/* pli+pli+rldimi */
+}
+
+/* { dg-final { scan-assembler-times {\mpli\M} 4 } } */
+/* { dg-final { scan-assembler-times {\mrldimi\M} 2 } } */
+
diff --git a/gcc/testsuite/gcc.target/powerpc/pr106550_1.c b/gcc/testsuite/gcc.target/powerpc/pr106550_1.c
new file mode 100644
index 0000000..7e709fc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr106550_1.c
@@ -0,0 +1,22 @@
+/* PR target/106550 */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -fdisable-rtl-split1" } */
+/* force the constant splitter run after RA: -fdisable-rtl-split1. */
+
+void
+foo (unsigned long long *a)
+{
+ /* Test oris/ori is used where paddi does not work with 'r0'. */
+ register long long d asm("r0") = 0x1245abcef9240dec; /* pli+sldi+oris+ori */
+ long long n;
+ asm("cntlzd %0, %1" : "=r"(n) : "r"(d));
+ *a++ = n;
+
+ *a++ = 0x235a8470a7480000ULL; /* pli+sldi+oris */
+ *a++ = 0x23a184700000b677ULL; /* pli+sldi+ori */
+}
+
+/* { dg-final { scan-assembler-times {\mpli\M} 3 } } */
+/* { dg-final { scan-assembler-times {\msldi\M} 3 } } */
+/* { dg-final { scan-assembler-times {\moris\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mori\M} 2 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr106833.c b/gcc/testsuite/gcc.target/powerpc/pr106833.c
new file mode 100644
index 0000000..968d751
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr106833.c
@@ -0,0 +1,14 @@
+/* { dg-do link } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-require-effective-target lto } */
+/* { dg-options "-flto -mdejagnu-cpu=power10" } */
+
+/* Verify there is no ICE in LTO mode. */
+
+int main ()
+{
+ float *b;
+ const __vector_quad c;
+ __builtin_mma_disassemble_acc (b, &c);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr86731-fwrapv-longlong.c b/gcc/testsuite/gcc.target/powerpc/pr86731-fwrapv-longlong.c
index dcb30e1..018e1cf 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr86731-fwrapv-longlong.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr86731-fwrapv-longlong.c
@@ -31,5 +31,5 @@ vector signed long long splats4(void)
/* { dg-final { scan-assembler-times {\mvspltis[bhw]\M} 0 } } */
/* { dg-final { scan-assembler-times {\mvsl[bhwd]\M} 0 } } */
-/* { dg-final { scan-assembler-times {\mp?lxv\M|\mlxv\M|\mlxvd2x\M|\mxxspltidp\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mp?lxv\M|\mlvx\M|\mlxvd2x\M|\mxxspltidp\M} 2 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/stabs-attrib-vect-darwin.c b/gcc/testsuite/gcc.target/powerpc/stabs-attrib-vect-darwin.c
deleted file mode 100644
index 5c7acf1..0000000
--- a/gcc/testsuite/gcc.target/powerpc/stabs-attrib-vect-darwin.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Test Attribute Vector associated with vector type stabs. */
-/* { dg-do compile { target powerpc*-*-darwin* } } */
-/* { dg-require-effective-target stabs } */
-/* { dg-options "-gstabs+ -fno-eliminate-unused-debug-types -faltivec" } */
-
-int main ()
-{
- vector int vi = { 6,7,8,9 };
- return 0;
-}
-
-/* { dg-final { scan-assembler ".stabs.*vi\:\\(0,\[0-9\]+\\)=\@V" } } */
diff --git a/gcc/testsuite/gcc.target/pru/bitop-di.c b/gcc/testsuite/gcc.target/pru/bitop-di.c
new file mode 100644
index 0000000..4290cdb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/pru/bitop-di.c
@@ -0,0 +1,25 @@
+/* 64-bit logical bit operations. */
+
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+
+unsigned long long
+test_xor_di (unsigned long long val1, unsigned long long val2)
+{
+ /* { dg-final { scan-assembler "xor\\tr14, r14, r16" } } */
+ return val1 ^ val2;
+}
+
+unsigned long long
+test_and_di (unsigned long long val1, unsigned long long val2)
+{
+ /* { dg-final { scan-assembler "and\\tr14, r14, r16" } } */
+ return val1 & val2;
+}
+
+unsigned long long
+test_ior_di (unsigned long long val1, unsigned long long val2)
+{
+ /* { dg-final { scan-assembler "or\\tr14, r14, r16" } } */
+ return val1 | val2;
+}
diff --git a/gcc/testsuite/gcc.target/pru/mov-m1.c b/gcc/testsuite/gcc.target/pru/mov-m1.c
new file mode 100644
index 0000000..0b31020
--- /dev/null
+++ b/gcc/testsuite/gcc.target/pru/mov-m1.c
@@ -0,0 +1,18 @@
+/* Loading a register with constant -1 integer value. */
+
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+
+int
+test_set_m1_si (void)
+{
+ /* { dg-final { scan-assembler "fill\\tr14(.b0)?, 4" } } */
+ return -1;
+}
+
+long long
+test_set_m1_di (void)
+{
+ /* { dg-final { scan-assembler "fill\\tr14(.b0)?, 8" } } */
+ return -1;
+}
diff --git a/gcc/testsuite/gcc.target/pru/pr106564-1.c b/gcc/testsuite/gcc.target/pru/pr106564-1.c
new file mode 100644
index 0000000..26fe2f3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/pru/pr106564-1.c
@@ -0,0 +1,9 @@
+/* { dg-do assemble } */
+/* { dg-options "-Os" } */
+/* { dg-final { object-size text <= 8 } } */
+
+
+unsigned long long test(unsigned char a)
+{
+ return a;
+}
diff --git a/gcc/testsuite/gcc.target/pru/pr106564-2.c b/gcc/testsuite/gcc.target/pru/pr106564-2.c
new file mode 100644
index 0000000..297c2ac
--- /dev/null
+++ b/gcc/testsuite/gcc.target/pru/pr106564-2.c
@@ -0,0 +1,9 @@
+/* { dg-do assemble } */
+/* { dg-options "-Os" } */
+/* { dg-final { object-size text <= 8 } } */
+
+
+unsigned long long test(unsigned int a)
+{
+ return a;
+}
diff --git a/gcc/testsuite/gcc.target/pru/pr106564-3.c b/gcc/testsuite/gcc.target/pru/pr106564-3.c
new file mode 100644
index 0000000..9d71114
--- /dev/null
+++ b/gcc/testsuite/gcc.target/pru/pr106564-3.c
@@ -0,0 +1,9 @@
+/* { dg-do assemble } */
+/* { dg-options "-Os" } */
+/* { dg-final { object-size text <= 16 } } */
+
+
+long long test(signed char a)
+{
+ return a;
+}
diff --git a/gcc/testsuite/gcc.target/pru/pr106564-4.c b/gcc/testsuite/gcc.target/pru/pr106564-4.c
new file mode 100644
index 0000000..6c1e4fb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/pru/pr106564-4.c
@@ -0,0 +1,9 @@
+/* { dg-do assemble } */
+/* { dg-options "-Os" } */
+/* { dg-final { object-size text <= 16 } } */
+
+
+long long test(int a)
+{
+ return a;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/_Float16-soft-1.c b/gcc/testsuite/gcc.target/riscv/_Float16-soft-1.c
new file mode 100644
index 0000000..0622588
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/_Float16-soft-1.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64if -mabi=lp64f -O" } */
+
+_Float16 test_soft_move (_Float16 a, _Float16 b)
+{
+ return b;
+}
+
+/* { dg-final { scan-assembler-not "fmv.h" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/_Float16-soft-2.c b/gcc/testsuite/gcc.target/riscv/_Float16-soft-2.c
new file mode 100644
index 0000000..3d37823
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/_Float16-soft-2.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64if -mabi=lp64f -O" } */
+
+_Float16 test_soft_add (_Float16 a, _Float16 b)
+{
+ /* Make sure __addhf3 not invoked here. */
+ /* { dg-final { scan-assembler-times "call\t__extendhfsf2" 2 } } */
+ return a + b;
+ /* { dg-final { scan-assembler-not "call\t__addhf3" } } */
+ /* { dg-final { scan-assembler-times "fadd.s" 1 } } */
+ /* { dg-final { scan-assembler-times "call\t__truncsfhf2" 1 } } */
+}
+
diff --git a/gcc/testsuite/gcc.target/riscv/_Float16-soft-3.c b/gcc/testsuite/gcc.target/riscv/_Float16-soft-3.c
new file mode 100644
index 0000000..ecce364
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/_Float16-soft-3.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64if -mabi=lp64f -O" } */
+
+int test_soft_compare (_Float16 a, _Float16 b)
+{
+ /* Make sure __gthf2 not invoked here. */
+ /* { dg-final { scan-assembler-times "call\t__extendhfsf2" 2 } } */
+ return a > b;
+ /* { dg-final { scan-assembler-not "call\t__gthf2" } } */
+ /* { dg-final { scan-assembler-times "fgt.s" 1 } } */
+}
+
diff --git a/gcc/testsuite/gcc.target/riscv/_Float16-soft-4.c b/gcc/testsuite/gcc.target/riscv/_Float16-soft-4.c
new file mode 100644
index 0000000..ce4bc7a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/_Float16-soft-4.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64i -mabi=lp64 -O" } */
+
+int test_soft_compare (_Float16 a, _Float16 b)
+{
+ /* Make sure __gthf2 not invoked here. */
+ /* { dg-final { scan-assembler-times "call\t__extendhfsf2" 2 } } */
+ return a > b;
+ /* { dg-final { scan-assembler-not "call\t__gthf2" } } */
+ /* { dg-final { scan-assembler-times "call\t__gtsf2" 1 } } */
+}
+
diff --git a/gcc/testsuite/gcc.target/riscv/_Float16-zfh-1.c b/gcc/testsuite/gcc.target/riscv/_Float16-zfh-1.c
new file mode 100644
index 0000000..98908dc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/_Float16-zfh-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64if_zfh -mabi=lp64f -O" } */
+
+_Float16 foo1 (_Float16 a, _Float16 b)
+{
+ /* { dg-final { scan-assembler-times "fmv.h" 1 } } */
+ return b;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/_Float16-zfh-2.c b/gcc/testsuite/gcc.target/riscv/_Float16-zfh-2.c
new file mode 100644
index 0000000..58bfa6b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/_Float16-zfh-2.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64if_zfh -mabi=lp64f -O" } */
+
+_Float16 foo1 (_Float16 a, _Float16 b)
+{
+ /* { dg-final { scan-assembler-times "fadd.h" 1 } } */
+ return a + b;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/_Float16-zfh-3.c b/gcc/testsuite/gcc.target/riscv/_Float16-zfh-3.c
new file mode 100644
index 0000000..128b4e5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/_Float16-zfh-3.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64if_zfh -mabi=lp64f -O" } */
+
+int foo1 (_Float16 a, _Float16 b)
+{
+ /* { dg-final { scan-assembler-times "fgt.h" 1 } } */
+ return a > b;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/_Float16-zfhmin-1.c b/gcc/testsuite/gcc.target/riscv/_Float16-zfhmin-1.c
new file mode 100644
index 0000000..631a049
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/_Float16-zfhmin-1.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64if_zfhmin -mabi=lp64f -O" } */
+
+_Float16 foo1 (_Float16 a, _Float16 b)
+{
+ /* { dg-final { scan-assembler-not "fmv.h" } } */
+ /* { dg-final { scan-assembler-times "fmv.s" 1 } } */
+ return b;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/_Float16-zfhmin-2.c b/gcc/testsuite/gcc.target/riscv/_Float16-zfhmin-2.c
new file mode 100644
index 0000000..06c85eb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/_Float16-zfhmin-2.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64if_zfhmin -mabi=lp64f -O" } */
+
+_Float16 foo1 (_Float16 a, _Float16 b)
+{
+ /* { dg-final { scan-assembler-not "fadd.h" } } */
+ /* { dg-final { scan-assembler-times "fadd.s" 1 } } */
+ return a + b;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/_Float16-zfhmin-3.c b/gcc/testsuite/gcc.target/riscv/_Float16-zfhmin-3.c
new file mode 100644
index 0000000..28960d6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/_Float16-zfhmin-3.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64if_zfhmin -mabi=lp64f -O" } */
+
+int foo1 (_Float16 a, _Float16 b)
+{
+ /* { dg-final { scan-assembler-not "fgt.h" } } */
+ /* { dg-final { scan-assembler-times "fgt.s" 1 } } */
+ return a > b;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/_Float16.c b/gcc/testsuite/gcc.target/riscv/_Float16.c
new file mode 100644
index 0000000..cc131fd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/_Float16.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+_Float16 x;
+
+_Float16 foo1 (_Float16 a, _Float16 b)
+{
+ return a + b;
+}
+
+_Float16 foo2 (_Float16 a, _Float16 b)
+{
+ return a * b;
+}
+
+int foo3 (_Float16 a, _Float16 b)
+{
+ return a > b;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/arch-16.c b/gcc/testsuite/gcc.target/riscv/arch-16.c
new file mode 100644
index 0000000..14b40ae
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/arch-16.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=rv32gcv_zfh -mabi=ilp32 -mcmodel=medlow" } */
+int foo()
+{
+}
diff --git a/gcc/testsuite/gcc.target/riscv/arch-17.c b/gcc/testsuite/gcc.target/riscv/arch-17.c
new file mode 100644
index 0000000..3d3275e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/arch-17.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=rv32gcv_zfhmin -mabi=ilp32 -mcmodel=medlow" } */
+int foo()
+{
+}
diff --git a/gcc/testsuite/gcc.target/riscv/fle-ieee.c b/gcc/testsuite/gcc.target/riscv/fle-ieee.c
new file mode 100644
index 0000000..af9d503
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/fle-ieee.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -ftrapping-math -fno-signaling-nans" } */
+
+long
+fle (double x, double y)
+{
+ return __builtin_islessequal (x, y);
+}
+
+/* { dg-final { scan-assembler "\tfrflags\t(\[^\n\]*)\n\tfle\\.d\t\[^\n\]*\n\tfsflags\t\\1\n" } } */
+/* { dg-final { scan-assembler-not "snez" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/fle-snan.c b/gcc/testsuite/gcc.target/riscv/fle-snan.c
new file mode 100644
index 0000000..0579d93
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/fle-snan.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -ftrapping-math -fsignaling-nans" } */
+
+long
+fle (double x, double y)
+{
+ return __builtin_islessequal (x, y);
+}
+
+/* { dg-final { scan-assembler "\tfrflags\t(\[^\n\]*)\n\tfle\\.d\t\[^,\]*,(\[^,\]*),(\[^,\]*)\n\tfsflags\t\\1\n\tfeq\\.d\tzero,\\2,\\3\n" } } */
+/* { dg-final { scan-assembler-not "snez" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/fle.c b/gcc/testsuite/gcc.target/riscv/fle.c
new file mode 100644
index 0000000..97c8ab9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/fle.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -fno-trapping-math -fno-signaling-nans" } */
+
+long
+fle (double x, double y)
+{
+ return __builtin_islessequal (x, y);
+}
+
+/* { dg-final { scan-assembler "\tf(?:gt|le)\\.d\t\[^\n\]*\n" } } */
+/* { dg-final { scan-assembler-not "f\[rs\]flags" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/flef-ieee.c b/gcc/testsuite/gcc.target/riscv/flef-ieee.c
new file mode 100644
index 0000000..e2d6b0d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/flef-ieee.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -ftrapping-math -fno-signaling-nans" } */
+
+long
+flef (float x, float y)
+{
+ return __builtin_islessequal (x, y);
+}
+
+/* { dg-final { scan-assembler "\tfrflags\t(\[^\n\]*)\n\tfle\\.s\t\[^\n\]*\n\tfsflags\t\\1\n" } } */
+/* { dg-final { scan-assembler-not "snez" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/flef-snan.c b/gcc/testsuite/gcc.target/riscv/flef-snan.c
new file mode 100644
index 0000000..2d2c5b9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/flef-snan.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -ftrapping-math -fsignaling-nans" } */
+
+long
+flef (float x, float y)
+{
+ return __builtin_islessequal (x, y);
+}
+
+/* { dg-final { scan-assembler "\tfrflags\t(\[^\n\]*)\n\tfle\\.s\t\[^,\]*,(\[^,\]*),(\[^,\]*)\n\tfsflags\t\\1\n\tfeq\\.s\tzero,\\2,\\3\n" } } */
+/* { dg-final { scan-assembler-not "snez" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/flef.c b/gcc/testsuite/gcc.target/riscv/flef.c
new file mode 100644
index 0000000..379f511
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/flef.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -fno-trapping-math -fno-signaling-nans" } */
+
+long
+flef (float x, float y)
+{
+ return __builtin_islessequal (x, y);
+}
+
+/* { dg-final { scan-assembler "\tf(?:gt|le)\\.s\t\[^\n\]*\n" } } */
+/* { dg-final { scan-assembler-not "f\[rs\]flags" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/flt-ieee.c b/gcc/testsuite/gcc.target/riscv/flt-ieee.c
new file mode 100644
index 0000000..7d7aae3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/flt-ieee.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -ftrapping-math -fno-signaling-nans" } */
+
+long
+flt (double x, double y)
+{
+ return __builtin_isless (x, y);
+}
+
+/* { dg-final { scan-assembler "\tfrflags\t(\[^\n\]*)\n\tflt\\.d\t\[^\n\]*\n\tfsflags\t\\1\n" } } */
+/* { dg-final { scan-assembler-not "snez" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/flt-snan.c b/gcc/testsuite/gcc.target/riscv/flt-snan.c
new file mode 100644
index 0000000..ff4c4e9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/flt-snan.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -ftrapping-math -fsignaling-nans" } */
+
+long
+flt (double x, double y)
+{
+ return __builtin_isless (x, y);
+}
+
+/* { dg-final { scan-assembler "\tfrflags\t(\[^\n\]*)\n\tflt\\.d\t\[^,\]*,(\[^,\]*),(\[^,\]*)\n\tfsflags\t\\1\n\tfeq\\.d\tzero,\\2,\\3\n" } } */
+/* { dg-final { scan-assembler-not "snez" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/flt.c b/gcc/testsuite/gcc.target/riscv/flt.c
new file mode 100644
index 0000000..4f5ef1d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/flt.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -fno-trapping-math -fno-signaling-nans" } */
+
+long
+flt (double x, double y)
+{
+ return __builtin_isless (x, y);
+}
+
+/* { dg-final { scan-assembler "\tf(?:ge|lt)\\.d\t\[^\n\]*\n" } } */
+/* { dg-final { scan-assembler-not "f\[rs\]flags" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/fltf-ieee.c b/gcc/testsuite/gcc.target/riscv/fltf-ieee.c
new file mode 100644
index 0000000..ede076e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/fltf-ieee.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -ftrapping-math -fno-signaling-nans" } */
+
+long
+fltf (float x, float y)
+{
+ return __builtin_isless (x, y);
+}
+
+/* { dg-final { scan-assembler "\tfrflags\t(\[^\n\]*)\n\tflt\\.s\t\[^\n\]*\n\tfsflags\t\\1\n" } } */
+/* { dg-final { scan-assembler-not "snez" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/fltf-snan.c b/gcc/testsuite/gcc.target/riscv/fltf-snan.c
new file mode 100644
index 0000000..d29d786
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/fltf-snan.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -ftrapping-math -fsignaling-nans" } */
+
+long
+fltf (float x, float y)
+{
+ return __builtin_isless (x, y);
+}
+
+/* { dg-final { scan-assembler "\tfrflags\t(\[^\n\]*)\n\tflt\\.s\t\[^,\]*,(\[^,\]*),(\[^,\]*)\n\tfsflags\t\\1\n\tfeq\\.s\tzero,\\2,\\3\n" } } */
+/* { dg-final { scan-assembler-not "snez" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/fltf.c b/gcc/testsuite/gcc.target/riscv/fltf.c
new file mode 100644
index 0000000..c9e6a2b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/fltf.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -fno-trapping-math -fno-signaling-nans" } */
+
+long
+fltf (float x, float y)
+{
+ return __builtin_isless (x, y);
+}
+
+/* { dg-final { scan-assembler "\tf(?:ge|lt)\\.s\t\[^\n\]*\n" } } */
+/* { dg-final { scan-assembler-not "f\[rs\]flags" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/fmax-snan.c b/gcc/testsuite/gcc.target/riscv/fmax-snan.c
index ba4823a..aabaad5 100644
--- a/gcc/testsuite/gcc.target/riscv/fmax-snan.c
+++ b/gcc/testsuite/gcc.target/riscv/fmax-snan.c
@@ -1,4 +1,5 @@
/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
/* { dg-options "-fno-finite-math-only -fsigned-zeros -fsignaling-nans -dp" } */
double
diff --git a/gcc/testsuite/gcc.target/riscv/fmaxf-snan.c b/gcc/testsuite/gcc.target/riscv/fmaxf-snan.c
index faada3a..f74a817 100644
--- a/gcc/testsuite/gcc.target/riscv/fmaxf-snan.c
+++ b/gcc/testsuite/gcc.target/riscv/fmaxf-snan.c
@@ -1,4 +1,5 @@
/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
/* { dg-options "-fno-finite-math-only -fsigned-zeros -fsignaling-nans -dp" } */
float
diff --git a/gcc/testsuite/gcc.target/riscv/fmin-snan.c b/gcc/testsuite/gcc.target/riscv/fmin-snan.c
index b511380..3b2e8c3 100644
--- a/gcc/testsuite/gcc.target/riscv/fmin-snan.c
+++ b/gcc/testsuite/gcc.target/riscv/fmin-snan.c
@@ -1,4 +1,5 @@
/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
/* { dg-options "-fno-finite-math-only -fsigned-zeros -fsignaling-nans -dp" } */
double
diff --git a/gcc/testsuite/gcc.target/riscv/fminf-snan.c b/gcc/testsuite/gcc.target/riscv/fminf-snan.c
index 39dd8fe..d28822e 100644
--- a/gcc/testsuite/gcc.target/riscv/fminf-snan.c
+++ b/gcc/testsuite/gcc.target/riscv/fminf-snan.c
@@ -1,4 +1,5 @@
/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
/* { dg-options "-fno-finite-math-only -fsigned-zeros -fsignaling-nans -dp" } */
float
diff --git a/gcc/testsuite/gcc.target/riscv/predef-21.c b/gcc/testsuite/gcc.target/riscv/predef-21.c
new file mode 100644
index 0000000..a171b3b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/predef-21.c
@@ -0,0 +1,59 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=rv64i_zfh -mabi=lp64f -mcmodel=medlow -misa-spec=20191213" } */
+
+int main () {
+
+#ifndef __riscv_arch_test
+#error "__riscv_arch_test"
+#endif
+
+#if __riscv_xlen != 64
+#error "__riscv_xlen"
+#endif
+
+#if !defined(__riscv_i)
+#error "__riscv_i"
+#endif
+
+#if defined(__riscv_c)
+#error "__riscv_c"
+#endif
+
+#if defined(__riscv_e)
+#error "__riscv_e"
+#endif
+
+#if defined(__riscv_a)
+#error "__riscv_a"
+#endif
+
+#if defined(__riscv_m)
+#error "__riscv_m"
+#endif
+
+#if !defined(__riscv_f)
+#error "__riscv_f"
+#endif
+
+#if defined(__riscv_d)
+#error "__riscv_d"
+#endif
+
+#if defined(__riscv_v)
+#error "__riscv_v"
+#endif
+
+#if !defined(__riscv_zfh)
+#error "__riscv_zfh"
+#endif
+
+#if !defined(__riscv_zfhmin)
+#error "__riscv_zfhmin"
+#endif
+
+#if !defined(__riscv_zicsr)
+#error "__riscv_zicsr"
+#endif
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/predef-22.c b/gcc/testsuite/gcc.target/riscv/predef-22.c
new file mode 100644
index 0000000..ad18965
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/predef-22.c
@@ -0,0 +1,59 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=rv64i_zfhmin -mabi=lp64f -mcmodel=medlow -misa-spec=20191213" } */
+
+int main () {
+
+#ifndef __riscv_arch_test
+#error "__riscv_arch_test"
+#endif
+
+#if __riscv_xlen != 64
+#error "__riscv_xlen"
+#endif
+
+#if !defined(__riscv_i)
+#error "__riscv_i"
+#endif
+
+#if defined(__riscv_c)
+#error "__riscv_c"
+#endif
+
+#if defined(__riscv_e)
+#error "__riscv_e"
+#endif
+
+#if defined(__riscv_a)
+#error "__riscv_a"
+#endif
+
+#if defined(__riscv_m)
+#error "__riscv_m"
+#endif
+
+#if !defined(__riscv_f)
+#error "__riscv_f"
+#endif
+
+#if defined(__riscv_d)
+#error "__riscv_d"
+#endif
+
+#if defined(__riscv_v)
+#error "__riscv_v"
+#endif
+
+#if defined(__riscv_zfh)
+#error "__riscv_zfh"
+#endif
+
+#if !defined(__riscv_zfhmin)
+#error "__riscv_zfhmin"
+#endif
+
+#if !defined(__riscv_zicsr)
+#error "__riscv_zicsr"
+#endif
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/zbb_32_bswap-1.c b/gcc/testsuite/gcc.target/riscv/zbb_32_bswap-1.c
new file mode 100644
index 0000000..3ff7d9d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/zbb_32_bswap-1.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gc_zbb -mabi=ilp32" } */
+/* { dg-skip-if "" { *-*-* } { "-O0" } } */
+
+int foo(int n)
+{
+ return __builtin_bswap32(n);
+}
+
+/* { dg-final { scan-assembler "rev8" } } */
+
diff --git a/gcc/testsuite/gcc.target/riscv/zbb_32_bswap-2.c b/gcc/testsuite/gcc.target/riscv/zbb_32_bswap-2.c
new file mode 100644
index 0000000..679b34c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/zbb_32_bswap-2.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gc_zbb -mabi=ilp32" } */
+/* { dg-skip-if "" { *-*-* } { "-O0" } } */
+
+int foo(int n)
+{
+ return __builtin_bswap16(n);
+}
+
+/* { dg-final { scan-assembler "rev8" } } */
+/* { dg-final { scan-assembler "srli" } } */
+
diff --git a/gcc/testsuite/gcc.target/riscv/zbb_bswap-1.c b/gcc/testsuite/gcc.target/riscv/zbb_bswap-1.c
new file mode 100644
index 0000000..20feded
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/zbb_bswap-1.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gc_zbb -mabi=lp64" } */
+/* { dg-skip-if "" { *-*-* } { "-O0" } } */
+
+int foo(int n)
+{
+ return __builtin_bswap32(n);
+}
+
+/* { dg-final { scan-assembler "rev8" } } */
+
diff --git a/gcc/testsuite/gcc.target/riscv/zbb_bswap-2.c b/gcc/testsuite/gcc.target/riscv/zbb_bswap-2.c
new file mode 100644
index 0000000..c358f66
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/zbb_bswap-2.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gc_zbb -mabi=lp64" } */
+/* { dg-skip-if "" { *-*-* } { "-O0" } } */
+
+int foo(int n)
+{
+ return __builtin_bswap16(n);
+}
+
+/* { dg-final { scan-assembler "rev8" } } */
+/* { dg-final { scan-assembler "srli" } } */
+
diff --git a/gcc/testsuite/gcc.target/riscv/zmmul-1.c b/gcc/testsuite/gcc.target/riscv/zmmul-1.c
new file mode 100644
index 0000000..cdae2cb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/zmmul-1.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64iafdc_zmmul -mabi=lp64" } */
+int foo1(int a, int b)
+{
+ return a*b;
+}
+
+int foo2(int a, int b)
+{
+ return a/b;
+}
+
+int foo3(int a, int b)
+{
+ return a%b;
+}
+
+/* { dg-final { scan-assembler-times "mulw\t" 1 } } */
+/* { dg-final { scan-assembler-not "div\t" } } */
+/* { dg-final { scan-assembler-not "rem\t" } } */ \ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/riscv/zmmul-2.c b/gcc/testsuite/gcc.target/riscv/zmmul-2.c
new file mode 100644
index 0000000..dc6829d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/zmmul-2.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32iafdc_zmmul -mabi=ilp32" } */
+int foo1(int a, int b)
+{
+ return a*b;
+}
+
+int foo2(int a, int b)
+{
+ return a/b;
+}
+
+int foo3(int a, int b)
+{
+ return a%b;
+}
+
+/* { dg-final { scan-assembler-times "mul\t" 1 } } */
+/* { dg-final { scan-assembler-not "div\t" } } */
+/* { dg-final { scan-assembler-not "rem\t" } } */ \ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/s390/20041216-1.c b/gcc/testsuite/gcc.target/s390/20041216-1.c
deleted file mode 100644
index 492ee6c..0000000
--- a/gcc/testsuite/gcc.target/s390/20041216-1.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* This test case would get an unresolved symbol during link
- because stabs referred to an optimized-away literal pool
- entry. */
-
-/* { dg-do run } */
-/* { dg-options "-O2 -fno-omit-frame-pointer -gstabs" } */
-
-int main (void)
-{
- static char buf[4096];
- char *p;
-
- do
- {
- p = buf;
- asm volatile ("" : : : "memory", "0", "1", "2", "3", "4", "5", "6",
- "7", "8", "9", "10", "12");
- }
- while (*p);
-
- return 0;
-}
-
diff --git a/gcc/testsuite/gcc.target/s390/ifcvt-one-insn-bool.c b/gcc/testsuite/gcc.target/s390/ifcvt-one-insn-bool.c
index 0a96b71..0c8c2f8 100644
--- a/gcc/testsuite/gcc.target/s390/ifcvt-one-insn-bool.c
+++ b/gcc/testsuite/gcc.target/s390/ifcvt-one-insn-bool.c
@@ -1,7 +1,7 @@
/* Check load on condition for bool. */
/* { dg-do compile { target { s390*-*-* } } } */
-/* { dg-options "-O2 -march=z13" } */
+/* { dg-options "-O2 -march=z13 -mzarch" } */
/* { dg-final { scan-assembler "lochinh\t%r.?,1" } } */
#include <stdbool.h>
diff --git a/gcc/testsuite/gcc.target/s390/ifcvt-one-insn-char.c b/gcc/testsuite/gcc.target/s390/ifcvt-one-insn-char.c
index 9c3d041..8c8e0ae 100644
--- a/gcc/testsuite/gcc.target/s390/ifcvt-one-insn-char.c
+++ b/gcc/testsuite/gcc.target/s390/ifcvt-one-insn-char.c
@@ -1,7 +1,7 @@
/* Check load on condition for global char. */
/* { dg-do compile { target { s390*-*-* } } } */
-/* { dg-options "-O2 -march=z13" } */
+/* { dg-options "-O2 -march=z13 -mzarch" } */
/* { dg-final { scan-assembler "locrnh\t%r.?,%r.?" } } */
#include <stdbool.h>
diff --git a/gcc/testsuite/gcc.target/s390/ifcvt-two-insns-bool.c b/gcc/testsuite/gcc.target/s390/ifcvt-two-insns-bool.c
index df0416a..1027ddc 100644
--- a/gcc/testsuite/gcc.target/s390/ifcvt-two-insns-bool.c
+++ b/gcc/testsuite/gcc.target/s390/ifcvt-two-insns-bool.c
@@ -1,7 +1,7 @@
/* Check if conversion for two instructions. */
/* { dg-do run } */
-/* { dg-options "-O2 -march=z13 --save-temps" } */
+/* { dg-options "-O2 -march=z13 -mzarch --save-temps" } */
/* { dg-final { scan-assembler "lochih\t%r.?,1" } } */
/* { dg-final { scan-assembler "locrh\t.*" } } */
diff --git a/gcc/testsuite/gcc.target/s390/ifcvt-two-insns-int.c b/gcc/testsuite/gcc.target/s390/ifcvt-two-insns-int.c
index 181173b..fc6946f 100644
--- a/gcc/testsuite/gcc.target/s390/ifcvt-two-insns-int.c
+++ b/gcc/testsuite/gcc.target/s390/ifcvt-two-insns-int.c
@@ -1,7 +1,7 @@
/* Check if conversion for two instructions. */
/* { dg-do run } */
-/* { dg-options "-O2 -march=z13 --save-temps" } */
+/* { dg-options "-O2 -march=z13 -mzarch --save-temps" } */
/* { dg-final { scan-assembler "lochih\t%r.?,1" } } */
/* { dg-final { scan-assembler "locrh\t.*" } } */
diff --git a/gcc/testsuite/gcc.target/s390/ifcvt-two-insns-long.c b/gcc/testsuite/gcc.target/s390/ifcvt-two-insns-long.c
index c66ef6c..51af498 100644
--- a/gcc/testsuite/gcc.target/s390/ifcvt-two-insns-long.c
+++ b/gcc/testsuite/gcc.target/s390/ifcvt-two-insns-long.c
@@ -1,19 +1,20 @@
/* Check if conversion for two instructions. */
/* { dg-do run } */
-/* { dg-options "-O2 -march=z13 --save-temps" } */
+/* { dg-options "-O2 -march=z13 -mzarch --save-temps" } */
/* { dg-final { scan-assembler "locghih\t%r.?,1" } } */
/* { dg-final { scan-assembler "locgrh\t.*" } } */
+
#include <limits.h>
#include <stdio.h>
#include <assert.h>
__attribute__ ((noinline))
-long foo (long *a, unsigned long n)
+long long foo (long long *a, unsigned long long n)
{
- long min = 999999;
- long bla = 0;
+ long long min = 999999;
+ long long bla = 0;
for (int i = 0; i < n; i++)
{
if (a[i] < min)
@@ -30,9 +31,9 @@ long foo (long *a, unsigned long n)
int main()
{
- long a[] = {2, 1, -13, LONG_MAX, LONG_MIN, 0};
+ long long a[] = {2, 1, -13, LONG_MAX, LONG_MIN, 0};
- long res = foo (a, sizeof (a) / sizeof (a[0]));
+ long long res = foo (a, sizeof (a) / sizeof (a[0]));
assert (res == (LONG_MIN + 1));
}
diff --git a/gcc/testsuite/gcc.target/s390/s390.exp b/gcc/testsuite/gcc.target/s390/s390.exp
index 0c44070..cae7ea6 100644
--- a/gcc/testsuite/gcc.target/s390/s390.exp
+++ b/gcc/testsuite/gcc.target/s390/s390.exp
@@ -30,7 +30,7 @@ load_lib target-supports.exp
load_lib gfortran-dg.exp
load_lib atomic-dg.exp
-# Return 1 if the the assembler understands .machine and .machinemode. The
+# Return 1 if the assembler understands .machine and .machinemode. The
# target attribute needs that feature to work.
proc check_effective_target_target_attribute { } {
if { ![check_runtime s390_check_machine_machinemode [subst {
diff --git a/gcc/testsuite/gcc.target/s390/vector/vec-copysign.c b/gcc/testsuite/gcc.target/s390/vector/vec-copysign.c
index 64c6970..b723ceb 100644
--- a/gcc/testsuite/gcc.target/s390/vector/vec-copysign.c
+++ b/gcc/testsuite/gcc.target/s390/vector/vec-copysign.c
@@ -1,5 +1,5 @@
/* { dg-do compile { target { s390*-*-* } } } */
-/* { dg-options "-O2 -ftree-vectorize -mzarch" } */
+/* { dg-options "-O2 -ftree-vectorize -mzarch -fno-unroll-loops" } */
/* { dg-final { scan-assembler-times "vgmg" 1 } } */
/* { dg-final { scan-assembler-times "vgmf" 1 } } */
/* { dg-final { scan-assembler-times "vsel" 2 } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/vec-sum-across-no-lower-subreg-1.c b/gcc/testsuite/gcc.target/s390/vector/vec-sum-across-no-lower-subreg-1.c
new file mode 100644
index 0000000..8d63e8c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/vec-sum-across-no-lower-subreg-1.c
@@ -0,0 +1,18 @@
+/* { dg-do compile { target { s390*-*-* } } } */
+/* { dg-options "-O3 -mzarch -mzvector -march=z15 -fdump-rtl-subreg1" } */
+
+/* { dg-final { scan-rtl-dump-times "Skipping mode V2DI for copy lowering" 2 "subreg1" } } */
+
+#include <vecintrin.h>
+
+#define STYPE long long
+#define VTYPE __attribute__ ((vector_size (16))) STYPE
+
+STYPE
+foo1 (VTYPE a)
+{
+ /* { dg-final { scan-assembler-not "vst\t.*" } } */
+ /* { dg-final { scan-assembler-not "lg\t.*" } } */
+ /* { dg-final { scan-assembler-not "lgr\t.*" } } */
+ return a[0] + a[1];
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/vperm-rev-z14.c b/gcc/testsuite/gcc.target/s390/vector/vperm-rev-z14.c
new file mode 100644
index 0000000..eefacad
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/vperm-rev-z14.c
@@ -0,0 +1,87 @@
+/* Make sure that the reverse permute patterns are optimized
+ correctly. */
+/* { dg-do run { target { s390*-*-* } } } */
+/* { dg-options "-O2 -march=z14 -mzarch -fno-unroll-loops -save-temps" } */
+
+/* { dg-final { scan-assembler-times "vpdi\t" 4 } } */
+/* { dg-final { scan-assembler-times "verllg\t" 2 } } */
+
+#include <assert.h>
+
+__attribute__((noipa))
+void reversel (long long *restrict a, long long *restrict b, int n)
+{
+ for (int i = 0; i < n; i += 2)
+ {
+ a[i + 1] = b[i + 0];
+ a[i + 0] = b[i + 1];
+ }
+}
+
+__attribute__((noipa))
+void reversed (double *restrict a, double *restrict b, int n)
+{
+ for (int i = 0; i < n; i += 2)
+ {
+ a[i + 1] = b[i + 0];
+ a[i + 0] = b[i + 1];
+ }
+}
+
+__attribute__((noipa))
+void reversei (unsigned int *restrict a, unsigned int *restrict b, int n)
+{
+ for (int i = 0; i < n; i += 4)
+ {
+ a[i + 3] = b[i + 0];
+ a[i + 2] = b[i + 1];
+ a[i + 1] = b[i + 2];
+ a[i + 0] = b[i + 3];
+ }
+}
+
+__attribute__((noipa))
+void reversef (float *restrict a, float *restrict b, int n)
+{
+ for (int i = 0; i < n; i += 4)
+ {
+ a[i + 3] = b[i + 0];
+ a[i + 2] = b[i + 1];
+ a[i + 1] = b[i + 2];
+ a[i + 0] = b[i + 3];
+ }
+}
+
+int main()
+{
+ const int n = 1024;
+ unsigned int u[n], u2[n];
+ long long l[n], l2[n];
+ double d[n], d2[n];
+ float f[n], f2[n];
+
+ for (int i = 0; i < n; i++)
+ {
+ u[i] = i;
+ l[i] = i;
+ d[i] = i;
+ f[i] = i;
+ u2[i] = i;
+ l2[i] = i;
+ d2[i] = i;
+ f2[i] = i;
+ }
+
+ reversei (u2, u, n);
+ reversel (l2, l, n);
+ reversed (d2, d, n);
+ reversef (f2, f, n);
+
+ for (int i = 0; i < n - 16; i++)
+ {
+ assert (u[i] == u2[i / (16 / sizeof (u[0])) * (16 / sizeof (u[0])) + 16 / sizeof (u[0]) - 1 - i % (16 / sizeof (u[0]))]);
+ assert (l[i] == l2[i / (16 / sizeof (l[0])) * (16 / sizeof (l[0])) + 16 / sizeof (l[0]) - 1 - i % (16 / sizeof (l[0]))]);
+ assert (d[i] == d2[i / (16 / sizeof (d[0])) * (16 / sizeof (d[0])) + 16 / sizeof (d[0]) - 1 - i % (16 / sizeof (d[0]))]);
+ assert (f[i] == f2[i / (16 / sizeof (f[0])) * (16 / sizeof (f[0])) + 16 / sizeof (f[0]) - 1 - i % (16 / sizeof (f[0]))]);
+ }
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/vperm-rev-z15.c b/gcc/testsuite/gcc.target/s390/vector/vperm-rev-z15.c
new file mode 100644
index 0000000..079460b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/vperm-rev-z15.c
@@ -0,0 +1,118 @@
+/* Make sure that the reverse permute patterns are optimized
+ correctly. */
+/* { dg-do run { target { s390*-*-* } } } */
+/* { dg-options "-O2 -march=z15 -mzarch -fno-unroll-loops -save-temps" } */
+
+/* { dg-final { scan-assembler-times "vsterg\t" 2 } } */
+/* { dg-final { scan-assembler-times "vsterf\t" 2 } } */
+/* { dg-final { scan-assembler-times "vstbrq\t" 1 } } */
+/* { dg-final { scan-assembler-times "vperm\t" 0 } } */
+
+#include <assert.h>
+
+__attribute__((noipa))
+void reversec (char *restrict a, char *restrict b, int n)
+{
+ for (int i = 0; i < n; i += 16)
+ {
+ a[i + 0] = b[i + 15];
+ a[i + 1] = b[i + 14];
+ a[i + 2] = b[i + 13];
+ a[i + 3] = b[i + 12];
+ a[i + 4] = b[i + 11];
+ a[i + 5] = b[i + 10];
+ a[i + 6] = b[i + 9];
+ a[i + 7] = b[i + 8];
+ a[i + 8] = b[i + 7];
+ a[i + 9] = b[i + 6];
+ a[i + 10] = b[i + 5];
+ a[i + 11] = b[i + 4];
+ a[i + 12] = b[i + 3];
+ a[i + 13] = b[i + 2];
+ a[i + 14] = b[i + 1];
+ a[i + 15] = b[i + 0];
+ }
+}
+
+__attribute__((noipa))
+void reversel (long long *restrict a, long long *restrict b, int n)
+{
+ for (int i = 0; i < n; i += 2)
+ {
+ a[i + 1] = b[i + 0];
+ a[i + 0] = b[i + 1];
+ }
+}
+
+__attribute__((noipa))
+void reversed (double *restrict a, double *restrict b, int n)
+{
+ for (int i = 0; i < n; i += 2)
+ {
+ a[i + 1] = b[i + 0];
+ a[i + 0] = b[i + 1];
+ }
+}
+
+__attribute__((noipa))
+void reversei (unsigned int *restrict a, unsigned int *restrict b, int n)
+{
+ for (int i = 0; i < n; i += 4)
+ {
+ a[i + 3] = b[i + 0];
+ a[i + 2] = b[i + 1];
+ a[i + 1] = b[i + 2];
+ a[i + 0] = b[i + 3];
+ }
+}
+
+__attribute__((noipa))
+void reversef (float *restrict a, float *restrict b, int n)
+{
+ for (int i = 0; i < n; i += 4)
+ {
+ a[i + 3] = b[i + 0];
+ a[i + 2] = b[i + 1];
+ a[i + 1] = b[i + 2];
+ a[i + 0] = b[i + 3];
+ }
+}
+
+int main()
+{
+ const int n = 1024;
+ char c[n], c2[n];
+ unsigned int u[n], u2[n];
+ long long l[n], l2[n];
+ double d[n], d2[n];
+ float f[n], f2[n];
+
+ for (int i = 0; i < n; i++)
+ {
+ c[i] = i;
+ u[i] = i;
+ l[i] = i;
+ d[i] = i;
+ f[i] = i;
+ c2[i] = i;
+ u2[i] = i;
+ l2[i] = i;
+ d2[i] = i;
+ f2[i] = i;
+ }
+
+ reversec (c2, c, n);
+ reversei (u2, u, n);
+ reversel (l2, l, n);
+ reversed (d2, d, n);
+ reversef (f2, f, n);
+
+ for (int i = 0; i < n - 16; i++)
+ {
+ assert (c[i] == c2[i / (16 / sizeof (c[0])) * (16 / sizeof (c[0])) + 16 / sizeof (c[0]) - 1 - i % (16 / sizeof (c[0]))]);
+ assert (u[i] == u2[i / (16 / sizeof (u[0])) * (16 / sizeof (u[0])) + 16 / sizeof (u[0]) - 1 - i % (16 / sizeof (u[0]))]);
+ assert (l[i] == l2[i / (16 / sizeof (l[0])) * (16 / sizeof (l[0])) + 16 / sizeof (l[0]) - 1 - i % (16 / sizeof (l[0]))]);
+ assert (d[i] == d2[i / (16 / sizeof (d[0])) * (16 / sizeof (d[0])) + 16 / sizeof (d[0]) - 1 - i % (16 / sizeof (d[0]))]);
+ assert (f[i] == f2[i / (16 / sizeof (f[0])) * (16 / sizeof (f[0])) + 16 / sizeof (f[0]) - 1 - i % (16 / sizeof (f[0]))]);
+ }
+}
diff --git a/gcc/testsuite/gcc.target/s390/zvector/autovec-double-quiet-uneq.c b/gcc/testsuite/gcc.target/s390/zvector/autovec-double-quiet-uneq.c
index 7c9b20f..8948be2 100644
--- a/gcc/testsuite/gcc.target/s390/zvector/autovec-double-quiet-uneq.c
+++ b/gcc/testsuite/gcc.target/s390/zvector/autovec-double-quiet-uneq.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -march=z13 -mzvector -mzarch" } */
+/* { dg-options "-O3 -march=z13 -mzvector -mzarch -fno-unroll-loops" } */
#include "autovec.h"
diff --git a/gcc/testsuite/gcc.target/s390/zvector/autovec-double-signaling-ltgt.c b/gcc/testsuite/gcc.target/s390/zvector/autovec-double-signaling-ltgt.c
index 9dfae8f..9417b0c 100644
--- a/gcc/testsuite/gcc.target/s390/zvector/autovec-double-signaling-ltgt.c
+++ b/gcc/testsuite/gcc.target/s390/zvector/autovec-double-signaling-ltgt.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -march=z14 -mzvector -mzarch" } */
+/* { dg-options "-O3 -march=z14 -mzvector -mzarch -fno-unroll-loops" } */
#include "autovec.h"
diff --git a/gcc/testsuite/gcc.target/s390/zvector/autovec-float-quiet-uneq.c b/gcc/testsuite/gcc.target/s390/zvector/autovec-float-quiet-uneq.c
index 5ab9337..0a2aca0 100644
--- a/gcc/testsuite/gcc.target/s390/zvector/autovec-float-quiet-uneq.c
+++ b/gcc/testsuite/gcc.target/s390/zvector/autovec-float-quiet-uneq.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -march=z14 -mzvector -mzarch" } */
+/* { dg-options "-O3 -march=z14 -mzvector -mzarch -fno-unroll-loops" } */
#include "autovec.h"
diff --git a/gcc/testsuite/gcc.target/s390/zvector/autovec-float-signaling-ltgt.c b/gcc/testsuite/gcc.target/s390/zvector/autovec-float-signaling-ltgt.c
index c34cf09..15e61b7 100644
--- a/gcc/testsuite/gcc.target/s390/zvector/autovec-float-signaling-ltgt.c
+++ b/gcc/testsuite/gcc.target/s390/zvector/autovec-float-signaling-ltgt.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -march=z14 -mzvector -mzarch" } */
+/* { dg-options "-O3 -march=z14 -mzvector -mzarch -fno-unroll-loops" } */
#include "autovec.h"
diff --git a/gcc/testsuite/gcc.target/s390/zvector/vec-cmp-2.c b/gcc/testsuite/gcc.target/s390/zvector/vec-cmp-2.c
index 09a15eb..c4e75f5 100644
--- a/gcc/testsuite/gcc.target/s390/zvector/vec-cmp-2.c
+++ b/gcc/testsuite/gcc.target/s390/zvector/vec-cmp-2.c
@@ -1,5 +1,5 @@
/* Similiar to vec-cmp-1.c but requires that
- s390_canonicalize_comparison is able to merge the the two nested
+ s390_canonicalize_comparison is able to merge the two nested
compares. */
/* { dg-do compile { target { s390*-*-* } } } */
diff --git a/gcc/testsuite/gcc.target/s390/zvector/vec-reve-int-long.c b/gcc/testsuite/gcc.target/s390/zvector/vec-reve-int-long.c
new file mode 100644
index 0000000..dff3a94
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/zvector/vec-reve-int-long.c
@@ -0,0 +1,31 @@
+/* Test that we use vpdi in order to reverse vectors
+ with two elements instead of creating a literal-pool entry
+ and permuting with vperm. */
+/* { dg-do compile { target { s390*-*-* } } } */
+/* { dg-options "-O2 -march=z14 -mzarch -mzvector -fno-unroll-loops" } */
+
+/* { dg-final { scan-assembler-times "vpdi\t" 4 } } */
+/* { dg-final { scan-assembler-times "verllg\t" 2 } } */
+/* { dg-final { scan-assembler-times "vperm" 0 } } */
+
+#include <vecintrin.h>
+
+vector double reved (vector double a)
+{
+ return vec_reve (a);
+}
+
+vector long long revel (vector long long a)
+{
+ return vec_reve (a);
+}
+
+vector float revef (vector float a)
+{
+ return vec_reve (a);
+}
+
+vector int revei (vector int a)
+{
+ return vec_reve (a);
+}
diff --git a/gcc/testsuite/gcc.target/s390/zvector/vec-reve-store-byte.c b/gcc/testsuite/gcc.target/s390/zvector/vec-reve-store-byte.c
index db8284b..6c061c6 100644
--- a/gcc/testsuite/gcc.target/s390/zvector/vec-reve-store-byte.c
+++ b/gcc/testsuite/gcc.target/s390/zvector/vec-reve-store-byte.c
@@ -16,13 +16,11 @@ bar (signed char *target, vector signed char x)
vec_xst (vec_reve (x), 0, target);
}
-/* { dg-final { scan-assembler-times "vstbrq\t" 2 } } */
-
-/* mem -> mem: This becomes vlbrq + vst */
+/* mem -> mem: This becomes vl + vstbrq */
void
baz (vector signed char *target, vector signed char *x)
{
*target = vec_reve (*x);
}
-/* { dg-final { scan-assembler-times "vlbrq\t" 1 } } */
+/* { dg-final { scan-assembler-times "vstbrq\t" 3 } } */
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/abi-bf16.exp b/gcc/testsuite/gcc.target/x86_64/abi/bf16/abi-bf16.exp
new file mode 100644
index 0000000..bd386f2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/abi-bf16.exp
@@ -0,0 +1,46 @@
+# Copyright (C) 2022 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# The x86-64 ABI testsuite needs one additional assembler file for most
+# testcases. For simplicity we will just link it into each test.
+
+load_lib c-torture.exp
+load_lib target-supports.exp
+load_lib torture-options.exp
+load_lib clearcap.exp
+
+if { (![istarget x86_64-*-*] && ![istarget i?86-*-*])
+ || ![is-effective-target lp64]
+ || ![is-effective-target sse2] } then {
+ return
+}
+
+
+torture-init
+clearcap-init
+set-torture-options $C_TORTURE_OPTIONS
+set additional_flags "-W -Wall -msse2"
+
+foreach src [lsort [glob -nocomplain $srcdir/$subdir/test_*.c]] {
+ if {[runtest_file_p $runtests $src]} {
+ c-torture-execute [list $src \
+ $srcdir/$subdir/asm-support.S] \
+ $additional_flags
+ }
+}
+
+clearcap-finish
+torture-finish
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/args.h b/gcc/testsuite/gcc.target/x86_64/abi/bf16/args.h
new file mode 100644
index 0000000..11d7e2b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/args.h
@@ -0,0 +1,164 @@
+#ifndef INCLUDED_ARGS_H
+#define INCLUDED_ARGS_H
+
+#include <string.h>
+
+/* This defines the calling sequences for integers and floats. */
+#define I0 rdi
+#define I1 rsi
+#define I2 rdx
+#define I3 rcx
+#define I4 r8
+#define I5 r9
+#define F0 xmm0
+#define F1 xmm1
+#define F2 xmm2
+#define F3 xmm3
+#define F4 xmm4
+#define F5 xmm5
+#define F6 xmm6
+#define F7 xmm7
+
+typedef union {
+ __bf16 ___bf16[8];
+ float _float[4];
+ double _double[2];
+ long long _longlong[2];
+ int _int[4];
+ ulonglong _ulonglong[2];
+#ifdef CHECK_M64_M128
+ __m64 _m64[2];
+ __m128 _m128[1];
+ __m128bf16 _m128bf16[1];
+#endif
+} XMM_T;
+
+typedef union {
+ __bf16 ___bf16;
+ float _float;
+ double _double;
+ ldouble _ldouble;
+ ulonglong _ulonglong[2];
+} X87_T;
+extern void (*callthis)(void);
+extern unsigned long long rax,rbx,rcx,rdx,rsi,rdi,rsp,rbp,r8,r9,r10,r11,r12,r13,r14,r15;
+XMM_T xmm_regs[16];
+X87_T x87_regs[8];
+extern volatile unsigned long long volatile_var;
+extern void snapshot (void);
+extern void snapshot_ret (void);
+#define WRAP_CALL(N) \
+ (callthis = (void (*)()) (N), (typeof (&N)) snapshot)
+#define WRAP_RET(N) \
+ (callthis = (void (*)()) (N), (typeof (&N)) snapshot_ret)
+
+/* Clear all integer registers. */
+#define clear_int_hardware_registers \
+ asm __volatile__ ("xor %%rax, %%rax\n\t" \
+ "xor %%rbx, %%rbx\n\t" \
+ "xor %%rcx, %%rcx\n\t" \
+ "xor %%rdx, %%rdx\n\t" \
+ "xor %%rsi, %%rsi\n\t" \
+ "xor %%rdi, %%rdi\n\t" \
+ "xor %%r8, %%r8\n\t" \
+ "xor %%r9, %%r9\n\t" \
+ "xor %%r10, %%r10\n\t" \
+ "xor %%r11, %%r11\n\t" \
+ "xor %%r12, %%r12\n\t" \
+ "xor %%r13, %%r13\n\t" \
+ "xor %%r14, %%r14\n\t" \
+ "xor %%r15, %%r15\n\t" \
+ ::: "rax", "rbx", "rcx", "rdx", "rsi", "rdi", "r8", \
+ "r9", "r10", "r11", "r12", "r13", "r14", "r15");
+
+/* This is the list of registers available for passing arguments. Not all of
+ these are used or even really available. */
+struct IntegerRegisters
+{
+ unsigned long long rax, rbx, rcx, rdx, rsi, rdi, r8, r9, r10, r11, r12, r13, r14, r15;
+};
+struct FloatRegisters
+{
+ double mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7;
+ ldouble st0, st1, st2, st3, st4, st5, st6, st7;
+ XMM_T xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9,
+ xmm10, xmm11, xmm12, xmm13, xmm14, xmm15;
+};
+
+/* Implemented in scalarargs.c */
+extern struct IntegerRegisters iregs;
+extern struct FloatRegisters fregs;
+extern unsigned int num_iregs, num_fregs;
+
+/* Clear register struct. */
+#define clear_struct_registers \
+ rax = rbx = rcx = rdx = rdi = rsi = rbp = rsp \
+ = r8 = r9 = r10 = r11 = r12 = r13 = r14 = r15 = 0; \
+ memset (&iregs, 0, sizeof (iregs)); \
+ memset (&fregs, 0, sizeof (fregs)); \
+ memset (xmm_regs, 0, sizeof (xmm_regs)); \
+ memset (x87_regs, 0, sizeof (x87_regs));
+
+/* Clear both hardware and register structs for integers. */
+#define clear_int_registers \
+ clear_struct_registers \
+ clear_int_hardware_registers
+
+/* Do the checking. */
+#define check_f_arguments(T) do { \
+ assert (num_fregs <= 0 || check_bf16 (fregs.xmm0._ ## T [0], xmm_regs[0]._ ## T [0]) == 1); \
+ assert (num_fregs <= 1 || check_bf16 (fregs.xmm1._ ## T [0], xmm_regs[1]._ ## T [0]) == 1); \
+ assert (num_fregs <= 2 || check_bf16 (fregs.xmm2._ ## T [0], xmm_regs[2]._ ## T [0]) == 1); \
+ assert (num_fregs <= 3 || check_bf16 (fregs.xmm3._ ## T [0], xmm_regs[3]._ ## T [0]) == 1); \
+ assert (num_fregs <= 4 || check_bf16 (fregs.xmm4._ ## T [0], xmm_regs[4]._ ## T [0]) == 1); \
+ assert (num_fregs <= 5 || check_bf16 (fregs.xmm5._ ## T [0], xmm_regs[5]._ ## T [0]) == 1); \
+ assert (num_fregs <= 6 || check_bf16 (fregs.xmm6._ ## T [0], xmm_regs[6]._ ## T [0]) == 1); \
+ assert (num_fregs <= 7 || check_bf16 (fregs.xmm7._ ## T [0], xmm_regs[7]._ ## T [0]) == 1); \
+ } while (0)
+
+#define check_bf16_arguments check_f_arguments(__bf16)
+
+#define check_vector_arguments(T,O) do { \
+ assert (num_fregs <= 0 \
+ || memcmp (((char *) &fregs.xmm0) + (O), \
+ &xmm_regs[0], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 1 \
+ || memcmp (((char *) &fregs.xmm1) + (O), \
+ &xmm_regs[1], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 2 \
+ || memcmp (((char *) &fregs.xmm2) + (O), \
+ &xmm_regs[2], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 3 \
+ || memcmp (((char *) &fregs.xmm3) + (O), \
+ &xmm_regs[3], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 4 \
+ || memcmp (((char *) &fregs.xmm4) + (O), \
+ &xmm_regs[4], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 5 \
+ || memcmp (((char *) &fregs.xmm5) + (O), \
+ &xmm_regs[5], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 6 \
+ || memcmp (((char *) &fregs.xmm6) + (O), \
+ &xmm_regs[6], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 7 \
+ || memcmp (((char *) &fregs.xmm7) + (O), \
+ &xmm_regs[7], \
+ sizeof (__ ## T) - (O)) == 0); \
+ } while (0)
+
+#define check_m128_arguments check_vector_arguments(m128, 0)
+
+#define clear_float_registers \
+ clear_struct_registers
+
+#define clear_x87_registers \
+ clear_struct_registers
+
+#endif /* INCLUDED_ARGS_H */
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/asm-support.S b/gcc/testsuite/gcc.target/x86_64/abi/bf16/asm-support.S
new file mode 100644
index 0000000..7559aa9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/asm-support.S
@@ -0,0 +1,84 @@
+ .text
+ .p2align 4,,15
+.globl snapshot
+ .type snapshot, @function
+snapshot:
+.LFB3:
+ movq %rax, rax(%rip)
+ movq %rbx, rbx(%rip)
+ movq %rcx, rcx(%rip)
+ movq %rdx, rdx(%rip)
+ movq %rdi, rdi(%rip)
+ movq %rsi, rsi(%rip)
+ movq %rbp, rbp(%rip)
+ movq %rsp, rsp(%rip)
+ movq %r8, r8(%rip)
+ movq %r9, r9(%rip)
+ movq %r10, r10(%rip)
+ movq %r11, r11(%rip)
+ movq %r12, r12(%rip)
+ movq %r13, r13(%rip)
+ movq %r14, r14(%rip)
+ movq %r15, r15(%rip)
+ movdqu %xmm0, xmm_regs+0(%rip)
+ movdqu %xmm1, xmm_regs+16(%rip)
+ movdqu %xmm2, xmm_regs+32(%rip)
+ movdqu %xmm3, xmm_regs+48(%rip)
+ movdqu %xmm4, xmm_regs+64(%rip)
+ movdqu %xmm5, xmm_regs+80(%rip)
+ movdqu %xmm6, xmm_regs+96(%rip)
+ movdqu %xmm7, xmm_regs+112(%rip)
+ movdqu %xmm8, xmm_regs+128(%rip)
+ movdqu %xmm9, xmm_regs+144(%rip)
+ movdqu %xmm10, xmm_regs+160(%rip)
+ movdqu %xmm11, xmm_regs+176(%rip)
+ movdqu %xmm12, xmm_regs+192(%rip)
+ movdqu %xmm13, xmm_regs+208(%rip)
+ movdqu %xmm14, xmm_regs+224(%rip)
+ movdqu %xmm15, xmm_regs+240(%rip)
+ jmp *callthis(%rip)
+.LFE3:
+ .size snapshot, .-snapshot
+
+ .p2align 4,,15
+.globl snapshot_ret
+ .type snapshot_ret, @function
+snapshot_ret:
+ movq %rdi, rdi(%rip)
+ subq $8, %rsp
+ call *callthis(%rip)
+ addq $8, %rsp
+ movq %rax, rax(%rip)
+ movq %rdx, rdx(%rip)
+ movdqu %xmm0, xmm_regs+0(%rip)
+ movdqu %xmm1, xmm_regs+16(%rip)
+ fstpt x87_regs(%rip)
+ fstpt x87_regs+16(%rip)
+ fldt x87_regs+16(%rip)
+ fldt x87_regs(%rip)
+ ret
+ .size snapshot_ret, .-snapshot_ret
+
+ .comm callthis,8,8
+ .comm rax,8,8
+ .comm rbx,8,8
+ .comm rcx,8,8
+ .comm rdx,8,8
+ .comm rsi,8,8
+ .comm rdi,8,8
+ .comm rsp,8,8
+ .comm rbp,8,8
+ .comm r8,8,8
+ .comm r9,8,8
+ .comm r10,8,8
+ .comm r11,8,8
+ .comm r12,8,8
+ .comm r13,8,8
+ .comm r14,8,8
+ .comm r15,8,8
+ .comm xmm_regs,256,32
+ .comm x87_regs,128,32
+ .comm volatile_var,8,8
+#ifdef __linux__
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/bf16-check.h b/gcc/testsuite/gcc.target/x86_64/abi/bf16/bf16-check.h
new file mode 100644
index 0000000..25448fc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/bf16-check.h
@@ -0,0 +1,24 @@
+#include <stdlib.h>
+#include "bf16-helper.h"
+
+static void do_test (void);
+
+int
+main ()
+{
+
+ if (__builtin_cpu_supports ("sse2"))
+ {
+ do_test ();
+#ifdef DEBUG
+ printf ("PASSED\n");
+#endif
+ return 0;
+ }
+
+#ifdef DEBUG
+ printf ("SKIPPED\n");
+#endif
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/bf16-helper.h b/gcc/testsuite/gcc.target/x86_64/abi/bf16/bf16-helper.h
new file mode 100644
index 0000000..e090a72
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/bf16-helper.h
@@ -0,0 +1,45 @@
+typedef __bf16 __m128bf16 __attribute__((__vector_size__(16), __aligned__(16)));
+typedef __bf16 __m256bf16 __attribute__((__vector_size__(32), __aligned__(32)));
+typedef __bf16 __m512bf16 __attribute__((__vector_size__(64), __aligned__(64)));
+
+typedef union
+{
+ float f;
+ unsigned int u;
+ __bf16 b[2];
+} unionf_b;
+
+static __bf16 make_f32_bf16 (float f)
+{
+ unionf_b tmp;
+ tmp.f = f;
+ return tmp.b[1];
+}
+
+static float make_bf16_f32 (__bf16 bf)
+{
+ unionf_b tmp;
+ tmp.u = 0;
+ tmp.b[1] = bf;
+ return tmp.f;
+}
+
+static int check_bf16 (__bf16 bf1, __bf16 bf2)
+{
+ unionf_b tmp1, tmp2;
+ tmp1.u = 0;
+ tmp2.u = 0;
+ tmp1.b[1] = bf1;
+ tmp2.b[1] = bf2;
+ return (tmp1.u == tmp2.u);
+}
+
+static int check_bf16_float (__bf16 bf, float f)
+{
+ unionf_b tmp1, tmp2;
+ tmp1.u = 0;
+ tmp1.b[0] = bf;
+ tmp2.f = f;
+ tmp2.u >>= 16;
+ return (tmp1.u == tmp2.u);
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/defines.h b/gcc/testsuite/gcc.target/x86_64/abi/bf16/defines.h
new file mode 100644
index 0000000..a4df0b0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/defines.h
@@ -0,0 +1,163 @@
+#ifndef DEFINED_DEFINES_H
+#define DEFINED_DEFINES_H
+
+/* Get __m64 and __m128. */
+#include <immintrin.h>
+
+typedef unsigned long long ulonglong;
+typedef long double ldouble;
+
+/* These defines determines what part of the test should be run. When
+ GCC implements these parts, the defines should be uncommented to
+ enable testing. */
+
+/* Scalar type __int128. */
+/* #define CHECK_INT128 */
+
+/* Scalar type long double. */
+#define CHECK_LONG_DOUBLE
+
+/* Scalar type __float128. */
+/* #define CHECK_FLOAT128 */
+
+/* Scalar types __m64 and __m128. */
+#define CHECK_M64_M128
+
+/* Structs with size >= 16. */
+#define CHECK_LARGER_STRUCTS
+
+/* Checks for passing floats and doubles. */
+#define CHECK_FLOAT_DOUBLE_PASSING
+
+/* Union passing with not-extremely-simple unions. */
+#define CHECK_LARGER_UNION_PASSING
+
+/* Variable args. */
+#define CHECK_VARARGS
+
+/* Check argument passing and returning for scalar types with sizeof = 16. */
+/* TODO: Implement these tests. Don't activate them for now. */
+#define CHECK_LARGE_SCALAR_PASSING
+
+/* Defines for sizing and alignment. */
+
+#define TYPE_SIZE_CHAR 1
+#define TYPE_SIZE_SHORT 2
+#define TYPE_SIZE_INT 4
+#ifdef __ILP32__
+# define TYPE_SIZE_LONG 4
+#else
+# define TYPE_SIZE_LONG 8
+#endif
+#define TYPE_SIZE_LONG_LONG 8
+#define TYPE_SIZE_INT128 16
+#define TYPE_SIZE_BF16 2
+#define TYPE_SIZE_FLOAT 4
+#define TYPE_SIZE_DOUBLE 8
+#define TYPE_SIZE_LONG_DOUBLE 16
+#define TYPE_SIZE_FLOAT128 16
+#define TYPE_SIZE_M64 8
+#define TYPE_SIZE_M128 16
+#define TYPE_SIZE_ENUM 4
+#ifdef __ILP32__
+# define TYPE_SIZE_POINTER 4
+#else
+# define TYPE_SIZE_POINTER 8
+#endif
+
+#define TYPE_ALIGN_CHAR 1
+#define TYPE_ALIGN_SHORT 2
+#define TYPE_ALIGN_INT 4
+#ifdef __ILP32__
+# define TYPE_ALIGN_LONG 4
+#else
+# define TYPE_ALIGN_LONG 8
+#endif
+#define TYPE_ALIGN_LONG_LONG 8
+#define TYPE_ALIGN_INT128 16
+#define TYPE_ALIGN_BF16 2
+#define TYPE_ALIGN_FLOAT 4
+#define TYPE_ALIGN_DOUBLE 8
+#define TYPE_ALIGN_LONG_DOUBLE 16
+#define TYPE_ALIGN_FLOAT128 16
+#define TYPE_ALIGN_M64 8
+#define TYPE_ALIGN_M128 16
+#define TYPE_ALIGN_ENUM 4
+#ifdef __ILP32__
+# define TYPE_ALIGN_POINTER 4
+#else
+# define TYPE_ALIGN_POINTER 8
+#endif
+
+/* These defines control the building of the list of types to check. There
+ is a string identifying the type (with a comma after), a size of the type
+ (also with a comma and an integer for adding to the total amount of types)
+ and an alignment of the type (which is currently not really needed since
+ the abi specifies that alignof == sizeof for all scalar types). */
+#ifdef CHECK_INT128
+#define CI128_STR "__int128",
+#define CI128_SIZ TYPE_SIZE_INT128,
+#define CI128_ALI TYPE_ALIGN_INT128,
+#define CI128_RET "???",
+#else
+#define CI128_STR
+#define CI128_SIZ
+#define CI128_ALI
+#define CI128_RET
+#endif
+#ifdef CHECK_LONG_DOUBLE
+#define CLD_STR "long double",
+#define CLD_SIZ TYPE_SIZE_LONG_DOUBLE,
+#define CLD_ALI TYPE_ALIGN_LONG_DOUBLE,
+#define CLD_RET "x87_regs[0]._ldouble",
+#else
+#define CLD_STR
+#define CLD_SIZ
+#define CLD_ALI
+#define CLD_RET
+#endif
+#ifdef CHECK_FLOAT128
+#define CF128_STR "__float128",
+#define CF128_SIZ TYPE_SIZE_FLOAT128,
+#define CF128_ALI TYPE_ALIGN_FLOAT128,
+#define CF128_RET "???",
+#else
+#define CF128_STR
+#define CF128_SIZ
+#define CF128_ALI
+#define CF128_RET
+#endif
+#ifdef CHECK_M64_M128
+#define CMM_STR "__m64", "__m128",
+#define CMM_SIZ TYPE_SIZE_M64, TYPE_SIZE_M128,
+#define CMM_ALI TYPE_ALIGN_M64, TYPE_ALIGN_M128,
+#define CMM_RET "???", "???",
+#else
+#define CMM_STR
+#define CMM_SIZ
+#define CMM_ALI
+#define CMM_RET
+#endif
+
+/* Used in size and alignment tests. */
+enum dummytype { enumtype };
+
+extern void abort (void);
+
+/* Assertion macro. */
+#define assert(test) if (!(test)) abort()
+
+#ifdef __GNUC__
+#define ATTRIBUTE_UNUSED __attribute__((__unused__))
+#else
+#define ATTRIBUTE_UNUSED
+#endif
+
+#ifdef __GNUC__
+#define PACKED __attribute__((__packed__))
+#else
+#warning Some tests will fail due to missing __packed__ support
+#define PACKED
+#endif
+
+#endif /* DEFINED_DEFINES_H */
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/abi-bf16-ymm.exp b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/abi-bf16-ymm.exp
new file mode 100644
index 0000000..309db8f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/abi-bf16-ymm.exp
@@ -0,0 +1,46 @@
+# Copyright (C) 2022 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# The x86-64 ABI testsuite needs one additional assembler file for most
+# testcases. For simplicity we will just link it into each test.
+
+load_lib c-torture.exp
+load_lib target-supports.exp
+load_lib torture-options.exp
+load_lib clearcap.exp
+
+if { (![istarget x86_64-*-*] && ![istarget i?86-*-*])
+ || ![is-effective-target lp64]
+ || ![is-effective-target avx2] } then {
+ return
+}
+
+
+torture-init
+clearcap-init
+set-torture-options $C_TORTURE_OPTIONS
+set additional_flags "-W -Wall -mavx2"
+
+foreach src [lsort [glob -nocomplain $srcdir/$subdir/test_*.c]] {
+ if {[runtest_file_p $runtests $src]} {
+ c-torture-execute [list $src \
+ $srcdir/$subdir/asm-support.S] \
+ $additional_flags
+ }
+}
+
+clearcap-finish
+torture-finish
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/args.h b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/args.h
new file mode 100644
index 0000000..94627ff
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/args.h
@@ -0,0 +1,152 @@
+#ifndef INCLUDED_ARGS_H
+#define INCLUDED_ARGS_H
+
+#include <immintrin.h>
+#include <string.h>
+
+/* Assertion macro. */
+#define assert(test) if (!(test)) abort()
+
+#ifdef __GNUC__
+#define ATTRIBUTE_UNUSED __attribute__((__unused__))
+#else
+#define ATTRIBUTE_UNUSED
+#endif
+
+/* This defines the calling sequences for integers and floats. */
+#define I0 rdi
+#define I1 rsi
+#define I2 rdx
+#define I3 rcx
+#define I4 r8
+#define I5 r9
+#define F0 ymm0
+#define F1 ymm1
+#define F2 ymm2
+#define F3 ymm3
+#define F4 ymm4
+#define F5 ymm5
+#define F6 ymm6
+#define F7 ymm7
+
+typedef union {
+ __bf16 ___bf16[16];
+ float _float[8];
+ double _double[4];
+ long long _longlong[4];
+ int _int[8];
+ unsigned long long _ulonglong[4];
+ __m64 _m64[4];
+ __m128 _m128[2];
+ __m256 _m256[1];
+ __m256bf16 _m256bf16[1];
+} YMM_T;
+
+typedef union {
+ float _float;
+ double _double;
+ long double _ldouble;
+ unsigned long long _ulonglong[2];
+} X87_T;
+extern void (*callthis)(void);
+extern unsigned long long rax,rbx,rcx,rdx,rsi,rdi,rsp,rbp,r8,r9,r10,r11,r12,r13,r14,r15;
+YMM_T ymm_regs[16];
+X87_T x87_regs[8];
+extern volatile unsigned long long volatile_var;
+extern void snapshot (void);
+extern void snapshot_ret (void);
+#define WRAP_CALL(N) \
+ (callthis = (void (*)()) (N), (typeof (&N)) snapshot)
+#define WRAP_RET(N) \
+ (callthis = (void (*)()) (N), (typeof (&N)) snapshot_ret)
+
+/* Clear all integer registers. */
+#define clear_int_hardware_registers \
+ asm __volatile__ ("xor %%rax, %%rax\n\t" \
+ "xor %%rbx, %%rbx\n\t" \
+ "xor %%rcx, %%rcx\n\t" \
+ "xor %%rdx, %%rdx\n\t" \
+ "xor %%rsi, %%rsi\n\t" \
+ "xor %%rdi, %%rdi\n\t" \
+ "xor %%r8, %%r8\n\t" \
+ "xor %%r9, %%r9\n\t" \
+ "xor %%r10, %%r10\n\t" \
+ "xor %%r11, %%r11\n\t" \
+ "xor %%r12, %%r12\n\t" \
+ "xor %%r13, %%r13\n\t" \
+ "xor %%r14, %%r14\n\t" \
+ "xor %%r15, %%r15\n\t" \
+ ::: "rax", "rbx", "rcx", "rdx", "rsi", "rdi", "r8", \
+ "r9", "r10", "r11", "r12", "r13", "r14", "r15");
+
+/* This is the list of registers available for passing arguments. Not all of
+ these are used or even really available. */
+struct IntegerRegisters
+{
+ unsigned long long rax, rbx, rcx, rdx, rsi, rdi, r8, r9, r10, r11, r12, r13, r14, r15;
+};
+struct FloatRegisters
+{
+ double mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7;
+ long double st0, st1, st2, st3, st4, st5, st6, st7;
+ YMM_T ymm0, ymm1, ymm2, ymm3, ymm4, ymm5, ymm6, ymm7, ymm8, ymm9,
+ ymm10, ymm11, ymm12, ymm13, ymm14, ymm15;
+};
+
+/* Implemented in scalarargs.c */
+extern struct IntegerRegisters iregs;
+extern struct FloatRegisters fregs;
+extern unsigned int num_iregs, num_fregs;
+
+/* Clear register struct. */
+#define clear_struct_registers \
+ rax = rbx = rcx = rdx = rdi = rsi = rbp = rsp \
+ = r8 = r9 = r10 = r11 = r12 = r13 = r14 = r15 = 0; \
+ memset (&iregs, 0, sizeof (iregs)); \
+ memset (&fregs, 0, sizeof (fregs)); \
+ memset (ymm_regs, 0, sizeof (ymm_regs)); \
+ memset (x87_regs, 0, sizeof (x87_regs));
+
+/* Clear both hardware and register structs for integers. */
+#define clear_int_registers \
+ clear_struct_registers \
+ clear_int_hardware_registers
+
+#define check_vector_arguments(T,O) do { \
+ assert (num_fregs <= 0 \
+ || memcmp (((char *) &fregs.ymm0) + (O), \
+ &ymm_regs[0], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 1 \
+ || memcmp (((char *) &fregs.ymm1) + (O), \
+ &ymm_regs[1], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 2 \
+ || memcmp (((char *) &fregs.ymm2) + (O), \
+ &ymm_regs[2], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 3 \
+ || memcmp (((char *) &fregs.ymm3) + (O), \
+ &ymm_regs[3], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 4 \
+ || memcmp (((char *) &fregs.ymm4) + (O), \
+ &ymm_regs[4], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 5 \
+ || memcmp (((char *) &fregs.ymm5) + (O), \
+ &ymm_regs[5], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 6 \
+ || memcmp (((char *) &fregs.ymm6) + (O), \
+ &ymm_regs[6], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 7 \
+ || memcmp (((char *) &fregs.ymm7) + (O), \
+ &ymm_regs[7], \
+ sizeof (__ ## T) - (O)) == 0); \
+ } while (0)
+
+#define check_m256_arguments check_vector_arguments(m256, 0)
+
+#endif /* INCLUDED_ARGS_H */
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/asm-support.S b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/asm-support.S
new file mode 100644
index 0000000..24c8b3c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/asm-support.S
@@ -0,0 +1,84 @@
+ .text
+ .p2align 4,,15
+.globl snapshot
+ .type snapshot, @function
+snapshot:
+.LFB3:
+ movq %rax, rax(%rip)
+ movq %rbx, rbx(%rip)
+ movq %rcx, rcx(%rip)
+ movq %rdx, rdx(%rip)
+ movq %rdi, rdi(%rip)
+ movq %rsi, rsi(%rip)
+ movq %rbp, rbp(%rip)
+ movq %rsp, rsp(%rip)
+ movq %r8, r8(%rip)
+ movq %r9, r9(%rip)
+ movq %r10, r10(%rip)
+ movq %r11, r11(%rip)
+ movq %r12, r12(%rip)
+ movq %r13, r13(%rip)
+ movq %r14, r14(%rip)
+ movq %r15, r15(%rip)
+ vmovdqu %ymm0, ymm_regs+0(%rip)
+ vmovdqu %ymm1, ymm_regs+32(%rip)
+ vmovdqu %ymm2, ymm_regs+64(%rip)
+ vmovdqu %ymm3, ymm_regs+96(%rip)
+ vmovdqu %ymm4, ymm_regs+128(%rip)
+ vmovdqu %ymm5, ymm_regs+160(%rip)
+ vmovdqu %ymm6, ymm_regs+192(%rip)
+ vmovdqu %ymm7, ymm_regs+224(%rip)
+ vmovdqu %ymm8, ymm_regs+256(%rip)
+ vmovdqu %ymm9, ymm_regs+288(%rip)
+ vmovdqu %ymm10, ymm_regs+320(%rip)
+ vmovdqu %ymm11, ymm_regs+352(%rip)
+ vmovdqu %ymm12, ymm_regs+384(%rip)
+ vmovdqu %ymm13, ymm_regs+416(%rip)
+ vmovdqu %ymm14, ymm_regs+448(%rip)
+ vmovdqu %ymm15, ymm_regs+480(%rip)
+ jmp *callthis(%rip)
+.LFE3:
+ .size snapshot, .-snapshot
+
+ .p2align 4,,15
+.globl snapshot_ret
+ .type snapshot_ret, @function
+snapshot_ret:
+ movq %rdi, rdi(%rip)
+ subq $8, %rsp
+ call *callthis(%rip)
+ addq $8, %rsp
+ movq %rax, rax(%rip)
+ movq %rdx, rdx(%rip)
+ vmovdqu %ymm0, ymm_regs+0(%rip)
+ vmovdqu %ymm1, ymm_regs+32(%rip)
+ fstpt x87_regs(%rip)
+ fstpt x87_regs+16(%rip)
+ fldt x87_regs+16(%rip)
+ fldt x87_regs(%rip)
+ ret
+ .size snapshot_ret, .-snapshot_ret
+
+ .comm callthis,8,8
+ .comm rax,8,8
+ .comm rbx,8,8
+ .comm rcx,8,8
+ .comm rdx,8,8
+ .comm rsi,8,8
+ .comm rdi,8,8
+ .comm rsp,8,8
+ .comm rbp,8,8
+ .comm r8,8,8
+ .comm r9,8,8
+ .comm r10,8,8
+ .comm r11,8,8
+ .comm r12,8,8
+ .comm r13,8,8
+ .comm r14,8,8
+ .comm r15,8,8
+ .comm ymm_regs,512,32
+ .comm x87_regs,128,32
+ .comm volatile_var,8,8
+#ifdef __linux__
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/bf16-ymm-check.h b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/bf16-ymm-check.h
new file mode 100644
index 0000000..479ebc3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/bf16-ymm-check.h
@@ -0,0 +1,24 @@
+#include <stdlib.h>
+#include "../bf16-helper.h"
+
+static void do_test (void);
+
+int
+main ()
+{
+
+ if (__builtin_cpu_supports ("avx2"))
+ {
+ do_test ();
+#ifdef DEBUG
+ printf ("PASSED\n");
+#endif
+ return 0;
+ }
+
+#ifdef DEBUG
+ printf ("SKIPPED\n");
+#endif
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/test_m256_returning.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/test_m256_returning.c
new file mode 100644
index 0000000..ea75128
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/test_m256_returning.c
@@ -0,0 +1,38 @@
+#include <stdio.h>
+#include "bf16-ymm-check.h"
+#include "args.h"
+
+struct FloatRegisters fregs;
+struct IntegerRegisters iregs;
+unsigned int num_fregs, num_iregs;
+
+volatile __bf16 bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16;
+
+__m256bf16
+fun_test_returning___m256bf16 (void)
+{
+ volatile_var++;
+ return (__m256bf16) { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16};
+}
+
+__m256bf16 test_256bf16;
+
+static void
+do_test (void)
+{
+ unsigned failed = 0;
+ YMM_T ymmt1, ymmt2;
+
+ clear_struct_registers;
+ test_256bf16 = (__m256bf16) { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16};
+ ymmt1._m256bf16[0] = test_256bf16;
+ ymmt2._m256bf16[0] = WRAP_RET (fun_test_returning___m256bf16) ();
+ if (memcmp (&ymmt1, &ymmt2, sizeof (ymmt2)) != 0)
+ printf ("fail m256bf16\n"), failed++;
+
+ if (failed)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/test_passing_m256.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/test_passing_m256.c
new file mode 100644
index 0000000..3fb2d7d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/test_passing_m256.c
@@ -0,0 +1,235 @@
+#include <stdio.h>
+#include "bf16-ymm-check.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+/* This struct holds values for argument checking. */
+struct
+{
+ YMM_T i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15,
+ i16, i17, i18, i19, i20, i21, i22, i23;
+} values;
+
+char *pass;
+int failed = 0;
+
+#undef assert
+#define assert(c) do { \
+ if (!(c)) {failed++; printf ("failed %s\n", pass); } \
+} while (0)
+
+#define compare(X1,X2,T) do { \
+ assert (memcmp (&X1, &X2, sizeof (T)) == 0); \
+} while (0)
+
+fun_check_passing_m256bf16_8_values (__m256bf16 i0 ATTRIBUTE_UNUSED,
+ __m256bf16 i1 ATTRIBUTE_UNUSED,
+ __m256bf16 i2 ATTRIBUTE_UNUSED,
+ __m256bf16 i3 ATTRIBUTE_UNUSED,
+ __m256bf16 i4 ATTRIBUTE_UNUSED,
+ __m256bf16 i5 ATTRIBUTE_UNUSED,
+ __m256bf16 i6 ATTRIBUTE_UNUSED,
+ __m256bf16 i7 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m256bf16);
+ compare (values.i1, i1, __m256bf16);
+ compare (values.i2, i2, __m256bf16);
+ compare (values.i3, i3, __m256bf16);
+ compare (values.i4, i4, __m256bf16);
+ compare (values.i5, i5, __m256bf16);
+ compare (values.i6, i6, __m256bf16);
+ compare (values.i7, i7, __m256bf16);
+}
+
+void
+fun_check_passing_m256bf16_8_regs (__m256bf16 i0 ATTRIBUTE_UNUSED,
+ __m256bf16 i1 ATTRIBUTE_UNUSED,
+ __m256bf16 i2 ATTRIBUTE_UNUSED,
+ __m256bf16 i3 ATTRIBUTE_UNUSED,
+ __m256bf16 i4 ATTRIBUTE_UNUSED,
+ __m256bf16 i5 ATTRIBUTE_UNUSED,
+ __m256bf16 i6 ATTRIBUTE_UNUSED,
+ __m256bf16 i7 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m256_arguments;
+}
+
+void
+fun_check_passing_m256bf16_20_values (__m256bf16 i0 ATTRIBUTE_UNUSED,
+ __m256bf16 i1 ATTRIBUTE_UNUSED,
+ __m256bf16 i2 ATTRIBUTE_UNUSED,
+ __m256bf16 i3 ATTRIBUTE_UNUSED,
+ __m256bf16 i4 ATTRIBUTE_UNUSED,
+ __m256bf16 i5 ATTRIBUTE_UNUSED,
+ __m256bf16 i6 ATTRIBUTE_UNUSED,
+ __m256bf16 i7 ATTRIBUTE_UNUSED,
+ __m256bf16 i8 ATTRIBUTE_UNUSED,
+ __m256bf16 i9 ATTRIBUTE_UNUSED,
+ __m256bf16 i10 ATTRIBUTE_UNUSED,
+ __m256bf16 i11 ATTRIBUTE_UNUSED,
+ __m256bf16 i12 ATTRIBUTE_UNUSED,
+ __m256bf16 i13 ATTRIBUTE_UNUSED,
+ __m256bf16 i14 ATTRIBUTE_UNUSED,
+ __m256bf16 i15 ATTRIBUTE_UNUSED,
+ __m256bf16 i16 ATTRIBUTE_UNUSED,
+ __m256bf16 i17 ATTRIBUTE_UNUSED,
+ __m256bf16 i18 ATTRIBUTE_UNUSED,
+ __m256bf16 i19 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m256bf16);
+ compare (values.i1, i1, __m256bf16);
+ compare (values.i2, i2, __m256bf16);
+ compare (values.i3, i3, __m256bf16);
+ compare (values.i4, i4, __m256bf16);
+ compare (values.i5, i5, __m256bf16);
+ compare (values.i6, i6, __m256bf16);
+ compare (values.i7, i7, __m256bf16);
+ compare (values.i8, i8, __m256bf16);
+ compare (values.i9, i9, __m256bf16);
+ compare (values.i10, i10, __m256bf16);
+ compare (values.i11, i11, __m256bf16);
+ compare (values.i12, i12, __m256bf16);
+ compare (values.i13, i13, __m256bf16);
+ compare (values.i14, i14, __m256bf16);
+ compare (values.i15, i15, __m256bf16);
+ compare (values.i16, i16, __m256bf16);
+ compare (values.i17, i17, __m256bf16);
+ compare (values.i18, i18, __m256bf16);
+ compare (values.i19, i19, __m256bf16);
+}
+
+void
+fun_check_passing_m256bf16_20_regs (__m256bf16 i0 ATTRIBUTE_UNUSED,
+ __m256bf16 i1 ATTRIBUTE_UNUSED,
+ __m256bf16 i2 ATTRIBUTE_UNUSED,
+ __m256bf16 i3 ATTRIBUTE_UNUSED,
+ __m256bf16 i4 ATTRIBUTE_UNUSED,
+ __m256bf16 i5 ATTRIBUTE_UNUSED,
+ __m256bf16 i6 ATTRIBUTE_UNUSED,
+ __m256bf16 i7 ATTRIBUTE_UNUSED,
+ __m256bf16 i8 ATTRIBUTE_UNUSED,
+ __m256bf16 i9 ATTRIBUTE_UNUSED,
+ __m256bf16 i10 ATTRIBUTE_UNUSED,
+ __m256bf16 i11 ATTRIBUTE_UNUSED,
+ __m256bf16 i12 ATTRIBUTE_UNUSED,
+ __m256bf16 i13 ATTRIBUTE_UNUSED,
+ __m256bf16 i14 ATTRIBUTE_UNUSED,
+ __m256bf16 i15 ATTRIBUTE_UNUSED,
+ __m256bf16 i16 ATTRIBUTE_UNUSED,
+ __m256bf16 i17 ATTRIBUTE_UNUSED,
+ __m256bf16 i18 ATTRIBUTE_UNUSED,
+ __m256bf16 i19 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m256_arguments;
+}
+
+#define def_check_passing8(_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _func1, _func2, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ WRAP_CALL(_func1) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7); \
+ clear_struct_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ fregs.F4.TYPE[0] = _i4; \
+ fregs.F5.TYPE[0] = _i5; \
+ fregs.F6.TYPE[0] = _i6; \
+ fregs.F7.TYPE[0] = _i7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7);
+
+#define def_check_passing20(_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
+ _i8, _i9, _i10, _i11, _i12, _i13, _i14, \
+ _i15, _i16, _i17, _i18, _i19, _func1, \
+ _func2, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ values.i8.TYPE[0] = _i8; \
+ values.i9.TYPE[0] = _i9; \
+ values.i10.TYPE[0] = _i10; \
+ values.i11.TYPE[0] = _i11; \
+ values.i12.TYPE[0] = _i12; \
+ values.i13.TYPE[0] = _i13; \
+ values.i14.TYPE[0] = _i14; \
+ values.i15.TYPE[0] = _i15; \
+ values.i16.TYPE[0] = _i16; \
+ values.i17.TYPE[0] = _i17; \
+ values.i18.TYPE[0] = _i18; \
+ values.i19.TYPE[0] = _i19; \
+ WRAP_CALL(_func1) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
+ _i9, _i10, _i11, _i12, _i13, _i14, _i15, \
+ _i16, _i17, _i18, _i19); \
+ clear_struct_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ fregs.F4.TYPE[0] = _i4; \
+ fregs.F5.TYPE[0] = _i5; \
+ fregs.F6.TYPE[0] = _i6; \
+ fregs.F7.TYPE[0] = _i7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
+ _i9, _i10, _i11, _i12, _i13, _i14, _i15, \
+ _i16, _i17, _i18, _i19);
+
+volatile __bf16 bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16;
+
+void
+test_m256bf16_on_stack ()
+{
+ __m256bf16 x[8];
+ int i;
+ for (i = 0; i < 8; i++)
+ x[i] = (__m256bf16) { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16};
+ pass = "m256bf16-8";
+ def_check_passing8 (x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7],
+ fun_check_passing_m256bf16_8_values,
+ fun_check_passing_m256bf16_8_regs, _m256bf16);
+}
+
+void
+test_too_many_m256bf16 ()
+{
+ __m256bf16 x[20];
+ int i;
+ for (i = 0; i < 20; i++)
+ x[i] = (__m256bf16) { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16};
+ pass = "m256bf16-20";
+ def_check_passing20 (x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8],
+ x[9], x[10], x[11], x[12], x[13], x[14], x[15], x[16],
+ x[17], x[18], x[19], fun_check_passing_m256bf16_20_values,
+ fun_check_passing_m256bf16_20_regs, _m256bf16);
+}
+
+static void
+do_test (void)
+{
+ test_m256bf16_on_stack ();
+ test_too_many_m256bf16 ();
+ if (failed)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/test_passing_structs.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/test_passing_structs.c
new file mode 100644
index 0000000..e06350e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/test_passing_structs.c
@@ -0,0 +1,69 @@
+#include "bf16-ymm-check.h"
+#include "args.h"
+
+struct FloatRegisters fregs;
+struct IntegerRegisters iregs;
+unsigned int num_fregs, num_iregs;
+
+struct m256bf16_struct
+{
+ __m256bf16 x;
+};
+
+struct m256bf16_2_struct
+{
+ __m256bf16 x1, x2;
+};
+
+/* Check that the struct is passed as the individual members in fregs. */
+void
+check_struct_passing1bf16 (struct m256bf16_struct ms1 ATTRIBUTE_UNUSED,
+ struct m256bf16_struct ms2 ATTRIBUTE_UNUSED,
+ struct m256bf16_struct ms3 ATTRIBUTE_UNUSED,
+ struct m256bf16_struct ms4 ATTRIBUTE_UNUSED,
+ struct m256bf16_struct ms5 ATTRIBUTE_UNUSED,
+ struct m256bf16_struct ms6 ATTRIBUTE_UNUSED,
+ struct m256bf16_struct ms7 ATTRIBUTE_UNUSED,
+ struct m256bf16_struct ms8 ATTRIBUTE_UNUSED)
+{
+ check_m256_arguments;
+}
+
+void
+check_struct_passing2bf16 (struct m256bf16_2_struct ms ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&ms.x1 == rsp+8);
+ assert ((unsigned long)&ms.x2 == rsp+40);
+}
+
+volatile __bf16 bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16;
+
+static void
+do_test (void)
+{
+ struct m256bf16_struct m256bf16s [8];
+ struct m256bf16_2_struct m256bf16_2s = {
+ { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16},
+ { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16},
+ };
+ int i;
+
+ for (i = 0; i < 8; i++)
+ {
+ m256bf16s[i].x = (__m256bf16) { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16};
+ }
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ (&fregs.ymm0)[i]._m256bf16[0] = m256bf16s[i].x;
+ num_fregs = 8;
+ WRAP_CALL (check_struct_passing1bf16) (m256bf16s[0], m256bf16s[1], m256bf16s[2], m256bf16s[3],
+ m256bf16s[4], m256bf16s[5], m256bf16s[6], m256bf16s[7]);
+ WRAP_CALL (check_struct_passing2bf16) (m256bf16_2s);
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/test_passing_unions.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/test_passing_unions.c
new file mode 100644
index 0000000..6d663b8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/test_passing_unions.c
@@ -0,0 +1,179 @@
+#include "bf16-ymm-check.h"
+#include "args.h"
+
+struct FloatRegisters fregs;
+struct IntegerRegisters iregs;
+unsigned int num_fregs, num_iregs;
+
+union un1b
+{
+ __m256bf16 x;
+ float f;
+};
+
+union un1bb
+{
+ __m256bf16 x;
+ __bf16 f;
+};
+
+union un2b
+{
+ __m256bf16 x;
+ double d;
+};
+
+union un3b
+{
+ __m256bf16 x;
+ __m128 v;
+};
+
+union un4b
+{
+ __m256bf16 x;
+ long double ld;
+};
+
+union un5b
+{
+ __m256bf16 x;
+ int i;
+};
+
+void
+check_union_passing1b (union un1b u1 ATTRIBUTE_UNUSED,
+ union un1b u2 ATTRIBUTE_UNUSED,
+ union un1b u3 ATTRIBUTE_UNUSED,
+ union un1b u4 ATTRIBUTE_UNUSED,
+ union un1b u5 ATTRIBUTE_UNUSED,
+ union un1b u6 ATTRIBUTE_UNUSED,
+ union un1b u7 ATTRIBUTE_UNUSED,
+ union un1b u8 ATTRIBUTE_UNUSED)
+{
+ check_m256_arguments;
+}
+
+void
+check_union_passing1bb (union un1bb u1 ATTRIBUTE_UNUSED,
+ union un1bb u2 ATTRIBUTE_UNUSED,
+ union un1bb u3 ATTRIBUTE_UNUSED,
+ union un1bb u4 ATTRIBUTE_UNUSED,
+ union un1bb u5 ATTRIBUTE_UNUSED,
+ union un1bb u6 ATTRIBUTE_UNUSED,
+ union un1bb u7 ATTRIBUTE_UNUSED,
+ union un1bb u8 ATTRIBUTE_UNUSED)
+{
+ check_m256_arguments;
+}
+
+void
+check_union_passing2b (union un2b u1 ATTRIBUTE_UNUSED,
+ union un2b u2 ATTRIBUTE_UNUSED,
+ union un2b u3 ATTRIBUTE_UNUSED,
+ union un2b u4 ATTRIBUTE_UNUSED,
+ union un2b u5 ATTRIBUTE_UNUSED,
+ union un2b u6 ATTRIBUTE_UNUSED,
+ union un2b u7 ATTRIBUTE_UNUSED,
+ union un2b u8 ATTRIBUTE_UNUSED)
+{
+ check_m256_arguments;
+}
+
+void
+check_union_passing3b (union un3b u1 ATTRIBUTE_UNUSED,
+ union un3b u2 ATTRIBUTE_UNUSED,
+ union un3b u3 ATTRIBUTE_UNUSED,
+ union un3b u4 ATTRIBUTE_UNUSED,
+ union un3b u5 ATTRIBUTE_UNUSED,
+ union un3b u6 ATTRIBUTE_UNUSED,
+ union un3b u7 ATTRIBUTE_UNUSED,
+ union un3b u8 ATTRIBUTE_UNUSED)
+{
+ check_m256_arguments;
+}
+
+void
+check_union_passing4b (union un4b u ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&u.x == rsp+8);
+ assert ((unsigned long)&u.ld == rsp+8);
+}
+
+void
+check_union_passing5b (union un5b u ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&u.x == rsp+8);
+ assert ((unsigned long)&u.i == rsp+8);
+}
+
+#define check_union_passing1b WRAP_CALL(check_union_passing1b)
+#define check_union_passing1bb WRAP_CALL(check_union_passing1bb)
+#define check_union_passing2b WRAP_CALL(check_union_passing2b)
+#define check_union_passing3b WRAP_CALL(check_union_passing3b)
+#define check_union_passing4b WRAP_CALL(check_union_passing4b)
+#define check_union_passing5b WRAP_CALL(check_union_passing5b)
+
+static void
+do_test (void)
+{
+ union un1b u1b[8];
+ union un1bb u1bb[8];
+ union un2b u2b[8];
+ union un3b u3b[8];
+ union un4b u4b;
+ union un5b u5b;
+ int i;
+ __bf16 bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16;
+
+ for (i = 0; i < 8; i++)
+ {
+ u1b[i].x = (__m256bf16) { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16 };
+ }
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ (&fregs.ymm0)[i]._m256bf16[0] = u1b[i].x;
+ num_fregs = 8;
+ check_union_passing1b (u1b[0], u1b[1], u1b[2], u1b[3],
+ u1b[4], u1b[5], u1b[6], u1b[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u1bb[i].x = u1b[i].x;
+ (&fregs.ymm0)[i]._m256bf16[0] = u1bb[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing1bb (u1bb[0], u1bb[1], u1bb[2], u1bb[3],
+ u1bb[4], u1bb[5], u1bb[6], u1bb[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u2b[i].x = u1b[i].x;
+ (&fregs.ymm0)[i]._m256bf16[0] = u2b[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing2b (u2b[0], u2b[1], u2b[2], u2b[3],
+ u2b[4], u2b[5], u2b[6], u2b[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u3b[i].x = u1b[i].x;
+ (&fregs.ymm0)[i]._m256bf16[0] = u3b[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing3b (u3b[0], u3b[1], u3b[2], u3b[3],
+ u3b[4], u3b[5], u3b[6], u3b[7]);
+
+ check_union_passing4b (u4b);
+ check_union_passing5b (u5b);
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/test_varargs-m256.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/test_varargs-m256.c
new file mode 100644
index 0000000..b69e095
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m256bf16/test_varargs-m256.c
@@ -0,0 +1,107 @@
+/* Test variable number of 256-bit vector arguments passed to functions. */
+
+#include <stdio.h>
+#include "bf16-ymm-check.h"
+#include "args.h"
+
+struct FloatRegisters fregs;
+struct IntegerRegisters iregs;
+
+/* This struct holds values for argument checking. */
+struct
+{
+ YMM_T i0, i1, i2, i3, i4, i5, i6, i7, i8, i9;
+} values;
+
+char *pass;
+int failed = 0;
+
+#undef assert
+#define assert(c) do { \
+ if (!(c)) {failed++; printf ("failed %s\n", pass); } \
+} while (0)
+
+#define compare(X1,X2,T) do { \
+ assert (memcmp (&X1, &X2, sizeof (T)) == 0); \
+} while (0)
+
+void
+fun_check_passing_m256bf16_varargs (__m256bf16 i0, __m256bf16 i1, __m256bf16 i2,
+ __m256bf16 i3, ...)
+{
+ /* Check argument values. */
+ void **fp = __builtin_frame_address (0);
+ void *ra = __builtin_return_address (0);
+ __m256bf16 *argp;
+
+ compare (values.i0, i0, __m256bf16);
+ compare (values.i1, i1, __m256bf16);
+ compare (values.i2, i2, __m256bf16);
+ compare (values.i3, i3, __m256bf16);
+
+ /* Get the pointer to the return address on stack. */
+ while (*fp != ra)
+ fp++;
+
+ /* Skip the return address stack slot. */
+ argp = (__m256bf16 *)(((char *) fp) + 8);
+
+ /* Check __m256bf16 arguments passed on stack. */
+ compare (values.i4, argp[0], __m256bf16);
+ compare (values.i5, argp[1], __m256bf16);
+ compare (values.i6, argp[2], __m256bf16);
+ compare (values.i7, argp[3], __m256bf16);
+ compare (values.i8, argp[4], __m256bf16);
+ compare (values.i9, argp[5], __m256bf16);
+
+ /* Check register contents. */
+ compare (fregs.ymm0, ymm_regs[0], __m256bf16);
+ compare (fregs.ymm1, ymm_regs[1], __m256bf16);
+ compare (fregs.ymm2, ymm_regs[2], __m256bf16);
+ compare (fregs.ymm3, ymm_regs[3], __m256bf16);
+}
+
+#define def_check_int_passing_varargs(_i0, _i1, _i2, _i3, _i4, _i5, \
+ _i6, _i7, _i8, _i9, \
+ _func, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ values.i8.TYPE[0] = _i8; \
+ values.i9.TYPE[0] = _i9; \
+ clear_struct_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ WRAP_CALL(_func) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9);
+
+void
+test_m256bf16_varargs (void)
+{
+ __m256bf16 x[10];
+ int i;
+ __bf16 bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16;
+ for (i = 0; i < 10; i++)
+ x[i] = (__m256bf16) { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16 };
+ pass = "m256bf16-varargs";
+ def_check_int_passing_varargs (x[0], x[1], x[2], x[3], x[4], x[5],
+ x[6], x[7], x[8], x[9],
+ fun_check_passing_m256bf16_varargs,
+ _m256bf16);
+}
+
+void
+do_test (void)
+{
+ test_m256bf16_varargs ();
+ if (failed)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/abi-bf16-zmm.exp b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/abi-bf16-zmm.exp
new file mode 100644
index 0000000..b6e0fed
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/abi-bf16-zmm.exp
@@ -0,0 +1,46 @@
+# Copyright (C) 2022 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# The x86-64 ABI testsuite needs one additional assembler file for most
+# testcases. For simplicity we will just link it into each test.
+
+load_lib c-torture.exp
+load_lib target-supports.exp
+load_lib torture-options.exp
+load_lib clearcap.exp
+
+if { (![istarget x86_64-*-*] && ![istarget i?86-*-*])
+ || ![is-effective-target lp64]
+ || ![is-effective-target avx512f] } then {
+ return
+}
+
+
+torture-init
+clearcap-init
+set-torture-options $C_TORTURE_OPTIONS
+set additional_flags "-W -Wall -mavx512f"
+
+foreach src [lsort [glob -nocomplain $srcdir/$subdir/test_*.c]] {
+ if {[runtest_file_p $runtests $src]} {
+ c-torture-execute [list $src \
+ $srcdir/$subdir/asm-support.S] \
+ $additional_flags
+ }
+}
+
+clearcap-finish
+torture-finish
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/args.h b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/args.h
new file mode 100644
index 0000000..64b2478
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/args.h
@@ -0,0 +1,155 @@
+#ifndef INCLUDED_ARGS_H
+#define INCLUDED_ARGS_H
+
+#include <immintrin.h>
+#include <string.h>
+
+/* Assertion macro. */
+#define assert(test) if (!(test)) abort()
+
+#ifdef __GNUC__
+#define ATTRIBUTE_UNUSED __attribute__((__unused__))
+#else
+#define ATTRIBUTE_UNUSED
+#endif
+
+/* This defines the calling sequences for integers and floats. */
+#define I0 rdi
+#define I1 rsi
+#define I2 rdx
+#define I3 rcx
+#define I4 r8
+#define I5 r9
+#define F0 zmm0
+#define F1 zmm1
+#define F2 zmm2
+#define F3 zmm3
+#define F4 zmm4
+#define F5 zmm5
+#define F6 zmm6
+#define F7 zmm7
+
+typedef union {
+ __bf16 ___bf16[32];
+ float _float[16];
+ double _double[8];
+ long long _longlong[8];
+ int _int[16];
+ unsigned long long _ulonglong[8];
+ __m64 _m64[8];
+ __m128 _m128[4];
+ __m256 _m256[2];
+ __m512 _m512[1];
+ __m512bf16 _m512bf16[1];
+} ZMM_T;
+
+typedef union {
+ float _float;
+ double _double;
+ long double _ldouble;
+ unsigned long long _ulonglong[2];
+} X87_T;
+extern void (*callthis)(void);
+extern unsigned long long rax,rbx,rcx,rdx,rsi,rdi,rsp,rbp,r8,r9,r10,r11,r12,r13,r14,r15;
+ZMM_T zmm_regs[32];
+X87_T x87_regs[8];
+extern volatile unsigned long long volatile_var;
+extern void snapshot (void);
+extern void snapshot_ret (void);
+#define WRAP_CALL(N) \
+ (callthis = (void (*)()) (N), (typeof (&N)) snapshot)
+#define WRAP_RET(N) \
+ (callthis = (void (*)()) (N), (typeof (&N)) snapshot_ret)
+
+/* Clear all integer registers. */
+#define clear_int_hardware_registers \
+ asm __volatile__ ("xor %%rax, %%rax\n\t" \
+ "xor %%rbx, %%rbx\n\t" \
+ "xor %%rcx, %%rcx\n\t" \
+ "xor %%rdx, %%rdx\n\t" \
+ "xor %%rsi, %%rsi\n\t" \
+ "xor %%rdi, %%rdi\n\t" \
+ "xor %%r8, %%r8\n\t" \
+ "xor %%r9, %%r9\n\t" \
+ "xor %%r10, %%r10\n\t" \
+ "xor %%r11, %%r11\n\t" \
+ "xor %%r12, %%r12\n\t" \
+ "xor %%r13, %%r13\n\t" \
+ "xor %%r14, %%r14\n\t" \
+ "xor %%r15, %%r15\n\t" \
+ ::: "rax", "rbx", "rcx", "rdx", "rsi", "rdi", "r8", \
+ "r9", "r10", "r11", "r12", "r13", "r14", "r15");
+
+/* This is the list of registers available for passing arguments. Not all of
+ these are used or even really available. */
+struct IntegerRegisters
+{
+ unsigned long long rax, rbx, rcx, rdx, rsi, rdi, r8, r9, r10, r11, r12, r13, r14, r15;
+};
+struct FloatRegisters
+{
+ double mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7;
+ long double st0, st1, st2, st3, st4, st5, st6, st7;
+ ZMM_T zmm0, zmm1, zmm2, zmm3, zmm4, zmm5, zmm6, zmm7, zmm8, zmm9,
+ zmm10, zmm11, zmm12, zmm13, zmm14, zmm15, zmm16, zmm17, zmm18,
+ zmm19, zmm20, zmm21, zmm22, zmm23, zmm24, zmm25, zmm26, zmm27,
+ zmm28, zmm29, zmm30, zmm31;
+};
+
+/* Implemented in scalarargs.c */
+extern struct IntegerRegisters iregs;
+extern struct FloatRegisters fregs;
+extern unsigned int num_iregs, num_fregs;
+
+/* Clear register struct. */
+#define clear_struct_registers \
+ rax = rbx = rcx = rdx = rdi = rsi = rbp = rsp \
+ = r8 = r9 = r10 = r11 = r12 = r13 = r14 = r15 = 0; \
+ memset (&iregs, 0, sizeof (iregs)); \
+ memset (&fregs, 0, sizeof (fregs)); \
+ memset (zmm_regs, 0, sizeof (zmm_regs)); \
+ memset (x87_regs, 0, sizeof (x87_regs));
+
+/* Clear both hardware and register structs for integers. */
+#define clear_int_registers \
+ clear_struct_registers \
+ clear_int_hardware_registers
+
+#define check_vector_arguments(T,O) do { \
+ assert (num_fregs <= 0 \
+ || memcmp (((char *) &fregs.zmm0) + (O), \
+ &zmm_regs[0], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 1 \
+ || memcmp (((char *) &fregs.zmm1) + (O), \
+ &zmm_regs[1], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 2 \
+ || memcmp (((char *) &fregs.zmm2) + (O), \
+ &zmm_regs[2], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 3 \
+ || memcmp (((char *) &fregs.zmm3) + (O), \
+ &zmm_regs[3], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 4 \
+ || memcmp (((char *) &fregs.zmm4) + (O), \
+ &zmm_regs[4], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 5 \
+ || memcmp (((char *) &fregs.zmm5) + (O), \
+ &zmm_regs[5], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 6 \
+ || memcmp (((char *) &fregs.zmm6) + (O), \
+ &zmm_regs[6], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 7 \
+ || memcmp (((char *) &fregs.zmm7) + (O), \
+ &zmm_regs[7], \
+ sizeof (__ ## T) - (O)) == 0); \
+ } while (0)
+
+#define check_m512_arguments check_vector_arguments(m512, 0)
+
+#endif /* INCLUDED_ARGS_H */
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/asm-support.S b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/asm-support.S
new file mode 100644
index 0000000..86d54d1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/asm-support.S
@@ -0,0 +1,100 @@
+ .text
+ .p2align 4,,15
+.globl snapshot
+ .type snapshot, @function
+snapshot:
+.LFB3:
+ movq %rax, rax(%rip)
+ movq %rbx, rbx(%rip)
+ movq %rcx, rcx(%rip)
+ movq %rdx, rdx(%rip)
+ movq %rdi, rdi(%rip)
+ movq %rsi, rsi(%rip)
+ movq %rbp, rbp(%rip)
+ movq %rsp, rsp(%rip)
+ movq %r8, r8(%rip)
+ movq %r9, r9(%rip)
+ movq %r10, r10(%rip)
+ movq %r11, r11(%rip)
+ movq %r12, r12(%rip)
+ movq %r13, r13(%rip)
+ movq %r14, r14(%rip)
+ movq %r15, r15(%rip)
+ vmovdqu32 %zmm0, zmm_regs+0(%rip)
+ vmovdqu32 %zmm1, zmm_regs+64(%rip)
+ vmovdqu32 %zmm2, zmm_regs+128(%rip)
+ vmovdqu32 %zmm3, zmm_regs+192(%rip)
+ vmovdqu32 %zmm4, zmm_regs+256(%rip)
+ vmovdqu32 %zmm5, zmm_regs+320(%rip)
+ vmovdqu32 %zmm6, zmm_regs+384(%rip)
+ vmovdqu32 %zmm7, zmm_regs+448(%rip)
+ vmovdqu32 %zmm8, zmm_regs+512(%rip)
+ vmovdqu32 %zmm9, zmm_regs+576(%rip)
+ vmovdqu32 %zmm10, zmm_regs+640(%rip)
+ vmovdqu32 %zmm11, zmm_regs+704(%rip)
+ vmovdqu32 %zmm12, zmm_regs+768(%rip)
+ vmovdqu32 %zmm13, zmm_regs+832(%rip)
+ vmovdqu32 %zmm14, zmm_regs+896(%rip)
+ vmovdqu32 %zmm15, zmm_regs+960(%rip)
+ vmovdqu32 %zmm16, zmm_regs+1024(%rip)
+ vmovdqu32 %zmm17, zmm_regs+1088(%rip)
+ vmovdqu32 %zmm18, zmm_regs+1152(%rip)
+ vmovdqu32 %zmm19, zmm_regs+1216(%rip)
+ vmovdqu32 %zmm20, zmm_regs+1280(%rip)
+ vmovdqu32 %zmm21, zmm_regs+1344(%rip)
+ vmovdqu32 %zmm22, zmm_regs+1408(%rip)
+ vmovdqu32 %zmm23, zmm_regs+1472(%rip)
+ vmovdqu32 %zmm24, zmm_regs+1536(%rip)
+ vmovdqu32 %zmm25, zmm_regs+1600(%rip)
+ vmovdqu32 %zmm26, zmm_regs+1664(%rip)
+ vmovdqu32 %zmm27, zmm_regs+1728(%rip)
+ vmovdqu32 %zmm28, zmm_regs+1792(%rip)
+ vmovdqu32 %zmm29, zmm_regs+1856(%rip)
+ vmovdqu32 %zmm30, zmm_regs+1920(%rip)
+ vmovdqu32 %zmm31, zmm_regs+1984(%rip)
+ jmp *callthis(%rip)
+.LFE3:
+ .size snapshot, .-snapshot
+
+ .p2align 4,,15
+.globl snapshot_ret
+ .type snapshot_ret, @function
+snapshot_ret:
+ movq %rdi, rdi(%rip)
+ subq $8, %rsp
+ call *callthis(%rip)
+ addq $8, %rsp
+ movq %rax, rax(%rip)
+ movq %rdx, rdx(%rip)
+ vmovdqu32 %zmm0, zmm_regs+0(%rip)
+ vmovdqu32 %zmm1, zmm_regs+64(%rip)
+ fstpt x87_regs(%rip)
+ fstpt x87_regs+16(%rip)
+ fldt x87_regs+16(%rip)
+ fldt x87_regs(%rip)
+ ret
+ .size snapshot_ret, .-snapshot_ret
+
+ .comm callthis,8,8
+ .comm rax,8,8
+ .comm rbx,8,8
+ .comm rcx,8,8
+ .comm rdx,8,8
+ .comm rsi,8,8
+ .comm rdi,8,8
+ .comm rsp,8,8
+ .comm rbp,8,8
+ .comm r8,8,8
+ .comm r9,8,8
+ .comm r10,8,8
+ .comm r11,8,8
+ .comm r12,8,8
+ .comm r13,8,8
+ .comm r14,8,8
+ .comm r15,8,8
+ .comm zmm_regs,2048,64
+ .comm x87_regs,128,32
+ .comm volatile_var,8,8
+#ifdef __linux__
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/bf16-zmm-check.h b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/bf16-zmm-check.h
new file mode 100644
index 0000000..9cd39b8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/bf16-zmm-check.h
@@ -0,0 +1,24 @@
+#include <stdlib.h>
+#include "../bf16-helper.h"
+
+static void do_test (void);
+
+int
+main ()
+{
+
+ if (__builtin_cpu_supports ("avx512f"))
+ {
+ do_test ();
+#ifdef DEBUG
+ printf ("PASSED\n");
+#endif
+ return 0;
+ }
+
+#ifdef DEBUG
+ printf ("SKIPPED\n");
+#endif
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/test_m512_returning.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/test_m512_returning.c
new file mode 100644
index 0000000..1a2500b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/test_m512_returning.c
@@ -0,0 +1,44 @@
+#include <stdio.h>
+#include "bf16-zmm-check.h"
+#include "args.h"
+
+struct FloatRegisters fregs;
+struct IntegerRegisters iregs;
+unsigned int num_fregs, num_iregs;
+
+volatile __bf16 bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16,
+ bf17,bf18,bf19,bf20,bf21,bf22,bf23,bf24,
+ bf25,bf26,bf27,bf28,bf29,bf30,bf31,bf32;
+
+__m512bf16
+fun_test_returning___m512bf16 (void)
+{
+ volatile_var++;
+ return (__m512bf16) { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16,
+ bf17,bf18,bf19,bf20,bf21,bf22,bf23,bf24,
+ bf25,bf26,bf27,bf28,bf29,bf30,bf31,bf32 };
+}
+
+__m512bf16 test_512bf16;
+
+static void
+do_test (void)
+{
+ unsigned failed = 0;
+ ZMM_T zmmt1, zmmt2;
+
+ clear_struct_registers;
+ test_512bf16 = (__m512bf16) { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16,
+ bf17,bf18,bf19,bf20,bf21,bf22,bf23,bf24,
+ bf25,bf26,bf27,bf28,bf29,bf30,bf31,bf32 };
+ zmmt1._m512bf16[0] = test_512bf16;
+ zmmt2._m512bf16[0] = WRAP_RET (fun_test_returning___m512bf16)();
+ if (memcmp (&zmmt1, &zmmt2, sizeof (zmmt2)) != 0)
+ printf ("fail m512bf16\n"), failed++;
+
+ if (failed)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/test_passing_m512.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/test_passing_m512.c
new file mode 100644
index 0000000..1c5c407
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/test_passing_m512.c
@@ -0,0 +1,243 @@
+#include <stdio.h>
+#include "bf16-zmm-check.h"
+#include "args.h"
+
+struct FloatRegisters fregs;
+struct IntegerRegisters iregs;
+unsigned int num_fregs, num_iregs;
+
+/* This struct holds values for argument checking. */
+struct
+{
+ ZMM_T i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15,
+ i16, i17, i18, i19, i20, i21, i22, i23;
+} values;
+
+char *pass;
+int failed = 0;
+
+#undef assert
+#define assert(c) do { \
+ if (!(c)) {failed++; printf ("failed %s\n", pass); } \
+} while (0)
+
+#define compare(X1,X2,T) do { \
+ assert (memcmp (&X1, &X2, sizeof (T)) == 0); \
+} while (0)
+
+fun_check_passing_m512bf16_8_values (__m512bf16 i0 ATTRIBUTE_UNUSED,
+ __m512bf16 i1 ATTRIBUTE_UNUSED,
+ __m512bf16 i2 ATTRIBUTE_UNUSED,
+ __m512bf16 i3 ATTRIBUTE_UNUSED,
+ __m512bf16 i4 ATTRIBUTE_UNUSED,
+ __m512bf16 i5 ATTRIBUTE_UNUSED,
+ __m512bf16 i6 ATTRIBUTE_UNUSED,
+ __m512bf16 i7 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m512bf16);
+ compare (values.i1, i1, __m512bf16);
+ compare (values.i2, i2, __m512bf16);
+ compare (values.i3, i3, __m512bf16);
+ compare (values.i4, i4, __m512bf16);
+ compare (values.i5, i5, __m512bf16);
+ compare (values.i6, i6, __m512bf16);
+ compare (values.i7, i7, __m512bf16);
+}
+
+void
+fun_check_passing_m512bf16_8_regs (__m512bf16 i0 ATTRIBUTE_UNUSED,
+ __m512bf16 i1 ATTRIBUTE_UNUSED,
+ __m512bf16 i2 ATTRIBUTE_UNUSED,
+ __m512bf16 i3 ATTRIBUTE_UNUSED,
+ __m512bf16 i4 ATTRIBUTE_UNUSED,
+ __m512bf16 i5 ATTRIBUTE_UNUSED,
+ __m512bf16 i6 ATTRIBUTE_UNUSED,
+ __m512bf16 i7 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+fun_check_passing_m512bf16_20_values (__m512bf16 i0 ATTRIBUTE_UNUSED,
+ __m512bf16 i1 ATTRIBUTE_UNUSED,
+ __m512bf16 i2 ATTRIBUTE_UNUSED,
+ __m512bf16 i3 ATTRIBUTE_UNUSED,
+ __m512bf16 i4 ATTRIBUTE_UNUSED,
+ __m512bf16 i5 ATTRIBUTE_UNUSED,
+ __m512bf16 i6 ATTRIBUTE_UNUSED,
+ __m512bf16 i7 ATTRIBUTE_UNUSED,
+ __m512bf16 i8 ATTRIBUTE_UNUSED,
+ __m512bf16 i9 ATTRIBUTE_UNUSED,
+ __m512bf16 i10 ATTRIBUTE_UNUSED,
+ __m512bf16 i11 ATTRIBUTE_UNUSED,
+ __m512bf16 i12 ATTRIBUTE_UNUSED,
+ __m512bf16 i13 ATTRIBUTE_UNUSED,
+ __m512bf16 i14 ATTRIBUTE_UNUSED,
+ __m512bf16 i15 ATTRIBUTE_UNUSED,
+ __m512bf16 i16 ATTRIBUTE_UNUSED,
+ __m512bf16 i17 ATTRIBUTE_UNUSED,
+ __m512bf16 i18 ATTRIBUTE_UNUSED,
+ __m512bf16 i19 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m512bf16);
+ compare (values.i1, i1, __m512bf16);
+ compare (values.i2, i2, __m512bf16);
+ compare (values.i3, i3, __m512bf16);
+ compare (values.i4, i4, __m512bf16);
+ compare (values.i5, i5, __m512bf16);
+ compare (values.i6, i6, __m512bf16);
+ compare (values.i7, i7, __m512bf16);
+ compare (values.i8, i8, __m512bf16);
+ compare (values.i9, i9, __m512bf16);
+ compare (values.i10, i10, __m512bf16);
+ compare (values.i11, i11, __m512bf16);
+ compare (values.i12, i12, __m512bf16);
+ compare (values.i13, i13, __m512bf16);
+ compare (values.i14, i14, __m512bf16);
+ compare (values.i15, i15, __m512bf16);
+ compare (values.i16, i16, __m512bf16);
+ compare (values.i17, i17, __m512bf16);
+ compare (values.i18, i18, __m512bf16);
+ compare (values.i19, i19, __m512bf16);
+}
+
+void
+fun_check_passing_m512bf16_20_regs (__m512bf16 i0 ATTRIBUTE_UNUSED,
+ __m512bf16 i1 ATTRIBUTE_UNUSED,
+ __m512bf16 i2 ATTRIBUTE_UNUSED,
+ __m512bf16 i3 ATTRIBUTE_UNUSED,
+ __m512bf16 i4 ATTRIBUTE_UNUSED,
+ __m512bf16 i5 ATTRIBUTE_UNUSED,
+ __m512bf16 i6 ATTRIBUTE_UNUSED,
+ __m512bf16 i7 ATTRIBUTE_UNUSED,
+ __m512bf16 i8 ATTRIBUTE_UNUSED,
+ __m512bf16 i9 ATTRIBUTE_UNUSED,
+ __m512bf16 i10 ATTRIBUTE_UNUSED,
+ __m512bf16 i11 ATTRIBUTE_UNUSED,
+ __m512bf16 i12 ATTRIBUTE_UNUSED,
+ __m512bf16 i13 ATTRIBUTE_UNUSED,
+ __m512bf16 i14 ATTRIBUTE_UNUSED,
+ __m512bf16 i15 ATTRIBUTE_UNUSED,
+ __m512bf16 i16 ATTRIBUTE_UNUSED,
+ __m512bf16 i17 ATTRIBUTE_UNUSED,
+ __m512bf16 i18 ATTRIBUTE_UNUSED,
+ __m512bf16 i19 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+#define def_check_passing8(_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _func1, _func2, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ WRAP_CALL(_func1) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7); \
+ \
+ clear_struct_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ fregs.F4.TYPE[0] = _i4; \
+ fregs.F5.TYPE[0] = _i5; \
+ fregs.F6.TYPE[0] = _i6; \
+ fregs.F7.TYPE[0] = _i7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7);
+
+#define def_check_passing20(_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9, \
+ _i10, _i11, _i12, _i13, _i14, _i15, _i16, _i17, \
+ _i18, _i19, _func1, _func2, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ values.i8.TYPE[0] = _i8; \
+ values.i9.TYPE[0] = _i9; \
+ values.i10.TYPE[0] = _i10; \
+ values.i11.TYPE[0] = _i11; \
+ values.i12.TYPE[0] = _i12; \
+ values.i13.TYPE[0] = _i13; \
+ values.i14.TYPE[0] = _i14; \
+ values.i15.TYPE[0] = _i15; \
+ values.i16.TYPE[0] = _i16; \
+ values.i17.TYPE[0] = _i17; \
+ values.i18.TYPE[0] = _i18; \
+ values.i19.TYPE[0] = _i19; \
+ WRAP_CALL(_func1) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9, \
+ _i10, _i11, _i12, _i13, _i14, _i15, _i16, _i17, \
+ _i18, _i19); \
+ \
+ clear_struct_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ fregs.F4.TYPE[0] = _i4; \
+ fregs.F5.TYPE[0] = _i5; \
+ fregs.F6.TYPE[0] = _i6; \
+ fregs.F7.TYPE[0] = _i7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9, \
+ _i10, _i11, _i12, _i13, _i14, _i15, _i16, _i17, \
+ _i18, _i19);
+
+volatile __bf16 bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16,
+ bf17,bf18,bf19,bf20,bf21,bf22,bf23,bf24,
+ bf25,bf26,bf27,bf28,bf29,bf30,bf31,bf32;
+
+void
+test_m512bf16_on_stack ()
+{
+ __m512bf16 x[8];
+ int i;
+ for (i = 0; i < 8; i++)
+ x[i] = (__m512bf16) { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16,
+ bf17,bf18,bf19,bf20,bf21,bf22,bf23,bf24,
+ bf25,bf26,bf27,bf28,bf29,bf30,bf31,bf32 };
+
+ pass = "m512bf16-8";
+ def_check_passing8 (x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7],
+ fun_check_passing_m512bf16_8_values,
+ fun_check_passing_m512bf16_8_regs, _m512bf16);
+}
+
+void
+test_too_many_m512bf16 ()
+{
+ __m512bf16 x[20];
+ int i;
+ for (i = 0; i < 20; i++)
+ x[i] = (__m512bf16) { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16,
+ bf17,bf18,bf19,bf20,bf21,bf22,bf23,bf24,
+ bf25,bf26,bf27,bf28,bf29,bf30,bf31,bf32 };
+ pass = "m512bf16-20";
+ def_check_passing20 (x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8],
+ x[9], x[10], x[11], x[12], x[13], x[14], x[15], x[16],
+ x[17], x[18], x[19], fun_check_passing_m512bf16_20_values,
+ fun_check_passing_m512bf16_20_regs, _m512bf16);
+}
+
+static void
+do_test (void)
+{
+ test_m512bf16_on_stack ();
+ test_too_many_m512bf16 ();
+ if (failed)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/test_passing_structs.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/test_passing_structs.c
new file mode 100644
index 0000000..f93a2b8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/test_passing_structs.c
@@ -0,0 +1,77 @@
+#include "bf16-zmm-check.h"
+#include "args.h"
+
+struct FloatRegisters fregs;
+struct IntegerRegisters iregs;
+unsigned int num_fregs, num_iregs;
+
+struct m512bf16_struct
+{
+ __m512bf16 x;
+};
+
+struct m512bf16_2_struct
+{
+ __m512bf16 x1, x2;
+};
+
+/* Check that the struct is passed as the individual members in fregs. */
+void
+check_struct_passing1bf16 (struct m512bf16_struct ms1 ATTRIBUTE_UNUSED,
+ struct m512bf16_struct ms2 ATTRIBUTE_UNUSED,
+ struct m512bf16_struct ms3 ATTRIBUTE_UNUSED,
+ struct m512bf16_struct ms4 ATTRIBUTE_UNUSED,
+ struct m512bf16_struct ms5 ATTRIBUTE_UNUSED,
+ struct m512bf16_struct ms6 ATTRIBUTE_UNUSED,
+ struct m512bf16_struct ms7 ATTRIBUTE_UNUSED,
+ struct m512bf16_struct ms8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+check_struct_passing2bf16 (struct m512bf16_2_struct ms ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&ms.x1 == rsp+8);
+ assert ((unsigned long)&ms.x2 == rsp+72);
+}
+
+static void
+do_test (void)
+{
+ __bf16 bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16,
+ bf17,bf18,bf19,bf20,bf21,bf22,bf23,bf24,
+ bf25,bf26,bf27,bf28,bf29,bf30,bf31,bf32;
+ struct m512bf16_struct m512bf16s [8];
+ struct m512bf16_2_struct m512bf16_2s = {
+ { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16,
+ bf17,bf18,bf19,bf20,bf21,bf22,bf23,bf24,
+ bf25,bf26,bf27,bf28,bf29,bf30,bf31,bf32 },
+ { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16,
+ bf17,bf18,bf19,bf20,bf21,bf22,bf23,bf24,
+ bf25,bf26,bf27,bf28,bf29,bf30,bf31,bf32 }
+ };
+ int i;
+
+ for (i = 0; i < 8; i++)
+ {
+ m512bf16s[i].x = (__m512bf16) { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16,
+ bf17,bf18,bf19,bf20,bf21,bf22,bf23,bf24,
+ bf25,bf26,bf27,bf28,bf29,bf30,bf31,bf32 };
+ }
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ (&fregs.zmm0)[i]._m512bf16[0] = m512bf16s[i].x;
+ num_fregs = 8;
+ WRAP_CALL (check_struct_passing1bf16) (m512bf16s[0], m512bf16s[1], m512bf16s[2], m512bf16s[3],
+ m512bf16s[4], m512bf16s[5], m512bf16s[6], m512bf16s[7]);
+ WRAP_CALL (check_struct_passing2bf16) (m512bf16_2s);
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/test_passing_unions.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/test_passing_unions.c
new file mode 100644
index 0000000..3769b38
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/test_passing_unions.c
@@ -0,0 +1,222 @@
+#include "bf16-zmm-check.h"
+#include "args.h"
+
+struct FloatRegisters fregs;
+struct IntegerRegisters iregs;
+unsigned int num_fregs, num_iregs;
+
+union un1b
+{
+ __m512bf16 x;
+ float f;
+};
+
+union un1bb
+{
+ __m512bf16 x;
+ __bf16 f;
+};
+
+union un2b
+{
+ __m512bf16 x;
+ double d;
+};
+
+union un3b
+{
+ __m512bf16 x;
+ __m128 v;
+};
+
+union un4b
+{
+ __m512bf16 x;
+ long double ld;
+};
+
+union un5b
+{
+ __m512bf16 x;
+ int i;
+};
+
+union un6b
+{
+ __m512bf16 x;
+ __m256 v;
+};
+
+void
+check_union_passing1b (union un1b u1 ATTRIBUTE_UNUSED,
+ union un1b u2 ATTRIBUTE_UNUSED,
+ union un1b u3 ATTRIBUTE_UNUSED,
+ union un1b u4 ATTRIBUTE_UNUSED,
+ union un1b u5 ATTRIBUTE_UNUSED,
+ union un1b u6 ATTRIBUTE_UNUSED,
+ union un1b u7 ATTRIBUTE_UNUSED,
+ union un1b u8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+check_union_passing1bb (union un1bb u1 ATTRIBUTE_UNUSED,
+ union un1bb u2 ATTRIBUTE_UNUSED,
+ union un1bb u3 ATTRIBUTE_UNUSED,
+ union un1bb u4 ATTRIBUTE_UNUSED,
+ union un1bb u5 ATTRIBUTE_UNUSED,
+ union un1bb u6 ATTRIBUTE_UNUSED,
+ union un1bb u7 ATTRIBUTE_UNUSED,
+ union un1bb u8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+
+void
+check_union_passing2b (union un2b u1 ATTRIBUTE_UNUSED,
+ union un2b u2 ATTRIBUTE_UNUSED,
+ union un2b u3 ATTRIBUTE_UNUSED,
+ union un2b u4 ATTRIBUTE_UNUSED,
+ union un2b u5 ATTRIBUTE_UNUSED,
+ union un2b u6 ATTRIBUTE_UNUSED,
+ union un2b u7 ATTRIBUTE_UNUSED,
+ union un2b u8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+check_union_passing3b (union un3b u1 ATTRIBUTE_UNUSED,
+ union un3b u2 ATTRIBUTE_UNUSED,
+ union un3b u3 ATTRIBUTE_UNUSED,
+ union un3b u4 ATTRIBUTE_UNUSED,
+ union un3b u5 ATTRIBUTE_UNUSED,
+ union un3b u6 ATTRIBUTE_UNUSED,
+ union un3b u7 ATTRIBUTE_UNUSED,
+ union un3b u8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+check_union_passing4b (union un4b u ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&u.x == rsp+8);
+ assert ((unsigned long)&u.ld == rsp+8);
+}
+
+void
+check_union_passing5b (union un5b u ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&u.x == rsp+8);
+ assert ((unsigned long)&u.i == rsp+8);
+}
+
+void
+check_union_passing6b (union un6b u1 ATTRIBUTE_UNUSED,
+ union un6b u2 ATTRIBUTE_UNUSED,
+ union un6b u3 ATTRIBUTE_UNUSED,
+ union un6b u4 ATTRIBUTE_UNUSED,
+ union un6b u5 ATTRIBUTE_UNUSED,
+ union un6b u6 ATTRIBUTE_UNUSED,
+ union un6b u7 ATTRIBUTE_UNUSED,
+ union un6b u8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+#define check_union_passing1b WRAP_CALL(check_union_passing1b)
+#define check_union_passing1bf WRAP_CALL(check_union_passing1bf)
+#define check_union_passing1bb WRAP_CALL(check_union_passing1bb)
+#define check_union_passing2b WRAP_CALL(check_union_passing2b)
+#define check_union_passing3b WRAP_CALL(check_union_passing3b)
+#define check_union_passing4b WRAP_CALL(check_union_passing4b)
+#define check_union_passing5b WRAP_CALL(check_union_passing5b)
+#define check_union_passing6b WRAP_CALL(check_union_passing6b)
+
+
+static void
+do_test (void)
+{
+ __bf16 bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16,
+ bf17,bf18,bf19,bf20,bf21,bf22,bf23,bf24,
+ bf25,bf26,bf27,bf28,bf29,bf30,bf31,bf32;
+ union un1b u1b[8];
+ union un1bb u1bb[8];
+ union un2b u2b[8];
+ union un3b u3b[8];
+ union un4b u4b;
+ union un5b u5b;
+ union un6b u6b[8];
+ int i;
+
+ for (i = 0; i < 8; i++)
+ {
+ u1b[i].x = (__m512bf16) { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16,
+ bf17,bf18,bf19,bf20,bf21,bf22,bf23,bf24,
+ bf25,bf26,bf27,bf28,bf29,bf30,bf31,bf32 };
+ }
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ (&fregs.zmm0)[i]._m512bf16[0] = u1b[i].x;
+ num_fregs = 8;
+ check_union_passing1b (u1b[0], u1b[1], u1b[2], u1b[3],
+ u1b[4], u1b[5], u1b[6], u1b[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u1bb[i].x = u1b[i].x;
+ (&fregs.zmm0)[i]._m512bf16[0] = u1bb[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing1bb (u1bb[0], u1bb[1], u1bb[2], u1bb[3],
+ u1bb[4], u1bb[5], u1bb[6], u1bb[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u2b[i].x = u1bb[i].x;
+ (&fregs.zmm0)[i]._m512bf16[0] = u2b[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing2b (u2b[0], u2b[1], u2b[2], u2b[3],
+ u2b[4], u2b[5], u2b[6], u2b[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u3b[i].x = u1b[i].x;
+ (&fregs.zmm0)[i]._m512bf16[0] = u3b[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing3b (u3b[0], u3b[1], u3b[2], u3b[3],
+ u3b[4], u3b[5], u3b[6], u3b[7]);
+
+ check_union_passing4b (u4b);
+ check_union_passing5b (u5b);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u6b[i].x = u1b[i].x;
+ (&fregs.zmm0)[i]._m512bf16[0] = u6b[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing6b (u6b[0], u6b[1], u6b[2], u6b[3],
+ u6b[4], u6b[5], u6b[6], u6b[7]);
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/test_varargs-m512.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/test_varargs-m512.c
new file mode 100644
index 0000000..2be57b8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/m512bf16/test_varargs-m512.c
@@ -0,0 +1,111 @@
+/* Test variable number of 512-bit vector arguments passed to functions. */
+
+#include <stdio.h>
+#include "bf16-zmm-check.h"
+#include "args.h"
+
+struct FloatRegisters fregs;
+struct IntegerRegisters iregs;
+
+/* This struct holds values for argument checking. */
+struct
+{
+ ZMM_T i0, i1, i2, i3, i4, i5, i6, i7, i8, i9;
+} values;
+
+char *pass;
+int failed = 0;
+
+#undef assert
+#define assert(c) do { \
+ if (!(c)) {failed++; printf ("failed %s\n", pass); } \
+} while (0)
+
+#define compare(X1,X2,T) do { \
+ assert (memcmp (&X1, &X2, sizeof (T)) == 0); \
+} while (0)
+
+void
+fun_check_passing_m512bf16_varargs (__m512bf16 i0, __m512bf16 i1, __m512bf16 i2,
+ __m512bf16 i3, ...)
+{
+ /* Check argument values. */
+ void **fp = __builtin_frame_address (0);
+ void *ra = __builtin_return_address (0);
+ __m512bf16 *argp;
+
+ compare (values.i0, i0, __m512bf16);
+ compare (values.i1, i1, __m512bf16);
+ compare (values.i2, i2, __m512bf16);
+ compare (values.i3, i3, __m512bf16);
+
+ /* Get the pointer to the return address on stack. */
+ while (*fp != ra)
+ fp++;
+
+ /* Skip the return address stack slot. */
+ argp = (__m512bf16 *)(((char *) fp) + 8);
+
+ /* Check __m512bf16 arguments passed on stack. */
+ compare (values.i4, argp[0], __m512bf16);
+ compare (values.i5, argp[1], __m512bf16);
+ compare (values.i6, argp[2], __m512bf16);
+ compare (values.i7, argp[3], __m512bf16);
+ compare (values.i8, argp[4], __m512bf16);
+ compare (values.i9, argp[5], __m512bf16);
+
+ /* Check register contents. */
+ compare (fregs.zmm0, zmm_regs[0], __m512bf16);
+ compare (fregs.zmm1, zmm_regs[1], __m512bf16);
+ compare (fregs.zmm2, zmm_regs[2], __m512bf16);
+ compare (fregs.zmm3, zmm_regs[3], __m512bf16);
+}
+
+#define def_check_int_passing_varargs(_i0, _i1, _i2, _i3, _i4, _i5, \
+ _i6, _i7, _i8, _i9, \
+ _func, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ values.i8.TYPE[0] = _i8; \
+ values.i9.TYPE[0] = _i9; \
+ clear_struct_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ WRAP_CALL(_func) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9);
+
+void
+test_m512bf16_varargs (void)
+{
+ __m512bf16 x[10];
+ __bf16 bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16,
+ bf17,bf18,bf19,bf20,bf21,bf22,bf23,bf24,
+ bf25,bf26,bf27,bf28,bf29,bf30,bf31,bf32;
+ int i;
+ for (i = 0; i < 10; i++)
+ x[i] = (__m512bf16) { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16,
+ bf17,bf18,bf19,bf20,bf21,bf22,bf23,bf24,
+ bf25,bf26,bf27,bf28,bf29,bf30,bf31,bf32 };
+ pass = "m512bf16-varargs";
+ def_check_int_passing_varargs (x[0], x[1], x[2], x[3], x[4], x[5],
+ x[6], x[7], x[8], x[9],
+ fun_check_passing_m512bf16_varargs,
+ _m512bf16);
+}
+
+void
+do_test (void)
+{
+ test_m512bf16_varargs ();
+ if (failed)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/macros.h b/gcc/testsuite/gcc.target/x86_64/abi/bf16/macros.h
new file mode 100644
index 0000000..98fbc66
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/macros.h
@@ -0,0 +1,53 @@
+#ifndef MACROS_H
+
+#define check_size(_t, _size) assert(sizeof(_t) == (_size))
+
+#define check_align(_t, _align) assert(__alignof__(_t) == (_align))
+
+#define check_align_lv(_t, _align) assert(__alignof__(_t) == (_align) \
+ && (((unsigned long)&(_t)) & ((_align) - 1) ) == 0)
+
+#define check_basic_struct_size_and_align(_type, _size, _align) { \
+ struct _str { _type dummy; } _t; \
+ check_size(_t, _size); \
+ check_align_lv(_t, _align); \
+}
+
+#define check_array_size_and_align(_type, _size, _align) { \
+ _type _a[1]; _type _b[2]; _type _c[16]; \
+ struct _str { _type _a[1]; } _s; \
+ check_align_lv(_a[0], _align); \
+ check_size(_a, _size); \
+ check_size(_b, (_size*2)); \
+ check_size(_c, (_size*16)); \
+ check_size(_s, _size); \
+ check_align_lv(_s._a[0], _align); \
+}
+
+#define check_basic_union_size_and_align(_type, _size, _align) { \
+ union _union { _type dummy; } _u; \
+ check_size(_u, _size); \
+ check_align_lv(_u, _align); \
+}
+
+#define run_signed_tests2(_function, _arg1, _arg2) \
+ _function(_arg1, _arg2); \
+ _function(signed _arg1, _arg2); \
+ _function(unsigned _arg1, _arg2);
+
+#define run_signed_tests3(_function, _arg1, _arg2, _arg3) \
+ _function(_arg1, _arg2, _arg3); \
+ _function(signed _arg1, _arg2, _arg3); \
+ _function(unsigned _arg1, _arg2, _arg3);
+
+/* Check size of a struct and a union of three types. */
+
+#define check_struct_and_union3(type1, type2, type3, struct_size, align_size) \
+{ \
+ struct _str { type1 t1; type2 t2; type3 t3; } _t; \
+ union _uni { type1 t1; type2 t2; type3 t3; } _u; \
+ check_size(_t, struct_size); \
+ check_size(_u, align_size); \
+}
+
+#endif // MACROS_H
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_3_element_struct_and_unions.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_3_element_struct_and_unions.c
new file mode 100644
index 0000000..0c58db1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_3_element_struct_and_unions.c
@@ -0,0 +1,214 @@
+/* This is an autogenerated file. Do not edit. */
+
+#include "defines.h"
+#include "macros.h"
+
+/* Check structs and unions of all permutations of 3 basic types. */
+int
+main (void)
+{
+ check_struct_and_union3(char, char, __bf16, 4, 2);
+ check_struct_and_union3(char, __bf16, char, 6, 2);
+ check_struct_and_union3(char, __bf16, __bf16, 6, 2);
+ check_struct_and_union3(char, __bf16, int, 8, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(char, __bf16, long, 16, 8);
+#endif
+ check_struct_and_union3(char, __bf16, long long, 16, 8);
+ check_struct_and_union3(char, __bf16, float, 8, 4);
+ check_struct_and_union3(char, __bf16, double, 16, 8);
+ check_struct_and_union3(char, __bf16, long double, 32, 16);
+ check_struct_and_union3(char, int, __bf16, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(char, long, __bf16, 24, 8);
+#endif
+ check_struct_and_union3(char, long long, __bf16, 24, 8);
+ check_struct_and_union3(char, float, __bf16, 12, 4);
+ check_struct_and_union3(char, double, __bf16, 24, 8);
+ check_struct_and_union3(char, long double, __bf16, 48, 16);
+ check_struct_and_union3(__bf16, char, char, 4, 2);
+ check_struct_and_union3(__bf16, char, __bf16, 6, 2);
+ check_struct_and_union3(__bf16, char, int, 8, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(__bf16, char, long, 16, 8);
+#endif
+ check_struct_and_union3(__bf16, char, long long, 16, 8);
+ check_struct_and_union3(__bf16, char, float, 8, 4);
+ check_struct_and_union3(__bf16, char, double, 16, 8);
+ check_struct_and_union3(__bf16, char, long double, 32, 16);
+ check_struct_and_union3(__bf16, __bf16, char, 6, 2);
+ check_struct_and_union3(__bf16, __bf16, __bf16, 6, 2);
+ check_struct_and_union3(__bf16, __bf16, int, 8, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(__bf16, __bf16, long, 16, 8);
+#endif
+ check_struct_and_union3(__bf16, __bf16, long long, 16, 8);
+ check_struct_and_union3(__bf16, __bf16, float, 8, 4);
+ check_struct_and_union3(__bf16, __bf16, double, 16, 8);
+ check_struct_and_union3(__bf16, __bf16, long double, 32, 16);
+ check_struct_and_union3(__bf16, int, char, 12, 4);
+ check_struct_and_union3(__bf16, int, __bf16, 12, 4);
+ check_struct_and_union3(__bf16, int, int, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(__bf16, int, long, 16, 8);
+#endif
+ check_struct_and_union3(__bf16, int, long long, 16, 8);
+ check_struct_and_union3(__bf16, int, float, 12, 4);
+ check_struct_and_union3(__bf16, int, double, 16, 8);
+ check_struct_and_union3(__bf16, int, long double, 32, 16);
+#ifndef __ILP32__
+ check_struct_and_union3(__bf16, long, char, 24, 8);
+ check_struct_and_union3(__bf16, long, __bf16, 24, 8);
+ check_struct_and_union3(__bf16, long, int, 24, 8);
+ check_struct_and_union3(__bf16, long, long, 24, 8);
+ check_struct_and_union3(__bf16, long, long long, 24, 8);
+ check_struct_and_union3(__bf16, long, float, 24, 8);
+ check_struct_and_union3(__bf16, long, double, 24, 8);
+#endif
+ check_struct_and_union3(__bf16, long, long double, 32, 16);
+ check_struct_and_union3(__bf16, long long, char, 24, 8);
+ check_struct_and_union3(__bf16, long long, __bf16, 24, 8);
+ check_struct_and_union3(__bf16, long long, int, 24, 8);
+ check_struct_and_union3(__bf16, long long, long, 24, 8);
+ check_struct_and_union3(__bf16, long long, long long, 24, 8);
+ check_struct_and_union3(__bf16, long long, float, 24, 8);
+ check_struct_and_union3(__bf16, long long, double, 24, 8);
+ check_struct_and_union3(__bf16, long long, long double, 32, 16);
+ check_struct_and_union3(__bf16, float, char, 12, 4);
+ check_struct_and_union3(__bf16, float, __bf16, 12, 4);
+ check_struct_and_union3(__bf16, float, int, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(__bf16, float, long, 16, 8);
+#endif
+ check_struct_and_union3(__bf16, float, long long, 16, 8);
+ check_struct_and_union3(__bf16, float, float, 12, 4);
+ check_struct_and_union3(__bf16, float, double, 16, 8);
+ check_struct_and_union3(__bf16, float, long double, 32, 16);
+ check_struct_and_union3(__bf16, double, char, 24, 8);
+ check_struct_and_union3(__bf16, double, __bf16, 24, 8);
+ check_struct_and_union3(__bf16, double, int, 24, 8);
+ check_struct_and_union3(__bf16, double, long, 24, 8);
+ check_struct_and_union3(__bf16, double, long long, 24, 8);
+ check_struct_and_union3(__bf16, double, float, 24, 8);
+ check_struct_and_union3(__bf16, double, double, 24, 8);
+ check_struct_and_union3(__bf16, double, long double, 32, 16);
+ check_struct_and_union3(__bf16, long double, char, 48, 16);
+ check_struct_and_union3(__bf16, long double, __bf16, 48, 16);
+ check_struct_and_union3(__bf16, long double, int, 48, 16);
+ check_struct_and_union3(__bf16, long double, long, 48, 16);
+ check_struct_and_union3(__bf16, long double, long long, 48, 16);
+ check_struct_and_union3(__bf16, long double, float, 48, 16);
+ check_struct_and_union3(__bf16, long double, double, 48, 16);
+ check_struct_and_union3(__bf16, long double, long double, 48, 16);
+ check_struct_and_union3(int, char, __bf16, 8, 4);
+ check_struct_and_union3(int, __bf16, char, 8, 4);
+ check_struct_and_union3(int, __bf16, __bf16, 8, 4);
+ check_struct_and_union3(int, __bf16, int, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(int, __bf16, long, 16, 8);
+#endif
+ check_struct_and_union3(int, __bf16, long long, 16, 8);
+ check_struct_and_union3(int, __bf16, float, 12, 4);
+ check_struct_and_union3(int, __bf16, double, 16, 8);
+ check_struct_and_union3(int, __bf16, long double, 32, 16);
+ check_struct_and_union3(int, int, __bf16, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(int, long, __bf16, 24, 8);
+#endif
+ check_struct_and_union3(int, long long, __bf16, 24, 8);
+ check_struct_and_union3(int, float, __bf16, 12, 4);
+ check_struct_and_union3(int, double, __bf16, 24, 8);
+ check_struct_and_union3(int, long double, __bf16, 48, 16);
+#ifndef __ILP32__
+ check_struct_and_union3(long, char, __bf16, 16, 8);
+ check_struct_and_union3(long, __bf16, char, 16, 8);
+ check_struct_and_union3(long, __bf16, __bf16, 16, 8);
+ check_struct_and_union3(long, __bf16, int, 16, 8);
+ check_struct_and_union3(long, __bf16, long, 24, 8);
+ check_struct_and_union3(long, __bf16, long long, 24, 8);
+ check_struct_and_union3(long, __bf16, float, 16, 8);
+ check_struct_and_union3(long, __bf16, double, 24, 8);
+#endif
+ check_struct_and_union3(long, __bf16, long double, 32, 16);
+#ifndef __ILP32__
+ check_struct_and_union3(long, int, __bf16, 16, 8);
+ check_struct_and_union3(long, long, __bf16, 24, 8);
+ check_struct_and_union3(long, long long, __bf16, 24, 8);
+ check_struct_and_union3(long, float, __bf16, 16, 8);
+ check_struct_and_union3(long, double, __bf16, 24, 8);
+#endif
+ check_struct_and_union3(long, long double, __bf16, 48, 16);
+ check_struct_and_union3(long long, char, __bf16, 16, 8);
+ check_struct_and_union3(long long, __bf16, char, 16, 8);
+ check_struct_and_union3(long long, __bf16, __bf16, 16, 8);
+ check_struct_and_union3(long long, __bf16, int, 16, 8);
+#ifndef __ILP32__
+ check_struct_and_union3(long long, __bf16, long, 24, 8);
+#endif
+ check_struct_and_union3(long long, __bf16, long long, 24, 8);
+ check_struct_and_union3(long long, __bf16, float, 16, 8);
+ check_struct_and_union3(long long, __bf16, double, 24, 8);
+ check_struct_and_union3(long long, __bf16, long double, 32, 16);
+ check_struct_and_union3(long long, int, __bf16, 16, 8);
+#ifndef __ILP32__
+ check_struct_and_union3(long long, long, __bf16, 24, 8);
+#endif
+ check_struct_and_union3(long long, long long, __bf16, 24, 8);
+ check_struct_and_union3(long long, float, __bf16, 16, 8);
+ check_struct_and_union3(long long, double, __bf16, 24, 8);
+ check_struct_and_union3(long long, long double, __bf16, 48, 16);
+ check_struct_and_union3(float, char, __bf16, 8, 4);
+ check_struct_and_union3(float, __bf16, char, 8, 4);
+ check_struct_and_union3(float, __bf16, __bf16, 8, 4);
+ check_struct_and_union3(float, __bf16, int, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(float, __bf16, long, 16, 8);
+#endif
+ check_struct_and_union3(float, __bf16, long long, 16, 8);
+ check_struct_and_union3(float, __bf16, float, 12, 4);
+ check_struct_and_union3(float, __bf16, double, 16, 8);
+ check_struct_and_union3(float, __bf16, long double, 32, 16);
+ check_struct_and_union3(float, int, __bf16, 12, 4);
+#ifndef __ILP32__
+ check_struct_and_union3(float, long, __bf16, 24, 8);
+#endif
+ check_struct_and_union3(float, long long, __bf16, 24, 8);
+ check_struct_and_union3(float, float, __bf16, 12, 4);
+ check_struct_and_union3(float, double, __bf16, 24, 8);
+ check_struct_and_union3(float, long double, __bf16, 48, 16);
+ check_struct_and_union3(double, char, __bf16, 16, 8);
+ check_struct_and_union3(double, __bf16, char, 16, 8);
+ check_struct_and_union3(double, __bf16, __bf16, 16, 8);
+ check_struct_and_union3(double, __bf16, int, 16, 8);
+#ifndef __ILP32__
+ check_struct_and_union3(double, __bf16, long, 24, 8);
+#endif
+ check_struct_and_union3(double, __bf16, long long, 24, 8);
+ check_struct_and_union3(double, __bf16, float, 16, 8);
+ check_struct_and_union3(double, __bf16, double, 24, 8);
+ check_struct_and_union3(double, __bf16, long double, 32, 16);
+ check_struct_and_union3(double, int, __bf16, 16, 8);
+#ifndef __ILP32__
+ check_struct_and_union3(double, long, __bf16, 24, 8);
+#endif
+ check_struct_and_union3(double, long long, __bf16, 24, 8);
+ check_struct_and_union3(double, float, __bf16, 16, 8);
+ check_struct_and_union3(double, double, __bf16, 24, 8);
+ check_struct_and_union3(double, long double, __bf16, 48, 16);
+ check_struct_and_union3(long double, char, __bf16, 32, 16);
+ check_struct_and_union3(long double, __bf16, char, 32, 16);
+ check_struct_and_union3(long double, __bf16, __bf16, 32, 16);
+ check_struct_and_union3(long double, __bf16, int, 32, 16);
+ check_struct_and_union3(long double, __bf16, long, 32, 16);
+ check_struct_and_union3(long double, __bf16, long long, 32, 16);
+ check_struct_and_union3(long double, __bf16, float, 32, 16);
+ check_struct_and_union3(long double, __bf16, double, 32, 16);
+ check_struct_and_union3(long double, __bf16, long double, 48, 16);
+ check_struct_and_union3(long double, int, __bf16, 32, 16);
+ check_struct_and_union3(long double, long, __bf16, 32, 16);
+ check_struct_and_union3(long double, long long, __bf16, 32, 16);
+ check_struct_and_union3(long double, float, __bf16, 32, 16);
+ check_struct_and_union3(long double, double, __bf16, 32, 16);
+ check_struct_and_union3(long double, long double, __bf16, 48, 16);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_alignment.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_alignment.c
new file mode 100644
index 0000000..6490a52
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_alignment.c
@@ -0,0 +1,14 @@
+/* This checks alignment of basic types. */
+
+#include "defines.h"
+#include "macros.h"
+
+
+int
+main (void)
+{
+ /* __bf16 point types. */
+ check_align(__bf16, TYPE_ALIGN_BF16);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_array_size_and_align.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_array_size_and_align.c
new file mode 100644
index 0000000..c004c35
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_array_size_and_align.c
@@ -0,0 +1,13 @@
+/* This checks . */
+
+#include "defines.h"
+#include "macros.h"
+
+
+int
+main (void)
+{
+ check_array_size_and_align(__bf16, TYPE_SIZE_BF16, TYPE_ALIGN_BF16);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_returning.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_returning.c
new file mode 100644
index 0000000..cfea222
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_returning.c
@@ -0,0 +1,20 @@
+#include "bf16-check.h"
+#include "defines.h"
+#include "macros.h"
+#include "args.h"
+
+__bf16
+fun_test_returning_bf16 (void)
+{
+ __bf16 b = make_f32_bf16 (72.0f);
+ volatile_var++;
+ return b;
+}
+
+static void
+do_test (void)
+{
+ __bf16 var = WRAP_RET (fun_test_returning_bf16) ();
+ assert (check_bf16_float (xmm_regs[0].___bf16[0], 72.0f) == 1);
+ assert (check_bf16_float (var, 72.0f) == 1);
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_sizes.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_sizes.c
new file mode 100644
index 0000000..b81a8d9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_sizes.c
@@ -0,0 +1,14 @@
+/* This checks sizes of basic types. */
+
+#include "defines.h"
+#include "macros.h"
+
+
+int
+main (void)
+{
+ /* Floating point types. */
+ check_size(__bf16, TYPE_SIZE_BF16);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_struct_size_and_align.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_struct_size_and_align.c
new file mode 100644
index 0000000..f282506
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_struct_size_and_align.c
@@ -0,0 +1,14 @@
+/* This checks size and alignment of structs with a single basic type
+ element. All basic types are checked. */
+
+#include "bf16-check.h"
+#include "defines.h"
+#include "macros.h"
+
+
+static void
+do_test (void)
+{
+ /* Floating point types. */
+ check_basic_struct_size_and_align(__bf16, TYPE_SIZE_BF16, TYPE_ALIGN_BF16);
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_union_size_and_align.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_union_size_and_align.c
new file mode 100644
index 0000000..03afa68
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_basic_union_size_and_align.c
@@ -0,0 +1,12 @@
+/* Test of simple unions, size and alignment. */
+
+#include "bf16-check.h"
+#include "defines.h"
+#include "macros.h"
+
+static void
+do_test (void)
+{
+ /* Floating point types. */
+ check_basic_union_size_and_align(__bf16, TYPE_SIZE_BF16, TYPE_ALIGN_BF16);
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_m128_returning.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_m128_returning.c
new file mode 100644
index 0000000..64857ce
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_m128_returning.c
@@ -0,0 +1,38 @@
+#include <stdio.h>
+#include "bf16-check.h"
+#include "defines.h"
+#include "macros.h"
+#include "args.h"
+
+struct FloatRegisters fregs;
+struct IntegerRegisters iregs;
+unsigned int num_fregs, num_iregs;
+
+volatile __bf16 bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8;
+
+__m128bf16
+fun_test_returning___m128bf16 (void)
+{
+ volatile_var++;
+ return (__m128bf16) { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8 };
+}
+
+__m128bf16 test_128bf16;
+
+static void
+do_test (void)
+{
+ unsigned failed = 0;
+ XMM_T xmmt1, xmmt2;
+
+ clear_struct_registers;
+ test_128bf16 = (__m128bf16) { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8 };
+ xmmt1._m128bf16[0] = test_128bf16;
+ xmmt2._m128bf16[0] = WRAP_RET (fun_test_returning___m128bf16)();
+ if (xmmt1._longlong[0] != xmmt2._longlong[0]
+ || xmmt1._longlong[0] != xmm_regs[0]._longlong[0])
+ printf ("fail m128bf16\n"), failed++;
+
+ if (failed)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_passing_floats.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_passing_floats.c
new file mode 100644
index 0000000..fe08042
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_passing_floats.c
@@ -0,0 +1,312 @@
+/* This is an autogenerated file. Do not edit. */
+
+#include "bf16-check.h"
+#include "defines.h"
+#include "macros.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+/* This struct holds values for argument checking. */
+struct
+{
+ __bf16 f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14,
+ f15, f16, f17, f18, f19, f20, f21, f22, f23;
+} values___bf16;
+
+void
+fun_check_bf16_passing_8_values (__bf16 f0 ATTRIBUTE_UNUSED,
+ __bf16 f1 ATTRIBUTE_UNUSED,
+ __bf16 f2 ATTRIBUTE_UNUSED,
+ __bf16 f3 ATTRIBUTE_UNUSED,
+ __bf16 f4 ATTRIBUTE_UNUSED,
+ __bf16 f5 ATTRIBUTE_UNUSED,
+ __bf16 f6 ATTRIBUTE_UNUSED,
+ __bf16 f7 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ check_bf16 (values___bf16.f0, f0);
+ check_bf16 (values___bf16.f1, f1);
+ check_bf16 (values___bf16.f2, f2);
+ check_bf16 (values___bf16.f3, f3);
+ check_bf16 (values___bf16.f4, f4);
+ check_bf16 (values___bf16.f5, f5);
+ check_bf16 (values___bf16.f6, f6);
+ check_bf16 (values___bf16.f7, f7);
+}
+
+void
+fun_check_bf16_passing_8_regs (__bf16 f0 ATTRIBUTE_UNUSED,
+ __bf16 f1 ATTRIBUTE_UNUSED,
+ __bf16 f2 ATTRIBUTE_UNUSED,
+ __bf16 f3 ATTRIBUTE_UNUSED,
+ __bf16 f4 ATTRIBUTE_UNUSED,
+ __bf16 f5 ATTRIBUTE_UNUSED,
+ __bf16 f6 ATTRIBUTE_UNUSED,
+ __bf16 f7 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_bf16_arguments;
+}
+
+void
+fun_check_bf16_passing_16_values (__bf16 f0 ATTRIBUTE_UNUSED,
+ __bf16 f1 ATTRIBUTE_UNUSED,
+ __bf16 f2 ATTRIBUTE_UNUSED,
+ __bf16 f3 ATTRIBUTE_UNUSED,
+ __bf16 f4 ATTRIBUTE_UNUSED,
+ __bf16 f5 ATTRIBUTE_UNUSED,
+ __bf16 f6 ATTRIBUTE_UNUSED,
+ __bf16 f7 ATTRIBUTE_UNUSED,
+ __bf16 f8 ATTRIBUTE_UNUSED,
+ __bf16 f9 ATTRIBUTE_UNUSED,
+ __bf16 f10 ATTRIBUTE_UNUSED,
+ __bf16 f11 ATTRIBUTE_UNUSED,
+ __bf16 f12 ATTRIBUTE_UNUSED,
+ __bf16 f13 ATTRIBUTE_UNUSED,
+ __bf16 f14 ATTRIBUTE_UNUSED,
+ __bf16 f15 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ check_bf16 (values___bf16.f0, f0);
+ check_bf16 (values___bf16.f1, f1);
+ check_bf16 (values___bf16.f2, f2);
+ check_bf16 (values___bf16.f3, f3);
+ check_bf16 (values___bf16.f4, f4);
+ check_bf16 (values___bf16.f5, f5);
+ check_bf16 (values___bf16.f6, f6);
+ check_bf16 (values___bf16.f7, f7);
+ check_bf16 (values___bf16.f8, f8);
+ check_bf16 (values___bf16.f9, f9);
+ check_bf16 (values___bf16.f10, f10);
+ check_bf16 (values___bf16.f11, f11);
+ check_bf16 (values___bf16.f12, f12);
+ check_bf16 (values___bf16.f13, f13);
+ check_bf16 (values___bf16.f14, f14);
+ check_bf16 (values___bf16.f15, f15);
+}
+
+void
+fun_check_bf16_passing_16_regs (__bf16 f0 ATTRIBUTE_UNUSED,
+ __bf16 f1 ATTRIBUTE_UNUSED,
+ __bf16 f2 ATTRIBUTE_UNUSED,
+ __bf16 f3 ATTRIBUTE_UNUSED,
+ __bf16 f4 ATTRIBUTE_UNUSED,
+ __bf16 f5 ATTRIBUTE_UNUSED,
+ __bf16 f6 ATTRIBUTE_UNUSED,
+ __bf16 f7 ATTRIBUTE_UNUSED,
+ __bf16 f8 ATTRIBUTE_UNUSED,
+ __bf16 f9 ATTRIBUTE_UNUSED,
+ __bf16 f10 ATTRIBUTE_UNUSED,
+ __bf16 f11 ATTRIBUTE_UNUSED,
+ __bf16 f12 ATTRIBUTE_UNUSED,
+ __bf16 f13 ATTRIBUTE_UNUSED,
+ __bf16 f14 ATTRIBUTE_UNUSED,
+ __bf16 f15 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_bf16_arguments;
+}
+
+void
+fun_check_bf16_passing_20_values (__bf16 f0 ATTRIBUTE_UNUSED,
+ __bf16 f1 ATTRIBUTE_UNUSED,
+ __bf16 f2 ATTRIBUTE_UNUSED,
+ __bf16 f3 ATTRIBUTE_UNUSED,
+ __bf16 f4 ATTRIBUTE_UNUSED,
+ __bf16 f5 ATTRIBUTE_UNUSED,
+ __bf16 f6 ATTRIBUTE_UNUSED,
+ __bf16 f7 ATTRIBUTE_UNUSED,
+ __bf16 f8 ATTRIBUTE_UNUSED,
+ __bf16 f9 ATTRIBUTE_UNUSED,
+ __bf16 f10 ATTRIBUTE_UNUSED,
+ __bf16 f11 ATTRIBUTE_UNUSED,
+ __bf16 f12 ATTRIBUTE_UNUSED,
+ __bf16 f13 ATTRIBUTE_UNUSED,
+ __bf16 f14 ATTRIBUTE_UNUSED,
+ __bf16 f15 ATTRIBUTE_UNUSED,
+ __bf16 f16 ATTRIBUTE_UNUSED,
+ __bf16 f17 ATTRIBUTE_UNUSED,
+ __bf16 f18 ATTRIBUTE_UNUSED,
+ __bf16 f19 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ check_bf16 (values___bf16.f0, f0);
+ check_bf16 (values___bf16.f1, f1);
+ check_bf16 (values___bf16.f2, f2);
+ check_bf16 (values___bf16.f3, f3);
+ check_bf16 (values___bf16.f4, f4);
+ check_bf16 (values___bf16.f5, f5);
+ check_bf16 (values___bf16.f6, f6);
+ check_bf16 (values___bf16.f7, f7);
+ check_bf16 (values___bf16.f8, f8);
+ check_bf16 (values___bf16.f9, f9);
+ check_bf16 (values___bf16.f10, f10);
+ check_bf16 (values___bf16.f11, f11);
+ check_bf16 (values___bf16.f12, f12);
+ check_bf16 (values___bf16.f13, f13);
+ check_bf16 (values___bf16.f14, f14);
+ check_bf16 (values___bf16.f15, f15);
+ check_bf16 (values___bf16.f16, f16);
+ check_bf16 (values___bf16.f17, f17);
+ check_bf16 (values___bf16.f18, f18);
+ check_bf16 (values___bf16.f19, f19);
+}
+
+void
+fun_check_bf16_passing_20_regs (__bf16 f0 ATTRIBUTE_UNUSED,
+ __bf16 f1 ATTRIBUTE_UNUSED,
+ __bf16 f2 ATTRIBUTE_UNUSED,
+ __bf16 f3 ATTRIBUTE_UNUSED,
+ __bf16 f4 ATTRIBUTE_UNUSED,
+ __bf16 f5 ATTRIBUTE_UNUSED,
+ __bf16 f6 ATTRIBUTE_UNUSED,
+ __bf16 f7 ATTRIBUTE_UNUSED,
+ __bf16 f8 ATTRIBUTE_UNUSED,
+ __bf16 f9 ATTRIBUTE_UNUSED,
+ __bf16 f10 ATTRIBUTE_UNUSED,
+ __bf16 f11 ATTRIBUTE_UNUSED,
+ __bf16 f12 ATTRIBUTE_UNUSED,
+ __bf16 f13 ATTRIBUTE_UNUSED,
+ __bf16 f14 ATTRIBUTE_UNUSED,
+ __bf16 f15 ATTRIBUTE_UNUSED,
+ __bf16 f16 ATTRIBUTE_UNUSED,
+ __bf16 f17 ATTRIBUTE_UNUSED,
+ __bf16 f18 ATTRIBUTE_UNUSED,
+ __bf16 f19 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_bf16_arguments;
+}
+
+#define def_check_bf16_passing8(_f0, _f1, _f2, _f3, _f4, _f5, _f6,\
+ _f7, _func1, _func2, TYPE) \
+ values_ ## TYPE .f0 = _f0; \
+ values_ ## TYPE .f1 = _f1; \
+ values_ ## TYPE .f2 = _f2; \
+ values_ ## TYPE .f3 = _f3; \
+ values_ ## TYPE .f4 = _f4; \
+ values_ ## TYPE .f5 = _f5; \
+ values_ ## TYPE .f6 = _f6; \
+ values_ ## TYPE .f7 = _f7; \
+ WRAP_CALL(_func1) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7); \
+ clear_float_registers; \
+ fregs.F0._ ## TYPE [0] = _f0; \
+ fregs.F1._ ## TYPE [0] = _f1; \
+ fregs.F2._ ## TYPE [0] = _f2; \
+ fregs.F3._ ## TYPE [0] = _f3; \
+ fregs.F4._ ## TYPE [0] = _f4; \
+ fregs.F5._ ## TYPE [0] = _f5; \
+ fregs.F6._ ## TYPE [0] = _f6; \
+ fregs.F7._ ## TYPE [0] = _f7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7);
+
+#define def_check_bf16_passing16(_f0, _f1, _f2, _f3, _f4, _f5, _f6, \
+ _f7, _f8, _f9, _f10, _f11, _f12, _f13, \
+ _f14, _f15, _func1, _func2, TYPE) \
+ values_ ## TYPE .f0 = _f0; \
+ values_ ## TYPE .f1 = _f1; \
+ values_ ## TYPE .f2 = _f2; \
+ values_ ## TYPE .f3 = _f3; \
+ values_ ## TYPE .f4 = _f4; \
+ values_ ## TYPE .f5 = _f5; \
+ values_ ## TYPE .f6 = _f6; \
+ values_ ## TYPE .f7 = _f7; \
+ values_ ## TYPE .f8 = _f8; \
+ values_ ## TYPE .f9 = _f9; \
+ values_ ## TYPE .f10 = _f10; \
+ values_ ## TYPE .f11 = _f11; \
+ values_ ## TYPE .f12 = _f12; \
+ values_ ## TYPE .f13 = _f13; \
+ values_ ## TYPE .f14 = _f14; \
+ values_ ## TYPE .f15 = _f15; \
+ WRAP_CALL(_func1) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, \
+ _f10, _f11, _f12, _f13, _f14, _f15); \
+ clear_float_registers; \
+ fregs.F0._ ## TYPE [0] = _f0; \
+ fregs.F1._ ## TYPE [0] = _f1; \
+ fregs.F2._ ## TYPE [0] = _f2; \
+ fregs.F3._ ## TYPE [0] = _f3; \
+ fregs.F4._ ## TYPE [0] = _f4; \
+ fregs.F5._ ## TYPE [0] = _f5; \
+ fregs.F6._ ## TYPE [0] = _f6; \
+ fregs.F7._ ## TYPE [0] = _f7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, \
+ _f10, _f11, _f12, _f13, _f14, _f15);
+
+#define def_check_bf16_passing20(_f0, _f1, _f2, _f3, _f4, _f5, _f6, \
+ _f7, _f8, _f9, _f10, _f11, _f12, \
+ _f13, _f14, _f15, _f16, _f17, \
+ _f18, _f19, _func1, _func2, TYPE) \
+ values_ ## TYPE .f0 = _f0; \
+ values_ ## TYPE .f1 = _f1; \
+ values_ ## TYPE .f2 = _f2; \
+ values_ ## TYPE .f3 = _f3; \
+ values_ ## TYPE .f4 = _f4; \
+ values_ ## TYPE .f5 = _f5; \
+ values_ ## TYPE .f6 = _f6; \
+ values_ ## TYPE .f7 = _f7; \
+ values_ ## TYPE .f8 = _f8; \
+ values_ ## TYPE .f9 = _f9; \
+ values_ ## TYPE .f10 = _f10; \
+ values_ ## TYPE .f11 = _f11; \
+ values_ ## TYPE .f12 = _f12; \
+ values_ ## TYPE .f13 = _f13; \
+ values_ ## TYPE .f14 = _f14; \
+ values_ ## TYPE .f15 = _f15; \
+ values_ ## TYPE .f16 = _f16; \
+ values_ ## TYPE .f17 = _f17; \
+ values_ ## TYPE .f18 = _f18; \
+ values_ ## TYPE .f19 = _f19; \
+ WRAP_CALL(_func1) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, \
+ _f9, _f10, _f11, _f12, _f13, _f14, _f15, _f16, \
+ _f17, _f18, _f19); \
+ clear_float_registers; \
+ fregs.F0._ ## TYPE [0] = _f0; \
+ fregs.F1._ ## TYPE [0] = _f1; \
+ fregs.F2._ ## TYPE [0] = _f2; \
+ fregs.F3._ ## TYPE [0] = _f3; \
+ fregs.F4._ ## TYPE [0] = _f4; \
+ fregs.F5._ ## TYPE [0] = _f5; \
+ fregs.F6._ ## TYPE [0] = _f6; \
+ fregs.F7._ ## TYPE [0] = _f7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, \
+ _f10, _f11, _f12, _f13, _f14, _f15, _f16, _f17, \
+ _f18, _f19);
+
+volatile __bf16 bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8, bf9, bf10,
+ bf11,bf12,bf13,bf14,bf15,bf16,bf17,bf18,bf19,bf20;
+
+void
+test_bf16_on_stack ()
+{
+ def_check_bf16_passing8 (bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ fun_check_bf16_passing_8_values,
+ fun_check_bf16_passing_8_regs, __bf16);
+
+ def_check_bf16_passing16 (bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16,
+ fun_check_bf16_passing_16_values,
+ fun_check_bf16_passing_16_regs, __bf16);
+}
+
+void
+test_too_many_bf16 ()
+{
+ def_check_bf16_passing20 (bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8, bf9, bf10,
+ bf11,bf12,bf13,bf14,bf15,bf16,bf17,bf18,bf19,bf20,
+ fun_check_bf16_passing_20_values,
+ fun_check_bf16_passing_20_regs, __bf16);
+}
+
+static void
+do_test (void)
+{
+ test_bf16_on_stack ();
+ test_too_many_bf16 ();
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_passing_m128.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_passing_m128.c
new file mode 100644
index 0000000..298b644
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_passing_m128.c
@@ -0,0 +1,238 @@
+#include <stdio.h>
+#include "bf16-check.h"
+#include "defines.h"
+#include "macros.h"
+#include "args.h"
+
+struct FloatRegisters fregs;
+struct IntegerRegisters iregs;
+unsigned int num_fregs, num_iregs;
+
+/* This struct holds values for argument checking. */
+struct
+{
+ XMM_T i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15,
+ i16, i17, i18, i19, i20, i21, i22, i23;
+} values;
+
+char *pass;
+int failed = 0;
+
+#undef assert
+#define assert(c) do { \
+ if (!(c)) {failed++; printf ("failed %s\n", pass); } \
+} while (0)
+
+#define compare(X1,X2,T) do { \
+ assert (memcmp (&X1, &X2, sizeof (T)) == 0); \
+} while (0)
+
+void
+fun_check_passing_m128bf16_8_values (__m128bf16 i0 ATTRIBUTE_UNUSED,
+ __m128bf16 i1 ATTRIBUTE_UNUSED,
+ __m128bf16 i2 ATTRIBUTE_UNUSED,
+ __m128bf16 i3 ATTRIBUTE_UNUSED,
+ __m128bf16 i4 ATTRIBUTE_UNUSED,
+ __m128bf16 i5 ATTRIBUTE_UNUSED,
+ __m128bf16 i6 ATTRIBUTE_UNUSED,
+ __m128bf16 i7 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m128bf16);
+ compare (values.i1, i1, __m128bf16);
+ compare (values.i2, i2, __m128bf16);
+ compare (values.i3, i3, __m128bf16);
+ compare (values.i4, i4, __m128bf16);
+ compare (values.i5, i5, __m128bf16);
+ compare (values.i6, i6, __m128bf16);
+ compare (values.i7, i7, __m128bf16);
+}
+
+void
+fun_check_passing_m128bf16_8_regs (__m128bf16 i0 ATTRIBUTE_UNUSED,
+ __m128bf16 i1 ATTRIBUTE_UNUSED,
+ __m128bf16 i2 ATTRIBUTE_UNUSED,
+ __m128bf16 i3 ATTRIBUTE_UNUSED,
+ __m128bf16 i4 ATTRIBUTE_UNUSED,
+ __m128bf16 i5 ATTRIBUTE_UNUSED,
+ __m128bf16 i6 ATTRIBUTE_UNUSED,
+ __m128bf16 i7 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m128_arguments;
+}
+
+void
+fun_check_passing_m128bf16_20_values (__m128bf16 i0 ATTRIBUTE_UNUSED,
+ __m128bf16 i1 ATTRIBUTE_UNUSED,
+ __m128bf16 i2 ATTRIBUTE_UNUSED,
+ __m128bf16 i3 ATTRIBUTE_UNUSED,
+ __m128bf16 i4 ATTRIBUTE_UNUSED,
+ __m128bf16 i5 ATTRIBUTE_UNUSED,
+ __m128bf16 i6 ATTRIBUTE_UNUSED,
+ __m128bf16 i7 ATTRIBUTE_UNUSED,
+ __m128bf16 i8 ATTRIBUTE_UNUSED,
+ __m128bf16 i9 ATTRIBUTE_UNUSED,
+ __m128bf16 i10 ATTRIBUTE_UNUSED,
+ __m128bf16 i11 ATTRIBUTE_UNUSED,
+ __m128bf16 i12 ATTRIBUTE_UNUSED,
+ __m128bf16 i13 ATTRIBUTE_UNUSED,
+ __m128bf16 i14 ATTRIBUTE_UNUSED,
+ __m128bf16 i15 ATTRIBUTE_UNUSED,
+ __m128bf16 i16 ATTRIBUTE_UNUSED,
+ __m128bf16 i17 ATTRIBUTE_UNUSED,
+ __m128bf16 i18 ATTRIBUTE_UNUSED,
+ __m128bf16 i19 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m128bf16);
+ compare (values.i1, i1, __m128bf16);
+ compare (values.i2, i2, __m128bf16);
+ compare (values.i3, i3, __m128bf16);
+ compare (values.i4, i4, __m128bf16);
+ compare (values.i5, i5, __m128bf16);
+ compare (values.i6, i6, __m128bf16);
+ compare (values.i7, i7, __m128bf16);
+ compare (values.i8, i8, __m128bf16);
+ compare (values.i9, i9, __m128bf16);
+ compare (values.i10, i10, __m128bf16);
+ compare (values.i11, i11, __m128bf16);
+ compare (values.i12, i12, __m128bf16);
+ compare (values.i13, i13, __m128bf16);
+ compare (values.i14, i14, __m128bf16);
+ compare (values.i15, i15, __m128bf16);
+ compare (values.i16, i16, __m128bf16);
+ compare (values.i17, i17, __m128bf16);
+ compare (values.i18, i18, __m128bf16);
+ compare (values.i19, i19, __m128bf16);
+}
+
+void
+fun_check_passing_m128bf16_20_regs (__m128bf16 i0 ATTRIBUTE_UNUSED,
+ __m128bf16 i1 ATTRIBUTE_UNUSED,
+ __m128bf16 i2 ATTRIBUTE_UNUSED,
+ __m128bf16 i3 ATTRIBUTE_UNUSED,
+ __m128bf16 i4 ATTRIBUTE_UNUSED,
+ __m128bf16 i5 ATTRIBUTE_UNUSED,
+ __m128bf16 i6 ATTRIBUTE_UNUSED,
+ __m128bf16 i7 ATTRIBUTE_UNUSED,
+ __m128bf16 i8 ATTRIBUTE_UNUSED,
+ __m128bf16 i9 ATTRIBUTE_UNUSED,
+ __m128bf16 i10 ATTRIBUTE_UNUSED,
+ __m128bf16 i11 ATTRIBUTE_UNUSED,
+ __m128bf16 i12 ATTRIBUTE_UNUSED,
+ __m128bf16 i13 ATTRIBUTE_UNUSED,
+ __m128bf16 i14 ATTRIBUTE_UNUSED,
+ __m128bf16 i15 ATTRIBUTE_UNUSED,
+ __m128bf16 i16 ATTRIBUTE_UNUSED,
+ __m128bf16 i17 ATTRIBUTE_UNUSED,
+ __m128bf16 i18 ATTRIBUTE_UNUSED,
+ __m128bf16 i19 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m128_arguments;
+}
+
+#define def_check_int_passing8(_i0, _i1, _i2, _i3, \
+ _i4, _i5, _i6, _i7, \
+ _func1, _func2, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ WRAP_CALL(_func1) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7); \
+ clear_float_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ fregs.F4.TYPE[0] = _i4; \
+ fregs.F5.TYPE[0] = _i5; \
+ fregs.F6.TYPE[0] = _i6; \
+ fregs.F7.TYPE[0] = _i7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7);
+
+#define def_check_int_passing20(_i0, _i1, _i2, _i3, _i4, _i5, _i6, \
+ _i7, _i8, _i9, _i10, _i11, _i12, _i13, \
+ _i14, _i15, _i16, _i17, _i18, _i19, \
+ _func1, _func2, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ values.i8.TYPE[0] = _i8; \
+ values.i9.TYPE[0] = _i9; \
+ values.i10.TYPE[0] = _i10; \
+ values.i11.TYPE[0] = _i11; \
+ values.i12.TYPE[0] = _i12; \
+ values.i13.TYPE[0] = _i13; \
+ values.i14.TYPE[0] = _i14; \
+ values.i15.TYPE[0] = _i15; \
+ values.i16.TYPE[0] = _i16; \
+ values.i17.TYPE[0] = _i17; \
+ values.i18.TYPE[0] = _i18; \
+ values.i19.TYPE[0] = _i19; \
+ WRAP_CALL(_func1) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
+ _i9, _i10, _i11, _i12, _i13, _i14, _i15, _i16, \
+ _i17, _i18, _i19); \
+ clear_float_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ fregs.F4.TYPE[0] = _i4; \
+ fregs.F5.TYPE[0] = _i5; \
+ fregs.F6.TYPE[0] = _i6; \
+ fregs.F7.TYPE[0] = _i7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
+ _i9, _i10, _i11, _i12, _i13, _i14, _i15, _i16, \
+ _i17, _i18, _i19);
+
+volatile __bf16 bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8;
+
+void
+test_m128bf16_on_stack ()
+{
+ __m128bf16 x[8];
+ int i;
+ for (i = 0; i < 8; i++)
+ x[i] = (__m128bf16) { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8 };
+ pass = "m128bf16-8";
+ def_check_int_passing8 (x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7],
+ fun_check_passing_m128bf16_8_values,
+ fun_check_passing_m128bf16_8_regs, _m128bf16);
+}
+
+void
+test_too_many_m128bf16 ()
+{
+ __m128bf16 x[20];
+ int i;
+ for (i = 0; i < 20; i++)
+ x[i] = (__m128bf16) { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8 };
+ pass = "m128bf16-20";
+ def_check_int_passing20 (x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7],
+ x[8], x[9], x[10], x[11], x[12], x[13], x[14],
+ x[15], x[16], x[17], x[18], x[19],
+ fun_check_passing_m128bf16_20_values,
+ fun_check_passing_m128bf16_20_regs, _m128bf16);
+}
+
+static void
+do_test (void)
+{
+ test_m128bf16_on_stack ();
+ test_too_many_m128bf16 ();
+ if (failed)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_passing_structs.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_passing_structs.c
new file mode 100644
index 0000000..8d96600
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_passing_structs.c
@@ -0,0 +1,67 @@
+#include "bf16-check.h"
+#include "defines.h"
+#include "args.h"
+
+struct FloatRegisters fregs;
+struct IntegerRegisters iregs;
+unsigned int num_fregs, num_iregs;
+
+struct m128bf16_struct
+{
+ __m128bf16 x;
+};
+
+struct m128bf16_2_struct
+{
+ __m128bf16 x1, x2;
+};
+
+/* Check that the struct is passed as the individual members in fregs. */
+void
+check_struct_passing1bf16 (struct m128bf16_struct ms1 ATTRIBUTE_UNUSED,
+ struct m128bf16_struct ms2 ATTRIBUTE_UNUSED,
+ struct m128bf16_struct ms3 ATTRIBUTE_UNUSED,
+ struct m128bf16_struct ms4 ATTRIBUTE_UNUSED,
+ struct m128bf16_struct ms5 ATTRIBUTE_UNUSED,
+ struct m128bf16_struct ms6 ATTRIBUTE_UNUSED,
+ struct m128bf16_struct ms7 ATTRIBUTE_UNUSED,
+ struct m128bf16_struct ms8 ATTRIBUTE_UNUSED)
+{
+ check_m128_arguments;
+}
+
+void
+check_struct_passing2bf16 (struct m128bf16_2_struct ms ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&ms.x1 == rsp+8);
+ assert ((unsigned long)&ms.x2 == rsp+24);
+}
+
+volatile __bf16 bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
+ bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16;
+
+static void
+do_test (void)
+{
+ struct m128bf16_struct m128bf16s [8];
+ struct m128bf16_2_struct m128bf16_2s = {
+ { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8 },
+ { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8 },
+ };
+ int i;
+
+ for (i = 0; i < 8; i++)
+ {
+ m128bf16s[i].x = (__m128bf16) { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8 };
+ }
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ (&fregs.xmm0)[i]._m128bf16[0] = m128bf16s[i].x;
+ num_fregs = 8;
+ WRAP_CALL (check_struct_passing1bf16) (m128bf16s[0], m128bf16s[1], m128bf16s[2], m128bf16s[3],
+ m128bf16s[4], m128bf16s[5], m128bf16s[6], m128bf16s[7]);
+ WRAP_CALL (check_struct_passing2bf16) (m128bf16_2s);
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_passing_unions.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_passing_unions.c
new file mode 100644
index 0000000..83e4380
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_passing_unions.c
@@ -0,0 +1,160 @@
+#include "bf16-check.h"
+#include "defines.h"
+#include "args.h"
+
+struct FloatRegisters fregs;
+struct IntegerRegisters iregs;
+unsigned int num_fregs, num_iregs;
+
+union un1b
+{
+ __m128bf16 x;
+ float f;
+};
+
+union un1bb
+{
+ __m128bf16 x;
+ __bf16 f;
+};
+
+union un2b
+{
+ __m128bf16 x;
+ double d;
+};
+
+union un3b
+{
+ __m128bf16 x;
+ __m128 v;
+};
+
+union un4b
+{
+ __m128bf16 x;
+ long double ld;
+};
+
+void
+check_union_passing1b (union un1b u1 ATTRIBUTE_UNUSED,
+ union un1b u2 ATTRIBUTE_UNUSED,
+ union un1b u3 ATTRIBUTE_UNUSED,
+ union un1b u4 ATTRIBUTE_UNUSED,
+ union un1b u5 ATTRIBUTE_UNUSED,
+ union un1b u6 ATTRIBUTE_UNUSED,
+ union un1b u7 ATTRIBUTE_UNUSED,
+ union un1b u8 ATTRIBUTE_UNUSED)
+{
+ check_m128_arguments;
+}
+
+void
+check_union_passing1bb (union un1bb u1 ATTRIBUTE_UNUSED,
+ union un1bb u2 ATTRIBUTE_UNUSED,
+ union un1bb u3 ATTRIBUTE_UNUSED,
+ union un1bb u4 ATTRIBUTE_UNUSED,
+ union un1bb u5 ATTRIBUTE_UNUSED,
+ union un1bb u6 ATTRIBUTE_UNUSED,
+ union un1bb u7 ATTRIBUTE_UNUSED,
+ union un1bb u8 ATTRIBUTE_UNUSED)
+{
+ check_m128_arguments;
+}
+
+void
+check_union_passing2b (union un2b u1 ATTRIBUTE_UNUSED,
+ union un2b u2 ATTRIBUTE_UNUSED,
+ union un2b u3 ATTRIBUTE_UNUSED,
+ union un2b u4 ATTRIBUTE_UNUSED,
+ union un2b u5 ATTRIBUTE_UNUSED,
+ union un2b u6 ATTRIBUTE_UNUSED,
+ union un2b u7 ATTRIBUTE_UNUSED,
+ union un2b u8 ATTRIBUTE_UNUSED)
+{
+ check_m128_arguments;
+}
+
+void
+check_union_passing3b (union un3b u1 ATTRIBUTE_UNUSED,
+ union un3b u2 ATTRIBUTE_UNUSED,
+ union un3b u3 ATTRIBUTE_UNUSED,
+ union un3b u4 ATTRIBUTE_UNUSED,
+ union un3b u5 ATTRIBUTE_UNUSED,
+ union un3b u6 ATTRIBUTE_UNUSED,
+ union un3b u7 ATTRIBUTE_UNUSED,
+ union un3b u8 ATTRIBUTE_UNUSED)
+{
+ check_m128_arguments;
+}
+
+void
+check_union_passing4b (union un4b u ATTRIBUTE_UNUSED)
+{
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&u.x == rsp+8);
+ assert ((unsigned long)&u.ld == rsp+8);
+}
+
+#define check_union_passing1b WRAP_CALL(check_union_passing1b)
+#define check_union_passing1bb WRAP_CALL(check_union_passing1bb)
+#define check_union_passing2b WRAP_CALL(check_union_passing2b)
+#define check_union_passing3b WRAP_CALL(check_union_passing3b)
+#define check_union_passing4b WRAP_CALL(check_union_passing4b)
+
+static void
+do_test (void)
+{
+ union un1b u1b[8];
+ union un1bb u1bb[8];
+ union un2b u2b[8];
+ union un3b u3b[8];
+ union un4b u4b;
+ int i;
+ __bf16 bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8;
+
+ for (i = 0; i < 8; i++)
+ {
+ u1b[i].x = (__m128bf16) { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8 };
+ }
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ (&fregs.xmm0)[i]._m128bf16[0] = u1b[i].x;
+ num_fregs = 8;
+ check_union_passing1b (u1b[0], u1b[1], u1b[2], u1b[3],
+ u1b[4], u1b[5], u1b[6], u1b[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u1bb[i].x = u1b[i].x;
+ (&fregs.xmm0)[i]._m128bf16[0] = u1bb[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing1bb (u1bb[0], u1bb[1], u1bb[2], u1bb[3],
+ u1bb[4], u1bb[5], u1bb[6], u1bb[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u2b[i].x = u1b[i].x;
+ (&fregs.xmm0)[i]._m128bf16[0] = u2b[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing2b (u2b[0], u2b[1], u2b[2], u2b[3],
+ u2b[4], u2b[5], u2b[6], u2b[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u3b[i].x = u1b[i].x;
+ (&fregs.xmm0)[i]._m128bf16[0] = u3b[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing3b (u3b[0], u3b[1], u3b[2], u3b[3],
+ u3b[4], u3b[5], u3b[6], u3b[7]);
+
+ check_union_passing4b (u4b);
+}
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_struct_returning.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_struct_returning.c
new file mode 100644
index 0000000..757ccc2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_struct_returning.c
@@ -0,0 +1,176 @@
+/* This tests returning of structures. */
+
+#include <stdio.h>
+#include "bf16-check.h"
+#include "defines.h"
+#include "macros.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+int current_test;
+int num_failed = 0;
+
+#undef assert
+#define assert(test) do { if (!(test)) {fprintf (stderr, "failed in test %d\n", current_test); num_failed++; } } while (0)
+
+#define xmm0b xmm_regs[0].___bf16
+#define xmm1b xmm_regs[1].___bf16
+#define xmm0f xmm_regs[0]._float
+#define xmm0d xmm_regs[0]._double
+#define xmm1f xmm_regs[1]._float
+#define xmm1d xmm_regs[1]._double
+
+typedef enum {
+ SSE_B = 0,
+ SSE_D,
+ MEM,
+ INT_SSE,
+ SSE_INT,
+ SSE_F_H,
+ SSE_F_H8
+} Type;
+
+/* Structures which should be returned in SSE. */
+#define D(I,MEMBERS,C,B) struct S_ ## I { MEMBERS ; }; Type class_ ## I = C; \
+struct S_ ## I f_ ## I (void) { struct S_ ## I s; memset (&s, 0, sizeof(s)); B; return s; }
+
+D(120,__bf16 f,SSE_B, s.f=make_f32_bf16(42.0f))
+D(121,__bf16 f;__bf16 f2,SSE_B, s.f=make_f32_bf16(42.0f))
+D(122,__bf16 f;float d,SSE_B, s.f=make_f32_bf16(42.0f))
+D(123,__bf16 f;double d,SSE_B, s.f=make_f32_bf16(42.0f))
+D(124,double d; __bf16 f,SSE_D, s.d=42)
+D(125,__bf16 f[2],SSE_B, s.f[0]=make_f32_bf16(42.0f))
+D(126,__bf16 f[3],SSE_B, s.f[0]=make_f32_bf16(42.0f))
+D(127,__bf16 f[4],SSE_B, s.f[0]=make_f32_bf16(42.0f))
+D(128,__bf16 f[2]; double d,SSE_B, s.f[0]=make_f32_bf16(42.0f))
+D(129,double d;__bf16 f[2],SSE_D, s.d=42)
+
+#undef D
+
+#define D(I,MEMBERS) struct S_ ## I { MEMBERS ; }; Type class_ ## I = INT_SSE; \
+struct S_ ## I f_ ## I (void) { struct S_ ## I s = { 42, make_f32_bf16(43.0f) }; return s; }
+
+D(310,char m1; __bf16 m2)
+D(311,short m1; __bf16 m2)
+D(312,int m1; __bf16 m2)
+D(313,long long m1; __bf16 m2)
+
+#undef D
+
+void check_300 (void)
+{
+ XMM_T x;
+ x._ulonglong[0] = rax;
+ switch (current_test) {
+ case 310: assert ((rax & 0xff) == 42
+ && check_bf16_float (x.___bf16[1], 43.0f) == 1); break;
+ case 311: assert ((rax & 0xffff) == 42
+ && check_bf16_float (x.___bf16[1], 43.0f) == 1); break;
+ case 312: assert ((rax & 0xffffffff) == 42
+ && check_bf16_float (x.___bf16[2], 43.0f) == 1); break;
+ case 313: assert (rax == 42
+ && check_bf16_float (xmm0b[0], 43.0f) == 1); break;
+
+ default: assert (0); break;
+ }
+}
+
+/* Structures which should be returned in SSE (low) and INT (high). */
+#define D(I,MEMBERS,B) struct S_ ## I { MEMBERS ; }; Type class_ ## I = SSE_INT; \
+struct S_ ## I f_ ## I (void) { struct S_ ## I s; memset (&s, 0, sizeof(s)); B; return s; }
+
+D(402,__bf16 f[4];char c, s.f[0]=make_f32_bf16(42.0f); s.c=43)
+
+#undef D
+
+void check_400 (void)
+{
+ switch (current_test) {
+ case 402: assert (check_bf16_float (xmm0b[0], 42.0f) == 1 && (rax & 0xff) == 43); break;
+
+ default: assert (0); break;
+ }
+}
+
+/* Structures which should be returned in MEM. */
+void *struct_addr;
+#define D(I,MEMBERS) struct S_ ## I { MEMBERS ; }; Type class_ ## I = MEM; \
+struct S_ ## I f_ ## I (void) { union {unsigned char c; struct S_ ## I s;} u; memset (&u.s, 0, sizeof(u.s)); u.c = 42; return u.s; }
+
+/* Unnaturally aligned members. */
+D(540,__bf16 m1[10])
+D(541,char m1[1];__bf16 f[8])
+
+#undef D
+
+
+/* Special tests. */
+#define D(I,MEMBERS,C,B) struct S_ ## I { MEMBERS ; }; Type class_ ## I = C; \
+struct S_ ## I f_ ## I (void) { struct S_ ## I s; B; return s; }
+D(601,__bf16 f[4], SSE_F_H, s.f[0] = s.f[1] = s.f[2] = s.f[3] = make_f32_bf16 (42.0f))
+D(602,__bf16 f[8], SSE_F_H8,
+ s.f[0] = s.f[1] = s.f[2] = s.f[3] = s.f[4] = s.f[5] = s.f[6] = s.f[7] = make_f32_bf16 (42.0f))
+#undef D
+
+void clear_all (void)
+{
+ clear_int_registers;
+}
+
+void check_all (Type class, unsigned long size)
+{
+ switch (class) {
+ case SSE_B: assert (check_bf16_float (xmm0b[0], 42.0f) == 1); break;
+ case SSE_D: assert (xmm0d[0] == 42); break;
+ case SSE_F_H: assert (check_bf16_float (xmm0b[0], 42) == 1
+ && check_bf16_float (xmm0b[1], 42) == 1
+ && check_bf16_float (xmm0b[2], 42) == 1
+ && check_bf16_float (xmm0b[3], 42) == 1); break;
+ case SSE_F_H8: assert (check_bf16_float (xmm0b[0], 42) == 1
+ && check_bf16_float (xmm0b[1], 42) == 1
+ && check_bf16_float (xmm0b[2], 42) == 1
+ && check_bf16_float (xmm0b[3], 42) == 1
+ && check_bf16_float (xmm1b[0], 42) == 1
+ && check_bf16_float (xmm1b[1], 42) == 1
+ && check_bf16_float (xmm1b[2], 42) == 1
+ && check_bf16_float (xmm1b[3], 42) == 1); break;
+ case INT_SSE: check_300(); break;
+ case SSE_INT: check_400(); break;
+ /* Ideally we would like to check that rax == struct_addr.
+ Unfortunately the address of the target struct escapes (for setting
+ struct_addr), so the return struct is a temporary one whose address
+ is given to the f_* functions, otherwise a conforming program
+ could notice the struct changing already before the function returns.
+ This temporary struct could be anywhere. For GCC it will be on
+ stack, but no one is forbidding that it could be a static variable
+ if there's no threading or proper locking. Nobody in his right mind
+ will not use the stack for that. */
+ case MEM: assert (*(unsigned char*)struct_addr == 42 && rdi == rax); break;
+ }
+}
+
+#define D(I) { struct S_ ## I s; current_test = I; struct_addr = (void*)&s; \
+ clear_all(); \
+ s = WRAP_RET(f_ ## I) (); \
+ check_all(class_ ## I, sizeof(s)); \
+}
+
+static void
+do_test (void)
+{
+ D(120) D(121) D(122) D(123) D(124) D(125) D(126) D(127) D(128) D(129)
+
+ D(310) D(311) D(312) D(313)
+
+ D(402)
+
+ D(540) D(541)
+
+ D(601) D(602)
+ if (num_failed)
+ abort ();
+}
+#undef D
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_varargs-m128.c b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_varargs-m128.c
new file mode 100644
index 0000000..4eea7eb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/bf16/test_varargs-m128.c
@@ -0,0 +1,111 @@
+/* Test variable number of 128-bit vector arguments passed to functions. */
+
+#include <stdio.h>
+#include "bf16-check.h"
+#include "defines.h"
+#include "macros.h"
+#include "args.h"
+
+struct FloatRegisters fregs;
+struct IntegerRegisters iregs;
+
+/* This struct holds values for argument checking. */
+struct
+{
+ XMM_T i0, i1, i2, i3, i4, i5, i6, i7, i8, i9;
+} values;
+
+char *pass;
+int failed = 0;
+
+#undef assert
+#define assert(c) do { \
+ if (!(c)) {failed++; printf ("failed %s\n", pass); } \
+} while (0)
+
+#define compare(X1,X2,T) do { \
+ assert (memcmp (&X1, &X2, sizeof (T)) == 0); \
+} while (0)
+
+void
+fun_check_passing_m128bf16_varargs (__m128bf16 i0, __m128bf16 i1, __m128bf16 i2,
+ __m128bf16 i3, ...)
+{
+ /* Check argument values. */
+ void **fp = __builtin_frame_address (0);
+ void *ra = __builtin_return_address (0);
+ __m128bf16 *argp;
+
+ compare (values.i0, i0, __m128bf16);
+ compare (values.i1, i1, __m128bf16);
+ compare (values.i2, i2, __m128bf16);
+ compare (values.i3, i3, __m128bf16);
+
+ /* Get the pointer to the return address on stack. */
+ while (*fp != ra)
+ fp++;
+
+ /* Skip the return address stack slot. */
+ argp = (__m128bf16 *) (((char *) fp) + 8);
+
+ /* Check __m128bf16 arguments passed on stack. */
+ compare (values.i8, argp[0], __m128bf16);
+ compare (values.i9, argp[1], __m128bf16);
+
+ /* Check register contents. */
+ compare (fregs.xmm0, xmm_regs[0], __m128bf16);
+ compare (fregs.xmm1, xmm_regs[1], __m128bf16);
+ compare (fregs.xmm2, xmm_regs[2], __m128bf16);
+ compare (fregs.xmm3, xmm_regs[3], __m128bf16);
+ compare (fregs.xmm4, xmm_regs[4], __m128bf16);
+ compare (fregs.xmm5, xmm_regs[5], __m128bf16);
+ compare (fregs.xmm6, xmm_regs[6], __m128bf16);
+ compare (fregs.xmm7, xmm_regs[7], __m128bf16);
+}
+
+#define def_check_int_passing_varargs(_i0, _i1, _i2, _i3, _i4, _i5, \
+ _i6, _i7, _i8, _i9, \
+ _func, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ values.i8.TYPE[0] = _i8; \
+ values.i9.TYPE[0] = _i9; \
+ clear_float_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ fregs.F4.TYPE[0] = _i4; \
+ fregs.F5.TYPE[0] = _i5; \
+ fregs.F6.TYPE[0] = _i6; \
+ fregs.F7.TYPE[0] = _i7; \
+ WRAP_CALL(_func) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9);
+
+void
+test_m128bf16_varargs (void)
+{
+ __m128bf16 x[10];
+ __bf16 bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8;
+ int i;
+ for (i = 0; i < 10; i++)
+ x[i] = (__m128bf16) { bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8 };
+ pass = "m128bf16-varargs";
+ def_check_int_passing_varargs (x[0], x[1], x[2], x[3], x[4], x[5],
+ x[6], x[7], x[8], x[9],
+ fun_check_passing_m128bf16_varargs,
+ _m128bf16);
+}
+
+static void
+do_test (void)
+{
+ test_m128bf16_varargs ();
+ if (failed)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/xtensa/constsynth_3insns.c b/gcc/testsuite/gcc.target/xtensa/constsynth_3insns.c
index f3c4a1c..831288c 100644
--- a/gcc/testsuite/gcc.target/xtensa/constsynth_3insns.c
+++ b/gcc/testsuite/gcc.target/xtensa/constsynth_3insns.c
@@ -21,4 +21,15 @@ void test_3(int *p)
*p = 192437;
}
+struct foo
+{
+ unsigned int b : 10;
+ unsigned int g : 11;
+ unsigned int r : 11;
+};
+void test_4(struct foo *p, unsigned int v)
+{
+ p->g = v;
+}
+
/* { dg-final { scan-assembler-not "l32r" } } */
diff --git a/gcc/testsuite/gcc.target/xtensa/sibcalls.c b/gcc/testsuite/gcc.target/xtensa/sibcalls.c
index d2b3fcc..31bb4a3 100644
--- a/gcc/testsuite/gcc.target/xtensa/sibcalls.c
+++ b/gcc/testsuite/gcc.target/xtensa/sibcalls.c
@@ -17,4 +17,9 @@ int test_2(int (*a)(void)) {
return a();
}
+_Complex double test_3(_Complex double a, _Complex double (*b)(_Complex double, double)) {
+ bar(-1);
+ return b(a, 3.141592653589795);
+}
+
/* { dg-final { scan-assembler-not "ret" } } */
diff --git a/gcc/testsuite/gdc.dg/imports/pr106555.d b/gcc/testsuite/gdc.dg/imports/pr106555.d
new file mode 100644
index 0000000..0d3ab6b
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/imports/pr106555.d
@@ -0,0 +1,10 @@
+module imports.pr106555;
+struct S106555
+{
+ int[] f106555;
+ int max106555;
+ this(int)
+ {
+ f106555.length = max106555;
+ }
+}
diff --git a/gcc/testsuite/gdc.dg/pr106555.d b/gcc/testsuite/gdc.dg/pr106555.d
new file mode 100644
index 0000000..7b40f3c
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr106555.d
@@ -0,0 +1,4 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106555
+// { dg-do compile }
+// { dg-additional-options "-O2" }
+// { dg-additional-sources "imports/pr106555.d" }
diff --git a/gcc/testsuite/gdc.dg/torture/imports/pr106563math.d b/gcc/testsuite/gdc.dg/torture/imports/pr106563math.d
new file mode 100644
index 0000000..b9351ea
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/imports/pr106563math.d
@@ -0,0 +1,12 @@
+module imports.pr106563math;
+
+T nextPow2(T)(const T val)
+{
+ return powIntegralImpl(val);
+}
+
+pragma(inline, true)
+T powIntegralImpl(T)(T)
+{
+ return 1;
+}
diff --git a/gcc/testsuite/gdc.dg/torture/imports/pr106563regex.d b/gcc/testsuite/gdc.dg/torture/imports/pr106563regex.d
new file mode 100644
index 0000000..a2cd90c
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/imports/pr106563regex.d
@@ -0,0 +1,7 @@
+module imports.pr106563regex;
+import imports.pr106563uni;
+
+struct CharMatcher
+{
+ typeof(MultiArray!().length) trie;
+}
diff --git a/gcc/testsuite/gdc.dg/torture/imports/pr106563uni.d b/gcc/testsuite/gdc.dg/torture/imports/pr106563uni.d
new file mode 100644
index 0000000..16e3bc8
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/imports/pr106563uni.d
@@ -0,0 +1,15 @@
+module imports.pr106563uni;
+
+struct MultiArray()
+{
+ @property length()
+ {
+ return spaceFor!0();
+ }
+}
+
+size_t spaceFor(size_t bits)()
+{
+ import imports.pr106563math;
+ return nextPow2(bits);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/pr106563.d b/gcc/testsuite/gdc.dg/torture/pr106563.d
new file mode 100644
index 0000000..7e15442
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/pr106563.d
@@ -0,0 +1,16 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106563
+// { dg-do link }
+// { dg-additional-files "imports/pr106563math.d imports/pr106563regex.d imports/pr106563uni.d" }
+// { dg-additional-options "-I[srcdir] -fno-druntime" }
+import imports.pr106563math;
+import imports.pr106563regex;
+
+auto requireSize()(size_t size)
+{
+ return nextPow2(size);
+}
+
+extern(C) int main()
+{
+ return cast(int)requireSize(0);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/pr106623.d b/gcc/testsuite/gdc.dg/torture/pr106623.d
new file mode 100644
index 0000000..d782b23
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/pr106623.d
@@ -0,0 +1,28 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106623
+// { dg-do compile }
+private struct _Complex(T) { T re; T im; }
+enum __c_complex_double : _Complex!double;
+
+pragma(inline, true)
+ulong hashOf()(scope const double val)
+{
+ return *cast(ulong*)&val;
+}
+
+pragma(inline, true)
+ulong hashOf()(scope const _Complex!double val, ulong seed = 0)
+{
+ return hashOf(val.re) + hashOf(val.im);
+}
+
+pragma(inline, true)
+ulong hashOf()(__c_complex_double val, ulong seed = 0)
+{
+ return hashOf(cast(_Complex!double) val, seed);
+}
+
+ulong test106623()
+{
+ __c_complex_double val;
+ return hashOf(val);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/simd_store.d b/gcc/testsuite/gdc.dg/torture/simd_store.d
index b96ed42..234c020 100644
--- a/gcc/testsuite/gdc.dg/torture/simd_store.d
+++ b/gcc/testsuite/gdc.dg/torture/simd_store.d
@@ -23,7 +23,7 @@ void main()
// store `v` to location pointed to by `d`
storeUnaligned(cast(T*)d, v);
- // check that the the data was stored correctly
+ // check that the data was stored correctly
foreach (j; 0..T.sizeof)
assert(ptrToV[j] == d[j]);
}
diff --git a/gcc/testsuite/gdc.dg/torture/torture.exp b/gcc/testsuite/gdc.dg/torture/torture.exp
index f7d00b1..d9c6a79 100644
--- a/gcc/testsuite/gdc.dg/torture/torture.exp
+++ b/gcc/testsuite/gdc.dg/torture/torture.exp
@@ -19,6 +19,15 @@
# Load support procs.
load_lib gdc-dg.exp
+# Helper function allows adding tests that use imports/*, but don't compile
+# the sources in with dg-additional-sources.
+global testdir
+set testdir $srcdir/$subdir
+proc srcdir {} {
+ global testdir
+ return $testdir
+}
+
# The default option list can be overridden by
# TORTURE_OPTIONS="{ { list1 } ... { listN } }"
diff --git a/gcc/testsuite/gdc.test/compilable/aliasassign.d b/gcc/testsuite/gdc.test/compilable/aliasassign.d
index a29836e..8643f5d 100644
--- a/gcc/testsuite/gdc.test/compilable/aliasassign.d
+++ b/gcc/testsuite/gdc.test/compilable/aliasassign.d
@@ -3,18 +3,18 @@ template AliasSeq(T...) { alias AliasSeq = T; }
template Unqual(T)
{
static if (is(T U == const U))
- alias Unqual = U;
+ alias Unqual = U;
else static if (is(T U == immutable U))
- alias Unqual = U;
+ alias Unqual = U;
else
- alias Unqual = T;
+ alias Unqual = T;
}
template staticMap(alias F, T...)
{
alias A = AliasSeq!();
static foreach (t; T)
- A = AliasSeq!(A, F!t); // what's tested
+ A = AliasSeq!(A, F!t); // what's tested
alias staticMap = A;
}
@@ -28,7 +28,7 @@ template reverse(T...)
{
alias A = AliasSeq!();
static foreach (t; T)
- A = AliasSeq!(t, A); // what's tested
+ A = AliasSeq!(t, A); // what's tested
alias reverse = A;
}
@@ -38,3 +38,98 @@ alias TK2 = reverse!(int, const uint, X2);
static assert(TK2[0] == 3);
static assert(is(TK2[1] == const(uint)));
static assert(is(TK2[2] == int));
+
+/**************************************************/
+
+template Tp(Args...)
+{
+ alias Tp = AliasSeq!(int, 1, "asd", Args);
+ static foreach (arg; Args)
+ {
+ Tp = AliasSeq!(4, Tp, "zxc", arg, Tp, 5, 4, int, Tp[0..2]);
+ }
+}
+
+void fun(){}
+
+alias a1 = Tp!(char[], fun, x => x);
+static assert(
+ __traits(isSame, a1, AliasSeq!(4, 4, 4, int, 1, "asd", char[], fun,
+ x => x, "zxc", char[], int, 1, "asd", char[], fun, x => x,
+ 5, 4, int, int, 1, "zxc", fun, 4, int, 1, "asd", char[],
+ fun, x => x, "zxc", char[], int, 1, "asd", char[], fun,
+ x => x, 5, 4, int, int, 1, 5, 4, int, 4, int, "zxc", x => x,
+ 4, 4, int, 1, "asd", char[], fun, x => x, "zxc", char[],
+ int, 1, "asd", char[], fun, x => x, 5, 4, int, int, 1,
+ "zxc", fun, 4, int, 1, "asd", char[], fun, x => x, "zxc",
+ char[], int, 1, "asd", char[], fun, x => x, 5, 4, int, int,
+ 1, 5, 4, int, 4, int, 5, 4, int, 4, 4)));
+
+template Tp2(Args...)
+{
+ alias Tp2 = () => 1;
+ static foreach (i; 0..Args.length)
+ Tp2 = AliasSeq!(Tp2, Args[i]);
+}
+
+const x = 8;
+static assert(
+ __traits(isSame, Tp2!(2, float, x), AliasSeq!(() => 1, 2, float, x)));
+
+
+enum F(int i) = i * i;
+
+template staticMap2(alias fun, args...)
+{
+ alias staticMap2 = AliasSeq!();
+ static foreach (i; 0 .. args.length)
+ staticMap2 = AliasSeq!(fun!(args[i]), staticMap2, fun!(args[i]));
+}
+
+enum a2 = staticMap2!(F, 0, 1, 2, 3, 4);
+
+struct Cmp(T...){}
+// isSame sucks
+static assert(is(Cmp!a2 == Cmp!(16, 9, 4, 1, 0, 0, 1, 4, 9, 16)));
+
+template Tp3()
+{
+ alias aa1 = int;
+ static foreach (t; AliasSeq!(float, char[]))
+ aa1 = AliasSeq!(aa1, t);
+ static assert(is(aa1 == AliasSeq!(int, float, char[])));
+
+ alias aa2 = AliasSeq!int;
+ static foreach (t; AliasSeq!(float, char[]))
+ aa2 = AliasSeq!(aa2, t);
+ static assert(is(aa2 == AliasSeq!(int, float, char[])));
+
+ alias aa3 = AliasSeq!int;
+ aa3 = AliasSeq!(float, char);
+ static assert(is(aa3 == AliasSeq!(float, char)));
+}
+alias a3 = Tp3!();
+
+template Tp4() // Uses slow path because overload
+{
+ alias AliasSeq(T...) = T;
+ alias AliasSeq(alias f, T...) = T;
+
+ alias aa4 = int;
+ aa4 = AliasSeq!(aa4, float);
+ static assert(is(aa4 == AliasSeq!(int, float)));
+
+}
+alias a4 = Tp4!();
+
+template Tp5() // same tp overloaded, still uses fast path
+{
+ alias AliasSeq2(T...) = T;
+ alias AliasSeq = AliasSeq2;
+ alias AliasSeq = AliasSeq2;
+
+ alias aa5 = int;
+ aa5 = AliasSeq!(aa5, float);
+ static assert(is(aa5 == AliasSeq!(int, float)));
+}
+alias a5 = Tp5!();
diff --git a/gcc/testsuite/gdc.test/compilable/backendfloatoptim.d b/gcc/testsuite/gdc.test/compilable/backendfloatoptim.d
new file mode 100644
index 0000000..7ec9f61
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/backendfloatoptim.d
@@ -0,0 +1,10 @@
+// REQUIRED_ARGS: -O -inline
+
+//https://issues.dlang.org/show_bug.cgi?id=20143
+real fun(int x) { return 0.0; }
+
+double bug()
+{
+ // value passed to fun is irrelevant
+ return 0.0 / fun(420);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/cppmangle3.d b/gcc/testsuite/gdc.test/compilable/cppmangle3.d
index 93e49c7..82c68f7 100644
--- a/gcc/testsuite/gdc.test/compilable/cppmangle3.d
+++ b/gcc/testsuite/gdc.test/compilable/cppmangle3.d
@@ -45,16 +45,12 @@ alias Alias(T) = T;
static assert(is(Alias!(__traits(parent, Foo.bar)) == Foo));
extern(C++, "std"):
-debug = 456;
debug = def;
-version = 456;
version = def;
extern(C++, "std")
{
- debug = 456;
debug = def;
- version = 456;
version = def;
}
diff --git a/gcc/testsuite/gdc.test/compilable/must_use_initialize.d b/gcc/testsuite/gdc.test/compilable/must_use_initialize.d
new file mode 100644
index 0000000..8caec43
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/must_use_initialize.d
@@ -0,0 +1,16 @@
+// https://issues.dlang.org/show_bug.cgi?id=23236
+// can't initialize a @mustuse member in constructor
+
+import core.attribute;
+
+@mustuse struct MyError { }
+
+struct S
+{
+ MyError lastError;
+
+ this(int x)
+ {
+ this.lastError = MyError();
+ }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/noreturn1.d b/gcc/testsuite/gdc.test/compilable/noreturn1.d
index 5bba9ba..e648a56 100644
--- a/gcc/testsuite/gdc.test/compilable/noreturn1.d
+++ b/gcc/testsuite/gdc.test/compilable/noreturn1.d
@@ -122,3 +122,31 @@ noreturn testdg(noreturn delegate() dg)
{
dg();
}
+
+noreturn func()
+{
+ while(1)
+ {
+ }
+}
+alias AliasSeq(T...) = T;
+alias Types = AliasSeq!(bool, byte, ubyte, short, ushort, int, uint,
+ long, ulong, char, wchar, dchar, float, double,
+ real);
+void noreturnImplicit()
+{
+ /*
+ Testing both ways because, although the underlying table
+ is symmetrical the code that calls into it may be buggy.
+ */
+ {
+ int x = 2 + func();
+ int y = func() + 2;
+ }
+ foreach(T; Types)
+ {
+ T value;
+ auto x = value + throw new Exception("Hello");
+ auto y = (throw new Exception("wow")) + value;
+ }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/scope_infer_array_assign.d b/gcc/testsuite/gdc.test/compilable/scope_infer_array_assign.d
new file mode 100644
index 0000000..8ef54a1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/scope_infer_array_assign.d
@@ -0,0 +1,28 @@
+// REQUIRED_ARGS: -preview=dip1000
+
+// Test that scope inference works even with non POD array assignment
+// This is tricky because it gets lowered to something like:
+// (S[] __assigntmp0 = e[]) , _d_arrayassign_l(this.e[], __assigntmp0) , this.e[];
+
+@safe:
+
+struct File
+{
+ void* f;
+ ~this() scope { }
+}
+
+struct Vector
+{
+ File[] e;
+
+ auto assign(File[] e)
+ {
+ this.e[] = e[]; // slice copy
+ }
+}
+
+void test(scope File[] arr, Vector v)
+{
+ v.assign(arr);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test20832.d b/gcc/testsuite/gdc.test/compilable/test20832.d
new file mode 100644
index 0000000..25617a9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test20832.d
@@ -0,0 +1,12 @@
+// PERMUTE_ARGS: -preview=dip1000
+// https://issues.dlang.org/show_bug.cgi?id=20823
+
+void boo(T)( scope void delegate(T[] data) fun) {}
+void goo(T)(/+scope+/ void delegate(T[] data) fun) {}
+
+void main()
+{
+ void Execute(int[] data) {}
+ goo(&Execute);
+ boo(&Execute);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test21177.d b/gcc/testsuite/gdc.test/compilable/test21177.d
index b3b613b..b485304 100644
--- a/gcc/testsuite/gdc.test/compilable/test21177.d
+++ b/gcc/testsuite/gdc.test/compilable/test21177.d
@@ -4,15 +4,19 @@ DISABLED: win
TEST_OUTPUT:
---
compilable/test21177.d(103): Deprecation: more format specifiers than 0 arguments
+compilable/test21177.d(111): Deprecation: more format specifiers than 0 arguments
compilable/test21177.d(150): Deprecation: more format specifiers than 0 arguments
compilable/test21177.d(151): Deprecation: more format specifiers than 0 arguments
compilable/test21177.d(152): Deprecation: more format specifiers than 0 arguments
compilable/test21177.d(153): Deprecation: more format specifiers than 0 arguments
-compilable/test21177.d(200): Deprecation: more format specifiers than 0 arguments
-compilable/test21177.d(203): Deprecation: format specifier `"%m"` is invalid
-compilable/test21177.d(204): Deprecation: format specifier `"%m"` is invalid
-compilable/test21177.d(205): Deprecation: argument `c` for format specification `"%a"` must be `float*`, not `char*`
-compilable/test21177.d(206): Deprecation: argument `c` for format specification `"%a"` must be `float*`, not `char*`
+compilable/test21177.d(154): Deprecation: more format specifiers than 0 arguments
+compilable/test21177.d(155): Deprecation: more format specifiers than 0 arguments
+compilable/test21177.d(202): Deprecation: format specifier `"%m"` is invalid
+compilable/test21177.d(203): Deprecation: argument `d` for format specification `"%mc"` must be `char**`, not `int`
+compilable/test21177.d(204): Deprecation: argument `c` for format specification `"%ms"` must be `char**`, not `char*`
+compilable/test21177.d(205): Deprecation: format specifier `"%ml"` is invalid
+compilable/test21177.d(206): Deprecation: argument `d` for format specification `"%mlc"` must be `wchar_t**`, not `int`
+compilable/test21177.d(207): Deprecation: argument `c` for format specification `"%mls"` must be `wchar_t**`, not `char*`
---
*/
@@ -27,50 +31,45 @@ void main()
#line 100
printf("%m this is a string in errno");
printf("%s %m", "str".ptr, 2);
- printf("%a", 2.);
+ printf("%m %a", 2.);
printf("%m %m %s");
+ printf("%m");
printf("%*m");
-
+ pragma(msg, "compilable/test21177.d(111): Deprecation: more format specifiers than 0 arguments");
+ }
+ else
+ {
+ pragma(msg, "compilable/test21177.d(103): Deprecation: more format specifiers than 0 arguments");
+ printf("%m");
+ }
+ {
char* a, b;
- sscanf("salut poilu", "%a %m", a, b);
+ sscanf("salut poilu", "%ms %m[^\n]", &a, &b);
assert(!strcmp(a, b));
free(a);
free(b);
- char* t, p;
- sscanf("Tomate Patate", "%ms %as", t, p);
+ char* t; wchar_t* p;
+ sscanf("Tomate Patate", "%mc %mlc", &t, &p);
free(t);
free(p);
#line 150
sscanf("150", "%m");
sscanf("151", "%ms");
- sscanf("152", "%a");
- sscanf("153", "%as");
-
- pragma(msg, "compilable/test21177.d(200): Deprecation: more format specifiers than 0 arguments");
- pragma(msg, "compilable/test21177.d(203): Deprecation: format specifier `\"%m\"` is invalid");
- pragma(msg, "compilable/test21177.d(204): Deprecation: format specifier `\"%m\"` is invalid");
- pragma(msg, "compilable/test21177.d(205): Deprecation: argument `c` for format specification `\"%a\"` must be `float*`, not `char*`");
- pragma(msg, "compilable/test21177.d(206): Deprecation: argument `c` for format specification `\"%a\"` must be `float*`, not `char*`");
- }
- else
- {
- // fake it
- pragma(msg, "compilable/test21177.d(103): Deprecation: more format specifiers than 0 arguments");
- pragma(msg, "compilable/test21177.d(150): Deprecation: more format specifiers than 0 arguments");
- pragma(msg, "compilable/test21177.d(151): Deprecation: more format specifiers than 0 arguments");
- pragma(msg, "compilable/test21177.d(152): Deprecation: more format specifiers than 0 arguments");
- pragma(msg, "compilable/test21177.d(153): Deprecation: more format specifiers than 0 arguments");
+ sscanf("152", "%mc");
+ sscanf("153", "%ml");
+ sscanf("154", "%mls");
+ sscanf("155", "%mlc");
#line 200
- printf("%m");
-
char* c;
+ int d;
sscanf("204", "%m", c);
- sscanf("205", "%ms", c);
- sscanf("206", "%a", c);
- sscanf("207", "%as", c);
-
+ sscanf("205", "%mc", d);
+ sscanf("206", "%ms", c);
+ sscanf("207", "%ml", d);
+ sscanf("208", "%mlc", d);
+ sscanf("209", "%mls", c);
}
}
diff --git a/gcc/testsuite/gdc.test/compilable/test21197.d b/gcc/testsuite/gdc.test/compilable/test21197.d
new file mode 100644
index 0000000..01ee66e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test21197.d
@@ -0,0 +1,25 @@
+/* REQUIRED_ARGS: -preview=dip1000
+ */
+// https://issues.dlang.org/show_bug.cgi?id=21197
+
+@safe void check2()
+{
+ int random;
+
+ S create1() return scope {
+ return S();
+ }
+
+ scope S gen1 = create1;
+
+ S create2() {
+ return S(&random);
+ }
+
+ scope S gen2 = create2;
+}
+
+struct S
+{
+ int* r;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test21432.d b/gcc/testsuite/gdc.test/compilable/test21432.d
new file mode 100644
index 0000000..2c83e24
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test21432.d
@@ -0,0 +1,25 @@
+// https://issues.dlang.org/show_bug.cgi?id=21432
+auto issue21432()
+{
+ enum int[] a = [];
+ return a;
+}
+
+enum test21432a = issue21432;
+
+///////////////////////
+
+double issue21432b(double r)
+{
+ enum double[4] poly = [
+ 0x1.ffffffffffdbdp-2,
+ 0x1.555555555543cp-3,
+ 0x1.55555cf172b91p-5,
+ 0x1.1111167a4d017p-7,
+ ];
+
+ immutable r2 = r * r;
+ return r + r2 * (poly[0] + r * poly[1]) + r2 * r2 * (poly[2] + r * poly[3]);
+}
+
+enum test21432b = issue21432b(-0x1p-1);
diff --git a/gcc/testsuite/gdc.test/compilable/test22390.d b/gcc/testsuite/gdc.test/compilable/test22390.d
new file mode 100644
index 0000000..f045416c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test22390.d
@@ -0,0 +1,8 @@
+// https://issues.dlang.org/show_bug.cgi?id=22390
+
+int main()
+{
+ noreturn[] empty;
+ assert(empty == empty);
+ return 0;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test23082.d b/gcc/testsuite/gdc.test/compilable/test23082.d
new file mode 100644
index 0000000..9df4e4e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test23082.d
@@ -0,0 +1,17 @@
+// https://issues.dlang.org/show_bug.cgi?id=23082
+
+/*
+TEST_OUTPUT:
+---
+bar
+---
+*/
+
+void foo()() {}
+alias bar = foo;
+void bar() { }
+
+void main()
+{
+ pragma(msg, __traits(parent, main).bar.stringof);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test23166.d b/gcc/testsuite/gdc.test/compilable/test23166.d
new file mode 100644
index 0000000..66da4cd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test23166.d
@@ -0,0 +1,22 @@
+// REQUIRED_ARGS: -inline
+
+// https://issues.dlang.org/show_bug.cgi?id=23166
+
+// seg fault with -inline
+
+bool __equals(scope const char[] lhs, scope const char[] rhs)
+{
+ if (lhs.length != rhs.length)
+ return false;
+
+ {
+ import core.stdc.string : memcmp;
+ return lhs.length == 0;
+ }
+ return true;
+}
+
+int test(string type)
+{
+ return __equals(type, "as-is");
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test23172.d b/gcc/testsuite/gdc.test/compilable/test23172.d
new file mode 100644
index 0000000..18b6d4c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test23172.d
@@ -0,0 +1,33 @@
+// https://issues.dlang.org/show_bug.cgi?id=23172
+
+enum E : ubyte { // `ubyte` is needed to trigger the bug
+ A,
+ B,
+}
+
+struct S {
+ E e;
+}
+
+void compiles(bool b, S s) {
+ E e = b ? E.A : s.e;
+}
+
+void errors(bool b, const ref S s) {
+ E e = b ? E.A : s.e;
+}
+
+// from https://issues.dlang.org/show_bug.cgi?id=23188
+
+enum Status : byte
+{
+ A, B, C
+}
+
+Status foo()
+{
+ Status t = Status.A;
+ const Status s = t;
+
+ return (s == Status.A) ? Status.B : s; // <-- here
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test23235.d b/gcc/testsuite/gdc.test/compilable/test23235.d
new file mode 100644
index 0000000..99772ad
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test23235.d
@@ -0,0 +1,20 @@
+/* https://issues.dlang.org/show_bug.cgi?id=23235
+ */
+
+@safe:
+
+void awkk(string[] ppp...)
+{
+}
+
+void bark(string[] foo...) {
+ awkk(foo);
+}
+
+void cack(string[] bar...) {
+ bark(bar);
+}
+
+void test() {
+ cack("abc", "def");
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test23256.d b/gcc/testsuite/gdc.test/compilable/test23256.d
new file mode 100644
index 0000000..1e57201
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test23256.d
@@ -0,0 +1,6 @@
+/* REQUIRED_ARGS: -os=windows
+ */
+
+// https://issues.dlang.org/show_bug.cgi?id=23256
+
+void test23256() { }
diff --git a/gcc/testsuite/gdc.test/compilable/test23262.d b/gcc/testsuite/gdc.test/compilable/test23262.d
new file mode 100644
index 0000000..96da272
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test23262.d
@@ -0,0 +1,17 @@
+/* https://issues.dlang.org/show_bug.cgi?id=23262
+ */
+
+struct T()
+{
+ string[] tags;
+
+ this(string[] tags...)
+ {
+ this.tags = tags; // don't infer `return` attribute for `tags`
+ }
+}
+
+void test()
+{
+ T!() t;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/testgotoskips.d b/gcc/testsuite/gdc.test/compilable/testgotoskips.d
new file mode 100644
index 0000000..659b5f7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testgotoskips.d
@@ -0,0 +1,17 @@
+/*
+ Tests to defend against false positives from the goto skips over decl errors
+*/
+// https://issues.dlang.org/show_bug.cgi?id=23271
+class A {
+ private static A[] active;
+ private void test() {
+ foreach(a; active) {
+ if(a is this)
+ goto label;
+ }
+ // used to say Error: `goto` skips declaration of variable `s.A.test.__appendtmp4` at s.d(...)
+ active ~= this;
+ label:
+ return;
+ }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/uda.d b/gcc/testsuite/gdc.test/compilable/uda.d
index ac66c2f..aa6277b 100644
--- a/gcc/testsuite/gdc.test/compilable/uda.d
+++ b/gcc/testsuite/gdc.test/compilable/uda.d
@@ -6,3 +6,9 @@ struct foo { }
@foo bar () { }
/************************************************/
+
+// https://issues.dlang.org/show_bug.cgi?id=23241
+
+alias feynman = int;
+enum get = __traits(getAttributes, feynman);
+static assert(get.length == 0);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/aliasassign2.d b/gcc/testsuite/gdc.test/fail_compilation/aliasassign2.d
new file mode 100644
index 0000000..dd421c9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/aliasassign2.d
@@ -0,0 +1,33 @@
+/* TEST_OUTPUT:
+---
+fail_compilation/aliasassign2.d(16): Error: `alias aa1 = aa1;` cannot alias itself, use a qualified name to create an overload set
+fail_compilation/aliasassign2.d(19): Error: template instance `aliasassign2.Tp1!()` error instantiating
+fail_compilation/aliasassign2.d(24): Error: undefined identifier `unknown`
+fail_compilation/aliasassign2.d(26): Error: template instance `aliasassign2.Tp2!()` error instantiating
+fail_compilation/aliasassign2.d(31): Error: template instance `AliasSeqX!(aa3, 1)` template `AliasSeqX` is not defined, did you mean AliasSeq(T...)?
+fail_compilation/aliasassign2.d(33): Error: template instance `aliasassign2.Tp3!()` error instantiating
+---
+*/
+
+alias AliasSeq(T...) = T;
+
+template Tp1()
+{
+ alias aa1 = aa1;
+ aa1 = AliasSeq!(aa1, float);
+}
+alias a1 = Tp1!();
+
+template Tp2()
+{
+ alias aa2 = AliasSeq!();
+ aa2 = AliasSeq!(aa2, unknown);
+}
+alias a2 = Tp2!();
+
+template Tp3()
+{
+ alias aa3 = AliasSeq!();
+ aa3 = AliasSeqX!(aa3, 1);
+}
+alias a3 = Tp3!();
diff --git a/gcc/testsuite/gdc.test/fail_compilation/attributediagnostic.d b/gcc/testsuite/gdc.test/fail_compilation/attributediagnostic.d
index 1fdf5a5..8360e1a 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/attributediagnostic.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/attributediagnostic.d
@@ -1,12 +1,20 @@
/*
TEST_OUTPUT:
---
-fail_compilation/attributediagnostic.d(16): Error: `@safe` function `attributediagnostic.layer2` cannot call `@system` function `attributediagnostic.layer1`
-fail_compilation/attributediagnostic.d(18): which calls `attributediagnostic.layer0`
-fail_compilation/attributediagnostic.d(20): which calls `attributediagnostic.system`
-fail_compilation/attributediagnostic.d(22): which was inferred `@system` because of:
-fail_compilation/attributediagnostic.d(22): `asm` statement is assumed to be `@system` - mark it with `@trusted` if it is not
-fail_compilation/attributediagnostic.d(17): `attributediagnostic.layer1` is declared here
+fail_compilation/attributediagnostic.d(24): Error: `@safe` function `attributediagnostic.layer2` cannot call `@system` function `attributediagnostic.layer1`
+fail_compilation/attributediagnostic.d(26): which calls `attributediagnostic.layer0`
+fail_compilation/attributediagnostic.d(28): which calls `attributediagnostic.system`
+fail_compilation/attributediagnostic.d(30): which was inferred `@system` because of:
+fail_compilation/attributediagnostic.d(30): `asm` statement is assumed to be `@system` - mark it with `@trusted` if it is not
+fail_compilation/attributediagnostic.d(25): `attributediagnostic.layer1` is declared here
+fail_compilation/attributediagnostic.d(46): Error: `@safe` function `D main` cannot call `@system` function `attributediagnostic.system1`
+fail_compilation/attributediagnostic.d(35): which was inferred `@system` because of:
+fail_compilation/attributediagnostic.d(35): cast from `uint` to `int*` not allowed in safe code
+fail_compilation/attributediagnostic.d(33): `attributediagnostic.system1` is declared here
+fail_compilation/attributediagnostic.d(47): Error: `@safe` function `D main` cannot call `@system` function `attributediagnostic.system2`
+fail_compilation/attributediagnostic.d(41): which was inferred `@system` because of:
+fail_compilation/attributediagnostic.d(41): `@safe` function `system2` cannot call `@system` `fsys`
+fail_compilation/attributediagnostic.d(39): `attributediagnostic.system2` is declared here
---
*/
@@ -19,5 +27,22 @@ auto layer0() { system(); }
auto system()
{
- asm {}
+ asm {}
+}
+
+auto system1()
+{
+ int* x = cast(int*) 0xDEADBEEF;
+}
+
+auto fsys = function void() @system {};
+auto system2()
+{
+ fsys();
+}
+
+void main() @safe
+{
+ system1();
+ system2();
}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/chkformat.d b/gcc/testsuite/gdc.test/fail_compilation/chkformat.d
index e9ed241..fa8915e 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/chkformat.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/chkformat.d
@@ -169,3 +169,21 @@ void test409() { char* p; printf("%llu", p); }
void test410() { char* p; printf("%lld", p); }
void test411() { char* p; printf("%ju", p); }
void test412() { char* p; printf("%jd", p); }
+
+/* https://issues.dlang.org/show_bug.cgi?id=23247
+TEST_OUTPUT:
+---
+fail_compilation/chkformat.d(501): Deprecation: argument `p` for format specification `"%a"` must be `double`, not `char*`
+fail_compilation/chkformat.d(502): Deprecation: argument `p` for format specification `"%La"` must be `real`, not `char*`
+fail_compilation/chkformat.d(503): Deprecation: argument `p` for format specification `"%a"` must be `float*`, not `char*`
+fail_compilation/chkformat.d(504): Deprecation: argument `p` for format specification `"%la"` must be `double*`, not `char*`
+fail_compilation/chkformat.d(505): Deprecation: argument `p` for format specification `"%La"` must be `real*`, not `char*`
+---
+*/
+#line 500
+
+void test501() { char* p; printf("%a", p); }
+void test502() { char* p; printf("%La", p); }
+void test503() { char* p; scanf("%a", p); }
+void test504() { char* p; scanf("%la", p); }
+void test505() { char* p; scanf("%La", p); }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10319.d b/gcc/testsuite/gdc.test/fail_compilation/diag10319.d
index 416d563..7b2eca7 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/diag10319.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag10319.d
@@ -1,15 +1,17 @@
/*
TEST_OUTPUT:
---
-fail_compilation/diag10319.d(27): Error: `pure` function `D main` cannot call impure function `diag10319.foo`
-fail_compilation/diag10319.d(27): Error: `@safe` function `D main` cannot call `@system` function `diag10319.foo`
-fail_compilation/diag10319.d(16): `diag10319.foo` is declared here
-fail_compilation/diag10319.d(28): Error: `pure` function `D main` cannot call impure function `diag10319.bar!int.bar`
-fail_compilation/diag10319.d(28): Error: `@safe` function `D main` cannot call `@system` function `diag10319.bar!int.bar`
-fail_compilation/diag10319.d(18): `diag10319.bar!int.bar` is declared here
-fail_compilation/diag10319.d(27): Error: function `diag10319.foo` is not `nothrow`
-fail_compilation/diag10319.d(28): Error: function `diag10319.bar!int.bar` is not `nothrow`
-fail_compilation/diag10319.d(25): Error: function `D main` may throw but is marked as `nothrow`
+fail_compilation/diag10319.d(29): Error: `pure` function `D main` cannot call impure function `diag10319.foo`
+fail_compilation/diag10319.d(29): Error: `@safe` function `D main` cannot call `@system` function `diag10319.foo`
+fail_compilation/diag10319.d(18): `diag10319.foo` is declared here
+fail_compilation/diag10319.d(30): Error: `pure` function `D main` cannot call impure function `diag10319.bar!int.bar`
+fail_compilation/diag10319.d(30): Error: `@safe` function `D main` cannot call `@system` function `diag10319.bar!int.bar`
+fail_compilation/diag10319.d(23): which was inferred `@system` because of:
+fail_compilation/diag10319.d(23): cannot take address of local `x` in `@safe` function `bar`
+fail_compilation/diag10319.d(20): `diag10319.bar!int.bar` is declared here
+fail_compilation/diag10319.d(29): Error: function `diag10319.foo` is not `nothrow`
+fail_compilation/diag10319.d(30): Error: function `diag10319.bar!int.bar` is not `nothrow`
+fail_compilation/diag10319.d(27): Error: function `D main` may throw but is marked as `nothrow`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag11198.d b/gcc/testsuite/gdc.test/fail_compilation/diag11198.d
index 279d62a..1be0f1e 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/diag11198.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag11198.d
@@ -1,12 +1,14 @@
/*
TEST_OUTPUT:
---
-fail_compilation/diag11198.d(15): Error: version `blah` declaration must be at module level
-fail_compilation/diag11198.d(16): Error: debug `blah` declaration must be at module level
-fail_compilation/diag11198.d(17): Error: version `1` level declaration must be at module level
-fail_compilation/diag11198.d(18): Error: debug `2` level declaration must be at module level
-fail_compilation/diag11198.d(19): Error: identifier or integer expected, not `""`
-fail_compilation/diag11198.d(20): Error: identifier or integer expected, not `""`
+fail_compilation/diag11198.d(17): Error: version `blah` declaration must be at module level
+fail_compilation/diag11198.d(18): Error: debug `blah` declaration must be at module level
+fail_compilation/diag11198.d(19): Deprecation: `version = <integer>` is deprecated, use version identifiers instead
+fail_compilation/diag11198.d(19): Error: version `1` level declaration must be at module level
+fail_compilation/diag11198.d(20): Deprecation: `debug = <integer>` is deprecated, use debug identifiers instead
+fail_compilation/diag11198.d(20): Error: debug `2` level declaration must be at module level
+fail_compilation/diag11198.d(21): Error: identifier or integer expected, not `""`
+fail_compilation/diag11198.d(22): Error: identifier or integer expected, not `""`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag12829.d b/gcc/testsuite/gdc.test/fail_compilation/diag12829.d
index f6e764b..1d37a1e 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/diag12829.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag12829.d
@@ -1,11 +1,11 @@
/*
TEST_OUTPUT:
---
-fail_compilation/diag12829.d(12): Error: function `diag12829.test1` is `@nogc` yet allocates closures with the GC
-fail_compilation/diag12829.d(15): diag12829.test1.__lambda2 closes over variable x at fail_compilation/diag12829.d(14)
-fail_compilation/diag12829.d(19): diag12829.test1.bar closes over variable x at fail_compilation/diag12829.d(14)
-fail_compilation/diag12829.d(26): Error: function `diag12829.test2` is `@nogc` yet allocates closures with the GC
-fail_compilation/diag12829.d(31): diag12829.test2.S.foo closes over variable x at fail_compilation/diag12829.d(28)
+fail_compilation/diag12829.d(12): Error: function `diag12829.test1` is `@nogc` yet allocates closure for `test1()` with the GC
+fail_compilation/diag12829.d(15): `diag12829.test1.__lambda2` closes over variable `x` at fail_compilation/diag12829.d(14)
+fail_compilation/diag12829.d(19): `diag12829.test1.bar` closes over variable `x` at fail_compilation/diag12829.d(14)
+fail_compilation/diag12829.d(26): Error: function `diag12829.test2` is `@nogc` yet allocates closure for `test2()` with the GC
+fail_compilation/diag12829.d(31): `diag12829.test2.S.foo` closes over variable `x` at fail_compilation/diag12829.d(28)
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag23295.d b/gcc/testsuite/gdc.test/fail_compilation/diag23295.d
new file mode 100644
index 0000000..a0bfe88
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag23295.d
@@ -0,0 +1,40 @@
+/*
+REQUIRED_ARGS: -preview=dip1000
+TEST_OUTPUT:
+---
+fail_compilation/diag23295.d(21): Error: scope variable `x` assigned to non-scope parameter `y` calling `foo`
+fail_compilation/diag23295.d(32): which is assigned to non-scope parameter `z`
+fail_compilation/diag23295.d(34): which is not `scope` because of `f = & z`
+fail_compilation/diag23295.d(24): Error: scope variable `ex` assigned to non-scope parameter `e` calling `thro`
+fail_compilation/diag23295.d(39): which is not `scope` because of `throw e`
+---
+*/
+
+// explain why scope inference failed
+// https://issues.dlang.org/show_bug.cgi?id=23295
+
+@safe:
+
+void main()
+{
+ scope int* x;
+ foo(x, null);
+
+ scope Exception ex;
+ thro(ex);
+}
+
+auto foo(int* y, int** w)
+{
+ fooImpl(y, null);
+}
+
+auto fooImpl(int* z, int** w)
+{
+ auto f = &z;
+}
+
+auto thro(Exception e)
+{
+ throw e;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10968.d b/gcc/testsuite/gdc.test/fail_compilation/fail10968.d
index d9f554a..e969b24 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail10968.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail10968.d
@@ -1,26 +1,27 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail10968.d(41): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.__postblit`
-fail_compilation/fail10968.d(41): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.__postblit`
-fail_compilation/fail10968.d(29): `fail10968.SA.__postblit` is declared here
fail_compilation/fail10968.d(42): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.__postblit`
fail_compilation/fail10968.d(42): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.__postblit`
-fail_compilation/fail10968.d(29): `fail10968.SA.__postblit` is declared here
+fail_compilation/fail10968.d(30): `fail10968.SA.__postblit` is declared here
fail_compilation/fail10968.d(43): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.__postblit`
fail_compilation/fail10968.d(43): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.__postblit`
-fail_compilation/fail10968.d(29): `fail10968.SA.__postblit` is declared here
-fail_compilation/fail10968.d(46): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.__postblit`
-fail_compilation/fail10968.d(46): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.__postblit`
-fail_compilation/fail10968.d(29): `fail10968.SA.__postblit` is declared here
+fail_compilation/fail10968.d(30): `fail10968.SA.__postblit` is declared here
+fail_compilation/fail10968.d(44): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.__postblit`
+fail_compilation/fail10968.d(44): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.__postblit`
+fail_compilation/fail10968.d(30): `fail10968.SA.__postblit` is declared here
+fail_compilation/fail10968.d(44): Error: `pure` function `fail10968.bar` cannot call impure function `core.internal.array.arrayassign._d_arrayassign_l!(SA[], SA)._d_arrayassign_l`
fail_compilation/fail10968.d(47): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.__postblit`
fail_compilation/fail10968.d(47): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.__postblit`
-fail_compilation/fail10968.d(29): `fail10968.SA.__postblit` is declared here
-fail_compilation/fail10968.d(47): Error: `pure` function `fail10968.bar` cannot call impure function `core.internal.array.construction._d_arraysetctor!(SA[], SA)._d_arraysetctor`
+fail_compilation/fail10968.d(30): `fail10968.SA.__postblit` is declared here
fail_compilation/fail10968.d(48): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.__postblit`
fail_compilation/fail10968.d(48): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.__postblit`
-fail_compilation/fail10968.d(29): `fail10968.SA.__postblit` is declared here
-fail_compilation/fail10968.d(48): Error: `pure` function `fail10968.bar` cannot call impure function `core.internal.array.construction._d_arrayctor!(SA[], SA)._d_arrayctor`
+fail_compilation/fail10968.d(30): `fail10968.SA.__postblit` is declared here
+fail_compilation/fail10968.d(48): Error: `pure` function `fail10968.bar` cannot call impure function `core.internal.array.construction._d_arraysetctor!(SA[], SA)._d_arraysetctor`
+fail_compilation/fail10968.d(49): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.__postblit`
+fail_compilation/fail10968.d(49): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.__postblit`
+fail_compilation/fail10968.d(30): `fail10968.SA.__postblit` is declared here
+fail_compilation/fail10968.d(49): Error: `pure` function `fail10968.bar` cannot call impure function `core.internal.array.construction._d_arrayctor!(SA[], SA)._d_arrayctor`
---
*/
@@ -51,12 +52,12 @@ void bar() pure @safe
/*
TEST_OUTPUT:
---
-fail_compilation/fail10968.d(74): Error: struct `fail10968.SD` is not copyable because it has a disabled postblit
fail_compilation/fail10968.d(75): Error: struct `fail10968.SD` is not copyable because it has a disabled postblit
fail_compilation/fail10968.d(76): Error: struct `fail10968.SD` is not copyable because it has a disabled postblit
-fail_compilation/fail10968.d(79): Error: struct `fail10968.SD` is not copyable because it has a disabled postblit
+fail_compilation/fail10968.d(77): Error: struct `fail10968.SD` is not copyable because it has a disabled postblit
fail_compilation/fail10968.d(80): Error: struct `fail10968.SD` is not copyable because it has a disabled postblit
fail_compilation/fail10968.d(81): Error: struct `fail10968.SD` is not copyable because it has a disabled postblit
+fail_compilation/fail10968.d(82): Error: struct `fail10968.SD` is not copyable because it has a disabled postblit
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail118.d b/gcc/testsuite/gdc.test/fail_compilation/fail118.d
index 3df797d..a526b90 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail118.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail118.d
@@ -1,15 +1,17 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail118.d(43): Error: invalid `foreach` aggregate `Iter` of type `Iter`
-fail_compilation/fail118.d(43): maybe define `opApply()`, range primitives, or use `.tupleof`
-fail_compilation/fail118.d(44): Error: invalid `foreach` aggregate `Iter` of type `Iter`
-fail_compilation/fail118.d(44): maybe define `opApply()`, range primitives, or use `.tupleof`
-fail_compilation/fail118.d(47): Error: invalid `foreach` aggregate `s` of type `S*`
-fail_compilation/fail118.d(49): Error: undefined identifier `unknown`
-fail_compilation/fail118.d(37): Error: undefined identifier `doesNotExist`
-fail_compilation/fail118.d(51): Error: template instance `fail118.error!()` error instantiating
-fail_compilation/fail118.d(51): Error: invalid `foreach` aggregate `error()` of type `void`
+fail_compilation/fail118.d(45): Error: invalid `foreach` aggregate `Iter` of type `Iter`
+fail_compilation/fail118.d(45): `foreach` works with input ranges (implementing `front` and `popFront`), aggregates implementing `opApply`, or the result of an aggregate's `.tupleof` property
+fail_compilation/fail118.d(45): https://dlang.org/phobos/std_range_primitives.html#isInputRange
+fail_compilation/fail118.d(46): Error: invalid `foreach` aggregate `Iter` of type `Iter`
+fail_compilation/fail118.d(46): `foreach` works with input ranges (implementing `front` and `popFront`), aggregates implementing `opApply`, or the result of an aggregate's `.tupleof` property
+fail_compilation/fail118.d(46): https://dlang.org/phobos/std_range_primitives.html#isInputRange
+fail_compilation/fail118.d(49): Error: invalid `foreach` aggregate `s` of type `S*`
+fail_compilation/fail118.d(51): Error: undefined identifier `unknown`
+fail_compilation/fail118.d(39): Error: undefined identifier `doesNotExist`
+fail_compilation/fail118.d(53): Error: template instance `fail118.error!()` error instantiating
+fail_compilation/fail118.d(53): Error: invalid `foreach` aggregate `error()` of type `void`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail14669.d b/gcc/testsuite/gdc.test/fail_compilation/fail14669.d
index be72663..5621ecc 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail14669.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail14669.d
@@ -20,9 +20,9 @@ void test1()
/*
TEST_OUTPUT:
---
-fail_compilation/fail14669.d(29): Error: `auto` can only be used as part of `auto ref` for template function parameters
+fail_compilation/fail14669.d(29): Error: cannot explicitly instantiate template function with `auto ref` parameter
fail_compilation/fail14669.d(38): Error: template instance `fail14669.bar1!int` error instantiating
-fail_compilation/fail14669.d(30): Error: `auto` can only be used as part of `auto ref` for template function parameters
+fail_compilation/fail14669.d(30): Error: cannot explicitly instantiate template function with `auto ref` parameter
fail_compilation/fail14669.d(40): Error: template instance `fail14669.bar2!int` error instantiating
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail20547.d b/gcc/testsuite/gdc.test/fail_compilation/fail20547.d
deleted file mode 100644
index c14977d..0000000
--- a/gcc/testsuite/gdc.test/fail_compilation/fail20547.d
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
-TEST_OUTPUT:
----
-fail_compilation/fail20547.d(12): Error: cannot create a `string[string]` with `new`
-fail_compilation/fail20547.d(14): Error: cannot create a `string[string]` with `new`
----
-*/
-
-void main()
-{
- //https://issues.dlang.org/show_bug.cgi?id=11790
- string[string] crash = new string[string];
- //https://issues.dlang.org/show_bug.cgi?id=20547
- int[string] c = new typeof(crash);
-}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail22134.d b/gcc/testsuite/gdc.test/fail_compilation/fail22134.d
new file mode 100644
index 0000000..5a4933e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail22134.d
@@ -0,0 +1,17 @@
+// https://issues.dlang.org/show_bug.cgi?id=22134
+/* REQUIRED_ARGS: -de
+TEST_OUTPUT:
+---
+fail_compilation/fail22134.d(12): Deprecation: `this.arr[i]` has no effect
+---
+*/
+struct StackBuffer
+{
+ auto opIndex(size_t i)
+ {
+ return arr[i];
+ }
+
+private:
+ void[] arr;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail23181.d b/gcc/testsuite/gdc.test/fail_compilation/fail23181.d
new file mode 100644
index 0000000..519244c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail23181.d
@@ -0,0 +1,16 @@
+/* https://issues.dlang.org/show_bug.cgi?id=23181
+TEST_OUTPUT:
+---
+$p:druntime/import/core/lifetime.d$($n$): Error: struct `fail23181.fail23181.NoPostblit` is not copyable because it has a disabled postblit
+$p:druntime/import/core/internal/array/construction.d$($n$): Error: template instance `core.lifetime.copyEmplace!(NoPostblit, NoPostblit)` error instantiating
+fail_compilation/fail23181.d(15): instantiated from here: `_d_arraysetctor!(NoPostblit[], NoPostblit)`
+---
+*/
+void fail23181()
+{
+ struct NoPostblit
+ {
+ @disable this(this);
+ }
+ NoPostblit[4] noblit23181 = NoPostblit();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail261.d b/gcc/testsuite/gdc.test/fail_compilation/fail261.d
index 85da957..d807dc8 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail261.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail261.d
@@ -1,8 +1,9 @@
/*
TEST_OUTPUT:
---
-fail_compilation/fail261.d(19): Error: invalid `foreach` aggregate `range` of type `MyRange`
-fail_compilation/fail261.d(19): maybe define `opApply()`, range primitives, or use `.tupleof`
+fail_compilation/fail261.d(20): Error: invalid `foreach` aggregate `range` of type `MyRange`
+fail_compilation/fail261.d(20): `foreach` works with input ranges (implementing `front` and `popFront`), aggregates implementing `opApply`, or the result of an aggregate's `.tupleof` property
+fail_compilation/fail261.d(20): https://dlang.org/phobos/std_range_primitives.html#isInputRange
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail58.d b/gcc/testsuite/gdc.test/fail_compilation/fail58.d
index 1557055..89b2351 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail58.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail58.d
@@ -7,7 +7,7 @@ fail_compilation/fail58.d(30): Error: function `fail58.SomeFunc(dchar[] pText, o
fail_compilation/fail58.d(30): cannot pass argument `""` of type `string` to parameter `dchar[] pText`
---
*/
-debug(1) import std.stdio;
+debug import std.stdio;
const int anything = -1000; // Line #2
dchar[] SomeFunc( dchar[] pText, out int pStopPosn)
{
@@ -15,7 +15,7 @@ dchar[] SomeFunc( dchar[] pText, out int pStopPosn)
pStopPosn = 0;
else
pStopPosn = -1;
- debug(1) writefln("DEBUG: using '%s' we get %d", pText, pStopPosn);
+ debug writefln("DEBUG: using '%s' we get %d", pText, pStopPosn);
return pText.dup;
}
@@ -24,12 +24,12 @@ int main(char[][] pArgs)
int sp;
SomeFunc("123", sp);
- debug(1) writefln("DEBUG: got %d", sp);
+ debug writefln("DEBUG: got %d", sp);
assert(sp == -1);
SomeFunc("", sp);
// if (sp != 0){} // Line #22
- debug(1) writefln("DEBUG: got %d", sp);
+ debug writefln("DEBUG: got %d", sp);
assert(sp == -1);
return 0;
}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6889.d b/gcc/testsuite/gdc.test/fail_compilation/fail6889.d
index aa18977..ee84a84 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail6889.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail6889.d
@@ -55,7 +55,7 @@ L1:
scope(failure) { L2: goto L1; } // OK
goto L2; // NG
- scope(failure) { return; } // OK
+
foreach (i; 0..1)
{
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7848.d b/gcc/testsuite/gdc.test/fail_compilation/fail7848.d
index e8371c4..001c7d7 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail7848.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7848.d
@@ -9,12 +9,12 @@ fail_compilation/fail7848.d(21): `fail7848.func` is declared here
fail_compilation/fail7848.d(27): Error: `@nogc` function `fail7848.C.__unittest_L25_C30` cannot call non-@nogc function `fail7848.func`
fail_compilation/fail7848.d(27): Error: function `fail7848.func` is not `nothrow`
fail_compilation/fail7848.d(25): Error: function `fail7848.C.__unittest_L25_C30` may throw but is marked as `nothrow`
-fail_compilation/fail7848.d(32): Error: `pure` function `fail7848.C.__invariant1` cannot call impure function `fail7848.func`
-fail_compilation/fail7848.d(32): Error: `@safe` function `fail7848.C.__invariant1` cannot call `@system` function `fail7848.func`
+fail_compilation/fail7848.d(32): Error: `pure` function `fail7848.C.__invariant0` cannot call impure function `fail7848.func`
+fail_compilation/fail7848.d(32): Error: `@safe` function `fail7848.C.__invariant0` cannot call `@system` function `fail7848.func`
fail_compilation/fail7848.d(21): `fail7848.func` is declared here
-fail_compilation/fail7848.d(32): Error: `@nogc` function `fail7848.C.__invariant1` cannot call non-@nogc function `fail7848.func`
+fail_compilation/fail7848.d(32): Error: `@nogc` function `fail7848.C.__invariant0` cannot call non-@nogc function `fail7848.func`
fail_compilation/fail7848.d(32): Error: function `fail7848.func` is not `nothrow`
-fail_compilation/fail7848.d(30): Error: function `fail7848.C.__invariant1` may throw but is marked as `nothrow`
+fail_compilation/fail7848.d(30): Error: function `fail7848.C.__invariant0` may throw but is marked as `nothrow`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11856_1.d b/gcc/testsuite/gdc.test/fail_compilation/ice11856_1.d
index d2a1d1d..24e39da 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/ice11856_1.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11856_1.d
@@ -1,8 +1,11 @@
/*
TEST_OUTPUT:
---
-fail_compilation/ice11856_1.d(13): Error: none of the overloads of template `ice11856_1.g` are callable using argument types `!()(A)`
-fail_compilation/ice11856_1.d(11): Candidate is: `g(T)(T x)`
+fail_compilation/ice11856_1.d(16): Error: none of the overloads of template `ice11856_1.g` are callable using argument types `!()(A)`
+fail_compilation/ice11856_1.d(14): Candidate is: `g(T)(T x)`
+ with `T = A`
+ must satisfy the following constraint:
+` is(typeof(x.f()))`
---
*/
struct A {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice8795.d b/gcc/testsuite/gdc.test/fail_compilation/ice8795.d
index 5d7d6dd..a30a65b 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/ice8795.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice8795.d
@@ -3,7 +3,7 @@ TEST_OUTPUT:
---
fail_compilation/ice8795.d-mixin-14(14): Error: found `End of File` when expecting `(`
fail_compilation/ice8795.d-mixin-14(14): Error: expression expected, not `End of File`
-fail_compilation/ice8795.d-mixin-14(14): Error: found `End of File` when expecting `)`
+fail_compilation/ice8795.d-mixin-14(14): Error: missing closing `)` after `switch (0`
fail_compilation/ice8795.d-mixin-14(14): Error: found `End of File` instead of statement
fail_compilation/ice8795.d-mixin-15(15): Error: { } expected following `interface` declaration
fail_compilation/ice8795.d-mixin-15(15): Error: anonymous interfaces not allowed
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/import15525.d b/gcc/testsuite/gdc.test/fail_compilation/imports/import15525.d
new file mode 100644
index 0000000..9c05e7c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/import15525.d
@@ -0,0 +1,3 @@
+module imports.import15525;
+
+template Tuple{ static if }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/issue12652.d b/gcc/testsuite/gdc.test/fail_compilation/issue12652.d
new file mode 100644
index 0000000..0ddd6b4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/issue12652.d
@@ -0,0 +1,24 @@
+/*
+TEST_OUTPUT:
+----
+fail_compilation/issue12652.d(18): Error: static initializations of associative arrays is not allowed.
+fail_compilation/issue12652.d(18): associative arrays must be initialized at runtime: https://dlang.org/spec/hash-map.html#runtime_initialization
+---
+*/
+
+enum A
+{
+ x,
+ y,
+ z
+}
+
+struct S
+{
+ string[A] t = [A.x : "aaa", A.y : "bbb"];
+}
+
+void main ()
+{
+ S s;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/misc_parser_err_cov1.d b/gcc/testsuite/gdc.test/fail_compilation/misc_parser_err_cov1.d
index 22cf392..b50a616 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/misc_parser_err_cov1.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/misc_parser_err_cov1.d
@@ -10,7 +10,6 @@ fail_compilation/misc_parser_err_cov1.d(31): Error: expression expected, not `)`
fail_compilation/misc_parser_err_cov1.d(32): Error: `type identifier : specialization` expected following `is`
fail_compilation/misc_parser_err_cov1.d(33): Error: semicolon expected following auto declaration, not `auto`
fail_compilation/misc_parser_err_cov1.d(33): Error: found `+` when expecting `(` following `mixin`
-fail_compilation/misc_parser_err_cov1.d(34): Error: cannot create a `char[float]` with `new`
fail_compilation/misc_parser_err_cov1.d(35): Error: `key:value` expected for associative array literal
fail_compilation/misc_parser_err_cov1.d(36): Error: basic type expected, not `;`
fail_compilation/misc_parser_err_cov1.d(36): Error: `{ members }` expected for anonymous class
@@ -44,7 +43,7 @@ void main()
auto tt = __traits(<o<);
auto b = is ;
auto mx1 = mixin +);
- auto aa1 = new char[float];
+
aa += [key:value, key];
auto anon1 = new class;
auto anon2 = new class {};
diff --git a/gcc/testsuite/gdc.test/fail_compilation/newaa.d b/gcc/testsuite/gdc.test/fail_compilation/newaa.d
new file mode 100644
index 0000000..ebc23fb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/newaa.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/newaa.d(14): Error: cannot implicitly convert expression `new string[string]` of type `string[string]` to `int[string]`
+fail_compilation/newaa.d(15): Error: function expected before `()`, not `new int[int]` of type `int[int]`
+fail_compilation/newaa.d(17): Error: `new` cannot take arguments for an associative array
+---
+*/
+#line 9
+void main()
+{
+ //https://issues.dlang.org/show_bug.cgi?id=11790
+ string[string] crash = new string[string];
+ //https://issues.dlang.org/show_bug.cgi?id=20547
+ int[string] c = new typeof(crash);
+ auto d = new int[int](5);
+ alias AA = char[string];
+ auto e = new AA(5);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/nogc3.d b/gcc/testsuite/gdc.test/fail_compilation/nogc3.d
index fdc3cde..3bd7167 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/nogc3.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/nogc3.d
@@ -43,10 +43,10 @@ fail_compilation/nogc3.d(35): Error: `@nogc` function `nogc3.testCall` cannot ca
/*
TEST_OUTPUT:
---
-fail_compilation/nogc3.d(52): Error: function `nogc3.testClosure1` is `@nogc` yet allocates closures with the GC
-fail_compilation/nogc3.d(55): nogc3.testClosure1.bar closes over variable x at fail_compilation/nogc3.d(54)
-fail_compilation/nogc3.d(64): Error: function `nogc3.testClosure3` is `@nogc` yet allocates closures with the GC
-fail_compilation/nogc3.d(67): nogc3.testClosure3.bar closes over variable x at fail_compilation/nogc3.d(66)
+fail_compilation/nogc3.d(52): Error: function `nogc3.testClosure1` is `@nogc` yet allocates closure for `testClosure1()` with the GC
+fail_compilation/nogc3.d(55): `nogc3.testClosure1.bar` closes over variable `x` at fail_compilation/nogc3.d(54)
+fail_compilation/nogc3.d(64): Error: function `nogc3.testClosure3` is `@nogc` yet allocates closure for `testClosure3()` with the GC
+fail_compilation/nogc3.d(67): `nogc3.testClosure3.bar` closes over variable `x` at fail_compilation/nogc3.d(66)
---
*/
@nogc auto testClosure1()
diff --git a/gcc/testsuite/gdc.test/fail_compilation/retscope.d b/gcc/testsuite/gdc.test/fail_compilation/retscope.d
index 9394404..2a69fe0 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/retscope.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/retscope.d
@@ -54,8 +54,8 @@ void test2(scope int* p, int[] a ...) @safe
/*
TEST_OUTPUT:
---
-fail_compilation/retscope.d(75): Error: function `retscope.HTTP.Impl.onReceive` is `@nogc` yet allocates closures with the GC
-fail_compilation/retscope.d(77): retscope.HTTP.Impl.onReceive.__lambda1 closes over variable this at fail_compilation/retscope.d(75)
+fail_compilation/retscope.d(75): Error: function `retscope.HTTP.Impl.onReceive` is `@nogc` yet allocates closure for `onReceive()` with the GC
+fail_compilation/retscope.d(77): `retscope.HTTP.Impl.onReceive.__lambda1` closes over variable `this` at fail_compilation/retscope.d(75)
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/retscope6.d b/gcc/testsuite/gdc.test/fail_compilation/retscope6.d
index a8e5de5..95d5dbe 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/retscope6.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/retscope6.d
@@ -78,6 +78,7 @@ void foo() @safe
fail_compilation/retscope6.d(8016): Error: address of variable `i` assigned to `p` with longer lifetime
fail_compilation/retscope6.d(8031): Error: reference to local variable `i` assigned to non-scope parameter `p` calling `betty`
fail_compilation/retscope6.d(8031): Error: reference to local variable `j` assigned to non-scope parameter `q` calling `betty`
+fail_compilation/retscope6.d(8021): which is assigned to non-scope parameter `p`
fail_compilation/retscope6.d(8048): Error: reference to local variable `j` assigned to non-scope parameter `q` calling `archie`
---
*/
@@ -255,6 +256,7 @@ void escape_throw_20150() @safe
/* TEST_OUTPUT:
---
fail_compilation/retscope6.d(14019): Error: scope variable `scopePtr` assigned to non-scope parameter `x` calling `noInfer23021`
+fail_compilation/retscope6.d(14009): which is not `scope` because of `*escapeHole = cast(const(int)*)x`
fail_compilation/retscope6.d(14022): Error: scope variable `scopePtr` may not be returned
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/shared.d b/gcc/testsuite/gdc.test/fail_compilation/shared.d
index ab6f540..7d15b16 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/shared.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/shared.d
@@ -225,3 +225,14 @@ auto ref Object test_inference_4(const return shared ref Object a)
{
return a;
}
+
+// https://issues.dlang.org/show_bug.cgi?id=23226
+// Allow accessing non-shared `this`
+struct BitRange
+{
+ int bits;
+ void f()
+ {
+ this.bits++;
+ }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test13786.d b/gcc/testsuite/gdc.test/fail_compilation/test13786.d
index 3524875..73ec588 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/test13786.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/test13786.d
@@ -1,11 +1,13 @@
/*
TEST_OUTPUT:
---
-fail_compilation/test13786.d(14): Error: debug `123` level declaration must be at module level
-fail_compilation/test13786.d(15): Error: debug `abc` declaration must be at module level
-fail_compilation/test13786.d(16): Error: version `123` level declaration must be at module level
-fail_compilation/test13786.d(17): Error: version `abc` declaration must be at module level
-fail_compilation/test13786.d(20): Error: template instance `test13786.T!()` error instantiating
+fail_compilation/test13786.d(16): Deprecation: `debug = <integer>` is deprecated, use debug identifiers instead
+fail_compilation/test13786.d(18): Deprecation: `version = <integer>` is deprecated, use version identifiers instead
+fail_compilation/test13786.d(16): Error: debug `123` level declaration must be at module level
+fail_compilation/test13786.d(17): Error: debug `abc` declaration must be at module level
+fail_compilation/test13786.d(18): Error: version `123` level declaration must be at module level
+fail_compilation/test13786.d(19): Error: version `abc` declaration must be at module level
+fail_compilation/test13786.d(22): Error: template instance `test13786.T!()` error instantiating
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15525.d b/gcc/testsuite/gdc.test/fail_compilation/test15525.d
new file mode 100644
index 0000000..cd35f30
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test15525.d
@@ -0,0 +1,17 @@
+// https://issues.dlang.org/show_bug.cgi?id=15525
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/imports/import15525.d(3): Error: parenthesized template parameter list expected following template identifier
+fail_compilation/imports/import15525.d(3): Error: (expression) expected following `static if`
+fail_compilation/imports/import15525.d(3): Error: declaration expected, not `}`
+fail_compilation/test15525.d(16): Error: template instance `Tuple!()` template `Tuple` is not defined
+---
+*/
+
+struct CrashMe
+{
+ import imports.import15525;
+ Tuple!() crash;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test16193.d b/gcc/testsuite/gdc.test/fail_compilation/test16193.d
index 053f583..6c80471 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/test16193.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/test16193.d
@@ -2,8 +2,8 @@
REQUIRED_ARGS: -preview=dip1000
TEST_OUTPUT:
---
-fail_compilation/test16193.d(38): Error: function `test16193.abc` is `@nogc` yet allocates closures with the GC
-fail_compilation/test16193.d(40): test16193.abc.__foreachbody2 closes over variable x at fail_compilation/test16193.d(39)
+fail_compilation/test16193.d(38): Error: function `test16193.abc` is `@nogc` yet allocates closure for `abc()` with the GC
+fail_compilation/test16193.d(40): `test16193.abc.__foreachbody2` closes over variable `x` at fail_compilation/test16193.d(39)
---
*/
//fail_compilation/test16193.d(22): To enforce `@safe`, the compiler allocates a closure unless `opApply()` uses `scope`
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test17423.d b/gcc/testsuite/gdc.test/fail_compilation/test17423.d
index 3afb63b..faa9806 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/test17423.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/test17423.d
@@ -1,7 +1,8 @@
/* REQUIRED_ARGS: -preview=dip1000
TEST_OUTPUT:
---
-fail_compilation/test17423.d(26): Error: reference to local `this` assigned to non-scope parameter `dlg` calling `opApply`
+fail_compilation/test17423.d(27): Error: reference to local `this` assigned to non-scope parameter `dlg` calling `opApply`
+fail_compilation/test17423.d(16): which is not `scope` because of `this.myDlg = dlg`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test17764.d b/gcc/testsuite/gdc.test/fail_compilation/test17764.d
new file mode 100644
index 0000000..6ee988a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test17764.d
@@ -0,0 +1,21 @@
+/* REQUIRED_ARGS: -preview=dip1000
+ * TEST_OUTPUT:
+---
+fail_compilation/test17764.d(109): Error: scope variable `c` assigned to non-scope `global`
+---
+ */
+
+// https://issues.dlang.org/show_bug.cgi?id=17764
+
+#line 100
+
+int** global;
+
+struct S { int** str; }
+
+void f() @safe
+{
+ int* buf;
+ S[1] c = S(&buf);
+ global = c[0].str; /* This should be rejected. */
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test20245.d b/gcc/testsuite/gdc.test/fail_compilation/test20245.d
index 1713c9d..98caa03 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/test20245.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/test20245.d
@@ -2,15 +2,16 @@
REQUIRED_ARGS: -preview=dip1000
TEST_OUTPUT:
---
-fail_compilation/test20245.d(20): Error: reference to local variable `x` assigned to non-scope parameter `ptr` calling `escape`
-fail_compilation/test20245.d(21): Error: copying `&x` into allocated memory escapes a reference to parameter `x`
-fail_compilation/test20245.d(22): Error: scope variable `a` may not be returned
-fail_compilation/test20245.d(26): Error: cannot take address of `scope` variable `x` since `scope` applies to first indirection only
-fail_compilation/test20245.d(32): Error: reference to local variable `x` assigned to non-scope parameter `ptr` calling `escape`
-fail_compilation/test20245.d(33): Error: copying `&x` into allocated memory escapes a reference to parameter `x`
-fail_compilation/test20245.d(49): Error: reference to local variable `price` assigned to non-scope `this.minPrice`
-fail_compilation/test20245.d(68): Error: reference to local variable `this` assigned to non-scope parameter `msg` calling `this`
-fail_compilation/test20245.d(88): Error: reference to local variable `this` assigned to non-scope parameter `content` calling `listUp`
+fail_compilation/test20245.d(21): Error: reference to local variable `x` assigned to non-scope parameter `ptr` calling `escape`
+fail_compilation/test20245.d(22): Error: copying `&x` into allocated memory escapes a reference to parameter `x`
+fail_compilation/test20245.d(23): Error: scope variable `a` may not be returned
+fail_compilation/test20245.d(27): Error: cannot take address of `scope` variable `x` since `scope` applies to first indirection only
+fail_compilation/test20245.d(33): Error: reference to local variable `x` assigned to non-scope parameter `ptr` calling `escape`
+fail_compilation/test20245.d(34): Error: copying `&x` into allocated memory escapes a reference to parameter `x`
+fail_compilation/test20245.d(50): Error: reference to local variable `price` assigned to non-scope `this.minPrice`
+fail_compilation/test20245.d(69): Error: reference to local variable `this` assigned to non-scope parameter `msg` calling `this`
+fail_compilation/test20245.d(89): Error: reference to local variable `this` assigned to non-scope parameter `content` calling `listUp`
+fail_compilation/test20245.d(82): which is not `scope` because of `charPtr = content`
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test20809.d b/gcc/testsuite/gdc.test/fail_compilation/test20809.d
new file mode 100644
index 0000000..44728c5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test20809.d
@@ -0,0 +1,44 @@
+/*
+REQUIRED_ARGS: -de
+TEST_OUTPUT:
+---
+fail_compilation/test20809.d(114): Deprecation: returning `this.a` escapes a reference to parameter `this`
+fail_compilation/test20809.d(112): perhaps annotate the function with `return`
+---
+ */
+
+// https://issues.dlang.org/show_bug.cgi?id=20809
+
+#line 100
+
+@safe:
+
+struct S
+{
+ @safe:
+ int a;
+ ~this()
+ {
+ a = 0;
+ }
+
+ ref int val()
+ {
+ return a;
+ }
+}
+
+S bar()
+{
+ return S(2);
+}
+
+int foo()
+{
+ return bar.val;
+}
+
+void test()
+{
+ assert(foo() == 2);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test21443.d b/gcc/testsuite/gdc.test/fail_compilation/test21443.d
new file mode 100644
index 0000000..2d99524
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test21443.d
@@ -0,0 +1,21 @@
+// https://issues.dlang.org/show_bug.cgi?id=21443
+// REQUIRED_ARGS: -de
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test21443.d(14): Deprecation: `return` statements cannot be in `scope(failure)` bodies.
+fail_compilation/test21443.d(14): Use try-catch blocks for this purpose
+---
+*/
+
+ulong get () @safe nothrow
+{
+ scope (failure) return 10;
+ throw new Error("");
+}
+
+void main () @safe
+{
+ assert(get() == 10); // passes
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test21912.d b/gcc/testsuite/gdc.test/fail_compilation/test21912.d
index 925210b..9b07eba 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/test21912.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/test21912.d
@@ -2,14 +2,14 @@
PERMUTE_ARGS: -preview=dip1000
TEST_OUTPUT:
---
-fail_compilation/test21912.d(24): Error: function `test21912.escapeParam` is `@nogc` yet allocates closures with the GC
-fail_compilation/test21912.d(26): test21912.escapeParam.__lambda2 closes over variable i at fail_compilation/test21912.d(24)
-fail_compilation/test21912.d(29): Error: function `test21912.escapeAssign` is `@nogc` yet allocates closures with the GC
-fail_compilation/test21912.d(31): test21912.escapeAssign.__lambda3 closes over variable i at fail_compilation/test21912.d(29)
-fail_compilation/test21912.d(40): Error: function `test21912.escapeAssignRef` is `@nogc` yet allocates closures with the GC
-fail_compilation/test21912.d(42): test21912.escapeAssignRef.__lambda3 closes over variable i at fail_compilation/test21912.d(40)
-fail_compilation/test21912.d(51): Error: function `test21912.escapeParamInferred` is `@nogc` yet allocates closures with the GC
-fail_compilation/test21912.d(53): test21912.escapeParamInferred.__lambda2 closes over variable i at fail_compilation/test21912.d(51)
+fail_compilation/test21912.d(24): Error: function `test21912.escapeParam` is `@nogc` yet allocates closure for `escapeParam()` with the GC
+fail_compilation/test21912.d(26): `test21912.escapeParam.__lambda2` closes over variable `i` at fail_compilation/test21912.d(24)
+fail_compilation/test21912.d(29): Error: function `test21912.escapeAssign` is `@nogc` yet allocates closure for `escapeAssign()` with the GC
+fail_compilation/test21912.d(31): `test21912.escapeAssign.__lambda3` closes over variable `i` at fail_compilation/test21912.d(29)
+fail_compilation/test21912.d(40): Error: function `test21912.escapeAssignRef` is `@nogc` yet allocates closure for `escapeAssignRef()` with the GC
+fail_compilation/test21912.d(42): `test21912.escapeAssignRef.__lambda3` closes over variable `i` at fail_compilation/test21912.d(40)
+fail_compilation/test21912.d(51): Error: function `test21912.escapeParamInferred` is `@nogc` yet allocates closure for `escapeParamInferred()` with the GC
+fail_compilation/test21912.d(53): `test21912.escapeParamInferred.__lambda2` closes over variable `i` at fail_compilation/test21912.d(51)
---
*/
@nogc:
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test21939.d b/gcc/testsuite/gdc.test/fail_compilation/test21939.d
index 8f30bac..e513dc2 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/test21939.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/test21939.d
@@ -2,8 +2,9 @@
/*
TEST_OUTPUT:
---
-fail_compilation/test21939.d(10): Error: invalid `foreach` aggregate `Object` of type `Object`
-fail_compilation/test21939.d(10): maybe define `opApply()`, range primitives, or use `.tupleof`
+fail_compilation/test21939.d(11): Error: invalid `foreach` aggregate `Object` of type `Object`
+fail_compilation/test21939.d(11): `foreach` works with input ranges (implementing `front` and `popFront`), aggregates implementing `opApply`, or the result of an aggregate's `.tupleof` property
+fail_compilation/test21939.d(11): https://dlang.org/phobos/std_range_primitives.html#isInputRange
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test23022.d b/gcc/testsuite/gdc.test/fail_compilation/test23022.d
new file mode 100644
index 0000000..8c4eca9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test23022.d
@@ -0,0 +1,15 @@
+/*
+REQUIRED_ARGS: -preview=dip1000
+TEST_OUTPUT:
+---
+fail_compilation/test23022.d(14): Error: scope parameter `p` may not be returned
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=23022
+// Typesafe variadic parameter should not infer return
+
+auto ir(string[] p...)
+{
+ return p;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test23073.d b/gcc/testsuite/gdc.test/fail_compilation/test23073.d
new file mode 100644
index 0000000..39106ba
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test23073.d
@@ -0,0 +1,35 @@
+/*
+REQUIRED_ARGS: -preview=dip1000
+TEST_OUTPUT:
+---
+fail_compilation/test23073.d(28): Error: scope variable `c` assigned to non-scope parameter `c` calling `assignNext`
+fail_compilation/test23073.d(22): which is not `scope` because of `c.next = c`
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=23073
+// scope inference from pure doesn't consider self-assignment
+
+@safe:
+
+class C
+{
+ C next;
+}
+
+void assignNext(C c) pure nothrow @nogc
+{
+ c.next = c;
+}
+
+C escape() @nogc
+{
+ scope C c = new C();
+ assignNext(c);
+ return c.next;
+}
+
+void main()
+{
+ C dangling = escape();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test23112.d b/gcc/testsuite/gdc.test/fail_compilation/test23112.d
new file mode 100644
index 0000000..325d89b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test23112.d
@@ -0,0 +1,30 @@
+/* REQUIRED_ARGS: -betterC
+TEST_OUTPUT:
+---
+fail_compilation/test23112.d(106): Error: function `test23112.bar` is `@nogc` yet allocates closure for `bar()` with the GC
+fail_compilation/test23112.d(108): `test23112.bar.f` closes over variable `a` at fail_compilation/test23112.d(106)
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=23112
+
+#line 100
+
+struct Forward(alias F)
+{
+ auto call()() { return F(); }
+}
+
+auto bar(int a) nothrow @safe
+{
+ auto f()
+ {
+ return a;
+ }
+ return Forward!f();
+}
+
+extern(C) void main()
+{
+ assert(bar(3).call() == 3);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test23170.d b/gcc/testsuite/gdc.test/fail_compilation/test23170.d
new file mode 100644
index 0000000..eb79cd8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test23170.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test23170.d(10): Error: array literal in `@nogc` delegate `test23170.__lambda5` may cause a GC allocation
+---
+*/
+// https://issues.dlang.org/show_bug.cgi?id=23170
+
+@nogc:
+enum lambda = () => badAlias([1, 2, 3]);
+alias badAlias = (int[] array) => id(array);
+int[] id(int[] array) { return array; }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test23216.d b/gcc/testsuite/gdc.test/fail_compilation/test23216.d
new file mode 100644
index 0000000..d7c12ed
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test23216.d
@@ -0,0 +1,24 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test23216.d(23): Error: invalid `foreach_reverse` aggregate `r` of type `Range`
+fail_compilation/test23216.d(23): `foreach_reverse` works with bidirectional ranges (implementing `back` and `popBack`), aggregates implementing `opApplyReverse`, or the result of an aggregate's `.tupleof` property
+fail_compilation/test23216.d(23): https://dlang.org/phobos/std_range_primitives.html#isBidirectionalRange
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=23216
+// Better Error Message For foreach_reverse Without Bidirectional Range
+
+struct Range
+{
+ bool empty = true;
+ int front = 0;
+ void popFront() { }
+}
+
+void main()
+{
+ Range r;
+ foreach_reverse (word; r) { }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/testsemi.d b/gcc/testsuite/gdc.test/fail_compilation/testsemi.d
new file mode 100644
index 0000000..fc9bc65
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/testsemi.d
@@ -0,0 +1,46 @@
+/* TEST_OUTPUT:
+---
+fail_compilation/testsemi.d(102): Error: found `int` when expecting `;` following static assert
+fail_compilation/testsemi.d(102): Error: no identifier for declarator `x`
+fail_compilation/testsemi.d(109): Error: found `alias` when expecting `;` following alias reassignment
+fail_compilation/testsemi.d(112): Error: found `}` when expecting `;` following invariant
+fail_compilation/testsemi.d(117): Error: found `int` when expecting `;` following `alias Identifier this`
+fail_compilation/testsemi.d(117): Error: no identifier for declarator `x`
+fail_compilation/testsemi.d(123): Error: found `int` when expecting `;` following mixin
+fail_compilation/testsemi.d(129): Error: found `int` when expecting `;` following `import` Expression
+fail_compilation/testsemi.d(131): Error: `}` expected following members in `class` declaration at fail_compilation/testsemi.d(112)
+---
+ */
+
+#line 100
+
+static assert(1)
+int x;
+
+template map(alias F, Args...)
+{
+ alias A = AliasSeq!();
+ static foreach (Arg; Args)
+ A = AliasSeq!(A, F!Arg)
+ alias staticMap = A;
+}
+
+class C { invariant(3) }
+
+class D
+{
+ alias x this
+ int x;
+}
+
+void test1()
+{
+ mixin("int x;")
+ int y;
+}
+
+void test2()
+{
+ import(1)
+ int z;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/closure.d b/gcc/testsuite/gdc.test/runnable/closure.d
index af304c1..1382f2d 100644
--- a/gcc/testsuite/gdc.test/runnable/closure.d
+++ b/gcc/testsuite/gdc.test/runnable/closure.d
@@ -922,7 +922,10 @@ void test14730()
// This is questionable case. Currently it works without any errors,
// but not sure it's really intentional
-
+// It showed up again in https://issues.dlang.org/show_bug.cgi?id=23112
+// where it's an @safe issue so it's a bug.
+static if (0)
+{
struct S14730x(alias f)
{
auto foo()() { return f(0); }
@@ -947,6 +950,7 @@ void test14730x()
// *after* the semantic3 completion of makeS() function.
assert(s.foo() == 10);
}
+}
/************************************/
@@ -981,7 +985,7 @@ int main()
test9685b();
test12406();
test14730();
- test14730x();
+ //test14730x();
printf("Success\n");
return 0;
diff --git a/gcc/testsuite/gdc.test/runnable/evalorder.d b/gcc/testsuite/gdc.test/runnable/evalorder.d
index 6805ee2..f93aef5 100644
--- a/gcc/testsuite/gdc.test/runnable/evalorder.d
+++ b/gcc/testsuite/gdc.test/runnable/evalorder.d
@@ -46,6 +46,12 @@ int mul11ret3(T)(ref T s)
return 3;
}
+auto cat11ret3(T)(ref T s)
+{
+ s ~= 11;
+ return [3];
+}
+
void add()
{
static int test1(int val) { val += add8ret3(val); return val; }
@@ -147,6 +153,25 @@ void shr()
static assert(test(0x80) == 0x40);
}
+void cat()
+{
+ static auto test1(int[] val) { val ~= cat11ret3(val); return val; }
+ assert(test1([1]) == [1, 11, 3]);
+ static assert(test1([1]) == [1, 11, 3]);
+
+ static auto test2(int[] val) { val = val ~ cat11ret3(val); return val; }
+ // FIXME: assert(test2([1]) == [1, 3]);
+ static assert(test2([1]) == [1, 3]);
+
+ static auto test3(int[] val) { (val ~= 7) ~= cat11ret3(val); return val; }
+ assert(test3([2]) == [2, 7, 11, 3]);
+ static assert(test3([2]) == [2, 7, 11, 3]);
+
+ static auto test4(int[] val) { (val ~= cat11ret3(val)) ~= 7; return val; }
+ assert(test4([2]) == [2, 11, 3, 7]);
+ static assert(test4([2]) == [2, 11, 3, 7]);
+}
+
void ldc_github_1617()
{
add();
@@ -156,6 +181,7 @@ void ldc_github_1617()
addptr();
lhsCast();
shr();
+ cat();
}
/******************************************/
diff --git a/gcc/testsuite/gdc.test/runnable/lexer.d b/gcc/testsuite/gdc.test/runnable/lexer.d
index ee2fef8..6e31c07 100644
--- a/gcc/testsuite/gdc.test/runnable/lexer.d
+++ b/gcc/testsuite/gdc.test/runnable/lexer.d
@@ -1,5 +1,11 @@
// REQUIRED_ARGS:
-
+/*
+TEST_OUTPUT:
+---
+runnable/lexer.d(81): Deprecation: `version( <integer> )` is deprecated, use version identifiers instead
+runnable/lexer.d(82): Deprecation: `debug( <integer> )` is deprecated, use debug identifiers instead
+---
+*/
/*********************************************************/
diff --git a/gcc/testsuite/gdc.test/runnable/noreturn1.d b/gcc/testsuite/gdc.test/runnable/noreturn1.d
index 7d15b54..5ed46c1 100644
--- a/gcc/testsuite/gdc.test/runnable/noreturn1.d
+++ b/gcc/testsuite/gdc.test/runnable/noreturn1.d
@@ -261,6 +261,37 @@ void testThrowDtor()
/*****************************************/
+noreturn func()
+{
+ throw new Exception("B");
+}
+
+// https://issues.dlang.org/show_bug.cgi?id=23120
+void test23120()
+{
+ string a;
+ try
+ {
+ noreturn q = throw new Exception ("A");
+ }
+ catch(Exception e)
+ {
+ a ~= e.msg;
+ }
+
+ try
+ {
+ noreturn z = func();
+ }
+ catch(Exception e)
+ {
+ a ~= e.msg;
+ }
+
+ assert(a == "AB");
+}
+
+/*****************************************/
int main()
{
test1();
@@ -269,5 +300,6 @@ int main()
testThrowExpression();
testThrowSideEffect();
testThrowDtor();
+ test23120();
return 0;
}
diff --git a/gcc/testsuite/gdc.test/runnable/test11.d b/gcc/testsuite/gdc.test/runnable/test11.d
index 6735a81..333b600 100644
--- a/gcc/testsuite/gdc.test/runnable/test11.d
+++ b/gcc/testsuite/gdc.test/runnable/test11.d
@@ -1193,41 +1193,6 @@ void test63()
printf("%.*s\n", cast(int)s.length, s.ptr);
}
-
-/**************************************/
-
-debug = 3;
-
-void test64()
-{
- debug(5)
- {
- assert(0);
- }
- debug(3)
- {
- int x = 3;
- }
- assert(x == 3);
-}
-
-/**************************************/
-
-version = 3;
-
-void test65()
-{
- version(5)
- {
- assert(0);
- }
- version(3)
- {
- int x = 3;
- }
- assert(x == 3);
-}
-
/**************************************/
// https://issues.dlang.org/show_bug.cgi?id=8809
@@ -1381,8 +1346,6 @@ int main(string[] argv)
test61();
test62();
test63();
- test64();
- test65();
test8809();
test9734();
diff --git a/gcc/testsuite/gdc.test/runnable/test18973.d b/gcc/testsuite/gdc.test/runnable/test18973.d
new file mode 100644
index 0000000..29fcfa7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test18973.d
@@ -0,0 +1,25 @@
+// This is a runnable test as we are testing a linker error
+
+// https://issues.dlang.org/show_bug.cgi?id=18973
+struct X {
+ @disable size_t toHash() const;
+ @disable string toString() const;
+ @disable bool opEquals(const ref X) const;
+ @disable int opCmp(const ref X) const;
+}
+
+// https://issues.dlang.org/show_bug.cgi?id=9161
+public struct dummy
+{
+ static auto opCall(C)(in C[] name)
+ {
+ return name;
+ }
+
+ @disable ~this(); //comment this out to avoid error
+}
+
+void main()
+{
+ assert(dummy("ABCDE") == "ABCDE");
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test19.d b/gcc/testsuite/gdc.test/runnable/test19.d
index 372d32f..eda6172 100644
--- a/gcc/testsuite/gdc.test/runnable/test19.d
+++ b/gcc/testsuite/gdc.test/runnable/test19.d
@@ -59,22 +59,7 @@ void test2()
void test3()
{
debug printf("debug\n");
- debug(1) printf("debug(1)\n");
- debug(2) printf("debug(2)\n");
- debug(3) printf("debug(3)\n");
debug(bar) printf("debug(bar)\n");
- debug(10) assert(0);
-
- debug(1)
- {
- int d1 = 3;
-
- printf("debug(1) { }\n");
- }
- debug(2)
- {
- printf("debug(2): d1 = %d\n", d1);
- }
}
/* ================================ */
diff --git a/gcc/testsuite/gdc.test/runnable/test20365.d b/gcc/testsuite/gdc.test/runnable/test20365.d
new file mode 100644
index 0000000..71865a5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test20365.d
@@ -0,0 +1,21 @@
+// https://issues.dlang.org/show_bug.cgi?id=20365
+
+string result = "";
+
+struct S
+{
+ long[3] a;
+ this(ref typeof(this)) { result ~= "C"; }
+}
+
+void fun()
+{
+ S[4] a;
+ auto b = a;
+}
+
+void main()
+{
+ fun();
+ assert(result == "CCCC");
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test20734.d b/gcc/testsuite/gdc.test/runnable/test20734.d
index 264602b..b3c5916 100644
--- a/gcc/testsuite/gdc.test/runnable/test20734.d
+++ b/gcc/testsuite/gdc.test/runnable/test20734.d
@@ -16,6 +16,7 @@ extern(C) int main() nothrow @nogc @safe
{
takeScopeSlice([ S(1), S(2) ]); // @nogc => no GC allocation
(() @trusted { assert(numDtor == 2); })(); // stack-allocated array literal properly destructed
+ assert23100([]);
return 0;
}
@@ -26,3 +27,9 @@ void test23098() @safe
{
f23098([10, 20]);
}
+
+// https://issues.dlang.org/show_bug.cgi?id=23100
+void assert23100(scope int[] d) @safe nothrow @nogc
+{
+ assert(!d);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test20809.d b/gcc/testsuite/gdc.test/runnable/test20809.d
new file mode 100644
index 0000000..6d6191e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test20809.d
@@ -0,0 +1,14 @@
+// https://issues.dlang.org/show_bug.cgi?id=20809
+
+
+@safe:
+struct S{
+ @safe:
+ int[8] a;
+ ~this(){ a[] = 0; }
+ ref val(){ return a; }
+}
+S bar(){ return S([2,2,2,2,2,2,2,2]); }
+int[8] foo(){ return bar.val; }
+
+void main(){ assert(foo() == [2,2,2,2,2,2,2,2]); } // error
diff --git a/gcc/testsuite/gdc.test/runnable/test23181.d b/gcc/testsuite/gdc.test/runnable/test23181.d
new file mode 100644
index 0000000..b961690
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test23181.d
@@ -0,0 +1,27 @@
+// https://issues.dlang.org/show_bug.cgi?id=23181
+void main()
+{
+ int count;
+ struct HasDtor
+ {
+ ~this() { ++count; }
+ }
+
+ // array[] = elem()
+ // -> creates temporary to construct array and calls destructor.
+ {
+ count = 0;
+ HasDtor[4] dtor1 = HasDtor();
+ assert(count == 1);
+ }
+ assert(count == 5);
+
+ // array[] = array[elem()]
+ // -> constructs array using direct emplacement.
+ {
+ count = 0;
+ HasDtor[2] dtor2 = [HasDtor(), HasDtor()];
+ assert(count == 0);
+ }
+ assert(count == 2);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test8.d b/gcc/testsuite/gdc.test/runnable/test8.d
index 7d66eb6..d65ba0e 100644
--- a/gcc/testsuite/gdc.test/runnable/test8.d
+++ b/gcc/testsuite/gdc.test/runnable/test8.d
@@ -592,6 +592,44 @@ void test34()
}
/***********************************/
+// https://issues.dlang.org/show_bug.cgi?id=19178
+
+float[3][4] arr2f = 10;
+Int3_4[1] arr3i = 20;
+short[3][4][1][1] arr4s = 30;
+
+enum Int3 : int[3] {
+ a = [0, 1, 2],
+}
+
+enum Int3_4 : Int3[4] {
+ b = Int3[4].init,
+}
+
+struct S35
+{
+ int[3][3] arr = [2, 1];
+}
+
+void test35()
+{
+ for (int i = 0; i < 4; i++)
+ {
+ for (int j = 0; j < 3; j++)
+ {
+ // printf("[%d %d]: %f %d %d\n", i, j, arr2f[i][j], arr3i[0][i][j], arr4s[0][0][i][j]);
+ assert(arr2f[i][j] == 10);
+ assert(arr3i[0][i][j] == 20);
+ assert(arr4s[0][0][i][j] == 30);
+ }
+ }
+
+ S35 t = S35.init;
+ assert(t.arr[0] == [2, 2, 2]);
+ assert(t.arr[1] == [1, 1, 1]);
+ assert(t.arr[2] == [0, 0, 0]);
+}
+/***********************************/
string itoa(int i)
{
@@ -868,6 +906,7 @@ int main()
test32();
test33();
test34();
+ test35();
test36();
test37();
test38();
diff --git a/gcc/testsuite/gdc.test/runnable/version.d b/gcc/testsuite/gdc.test/runnable/version.d
index 1186e4c..e225d5e 100644
--- a/gcc/testsuite/gdc.test/runnable/version.d
+++ b/gcc/testsuite/gdc.test/runnable/version.d
@@ -1,10 +1,9 @@
/*
PERMUTE_ARGS:
-REQUIRED_ARGS: -version=3 -version=foo
+REQUIRED_ARGS: -version=foo
RUN_OUTPUT:
---
i = 2
-i = 2
---
*/
@@ -15,20 +14,6 @@ extern(C) int printf(const char*, ...);
void test1()
{
int i = 3;
-
- version(2)
- {
- i = 2;
- }
- else
- {
- i = 0;
- }
- printf("i = %d\n", i);
- assert(i == 2);
-
- i = 3;
-
version(foo)
{
i = 2;
@@ -47,10 +32,6 @@ version(foo)
{
version = bar;
}
-else
-{
- version = 4;
-}
void test2()
{
@@ -59,8 +40,6 @@ void test2()
}
else
assert(0);
-
- version(4) assert(0);
}
/*******************************************/
diff --git a/gcc/testsuite/gdc.test/runnable/warning1.d b/gcc/testsuite/gdc.test/runnable/warning1.d
index 537088e..01ac20c0 100644
--- a/gcc/testsuite/gdc.test/runnable/warning1.d
+++ b/gcc/testsuite/gdc.test/runnable/warning1.d
@@ -133,15 +133,6 @@ void test6518()
}
}
-/******************************************/
-// https://issues.dlang.org/show_bug.cgi?id=7232
-
-bool test7232()
-{
- scope(failure) return false;
- return true;
-}
-
/***************************************************/
struct S9332
diff --git a/gcc/testsuite/gfortran.dg/PR100132.f90 b/gcc/testsuite/gfortran.dg/PR100132.f90
new file mode 100644
index 0000000..78ae670
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/PR100132.f90
@@ -0,0 +1,75 @@
+! { dg-do run }
+!
+! Test the fix for PR100132
+!
+
+module main_m
+ implicit none
+
+ private
+
+ public :: &
+ foo_t
+
+ public :: &
+ set, &
+ get
+
+ type :: foo_t
+ integer :: i
+ end type foo_t
+
+ type(foo_t), save, pointer :: data => null()
+
+contains
+
+ subroutine set(this)
+ class(foo_t), pointer, intent(in) :: this
+
+ if(associated(data)) stop 1
+ data => this
+ end subroutine set
+
+ subroutine get(this)
+ type(foo_t), pointer, intent(out) :: this
+
+ if(.not.associated(data)) stop 4
+ this => data
+ nullify(data)
+ end subroutine get
+
+end module main_m
+
+program main_p
+
+ use :: main_m, only: &
+ foo_t, set, get
+
+ implicit none
+
+ integer, parameter :: n = 1000
+
+ type(foo_t), pointer :: ps
+ type(foo_t), target :: s
+ integer :: i, j, yay, nay
+
+ yay = 0
+ nay = 0
+ do i = 1, n
+ s%i = i
+ call set(s)
+ call get(ps)
+ if(.not.associated(ps)) stop 13
+ j = ps%i
+ if(i/=j) stop 14
+ if(i/=s%i) stop 15
+ if(ps%i/=s%i) stop 16
+ if(associated(ps, s))then
+ yay = yay + 1
+ else
+ nay = nay + 1
+ end if
+ end do
+ if((yay/=n).or.(nay/=0)) stop 17
+
+end program main_p
diff --git a/gcc/testsuite/gfortran.dg/PR100136.f90 b/gcc/testsuite/gfortran.dg/PR100136.f90
new file mode 100644
index 0000000..922af4a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/PR100136.f90
@@ -0,0 +1,39 @@
+! { dg-do run }
+! { dg-options "-fcheck=pointer" }
+! { dg-shouldfail "Argument not allocated" }
+! { dg-output "Fortran runtime error: Allocatable actual argument 'c_init2' is not allocated" }
+!
+! Tests fix for PR100136
+!
+! Test cut down from PR58586
+!
+
+module test_pr58586_mod
+ implicit none
+
+ type :: a
+ end type
+
+ type :: c
+ type(a), allocatable :: a
+ end type
+
+contains
+
+ subroutine add_class_c (d)
+ class(c), value :: d
+ end subroutine
+
+ class(c) function c_init2()
+ allocatable :: c_init2
+ end function
+
+end module test_pr58586_mod
+
+program test_pr58586
+ use test_pr58586_mod
+
+ ! This needs to execute, to see whether the segfault at runtime is resolved
+ call add_class_c(c_init2())
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/PR100245.f90 b/gcc/testsuite/gfortran.dg/PR100245.f90
new file mode 100644
index 0000000..07c1f7b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/PR100245.f90
@@ -0,0 +1,28 @@
+! { dg-do run }
+!
+! Test the fix for PR100245
+!
+
+program main_p
+
+ implicit none
+
+ type :: foo_t
+ integer :: a
+ end type foo_t
+
+ integer, parameter :: a = 42
+
+ class(foo_t), allocatable :: val
+ class(foo_t), allocatable :: rs1
+ type(foo_t), allocatable :: rs2
+
+ allocate(val, source=foo_t(42))
+ if (val%a/=a) stop 1
+ rs1 = val
+ if (rs1%a/=a) stop 2
+ rs2 = val
+ if (rs2%a/=a) stop 3
+ deallocate(val, rs1, rs2)
+
+end program main_p
diff --git a/gcc/testsuite/gfortran.dg/actual_array_offset_1.f90 b/gcc/testsuite/gfortran.dg/actual_array_offset_1.f90
index a78f546..53dbc2e 100644
--- a/gcc/testsuite/gfortran.dg/actual_array_offset_1.f90
+++ b/gcc/testsuite/gfortran.dg/actual_array_offset_1.f90
@@ -155,7 +155,7 @@ program test_quicksort
call quicksort( array )
-! Check the the array is correctly ordered
+! Check the array is correctly ordered
if (.not.check (array)) STOP 2
contains
logical function check (arg)
diff --git a/gcc/testsuite/gfortran.dg/assumed_type_16.f90 b/gcc/testsuite/gfortran.dg/assumed_type_16.f90
new file mode 100644
index 0000000..52d8ef5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/assumed_type_16.f90
@@ -0,0 +1,14 @@
+! { dg-do compile }
+! { dg-additional-options "-std=f2008" }
+!
+! PR fortran/104143
+!
+ interface
+ subroutine foo(x)
+ type(*) :: x(*) ! { dg-error "Fortran 2018: Assumed type" }
+ end
+ end interface
+ integer :: a
+ call foo(a) ! { dg-error "Type mismatch in argument" }
+ call foo((a)) ! { dg-error "Type mismatch in argument" }
+end
diff --git a/gcc/testsuite/gfortran.dg/assumed_type_17.f90 b/gcc/testsuite/gfortran.dg/assumed_type_17.f90
new file mode 100644
index 0000000..d6ccd30
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/assumed_type_17.f90
@@ -0,0 +1,18 @@
+! { dg-do compile }
+! { dg-additional-options "-std=f2018 -fdump-tree-original" }
+!
+! PR fortran/104143
+!
+ interface
+ subroutine foo(x)
+ type(*) :: x(*)
+ end
+ end interface
+ integer :: a
+ call foo(a)
+ call foo((a))
+end
+
+! { dg-final { scan-tree-dump-times "foo \\(&a\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "D.\[0-9\]+ = a;" 1 "original" } }
+! { dg-final { scan-tree-dump-times "foo \\(&D.\[0-9\]+\\);" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/c-interop/c407b-2.f90 b/gcc/testsuite/gfortran.dg/c-interop/c407b-2.f90
index 4f9f6c7..49352fc 100644
--- a/gcc/testsuite/gfortran.dg/c-interop/c407b-2.f90
+++ b/gcc/testsuite/gfortran.dg/c-interop/c407b-2.f90
@@ -40,7 +40,7 @@ subroutine s0 (x)
call g (x, 1)
call f (x, 1) ! { dg-error "Type mismatch" }
- call h (x, 1) ! { dg-error "Rank mismatch" }
+ call h (x, 1) ! Scalar to type(*),dimension(*): Invalid in TS29113 but valid since F2018
end subroutine
! Check that you can't use an assumed-type array variable in an array
diff --git a/gcc/testsuite/gfortran.dg/debug/pr35154-stabs.f b/gcc/testsuite/gfortran.dg/debug/pr35154-stabs.f
deleted file mode 100644
index 5e5c42e..0000000
--- a/gcc/testsuite/gfortran.dg/debug/pr35154-stabs.f
+++ /dev/null
@@ -1,35 +0,0 @@
-C Test program for common block debugging. G. Helffrich 11 July 2004.
-C { dg-do compile }
-C { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* alpha*-*-* hppa*64*-*-* ia64-*-* *-*-vxworks* } }
-C { dg-skip-if "No stabs" { *-*-* } { "*" } { "-gstabs" } }
- common i,j
- common /label/l,m
- i = 1
- j = 2
- k = 3
- l = 4
- m = 5
- call sub
- end
- subroutine sub
- common /label/l,m
- logical first
- save n
- data first /.true./
- if (first) then
- n = 0
- first = .false.
- endif
- n = n + 1
- l = l + 1
- return
- end
-
-C { dg-final { scan-assembler ".stabs.*\"__BLNK__\",226" } }
-C { dg-final { scan-assembler ".stabs.*\"i:V.*\",.*,0" } }
-C { dg-final { scan-assembler ".stabs.*\"j:V.*\",.*,4" } }
-C { dg-final { scan-assembler ".stabs.*\"__BLNK__\",228" } }
-C { dg-final { scan-assembler ".stabs.*\"label_\",226" } }
-C { dg-final { scan-assembler ".stabs.*\"l:V.*\",.*,0" } }
-C { dg-final { scan-assembler ".stabs.*\"m:V.*\",.*,4" } }
-C { dg-final { scan-assembler ".stabs.*\"label_\",228" } }
diff --git a/gcc/testsuite/gfortran.dg/goacc/classify-kernels-parloops.f95 b/gcc/testsuite/gfortran.dg/goacc/classify-kernels-parloops.f95
index 96814a1..5dd763f 100644
--- a/gcc/testsuite/gfortran.dg/goacc/classify-kernels-parloops.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/classify-kernels-parloops.f95
@@ -29,16 +29,16 @@ program main
end program main
! Check the offloaded function's attributes.
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint\\)\\)" 1 "ompexp" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "ompexp" } }
! Check that exactly one OpenACC kernels construct is analyzed, and that it
! can be parallelized.
! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "parloops1" } }
! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } }
! Check the offloaded function's classification and compute dimensions (will
! always be 1 x 1 x 1 for non-offloading compilation).
! { dg-final { scan-tree-dump-times "(?n)Function is parallelized OpenACC kernels offload" 1 "oaccloops" } }
! { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "oaccloops" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "oaccloops" } }
diff --git a/gcc/testsuite/gfortran.dg/goacc/classify-kernels-unparallelized-parloops.f95 b/gcc/testsuite/gfortran.dg/goacc/classify-kernels-unparallelized-parloops.f95
index e858617..eb165e5 100644
--- a/gcc/testsuite/gfortran.dg/goacc/classify-kernels-unparallelized-parloops.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/classify-kernels-unparallelized-parloops.f95
@@ -33,16 +33,16 @@ program main
end program main
! Check the offloaded function's attributes.
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint\\)\\)" 1 "ompexp" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "ompexp" } }
! Check that exactly one OpenACC kernels construct is analyzed, and that it
! can't be parallelized.
! { dg-final { scan-tree-dump-times "FAILED:" 1 "parloops1" } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "parloops1" } }
! { dg-final { scan-tree-dump-not "SUCCESS: may be parallelized" "parloops1" } }
! Check the offloaded function's classification and compute dimensions (will
! always be 1 x 1 x 1 for non-offloading compilation).
! { dg-final { scan-tree-dump-times "(?n)Function is unparallelized OpenACC kernels offload" 1 "oaccloops" } }
! { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels, omp target entrypoint\\)\\)" 1 "oaccloops" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "oaccloops" } }
diff --git a/gcc/testsuite/gfortran.dg/goacc/classify-kernels-unparallelized.f95 b/gcc/testsuite/gfortran.dg/goacc/classify-kernels-unparallelized.f95
index f8897fc..e8ceda9 100644
--- a/gcc/testsuite/gfortran.dg/goacc/classify-kernels-unparallelized.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/classify-kernels-unparallelized.f95
@@ -34,16 +34,16 @@ program main
end program main
! Check the offloaded function's attributes.
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint\\)\\)" 1 "ompexp" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "ompexp" } }
! Check that exactly one OpenACC kernels construct is analyzed, and that it
! can't be parallelized.
! { dg-final { scan-tree-dump-times "FAILED:" 1 "parloops1" } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "parloops1" } }
! { dg-final { scan-tree-dump-not "SUCCESS: may be parallelized" "parloops1" } }
! Check the offloaded function's classification and compute dimensions (will
! always be 1 x 1 x 1 for non-offloading compilation).
! { dg-final { scan-tree-dump-times "(?n)Function is unparallelized OpenACC kernels offload" 1 "oaccloops" } }
! { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels, omp target entrypoint\\)\\)" 1 "oaccloops" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "oaccloops" } }
diff --git a/gcc/testsuite/gfortran.dg/goacc/classify-kernels.f95 b/gcc/testsuite/gfortran.dg/goacc/classify-kernels.f95
index 2ed6cdb..7eb7918 100644
--- a/gcc/testsuite/gfortran.dg/goacc/classify-kernels.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/classify-kernels.f95
@@ -32,16 +32,16 @@ program main
end program main
! Check the offloaded function's attributes.
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint\\)\\)" 1 "ompexp" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "ompexp" } }
! Check that exactly one OpenACC kernels construct is analyzed, and that it
! can be parallelized.
! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "parloops1" } }
! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } }
! Check the offloaded function's classification and compute dimensions (will
! always be 1 x 1 x 1 for non-offloading compilation).
! { dg-final { scan-tree-dump-times "(?n)Function is parallelized OpenACC kernels offload" 1 "oaccloops" } }
! { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "oaccloops" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "oaccloops" } }
diff --git a/gcc/testsuite/gfortran.dg/goacc/classify-parallel.f95 b/gcc/testsuite/gfortran.dg/goacc/classify-parallel.f95
index adc3846..8fa1e94 100644
--- a/gcc/testsuite/gfortran.dg/goacc/classify-parallel.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/classify-parallel.f95
@@ -26,10 +26,10 @@ program main
end program main
! Check the offloaded function's attributes.
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc parallel, omp target entrypoint\\)\\)" 1 "ompexp" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc parallel, omp target entrypoint, noclone\\)\\)" 1 "ompexp" } }
! Check the offloaded function's classification and compute dimensions (will
! always be 1 x 1 x 1 for non-offloading compilation).
! { dg-final { scan-tree-dump-times "(?n)Function is OpenACC parallel offload" 1 "oaccloops" } }
! { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc parallel, omp target entrypoint\\)\\)" 1 "oaccloops" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc parallel, omp target entrypoint, noclone\\)\\)" 1 "oaccloops" } }
diff --git a/gcc/testsuite/gfortran.dg/goacc/classify-serial.f95 b/gcc/testsuite/gfortran.dg/goacc/classify-serial.f95
index 2101587..996b2ae 100644
--- a/gcc/testsuite/gfortran.dg/goacc/classify-serial.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/classify-serial.f95
@@ -29,10 +29,10 @@ program main
end program main
! Check the offloaded function's attributes.
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc serial, omp target entrypoint\\)\\)" 1 "ompexp" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc serial, omp target entrypoint, noclone\\)\\)" 1 "ompexp" } }
! Check the offloaded function's classification and compute dimensions (will
! always be 1 x 1 x 1 for non-offloading compilation).
! { dg-final { scan-tree-dump-times "(?n)Function is OpenACC serial offload" 1 "oaccloops" } }
! { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc serial, omp target entrypoint\\)\\)" 1 "oaccloops" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc serial, omp target entrypoint, noclone\\)\\)" 1 "oaccloops" } }
diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-loop-2.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-loop-2.f95
index ef53324..8f54db7 100644
--- a/gcc/testsuite/gfortran.dg/goacc/kernels-loop-2.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/kernels-loop-2.f95
@@ -34,7 +34,7 @@ end program main
! Check that only three loops are analyzed, and that all can be parallelized.
! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 3 "parloops1" } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 3 "parloops1" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 3 "parloops1" } }
! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } }
! Check that the loop has been split off into a function.
diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-loop-data-2.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-loop-data-2.f95
index 2f1dcd6..22282ec 100644
--- a/gcc/testsuite/gfortran.dg/goacc/kernels-loop-data-2.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/kernels-loop-data-2.f95
@@ -40,7 +40,7 @@ end program main
! Check that only three loops are analyzed, and that all can be parallelized.
! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 3 "parloops1" } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 3 "parloops1" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 3 "parloops1" } }
! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } }
! Check that the loop has been split off into a function.
diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-loop-data-enter-exit-2.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-loop-data-enter-exit-2.f95
index 447e85d6..9d057f3 100644
--- a/gcc/testsuite/gfortran.dg/goacc/kernels-loop-data-enter-exit-2.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/kernels-loop-data-enter-exit-2.f95
@@ -40,7 +40,7 @@ end program main
! Check that only three loops are analyzed, and that all can be parallelized.
! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 3 "parloops1" } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 3 "parloops1" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 3 "parloops1" } }
! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } }
! Check that the loop has been split off into a function.
diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-loop-data-enter-exit.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-loop-data-enter-exit.f95
index 4edb288..e0e8564 100644
--- a/gcc/testsuite/gfortran.dg/goacc/kernels-loop-data-enter-exit.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/kernels-loop-data-enter-exit.f95
@@ -38,7 +38,7 @@ end program main
! Check that only three loops are analyzed, and that all can be parallelized.
! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 3 "parloops1" } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 3 "parloops1" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 3 "parloops1" } }
! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } }
! Check that the loop has been split off into a function.
diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-loop-data-update.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-loop-data-update.f95
index fc113e1..5328371 100644
--- a/gcc/testsuite/gfortran.dg/goacc/kernels-loop-data-update.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/kernels-loop-data-update.f95
@@ -38,7 +38,7 @@ end program main
! Check that only three loops are analyzed, and that all can be parallelized.
! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 2 "parloops1" } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 2 "parloops1" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 2 "parloops1" } }
! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } }
! Check that the loop has been split off into a function.
diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-loop-data.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-loop-data.f95
index 94522f5..da9fe2e 100644
--- a/gcc/testsuite/gfortran.dg/goacc/kernels-loop-data.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/kernels-loop-data.f95
@@ -38,7 +38,7 @@ end program main
! Check that only three loops are analyzed, and that all can be parallelized.
! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 3 "parloops1" } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 3 "parloops1" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 3 "parloops1" } }
! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } }
! Check that the loop has been split off into a function.
diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-loop-n.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-loop-n.f95
index b9c4aea..0104c08 100644
--- a/gcc/testsuite/gfortran.dg/goacc/kernels-loop-n.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/kernels-loop-n.f95
@@ -33,7 +33,7 @@ end module test
! Check that only one loop is analyzed, and that it can be parallelized.
! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } }
! TODO, PR70545.
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" { xfail *-*-* } } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "parloops1" { xfail *-*-* } } }
! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } }
! Check that the loop has been split off into a function.
diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-loop.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-loop.f95
index 6dc7b2e..e3e74e8 100644
--- a/gcc/testsuite/gfortran.dg/goacc/kernels-loop.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/kernels-loop.f95
@@ -30,7 +30,7 @@ end program main
! Check that only one loop is analyzed, and that it can be parallelized.
! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "parloops1" } }
! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } }
! Check that the loop has been split off into a function.
diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-parallel-loop-data-enter-exit.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-parallel-loop-data-enter-exit.f95
index 48c20b9..5b6ae05 100644
--- a/gcc/testsuite/gfortran.dg/goacc/kernels-parallel-loop-data-enter-exit.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/kernels-parallel-loop-data-enter-exit.f95
@@ -39,7 +39,7 @@ end program main
! Check that only three loops are analyzed, and that all can be parallelized.
! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 2 "parloops1" { xfail *-*-* } } }
-! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 2 "parloops1" { xfail *-*-* } } }
+! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 2 "parloops1" { xfail *-*-* } } }
! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" { xfail *-*-* } } }
! Check that the loop has been split off into a function.
diff --git a/gcc/testsuite/gfortran.dg/gomp/all-memory-1.f90 b/gcc/testsuite/gfortran.dg/gomp/all-memory-1.f90
index f8f34f0..51b5633 100644
--- a/gcc/testsuite/gfortran.dg/gomp/all-memory-1.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/all-memory-1.f90
@@ -50,5 +50,5 @@ subroutine f6
!$omp target depend ( depobj : omp_all_memory) ! { dg-error "'omp_all_memory' used with DEPEND kind other than OUT or INOUT" }
!!$omp end target
- !$omp ordered depend ( sink : omp_all_memory) ! { dg-error "'omp_all_memory' used with DEPEND kind other than OUT or INOUT" }
+ !$omp ordered depend ( sink : omp_all_memory) ! { dg-error "used with dependence-type other than OUT or INOUT" }
end
diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-simd-3.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-simd-3.f90
new file mode 100644
index 0000000..b94587ef
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/declare-simd-3.f90
@@ -0,0 +1,30 @@
+! { dg-do compile }
+
+module m
+ implicit none (type, external)
+contains
+ real function add(x, y, j) result(res)
+ !$omp declare simd(add) uniform(x, y) linear(j : 1) simdlen(4)
+ integer, value :: j
+ real, intent(in) :: x(*), y(*)
+ res = x(j) + y(j)
+ end function
+end module m
+
+program main
+ use m
+ implicit none (type, external)
+ real, allocatable :: A(:), B(:), C(:)
+ integer :: i, N
+ N = 128
+ A = [(3*i, i = 1, N)]
+ B = [(7*i, i = 1, N)]
+ allocate (C(N))
+
+ !$omp simd
+ do i = 1, N
+ C(i) = add(A, B, i)
+ end do
+
+ if (any (C /= [(10*i, i = 1, N)])) error stop
+end program main
diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-simd-4.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-simd-4.f90
new file mode 100644
index 0000000..27a75ab
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/declare-simd-4.f90
@@ -0,0 +1,42 @@
+! { dg-do compile }
+! { dg-additional-options "-fdump-tree-gimple" }
+!
+! PR fortran/106566
+!
+! { dg-final { scan-tree-dump-times "__attribute__\\(\\(omp declare simd \\(linear\\(0:ref,step\\(4\\)\\) simdlen\\(8\\)\\)\\)\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "__attribute__\\(\\(omp declare simd \\(linear\\(0:ref,step\\(8\\)\\) simdlen\\(8\\)\\)\\)\\)" 2 "gimple" } }
+
+subroutine add_one2(p)
+ implicit none
+ !$omp declare simd(add_one2) linear(p: ref) simdlen(8)
+ integer(kind=4) :: p
+
+ p = p + 1
+end subroutine
+
+subroutine linear_add_one2(p)
+ implicit none
+ !$omp declare simd(linear_add_one2) linear(p: ref, step(2)) simdlen(8)
+ integer(kind=4) :: p
+
+ p = p + 1
+end subroutine
+
+module m
+ integer, parameter :: NN = 1023
+ integer(kind=4) :: a(NN)
+contains
+ subroutine module_add_one2(q)
+ implicit none
+ !$omp declare simd(module_add_one2) linear(q: ref) simdlen(8)
+ integer(kind=4) :: q
+ q = q + 1
+ end subroutine
+
+ subroutine linear_add_one2(q)
+ implicit none
+ !$omp declare simd(linear_add_one2) linear(q: ref, step(2)) simdlen(8)
+ integer(kind=4) :: q
+ q = q + 1
+ end subroutine
+end module
diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-simd-5.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-simd-5.f90
new file mode 100644
index 0000000..f5880f5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/declare-simd-5.f90
@@ -0,0 +1,49 @@
+! { dg-do compile }
+!
+! PR fortran/106566
+!
+
+subroutine add_one2(p)
+ implicit none
+ procedure(add_one2) :: ext1
+ !$omp declare simd(ext1) linear(p: ref) simdlen(8) ! { dg-error "OMP DECLARE SIMD should refer to containing procedure 'add_one2'" }
+ integer :: p
+
+ p = p + 1
+end subroutine
+
+subroutine linear_add_one2(p)
+ implicit none
+ procedure(linear_add_one2) :: ext2
+ !$omp declare simd(ext2) linear(p: ref, step(2)) simdlen(8) ! { dg-error "OMP DECLARE SIMD should refer to containing procedure 'linear_add_one2'" }
+ integer :: p
+
+ p = p + 1
+end subroutine
+
+module m
+ integer, parameter :: NN = 1023
+ integer :: a(NN)
+contains
+ subroutine some_proc(r)
+ integer :: r
+ end subroutine
+ subroutine module_add_one2(q)
+ implicit none
+ !$omp declare simd(some_proc) linear(q: ref) simdlen(8) ! { dg-error "OMP DECLARE SIMD should refer to containing procedure 'module_add_one2'" }
+ integer :: q
+ q = q + 1
+ end subroutine
+
+ subroutine module_linear_add_one2(q)
+ implicit none
+ interface
+ subroutine other_proc(r)
+ integer :: r
+ end subroutine
+ end interface
+ !$omp declare simd(other_proc) linear(q: ref, step(2)) simdlen(8) ! { dg-error "OMP DECLARE SIMD should refer to containing procedure 'module_linear_add_one2'" }
+ integer :: q
+ q = q + 1
+ end subroutine
+end module
diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-simd-6.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-simd-6.f90
new file mode 100644
index 0000000..83f2c0a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/declare-simd-6.f90
@@ -0,0 +1,42 @@
+! { dg-do compile }
+! { dg-additional-options "-fdump-tree-gimple" }
+!
+! PR fortran/106566
+!
+! { dg-final { scan-tree-dump-times "__attribute__\\(\\(omp declare simd \\(linear\\(ref\\(0\\):4\\) simdlen\\(8\\)\\)\\)\\)" 2 "gimple" } }
+! { dg-final { scan-tree-dump-times "__attribute__\\(\\(omp declare simd \\(linear\\(ref\\(0\\):8\\) simdlen\\(8\\)\\)\\)\\)" 2 "gimple" } }
+
+subroutine add_one2(p)
+ implicit none
+ !$omp declare simd(add_one2) linear(ref(p)) simdlen(8)
+ integer(kind=4) :: p
+
+ p = p + 1
+end subroutine
+
+subroutine linear_add_one2(p)
+ implicit none
+ !$omp declare simd(linear_add_one2) linear(ref(p) : 2) simdlen(8)
+ integer(kind=4) :: p
+
+ p = p + 1
+end subroutine
+
+module m
+ integer, parameter :: NN = 1023
+ integer(kind=4) :: a(NN)
+contains
+ subroutine module_add_one2(q)
+ implicit none
+ !$omp declare simd(module_add_one2) linear(ref(q)) simdlen(8)
+ integer(kind=4) :: q
+ q = q + 1
+ end subroutine
+
+ subroutine linear_add_one2(q)
+ implicit none
+ !$omp declare simd(linear_add_one2) linear(ref(q) : 2) simdlen(8)
+ integer(kind=4) :: q
+ q = q + 1
+ end subroutine
+end module
diff --git a/gcc/testsuite/gfortran.dg/gomp/depend-4.f90 b/gcc/testsuite/gfortran.dg/gomp/depend-4.f90
index f6cf2fd..edc30fe 100644
--- a/gcc/testsuite/gfortran.dg/gomp/depend-4.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/depend-4.f90
@@ -52,7 +52,7 @@ subroutine foo(dss, dsp, dsa, daa, daaa, daap, doss, dosp, dosa, doaa, doaaa, do
!$omp depobj(elem(4)) depend(in: daa(2))
!$omp depobj(elem(5)) depend(in: daaa(2))
!$omp depobj(elem(6)) depend(in: daap(2))
- !$omp depobj(elem(6)) depend(in: doaa(2))
+ !$omp depobj(elem(7)) depend(in: doaa(2))
!$omp depobj(elem(8)) depend(in: doaaa(2))
!$omp depobj(elem(9)) depend(in: doaap(2))
@@ -199,7 +199,7 @@ end
! { dg-final { scan-tree-dump-times "&elem\\\[3\\\] = &\\(\\*daa\\)\\\[1\\\];" 1 "original" } }
! { dg-final { scan-tree-dump-times "&elem\\\[4\\\] = &\\(\\*\\(integer.kind=4.\\\[0:\\\] \\* restrict\\) daaa->data\\)\\\[daaa->offset \\+ 2\\\];" 1 "original" } }
! { dg-final { scan-tree-dump-times "&elem\\\[5\\\] = \\(integer.kind=4. \\*\\) \\(daap->data \\+ .sizetype. \\(\\(daap->offset \\+ daap->dim\\\[0\\\].stride \\* 2\\) \\* daap->span\\)\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "&elem\\\[5\\\] = &\\(\\*doaa\\)\\\[1\\\];" 1 "original" } }
+! { dg-final { scan-tree-dump-times "&elem\\\[6\\\] = &\\(\\*doaa\\)\\\[1\\\];" 1 "original" } }
! { dg-final { scan-tree-dump-times "&elem\\\[7\\\] = &\\(\\*\\(integer.kind=4.\\\[0:\\\] \\* restrict\\) doaaa->data\\)\\\[doaaa->offset \\+ 2\\\];" 1 "original" } }
! { dg-final { scan-tree-dump-times "&elem\\\[8\\\] = \\(integer.kind=4. \\*\\) \\(doaap->data \\+ .sizetype. \\(\\(doaap->offset \\+ doaap->dim\\\[0\\\].stride \\* 2\\) \\* doaap->span\\)\\);" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/depend-6.f90 b/gcc/testsuite/gfortran.dg/gomp/depend-6.f90
index b6c1afe..fbac14b 100644
--- a/gcc/testsuite/gfortran.dg/gomp/depend-6.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/depend-6.f90
@@ -52,7 +52,7 @@ subroutine foo(dss, dsp, dsa, daa, daaa, daap, doss, dosp, dosa, doaa, doaaa, do
!$omp depobj(elem(4)) depend(in: daa(2))
!$omp depobj(elem(5)) depend(in: daaa(2))
!$omp depobj(elem(6)) depend(in: daap(2))
- !$omp depobj(elem(6)) depend(in: doaa(2))
+ !$omp depobj(elem(7)) depend(in: doaa(2))
!$omp depobj(elem(8)) depend(in: doaaa(2))
!$omp depobj(elem(9)) depend(in: doaap(2))
@@ -199,7 +199,7 @@ end
! { dg-final { scan-tree-dump-times "&elem\\\[3\\\] = &\\(\\*daa\\)\\\[1\\\];" 1 "original" } }
! { dg-final { scan-tree-dump-times "&elem\\\[4\\\] = &\\(\\*\\(void \\*\\\[0:\\\] \\* restrict\\) daaa->data\\)\\\[daaa->offset \\+ 2\\\];" 1 "original" } }
! { dg-final { scan-tree-dump-times "&elem\\\[5\\\] = \\(void \\* \\*\\) \\(daap->data \\+ .sizetype. \\(\\(daap->offset \\+ daap->dim\\\[0\\\].stride \\* 2\\) \\* daap->span\\)\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "&elem\\\[5\\\] = &\\(\\*doaa\\)\\\[1\\\];" 1 "original" } }
+! { dg-final { scan-tree-dump-times "&elem\\\[6\\\] = &\\(\\*doaa\\)\\\[1\\\];" 1 "original" } }
! { dg-final { scan-tree-dump-times "&elem\\\[7\\\] = &\\(\\*\\(void \\*\\\[0:\\\] \\* restrict\\) doaaa->data\\)\\\[doaaa->offset \\+ 2\\\];" 1 "original" } }
! { dg-final { scan-tree-dump-times "&elem\\\[8\\\] = \\(void \\* \\*\\) \\(doaap->data \\+ .sizetype. \\(\\(doaap->offset \\+ doaap->dim\\\[0\\\].stride \\* 2\\) \\* doaap->span\\)\\);" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/depend-iterator-2.f90 b/gcc/testsuite/gfortran.dg/gomp/depend-iterator-2.f90
index 21fc327..cadd9a0 100644
--- a/gcc/testsuite/gfortran.dg/gomp/depend-iterator-2.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/depend-iterator-2.f90
@@ -34,7 +34,7 @@ program main
!!$omp end task
!$omp task depend(iterator(i=1:5), source ) ! { dg-error "ITERATOR may not be combined with SOURCE" }
!!$omp end task
- !$omp task affinity (iterator(i=1:5): a) depend(iterator(i=1:5), sink : x) ! { dg-error "ITERATOR may not be combined with SINK" }
+ !$omp task affinity (iterator(i=1:5): a) depend(iterator(i=1:5), sink : x) ! { dg-error "SINK at .1. not permitted as dependence-type for this directive" }
!!$omp end task
end do
diff --git a/gcc/testsuite/gfortran.dg/gomp/depobj-2.f90 b/gcc/testsuite/gfortran.dg/gomp/depobj-2.f90
index cb67c3c..6e7441d 100644
--- a/gcc/testsuite/gfortran.dg/gomp/depobj-2.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/depobj-2.f90
@@ -21,13 +21,13 @@ subroutine f1
!$omp depobj(d) depend( inout : a) ! { dg-error "DEPOBJ in DEPOBJ construct at .1. shall be a scalar integer of OMP_DEPEND_KIND kind" }
!$omp depobj(depobj) depend( inout : a, b) ! { dg-error "DEPEND clause at .1. of OMP DEPOBJ construct shall have only a single locator" }
!$omp depobj(depobj) depend(mutexinoutset : a) ! OK
- !$omp depobj(depobj) depend(source) ! { dg-error "DEPEND clause at .1. of OMP DEPOBJ construct shall not have dependence-type SOURCE, SINK or DEPOBJ" }
- !$omp depobj(depobj) depend(sink : i + 1) ! { dg-error "DEPEND clause at .1. of OMP DEPOBJ construct shall not have dependence-type SOURCE, SINK or DEPOBJ" }
+ !$omp depobj(depobj) depend(source) ! { dg-error "SOURCE at .1. not permitted as dependence-type for this directive" }
+ !$omp depobj(depobj) depend(sink : i + 1) ! { dg-error "SINK at .1. not permitted as dependence-type for this directive" }
!$omp depobj(depobj) update(source) ! { dg-error "Expected IN, OUT, INOUT, INOUTSET or MUTEXINOUTSET followed by '\\)'" }
!$omp depobj(depobj) update(sink) ! { dg-error "Expected IN, OUT, INOUT, INOUTSET or MUTEXINOUTSET followed by '\\)'" }
!$omp depobj(depobj) update(depobj) ! { dg-error "Expected IN, OUT, INOUT, INOUTSET or MUTEXINOUTSET followed by '\\)'" }
! Valid in OpenMP 5.1:
- !$omp depobj(depobj5) depend(depobj: depobj3) ! { dg-error "DEPEND clause at .1. of OMP DEPOBJ construct shall not have dependence-type SOURCE, SINK or DEPOBJ" }
+ !$omp depobj(depobj5) depend(depobj: depobj3) ! { dg-error "DEPEND clause at .1. of OMP DEPOBJ construct shall not have dependence-type DEPOBJ" }
end subroutine f1
diff --git a/gcc/testsuite/gfortran.dg/gomp/doacross-5.f90 b/gcc/testsuite/gfortran.dg/gomp/doacross-5.f90
new file mode 100644
index 0000000..3a1679a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/doacross-5.f90
@@ -0,0 +1,88 @@
+subroutine foo (n)
+ integer i, n
+
+ !$omp do ordered
+ do i = 1, 8, n
+ !$omp ordered doacross(source:)
+ !$omp ordered doacross(sink: i - 2)
+ end do
+end
+
+subroutine bar (n)
+ integer :: i, j, n
+
+ !$omp do collapse(2) ordered(2)
+ do i = 1, 8, n
+ do j = 1, 8, n
+ !$omp ordered doacross(source:omp_cur_iteration)
+ !$omp ordered doacross(sink: i - 2, j + 2)
+ end do
+ end do
+end
+
+subroutine baz ()
+ integer :: i, j
+
+ !$omp do ordered(1)
+ do i = 1, 64
+ !$omp ordered ! { dg-error "'ordered' construct without 'doacross' or 'depend' clauses must not have the same binding region as 'ordered' construct with those clauses" }
+ !$omp end ordered
+
+ !$omp ordered doacross(source:)
+
+ !$omp ordered doacross(sink: i - 1)
+ end do
+
+ !$omp do ordered
+ do i = 1, 64
+ !$omp ordered doacross(source: omp_cur_iteration )
+
+ !$omp ordered doacross(sink: i - 1)
+
+ !$omp ordered threads ! { dg-error "'ordered' construct without 'doacross' or 'depend' clauses must not have the same binding region as 'ordered' construct with those clauses" }
+ !$omp end ordered
+ end do
+ !$omp do ordered(2)
+ do i = 1, 64
+ do j = 1, 64
+ !$omp ordered ! { dg-error "'ordered' construct without 'doacross' or 'depend' clauses binds to loop where 'collapse' argument 1 is different from 'ordered' argument 2" }
+ !$omp end ordered
+ end do
+ end do
+ !$omp do ordered(2) collapse(1)
+ do i = 1, 8
+ do j = 1, 8
+ !$omp ordered threads ! { dg-error "'ordered' construct without 'doacross' or 'depend' clauses binds to loop where 'collapse' argument 1 is different from 'ordered' argument 2" }
+ !$omp end ordered
+ end do
+ end do
+end
+
+subroutine qux ()
+ integer :: i, j
+ j = 0
+ !$omp do ordered linear(j)
+ do i = 1, 64
+ j = j + 1
+ !$omp ordered
+ !$omp end ordered
+ end do
+ !$omp do ordered linear(j) ! { dg-error "'linear' clause may not be specified together with 'ordered' clause if stand-alone 'ordered' construct is nested in it" }
+ do i = 1, 64
+ j = j + 1
+ !$omp ordered doacross(source:)
+ !$omp ordered doacross(sink:i-1)
+ end do
+ !$omp do ordered(1) linear(j)
+ do i = 1, 64
+ j = j + 1
+ !$omp ordered
+ !$omp end ordered
+ end do
+ !$omp do ordered(1) linear(j) ! { dg-error "'linear' clause may not be specified together with 'ordered' clause if stand-alone 'ordered' construct is nested in it" }
+ do i = 1, 64
+ j = j + 1
+ !$omp ordered doacross(source:)
+ !$omp ordered doacross(sink:i-1)
+ end do
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/doacross-6.f90 b/gcc/testsuite/gfortran.dg/gomp/doacross-6.f90
new file mode 100644
index 0000000..a45e1c9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/doacross-6.f90
@@ -0,0 +1,77 @@
+subroutine foo (n)
+ integer :: i, n
+ !$omp do ordered
+ do i = 1, 8, n
+ !$omp ordered doacross(source) ! { dg-error "Expected ':'" }
+ end do
+
+ !$omp do ordered
+ do i = 1, 8, n
+ !$omp ordered doacross(source:omp_current_iteration) ! { dg-error "Expected '\\\)' or 'omp_cur_iteration\\\)'" }
+ end do
+
+ !$omp do ordered
+ do i = 1, 8, n
+ !$omp ordered doacross(source:i - 2) ! { dg-error "Expected '\\\)' or 'omp_cur_iteration\\\)'" }
+ end do
+
+ !$omp do ordered
+ do i = 1, 8, n
+ !$omp ordered doacross(sink) ! { dg-error "Expected ':'" }
+ end do
+
+ !$omp do ordered
+ do i = 1, 8, n
+ !$omp ordered doacross(sink:) ! { dg-error "Syntax error in OpenMP SINK dependence-type list" }
+ end do
+end
+
+subroutine bar (n)
+ implicit none
+ integer i, n
+
+ !$omp do ordered
+ do i = 1, 8, n
+ !$omp ordered doacross(sink:omp_current_iteration - 1) ! { dg-error "Symbol 'omp_current_iteration' at .1. has no IMPLICIT type" }
+ end do
+
+ !$omp do ordered
+ do i = 1, 8, n
+ !$omp ordered doacross(sink:omp_cur_iteration) ! { dg-error "omp_cur_iteration at .1. requires '-1' as logical offset" }
+ end do
+end
+
+subroutine baz (n)
+ implicit none
+ integer i, n
+
+ !$omp do ordered
+ do i = 1, 8, n
+ !$omp ordered doacross(sink:omp_cur_iteration + 1) ! { dg-error "omp_cur_iteration at .1. requires '-1' as logical offset" }
+ end do
+end
+
+subroutine qux (n)
+ implicit none
+ integer i, n
+
+ !$omp do ordered
+ do i = 1, 8, n
+ !$omp ordered doacross(sink:omp_cur_iteration - (2 - 1)) ! { dg-error "Syntax error in OpenMP SINK dependence-type list" }
+ end do
+end
+
+subroutine corge (n)
+ implicit none
+ integer i, n
+
+ !$omp do ordered
+ do i = 1, 8, n
+ !$omp ordered doacross(sink:omp_cur_iteration - 1)
+ end do
+
+ !$omp do ordered
+ do i = 1, 8, n
+ !$omp ordered doacross(sink:omp_cur_iteration - 1_8)
+ end do
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/nesting-2.f90 b/gcc/testsuite/gfortran.dg/gomp/nesting-2.f90
index 2eccdf9..d8014d6 100644
--- a/gcc/testsuite/gfortran.dg/gomp/nesting-2.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/nesting-2.f90
@@ -158,8 +158,8 @@ subroutine foo
!$omp do ordered(1)
do i = 0, 63
!$omp parallel
- !$omp ordered depend(source) ! { dg-error ".ordered. construct with .depend. clause must be closely nested inside a loop with .ordered. clause with a parameter" }
- !$omp ordered depend(sink: i - 1) ! { dg-error ".ordered. construct with .depend. clause must be closely nested inside a loop with .ordered. clause with a parameter" }
+ !$omp ordered depend(source) ! { dg-error ".ordered. construct with .depend. clause must be closely nested inside a loop with .ordered. clause" }
+ !$omp ordered depend(sink: i - 1) ! { dg-error ".ordered. construct with .depend. clause must be closely nested inside a loop with .ordered. clause" }
!$omp end parallel
end do
end
diff --git a/gcc/testsuite/gfortran.dg/gomp/ompx-1.f90 b/gcc/testsuite/gfortran.dg/gomp/ompx-1.f90
new file mode 100644
index 0000000..e5dc652
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/ompx-1.f90
@@ -0,0 +1,2 @@
+!$ompx foo ! { dg-warning "!.OMP at .1. starts a commented line as it neither is followed by a space nor is a continuation line" }
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/omx-1.f b/gcc/testsuite/gfortran.dg/gomp/omx-1.f
new file mode 100644
index 0000000..4febf89
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/omx-1.f
@@ -0,0 +1,7 @@
+!$omx foo
+!$OMX foo
+c$oMx foo
+c$OMx foo
+*$oMx foo
+*$OMx foo
+ end
diff --git a/gcc/testsuite/gfortran.dg/gomp/omx-2.f b/gcc/testsuite/gfortran.dg/gomp/omx-2.f
new file mode 100644
index 0000000..3c107d9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/omx-2.f
@@ -0,0 +1,9 @@
+! { dg-additional-options "-Wsurprising" }
+
+!$omx foo ! { dg-warning "Ignoring '!.omx' vendor-extension sentinel" }
+!$OMX foo ! { dg-warning "Ignoring '!.omx' vendor-extension sentinel" }
+c$oMx foo ! { dg-warning "Ignoring '!.omx' vendor-extension sentinel" }
+c$OMx foo ! { dg-warning "Ignoring '!.omx' vendor-extension sentinel" }
+*$oMx foo ! { dg-warning "Ignoring '!.omx' vendor-extension sentinel" }
+*$OMx foo ! { dg-warning "Ignoring '!.omx' vendor-extension sentinel" }
+ end
diff --git a/gcc/testsuite/gfortran.dg/gomp/strictly-structured-block-4.f90 b/gcc/testsuite/gfortran.dg/gomp/strictly-structured-block-4.f90
new file mode 100644
index 0000000..66cf0a3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/strictly-structured-block-4.f90
@@ -0,0 +1,21 @@
+! { dg-do compile }
+implicit none
+integer ::x,z
+x = 42
+print '(*(z16:" "))', loc(x)
+!$omp target map(x, z)
+block
+ integer :: y
+ x = 123
+ y = 99
+ !$omp target device(ancestor:1) map(always,tofrom:x) map(y) ! { dg-error "'ancestor' device modifier not preceded by 'requires' directive with 'reverse_offload' clause" }
+ print '(*(z16:" "))', loc(x), loc(y)
+ print * ,x, y
+ x = -x
+ y = -y
+ !$omp end target ! { dg-error "Unexpected ..OMP END TARGET statement" }
+ z = y
+end block
+ print * ,x !, z
+end
+
diff --git a/gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-4.f90 b/gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-4.f90
index ab56e2d..d73adf2 100644
--- a/gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-4.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-4.f90
@@ -6,7 +6,7 @@
!$omp requires reverse_offload
-!$omp target device (ancestor : 1) ! { dg-message "sorry, unimplemented: 'ancestor' not yet supported" }
+!$omp target device (ancestor : 1)
!$omp end target
end
diff --git a/gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-5.f90 b/gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-5.f90
index ca8d4b2..9596d61 100644
--- a/gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-5.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-5.f90
@@ -17,7 +17,7 @@ contains
block
block
block
- !$omp target device(ancestor:1) ! { dg-message "sorry, unimplemented: 'ancestor' not yet supported" }
+ !$omp target device(ancestor:1)
!$omp end target
end block
end block
diff --git a/gcc/testsuite/gfortran.dg/ieee/fma_1.f90 b/gcc/testsuite/gfortran.dg/ieee/fma_1.f90
new file mode 100644
index 0000000..3463642
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/ieee/fma_1.f90
@@ -0,0 +1,100 @@
+! Test IEEE_FMA
+! { dg-do run }
+
+ use, intrinsic :: ieee_features
+ use, intrinsic :: ieee_exceptions
+ use, intrinsic :: ieee_arithmetic
+ implicit none
+
+ integer :: ex
+
+ real :: sx1, sx2, sx3
+ double precision :: dx1, dx2, dx3
+
+ ! k1 and k2 will be large real kinds, if supported, and single/double
+ ! otherwise
+ integer, parameter :: k1 = &
+ max(ieee_selected_real_kind(precision(0.d0) + 1), kind(0.))
+ integer, parameter :: k2 = &
+ max(ieee_selected_real_kind(precision(0._k1) + 1), kind(0.d0))
+
+ real(kind=k1) :: lx1, lx2, lx3
+ real(kind=k2) :: wx1, wx2, wx3
+
+ ! Float
+
+ sx1 = 3 ; sx2 = 2 ; sx3 = 1
+ if (ieee_fma(sx1, sx2, sx3) /= 7) stop 1
+ sx1 = 0 ; sx2 = 2 ; sx3 = 1
+ if (ieee_fma(sx1, sx2, sx3) /= 1) stop 2
+ sx1 = 3 ; sx2 = 2 ; sx3 = 0
+ if (ieee_fma(sx1, sx2, sx3) /= 6) stop 3
+
+ ex = int(log(rrspacing(real(1, kind(sx1)))) / log(real(2, kind(sx1)))) - 1
+ sx1 = 1 + spacing(real(1, kind(sx1)))
+ sx2 = 2 ; sx2 = sx2 ** ex ; sx2 = sx2 * 3
+ sx3 = -sx2
+
+ print *, sx1 * sx2 + sx3
+ print *, ieee_fma(sx1, sx2, sx3)
+ if (ieee_fma(sx1, sx2, sx3) /= real(3, kind(sx1)) / 2) stop 4
+ !if (ieee_fma(sx1, sx2, sx3) == sx1 * sx2 + sx3) stop 5
+
+ ! Double
+
+ dx1 = 3 ; dx2 = 2 ; dx3 = 1
+ if (ieee_fma(dx1, dx2, dx3) /= 7) stop 1
+ dx1 = 0 ; dx2 = 2 ; dx3 = 1
+ if (ieee_fma(dx1, dx2, dx3) /= 1) stop 2
+ dx1 = 3 ; dx2 = 2 ; dx3 = 0
+ if (ieee_fma(dx1, dx2, dx3) /= 6) stop 3
+
+ ex = int(log(rrspacing(real(1, kind(dx1)))) / log(real(2, kind(dx1)))) - 1
+ dx1 = 1 + spacing(real(1, kind(dx1)))
+ dx2 = 2 ; dx2 = dx2 ** ex ; dx2 = dx2 * 3
+ dx3 = -dx2
+
+ print *, dx1 * dx2 + dx3
+ print *, ieee_fma(dx1, dx2, dx3)
+ if (ieee_fma(dx1, dx2, dx3) /= real(3, kind(dx1)) / 2) stop 4
+ !if (ieee_fma(dx1, dx2, dx3) == dx1 * dx2 + dx3) stop 5
+
+ ! Large kind 1
+
+ lx1 = 3 ; lx2 = 2 ; lx3 = 1
+ if (ieee_fma(lx1, lx2, lx3) /= 7) stop 1
+ lx1 = 0 ; lx2 = 2 ; lx3 = 1
+ if (ieee_fma(lx1, lx2, lx3) /= 1) stop 2
+ lx1 = 3 ; lx2 = 2 ; lx3 = 0
+ if (ieee_fma(lx1, lx2, lx3) /= 6) stop 3
+
+ ex = int(log(rrspacing(real(1, kind(lx1)))) / log(real(2, kind(lx1)))) - 1
+ lx1 = 1 + spacing(real(1, kind(lx1)))
+ lx2 = 2 ; lx2 = lx2 ** ex ; lx2 = lx2 * 3
+ lx3 = -lx2
+
+ print *, lx1 * lx2 + lx3
+ print *, ieee_fma(lx1, lx2, lx3)
+ if (ieee_fma(lx1, lx2, lx3) /= real(3, kind(lx1)) / 2) stop 4
+ if (ieee_fma(lx1, lx2, lx3) == lx1 * lx2 + lx3) stop 5
+
+ ! Large kind 2
+
+ wx1 = 3 ; wx2 = 2 ; wx3 = 1
+ if (ieee_fma(wx1, wx2, wx3) /= 7) stop 1
+ wx1 = 0 ; wx2 = 2 ; wx3 = 1
+ if (ieee_fma(wx1, wx2, wx3) /= 1) stop 2
+ wx1 = 3 ; wx2 = 2 ; wx3 = 0
+ if (ieee_fma(wx1, wx2, wx3) /= 6) stop 3
+
+ ex = int(log(rrspacing(real(1, kind(wx1)))) / log(real(2, kind(wx1)))) - 1
+ wx1 = 1 + spacing(real(1, kind(wx1)))
+ wx2 = 2 ; wx2 = wx2 ** ex ; wx2 = wx2 * 3
+ wx3 = -wx2
+
+ print *, wx1 * wx2 + wx3
+ print *, ieee_fma(wx1, wx2, wx3)
+ if (ieee_fma(wx1, wx2, wx3) /= real(3, kind(wx1)) / 2) stop 4
+ if (ieee_fma(wx1, wx2, wx3) == wx1 * wx2 + wx3) stop 5
+
+end
diff --git a/gcc/testsuite/gfortran.dg/ieee/modes_1.f90 b/gcc/testsuite/gfortran.dg/ieee/modes_1.f90
new file mode 100644
index 0000000..b6ab288
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/ieee/modes_1.f90
@@ -0,0 +1,95 @@
+! { dg-do run }
+!
+! Test IEEE_MODES_TYPE, IEEE_GET_MODES and IEEE_SET_MODES
+
+
+! The symbols should be accessible from both IEEE_EXCEPTIONS
+! and IEEE_ARITHMETIC.
+
+subroutine test_1
+ use ieee_exceptions, only : IEEE_GET_MODES, IEEE_SET_MODES
+end subroutine
+
+subroutine test_2
+ use ieee_arithmetic, only : IEEE_GET_MODES, IEEE_SET_MODES
+end subroutine
+
+subroutine test_3
+ use ieee_exceptions, only : IEEE_MODES_TYPE
+end subroutine
+
+subroutine test_4
+ use ieee_arithmetic, only : IEEE_MODES_TYPE
+end subroutine
+
+
+! Check that the functions actually do the job
+
+program foo
+ use ieee_arithmetic
+ implicit none
+
+ type(ieee_modes_type) :: modes1, modes2
+ type(ieee_round_type) :: rmode
+ logical :: f
+
+ ! Set some modes
+ if (ieee_support_underflow_control()) then
+ call ieee_set_underflow_mode(gradual=.false.)
+ endif
+ if (ieee_support_rounding(ieee_up)) then
+ call ieee_set_rounding_mode(ieee_up)
+ endif
+ if (ieee_support_halting(ieee_overflow)) then
+ call ieee_set_halting_mode(ieee_overflow, .true.)
+ endif
+
+ call ieee_get_modes(modes1)
+
+ ! Change modes
+ if (ieee_support_underflow_control()) then
+ call ieee_set_underflow_mode(gradual=.true.)
+ endif
+ if (ieee_support_rounding(ieee_down)) then
+ call ieee_set_rounding_mode(ieee_down)
+ endif
+ if (ieee_support_halting(ieee_overflow)) then
+ call ieee_set_halting_mode(ieee_overflow, .false.)
+ endif
+
+ ! Save and restore the previous modes
+ call ieee_get_modes(modes2)
+ call ieee_set_modes(modes1)
+
+ ! Check them
+ if (ieee_support_underflow_control()) then
+ call ieee_get_underflow_mode(f)
+ if (f) stop 1
+ endif
+ if (ieee_support_rounding(ieee_down)) then
+ call ieee_get_rounding_mode(rmode)
+ if (rmode /= ieee_up) stop 2
+ endif
+ if (ieee_support_halting(ieee_overflow)) then
+ call ieee_get_halting_mode(ieee_overflow, f)
+ if (.not. f) stop 3
+ endif
+
+ ! Restore the second set of modes
+ call ieee_set_modes(modes2)
+
+ ! Check again
+ if (ieee_support_underflow_control()) then
+ call ieee_get_underflow_mode(f)
+ if (.not. f) stop 3
+ endif
+ if (ieee_support_rounding(ieee_down)) then
+ call ieee_get_rounding_mode(rmode)
+ if (rmode /= ieee_down) stop 4
+ endif
+ if (ieee_support_halting(ieee_overflow)) then
+ call ieee_get_halting_mode(ieee_overflow, f)
+ if (f) stop 5
+ endif
+
+end program foo
diff --git a/gcc/testsuite/gfortran.dg/ieee/rounding_2.f90 b/gcc/testsuite/gfortran.dg/ieee/rounding_2.f90
new file mode 100644
index 0000000..8af6c91
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/ieee/rounding_2.f90
@@ -0,0 +1,20 @@
+! { dg-do run }
+
+ use, intrinsic :: ieee_arithmetic
+ implicit none
+
+ real :: sx1, sx2, sx3
+ double precision :: dx1, dx2, dx3
+
+ ! IEEE_AWAY was added in Fortran 2018 and not supported by any target
+ ! at the moment. Just check we can query for its support.
+
+ ! We should support at least C float and C double types
+ if (ieee_support_rounding(ieee_away) &
+ .or. ieee_support_rounding(ieee_away, 0.) &
+ .or. ieee_support_rounding(ieee_away, 0.d0)) then
+ print *, "If a target / libc now supports this, we need to add a proper check!"
+ stop 1
+ end if
+
+end
diff --git a/gcc/testsuite/gfortran.dg/ieee/rounding_3.f90 b/gcc/testsuite/gfortran.dg/ieee/rounding_3.f90
new file mode 100644
index 0000000..ff4e834
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/ieee/rounding_3.f90
@@ -0,0 +1,27 @@
+! { dg-do run }
+
+ ! Test IEEE_GET_ROUNDING_MODE and IEEE_SET_ROUNDING_MODE
+ ! with a RADIX argument
+ use, intrinsic :: ieee_arithmetic
+ implicit none
+
+ real :: sx1
+ type(ieee_round_type) :: r
+
+ if (ieee_support_rounding(ieee_up, sx1) .and. &
+ ieee_support_rounding(ieee_down, sx1)) then
+
+ call ieee_set_rounding_mode(ieee_up)
+ call ieee_get_rounding_mode(r)
+ if (r /= ieee_up) stop 1
+
+ call ieee_set_rounding_mode(ieee_down, radix=2)
+ call ieee_get_rounding_mode(r, radix=2)
+ if (r /= ieee_down) stop 2
+
+ call ieee_set_rounding_mode(ieee_up, radix=10)
+ call ieee_get_rounding_mode(r, radix=2)
+ if (r /= ieee_down) stop 3
+ end if
+
+end
diff --git a/gcc/testsuite/gfortran.dg/ieee/signbit_1.f90 b/gcc/testsuite/gfortran.dg/ieee/signbit_1.f90
new file mode 100644
index 0000000..5d6e41d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/ieee/signbit_1.f90
@@ -0,0 +1,166 @@
+! Test IEEE_SIGNBIT
+! { dg-do run }
+
+ use, intrinsic :: ieee_features
+ use, intrinsic :: ieee_exceptions
+ use, intrinsic :: ieee_arithmetic
+ implicit none
+
+ real :: sx1
+ double precision :: dx1
+
+ ! k1 and k2 will be large real kinds, if supported, and single/double
+ ! otherwise
+ integer, parameter :: k1 = &
+ max(ieee_selected_real_kind(precision(0.d0) + 1), kind(0.))
+ integer, parameter :: k2 = &
+ max(ieee_selected_real_kind(precision(0._k1) + 1), kind(0.d0))
+
+ real(kind=k1) :: xk1
+ real(kind=k2) :: xk2
+
+ ! Float
+
+ sx1 = 1.3
+ if (ieee_signbit(sx1)) stop 1
+ sx1 = huge(sx1)
+ if (ieee_signbit(sx1)) stop 2
+ sx1 = ieee_value(sx1, ieee_positive_inf)
+ if (ieee_signbit(sx1)) stop 3
+ sx1 = tiny(sx1)
+ if (ieee_signbit(sx1)) stop 4
+ sx1 = tiny(sx1)
+ sx1 = sx1 / 101
+ if (ieee_signbit(sx1)) stop 5
+ sx1 = 0
+ if (ieee_signbit(sx1)) stop 6
+ sx1 = ieee_value(sx1, ieee_quiet_nan)
+ if (ieee_signbit(sx1)) stop 7
+
+ sx1 = -1.3
+ if (.not. ieee_signbit(sx1)) stop 8
+ sx1 = -huge(sx1)
+ if (.not. ieee_signbit(sx1)) stop 9
+ sx1 = -ieee_value(sx1, ieee_positive_inf)
+ if (.not. ieee_signbit(sx1)) stop 10
+ sx1 = -tiny(sx1)
+ if (.not. ieee_signbit(sx1)) stop 11
+ sx1 = -tiny(sx1)
+ sx1 = sx1 / 101
+ if (.not. ieee_signbit(sx1)) stop 12
+ sx1 = 0
+ sx1 = -sx1
+ if (.not. ieee_signbit(sx1)) stop 13
+ sx1 = ieee_value(sx1, ieee_quiet_nan)
+ sx1 = -sx1
+ if (.not. ieee_signbit(sx1)) stop 14
+
+ ! Double
+
+ dx1 = 1.3
+ if (ieee_signbit(dx1)) stop 1
+ dx1 = huge(dx1)
+ if (ieee_signbit(dx1)) stop 2
+ dx1 = ieee_value(dx1, ieee_positive_inf)
+ if (ieee_signbit(dx1)) stop 3
+ dx1 = tiny(dx1)
+ if (ieee_signbit(dx1)) stop 4
+ dx1 = tiny(dx1)
+ dx1 = dx1 / 101
+ if (ieee_signbit(dx1)) stop 5
+ dx1 = 0
+ if (ieee_signbit(dx1)) stop 6
+ dx1 = ieee_value(dx1, ieee_quiet_nan)
+ if (ieee_signbit(dx1)) stop 7
+
+ dx1 = -1.3
+ if (.not. ieee_signbit(dx1)) stop 8
+ dx1 = -huge(dx1)
+ if (.not. ieee_signbit(dx1)) stop 9
+ dx1 = -ieee_value(dx1, ieee_positive_inf)
+ if (.not. ieee_signbit(dx1)) stop 10
+ dx1 = -tiny(dx1)
+ if (.not. ieee_signbit(dx1)) stop 11
+ dx1 = -tiny(dx1)
+ dx1 = dx1 / 101
+ if (.not. ieee_signbit(dx1)) stop 12
+ dx1 = 0
+ dx1 = -dx1
+ if (.not. ieee_signbit(dx1)) stop 13
+ dx1 = ieee_value(dx1, ieee_quiet_nan)
+ dx1 = -dx1
+ if (.not. ieee_signbit(dx1)) stop 14
+
+ ! Large kind 1
+
+ xk1 = 1.3
+ if (ieee_signbit(xk1)) stop 1
+ xk1 = huge(xk1)
+ if (ieee_signbit(xk1)) stop 2
+ xk1 = ieee_value(xk1, ieee_positive_inf)
+ if (ieee_signbit(xk1)) stop 3
+ xk1 = tiny(xk1)
+ if (ieee_signbit(xk1)) stop 4
+ xk1 = tiny(xk1)
+ xk1 = xk1 / 101
+ if (ieee_signbit(xk1)) stop 5
+ xk1 = 0
+ if (ieee_signbit(xk1)) stop 6
+ xk1 = ieee_value(xk1, ieee_quiet_nan)
+ if (ieee_signbit(xk1)) stop 7
+
+ xk1 = -1.3
+ if (.not. ieee_signbit(xk1)) stop 8
+ xk1 = -huge(xk1)
+ if (.not. ieee_signbit(xk1)) stop 9
+ xk1 = -ieee_value(xk1, ieee_positive_inf)
+ if (.not. ieee_signbit(xk1)) stop 10
+ xk1 = -tiny(xk1)
+ if (.not. ieee_signbit(xk1)) stop 11
+ xk1 = -tiny(xk1)
+ xk1 = xk1 / 101
+ if (.not. ieee_signbit(xk1)) stop 12
+ xk1 = 0
+ xk1 = -xk1
+ if (.not. ieee_signbit(xk1)) stop 13
+ xk1 = ieee_value(xk1, ieee_quiet_nan)
+ xk1 = -xk1
+ if (.not. ieee_signbit(xk1)) stop 14
+
+ ! Large kind 2
+
+ xk2 = 1.3
+ if (ieee_signbit(xk2)) stop 1
+ xk2 = huge(xk2)
+ if (ieee_signbit(xk2)) stop 2
+ xk2 = ieee_value(xk2, ieee_positive_inf)
+ if (ieee_signbit(xk2)) stop 3
+ xk2 = tiny(xk2)
+ if (ieee_signbit(xk2)) stop 4
+ xk2 = tiny(xk2)
+ xk2 = xk2 / 101
+ if (ieee_signbit(xk2)) stop 5
+ xk2 = 0
+ if (ieee_signbit(xk2)) stop 6
+ xk2 = ieee_value(xk2, ieee_quiet_nan)
+ if (ieee_signbit(xk2)) stop 7
+
+ xk2 = -1.3
+ if (.not. ieee_signbit(xk2)) stop 8
+ xk2 = -huge(xk2)
+ if (.not. ieee_signbit(xk2)) stop 9
+ xk2 = -ieee_value(xk2, ieee_positive_inf)
+ if (.not. ieee_signbit(xk2)) stop 10
+ xk2 = -tiny(xk2)
+ if (.not. ieee_signbit(xk2)) stop 11
+ xk2 = -tiny(xk2)
+ xk2 = xk2 / 101
+ if (.not. ieee_signbit(xk2)) stop 12
+ xk2 = 0
+ xk2 = -xk2
+ if (.not. ieee_signbit(xk2)) stop 13
+ xk2 = ieee_value(xk2, ieee_quiet_nan)
+ xk2 = -xk2
+ if (.not. ieee_signbit(xk2)) stop 14
+
+end
diff --git a/gcc/testsuite/gfortran.dg/literal_constants.f b/gcc/testsuite/gfortran.dg/literal_constants.f
new file mode 100644
index 0000000..4d1f1b7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/literal_constants.f
@@ -0,0 +1,20 @@
+! { dg-do compile }
+! { dg-options "-ffixed-form" }
+! PR fortran/92805 - blanks within literal constants in fixed-form mode
+
+ implicit none
+ integer, parameter :: ck = kind ("a") ! default character kind
+ integer, parameter :: rk = kind (1.0) ! default real kind
+ print *, 1_"abc"
+ print *, 1 _"abc"
+ print *, 1_ "abc"
+ print *, ck_"a"
+ print *, ck _"ab"
+ print *, ck_ "ab"
+ print *, 3.1415_4
+ print *, 3.1415 _4
+ print *, 3.1415_ 4
+ print *, 3.1415_rk
+ print *, 3.1415 _rk
+ print *, 3.1415_ rk
+ end
diff --git a/gcc/testsuite/gfortran.dg/literal_constants.f90 b/gcc/testsuite/gfortran.dg/literal_constants.f90
new file mode 100644
index 0000000..f8908f9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/literal_constants.f90
@@ -0,0 +1,24 @@
+! { dg-do compile }
+! { dg-options "-ffree-form" }
+! PR fortran/92805 - blanks within literal constants in free-form mode
+
+ implicit none
+ integer, parameter :: ck = kind ("a") ! default character kind
+ integer, parameter :: rk = kind (1.0) ! default real kind
+ print *, 1_"abc"
+ print *, 1 _"abc" ! { dg-error "Syntax error" }
+ print *, 1_ "abc" ! { dg-error "Missing kind-parameter" }
+ print *, 1 _ "abc" ! { dg-error "Syntax error" }
+ print *, ck_"a"
+ print *, ck _"ab" ! { dg-error "Syntax error" }
+ print *, ck_ "ab" ! { dg-error "Syntax error" }
+ print *, ck _ "ab" ! { dg-error "Syntax error" }
+ print *, 3.1415_4
+ print *, 3.1415 _4 ! { dg-error "Syntax error" }
+ print *, 3.1415_ 4 ! { dg-error "Missing kind-parameter" }
+ print *, 3.1415 _ 4 ! { dg-error "Syntax error" }
+ print *, 3.1415_rk
+ print *, 3.1415 _rk ! { dg-error "Syntax error" }
+ print *, 3.1415_ rk ! { dg-error "Missing kind-parameter" }
+ print *, 3.141 _ rk ! { dg-error "Syntax error" }
+ end
diff --git a/gcc/testsuite/gfortran.dg/pdt_15.f03 b/gcc/testsuite/gfortran.dg/pdt_15.f03
index 30c7f18..4ae1983 100644
--- a/gcc/testsuite/gfortran.dg/pdt_15.f03
+++ b/gcc/testsuite/gfortran.dg/pdt_15.f03
@@ -1,7 +1,7 @@
! { dg-do compile }
! { dg-options "-fdump-tree-original" }
!
-! Test the fix for PR82375. This is a wrinkle on the the allocatable
+! Test the fix for PR82375. This is a wrinkle on the allocatable
! version of pdt_13.f03, pdt_14.f03, whereby 'root' is now declared
! in a subroutine so that it should be cleaned up automatically. This
! is best tested with valgrind or its like.
diff --git a/gcc/testsuite/gfortran.dg/pointer_array_8.f90 b/gcc/testsuite/gfortran.dg/pointer_array_8.f90
index 3bb2a1b..1cc1787 100644
--- a/gcc/testsuite/gfortran.dg/pointer_array_8.f90
+++ b/gcc/testsuite/gfortran.dg/pointer_array_8.f90
@@ -30,7 +30,7 @@
select type (cptr)
type is (integer)
- if (any (cptr .ne. [1,2,3])) STOP 3! Check the the scalarizer works.
+ if (any (cptr .ne. [1,2,3])) STOP 3! Check the scalarizer works.
if (cptr(2) .ne. 2) STOP 4! Check ordinary array indexing.
end select
@@ -63,7 +63,7 @@ contains
addr = loc(arg)
select type (arg)
type is (integer)
- if (any (arg .ne. [1,2,3])) STOP 11! Check the the scalarizer works.
+ if (any (arg .ne. [1,2,3])) STOP 11! Check the scalarizer works.
if (arg(2) .ne. 2) STOP 12! Check ordinary array indexing.
end select
end subroutine
diff --git a/gcc/testsuite/gfortran.dg/pr103694.f90 b/gcc/testsuite/gfortran.dg/pr103694.f90
new file mode 100644
index 0000000..3ed8b20
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr103694.f90
@@ -0,0 +1,11 @@
+! { dg-do compile }
+! PR fortran/103694 - ICE in gfc_conv_expr_op
+! Contributed by G.Steinmetz
+
+subroutine s
+ type t
+ integer :: a(2)
+ end type
+ type(t) :: x((0.)/0)
+ integer :: n = size(x(1)%a) ! { dg-error "does not reduce to a constant expression" }
+end
diff --git a/gcc/testsuite/gfortran.dg/pr104314.f90 b/gcc/testsuite/gfortran.dg/pr104314.f90
new file mode 100644
index 0000000..510ded0
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr104314.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! PR fortran/104314 - ICE in deferred_op_assign
+! Contributed by G.Steinmetz
+
+program p
+ character(:), allocatable :: c(:)
+ c = ['123']
+ c = c == c ! { dg-error "Cannot convert" }
+end
diff --git a/gcc/testsuite/gfortran.dg/pr106556.f90 b/gcc/testsuite/gfortran.dg/pr106556.f90
new file mode 100644
index 0000000..01b89a8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr106556.f90
@@ -0,0 +1,10 @@
+! { dg-do compile }
+! { dg-options "-O1 -fnon-call-exceptions -ftree-loop-if-convert" }
+
+
+program p
+ real :: a(2)
+
+ a(:) = 1.0
+ if (minloc (a, dim = 1).ne.1) STOP 1
+end
diff --git a/gcc/testsuite/gfortran.dg/pr106557.f90 b/gcc/testsuite/gfortran.dg/pr106557.f90
new file mode 100644
index 0000000..d073f3e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr106557.f90
@@ -0,0 +1,19 @@
+! { dg-do run }
+! { dg-additional-options "-fdump-tree-original" }
+! PR fortran/106557 - nesting intrinsics ibset and transfer gives wrong result
+
+program p
+ implicit none
+ character(1) :: s
+
+ write(s,'(i1)') ibset (transfer (0, 0), 0)
+ if (s /= '1') stop 1
+ write(s,'(i1)') ibclr (transfer (1, 0), 0)
+ if (s /= '0') stop 2
+
+ ! These shall be fully resolved at compile time:
+ if (transfer (ibset (transfer (0, 0), 0), 0) /= 1) stop 3
+ if (transfer (ibclr (transfer (1, 0), 0), 0) /= 0) stop 4
+end
+
+! { dg-final { scan-tree-dump-times "_gfortran_stop_numeric" 2 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/pr106857.f90 b/gcc/testsuite/gfortran.dg/pr106857.f90
new file mode 100644
index 0000000..4b0f86a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr106857.f90
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! PR fortran/106857 - ICE in gfc_simplify_pack
+! Contributed by G.Steinmetz
+
+program p
+ type t
+ integer :: n
+ end type
+ type(t), parameter :: a(2,2) = t(1)
+ type(t), parameter :: b(4) = reshape(a, [2]) ! { dg-error "Different shape" }
+ type(t), parameter :: c(2) = pack(b, [.false.,.true.,.false.,.true.]) ! { dg-error "Different shape" }
+end
diff --git a/gcc/testsuite/gfortran.dg/pr106934.f90 b/gcc/testsuite/gfortran.dg/pr106934.f90
new file mode 100644
index 0000000..ac58a3e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr106934.f90
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! { dg-options "-O" }
+subroutine s
+ logical(1) :: a = .true.
+ logical(2) :: b
+ a = transfer(b, a)
+end
diff --git a/gcc/testsuite/gfortran.dg/pr106985.f90 b/gcc/testsuite/gfortran.dg/pr106985.f90
new file mode 100644
index 0000000..f4ed925
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr106985.f90
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/106985 - ICE in gfc_simplify_expr
+! Contributed by G.Steinmetz
+
+program p
+ integer, parameter :: a(2) = 1
+ integer, parameter :: b = a(2) + b ! { dg-error "before its definition is complete" }
+end
diff --git a/gcc/testsuite/gfortran.dg/pr106986.f90 b/gcc/testsuite/gfortran.dg/pr106986.f90
new file mode 100644
index 0000000..a309b25
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr106986.f90
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/106986 - ICE in simplify_findloc_nodim
+! Contributed by G.Steinmetz
+
+program p
+ integer, parameter :: a(:) = [1] ! { dg-error "deferred shape" }
+ print *, findloc (a, 1)
+end
diff --git a/gcc/testsuite/gfortran.dg/pr99349.f90 b/gcc/testsuite/gfortran.dg/pr99349.f90
new file mode 100644
index 0000000..e1f4628
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr99349.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! PR fortran/99349 - ICE in match_data_constant
+! Contributed by G.Steinmetz
+
+function f()
+ logical, parameter :: a((1.)/0) = .true. ! { dg-error "Parameter array" }
+ integer :: b
+ data b /a%kind/ ! { dg-error "Syntax error" }
+end
diff --git a/gcc/testsuite/gnat.dg/aspect2.adb b/gcc/testsuite/gnat.dg/aspect2.adb
deleted file mode 100644
index acf3329..0000000
--- a/gcc/testsuite/gnat.dg/aspect2.adb
+++ /dev/null
@@ -1,5 +0,0 @@
--- { dg-do compile }
-
-package body Aspect2 is
- procedure Foo is null;
-end Aspect2;
diff --git a/gcc/testsuite/gnat.dg/aspect2.ads b/gcc/testsuite/gnat.dg/aspect2.ads
deleted file mode 100644
index 73d3fe0..0000000
--- a/gcc/testsuite/gnat.dg/aspect2.ads
+++ /dev/null
@@ -1,30 +0,0 @@
-with Ada.Containers.Functional_Vectors;
-with Ada.Containers; use Ada.Containers;
-
-generic
- type Element_Type (<>) is private;
- type Element_Model (<>) is private;
- with function Model (X : Element_Type) return Element_Model is <>;
- with function Copy (X : Element_Type) return Element_Type is <>;
-package Aspect2 with SPARK_Mode is
- pragma Unevaluated_Use_Of_Old (Allow);
-
- type Vector is private;
-
- function Length (V : Vector) return Natural;
-
- procedure Foo;
-
-private
- type Element_Access is access Element_Type;
- type Element_Array is array (Positive range <>) of Element_Access with
- Dynamic_Predicate => Element_Array'First = 1;
- type Element_Array_Access is access Element_Array;
- type Vector is record
- Top : Natural := 0;
- Content : Element_Array_Access;
- end record;
-
- function Length (V : Vector) return Natural is
- (V.Top);
-end Aspect2;
diff --git a/gcc/testsuite/gnat.dg/config_pragma1.adb b/gcc/testsuite/gnat.dg/config_pragma1.adb
deleted file mode 100644
index bae42d2..0000000
--- a/gcc/testsuite/gnat.dg/config_pragma1.adb
+++ /dev/null
@@ -1,21 +0,0 @@
--- { dg-do run }
--- { dg-options "-gnata" }
-
-with Ada.Strings.Fixed; use Ada.Strings.Fixed;
-with Config_Pragma1_Pkg; use Config_Pragma1_Pkg;
-
-procedure Config_Pragma1 is
- Target : String10;
-
-begin
- for I in Positive10 loop
- Move
- (Source => Positive10'Image(I),
- Target => Target);
-
- FHM.Include
- (Container => FHMM,
- Key => Target,
- New_Item => I);
- end loop;
-end Config_Pragma1;
diff --git a/gcc/testsuite/gnat.dg/config_pragma1_pkg.ads b/gcc/testsuite/gnat.dg/config_pragma1_pkg.ads
deleted file mode 100644
index 1715068..0000000
--- a/gcc/testsuite/gnat.dg/config_pragma1_pkg.ads
+++ /dev/null
@@ -1,21 +0,0 @@
-pragma Assertion_Policy (Ignore);
-
-with Ada.Containers; use Ada.Containers;
-with Ada.Containers.Formal_Hashed_Maps;
-with Ada.Strings; use Ada.Strings;
-with Ada.Strings.Hash;
-
-package Config_Pragma1_Pkg is
- subtype Positive10 is Positive range 1 .. 1000;
- subtype String10 is String (Positive10);
-
- package FHM is new Formal_Hashed_Maps
- (Key_Type => String10,
- Element_Type => Positive10,
- Hash => Hash,
- Equivalent_Keys => "=");
-
- FHMM : FHM.Map
- (Capacity => 1_000_000,
- Modulus => FHM.Default_Modulus (Count_Type (1_000_000)));
-end Config_Pragma1_Pkg;
diff --git a/gcc/testsuite/gnat.dg/equal8.adb b/gcc/testsuite/gnat.dg/equal8.adb
deleted file mode 100644
index 9424abc..0000000
--- a/gcc/testsuite/gnat.dg/equal8.adb
+++ /dev/null
@@ -1,6 +0,0 @@
--- { dg-do compile }
--- { dg-options "-gnata" }
-
-package body Equal8 is
- procedure Foo is null;
-end Equal8;
diff --git a/gcc/testsuite/gnat.dg/equal8.ads b/gcc/testsuite/gnat.dg/equal8.ads
deleted file mode 100644
index 9b6694d..0000000
--- a/gcc/testsuite/gnat.dg/equal8.ads
+++ /dev/null
@@ -1,36 +0,0 @@
-with Ada.Containers.Formal_Hashed_Sets;
-with Ada.Strings.Hash;
-
--- with Dynamic_Strings; use Dynamic_Strings;
--- with Bounded_Dynamic_Strings;
-
-with Equal8_Pkg;
-
-package Equal8 is
-
- package Dynamic_Strings is
- -- pragma SPARK_Mode (On);
-
- package Bounded_Dynamic_Strings is new Equal8_Pkg
- (Component => Character,
- List_Index => Positive,
- List => String,
- Default_Value => ' ');
- type Dynamic_String is new Bounded_Dynamic_Strings.Sequence;
-
- end Dynamic_Strings;
- use Dynamic_Strings;
-
- subtype Subscription_Address is Dynamic_String (Capacity => 255);
-
- function Hashed_Subscription_Address (Element : Subscription_Address)
- return Ada.Containers.Hash_Type is
- (Ada.Strings.Hash (Value (Element)));
-
- package Subscription_Addresses is new Ada.Containers.Formal_Hashed_Sets
- (Element_Type => Subscription_Address,
- Hash => Hashed_Subscription_Address,
- Equivalent_Elements => "=");
-
- procedure Foo;
-end Equal8;
diff --git a/gcc/testsuite/gnat.dg/equal8_pkg.ads b/gcc/testsuite/gnat.dg/equal8_pkg.ads
deleted file mode 100644
index b454a2c..0000000
--- a/gcc/testsuite/gnat.dg/equal8_pkg.ads
+++ /dev/null
@@ -1,58 +0,0 @@
-generic
- type Component is private;
- type List_Index is range <>;
- type List is array (List_Index range <>) of Component;
- Default_Value : Component;
- -- with function "=" (Left, Right : List) return Boolean is <>;
-
-package Equal8_Pkg is
-
- pragma Pure;
-
- Maximum_Length : constant List_Index := List_Index'Last;
-
- subtype Natural_Index is List_Index'Base range 0 .. Maximum_Length;
- type Sequence (Capacity : Natural_Index) is private;
- -- from zero to Capacity.
-
- function Value (This : Sequence) return List;
- -- Returns the content of this sequence. The value returned is the
- -- "logical" value in that only that slice which is currently assigned
- -- is returned, as opposed to the entire physical representation.
-
- overriding
- function "=" (Left, Right : Sequence) return Boolean with
- Inline;
-
- function "=" (Left : Sequence; Right : List) return Boolean with
- Inline;
-
-private
- type Sequence (Capacity : Natural_Index) is record
- Current_Length : Natural_Index := 0;
- Content : List (1 .. Capacity) := (others => Default_Value);
- end record;
-
- -----------
- -- Value --
- -----------
-
- function Value (This : Sequence) return List is
- (This.Content (1 .. This.Current_Length));
-
- ---------
- -- "=" --
- ---------
-
- overriding
- function "=" (Left, Right : Sequence) return Boolean is
- (Value (Left) = Value (Right));
-
- ---------
- -- "=" --
- ---------
-
- function "=" (Left : Sequence; Right : List) return Boolean is
- (Value (Left) = Right);
-end Equal8_Pkg;
-
diff --git a/gcc/testsuite/gnat.dg/formal_containers.adb b/gcc/testsuite/gnat.dg/formal_containers.adb
deleted file mode 100644
index 185b946..0000000
--- a/gcc/testsuite/gnat.dg/formal_containers.adb
+++ /dev/null
@@ -1,23 +0,0 @@
--- { dg-do compile }
-
-with Ada.Containers.Formal_Hashed_Sets;
-
-procedure Formal_Containers is
- type T is new Integer;
-
- function Eq (X : T; Y : T) return Boolean;
-
- function Hash (X : T) return Ada.Containers.Hash_Type is (0);
-
- package TSet is new Ada.Containers.Formal_Hashed_Sets
- (Element_Type => T,
- Hash => Hash,
- Equivalent_Elements => Eq);
-
- S : Tset.Set := TSet.Empty_Set;
-
- function Eq (X : T; Y : T) return Boolean is
- begin
- return TSet.Contains (S, X) or TSet.Contains (S, Y);
- end Eq;
-begin null; end Formal_Containers;
diff --git a/gcc/testsuite/gnat.dg/iter1.adb b/gcc/testsuite/gnat.dg/iter1.adb
deleted file mode 100644
index a0a69cf..0000000
--- a/gcc/testsuite/gnat.dg/iter1.adb
+++ /dev/null
@@ -1,20 +0,0 @@
--- { dg-do compile }
-
-with Ada.Text_IO;
-
-package body Iter1 is
-
- type Table is array (Integer range <>) of Float;
- My_Table : Table := (1.0, 2.0, 3.0);
-
- procedure Dummy (L : My_Lists.List) is
- begin
- for Item : Boolean of L loop -- { dg-error "subtype indication does not match element type" }
- Ada.Text_IO.Put_Line (Integer'Image (Item));
- end loop;
-
- for Item : Boolean of My_Table loop -- { dg-error "subtype indication does not match component type" }
- null;
- end loop;
- end;
-end Iter1;
diff --git a/gcc/testsuite/gnat.dg/iter1.ads b/gcc/testsuite/gnat.dg/iter1.ads
deleted file mode 100644
index 8329f75..0000000
--- a/gcc/testsuite/gnat.dg/iter1.ads
+++ /dev/null
@@ -1,8 +0,0 @@
-with Ada.Containers.Formal_Doubly_Linked_Lists;
-
-package Iter1 is
- package My_Lists is new Ada.Containers.Formal_Doubly_Linked_Lists
- (Element_Type => Integer);
-
- procedure Dummy (L : My_Lists.List);
-end Iter1;
diff --git a/gcc/testsuite/lib/g++.exp b/gcc/testsuite/lib/g++.exp
index 24ef068..16e61fb 100644
--- a/gcc/testsuite/lib/g++.exp
+++ b/gcc/testsuite/lib/g++.exp
@@ -303,11 +303,6 @@ proc g++_target_compile { source dest type options } {
global flags_to_postpone
global board_info
- if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
- lappend options "libs=${gluefile}"
- lappend options "ldflags=${wrap_flags}"
- }
-
global TEST_EXTRA_LIBS
if [info exists TEST_EXTRA_LIBS] {
lappend options "ldflags=$TEST_EXTRA_LIBS"
@@ -333,6 +328,11 @@ proc g++_target_compile { source dest type options } {
set options [dg-additional-files-options $options $source]
+ if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
+ lappend options "libs=${gluefile}"
+ lappend options "ldflags=${wrap_flags}"
+ }
+
set result [target_compile $source $dest $type $options]
if {[board_info $tboard exists multilib_flags]} {
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index f58b9e6..23ec038 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -656,7 +656,7 @@ proc gcc-dg-target-supports-debug-format { target_compile trivial type } {
proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } {
if ![info exists DEBUG_TORTURE_OPTIONS] {
set DEBUG_TORTURE_OPTIONS ""
- foreach type {-gctf -gdwarf-2 -gstabs -gstabs+ -gxcoff -gxcoff+} {
+ foreach type {-gctf -gdwarf-2} {
if [expr [gcc-dg-target-supports-debug-format \
$target_compile $trivial $type]] {
if { $type == "-gctf" } {
diff --git a/gcc/testsuite/lib/gcc.exp b/gcc/testsuite/lib/gcc.exp
index 1b25ebe..2f145d0 100644
--- a/gcc/testsuite/lib/gcc.exp
+++ b/gcc/testsuite/lib/gcc.exp
@@ -129,16 +129,6 @@ proc gcc_target_compile { source dest type options } {
global flags_to_postpone
global board_info
- if {[target_info needs_status_wrapper] != "" && \
- [target_info needs_status_wrapper] != "0" && \
- [info exists gluefile] } {
- lappend options "libs=${gluefile}"
- lappend options "ldflags=$wrap_flags"
- if { $type == "executable" } {
- set options [concat "{additional_flags=-dumpbase \"\"}" $options]
- }
- }
-
global TEST_EXTRA_LIBS
if [info exists TEST_EXTRA_LIBS] {
lappend options "ldflags=$TEST_EXTRA_LIBS"
@@ -170,6 +160,17 @@ proc gcc_target_compile { source dest type options } {
lappend options "timeout=[timeout_value]"
lappend options "compiler=$GCC_UNDER_TEST"
set options [dg-additional-files-options $options $source]
+
+ if {[target_info needs_status_wrapper] != "" && \
+ [target_info needs_status_wrapper] != "0" && \
+ [info exists gluefile] } {
+ lappend options "libs=${gluefile}"
+ lappend options "ldflags=$wrap_flags"
+ if { $type == "executable" } {
+ set options [concat "{additional_flags=-dumpbase \"\"}" $options]
+ }
+ }
+
set return_val [target_compile $source $dest $type $options]
if {[board_info $tboard exists multilib_flags]} {
diff --git a/gcc/testsuite/lib/gfortran-dg.exp b/gcc/testsuite/lib/gfortran-dg.exp
index 7407be4..d4a245e 100644
--- a/gcc/testsuite/lib/gfortran-dg.exp
+++ b/gcc/testsuite/lib/gfortran-dg.exp
@@ -170,7 +170,7 @@ proc gfortran-dg-debug-runtest { target_compile trivial opt_opts testcases } {
if ![info exists DEBUG_TORTURE_OPTIONS] {
set DEBUG_TORTURE_OPTIONS ""
- set type_list [list "-gstabs" "-gstabs+" "-gxcoff" "-gxcoff+" "-gdwarf-2" ]
+ set type_list [list "-gdwarf-2" ]
foreach type $type_list {
set comp_output [$target_compile \
"$srcdir/$subdir/$trivial" "trivial.S" assembly \
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 4ed7b25..703aba4 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -310,12 +310,6 @@ proc check_weak_available { } {
return 1
}
- # HP-UX 10.X doesn't support it
-
- if { [istarget hppa*-*-hpux10*] } {
- return 0
- }
-
# nvptx (nearly) supports it
if { [istarget nvptx-*-*] } {
@@ -562,8 +556,6 @@ proc check_effective_target_trampolines { } {
if { [istarget avr-*-*]
|| [istarget msp430-*-*]
|| [istarget nvptx-*-*]
- || [istarget hppa2.0w-hp-hpux11.23]
- || [istarget hppa64-hp-hpux11.23]
|| [istarget pru-*-*]
|| [istarget bpf-*-*] } {
return 0;
@@ -611,7 +603,7 @@ proc check_effective_target_keeps_null_pointer_checks { } {
if [target_info exists keeps_null_pointer_checks] {
return 1
}
- if { [istarget msp430-*-*] || [istarget cr16-*-*] } {
+ if { [istarget msp430-*-*] } {
return 1;
}
return 0
@@ -1125,15 +1117,6 @@ proc check_effective_target_pthread {} {
} "-pthread"]
}
-# Return 1 if compilation with -gstabs is error-free for trivial
-# code, 0 otherwise.
-
-proc check_effective_target_stabs {} {
- return [check_no_compiler_messages stabs object {
- void foo (void) { }
- } "-gstabs"]
-}
-
# Return 1 if compilation with -mpe-aligned-commons is error-free
# for trivial code, 0 otherwise.
@@ -2288,7 +2271,7 @@ proc check_p9modulo_hw_available { } {
{
int i = 5, j = 3, r = -1;
asm ("modsw %0,%1,%2" : "+r" (r) : "r" (i), "r" (j));
- return (r == 2);
+ return (r != 2);
}
} $options
}
@@ -2827,10 +2810,7 @@ proc check_mkfifo_available {} {
proc check_cxa_atexit_available { } {
return [check_cached_effective_target cxa_atexit_available {
- if { [istarget hppa*-*-hpux10*] } {
- # HP-UX 10 doesn't have __cxa_atexit but subsequent test passes.
- expr 0
- } elseif { [istarget *-*-vxworks] } {
+ if { [istarget *-*-vxworks] } {
# vxworks doesn't have __cxa_atexit but subsequent test passes.
expr 0
} else {
@@ -6259,9 +6239,12 @@ proc check_effective_target_powerpc_sqrt { } {
}
return [check_no_compiler_messages powerpc_sqrt object {
+ void test (void)
+ {
#ifndef _ARCH_PPCSQ
#error _ARCH_PPCSQ is not defined
#endif
+ }
} {}]
}
@@ -6369,71 +6352,92 @@ proc check_effective_target_powerpc_p9modulo_ok { } {
# as provided by the test.
proc check_effective_target_has_arch_pwr5 { } {
return [check_no_compiler_messages_nocache arch_pwr5 assembly {
+ void test (void)
+ {
#ifndef _ARCH_PWR5
#error does not have power5 support.
#else
/* "has power5 support" */
#endif
+ }
} [current_compiler_flags]]
}
proc check_effective_target_has_arch_pwr6 { } {
return [check_no_compiler_messages_nocache arch_pwr6 assembly {
+ void test (void)
+ {
#ifndef _ARCH_PWR6
#error does not have power6 support.
#else
/* "has power6 support" */
#endif
+ }
} [current_compiler_flags]]
}
proc check_effective_target_has_arch_pwr7 { } {
return [check_no_compiler_messages_nocache arch_pwr7 assembly {
+ void test (void)
+ {
#ifndef _ARCH_PWR7
#error does not have power7 support.
#else
/* "has power7 support" */
#endif
+ }
} [current_compiler_flags]]
}
proc check_effective_target_has_arch_pwr8 { } {
return [check_no_compiler_messages_nocache arch_pwr8 assembly {
+ void test (void)
+ {
#ifndef _ARCH_PWR8
#error does not have power8 support.
#else
/* "has power8 support" */
#endif
+ }
} [current_compiler_flags]]
}
proc check_effective_target_has_arch_pwr9 { } {
return [check_no_compiler_messages_nocache arch_pwr9 assembly {
+ void test (void)
+ {
#ifndef _ARCH_PWR9
#error does not have power9 support.
#else
/* "has power9 support" */
#endif
+ }
} [current_compiler_flags]]
}
proc check_effective_target_has_arch_pwr10 { } {
return [check_no_compiler_messages_nocache arch_pwr10 assembly {
+ void test (void)
+ {
#ifndef _ARCH_PWR10
#error does not have power10 support.
#else
/* "has power10 support" */
#endif
+ }
} [current_compiler_flags]]
}
proc check_effective_target_has_arch_ppc64 { } {
return [check_no_compiler_messages_nocache arch_ppc64 assembly {
+ void test (void)
+ {
#ifndef _ARCH_PPC64
#error does not have ppc64 support.
#else
/* "has ppc64 support" */
#endif
+ }
} [current_compiler_flags]]
}
@@ -6520,9 +6524,12 @@ proc check_effective_target_powerpc_float128_hw_ok { } {
proc check_effective_target_ppc_float128 { } {
return [check_no_compiler_messages_nocache ppc_float128 object {
+ void test (void)
+ {
#ifndef __FLOAT128__
nope no good
#endif
+ }
}]
}
@@ -6530,9 +6537,12 @@ proc check_effective_target_ppc_float128 { } {
proc check_effective_target_ppc_float128_insns { } {
return [check_no_compiler_messages_nocache ppc_float128 object {
+ void test (void)
+ {
#ifndef __FLOAT128_HARDWARE__
nope no good
#endif
+ }
}]
}
@@ -6540,9 +6550,12 @@ proc check_effective_target_ppc_float128_insns { } {
proc check_effective_target_powerpc_vsx { } {
return [check_no_compiler_messages_nocache powerpc_vsx object {
+ void test (void)
+ {
#ifndef __VSX__
nope no vsx
#endif
+ }
}]
}
@@ -6814,6 +6827,7 @@ proc check_effective_target_vect_var_shift { } {
return [check_cached_effective_target_indexed vect_var_shift {
expr {(([istarget i?86-*-*] || [istarget x86_64-*-*])
&& [check_avx2_available])
+ || [istarget aarch64*-*-*]
}}]
}
@@ -8646,6 +8660,13 @@ proc check_effective_target_bswap { } {
|| [istarget powerpc*-*-*]
|| [istarget rs6000-*-*]
|| [istarget s390*-*-*]
+ || ([istarget riscv*-*-*]
+ && [check_no_compiler_messages_nocache riscv_zbb object {
+ #if __riscv_zbb <= 0
+ #error ZBB is not enabled
+ #endif
+ int i;
+ } ""])
|| ([istarget arm*-*-*]
&& [check_no_compiler_messages_nocache arm_v6_or_later object {
#if __ARM_ARCH < 6
diff --git a/gcc/testsuite/lib/wrapper.exp b/gcc/testsuite/lib/wrapper.exp
index 5a601b2..4a7d569 100644
--- a/gcc/testsuite/lib/wrapper.exp
+++ b/gcc/testsuite/lib/wrapper.exp
@@ -22,7 +22,7 @@
# the compiler when compiling FILENAME.
proc ${tool}_maybe_build_wrapper { filename args } {
- global gluefile wrap_flags
+ global gluefile wrap_flags gcc_adjusted_linker_flags
if { [target_info needs_status_wrapper] != "" \
&& [target_info needs_status_wrapper] != "0" \
@@ -43,6 +43,11 @@ proc ${tool}_maybe_build_wrapper { filename args } {
if { $result != "" } {
set gluefile [lindex $result 0]
set wrap_flags [lindex $result 1]
+
+ # Reset the cached state of the adjusted flags
+ if { [info exists gcc_adjusted_linker_flags] } {
+ set gcc_adjusted_linker_flags 0
+ }
}
}
}
diff --git a/gcc/testsuite/objc.dg/stabs-1.m b/gcc/testsuite/objc.dg/stabs-1.m
deleted file mode 100644
index b97e4d6..0000000
--- a/gcc/testsuite/objc.dg/stabs-1.m
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Check if the final SO STABS record goes into the .text section. */
-/* Contributed by Ziemowit Laski <zlaski@apple.com> */
-
-/* { dg-do compile { target stabs } } */
-/* { dg-options "-gstabs" } */
-/* { dg-additional-options "-Wno-objc-root-class" } */
-
-@interface MyClass
-+ newWithArg: arg;
-@end
-
-@implementation MyClass
-+ newWithArg: arg
-{
-}
-@end
-
-/* See PR target/52152 for the xfail. */
-/* { dg-final { scan-assembler "(.SUBSPA.*\[\$\]CODE\[\$\]|.text\"?)\n\t.stabs.*100,0,0,(\[\.\$\])?L?L\[\$\]?etext\[0-9\]*\n(\[\.\$\])?L?L\[\$\]?etext" { xfail mips*-*-elf* } } } */