aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/c-c++-common
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
committerBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
commit1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch)
treec607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/c-c++-common
parent283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff)
downloadtoolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/c-c++-common')
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wcast-qual-1.c162
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wconversion-real.c85
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wfloat-conversion.c58
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-1.c12
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-2.c12
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-3.c22
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wpointer-arith-1.c26
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wsequence-point-1.c17
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wsizeof-pointer-memaccess1.c161
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wsizeof-pointer-memaccess2.c482
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wunused-local-typedefs.c44
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-1.c179
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-10.c68
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-11.c12
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-12.c26
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-13.c27
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-14.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-2.c20
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-3.c37
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-4.c29
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-5.c33
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-6.c15
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-7.c48
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-8.c19
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-9.c80
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wvarargs-2.c33
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wvarargs.c54
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/abi-bf.c3
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/array-lit.c12
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/attrib-1.c62
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/clone-test-1.c46
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/force-inline-opt0-1.c16
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/global-overflow-1.c28
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/heap-overflow-1.c31
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/inc.c21
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/memcmp-1.c20
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/memcmp-2.c10
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/no-asan-globals.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/no-asan-stack.c16
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/no-instrument-reads.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/no-instrument-writes.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c68
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-2.c25
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-3.c18
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-4.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-5.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-6.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-7.c23
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-8.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/no-use-after-return.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/null-deref-1.c22
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/pr56330.c24
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/pr59029.c7
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/pr59063-1.c11
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/pr59063-2.c12
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/rlimit-mmap-test-1.c22
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/sanity-check-pure-c-1.c16
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/sleep-before-dying-1.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/stack-overflow-1.c23
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/strip-path-prefix-1.c15
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/strncpy-overflow-1.c21
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/swapcontext-test-1.c63
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/use-after-free-1.c22
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asan/use-after-return-1.c53
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asmgoto-1.c15
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asmgoto-2.c20
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asmgoto-3.c10
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/asmgoto-4.c44
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/attr-used-2.c11
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/attr-used.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/attributes-1.c23
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/builtin-offsetof.c29
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c48
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/array_test1.c84
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/array_test2.c128
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/array_test_ND.c102
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/builtin_fn_custom.c69
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/builtin_fn_mutating.c69
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/builtin_func_double.c124
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/builtin_func_double2.c77
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/comma_exp.c55
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/conditional.c44
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/decl-ptr-colon.c19
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/dimensionless-arrays.c10
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/exec-once.c44
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/exec-once2.c87
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/fn_ptr.c21
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/fp_triplet_values.c28
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/gather-scatter-errors.c19
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/gather_scatter.c60
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/if_test.c306
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/if_test_errors.c56
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/misc.c112
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/n-ptr-test.c48
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/parser_errors.c11
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/parser_errors2.c12
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/parser_errors3.c12
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/parser_errors4.c11
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57457-2.c15
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57457.c39
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c28
-rwxr-xr-xgcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c17
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57577.c12
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/rank_mismatch.c18
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/rank_mismatch2.c27
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/rank_mismatch3.c19
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_implicit.c11
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_implicit2.c11
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_implicit_ex.c29
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_reduce_ind_same_value.c21
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_reduce_max_min_ind.c17
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_reduce_return.c29
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/side-effects-1.c26
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/test_builtin_return.c73
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/test_sec_limits.c18
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/tst_lngth.c19
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/vla.c20
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/compound_cilk_spawn.c26
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/concec_cilk_spawn.c20
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/fib.c54
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/fib_init_expr_xy.c68
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/fib_no_return.c73
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/fib_no_sync.c67
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_spawns.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/no_args_error.c11
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/pr59631.c15
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197-2.c35
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197.c66
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/spawn_in_return.c8
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/spawnee_inline.c80
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/spawner_inline.c67
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/spawning_arg.c37
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/steal_check.c43
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/sync_wo_spawn.c9
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/test__cilk.c10
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/varargs_test.c47
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/body.c34
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/clauses1.c80
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/clauses2.c18
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/clauses3.c39
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/for1.c132
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/for2.c8
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/for3.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/reduction-1.c38
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/reduction-2.c36
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/reduction-3.c41
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/run-1.c28
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/safelen.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/vectorlength-2.c12
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/vectorlength-3.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/vectorlength.c21
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/ef_error.c32
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/ef_error2.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/ef_error3.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/ef_test.c78
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/ef_test2.c16
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/vlength_errors.c59
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/convert-vec-1.c4
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-1.c11
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cpp/normalize-3.c35
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cpp/openmp-define-1.c6
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cpp/openmp-define-2.c7
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cpp/openmp-define-3.c11
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr45457.c18
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr58844-1.c8
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr58844-2.c8
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr60400-1.h3
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr60400-2.h4
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr60400.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c15
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-1.c4
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-2.c5
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-3.c4
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-4.c4
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-zero-in-literals-1.cbin0 -> 240 bytes
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-zero-location-2.c10
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-zero-location.c8
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cxxbitfields-3.c22
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/cxxbitfields-6.c17
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/call-by-value.c43
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/cast.c75
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq-const.c28
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq-d128.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq-d32.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq-d64.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq-dfp.c53
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq.h92
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel-const.c57
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel-d128.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel-d32.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel-d64.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel-dfp.c53
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel.h132
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-special-d128.c15
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-special-d32.c15
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-special-d64.c15
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-special.h284
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/constants-zero.c159
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-10.c107
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-11.c58
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-12.c16
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-13.c18
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-14.c15
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-2.c33
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-3.c21
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-4.c21
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-5.c21
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-6.c178
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-7.c83
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-8.c71
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-9.c192
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-fold.c118
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp.c131
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-dfp-fold-2.c15
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-dfp-fold.c47
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-dfp.c94
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-int-fold.c173
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-int-max-fold.c148
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-int-max.c146
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-int-saturate.c64
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-int.c199
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert.h462
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/dfp-dbg.h20
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-array.c157
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-deref.c205
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-mixed.c174
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-pointer.c205
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-scalar.c192
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-struct.c93
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d128-2.c22
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d128.c19
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d32.c19
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d64.c19
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate.h143
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-dfp.c95
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed-2.c105
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed.c102
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-size0.c41
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/inf-1.c61
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/loop-index.c57
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/modes.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/nan-1.c106
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/nan-2.c53
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-arith-fold.c45
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-assignment.c56
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-comma.c47
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-cond.c57
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-logical.c63
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-unary.c52
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr31385.c30
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr33466.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr35620.c27
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr36800.c32
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr39034.c100
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr39035.c71
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr39902.c226
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr39986.c32
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/signbit-1.c40
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/signbit-2.c36
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/struct-layout-1.c71
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/usual-arith-conv-const.c32
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dfp/usual-arith-conv.c117
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dwarf2/pr43190.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/dwarf2/vla1.c11
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/fmax-errors.c11
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/fold-bitand-4.c45
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/fold-divmul-1.c11
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-1.c99
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-10.c25
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-12.c306
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-13.c9
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-14.c43
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-15.c44
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-16.c34
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-2.c23
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-3.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-4.c24
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-7.c23
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-8.c21
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-9.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/cancel-1.c396
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/depend-1.c79
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/depend-2.c19
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/map-1.c109
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr51360.c27
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr53580.c19
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr54017.c65
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr56883.c57
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr57824.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr58257.c15
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr58472.c16
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr58551.c33
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr58703.c6
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr58809.c31
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr59152.c40
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr59467.c68
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr59917-1.c22
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr59917-2.c22
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/sections1.c73
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd1.c31
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd2.c29
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd3.c26
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd4.c21
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd5.c19
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd6.c27
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/gomp/single1.c15
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/guality/pr43141.c16
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/init-vec-1.c4
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/int128-1.c41
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/int128-2.c157
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/int128-types-1.c666
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/opaque-vector.c22
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr20000.c32
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr20318.c3
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr28656.c29
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr33193.c19
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr33763.c60
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr36282-1.c12
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr36282-2.c10
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr36282-3.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr36282-4.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr36513-2.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr36513.c15
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr37743.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr41779.c56
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr41935.c70
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr42674.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr43690.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr43772.c45
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr43942.c33
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr44832.c162
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr46562-2.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr46562.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr48418.c20
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr51294.c9
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr51712.c19
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr51768.c25
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr52177.c23
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr52181.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr53633.c16
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr54486.c33
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr54988.c20
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr55619.c11
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr55771.c12
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr56302.c9
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr56566.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr56607.c29
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr57793.c23
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr58346-1.c24
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr58346-2.c8
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr58346-3.c16
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr59032.c30
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr59037.c12
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr59223.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr59280.c4
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr60101.c112
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/raw-string-1.c141
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/raw-string-10.c20
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/raw-string-11.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/raw-string-12.cbin0 -> 137 bytes
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/raw-string-13.c272
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/raw-string-14.c39
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/raw-string-15.c272
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/raw-string-16.c33
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/raw-string-17.c30
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/raw-string-18.c21
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/raw-string-19.c22
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/raw-string-2.c113
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/raw-string-3.c59
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/raw-string-4.c29
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/raw-string-5.c27
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/raw-string-6.c6
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/raw-string-7.c24
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/raw-string-8.c10
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/raw-string-9.c19
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/restrict-1.c20
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/restrict-2.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/restrict-4.c19
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/rotate-1.c581
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/rotate-1a.c49
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/rotate-2.c583
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/rotate-2a.c6
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/rotate-3.c581
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/rotate-3a.c6
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/rotate-4.c583
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/rotate-4a.c6
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/rotate-5.c43
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/scal-to-vec1.c43
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/scal-to-vec2.c21
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/simulate-thread/bitfields-1.c71
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/simulate-thread/bitfields-2.c59
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/simulate-thread/bitfields-3.c63
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/simulate-thread/bitfields-4.c60
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/20100127.c36
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/20111206.c53
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/abort-1.c6
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/abort-2.c11
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/abort-3.c8
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/atomic-1.c9
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/atomic-2.c10
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/attrib-1.c25
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/cancel-1.c17
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/freq.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/inline-asm-2.c8
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/inline-asm.c17
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/ipa-1.c23
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/malloc.c26
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/memcpy-1.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/omp.c23
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/outer-1.c31
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/pr54893.c16
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/safe-1.c69
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/safe-2.c43
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/safe-3.c48
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/trxn-expr-2.c15
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/trxn-expr-3.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/trxn-expr.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tm/wrap-1.c10
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-alias-1.c35
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-add.c55
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-add.c55
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-div.c47
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-mul.c55
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-sub.c55
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mul-minus-one.c63
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mul-one.c63
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mul.c55
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-sub.c55
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign.h80
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/pr42834.c23
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/pr46137.c18
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/pr53505.c42
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/pr57945.c11
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/pr58794-1.c29
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/pr58794-2.c21
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/pr60026.c28
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-compare-1.c124
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-compare-2.c29
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-shift.c49
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-shift1.c18
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-shift2.c60
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-subscript-1.c61
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-subscript-2.c69
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-subscript-3.c26
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-16.inc81
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-2.inc38
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-4.inc39
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-8.inc101
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-main.inc26
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v16hi.c5
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v16qi.c5
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v2df.c15
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v2di.c15
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v2sf.c21
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v2si.c18
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v4df.c19
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v4di.c19
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v4hi.c15
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v4sf.c25
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v4si.c22
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v8hi.c23
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v8qi.c23
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v8si.c30
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/transparent-union-1.c5
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tsan/atomic_stack.c31
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tsan/fd_pipe_race.c36
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tsan/free_race.c27
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tsan/free_race2.c28
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tsan/mutexset1.c40
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_barrier.c32
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_barrier2.c32
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c43
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_mutex2.c25
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tsan/simple_race.c50
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tsan/simple_stack.c65
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tsan/sleep_sync.c30
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tsan/thread_leak.c16
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tsan/thread_leak1.c18
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tsan/thread_leak2.c21
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tsan/tiny_race.c22
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tsan/tls_race.c20
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/tsan/write_in_reader_lock.c36
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/attrib-1.c33
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/const-char-1.c9
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/const-expr-1.c22
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-1.c24
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-2.c23
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-3.c21
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-4.c11
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-5.c8
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/load-bool-enum.c29
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-1.c12
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-10.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-11.c16
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-2.c12
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-3.c18
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-4.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-5.c16
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-6.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-7.c17
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-8.c16
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-9.c16
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-1.c269
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-2.c7
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-add-1.c67
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-add-2.c60
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-int128.c47
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-mul-1.c53
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-mul-2.c26
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-mul-3.c46
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-mul-4.c86
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-negate-1.c38
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-negate-2.c45
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-sub-1.c69
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-sub-2.c54
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr58443-1.c11
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr58443-2.c11
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr58443-3.c18
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr59333.c18
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr59397.c10
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr59503.c21
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr59667.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr60613-1.c41
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr60613-2.c36
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/save-expr-1.c19
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/save-expr-2.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/save-expr-3.c16
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/save-expr-4.c16
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-1.c31
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-2.c23
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-3.c19
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-4.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-5.c33
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-6.c38
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/typedef-1.c12
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/undefined-1.c33
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/unreachable-1.c10
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/vla-1.c119
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/vla-2.c22
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/vla-3.c25
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/vla-4.c21
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/uninit-17.c25
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/uninit-D-O0.c9
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/uninit-D.c9
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/uninit-E-O0.c9
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/uninit-E.c9
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/uninit-F-O0.c9
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/uninit-F.c9
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/uninit-G-O0.c9
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/uninit-G.c9
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/uninit-pr51010.c13
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/vector-1.c15
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/vector-2.c20
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/vector-3.c8
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/vector-4.c12
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/vector-compare-1.c22
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/vector-compare-2.c31
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/vector-compare-3.c25
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/vector-init-1.c6
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/vector-init-2.c25
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/vector-scalar-2.c14
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/vector-scalar.c10
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/vector-shift.c15
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/vector-shift1.c19
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/vector-shift3.c16
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/vector-subscript-1.c16
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/vector-subscript-2.c12
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/vector-subscript-3.c18
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/vla-1.c21
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/warn-ommitted-condop.c29
570 files changed, 26424 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wcast-qual-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wcast-qual-1.c
new file mode 100644
index 000000000..640e4f0b6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wcast-qual-1.c
@@ -0,0 +1,162 @@
+/* { dg-do compile } */
+/* { dg-options "-Wcast-qual" } */
+
+void
+f1 (void *bar)
+{
+ const void *p1 = (const void *) bar;
+ const char *p2 = (const char *) bar;
+ const void **p3 = (const void **) bar;
+ const char **p4 = (const char **) bar;
+ const void * const *p5 = (const void * const *) bar;
+ const char * const *p6 = (const char * const *) bar;
+ void * const *p7 = (void * const *) bar;
+ char * const *p8 = (char * const *) bar;
+ const void ***p9 = (const void ***) bar;
+ const char ***p10 = (const char ***) bar;
+ void * const **p11 = (void * const **) bar;
+ char * const **p12 = (char * const **) bar;
+ void ** const *p13 = (void ** const *) bar;
+ char ** const *p14 = (char ** const *) bar;
+ const void * const **p15 = (const void * const **) bar;
+ const char * const **p16 = (const char * const **) bar;
+ const void ** const *p17 = (const void ** const *) bar;
+ const char ** const *p18 = (const char ** const *) bar;
+ void * const * const * p19 = (void * const * const *) bar;
+ char * const * const * p20 = (char * const * const *) bar;
+ const void * const * const *p21 = (const void * const * const *) bar;
+ const char * const * const *p22 = (const char * const * const *) bar;
+}
+
+void
+f2 (void **bar)
+{
+ const void *p1 = (const void *) bar;
+ const char *p2 = (const char *) bar;
+ const void **p3 = (const void **) bar; /* { dg-warning "cast" } */
+ const char **p4 = (const char **) bar;
+ const void * const *p5 = (const void * const *) bar;
+ const char * const *p6 = (const char * const *) bar;
+ void * const *p7 = (void * const *) bar;
+ char * const *p8 = (char * const *) bar;
+ const void ***p9 = (const void ***) bar;
+ const char ***p10 = (const char ***) bar;
+ void * const **p11 = (void * const **) bar;
+ char * const **p12 = (char * const **) bar;
+ void ** const *p13 = (void ** const *) bar;
+ char ** const *p14 = (char ** const *) bar;
+ const void * const **p15 = (const void * const **) bar;
+ const char * const **p16 = (const char * const **) bar;
+ const void ** const *p17 = (const void ** const *) bar;
+ const char ** const *p18 = (const char ** const *) bar;
+ void * const * const * p19 = (void * const * const *) bar;
+ char * const * const * p20 = (char * const * const *) bar;
+ const void * const * const *p21 = (const void * const * const *) bar;
+ const char * const * const *p22 = (const char * const * const *) bar;
+}
+
+void
+f3 (void ***bar)
+{
+ const void *p1 = (const void *) bar;
+ const char *p2 = (const char *) bar;
+ const void **p3 = (const void **) bar;
+ const char **p4 = (const char **) bar;
+ const void * const *p5 = (const void * const *) bar;
+ const char * const *p6 = (const char * const *) bar;
+ void * const *p7 = (void * const *) bar;
+ char * const *p8 = (char * const *) bar;
+ const void ***p9 = (const void ***) bar; /* { dg-warning "cast" } */
+ const char ***p10 = (const char ***) bar;
+ void * const **p11 = (void * const **) bar; /* { dg-warning "cast" } */
+ char * const **p12 = (char * const **) bar;
+ void ** const *p13 = (void ** const *) bar;
+ char ** const *p14 = (char ** const *) bar;
+ const void * const **p15 = (const void * const **) bar; /* { dg-warning "cast" } */
+ const char * const **p16 = (const char * const **) bar;
+ const void ** const *p17 = (const void ** const *) bar; /* { dg-warning "cast" } */
+ const char ** const *p18 = (const char ** const *) bar;
+ void * const * const * p19 = (void * const * const *) bar;
+ char * const * const * p20 = (char * const * const *) bar;
+ const void * const * const *p21 = (const void * const * const *) bar;
+ const char * const * const *p22 = (const char * const * const *) bar;
+}
+
+void
+f4 (void * const **bar)
+{
+ const void ***p9 = (const void ***) bar; /* { dg-warning "cast" } */
+ void * const **p11 = (void * const **) bar;
+ void ** const *p13 = (void ** const *) bar; /* { dg-warning "cast" } */
+ const void * const **p15 = (const void * const **) bar; /* { dg-warning "cast" } */
+ const void ** const *p17 = (const void ** const *) bar; /* { dg-warning "cast" } */
+ void * const * const * p19 = (void * const * const *) bar;
+ const void * const * const *p21 = (const void * const * const *) bar;
+}
+
+void
+f5 (char ***bar)
+{
+ volatile const char ***p9 = (volatile const char ***) bar; /* { dg-warning "cast" } */
+ volatile char * const **p11 = (volatile char * const **) bar; /* { dg-warning "cast" } */
+ volatile char ** const *p13 = (volatile char ** const *) bar; /* { dg-warning "cast" } */
+ volatile const char * const **p15 = (volatile const char * const **) bar; /* { dg-warning "cast" } */
+ volatile const char ** const *p17 = (volatile const char ** const *) bar; /* { dg-warning "cast" } */
+ volatile char * const * const * p19 = (volatile char * const * const *) bar;
+ volatile const char * const * const *p21 = (volatile const char * const * const *) bar;
+}
+
+void
+f6 (char ***bar)
+{
+ const char * volatile **p9 = (const char * volatile **) bar; /* { dg-warning "cast" } */
+ char * volatile const **p11 = (char * volatile const **) bar; /* { dg-warning "cast" } */
+ char * volatile * const *p13 = (char * volatile * const *) bar;
+ const char * volatile const **p15 = (const char * volatile const **) bar; /* { dg-warning "cast" } */
+ const char * volatile * const *p17 = (const char * volatile * const *) bar; /* { dg-warning "cast" } */
+ char * volatile const * const * p19 = (char * volatile const * const *) bar;
+ const char * volatile const * const *p21 = (const char * volatile const * const *) bar;
+}
+
+void
+f7 (char ***bar)
+{
+ const char ** volatile *p9 = (const char ** volatile *) bar; /* { dg-warning "cast" } */
+ char * const * volatile *p11 = (char * const * volatile *) bar; /* { dg-warning "cast" } */
+ char ** volatile const *p13 = (char ** volatile const *) bar;
+ const char * const * volatile *p15 = (const char * const * volatile *) bar; /* { dg-warning "cast" } */
+ const char ** volatile const *p17 = (const char ** volatile const *) bar; /* { dg-warning "cast" } */
+ char * const * volatile const * p19 = (char * const * volatile const *) bar;
+ const char * const * volatile const *p21 = (const char * const * volatile const *) bar;
+}
+
+typedef int (intfn) (int);
+typedef intfn *pintfn;
+typedef const intfn *constfn;
+
+void
+f8 (constfn ***bar)
+{
+ const constfn *p1 = (const constfn *) bar;
+ const pintfn *p2 = (const pintfn *) bar;
+ const constfn **p3 = (const constfn **) bar;
+ const pintfn **p4 = (const pintfn **) bar;
+ const constfn * const *p5 = (const constfn * const *) bar;
+ const pintfn * const *p6 = (const pintfn * const *) bar;
+ constfn * const *p7 = (constfn * const *) bar;
+ pintfn * const *p8 = (pintfn * const *) bar;
+ const constfn ***p9 = (const constfn ***) bar; /* { dg-warning "cast" } */
+ const pintfn ***p10 = (const pintfn ***) bar; /* { dg-warning "cast" } */
+ constfn * const **p11 = (constfn * const **) bar; /* { dg-warning "cast" } */
+ pintfn * const **p12 = (pintfn * const **) bar; /* { dg-warning "cast" } */
+ constfn ** const *p13 = (constfn ** const *) bar;
+ pintfn ** const *p14 = (pintfn ** const *) bar;
+ const constfn * const **p15 = (const constfn * const **) bar; /* { dg-warning "cast" } */
+ const pintfn * const **p16 = (const pintfn * const **) bar; /* { dg-warning "cast" } */
+ const constfn ** const *p17 = (const constfn ** const *) bar; /* { dg-warning "cast" } */
+ const pintfn ** const *p18 = (const pintfn ** const *) bar; /* { dg-warning "cast" } */
+ constfn * const * const * p19 = (constfn * const * const *) bar;
+ pintfn * const * const * p20 = (pintfn * const * const *) bar;
+ const constfn * const * const *p21 = (const constfn * const * const *) bar;
+ const pintfn * const * const *p22 = (const pintfn * const * const *) bar;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wconversion-real.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wconversion-real.c
new file mode 100644
index 000000000..464aab055
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wconversion-real.c
@@ -0,0 +1,85 @@
+/* Test for diagnostics for Wconversion for floating-point. */
+
+/* { dg-do compile } */
+/* { dg-skip-if "doubles are floats" { "avr-*-*" } { "*" } { "" } } */
+/* { dg-options "-std=c99 -Wconversion" { target c } } */
+/* { dg-options "-Wconversion" { target c++ } } */
+/* { dg-require-effective-target large_double } */
+
+float vfloat;
+double vdouble;
+long double vlongdouble;
+
+void ffloat (float f);
+void fdouble (double d);
+void flongdouble (long double ld);
+
+void h (void)
+{
+ float f = 0;
+ double d = 0;
+ long double ld = 0;
+
+ ffloat (3.1); /* { dg-warning "conversion" } */
+ vfloat = 3.1; /* { dg-warning "conversion" } */
+ ffloat (3.1L); /* { dg-warning "conversion" } */
+ vfloat = 3.1L; /* { dg-warning "conversion" } */
+ fdouble (3.1L); /* { dg-warning "conversion" "" { target large_long_double } } */
+ vdouble = 3.1L; /* { dg-warning "conversion" "" { target large_long_double } } */
+ ffloat (vdouble); /* { dg-warning "conversion" } */
+ vfloat = vdouble; /* { dg-warning "conversion" } */
+ ffloat (vlongdouble); /* { dg-warning "conversion" } */
+ vfloat = vlongdouble; /* { dg-warning "conversion" } */
+ fdouble (vlongdouble); /* { dg-warning "conversion" "" { target large_long_double } } */
+ vdouble = vlongdouble; /* { dg-warning "conversion" "" { target large_long_double } } */
+
+
+ ffloat ((float) 3.1);
+ vfloat = (float) 3.1;
+ ffloat ((float) 3.1L);
+ vfloat = (float) 3.1L;
+ fdouble ((double) 3.1L);
+ vdouble = (double) 3.1L;
+ ffloat ((float) vdouble);
+ vfloat = (float) vdouble;
+ ffloat ((float) vlongdouble);
+ vfloat = (float) vlongdouble;
+ fdouble ((double) vlongdouble);
+ vdouble = (double) vlongdouble;
+
+
+ ffloat (3.0);
+ vfloat = 3.0;
+ ffloat (3.1f);
+ vfloat = 3.1f;
+ ffloat (0.25L);
+ vfloat = 0.25L;
+
+
+ fdouble (3.0);
+ vdouble = 3.0;
+ fdouble (3.1f);
+ vdouble = 3.1f;
+ fdouble (0.25L);
+ vdouble = 0.25L;
+
+ flongdouble (3.0);
+ vlongdouble = 3.0;
+ flongdouble (3.1f);
+ vlongdouble = 3.1f;
+ flongdouble (0.25L);
+ vlongdouble = 0.25L;
+
+ ffloat (f);
+ vfloat = f;
+ fdouble (f);
+ vdouble = f;
+ fdouble (d);
+ vdouble = d;
+ flongdouble (f);
+ vlongdouble = f;
+ flongdouble (d);
+ vlongdouble = d;
+ flongdouble (ld);
+ vlongdouble = ld;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wfloat-conversion.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wfloat-conversion.c
new file mode 100644
index 000000000..e87275590
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wfloat-conversion.c
@@ -0,0 +1,58 @@
+/* Test for diagnostics for Wconversion for floating-point. */
+
+/* { dg-do compile } */
+/* { dg-options "-std=c99 -Wfloat-conversion" { target c } } */
+/* { dg-options "-Wfloat-conversion" { target c++ } } */
+/* { dg-require-effective-target large_double } */
+/* { dg-require-effective-target int32plus } */
+/* { dg-require-effective-target double64plus } */
+#include <limits.h>
+
+float vfloat;
+double vdouble;
+long double vlongdouble;
+int bar;
+
+void fsi (signed int x);
+void fui (unsigned int x);
+void ffloat (float f);
+void fdouble (double d);
+void flongdouble (long double ld);
+
+void h (void)
+{
+ unsigned int ui = 3;
+ int si = 3;
+ unsigned char uc = 3;
+ signed char sc = 3;
+ float f = 0;
+ double d = 0;
+ long double ld = 0;
+
+ ffloat (3.1); /* { dg-warning "conversion to 'float' alters 'double' constant value" } */
+ vfloat = 3.1; /* { dg-warning "conversion to 'float' alters 'double' constant value" } */
+ ffloat (3.1L); /* { dg-warning "conversion to 'float' alters 'long double' constant value" } */
+ vfloat = 3.1L; /* { dg-warning "conversion to 'float' alters 'long double' constant value" } */
+ fdouble (3.1L); /* { dg-warning "conversion to 'double' alters 'long double' constant value" "" { target large_long_double } } */
+ vdouble = 3.1L; /* { dg-warning "conversion to 'double' alters 'long double' constant value" "" { target large_long_double } } */
+ ffloat (vdouble); /* { dg-warning "conversion to 'float' from 'double' may alter its value" } */
+ vfloat = vdouble; /* { dg-warning "conversion to 'float' from 'double' may alter its value" } */
+ ffloat (vlongdouble); /* { dg-warning "conversion to 'float' from 'long double' may alter its value" } */
+ vfloat = vlongdouble; /* { dg-warning "conversion to 'float' from 'long double' may alter its value" } */
+ fdouble (vlongdouble); /* { dg-warning "conversion to 'double' from 'long double' may alter its value" "" { target large_long_double } } */
+ vdouble = vlongdouble; /* { dg-warning "conversion to 'double' from 'long double' may alter its value" "" { target large_long_double } } */
+
+ fsi (3.1f); /* { dg-warning "conversion to 'int' alters 'float' constant value" } */
+ si = 3.1f; /* { dg-warning "conversion to 'int' alters 'float' constant value" } */
+ fsi (3.1); /* { dg-warning "conversion to 'int' alters 'double' constant value" } */
+ si = 3.1; /* { dg-warning "conversion to 'int' alters 'double' constant value" } */
+ fsi (d); /* { dg-warning "conversion to 'int' from 'double' may alter its value" } */
+ si = d; /* { dg-warning "conversion to 'int' from 'double' may alter its value" } */
+ ffloat (INT_MAX); /* { dg-warning "conversion to 'float' alters 'int' constant value" } */
+ vfloat = INT_MAX; /* { dg-warning "conversion to 'float' alters 'int' constant value" } */
+ ffloat (16777217); /* { dg-warning "conversion to 'float' alters 'int' constant value" } */
+ vfloat = 16777217; /* { dg-warning "conversion to 'float' alters 'int' constant value" } */
+
+ sc = bar != 0 ? 2.1 : 10; /* { dg-warning "conversion to 'signed char' alters 'double' constant value" } */
+ uc = bar != 0 ? 2.1 : 10; /* { dg-warning "conversion to 'unsigned char' alters 'double' constant value" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-1.c
new file mode 100644
index 000000000..a7687a607
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-1.c
@@ -0,0 +1,12 @@
+/* Test -Wint-to-pointer-cast - on by default. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+char c;
+
+void *
+f (void)
+{
+ return (void *) c; /* { dg-warning "cast to pointer from integer of different size" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-2.c
new file mode 100644
index 000000000..5546abb81
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-2.c
@@ -0,0 +1,12 @@
+/* Test -Wint-to-pointer-cast. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-Wint-to-pointer-cast" } */
+
+char c;
+
+void *
+f (void)
+{
+ return (void *) c; /* { dg-warning "cast to pointer from integer of different size" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-3.c
new file mode 100644
index 000000000..052ab3727
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-3.c
@@ -0,0 +1,22 @@
+/* Test -Wno-int-to-pointer-cast. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-Wno-int-to-pointer-cast" } */
+
+char c;
+
+void *
+f (void)
+{
+ return (void *) c;
+}
+
+void *p;
+
+char
+g (void)
+{
+ return (char) p;
+/* { dg-warning "cast from pointer to integer of different size" "" { target c } 19 } */
+/* { dg-error "cast from 'void\\*' to 'char' loses precision" "" { target c++ } 19 } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wpointer-arith-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wpointer-arith-1.c
new file mode 100644
index 000000000..86668ef1b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wpointer-arith-1.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-Wpedantic -Wno-pointer-arith" } */
+
+void h(void)
+{
+ typedef void (*pft) ();
+ typedef void (ft) ();
+
+ void *pv = 0;
+ pft pf = 0;
+
+ pv++;
+ pf++;
+
+ --pv;
+ --pf;
+
+ pv += 1;
+ pf += 1;
+
+ pv = pv - 1;
+ pf = pf - 1;
+
+ sizeof (void);
+ sizeof (ft);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wsequence-point-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wsequence-point-1.c
new file mode 100644
index 000000000..60dd55bbb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wsequence-point-1.c
@@ -0,0 +1,17 @@
+/* PR c++/57274 */
+/* { dg-do compile } */
+/* { dg-options "-Wsequence-point" } */
+
+void foo (int, int);
+
+void
+bar (int *x)
+{
+ foo (*x++, sizeof (*x)); /* { dg-bogus "may be undefined" } */
+}
+
+void
+baz (int *x)
+{
+ foo (*x, sizeof (*x++) + sizeof (*x++)); /* { dg-bogus "may be undefined" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wsizeof-pointer-memaccess1.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wsizeof-pointer-memaccess1.c
new file mode 100644
index 000000000..2a5f4193b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wsizeof-pointer-memaccess1.c
@@ -0,0 +1,161 @@
+/* Test -Wsizeof-pointer-memaccess warnings. */
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+typedef __SIZE_TYPE__ size_t;
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern int snprintf (char *, size_t, const char *, ...);
+extern int vsnprintf (char *, size_t, const char *, __builtin_va_list);
+extern void *memchr (const void *, int, size_t);
+#ifdef __cplusplus
+}
+#endif
+
+struct A { short a, b; int c, d; long e, f; };
+typedef struct A TA;
+typedef struct A *PA;
+typedef TA *PTA;
+struct B {};
+typedef struct B TB;
+typedef struct B *PB;
+typedef TB *PTB;
+typedef int X[3][3][3];
+
+void foo (void **);
+
+void
+f1 (void *x)
+{
+ struct A a, *pa1 = &a;
+ TA *pa2 = &a;
+ PA pa3 = &a;
+ PTA pa4 = &a;
+ void *arr[100];
+ int i = 0;
+ arr[i++] = memchr (&a, 0, sizeof (&a)); /* { dg-warning "call is the same expression as the source; did you mean to remove the addressof" } */
+ arr[i++] = memchr (pa1, 0, sizeof (pa1)); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ arr[i++] = memchr (pa2, 0, sizeof pa2); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ arr[i++] = memchr (pa3, 0, sizeof (pa3)); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ arr[i++] = memchr (pa4, 0, sizeof pa4); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ arr[i++] = memchr (pa1, 0, sizeof (struct A *)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+ arr[i++] = memchr (pa2, 0, sizeof (PTA)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+ arr[i++] = memchr (pa3, 0, sizeof (PA)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+ arr[i++] = memchr (pa4, 0, sizeof (__typeof (pa4))); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+
+ /* These are correct, no warning. */
+ arr[i++] = memchr (&a, 0, sizeof a);
+ arr[i++] = memchr (&a, 0, sizeof (a));
+ arr[i++] = memchr (&a, 0, sizeof (struct A));
+ arr[i++] = memchr (&a, 0, sizeof (const struct A));
+ arr[i++] = memchr (&a, 0, sizeof (volatile struct A));
+ arr[i++] = memchr (&a, 0, sizeof (volatile const struct A));
+ arr[i++] = memchr (&a, 0, sizeof (TA));
+ arr[i++] = memchr (&a, 0, sizeof (__typeof (*&a)));
+ arr[i++] = memchr (pa1, 0, sizeof (*pa1));
+ arr[i++] = memchr (pa2, 0, sizeof (*pa3));
+ arr[i++] = memchr (pa3, 0, sizeof (__typeof (*pa3)));
+ /* These are probably broken, but obfuscated, no warning. */
+ arr[i++] = memchr ((void *) &a, 0, sizeof (&a));
+ arr[i++] = memchr ((char *) &a, 0, sizeof (&a));
+ arr[i++] = memchr (&a, 0, sizeof (&a) + 0);
+ arr[i++] = memchr (&a, 0, 0 + sizeof (&a));
+
+ foo (arr);
+}
+
+void
+f2 (void *x)
+{
+ struct B b, *pb1 = &b;
+ TB *pb2 = &b;
+ PB pb3 = &b;
+ PTB pb4 = &b;
+ void *arr[100];
+ int i = 0;
+ arr[i++] = memchr (&b, 0, sizeof (&b)); /* { dg-warning "call is the same expression as the source; did you mean to remove the addressof" } */
+ arr[i++] = memchr (pb1, 0, sizeof (pb1)); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ arr[i++] = memchr (pb2, 0, sizeof pb2); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ arr[i++] = memchr (pb3, 0, sizeof (pb3)); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ arr[i++] = memchr (pb4, 0, sizeof pb4); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ arr[i++] = memchr (pb1, 0, sizeof (struct B *)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+ arr[i++] = memchr (pb2, 0, sizeof (PTB)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+ arr[i++] = memchr (pb3, 0, sizeof (PB)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+ arr[i++] = memchr (pb4, 0, sizeof (__typeof (pb4))); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+
+ /* These are correct, no warning. */
+ arr[i++] = memchr (&b, 0, sizeof b);
+ arr[i++] = memchr (&b, 0, sizeof (b));
+ arr[i++] = memchr (&b, 0, sizeof (struct B));
+ arr[i++] = memchr (&b, 0, sizeof (const struct B));
+ arr[i++] = memchr (&b, 0, sizeof (volatile struct B));
+ arr[i++] = memchr (&b, 0, sizeof (volatile const struct B));
+ arr[i++] = memchr (&b, 0, sizeof (TB));
+ arr[i++] = memchr (&b, 0, sizeof (__typeof (*&b)));
+ arr[i++] = memchr (pb1, 0, sizeof (*pb1));
+ arr[i++] = memchr (pb2, 0, sizeof (*pb3));
+ arr[i++] = memchr (pb3, 0, sizeof (__typeof (*pb3)));
+ /* These are probably broken, but obfuscated, no warning. */
+ arr[i++] = memchr ((void *) &b, 0, sizeof (&b));
+ arr[i++] = memchr ((char *) &b, 0, sizeof (&b));
+ arr[i++] = memchr (&b, 0, sizeof (&b) + 0);
+ arr[i++] = memchr (&b, 0, 0 + sizeof (&b));
+
+ foo (arr);
+}
+
+void
+f3 (void *x, char *y, int z, X w)
+{
+ unsigned char *y1 = (unsigned char *) __builtin_alloca (z + 16);
+ char buf1[7];
+ signed char buf2[z + 32];
+ long buf3[17];
+ int *buf4[9];
+ signed char *y2 = buf2;
+ char c;
+ void *arr[100];
+ int i = 0;
+ arr[i++] = memchr (y, 0, sizeof (y)); /* { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" } */
+ arr[i++] = memchr (y1, 0, sizeof (y1)); /* { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" } */
+ arr[i++] = memchr (y2, 0, sizeof (y2)); /* { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" } */
+ arr[i++] = memchr (&c, 0, sizeof (&c)); /* { dg-warning "call is the same expression as the source; did you mean to remove the addressof" } */
+ arr[i++] = memchr (w, 0, sizeof w); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+
+ /* These are correct, no warning. */
+ arr[i++] = memchr (y, 0, sizeof (*y));
+ arr[i++] = memchr (y1, 0, sizeof (*y2));
+ arr[i++] = memchr (buf1, 0, sizeof buf1);
+ arr[i++] = memchr (buf3, 0, sizeof (buf3));
+ arr[i++] = memchr (&buf3[0], 0, sizeof (buf3));
+ arr[i++] = memchr (&buf4[0], 0, sizeof (buf4));
+ arr[i++] = memchr (w, 0, sizeof (X));
+ /* These are probably broken, but obfuscated, no warning. */
+ arr[i++] = memchr ((void *) y, 0, sizeof (y));
+ arr[i++] = memchr ((char *) y1, 0, sizeof (y2));
+ arr[i++] = memchr (y, 0, sizeof (y) + 0);
+ arr[i++] = memchr (y1, 0, 0 + sizeof (y2));
+ arr[i++] = memchr ((void *) &c, 0, sizeof (&c));
+ arr[i++] = memchr ((signed char *) &c, 0, sizeof (&c));
+ arr[i++] = memchr (&c, 0, sizeof (&c) + 0);
+ arr[i++] = memchr (&c, 0, 0 + sizeof (&c));
+
+ foo (arr);
+}
+
+void
+f4 (char x[64], char *y, __builtin_va_list ap)
+{
+ char buf[128], *p = buf;
+ snprintf (x, sizeof (x), "%s", y); /* { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" } */
+ vsnprintf (x, sizeof (x), "%s", ap); /* { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" } */
+ snprintf (p, sizeof (p), "%s", y); /* { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" } */
+ vsnprintf (p, sizeof (p), "%s", ap); /* { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" } */
+
+ /* These are correct, no warning. */
+ snprintf (buf, sizeof (buf), "%s", y);
+ vsnprintf (buf, sizeof (buf), "%s", ap);
+ snprintf (p, sizeof (buf), "%s", y);
+ vsnprintf (p, sizeof (buf), "%s", ap);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wsizeof-pointer-memaccess2.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wsizeof-pointer-memaccess2.c
new file mode 100644
index 000000000..73cdf0eab
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wsizeof-pointer-memaccess2.c
@@ -0,0 +1,482 @@
+/* Test -Wsizeof-pointer-memaccess warnings. */
+/* { dg-do compile } */
+/* { dg-options "-Wall -O2" } */
+
+#define bos(ptr) __builtin_object_size (ptr, 1)
+#define bos0(ptr) __builtin_object_size (ptr, 0)
+
+#define memset(dst, val, sz) __builtin___memset_chk (dst, val, sz, bos (dst))
+#define memcpy(dst, src, sz) __builtin___memcpy_chk (dst, src, sz, bos (dst))
+#define memmove(dst, src, sz) __builtin___memmove_chk (dst, src, sz, bos (dst))
+#define strncpy(dst, src, sz) __builtin___strncpy_chk (dst, src, sz, bos (dst))
+#define strncat(dst, src, sz) __builtin___strncat_chk (dst, src, sz, bos (dst))
+#define stpncpy(dst, src, sz) __builtin___stpncpy_chk (dst, src, sz, bos (dst))
+
+struct A { short a, b; int c, d; long e, f; };
+typedef struct A TA;
+typedef struct A *PA;
+typedef TA *PTA;
+struct B {};
+typedef struct B TB;
+typedef struct B *PB;
+typedef TB *PTB;
+typedef int X[3][3][3];
+
+void
+f1 (void *x)
+{
+ struct A a, *pa1 = &a;
+ TA *pa2 = &a;
+ PA pa3 = &a;
+ PTA pa4 = &a;
+ memset (&a, 0, sizeof (&a)); /* { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" } */
+ memset (pa1, 0, sizeof (pa1)); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memset (pa2, 0, sizeof pa2); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memset (pa3, 0, sizeof (pa3)); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memset (pa4, 0, sizeof pa4); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memset (pa1, 0, sizeof (struct A *)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+ memset (pa2, 0, sizeof (PTA)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+ memset (pa3, 0, sizeof (PA)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+ memset (pa4, 0, sizeof (__typeof (pa4))); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+
+ memcpy (&a, x, sizeof (&a)); /* { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" } */
+ memcpy (pa1, x, sizeof (pa1)); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memcpy (pa2, x, sizeof pa2); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memcpy (pa3, x, sizeof (pa3)); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memcpy (pa4, x, sizeof pa4); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memcpy (pa1, x, sizeof (struct A *)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+ memcpy (pa2, x, sizeof (PTA)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+ memcpy (pa3, x, sizeof (PA)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+ memcpy (pa4, x, sizeof (__typeof (pa4))); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+
+ memcpy (x, &a, sizeof (&a)); /* { dg-warning "call is the same expression as the source; did you mean to remove the addressof" } */
+ memcpy (x, pa1, sizeof (pa1)); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ memcpy (x, pa2, sizeof pa2); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ memcpy (x, pa3, sizeof (pa3)); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ memcpy (x, pa4, sizeof pa4); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ memcpy (x, pa1, sizeof (struct A *)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+ memcpy (x, pa2, sizeof (PTA)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+ memcpy (x, pa3, sizeof (PA)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+ memcpy (x, pa4, sizeof (__typeof (pa4))); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+
+ memmove (&a, x, sizeof (&a)); /* { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" } */
+ memmove (pa1, x, sizeof (pa1)); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memmove (pa2, x, sizeof pa2); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memmove (pa3, x, sizeof (pa3)); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memmove (pa4, x, sizeof pa4); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memmove (pa1, x, sizeof (struct A *)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+ memmove (pa2, x, sizeof (PTA)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+ memmove (pa3, x, sizeof (PA)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+ memmove (pa4, x, sizeof (__typeof (pa4)));/* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+
+ memmove (x, &a, sizeof (&a)); /* { dg-warning "call is the same expression as the source; did you mean to remove the addressof" } */
+ memmove (x, pa1, sizeof (pa1)); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ memmove (x, pa2, sizeof pa2); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ memmove (x, pa3, sizeof (pa3)); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ memmove (x, pa4, sizeof pa4); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ memmove (x, pa1, sizeof (struct A *)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+ memmove (x, pa2, sizeof (PTA)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+ memmove (x, pa3, sizeof (PA)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+ memmove (x, pa4, sizeof (__typeof (pa4)));/* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+
+ /* These are correct, no warning. */
+ memset (&a, 0, sizeof a);
+ memset (&a, 0, sizeof (a));
+ memset (&a, 0, sizeof (struct A));
+ memset (&a, 0, sizeof (const struct A));
+ memset (&a, 0, sizeof (volatile struct A));
+ memset (&a, 0, sizeof (volatile const struct A));
+ memset (&a, 0, sizeof (TA));
+ memset (&a, 0, sizeof (__typeof (*&a)));
+ memset (pa1, 0, sizeof (*pa1));
+ memset (pa2, 0, sizeof (*pa3));
+ memset (pa3, 0, sizeof (__typeof (*pa3)));
+ /* These are probably broken, but obfuscated, no warning. */
+ memset ((void *) &a, 0, sizeof (&a));
+ memset ((char *) &a, 0, sizeof (&a));
+ memset (&a, 0, sizeof (&a) + 0);
+ memset (&a, 0, 0 + sizeof (&a));
+
+ /* These are correct, no warning. */
+ memcpy (&a, x, sizeof a);
+ memcpy (&a, x, sizeof (a));
+ memcpy (&a, x, sizeof (struct A));
+ memcpy (&a, x, sizeof (const struct A));
+ memcpy (&a, x, sizeof (volatile struct A));
+ memcpy (&a, x, sizeof (volatile const struct A));
+ memcpy (&a, x, sizeof (TA));
+ memcpy (&a, x, sizeof (__typeof (*&a)));
+ memcpy (pa1, x, sizeof (*pa1));
+ memcpy (pa2, x, sizeof (*pa3));
+ memcpy (pa3, x, sizeof (__typeof (*pa3)));
+ /* These are probably broken, but obfuscated, no warning. */
+ memcpy ((void *) &a, x, sizeof (&a));
+ memcpy ((char *) &a, x, sizeof (&a));
+ memcpy (&a, x, sizeof (&a) + 0);
+ memcpy (&a, x, 0 + sizeof (&a));
+
+ /* These are correct, no warning. */
+ memcpy (x, &a, sizeof a);
+ memcpy (x, &a, sizeof (a));
+ memcpy (x, &a, sizeof (struct A));
+ memcpy (x, &a, sizeof (const struct A));
+ memcpy (x, &a, sizeof (volatile struct A));
+ memcpy (x, &a, sizeof (volatile const struct A));
+ memcpy (x, &a, sizeof (TA));
+ memcpy (x, &a, sizeof (__typeof (*&a)));
+ memcpy (x, pa1, sizeof (*pa1));
+ memcpy (x, pa2, sizeof (*pa3));
+ memcpy (x, pa3, sizeof (__typeof (*pa3)));
+ /* These are probably broken, but obfuscated, no warning. */
+ memcpy (x, (void *) &a, sizeof (&a));
+ memcpy (x, (char *) &a, sizeof (&a));
+ memcpy (x, &a, sizeof (&a) + 0);
+ memcpy (x, &a, 0 + sizeof (&a));
+
+ /* These are correct, no warning. */
+ memmove (&a, x, sizeof a);
+ memmove (&a, x, sizeof (a));
+ memmove (&a, x, sizeof (struct A));
+ memmove (&a, x, sizeof (const struct A));
+ memmove (&a, x, sizeof (volatile struct A));
+ memmove (&a, x, sizeof (volatile const struct A));
+ memmove (&a, x, sizeof (TA));
+ memmove (&a, x, sizeof (__typeof (*&a)));
+ memmove (pa1, x, sizeof (*pa1));
+ memmove (pa2, x, sizeof (*pa3));
+ memmove (pa3, x, sizeof (__typeof (*pa3)));
+ /* These are probably broken, but obfuscated, no warning. */
+ memmove ((void *) &a, x, sizeof (&a));
+ memmove ((char *) &a, x, sizeof (&a));
+ memmove (&a, x, sizeof (&a) + 0);
+ memmove (&a, x, 0 + sizeof (&a));
+
+ /* These are correct, no warning. */
+ memmove (x, &a, sizeof a);
+ memmove (x, &a, sizeof (a));
+ memmove (x, &a, sizeof (struct A));
+ memmove (x, &a, sizeof (const struct A));
+ memmove (x, &a, sizeof (volatile struct A));
+ memmove (x, &a, sizeof (volatile const struct A));
+ memmove (x, &a, sizeof (TA));
+ memmove (x, &a, sizeof (__typeof (*&a)));
+ memmove (x, pa1, sizeof (*pa1));
+ memmove (x, pa2, sizeof (*pa3));
+ memmove (x, pa3, sizeof (__typeof (*pa3)));
+ /* These are probably broken, but obfuscated, no warning. */
+ memmove (x, (void *) &a, sizeof (&a));
+ memmove (x, (char *) &a, sizeof (&a));
+ memmove (x, &a, sizeof (&a) + 0);
+ memmove (x, &a, 0 + sizeof (&a));
+}
+
+void
+f2 (void *x)
+{
+ struct B b, *pb1 = &b;
+ TB *pb2 = &b;
+ PB pb3 = &b;
+ PTB pb4 = &b;
+ memset (&b, 0, sizeof (&b)); /* { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" } */
+ memset (pb1, 0, sizeof (pb1)); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memset (pb2, 0, sizeof pb2); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memset (pb3, 0, sizeof (pb3)); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memset (pb4, 0, sizeof pb4); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memset (pb1, 0, sizeof (struct B *)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+ memset (pb2, 0, sizeof (PTB)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+ memset (pb3, 0, sizeof (PB)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+ memset (pb4, 0, sizeof (__typeof (pb4))); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+
+ memcpy (&b, x, sizeof (&b)); /* { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" } */
+ memcpy (pb1, x, sizeof (pb1)); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memcpy (pb2, x, sizeof pb2); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memcpy (pb3, x, sizeof (pb3)); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memcpy (pb4, x, sizeof pb4); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memcpy (pb1, x, sizeof (struct B *)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+ memcpy (pb2, x, sizeof (PTB)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+ memcpy (pb3, x, sizeof (PB)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+ memcpy (pb4, x, sizeof (__typeof (pb4))); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+
+ memcpy (x, &b, sizeof (&b)); /* { dg-warning "call is the same expression as the source; did you mean to remove the addressof" } */
+ memcpy (x, pb1, sizeof (pb1)); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ memcpy (x, pb2, sizeof pb2); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ memcpy (x, pb3, sizeof (pb3)); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ memcpy (x, pb4, sizeof pb4); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ memcpy (x, pb1, sizeof (struct B *)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+ memcpy (x, pb2, sizeof (PTB)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+ memcpy (x, pb3, sizeof (PB)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+ memcpy (x, pb4, sizeof (__typeof (pb4))); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+
+ memmove (&b, x, sizeof (&b)); /* { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" } */
+ memmove (pb1, x, sizeof (pb1)); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memmove (pb2, x, sizeof pb2); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memmove (pb3, x, sizeof (pb3)); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memmove (pb4, x, sizeof pb4); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+ memmove (pb1, x, sizeof (struct B *)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+ memmove (pb2, x, sizeof (PTB)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+ memmove (pb3, x, sizeof (PB)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+ memmove (pb4, x, sizeof (__typeof (pb4)));/* { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" } */
+
+ memmove (x, &b, sizeof (&b)); /* { dg-warning "call is the same expression as the source; did you mean to remove the addressof" } */
+ memmove (x, pb1, sizeof (pb1)); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ memmove (x, pb2, sizeof pb2); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ memmove (x, pb3, sizeof (pb3)); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ memmove (x, pb4, sizeof pb4); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+ memmove (x, pb1, sizeof (struct B *)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+ memmove (x, pb2, sizeof (PTB)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+ memmove (x, pb3, sizeof (PB)); /* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+ memmove (x, pb4, sizeof (__typeof (pb4)));/* { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" } */
+
+ /* These are correct, no warning. */
+ memset (&b, 0, sizeof b);
+ memset (&b, 0, sizeof (b));
+ memset (&b, 0, sizeof (struct B));
+ memset (&b, 0, sizeof (const struct B));
+ memset (&b, 0, sizeof (volatile struct B));
+ memset (&b, 0, sizeof (volatile const struct B));
+ memset (&b, 0, sizeof (TB));
+ memset (&b, 0, sizeof (__typeof (*&b)));
+ memset (pb1, 0, sizeof (*pb1));
+ memset (pb2, 0, sizeof (*pb3));
+ memset (pb3, 0, sizeof (__typeof (*pb3)));
+ /* These are probably broken, but obfuscated, no warning. */
+ memset ((void *) &b, 0, sizeof (&b));
+ memset ((char *) &b, 0, sizeof (&b));
+ memset (&b, 0, sizeof (&b) + 0);
+ memset (&b, 0, 0 + sizeof (&b));
+
+ /* These are correct, no warning. */
+ memcpy (&b, x, sizeof b);
+ memcpy (&b, x, sizeof (b));
+ memcpy (&b, x, sizeof (struct B));
+ memcpy (&b, x, sizeof (const struct B));
+ memcpy (&b, x, sizeof (volatile struct B));
+ memcpy (&b, x, sizeof (volatile const struct B));
+ memcpy (&b, x, sizeof (TB));
+ memcpy (&b, x, sizeof (__typeof (*&b)));
+ memcpy (pb1, x, sizeof (*pb1));
+ memcpy (pb2, x, sizeof (*pb3));
+ memcpy (pb3, x, sizeof (__typeof (*pb3)));
+ /* These are probably broken, but obfuscated, no warning. */
+ memcpy ((void *) &b, x, sizeof (&b));
+ memcpy ((char *) &b, x, sizeof (&b));
+ memcpy (&b, x, sizeof (&b) + 0);
+ memcpy (&b, x, 0 + sizeof (&b));
+
+ /* These are correct, no warning. */
+ memcpy (x, &b, sizeof b);
+ memcpy (x, &b, sizeof (b));
+ memcpy (x, &b, sizeof (struct B));
+ memcpy (x, &b, sizeof (const struct B));
+ memcpy (x, &b, sizeof (volatile struct B));
+ memcpy (x, &b, sizeof (volatile const struct B));
+ memcpy (x, &b, sizeof (TB));
+ memcpy (x, &b, sizeof (__typeof (*&b)));
+ memcpy (x, pb1, sizeof (*pb1));
+ memcpy (x, pb2, sizeof (*pb3));
+ memcpy (x, pb3, sizeof (__typeof (*pb3)));
+ /* These are probably broken, but obfuscated, no warning. */
+ memcpy (x, (void *) &b, sizeof (&b));
+ memcpy (x, (char *) &b, sizeof (&b));
+ memcpy (x, &b, sizeof (&b) + 0);
+ memcpy (x, &b, 0 + sizeof (&b));
+
+ /* These are correct, no warning. */
+ memmove (&b, x, sizeof b);
+ memmove (&b, x, sizeof (b));
+ memmove (&b, x, sizeof (struct B));
+ memmove (&b, x, sizeof (const struct B));
+ memmove (&b, x, sizeof (volatile struct B));
+ memmove (&b, x, sizeof (volatile const struct B));
+ memmove (&b, x, sizeof (TB));
+ memmove (&b, x, sizeof (__typeof (*&b)));
+ memmove (pb1, x, sizeof (*pb1));
+ memmove (pb2, x, sizeof (*pb3));
+ memmove (pb3, x, sizeof (__typeof (*pb3)));
+ /* These are probably broken, but obfuscated, no warning. */
+ memmove ((void *) &b, x, sizeof (&b));
+ memmove ((char *) &b, x, sizeof (&b));
+ memmove (&b, x, sizeof (&b) + 0);
+ memmove (&b, x, 0 + sizeof (&b));
+
+ /* These are correct, no warning. */
+ memmove (x, &b, sizeof b);
+ memmove (x, &b, sizeof (b));
+ memmove (x, &b, sizeof (struct B));
+ memmove (x, &b, sizeof (const struct B));
+ memmove (x, &b, sizeof (volatile struct B));
+ memmove (x, &b, sizeof (volatile const struct B));
+ memmove (x, &b, sizeof (TB));
+ memmove (x, &b, sizeof (__typeof (*&b)));
+ memmove (x, pb1, sizeof (*pb1));
+ memmove (x, pb2, sizeof (*pb3));
+ memmove (x, pb3, sizeof (__typeof (*pb3)));
+ /* These are probably broken, but obfuscated, no warning. */
+ memmove (x, (void *) &b, sizeof (&b));
+ memmove (x, (char *) &b, sizeof (&b));
+ memmove (x, &b, sizeof (&b) + 0);
+ memmove (x, &b, 0 + sizeof (&b));
+}
+
+void
+f3 (void *x, char *y, int z, X w)
+{
+ unsigned char *y1 = (unsigned char *) __builtin_alloca (z + 16);
+ char buf1[7];
+ signed char buf2[z + 32];
+ long buf3[17];
+ int *buf4[9];
+ signed char *y2 = buf2;
+ char c;
+ char *y3;
+ memset (y, 0, sizeof (y)); /* { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" } */
+ memset (y1, 0, sizeof (y1)); /* { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" } */
+ memset (y2, 0, sizeof (y2)); /* { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" } */
+ memset (&c, 0, sizeof (&c)); /* { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" } */
+ memset (w, 0, sizeof w); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+
+ memcpy (y, x, sizeof (y)); /* { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" } */
+ memcpy (y1, x, sizeof (y1)); /* { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" } */
+ memcpy (y2, x, sizeof (y2)); /* { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" } */
+ memcpy (&c, x, sizeof (&c)); /* { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" } */
+ memcpy (w, x, sizeof w); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+
+ memcpy (x, y, sizeof (y)); /* { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" } */
+ memcpy (x, y1, sizeof (y1)); /* { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" } */
+ memcpy (x, y2, sizeof (y2)); /* { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" } */
+ memcpy (x, &c, sizeof (&c)); /* { dg-warning "call is the same expression as the source; did you mean to remove the addressof" } */
+ memcpy (x, w, sizeof w); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+
+ memmove (y, x, sizeof (y)); /* { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" } */
+ memmove (y1, x, sizeof (y1)); /* { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" } */
+ memmove (y2, x, sizeof (y2)); /* { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" } */
+ memmove (&c, x, sizeof (&c)); /* { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" } */
+ memmove (w, x, sizeof w); /* { dg-warning "call is the same expression as the destination; did you mean to dereference it" } */
+
+ memmove (x, y, sizeof (y)); /* { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" } */
+ memmove (x, y1, sizeof (y1)); /* { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" } */
+ memmove (x, y2, sizeof (y2)); /* { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" } */
+ memmove (x, &c, sizeof (&c)); /* { dg-warning "call is the same expression as the source; did you mean to remove the addressof" } */
+ memmove (x, w, sizeof w); /* { dg-warning "call is the same expression as the source; did you mean to dereference it" } */
+
+ /* These are correct, no warning. */
+ memset (y, 0, sizeof (*y));
+ memset (y1, 0, sizeof (*y2));
+ memset (buf1, 0, sizeof buf1);
+ memset (buf3, 0, sizeof (buf3));
+ memset (&buf3[0], 0, sizeof (buf3));
+ memset (&buf4[0], 0, sizeof (buf4));
+ memset (w, 0, sizeof (X));
+ /* These are probably broken, but obfuscated, no warning. */
+ memset ((void *) y, 0, sizeof (y));
+ memset ((char *) y1, 0, sizeof (y2));
+ memset (y, 0, sizeof (y) + 0);
+ memset (y1, 0, 0 + sizeof (y2));
+ memset ((void *) &c, 0, sizeof (&c));
+ memset ((signed char *) &c, 0, sizeof (&c));
+ memset (&c, 0, sizeof (&c) + 0);
+ memset (&c, 0, 0 + sizeof (&c));
+
+ /* These are correct, no warning. */
+ memcpy (y, x, sizeof (*y));
+ memcpy (y1, x, sizeof (*y2));
+ memcpy (buf1, x, sizeof buf1);
+ memcpy (buf3, x, sizeof (buf3));
+ memcpy (&buf3[0], x, sizeof (buf3));
+ memcpy (&buf4[0], x, sizeof (buf4));
+ memcpy (&y3, y, sizeof (y3));
+ memcpy ((char *) &y3, y, sizeof (y3));
+ memcpy (w, x, sizeof (X));
+ /* These are probably broken, but obfuscated, no warning. */
+ memcpy ((void *) y, x, sizeof (y));
+ memcpy ((char *) y1, x, sizeof (y2));
+ memcpy (y, x, sizeof (y) + 0);
+ memcpy (y1, x, 0 + sizeof (y2));
+ memcpy ((void *) &c, x, sizeof (&c));
+ memcpy ((signed char *) &c, x, sizeof (&c));
+ memcpy (&c, x, sizeof (&c) + 0);
+ memcpy (&c, x, 0 + sizeof (&c));
+
+ /* These are correct, no warning. */
+ memcpy (x, y, sizeof (*y));
+ memcpy (x, y1, sizeof (*y2));
+ memcpy (x, buf1, sizeof buf1);
+ memcpy (x, buf3, sizeof (buf3));
+ memcpy (x, &buf3[0], sizeof (buf3));
+ memcpy (x, &buf4[0], sizeof (buf4));
+ memcpy (y, &y3, sizeof (y3));
+ memcpy (y, (char *) &y3, sizeof (y3));
+ memcpy (x, w, sizeof (X));
+ /* These are probably broken, but obfuscated, no warning. */
+ memcpy (x, (void *) y, sizeof (y));
+ memcpy (x, (char *) y1, sizeof (y2));
+ memcpy (x, y, sizeof (y) + 0);
+ memcpy (x, y1, 0 + sizeof (y2));
+ memcpy (x, (void *) &c, sizeof (&c));
+ memcpy (x, (signed char *) &c, sizeof (&c));
+ memcpy (x, &c, sizeof (&c) + 0);
+ memcpy (x, &c, 0 + sizeof (&c));
+
+ /* These are correct, no warning. */
+ memmove (y, x, sizeof (*y));
+ memmove (y1, x, sizeof (*y2));
+ memmove (buf1, x, sizeof buf1);
+ memmove (buf3, x, sizeof (buf3));
+ memmove (&buf3[0], x, sizeof (buf3));
+ memmove (&buf4[0], x, sizeof (buf4));
+ memmove (&y3, y, sizeof (y3));
+ memmove ((char *) &y3, y, sizeof (y3));
+ memmove (w, x, sizeof (X));
+ /* These are probably broken, but obfuscated, no warning. */
+ memmove ((void *) y, x, sizeof (y));
+ memmove ((char *) y1, x, sizeof (y2));
+ memmove (y, x, sizeof (y) + 0);
+ memmove (y1, x, 0 + sizeof (y2));
+ memmove ((void *) &c, x, sizeof (&c));
+ memmove ((signed char *) &c, x, sizeof (&c));
+ memmove (&c, x, sizeof (&c) + 0);
+ memmove (&c, x, 0 + sizeof (&c));
+
+ /* These are correct, no warning. */
+ memmove (x, y, sizeof (*y));
+ memmove (x, y1, sizeof (*y2));
+ memmove (x, buf1, sizeof buf1);
+ memmove (x, buf3, sizeof (buf3));
+ memmove (x, &buf3[0], sizeof (buf3));
+ memmove (x, &buf4[0], sizeof (buf4));
+ memmove (y, &y3, sizeof (y3));
+ memmove (y, (char *) &y3, sizeof (y3));
+ memmove (x, w, sizeof (X));
+ /* These are probably broken, but obfuscated, no warning. */
+ memmove (x, (void *) y, sizeof (y));
+ memmove (x, (char *) y1, sizeof (y2));
+ memmove (x, y, sizeof (y) + 0);
+ memmove (x, y1, 0 + sizeof (y2));
+ memmove (x, (void *) &c, sizeof (&c));
+ memmove (x, (signed char *) &c, sizeof (&c));
+ memmove (x, &c, sizeof (&c) + 0);
+ memmove (x, &c, 0 + sizeof (&c));
+}
+
+void
+f4 (char *x, char **y, int z, char w[64])
+{
+ const char *s1 = "foobarbaz";
+ const char *s2 = "abcde12345678";
+ strncpy (x, s1, sizeof (s1)); /* { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" } */
+ strncat (x, s2, sizeof (s2)); /* { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" } */
+ stpncpy (x, s1, sizeof (s1)); /* { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" } */
+
+ strncpy (w, s1, sizeof (w)); /* { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" } */
+ strncat (w, s2, sizeof (w)); /* { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" } */
+ stpncpy (w, s1, sizeof (w)); /* { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" } */
+
+ /* These are correct, no warning. */
+ const char s3[] = "foobarbaz";
+ const char s4[] = "abcde12345678";
+ strncpy (x, s3, sizeof (s3));
+ strncat (x, s4, sizeof (s4));
+ stpncpy (x, s3, sizeof (s3));
+}
+
+/* { dg-prune-output "\[\n\r\]*will always overflow\[\n\r\]*" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-local-typedefs.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-local-typedefs.c
new file mode 100644
index 000000000..683019d72
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-local-typedefs.c
@@ -0,0 +1,44 @@
+/* Origin PR c++/33255
+ { dg-options "-Wunused-local-typedefs" }
+ { dg-do compile }
+*/
+
+void
+test_warn ()
+{
+ typedef int foo; // { dg-warning "locally defined but not used" }
+}
+
+void
+test0 ()
+{
+ typedef int foo;
+ foo var __attribute__((unused));
+}
+
+void
+test1 ()
+{
+ typedef int foo;
+ const foo *var = 0;
+}
+
+void
+test2 ()
+{
+ typedef int foo;
+ void func(foo);
+}
+
+void
+test7 (void)
+{
+ typedef int foo;
+ int vec[1] = {sizeof (foo)};
+}
+
+void
+test8 (void)
+{
+ typedef int foo __attribute__((used));
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-1.c
new file mode 100644
index 000000000..ef8f6d454
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-1.c
@@ -0,0 +1,179 @@
+/* { dg-do compile } */
+/* { dg-options "-Wunused" } */
+
+void
+f1 (void)
+{
+ int a; /* { dg-warning "set but not used" } */
+ int b;
+ int c;
+ c = 1;
+ a = b = c;
+}
+
+void
+f2 (int x)
+{
+ int a; /* { dg-warning "set but not used" } */
+ int b;
+ int c; /* { dg-warning "set but not used" } */
+ c = (a = x, b = x);
+}
+
+int
+f3 (int x)
+{
+ int a;
+ return a = x;
+}
+
+int
+f4 (int x)
+{
+ int a;
+ a = x;
+ return a;
+}
+
+void
+f5 (int x)
+{
+ int a[2]; /* { dg-warning "set but not used" } */
+ int b;
+ int *c, d[2];
+ c = d;
+ b = x;
+ a[b] = 1;
+ c[b] = 1;
+}
+
+int
+f6 (int x)
+{
+ int a[2];
+ int b;
+ b = x;
+ a[b] = 1;
+ return a[b];
+}
+
+void
+f7 (int x, int *p)
+{
+ int *a[2];
+ a[x] = p;
+ a[x][x] = x;
+}
+
+struct S { int i; };
+
+void
+f8 (void)
+{
+ struct S s; /* { dg-warning "set but not used" } */
+ s.i = 6;
+}
+
+int
+f9 (void)
+{
+ struct S s;
+ s.i = 6;
+ return s.i;
+}
+
+struct S
+f10 (void)
+{
+ struct S s;
+ s.i = 6;
+ return s;
+}
+
+extern int foo11 (int *);
+
+void
+f11 (void)
+{
+ int a[2];
+ foo11 (a);
+}
+
+void
+f12 (void)
+{
+ int a;
+ a = 1;
+ a; /* { dg-warning "no effect" } */
+}
+
+void
+f13 (void (*x) (void))
+{
+ void (*a) (void);
+ a = x;
+ a ();
+}
+
+void
+f14 (void (*x) (void))
+{
+ void (*a) (void); /* { dg-warning "set but not used" } */
+ a = x;
+}
+
+extern void foo15 (int *);
+
+void
+f15 (void)
+{
+ int a[10];
+ int *b = a + 2;
+ foo15 (b);
+}
+
+extern void foo16 (int **);
+
+void
+f16 (void)
+{
+ int a[10];
+ int *b[] = { a, a + 2 };
+ foo16 (b);
+}
+
+void
+f17 (int x)
+{
+ long a; /* { dg-warning "set but not used" } */
+ int b;
+ a = b = x;
+}
+
+void
+f18 (int x)
+{
+ int a; /* { dg-warning "set but not used" } */
+ int b;
+ a = (char) (b = x);
+}
+
+int
+f19 (int x, int y, int z)
+{
+ int a;
+ int b;
+ a = x;
+ b = y;
+ return z ? a : b;
+}
+
+int *
+f20 (int x)
+{
+ static int a[] = { 3, 4, 5, 6 };
+ static int b[] = { 4, 5, 6, 7 };
+ static int c[] = { 5, 6, 7, 8 }; /* { dg-warning "set but not used" } */
+ c[1] = 1;
+ return x ? a : b;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-10.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-10.c
new file mode 100644
index 000000000..16d5171d0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-10.c
@@ -0,0 +1,68 @@
+/* PR c++/44362 */
+/* { dg-options "-Wunused" } */
+/* { dg-do compile } */
+
+int
+f1 (int u, int v)
+{
+ int a, b, c, d, e, f, g, h, i;
+ a = u;
+ b = v;
+ c = u;
+ d = v;
+ e = u;
+ f = v;
+ g = u == 6 ? a : b;
+ h = 0 ? c : d;
+ i = 1 ? e : f;
+ return g + h + i;
+}
+
+int
+f2 (int u, int v)
+{
+ int a, b, c, d, e, f, g, h, i;
+ a = u;
+ b = v;
+ c = u;
+ d = v;
+ e = u;
+ f = v;
+ g = u == 6 ? a + 1 : b;
+ h = 0 ? c + 1 : d;
+ i = 1 ? e + 1 : f;
+ return g + h + i;
+}
+
+int
+f3 (int u, int v)
+{
+ int a, b, c, d, e, f, g, h, i;
+ a = u;
+ b = v;
+ c = u;
+ d = v;
+ e = u;
+ f = v;
+ g = u == 6 ? a : b + 1;
+ h = 0 ? c : d + 1;
+ i = 1 ? e : f + 1;
+ return g + h + i;
+}
+
+int
+f4 (int u, int v)
+{
+ int a, c, e, g, h, i;
+ long b, d, f;
+ a = u;
+ b = v;
+ c = u;
+ d = v;
+ e = u;
+ f = v;
+ g = u == 6 ? a : b;
+ h = 0 ? c : d;
+ i = 1 ? e : f;
+ return g + h + i;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-11.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-11.c
new file mode 100644
index 000000000..a59ef8149
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-11.c
@@ -0,0 +1,12 @@
+/* PR c++/44443 */
+/* { dg-options "-Wunused" } */
+/* { dg-do compile } */
+
+int i;
+
+void
+f1 ()
+{
+ const int * __attribute__((unused)) a = &i;
+ const int *b __attribute__((unused)) = &i;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-12.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-12.c
new file mode 100644
index 000000000..b2fb9aca1
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-12.c
@@ -0,0 +1,26 @@
+/* PR c++/44780 */
+/* { dg-do compile } */
+/* { dg-options "-Wunused" } */
+/* { dg-additional-options "-fno-common" { target { { hppa*-*-hpux* } && { ! lp64 } } } } */
+
+typedef double vec __attribute__ ((__vector_size__ (16)));
+vec c, d;
+
+void
+foo (void)
+{
+ vec a;
+ vec b;
+ a = c;
+ b = a;
+ d = b;
+}
+
+void
+bar (void)
+{
+ vec a;
+ vec b; /* { dg-warning "set but not used" } */
+ a = c;
+ b = a;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-13.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-13.c
new file mode 100644
index 000000000..3afd873b6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-13.c
@@ -0,0 +1,27 @@
+/* PR c/46015 */
+/* { dg-options "-Wunused" } */
+/* { dg-do compile } */
+
+int
+f1 (int i)
+{
+ static void *labs[2] = { &&lab1, &&lab2 };
+ goto *(labs[i & 1]);
+
+lab1:
+ return 1;
+lab2:
+ return 2;
+}
+
+int
+f2 (int i)
+{
+ void *labs[2] = { &&lab1, &&lab2 };
+ goto *labs[i & 1];
+
+lab1:
+ return 1;
+lab2:
+ return 2;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-14.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-14.c
new file mode 100644
index 000000000..389febae8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-14.c
@@ -0,0 +1,13 @@
+/* PR c/50179 */
+/* { dg-options "-Wunused" } */
+/* { dg-do compile } */
+
+void bar (int, ...);
+
+char *
+foo (void)
+{
+ bar (1, (__extension__ ({ static char b[2]; b[0] = 1; b; })));
+ bar (1, ({ static char c[2]; c[0] = 1; c; }));
+ return ({ static char d[2]; d[0] = 1; d; });
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-2.c
new file mode 100644
index 000000000..281825900
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-2.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-Wunused" } */
+
+int
+f1 (void)
+{
+ int c = ({
+ int a;
+ a = 1;
+ a; });
+ return c;
+}
+
+void
+f2 (void)
+{
+ int f;
+ f = 0;
+ __asm__ __volatile__ ("" : "+r" (f));
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-3.c
new file mode 100644
index 000000000..9b1fce77a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-3.c
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+/* { dg-options "-Wunused" } */
+
+void
+f1 (void)
+{
+ _Complex int a; /* { dg-warning "set but not used" } */
+ _Complex double b; /* { dg-warning "set but not used" } */
+ __real__ a = 1;
+ __imag__ a = 2;
+ __real__ b = 3.0;
+ __imag__ b = 4.0;
+}
+
+int
+f2 (void)
+{
+ _Complex int a;
+ _Complex double b;
+ __real__ a = 1;
+ __imag__ a = 2;
+ __real__ b = 3.0;
+ __imag__ b = 4.0;
+ return __real__ a + __imag__ b;
+}
+
+_Complex double
+f3 (void)
+{
+ _Complex int a;
+ _Complex double b;
+ __real__ a = 1;
+ __imag__ a = 2;
+ __real__ b = 3.0;
+ __imag__ b = 4.0;
+ return a + b;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-4.c
new file mode 100644
index 000000000..d60c476a4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-4.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-Wunused -W" } */
+
+int
+f1 (unsigned int x)
+{
+ int c = ({ union { unsigned int a; int b; } u; u.a = x; u.b; });
+ return c;
+}
+
+void
+f2 (void)
+{
+ struct S { int i; } a;
+ int b[1];
+ a.i = 1;
+ a.i; /* { dg-warning "no effect" } */
+ b[0] = 1;
+ b[0]; /* { dg-warning "no effect" } */
+}
+
+void
+f3 (void)
+{
+ struct S { int i; } a; /* { dg-warning "set but not used" } */
+ int b[1]; /* { dg-warning "set but not used" } */
+ a.i = 1;
+ b[0] = 1;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-5.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-5.c
new file mode 100644
index 000000000..747f58d04
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-5.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-Wunused" } */
+
+void
+f1 (void)
+{
+ extern int extvari;
+ extvari = 1;
+}
+
+int extvarj;
+
+void
+f2 (void)
+{
+ extern int extvarj;
+ extvarj = 1;
+}
+
+static int extvark;
+
+void
+f3 (void)
+{
+ extern int extvark;
+ extvark = 1;
+}
+
+int
+f4 (void)
+{
+ return extvark;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-6.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-6.c
new file mode 100644
index 000000000..1217719a2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-6.c
@@ -0,0 +1,15 @@
+/* PR c/43981 */
+/* { dg-do compile } */
+/* { dg-options "-Wunused" } */
+
+void g (char *);
+
+char
+f (int a)
+{
+ int len = a * 3;
+ char t[len];
+
+ g (t);
+ return t[0];
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-7.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-7.c
new file mode 100644
index 000000000..74196436d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-7.c
@@ -0,0 +1,48 @@
+/* PR c++/44062 */
+/* { dg-do compile } */
+/* { dg-options "-Wunused" } */
+
+void
+foo (void)
+{
+ int a, b, c, d, e, f, g;
+ a = 1;
+ b = 2;
+ c = 3;
+ d = 4;
+ e = 5;
+ f = 6;
+ g = 7;
+ a; /* { dg-warning "no effect" } */
+ b, 1; /* { dg-warning "no effect" } */
+ (void) c;
+ (void) d, 1; /* { dg-warning "no effect" } */
+ e, f, 1; /* { dg-warning "no effect" } */
+ (void) g, f, 1; /* { dg-warning "no effect" } */
+}
+
+void
+bar (void)
+{
+ int a;
+ int b;
+ int c; /* { dg-warning "set but not used" } */
+ a = 1;
+ b = 2;
+ c = 3;
+ c = ({ a++, b; });
+}
+
+void
+baz (void)
+{
+ int a;
+ int b;
+ int c;
+ int d;
+ a = 1;
+ b = 2;
+ c = 3;
+ d = 4;
+ d, ( a++, b ), c; /* { dg-warning "no effect" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-8.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-8.c
new file mode 100644
index 000000000..0923b3556
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-8.c
@@ -0,0 +1,19 @@
+/* Origin: PR c++/44108 */
+/* { dg-options "-Wunused" } */
+/* { dg-do compile } */
+
+int
+foo ()
+{
+ unsigned int M = 2;
+ const unsigned int M_CONST = 2;
+ static unsigned int M_STATIC = 2;
+ static const unsigned int M_STATIC_CONST = 2;
+
+ char n1[M];
+ char n2[M_CONST];
+ char n3[M_STATIC];
+ char n4[M_STATIC_CONST];
+
+ return sizeof (n1) + sizeof (n2) + sizeof (n3) + sizeof (n4);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-9.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-9.c
new file mode 100644
index 000000000..b2cdc4510
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wunused-var-9.c
@@ -0,0 +1,80 @@
+/* { dg-options "-Wunused" } */
+/* { dg-do compile } */
+
+int f1 (int *, int);
+int f2 (int *);
+int f3 (int *);
+
+int
+f4 (int x)
+{
+ int a, n = 0;
+ int b;
+ for (a = f1 (&b, x); f2 (&b); (void) (a = f3 (&b)))
+ n++;
+ return n;
+}
+
+void
+f5 (int x)
+{
+ int a;
+ a = x;
+ (void) (a = x);
+}
+
+void
+f6 (int x)
+{
+ int a; /* { dg-warning "set but not used" } */
+ a = x;
+}
+
+void
+f7 (int x)
+{
+ int a;
+ ({ a = x; });
+}
+
+int
+f8 (int x)
+{
+ int a;
+ int b = ({ a = x; });
+ return b;
+}
+
+int v;
+
+void
+f9 (int x)
+{
+ int a;
+ ({ v++, a = x; });
+}
+
+int
+f10 (int x)
+{
+ int a;
+ int b = ({ v++, a = x; });
+ return b;
+}
+
+void
+f11 (int x)
+{
+ int a;
+ a = x;
+ ({ v++, a; });
+}
+
+int
+f12 (int x)
+{
+ int a;
+ a = x;
+ int b = ({ v++, a; });
+ return b;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wvarargs-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wvarargs-2.c
new file mode 100644
index 000000000..a2e031f91
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wvarargs-2.c
@@ -0,0 +1,33 @@
+/*
+ { dg-options "-Wno-varargs" }
+ { dg-do compile }
+ */
+
+#include <stdarg.h>
+
+void
+err (int a)
+{
+ va_list vp;
+ va_start (vp, a); // { dg-error "used in function with fixed args" }
+}
+
+void
+foo0 (int a, int b, ...)
+{
+ va_list vp;
+ /* 'a' is not the last argument of the enclosing function, but
+ don't warn because we are ignoring -Wvarargs. */
+ va_start (vp, a);
+ va_end (vp);
+}
+
+void
+foo1 (int a, register int b, ...)
+{
+ va_list vp;
+ /* 'b' is declared with register storage, but don't warn
+ because we are ignoring -Wvarargs. */
+ va_start (vp, b);
+ va_end (vp);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wvarargs.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wvarargs.c
new file mode 100644
index 000000000..408f427b5
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wvarargs.c
@@ -0,0 +1,54 @@
+/* { dg-do compile } */
+
+#include <stdarg.h>
+
+void
+err (int a)
+{
+ va_list vp;
+ va_start (vp, a); // { dg-error "used in function with fixed args" }
+}
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvarargs"
+
+void
+foo0 (int a, int b, ...)
+{
+ va_list vp;
+ /* 'a' is not the last argument of the enclosing function, but
+ don't warn because we are ignoring -Wvarargs. */
+ va_start (vp, a);
+ va_end (vp);
+}
+
+void
+foo1 (int a, register int b, ...)
+{
+ va_list vp;
+ /* 'b' is declared with register storage, but don't warn
+ because we are ignoring -Wvarargs. */
+ va_start (vp, b);
+ va_end (vp);
+}
+
+#pragma GCC diagnostic pop
+
+void
+foo2 (int a, int b, ...)
+{
+ va_list vp;
+ /* 'a' is not the last argument of the enclosing function, so
+ warn. */
+ va_start (vp, a); /* { dg-warning "second parameter" } */
+ va_end (vp);
+}
+
+void
+foo3 (int a, register int b, ...)
+{
+ va_list vp;
+ /* 'b' is declared with register storage, so warn. */
+ va_start (vp, b); /* { dg-warning "undefined behaviour" } */
+ va_end (vp);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/abi-bf.c b/gcc-4.9/gcc/testsuite/c-c++-common/abi-bf.c
new file mode 100644
index 000000000..05b898609
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/abi-bf.c
@@ -0,0 +1,3 @@
+/* { dg-warning "incompatible" } */
+/* { dg-do compile } */
+/* { dg-options "-fstrict-volatile-bitfields -fabi-version=1" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/array-lit.c b/gcc-4.9/gcc/testsuite/c-c++-common/array-lit.c
new file mode 100644
index 000000000..6505c2091
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/array-lit.c
@@ -0,0 +1,12 @@
+/* { dg-options "-std=c99 -Wc++-compat -Werror" { target c } } */
+/* { dg-prune-output "treated as errors" } */
+#include <stdio.h>
+
+int main()
+{
+ for (int *p = (int[]){ 1, 2, 3, 0 }; /* { dg-error "array" } */
+ *p; ++p) {
+ printf("%d\n", *p);
+ }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/attrib-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/attrib-1.c
new file mode 100644
index 000000000..a2a7f7c9f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/attrib-1.c
@@ -0,0 +1,62 @@
+/* PR sanitizer/55435 */
+/* { dg-do compile } */
+
+__attribute__((no_sanitize_address)) int
+f1 (int *p, int *q)
+{
+ *p = 42;
+ return *q;
+}
+
+void f2 (char *);
+void f2 (char *) __attribute__((no_sanitize_address));
+void f2 (char *) __attribute__((no_sanitize_address));
+void f2 (char *);
+
+void
+f2 (char *p)
+{
+ *p = 42;
+}
+
+void f3 (short *);
+__typeof (f3) f3 __attribute__((__no_sanitize_address__));
+
+void
+f3 (short *p)
+{
+ *p = 42;
+}
+
+__attribute__((no_sanitize_address)) int
+f4 (int *p, int *q)
+{
+ *p = 42;
+ return *q;
+}
+
+void f5 (char *);
+void f5 (char *) __attribute__((no_sanitize_address));
+void f5 (char *) __attribute__((no_sanitize_address));
+void f5 (char *);
+
+void
+f5 (char *p)
+{
+ *p = 42;
+}
+
+void f6 (short *);
+__typeof (f6) f6 __attribute__((__no_address_safety_analysis__));
+
+void
+f6 (short *p)
+{
+ *p = 42;
+}
+
+int v __attribute__((no_sanitize_address)); /* { dg-warning "attribute ignored" } */
+int v2 __attribute__((no_address_safety_analysis)); /* { dg-warning "attribute ignored" } */
+
+/* { dg-final { scan-assembler-not "__asan_report_store" } } */
+/* { dg-final { scan-assembler-not "__asan_report_load" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/clone-test-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/clone-test-1.c
new file mode 100644
index 000000000..fd187aaad
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/clone-test-1.c
@@ -0,0 +1,46 @@
+/* Regression test for:
+ http://code.google.com/p/address-sanitizer/issues/detail?id=37 */
+
+/* { dg-do run { target { *-*-linux* } } } */
+/* { dg-require-effective-target clone } */
+/* { dg-require-effective-target hw } */
+/* { dg-options "-D_GNU_SOURCE" } */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sched.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+int Child(void *arg) {
+ char x[32] = {0}; /* Stack gets poisoned. */
+ printf("Child: %p\n", x);
+ _exit(1); /* NoReturn, stack will remain unpoisoned unless we do something. */
+}
+
+volatile int zero = 0;
+
+int main(int argc, char **argv) {
+ int i;
+ const int kStackSize = 1 << 20;
+ char child_stack[kStackSize + 1];
+ char *sp = child_stack + kStackSize; /* Stack grows down. */
+ printf("Parent: %p\n", sp);
+ pid_t clone_pid = clone(Child, sp, CLONE_FILES | CLONE_VM, NULL, 0, 0, 0);
+ int status;
+ pid_t wait_result = waitpid(clone_pid, &status, __WCLONE);
+ if (wait_result < 0) {
+ perror("waitpid");
+ return 1;
+ }
+ if (wait_result == clone_pid && WIFEXITED(status)) {
+ /* Make sure the child stack was indeed unpoisoned. */
+ for (i = 0; i < kStackSize; i++)
+ child_stack[i] = i;
+ int ret = child_stack[zero];
+ return ret;
+ }
+ return 1;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/force-inline-opt0-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/force-inline-opt0-1.c
new file mode 100644
index 000000000..0576155c2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/force-inline-opt0-1.c
@@ -0,0 +1,16 @@
+/* This test checks that we are no instrumenting a memory access twice
+ (before and after inlining) */
+
+/* { dg-do compile } */
+/* { dg-final { scan-assembler-not "__asan_report_load" } } */
+
+__attribute__((always_inline))
+inline void foo(int *x) {
+ *x = 0;
+}
+
+int main() {
+ int x;
+ foo(&x);
+ return x;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/global-overflow-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/global-overflow-1.c
new file mode 100644
index 000000000..66e91479c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/global-overflow-1.c
@@ -0,0 +1,28 @@
+/* { dg-do run } */
+/* { dg-options "-fno-builtin-memset" } */
+/* { dg-shouldfail "asan" } */
+
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void *memset (void *, int, __SIZE_TYPE__);
+
+volatile int ten = 10;
+
+int main() {
+ static char XXX[10];
+ static char YYY[10];
+ static char ZZZ[10];
+ memset(XXX, 0, 10);
+ memset(YYY, 0, 10);
+ memset(ZZZ, 0, 10);
+ int res = YYY[ten]; /* BOOOM */
+ res += XXX[ten/10] + ZZZ[ten/10];
+ return res;
+}
+
+/* { dg-output "READ of size 1 at 0x\[0-9a-f\]+ thread T0.*(\n|\r\n|\r)" } */
+/* { dg-output " #0 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*global-overflow-1.c:20|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r).*" } */
+/* { dg-output "0x\[0-9a-f\]+ is located 0 bytes to the right of global variable" } */
+/* { dg-output ".*YYY\[^\n\r]* of size 10\[^\n\r]*(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/heap-overflow-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/heap-overflow-1.c
new file mode 100644
index 000000000..996909d3c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/heap-overflow-1.c
@@ -0,0 +1,31 @@
+/* { dg-do run } */
+/* { dg-options "-fno-builtin-malloc -fno-builtin-free -fno-builtin-memset" } */
+/* { dg-shouldfail "asan" } */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void *memset (void *, int, __SIZE_TYPE__);
+void *malloc (__SIZE_TYPE__);
+void free (void *);
+
+#ifdef __cplusplus
+}
+#endif
+
+volatile int ten = 10;
+int main(int argc, char **argv) {
+ char *x = (char*)malloc(10);
+ memset(x, 0, 10);
+ int res = x[ten]; /* BOOOM */
+ free(x);
+ return res;
+}
+
+/* { dg-output "READ of size 1 at 0x\[0-9a-f\]+ thread T0.*(\n|\r\n|\r)" } */
+/* { dg-output " #0 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*heap-overflow-1.c:21|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*0x\[0-9a-f\]+ is located 0 bytes to the right of 10-byte region\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*allocated by thread T0 here:\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output " #0 0x\[0-9a-f\]+ (in _*(interceptor_|)malloc|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output " #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*heap-overflow-1.c:19|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/inc.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/inc.c
new file mode 100644
index 000000000..b9c6734ea
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/inc.c
@@ -0,0 +1,21 @@
+/* { dg-options "-fdump-tree-asan0" } */
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
+
+void
+foo(int *a)
+{
+ (*a)++;
+}
+
+int
+main ()
+{
+ int a = 0;
+ foo (&a);
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report" 1 "asan0" } } */
+/* { dg-final { scan-tree-dump "__builtin___asan_report_load4" "asan0" } } */
+/* { dg-final { cleanup-tree-dump "asan0" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/memcmp-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/memcmp-1.c
new file mode 100644
index 000000000..03f32e92a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/memcmp-1.c
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+/* { dg-options "-fno-builtin-memcmp" } */
+/* { dg-shouldfail "asan" } */
+
+#include <string.h>
+
+volatile int one = 1;
+
+int
+main ()
+{
+ char a1[] = {one, 2, 3, 4};
+ char a2[] = {1, 2*one, 3, 4};
+ int res = memcmp (a1, a2, 5 + one);
+ return res;
+}
+
+/* { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow.*(\n|\r\n|\r)" } */
+/* { dg-output " #0 0x\[0-9a-f\]+ (in _*(interceptor_|)memcmp |\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output " #1 0x\[0-9a-f\]+ (in _*main|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/memcmp-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/memcmp-2.c
new file mode 100644
index 000000000..be20cd81e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/memcmp-2.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+
+int
+foo ()
+{
+ char s0[5] = {0};
+ char s1[5] = {1};
+
+ return __builtin_memcmp (s0, s1, 2);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-asan-globals.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-asan-globals.c
new file mode 100644
index 000000000..70a1f95a3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-asan-globals.c
@@ -0,0 +1,13 @@
+/* { dg-do assemble } */
+/* { dg-options "-save-temps --param asan-globals=0" } */
+
+volatile int ten = 10;
+
+int main() {
+ volatile static char XXX[10];
+ XXX[ten];
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not "__asan_register_globals" } } */
+/* { dg-final { cleanup-saved-temps } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-asan-stack.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-asan-stack.c
new file mode 100644
index 000000000..0f65ab3f7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-asan-stack.c
@@ -0,0 +1,16 @@
+/* { dg-do compile { target { { i?86-*-linux* x86_64-*-linux* } && lp64 } } } */
+/* { dg-options "--param asan-stack=0" } */
+#include <string.h>
+
+volatile int one = 1;
+
+int
+main ()
+{
+ volatile char a1[] = {one, 2, 3, 4};
+ volatile char a2[] = {1, 2*one, 3, 4};
+ volatile int res = memcmp ((void *)a1,(void *)a2, 5 + one);
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not "0x41b58ab3|0x41B58AB3|1102416563" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-instrument-reads.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-instrument-reads.c
new file mode 100644
index 000000000..df75878de
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-instrument-reads.c
@@ -0,0 +1,13 @@
+/* { dg-do assemble } */
+/* { dg-options "--param asan-instrument-reads=0 -save-temps" } */
+
+volatile int ten = 10;
+
+int main() {
+ volatile char x[10];
+ x[ten];
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not "__asan_load" } } */
+/* { dg-final { cleanup-saved-temps } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-instrument-writes.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-instrument-writes.c
new file mode 100644
index 000000000..c1500b9fb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-instrument-writes.c
@@ -0,0 +1,13 @@
+/* { dg-do assemble } */
+/* { dg-options "--param asan-instrument-writes=0 -save-temps" } */
+
+volatile int ten = 10;
+
+int main() {
+ volatile char x[10];
+ x[ten] = 1;
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not "__asan_store" } } */
+/* { dg-final { cleanup-saved-temps } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c
new file mode 100644
index 000000000..fa52e0ca8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c
@@ -0,0 +1,68 @@
+/* This tests that when faced with two references to the same memory
+ location in the same basic block, the second reference should not
+ be instrumented by the Address Sanitizer. */
+
+/* { dg-options "-fdump-tree-asan0" } */
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
+
+extern char tab[4];
+
+static int
+test0 ()
+{
+ /* __builtin___asan_report_store1 called 2 times for the two stores
+ below. */
+ tab[0] = 1;
+ tab[1] = 2;
+
+ /* __builtin___asan_report_load1 called 1 time for the store
+ below. */
+ char t0 = tab[1];
+
+ /* This load should not be instrumented because it is to the same
+ memory location as above. */
+ char t1 = tab[1];
+
+ return t0 + t1;
+}
+
+__attribute__((noinline, noclone)) static int
+test1 (int i)
+{
+ char foo[4] = {};
+
+ /*__builtin___asan_report_store1 called 1 time here to instrument
+ the initialization. */
+ foo[i] = 1;
+
+ /*__builtin___asan_report_store1 called 2 times here to instrument
+ the store to the memory region of tab. */
+ __builtin_memset (tab, 3, sizeof (tab));
+
+ /* There is no instrumentation for the two memset calls below. */
+ __builtin_memset (tab, 4, sizeof (tab));
+ __builtin_memset (tab, 5, sizeof (tab));
+
+ /* There are 2 calls to __builtin___asan_report_store1 and 2 calls
+ to __builtin___asan_report_load1 to instrument the store to
+ (subset of) the memory region of tab. */
+ __builtin_memcpy (&tab[1], foo + i, 3);
+
+ /* This should not generate a __builtin___asan_report_load1 because
+ the reference to tab[1] has been already instrumented above. */
+ return tab[1];
+
+ /* So for these function, there should be 7 calls to
+ __builtin___asan_report_store1. */
+}
+
+int
+main ()
+{
+ return test0 () && test1 (0);
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store1" 7 "asan0" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load" 2 "asan0" } } */
+/* { dg-final { cleanup-tree-dump "asan0" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-2.c
new file mode 100644
index 000000000..28525e0ff
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-2.c
@@ -0,0 +1,25 @@
+/* This tests that when faced with two references to the same memory
+ location in the same basic block, the second reference should not
+ be instrumented by the Address Sanitizer. But in case of access to
+ overlapping regions we must be precise. */
+
+/* { dg-options "-fdump-tree-asan0" } */
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
+
+int
+main ()
+{
+ char tab[5];
+
+ /* Here, we instrument the access at offset 0 and access at offset
+ 4. */
+ __builtin_memset (tab, 1, sizeof (tab));
+ /* We instrumented access at offset 0 above already, so only access
+ at offset 3 is instrumented. */
+ __builtin_memset (tab, 1, 3);
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store1" 3 "asan0" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report" 3 "asan0" } } */
+/* { dg-final { cleanup-tree-dump "asan0" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-3.c
new file mode 100644
index 000000000..420a26309
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-3.c
@@ -0,0 +1,18 @@
+/* { dg-options "-fdump-tree-asan0" } */
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
+
+char
+foo (__INT32_TYPE__ *p)
+{
+ /* This generates a __builtin___asan_report_load1. */
+ __INT32_TYPE__ ret = *(char *) p;
+ /* This generates a __builtin___asan_report_store4 depending on the. */
+ *p = 26;
+ return ret;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report" 2 "asan0" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 1 "asan0" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store" 1 "asan0" } } */
+/* { dg-final { cleanup-tree-dump "asan0" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-4.c
new file mode 100644
index 000000000..b2e72841b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-4.c
@@ -0,0 +1,13 @@
+/* { dg-options "-fdump-tree-asan0" } */
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
+
+void
+foo (int *a, char *b, char *c)
+{
+ __builtin_memmove (c, b, a[c[0]]);
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 3 "asan0" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store1" 1 "asan0" } } */
+/* { dg-final { cleanup-tree-dump "asan0" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-5.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-5.c
new file mode 100644
index 000000000..ead3f5823
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-5.c
@@ -0,0 +1,13 @@
+/* { dg-options "-fdump-tree-asan0" } */
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
+
+void
+foo (int *a, char *b, char *c)
+{
+ __builtin_memmove (c, b, a[b[0]]);
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 2 "asan0" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store1" 2 "asan0" } } */
+/* { dg-final { cleanup-tree-dump "asan0" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-6.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-6.c
new file mode 100644
index 000000000..e4691bc47
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-6.c
@@ -0,0 +1,14 @@
+/* { dg-options "-fdump-tree-asan0" } */
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
+
+void
+foo (int *a, char *b, char *c)
+{
+ __builtin_memmove (c, b, a[c[0]]);
+ __builtin_memmove (c, b, a[b[0]]);
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 5 "asan0" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store1" 2 "asan0" } } */
+/* { dg-final { cleanup-tree-dump "asan0" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-7.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-7.c
new file mode 100644
index 000000000..bf40a0376
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-7.c
@@ -0,0 +1,23 @@
+/* { dg-options "-fdump-tree-asan0" } */
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
+
+char e[200];
+
+struct S
+{
+ char a[100];
+ char b[100];
+} s;
+
+int
+foo (int *a, char *b, char *c)
+{
+ int d = __builtin_memcmp (s.a, e, 100);
+ d += __builtin_memcmp (s.a, e, 200);
+ return d;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load" 6 "asan0" } } */
+/* { dg-final { scan-tree-dump-not "__builtin___asan_report_store" "asan0" } } */
+/* { dg-final { cleanup-tree-dump "asan0" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-8.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-8.c
new file mode 100644
index 000000000..38ea7a21d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-8.c
@@ -0,0 +1,14 @@
+/* { dg-options "-fdump-tree-asan0" } */
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
+
+char
+foo (int *a, char *b, char *c)
+{
+ __builtin_memmove (c, b, a[b[0]]);
+ return c[0] + b[0];
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 3 "asan0" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store1" 2 "asan0" } } */
+/* { dg-final { cleanup-tree-dump "asan0" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-use-after-return.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-use-after-return.c
new file mode 100644
index 000000000..f326e0cae
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-use-after-return.c
@@ -0,0 +1,13 @@
+/* { dg-do assemble } */
+/* { dg-options "--param asan-use-after-return=0 -save-temps" } */
+
+extern void f(char *);
+
+int main() {
+ char buf[64];
+ f(buf);
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not "__asan_option_detect_stack_use_after_return" } } */
+/* { dg-final { cleanup-saved-temps } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/null-deref-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/null-deref-1.c
new file mode 100644
index 000000000..6aea9d295
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/null-deref-1.c
@@ -0,0 +1,22 @@
+/* { dg-do run } */
+/* { dg-options "-fno-omit-frame-pointer -fno-shrink-wrap" } */
+/* { dg-additional-options "-mno-omit-leaf-frame-pointer" { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-shouldfail "asan" } */
+
+__attribute__((noinline, noclone))
+static void
+NullDeref(int *ptr)
+{
+ ptr[10]++;
+}
+
+int main()
+{
+ NullDeref((int*)0);
+ return 0;
+}
+
+/* { dg-output "ERROR: AddressSanitizer:? SEGV on unknown address\[^\n\r]*" } */
+/* { dg-output "0x\[0-9a-f\]+ \[^\n\r]*pc 0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output " #0 0x\[0-9a-f\]+ (in \[^\n\r]*NullDeref\[^\n\r]* (\[^\n\r]*null-deref-1.c:10|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output " #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*null-deref-1.c:15|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr56330.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr56330.c
new file mode 100644
index 000000000..25759f4ec
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr56330.c
@@ -0,0 +1,24 @@
+/* PR sanitizer/56330 */
+/* { dg-do compile } */
+
+char e[200];
+
+struct S
+{
+ char a[100];
+ char b[100];
+} s;
+
+int
+foo (void)
+{
+ int i = __builtin_memcmp (s.a, e, 100);
+ i += __builtin_memcmp (s.a, e, 200);
+ return i;
+}
+
+void
+bar (int *a, char *b, char *c)
+{
+ __builtin_memmove (c, b, a[b[0]]);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr59029.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr59029.c
new file mode 100644
index 000000000..a1319b272
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr59029.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+
+int
+foo ()
+{
+ return __sync_fetch_and_add ((int *) 0, 1);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr59063-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr59063-1.c
new file mode 100644
index 000000000..a22db6a0d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr59063-1.c
@@ -0,0 +1,11 @@
+/* { dg-do run { target { *-*-linux* } } } */
+
+#include <time.h>
+static int weak_gettime (clockid_t clk_id, struct timespec *tp)
+ __attribute__((__weakref__("clock_gettime")));
+int main() {
+ if (!clock_gettime)
+ return 0;
+ struct timespec ts;
+ return weak_gettime(CLOCK_MONOTONIC, &ts);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr59063-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr59063-2.c
new file mode 100644
index 000000000..759b7f24d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr59063-2.c
@@ -0,0 +1,12 @@
+/* { dg-do run { target { *-*-linux* } } } */
+/* { dg-options "-static-libasan" } */
+
+#include <time.h>
+static int weak_gettime (clockid_t clk_id, struct timespec *tp)
+ __attribute__((__weakref__("clock_gettime")));
+int main() {
+ if (!clock_gettime)
+ return 0;
+ struct timespec ts;
+ return weak_gettime(CLOCK_MONOTONIC, &ts);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/rlimit-mmap-test-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/rlimit-mmap-test-1.c
new file mode 100644
index 000000000..9dbbc85f4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/rlimit-mmap-test-1.c
@@ -0,0 +1,22 @@
+/* Check that we properly report mmap failure. */
+
+/* { dg-do run { target setrlimit } } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
+/* { dg-require-effective-target hw } */
+/* { dg-shouldfail "asan" } */
+
+#include <stdlib.h>
+#include <assert.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+
+static volatile void *x;
+
+int main(int argc, char **argv) {
+ struct rlimit mmap_resource_limit = { 0, 0 };
+ if (setrlimit(RLIMIT_AS, &mmap_resource_limit)) return 1;
+ x = malloc(10000000);
+ return 0;
+}
+
+/* { dg-output "ERROR: Failed to mmap" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/sanity-check-pure-c-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/sanity-check-pure-c-1.c
new file mode 100644
index 000000000..78d15e1aa
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/sanity-check-pure-c-1.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-options "-fno-builtin-malloc -fno-builtin-free" } */
+/* { dg-shouldfail "asan" } */
+
+#include <stdlib.h>
+int main() {
+ char *x = (char*)malloc(10);
+ free(x);
+ return x[5];
+}
+
+/* { dg-output "heap-use-after-free.*(\n|\r\n|\r)" } */
+/* { dg-output " #0 \[^\n\r]*(in _*(interceptor_|)free|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output " #1 \[^\n\r]*(in _*main (\[^\n\r]*sanity-check-pure-c-1.c:8|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
+/* { dg-output " #0 \[^\n\r]*(in _*(interceptor_|)malloc|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output " #1 \[^\n\r]*(in _*main (\[^\n\r]*sanity-check-pure-c-1.c:7|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/sleep-before-dying-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/sleep-before-dying-1.c
new file mode 100644
index 000000000..e50885907
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/sleep-before-dying-1.c
@@ -0,0 +1,14 @@
+/* { dg-do run } */
+/* { dg-set-target-env-var ASAN_OPTIONS "sleep_before_dying=1" } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-O2" } } */
+/* { dg-options "-fno-builtin-malloc -fno-builtin-free" } */
+/* { dg-shouldfail "asan" } */
+
+#include <stdlib.h>
+int main() {
+ char *x = (char*)malloc(10);
+ free(x);
+ return x[5];
+}
+
+/* { dg-output "Sleeping for 1 second" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/stack-overflow-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/stack-overflow-1.c
new file mode 100644
index 000000000..c71765097
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/stack-overflow-1.c
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+/* { dg-options "-fno-builtin-memset" } */
+/* { dg-shouldfail "asan" } */
+
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void *memset (void *, int, __SIZE_TYPE__);
+
+volatile int ten = 10;
+
+int main() {
+ char x[10];
+ memset(x, 0, 10);
+ int res = x[ten]; /* BOOOM */
+ return res;
+}
+
+/* { dg-output "READ of size 1 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output " #0 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*stack-overflow-1.c:16|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*Address 0x\[0-9a-f\]+ is located in stack of thread T0.*(\n|\r\n|\r)" */
+/* { dg-output "\[^\n\r]*in main.*stack-overflow-1.c.*(\n|\r\n|\r)" */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/strip-path-prefix-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/strip-path-prefix-1.c
new file mode 100644
index 000000000..812aa37e2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/strip-path-prefix-1.c
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-O2" } } */
+/* { dg-set-target-env-var ASAN_OPTIONS "strip_path_prefix='/'" } */
+/* { dg-options "-fno-builtin-malloc -fno-builtin-free" } */
+/* { dg-shouldfail "asan" } */
+
+#include <stdlib.h>
+int main() {
+ char *x = (char*)malloc(10);
+ free(x);
+ return x[5];
+}
+
+/* { dg-output "heap-use-after-free.*(\n|\r\n|\r)" } */
+/* { dg-output " #0 0x\[0-9a-f\]+ \[(\]?\[^/\]\[^\n\r]*(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/strncpy-overflow-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/strncpy-overflow-1.c
new file mode 100644
index 000000000..3ed9fd6dd
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/strncpy-overflow-1.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-options "-fno-builtin-malloc -fno-builtin-strncpy" } */
+/* { dg-shouldfail "asan" } */
+
+#include <string.h>
+#include <stdlib.h>
+int main(int argc, char **argv) {
+ char *hello = (char*)malloc(6);
+ strcpy(hello, "hello");
+ char *short_buffer = (char*)malloc(9);
+ strncpy(short_buffer, hello, 10); /* BOOM */
+ return short_buffer[8];
+}
+
+/* { dg-output "WRITE of size \[0-9\]* at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output " #0 0x\[0-9a-f\]+ (in _*(interceptor_|)strncpy|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output " #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*strncpy-overflow-1.c:11|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*0x\[0-9a-f\]+ is located 0 bytes to the right of 9-byte region\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*allocated by thread T0 here:\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output " #0 0x\[0-9a-f\]+ (in _*(interceptor_|)malloc|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output " #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*strncpy-overflow-1.c:10|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/swapcontext-test-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/swapcontext-test-1.c
new file mode 100644
index 000000000..23d3db065
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/swapcontext-test-1.c
@@ -0,0 +1,63 @@
+/* Check that ASan plays well with easy cases of makecontext/swapcontext. */
+
+/* { dg-do run { target swapcontext } } */
+
+#include <stdio.h>
+#include <ucontext.h>
+#include <unistd.h>
+
+ucontext_t orig_context;
+ucontext_t child_context;
+
+void Child(int mode) {
+ char x[32] = {0}; /* Stack gets poisoned. */
+ printf("Child: %p\n", x);
+ /* (a) Do nothing, just return to parent function.
+ (b) Jump into the original function. Stack remains poisoned unless we do
+ something. */
+ if (mode == 1) {
+ if (swapcontext(&child_context, &orig_context) < 0) {
+ perror("swapcontext");
+ _exit(0);
+ }
+ }
+}
+
+int Run(int arg, int mode) {
+ int i;
+ const int kStackSize = 1 << 20;
+ char child_stack[kStackSize + 1];
+ printf("Child stack: %p\n", child_stack);
+ /* Setup child context. */
+ getcontext(&child_context);
+ child_context.uc_stack.ss_sp = child_stack;
+ child_context.uc_stack.ss_size = kStackSize / 2;
+ if (mode == 0) {
+ child_context.uc_link = &orig_context;
+ }
+ makecontext(&child_context, (void (*)())Child, 1, mode);
+ if (swapcontext(&orig_context, &child_context) < 0) {
+ perror("swapcontext");
+ return 0;
+ }
+ /* Touch childs's stack to make sure it's unpoisoned. */
+ for (i = 0; i < kStackSize; i++) {
+ child_stack[i] = i;
+ }
+ return child_stack[arg];
+}
+
+volatile int zero = 0;
+
+int main(int argc, char **argv) {
+ int ret = 0;
+ ret += Run(zero, 0);
+ printf("Test1 passed\n");
+ ret += Run(zero, 1);
+ printf("Test2 passed\n");
+ return ret;
+}
+
+/* { dg-output "WARNING: ASan doesn't fully support makecontext/swapcontext.*" } */
+/* { dg-output "Test1 passed.*" } */
+/* { dg-output "Test2 passed.*" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/use-after-free-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/use-after-free-1.c
new file mode 100644
index 000000000..25e9be827
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/use-after-free-1.c
@@ -0,0 +1,22 @@
+/* { dg-do run } */
+/* { dg-options "-fno-builtin-malloc -fno-builtin-free" } */
+/* { dg-shouldfail "asan" } */
+
+#include <stdlib.h>
+int main() {
+ char *x = (char*)malloc(10);
+ free(x);
+ return x[5];
+}
+
+/* { dg-output "ERROR: AddressSanitizer:? heap-use-after-free on address\[^\n\r]*" } */
+/* { dg-output "0x\[0-9a-f\]+ at pc 0x\[0-9a-f\]+ bp 0x\[0-9a-f\]+ sp 0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*READ of size 1 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output " #0 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*use-after-free-1.c:9|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*0x\[0-9a-f\]+ is located 5 bytes inside of 10-byte region .0x\[0-9a-f\]+,0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*freed by thread T0 here:\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output " #0 0x\[0-9a-f\]+ (in _*(interceptor_|)free|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output " #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*use-after-free-1.c:8|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*previously allocated by thread T0 here:\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output " #0 0x\[0-9a-f\]+ (in _*(interceptor_|)malloc|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output " #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*use-after-free-1.c:7|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/use-after-return-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/use-after-return-1.c
new file mode 100644
index 000000000..49933e531
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/use-after-return-1.c
@@ -0,0 +1,53 @@
+/* { dg-do run } */
+/* { dg-set-target-env-var ASAN_OPTIONS "detect_stack_use_after_return=1" } */
+/* { dg-shouldfail "asan" } */
+
+#include <stdio.h>
+#include <pthread.h>
+
+#ifndef kSize
+# define kSize 1
+#endif
+
+#ifndef UseThread
+# define UseThread 0
+#endif
+
+__attribute__((noinline))
+char *Ident(char *x) {
+ fprintf(stderr, "1: %p\n", x);
+ return x;
+}
+
+__attribute__((noinline))
+char *Func1() {
+ char local[kSize];
+ return Ident(local);
+}
+
+__attribute__((noinline))
+void Func2(char *x) {
+ fprintf(stderr, "2: %p\n", x);
+ *x = 1;
+}
+
+void *Thread(void *unused) {
+ Func2(Func1());
+ return NULL;
+}
+
+int main(int argc, char **argv) {
+#if UseThread
+ pthread_t t;
+ pthread_create(&t, 0, Thread, 0);
+ pthread_join(t, 0);
+#else
+ Func2(Func1());
+#endif
+ return 0;
+}
+
+/* { dg-output "WRITE of size 1 at .* thread T0.*" } */
+/* { dg-output " #0.*(Func2)?.*use-after-return-1.(c:31)?.*" } */
+/* { dg-output "is located in stack of thread T0 at offset.*" } */
+/* { dg-output "\'local\' <== Memory access at offset 32 is inside this variable" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asmgoto-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asmgoto-1.c
new file mode 100644
index 000000000..9c729fdd5
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asmgoto-1.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void
+foo (void)
+{
+ int i = 0;
+ asm ("" : : : "memory");
+ asm ("" : : : );
+ asm ("" : : "r" (i));
+ asm ("" : : );
+ asm ("" : "=r" (i));
+ asm ("" : );
+ asm ("");
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asmgoto-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/asmgoto-2.c
new file mode 100644
index 000000000..5bf45725d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asmgoto-2.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void
+foo (void)
+{
+ __label__ lab;
+ int i = 0;
+ asm goto ("" : : : : lab);
+ asm goto ("" : "=r" (i) : : : lab); /* { dg-error "expected" } */
+ asm goto ("" : : : : ); /* { dg-error "expected" } */
+ asm goto ("" : : : "memory"); /* { dg-error "expected" } */
+ asm goto ("" : : : ); /* { dg-error "expected" } */
+ asm goto ("" : : "r" (i)); /* { dg-error "expected" } */
+ asm goto ("" : : ); /* { dg-error "expected" } */
+ asm goto ("" : "=r" (i)); /* { dg-error "expected" } */
+ asm goto ("" : ); /* { dg-error "expected" } */
+ asm goto (""); /* { dg-error "expected" } */
+ lab:;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asmgoto-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/asmgoto-3.c
new file mode 100644
index 000000000..5224429a3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asmgoto-3.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-Wunused" } */
+
+int foo ()
+{
+ asm goto ("" : : : : label);
+ return 1;
+ label:
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asmgoto-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/asmgoto-4.c
new file mode 100644
index 000000000..4532bf196
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/asmgoto-4.c
@@ -0,0 +1,44 @@
+/* PR middle-end/44071 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+static inline int
+f1 (void)
+{
+ asm goto ("" : : : : l1, l2);
+ __builtin_unreachable ();
+ l1:
+ return 1;
+ l2:
+ return 0;
+}
+
+int
+b1 (int x)
+{
+ if (f1 () || x == 6)
+ x = 1;
+ else
+ x = 2;
+ return x;
+}
+
+static inline int
+f2 (void)
+{
+ asm goto ("" : : : : l1, l2);
+ l1:
+ return 1;
+ l2:
+ return 0;
+}
+
+int
+b2 (int x)
+{
+ if (f2 () || x == 6)
+ x = 1;
+ else
+ x = 2;
+ return x;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/attr-used-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/attr-used-2.c
new file mode 100644
index 000000000..f78b94b53
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/attr-used-2.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-Wall -O2" } */
+
+static int xyzzy __attribute__((__used__)) = 1;
+
+void foo()
+{
+ int x __attribute__((__used__)); /* { dg-warning "attribute ignored|unused variable" } */
+}
+
+/* { dg-final { scan-assembler "xyzzy" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/attr-used.c b/gcc-4.9/gcc/testsuite/c-c++-common/attr-used.c
new file mode 100644
index 000000000..ba7705aaa
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/attr-used.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+static void function_declaration_before(void) __attribute__((__used__));
+
+static void function_declaration_before(void) {}
+
+static void function_declaration_after(void) {}
+
+static void function_declaration_after(void) __attribute__((__used__));
+
+/* { dg-final { scan-assembler "function_declaration_before" } } */
+/* { dg-final { scan-assembler "function_declaration_after" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/attributes-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/attributes-1.c
new file mode 100644
index 000000000..af4dd1227
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/attributes-1.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-prune-output "undeclared here \\(not in a function\\)|\[^\n\r\]* was not declared in this scope" } */
+
+void* my_calloc(unsigned, unsigned) __attribute__((alloc_size(1,bar))); /* { dg-warning "outside range" } */
+void* my_realloc(void*, unsigned) __attribute__((alloc_size(bar))); /* { dg-warning "outside range" } */
+
+typedef char vec __attribute__((vector_size(bar))); /* { dg-warning "ignored" } */
+
+void f1(char*) __attribute__((nonnull(bar))); /* { dg-error "invalid operand" } */
+void f2(char*) __attribute__((nonnull(1,bar))); /* { dg-error "invalid operand" } */
+
+void g() __attribute__((aligned(bar))); /* { dg-error "invalid value|not an integer" } */
+
+void foo(void);
+void* my_calloc(unsigned, unsigned) __attribute__((alloc_size(1,foo))); /* { dg-warning "outside range" } */
+void* my_realloc(void*, unsigned) __attribute__((alloc_size(foo))); /* { dg-warning "outside range" } */
+
+typedef char vec __attribute__((vector_size(foo))); /* { dg-warning "ignored" } */
+
+void f1(char*) __attribute__((nonnull(foo))); /* { dg-error "invalid operand" } */
+void f2(char*) __attribute__((nonnull(1,foo))); /* { dg-error "invalid operand" } */
+
+void g() __attribute__((aligned(foo))); /* { dg-error "invalid value|not an integer" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/builtin-offsetof.c b/gcc-4.9/gcc/testsuite/c-c++-common/builtin-offsetof.c
new file mode 100644
index 000000000..6d9777546
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/builtin-offsetof.c
@@ -0,0 +1,29 @@
+// Contributed by Dodji Seketeli <dodji@redhat.com>
+// Origin PR c++/38699
+// { dg-options "-Warray-bounds" }
+// { dg-do compile }
+
+struct A
+{
+ const char *p;
+};
+
+struct B
+{
+ char p[10];
+ struct A a;
+};
+
+void
+f0 ()
+{
+ __builtin_offsetof(struct A, p); // OK
+ __builtin_offsetof(struct A, p[0]); // { dg-error "non constant address" }
+ __builtin_offsetof(struct B, p[0]); // OK
+ __builtin_offsetof(struct B, p[9]); // OK
+ __builtin_offsetof(struct B, p[10]); // OK
+ __builtin_offsetof(struct B, p[11]); // { dg-warning "greater than size" }
+ __builtin_offsetof(struct B, a.p); // OK
+ __builtin_offsetof(struct B, p[0]); // OK
+ __builtin_offsetof(struct B, a.p[0]); // { dg-error "non constant address" }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c
new file mode 100644
index 000000000..4bf85b5ca
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c
@@ -0,0 +1,48 @@
+/* { dg-do run } */
+/* { dg-options "-fcilkplus" } */
+
+#if HAVE_IO
+#include <stdio.h>
+#endif
+#include <assert.h>
+
+const int n = 8;
+
+float x[8], y[8], z[8];
+
+int main() {
+ int i = 0;
+ float x_sum =0;
+ for(i=1; i<=5; i+=4 ) {
+ x[0:n] = 3;
+ y[0:n] = i;
+ z[0:n] = 0;
+#if HAVE_IO
+ printf("x\ty\tz\n");
+ for( size_t k=0; k<n; ++k ) {
+ printf("%g\t%g\t%g\n",x[k],y[k],z[k]);
+ }
+ x_sum = __sec_reduce_add (x[0:n]);
+ printf("sec_reduce_add (x[0:n]) = %6.3f\n", x_sum);
+#endif
+ assert( __sec_reduce_add(x[0:n])==3*n );
+ assert( __sec_reduce_add(y[0:n])==i*n );
+ assert( __sec_reduce_add(z[0:n])==0 );
+
+ if (x[0:n] >= y[0:n]) {
+ z[0:n] = x[0:n] - y[0:n];
+ } else {
+ z[0:n] = x[0:n] + y[0:n];
+ }
+#if HAVE_IO
+ printf("x\ty\tz\n");
+ for( size_t k=0; k<n; ++k ) {
+ printf("%g\t%g\t%g\n",x[k],y[k],z[k]);
+ }
+#endif
+ assert( __sec_reduce_add(x[0:n])==3*n );
+ assert( __sec_reduce_add(y[0:n])==i*n );
+ assert( __sec_reduce_add(z[0:n])==(3>=i?3-i:3+i)*n );
+ }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/array_test1.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/array_test1.c
new file mode 100644
index 000000000..282a55d6f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/array_test1.c
@@ -0,0 +1,84 @@
+/* { dg-do run } */
+/* { dg-options "-fcilkplus" } */
+
+#include <stdlib.h>
+
+int main2 (char **argv);
+
+int main(void)
+{
+ int x = 0;
+ const char *array[] = {"a.out", "5"};
+ x = main2 ((char **)array);
+ return x;
+}
+
+int main2 (char **argv)
+{
+ int array[10], ii = 0, x = 2, z= 0 , y = 0 ;
+ for (ii = 0; ii < 10; ii++)
+ array[ii] = 10;
+
+ array[0:10:1] = 15;
+
+ for (ii = 0; ii < 10; ii++)
+ if (array[ii] != 15)
+ return 5;
+ array[0:5:2] = 20;
+
+ for (ii = 0; ii < 10; ii += 2)
+ if (array[ii] != 20)
+ return 4;
+
+
+ x = atoi(argv[1]);
+ z = (10-atoi(argv[1]))/atoi(argv[1]);
+
+ array[x:5:z] = 50;
+
+ for (ii = x; ii < 10; ii += z)
+ if (array[ii] != 50)
+ return 3;
+
+ x = atoi(argv[1]);
+ z = (10-atoi(argv[1]))/atoi(argv[1]);
+ y = 10-atoi(argv[1]);
+
+ array[x:y:z] = 505;
+ for (ii = x; ii < 10; ii += z)
+ if (array[ii] != 505)
+ return 4;
+
+ x = atoi(argv[1]);
+ z = (10-atoi(argv[1]))/atoi(argv[1]);
+ y = 10-atoi(argv[1]);
+
+ array[x:y:((10-atoi(argv[1]))/atoi(argv[1]))] = 25;
+
+ for (ii = x; ii < 10; ii += z)
+ if (array[ii] != 25)
+ return 5;
+ x = atoi(argv[1]);
+ z = (10-atoi(argv[1]))/atoi(argv[1]);
+ y = 10-atoi(argv[1]);
+
+ array[atoi(argv[1]):(10-atoi(argv[1])):((10-atoi(argv[1]))/atoi(argv[1]))] =
+ 1400;
+ for (ii = x; ii < 10; ii += z)
+ if (array[ii] != 1400)
+ return 6;
+
+
+ array[atoi("5"):5:1] = 5555;
+
+ for (ii = atoi ("5"); ii < 10; ii++)
+ if (array[ii] != 5555)
+ return 7;
+
+
+ array[atoi("5"):atoi("5"):atoi("1")] = 9999;
+ for (ii = atoi ("5"); ii < (atoi ("5") + atoi ("5")); ii += atoi ("1"))
+ if (array[ii] != 9999)
+ return 8;
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/array_test2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/array_test2.c
new file mode 100644
index 000000000..60f2de283
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/array_test2.c
@@ -0,0 +1,128 @@
+/* { dg-do run } */
+/* { dg-options "-fcilkplus" } */
+
+#include <stdlib.h>
+int main2 (char **argv);
+int main(void)
+{
+ int x = 0;
+ const char *array[] = {"a.out", "5"};
+ x = main2 ((char **)array);
+ return x;
+}
+
+
+int main2(char **argv)
+{
+ int array[10], array2[10], ii = 0, x = 2, z= 0 , y = 0 ;
+
+ for (ii = 0; ii < 10; ii++)
+ {
+ array[ii] = 10;
+ array2[ii] = 5000000;
+ }
+
+ array2[0:10:1] = array[0:10:1];
+
+ for (ii = 0; ii < 10; ii++)
+ if (array2[ii] != array[ii])
+ return 1;
+
+ for (ii = 0; ii < 10; ii++)
+ {
+ array[ii] = 10;
+ array2[ii] = 5000000;
+ }
+
+ array2[0:5:2] = array[0:5:2];
+
+ for (ii = 0; ii < 10; ii += 2)
+ if (array[ii] != array2[ii])
+ return 2;
+
+ for (ii = 0; ii < 10; ii++)
+ {
+ array[ii] = 10;
+ array2[ii] = 5000000;
+ }
+ x = atoi(argv[1]);
+ z = (10-atoi(argv[1]))/atoi(argv[1]);
+
+ array2[x:5:z] = array[x:5:z];
+
+ for (ii = x; ii < 5; ii += z)
+ if (array2[ii] != array[ii])
+ return 3;
+
+ for (ii = 0; ii < 10; ii++)
+ {
+ array[ii] = 500;
+ array2[ii] = 1000000;
+ }
+ x = atoi(argv[1]);
+ z = (10-atoi(argv[1]))/atoi(argv[1]);
+ y = 10-atoi(argv[1]);
+
+ array2[x:y:z] = array[x:y:z];
+ for (ii = x; ii < 10; ii = ii + z)
+ if (array2[ii] != array[ii])
+ return 4;
+
+ for (ii = 0; ii < 10; ii++)
+ {
+ array[ii] = 500;
+ array2[ii] = 1000000;
+ }
+ x = atoi(argv[1]);
+ z = (10-atoi(argv[1]))/atoi(argv[1]);
+ y = 10-atoi(argv[1]);
+
+ array[x:y:((10-atoi(argv[1]))/atoi(argv[1]))] =
+ array2[x:y:((10-atoi(argv[1]))/atoi(argv[1]))];
+
+ for (ii = x; ii < 10; ii += z)
+ if (array[ii] != array2[ii])
+ return 5;
+
+
+ x = atoi(argv[1]);
+ z = (10-atoi(argv[1]))/atoi(argv[1]);
+ y = 10-atoi(argv[1]);
+
+ for (ii = 0; ii < 10; ii++)
+ {
+ array[ii] = 500;
+ array2[ii] = 1000000;
+ }
+
+ array[atoi(argv[1]):(10-atoi(argv[1])):((10-atoi(argv[1]))/atoi(argv[1]))] =
+ array2[atoi(argv[1]):(10-atoi(argv[1])):((10-atoi(argv[1]))/atoi(argv[1]))];
+ for (ii = x; ii < 10; ii += z)
+ if (array[ii] != array2[ii])
+ return 6;
+
+ for (ii = 0; ii < 10; ii++)
+ {
+ array[ii] = 4;
+ array2[ii] = 2;
+ }
+
+ array[atoi("5"):5:1] = array2[atoi("5"):5:1];
+
+ for (ii = atoi ("5"); ii < 10; ii++)
+ if (array[ii] != array2[ii])
+ return (7);
+
+ for (ii = 0; ii < 10; ii++)
+ {
+ array[ii] = 5;
+ array2[ii] = 1;
+ }
+ array[atoi("5"):atoi("5"):atoi("1")] = array2[atoi("5"):atoi("5"):atoi("1")];
+
+ for (ii = 5; ii < 10; ii++)
+ if (array2[ii] != array[ii])
+ return 8;
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/array_test_ND.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/array_test_ND.c
new file mode 100644
index 000000000..e89bbab26
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/array_test_ND.c
@@ -0,0 +1,102 @@
+/* { dg-do run } */
+/* { dg-options "-fcilkplus" } */
+
+#include <stdlib.h>
+int main2(char **argv);
+int main(void)
+{
+ int x = 0;
+ const char *array[] = {"a.out", "10", "15"};
+ x = main2 ((char **)array);
+ return x;
+}
+
+int main2(char **argv)
+{
+ int array[10][15], ii = 0, jj = 0,x = 0, z= 1 , y = 10 ;
+ int array_2[10][15];
+ int argc = 3;
+ __asm volatile ("" : "+r" (argc));
+
+ for (ii = 0; ii < 10; ii++) {
+ for (jj = 0; jj< 15; jj++) {
+ array[ii][jj] = ii+jj;
+ array_2[ii][jj] = 0;
+ }
+ }
+ array_2[0:5:2][0:5:3] = array[0:5:2][0:5:3] + 1 + 5 + array[0][5] + x;
+
+ for (ii = 0; ii < 10; ii += 2)
+ {
+ for (jj = 0; jj < 15; jj += 3)
+ {
+ if (array_2[ii][jj] != array[ii][jj] + 1 + 5 + array[0][5] + x)
+ return 2;
+ }
+ }
+
+
+ for (ii = 0; ii < 10; ii++) {
+ for (jj = 0; jj< 15; jj++) {
+ array[ii][jj] = ii+jj;
+ array_2[ii][jj] = 0;
+ }
+ }
+ x = atoi(argv[1]);
+ y = atoi(argv[2]);
+ array_2[0:x:1][0:y:1] = array[0:x:1][0:y:1] + x + y + array[0:x:1][0:y:1];
+
+ for (ii = 0; ii < x; ii++)
+ {
+ for (jj = 0; jj < y; jj++)
+ {
+ if (array_2[ii][jj] != array[ii][jj] + x + y + array[ii][jj])
+ return 3;
+ }
+ }
+
+ for (ii = 0; ii < 10; ii++) {
+ for (jj = 0; jj< 15; jj++) {
+ array[ii][jj] = ii+jj;
+ array_2[ii][jj] = 0;
+ }
+ }
+ x = atoi(argv[1]);
+ y = atoi(argv[2]);
+ z = (20- atoi (argv[1]))/atoi(argv[1]);
+ /* (20-10)/10 evaluates to 1 all the time :-). */
+ array_2[0:x:z][0:y:z] = array[0:x:z][0:y:z] + array[0:x:z][0:y:z] + y + z;
+
+ for (ii = 0; ii < x; ii += z)
+ {
+ for (jj = 0; jj < y; jj += z)
+ {
+ if (array_2[ii][jj] != array[ii][jj] + array[ii][jj] + y + z)
+ return 4;
+ }
+ }
+
+
+
+ for (ii = 0; ii < 10; ii++) {
+ for (jj = 0; jj< 15; jj++) {
+ array[ii][jj] = ii+jj;
+ array_2[ii][jj] = 0;
+ }
+ }
+ x = argc-3;
+ y = 20-atoi(argv[1]);
+ z = (20- atoi (argv[1]))/atoi(argv[1]);
+ /* (20-10)/10 evaluates to 1 all the time :-). */
+ array_2[(argc-3):(20-atoi(argv[1])):(20-atoi(argv[1]))/atoi(argv[1])][(argc-3):(30-atoi(argv[2])): ((30-atoi(argv[2]))/atoi(argv[2]))] = array[(argc-3):20-atoi(argv[1]):(20-atoi(argv[1]))/atoi(argv[1])][(argc-3):(30-atoi(argv[2])): (30-atoi(argv[2]))/atoi(argv[2])] + array[(argc-3):20-atoi(argv[1]):(20-atoi(argv[1]))/atoi(argv[1])][(argc-3):(30-atoi(argv[2])): (30-atoi(argv[2]))/atoi(argv[2])] * array[(argc-3):20-atoi(argv[1]):(20-atoi(argv[1]))/atoi(argv[1])][(argc-3):(30-atoi(argv[2])): (30-atoi(argv[2]))/atoi(argv[2])];
+
+ for (ii = 0; ii < 10; ii++)
+ {
+ for (jj = 0; jj < 15; jj++)
+ {
+ if (array_2[ii][jj] != array[ii][jj] + array[ii][jj] * array[ii][jj])
+ return 5;
+ }
+ }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/builtin_fn_custom.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/builtin_fn_custom.c
new file mode 100644
index 000000000..0f066d4a6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/builtin_fn_custom.c
@@ -0,0 +1,69 @@
+/* { dg-do run } */
+/* { dg-options "-fcilkplus" } */
+
+#define NUMBER 100
+#if HAVE_IO
+#include <stdio.h>
+#endif
+/* #include <stdlib.h> */
+
+double my_func (double x, double y)
+{
+ if (x > y)
+ return x;
+ else
+ return y;
+}
+
+
+/* char __sec_reduce_add (int *); */
+int main(void)
+{
+ int ii,array[NUMBER], y = 0, y_int = 0, array2[NUMBER];
+ double x, yy, array3[NUMBER], array4[NUMBER];
+ double max_value = 0.000, min_value = 0.000, add_value, mul_value = 1.00;
+ int max_index = 0, min_index = 0;
+ for (ii = 0; ii < NUMBER; ii++)
+ {
+ array[ii] = 1+ii;
+ array2[ii]= 2;
+ }
+
+ for (ii = 0; ii < NUMBER; ii++)
+ {
+ if (ii%2 && ii)
+ array3[ii] = (double)(1.0000/(double)ii);
+ else
+ array3[ii] = (double) ii + 0.10;
+ array4[ii] = (double) (1.00000/ (double)(ii+1));
+ }
+
+ /* array[:] = 5; */
+ x = __sec_reduce (0, array3[:] * array4[:], my_func);
+ y = __sec_reduce_max_ind ( array3[:] * array4[:]);
+
+ /* Initialize it to the first variable. */
+ max_value = array3[0] * array4[0];
+ for (ii = 0; ii < NUMBER; ii++)
+ if (array3[ii] * array4[ii] > max_value) {
+ max_value = array3[ii] * array4[ii];
+ max_index = ii;
+ }
+
+
+
+#if HAVE_IO
+ for (ii = 0; ii < NUMBER; ii++)
+ printf("%5.3f ", array3[ii] * array4[ii]);
+ printf("\n");
+ printf("Max = %5.3f\t Max Index = %2d\n", x, y);
+#endif
+
+ if (x != max_value)
+ return 1;
+
+ if (y != max_index)
+ return 2;
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/builtin_fn_mutating.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/builtin_fn_mutating.c
new file mode 100644
index 000000000..e01fbb1b3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/builtin_fn_mutating.c
@@ -0,0 +1,69 @@
+/* { dg-do run } */
+/* { dg-options "-fcilkplus" } */
+
+#define NUMBER 100
+#if HAVE_IO
+#include <stdio.h>
+#endif
+/* #include <stdlib.h> */
+
+void my_func (double *x, double y)
+{
+ if (*x < y)
+ *x = y;
+}
+
+
+int main(void)
+{
+ int ii,array[NUMBER], y = 0, y_int = 0, array2[NUMBER];
+ double x = 0.000, yy, array3[NUMBER], array4[NUMBER];
+ double max_value = 0.000, min_value = 0.000, add_value, mul_value = 1.00;
+ int max_index = 0, min_index = 0;
+#if 1
+ for (ii = 0; ii < NUMBER; ii++)
+ {
+ array[ii] = 1+ii;
+ array2[ii]= 2;
+ }
+
+ for (ii = 0; ii < NUMBER; ii++)
+ {
+ if (ii%2 && ii)
+ array3[ii] = (double)(1.0000/(double)ii);
+ else
+ array3[ii] = (double) ii + 0.10;
+ array4[ii] = (double) (1.00000/ (double)(ii+1));
+ }
+#endif
+ /* array[:] = 5; */
+ __sec_reduce_mutating (&x, array3[:] * array4[:], my_func);
+#if 1
+ y = __sec_reduce_max_ind ( array3[:] * array4[:]);
+
+ /* Initialize it to the first variable. */
+ max_value = array3[0] * array4[0];
+ for (ii = 0; ii < NUMBER; ii++)
+ if (array3[ii] * array4[ii] > max_value) {
+ max_index = ii;
+ }
+
+ for (ii = 0; ii < NUMBER; ii++)
+ my_func (&max_value, array3[ii] * array4[ii]);
+
+#if HAVE_IO
+ for (ii = 0; ii < NUMBER; ii++)
+ printf("%5.3f ", array3[ii] * array4[ii]);
+ printf("\n");
+ printf("Max = %5.3f\t Max Index = %2d\n", x, y);
+ printf("Max = %5.3f\t Max Index = %2d\n", max_value, max_index);
+#endif
+
+ if (x != max_value)
+ return 1;
+
+ if (y != max_index)
+ return 2;
+#endif
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/builtin_func_double.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/builtin_func_double.c
new file mode 100644
index 000000000..0c05994ee
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/builtin_func_double.c
@@ -0,0 +1,124 @@
+#if HAVE_IO
+#include <stdio.h>
+#endif
+/* #include <stdlib.h> */
+
+/* char __sec_reduce_add (int *); */
+int main(void)
+{
+ int ii,array[10], y = 0, y_int = 0, array2[10];
+ double x, yy, array3[10], array4[10];
+ double max_value = 0.000, min_value = 0.000, add_value, mul_value = 1.00;
+ int max_index = 0, min_index = 0;
+ for (ii = 0; ii < 10; ii++)
+ {
+ array[ii] = 1+ii;
+ array2[ii]= 2;
+ }
+
+ for (ii = 0; ii < 10; ii++)
+ {
+ if (ii%2 && ii)
+ array3[ii] = (double)(1.0000/(double)ii);
+ else
+ array3[ii] = (double) ii + 0.10;
+ array4[ii] = (double) (1.00000/ (double)(ii+1));
+ }
+
+ /* array[:] = 5; */
+ x = __sec_reduce_max (array3[:] * array4[:]);
+ y = __sec_reduce_max_ind ( array3[:] * array4[:]);
+
+ /* Initialize it to the first variable. */
+ max_value = array3[0] * array4[0];
+ for (ii = 0; ii < 10; ii++)
+ if (array3[ii] * array4[ii] > max_value) {
+ max_value = array3[ii] * array4[ii];
+ max_index = ii;
+ }
+
+
+
+#if HAVE_IO
+ for (ii = 0; ii < 10; ii++)
+ printf("%5.3f ", array3[ii] * array4[ii]);
+ printf("\n");
+ printf("Max = %5.3f\t Max Index = %2d\n", x, y);
+#endif
+
+ if (x != max_value)
+ return 1;
+
+ if (y != max_index)
+ return 2;
+
+ x = __sec_reduce_min (array3[:] * array4[:]);
+ y = __sec_reduce_min_ind ( array3[:] * array4[:]);
+#if HAVE_IO
+ for (ii = 0; ii < 10; ii++)
+ printf("%5.3f ", array3[ii] * array4[ii]);
+ printf("\n");
+ printf("Min = %5.3f\t Min Index = %2d\n", x, y);
+#endif
+
+ /* Initialize it to the first variable. */
+ min_value = array3[0] * array4[0];
+ for (ii = 0; ii < 10; ii++)
+ if (array3[ii] * array4[ii] < min_value) {
+ min_value = array3[ii] * array4[ii];
+ min_index = ii;
+ }
+
+ if (x != min_value)
+ return 3;
+ if (y != min_index)
+ return 4;
+
+ x = __sec_reduce_add (array3[:] * array4[:]);
+ yy = __sec_reduce_mul ( array3[:] * array4[:]);
+#if HAVE_IO
+ for (ii = 0; ii < 10; ii++)
+ printf("%5.3f ", array3[ii] * array4[ii]);
+ printf("\n");
+ printf("Add = %5.3f\t Mul = %f\n", x, yy);
+#endif
+
+ /* Initialize it to the first variable. */
+ add_value = 0.0000;
+ mul_value = 1.0000;
+ for (ii = 0; ii < 10; ii++)
+ {
+ add_value += (array3[ii] * array4[ii]);
+ mul_value *= (array3[ii] * array4[ii]);
+ }
+
+ if (x != add_value)
+ return 5;
+ if (yy != mul_value)
+ return 6;
+
+ for (ii = 0; ii < 10; ii++)
+ {
+ if (ii%2 && ii)
+ array3[ii] = (double)(1.0000/(double)ii);
+ else
+ array3[ii] = (double) ii + 0.00;
+ array4[ii] = (double) (1.00000/ (double)(ii+1));
+ }
+ y_int = __sec_reduce_any_zero (array3[:] * array4[:]);
+ y = __sec_reduce_all_zero ( array3[:] * array4[:]);
+
+ if (y_int != 1)
+ return 7;
+
+ if (y != 0)
+ return 8;
+
+#if HAVE_IO
+ for (ii = 0; ii < 10; ii++)
+ printf("%5.3f ", array3[ii] * array4[ii]);
+ printf("\n");
+ printf("Any Zeros = %d\t All Zeros = %d\n", y_int, y);
+#endif
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/builtin_func_double2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/builtin_func_double2.c
new file mode 100644
index 000000000..65549121b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/builtin_func_double2.c
@@ -0,0 +1,77 @@
+/* { dg-do run } */
+/* { dg-options "-fcilkplus" } */
+
+#define NUMBER 100
+#if HAVE_IO
+#include <stdio.h>
+#endif
+
+int main(void)
+{
+ int argc = 1;
+ int ii,array[NUMBER], y = 0, y_int = 0, array2[NUMBER], y_int2=0, y2=0;
+ double x, yy, array3[NUMBER], array4[NUMBER];
+ int all_zero, all_nonzero, any_zero, any_nonzero;
+ for (ii = 0; ii < NUMBER; ii++)
+ {
+ array[ii] = 0;
+ array2[ii] = 5;
+ if (ii%2 && ii)
+ array3[ii] = (double)(1.0000/(double)ii);
+ else
+ array3[ii] = (double) ii + 0.00;
+ array4[ii] = (double) (1.00000/ (double)(ii+1));
+ }
+ __asm volatile ("" : "+r" (argc));
+ y_int = __sec_reduce_any_nonzero (array3[:] + array[4]);
+ y_int2 = __sec_reduce_any_zero (array3[:] + array[4]);
+ y = __sec_reduce_all_nonzero ((array3[:] + array4[:]) * (argc-1));
+ y2 = __sec_reduce_all_zero ((array3[:] + array4[:]) * (argc-1));
+
+ any_zero = 0;
+ any_nonzero = 0;
+ for (ii = 0; ii < NUMBER; ii++)
+ {
+ if ((array3[ii] + array[4]) == 0)
+ any_zero = 1;
+ else
+ any_nonzero = 1;
+ }
+
+ if (any_nonzero != y_int)
+ return 1;
+ if (any_zero != y_int2)
+ return 2;
+
+
+ all_zero = 0;
+ all_nonzero = 0;
+ for (ii = 0; ii < NUMBER; ii++)
+ {
+ if (((array3[ii] + array4[ii]) * (argc-1)) == 0)
+ all_zero = 1;
+ else
+ all_nonzero = 1;
+ }
+
+ if (y != all_nonzero)
+ return 3;
+ if (all_zero != y2)
+ return 4;
+
+
+#if HAVE_IO
+ for (ii = 0; ii < NUMBER; ii++) {
+ printf("%5.3f ", array3[ii] +array4[ii]);
+ }
+ printf("\n");
+ for (ii = 0; ii < NUMBER; ii++) {
+ printf("%5.3f ", (array3[ii] + array4[ii]) * (argc-1));
+ }
+ printf("\n");
+ printf("Any Non-zeros (1st line) = %d\t All non-zeros (1st line) = %d\n",
+ y_int, y);
+ printf("Any zeros (2nd line) = %d\t All zeros (2nd line) = %d\n", y_int2, y2);
+#endif
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/comma_exp.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/comma_exp.c
new file mode 100644
index 000000000..845d916ab
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/comma_exp.c
@@ -0,0 +1,55 @@
+/* { dg-do run } */
+/* { dg-options "-fcilkplus" } */
+
+#include <stdlib.h>
+
+int main2 (char **argv);
+int main(void)
+{
+ int x = 0;
+ const char *array[] = {"a.out", "5"};
+ x = main2 ((char **)array);
+ return x;
+}
+
+int main2 (char **argv)
+{
+ int argc = 2;
+ int array[10], array2[10], ii = 0, x = 2, z= 0 , y = 0 ;
+ __asm volatile ("" : "+r" (argc));
+ for (ii = 0; ii < 10; ii++)
+ array[ii] = 10;
+
+ for (ii = 0; ii < 10; ii++)
+ array2[ii] = 1;
+
+ array[0:10:1] = (array[:], 15);
+
+ for (ii = 0; ii < 10; ii++)
+ if (array[ii] != 15)
+ return 1;
+ array[0:5:2] = (argc+2, 20);
+
+ for (ii = 0; ii < 10; ii += 2)
+ if (array[ii] != 20)
+ return 2;
+
+
+ x = atoi(argv[1]);
+ z = (10-atoi(argv[1]))/atoi(argv[1]);
+
+ array[x:5:z] = 50;
+
+ array[:] = (atoi(argv[1]), (array2[0:10]+5));
+
+ for (ii = 0; ii < 10; ii++)
+ if (array[ii] != 6)
+ return (3);
+
+ array[:] = (atoi(argv[1]), (array2[0:10]+array2[0:10]));
+ for (ii = 0; ii < 10; ii++)
+ if (array[ii] != 2)
+ return 4;
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/conditional.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/conditional.c
new file mode 100644
index 000000000..07c50173b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/conditional.c
@@ -0,0 +1,44 @@
+/* { dg-do run } */
+/* { dg-options "-fcilkplus" } */
+
+#include <stdlib.h>
+int main(void)
+{
+ int argc = 1;
+ short array[1000], array2[1000], *array3, cond[1000], ii = 0;
+
+ __asm volatile ("" : "+r" (argc));
+ for (ii = 0; ii < 1000; ii++) {
+ cond[ii] = 1;
+ array[ii] = 1000;
+ array2[ii] = 2000;
+ }
+ array2[:] = cond[:] ? array[:] : array2[:];
+
+ for (ii = 0; ii < 1000; ii++) {
+ if (array2[ii] != 1000)
+ return 1;
+ }
+
+ array2[0:500:2] = cond[0:500] ? array[0:500:1] : array2[0:500:2];
+
+ for (ii = 0; ii < 1000; ii++) {
+ if (array2[ii] != 1000)
+ return 2;
+ }
+
+ for (ii = 0; ii < 1000; ii++) {
+ cond[ii] = ii % 2; /* This should give 0, 1, 0, 1, 0, 1, 0,... */
+ array2[ii] = 5;
+ array[ii] = 3;
+ }
+ array3 = (short *) malloc (sizeof (short) * 1000);
+ array3[0:1000:argc] = cond[:] ? array[0:(argc * 1000)] : array2[argc-1:1000];
+
+ for (ii = 0; ii < 1000; ii++) {
+ if ((cond[ii] == 0 && array3[ii] != 5)
+ || (cond[ii] == 1 && array3[ii] != 3))
+ return 3;
+ }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/decl-ptr-colon.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/decl-ptr-colon.c
new file mode 100644
index 000000000..4b54f4d06
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/decl-ptr-colon.c
@@ -0,0 +1,19 @@
+/* { dg-do compile { target c } } */
+/* { dg-options "-fcilkplus" } */
+
+int main(void)
+{
+ extern int func(int);
+ int array3[:], x, q; /* { dg-error "array notations cannot be used in declaration" } */
+ int array3[1:2:x]; /* { dg-error "array notations cannot be used in declaration" } */
+ extern char array3[1:func(x)]; /* { dg-error "array notations cannot be used in declaration" } */
+ int *a, ***b;
+ extern char *c;
+ int array2[10];
+
+ a[:] = 5; /* { dg-error "start-index and length fields necessary for using array notations in pointers" } */
+ c[1:2] = 3; /* This is OK. */
+ (array2)[:] = 5; /* This is OK. */
+ b[1:2][1:func(x)][:] = 3; /* { dg-error "start-index and length fields necessary for using array notations in pointers" } */
+}
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/dimensionless-arrays.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/dimensionless-arrays.c
new file mode 100644
index 000000000..690e89a27
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/dimensionless-arrays.c
@@ -0,0 +1,10 @@
+/* { dg-options "-fcilkplus" } */
+
+extern int a[];
+extern int *b;
+
+void foo()
+{
+ a[:] = 5; // { dg-error "start-index and length fields necessary for using array notation" }
+ b[:] = 5; // { dg-error "start-index and length fields necessary for using" }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/exec-once.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/exec-once.c
new file mode 100644
index 000000000..00b018a2c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/exec-once.c
@@ -0,0 +1,44 @@
+/* { dg-do run } */
+/* { dg-options "-fcilkplus" } */
+
+#define NUMBER 1000
+
+#if HAVE_IO
+#include <stdio.h>
+#endif
+
+int func (int *x)
+{
+ int q = *x;
+ q++;
+ *x = q;
+#if HAVE_IO
+ printf("%d\n", (q));
+#endif
+ return *x;
+}
+int main (void)
+{
+ char array[NUMBER], array2[NUMBER];
+ int ii, d = 2;
+#if 1
+ for (ii = 0; ii < NUMBER; ii++) {
+ array[ii] = 5;
+ array2[ii]= 2;
+ }
+#endif
+ d = func (&d); /* d = 1 */
+ array2[:] = d * array[:] + (char) func (&d); /* 3 * 5 + 4 */
+#if HAVE_IO
+ for (ii = 0; ii < NUMBER; ii++)
+ printf("array2[%d] = %d\n", ii, array2[ii]);
+#endif
+ for (ii = 0; ii < NUMBER; ii++)
+ if (array2[ii] != (3 * 5 + 4))
+ return 1;
+
+ return 0;
+}
+
+
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/exec-once2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/exec-once2.c
new file mode 100644
index 000000000..d9f39dd66
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/exec-once2.c
@@ -0,0 +1,87 @@
+/* { dg-do run } */
+/* { dg-options "-fcilkplus" } */
+
+#ifdef HAVE_IO
+#include <stdio.h>
+#endif
+
+
+int func1(int x)
+{
+ /* If x == 2 then it should return 0. */
+ return (x - 2);
+}
+
+int func2(int x)
+{
+ /* If x == 2 then it should return 1000. */
+ return (x * 500);
+}
+
+int func3 (int x)
+{
+ /* If x == 2 then it should return 1. */
+ /* If x == 1 then it should return 0. */
+ return (x-1);
+}
+
+int func4(int x)
+{
+ if (x > 0)
+ return x;
+ else
+ return x--;
+}
+
+
+/* This program makes an assumption that argc == 1. */
+int main (void)
+{
+ int argc = 1;
+ int array[2500];
+
+ /* This is done to make sure the compiler does not optimize out argc. */
+ __asm volatile ("" : "+r" (argc));
+ /* This should set array[0->999] to 5. */
+ array[argc-1:func2(++argc):1] = 5;
+ array[1000:500:1] = 10; /* set all variables in array[1000-->1499] to 10. */
+ array[1500:500:1] = 15; /* set all variables in array[1500-->1999] to 15. */
+ array[2000:500:1] = 20; /* set all variables in array[2000-->2499] to 20. */
+ array[2000:500:1] = 25; /* set all variables in array[2500-->2999] to 25. */
+ array[2000:500:1] = 30; /* set all variables in array[3000-->3499] to 30. */
+
+ argc = func3 (argc); /* This will set argc back to 1. */
+#if HAVE_IO
+ printf("argc = %d\n", argc);
+#endif
+ /* If the parameters inside the function get evaluated only once, then this
+ if statement must work fine, i.e. the triplet values will be 0, 1000, 1.
+
+ Otherwise, the program should crash or give some uneasy value. */
+
+ /* If done correctly, it should boil down to: array[0:1000:1]. */
+ if (array[func3(argc):func2(++argc)] != 5) {
+#ifdef HAVE_IO
+ printf ("Should not be there(1).\n");
+#endif
+ return 1;
+ }
+
+ /* If done correctly, it should boil down to: array[999:500:-1]. */
+ if (func4(array[func2(argc)-1:func2(argc--):func1(argc)]) != 5) {
+#ifdef HAVE_IO
+ printf ("Should not be there(2).\n");
+#endif
+ return 2;
+ }
+
+ /* If done correctly, it should boil down to: array[1000:500:1]. */
+ if (func4 (func4(array[func2(argc++):500: func1(argc--)])) != 5) {
+#ifdef HAVE_IO
+ printf ("Should not be there(3).\n");
+#endif
+ return 3;
+ }
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/fn_ptr.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/fn_ptr.c
new file mode 100644
index 000000000..fa6d9003a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/fn_ptr.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+typedef int (*foo)(int);
+
+int main(void)
+{
+ int array[10], array2[10][10];
+ foo func_array[10];
+ foo func_array2[10][10];
+ foo ***func_array_ptr;
+ int argc = 5;
+
+ array[:] = func_array[:](10);
+ func_array[0:5](10);
+ func_array2[0:5][:](10);
+ array2[0:5][:] = func_array2[0:5][:](10);
+ func_array_ptr[0:5][0:4][0:argc:2](argc);
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/fp_triplet_values.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/fp_triplet_values.c
new file mode 100644
index 000000000..b2ac7bcc8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/fp_triplet_values.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+float q;
+
+void func (int *x)
+{
+ *x = 5;
+}
+
+int main (void)
+{
+ int array[10], array2[10];
+ array2[:] = array[1.5:2]; /* { dg-error "start-index of array notation triplet is not an integer" } */
+ array2[:] = array[1:2.32333333333]; /* { dg-error "length of array notation triplet is not an integer" } */
+ array2[1:2:1.5] = array[:]; /* { dg-error "stride of array notation triplet is not an integer" } */
+ func (&array2[1:2.34:3]); /* { dg-error "length of array notation triplet is not an integer" } */
+ array2[1.43:9]++; /* { dg-error "start-index of array notation triplet is not an integer" } */
+ array2[1:9.3]++; /* { dg-error "length of array notation triplet is not an integer" } */
+ array2[1:9:0.3]++; /* { dg-error "stride of array notation triplet is not an integer" } */
+
+ ++array2[1:q:3]; /* { dg-error "length of array notation triplet is not an integer" } */
+ array2[:] = array[q:1:3]; /* { dg-error "start-index of array notation triplet is not an integer" } */
+ array2[:] = array[1:q:3]; /* { dg-error "length of array notation triplet is not an integer" } */
+ array2[:] = array[1:3:q]; /* { dg-error "stride of array notation triplet is not an integer" } */
+ func (&array2[1:q:3]); /* { dg-error "length of array notation triplet is not an integer" } */
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/gather-scatter-errors.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/gather-scatter-errors.c
new file mode 100644
index 000000000..f425fbec0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/gather-scatter-errors.c
@@ -0,0 +1,19 @@
+/* { dg-options "-fcilkplus" } */
+
+int main (void)
+{
+ extern int func (int);
+ int array[10][10], array2[10];
+ int argc = 1;
+ array2[array[:][:]] = 5; /* { dg-error "rank of the array's index is greater than 1" } */
+
+ array2[array[:][:]] = 5; /* { dg-error "rank of the array's index is greater than 1" } */
+ func (array2[array[:][:]]); /* { dg-error "rank of the array's index is greater than 1" } */
+ func (array2[array[argc:func(5)][0:10:2]]); /* { dg-error "rank of the array's index is greater than 1" } */
+
+ array[array2[:]][array2[:]] = 5; /* This is OK. */
+ array[array2[:]][array2[:]] = array2[array[:][:]]; /* { dg-error "rank of the array's index is greater than 1" } */
+ array[array2[:]][array2[:]] = array2[array[0:10:1][:]]; /* { dg-error "rank of the array's index is greater than 1" } */
+ array[array2[:]][array2[:]] = array2[array[:][argc:func (argc)]]; /* { dg-error "rank of the array's index is greater than 1" } */
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/gather_scatter.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/gather_scatter.c
new file mode 100644
index 000000000..faee3fceb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/gather_scatter.c
@@ -0,0 +1,60 @@
+/* { dg-do run } */
+/* { dg-options "-fcilkplus" } */
+
+#define NUMBER 20
+#if HAVE_IO
+#include <stdio.h>
+#endif
+
+float array4[NUMBER][NUMBER][NUMBER][NUMBER];
+int main(void)
+{
+ int array[NUMBER][NUMBER], array2[NUMBER], array3[NUMBER], x = 0, y;
+ int x_correct, y_correct, ii, jj = 0, kk = 0, ll = 0;
+ for (ii = 0; ii < NUMBER; ii++)
+ {
+ for (jj = 0; jj < NUMBER; jj++)
+ {
+ array[ii][jj] = 1+ii;
+ array2[ii]= 2;
+ array3[ii]= 3;
+ }
+ }
+
+ array[array2[:]][array3[:]] = 1000;
+
+ for (ii = 0; ii < NUMBER; ii++)
+ if (array[array2[ii]][array3[ii]] != 1000)
+ return 1;
+
+#if HAVE_IO
+ for (ii = 0; ii < NUMBER; ii++) {
+ for (jj = 0; jj < NUMBER; jj++) {
+ printf("%4d\t", array[ii][jj]);
+ }
+ printf("\n");
+ }
+#endif
+
+ array4[array2[:]][array3[0:NUMBER:1]][array2[0:NUMBER:1]][array3[0:NUMBER:1]] =
+ (float)array[array2[:]][array3[:]];
+
+ for (ii = 0; ii < NUMBER; ii++)
+ if (array4[array2[ii]][array3[ii]][array2[ii]][array3[ii]] !=
+ (float)array[array2[ii]][array3[ii]])
+ return 2;
+
+#if HAVE_IO
+ for (ii = 0; ii < NUMBER; ii++) {
+ for (jj = 0; jj < NUMBER; jj++) {
+ for (kk = 0; kk < NUMBER; kk++) {
+ for (ll = 0; ll < NUMBER; ll++) {
+ printf("%4d\n", array4[ii][jj][kk][ll]);
+ }
+ }
+ }
+ }
+#endif
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/if_test.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/if_test.c
new file mode 100644
index 000000000..4e5b15837
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/if_test.c
@@ -0,0 +1,306 @@
+/* { dg-do run } */
+/* { dg-options "-fcilkplus" } */
+
+#if HAVE_IO
+#include <stdio.h>
+#endif
+#include <stdlib.h>
+int main2 (char **argv);
+int main(int argc, char **argv)
+{
+ int x = 0;
+ const char *array[] = {"a.out", "10", "15"};
+ x = main2 ((char **) array);
+ return x;
+}
+
+
+int main2 (char **argv)
+{
+ int x = 3, y, z, array[10], array2[10], TwodArray[10][10], jj,kk,ll ;
+ int array2_check[10], array2d_check[10][10], array2d[10][10];
+ int FourDArray[10][10][10][10], array4[10][10][10][10];
+ int array4_check[10][10][10][10];
+ int ii = 0, argc = 3;
+
+ __asm volatile ("" : "+r" (argc));
+
+ for (ii = 0; ii < 10; ii++)
+ {
+ array[ii] = argc%3;
+ array2[ii]= 10;
+ array2_check[ii] = 10;
+ }
+
+ if (!array[:])
+ array2[:] = 5;
+ else
+ array2[:] = 10;
+
+
+ for (ii = 0; ii < 10; ii++)
+ {
+ if (!array[ii])
+ array2_check[ii] = 5;
+ else
+ array2_check[ii] = 10;
+ }
+
+ for (ii = 0; ii < 10; ii++)
+ if (array2_check[ii] != array2[ii])
+ return 2;
+
+
+
+ if (!(array[0:10:1] + array[0:10:1]))
+ array2[:] = 5;
+ else
+ array2[:] = 10;
+
+ for (ii = 0; ii < 10; ii++)
+ {
+ if (!(array[ii]+ array[ii]))
+ array2_check[ii] = 5;
+ else
+ array2_check[ii] = 10;
+ }
+
+ for (ii = 0; ii < 10; ii++)
+ if (array2_check[ii] != array2[ii])
+ return 3;
+
+ x = atoi (argv[1])-10;
+ y = atoi (argv[1])/2;
+ z = (atoi (argv[1]))/5;
+
+ for (ii = 0; ii < 10; ii++)
+ {
+ if (ii % 2)
+ array[ii] = 0;
+ else
+ array[ii] = 1;
+ }
+
+ /*printf("x = %2d y = %2d z = %2d\n", x, y, z); */
+
+ for (ii = 0; ii < 10; ii++)
+ array[ii] = 10;
+
+ /* This if loop will change all the 10's to 5's */
+ if (array[x:y:z] != 9)
+ array2[:] = 5;
+ else
+ array2[:] = 10;
+
+ for (ii = x; ii < (x+y); ii += z)
+ {
+ if (array[ii] != 9)
+ array2_check[ii] = 5;
+ else
+ array2_check[ii] = 10;
+ }
+
+ for (ii = 0; ii < 10; ii++)
+ if (array2_check[ii] != array2[ii])
+ return 4;
+
+ for (ii = 0; ii < 10; ii++) {
+ array2[ii] = 10;
+ array2_check[ii] = 10;
+ }
+
+ /* This if loop will change all the 10's to 5's */
+ if (array[atoi(argv[1])-10:atoi(argv[1])/2: atoi(argv[1])/5])
+ array2[atoi(argv[1])-10: atoi (argv[1])/2: atoi(argv[1])/5] = 5;
+ else
+ array2[atoi(argv[1])-10: atoi (argv[1])/2: atoi(argv[1])/5] = 10;
+
+ for (ii = atoi(argv[1])-10; ii < atoi(argv[1]) + (atoi (argv[1])-10);
+ ii +=atoi(argv[1])/5)
+ if (array[ii])
+ array2_check[ii] = 5;
+ else
+ array2_check[ii] = 10;
+
+ for (ii = 0; ii < 10; ii++)
+ if (array2_check[ii] != array2[ii]) {
+#if HAVE_IO
+ printf("array2[%2d] = %2d array2_check[%2d] = %2d\n", ii, array2[ii],
+ ii, array2_check[ii]);
+#endif
+ return 5;
+ }
+
+ for (ii = 0; ii < 10; ii++)
+ for (jj = 0; jj < 10; jj++)
+ TwodArray[ii][jj] = atoi(argv[1]);
+
+
+ for (ii = 0; ii < 10; ii++)
+ for (ii = 0; ii < 10; ii++) {
+ array2d[ii][jj] = 10;
+ array2d_check[ii][jj] = 10;
+ }
+
+ /* atoi(argv[1]) == 10, so it will convert all 10's to 5's */
+ if (TwodArray[:][:] != 10)
+ array2d[:][:] = 10;
+ else
+ array2d[:][:] = 5;
+
+ for (ii = 0; ii < 10; ii++) {
+ for (jj = 0; jj < 10; jj++) {
+ if (TwodArray[ii][jj] != 10)
+ array2d_check[ii][jj] = 10;
+ else
+ array2d_check[ii][jj] = 5;
+ }
+ }
+
+ for (ii = 0; ii < 10; ii++)
+ for (jj = 0; jj < 10; jj++)
+ if (array2d[ii][jj] != array2d_check[ii][jj])
+ return 6;
+
+ for (ii = 0; ii < 10; ii++)
+ for (jj = 0; jj < 10; jj++)
+ for (kk = 0; kk < 10; kk++)
+ for (ll = 0; ll < 10; ll++)
+ {
+ array4[ii][jj][kk][ll] = 10;
+ array4_check[ii][jj][kk][ll] = 10;
+ }
+
+ for (ii = 0; ii < 10; ii++)
+ for (jj = 0; jj < 10; jj++)
+ for (kk = 0; kk < 10; kk++)
+ for (ll = 0; ll < 10; ll++)
+ FourDArray[ii][jj][kk][ll] = atoi(argv[1]);
+
+ /* atoi(argv[1]) == 10, so it will convert all 10's to 5's */
+ if (FourDArray[:][:][:][:] != 10)
+ array4[:][:][:][:] = 10;
+ else
+ array4[:][:][:][:] = 5;
+
+ for (ii = 0; ii < 10; ii++) {
+ for (jj = 0; jj < 10; jj++) {
+ for (kk = 0; kk < 10; kk++) {
+ for (ll = 0; ll < 10; ll++) {
+ if (FourDArray[ii][jj][kk][ll] != 10)
+ array4_check[ii][jj][kk][ll] = 10;
+ else
+ array4_check[ii][jj][kk][ll] = 5;
+ }
+ }
+ }
+ }
+
+ for (ii = 0; ii < 10; ii++)
+ for (jj = 0; jj < 10; jj++)
+ for (kk = 0; kk < 10; kk++)
+ for (ll = 0; ll < 10; ll++)
+ if (array4_check[ii][jj][kk][ll] != array4[ii][jj][kk][ll])
+ return 7;
+
+ for (ii = 0; ii < 10; ii++)
+ for (jj = 0; jj < 10; jj++)
+ for (kk = 0; kk < 10; kk++)
+ for (ll = 0; ll < 10; ll++)
+ {
+ array4[ii][jj][kk][ll] = 10;
+ array4_check[ii][jj][kk][ll] = 10;
+ }
+
+ for (ii = 0; ii < 10; ii++)
+ for (jj = 0; jj < 10; jj++)
+ for (kk = 0; kk < 10; kk++)
+ for (ll = 0; ll < 10; ll++)
+ FourDArray[ii][jj][kk][ll] = atoi(argv[1]);
+
+ /* atoi(argv[1]) == 10, so it will convert all 10's to 5's */
+ if (FourDArray[0:10:1][0:5:2][9:10:-1][0:5:2] != 10)
+ array4[0:10:1][0:5:2][9:10:-1][0:5:2] = 10;
+ else
+ array4[0:10:1][0:5:2][9:10:-1][0:5:2] = 5;
+
+ for (ii = 0; ii < 10; ii++) {
+ for (jj = 0; jj < 10; jj += 2) {
+ for (kk = 9; kk >= 0; kk--) {
+ for (ll = 0; ll < 10; ll += 2) {
+ if (FourDArray[ii][jj][kk][ll] != 10)
+ array4_check[ii][jj][kk][ll] = 10;
+ else
+ array4_check[ii][jj][kk][ll] = 5;
+ }
+ }
+ }
+ }
+
+ for (ii = 0; ii < 10; ii++)
+ for (jj = 0; jj < 10; jj++)
+ for (kk = 0; kk < 10; kk++)
+ for (ll = 0; ll < 10; ll++)
+ if (array4_check[ii][jj][kk][ll] != array4[ii][jj][kk][ll]) {
+#if HAVE_IO
+ printf("array4_check[%d][%d][%d][%d] = %d\n",ii, jj, kk, ll,
+ array4_check[ii][jj][kk][ll]);
+ printf("array4[%d][%d][%d][%d] = %d\n",ii, jj, kk, ll,
+ array4[ii][jj][kk][ll]);
+#endif
+ return 8;
+ }
+
+ for (ii = 0; ii < 10; ii++)
+ for (jj = 0; jj < 10; jj++)
+ for (kk = 0; kk < 10; kk++)
+ for (ll = 0; ll < 10; ll++)
+ FourDArray[ii][jj][kk][ll] = atoi(argv[1]);
+
+ for (ii = 0; ii < 10; ii++)
+ for (jj = 0; jj < 10; jj++)
+ for (kk = 0; kk < 10; kk++)
+ for (ll = 0; ll < 10; ll++)
+ {
+ array4[ii][jj][kk][ll] = 10;
+ array4_check[ii][jj][kk][ll] = 10;
+ }
+
+
+ /* atoi(argv[1]) == 10, so it will convert all 10's to 5's */
+ if (FourDArray[0:10:1][0:5:2][9:10:-1][x:y:z] +
+ FourDArray[0:10:1][0:5:2][9:10:-1][x:y:z] != 20)
+ array4[0:10:1][0:5:2][9:10:-1][x:y:z] = 10;
+ else
+ array4[0:10][0:5:2][9:10:-1][x:y:z] = 5;
+
+ for (ii = 0; ii < 10; ii++) {
+ for (jj = 0; jj < 10; jj += 2) {
+ for (kk = 9; kk >= 0; kk--) {
+ for (ll = 0; ll < 10; ll += 2) {
+ if (FourDArray[ii][jj][kk][ll] != 10)
+ array4_check[ii][jj][kk][ll] = 10;
+ else
+ array4_check[ii][jj][kk][ll] = 5;
+ }
+ }
+ }
+ }
+
+ for (ii = 0; ii < 10; ii++)
+ for (jj = 0; jj < 10; jj++)
+ for (kk = 0; kk < 10; kk++)
+ for (ll = 0; ll < 10; ll++)
+ if (array4_check[ii][jj][kk][ll] != array4[ii][jj][kk][ll]) {
+#if HAVE_IO
+ printf("array4_check[%d][%d][%d][%d] = %d\n",ii, jj, kk, ll,
+ array4_check[ii][jj][kk][ll]);
+ printf("array4[%d][%d][%d][%d] = %d\n",ii, jj, kk, ll,
+ array4[ii][jj][kk][ll]);
+#endif
+ return 9;
+ }
+
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/if_test_errors.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/if_test_errors.c
new file mode 100644
index 000000000..579d39694
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/if_test_errors.c
@@ -0,0 +1,56 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+#include <stdlib.h>
+int main (void)
+{
+ int x = 3, y, z, array[10], array2[10], TwodArray[10][10], jj,kk,ll ;
+ int array2_check[10], array2d_check[10][10], array2d[10][10];
+ int FourDArray[10][10][10][10], array4[10][10][10][10];
+ int array4_check[10][10][10][10];
+ int ii = 0;
+
+ x = 5;
+ y = 10;
+ z = 2;
+
+ if (!array[:]) /* This is OK! */
+ array2[:] = 5;
+ else
+ array2[:] = 10;
+ if (!(array[0:10:1] + array[0:10:1])) /* { dg-error "condition and the then-block" "" { target c } } */
+ array2d[:][:] = 5; /* { dg-error "rank mismatch with controlling expression of parent" "" { target c++ } } */
+ else
+ array2[:] = 10;
+
+ if (!(array[0:10:1] + array[0:10:1])) /* { dg-error "condition and the else-block" "" { target c } } */
+ array2[:] = 5;
+ else
+ array2d[:][:] = 10; /* { dg-error "rank mismatch with controlling expression of parent" "" { target c++ } } */
+
+
+ if (TwodArray[:][:] != 10) /* { dg-error "condition and the then-block" "" { target c } } */
+ array2[:] = 10; /* { dg-error "rank mismatch with controlling expression of parent" "" { target c++ } } */
+ else
+ array2[:] = 5;
+
+ if (FourDArray[43][:][:][:] != 10) /* This is OK! */
+ array4[45][:][:][:] = 10;
+ else
+ array4[32][:][:][:] = 5;
+
+ /* atoi(argv[1]) == 10, so it will convert all 10's to 5's */
+ if (FourDArray[42][0:10:1][9:10:-1][0:5:2] != 10) /* { dg-error "condition and the then-block" "" { target c } } */
+ array4[0:10:1][0:5:2][9:10:-1][0:5:2] = 10; /* { dg-error "rank mismatch with controlling expression of parent" "" { target c++ } } */
+ else
+ array4[0:10:1][0:5:2][9:10:-1][0:5:2] = 5;
+
+ /* atoi(argv[1]) == 10, so it will convert all 10's to 5's */
+ if (FourDArray[0:10:1][0:5:2][9:10:-1][x:y:z] +
+ FourDArray[0:10:1][0:5:2][9:-10:1][x:y:z] != 20)
+ array4[0:10:1][0:5:2][9:10:-1][x:y:z] = 10;
+ else
+ array4[0:10][0:5:2][9:10:-1][x:y:z] = 5;
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/misc.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/misc.c
new file mode 100644
index 000000000..814786b99
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/misc.c
@@ -0,0 +1,112 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+int main (void)
+{
+ int array[10], array2[10][10];
+ int x, ii, jj ;
+
+ switch (array[:]) { /* { dg-error "cannot be used as a condition for switch statement" } */
+ case 1:
+ x = 5;
+ break;
+ case 2:
+ x = 2;
+ break;
+ default:
+ x = 9;
+ }
+
+ switch (array2[:][:]) { /* { dg-error "cannot be used as a condition for switch statement" } */
+ case 1:
+ x = 5;
+ break;
+ case 2:
+ x = 2;
+ break;
+ default:
+ x = 9;
+ }
+
+ switch (array[:] + x) { /* { dg-error "cannot be used as a condition for switch statement" } */
+ case 1:
+ x = 5;
+ break;
+ case 2:
+ x = 2;
+ break;
+ default:
+ x = 9;
+ }
+
+ switch (array2[:][1:x:4] + x) { /* { dg-error "cannot be used as a condition for switch statement" } */
+ case 1:
+ x = 5;
+ break;
+ case 2:
+ x = 2;
+ break;
+ default:
+ x = 9;
+ }
+
+ for (ii = 0; ii < array[:]; ii++) /* { dg-error "cannot be used in a condition for a for-loop" } */
+ {
+ x = 2;
+ }
+
+ for (ii = 0; ii < array2[:][:]; ii++) /* { dg-error "cannot be used in a condition for a for-loop" } */
+ {
+ x = 3;
+ }
+
+ for (; array2[:][:] < 2;) /* { dg-error "cannot be used in a condition for a for-loop" } */
+ x = 4;
+
+
+ while (array2[:][:]) /* { dg-error "cannot be used as a condition for while statement" } */
+ x = 3;
+
+ while (array[1:1:1]) /* { dg-error "cannot be used as a condition for while statement" } */
+ x = 1;
+
+ while (ii != array2[1:x:3][1:2:1]) /* { dg-error "cannot be used as a condition for while statement" } */
+ x = 2;
+
+ do { /* { dg-error "cannot be used as a condition for a do-while statement" "" { target c } } */
+ x = 3;
+ } while (ii != array2[:][:]); /* { dg-error "cannot be used as a condition for a do-while statement" "" { target c++ } } */
+
+ do { /* { dg-error "cannot be used as a condition for a do-while statement" "" { target c } } */
+ x = 2;
+ } while (ii != (x + array2[:][1:x:2]) + 2); /* { dg-error "cannot be used as a condition for a do-while statement" "" { target c++ } } */
+
+ do {
+ x += 3;
+ if (x == 5)
+ return array2[:][:]; /* { dg-error "array notation expression cannot be used as a return value" } */
+ } while (ii != 0);
+
+ for (ii = 0; ii < 10; ii++)
+ if (ii % 2)
+ return array[1:x:ii]; /* { dg-error "array notation expression cannot be used as a return value" } */
+
+ for (ii = 0; ii < x; ii++)
+ if (ii)
+ return array2[:][:]; /* { dg-error "array notation expression cannot be used as a return value" } */
+
+ for (array[:] = 0; ii < x; ii++) /* This should be OK. */
+ x= 2;
+
+ for (ii = 0; ii < 10; array[:]++) /* This is OK. */
+ x = 5;
+
+ for (jj = 0; jj < 10; array2[:][:]++) /* This is OK. */
+ x = 3;
+
+ for (jj = 0; jj < 10; array2[:][1:x:4]++, jj++) /* This is OK. */
+ x = 3;
+
+ return x;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/n-ptr-test.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/n-ptr-test.c
new file mode 100644
index 000000000..750446c87
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/n-ptr-test.c
@@ -0,0 +1,48 @@
+/* { dg-do run } */
+/* { dg-options "-fcilkplus" } */
+
+#define NUMBER 10
+#include <stdlib.h>
+
+int ***func2 (int ***a1, int ***a2, int size)
+{
+ a1[0:size:1][0:size:1][0:size] += (a2[0:size][0:size][0:size:1] + size);
+ return a1;
+}
+
+int main (void)
+{
+ int ii, jj, kk;
+ int ***array3, ***array2 = NULL, ***array = NULL;
+
+ array = (int ***) malloc (sizeof (int **) * NUMBER);
+ array2 = (int ***) malloc (sizeof (int **) * NUMBER);
+ for (ii = 0; ii < NUMBER; ii++) {
+ array[ii] = (int **) malloc (sizeof (int *) * NUMBER);
+ array2[ii] = (int **) malloc (sizeof (int *) * NUMBER);
+ for (jj = 0; jj < NUMBER; jj++) {
+ array[ii][jj] = (int *) malloc (sizeof (int) * NUMBER);
+ array2[ii][jj] = (int *) malloc (sizeof (int) * NUMBER);
+ }
+ }
+
+ for (ii = 0; ii < NUMBER; ii++) {
+ for (jj = 0; jj < NUMBER; jj++) {
+ for (kk = 0; kk < NUMBER; kk++) {
+ array[ii][jj][kk] = 5;
+ array2[ii][jj][kk]= 2;
+ }
+ }
+ }
+ array3 = func2 ((int ***)array, (int ***)array2, NUMBER);
+
+ for (ii = 0; ii < NUMBER; ii++) {
+ for (jj = 0; jj < NUMBER; jj++) {
+ for (kk = 0; kk < NUMBER; kk++) {
+ if (array3[ii][jj][kk] != (7 + NUMBER))
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/parser_errors.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/parser_errors.c
new file mode 100644
index 000000000..18816e0ec
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/parser_errors.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+int main (void)
+{
+ int array[10][10], array2[10];
+
+ array2[:] = array2[: ; /* { dg-error "expected ']'" } */
+
+ return 0;
+} /* { dg-error "expected ';' before" "" { target c } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/parser_errors2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/parser_errors2.c
new file mode 100644
index 000000000..4314090f4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/parser_errors2.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+int main (void)
+{
+ int array[10][10], array2[10];
+
+ array2[:] = array2[1:2:] ; /* { dg-error "expected expression before" "" { target c } } */
+ /* { dg-error "expected primary-expression before" "" { target c++ } 8 } */
+
+ return 0; /* { dg-error "expected ';' before" "" { target c } } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/parser_errors3.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/parser_errors3.c
new file mode 100644
index 000000000..47b597986
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/parser_errors3.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+int main (void)
+{
+ int array[10][10], array2[10];
+
+ array2[:] = array2[1: :] ; /* { dg-error "expected expression before" "" { target c } } */
+ /* { dg-error "expected primary-expression before" "" { target c++ } 8 } */
+
+ return 0; /* { dg-error "expected ';' before" "" { target c } } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/parser_errors4.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/parser_errors4.c
new file mode 100644
index 000000000..a0efc04d2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/parser_errors4.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+int main (void)
+{
+ int array[10][10], array2[10];
+
+ array2[:] = array2[ : : ] ; /* { dg-error " expected ']' before ':' token" } */
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57457-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57457-2.c
new file mode 100644
index 000000000..ac11b9209
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57457-2.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+/* Test-case contains no array notation but is compiled with -fcilkplus.
+ It will still print the too few arguments func, thereby saying the
+ if-statement after the for-loop to check for !flag_enable_cilkplus ||
+ !is_cilkplus_reduce_function (fundecl) is not valid is always taken. */
+
+int func (int, int); /* { dg-message "declared here" } */
+
+int main (void)
+{
+ int a = 5, b = 2;
+ return func (a); /* { dg-error "too few arguments to function" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57457.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57457.c
new file mode 100644
index 000000000..68a1fd811
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57457.c
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+/* This test has no array notation components in it and thus should compile
+ fine without crashing. */
+
+typedef unsigned int size_t;
+typedef int (*__compar_fn_t) (const void *, const void *);
+extern void *bsearch (const void *__key, const void *__base,
+ size_t __nmemb, size_t __size, __compar_fn_t
+ __compar)
+ __attribute__ ((__nonnull__ (1, 2, 5))) ;
+extern __inline __attribute__ ((__gnu_inline__)) void *
+bsearch (const void *__key, const void *__base, size_t __nmemb, size_t
+ __size,
+ __compar_fn_t __compar)
+{
+ size_t __l, __u, __idx;
+ const void *__p;
+ int __comparison;
+ __l = 0;
+ __u = __nmemb;
+ while (__l < __u)
+ {
+ __idx = (__l + __u) / 2;
+ __p = (void *) (((const char *) __base) +
+ (__idx * __size));
+ __comparison = (*__compar) (__key,
+ __p);
+ if (__comparison < 0)
+ __u = __idx;
+ else if (__comparison > 0)
+ __l = __idx + 1;
+ else
+ return (void *)
+ __p;
+ }
+ return ((void *)0);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c
new file mode 100644
index 000000000..db38b30b5
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c
@@ -0,0 +1,28 @@
+/* { dg-do run } */
+/* { dg-options "-fcilkplus" } */
+
+const int n = 8;
+float x[8], y[8], z[8];
+int main() {
+ int i = 0;
+ float x_sum =0;
+ for(i=1; i<=5; i+=4 ) {
+ x[0:n] = 3;
+ y[0:n] = i;
+ z[0:n] = 0;
+ (void)((__sec_reduce_add(x[0:n])==3*n) || (__builtin_abort (), 0));
+ (void)((__sec_reduce_add(y[0:n])==i*n) || (__builtin_abort (), 0));
+ (void)((__sec_reduce_add(z[0:n])==0) || (__builtin_abort (), 0));
+
+ if (x[0:n] >= y[0:n]) {
+ z[0:n] = x[0:n] - y[0:n];
+ } else {
+ z[0:n] = x[0:n] + y[0:n];
+ }
+ (void)((__sec_reduce_add(x[0:n])==3*n) || (__builtin_abort (), 0));
+ (void)((__sec_reduce_add(y[0:n])==i*n) || (__builtin_abort (), 0));
+ (void)((__sec_reduce_add(z[0:n])==(3>=i?3-i:3+i)*n)
+ || (__builtin_abort (), 0));
+ }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c
new file mode 100755
index 000000000..9bff07991
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+int A[10];
+
+int main () {
+
+ /* C compiler uses the term "undeclared" whereas C++ compiler uses
+ "not declared". Thus, grepping for declared seem to be the easiest. */
+ char c = (char)N; /* { dg-error "declared" } */
+ short s = (short)N;
+ long l = (long)N;
+ A[l:s:c];
+}
+
+/* { dg-message "note: each" "defined" { target c } 10 } */
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57577.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57577.c
new file mode 100644
index 000000000..98ab9e166
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57577.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+#define NUMBER 100
+int A[NUMBER], B[NUMBER][NUMBER];
+int foo (int a);
+
+int main () {
+ A[:] = foo (B[:][:]); /* { dg-error "rank mismatch between" } */
+ A[0] = foo (B[:][:]); /* { dg-error "cannot be scalar when" } */
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/rank_mismatch.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/rank_mismatch.c
new file mode 100644
index 000000000..eb3c1f1d6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/rank_mismatch.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus -w" } */
+
+/* We use -w because in the first error, there will be a warning of setting an
+ integer to a pointer. Just ignore it to expose the rank mismatch error. */
+
+int main (void)
+{
+ int x = 0;
+ int array[10][10], array2[10];
+
+ array[:][:] = array[:]; /* { dg-error "rank mismatch between" } */
+ /* { dg-error "invalid conversion" "" { target c++ } 12 } */
+
+ x = array2[:]; /* { dg-error "cannot be scalar when" } */
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/rank_mismatch2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/rank_mismatch2.c
new file mode 100644
index 000000000..4a4882dba
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/rank_mismatch2.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+int function_call (int x);
+int function_call (int x)
+{
+ return x;
+}
+
+int main (void)
+{
+ int array[100], array2[100][100];
+ int argc = 4;
+ array[:] = array[:] + array2[:][:]; /* { dg-error "rank mismatch between" } */
+
+ if (array[:] + array2[:][:]) /* { dg-error "rank mismatch between" } */
+ return argc == 5;
+
+ argc += function_call (array[:] + array2[5:10:2][:]); /* { dg-error "rank mismatch between" } */
+
+ argc += function_call (function_call (array[:] + array2[5:10:2][:])); /* { dg-error "rank mismatch between" } */
+
+ argc += __sec_reduce_add (array[:], array2[:][:]); /* { dg-error "rank mismatch between" } */
+
+ argc += __sec_reduce_add (array2[:][:]) + argc; /* This is OK. */
+ return argc;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/rank_mismatch3.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/rank_mismatch3.c
new file mode 100644
index 000000000..de335922f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/rank_mismatch3.c
@@ -0,0 +1,19 @@
+/* { dg-options "-fcilkplus" } */
+
+int funct (int x, int y);
+void funct_void (int x, int y, int z);
+int main(void)
+{
+ int y, array[100], array2[100], array3[100][100], array4[100];
+
+ array[:] = ((array2[:] + array[:]) * array4[:]) + array3[:][:]; /* { dg-error "rank mismatch between" } */
+ array[:] = funct (array2[:], array3[:][:]); /* { dg-error "rank mismatch between" } */
+ array[:] = array3[:][:]; /* { dg-error "rank mismatch between" } */
+ array3[:][:] = array[:]; /* { dg-error "rank mismatch between" } */
+ array3[:][:] = array[5]; /* This is OK! */
+ funct_void (array2[:], array3[:][:], array[:]); /* { dg-error "rank mismatch between" } */
+ funct_void (array2[:], array3[:][:], array[:]); /* { dg-error "rank mismatch between" } */
+ funct_void (array3[:][:], array2[:], array[:]); /* { dg-error "rank mismatch between" } */
+ funct_void (array2[:], array[:], array3[:][0:10:1]); /* { dg-error "rank mismatch between" } */
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_implicit.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_implicit.c
new file mode 100644
index 000000000..bacbf3505
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_implicit.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+int main (void)
+{
+ int array[10][10], array2[10];
+
+ array[:][:] = __sec_implicit_index(5) + array[:][:]; /* { dg-error "__sec_implicit_index argument" } */
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_implicit2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_implicit2.c
new file mode 100644
index 000000000..0aef0c29a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_implicit2.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+int main (void)
+{
+ int argc = 2;
+ int array[10][10], array2[10];
+ __asm volatile ("" : "+r" (argc));
+ array[:][:] = __sec_implicit_index(argc) + array[:][:]; /* { dg-error "__sec_implicit_index parameter" } */
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_implicit_ex.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_implicit_ex.c
new file mode 100644
index 000000000..419799a3b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_implicit_ex.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-options "-fcilkplus" } */
+
+#define NUMBER 20
+
+int main(void)
+{
+ int jj, kk, array_3C[NUMBER][NUMBER][NUMBER];
+ int ii,array[NUMBER], y = 0, y_int = 0, array2[NUMBER],
+ array_3[NUMBER][NUMBER][NUMBER];
+ double x, yy, array3[NUMBER], array4[NUMBER];
+
+ array[:] = __sec_implicit_index (0);
+ array_3[:][:][:] = __sec_implicit_index (1) + __sec_implicit_index(0) +
+ __sec_implicit_index (2);
+
+ for (ii = 0; ii < NUMBER; ii++)
+ for (jj = 0; jj < NUMBER; jj++)
+ for (kk = 0; kk < NUMBER; kk++)
+ array_3C[ii][jj][kk] = ii+jj+kk;
+
+ for (ii = 0; ii < NUMBER; ii++)
+ for (jj = 0; jj < NUMBER; jj++)
+ for (kk = 0; kk < NUMBER; kk++)
+ if (array_3[ii][jj][kk] != array_3C[ii][jj][kk])
+ return 1;
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_reduce_ind_same_value.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_reduce_ind_same_value.c
new file mode 100644
index 000000000..34c6f1284
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_reduce_ind_same_value.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-options "-fcilkplus" } */
+
+int A[256];
+
+int main () {
+ A[:] = 2;
+ int max_index = 0, min_index = 0;
+
+ max_index = __sec_reduce_max_ind (A[:]);
+
+ if (max_index != 255)
+ return 1;
+
+ min_index = __sec_reduce_min_ind (A[:]);
+ if (min_index != 255)
+ return 2;
+
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_reduce_max_min_ind.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_reduce_max_min_ind.c
new file mode 100644
index 000000000..9652e1594
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_reduce_max_min_ind.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+int main (void)
+{
+ int array[10][10], array2[10];
+ int x, y;
+ x = __sec_reduce_max_ind (array[:][:]); /* { dg-error "cannot have arrays with dimension greater than" } */
+
+ y = __sec_reduce_max_ind (array2[:]); /* this should be OK. */
+
+ x = __sec_reduce_min_ind (array[:][:]); /* { dg-error "cannot have arrays with dimension greater than" } */
+
+ y = __sec_reduce_min_ind (array2[:]); /* this should be OK. */
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_reduce_return.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_reduce_return.c
new file mode 100644
index 000000000..034017146
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_reduce_return.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-options "-fcilkplus" } */
+
+int add_all (int *my_array, int size)
+{
+ return __sec_reduce_add (my_array[0:size]);
+}
+
+int mult_all (int *my_array, int size)
+{
+ return __sec_reduce_mul (my_array[0:size]);
+}
+
+int main (void)
+{
+ int argc = 1;
+ int array[10000];
+
+ __asm volatile ("" : "+r" (argc));
+ array[:] = argc; /* All elements should be one. */
+
+ if (add_all (array, 10000) != 10000)
+ return 1;
+
+ if (mult_all (array, 10000) != 1)
+ return 2;
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/side-effects-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/side-effects-1.c
new file mode 100644
index 000000000..8b0034e72
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/side-effects-1.c
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+/* { dg-options "-fcilkplus" } */
+
+/* Test that the array index, limit, and stride are evaluated only
+ once. */
+
+int array[1000];
+
+int func1_times = 0;
+int func2_times = 0;
+int func3_times = 0;
+int func1() { func1_times++; return 0; }
+int func2() { func2_times++; return 0; }
+int func3() { func3_times++; return 0; }
+
+int main()
+{
+ array[func1() + 11 : func2() + 22 : func3() + 33] = 666;
+
+ if (func1_times != 1
+ || func2_times != 1
+ || func3_times != 1)
+ return 1;
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/test_builtin_return.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/test_builtin_return.c
new file mode 100644
index 000000000..b9f9f8d65
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/test_builtin_return.c
@@ -0,0 +1,73 @@
+/* { dg-options "-lm -fcilkplus" } */
+/* { dg-do run } */
+
+#if HAVE_IO
+#include <stdio.h>
+#endif
+#include <math.h>
+#define NUMBER 5
+
+int func1 (int *a1, int *a2)
+{
+ return __sec_reduce_add (a1[0:NUMBER] * a2[0:NUMBER:1]);
+}
+
+int func2 (int *a1, int *a2)
+{
+ return (__sec_reduce_add (a1[0:NUMBER] * a2[0:NUMBER]) +
+ __sec_reduce_mul (a1[0:NUMBER] + a2[0:NUMBER]));
+}
+
+int func3 (int *a1, int *a2)
+{
+ return (int) sqrt ((double)(__sec_reduce_add (a1[0:NUMBER] * a2[0:NUMBER]) +
+ a2[0] + a2[1] + a2[3]));
+}
+
+int func4 (int *a1, int *a2)
+{
+ return a1[NUMBER-1] * (__sec_reduce_add (a1[0:NUMBER] * a2[0:NUMBER]) + a2[0] + a2[1] + a2[3])/a1[NUMBER-2];
+}
+int main(void)
+{
+ int array[NUMBER], array2[NUMBER];
+ int return_value = 0;
+ int ii = 0;
+ int argc = 1;
+ __asm volatile ("" : "+r" (argc));
+ for (ii = 0; ii < NUMBER; ii++)
+ {
+ array[ii] = argc; /* This should calculate to 1. */
+ array2[ii] = argc * argc + argc; /* This should calculate to 2. */
+ }
+
+ return_value = func1 (array, array2);
+#if HAVE_IO
+ printf("Return_value = %d\n", return_value);
+#endif
+ if (return_value != (2+2+2+2+2))
+ return 1;
+
+ return_value = func2 (array2, array);
+#if HAVE_IO
+ printf("Return_value = %d\n", return_value);
+#endif
+ if (return_value != (3*3*3*3*3) + (2+2+2+2+2))
+ return 2;
+
+ return_value = func3 (array, array2);
+#if HAVE_IO
+ printf("Return_value = %d\n", return_value);
+#endif
+ if (return_value != 4)
+ return 3;
+
+ return_value = func4 (array, array2);
+#if HAVE_IO
+ printf("Return_value = %d\n", return_value);
+#endif
+ if (return_value != 16)
+ return 4;
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/test_sec_limits.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/test_sec_limits.c
new file mode 100644
index 000000000..f4f3ca5a6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/test_sec_limits.c
@@ -0,0 +1,18 @@
+/* { dg-do run } */
+/* { dg-options "-fcilkplus" } */
+
+#include <limits.h>
+int A[16];
+int a = 0;
+
+int main () {
+ if (__sec_reduce_max(A[0:0:2]) != INT_MIN)
+ a++;
+
+ if (__sec_reduce_min(A[0:0:2]) != INT_MAX)
+ a++;
+
+ return a;
+}
+
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/tst_lngth.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/tst_lngth.c
new file mode 100644
index 000000000..015a7eb73
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/tst_lngth.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options " -fcilkplus " } */
+
+#if HAVE_IO
+#include <stdio.h>
+#endif
+
+#define N 256
+int A[N], B[N];
+
+int
+main ()
+{
+ A[0:(N / 4)] = A[4]+ B[0:(N / 2):2]; /* { dg-error "length mismatch between" } */
+ A[0:(N / 4)] = B[0:(N / 2):2] + N; /* { dg-error "length mismatch between" } */
+ A[0:(N / 4)] = B[0:(N / 2):2] + A[4]; /* { dg-error "length mismatch between" } */
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/vla.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/vla.c
new file mode 100644
index 000000000..3b0777e0f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/AN/vla.c
@@ -0,0 +1,20 @@
+/* { dg-do compile { target c } } */
+/* { dg-options "-fcilkplus -std=c99 -w" } */
+
+int func (int x)
+{
+ return x++;
+}
+int main(void)
+{
+ int argc = 1;
+ __asm volatile ("" : "+r" (argc));
+ int array[argc];
+
+ array[:] = 5; /* { dg-error "start-index and length fields necessary for using array notations in variable-length arrays." } */
+ array[0:argc] = 5; /* This is OK. */
+ array[0:5:2] = 5; /* This is OK. */
+ array[0:argc:2] = 5; /* This is OK. */
+ array[0:argc:func (argc-2)] = 5; /* This is OK. */
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/compound_cilk_spawn.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/compound_cilk_spawn.c
new file mode 100644
index 000000000..5e687bd0a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/compound_cilk_spawn.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+/* <feature>
+ A program is considered ill formed if the _Cilk_spawn form of this
+ expression appears other than in one of the following contexts:
+ as the entire body of an expression statement,
+ as the entire right hand side of an assignment expression that is the entire
+ body of an expression statement, or as the entire initializer-clause in a
+ simple declaration.
+ </feature>
+*/
+
+int spawn_func (int arg)
+{
+ return arg + 1;
+}
+
+int check()
+{
+ int z;
+ z = 23, _Cilk_spawn spawn_func (3), 3424; /* { dg-error "spawned function call cannot be part of a comma expression" } */
+ 23, spawn_func (5), _Cilk_spawn spawn_func (3); /* { dg-error "spawned function call cannot be part of a comma expression" } */
+ _Cilk_spawn spawn_func (0), _Cilk_spawn spawn_func (3), 3, spawn_func (0); /* { dg-error "spawned function call cannot be part of a comma expression" } */
+ return 23;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/concec_cilk_spawn.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/concec_cilk_spawn.c
new file mode 100644
index 000000000..b93c9626d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/concec_cilk_spawn.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+/* <feature> Consecutive _Cilk_spawn tokens are not permitted
+ </feature>
+*/
+
+int spawn_func (int arg)
+{
+ return arg + 1;
+}
+
+void func ()
+{
+ int a;
+ a = _Cilk_spawn _Cilk_spawn spawn_func (4); /* { dg-error "consecutive" } */
+ a = _Cilk_spawn _Cilk_spawn _Cilk_spawn spawn_func (4); /* { dg-error "consecutive" } */
+ a = _Cilk_spawn _Cilk_spawn _Cilk_spawn _Cilk_spawn spawn_func (4); /* { dg-error "consecutive" } */
+ return;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/fib.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/fib.c
new file mode 100644
index 000000000..a8849fb9e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/fib.c
@@ -0,0 +1,54 @@
+/* { dg-options "-fcilkplus" } */
+/* { dg-do run { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-fcilkplus -lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
+
+#if HAVE_IO
+#include <stdio.h>
+#endif
+
+int fib (int);
+int fib_serial (int);
+
+#define FIB_ITERATION 30
+
+int main(void)
+{
+ int ii = 0;
+ int fib_result[FIB_ITERATION+1], fib_serial_result[FIB_ITERATION+1];
+#if HAVE_IO
+
+ for (ii = 0; ii <= FIB_ITERATION; ii++)
+ printf("fib (%2d) = %10d\n", ii, fib (ii));
+#else
+ for (ii = 0; ii <= FIB_ITERATION; ii++)
+ {
+ fib_result[ii] = fib (ii);
+ }
+
+ fib_serial_result[0] = 0;
+ fib_serial_result[1] = 1;
+ for (ii = 2; ii <= FIB_ITERATION; ii++)
+ fib_serial_result[ii] = fib_serial_result[ii-1] + fib_serial_result[ii-2];
+
+ for (ii = 0; ii <= FIB_ITERATION; ii++)
+ {
+ if (fib_result[ii] != fib_serial_result[ii])
+ __builtin_abort ();
+ }
+#endif
+ return 0;
+}
+
+int fib(int n)
+{
+ int x = 0, y = 0;
+ if (n < 2)
+ return n;
+ else
+ {
+ x = _Cilk_spawn fib(n-1);
+ y = fib(n-2);
+ _Cilk_sync;
+ return (x+y);
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/fib_init_expr_xy.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/fib_init_expr_xy.c
new file mode 100644
index 000000000..0196a8dab
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/fib_init_expr_xy.c
@@ -0,0 +1,68 @@
+/* { dg-options "-fcilkplus" } */
+/* { dg-do run { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-fcilkplus -lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
+
+#if HAVE_IO
+#include <stdio.h>
+#endif
+
+int fib (int);
+int fib_serial (int);
+
+#define FIB_ITERATION 30
+
+int main(void)
+{
+ int ii = 0;
+ int fib_result[FIB_ITERATION+1], fib_serial_result[FIB_ITERATION+1];
+#if HAVE_IO
+
+ for (ii = 0; ii <= FIB_ITERATION; ii++)
+ printf("fib (%2d) = %10d\n", ii, fib (ii));
+#else
+ for (ii = 0; ii <= FIB_ITERATION; ii++)
+ {
+ fib_result[ii] = fib (ii);
+ }
+
+ fib_serial_result[0] = 0;
+ fib_serial_result[1] = 1;
+
+ for (ii = 2; ii <= FIB_ITERATION; ii++)
+ fib_serial_result[ii] = fib_serial_result[ii-1] + fib_serial_result[ii-2];
+
+ for (ii = 0; ii <= FIB_ITERATION; ii++)
+ {
+ if (fib_result[ii] != fib_serial_result[ii])
+ __builtin_abort ();
+ }
+
+#endif
+ return 0;
+}
+
+int fib_serial (int n)
+{
+ int x = 0, y = 0;
+ if (n < 2)
+ return n;
+ else
+ {
+ x = fib_serial (n-1);
+ y = fib_serial (n-2);
+ return (x+y);
+ }
+}
+
+int fib(int n)
+{
+ if (n < 2)
+ return n;
+ else
+ {
+ int x = _Cilk_spawn fib(n-1);
+ int y = fib(n-2);
+ _Cilk_sync;
+ return (x+y);
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/fib_no_return.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/fib_no_return.c
new file mode 100644
index 000000000..47ebef520
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/fib_no_return.c
@@ -0,0 +1,73 @@
+/* { dg-options "-fcilkplus" } */
+/* { dg-do run { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-fcilkplus -lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
+
+#if HAVE_IO
+#include <stdio.h>
+#endif
+
+#define FIB_ITERATION 30
+
+void fib (int *, int);
+int fib_serial (int);
+
+int main(void)
+{
+ int ii = 0, error = 0;
+ int fib_result[FIB_ITERATION+1], fib_serial_result[FIB_ITERATION+1];
+
+#if HAVE_IO
+ for (ii = 0; ii <= FIB_ITERATION; ii++)
+ {
+ int result = 0;
+ fib (&result, ii);
+ printf("fib (%2d) = %10d\n", ii, result);
+ }
+#else
+ for (ii = 0; ii <= FIB_ITERATION; ii++)
+ {
+ fib (&fib_result[ii], ii);
+ }
+
+ fib_serial_result[0] = 0;
+ fib_serial_result[1] = 1;
+
+ for (ii = 2; ii <= FIB_ITERATION; ii++)
+ fib_serial_result[ii] = fib_serial_result[ii-1] + fib_serial_result[ii-2];
+
+ for (ii = 0; ii <= FIB_ITERATION; ii++)
+ {
+ if (fib_result[ii] != fib_serial_result[ii])
+ __builtin_abort ();
+ }
+#endif
+
+ return 0;
+}
+
+int fib_serial (int n)
+{
+ int x = 0, y = 0;
+ if (n < 2)
+ return n;
+ else
+ {
+ x = fib_serial (n-1);
+ y = fib_serial (n-2);
+ return (x+y);
+ }
+}
+
+void fib(int *result, int n)
+{
+ int x = 0, y = 0;
+ if (n < 2)
+ x = n;
+ else
+ {
+ _Cilk_spawn fib(&x, n-1);
+ fib(&y, n-2);
+ _Cilk_sync;
+ }
+ *result = (x+y);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/fib_no_sync.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/fib_no_sync.c
new file mode 100644
index 000000000..a23051d48
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/fib_no_sync.c
@@ -0,0 +1,67 @@
+/* { dg-options "-fcilkplus" } */
+/* { dg-do run { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-fcilkplus -lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
+
+#if HAVE_IO
+#include <stdio.h>
+#endif
+
+#define FIB_ITERATION 30
+
+int fib (int);
+int fib_serial (int);
+
+int main(void)
+{
+ int ii = 0;
+ int fib_result[FIB_ITERATION+1], fib_serial_result[FIB_ITERATION+1];
+#if HAVE_IO
+
+ for (ii = 0; ii <= FIB_ITERATION; ii++)
+ printf("fib (%2d) = %10d\n", ii, fib (ii));
+#else
+ for (ii = 0; ii <= FIB_ITERATION; ii++)
+ {
+ fib_result[ii] = fib (ii);
+ }
+
+ fib_serial_result[0] = 0;
+ fib_serial_result[1] = 1;
+
+ for (ii = 2; ii <= FIB_ITERATION; ii++)
+ fib_serial_result[ii] = fib_serial_result[ii-1] + fib_serial_result[ii-2];
+
+ for (ii = 0; ii <= FIB_ITERATION; ii++)
+ {
+ if (fib_result[ii] != fib_serial_result[ii])
+ __builtin_abort ();
+ }
+
+#endif
+ return 0;
+}
+
+int fib_serial (int n)
+{
+ int x = 0, y = 0;
+ if (n < 2)
+ return n;
+ else
+ {
+ x = fib_serial (n-1);
+ y = fib_serial (n-2);
+ return (x+y);
+ }
+}
+
+int fib(int n)
+{
+ if (n < 2)
+ return n;
+ else
+ {
+ int x = _Cilk_spawn fib(n-1);
+ int y = fib(n-2);
+ return (x+y);
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_spawns.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_spawns.c
new file mode 100644
index 000000000..ba9e61936
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_spawns.c
@@ -0,0 +1,13 @@
+/* { dg-options "-fcilkplus" } */
+
+extern int foo ();
+int bar = _Cilk_spawn foo (); /* { dg-error "may only be used inside a function" } */
+
+
+int main (void)
+{
+ int x;
+
+ _Cilk_spawn x; /* { dg-error "only function calls can be spawned" } */
+ return x;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/no_args_error.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/no_args_error.c
new file mode 100644
index 000000000..593732ef5
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/no_args_error.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+int spawn_1 ();
+typedef int(*func) (int);
+
+void check () {
+ func var = spawn_1; /* { dg-error "invalid conversion from" "" { target c++ } 8 } */
+ _Cilk_spawn var (); /* { dg-error "too few arguments to function" } */
+}
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/pr59631.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/pr59631.c
new file mode 100644
index 000000000..389ee7c5d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/pr59631.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options " " } */
+
+/* Tests the errors when Cilk keywords are used without -fcilkplus. */
+
+void foo()
+{
+ _Cilk_spawn foo(); /* { dg-error "must be enabled to use" } */
+}
+
+void foo2 ()
+{
+ _Cilk_spawn foo (); /* { dg-error "must be enabled to use" } */
+ _Cilk_sync; /* { dg-error "must be enabled to use" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197-2.c
new file mode 100644
index 000000000..1e5ca00a4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197-2.c
@@ -0,0 +1,35 @@
+/* PR c/60197 */
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+extern int foo (void);
+
+int
+fn1 (void)
+{
+ int i;
+ i = (_Cilk_spawn foo ()) + 1; /* { dg-error "invalid use of" } */
+ return i;
+}
+
+int
+fn2 (void)
+{
+ int i = (_Cilk_spawn foo ()) + 1; /* { dg-error "invalid use of" } */
+ return i;
+}
+
+int
+fn3 (int j, int k, int l)
+{
+ int i = (((((_Cilk_spawn foo ()) + 1) - l) * k) / j); /* { dg-error "invalid use of" } */
+ return i;
+}
+
+int
+fn4 (int j, int k, int l)
+{
+ int i;
+ i = (((((_Cilk_spawn foo ()) + 1) - l) * k) / j); /* { dg-error "invalid use of" } */
+ return i;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197.c
new file mode 100644
index 000000000..2b47d1efb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197.c
@@ -0,0 +1,66 @@
+/* PR c/60197 */
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+extern int foo (void);
+extern int bar (int);
+
+int
+fn1 (void)
+{
+ return (_Cilk_spawn foo ()) * 2; /* { dg-error "in a return statement is not allowed" } */
+}
+
+int
+fn2 (void)
+{
+ return (_Cilk_spawn foo ()) > 2; /* { dg-error "in a return statement is not allowed" } */
+}
+
+int
+fn3 (int i, int j, int k)
+{
+ return ((((((_Cilk_spawn foo () + i) - j) * k) / j) | i) ^ k) ; /* { dg-error "in a return statement is not allowed" } */
+}
+
+int
+fn4 (int i, int j, int k)
+{
+ return (((((i - _Cilk_spawn foo ()) * k) / j) | i) ^ k); /* { dg-error "in a return statement is not allowed" } */
+}
+
+int
+fn5 (void)
+{
+ return _Cilk_spawn foo (); /* { dg-error "in a return statement is not allowed" } */
+}
+
+int
+fn6 (void)
+{
+ return _Cilk_spawn foo () + _Cilk_spawn foo (); /* { dg-error "in a return statement is not allowed" } */
+}
+
+int
+fn7 (void)
+{
+ return 5 % _Cilk_spawn foo (); /* { dg-error "in a return statement is not allowed" } */
+}
+
+int
+fn8 (void)
+{
+ return !_Cilk_spawn foo (); /* { dg-error "in a return statement is not allowed" } */
+}
+
+int
+fn9 (void)
+{
+ return foo () && _Cilk_spawn foo (); /* { dg-error "in a return statement is not allowed" } */
+}
+
+int
+fn10 (void)
+{
+ return bar (_Cilk_spawn foo ()); /* { dg-error "in a return statement is not allowed" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/spawn_in_return.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/spawn_in_return.c
new file mode 100644
index 000000000..14b7eef12
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/spawn_in_return.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+int main (void)
+{
+ extern int foo ();
+ return _Cilk_spawn foo (); /* { dg-error "return statement is not allowed" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/spawnee_inline.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/spawnee_inline.c
new file mode 100644
index 000000000..233a371f1
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/spawnee_inline.c
@@ -0,0 +1,80 @@
+/* { dg-do run { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-options "-fcilkplus -w" } */
+/* { dg-additional-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
+
+#include <stdio.h>
+#include <stdlib.h>
+#define DEFAULT_VALUE "30"
+
+int fib (char *n_char)
+{
+ int n;
+ char n_char_minus_one[20], n_char_minus_two[20];
+ if (n_char)
+ n = atoi (n_char);
+ else
+ n = atoi(DEFAULT_VALUE);
+
+ if (n < 2)
+ return n;
+ else
+ {
+ int x, y;
+ sprintf (n_char_minus_one,"%d", n-1);
+ sprintf (n_char_minus_two,"%d", n-2);
+ x = _Cilk_spawn fib (n_char_minus_one);
+ y = _Cilk_spawn fib (n_char_minus_two);
+ _Cilk_sync;
+ return (x+y);
+ }
+}
+
+int fib_serial (int n)
+{
+ int x, y;
+ if (n < 2)
+ return n;
+ else
+ {
+ x = fib_serial (n-1);
+ y = fib_serial (n-2);
+ return (x+y);
+ }
+ return 0;
+}
+
+int main2_parallel (int argc, char *argv[])
+{
+ int n, result_parallel = 0;
+
+ if (argc == 2)
+ {
+ result_parallel = _Cilk_spawn fib (argv[1]);
+ _Cilk_sync;
+ }
+ else
+ {
+ result_parallel = _Cilk_spawn fib((char *)"30");
+ _Cilk_sync;
+ }
+ return result_parallel;
+}
+
+int main2_serial (int argc, char *argv[])
+{
+ int n, result_serial = 0;
+ if (argc == 2)
+ result_serial = fib_serial (atoi (argv[1]));
+ else
+ result_serial = fib_serial (atoi (DEFAULT_VALUE));
+
+ return result_serial;
+}
+
+int main (void)
+{
+ if (main2_serial (1, 0) != main2_parallel (1,0))
+ return 1;
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/spawner_inline.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/spawner_inline.c
new file mode 100644
index 000000000..55ec223ab
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/spawner_inline.c
@@ -0,0 +1,67 @@
+/* { dg-do run { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-options "-fcilkplus" } */
+/* { dg-additional-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
+
+#include <stdlib.h>
+#define DEFAULT_VALUE 30
+int fib (int n)
+{
+ if (n<2)
+ return n;
+ else
+ {
+ int x, y;
+ x = _Cilk_spawn fib (n-1);
+ y = _Cilk_spawn fib (n-2);
+ _Cilk_sync;
+ return (x+y);
+ return 5;
+ }
+}
+
+int main_parallel (int argc, char *argv[])
+{
+ int n, result;
+ if (argc == 2)
+ n = atoi(argv[1]);
+ else
+ n = DEFAULT_VALUE;
+ result = _Cilk_spawn fib(n);
+ _Cilk_sync;
+ return result;
+}
+
+int fib_serial (int n)
+{
+ int x, y;
+ if (n < 2)
+ return n;
+ else
+ {
+ x = fib (n-1);
+ y = fib (n-2);
+ return (x+y);
+ }
+}
+
+int main_serial (int argc, char *argv[])
+{
+ int n, result;
+
+ if (argc == 2)
+ n = atoi (argv[1]);
+ else
+ n = DEFAULT_VALUE;
+ result = fib_serial (n);
+
+ return result;
+}
+
+int main (void)
+{
+ if (main_serial (1, 0) != main_parallel (1,0))
+ return 1;
+ else
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/spawning_arg.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/spawning_arg.c
new file mode 100644
index 000000000..95e6cab02
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/spawning_arg.c
@@ -0,0 +1,37 @@
+/* { dg-do run { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-options "-fcilkplus" } */
+/* { dg-additional-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
+
+void f0(volatile int *steal_flag)
+{
+ int i = 0;
+ /* Wait for steal_flag to be set */
+ while (!*steal_flag)
+ ;
+}
+
+int f1()
+{
+
+ volatile int steal_flag = 0;
+ _Cilk_spawn f0(&steal_flag);
+ steal_flag = 1; // Indicate stolen
+ _Cilk_sync;
+ return 0;
+}
+
+void f2(int q)
+{
+ q = 5;
+}
+
+void f3()
+{
+ _Cilk_spawn f2(f1());
+}
+
+int main()
+{
+ f3();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/steal_check.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/steal_check.c
new file mode 100644
index 000000000..6e2876531
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/steal_check.c
@@ -0,0 +1,43 @@
+/* { dg-do run { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-options "-fcilkplus" } */
+/* { dg-additional-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
+
+// #include <cilk/cilk_api.h>
+extern void __cilkrts_set_param (char *, char *);
+
+void foo(volatile int *);
+
+void main2(void);
+
+int main(void)
+{
+ // __cilkrts_set_param ((char *)"nworkers", (char *)"2");
+ main2();
+ return 0;
+}
+
+
+void main2(void)
+{
+ int some_var = 0;
+
+ _Cilk_spawn foo(&some_var);
+
+ some_var=1;
+ some_var=5;
+ some_var=3;
+ some_var=4;
+
+ _Cilk_sync;
+ return;
+}
+
+void foo(volatile int *some_other_var)
+{
+ while (*some_other_var == 0)
+ {
+ ;
+ }
+}
+
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/sync_wo_spawn.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/sync_wo_spawn.c
new file mode 100644
index 000000000..51be796e5
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/sync_wo_spawn.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+int main (void)
+{
+ _Cilk_sync; /* { dg-error "expected '_Cilk_spawn' before '_Cilk_sync'" } */
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/test__cilk.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/test__cilk.c
new file mode 100644
index 000000000..2b37cd664
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/test__cilk.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-do run { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-options "-fcilkplus" } */
+
+int main (void)
+{
+ if (__cilk == 200)
+ return 0;
+ return 1;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/varargs_test.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/varargs_test.c
new file mode 100644
index 000000000..271460024
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/varargs_test.c
@@ -0,0 +1,47 @@
+/* { dg-do run { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-options "-fcilkplus" } */
+/* { dg-additional-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
+
+#include <stdarg.h>
+#include <stdlib.h>
+
+
+double compute_total (int no_elements, ...);
+
+int main(void)
+{
+ double array[5] = {5.0, 4.0, 9.0, 3.0, 4.0};
+ double array2[5] = {5.0, 6.0, 8.0, 6.0};
+ double yy=0, xx=0, xx_serial, yy_serial;
+
+ yy = _Cilk_spawn compute_total(5,array[0],array[1],array[2],
+ array[3], array[4]);
+ xx= compute_total(4,array2[0],array2[1],array2[2], array2[3]);
+
+ _Cilk_sync;
+
+ yy_serial = compute_total(5,array[0],array[1],array[2], array[3], array[4]);
+ xx_serial = compute_total(4,array2[0],array2[1],array2[2], array2[3]);
+
+ if ((xx + yy) != (xx_serial + yy_serial))
+ return 1;
+ return 0;
+
+}
+
+
+double compute_total (int no_elements, ...)
+{
+ double total = 0;
+ va_list args;
+ va_start(args, no_elements);
+ int ii = 0;
+ for (ii = 0; ii < no_elements; ii++)
+ {
+ total += va_arg(args,double);
+ }
+ va_end(args);
+
+ return total;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/body.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/body.c
new file mode 100644
index 000000000..82c0a0c20
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/body.c
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus -fopenmp" } */
+/* { dg-require-effective-target fopenmp } */
+
+int *a, *b, c;
+void *jmpbuf[10];
+
+void foo()
+{
+ int j;
+
+#pragma simd
+ for (int i=0; i < 1000; ++i)
+ {
+ if (c == 6)
+ __builtin_setjmp (jmpbuf); /* { dg-error "setjmp" } */
+ a[i] = b[i];
+ }
+
+#pragma simd
+ for (int i=0; i < 1000; ++i)
+ {
+ if (c==5)
+ break; /* { dg-error "break statement " } */
+ }
+
+#pragma simd
+ for (int i=0; i < 1000; ++i)
+ {
+#pragma omp for /* { dg-error "OpenMP constructs may not" } */
+ for (j=0; j < 1000; ++j)
+ a[i] = b[i];
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/clauses1.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/clauses1.c
new file mode 100644
index 000000000..27d117ec2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/clauses1.c
@@ -0,0 +1,80 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -Werror -Wunknown-pragmas -fcilkplus" } */
+
+volatile int *a, *b;
+
+void foo()
+{
+ int i, j, k;
+
+#pragma simd assert /* { dg-error "expected '#pragma simd' clause" } */
+ for (i=0; i < 100; ++i)
+ a[i] = b[i];
+
+#pragma simd vectorlength /* { dg-error "expected '\\('" } */
+ for (int i=0; i < 1000; ++i)
+ a[i] = b[j];
+
+#pragma simd vectorlength /* { dg-error "expected '\\('" } */
+ for (int i=0; i < 1000; ++i)
+ a[i] = b[j];
+
+#pragma simd vectorlength(sizeof (a) == sizeof (float) ? 4 : 8)
+ for (int i=0; i < 1000; ++i)
+ a[i] = b[j];
+
+#pragma simd vectorlength(4,8) /* { dg-error "expected '\\)'" } */
+ for (int i=0; i < 1000; ++i)
+ a[i] = b[j];
+
+#pragma simd vectorlength(i) /* { dg-error "\(vectorlength must be an integer\|in a constant\)" } */
+ for (int i=0; i < 1000; ++i)
+ a[i] = b[j];
+
+#pragma simd linear(35) /* { dg-error "expected identifier" } */
+ for (int i=0; i < 1000; ++i)
+ a[i] = b[j];
+
+#pragma simd linear(blah) /* { dg-error "'blah' \(undeclared\|has not been\)" } */
+ for (int i=0; i < 1000; ++i)
+ a[i] = b[j];
+
+#pragma simd linear(j, 36, k) /* { dg-error "expected" } */
+ for (int i=0; i < 1000; ++i)
+ a[i] = b[j];
+
+#pragma simd linear(i, j)
+ for (int i=0; i < 1000; ++i)
+ a[i] = b[j];
+
+#pragma simd linear(i)
+ for (int i=0; i < 1000; ++i)
+ a[i] = b[j];
+
+#pragma simd linear(i : 4)
+ for (int i=0; i < 1000; ++i)
+ a[i] = b[j];
+
+#pragma simd linear(i : 2, j : 4, k)
+ for (int i=0; i < 1000; ++i)
+ a[i] = b[j];
+
+#pragma simd linear(j : sizeof (a) == sizeof (float) ? 4 : 8)
+ for (int i=0; i < 1000; ++i)
+ a[i] = b[j];
+
+ // And now everyone in unison!
+#pragma simd linear(j : 4) vectorlength(4)
+ for (int i=0; i < 1000; ++i)
+ a[i] = b[j];
+
+#pragma simd linear(blah2, 36)
+ /* { dg-error "'blah2' \(undeclared\|has not been\)" "undeclared" { target *-*-* } 71 } */
+ /* { dg-error "expected" "expected" { target *-*-* } 71 } */
+ for (int i=0; i < 1000; ++i)
+ a[i] = b[j];
+
+#pragma simd linear(j : k)
+ for (int i=0; i < 1234; ++i)
+ a[i] = b[j];
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/clauses2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/clauses2.c
new file mode 100644
index 000000000..71589c2b1
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/clauses2.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-original -fcilkplus" } */
+
+volatile int *a, *b;
+
+void foo()
+{
+ int j, k;
+
+#pragma simd linear(j : 4, k) vectorlength(4)
+ for (int i=0; i < 1000; ++i)
+ a[i] = b[j];
+}
+
+/* { dg-final { scan-tree-dump-times "linear\\(j:4\\)" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "linear\\(k:1\\)" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "safelen\\(4\\)" 1 "original" } } */
+/* { dg-final { cleanup-tree-dump "original" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/clauses3.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/clauses3.c
new file mode 100644
index 000000000..579b718a0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/clauses3.c
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fcilkplus" } */
+
+#define N 1000
+
+int A[N], B[N], C[N];
+int main (void)
+{
+#pragma simd private (B) linear(B:1) /* { dg-error "more than one clause" } */
+ for (int ii = 0; ii < N; ii++)
+ {
+ A[ii] = B[ii] + C[ii];
+ }
+
+#pragma simd private (B, C) linear(B:1) /* { dg-error "more than one clause" } */
+ for (int ii = 0; ii < N; ii++)
+ {
+ A[ii] = B[ii] + C[ii];
+ }
+
+#pragma simd private (B) linear(C:2, B:1) /* { dg-error "more than one clause" } */
+ for (int ii = 0; ii < N; ii++)
+ {
+ A[ii] = B[ii] + C[ii];
+ }
+
+#pragma simd reduction (+:B) linear(B:1) /* { dg-error "more than one clause" } */
+ for (int ii = 0; ii < N; ii++)
+ {
+ A[ii] = B[ii] + C[ii];
+ }
+
+#pragma simd reduction (+:B) linear(B) /* { dg-error "more than one clause" } */
+ for (int ii = 0; ii < N; ii++)
+ {
+ A[ii] = B[ii] + C[ii];
+ }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/for1.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/for1.c
new file mode 100644
index 000000000..3b678952c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/for1.c
@@ -0,0 +1,132 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fcilkplus" } */
+
+int *a, *b, *c;
+int something;
+
+void foo()
+{
+ int i, j;
+
+ // Declaration and initialization is allowed.
+#pragma simd
+ for (int i=0; i < 1000; i++)
+ a[i] = b[j];
+
+ // Empty initialization is not allowed.
+#pragma simd
+ for (; i < 5; ++i) // { dg-error "expected iteration" }
+ a[i] = i;
+
+ // Empty condition is not allowed.
+#pragma simd
+ for (int i=0; ; ++i) /* { dg-error "missing controlling" } */
+ a[i] = i;
+
+ // Empty increment is not allowed.
+#pragma simd
+ for (int i=0; i < 1234; ) /* { dg-error "missing increment" } */
+ a[i] = i*2;
+
+#pragma simd
+ i = 5; /* { dg-error "for statement expected" } */
+
+ // Initialization variables must be either integral or pointer types.
+ struct S {
+ int i;
+ };
+#pragma simd
+ for (struct S ss = { 0 }; ss.i <= 1000; ++ss.i) /* { dg-error "invalid controlling\|invalid type for iteration\|invalid increment" } */
+ a[ss.i] = b[ss.i];
+
+ #pragma simd
+ for (float f=0.0; f < 15.0; ++f) /* { dg-error "invalid type" } */
+ a[(int)f] = (int) f;
+
+ // Pointers are OK.
+ #pragma simd
+ for (int *i=c; i < &c[100]; ++i)
+ *a = '5';
+
+ // Condition of '==' is not allowed.
+#pragma simd
+ for (int i=j; i == 5; ++i) /* { dg-error "invalid controlling predicate" } */
+ a[i] = b[i];
+
+ // The LHS or RHS of the condition must be the initialization variable.
+#pragma simd
+ for (int i=0; i+j < 1234; ++i) /* { dg-error "invalid controlling predicate" } */
+ a[i] = b[i];
+
+ // Likewise.
+#pragma simd
+ for (int i=0; 1234 < i + j; ++i) /* { dg-error "invalid controlling predicate" } */
+ a[i] = b[i];
+
+ // Likewise, this is ok.
+#pragma simd
+ for (int i=0; 1234 + j < i; ++i)
+ a[i] = b[i];
+
+ // According to the CilkPlus forum, casts are not allowed, even if
+ // they are no-ops.
+#pragma simd
+ for (int i=0; (char)i < 1234; ++i) /* { dg-error "invalid controlling predicate" } */
+ a[i] = b[i];
+
+#pragma simd
+ for (int i=255; i != something; --i)
+ a[i] = b[i];
+
+#pragma simd
+ for (int i=100; i != 5; i += something)
+ a[i] = b[i];
+
+ // Increment must be on the induction variable.
+#pragma simd
+ for (int i=0; i < 100; j++) /* { dg-error "invalid increment expression" } */
+ a[i] = b[i];
+
+ // Likewise.
+#pragma simd
+ for (int i=0; i < 100; j = i + 1) /* { dg-error "invalid increment expression" } */
+ a[i] = b[i];
+
+ // Likewise.
+#pragma simd
+ for (int i=0; i < 100; i = j + 1) /* { dg-error "invalid increment expression" } */
+ a[i] = b[i];
+
+#pragma simd
+ for (int i=0; i < 100; i = i + 5)
+ a[i] = b[i];
+
+ // Only PLUS and MINUS increments are allowed.
+#pragma simd
+ for (int i=0; i < 100; i *= 5) /* { dg-error "invalid increment expression" } */
+ a[i] = b[i];
+
+#pragma simd
+ for (int i=0; i < 100; i -= j)
+ a[i] = b[i];
+
+#pragma simd
+ for (int i=0; i < 100; i = i + j)
+ a[i] = b[i];
+
+#pragma simd
+ for (int i=0; i < 100; i = j + i)
+ a[i] = b[i];
+
+#pragma simd
+ for (int i=0; i < 100; ++i, ++j) /* { dg-error "invalid increment expression" } */
+ a[i] = b[i];
+
+#pragma simd
+ for (int *point=0; point < b; ++point)
+ *point = 555;
+
+#pragma simd
+ for (int *point=0; point > b; --point)
+ *point = 555;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/for2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/for2.c
new file mode 100644
index 000000000..86606275a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/for2.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fcilkplus" } */
+
+#pragma simd /* { dg-error "must be inside a function" } */
+
+void foo()
+{
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/for3.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/for3.c
new file mode 100644
index 000000000..2da8235f3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/for3.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fcilkplus" } */
+
+int *a, *c;
+
+void foo()
+{
+ int i, j;
+
+ // Pointers are OK.
+ #pragma simd
+ for (int *i=c; i < c; ++i)
+ *a = '5';
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/reduction-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/reduction-1.c
new file mode 100644
index 000000000..d8cec84f1
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/reduction-1.c
@@ -0,0 +1,38 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -fcilkplus" } */
+
+/* FIXME: This test has been xfailed until reductions are fixed. */
+
+int argc = 1;
+
+/* This is a simple vectorization test. It tests if reduction works
+ and if it can vectorize the loop in func correctly. */
+#define N 1000
+
+int func (int *p, int *q) {
+ int x = 0;
+#pragma simd reduction (+:x)
+ for (int ii = 0; ii < N; ii++) {
+ x += (q[ii] + p[ii]);
+ }
+ return x;
+
+}
+
+int main ()
+{
+ int ii = 0, x;
+ int Array[N], Array2[N];
+
+ for (ii = 0; ii < N; ii++)
+ {
+ Array[ii] = 5 + argc;
+ Array2[ii] = argc;
+ }
+ x = func (Array, Array2);
+
+ if (x != N * 7)
+ return 1;
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/reduction-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/reduction-2.c
new file mode 100644
index 000000000..f5554f6b1
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/reduction-2.c
@@ -0,0 +1,36 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -fcilkplus" } */
+
+/* FIXME: This test has been xfailed until reductions are fixed. */
+
+#include <stdio.h>
+
+#define ARRAY_SIZE (256)
+int a[ARRAY_SIZE];
+
+__attribute__((noinline))
+int addit (int *arr, int N)
+{
+ int s=0;
+#pragma simd reduction (+:s)
+ for (int i = 0; i < N; i++)
+ s += arr[i];
+ return s;
+}
+
+int main () {
+ int i, s = 0, r = 0;
+ for (i = 0; i < ARRAY_SIZE; i++)
+ {
+ a[i] = i;
+ }
+
+ s = addit (a, ARRAY_SIZE);
+
+ for (i = 0; i < ARRAY_SIZE; i++)
+ r += i;
+
+ if (s == r)
+ return 0;
+ return 1;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/reduction-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/reduction-3.c
new file mode 100644
index 000000000..35cb904a5
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/reduction-3.c
@@ -0,0 +1,41 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -fcilkplus" } */
+
+#define N 256
+#if HAVE_IO
+#include <stdio.h>
+#endif
+#include <stdlib.h>
+
+int
+reduction_simd (int *a)
+{
+ int s = 0;
+
+#pragma simd reduction (+:s)
+ for (int i = 0; i < N; i++)
+ {
+ s += a[i];
+ }
+
+ return s;
+}
+
+int
+main ()
+{
+ int *a = (int *) malloc (N * sizeof (int));
+ int i, s = (N - 1) * N / 2;
+
+ for (i = 0; i < N; i++)
+ {
+ a[i] = i;
+ }
+#if HAVE_IO
+ printf ("%d, %d\n", s, reduction_simd (a));
+#endif
+ if (s == reduction_simd (a))
+ return 0;
+ else
+ return 1;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/run-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/run-1.c
new file mode 100644
index 000000000..c8fe1c762
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/run-1.c
@@ -0,0 +1,28 @@
+/* { dg-do run } */
+/* { dg-options "-fcilkplus -O3" } */
+
+#include <stdlib.h>
+
+#define N 4
+
+float f1[] = { 2.0, 3.0, 4.0, 5.0 };
+float f2[] = { 1.0, 6.0, -1.0, -2.0 };
+float res[] = { 3.0, 9.0, 3.0, 3.0 };
+
+__attribute__((noinline))
+void verify (float *sum)
+{
+ for (int i=0; i < N; ++i)
+ if (sum[i] != res[i])
+ abort ();
+}
+
+int main()
+{
+ float sum[N];
+#pragma simd
+ for (int i=0; i < N; ++i)
+ sum[i] = f1[i] + f2[i];
+ verify (sum);
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/safelen.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/safelen.c
new file mode 100644
index 000000000..2c59de9b0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/safelen.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-gimple -fcilkplus" } */
+
+int *a, *b;
+
+void foo()
+{
+#pragma simd vectorlength(8)
+ for (int i=0; i < 1000; ++i)
+ a[i] = b[i];
+}
+
+/* { dg-final { scan-tree-dump-times "safelen\\(8\\)" 1 "gimple" } } */
+/* { dg-final { cleanup-tree-dump "gimple" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/vectorlength-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/vectorlength-2.c
new file mode 100644
index 000000000..d90397717
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/vectorlength-2.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcilkplus" } */
+
+#define vl(n) vectorlength(2*n)
+void
+foo (int *a, int *b, int *c)
+{
+ int i;
+#pragma simd vl(4)
+ for (i = 0; i < 64; i++)
+ a[i] = b[i] * c[i];
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/vectorlength-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/vectorlength-3.c
new file mode 100644
index 000000000..9cef5a581
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/vectorlength-3.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcilkplus -save-temps" } */
+
+#define vl(n) vectorlength(2*n)
+void
+foo (int *a, int *b, int *c)
+{
+ int i;
+#pragma simd vl(4)
+ for (i = 0; i < 64; i++)
+ a[i] = b[i] * c[i];
+}
+
+/* { dg-final { cleanup-saved-temps } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/vectorlength.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/vectorlength.c
new file mode 100644
index 000000000..9aa4a6829
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/PS/vectorlength.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fcilkplus" } */
+
+volatile int *a, *b, N;
+typedef int tint;
+struct someclass {
+ int a;
+ char b;
+ int *p;
+};
+
+void foo()
+{
+#pragma simd vectorlength(4) vectorlength(8) /* { dg-error "too many 'vectorlength' clauses" } */
+ for (int i=0; i < N; ++i)
+ a[i] = b[i];
+
+#pragma simd vectorlength(3) /* { dg-error "must be a power of 2" } */
+ for (int i=0; i < N; ++i)
+ a[i] = b[i];
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/ef_error.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/ef_error.c
new file mode 100644
index 000000000..5312992ff
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/ef_error.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus -fopenmp-simd" } */
+
+#pragma omp declare simd linear(y:1) simdlen(4)
+__attribute__((vector (linear (y:1), vectorlength(4))))
+int func (int x, int y) { /* { dg-error "cannot be used in the same function marked as a Cilk Plus SIMD-enabled" } */
+ return (x+y);
+}
+__attribute__((vector (linear (y:1), private (x)))) /* { dg-error "is not valid for" } */
+int func2 (int x, int y) {
+ return (x+y);
+}
+
+__attribute__((vector (linear (y:1), simdlen (4)))) /* { dg-error "is not valid for" } */
+int func2_1 (int x, int y) {
+ return (x+y);
+}
+
+__attribute__((vector (linear (y:1), inbranch))) /* { dg-error "is not valid for" } */
+int func2_3 (int x, int y) {
+ return (x+y);
+}
+
+__attribute__((vector (notinbranch, vectorlength (4)))) /* { dg-error "is not valid for" } */
+int func2_2 (int x, int y) {
+ return (x+y);
+}
+
+int main (void)
+{
+ return (func (5,6));
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/ef_error2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/ef_error2.c
new file mode 100644
index 000000000..518d6407e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/ef_error2.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-options "-fcilkplus -Wall" } */
+
+__attribute__((vector (vectorlength(32))))
+//#pragma omp simd simdlen (32)
+int func2 (int x, int y) /* { dg-warning "unsupported simdlen" } */
+{
+ return (x+y);
+}
+
+int main (void)
+{
+ return (func2 (5,6));
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/ef_error3.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/ef_error3.c
new file mode 100644
index 000000000..195e9f1d7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/ef_error3.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-options "-fcilkplus -Wall" } */
+
+__attribute__((vector (linear (x:y)))) /* { dg-message "parameter" "" { target c++ } } */
+int func2 (int x, int y)
+{ /* { dg-message "using parameters for" "" { target c } } */
+ return (x+y);
+}
+
+int main (void)
+{
+ return (func2 (5,6));
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/ef_test.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/ef_test.c
new file mode 100644
index 000000000..e606acac1
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/ef_test.c
@@ -0,0 +1,78 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus -Wunknown-pragmas" } */
+
+/* Tests the clauses in several combinations put in different locations. */
+/* This is mostly a parser test. */
+#define Q 4
+
+int z = Q;
+
+ __attribute__ ((vector (uniform(x), linear (y:1), vectorlength (4) )))
+int func (int x, int y)
+{
+ int zq = 5;
+ return x + (y*zq);
+}
+ __attribute__ ((__vector__ (uniform(x), vectorlength (2), linear (y:1) )))
+int func2 (int x, int y)
+{
+ int zq = 5;
+ return x + (y*zq);
+}
+
+__attribute__ ((vector (uniform(y), linear (x), vectorlength (4) )))
+int func3 (int x, int y)
+{
+ int zq = 5;
+ return x + (y*zq);
+}
+
+__attribute__ ((vector (uniform(x), linear (y:1), mask)))
+int func4 (int x, int y)
+{
+ int zq = 5;
+ return x + (y*zq);
+}
+
+__attribute__ ((vector (uniform(x), linear (y:1), nomask)))
+int func5 (int x, int y)
+{
+ int zq = 5;
+ return x + (y*zq);
+}
+
+__attribute__ ((vector (uniform(x), mask, linear (y:1))))
+int func6 (int x, int y)
+{
+ int zq = 5;
+ return x + (y*zq);
+}
+
+__attribute__ ((vector (uniform (x), mask, linear (y:1)), vector))
+int func7 (int x, int y)
+{
+ int zq = 5;
+ return x + (y*zq);
+}
+
+__attribute__ ((vector (uniform (x), mask, linear (y:1)), vector (uniform (y), mask)))
+int func8 (int x, int y)
+{
+ int zq = 5;
+ return x + (y*zq);
+}
+
+__attribute__ ((vector, vector (uniform (y), mask)))
+int func9 (int x, int y)
+{
+ int zq = 5;
+ return x + (y*zq);
+}
+
+int main (int argc, char *argv[])
+{
+ int ii = 0, q = 5;
+ for (ii = 0; ii < 10; ii++)
+ q += func (argc, ii);
+ return q;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/ef_test2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/ef_test2.c
new file mode 100644
index 000000000..7ec0578b4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/ef_test2.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+void func (int x, int y) __attribute__((vector(linear(x:1), uniform (y)),
+ vector));
+
+int q;
+int main (void)
+{
+ int ii = 0;
+ q = 5;
+ for (ii = 0; ii < 100; ii++)
+ func (ii, q);
+
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/vlength_errors.c b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/vlength_errors.c
new file mode 100644
index 000000000..1bcf2a27a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/SE/vlength_errors.c
@@ -0,0 +1,59 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus -Wunknown-pragmas" } */
+
+#define Q 4
+
+int z = Q;
+
+__attribute__ ((vector (uniform(x), vectorlength (), linear (y:1) ))) /* { dg-error "expected expression" "" { target c } } */
+ /* { dg-error "expected primary-expression" "" { target c++ } 8 } */
+int func2 (int x, int y)
+{
+ int zq = 5;
+ return x + (y*zq);
+}
+
+__attribute__ ((vector (uniform(x), linear (y:1), vectorlength (4.5) ))) /* { dg-error "vectorlength must be an integer" } */
+int func3 (int x, int y)
+{
+ int zq = 5;
+ return x + (y*zq);
+}
+
+__attribute__ ((vector (uniform(x), linear (y:1), vectorlength (z) ))) /* { dg-error "vectorlength must be an integer" "" { target c } } */
+ /* { dg-error "constant" "" { target c++ } 23 } */
+int func4 (int x, int y)
+{
+ int zq = 5;
+ return x + (y*zq);
+}
+
+__attribute__ ((vector (uniform(x), linear (y:1), vectorlength (Q) ))) /* This is OK! */
+int func5 (int x, int y)
+{
+ int zq = 5;
+ return x + (y*zq);
+}
+
+__attribute__ ((vector (uniform(x), vectorlength (z), linear (y:1)))) /* { dg-error "vectorlength must be an integer" "" { target c } } */
+ /* { dg-error "constant" "" { target c++ } 38 } */
+int func6 (int x, int y)
+{
+ int zq = 5;
+ return x + (y*zq);
+}
+
+__attribute__ ((vector (uniform(x), linear (y:1), vectorlength (sizeof (int)) ))) /* This is OK too! */
+int func7 (int x, int y)
+{
+ int zq = 5;
+ return x + (y*zq);
+}
+
+int main (void)
+{
+ int ii = 0, q = 5;
+ for (ii = 0; ii < 10; ii++)
+ q += func2 (z, ii);
+ return q;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/convert-vec-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/convert-vec-1.c
new file mode 100644
index 000000000..862190d60
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/convert-vec-1.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-prune-output "changes the ABI" } */
+typedef float v2sf __attribute__ ((vector_size (8)));
+v2sf sub (void) { return (v2sf) 0.0; } /* { dg-error "can't convert" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-1.c
new file mode 100644
index 000000000..9867c94a8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-1.c
@@ -0,0 +1,11 @@
+// { dg-do compile }
+
+#pragma GCC warning "warn-a" // { dg-warning warn-a }
+#pragma GCC error "err-b" // { dg-error err-b }
+
+#define CONST1 _Pragma("GCC warning \"warn-c\"") 1
+#define CONST2 _Pragma("GCC error \"err-d\"") 2
+
+char a[CONST1]; // { dg-warning warn-c }
+char b[CONST2]; // { dg-error err-d }
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/normalize-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/normalize-3.c
new file mode 100644
index 000000000..ae0184cfb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/normalize-3.c
@@ -0,0 +1,35 @@
+/* { dg-do preprocess } */
+/* { dg-options "-std=c99 -fextended-identifiers -Wnormalized=id" { target c } } */
+/* { dg-options "-fextended-identifiers -Wnormalized=id" { target c++ } } */
+
+\u00AA
+\u00B7
+\u0F43 /* { dg-warning "not in NFC" } */
+a\u05B8\u05B9\u05B9\u05BBb
+ a\u05BB\u05B9\u05B8\u05B9b /* { dg-warning "not in NFC" } */
+\u09CB
+\u09C7\u09BE /* { dg-warning "not in NFC" } */
+\u0B4B
+\u0B47\u0B3E /* { dg-warning "not in NFC" } */
+\u0BCA
+\u0BC6\u0BBE /* { dg-warning "not in NFC" } */
+\u0BCB
+\u0BC7\u0BBE /* { dg-warning "not in NFC" } */
+\u0CCA
+\u0CC6\u0CC2 /* { dg-warning "not in NFC" } */
+\u0D4A
+\u0D46\u0D3E /* { dg-warning "not in NFC" } */
+\u0D4B
+\u0D47\u0D3E /* { dg-warning "not in NFC" } */
+
+K
+\u212A
+
+\u03AC
+\u1F71 /* { dg-warning "not in NFC" } */
+
+\uAC00
+\u1100\u1161
+\uAC01
+\u1100\u1161\u11A8
+\uAC00\u11A8
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/openmp-define-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/openmp-define-1.c
new file mode 100644
index 000000000..c5379223c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/openmp-define-1.c
@@ -0,0 +1,6 @@
+/* { dg-do preprocess } */
+/* { dg-require-effective-target fopenmp } */
+
+#ifdef _OPENMP
+# error _OPENMP defined
+#endif
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/openmp-define-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/openmp-define-2.c
new file mode 100644
index 000000000..8823e291b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/openmp-define-2.c
@@ -0,0 +1,7 @@
+/* { dg-options "-fno-openmp" } */
+/* { dg-do preprocess } */
+/* { dg-require-effective-target fopenmp } */
+
+#ifdef _OPENMP
+# error _OPENMP defined
+#endif
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/openmp-define-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/openmp-define-3.c
new file mode 100644
index 000000000..6986c5507
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/openmp-define-3.c
@@ -0,0 +1,11 @@
+/* { dg-options "-fopenmp" } */
+/* { dg-do preprocess } */
+/* { dg-require-effective-target fopenmp } */
+
+#ifndef _OPENMP
+# error _OPENMP not defined
+#endif
+
+#if _OPENMP != 201307
+# error _OPENMP defined to wrong value
+#endif
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr45457.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr45457.c
new file mode 100644
index 000000000..14879cd79
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr45457.c
@@ -0,0 +1,18 @@
+/* PR preprocessor/45457 */
+/* { dg-do compile } */
+
+const char *a =
+#ifdef __DBL_DENORM_MIN__
+"a"
+#endif
+#if defined(__DBL_EPSILON__)
+"b"
+#endif
+#ifndef __DBL_MAX__
+"c"
+#endif
+#if !defined(__DBL_MIN__)
+"d"
+#endif
+;
+double b = __DBL_DENORM_MIN__ + __DBL_EPSILON__ + __DBL_MAX__ + __DBL_MIN__;
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr58844-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr58844-1.c
new file mode 100644
index 000000000..3abf8a768
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr58844-1.c
@@ -0,0 +1,8 @@
+/* PR preprocessor/58844 */
+/* { dg-do compile } */
+/* { dg-options "-ftrack-macro-expansion=0" } */
+
+#define A x######x
+int A = 1;
+#define A x######x /* { dg-message "previous definition" } */
+#define A x##x /* { dg-warning "redefined" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr58844-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr58844-2.c
new file mode 100644
index 000000000..1e219152f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr58844-2.c
@@ -0,0 +1,8 @@
+/* PR preprocessor/58844 */
+/* { dg-do compile } */
+/* { dg-options "-ftrack-macro-expansion=2" } */
+
+#define A x######x
+int A = 1;
+#define A x######x /* { dg-message "previous definition" } */
+#define A x##x /* { dg-warning "redefined" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr60400-1.h b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr60400-1.h
new file mode 100644
index 000000000..3e32175fe
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr60400-1.h
@@ -0,0 +1,3 @@
+??=ifndef PR60400_1_H
+??=define PR60400_1_H
+??=endif
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr60400-2.h b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr60400-2.h
new file mode 100644
index 000000000..d9a590636
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr60400-2.h
@@ -0,0 +1,4 @@
+??=ifndef PR60400_2_H
+??=define PR60400_2_H
+??=include "pr60400-1.h"
+??=endif
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr60400.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr60400.c
new file mode 100644
index 000000000..fc3e0d9f4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/pr60400.c
@@ -0,0 +1,13 @@
+/* PR preprocessor/60400 */
+/* { dg-do compile } */
+/* { dg-options "-trigraphs -Wtrigraphs" } */
+
+??=include "pr60400-1.h"
+??=include "pr60400-2.h"
+
+/* { dg-warning "trigraph" "" { target *-*-* } 1 } */
+/* { dg-warning "trigraph" "" { target *-*-* } 2 } */
+/* { dg-warning "trigraph" "" { target *-*-* } 3 } */
+/* { dg-warning "trigraph" "" { target *-*-* } 4 } */
+/* { dg-warning "trigraph" "" { target *-*-* } 5 } */
+/* { dg-warning "trigraph" "" { target *-*-* } 6 } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c
new file mode 100644
index 000000000..e3c6d2608
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c
@@ -0,0 +1,15 @@
+/* { dg-do preprocess } */
+/* { dg-options "-std=c11 -pedantic -fextended-identifiers" { target c } } */
+/* { dg-options "-std=c++11 -pedantic -fextended-identifiers" { target c++ } } */
+
+\u00A8
+
+B\u0300
+
+\u0300 /* { dg-error "not valid at the start of an identifier" } */
+
+A\u0300 /* { dg-warning "not in NFC" } */
+
+\U00010000
+\U0001FFFD
+\U000E1234
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-1.c
new file mode 100644
index 000000000..e23d240c2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-1.c
@@ -0,0 +1,4 @@
+// { dg-do preprocess }
+// { dg-options "-std=gnu99 -fdiagnostics-show-option" { target c } }
+// { dg-options "-fdiagnostics-show-option" { target c++ } }
+#warning "Printed" // { dg-warning "\"Printed\" .-Wcpp." }
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-2.c
new file mode 100644
index 000000000..65edd7bb9
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-2.c
@@ -0,0 +1,5 @@
+// { dg-do preprocess }
+// { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=cpp" { target c } }
+// { dg-options "-fdiagnostics-show-option -Werror=cpp" { target c++ } }
+/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */
+#warning "Printed" // { dg-error "\"Printed\" .-Werror=cpp." }
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-3.c
new file mode 100644
index 000000000..0c50a318d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-3.c
@@ -0,0 +1,4 @@
+// { dg-do preprocess }
+// { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror -Wno-error=cpp" { target c } }
+// { dg-options "-fdiagnostics-show-option -Werror -Wno-error=cpp" { target c++ } }
+#warning "Printed" // { dg-warning "\"Printed\" .-Wcpp." }
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-4.c
new file mode 100644
index 000000000..23069f8ad
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-directive-4.c
@@ -0,0 +1,4 @@
+// { dg-do preprocess }
+// { dg-options "-std=gnu99 -fdiagnostics-show-option -Wno-cpp" { target c } }
+// { dg-options "-fdiagnostics-show-option -Wno-cpp" { target c++ } }
+#warning "Not printed" // { dg-bogus "." }
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-zero-in-literals-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-zero-in-literals-1.c
new file mode 100644
index 000000000..ff2ed962a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-zero-in-literals-1.c
Binary files differ
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-zero-location-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-zero-location-2.c
new file mode 100644
index 000000000..e919bca69
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-zero-location-2.c
@@ -0,0 +1,10 @@
+/*
+ { dg-options "-D _GNU_SOURCE -fdiagnostics-show-caret" }
+ { dg-do compile }
+ */
+
+#line 4636 "configure"
+#include <xxxxxxxxxxxx.h>
+int main() { return 0; }
+
+/* { dg-message "" "#include" {target *-*-* } 0 }
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-zero-location.c b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-zero-location.c
new file mode 100644
index 000000000..ca2e102bb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cpp/warning-zero-location.c
@@ -0,0 +1,8 @@
+/*
+ { dg-options "-D _GNU_SOURCE -fdiagnostics-show-caret" }
+ { dg-do compile }
+ */
+
+#define _GNU_SOURCE /* { dg-warning "redefined" } */
+
+/* { dg-message "" "#define _GNU_SOURCE" {target *-*-* } 0 }
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cxxbitfields-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/cxxbitfields-3.c
new file mode 100644
index 000000000..fc423ea8b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cxxbitfields-3.c
@@ -0,0 +1,22 @@
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-O2 --param allow-store-data-races=0" } */
+
+/* Make sure we don't narrow down to a QI or HI to store into VAR.J,
+ but instead use an SI. */
+
+struct S
+{
+ volatile int i: 4;
+ volatile int j: 4;
+ volatile int k: 8;
+ volatile int l: 8;
+ volatile int m: 8;
+} var;
+
+void setit()
+{
+ var.j = 5;
+}
+
+/* { dg-final { scan-assembler "movl.*, _?var" { target nonpic } } } */
+/* { dg-final { scan-assembler "movl.*, (_?var|\\(%)" { target { ! nonpic } } } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/cxxbitfields-6.c b/gcc-4.9/gcc/testsuite/c-c++-common/cxxbitfields-6.c
new file mode 100644
index 000000000..bdd62941b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/cxxbitfields-6.c
@@ -0,0 +1,17 @@
+/* PR middle-end/50141 */
+/* { dg-do compile } */
+/* { dg-options "-O2 --param allow-store-data-races=0" } */
+
+struct S
+{
+ int i:8;
+};
+
+void bar (struct S, int);
+
+void
+foo (struct S s, int i)
+{
+ s.i = i;
+ bar (s, i);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/call-by-value.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/call-by-value.c
new file mode 100644
index 000000000..74aec53ae
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/call-by-value.c
@@ -0,0 +1,43 @@
+/* C99 6.9.1(9) Function definitions; parameter has automatic storage.
+
+ Test that actual parameters are passed by value and that modifications
+ made within functions are lost on function return. */
+
+#include "dfp-dbg.h"
+
+int foo32 (_Decimal32 z)
+{
+ z = z + 1.0df;
+}
+
+int foo64 (_Decimal64 z)
+{
+ z = z + 1.0dd;
+}
+
+int foo128 (_Decimal128 z)
+{
+ z = z + 1.0dl;
+}
+
+int
+main ()
+{
+ _Decimal32 d32 = 1.1df;
+ _Decimal64 d64 = 1.2dd;
+ _Decimal128 d128 = 1.3dl;
+
+ foo32 (d32);
+ if (d32 != 1.1df)
+ FAILURE
+
+ foo64 (d64);
+ if (d64 != 1.2dd)
+ FAILURE
+
+ foo128 (d128);
+ if (d128 != 1.3dl)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/cast.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/cast.c
new file mode 100644
index 000000000..b6585d70c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/cast.c
@@ -0,0 +1,75 @@
+/* C99 6.5.4 Cast operators.
+ Test valid casts involving decimal float. */
+
+#include "dfp-dbg.h"
+
+_Decimal32 d32;
+_Decimal64 d64;
+_Decimal128 d128;
+
+static float f = 2.f;
+static double d = 2.l;
+
+int
+main (void)
+{
+ /* Casts between DFP types. */
+ d32 = 1.2df;
+ d64 = 1.2dd;
+ d128 = 1.2dl;
+
+ if (d32 != (_Decimal32) d64)
+ FAILURE
+ if (d32 != (_Decimal32) d128)
+ FAILURE
+
+ if (d64 != (_Decimal64) d32)
+ FAILURE
+ if (d64 != (_Decimal64) d128)
+ FAILURE
+
+ if (d128 != (_Decimal128) d32)
+ FAILURE
+ if (d128 != (_Decimal128) d64)
+ FAILURE
+
+ /* Casts between generic and decimal floating point types. Use a
+ value that we can assume can be represented exactly in all
+ representations. */
+
+ d32 = 2.0df;
+ d64 = 2.0dd;
+ d128 = 2.0dl;
+
+ /* To generic floating types. */
+ if ((float) d32 != 2.0f)
+ FAILURE
+ if ((double) d32 != 2.0l)
+ FAILURE
+ if ((float) d64 != 2.0f)
+ FAILURE
+ if ((double) d64 != 2.0l)
+ FAILURE
+ if ((float) d128 != 2.0f)
+ FAILURE
+ if ((double) d128 != 2.0l)
+ FAILURE
+
+ /* float to decimal floating types. */
+ if (d32 != (_Decimal32) f)
+ FAILURE
+ if (d64 != (_Decimal64) f)
+ FAILURE
+ if (d128 != (_Decimal128) f)
+ FAILURE
+
+ /* double to decimal floating types. */
+ if (d32 != (_Decimal32) d)
+ FAILURE
+ if (d64 != (_Decimal64) d)
+ FAILURE
+ if (d128 != (_Decimal128) d)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq-const.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq-const.c
new file mode 100644
index 000000000..0c9ff200b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq-const.c
@@ -0,0 +1,28 @@
+/* C99 6.5.9 Equality operators.
+ Compare decimal float constants against each other. */
+
+#include "dfp-dbg.h"
+
+extern void link_error (void);
+
+int
+main ()
+{
+ /* Compare like-typed positive constants. */
+ if (2.0df != 2.0df)
+ link_error ();
+
+ /* Compare decimal float constants of different types. */
+ if (500e-2dl != 0.05e2df)
+ link_error ();
+
+ /* Binary floating point introduces errors to decimal values. */
+ if (1.4 + 1.4 + 1.4 == 4.2)
+ link_error ();
+
+ /* But, this looks more like what one would expect. */
+ if (1.4dd + 1.4dd + 1.4dd != 4.2dd)
+ link_error ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq-d128.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq-d128.c
new file mode 100644
index 000000000..79fcac319
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq-d128.c
@@ -0,0 +1,14 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.9 Equality operators.
+ Compare decimal float values against each other at runtime. */
+
+#define WIDTH 128
+#include "compare-eq.h"
+
+int main ()
+{
+ test_compares ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq-d32.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq-d32.c
new file mode 100644
index 000000000..6b1a4c6d7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq-d32.c
@@ -0,0 +1,14 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.9 Equality operators.
+ Compare decimal float values against each other at runtime. */
+
+#define WIDTH 32
+#include "compare-eq.h"
+
+int main ()
+{
+ test_compares ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq-d64.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq-d64.c
new file mode 100644
index 000000000..f1b463ebe
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq-d64.c
@@ -0,0 +1,14 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.9 Equality operators.
+ Compare decimal float values against each other at runtime. */
+
+#define WIDTH 64
+#include "compare-eq.h"
+
+int main ()
+{
+ test_compares ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq-dfp.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq-dfp.c
new file mode 100644
index 000000000..79a5691eb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq-dfp.c
@@ -0,0 +1,53 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.9 Equality operators.
+ Compare decimal float values against variables of different types. */
+
+#include "dfp-dbg.h"
+
+_Decimal32 d32;
+_Decimal64 d64;
+_Decimal128 d128;
+
+/* Use some typedefs of decimal float types, too. */
+typedef _Decimal32 SDtype;
+typedef _Decimal64 DDtype;
+typedef _Decimal128 TDtype;
+
+SDtype d32b;
+DDtype d64b;
+TDtype d128b;
+
+void
+inits (void)
+{
+ d32 = 1.0df;
+ d64 = 3.0dd;
+ d128 = 5.0dl;
+ d32b = -1.0df;
+ d64b = -4.0dd;
+ d128b = -6.0dl;
+}
+
+void
+compare_dfp (void)
+{
+ if ((d32 == d64) != 0) FAILURE
+ if ((d32 != d128b) != 1) FAILURE
+
+ if ((d64 != d32) != 1) FAILURE
+ if ((d64 == d128) != 0) FAILURE
+
+ if ((d128 != d32) != 1) FAILURE
+ if ((d128 == d64) != 0) FAILURE
+}
+
+int
+main ()
+{
+ inits ();
+
+ compare_dfp ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq.h b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq.h
new file mode 100644
index 000000000..830b3289b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-eq.h
@@ -0,0 +1,92 @@
+/* Basic test of runtime equality comparisons using simple values that
+ are not affected by rounding. */
+
+#include <stdlib.h>
+#include "dfp-dbg.h"
+
+#define PASTE2(A,B) A ## B
+#define PASTE(A,B) PASTE2(A,B)
+
+#undef FAILURE
+#ifdef DBG
+#define FAILURE(OP,KIND) \
+ { printf ("failed at line %d: %s for %s values\n", __LINE__, OP, KIND); \
+ failures++; }
+#else
+#define FAILURE(OP,KIND) __builtin_abort ();
+#endif
+
+#ifndef WIDTH
+#error define WIDTH as decimal float size in bytes
+#endif
+
+#if WIDTH == 32
+#define DTYPE _Decimal32
+#define SUFFIX DF
+#elif WIDTH == 64
+#define DTYPE _Decimal64
+#define SUFFIX DD
+#elif WIDTH == 128
+#define DTYPE _Decimal128
+#define SUFFIX DL
+#elif WIDTH == 0
+/* This is for testing the test using a type known to work. */
+#define DTYPE double
+#define SUFFIX
+#else
+#error invalid width for decimal float type
+#endif
+
+DTYPE m_two = PASTE(-2.0, SUFFIX);
+DTYPE m_one = PASTE(-1.0, SUFFIX);
+DTYPE zero = PASTE(0.0, SUFFIX);
+DTYPE one = PASTE(1.0, SUFFIX);
+DTYPE two = PASTE(2.0, SUFFIX);
+
+void
+test_compares (void)
+{
+ DTYPE x = one;
+ DTYPE y = zero;
+ DTYPE z = m_one;
+
+ /* Equal to: comparisons against equal values. */
+
+ if (! (x == one)) FAILURE ("==", "equal")
+ if (! (y == zero)) FAILURE ("==", "equal")
+ if (! (z == m_one)) FAILURE ("==", "equal")
+
+ /* Equal to: comparisons against lesser values. */
+
+ if (x == m_one) FAILURE ("==", "lesser")
+ if (x == zero) FAILURE ("==", "lesser")
+ if (y == m_one) FAILURE ("==", "lesser")
+ if (z == m_two) FAILURE ("==", "lesser")
+
+ /* Equal to: comparisons against greater values. */
+
+ if (x == two) FAILURE ("==", "greater")
+ if (y == one) FAILURE ("==", "greater")
+ if (z == zero) FAILURE ("==", "greater")
+ if (z == one) FAILURE ("==", "greater")
+
+ /* Not equal to: comparisons against equal values. */
+
+ if (x != one) FAILURE ("!=", "equal")
+ if (y != zero) FAILURE ("!=", "equal")
+ if (z != m_one) FAILURE ("!=", "equal")
+
+ /* Not equal to: comparisons against lesser values. */
+
+ if (! (x != m_one)) FAILURE ("!=", "lesser")
+ if (! (x != zero)) FAILURE ("!=", "lesser")
+ if (! (y != m_one)) FAILURE ("!=", "lesser")
+ if (! (z != m_two)) FAILURE ("!=", "lesser")
+
+ /* Not equal to: comparisons against greater values. */
+
+ if (! (x != m_one)) FAILURE ("!=", "greater")
+ if (! (x != zero)) FAILURE ("!=", "greater")
+ if (! (y != m_one)) FAILURE ("!=", "greater")
+ if (! (z != m_two)) FAILURE ("!=", "greater")
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel-const.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel-const.c
new file mode 100644
index 000000000..8e99b4466
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel-const.c
@@ -0,0 +1,57 @@
+/* C99 6.5.8 Relational operators.
+ Compare decimal float constants against each other. */
+
+extern void link_error (void);
+
+int
+main ()
+{
+ /* Compare like-typed negative constants. */
+ if (-2.0dl < -2.0dl)
+ link_error ();
+
+ /* Compare like-typed constants. */
+ if (-2.0dl >= .01dl)
+ link_error ();
+
+ /* Compare like-typed constants. */
+ if (0.2dd > 0.02e1dd)
+ link_error ();
+
+ /* Compare decimal float constants of different types. */
+ if (-.000005dd >= -.0000049DL)
+ link_error();
+
+ /* Test use gcc builtins for comparisons. */
+ if (__builtin_isless(-2.0dl,-2.0dl))
+ link_error();
+
+ if (__builtin_isgreaterequal(-2.0dl,.01dl))
+ link_error();
+
+ if (!(__builtin_islessequal(-2.0dl, -2.0dd)))
+ link_error();
+
+ if (!(__builtin_isgreater(2.0dl, -2.0dd)))
+ link_error();
+
+ if (__builtin_islessequal(2.0df, __builtin_nand64("")))
+ link_error();
+
+ if (__builtin_islessgreater(2.0dd, __builtin_nand64("")))
+ link_error();
+
+ if (!__builtin_islessgreater(2.0dd, -2.0dd))
+ link_error();
+
+ if (!__builtin_islessgreater(-3.0dd, 2.0dd))
+ link_error();
+
+ if (__builtin_isunordered(1.1df, 0.003dd))
+ link_error();
+
+ if (!__builtin_isunordered(-3.1df, __builtin_nand32("")))
+ link_error();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel-d128.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel-d128.c
new file mode 100644
index 000000000..38c931a02
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel-d128.c
@@ -0,0 +1,14 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.8 Relational operators.
+ Compare decimal float values against each other at runtime. */
+
+#define WIDTH 128
+#include "compare-rel.h"
+
+int
+main ()
+{
+ test_compares ();
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel-d32.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel-d32.c
new file mode 100644
index 000000000..04128aab9
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel-d32.c
@@ -0,0 +1,14 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.8 Relational operators.
+ Compare decimal float values against each other at runtime. */
+
+#define WIDTH 32
+#include "compare-rel.h"
+
+int
+main ()
+{
+ test_compares ();
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel-d64.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel-d64.c
new file mode 100644
index 000000000..92f904a81
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel-d64.c
@@ -0,0 +1,14 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.8 Relational operators.
+ Compare decimal float values against each other at runtime. */
+
+#define WIDTH 64
+#include "compare-rel.h"
+
+int
+main ()
+{
+ test_compares ();
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel-dfp.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel-dfp.c
new file mode 100644
index 000000000..59cc20353
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel-dfp.c
@@ -0,0 +1,53 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.8 Relational operators.
+ Compare decimal float values against variables of different types. */
+
+#include "dfp-dbg.h"
+
+_Decimal32 d32;
+_Decimal64 d64;
+_Decimal128 d128;
+
+/* Use some typedefs of decimal float types, too. */
+typedef _Decimal32 SDtype;
+typedef _Decimal64 DDtype;
+typedef _Decimal128 TDtype;
+
+SDtype d32b;
+DDtype d64b;
+TDtype d128b;
+
+void
+inits (void)
+{
+ d32 = 1.0df;
+ d64 = 3.0dd;
+ d128 = 5.0dl;
+ d32b = -1.0df;
+ d64b = -4.0dd;
+ d128b = -6.0dl;
+}
+
+void
+compare_dfp (void)
+{
+ if ((d32 > d64) != 0) FAILURE
+ if ((d32 >= d128b) != 1) FAILURE
+
+ if ((d64 < d32) != 0) FAILURE
+ if ((d64 <= d128) != 1) FAILURE
+
+ if ((d128 > d32) != 1) FAILURE
+ if ((d128 >= d64) != 1) FAILURE
+}
+
+int
+main ()
+{
+ inits ();
+
+ compare_dfp ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel.h b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel.h
new file mode 100644
index 000000000..784010814
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-rel.h
@@ -0,0 +1,132 @@
+/* Basic test of runtime relational comparisons using simple values that
+ are not affected by rounding. */
+
+#include <stdlib.h>
+#include "dfp-dbg.h"
+
+#undef FAILURE
+#ifdef DBG
+#define FAILURE(OP,KIND) \
+ { printf ("failed at line %d: %s for %s values\n", __LINE__, OP, KIND); \
+ failures++; }
+#else
+#define FAILURE(OP,KIND) __builtin_abort ();
+#endif
+
+#define PASTE2(A,B) A ## B
+#define PASTE(A,B) PASTE2(A,B)
+
+#ifndef WIDTH
+#error define WIDTH as decimal float size in bytes
+#endif
+
+#if WIDTH == 32
+#define DTYPE _Decimal32
+#define SUFFIX DF
+#elif WIDTH == 64
+#define DTYPE _Decimal64
+#define SUFFIX DD
+#elif WIDTH == 128
+#define DTYPE _Decimal128
+#define SUFFIX DL
+#elif WIDTH == 0
+/* This is for testing the test using a type known to work. */
+#define DTYPE double
+#define SUFFIX
+#else
+#error invalid width for decimal float type
+#endif
+
+DTYPE m_two = PASTE(-2.0, SUFFIX);
+DTYPE m_one = PASTE(-1.0, SUFFIX);
+DTYPE zero = PASTE(0.0, SUFFIX);
+DTYPE one = PASTE(1.0, SUFFIX);
+DTYPE two = PASTE(2.0, SUFFIX);
+
+void
+test_compares (void)
+{
+ DTYPE x = one;
+ DTYPE y = zero;
+ DTYPE z = m_one;
+
+ /* Less than or equal to: comparisons against equal values. */
+
+ if (! (x <= one)) FAILURE ("<=", "equal")
+ if (! (y <= zero)) FAILURE ("<=", "equal")
+ if (! (z <= m_one)) FAILURE ("<=", "equal")
+
+ /* Less than or equal to: comparisons against lesser values. */
+
+ if (x <= m_one) FAILURE ("<=", "lesser")
+ if (x <= zero) FAILURE ("<=", "lesser")
+ if (y <= m_one) FAILURE ("<=", "lesser")
+ if (z <= m_two) FAILURE ("<=", "lesser")
+
+ /* Less than or equal to: comparisons against greater values. */
+
+ if (! (x <= two)) FAILURE ("<=", "greater")
+ if (! (y <= one)) FAILURE ("<=", "greater")
+ if (! (z <= zero)) FAILURE ("<=", "greater")
+ if (! (z <= one)) FAILURE ("<=", "greater")
+
+ /* Less than: comparisons against equal values. */
+
+ if (x < one) FAILURE ("<", "equal")
+ if (y < zero) FAILURE ("<", "equal")
+ if (z < m_one) FAILURE ("<", "equal")
+
+ /* Less than: comparisons against lesser values. */
+
+ if (x < m_one) FAILURE ("<", "lesser")
+ if (x < zero) FAILURE ("<", "lesser")
+ if (y < m_one) FAILURE ("<", "lesser")
+ if (z < m_two) FAILURE ("<", "lesser")
+
+ /* Less than: comparisons against greater values. */
+
+ if (! (x < two)) FAILURE ("<", "greater")
+ if (! (y < one)) FAILURE ("<", "greater")
+ if (! (z < zero)) FAILURE ("<", "greater")
+ if (! (z < one)) FAILURE ("<", "greater")
+
+ /* Greater than or equal to: comparisons against equal values. */
+
+ if (! (x >= one)) FAILURE (">=", "equal")
+ if (! (y >= zero)) FAILURE (">=", "equal")
+ if (! (z >= m_one)) FAILURE (">=", "equal")
+
+ /* Greater than or equal to: comparisons against lesser values. */
+
+ if (! (x >= m_one)) FAILURE (">=", "lesser")
+ if (! (x >= zero)) FAILURE (">=", "lesser")
+ if (! (y >= m_one)) FAILURE (">=", "lesser")
+ if (! (z >= m_two)) FAILURE (">=", "lesser")
+
+ /* Greater than or equal to: comparisons against greater values. */
+
+ if (x >= two) FAILURE (">=", "greater")
+ if (y >= one) FAILURE (">=", "greater")
+ if (z >= zero) FAILURE (">=", "greater")
+ if (z >= one) FAILURE (">=", "greater")
+
+ /* Greater than: comparisons against equal values. */
+
+ if (x > one) FAILURE (">", "equal")
+ if (y > zero) FAILURE (">", "equal")
+ if (z > m_one) FAILURE (">", "equal")
+
+ /* Greater than: comparisons against lesser values. */
+
+ if (! (x > m_one)) FAILURE (">", "lesser")
+ if (! (x > zero)) FAILURE (">", "lesser")
+ if (! (y > m_one)) FAILURE (">", "lesser")
+ if (! (z > m_two)) FAILURE (">", "lesser")
+
+ /* Greater than: comparisons against greater values. */
+
+ if (x > two) FAILURE (">", "greater")
+ if (y > one) FAILURE (">", "greater")
+ if (z > zero) FAILURE (">", "greater")
+ if (z > one) FAILURE (">", "greater")
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-special-d128.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-special-d128.c
new file mode 100644
index 000000000..d1f5bc5ed
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-special-d128.c
@@ -0,0 +1,15 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.8 Relational operators.
+ C99 6.5.9 Equality operators.
+ Compare decimal float special values at runtime. */
+
+#define WIDTH 128
+#include "compare-special.h"
+
+int
+main ()
+{
+ test_compares ();
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-special-d32.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-special-d32.c
new file mode 100644
index 000000000..377c65a5b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-special-d32.c
@@ -0,0 +1,15 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.8 Relational operators.
+ C99 6.5.9 Equality operators.
+ Compare decimal float special values at runtime. */
+
+#define WIDTH 32
+#include "compare-special.h"
+
+int
+main ()
+{
+ test_compares ();
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-special-d64.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-special-d64.c
new file mode 100644
index 000000000..16154eff3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-special-d64.c
@@ -0,0 +1,15 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.8 Relational operators.
+ C99 6.5.9 Equality operators.
+ Compare decimal float special values at runtime. */
+
+#define WIDTH 64
+#include "compare-special.h"
+
+int
+main ()
+{
+ test_compares ();
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-special.h b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-special.h
new file mode 100644
index 000000000..9c27d126c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/compare-special.h
@@ -0,0 +1,284 @@
+/* Basic test of runtime relational comparisons using NaNs and infinities. */
+
+#include <stdlib.h>
+#include "dfp-dbg.h"
+
+#define PASTE2(A,B) A ## B
+#define PASTE(A,B) PASTE2(A,B)
+
+/* Override FAILURE from dfp-dbg.h with one that provides additional info. */
+#undef FAILURE
+#ifdef DBG
+#define FAILURE(OP,KIND) \
+ { printf ("failed at line %d: %s for %s values\n", __LINE__, OP, KIND); \
+ failures++; }
+#else
+#define FAILURE(OP,KIND) __builtin_abort ();
+#endif
+
+#ifndef WIDTH
+#error define WIDTH as decimal float size in bytes
+#endif
+
+#if WIDTH == 32
+#define DTYPE _Decimal32
+#define SUFFIX DF
+#define SUFFIX2 d32
+#elif WIDTH == 64
+#define DTYPE _Decimal64
+#define SUFFIX DD
+#define SUFFIX2 d64
+#elif WIDTH == 128
+#define DTYPE _Decimal128
+#define SUFFIX DL
+#define SUFFIX2 d128
+#elif WIDTH == 0
+/* This is for testing the test using a type known to work. */
+#define DTYPE double
+#define SUFFIX
+#define SUFFIX2
+#else
+#error invalid width for decimal float type
+#endif
+
+DTYPE m_two = PASTE(-2.0, SUFFIX);
+DTYPE m_one = PASTE(-1.0, SUFFIX);
+DTYPE zero = PASTE(0.0, SUFFIX);
+DTYPE one = PASTE(1.0, SUFFIX);
+DTYPE two = PASTE(2.0, SUFFIX);
+
+volatile DTYPE x, y, z, _nan, inf, m_inf;
+
+void
+test_compares (void)
+{
+ _nan = PASTE(__builtin_nan, SUFFIX2) ("");
+ inf = PASTE(__builtin_inf, SUFFIX2) ();
+ m_inf = - PASTE(__builtin_inf, SUFFIX2) ();
+
+ x = PASTE(__builtin_nan, SUFFIX2) ("");
+ y = PASTE(__builtin_inf, SUFFIX2) ();
+ z = - PASTE(__builtin_inf, SUFFIX2) ();
+
+ /* Less than or equal to with NaN. */
+
+ if (x <= two) FAILURE ("<=", "NaN")
+ if (x <= zero) FAILURE ("<=", "NaN")
+ if (x <= m_one) FAILURE ("<=", "NaN")
+ if (x <= _nan) FAILURE ("<=", "NaN")
+ if (x <= inf) FAILURE ("<=", "NaN")
+ if (x <= m_inf) FAILURE ("<=", "NaN")
+
+ if (two <= x) FAILURE ("<=", "NaN")
+ if (zero <= x) FAILURE ("<=", "NaN")
+ if (m_one <= x) FAILURE ("<=", "NaN")
+ if (_nan <= x) FAILURE ("<=", "NaN")
+ if (inf <= x) FAILURE ("<=", "NaN")
+ if (m_inf <= x) FAILURE ("<=", "NaN")
+
+ /* Less than or equal to with infinities, no NaNs. */
+
+ if (y <= two) FAILURE ("<=", "inf")
+ if (y <= zero) FAILURE ("<=", "inf")
+ if (y <= m_one) FAILURE ("<=", "inf")
+ if (!(two <= y)) FAILURE ("<=", "inf")
+ if (!(zero <= y)) FAILURE ("<=", "inf")
+ if (!(m_one <= y)) FAILURE ("<=", "inf")
+
+ if (!(z <= two)) FAILURE ("<=", "-inf")
+ if (!(z <= zero)) FAILURE ("<=", "-inf")
+ if (!(z <= m_one)) FAILURE ("<=", "-inf")
+ if (two <= z) FAILURE ("<=", "-inf")
+ if (zero <= z) FAILURE ("<=", "-inf")
+ if (m_one <= z) FAILURE ("<=", "-inf")
+
+ if (!(y <= inf)) FAILURE ("<=", "inf")
+ if (y <= m_inf) FAILURE ("<=", "inf")
+ if (!(z <= inf)) FAILURE ("<=", "inf")
+ if (!(z <= m_inf)) FAILURE ("<=", "inf")
+
+ /* Less than with NaN. */
+
+ if (x < two) FAILURE ("<", "NaN")
+ if (x < zero) FAILURE ("<", "NaN")
+ if (x < m_one) FAILURE ("<", "NaN")
+ if (x < _nan) FAILURE ("<", "NaN")
+ if (x < inf) FAILURE ("<", "NaN")
+ if (x < m_inf) FAILURE ("<", "NaN")
+
+ if (two < x) FAILURE ("<", "NaN")
+ if (zero < x) FAILURE ("<", "NaN")
+ if (m_one < x) FAILURE ("<", "NaN")
+ if (_nan < x) FAILURE ("<", "NaN")
+ if (inf < x) FAILURE ("<", "NaN")
+ if (m_inf < x) FAILURE ("<", "NaN")
+
+ /* Less than with infinities, no NaNs. */
+
+ if (y < two) FAILURE ("<", "inf")
+ if (y < zero) FAILURE ("<", "inf")
+ if (y < m_one) FAILURE ("<", "inf")
+ if (!(two < y)) FAILURE ("<", "inf")
+ if (!(zero < y)) FAILURE ("<", "inf")
+ if (!(m_one < y)) FAILURE ("<", "inf")
+
+ if (!(z < two)) FAILURE ("<", "-inf")
+ if (!(z < zero)) FAILURE ("<", "-inf")
+ if (!(z < m_one)) FAILURE ("<", "-inf")
+ if (two < z) FAILURE ("<", "-inf")
+ if (zero < z) FAILURE ("<", "-inf")
+ if (m_one < z) FAILURE ("<", "-inf")
+
+ if (y < inf) FAILURE ("<=", "inf")
+ if (y < m_inf) FAILURE ("<=", "inf")
+ if (!(z < inf)) FAILURE ("<=", "inf")
+ if (z < m_inf) FAILURE ("<=", "inf")
+
+ /* Greater than or equal to with NaN. */
+
+ if (x >= two) FAILURE (">=", "NaN")
+ if (x >= zero) FAILURE (">=", "NaN")
+ if (x >= m_one) FAILURE (">=", "NaN")
+ if (x >= _nan) FAILURE (">=", "NaN")
+ if (x >= inf) FAILURE (">=", "NaN")
+ if (x >= m_inf) FAILURE (">=", "NaN")
+
+ if (two >= x) FAILURE (">=", "NaN")
+ if (zero >= x) FAILURE (">=", "NaN")
+ if (m_one >= x) FAILURE (">=", "NaN")
+ if (_nan >= x) FAILURE (">=", "NaN")
+ if (inf >= x) FAILURE (">=", "NaN")
+ if (m_inf >= x) FAILURE (">=", "NaN")
+
+ /* Greater than or equal to with infinities, no NaNs. */
+
+ if (!(y >= two)) FAILURE (">=", "inf")
+ if (!(y >= zero)) FAILURE (">=", "inf")
+ if (!(y >= m_one)) FAILURE (">=", "inf")
+ if (two >= y) FAILURE (">=", "inf")
+ if (zero >= y) FAILURE (">=", "inf")
+ if (m_one >= y) FAILURE (">=", "inf")
+
+ if (z >= two) FAILURE (">=", "-inf")
+ if (z >= zero) FAILURE (">=", "-inf")
+ if (z >= m_one) FAILURE (">=", "-inf")
+ if (!(two >= z)) FAILURE (">=", "-inf")
+ if (!(zero >= z)) FAILURE (">=", "-inf")
+ if (!(m_one >= z)) FAILURE (">=", "-inf")
+
+ if (!(y >= inf)) FAILURE ("<=", "inf")
+ if (!(y >= m_inf)) FAILURE ("<=", "inf")
+ if (z >= inf) FAILURE ("<=", "inf")
+ if (!(z >= m_inf)) FAILURE ("<=", "inf")
+
+ /* Greater than with NaN. */
+
+ if (x > two) FAILURE (">", "NaN")
+ if (x > zero) FAILURE (">", "NaN")
+ if (x > m_one) FAILURE (">", "NaN")
+ if (x > _nan) FAILURE (">", "NaN")
+ if (x > inf) FAILURE (">", "NaN")
+ if (x > m_inf) FAILURE (">", "NaN")
+
+ if (two > x) FAILURE (">", "NaN")
+ if (zero > x) FAILURE (">", "NaN")
+ if (m_one > x) FAILURE (">", "NaN")
+ if (_nan > x) FAILURE (">", "NaN")
+ if (inf > x) FAILURE (">", "NaN")
+ if (m_inf > x) FAILURE (">", "NaN")
+
+ /* Greater than with infinities, no NaNs. */
+
+ if (!(y > two)) FAILURE (">", "inf")
+ if (!(y > zero)) FAILURE (">", "inf")
+ if (!(y > m_one)) FAILURE (">", "inf")
+ if (two > y) FAILURE (">", "inf")
+ if (zero > y) FAILURE (">", "inf")
+ if (m_one > y) FAILURE (">", "inf")
+
+ if (z > two) FAILURE (">", "-inf")
+ if (z > zero) FAILURE (">", "-inf")
+ if (z > m_one) FAILURE (">", "-inf")
+ if (!(two > z)) FAILURE (">", "-inf")
+ if (!(zero > z)) FAILURE (">", "-inf")
+ if (!(m_one > z)) FAILURE (">", "-inf")
+
+ if (y > inf) FAILURE (">", "inf")
+ if (!(y > m_inf)) FAILURE (">", "inf")
+ if (z > inf) FAILURE (">", "inf")
+ if (z > m_inf) FAILURE (">", "inf")
+
+ /* Equal with NaN. */
+
+ if (x == two) FAILURE ("==", "NaN")
+ if (x == zero) FAILURE ("==", "NaN")
+ if (x == m_one) FAILURE ("==", "NaN")
+ if (x == _nan) FAILURE ("==", "NaN")
+ if (x == inf) FAILURE ("==", "NaN")
+ if (x == m_inf) FAILURE ("==", "NaN")
+
+ if (two == x) FAILURE ("==", "NaN")
+ if (zero == x) FAILURE ("==", "NaN")
+ if (m_one == x) FAILURE ("==", "NaN")
+ if (_nan == x) FAILURE ("==", "NaN")
+ if (inf == x) FAILURE ("==", "NaN")
+ if (m_inf == x) FAILURE ("==", "NaN")
+
+ /* Equal with infinities, no NaNs. */
+
+ if (y == two) FAILURE ("==", "inf")
+ if (y == zero) FAILURE ("==", "inf")
+ if (y == m_one) FAILURE ("==", "inf")
+ if (two == y) FAILURE ("==", "inf")
+ if (zero == y) FAILURE ("==", "inf")
+ if (m_one == y) FAILURE ("==", "inf")
+
+ if (z == two) FAILURE ("==", "-inf")
+ if (z == zero) FAILURE ("==", "-inf")
+ if (z == m_one) FAILURE ("==", "-inf")
+ if (two == z) FAILURE ("==", "-inf")
+ if (zero == z) FAILURE ("==", "-inf")
+ if (m_one == z) FAILURE ("==", "-inf")
+
+ if (!(y == inf)) FAILURE ("==", "inf")
+ if (y == m_inf) FAILURE ("==", "inf")
+ if (z == inf) FAILURE ("==", "inf")
+ if (!(z == m_inf)) FAILURE ("==", "inf")
+
+ /* Not equal with NaN. */
+
+ if (!(x != two)) FAILURE ("!=", "NaN")
+ if (!(x != zero)) FAILURE ("!=", "NaN")
+ if (!(x != m_one)) FAILURE ("!=", "NaN")
+ if (!(x != _nan)) FAILURE ("!=", "NaN")
+ if (!(x != inf)) FAILURE ("!=", "NaN")
+ if (!(x != m_inf)) FAILURE ("!=", "NaN")
+
+ if (!(two != x)) FAILURE ("!=", "NaN")
+ if (!(zero != x)) FAILURE ("!=", "NaN")
+ if (!(m_one != x)) FAILURE ("!=", "NaN")
+ if (!(_nan != x)) FAILURE ("!=", "NaN")
+ if (!(inf != x)) FAILURE ("!=", "NaN")
+ if (!(m_inf != x)) FAILURE ("!=", "NaN")
+
+ /* Not equal with infinities, no NaNs. */
+
+ if (!(y != two)) FAILURE ("!=", "inf")
+ if (!(y != zero)) FAILURE ("!=", "inf")
+ if (!(y != m_one)) FAILURE ("!=", "inf")
+ if (!(two != y)) FAILURE ("!=", "inf")
+ if (!(zero != y)) FAILURE ("!=", "inf")
+ if (!(m_one != y)) FAILURE ("!=", "inf")
+
+ if (!(z != two)) FAILURE ("!=", "-inf")
+ if (!(z != zero)) FAILURE ("!=", "-inf")
+ if (!(z != m_one)) FAILURE ("!=", "-inf")
+ if (!(two != z)) FAILURE ("!=", "-inf")
+ if (!(zero != z)) FAILURE ("!=", "-inf")
+ if (!(m_one != z)) FAILURE ("!=", "-inf")
+
+ if (y != inf) FAILURE ("!=", "inf")
+ if (!(y != m_inf)) FAILURE ("!=", "inf")
+ if (!(z != inf)) FAILURE ("!=", "inf")
+ if (z != m_inf) FAILURE ("!=", "inf")
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/constants-zero.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/constants-zero.c
new file mode 100644
index 000000000..64b0054d2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/constants-zero.c
@@ -0,0 +1,159 @@
+/* { dg-options "-O0" } */
+
+/* Decimal float values can have significant trailing zeroes. This is
+ true for zero values as well. Check that various representations of
+ zero are handled correctly when specified as literal constants. */
+
+#include "dfp-dbg.h"
+
+int big_endian;
+
+typedef union U32 {
+ unsigned int i;
+ _Decimal32 d;
+ unsigned char b[4];
+} u32_t;
+
+typedef union U64 {
+ unsigned long long i;
+ _Decimal64 d;
+} u64_t;
+
+typedef union U128 {
+ unsigned long long i[2];
+ _Decimal128 d;
+} u128_t;
+
+int
+compare32 (_Decimal32 d, unsigned int i)
+{
+ u32_t u;
+
+ u.d = d;
+ return (u.i == i);
+}
+
+int
+compare64 (_Decimal64 d, unsigned long long i)
+{
+ u64_t u;
+
+ u.d = d;
+ return (u.i == i);
+}
+
+int
+compare128 (_Decimal64 d, unsigned long long i, unsigned long long j)
+{
+ u128_t u;
+
+ u.d = d;
+ if (big_endian)
+ return (u.i[0] == i && u.i[1] == j);
+ else
+ return (u.i[1] == i && u.i[0] == j);
+}
+
+void
+dpd_tests (void)
+{
+ if (! compare32 (0.DF, 0x22500000U))
+ FAILURE
+ if (! compare32 (-0.DF, 0xa2500000U))
+ FAILURE
+ if (! compare32 (0.E-4DF, 0x22100000U))
+ FAILURE
+ if (! compare32 (0.E-7DF, 0x21e00000U))
+ FAILURE
+ if (! compare32 (0.E+3DF, 0x22800000U))
+ FAILURE
+
+ if (! compare64 (0.DD, 0x2238000000000000ULL))
+ FAILURE
+ if (! compare64 (-0.DD, 0xa238000000000000ULL))
+ FAILURE
+ if (! compare64 (0.E-6DD, 0x2220000000000000ULL))
+ FAILURE
+ if (! compare64 (0.E-7DD, 0x221c000000000000ULL))
+ FAILURE
+ if (! compare64 (0.E+2DD, 0x2240000000000000ULL))
+ FAILURE
+
+ if (! compare128 (0.DL, 0x2208000000000000ULL, 0x0000000000000000ULL))
+ FAILURE
+ if (! compare128 (-0.DL, 0xa208000000000000ULL, 0x0000000000000000ULL))
+ FAILURE
+ if (! compare128 (0.E-3DL, 0x2207400000000000ULL, 0x0000000000000000ULL))
+ FAILURE
+ if (! compare128 (0.E-8DL, 0x2206000000000000ULL, 0x0000000000000000ULL))
+ FAILURE
+ if (! compare128 (0.E+2DL, 0x2208800000000000ULL, 0x0000000000000000ULL))
+ FAILURE
+}
+
+void
+bid_tests (void)
+{
+ if (! compare32 (0.DF, 0x32800000U))
+ FAILURE
+ if (! compare32 (-0.DF, 0xb2800000U))
+ FAILURE
+ if (! compare32 (0.E-4DF, 0x30800000U))
+ FAILURE
+ if (! compare32 (0.E-7DF, 0x2f000000U))
+ FAILURE
+ if (! compare32 (0.E+3DF, 0x34000000U))
+ FAILURE
+
+ if (! compare64 (0.DD, 0x31c0000000000000ULL))
+ FAILURE
+ if (! compare64 (-0.DD, 0xb1c0000000000000ULL))
+ FAILURE
+ if (! compare64 (0.E-6DD, 0x3100000000000000ULL))
+ FAILURE
+ if (! compare64 (0.E-7DD, 0x30e0000000000000ULL))
+ FAILURE
+ if (! compare64 (0.E+2DD, 0x3200000000000000ULL))
+ FAILURE
+
+ if (! compare128 (0.DL, 0x3040000000000000ULL, 0x0000000000000000ULL))
+ FAILURE
+ if (! compare128 (-0.DL, 0xb040000000000000ULL, 0x0000000000000000ULL))
+ FAILURE
+ if (! compare128 (0.E-3DL, 0x303a000000000000ULL, 0x0000000000000000ULL))
+ FAILURE
+ if (! compare128 (0.E-8DL, 0x3030000000000000ULL, 0x0000000000000000ULL))
+ FAILURE
+ if (! compare128 (0.E+2DL, 0x3044000000000000ULL, 0x0000000000000000ULL))
+ FAILURE
+}
+
+int
+main ()
+{
+ u32_t u32;
+
+ /* These sizes are probably always true for targets that support decimal
+ float types, but check anyway. Abort so we can fix the test. */
+ if ((sizeof (_Decimal64) != sizeof (long long))
+ || (sizeof (_Decimal128) != 2 * sizeof (long long))
+ || (sizeof (_Decimal32) != sizeof (_Decimal32)))
+ FAILURE
+
+ u32.d = 1.DF;
+
+ if (u32.i == 0x22500001)
+ {
+ big_endian = (u32.b[0] == 0x22);
+ dpd_tests ();
+ }
+ else if (u32.i == 0x32800001)
+ {
+ big_endian = (u32.b[0] == 0x32);
+ bid_tests ();
+ }
+ else
+ FAILURE /* unknown format; test problem */
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-10.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-10.c
new file mode 100644
index 000000000..3fef98a33
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-10.c
@@ -0,0 +1,107 @@
+/* This test assumes IEEE float and double. */
+
+#include "convert.h"
+
+volatile _Decimal32 sd;
+volatile _Decimal64 dd;
+volatile _Decimal128 td;
+volatile float sf;
+volatile double df;
+
+/* Conversions using denormalized float values. */
+CONVERT_VALID (111, sf, sd, 1.2e-38f, 1.2e-38df, 0.df)
+CONVERT_VALID (112, sf, sd, 1.1e-38f, 1.1e-38df, 0.df)
+CONVERT_VALID (113, sf, sd, 1.1e-40f, 1.1e-40df, 1.1e-45df)
+
+CONVERT_VALID (121, sd, sf, 1.2e-38df, 1.2e-38f, 0.f)
+CONVERT_VALID (122, sd, sf, 1.1e-38df, 1.1e-38f, 0.f)
+
+CONVERT_VALID (131, sf, sd, -1.2e-38f, -1.2e-38df, 0.df)
+CONVERT_VALID (132, sf, sd, -1.1e-38f, -1.1e-38df, 0.df)
+
+CONVERT_VALID (141, sd, sf, -1.2e-38df, -1.2e-38f, 0.f)
+CONVERT_VALID (142, sd, sf, -1.1e-38df, -1.1e-38f, 0.f)
+
+/* Conversions using denormalized double values. */
+CONVERT_VALID (211, df, sd, 1.2e-38, 1.2e-38df, 0.df)
+CONVERT_VALID (212, df, sd, 1.1e-38, 1.1e-38df, 0.df)
+CONVERT_VALID (213, df, sd, 1.e-40, 1.e-40df, 0.df)
+CONVERT_VALID (214, df, sd, 8.e-44, 8.e-44df, 0.df)
+CONVERT_VALID (215, df, sd, 9.e-44, 9.e-44df, 0.df)
+CONVERT_VALID (216, df, sd, 8.e-46, 8.e-46df, 0.df)
+CONVERT_VALID (217, df, sd, 7.e-46, 7.e-46df, 0.df)
+
+CONVERT_VALID (221, sd, df, 1.2e-38df, 1.2e-38, 1.e-53)
+CONVERT_VALID (222, sd, df, 1.1e-38df, 1.1e-38, 1.e-53)
+CONVERT_VALID (223, sd, df, 1.e-40df, 1.e-40, 0.)
+CONVERT_VALID (224, sd, df, 8.e-44df, 8.e-44, 0.)
+CONVERT_VALID (225, sd, df, 9.e-44df, 9.e-44, 0.)
+CONVERT_VALID (226, sd, df, 8.e-46df, 8.e-46, 0.)
+CONVERT_VALID (227, sd, df, 7.e-46df, 7.e-46, 0.)
+
+CONVERT_VALID (231, df, sd, -1.2e-38, -1.2e-38df, 0.df)
+CONVERT_VALID (232, df, sd, -1.1e-38f, -1.1e-38df, 0.df)
+CONVERT_VALID (233, df, sd, -1.e-40, -1.e-40df, 0.df)
+CONVERT_VALID (234, df, sd, -8.e-44, -8.e-44df, 0.df)
+CONVERT_VALID (235, df, sd, -9.e-44, -9.e-44df, 0.df)
+CONVERT_VALID (236, df, sd, -8.e-46, -8.e-46df, 0.df)
+CONVERT_VALID (237, df, sd, -7.e-46, -7.e-46df, 0.df)
+
+CONVERT_VALID (241, sd, df, -1.2e-38df, -1.2e-38, 1.e-53)
+CONVERT_VALID (242, sd, df, -1.1e-38df, -1.1e-38, 1.e-53)
+CONVERT_VALID (243, sd, df, -1.e-40df, -1.e-40, 0.)
+CONVERT_VALID (244, sd, df, -8.e-44df, -8.e-44, 0.)
+CONVERT_VALID (245, sd, df, -9.e-44df, -9.e-44, 0.)
+CONVERT_VALID (246, sd, df, -8.e-46df, -8.e-46, 0.)
+CONVERT_VALID (247, sd, df, -7.e-46df, -7.e-46, 0.)
+
+int
+main ()
+{
+ convert_111 ();
+ convert_112 ();
+ convert_113 ();
+
+ convert_121 ();
+ convert_122 ();
+
+ convert_131 ();
+ convert_132 ();
+
+ convert_141 ();
+ convert_142 ();
+
+ convert_211 ();
+ convert_212 ();
+ convert_213 ();
+ convert_214 ();
+ convert_215 ();
+ convert_216 ();
+ convert_217 ();
+
+ convert_221 ();
+ convert_222 ();
+ convert_223 ();
+ convert_224 ();
+ convert_225 ();
+ convert_226 ();
+ convert_227 ();
+
+ convert_231 ();
+ convert_232 ();
+ convert_233 ();
+ convert_234 ();
+ convert_235 ();
+ convert_236 ();
+ convert_237 ();
+
+ convert_241 ();
+ convert_242 ();
+ convert_243 ();
+ convert_244 ();
+ convert_245 ();
+ convert_246 ();
+ convert_247 ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-11.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-11.c
new file mode 100644
index 000000000..d16919f81
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-11.c
@@ -0,0 +1,58 @@
+/* { dg-skip-if "" { ! "powerpc*-*-linux*" } { "*" } { "" } } */
+
+/* Test decimal float conversions to and from IBM 128-bit long double.
+ Checks are skipped at runtime if long double is not 128 bits.
+ Don't force 128-bit long doubles because runtime support depends
+ on glibc. */
+
+#include "convert.h"
+
+volatile _Decimal32 sd;
+volatile _Decimal64 dd;
+volatile _Decimal128 td;
+volatile float sf;
+volatile double df;
+volatile long double tf;
+
+/* A value slightly less than DEC32_MAX can be converted in both directions. */
+CONVERT_VALID (101, sd, tf, 9.999998e96df, 9.999998e96L, 1.e+81L)
+CONVERT_VALID (102, tf, sd, 9.999998e96L, 9.999998e96df, 0.df)
+
+/* A value slightly less than DBL_MAX can be converted in both directions. */
+CONVERT_VALID (201, tf, dd, 1.79768e+308l, 1.79768e+308dd, 0.dd)
+CONVERT_VALID (202, dd, tf, 1.79768e+308dd, 1.79768e+308l, 2.e292l)
+CONVERT_VALID (203, tf, td, 1.79768e+308l, 1.79768e+308dl, 1.e292dl)
+CONVERT_VALID (204, td, tf, 1.79768e+308dl, 1.79768e+308l, 2.e292l)
+
+/* Check values that are too large for the result type. */
+CONVERT_TO_PINF (301, dd, tf, 1.8e+308dd, l)
+CONVERT_TO_PINF (302, dd, tf, 9.9e+384dd, l)
+CONVERT_TO_PINF (303, td, tf, 1.8e+308dl, l)
+CONVERT_TO_PINF (304, td, tf, 9.9e+384dl, l)
+
+CONVERT_TO_PINF (311, tf, sd, 1.0e+97L, d32)
+CONVERT_TO_PINF (312, tf, sd, 1.6e+308L, d32)
+
+int
+main ()
+{
+ if (sizeof (long double) != 16)
+ return 0;
+
+ convert_101 ();
+ convert_102 ();
+
+ convert_201 ();
+ convert_202 ();
+ convert_203 ();
+ convert_204 ();
+
+ convert_301 ();
+ convert_302 ();
+ convert_303 ();
+ convert_304 ();
+ convert_311 ();
+ convert_312 ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-12.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-12.c
new file mode 100644
index 000000000..7a909552a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-12.c
@@ -0,0 +1,16 @@
+/* Test for bug where fold wrongly removed conversions to double and
+ replaced them by conversions to float. */
+
+#include "dfp-dbg.h"
+
+volatile float f = __builtin_inff ();
+volatile _Decimal32 d32 = 1e40DF;
+
+int
+main (void)
+{
+ if ((double) f == (double) d32)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-13.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-13.c
new file mode 100644
index 000000000..259cc745c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-13.c
@@ -0,0 +1,18 @@
+/* Test for bug where fold changed binary operation to decimal
+ depending on typedefs. */
+
+#include "dfp-dbg.h"
+
+volatile double d = 1.2345675;
+
+typedef const volatile _Decimal32 d32;
+
+int
+main (void)
+{
+ _Decimal32 a = (d * d);
+ d32 b = (d * d);
+ if (a != b)
+ FAILURE
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-14.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-14.c
new file mode 100644
index 000000000..858c92980
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-14.c
@@ -0,0 +1,15 @@
+/* Test for bug where fold narrowed decimal floating-point
+ operations. */
+
+#include "dfp-dbg.h"
+
+volatile _Decimal32 f = 1.23456DF;
+volatile _Decimal64 d = 1.23456DD;
+
+int
+main (void)
+{
+ if ((double)((_Decimal64)f * (_Decimal64)f) != (double)(d * d))
+ FAILURE
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-2.c
new file mode 100644
index 000000000..463d27f35
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-2.c
@@ -0,0 +1,33 @@
+/* This test assumes IEEE float and double. It also tests long double
+ but makes no assumption about its size or range of values. */
+
+#include "convert.h"
+
+volatile _Decimal32 sd;
+volatile _Decimal64 dd;
+volatile _Decimal128 td;
+volatile float sf;
+volatile double df;
+volatile long double tf; /* might actually be df or xf, doesn't matter */
+
+CONVERT_VALID_ALL (t1, 0.0, 0.)
+CONVERT_VALID_ALL (t2, 1.0, 0.)
+CONVERT_VALID_ALL (t3, -11.5, 0.)
+CONVERT_VALID_ALL (t4, 7.0, 0.1e-14)
+CONVERT_VALID_ALL (t5, -7.0, 0.1e-14)
+CONVERT_VALID_ALL (t6, 999999., 0.)
+CONVERT_VALID_ALL (t7, -999999., 0.)
+
+int
+main ()
+{
+ CALL_VALID_ALL (t1)
+ CALL_VALID_ALL (t2)
+ CALL_VALID_ALL (t3)
+ CALL_VALID_ALL (t4)
+ CALL_VALID_ALL (t5)
+ CALL_VALID_ALL (t6)
+ CALL_VALID_ALL (t7)
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-3.c
new file mode 100644
index 000000000..3e1d9d57a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-3.c
@@ -0,0 +1,21 @@
+/* This test assumes IEEE float and double. It also tests long double
+ but makes no assumption about its size or range of values. */
+
+#include "convert.h"
+
+volatile _Decimal32 sd;
+volatile _Decimal64 dd;
+volatile _Decimal128 td;
+volatile float sf;
+volatile double df;
+volatile long double tf; /* might actually be df or xf, doesn't matter */
+
+CONVERT_ZEROES_ALL (t);
+
+int
+main ()
+{
+ CALL_ZEROES_ALL (t)
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-4.c
new file mode 100644
index 000000000..b97b9c6cb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-4.c
@@ -0,0 +1,21 @@
+/* This test assumes IEEE float and double. It also tests long double
+ but makes no assumption about its size or range of values. */
+
+#include "convert.h"
+
+volatile _Decimal32 sd;
+volatile _Decimal64 dd;
+volatile _Decimal128 td;
+volatile float sf;
+volatile double df;
+volatile long double tf; /* might actually be df or xf, doesn't matter */
+
+CONVERT_INF_ALL (t);
+
+int
+main ()
+{
+ CALL_INF_ALL (t)
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-5.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-5.c
new file mode 100644
index 000000000..ada2d352c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-5.c
@@ -0,0 +1,21 @@
+/* This test assumes IEEE float and double. It also tests long double
+ but makes no assumption about its size or range of values. */
+
+#include "convert.h"
+
+volatile _Decimal32 sd;
+volatile _Decimal64 dd;
+volatile _Decimal128 td;
+volatile float sf;
+volatile double df;
+volatile long double tf; /* might actually be df or xf, doesn't matter */
+
+CONVERT_NAN_ALL (t);
+
+int
+main ()
+{
+ CALL_NAN_ALL (t)
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-6.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-6.c
new file mode 100644
index 000000000..64198a95f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-6.c
@@ -0,0 +1,178 @@
+/* { dg-xfail-run-if "" { lax_strtofp } "*" "" } */
+/* { dg-options "-w" } */
+
+/* This test assumes IEEE float and double. */
+
+#define __STDC_WANT_DEC_FP__
+#include <float.h>
+
+#include "convert.h"
+
+volatile _Decimal32 sd;
+volatile _Decimal64 dd;
+volatile _Decimal128 td;
+volatile float sf;
+volatile double df;
+volatile long double tf;
+
+CONVERT_VALID (101, td, sf, 0.000488281251dl, 0.00048828125f, 0.f)
+
+/* 2**(-25) = 0.298023223876953125E-7. */
+CONVERT_VALID (102, td, sf, 2.98023223876953125e-8dl, 2.9802322387695312e-08f,
+ 01.e-13f)
+
+/* Fractional part doesn't fit. */
+CONVERT_VALID (103, df, sd, 1.0e-20, 1.0e-20df, 0.df)
+
+/* Exact power of 2. */
+CONVERT_VALID (104, df, sd, 0.00048828125, 0.00048828125df, 0.df)
+CONVERT_VALID (105, df, sd, 1.0e-96, 0.dd, DEC32_MIN)
+
+/* A value slightly less than FLT_MAX can be converted in both directions. */
+CONVERT_VALID (201, sf, sd, 3.402819e+38f, 3.402819e+38df, 0.df)
+CONVERT_VALID (202, sd, sf, 3.402819e+38df, 3.402819e+38f, 0.f)
+CONVERT_VALID (203, sf, dd, 3.402819e+38f, 3.402819e+38dd, 1.e+30dd)
+CONVERT_VALID (204, dd, sf, 3.402819e+38dd, 3.402819e+38f, 0.f)
+CONVERT_VALID (205, sf, td, 3.402819e+38f, 3.402819e+38dl, 1.e+30dl)
+CONVERT_VALID (206, td, sf, 3.402819e+38dl, 3.402819e+38f, 0.f)
+
+/* A value slightly less than DEC32_MAX can be converted in both directions. */
+CONVERT_VALID (211, sd, df, 9.999998e96df, 9.999998e96, 0.)
+CONVERT_VALID (212, df, sd, 9.999998e96, 9.999998e96df, 0.df)
+
+/* A value slightly less than DBL_MAX can be converted in both directions. */
+CONVERT_VALID (221, df, dd, 1.79768e+308, 1.79768e+308dd, 0.dd)
+CONVERT_VALID (222, dd, df, 1.79768e+308dd, 1.79768e+308, 0.)
+CONVERT_VALID (223, df, td, 1.79768e+308, 1.79768e+308dl, 1.e292dl)
+CONVERT_VALID (224, td, df, 1.79768e+308dl, 1.79768e+308, 0.)
+
+/* An integral value with 6 digits (FLT_DIG) can be converted between float
+ and _Decimal32 in both directions. */
+CONVERT_VALID (301, sd, sf, 100000.DF, 100000.F, 0.F)
+CONVERT_VALID (302, sf, sd, 100000.F, 100000.DF, 0.DF)
+CONVERT_VALID (303, sd, sf, 999999.DF, 999999.F, 0.F)
+CONVERT_VALID (304, sf, sd, 999999.F, 999999.DF, 0.DF)
+
+/* An integral value with 7 digits (DEC32_MANT_DIG) can be converted between
+ _Decimal32 and double in both directions. */
+CONVERT_VALID (311, sd, df, 1000000.DF, 1000000., 0.)
+CONVERT_VALID (312, df, sd, 1000000., 1000000.DF, 0.DF)
+CONVERT_VALID (313, sd, df, 9999999.DF, 9999999., 0.)
+CONVERT_VALID (314, df, sd, 9999999., 9999999.DF, 0.DF)
+
+/* An integral value with 15 digits (DBL_DIG) can be converted between
+ double and _Decimal64 in both directions. */
+CONVERT_VALID (321, dd, df, 100000000000000.DD, 100000000000000., 0.)
+CONVERT_VALID (322, df, dd, 100000000000000., 100000000000000.DD, 0.DD);
+CONVERT_VALID (323, dd, df, 999999999999999.DD, 999999999999999., 0.);
+CONVERT_VALID (324, df, dd, 999999999999999., 999999999999999.DD, 0.DD);
+
+/* If LDBL_DIG is at least 16, an integral value with 16 digits can be
+ converted between _Decimal64 and long double in both directions. */
+CONVERT_VALID (331, dd, tf, 1000000000000000.DD, 1000000000000000.L, 0.L)
+CONVERT_VALID (332, td, dd, 1000000000000000.L, 1000000000000000.DD, 0.DD)
+CONVERT_VALID (333, dd, tf, 9999999999999999.DD, 9999999999999999.L, 0.L)
+CONVERT_VALID (334, td, dd, 9999999999999999.L, 9999999999999999.DD, 0.DD)
+
+/* If LDBL_DIG is at least 18, an integral value with 18 digits can be
+ converted between long double and _Decimal128 in both directions. */
+CONVERT_VALID (341, td, tf, 100000000000000000.DL, 100000000000000000.L, 0.L)
+CONVERT_VALID (342, tf, td, 100000000000000000.L, 100000000000000000.DL, 0.DL)
+CONVERT_VALID (343, td, tf, 999999999999999999.DL, 999999999999999999.L, 0.L)
+CONVERT_VALID (344, tf, td, 999999999999999999.L, 999999999999999999.DL, 0.DL)
+
+/* If LDBL_DIG is at least 31, an integral value with 31 digits can be
+ converted between long double and _Decimal128 in both directions. */
+CONVERT_VALID (351, td, tf, 1000000000000000000000000000000.DL,
+ 1000000000000000000000000000000.L, 0.L)
+CONVERT_VALID (352, tf, td, 1000000000000000000000000000000.L,
+ 1000000000000000000000000000000.DL, 0.DL)
+CONVERT_VALID (353, td, tf, 9999999999999999999999999999999.DL,
+ 9999999999999999999999999999999.L, 0.L)
+CONVERT_VALID (354, tf, td, 9999999999999999999999999999999.L,
+ 9999999999999999999999999999999.DL, 0.DL)
+
+/* If LDBL_DIG is at least 33, an integral value with 33 digits can be
+ converted between long double and _Decimal128 in both directions. */
+CONVERT_VALID (361, td, tf, 100000000000000000000000000000000.DL,
+ 100000000000000000000000000000000.L, 0.L)
+CONVERT_VALID (362, tf, td, 100000000000000000000000000000000.L,
+ 100000000000000000000000000000000.DL, 0.DL)
+CONVERT_VALID (363, td, tf, 999999999999999999999999999999999.DL,
+ 999999999999999999999999999999999.L, 0.L)
+CONVERT_VALID (364, tf, td, 999999999999999999999999999999999.L,
+ 999999999999999999999999999999999.DL, 0.DL)
+
+int
+main ()
+{
+ convert_101 ();
+ convert_102 ();
+ convert_103 ();
+ convert_104 ();
+ convert_105 ();
+
+ convert_201 ();
+ convert_202 ();
+ convert_203 ();
+ convert_204 ();
+ convert_205 ();
+ convert_206 ();
+
+ convert_211 ();
+ convert_212 ();
+
+ convert_221 ();
+ convert_222 ();
+ convert_223 ();
+ convert_224 ();
+
+ convert_301 ();
+ convert_302 ();
+ convert_303 ();
+ convert_304 ();
+
+ convert_311 ();
+ convert_312 ();
+ convert_313 ();
+ convert_314 ();
+
+ convert_321 ();
+ convert_322 ();
+ convert_323 ();
+ convert_324 ();
+
+ if (LDBL_DIG >= 16)
+ {
+ convert_331 ();
+ convert_332 ();
+ convert_333 ();
+ convert_334 ();
+ }
+
+ if (LDBL_DIG >= 18)
+ {
+ convert_341 ();
+ convert_342 ();
+ convert_343 ();
+ convert_344 ();
+ }
+
+ if (LDBL_DIG >= 31)
+ {
+ convert_351 ();
+ convert_352 ();
+ convert_353 ();
+ convert_354 ();
+ }
+
+ if (LDBL_DIG >= 33)
+ {
+ convert_361 ();
+ convert_362 ();
+ convert_363 ();
+ convert_364 ();
+ }
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-7.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-7.c
new file mode 100644
index 000000000..f51d696ce
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-7.c
@@ -0,0 +1,83 @@
+/* { dg-options "-w" } */
+
+/* This test assumes IEEE float and double. */
+
+#define __STDC_WANT_DEC_FP__
+#include <float.h>
+
+#include "convert.h"
+
+volatile _Decimal32 sd;
+volatile _Decimal64 dd;
+volatile _Decimal128 td;
+volatile float sf;
+volatile double df;
+
+/* Check values that are too large for the result type. */
+CONVERT_TO_PINF (301, sd, sf, 4.e+38df, f)
+CONVERT_TO_PINF (303, dd, sf, 4.e+38dd, f)
+CONVERT_TO_PINF (302, sd, sf, 9.9e+384df, f)
+CONVERT_TO_PINF (304, dd, sf, 9.9e+384dd, f)
+CONVERT_TO_PINF (305, td, sf, 4.e+38dl, f)
+CONVERT_TO_PINF (306, td, sf, 1.e+39dl, f)
+CONVERT_TO_MINF (311, sd, sf, -4.e+38df, f)
+CONVERT_TO_MINF (312, dd, sf, -4.e+38dd, f)
+CONVERT_TO_MINF (313, sd, sf, -9.9e+384df, f)
+CONVERT_TO_MINF (314, dd, sf, -9.9e+384dd, f)
+CONVERT_TO_MINF (315, td, sf, -4.e+38dl, f)
+CONVERT_TO_MINF (316, td, sf, -1.e+39dl, f)
+
+CONVERT_TO_PINF (321, dd, df, 1.8e+308dd,)
+CONVERT_TO_PINF (322, dd, df, 9.9e+384dd,)
+CONVERT_TO_PINF (323, td, df, 1.8e+308dl,)
+CONVERT_TO_PINF (324, td, df, 9.9e+384dl,)
+CONVERT_TO_PINF (325, dd, df, 1.e309dd,)
+CONVERT_TO_PINF (326, td, df, 1.e309dl,)
+CONVERT_TO_MINF (331, dd, df, -1.8e+308dd,)
+CONVERT_TO_MINF (332, dd, df, -9.9e+384dd,)
+CONVERT_TO_MINF (333, td, df, -1.8e+308dl,)
+CONVERT_TO_MINF (334, td, df, -9.9e+384dl,)
+CONVERT_TO_MINF (335, dd, df, -1.e309dd,)
+CONVERT_TO_MINF (336, td, df, -1.e309dl,)
+
+CONVERT_TO_PINF (341, df, sd, 1.0e+97, d32)
+CONVERT_TO_PINF (342, df, sd, 1.6e+308, d32)
+CONVERT_TO_MINF (351, df, sd, -1.0e+97, d32)
+CONVERT_TO_MINF (352, df, sd, -1.6e+308, d32)
+
+int
+main ()
+{
+ convert_301 ();
+ convert_302 ();
+ convert_303 ();
+ convert_304 ();
+ convert_305 ();
+ convert_306 ();
+ convert_311 ();
+ convert_312 ();
+ convert_313 ();
+ convert_314 ();
+ convert_315 ();
+ convert_316 ();
+
+ convert_321 ();
+ convert_322 ();
+ convert_323 ();
+ convert_324 ();
+ convert_325 ();
+ convert_326 ();
+ convert_331 ();
+ convert_332 ();
+ convert_333 ();
+ convert_334 ();
+ convert_335 ();
+ convert_336 ();
+
+ convert_341 ();
+ convert_342 ();
+ convert_351 ();
+ convert_352 ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-8.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-8.c
new file mode 100644
index 000000000..532bd8613
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-8.c
@@ -0,0 +1,71 @@
+/* { dg-options "-w" } */
+
+/* This test assumes IEEE float and double. */
+
+#define __STDC_WANT_DEC_FP__
+#include <float.h>
+
+#include "convert.h"
+
+volatile _Decimal32 sd;
+volatile _Decimal64 dd;
+volatile _Decimal128 td;
+volatile float sf;
+volatile double df;
+
+/* Values slightly smaller than minimum (closest to zero) for result type. */
+CONVERT_VALID (401, sd, sf, 1.e-39df, 0.f, FLT_MIN)
+CONVERT_VALID (402, sd, sf, -1.e-39df, 0.f, FLT_MIN)
+CONVERT_VALID (403, sd, sf, 1.1e-38df, 0.f, FLT_MIN)
+CONVERT_VALID (404, sd, sf, -1.1e-38df, 0.f, FLT_MIN)
+
+CONVERT_VALID (411, dd, sf, 1.e-39dd, 0.f, FLT_MIN)
+CONVERT_VALID (412, dd, sf, -1.e-39dd, 0.f, FLT_MIN)
+CONVERT_VALID (413, dd, sf, 1.1e-38dd, 0.f, FLT_MIN)
+CONVERT_VALID (414, dd, sf, -1.1e-38dd, 0.f, FLT_MIN)
+
+CONVERT_VALID (421, dd, df, 3.e-309dd, 0., DBL_MIN)
+CONVERT_VALID (422, dd, df, -3.e-309dd, 0., DBL_MIN)
+CONVERT_VALID (423, dd, df, 2.e-308dd, 0., DBL_MIN)
+CONVERT_VALID (424, dd, df, -2.e-308dd, 0., DBL_MIN)
+
+CONVERT_VALID (431, td, sf, 1.e-39dl, 0.f, FLT_MIN)
+CONVERT_VALID (432, td, sf, -1.e-39dl, 0.f, FLT_MIN)
+CONVERT_VALID (433, td, sf, 1.1e-38dl, 0.f, FLT_MIN)
+CONVERT_VALID (434, td, sf, -1.1e-38dl, 0.f, FLT_MIN)
+
+CONVERT_VALID (441, td, df, 3.e-309dl, 0., DBL_MIN)
+CONVERT_VALID (442, td, df, -3.e-309dl, 0., DBL_MIN)
+CONVERT_VALID (443, td, df, 2.e-308dl, 0., DBL_MIN)
+CONVERT_VALID (444, td, df, -2.e-308dl, 0., DBL_MIN)
+
+int
+main ()
+{
+ convert_401 ();
+ convert_402 ();
+ convert_403 ();
+ convert_404 ();
+
+ convert_411 ();
+ convert_412 ();
+ convert_413 ();
+ convert_414 ();
+
+ convert_421 ();
+ convert_422 ();
+ convert_423 ();
+ convert_424 ();
+
+ convert_431 ();
+ convert_432 ();
+ convert_433 ();
+ convert_434 ();
+
+ convert_441 ();
+ convert_442 ();
+ convert_443 ();
+ convert_444 ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-9.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-9.c
new file mode 100644
index 000000000..e60908752
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-9.c
@@ -0,0 +1,192 @@
+/* { dg-xfail-run-if "" { lax_strtofp } "*" "" } */
+/* { dg-options "-w" } */
+
+/* This test assumes IEEE float and double. */
+
+#define __STDC_WANT_DEC_FP__
+#include <float.h>
+
+#include "convert.h"
+
+volatile _Decimal32 sd;
+volatile _Decimal64 dd;
+volatile _Decimal128 td;
+volatile float sf;
+volatile double df;
+
+/* Exponent values that might cause problems with a particular
+ implementation. */
+
+CONVERT_VALID (101, dd, df, 1.e309dd, 1.e309, 0.)
+CONVERT_VALID (102, dd, df, 1.e308dd, 1.e308, 0.)
+CONVERT_VALID (103, dd, df, 1.e307dd, 1.e307, 0.)
+CONVERT_VALID (104, dd, df, 1.e306dd, 1.e306, 0.)
+CONVERT_VALID (105, dd, df, 1.e305dd, 1.e305, 0.)
+CONVERT_VALID (106, dd, df, 1.e304dd, 1.e304, 0.)
+CONVERT_VALID (107, dd, df, 1.e303dd, 1.e303, 0.)
+CONVERT_VALID (108, dd, df, 1.e302dd, 1.e302, 0.)
+CONVERT_VALID (109, dd, df, 1.e301dd, 1.e301, 0.)
+CONVERT_VALID (110, dd, df, 1.e300dd, 1.e300, 0.)
+CONVERT_VALID (111, dd, df, 1.e299dd, 1.e299, 0.)
+CONVERT_VALID (112, dd, df, 1.e298dd, 1.e298, 0.)
+CONVERT_VALID (113, dd, df, 1.e297dd, 1.e297, 0.)
+CONVERT_VALID (114, dd, df, 1.e296dd, 1.e296, 0.)
+CONVERT_VALID (115, dd, df, 1.e295dd, 1.e295, 0.)
+CONVERT_VALID (116, dd, df, 1.e294dd, 1.e294, 0.)
+CONVERT_VALID (117, dd, df, 1.e293dd, 1.e293, 0.)
+CONVERT_VALID (118, dd, df, 1.e292dd, 1.e292, 0.)
+CONVERT_VALID (119, dd, df, 1.e291dd, 1.e291, 0.)
+CONVERT_VALID (120, dd, df, 1.e290dd, 1.e290, 0.)
+
+CONVERT_VALID (201, dd, df, 1.e-309dd, 1.e-309, 0.)
+CONVERT_VALID (202, dd, df, 1.e-308dd, 1.e-308, 0.)
+CONVERT_VALID (203, dd, df, 1.e-307dd, 1.e-307, 0.)
+CONVERT_VALID (204, dd, df, 1.e-306dd, 1.e-306, 0.)
+CONVERT_VALID (205, dd, df, 1.e-305dd, 1.e-305, 0.)
+CONVERT_VALID (206, dd, df, 1.e-304dd, 1.e-304, 0.)
+CONVERT_VALID (207, dd, df, 1.e-303dd, 1.e-303, 0.)
+CONVERT_VALID (208, dd, df, 1.e-302dd, 1.e-302, 0.)
+CONVERT_VALID (209, dd, df, 1.e-301dd, 1.e-301, 0.)
+CONVERT_VALID (210, dd, df, 1.e-300dd, 1.e-300, 0.)
+CONVERT_VALID (211, dd, df, 1.e-299dd, 1.e-299, 0.)
+CONVERT_VALID (212, dd, df, 1.e-298dd, 1.e-298, 0.)
+CONVERT_VALID (213, dd, df, 1.e-297dd, 1.e-297, 0.)
+CONVERT_VALID (214, dd, df, 1.e-296dd, 1.e-296, 0.)
+CONVERT_VALID (215, dd, df, 1.e-295dd, 1.e-295, 0.)
+CONVERT_VALID (216, dd, df, 1.e-294dd, 1.e-294, 0.)
+CONVERT_VALID (217, dd, df, 1.e-293dd, 1.e-293, 0.)
+CONVERT_VALID (218, dd, df, 1.e-292dd, 1.e-292, 0.)
+CONVERT_VALID (219, dd, df, 1.e-291dd, 1.e-291, 0.)
+CONVERT_VALID (220, dd, df, 1.e-290dd, 1.e-290, 0.)
+
+CONVERT_VALID (301, td, df, 1.e309dl, 1.e309, 0.)
+CONVERT_VALID (302, td, df, 1.e308dl, 1.e308, 0.)
+CONVERT_VALID (303, td, df, 1.e307dl, 1.e307, 0.)
+CONVERT_VALID (304, td, df, 1.e306dl, 1.e306, 0.)
+CONVERT_VALID (305, td, df, 1.e305dl, 1.e305, 0.)
+CONVERT_VALID (306, td, df, 1.e304dl, 1.e304, 0.)
+CONVERT_VALID (307, td, df, 1.e303dl, 1.e303, 0.)
+CONVERT_VALID (308, td, df, 1.e302dl, 1.e302, 0.)
+CONVERT_VALID (309, td, df, 1.e301dl, 1.e301, 0.)
+CONVERT_VALID (310, td, df, 1.e300dl, 1.e300, 0.)
+CONVERT_VALID (311, td, df, 1.e299dl, 1.e299, 0.)
+CONVERT_VALID (312, td, df, 1.e298dl, 1.e298, 0.)
+CONVERT_VALID (313, td, df, 1.e297dl, 1.e297, 0.)
+CONVERT_VALID (314, td, df, 1.e296dl, 1.e296, 0.)
+CONVERT_VALID (315, td, df, 1.e295dl, 1.e295, 0.)
+CONVERT_VALID (316, td, df, 1.e294dl, 1.e294, 0.)
+CONVERT_VALID (317, td, df, 1.e293dl, 1.e293, 0.)
+CONVERT_VALID (318, td, df, 1.e292dl, 1.e292, 0.)
+CONVERT_VALID (319, td, df, 1.e291dl, 1.e291, 0.)
+CONVERT_VALID (320, td, df, 1.e290dl, 1.e290, 0.)
+
+CONVERT_VALID (401, td, df, 1.e-309dl, 1.e-309, 0.)
+CONVERT_VALID (402, td, df, 1.e-308dl, 1.e-308, 0.)
+CONVERT_VALID (403, td, df, 1.e-307dl, 1.e-307, 0.)
+CONVERT_VALID (404, td, df, 1.e-306dl, 1.e-306, 0.)
+CONVERT_VALID (405, td, df, 1.e-305dl, 1.e-305, 0.)
+CONVERT_VALID (406, td, df, 1.e-304dl, 1.e-304, 0.)
+CONVERT_VALID (407, td, df, 1.e-303dl, 1.e-303, 0.)
+CONVERT_VALID (408, td, df, 1.e-302dl, 1.e-302, 0.)
+CONVERT_VALID (409, td, df, 1.e-301dl, 1.e-301, 0.)
+CONVERT_VALID (410, td, df, 1.e-300dl, 1.e-300, 0.)
+CONVERT_VALID (411, td, df, 1.e-299dl, 1.e-299, 0.)
+CONVERT_VALID (412, td, df, 1.e-298dl, 1.e-298, 0.)
+CONVERT_VALID (413, td, df, 1.e-297dl, 1.e-297, 0.)
+CONVERT_VALID (414, td, df, 1.e-296dl, 1.e-296, 0.)
+CONVERT_VALID (415, td, df, 1.e-295dl, 1.e-295, 0.)
+CONVERT_VALID (416, td, df, 1.e-294dl, 1.e-294, 0.)
+CONVERT_VALID (417, td, df, 1.e-293dl, 1.e-293, 0.)
+CONVERT_VALID (418, td, df, 1.e-292dl, 1.e-292, 0.)
+CONVERT_VALID (419, td, df, 1.e-291dl, 1.e-291, 0.)
+CONVERT_VALID (420, td, df, 1.e-290dl, 1.e-290, 0.)
+
+int
+main ()
+{
+ convert_101 ();
+ convert_102 ();
+ convert_103 ();
+ convert_104 ();
+ convert_105 ();
+ convert_106 ();
+ convert_107 ();
+ convert_108 ();
+ convert_109 ();
+ convert_110 ();
+ convert_111 ();
+ convert_112 ();
+ convert_113 ();
+ convert_114 ();
+ convert_115 ();
+ convert_116 ();
+ convert_117 ();
+ convert_118 ();
+ convert_119 ();
+ convert_120 ();
+
+ convert_201 ();
+ convert_202 ();
+ convert_203 ();
+ convert_204 ();
+ convert_205 ();
+ convert_206 ();
+ convert_207 ();
+ convert_208 ();
+ convert_209 ();
+ convert_210 ();
+ convert_211 ();
+ convert_212 ();
+ convert_213 ();
+ convert_214 ();
+ convert_215 ();
+ convert_216 ();
+ convert_217 ();
+ convert_218 ();
+ convert_219 ();
+ convert_220 ();
+
+ convert_301 ();
+ convert_302 ();
+ convert_303 ();
+ convert_304 ();
+ convert_305 ();
+ convert_306 ();
+ convert_307 ();
+ convert_308 ();
+ convert_309 ();
+ convert_310 ();
+ convert_311 ();
+ convert_312 ();
+ convert_313 ();
+ convert_314 ();
+ convert_315 ();
+ convert_316 ();
+ convert_317 ();
+ convert_318 ();
+ convert_319 ();
+ convert_320 ();
+
+ convert_401 ();
+ convert_402 ();
+ convert_403 ();
+ convert_404 ();
+ convert_405 ();
+ convert_406 ();
+ convert_407 ();
+ convert_408 ();
+ convert_409 ();
+ convert_410 ();
+ convert_411 ();
+ convert_412 ();
+ convert_413 ();
+ convert_414 ();
+ convert_415 ();
+ convert_416 ();
+ convert_417 ();
+ convert_418 ();
+ convert_419 ();
+ convert_420 ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-fold.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-fold.c
new file mode 100644
index 000000000..d62a7e4b2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp-fold.c
@@ -0,0 +1,118 @@
+/* { dg-options "-O2" } */
+
+/* N1150 5.2 Conversions among decimal floating types and between
+ decimal floating types and generic floating types.
+ C99 6.3.1.5(4) Conversions, arithmetic operands, real floating types. */
+
+#include "dfp-dbg.h"
+
+_Decimal32 d32;
+_Decimal64 d64;
+_Decimal128 d128;
+float sf;
+double df;
+long double tf;
+
+extern void link_error (void);
+
+int
+main ()
+{
+ /* Conversions from decimal float to binary float. */
+
+ /* Conversions from _Decimal32. */
+ d32 = 2.0df;
+ sf = d32;
+ if (sf != 2.0f)
+ link_error ();
+
+ df = d32;
+ if (df != 2.0)
+ link_error ();
+
+ tf = d32;
+ if (tf != 2.0l)
+ link_error ();
+
+ /* Conversions from _Decimal64. */
+ d64 = -7.0dd;
+ sf = d64;
+ if (sf != -7.0f)
+ link_error ();
+
+ df = d64;
+ if (df != -7.0)
+ link_error ();
+
+ tf = d64;
+ if (tf != -7.0l)
+ link_error ();
+
+ /* Conversions from _Decimal128. */
+ d128 = 30.0dl;
+ sf = d128;
+ if (sf != 30.0f)
+ link_error ();
+
+ df = d128;
+ if (df != 30.0)
+ link_error ();
+
+ df = d128;
+ if (df != 30.0l)
+ link_error ();
+
+ /* Conversions from binary float to decimal float. */
+ sf = 30.0f;
+ d128 = sf;
+ if (d128 != 30.0dl)
+ link_error ();
+
+ d64 = sf;
+ if (d64 != 30.0dd)
+ link_error ();
+
+ d32 = sf;
+ if (d32 != 30.0df)
+ link_error ();
+
+ df = -2.0;
+ d128 = df;
+ if (d128 != -2.0dl)
+ link_error ();
+
+ d64 = df;
+ if (d64 != -2.0dd)
+ link_error ();
+
+ d32 = df;
+ if (d32 != -2.0df)
+ link_error ();
+
+ tf = -22.0l;
+ d128 = tf;
+ if (d128 != -22.0dl)
+ link_error ();
+
+ d64 = tf;
+ if (d64 != -22.0dd)
+ link_error ();
+
+ d32 = tf;
+ if (d32 != -22.0df)
+ link_error ();
+
+ /* 2**(-11) = 0.00048828125. */
+ d128 = 0.000488281251dl;
+ sf = d128;
+ if (sf != 0.00048828125f)
+ link_error ();
+ /* 2**(-25) = 0.298023223876953125E-7. */
+ d128 = 2.98023223876953125E-8dl;
+ df = d128;
+ if (df < (2.9802322387695312e-08 - 0.00000000001)
+ || df > (2.9802322387695312e-08 + 0.00000000001))
+ link_error ();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp.c
new file mode 100644
index 000000000..710538d46
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-bfp.c
@@ -0,0 +1,131 @@
+/* N1150 5.2 Conversions among decimal floating types and between
+ decimal floating types and generic floating types.
+ C99 6.3.1.5(4) Conversions, arithmetic operands, real floating types. */
+
+/* Long double isn't supported yet at runtime, so disable those checks. */
+
+#include "dfp-dbg.h"
+
+static int skip_long_double;
+
+volatile _Decimal32 d32;
+volatile _Decimal64 d64;
+volatile _Decimal128 d128;
+volatile float sf;
+volatile double df;
+volatile long double tf;
+
+int
+main ()
+{
+ /* Conversions from decimal float to binary float. */
+
+ if (sizeof (long double) == sizeof (double))
+ skip_long_double = 1;
+
+ /* Conversions from _Decimal32. */
+ d32 = 2.0df;
+ sf = d32;
+ if (sf != 2.0f)
+ FAILURE
+
+ df = d32;
+ if (df != 2.0)
+ FAILURE
+
+ if (skip_long_double == 0)
+ {
+ tf = d32;
+ if (tf != 2.0l)
+ FAILURE
+ }
+
+ /* Conversions from _Decimal64. */
+ d64 = -7.0dd;
+ sf = d64;
+ if (sf != -7.0f)
+ FAILURE
+
+ df = d64;
+ if (df != -7.0)
+ FAILURE
+
+ if (skip_long_double == 0)
+ {
+ tf = d64;
+ if (tf != -7.0l)
+ FAILURE
+ }
+
+ /* Conversions from _Decimal128. */
+ d128 = 30.0dl;
+ sf = d128;
+ if (sf != 30.0f)
+ FAILURE
+
+ df = d128;
+ if (df != 30.0)
+ FAILURE
+
+ df = d128;
+ if (df != 30.0l)
+ FAILURE
+
+ /* Conversions from binary float to decimal float. */
+ sf = 30.0f;
+ d32 = sf;
+ if (d32 != 30.0df)
+ FAILURE
+
+ d64 = sf;
+ if (d64 != 30.0dd)
+ FAILURE
+
+ df = -2.0;
+ d32 = df;
+ if (d32 != -2.0df)
+ FAILURE
+
+ d64 = df;
+ if (d64 != -2.0dd)
+ FAILURE
+
+ d128 = df;
+ if (d128 != -2.0dl)
+ FAILURE
+
+ sf = 30.0f;
+ d128 = sf;
+ if (d128 != 30.0dl)
+ FAILURE
+
+ if (skip_long_double == 0)
+ {
+ tf = -22.0l;
+ d32 = tf;
+ if (d32 != -22.0df)
+ FAILURE
+
+ d64 = tf;
+ if (d64 != -22.0dd)
+ FAILURE
+
+ d128 = tf;
+ if (d128 != -22.0dl)
+ FAILURE
+ }
+
+ /* 2**(-11) = 0.00048828125. */
+ d128 = 0.000488281251dl;
+ sf = d128;
+ if (sf != 0.00048828125f)
+ FAILURE
+ /* 2**(-25) = 0.298023223876953125E-7. */
+ d128 = 2.98023223876953125E-8dl;
+ df = d128;
+ if (df < (2.9802322387695312e-08 - 0.00000000001)
+ || df > (2.9802322387695312e-08 + 0.00000000001))
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-dfp-fold-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-dfp-fold-2.c
new file mode 100644
index 000000000..073f7abc4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-dfp-fold-2.c
@@ -0,0 +1,15 @@
+/* Test for bug where fold narrowed decimal floating-point
+ operations. */
+
+#include "dfp-dbg.h"
+
+volatile _Decimal32 f = 1.23456DF;
+volatile _Decimal64 d = 1.23456DD;
+
+int
+main (void)
+{
+ if ((_Decimal128)((_Decimal64)f * (_Decimal64)f) != (_Decimal128)(d * d))
+ FAILURE
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-dfp-fold.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-dfp-fold.c
new file mode 100644
index 000000000..67c9d71c2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-dfp-fold.c
@@ -0,0 +1,47 @@
+/* { dg-options "-O2" } */
+
+/* N1150 5.2 Conversions among decimal floating types and between
+ decimal floating types and generic floating types.
+ C99 6.3.1.5(3) New. */
+
+#include "dfp-dbg.h"
+
+extern void link_error ();
+
+int
+main ()
+{
+ _Decimal32 d32;
+ _Decimal64 d64;
+ _Decimal128 d128;
+
+ /* Conversions to larger types. */
+ d32 = 123.4df;
+ d64 = d32;
+ if (d64 != 123.4dd)
+ link_error ();
+ d128 = d32;
+ if (d128 != 123.4dl)
+ link_error ();
+ d64 = 345.678dd;
+ d128 = d64;
+ if (d128 != 345.678dl)
+ link_error ();
+
+ /* Conversions to smaller types for which the value fits. */
+ d64 = 3456.789dd;
+ d32 = d64;
+ if (d32 != 3456.789df)
+ link_error ();
+ d128 = 123.4567dl;
+ d32 = d128;
+ if (d32 != 123.4567dl)
+ link_error ();
+
+ d128 = 1234567890.123456dl;
+ d64 = d128;
+ if (d64 != 1234567890.123456dd)
+ link_error ();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-dfp.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-dfp.c
new file mode 100644
index 000000000..d52ba51b0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-dfp.c
@@ -0,0 +1,94 @@
+/* { dg-options "-O0" } */
+
+/* N1150 5.2 Conversions among decimal floating types and between
+ decimal floating types and generic floating types.
+ C99 6.3.1.5(3) New.
+
+ Test various conversions involving decimal floating types. */
+
+#ifndef __STDC_WANT_DEC_FP__
+#define __STDC_WANT_DEC_FP__ 1
+#endif
+
+#include "dfp-dbg.h"
+#include <float.h>
+
+volatile _Decimal32 d32;
+volatile _Decimal64 d64;
+volatile _Decimal128 d128;
+
+int
+main ()
+{
+ /* Conversions to larger types. */
+ d32 = 123.4df;
+ d64 = d32;
+ if (d64 != 123.4dd)
+ FAILURE
+ d128 = d32;
+ if (d128 != 123.4dl)
+ FAILURE
+ d64 = 345.678dd;
+ d128 = d64;
+ if (d128 != 345.678dl)
+ FAILURE
+
+ /* Conversions to smaller types for which the value fits. */
+ d64 = 3456.789dd;
+ d32 = d64;
+ if (d32 != 3456.789df)
+ FAILURE
+ d128 = 123.4567dl;
+ d32 = d128;
+ if (d32 != 123.4567df)
+ FAILURE
+
+ d128 = 1234567890.123456dl;
+ d64 = d128;
+ if (d64 != 1234567890.123456dd)
+ FAILURE
+
+ /* Test demotion to non-representable decimal floating type. */
+
+ /* Assumes a default rounding mode of 'near'. This uses the rules
+ describe in the 27 July 2005 draft of IEEE 754r, which are much
+ more clear that what's described in draft 5 of N1107. */
+
+ /* Rounds to what _Decimal32 can handle. */
+ d64 = 9.99999949E96DD;
+ d32 = d64;
+ if (d32 != DEC32_MAX)
+ FAILURE
+
+ /* Rounds to more than _Decimal32 can handle. */
+ d64 = 9.9999995E96DD;
+ d32 = d64;
+ if (d32 != __builtin_infd32())
+ FAILURE
+
+ /* Rounds to what _Decimal32 can handle. */
+ d128 = 9.99999949E96DD;
+ d32 = d128;
+ if (d32 != DEC32_MAX)
+ FAILURE
+
+ /* Rounds to more than _Decimal32 can handle. */
+ d128= 9.9999995E96DD;
+ d32 = d128;
+ if (d32 != __builtin_infd32())
+ FAILURE
+
+ /* Rounds to what _Decimal64 can handle. */
+ d128 = 9.99999999999999949E384DL;
+ d64 = d128;
+ if (d64 != DEC64_MAX)
+ FAILURE
+
+ /* Rounds to more than _Decimal64 can handle. */
+ d128 = 9.9999999999999995E384DL;
+ d64 = d128;
+ if (d64 != __builtin_infd64())
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-int-fold.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-int-fold.c
new file mode 100644
index 000000000..038559d41
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-int-fold.c
@@ -0,0 +1,173 @@
+/* { dg-options "-O2" } */
+
+/* N1150 5.1 Conversion between decimal floating integer.
+ C99 6.3.1.4(1a) New.
+ These should all be folded at compile time. */
+
+#include "dfp-dbg.h"
+
+#ifdef __cplusplus
+#define BOOL bool
+#else
+#define BOOL _Bool
+#endif
+
+extern void link_error (void);
+
+int
+main ()
+{
+ _Decimal32 d32;
+ _Decimal64 d64;
+ _Decimal128 d128;
+ unsigned int ui;
+ unsigned long ul;
+ unsigned long long ull;
+ int si;
+ long sl;
+ long long sll;
+ BOOL b;
+
+ /* C99 Section 6.7.2 Type specifiers. Type _Bool is
+ mentioned in this section. Conversions between
+ BOOL and DFP types. */
+
+ /* Decimal float to unsigned integer. */
+ d32 = 456.789df;
+ d64 = 23.456789dd;
+ d128 = 1234.5678dl;
+
+ ui = d32;
+ if (ui != 456U)
+ link_error ();
+ ul = d32;
+ if (ul != 456UL)
+ link_error ();
+ ull = d32;
+ if (ull != 456ULL)
+ link_error ();
+
+ ui = d64;
+ if (ui != 23U)
+ link_error ();
+ ul = d64;
+ if (ul != 23UL)
+ link_error ();
+ ull = d64;
+ if (ull != 23ULL)
+ link_error ();
+
+ ui = d128;
+ if (ui != 1234U)
+ link_error ();
+ ul = d128;
+ if (ul != 1234UL)
+ link_error ();
+ ull = d128;
+ if (ull != 1234ULL)
+ link_error ();
+
+ /* Decimal float to signed integer. */
+
+ /* Decimal float to BOOL. */
+ d32 = 1.23df;
+ d64 = -3.4dd;
+ d128 = 0.00003dl;
+
+ b = d32;
+ if (!b)
+ link_error ();
+ b = d64;
+ if (!b)
+ link_error ();
+ b = d128;
+ if (!b)
+ link_error ();
+
+ /* Unsigned integer to decimal float. */
+ ui = 987U;
+ ul = 345678UL;
+ ull = 1234567ULL;
+
+ d32 = ui;
+ if (d32 != 987.0df)
+ link_error ();
+ d32 = ul;
+ if (d32 != 345678.0df)
+ link_error ();
+ d32 = ull;
+ if (d32 != 1234567.df)
+ link_error ();
+
+ d64 = ui;
+ if (d64 != 987.0dd)
+ link_error ();
+ d64 = ul;
+ if (d64 != 345678.0dd)
+ link_error ();
+ d64 = ull;
+ if (d64 != 1234567.dd)
+ link_error ();
+
+ d128 = ui;
+ if (d128 != 987.0dl)
+ link_error ();
+ d128 = ul;
+ if (d128 != 345678.0dl)
+ link_error ();
+ d128 = ull;
+ if (d128 != 1234567.dl)
+ link_error ();
+
+ /* Signed integer to decimal float. */
+ si = -987;
+ sl = -345678;
+ sll = -1234567;
+
+ d32 = si;
+ if (d32 != -987.0df)
+ link_error ();
+ d32 = sl;
+ if (d32 != -345678.0df)
+ link_error ();
+ d32 = sll;
+ if (d32 != -1234567.df)
+ link_error ();
+
+ d64 = si;
+ if (d64 != -987.0dd)
+ link_error ();
+ d64 = sl;
+ if (d64 != -345678.0dd)
+ link_error ();
+ d64 = sll;
+ if (d64 != -1234567.dd)
+ link_error ();
+
+ d128 = si;
+ if (d128 != -987.0dl)
+ link_error ();
+ d128 = sl;
+ if (d128 != -345678.0dl)
+ link_error ();
+ d128 = sll;
+ if (d128 != -1234567.dl)
+ link_error ();
+
+ /* BOOL to decimal float. */
+ d32 = 0.0DF;
+ d64 = 0.0DD;
+ d128 = 0.0DL;
+
+ b = d32;
+ if (b)
+ link_error ();
+ b = d64;
+ if (b)
+ link_error ();
+ b = d128;
+ if (b)
+ link_error ();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-int-max-fold.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-int-max-fold.c
new file mode 100644
index 000000000..3f6faae34
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-int-max-fold.c
@@ -0,0 +1,148 @@
+/* { dg-options "-O2 -w" } */
+
+/* N1150 5.1 Conversions from decimal float to integer. */
+
+/* Test decimal float to integer conversions for values at the limit of
+ what will fit into the destination type. This assumes 32-bit int and
+ 64-bit long long (there's a check for that below). This version tests
+ conversions during compilation. */
+
+#include "dfp-dbg.h"
+
+extern void link_error (void);
+
+void
+doit ()
+{
+ _Decimal32 d32;
+ _Decimal64 d64;
+ _Decimal128 d128;
+ int si;
+ unsigned int ui;
+ long long sll;
+ unsigned long long ull;
+
+ /* _Decimal32 to int. */
+
+ d32 = 2147483.E3DF;
+ si = d32;
+ if (si != 2147483000)
+ link_error ();
+
+ d32 = -2147483.E3DF;
+ si = d32;
+ if (si != -2147483000)
+ link_error ();
+
+ /* _Decimal32 to unsigned int. */
+
+ d32 = 4.294967E9DF;
+ ui = d32;
+ if (ui != 4294967000U)
+ link_error ();
+
+ /* _Decimal32 to long long. */
+
+ d32 = 922.3372E16DF;
+ sll = d32;
+ if (sll != 9223372000000000000LL)
+ link_error ();
+
+ d32 = -92233.72E14DF;
+ sll = d32;
+ if (sll != -9223372000000000000LL)
+ link_error ();
+
+ /* _Decimal32 to unsigned long long. */
+
+ d32 = 0.1844674E20DF;
+ ull = d32;
+ if (ull != 18446740000000000000ULL)
+ link_error ();
+
+ /* _Decimal64 to int. */
+
+ d64 = 2.147483647E9DD;
+ si = d64;
+ if (si != 2147483647)
+ link_error ();
+
+ d64 = -2147483648.DD;
+ si = d64;
+ if (si != -2147483648)
+ link_error ();
+
+ /* _Decimal64 to unsigned int. */
+
+ d64 = 42949.67295E5DD;
+ ui = d64;
+ if (ui != 4294967295)
+ link_error ();
+
+ /* _Decimal64 to long long. */
+
+ d64 = 9.223372036854775E18DD;
+ sll = d64;
+ if (sll != 9223372036854775000LL)
+ link_error ();
+
+ d64 = -92233720.36854775E11DD;
+ sll = d64;
+ if (sll != -9223372036854775000LL)
+ link_error ();
+
+ /* _Decimal64 to unsigned long long. */
+ d64 = 1844674407370955.E4DD;
+ ull = d64;
+ if (ull != 18446744073709550000ULL)
+ link_error ();
+
+ /* _Decimal128 to int. */
+
+ d128 = 2.147483647E9DL;
+ si = d128;
+ if (si != 2147483647)
+ link_error ();
+
+ d128 = -2147483648.DL;
+ si = d128;
+ if (si != -2147483648)
+ link_error ();
+
+ /* _Decimal128 to unsigned int. */
+
+ d128 = 4294.967295E6DL;
+ ui = d128;
+ if (ui != 4294967295)
+ link_error ();
+
+ /* _Decimal128 to long long. */
+
+ d128 = 9223372036854775807.DL;
+ sll = d128;
+ if (sll != 9223372036854775807LL)
+ link_error ();
+
+ d128 = -9.223372036854775808E19DL;
+ sll = d128;
+ if (sll != -9223372036854775807LL - 1LL)
+ link_error ();
+
+ /* _Decimal128 to unsigned long long. */
+ d128 = 18446744073709551615.DL;
+ ull = d128;
+ if (ull != 18446744073709551615ULL)
+ link_error ();
+}
+
+int
+main ()
+{
+ /* This test assumes 32-bit int and 64-bit long long. */
+
+ if (sizeof (int) != 4 || sizeof (long long) != 8)
+ return 0;
+
+ doit ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-int-max.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-int-max.c
new file mode 100644
index 000000000..724627d37
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-int-max.c
@@ -0,0 +1,146 @@
+/* { dg-options "-O0 -w" } */
+
+/* N1150 5.1 Conversions from decimal float to integer. */
+
+/* Test decimal float to integer conversions for values at the limit of
+ what will fit into the destination type. This assumes 32-bit int and
+ 64-bit long long (there's a check for that below). */
+
+#include "dfp-dbg.h"
+
+volatile _Decimal32 d32;
+volatile _Decimal64 d64;
+volatile _Decimal128 d128;
+volatile int si;
+volatile unsigned int ui;
+volatile long long sll;
+volatile unsigned long long ull;
+
+void
+doit ()
+{
+ /* _Decimal32 to int. */
+
+ d32 = 2147483.E3DF;
+ si = d32;
+ if (si != 2147483000)
+ FAILURE
+
+ d32 = -2147483.E3DF;
+ si = d32;
+ if (si != -2147483000)
+ FAILURE
+
+ /* _Decimal32 to unsigned int. */
+
+ d32 = 4.294967E9DF;
+ ui = d32;
+ if (ui != 4294967000U)
+ FAILURE
+
+ /* _Decimal32 to long long. */
+
+ d32 = 922.3372E16DF;
+ sll = d32;
+ if (sll != 9223372000000000000LL)
+ FAILURE
+
+ d32 = -92233.72E14DF;
+ sll = d32;
+ if (sll != -9223372000000000000LL)
+ FAILURE
+
+ /* _Decimal32 to unsigned long long. */
+
+ d32 = .1844674E20DF;
+ ull = d32;
+ if (ull != 18446740000000000000ULL)
+ FAILURE
+
+ /* _Decimal64 to int. */
+
+ d64 = 2.147483647E9DD;
+ si = d64;
+ if (si != 2147483647)
+ FAILURE
+
+ d64 = -2147483648.DD;
+ si = d64;
+ if (si != -2147483648)
+ FAILURE
+
+ /* _Decimal64 to unsigned int. */
+
+ d64 = 42949.67295E5DD;
+ ui = d64;
+ if (ui != 4294967295)
+ FAILURE
+
+ /* _Decimal64 to long long. */
+
+ d64 = 9.223372036854775E18DD;
+ sll = d64;
+ if (sll != 9223372036854775000LL)
+ FAILURE
+
+ d64 = -92233720.36854775E11DD;
+ sll = d64;
+ if (sll != -9223372036854775000LL)
+ FAILURE
+
+ /* _Decimal64 to unsigned long long. */
+ d64 = 1844674407370955.E4DD;
+ ull = d64;
+ if (ull != 18446744073709550000ULL)
+ FAILURE
+
+ /* _Decimal128 to int. */
+
+ d128 = 2.147483647E9DL;
+ si = d128;
+ if (si != 2147483647)
+ FAILURE
+
+ d128 = -2147483648.DL;
+ si = d128;
+ if (si != -2147483648)
+ FAILURE
+
+ /* _Decimal128 to unsigned int. */
+
+ d128 = 4294.967295E6DL;
+ ui = d128;
+ if (ui != 4294967295)
+ FAILURE
+
+ /* _Decimal128 to long long. */
+
+ d128 = 9223372036854775807.DL;
+ sll = d128;
+ if (sll != 9223372036854775807LL)
+ FAILURE
+
+ d128 = -9.223372036854775808E19DL;
+ sll = d128;
+ if (sll != -9223372036854775807LL - 1LL)
+ FAILURE
+
+ /* _Decimal128 to unsigned long long. */
+ d128 = 18446744073709551615.DL;
+ ull = d128;
+ if (ull != 18446744073709551615ULL)
+ FAILURE
+}
+
+int
+main ()
+{
+ /* This test assumes 32-bit int and 64-bit long long. */
+
+ if (sizeof (int) != 4 || sizeof (long long) != 8)
+ return 0;
+
+ doit ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-int-saturate.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-int-saturate.c
new file mode 100644
index 000000000..c92502d56
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-int-saturate.c
@@ -0,0 +1,64 @@
+/* N1150 5.1 Conversion between decimal floating integer.
+ C99 6.3.1.4(1a) New.
+ Test integer saturation. */
+
+#ifndef __STDC_WANT_DEC_FP__
+#define __STDC_WANT_DEC_FP__ 1
+#endif
+
+#include "dfp-dbg.h"
+#include <float.h>
+#include <limits.h>
+
+volatile _Decimal32 d32;
+volatile _Decimal64 d64;
+volatile _Decimal128 d128;
+
+volatile signed int si;
+volatile unsigned int usi;
+volatile unsigned long long udi;
+
+int
+main ()
+{
+
+ /* Unsigned. */
+ usi = DEC32_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
+ if (usi != UINT_MAX)
+ FAILURE
+
+ usi = DEC64_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
+ if (usi != UINT_MAX)
+ FAILURE
+
+ usi = DEC128_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
+ if (usi != UINT_MAX)
+ FAILURE
+
+ /* Signed. */
+ si = DEC32_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
+ if (si != INT_MAX)
+ FAILURE
+
+ si = DEC64_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
+ if (si != INT_MAX)
+ FAILURE
+
+ si = DEC128_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
+ if (si != INT_MAX)
+ FAILURE
+
+ si = - DEC32_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
+ if (si != INT_MIN)
+ FAILURE
+
+ si = - DEC64_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
+ if (si != INT_MIN)
+ FAILURE
+
+ si = - DEC128_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
+ if (si != INT_MIN)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-int.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-int.c
new file mode 100644
index 000000000..1525d5760
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert-int.c
@@ -0,0 +1,199 @@
+/* { dg-options "-O0" } */
+
+/* N1150 5.1 Conversion between decimal floating types and integer.
+ C99 6.3.1.4(1a) New. */
+
+#include "dfp-dbg.h"
+
+#ifdef __cplusplus
+#define BOOL bool
+#else
+#define BOOL _Bool
+#endif
+
+_Decimal32 d32;
+_Decimal64 d64;
+_Decimal128 d128;
+unsigned int ui;
+unsigned long ul;
+unsigned long long ull;
+int si;
+long sl;
+long long sll;
+BOOL b;
+
+void
+init_dfp_1 (void)
+{
+ d32 = 456.789df;
+ d64 = 23.456789dd;
+ d128 = 1234.5678dl;
+}
+void
+init_dfp_2 (void)
+{
+ d32 = 1.23df;
+ d64 = -3.4dd;
+ d128 = 0.00003dl;
+}
+
+void
+init_dfp_3 (void)
+{
+ d32 = 0.0DF;
+ d64 = 0.0DD;
+ d128 = 0.0DL;
+}
+
+void
+init_unsigned_int (void)
+{
+ ui = 987U;
+ ul = 345678UL;
+ ull = 1234567ULL;
+}
+
+void
+init_signed_int (void)
+{
+ si = -987;
+ sl = -345678;
+ sll = -1234567;
+}
+
+int
+main ()
+{
+ /* C99 Section 6.7.2 Type specifiers. Type _Bool is
+ mentioned in this section. Conversions between
+ BOOL and DFP types. */
+
+ /* Decimal float to unsigned integer. */
+ init_dfp_1 ();
+
+ ui = d32;
+ if (ui != 456U)
+ FAILURE
+ ul = d32;
+ if (ul != 456UL)
+ FAILURE
+ ull = d32;
+ if (ull != 456ULL)
+ FAILURE
+
+ ui = d64;
+ if (ui != 23U)
+ FAILURE
+ ul = d64;
+ if (ul != 23UL)
+ FAILURE
+ ull = d64;
+ if (ull != 23ULL)
+ FAILURE
+
+ ui = d128;
+ if (ui != 1234U)
+ FAILURE
+ ul = d128;
+ if (ul != 1234UL)
+ FAILURE
+ ull = d128;
+ if (ull != 1234ULL)
+ FAILURE
+
+ /* Decimal float to signed integer. */
+
+ /* Decimal float to BOOL. */
+ init_dfp_2 ();
+
+ b = d32;
+ if (!b)
+ FAILURE
+ b = d64;
+ if (!b)
+ FAILURE
+ b = d128;
+ if (!b)
+ FAILURE
+
+ /* Unsigned integer to decimal float. */
+ init_unsigned_int ();
+
+ d32 = ui;
+ if (d32 != 987.0df)
+ FAILURE
+ d32 = ul;
+ if (d32 != 345678.0df)
+ FAILURE
+ d32 = ull;
+ if (d32 != 1234567.df)
+ FAILURE
+
+ d64 = ui;
+ if (d64 != 987.0dd)
+ FAILURE
+ d64 = ul;
+ if (d64 != 345678.0dd)
+ FAILURE
+ d64 = ull;
+ if (d64 != 1234567.dd)
+ FAILURE
+
+ d128 = ui;
+ if (d128 != 987.0dl)
+ FAILURE
+ d128 = ul;
+ if (d128 != 345678.0dl)
+ FAILURE
+ d128 = ull;
+ if (d128 != 1234567.dl)
+ FAILURE
+
+ /* Signed integer to decimal float. */
+ init_signed_int ();
+
+ d32 = si;
+ if (d32 != -987.0df)
+ FAILURE
+ d32 = sl;
+ if (d32 != -345678.0df)
+ FAILURE
+ d32 = sll;
+ if (d32 != -1234567.df)
+ FAILURE
+
+ d64 = si;
+ if (d64 != -987.0dd)
+ FAILURE
+ d64 = sl;
+ if (d64 != -345678.0dd)
+ FAILURE
+ d64 = sll;
+ if (d64 != -1234567.dd)
+ FAILURE
+
+ d128 = si;
+ if (d128 != -987.0dl)
+ FAILURE
+ d128 = sl;
+ if (d128 != -345678.0dl)
+ FAILURE
+ d128 = sll;
+ if (d128 != -1234567.dl)
+ FAILURE
+
+ /* BOOL to decimal float. */
+ init_dfp_3 ();
+
+ b = d32;
+ if (b)
+ FAILURE
+ b = d64;
+ if (b)
+ FAILURE
+ b = d128;
+ if (b)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert.h b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert.h
new file mode 100644
index 000000000..304164ff6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/convert.h
@@ -0,0 +1,462 @@
+#include "dfp-dbg.h"
+
+/* Macros are set up to skip using long double, which doesn't necessarily
+ map to TF mode. If there's a reason to skip those for a test, the
+ test itself can define USE_TF to be zero. */
+#ifndef USE_TF
+#define USE_TF 1
+#endif
+
+/* Provide more information with FAILURE than what is available with
+ the version of that macro in dfp-dbg.h. */
+
+#undef FAILURE
+#if defined(DBG) || defined(DBG2)
+#include <stdio.h>
+#define FAILURE(NUM) \
+ { printf ("failed for test %s\n", NUM); failures++; }
+#else
+#define FAILURE(N) __builtin_abort ();
+#endif
+
+/* This is useful when modifying the test to make sure that tests are
+ actually run. */
+#if defined(DBG2)
+#define REPORT(NUM) \
+ { printf ("%s\n", NUM); }
+#else
+#define REPORT(N) ;
+#endif
+
+#define CONVERT_VALID(NUM,FROM,TO,FROMVAL,TOVAL,DIFF) \
+void \
+convert_##NUM (void) \
+{ \
+ REPORT(#NUM " " #FROMVAL) \
+ FROM = FROMVAL; \
+ TO = FROM; \
+ if (TO < (TOVAL - DIFF) || TO > (TOVAL + DIFF)) \
+ FAILURE (#NUM); \
+}
+
+#define CONVERT_TO_PINF(NUM,FROM,TO,FROMVAL,TOSUFFIX) \
+void \
+convert_##NUM (void) \
+{ \
+ REPORT(#NUM " " #FROMVAL) \
+ FROM = FROMVAL; \
+ TO = FROM; \
+ if (__builtin_isinf##TOSUFFIX (TO) == 0) \
+ FAILURE (#NUM " pinf: isinf"); \
+ if (__builtin_signbit##TOSUFFIX (TO) != 0) \
+ FAILURE (#NUM " pinf: sign"); \
+}
+
+#define CONVERT_TO_MINF(NUM,FROM,TO,FROMVAL,TOSUFFIX) \
+void \
+convert_##NUM (void) \
+{ \
+ REPORT(#NUM " " #FROMVAL) \
+ FROM = FROMVAL; \
+ TO = FROM; \
+ if (__builtin_isinf##TOSUFFIX (TO) == 0) \
+ FAILURE (#NUM " pinf: isinf"); \
+ if (__builtin_signbit##TOSUFFIX (TO) == 0) \
+ FAILURE (#NUM " pinf: sign"); \
+}
+
+#define CONVERT_TO_PZERO(NUM,FROM,TO,FROMVAL,TOVAL,TOSUFFIX) \
+void \
+convert_##NUM (void) \
+{ \
+ REPORT(#NUM " " #FROMVAL) \
+ FROM = FROMVAL; \
+ TO = FROM; \
+ if (TO != TOVAL) \
+ FAILURE (#NUM "_pzero: zero") \
+ if (__builtin_signbit##TOSUFFIX (TO) != 0) \
+ FAILURE (#NUM " _pzero: sign"); \
+}
+
+#define CONVERT_TO_MZERO(NUM,FROM,TO,FROMVAL,TOVAL,TOSUFFIX) \
+void \
+convert_##NUM (void) \
+{ \
+ REPORT(#NUM " " #FROMVAL) \
+ FROM = FROMVAL; \
+ TO = FROM; \
+ if (TO != TOVAL) \
+ FAILURE (#NUM "_mzero: zero") \
+ if (__builtin_signbit##TOSUFFIX (TO) == 0) \
+ FAILURE (#NUM " _mzero: sign"); \
+}
+
+#define CONVERT_NAN(NUM,FROM,TO,FROMSUFFIX,TOSUFFIX) \
+void \
+convert_##NUM##_nan (void) \
+{ \
+ REPORT(#NUM "_nan") \
+ FROM = __builtin_nan##FROMSUFFIX (""); \
+ TO = FROM; \
+ if (__builtin_isnan##TOSUFFIX (TO) == 0) \
+ FAILURE (#NUM " nan"); \
+}
+
+#define CONVERT_PINF(NUM,FROM,TO,FROMSUFFIX,TOSUFFIX) \
+void \
+convert_##NUM##_pinf (void) \
+{ \
+ REPORT (#NUM "_pinf") \
+ FROM = __builtin_inf##FROMSUFFIX (); \
+ TO = FROM; \
+ if (__builtin_isinf##TOSUFFIX (TO) == 0) \
+ FAILURE (#NUM " pinf: isinf"); \
+ if (__builtin_signbit##TOSUFFIX (TO) != 0) \
+ FAILURE (#NUM " pinf: sign"); \
+}
+
+#define CONVERT_MINF(NUM,FROM,TO,FROMSUFFIX,TOSUFFIX) \
+void \
+convert_##NUM##_minf (void) \
+{ \
+ REPORT (#NUM "_minf") \
+ FROM = -__builtin_inf##FROMSUFFIX (); \
+ TO = FROM; \
+ if (__builtin_isinf##TOSUFFIX (TO) == 0) \
+ FAILURE (#NUM " minf: isinf"); \
+ if (__builtin_signbit##TOSUFFIX (TO) == 0) \
+ FAILURE (#NUM " minf: sign"); \
+}
+
+#define CONVERT_PZERO(NUM,FROM,TO,FROMVALUE,TOVALUE,TOSUFFIX) \
+void \
+convert_##NUM##_pzero (void) \
+{ \
+ REPORT (#NUM "_pzero") \
+ FROM = FROMVALUE; \
+ TO = FROM; \
+ if (TO != TOVALUE) \
+ FAILURE (#NUM "pzero: zero") \
+ if (__builtin_signbit##TOSUFFIX (TO) != 0) \
+ FAILURE (#NUM " pzero: sign"); \
+}
+
+#define CONVERT_MZERO(NUM,FROM,TO,FROMVALUE,TOVALUE,TOSUFFIX) \
+void \
+convert_##NUM##_mzero (void) \
+{ \
+ REPORT (#NUM "_mzero") \
+ FROM = FROMVALUE; \
+ TO = FROM; \
+ if (TO != TOVALUE) \
+ FAILURE (#NUM "mzero: zero") \
+ if (__builtin_signbit##TOSUFFIX (TO) == 0) \
+ FAILURE (#NUM " mzero: sign"); \
+}
+
+#define CONVERT_VALID_NOTF(NUM,VAL,DIFF) \
+CONVERT_VALID (NUM##_sdsf, sd, sf, VAL##df, VAL##f, DIFF##f) \
+CONVERT_VALID (NUM##_sddf, sd, df, VAL##df, VAL, DIFF) \
+CONVERT_VALID (NUM##_ddsf, dd, sf, VAL##dd, VAL##f, DIFF##f) \
+CONVERT_VALID (NUM##_dddf, dd, df, VAL##dd, VAL, DIFF) \
+CONVERT_VALID (NUM##_tdsf, td, sf, VAL##dl, VAL##f, DIFF##f) \
+CONVERT_VALID (NUM##_tddf, td, df, VAL##dl, VAL, DIFF) \
+CONVERT_VALID (NUM##_sfsd, sf, sd, VAL##f, VAL##df, DIFF##df) \
+CONVERT_VALID (NUM##_sfdd, sf, dd, VAL##f, VAL##dd, DIFF##dd) \
+CONVERT_VALID (NUM##_sftd, sf, td, VAL##f, VAL##dl, DIFF##dl) \
+CONVERT_VALID (NUM##_dfsd, df, sd, VAL, VAL##df, DIFF##df) \
+CONVERT_VALID (NUM##_dfdd, df, dd, VAL, VAL##dd, DIFF##dd) \
+CONVERT_VALID (NUM##_dftd, df, td, VAL, VAL##dl, DIFF##dl) \
+CONVERT_VALID (NUM##_sddd, sd, dd, VAL##df, VAL##dd, DIFF##dd) \
+CONVERT_VALID (NUM##_sdtd, sd, dd, VAL##df, VAL##dd, DIFF##dd) \
+CONVERT_VALID (NUM##_ddsd, dd, sd, VAL##dd, VAL##df, DIFF##dd) \
+CONVERT_VALID (NUM##_ddtd, dd, td, VAL##dd, VAL##dl, DIFF##dl) \
+CONVERT_VALID (NUM##_tdsd, td, sd, VAL##dl, VAL##df, DIFF##df) \
+CONVERT_VALID (NUM##_tddd, td, dd, VAL##dl, VAL##dd, DIFF##dd)
+
+#if USE_TF == 0
+#define CONVERT_VALID_TF(NUM,VAL,DIFF)
+#else
+#define CONVERT_VALID_TF(NUM,VAL,DIFF) \
+CONVERT_VALID (NUM##_sdtf, sd, tf, VAL##df, VAL##l, DIFF##l) \
+CONVERT_VALID (NUM##_tdtf, td, tf, VAL##dl, VAL##l, DIFF##l) \
+CONVERT_VALID (NUM##_ddtf, dd, tf, VAL##dd, VAL##l, DIFF##l) \
+CONVERT_VALID (NUM##_tfsd, tf, sd, VAL##l, VAL##df, DIFF##df) \
+CONVERT_VALID (NUM##_tfdd, tf, dd, VAL##l, VAL##dd, DIFF##dd) \
+CONVERT_VALID (NUM##_tftd, tf, td, VAL##l, VAL##dl, DIFF##dl)
+#endif
+
+#define CONVERT_VALID_ALL(NUM,VAL,DIFF) \
+ CONVERT_VALID_NOTF(NUM,VAL,DIFF) \
+ CONVERT_VALID_TF(NUM,VAL,DIFF)
+
+#define CALL_VALID_NOTF(NUM) \
+ convert_##NUM##_sdsf (); \
+ convert_##NUM##_sddf (); \
+ convert_##NUM##_ddsf (); \
+ convert_##NUM##_dddf (); \
+ convert_##NUM##_tdsf (); \
+ convert_##NUM##_tddf (); \
+ convert_##NUM##_sfsd (); \
+ convert_##NUM##_sfdd (); \
+ convert_##NUM##_sftd (); \
+ convert_##NUM##_dfsd (); \
+ convert_##NUM##_dfdd (); \
+ convert_##NUM##_dftd (); \
+ convert_##NUM##_sddd (); \
+ convert_##NUM##_sdtd (); \
+ convert_##NUM##_ddsd (); \
+ convert_##NUM##_ddtd (); \
+ convert_##NUM##_tdsd (); \
+ convert_##NUM##_tddd ();
+
+#if USE_TF == 0
+#define CALL_VALID_TF(NUM)
+#else
+#define CALL_VALID_TF(NUM) \
+ convert_##NUM##_sdtf (); \
+ convert_##NUM##_ddtf (); \
+ convert_##NUM##_tdtf (); \
+ convert_##NUM##_tfsd (); \
+ convert_##NUM##_tfdd (); \
+ convert_##NUM##_tftd ();
+#endif
+
+#define CALL_VALID_ALL(NUM) \
+ CALL_VALID_NOTF(NUM) \
+ CALL_VALID_TF(NUM)
+
+#define CONVERT_ZEROES(NUM,FROM,TO,FROMVALUE,TOVALUE,TOSUFFIX) \
+CONVERT_PZERO(NUM, FROM, TO, FROMVALUE, TOVALUE, TOSUFFIX) \
+CONVERT_MZERO(NUM, FROM, TO, -FROMVALUE, -TOVALUE, TOSUFFIX)
+
+#define CONVERT_ZEROES_NOTF(NUM) \
+CONVERT_ZEROES (NUM##_sdsf, sd, sf, 0.0df, 0.0f, f) \
+CONVERT_ZEROES (NUM##_sddf, sd, df, 0.0df, 0.0, ) \
+CONVERT_ZEROES (NUM##_ddsf, dd, sf, 0.0dd, 0.0f, f) \
+CONVERT_ZEROES (NUM##_dddf, dd, df, 0.0dd, 0.0, ) \
+CONVERT_ZEROES (NUM##_tdsf, td, sf, 0.0dl, 0.0f, f) \
+CONVERT_ZEROES (NUM##_tddf, td, df, 0.0dl, 0.0, ) \
+CONVERT_ZEROES (NUM##_sfsd, sf, sd, 0.0f, 0.0df, d32) \
+CONVERT_ZEROES (NUM##_sfdd, sf, dd, 0.0f, 0.0dd, d64) \
+CONVERT_ZEROES (NUM##_sftd, sf, td, 0.0f, 0.0dl, d128) \
+CONVERT_ZEROES (NUM##_dfsd, df, sd, 0.0, 0.0df, d32) \
+CONVERT_ZEROES (NUM##_dfdd, df, dd, 0.0, 0.0dd, d64) \
+CONVERT_ZEROES (NUM##_dftd, df, td, 0.0, 0.0dl, d128) \
+CONVERT_ZEROES (NUM##_sddd, sd, dd, 0.0df, 0.0dd, d64) \
+CONVERT_ZEROES (NUM##_sdtd, sd, td, 0.0dl, 0.0dl, d128) \
+CONVERT_ZEROES (NUM##_ddsd, dd, sd, 0.0dd, 0.0df, d32) \
+CONVERT_ZEROES (NUM##_ddtd, dd, td, 0.0dd, 0.0dl, d128) \
+CONVERT_ZEROES (NUM##_tdsd, td, sd, 0.0dl, 0.0df, d32) \
+CONVERT_ZEROES (NUM##_tddd, td, dd, 0.0dl, 0.0dd, d64)
+
+#if USE_TF == 0
+#define CONVERT_ZEROES_TF(NUM)
+#else
+#define CONVERT_ZEROES_TF(NUM) \
+CONVERT_ZEROES (NUM##_sdtf, sd, tf, 0.0df, 0.0l, l) \
+CONVERT_ZEROES (NUM##_ddtf, dd, tf, 0.0dd, 0.0l, l) \
+CONVERT_ZEROES (NUM##_tdtf, td, tf, 0.0dl, 0.0l, l) \
+CONVERT_ZEROES (NUM##_tfsd, tf, sd, 0.0l, 0.0df, d32) \
+CONVERT_ZEROES (NUM##_tfdd, tf, dd, 0.0l, 0.0dd, d64) \
+CONVERT_ZEROES (NUM##_tftd, tf, td, 0.0l, 0.0dl, d128)
+#endif
+
+#define CONVERT_ZEROES_ALL(NUM) \
+ CONVERT_ZEROES_NOTF(NUM) \
+ CONVERT_ZEROES_TF(NUM)
+
+#define CALL_ZEROES(NUM) \
+ convert_##NUM##_pzero (); \
+ convert_##NUM##_mzero ();
+
+#define CALL_ZEROES_NOTF(NUM) \
+ CALL_ZEROES (NUM##_sdsf) \
+ CALL_ZEROES (NUM##_sddf) \
+ CALL_ZEROES (NUM##_ddsf) \
+ CALL_ZEROES (NUM##_dddf) \
+ CALL_ZEROES (NUM##_tdsf) \
+ CALL_ZEROES (NUM##_tddf) \
+ CALL_ZEROES (NUM##_sfsd) \
+ CALL_ZEROES (NUM##_sfdd) \
+ CALL_ZEROES (NUM##_sftd) \
+ CALL_ZEROES (NUM##_dfsd) \
+ CALL_ZEROES (NUM##_dfdd) \
+ CALL_ZEROES (NUM##_dftd) \
+ CALL_ZEROES (NUM##_sddd) \
+ CALL_ZEROES (NUM##_sdtd) \
+ CALL_ZEROES (NUM##_ddsd) \
+ CALL_ZEROES (NUM##_ddtd) \
+ CALL_ZEROES (NUM##_tdsd) \
+ CALL_ZEROES (NUM##_tddd)
+
+#if USE_TF == 0
+#define CALL_ZEROES_TF(NUM)
+#else
+#define CALL_ZEROES_TF(NUM) \
+ CALL_ZEROES (NUM##_sdtf) \
+ CALL_ZEROES (NUM##_ddtf) \
+ CALL_ZEROES (NUM##_tdtf) \
+ CALL_ZEROES (NUM##_tfsd) \
+ CALL_ZEROES (NUM##_tfdd) \
+ CALL_ZEROES (NUM##_tftd)
+#endif
+
+#define CALL_ZEROES_ALL(NUM) \
+ CALL_ZEROES_NOTF(NUM) \
+ CALL_ZEROES_TF(NUM)
+
+#define CONVERT_INF(NUM,FROM,TO,FROMSUFFIX,TOSUFFIX) \
+CONVERT_PINF (NUM, FROM, TO, FROMSUFFIX, TOSUFFIX) \
+CONVERT_MINF (NUM, FROM, TO, FROMSUFFIX, TOSUFFIX)
+
+#define CONVERT_INF_NOTF(NUM) \
+CONVERT_INF (NUM##_sdsf, sd, sf, d32, f) \
+CONVERT_INF (NUM##_sddf, sd, df, d32, ) \
+CONVERT_INF (NUM##_ddsf, dd, sf, d64, f) \
+CONVERT_INF (NUM##_dddf, dd, df, d64, ) \
+CONVERT_INF (NUM##_tdsf, td, sf, d128, f) \
+CONVERT_INF (NUM##_tddf, td, df, d128, ) \
+CONVERT_INF (NUM##_sfsd, sf, sd, f, d32) \
+CONVERT_INF (NUM##_sfdd, sf, dd, f, d64) \
+CONVERT_INF (NUM##_sftd, sf, td, f, d128) \
+CONVERT_INF (NUM##_dfsd, df, sd, , d32) \
+CONVERT_INF (NUM##_dfdd, df, dd, , d64) \
+CONVERT_INF (NUM##_dftd, df, td, , d128) \
+CONVERT_INF (NUM##_sddd, sd, dd, d32, d64) \
+CONVERT_INF (NUM##_sdtd, sd, td, d32, d128) \
+CONVERT_INF (NUM##_ddsd, dd, sd, d64, d32) \
+CONVERT_INF (NUM##_ddtd, dd, td, d64, d128) \
+CONVERT_INF (NUM##_tdsd, td, sd, d128, d32) \
+CONVERT_INF (NUM##_tddd, td, dd, d128, d64)
+
+#if USE_TF == 0
+#define CONVERT_INF_TF(NUM)
+#else
+#define CONVERT_INF_TF(NUM) \
+CONVERT_INF (NUM##_sdtf, sd, tf, d32, l) \
+CONVERT_INF (NUM##_ddtf, dd, tf, d64, l) \
+CONVERT_INF (NUM##_tdtf, td, tf, d128, l) \
+CONVERT_INF (NUM##_tfsd, tf, sd, l, d32) \
+CONVERT_INF (NUM##_tfdd, tf, dd, l, d64) \
+CONVERT_INF (NUM##_tftd, tf, td, l, d128)
+#endif
+
+#define CONVERT_INF_ALL(NUM) \
+ CONVERT_INF_NOTF(NUM) \
+ CONVERT_INF_TF(NUM)
+
+#define CALL_INF(NUM) \
+ convert_##NUM##_pinf (); \
+ convert_##NUM##_minf ();
+
+#define CALL_INF_NOTF(NUM) \
+ CALL_INF (NUM##_sdsf) \
+ CALL_INF (NUM##_sddf) \
+ CALL_INF (NUM##_ddsf) \
+ CALL_INF (NUM##_dddf) \
+ CALL_INF (NUM##_tdsf) \
+ CALL_INF (NUM##_tddf) \
+ CALL_INF (NUM##_sfsd) \
+ CALL_INF (NUM##_sfdd) \
+ CALL_INF (NUM##_sftd) \
+ CALL_INF (NUM##_dfsd) \
+ CALL_INF (NUM##_dfdd) \
+ CALL_INF (NUM##_dftd) \
+ CALL_INF (NUM##_sddd) \
+ CALL_INF (NUM##_sdtd) \
+ CALL_INF (NUM##_ddsd) \
+ CALL_INF (NUM##_ddtd) \
+ CALL_INF (NUM##_tdsd) \
+ CALL_INF (NUM##_tddd)
+
+#if USE_TF == 0
+#define CALL_INF_TF(NUM)
+#else
+#define CALL_INF_TF(NUM) \
+ CALL_INF (NUM##_sdtf) \
+ CALL_INF (NUM##_ddtf) \
+ CALL_INF (NUM##_tdtf) \
+ CALL_INF (NUM##_tfsd) \
+ CALL_INF (NUM##_tfdd) \
+ CALL_INF (NUM##_tftd)
+#endif
+
+#define CALL_INF_ALL(NUM) \
+ CALL_INF_NOTF(NUM) \
+ CALL_INF_TF(NUM)
+
+#define CONVERT_NAN_NOTF(NUM) \
+CONVERT_NAN (NUM##_sdsf, sd, sf, d32, f) \
+CONVERT_NAN (NUM##_sddf, sd, df, d32, ) \
+CONVERT_NAN (NUM##_ddsf, dd, sf, d64, f) \
+CONVERT_NAN (NUM##_dddf, dd, df, d64, ) \
+CONVERT_NAN (NUM##_tdsf, td, sf, d128, f) \
+CONVERT_NAN (NUM##_tddf, td, df, d128, ) \
+CONVERT_NAN (NUM##_sfsd, sf, sd, f, d32) \
+CONVERT_NAN (NUM##_sfdd, sf, dd, f, d64) \
+CONVERT_NAN (NUM##_sftd, sf, td, f, d128) \
+CONVERT_NAN (NUM##_dfsd, df, sd, , d32) \
+CONVERT_NAN (NUM##_dfdd, df, dd, , d64) \
+CONVERT_NAN (NUM##_dftd, df, td, , d128) \
+CONVERT_NAN (NUM##_sddd, sd, dd, d32, d64) \
+CONVERT_NAN (NUM##_sdtd, sd, td, d32, d128) \
+CONVERT_NAN (NUM##_ddsd, dd, sd, d64, d32) \
+CONVERT_NAN (NUM##_ddtd, dd, td, d64, d128) \
+CONVERT_NAN (NUM##_tdsd, td, sd, d128, d32) \
+CONVERT_NAN (NUM##_tddd, td, dd, d128, d64)
+
+#if USE_TF == 0
+#define CONVERT_NAN_TF(NUM)
+#else
+#define CONVERT_NAN_TF(NUM) \
+CONVERT_NAN (NUM##_sdtf, sd, tf, d32, l) \
+CONVERT_NAN (NUM##_ddtf, dd, tf, d64, l) \
+CONVERT_NAN (NUM##_tdtf, td, tf, d128, l) \
+CONVERT_NAN (NUM##_tfsd, tf, sd, l, d32) \
+CONVERT_NAN (NUM##_tfdd, tf, dd, l, d64) \
+CONVERT_NAN (NUM##_tftd, tf, td, l, d128)
+#endif
+
+#define CONVERT_NAN_ALL(NUM) \
+ CONVERT_NAN_NOTF(NUM) \
+ CONVERT_NAN_TF(NUM)
+
+#define CALL_NAN(NUM) \
+ convert_##NUM##_nan ();
+
+#define CALL_NAN_NOTF(NUM) \
+ CALL_NAN (NUM##_sdsf) \
+ CALL_NAN (NUM##_sddf) \
+ CALL_NAN (NUM##_ddsf) \
+ CALL_NAN (NUM##_dddf) \
+ CALL_NAN (NUM##_tdsf) \
+ CALL_NAN (NUM##_tddf) \
+ CALL_NAN (NUM##_sfsd) \
+ CALL_NAN (NUM##_sfdd) \
+ CALL_NAN (NUM##_sftd) \
+ CALL_NAN (NUM##_dfsd) \
+ CALL_NAN (NUM##_dfdd) \
+ CALL_NAN (NUM##_dftd) \
+ CALL_NAN (NUM##_sddd) \
+ CALL_NAN (NUM##_sdtd) \
+ CALL_NAN (NUM##_ddsd) \
+ CALL_NAN (NUM##_ddtd) \
+ CALL_NAN (NUM##_tdsd) \
+ CALL_NAN (NUM##_tddd)
+
+#if USE_TF == 0
+#define CALL_NAN_TF(NUM)
+#else
+#define CALL_NAN_TF(NUM) \
+ CALL_NAN (NUM##_sdtf) \
+ CALL_NAN (NUM##_ddtf) \
+ CALL_NAN (NUM##_tdtf) \
+ CALL_NAN (NUM##_tfsd) \
+ CALL_NAN (NUM##_tfdd) \
+ CALL_NAN (NUM##_tftd)
+#endif
+
+#define CALL_NAN_ALL(NUM) \
+ CALL_NAN_NOTF(NUM) \
+ CALL_NAN_TF(NUM)
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/dfp-dbg.h b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/dfp-dbg.h
new file mode 100644
index 000000000..cde76c494
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/dfp-dbg.h
@@ -0,0 +1,20 @@
+#ifdef __cplusplus
+typedef float _Decimal32 __attribute__((mode(SD)));
+typedef float _Decimal64 __attribute__((mode(DD)));
+typedef float _Decimal128 __attribute__((mode(TD)));
+
+#define EXTERN extern "C"
+#else
+#define EXTERN extern
+#endif
+
+int failures;
+
+#ifdef DBG
+extern int printf (const char *, ...);
+#define FAILURE { printf ("failed at line %d\n", __LINE__); failures++; }
+#define FINISH if (failures != 0) __builtin_abort (); return 0;
+#else
+#define FAILURE __builtin_abort ();
+#define FINISH return 0;
+#endif
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-array.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-array.c
new file mode 100644
index 000000000..6d158f355
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-array.c
@@ -0,0 +1,157 @@
+/* C99 6.5.2.2 Function calls.
+ Test passing array elements involving decimal floating point types. */
+
+#include "dfp-dbg.h"
+
+/* A handful of functions that return the Nth _Decimal32 argument of
+ an incoming array. */
+
+_Decimal32
+arg0_32 (_Decimal32 args[])
+{
+ return args[0];
+}
+
+_Decimal32
+arg1_32 (_Decimal32 args[])
+{
+ return args[1];
+}
+
+_Decimal32
+arg2_32 (_Decimal32 args[])
+{
+ return args[2];
+}
+
+_Decimal32
+arg3_32 (_Decimal32 args[])
+{
+ return args[3];
+}
+
+_Decimal32
+arg4_32 (_Decimal32 args[])
+{
+ return args[4];
+}
+
+_Decimal32
+arg5_32 (_Decimal32 args[])
+{
+ return args[5];
+}
+
+
+/* A handful of functions that return the Nth _Decimal64 argument of
+ an incoming array. */
+
+_Decimal64
+arg0_64 (_Decimal64 args[])
+{
+ return args[0];
+}
+
+_Decimal64
+arg1_64 (_Decimal64 args[])
+{
+ return args[1];
+}
+
+_Decimal64
+arg2_64 (_Decimal64 args[])
+{
+ return args[2];
+}
+
+_Decimal64
+arg3_64 (_Decimal64 args[])
+{
+ return args[3];
+}
+
+_Decimal64
+arg4_64 (_Decimal64 args[])
+{
+ return args[4];
+}
+
+_Decimal64
+arg5_64 (_Decimal64 args[])
+{
+ return args[5];
+}
+
+
+/* A handful of functions that return the Nth _Decimal128 argument of
+ an incoming array. */
+
+_Decimal128
+arg0_128 (_Decimal128 args[])
+{
+ return args[0];
+}
+
+_Decimal128
+arg1_128 (_Decimal128 args[])
+{
+ return args[1];
+}
+
+_Decimal128
+arg2_128 (_Decimal128 args[])
+{
+ return args[2];
+}
+
+_Decimal128
+arg3_128 (_Decimal128 args[])
+{
+ return args[3];
+}
+
+_Decimal128
+arg4_128 (_Decimal128 args[])
+{
+ return args[4];
+}
+
+_Decimal128
+arg5_128 (_Decimal128 args[])
+{
+ return args[5];
+}
+
+
+int main()
+{
+ _Decimal32 d32[] = { 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df };
+ _Decimal64 d64[] = { 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd };
+ _Decimal128 d128[] = { 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl };
+
+ /* _Decimal32 variants. */
+ if (arg0_32 (d32) != 0.0df) FAILURE
+ if (arg1_32 (d32) != 1.0df) FAILURE
+ if (arg2_32 (d32) != 2.0df) FAILURE
+ if (arg3_32 (d32) != 3.0df) FAILURE
+ if (arg4_32 (d32) != 4.0df) FAILURE
+ if (arg5_32 (d32) != 5.0df) FAILURE
+
+ /* _Decimal64 variants. */
+ if (arg0_64 (d64) != 0.0dd) FAILURE
+ if (arg1_64 (d64) != 1.0dd) FAILURE
+ if (arg2_64 (d64) != 2.0dd) FAILURE
+ if (arg3_64 (d64) != 3.0dd) FAILURE
+ if (arg4_64 (d64) != 4.0dd) FAILURE
+ if (arg5_64 (d64) != 5.0dd) FAILURE
+
+ /* _Decimal128 variants. */
+ if (arg0_128 (d128) != 0.0dl) FAILURE
+ if (arg1_128 (d128) != 1.0dl) FAILURE
+ if (arg2_128 (d128) != 2.0dl) FAILURE
+ if (arg3_128 (d128) != 3.0dl) FAILURE
+ if (arg4_128 (d128) != 4.0dl) FAILURE
+ if (arg5_128 (d128) != 5.0dl) FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-deref.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-deref.c
new file mode 100644
index 000000000..81a48a9f8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-deref.c
@@ -0,0 +1,205 @@
+/* C99 6.5.2.2 Function calls.
+ Test scalar passing and return values involving decimal floating
+ point types and dereferenced pointers. */
+
+#include "dfp-dbg.h"
+
+/* A handful of functions that return their Nth _Decimal32
+ argument. */
+
+_Decimal32 __attribute__((noinline))
+arg0_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg0;
+}
+
+_Decimal32 __attribute__((noinline))
+arg1_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg1;
+}
+
+_Decimal32 __attribute__((noinline))
+arg2_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg2;
+}
+
+_Decimal32 __attribute__((noinline))
+arg3_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg3;
+}
+
+_Decimal32 __attribute__((noinline))
+arg4_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg4;
+}
+
+_Decimal32 __attribute__((noinline))
+arg5_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg5;
+}
+
+
+/* A handful of functions that return their Nth _Decimal64
+ argument. */
+
+_Decimal64 __attribute__((noinline))
+arg0_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg0;
+}
+
+_Decimal64 __attribute__((noinline))
+arg1_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg1;
+}
+
+_Decimal64 __attribute__((noinline))
+arg2_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg2;
+}
+
+_Decimal64 __attribute__((noinline))
+arg3_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg3;
+}
+
+_Decimal64 __attribute__((noinline))
+arg4_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg4;
+}
+
+_Decimal64 __attribute__((noinline))
+arg5_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg5;
+}
+
+
+/* A handful of functions that return their Nth _Decimal128
+ argument. */
+
+_Decimal128 __attribute__((noinline))
+arg0_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg0;
+}
+
+_Decimal128 __attribute__((noinline))
+arg1_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg1;
+}
+
+_Decimal128 __attribute__((noinline))
+arg2_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg2;
+}
+
+_Decimal128 __attribute__((noinline))
+arg3_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg3;
+}
+
+_Decimal128 __attribute__((noinline))
+arg4_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg4;
+}
+
+_Decimal128 __attribute__((noinline))
+arg5_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg5;
+}
+
+
+
+_Decimal32 df0 = 0.0df, df1 = 1.0df, df2 = 2.0df,
+ df3 = 3.0df, df4 = 4.0df, df5 = 5.0df;
+_Decimal32 *pdf0 = &df0, *pdf1 = &df1, *pdf2 = &df2,
+ *pdf3 = &df3, *pdf4 = &df4, *pdf5 = &df5;
+_Decimal64 dd0 = 0.0dd, dd1 = 1.0dd, dd2 = 2.0dd,
+ dd3 = 3.0dd, dd4 = 4.0dd, dd5 = 5.0dd;
+_Decimal64 *pdd0 = &dd0, *pdd1 = &dd1, *pdd2 = &dd2,
+ *pdd3 = &dd3, *pdd4 = &dd4, *pdd5 = &dd5;
+_Decimal128 dl0 = 0.0dl, dl1 = 1.0dl, dl2 = 2.0dl,
+ dl3 = 3.0dl, dl4 = 4.0dl, dl5 = 5.0dl;
+_Decimal128 *pdl0 = &dl0, *pdl1 = &dl1, *pdl2 = &dl2,
+ *pdl3 = &dl3, *pdl4 = &dl4, *pdl5 = &dl5;
+
+int
+main ()
+{
+ /* _Decimal32 variants. */
+ if (arg0_32 (*pdf0, *pdf1, *pdf2, *pdf3, *pdf4, *pdf5) != 0.0df)
+ FAILURE
+ if (arg1_32 (*pdf0, *pdf1, *pdf2, *pdf3, *pdf4, *pdf5) != 1.0df)
+ FAILURE
+ if (arg2_32 (*pdf0, *pdf1, *pdf2, *pdf3, *pdf4, *pdf5) != 2.0df)
+ FAILURE
+ if (arg3_32 (*pdf0, *pdf1, *pdf2, *pdf3, *pdf4, *pdf5) != 3.0df)
+ FAILURE
+ if (arg4_32 (*pdf0, *pdf1, *pdf2, *pdf3, *pdf4, *pdf5) != 4.0df)
+ FAILURE
+ if (arg5_32 (*pdf0, *pdf1, *pdf2, *pdf3, *pdf4, *pdf5) != 5.0df)
+ FAILURE
+
+ /* _Decimal64 variants. */
+ if (arg0_64 (*pdd0, *pdd1, *pdd2, *pdd3, *pdd4, *pdd5) != 0.0dd)
+ FAILURE
+ if (arg1_64 (*pdd0, *pdd1, *pdd2, *pdd3, *pdd4, *pdd5) != 1.0dd)
+ FAILURE
+ if (arg2_64 (*pdd0, *pdd1, *pdd2, *pdd3, *pdd4, *pdd5) != 2.0dd)
+ FAILURE
+ if (arg3_64 (*pdd0, *pdd1, *pdd2, *pdd3, *pdd4, *pdd5) != 3.0dd)
+ FAILURE
+ if (arg4_64 (*pdd0, *pdd1, *pdd2, *pdd3, *pdd4, *pdd5) != 4.0dd)
+ FAILURE
+ if (arg5_64 (*pdd0, *pdd1, *pdd2, *pdd3, *pdd4, *pdd5) != 5.0dd)
+ FAILURE
+
+ /* _Decimal128 variants. */
+ if (arg0_128 (*pdl0, *pdl1, *pdl2, *pdl3, *pdl4, *pdl5) != 0.0dl)
+ FAILURE
+ if (arg1_128 (*pdl0, *pdl1, *pdl2, *pdl3, *pdl4, *pdl5) != 1.0dl)
+ FAILURE
+ if (arg2_128 (*pdl0, *pdl1, *pdl2, *pdl3, *pdl4, *pdl5) != 2.0dl)
+ FAILURE
+ if (arg3_128 (*pdl0, *pdl1, *pdl2, *pdl3, *pdl4, *pdl5) != 3.0dl)
+ FAILURE
+ if (arg4_128 (*pdl0, *pdl1, *pdl2, *pdl3, *pdl4, *pdl5) != 4.0dl)
+ FAILURE
+ if (arg5_128 (*pdl0, *pdl1, *pdl2, *pdl3, *pdl4, *pdl5) != 5.0dl)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-mixed.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-mixed.c
new file mode 100644
index 000000000..6f7e2eb41
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-mixed.c
@@ -0,0 +1,174 @@
+/* { dg-options "-Wall" } */
+
+/* C99 6.5.2.2 Function calls.
+ Test scalar passing and return values involving decimal floating
+ point types. */
+
+#include "dfp-dbg.h"
+
+/* A handful of functions that return their Nth _Decimal32
+ argument with mixed types in parameter list. */
+
+_Decimal32
+arg0_32 (_Decimal32 arg0, int arg1, unsigned int arg2,
+ float arg3, double arg4, long double arg5)
+{
+ return arg0;
+}
+
+_Decimal32
+arg1_32 (int arg0, _Decimal32 arg1, unsigned int arg2,
+ float arg3, double arg4, long double arg5)
+{
+ return arg1;
+}
+
+_Decimal32
+arg2_32 (int arg0, unsigned int arg1, _Decimal32 arg2,
+ float arg3, double arg4, long double arg5)
+{
+ return arg2;
+}
+
+
+_Decimal32
+arg3_32 (int arg0, unsigned int arg1, float arg2,
+ _Decimal32 arg3, double arg4, long double arg5)
+{
+ return arg3;
+}
+
+_Decimal32
+arg4_32 (int arg0, unsigned int arg1, float arg2,
+ double arg3, _Decimal32 arg4, long double arg5)
+{
+ return arg4;
+}
+
+_Decimal32
+arg5_32 (int arg0, unsigned int arg1, float arg2,
+ double arg3, long double arg4, _Decimal32 arg5)
+{
+ return arg5;
+}
+
+/* A handful of functions that return their Nth _Decimal64
+ argument with mixed types in parameter list. */
+
+_Decimal64
+arg0_64 (_Decimal64 arg0, int arg1, unsigned int arg2,
+ float arg3, double arg4, long double arg5)
+{
+ return arg0;
+}
+
+_Decimal64
+arg1_64 (int arg0, _Decimal64 arg1, unsigned int arg2,
+ float arg3, double arg4, long double arg5)
+{
+ return arg1;
+}
+
+_Decimal64
+arg2_64 (int arg0, unsigned int arg1, _Decimal64 arg2,
+ float arg3, double arg4, long double arg5)
+{
+ return arg2;
+}
+
+_Decimal64
+arg3_64 (int arg0, unsigned int arg1, float arg2,
+ _Decimal64 arg3, double arg4, long double arg5)
+{
+ return arg3;
+}
+
+_Decimal64
+arg4_64 (int arg0, unsigned int arg1, float arg2,
+ float arg3, _Decimal64 arg4, long double arg5)
+{
+ return arg4;
+}
+
+_Decimal64
+arg5_64 (int arg0, unsigned int arg1, float arg2,
+ double arg3, long double arg4, _Decimal64 arg5)
+{
+ return arg5;
+}
+
+/* A handful of functions that return their Nth _Decimal128
+ argument with mixed types in parameter list. */
+
+_Decimal128
+arg0_128 (_Decimal128 arg0, int arg1, unsigned int arg2,
+ float arg3, double arg4, long double arg5)
+{
+ return arg0;
+}
+_Decimal128
+arg1_128 (int arg0, _Decimal128 arg1, unsigned int arg2,
+ float arg3, double arg4, long double arg5)
+{
+ return arg1;
+}
+
+_Decimal128
+arg2_128 (int arg0, unsigned int arg1, _Decimal128 arg2,
+ float arg3, double arg4, long double arg5)
+{
+ return arg2;
+}
+
+_Decimal128
+arg3_128 (int arg0, unsigned int arg1, float arg2,
+ _Decimal128 arg3, double arg4, long double arg5)
+{
+ return arg3;
+}
+
+_Decimal128
+arg4_128 (int arg0, unsigned int arg1, float arg2,
+ float arg3, _Decimal32 arg4, long double arg5)
+{
+ return arg4;
+}
+
+_Decimal128
+arg5_128 (int arg0, unsigned int arg1, float arg2,
+ double arg3, long double arg4, _Decimal128 arg5)
+{
+ return arg5;
+}
+
+
+
+int
+main ()
+{
+ /* _Decimal32 variants. */
+ if (arg0_32 (0.0df, -1, 2, 3.0f, 4.0, 5.0l) != 0.0df) FAILURE
+ if (arg1_32 (0, 1.0df, 2, 3.0f, 4.0, 5.0l) != 1.0df) FAILURE
+ if (arg2_32 (0, -1, 2.0df, 3.0f, 4.0, 5.0l) != 2.0df) FAILURE
+ if (arg3_32 (0, -1, 2.0f, 3.0df, 4.0, 5.0l) != 3.0df) FAILURE
+ if (arg4_32 (0, -1, 2.0f, 3.0, 4.0df, 5.0l) != 4.0df) FAILURE
+ if (arg5_32 (0, -1, 2.0f, 3.0, 4.0l, 5.0df) != 5.0df) FAILURE
+
+ /* _Decimal64 variants. */
+ if (arg0_64 (0.0dd, -1, 2, 3.0f, 4.0, 5.0l) != 0.0dd) FAILURE
+ if (arg1_64 (0, 1.0dd, 2, 3.0f, 4.0, 5.0l) != 1.0dd) FAILURE
+ if (arg2_64 (0, -1, 2.0dd, 3.0f, 4.0, 5.0l) != 2.0dd) FAILURE
+ if (arg3_64 (0, -1, 2.0f, 3.0dd, 4.0, 5.0l) != 3.0dd) FAILURE
+ if (arg4_64 (0, -1, 2.0f, 3.0, 4.0dd, 5.0l) != 4.0dd) FAILURE
+ if (arg5_64 (0, -1, 2.0f, 3.0, 4.0l, 5.0dd) != 5.0dd) FAILURE
+
+ /* _Decimal128 variants. */
+ if (arg0_128 (0.0dl, -1, 2, 3.0f, 4.0, 5.0l) != 0.0dl) FAILURE
+ if (arg1_128 (0, 1.0dl, 2, 3.0f, 4.0, 5.0l) != 1.0dl) FAILURE
+ if (arg2_128 (0, -1, 2.0dl, 3.0f, 4.0, 5.0l) != 2.0dl) FAILURE
+ if (arg3_128 (0, -1, 2.0f, 3.0dl, 4.0, 5.0l) != 3.0dl) FAILURE
+ if (arg4_128 (0, -1, 2.0f, 3.0, 4.0dl, 5.0l) != 4.0dl) FAILURE
+ if (arg5_128 (0, -1, 2.0f, 3.0, 4.0l, 5.0dl) != 5.0dl) FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-pointer.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-pointer.c
new file mode 100644
index 000000000..cfdf2356c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-pointer.c
@@ -0,0 +1,205 @@
+/* C99 6.5.2.2 Function calls.
+ Test pointer argument passing and return values involving decimal floating
+ point types. */
+
+#include "dfp-dbg.h"
+
+/* A handful of functions that return their Nth pointer to Decimal32
+ argument. */
+
+_Decimal32 *
+arg0_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2,
+ _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5)
+{
+ return arg0;
+}
+
+_Decimal32 *
+arg1_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2,
+ _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5)
+{
+ return arg1;
+}
+
+_Decimal32 *
+arg2_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2,
+ _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5)
+{
+ return arg2;
+}
+
+_Decimal32 *
+arg3_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2,
+ _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5)
+{
+ return arg3;
+}
+
+_Decimal32 *
+arg4_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2,
+ _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5)
+{
+ return arg4;
+}
+
+_Decimal32 *
+arg5_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2,
+ _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5)
+{
+ return arg5;
+}
+
+
+/* A handful of functions that return their Nth pointer to _Decimal64
+ argument. */
+
+_Decimal64 *
+arg0_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2,
+ _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5)
+{
+ return arg0;
+}
+
+_Decimal64 *
+arg1_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2,
+ _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5)
+{
+ return arg1;
+}
+
+_Decimal64 *
+arg2_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2,
+ _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5)
+{
+ return arg2;
+}
+
+_Decimal64 *
+arg3_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2,
+ _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5)
+{
+ return arg3;
+}
+
+_Decimal64 *
+arg4_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2,
+ _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5)
+{
+ return arg4;
+}
+
+_Decimal64 *
+arg5_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2,
+ _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5)
+{
+ return arg5;
+}
+
+
+/* A handful of functions that return their Nth _Decimal128
+ argument. */
+
+_Decimal128 *
+arg0_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2,
+ _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5)
+{
+ return arg0;
+}
+
+_Decimal128 *
+arg1_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2,
+ _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5)
+{
+ return arg1;
+}
+
+_Decimal128 *
+arg2_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2,
+ _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5)
+{
+ return arg2;
+}
+
+_Decimal128 *
+arg3_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2,
+ _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5)
+{
+ return arg3;
+}
+
+_Decimal128 *
+arg4_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2,
+ _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5)
+{
+ return arg4;
+}
+
+_Decimal128 *
+arg5_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2,
+ _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5)
+{
+ return arg5;
+}
+
+
+
+_Decimal32 df0 = 0.0df, df1 = 1.0df, df2 = 2.0df,
+ df3 = 3.0df, df4 = 4.0df, df5 = 5.0df;
+_Decimal32 *pdf0 = &df0, *pdf1 = &df1, *pdf2 = &df2,
+ *pdf3 = &df3, *pdf4 = &df4, *pdf5 = &df5;
+_Decimal64 dd0 = 0.0dd, dd1 = 1.0dd, dd2 = 2.0dd,
+ dd3 = 3.0dd, dd4 = 4.0dd, dd5 = 5.0dd;
+_Decimal64 *pdd0 = &dd0, *pdd1 = &dd1, *pdd2 = &dd2,
+ *pdd3 = &dd3, *pdd4 = &dd4, *pdd5 = &dd5;
+_Decimal128 dl0 = 0.0dl, dl1 = 1.0dl, dl2 = 2.0dl,
+ dl3 = 3.0dl, dl4 = 4.0dl, dl5 = 5.0dl;
+_Decimal128 *pdl0 = &dl0, *pdl1 = &dl1, *pdl2 = &dl2,
+ *pdl3 = &dl3, *pdl4 = &dl4, *pdl5 = &dl5;
+
+int
+main ()
+{
+ /* _Decimal32 variants. */
+ if (*arg0_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 0.0df)
+ FAILURE
+ if (*arg1_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 1.0df)
+ FAILURE
+ if (*arg2_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 2.0df)
+ FAILURE
+ if (*arg3_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 3.0df)
+ FAILURE
+ if (*arg4_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 4.0df)
+ FAILURE
+ if (*arg5_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 5.0df)
+ FAILURE
+
+ /* _Decimal64 variants. */
+ if (*arg0_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 0.0dd)
+ FAILURE
+ if (*arg1_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 1.0dd)
+ FAILURE
+ if (*arg2_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 2.0dd)
+ FAILURE
+ if (*arg3_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 3.0dd)
+ FAILURE
+ if (*arg4_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 4.0dd)
+ FAILURE
+ if (*arg5_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 5.0dd)
+ FAILURE
+
+ /* _Decimal128 variants. */
+ if (*arg0_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 0.0dl)
+ FAILURE
+ if (*arg1_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 1.0dl)
+ FAILURE
+ if (*arg2_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 2.0dl)
+ FAILURE
+ if (*arg3_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 3.0dl)
+ FAILURE
+ if (*arg4_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 4.0dl)
+ FAILURE
+ if (*arg5_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 5.0dl)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-scalar.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-scalar.c
new file mode 100644
index 000000000..370c21b20
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-scalar.c
@@ -0,0 +1,192 @@
+/* C99 6.5.2.2 Function calls.
+ Test scalar passing and return values involving decimal floating
+ point types. */
+
+#include "dfp-dbg.h"
+
+/* A handful of functions that return their Nth _Decimal32
+ argument. */
+
+_Decimal32
+arg0_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg0;
+}
+
+_Decimal32
+arg1_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg1;
+}
+
+_Decimal32
+arg2_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg2;
+}
+
+_Decimal32
+arg3_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg3;
+}
+
+_Decimal32
+arg4_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg4;
+}
+
+_Decimal32
+arg5_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg5;
+}
+
+
+/* A handful of functions that return their Nth _Decimal64
+ argument. */
+
+_Decimal64
+arg0_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg0;
+}
+
+_Decimal64
+arg1_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg1;
+}
+
+_Decimal64
+arg2_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg2;
+}
+
+_Decimal64
+arg3_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg3;
+}
+
+_Decimal64
+arg4_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg4;
+}
+
+_Decimal64
+arg5_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg5;
+}
+
+
+/* A handful of functions that return their Nth _Decimal128
+ argument. */
+
+_Decimal128
+arg0_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg0;
+}
+
+_Decimal128
+arg1_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg1;
+}
+
+_Decimal128
+arg2_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg2;
+}
+
+_Decimal128
+arg3_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg3;
+}
+
+_Decimal128
+arg4_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg4;
+}
+
+_Decimal128
+arg5_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg5;
+}
+
+
+
+int
+main ()
+{
+ /* _Decimal32 variants. */
+ if (arg0_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 0.0df)
+ FAILURE
+ if (arg1_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 1.0df)
+ FAILURE
+ if (arg2_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 2.0df)
+ FAILURE
+ if (arg3_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 3.0df)
+ FAILURE
+ if (arg4_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 4.0df)
+ FAILURE
+ if (arg5_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 5.0df)
+ FAILURE
+
+ /* _Decimal64 variants. */
+ if (arg0_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 0.0dd)
+ FAILURE
+ if (arg1_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 1.0dd)
+ FAILURE
+ if (arg2_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 2.0dd)
+ FAILURE
+ if (arg3_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 3.0dd)
+ FAILURE
+ if (arg4_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 4.0dd)
+ FAILURE
+ if (arg5_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 5.0dd)
+ FAILURE
+
+ /* _Decimal128 variants. */
+ if (arg0_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 0.0dl)
+ FAILURE
+ if (arg1_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 1.0dl)
+ FAILURE
+ if (arg2_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 2.0dl)
+ FAILURE
+ if (arg3_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 3.0dl)
+ FAILURE
+ if (arg4_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 4.0dl)
+ FAILURE
+ if (arg5_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 5.0dl)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-struct.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-struct.c
new file mode 100644
index 000000000..ad0224d6c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-struct.c
@@ -0,0 +1,93 @@
+/* C99 6.5.2.2 Function calls.
+ Test structure passing and return values involving decimal floating
+ point types. */
+
+#include "dfp-dbg.h"
+
+struct example
+{
+ _Decimal128 d128;
+ char dummy1;
+ _Decimal64 d64;
+ char dummy2;
+ _Decimal32 d32;
+} nums = { 1.0dl, 'a', 2.0dd, 'b', 3.0df };
+
+_Decimal32
+d32_field (struct example s)
+{
+ return s.d32;
+}
+
+_Decimal64
+d64_field (struct example s)
+{
+ return s.d64;
+}
+
+_Decimal128
+d128_field (struct example s)
+{
+ return s.d128;
+}
+
+char
+dummy1_field (struct example s)
+{
+ return s.dummy1;
+}
+
+char
+dummy2_field (struct example s)
+{
+ return s.dummy2;
+}
+
+_Decimal32
+ptr_d32_field (struct example *s)
+{
+ return s->d32;
+}
+
+_Decimal64
+ptr_d64_field (struct example *s)
+{
+ return s->d64;
+}
+
+_Decimal128
+ptr_d128_field (struct example *s)
+{
+ return s->d128;
+}
+
+char
+ptr_dummy1_field (struct example *s)
+{
+ return s->dummy1;
+}
+
+char
+ptr_dummy2_field (struct example *s)
+{
+ return s->dummy2;
+}
+
+
+int
+main ()
+{
+ if (d32_field (nums) != 3.0df) FAILURE
+ if (d64_field (nums) != 2.0dd) FAILURE
+ if (d128_field (nums) != 1.0dl) FAILURE
+ if (dummy1_field (nums) != 'a') FAILURE
+ if (dummy2_field (nums) != 'b') FAILURE
+
+ if (ptr_d32_field (&nums) != 3.0df) FAILURE
+ if (ptr_d64_field (&nums) != 2.0dd) FAILURE
+ if (ptr_d128_field (&nums) != 1.0dl) FAILURE
+ if (ptr_dummy1_field (&nums) != 'a') FAILURE
+ if (ptr_dummy2_field (&nums) != 'b') FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d128-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d128-2.c
new file mode 100644
index 000000000..f2e4dee23
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d128-2.c
@@ -0,0 +1,22 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
+/* { dg-options "-mpreferred-stack-boundary=2" } */
+
+/* Simple test of vararg passing for problematic types with and without
+ double values passed between them. */
+
+#define DTYPE _Decimal128
+#define ONE 1.0dl
+#define THREE 3.0dl
+#define SEVEN 7.0dl
+#define ELEVEN 11.0dl
+#define INTS 4
+
+#include "func-vararg-alternate.h"
+
+int
+main ()
+{
+ doit ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d128.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d128.c
new file mode 100644
index 000000000..8d452eadc
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d128.c
@@ -0,0 +1,19 @@
+/* Simple test of vararg passing for problematic types with and without
+ double values passed between them. */
+
+#define DTYPE _Decimal128
+#define ONE 1.0dl
+#define THREE 3.0dl
+#define SEVEN 7.0dl
+#define ELEVEN 11.0dl
+#define INTS 4
+
+#include "func-vararg-alternate.h"
+
+int
+main ()
+{
+ doit ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d32.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d32.c
new file mode 100644
index 000000000..651b7e8c5
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d32.c
@@ -0,0 +1,19 @@
+/* Simple test of vararg passing for problematic types with and without
+ double values passed between them. */
+
+#define DTYPE _Decimal32
+#define ONE 1.0df
+#define THREE 3.0df
+#define SEVEN 7.0df
+#define ELEVEN 11.0df
+#define INTS 1
+
+#include "func-vararg-alternate.h"
+
+int
+main ()
+{
+ doit ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d64.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d64.c
new file mode 100644
index 000000000..86b475d2a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d64.c
@@ -0,0 +1,19 @@
+/* Simple test of vararg passing for problematic types with and without
+ double values passed between them. */
+
+#define DTYPE _Decimal64
+#define ONE 1.0dd
+#define THREE 3.0dd
+#define SEVEN 7.0dd
+#define ELEVEN 11.0dd
+#define INTS 2
+
+#include "func-vararg-alternate.h"
+
+int
+main ()
+{
+ doit ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate.h b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate.h
new file mode 100644
index 000000000..5ba0ab0dc
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate.h
@@ -0,0 +1,143 @@
+/* Simple test of vararg passing for problematic types with and without
+ double values passed between them. */
+
+#include "dfp-dbg.h"
+#include <stdarg.h>
+
+DTYPE a[10];
+double b[10];
+
+union U {
+ DTYPE d;
+ unsigned int i[INTS];
+};
+
+void
+compare (double r, double s, unsigned int *p, unsigned int *q, int n, int line)
+{
+ int i;
+
+ for (i = 0; i < n; i++)
+ if (r != s || p[i] != q[i])
+#ifdef DBG
+ {
+ int j;
+
+ failures++;
+ printf ("line %-3d", line);
+ for (j = 0; j < n; j++)
+ printf (" %08x", p[j]);
+ printf (" %10.2g\n ", r);
+ for (j = 0; j < n; j++)
+ printf (" %08x", q[j]);
+ printf (" %10.2g\n\n", s);
+
+ return;
+ }
+#else
+ __builtin_abort ();
+#endif
+}
+
+void
+bar0 (int n, ...)
+{
+ union U u;
+ int j;
+ va_list ap;
+
+ va_start (ap, n);
+ for (j = 0; j < n; j++)
+ a[j] = va_arg (ap, DTYPE);
+ va_end (ap);
+}
+
+void
+bar1 (int n, ...)
+{
+ union U u;
+ int j;
+ va_list ap;
+
+ va_start (ap, n);
+ for (j = 0; j < n; j++)
+ {
+ a[j] = va_arg (ap, DTYPE);
+ b[j] = va_arg (ap, double);
+ }
+ va_end (ap);
+}
+
+void
+bar2 (int n, ...)
+{
+ union U u;
+ int j;
+ va_list ap;
+
+ va_start (ap, n);
+ for (j = 0; j < n; j++)
+ {
+ b[j] = va_arg (ap, double);
+ a[j] = va_arg (ap, DTYPE);
+ }
+ va_end (ap);
+}
+
+void
+doit ()
+{
+ DTYPE x, y, z;
+ union U u1, u2;
+
+ /* Sanity check that test setup is right, especially for long double
+ which can be changed by command line option. */
+ if (INTS * 4 != sizeof (DTYPE))
+ {
+#ifdef DBG
+ printf ("test error: INTS = %d, sizeof (DTYPE) = %d\n",
+ INTS, sizeof (DTYPE));
+#endif
+ __builtin_abort ();
+ }
+
+ x = ONE / THREE;
+ y = ONE / SEVEN;
+ z = ONE / ELEVEN;
+
+ bar0 (1, x);
+ u1.d = x; u2.d = a[0]; compare (0.0, 0.0, u1.i, u2.i, INTS, __LINE__);
+
+ bar0 (2, x, y);
+ u1.d = x; u2.d = a[0]; compare (0.0, 0.0, u1.i, u2.i, INTS, __LINE__);
+ u1.d = y; u2.d = a[1]; compare (0.0, 0.0, u1.i, u2.i, INTS, __LINE__);
+
+ bar0 (3, x, y, z);
+ u1.d = x; u2.d = a[0]; compare (0.0, 0.0, u1.i, u2.i, INTS, __LINE__);
+ u1.d = y; u2.d = a[1]; compare (0.0, 0.0, u1.i, u2.i, INTS, __LINE__);
+ u1.d = z; u2.d = a[2]; compare (0.0, 0.0, u1.i, u2.i, INTS, __LINE__);
+
+ bar1 (1, x, 1.5);
+ u1.d = x; u2.d = a[0]; compare (1.5, b[0], u1.i, u2.i, INTS, __LINE__);
+
+ bar1 (2, x, 1.5, y, 2.5);
+ u1.d = x; u2.d = a[0]; compare (1.5, b[0], u1.i, u2.i, INTS, __LINE__);
+ u1.d = y; u2.d = a[1]; compare (2.5, b[1], u1.i, u2.i, INTS, __LINE__);
+
+ bar1 (3, x, 1.5, y, 2.5, z, 3.5);
+ u1.d = x; u2.d = a[0]; compare (1.5, b[0], u1.i, u2.i, INTS, __LINE__);
+ u1.d = y; u2.d = a[1]; compare (2.5, b[1], u1.i, u2.i, INTS, __LINE__);
+ u1.d = z; u2.d = a[2]; compare (3.5, b[2], u1.i, u2.i, INTS, __LINE__);
+
+ bar2 (1, 1.5, x);
+ u1.d = x; u2.d = a[0]; compare (1.5, b[0], u1.i, u2.i, INTS, __LINE__);
+
+ bar2 (2, 1.5, x, 2.5, y);
+ u1.d = x; u2.d = a[0]; compare (1.5, b[0], u1.i, u2.i, INTS, __LINE__);
+ u1.d = y; u2.d = a[1]; compare (2.5, b[1], u1.i, u2.i, INTS, __LINE__);
+
+ bar2 (3, 1.5, x, 2.5, y, 3.5, z);
+ u1.d = x; u2.d = a[0]; compare (1.5, b[0], u1.i, u2.i, INTS, __LINE__);
+ u1.d = y; u2.d = a[1]; compare (2.5, b[1], u1.i, u2.i, INTS, __LINE__);
+ u1.d = z; u2.d = a[2]; compare (3.5, b[2], u1.i, u2.i, INTS, __LINE__);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-dfp.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-dfp.c
new file mode 100644
index 000000000..5add1f7fd
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-dfp.c
@@ -0,0 +1,95 @@
+/* C99 6.5.2.2 Function calls.
+ Test passing varargs of the decimal float types. */
+
+#include <stdarg.h>
+#include "dfp-dbg.h"
+
+static _Decimal32
+vararg32 (unsigned arg, ...)
+{
+ int i;
+ va_list ap;
+ _Decimal32 result;
+
+ va_start (ap, arg);
+ for (i = 0; i <= arg; i++)
+ result = va_arg (ap, _Decimal32);
+ va_end (ap);
+ return result;
+}
+
+static _Decimal64
+vararg64 (unsigned arg, ...)
+{
+ int i;
+ va_list ap;
+ _Decimal64 result;
+
+ va_start (ap, arg);
+ for (i = 0; i <= arg; i++)
+ result = va_arg (ap, _Decimal64);
+ va_end (ap);
+ return result;
+}
+
+static _Decimal128
+vararg128 (unsigned arg, ...)
+{
+ int i;
+ va_list ap;
+ _Decimal128 result;
+
+ va_start (ap, arg);
+ for (i = 0; i <= arg; i++)
+ result = va_arg (ap, _Decimal128);
+ va_end (ap);
+ return result;
+}
+
+
+int main()
+{
+ /* _Decimal32 variants. */
+ if (vararg32 (0, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 0.0df)
+ FAILURE
+ if (vararg32 (1, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 1.0df)
+ FAILURE
+ if (vararg32 (2, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 2.0df)
+ FAILURE
+ if (vararg32 (3, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 3.0df)
+ FAILURE
+ if (vararg32 (4, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 4.0df)
+ FAILURE
+ if (vararg32 (5, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 5.0df)
+ FAILURE
+
+ /* _Decimal64 variants. */
+ if (vararg64 (0, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 0.0dd)
+ FAILURE
+ if (vararg64 (1, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 1.0dd)
+ FAILURE
+ if (vararg64 (2, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 2.0dd)
+ FAILURE
+ if (vararg64 (3, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 3.0dd)
+ FAILURE
+ if (vararg64 (4, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 4.0dd)
+ FAILURE
+ if (vararg64 (5, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 5.0dd)
+ FAILURE
+
+ /* _Decimal128 variants. */
+ if (vararg128 (0, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 0.0dl)
+ FAILURE
+ if (vararg128 (1, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 1.0dl)
+ FAILURE
+ if (vararg128 (2, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 2.0dl)
+ FAILURE
+ if (vararg128 (3, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 3.0dl)
+ FAILURE
+ if (vararg128 (4, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 4.0dl)
+ FAILURE
+ if (vararg128 (5, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 5.0dl)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed-2.c
new file mode 100644
index 000000000..02cafb016
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed-2.c
@@ -0,0 +1,105 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
+/* { dg-options "-mpreferred-stack-boundary=2" } */
+
+/* C99 6.5.2.2 Function calls.
+ Test passing varargs of the combination of decimal float types and
+ other types. */
+
+#include <stdarg.h>
+#include "dfp-dbg.h"
+
+/* Supposing the list of varying number of arguments is:
+ unsigned int, _Decimal128, double, _Decimal32, _Decimal64. */
+
+static _Decimal32
+vararg_d32 (unsigned arg, ...)
+{
+ va_list ap;
+ _Decimal32 result;
+
+ va_start (ap, arg);
+
+ va_arg (ap, unsigned int);
+ va_arg (ap, _Decimal128);
+ va_arg (ap, double);
+ result = va_arg (ap, _Decimal32);
+
+ va_end (ap);
+ return result;
+}
+
+static _Decimal32
+vararg_d64 (unsigned arg, ...)
+{
+ va_list ap;
+ _Decimal64 result;
+
+ va_start (ap, arg);
+
+ va_arg (ap, unsigned int);
+ va_arg (ap, _Decimal128);
+ va_arg (ap, double);
+ va_arg (ap, _Decimal32);
+ result = va_arg (ap, _Decimal64);
+
+ va_end (ap);
+ return result;
+}
+
+static _Decimal128
+vararg_d128 (unsigned arg, ...)
+{
+ va_list ap;
+ _Decimal128 result;
+
+ va_start (ap, arg);
+
+ va_arg (ap, unsigned int);
+ result = va_arg (ap, _Decimal128);
+
+ va_end (ap);
+ return result;
+}
+
+static unsigned int
+vararg_int (unsigned arg, ...)
+{
+ va_list ap;
+ unsigned int result;
+
+ va_start (ap, arg);
+
+ result = va_arg (ap, unsigned int);
+
+ va_end (ap);
+ return result;
+}
+
+static double
+vararg_double (unsigned arg, ...)
+{
+ va_list ap;
+ float result;
+
+ va_start (ap, arg);
+
+ va_arg (ap, unsigned int);
+ va_arg (ap, _Decimal128);
+ result = va_arg (ap, double);
+
+ va_end (ap);
+ return result;
+}
+
+
+int
+main ()
+{
+ if (vararg_d32 (3, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 3.0df) FAILURE
+ if (vararg_d64 (4, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 4.0dd) FAILURE
+ if (vararg_d128 (1, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 1.0dl) FAILURE
+ if (vararg_int (0, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 0) FAILURE
+ if (vararg_double (2, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 2.0) FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed.c
new file mode 100644
index 000000000..1669eaf95
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed.c
@@ -0,0 +1,102 @@
+/* C99 6.5.2.2 Function calls.
+ Test passing varargs of the combination of decimal float types and
+ other types. */
+
+#include <stdarg.h>
+#include "dfp-dbg.h"
+
+/* Supposing the list of varying number of arguments is:
+ unsigned int, _Decimal128, double, _Decimal32, _Decimal64. */
+
+static _Decimal32
+vararg_d32 (unsigned arg, ...)
+{
+ va_list ap;
+ _Decimal32 result;
+
+ va_start (ap, arg);
+
+ va_arg (ap, unsigned int);
+ va_arg (ap, _Decimal128);
+ va_arg (ap, double);
+ result = va_arg (ap, _Decimal32);
+
+ va_end (ap);
+ return result;
+}
+
+static _Decimal32
+vararg_d64 (unsigned arg, ...)
+{
+ va_list ap;
+ _Decimal64 result;
+
+ va_start (ap, arg);
+
+ va_arg (ap, unsigned int);
+ va_arg (ap, _Decimal128);
+ va_arg (ap, double);
+ va_arg (ap, _Decimal32);
+ result = va_arg (ap, _Decimal64);
+
+ va_end (ap);
+ return result;
+}
+
+static _Decimal128
+vararg_d128 (unsigned arg, ...)
+{
+ va_list ap;
+ _Decimal128 result;
+
+ va_start (ap, arg);
+
+ va_arg (ap, unsigned int);
+ result = va_arg (ap, _Decimal128);
+
+ va_end (ap);
+ return result;
+}
+
+static unsigned int
+vararg_int (unsigned arg, ...)
+{
+ va_list ap;
+ unsigned int result;
+
+ va_start (ap, arg);
+
+ result = va_arg (ap, unsigned int);
+
+ va_end (ap);
+ return result;
+}
+
+static double
+vararg_double (unsigned arg, ...)
+{
+ va_list ap;
+ float result;
+
+ va_start (ap, arg);
+
+ va_arg (ap, unsigned int);
+ va_arg (ap, _Decimal128);
+ result = va_arg (ap, double);
+
+ va_end (ap);
+ return result;
+}
+
+
+int
+main ()
+{
+ if (vararg_d32 (3, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 3.0df) FAILURE
+ if (vararg_d64 (4, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 4.0dd) FAILURE
+ if (vararg_d128 (1, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 1.0dl) FAILURE
+ if (vararg_int (0, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 0) FAILURE
+ if (vararg_double (2, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 2.0) FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-size0.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-size0.c
new file mode 100644
index 000000000..bc8b20fd4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/func-vararg-size0.c
@@ -0,0 +1,41 @@
+/* C99 6.5.2.2 Function calls. */
+
+#include <stdarg.h>
+#include "dfp-dbg.h"
+
+struct S1
+{
+ struct
+ {
+ _Decimal64 e;
+ } b[0];
+};
+
+/* Test handling vararg parameters whose size is 0. */
+
+int check_var(int z,...)
+{
+ double d;
+ struct S1 s1;
+ long long result;
+ va_list ap;
+ va_start (ap, z);
+ d = va_arg (ap, double);
+ s1 = va_arg (ap, struct S1);
+ result = va_arg (ap, long long);
+ va_end (ap);
+ return (result == 2LL);
+
+}
+
+int
+main ()
+{
+ struct S1 s1;
+ struct S1 a1[5];
+
+ if (check_var(5, 1.0, s1, 2LL, a1[2], a1[2]) == 0)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/inf-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/inf-1.c
new file mode 100644
index 000000000..c4f8cd796
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/inf-1.c
@@ -0,0 +1,61 @@
+/* N1150 4: Characteristics of decimal floating types (not explicit)
+ C99 5.2.4.2.2: Characteristics of floating types.
+ A few simple checks on arithmetic operations. */
+
+#include "dfp-dbg.h"
+
+int main()
+{
+ /* Assumes rounding mode. */
+ if (9999999.E90DF + 1.E90df != __builtin_infd32 ())
+ FAILURE
+
+ if (!__builtin_isinfd32 (9999999.E90DF + 1.E90df))
+ FAILURE
+
+ if (9.999999999999999E384dd + .000000000000001e384dd
+ != __builtin_infd32 ())
+ FAILURE
+
+ if (-9999999.E90DF - 1.E90df != -__builtin_infd32 ())
+ FAILURE
+
+ if (!__builtin_isinfd32 (9.999999999999999E384dd + .000000000000001e384dd))
+ FAILURE
+
+ if (7.999999999999999999999999999999999E6144dl + 3.0E6144dl
+ != __builtin_infd32 ())
+ FAILURE
+
+ if (__builtin_infd32 () * __builtin_infd32 () != __builtin_infd32 ())
+ FAILURE
+
+ if (__builtin_infd32 () * 2 != __builtin_infd32 ())
+ FAILURE
+
+ if (__builtin_infd64 () * -5 != -__builtin_infd32 ())
+ FAILURE
+
+ if (!__builtin_isinfd128 (__builtin_infd32 () / 4))
+ FAILURE
+
+ if (__builtin_infd64 () != __builtin_infd128 ())
+ FAILURE
+
+ if (!__builtin_isinfd64 (__builtin_infd128 ()))
+ FAILURE
+
+ if (__builtin_finited64 (__builtin_infd32 () * 4))
+ FAILURE
+
+ if (!__builtin_finited128 (9.999999E90DL - 1.E90dd))
+ FAILURE
+
+ if (__builtin_finited128 (__builtin_infd32 () *__builtin_infd128 ()))
+ FAILURE
+
+ if (__builtin_finited32 (__builtin_nand32 ("")))
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/loop-index.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/loop-index.c
new file mode 100644
index 000000000..a944042a7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/loop-index.c
@@ -0,0 +1,57 @@
+/* C99 6.8.5.2: The for statement. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "dfp-dbg.h"
+
+void
+f32 (void)
+{
+ _Decimal32 d;
+ int i;
+
+ for (d = 1.1df, i=0; d <= 1.5df; d += 0.1df)
+ i++;
+
+ if (i != 5)
+ FAILURE
+}
+
+void
+f64 (void)
+{
+ _Decimal64 d;
+ int i;
+
+ for (d = 1.1dd, i=0; d <= 1.5dd; d += 0.1dd)
+ i++;
+
+ if (i != 5)
+ FAILURE
+}
+
+void
+f128 (void)
+{
+ _Decimal128 d;
+ int i;
+
+ for (d = 1.1dl, i=0; d <= 1.5dl; d += 0.1dl)
+ i++;
+
+ if (i != 5)
+ FAILURE
+}
+
+int
+main ()
+{
+ int i;
+
+ f32 ();
+ f64 ();
+ f128 ();
+
+ FINISH
+ return (0);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/modes.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/modes.c
new file mode 100644
index 000000000..09d4a15c2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/modes.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+typedef float decimal32 __attribute__ ((mode (SD)));
+typedef float decimal64 __attribute__ ((mode (DD)));
+typedef float decimal128 __attribute__ ((mode (TD)));
+
+int ssize[sizeof (decimal32) == 4 ? 1 : -1];
+int dsize[sizeof (decimal64) == 8 ? 1 : -1];
+int tsize[sizeof (decimal128) == 16 ? 1 : -1];
+
+int salign = __alignof (decimal32);
+int dalign = __alignof (decimal64);
+int talign = __alignof (decimal128);
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/nan-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/nan-1.c
new file mode 100644
index 000000000..8961777c7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/nan-1.c
@@ -0,0 +1,106 @@
+/* N1150 4: Characteristics of decimal floating types (not explicit)
+ C99 5.2.4.2.2: Characteristics of floating types.
+ A few simple checks on arithmetic operations. */
+
+#include "dfp-dbg.h"
+
+int main()
+{
+ /* Some possibly non-obvious tests, but most logical
+ operations on NaN return false, including NaN == NaN. */
+ if (__builtin_nand32("") == __builtin_nand32(""))
+ FAILURE
+
+ if (__builtin_nand64("") == __builtin_nand64(""))
+ FAILURE
+
+ if (__builtin_nand128("") == __builtin_nand128(""))
+ FAILURE
+
+ if (!(__builtin_nand32("") != __builtin_nand32("")))
+ FAILURE
+
+ if (!(__builtin_nand64("") != __builtin_nand64("")))
+ FAILURE
+
+ if (!(__builtin_nand128("") != __builtin_nand128("")))
+ FAILURE
+
+ if (__builtin_nand32("") > __builtin_nand32(""))
+ FAILURE
+
+ if (__builtin_nand64("") >= __builtin_nand64(""))
+ FAILURE
+
+ if (__builtin_nand128("") < __builtin_nand128(""))
+ FAILURE
+
+ if (-__builtin_nand128("") < +__builtin_nand128(""))
+ FAILURE
+
+ /* 0.0/0.0 => NaN, but NaN != NaN. */
+ if (0.0df/0.0dl == __builtin_nand32(""))
+ FAILURE
+
+ /* 0.0 * INF => NaN. */
+ if (!__builtin_isnand32 (0.0df * __builtin_infd32()))
+ FAILURE
+
+ if (!__builtin_isnand64 (0.0dd * __builtin_infd64()))
+ FAILURE
+
+ if (!__builtin_isnand128 (0.0dd * __builtin_infd128()))
+ FAILURE
+
+ /* INF - INF => NaN. */
+ if (!__builtin_isnand32 (__builtin_infd32() - __builtin_infd32()))
+ FAILURE
+
+ if (!__builtin_isnand64 (__builtin_infd64() - __builtin_infd64()))
+ FAILURE
+
+ if (!__builtin_isnand128 (__builtin_infd128() - __builtin_infd128()))
+ FAILURE
+
+ /* INF/INF => NaN. */
+ if (!__builtin_isnand32 (__builtin_infd32()/__builtin_infd32()) )
+ FAILURE
+
+ if (!__builtin_isnand64 (__builtin_infd64()/__builtin_infd64()) )
+ FAILURE
+
+ if (!__builtin_isnand128 (__builtin_infd128()/__builtin_infd128()) )
+ FAILURE
+
+ /* 0.0/0.0 => NaN, but NaN != NaN. */
+ if ((0.0dd/0.0df) == (0.0dd/0.0df))
+ FAILURE
+
+ if (__builtin_nand32("") < __builtin_infd32())
+ FAILURE
+
+ if (__builtin_nand32("") >= __builtin_infd32())
+ FAILURE
+
+ /* Fixme: Add sqrtdf(-x.df) test when sqrt is supported. */
+
+ if (!__builtin_isnand32(__builtin_nand32("")))
+ FAILURE
+
+ if (!__builtin_isnand64(__builtin_nand64("")))
+ FAILURE
+
+ if (!__builtin_isnand128(__builtin_nand128("")))
+ FAILURE
+
+ if (!__builtin_isnand128(8.0df * __builtin_nand128("")))
+ FAILURE
+
+ if (!__builtin_isnand32(8.1dl - __builtin_nand32("")))
+ FAILURE
+
+ if (!__builtin_isnand128(__builtin_nand64("") + __builtin_nand128("")))
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/nan-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/nan-2.c
new file mode 100644
index 000000000..ec9d18e10
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/nan-2.c
@@ -0,0 +1,53 @@
+/* N1150 4: Characteristics of decimal floating types (not explicit)
+ C99 5.2.4.2.2: Characteristics of floating types.
+ A few simple checks on arithmetic operations. Based on nan-1.c with
+ the consideration of negative zero. */
+
+#include "dfp-dbg.h"
+
+int main()
+{
+ _Decimal32 d32;
+ _Decimal64 d64;
+ _Decimal128 d128;
+
+ /* Verify that division by negative zero produces a negative infinity
+ result. */
+ d32 = 123.45f;
+ if (d32/-0.0df != -__builtin_infd32())
+ FAILURE
+ if (123.45df/-0.0df != -__builtin_infd32())
+ FAILURE
+
+ d64 = 123.45f;
+ if (d64/-0.0dd != -__builtin_infd64())
+ FAILURE
+ if (123.45dd/-0.0dd != -__builtin_infd64())
+ FAILURE
+
+ d128 = 123.45f;
+ if (d128/-0.0dl != -__builtin_infd64())
+ FAILURE
+ if (123.45dl/-0.0dl != -__builtin_infd128())
+ FAILURE
+
+ d32 = 0.0df;
+ if (!__builtin_isnand32(-(d32/-0.0df)))
+ FAILURE
+ if (!__builtin_isnand32(-(0.0df/-0.0df)))
+ FAILURE
+
+ d64 = 0.0dd;
+ if (!__builtin_isnand64(-(d64/-0.0dd)))
+ FAILURE
+ if (!__builtin_isnand64(-(0.0dd/-0.0dd)))
+ FAILURE
+
+ d128 = 0.0dl;
+ if (!__builtin_isnand128(-(d128/-0.0dl)))
+ FAILURE
+ if (!__builtin_isnand128(-(0.0dl/-0.0dl)))
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-arith-fold.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-arith-fold.c
new file mode 100644
index 000000000..c4aa4cbb2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-arith-fold.c
@@ -0,0 +1,45 @@
+/* { dg-options "-O2" } */
+
+/* C99 6.5.5: Multiplicative operators.
+ C99 6.5.6: Additive operators. */
+
+#include "dfp-dbg.h"
+
+extern void link_error (void);
+
+int
+main ()
+{
+ _Decimal32 d32_1, d32_2;
+
+ /* Compare like-typed positive constants. */
+ if (2.99df + 5.1df != 8.09df)
+ link_error ();
+
+ if (5.77df - 2.22dd != 3.55df)
+ link_error ();
+
+ if (2.0dl * 3.7dd * -2 != -14.8df)
+ link_error ();
+
+ if (.18df / -.2df + 1 != 1.e-1dd)
+ link_error ();
+
+ d32_1 = 3.0df;
+ d32_2 = 1.0df;
+
+ if (!__builtin_constant_p (d32_1 + 0.2df))
+ link_error ();
+
+ if (!__builtin_constant_p (1.0df / 3.0df))
+ link_error ();
+
+ if (!__builtin_constant_p (d32_2 / d32_1))
+ link_error ();
+
+ d32_2 = 2.0df;
+ if (!__builtin_constant_p (d32_2 / d32_1))
+ link_error ();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-assignment.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-assignment.c
new file mode 100644
index 000000000..faadf1e86
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-assignment.c
@@ -0,0 +1,56 @@
+/* C99 6.5.16 Assignment operators.
+ Verify the compound assignment operator for decimal float types,
+ using it with other decimal float types, integers, and other binary
+ float types cast to decimal float types. */
+
+#include "dfp-dbg.h"
+
+#define OPERATE(OPRD1,OPRT,OPRD2,RLT) \
+ if (( OPRD1 OPRT OPRD2 )!= RLT) \
+ FAILURE
+
+#define DECIMAL_COMPOUND_ASSIGNMENT(TYPE, OPRD) \
+{ \
+ _Decimal##TYPE d = OPRD; \
+ OPERATE(d,+=,1,(OPRD + 1)); \
+ d = OPRD; \
+ OPERATE(d,+=,0,OPRD); \
+ d = OPRD; \
+ OPERATE(d,+=,(-1),(OPRD - 1)); \
+ d = OPRD; \
+ OPERATE(d,+=,d32a,(OPRD + d32a)); \
+ d = OPRD; \
+ OPERATE(d,+=,d64a,(OPRD + d64a)); \
+ d = OPRD; \
+ OPERATE(d,+=,d128a,(OPRD + d128a)); \
+ d = OPRD; \
+ OPERATE(d,+=,(_Decimal##TYPE)1.1,(OPRD + (_Decimal##TYPE)1.1)); \
+ d = OPRD; \
+ OPERATE(d,+=,(_Decimal##TYPE)2.2f,(OPRD + (_Decimal##TYPE)2.2f)); \
+ d = OPRD; \
+ OPERATE(d,-=,1,(OPRD - 1)); \
+ d = OPRD; \
+ OPERATE(d,-=,0,OPRD); \
+ d = OPRD; \
+ OPERATE(d,-=,(-1),(OPRD + 1)); \
+ d = OPRD; \
+ OPERATE(d,-=,d32a,OPRD-d32a); \
+ d = OPRD; \
+ OPERATE(d,-=,d64a,OPRD-d64a); \
+ d = OPRD; \
+ OPERATE(d,-=,d128a,OPRD-d128a); \
+}
+
+int
+main ()
+{
+ _Decimal32 d32 = 1.23456df, d32a = 1.2df;
+ _Decimal64 d64 = 23.456789dd, d64a = 2.8dd;
+ _Decimal128 d128 = 345.67890123456789dl, d128a = 4.7dl;
+
+ DECIMAL_COMPOUND_ASSIGNMENT(32, d32);
+ DECIMAL_COMPOUND_ASSIGNMENT(64, d64);
+ DECIMAL_COMPOUND_ASSIGNMENT(128, d128);
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-comma.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-comma.c
new file mode 100644
index 000000000..be6bf6f8c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-comma.c
@@ -0,0 +1,47 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.17: Comma operator.
+ Test with decimal float operands. */
+
+#include "dfp-dbg.h"
+
+volatile _Decimal32 d32a, d32b, d32c;
+volatile _Decimal64 d64a, d64b, d64c;
+volatile _Decimal128 d128a, d128b, d128c;
+
+void
+init ()
+{
+ d32b = 123.456e94df;
+ d64b = 12.3456789012345e383dd;
+ d128b = 12345.6789012345678901e4000dl;
+
+ d32c = 1.3df;
+ d64c = 1.2dd;
+ d128c = 1.1dl;
+}
+
+int
+main ()
+{
+ d32a = (d32b, d32c);
+ if (d32a != d32c)
+ FAILURE
+ d64a = (d64b, 7.89dd, d64c);
+ if (d64a != d64c)
+ FAILURE
+ d128a = (45678.987654dl, d128c, d128b);
+ if (d128a != d128b)
+ FAILURE
+ d128a = (d32b, d64b, d128b);
+ if (d128a != d128b)
+ FAILURE
+ d32a = (d32b, 12, d64c);
+ if (d32a != d64c)
+ FAILURE;
+ d64a = (d64b, d32b, 12);
+ if (d64a != 12.0dd)
+ FAILURE;
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-cond.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-cond.c
new file mode 100644
index 000000000..140dd9507
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-cond.c
@@ -0,0 +1,57 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.15 Conditional operator.
+ Test with decimal float operands. */
+
+#include "dfp-dbg.h"
+
+volatile _Decimal32 d32a, d32b, d32c;
+volatile _Decimal64 d64a, d64b, d64c;
+volatile _Decimal128 d128a, d128b, d128c;
+volatile int i, yes, no;
+
+void
+init ()
+{
+ d32b = 123.456e94df;
+ d64b = 12.3456789012345e383dd;
+ d128b = 12345.6789012345678901e4000dl;
+
+ d32c = 1.3df;
+ d64c = 1.2dd;
+ d128c = 1.1dl;
+
+ i = 2;
+ yes = 1;
+ no = 0;
+}
+
+int
+main ()
+{
+ init ();
+
+ /* Operands and the result are all the same decimal float type. */
+ d32a = yes ? d32b : d32c;
+ if (d32a != d32b)
+ FAILURE
+ d64a = no ? d64b : d64c;
+ if (d64a != d64c)
+ FAILURE
+ d128a = yes ? d128b : d128c;
+ if (d128a != d128b)
+ FAILURE
+
+ /* Operand types are different. */
+ d128a = yes ? d32b : d64b;
+ if (d128a != d32b)
+ FAILURE
+ d128a = yes ? d128b : d64b;
+ if (d128a != d128b)
+ FAILURE
+ d128a = no ? d32b : d128b;
+ if (d128a != d128b)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-logical.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-logical.c
new file mode 100644
index 000000000..c784468c7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-logical.c
@@ -0,0 +1,63 @@
+/* C99 Logical AND operator.
+ C99 Logical OR operator.
+ Test with decimal float operands. */
+
+#include "dfp-dbg.h"
+
+#define OPERATE(OPRD1,OPRT,OPRD2,RLT) \
+do \
+{ \
+ if (( (OPRD1) OPRT (OPRD2) )!= RLT) \
+ __builtin_abort (); \
+} while (0)
+
+#define DECIMAL_LOGICAL_OR(OPRD) \
+do \
+{ \
+ OPRD = 1.0; \
+ OPERATE(1,||,OPRD,1); \
+ OPERATE(0,||,OPRD,1); \
+ OPERATE(OPRD,||,1,1); \
+ OPERATE(OPRD,||,0,1); \
+ OPRD = 0.0; \
+ OPERATE(1,||,OPRD,1); \
+ OPERATE(0,||,OPRD,0); \
+ OPERATE(OPRD,||,1,1); \
+ OPERATE(OPRD,||,0,0); \
+} while (0)
+
+#define DECIMAL_LOGICAL_AND(OPRD) \
+do \
+{ \
+ OPRD = 1.0; \
+ OPERATE(1,&&,OPRD,1); \
+ OPERATE(0,&&,OPRD,0); \
+ OPERATE(OPRD,&&,1,1); \
+ OPERATE(OPRD,&&,0,0); \
+ OPRD = 0.0; \
+ OPERATE(1,&&,OPRD,0); \
+ OPERATE(0,&&,OPRD,0); \
+ OPERATE(OPRD,&&,1,0); \
+ OPERATE(OPRD,&&,0,0); \
+} while (0)
+
+int
+main ()
+{
+ _Decimal32 d32;
+ _Decimal64 d64;
+ _Decimal128 d128;
+
+ /* C99 Section 6.5.{13,14} Logical operator. Constraints Each of the
+ operands shall have scalar type. DFP types would obey this. */
+ DECIMAL_LOGICAL_OR (d32);
+ DECIMAL_LOGICAL_AND (d32);
+
+ DECIMAL_LOGICAL_OR (d64);
+ DECIMAL_LOGICAL_AND (d64);
+
+ DECIMAL_LOGICAL_OR (d128);
+ DECIMAL_LOGICAL_AND (d128);
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-unary.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-unary.c
new file mode 100644
index 000000000..65f0be074
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-unary.c
@@ -0,0 +1,52 @@
+/* C99 6.5.3 Unary operators. */
+
+#include "dfp-dbg.h"
+
+#define AUTO_INCREASE_DECREASE(TYPE,SUFFIX) \
+do \
+{ \
+ _Decimal##TYPE in_de_d##TYPE = 0.0##SUFFIX; \
+ if (in_de_d##TYPE++) FAILURE \
+ if (--in_de_d##TYPE) FAILURE \
+ if (++in_de_d##TYPE == 0.0##SUFFIX) FAILURE \
+ if (in_de_d##TYPE-- == 0.0##SUFFIX) FAILURE \
+} while(0)
+
+#define UNARY_OPERATOR(TYPE,SUFFIX) \
+do \
+{ \
+ _Decimal##TYPE unary_d##TYPE = 1.0##SUFFIX; \
+ _Decimal##TYPE* unary_dp##TYPE; \
+ /* & operator. */ \
+ unary_dp##TYPE = &(unary_d##TYPE); \
+ /* * operator. */ \
+ unary_d##TYPE = *(unary_dp##TYPE); \
+ /* - operator. */ \
+ unary_d##TYPE = -unary_d##TYPE; \
+ if (unary_d##TYPE != -1.0##SUFFIX) FAILURE \
+ /* + operator. */ \
+ unary_d##TYPE = +unary_d##TYPE; \
+ if (unary_d##TYPE != -1.0##SUFFIX) FAILURE \
+ if (!unary_d##TYPE) FAILURE /*! operator. */ \
+} while (0)
+
+int
+main ()
+{
+ /* C99 6.5.3.1 Prefix increment and decrement operators. */
+ AUTO_INCREASE_DECREASE(32, DF);
+ AUTO_INCREASE_DECREASE(64, DD);
+ AUTO_INCREASE_DECREASE(128, DL);
+
+ /* C99 6.5.3 Unary operators. */
+ UNARY_OPERATOR(32, DF);
+ UNARY_OPERATOR(64, DD);
+ UNARY_OPERATOR(128, DL);
+
+ /* C99 6.5.3 Unary operators for zero values. */
+ if (- +0.df != -0.df) FAILURE
+ if (+ -0.df != -0.df) FAILURE
+ if (- -0.df != +0.df) FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr31385.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr31385.c
new file mode 100644
index 000000000..fc024a3e6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr31385.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef float fp_t __attribute__((mode(SD)));
+
+extern fp_t g(fp_t);
+
+fp_t
+bug(fp_t x)
+{
+ fp_t result;
+ int n;
+ fp_t f, f3, y, z;
+
+ n = 0;
+ y = 1.DF;
+ f = g(x);
+
+ if (f < 0.DF)
+ f = -f;
+
+ f3 = 2.DF;
+
+ z = (y + y + f / (y * y));
+ y = (z + z) / (9.DF) + f3 / (z * z);
+
+ result = y;
+
+ return (result);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr33466.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr33466.c
new file mode 100644
index 000000000..9b10a092b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr33466.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+/* The suffix for a decimal float constant must use a single case.
+
+ These are invalid for all targets, not just those that support
+ decimal float. */
+
+long double dF = 4.5dF; /* { dg-error "invalid suffix|literal operator" } */
+long double Df = 4.5Df; /* { dg-error "invalid suffix|literal operator" } */
+long double dD = 4.5dD; /* { dg-error "invalid suffix|literal operator" } */
+long double Dd = 4.5Dd; /* { dg-error "invalid suffix|literal operator" } */
+long double dL = 4.5dL; /* { dg-error "invalid suffix|literal operator" } */
+long double Dl = 4.5Dl; /* { dg-error "invalid suffix|literal operator" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr35620.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr35620.c
new file mode 100644
index 000000000..2d56ab76b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr35620.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#ifdef __cplusplus
+typedef float _Decimal32 __attribute__((mode(SD)));
+#endif
+
+extern void foo (_Decimal32);
+_Decimal32 *p;
+
+extern int i;
+union U { _Decimal32 a; int b; } u;
+
+void
+blatz (void)
+{
+ _Decimal32 d;
+ u.b = i;
+ d = u.a;
+ foo (d);
+}
+
+void
+bar (void)
+{
+ foo (*p);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr36800.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr36800.c
new file mode 100644
index 000000000..76ff28c98
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr36800.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+
+#include <stdarg.h>
+#include "dfp-dbg.h"
+
+void
+f (int a, ...)
+{
+ va_list ap;
+ if (a != 0)
+ FAILURE
+ va_start (ap, a);
+ if (va_arg (ap, _Decimal128) != 1.2DL)
+ FAILURE
+ if (va_arg (ap, _Decimal128) != 2.34DL)
+ FAILURE
+ if (va_arg (ap, _Decimal128) != 3.456DL)
+ FAILURE
+ if (va_arg (ap, _Decimal128) != 4.567DL)
+ FAILURE
+ if (va_arg (ap, double) != 5.125)
+ FAILURE
+ va_end (ap);
+}
+
+int
+main (void)
+{
+ f (0, 1.2DL, 2.34DL, 3.456DL, 4.567DL, 5.125);
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr39034.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr39034.c
new file mode 100644
index 000000000..2a7eedbdb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr39034.c
@@ -0,0 +1,100 @@
+/* { dg-do run } */
+/* { dg-options "-O" } */
+
+/* DFP TR 24732 == WG14 / N1176, N1312 */
+/* Based on a test from Fred Tydeman. */
+
+#include "dfp-dbg.h"
+
+/* Test runtime computations. */
+
+void
+runtime32 (void)
+{
+ volatile float v1 = 28.f, v2 = 3.f, v3 = 9.f, v4 = 31.f, v5 = 3.f, v6 = 10.f;
+ float b32 = (float)((v1/v2-v3) - (v4/v5-v6));
+ _Decimal32 d32 = (float)((v1/v2-v3) - (v4/v5-v6));
+
+ if (b32)
+ FAILURE
+ if (d32)
+ FAILURE
+}
+
+void
+runtime64 (void)
+{
+ volatile double v1 = 28., v2 = 3., v3 = 9., v4 = 31., v5 = 3., v6 = 10.;
+ double b64 = (double)((v1/v2-v3) - (v4/v5-v6));
+ _Decimal64 d64 = (double)((v1/v2-v3) - (v4/v5-v6));
+
+ if (b64)
+ FAILURE
+ if (d64)
+ FAILURE
+}
+
+void
+runtime128 (void)
+{
+ volatile long double v1 = 28.l, v2 = 3.l, v3 = 9.l,
+ v4 = 31.l, v5 = 3.l, v6 = 10.l;
+ long double b128 = (long double)((v1/v2-v3) - (v4/v5-v6));
+ _Decimal128 d128 = (long double)((v1/v2-v3) - (v4/v5-v6));
+
+ if (b128)
+ FAILURE
+ if (d128)
+ FAILURE
+}
+
+/* Test constant folding. */
+
+void
+fold32 (void)
+{
+ double d32 = (float)((28.f/3.f-9.f) - (31.f/3.f-10.f));
+ _Decimal32 b32 = (float)((28.f/3.f-9.f) - (31.f/3.f-10.f));
+
+ if (b32)
+ FAILURE
+ if (d32)
+ FAILURE
+}
+
+void
+fold64 (void)
+{
+ double b64 = (double)((28./3.-9.) - (31./3.-10.));
+ _Decimal64 d64 = (double)((28./3.-9.) - (31./3.-10.));
+
+ if (b64)
+ FAILURE
+ if (d64)
+ FAILURE
+}
+
+void
+fold128 (void)
+{
+ long double b128 = (long double)((28./3.-9.) - (31./3.-10.));
+ _Decimal128 d128 = (long double)((28./3.-9.) - (31./3.-10.));
+
+ if (b128)
+ FAILURE
+ if (d128)
+ FAILURE
+}
+
+int
+main ()
+{
+ runtime32 ();
+ runtime64 ();
+ runtime128 ();
+ fold32 ();
+ fold64 ();
+ fold128 ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr39035.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr39035.c
new file mode 100644
index 000000000..2c9e8b386
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr39035.c
@@ -0,0 +1,71 @@
+/* { dg-do run } */
+/* { dg-options "-O" } */
+
+/* DFP TR 24732 == WG14 / N1176, N1312 */
+/* Based on a test from Fred Tydeman. */
+
+#include "dfp-dbg.h"
+
+/* Test runtime computations. */
+
+void
+runtime32 (void)
+{
+ volatile _Decimal32 d;
+ d = 0.0DF;
+ if (d)
+ FAILURE
+}
+
+void
+runtime64 (void)
+{
+ volatile _Decimal64 d;
+ d = 0.0DD;
+ if (d)
+ FAILURE
+}
+
+void
+runtime128 (void)
+{
+ volatile _Decimal128 d;
+ d = 0.0DL;
+ if (d)
+ FAILURE
+}
+
+void
+fold32 (void)
+{
+ if (0.0DF)
+ FAILURE
+}
+
+void
+fold64 (void)
+{
+ if (0.0DD)
+ FAILURE
+}
+
+void
+fold128 (void)
+{
+ if (0.0DL)
+ FAILURE
+}
+
+int
+main(void)
+{
+ runtime32 ();
+ runtime64 ();
+ runtime128 ();
+
+ fold32 ();
+ fold64 ();
+ fold128 ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr39902.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr39902.c
new file mode 100644
index 000000000..847069966
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr39902.c
@@ -0,0 +1,226 @@
+/* Check that optimizations like (x * 1) to x, or (x * -1) to -x,
+ do not apply to decimal float computations where trailing zeroes
+ are significant. */
+
+#include "dfp-dbg.h"
+
+#define COMPARE32(A,B) \
+ A.i == B.i
+
+#define COMPARE64(A,B) \
+ A.i[0] == B.i[0] && A.i[1] == B.i[1]
+
+#define COMPARE128(A,B) \
+ A.i[0] == B.i[0] && A.i[1] == B.i[1] && A.i[2] == B.i[2] && A.i[3] == B.i[3]
+
+typedef union {
+ _Decimal32 d;
+ unsigned int i;
+} u32;
+
+typedef union {
+ _Decimal64 d;
+ unsigned int i[2];
+} u64;
+
+typedef union {
+ _Decimal128 d;
+ unsigned int i[4];
+} u128;
+
+volatile u32 p32_1;
+volatile u32 p32_1_0;
+volatile u32 p32_2_0;
+volatile u32 m32_1;
+volatile u32 m32_1_0;
+volatile u32 m32_2_0;
+volatile u32 a32;
+
+volatile u64 p64_1;
+volatile u64 p64_1_0;
+volatile u64 p64_2_0;
+volatile u64 m64_1;
+volatile u64 m64_1_0;
+volatile u64 m64_2_0;
+volatile u64 a64;
+
+volatile u128 p128_1;
+volatile u128 p128_1_0;
+volatile u128 p128_2_0;
+volatile u128 m128_1;
+volatile u128 m128_1_0;
+volatile u128 m128_2_0;
+volatile u128 a128;
+
+void
+init32 (void)
+{
+ p32_1.d = 1.DF;
+ p32_1_0.d = 1.0DF;
+ p32_2_0.d = 2.0DF;
+ m32_1.d = -1.DF;
+ m32_1_0.d = -1.0DF;
+ m32_2_0.d = -2.0DF;
+}
+
+void
+init64 (void)
+{
+ p64_1.d = 1.DD;
+ p64_1_0.d = 1.0DD;
+ p64_2_0.d = 2.0DD;
+ m64_1.d = -1.DD;
+ m64_1_0.d = -1.0DD;
+ m64_2_0.d = -2.0DD;
+}
+
+void
+init128 (void)
+{
+ p128_1.d = 1.DL;
+ p128_1_0.d = 1.0DL;
+ p128_2_0.d = 2.0DL;
+ m128_1.d = -1.DL;
+ m128_1_0.d = -1.0DL;
+ m128_2_0.d = -2.0DL;
+}
+
+void
+doit32 (void)
+{
+ /* Multiplying by a value with no trailing zero should not change the
+ quantum exponent. */
+
+ a32.d = p32_2_0.d * p32_1.d;
+ if (! (COMPARE32 (a32, p32_2_0)))
+ FAILURE
+
+ a32.d = p32_2_0.d * 1.DF;
+ if (! (COMPARE32 (a32, p32_2_0)))
+ FAILURE
+
+ a32.d = p32_2_0.d * m32_1.d;
+ if (! (COMPARE32 (a32, m32_2_0)))
+ FAILURE
+
+ a32.d = p32_2_0.d * -1.DF;
+ if (! (COMPARE32 (a32, m32_2_0)))
+ FAILURE
+
+ /* Multiplying by a value with a trailing zero should change the
+ quantum exponent. */
+
+ a32.d = p32_2_0.d * p32_1_0.d;
+ if (COMPARE32 (a32, p32_2_0))
+ FAILURE
+
+ a32.d = p32_2_0.d * 1.0DF;
+ if (COMPARE32 (a32, p32_2_0))
+ FAILURE
+
+ a32.d = p32_2_0.d * m32_1_0.d;
+ if (COMPARE32 (a32, m32_2_0))
+ FAILURE
+
+ a32.d = p32_2_0.d * -1.0DF;
+ if (COMPARE32 (a32, m32_2_0))
+ FAILURE
+}
+
+void
+doit64 (void)
+{
+ /* Multiplying by a value with no trailing zero should not change the
+ quantum exponent. */
+
+ a64.d = p64_2_0.d * p64_1.d;
+ if (! (COMPARE64 (a64, p64_2_0)))
+ FAILURE
+
+ a64.d = p64_2_0.d * 1.DD;
+ if (! (COMPARE64 (a64, p64_2_0)))
+ FAILURE
+
+ a64.d = p64_2_0.d * m64_1.d;
+ if (! (COMPARE64 (a64, m64_2_0)))
+ FAILURE
+
+ a64.d = p64_2_0.d * -1.DD;
+ if (! (COMPARE64 (a64, m64_2_0)))
+ FAILURE
+
+ /* Multiplying by a value with a trailing zero should change the
+ quantum exponent. */
+
+ a64.d = p64_2_0.d * p64_1_0.d;
+ if (COMPARE64 (a64, p64_2_0))
+ FAILURE
+
+ a64.d = p64_2_0.d * 1.0DD;
+ if (COMPARE64 (a64, p64_2_0))
+ FAILURE
+
+ a64.d = p64_2_0.d * m64_1_0.d;
+ if (COMPARE64 (a64, m64_2_0))
+ FAILURE
+
+ a64.d = p64_2_0.d * -1.0DD;
+ if (COMPARE64 (a64, m64_2_0))
+ FAILURE
+}
+
+void
+doit128 (void)
+{
+ /* Multiplying by a value with no trailing zero should not change the
+ quantum exponent. */
+
+ a128.d = p128_2_0.d * p128_1_0.d;
+ if (COMPARE128 (a128, p128_2_0))
+ FAILURE
+
+ a128.d = p128_2_0.d * 1.0DL;
+ if (COMPARE128 (a128, p128_2_0))
+ FAILURE
+
+ a128.d = p128_2_0.d * m128_1_0.d;
+ if (COMPARE128 (a128, m128_2_0))
+ FAILURE
+
+ a128.d = p128_2_0.d * -1.0DL;
+ if (COMPARE128 (a128, m128_2_0))
+ FAILURE
+
+ /* Multiplying by a value with a trailing zero should change the
+ quantum exponent. */
+
+ a128.d = p128_2_0.d * p128_1.d;
+ if (! (COMPARE128 (a128, p128_2_0)))
+ FAILURE
+
+ a128.d = p128_2_0.d * 1.DL;
+ if (! (COMPARE128 (a128, p128_2_0)))
+ FAILURE
+
+ a128.d = p128_2_0.d * m128_1.d;
+ if (! (COMPARE128 (a128, m128_2_0)))
+ FAILURE
+
+ a128.d = p128_2_0.d * -1.DL;
+ if (! (COMPARE128 (a128, m128_2_0)))
+ FAILURE
+}
+
+int
+main (void)
+{
+ init32 ();
+ init64 ();
+ init128 ();
+
+ doit32 ();
+ doit64 ();
+ doit128 ();
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr39986.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr39986.c
new file mode 100644
index 000000000..e7c9ce982
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/pr39986.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+
+#include "dfp-dbg.h"
+
+/* Check that the compiler generates the correct decimal float constants. */
+
+_Decimal32 a = 100.223df;
+_Decimal32 b = -2.3df;
+_Decimal64 c = 3.4e-4dd;
+_Decimal64 d = -4.500dd;
+_Decimal128 e = 5678901234567.89e+200dl;
+_Decimal128 f = -678901.234e-6dl;
+
+/* The first value is DPD, the second is BID. The order differs depending
+ on whether the target is big-endian or little-endian. */
+
+/* { dg-final { scan-assembler ".long\t(572653859|822183807)\n" } } */
+
+/* { dg-final { scan-assembler ".long\t(-1572863965|-1308622825)\n" } } */
+
+/* { dg-final { scan-assembler ".long\t(52|34)\n" } } */
+/* { dg-final { scan-assembler ".long\t(572784640|824180736)\n" } } */
+
+/* { dg-final { scan-assembler ".long\t(4736|4500)\n" } } */
+/* { dg-final { scan-assembler ".long\t(-1574174720|-1319108608)\n" } } */
+
+/* { dg-final { scan-assembler ".long\t(-1975952433|957645077)\n" } } */
+/* { dg-final { scan-assembler ".long\t(190215|132222)\n" } } */
+/* { dg-final { scan-assembler ".long\t(574193664|835452928)\n" } } */
+
+/* { dg-final { scan-assembler ".long\t(931280180|678901234)\n" } } */
+/* { dg-final { scan-assembler ".long\t(-1576681472|-1339162624)\n" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/signbit-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/signbit-1.c
new file mode 100644
index 000000000..d83d2a48e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/signbit-1.c
@@ -0,0 +1,40 @@
+/* { dg-options "-O0" } */
+
+/* Decimal float versions of __builtin_signbit. */
+
+#include "dfp-dbg.h"
+
+#define CHECK32(D,I) \
+ if ((__builtin_signbitd32 (D) != 0) != I) FAILURE
+
+#define CHECK64(D,I) \
+ if ((__builtin_signbitd64 (D) != 0) != I) FAILURE
+
+#define CHECK128(D,I) \
+ if ((__builtin_signbitd128 (D) != 0) != I) FAILURE
+
+/* Prevent the compiler from folding the calls at compile time. */
+volatile _Decimal32 sd;
+volatile _Decimal64 dd;
+volatile _Decimal128 td;
+
+int
+main ()
+{
+ sd = 1.9df; CHECK32 (sd, 0)
+ sd = -5.3df; CHECK32 (sd, 1)
+ sd = 0.0df; CHECK32 (sd, 0)
+ sd = -0.0df; CHECK32 (sd, 1)
+
+ dd = 1.9dd; CHECK64 (dd, 0)
+ dd = -5.3dd; CHECK64 (dd, 1)
+ dd = 0.0dd; CHECK64 (dd, 0)
+ dd = -0.0dd; CHECK64 (dd, 1)
+
+ td = 1.9dl; CHECK128 (td, 0)
+ td = -5.3dl; CHECK128 (td, 1)
+ td = 0.0dl; CHECK128 (td, 0)
+ td = -0.0dl; CHECK128 (td, 1)
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/signbit-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/signbit-2.c
new file mode 100644
index 000000000..5444d8f64
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/signbit-2.c
@@ -0,0 +1,36 @@
+/* { dg-options "-O1" } */
+
+/* Check that the compiler uses builtins for signbit; if not the link
+ will fail because library functions are in libm. */
+/* See PR51867.
+ Since GCC uses library call when optimizing for "-O0", this test
+ case requires at least "-O1" level optimization now. */
+
+#include "dfp-dbg.h"
+
+volatile _Decimal32 sd = 2.3df;
+volatile _Decimal64 dd = -4.5dd;
+volatile _Decimal128 tf = 5.3dl;
+volatile float f = 1.2f;
+volatile double d = -7.8;
+volatile long double ld = 3.4L;
+
+EXTERN int signbitf (float);
+EXTERN int signbit (double);
+EXTERN int signbitl (long double);
+EXTERN int signbitd32 (_Decimal32);
+EXTERN int signbitd64 (_Decimal64);
+EXTERN int signbitd128 (_Decimal128);
+
+int
+main ()
+{
+ if (signbitf (f) != 0) FAILURE
+ if (signbit (d) == 0) FAILURE
+ if (signbitl (ld) != 0) FAILURE
+ if (signbitd32 (sd) != 0) FAILURE
+ if (signbitd64 (dd) == 0) FAILURE
+ if (signbitd128 (tf) != 0) FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/struct-layout-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/struct-layout-1.c
new file mode 100644
index 000000000..2a9d7304f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/struct-layout-1.c
@@ -0,0 +1,71 @@
+#include <stdarg.h>
+#include "dfp-dbg.h"
+
+struct S1
+{
+ _Decimal64 a[0];
+};
+
+struct S2
+{
+ struct
+ {
+ _Decimal64 e;
+ } b[0];
+};
+
+struct S3
+{
+ union
+ {
+ _Decimal64 c;
+ } a[0];
+};
+
+struct S4
+{
+ int a[0];
+ _Decimal64 b[0];
+};
+
+struct S5
+{
+ union
+ {
+ _Decimal64 c[0];
+ } a;
+};
+
+int check_var (int z, ...)
+{
+ long long result;
+ va_list ap;
+ va_start (ap, z);
+ va_arg (ap, struct S1);
+ result = va_arg (ap, long long);
+ va_end (ap);
+
+ return (result == 2LL);
+}
+
+int main ()
+{
+ struct S1 s1;
+ struct S2 s2;
+ struct S3 s3;
+ struct S4 s4;
+ struct S5 s5;
+
+ if (check_var (2, s1, 2LL) == 0)
+ FAILURE;
+ if (check_var (2, s2, 2LL) == 0)
+ FAILURE;
+ if (check_var (2, s3, 2LL) == 0)
+ FAILURE;
+ if (check_var (2, s4, 2LL) == 0)
+ FAILURE;
+ if (check_var (2, s5, 2LL) == 0)
+ FAILURE;
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/usual-arith-conv-const.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/usual-arith-conv-const.c
new file mode 100644
index 000000000..2d72bba42
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/usual-arith-conv-const.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+
+/* Test various conversions involving decimal floating types. */
+
+#include "dfp-dbg.h"
+
+/* Assertion that constant C is of type T. */
+#define ASSERT_CONST_TYPE(C, T) \
+ do { \
+ typedef T type; \
+ typedef type **typepp; \
+ typedef __typeof__((C)) ctype; \
+ typedef ctype **ctypepp; \
+ typepp x = 0; \
+ ctypepp y = 0; \
+ x = y; \
+ y = x; \
+ } while (0)
+
+int
+main ()
+{
+ ASSERT_CONST_TYPE (3 + 2.1df, _Decimal32); /* { dg-bogus "assignment from incompatible pointer type" } */
+ ASSERT_CONST_TYPE (1.3df + 2, _Decimal32); /* { dg-bogus "assignment from incompatible pointer type" } */
+ ASSERT_CONST_TYPE (56U - 55.0dd, _Decimal64); /* { dg-bogus "assignment from incompatible pointer type" } */
+ ASSERT_CONST_TYPE (5 * .2DL, _Decimal128); /* { dg-bogus "assignment from incompatible pointer type" } */
+ ASSERT_CONST_TYPE (.88dl / 2L, _Decimal128); /* { dg-bogus "assignment from incompatible pointer type" } */
+ ASSERT_CONST_TYPE (.114df - 1.6dd, _Decimal64); /* { dg-bogus "assignment from incompatible pointer type" } */
+ ASSERT_CONST_TYPE (3L - 1 + .55df, _Decimal32); /* { dg-bogus "assignment from incompatible pointer type" } */
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/usual-arith-conv.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/usual-arith-conv.c
new file mode 100644
index 000000000..baff06bc1
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/usual-arith-conv.c
@@ -0,0 +1,117 @@
+/* { dg-options "-O0" } */
+
+/* N1150 5.4: Usual arithmetic conversions.
+ C99 6.3.1.8[1] (New).
+
+ Test arithmetic operators with different decimal float types, and
+ between decimal float types and integer types. */
+
+#include "dfp-dbg.h"
+
+volatile _Decimal32 d32a, d32b, d32c;
+volatile _Decimal64 d64a, d64b, d64c;
+volatile _Decimal128 d128a, d128b, d128c;
+volatile int i;
+
+void
+init ()
+{
+ d32b = 123.456e94df;
+ d64b = 12.3456789012345e383dd;
+ d128b = 12345.6789012345678901e4000dl;
+
+ d32c = 1.3df;
+ d64c = 1.2dd;
+ d128c = 1.1dl;
+
+ i = 2;
+}
+
+int
+main ()
+{
+ init ();
+
+ /* Usual arithmetic conversions between decimal float types; addition. */
+ d128a = d128b + d32b;
+ if (d128a < d128b)
+ FAILURE
+ d128a = d32b + d128b;
+ if (d128a < d128b)
+ FAILURE
+ d128a = d128b + d64b;
+ if (d128a < d128b)
+ FAILURE
+ d128a = d64b + d128b;
+ if (d128a < d128b)
+ FAILURE
+ d64a = d64b + d32b;
+ if (d64a < d64b)
+ FAILURE
+ d64a = d32b + d64b;
+ if (d64a < d64b)
+ FAILURE
+
+ /* Usual arithmetic conversions between decimal float types;
+ multiplication. */
+ d128a = d128b * d32c;
+ if (d128a < d128b)
+ FAILURE
+ d128a = d32c * d128b;
+ if (d128a < d128b)
+ FAILURE
+ d128a = d128b * d64c;
+ if (d128a < d128b)
+ FAILURE
+ d128a = d64c * d128b;
+ if (d128a < d128b)
+ FAILURE
+ d64a = d64b * d32c;
+ if (d64a < d64b)
+ FAILURE
+ d64a = d32c * d64b;
+ if (d64a < d64b)
+ FAILURE
+
+ /* Usual arithmetic conversions between decimal float and integer types. */
+ d32a = d32c + i;
+ if (d32a != d32c + 2.0df)
+ FAILURE
+ d32a = d32c - i;
+ if (d32a != d32c - 2.0df)
+ FAILURE
+ d32a = i * d32c;
+ if (d32a != d32c + d32c)
+ FAILURE
+ d32a = d32c / i;
+ if (d32a != d32c / 2.0df)
+ FAILURE
+
+ d64a = i + d64c;
+ if (d64a != d64c + 2.0dd)
+ FAILURE
+ d64a = d64c - i;
+ if (d64a != d64c - 2.0dd)
+ FAILURE
+ d64a = d64c * i;
+ if (d64a != d64c + d64c)
+ FAILURE
+ d64a = d64c / i;
+ if (d64a != d64c / 2.0dd)
+ FAILURE
+
+ d128a = d128c + i;
+ if (d128a != d128c + 2.0dl)
+ FAILURE
+ d128a = d128c - i;
+ if (d128a != d128c - 2.0dl)
+ FAILURE
+ d128a = i * d128c;
+ if (d128a != d128c + d128c)
+ FAILURE
+ d128a = d128c / i;
+ if (d128a != d128c / 2.0dl)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dwarf2/pr43190.c b/gcc-4.9/gcc/testsuite/c-c++-common/dwarf2/pr43190.c
new file mode 100644
index 000000000..2cb1b7086
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dwarf2/pr43190.c
@@ -0,0 +1,13 @@
+/* PR debug/43190 */
+/* { dg-options "-gdwarf-2 -dA" } */
+/* { dg-final { scan-assembler "DW_TAG_structure_type\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"S\[^\\r\\n\]*DW_AT_name" } } */
+/* { dg-final { scan-assembler "DW_TAG_typedef\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"T\[^\\r\\n\]*DW_AT_name" } } */
+
+typedef struct S { int i; } *T;
+#define M(p) ((T) (p))
+
+void
+foo (void *p)
+{
+ M (p)->i++;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dwarf2/vla1.c b/gcc-4.9/gcc/testsuite/c-c++-common/dwarf2/vla1.c
new file mode 100644
index 000000000..e814bf568
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/dwarf2/vla1.c
@@ -0,0 +1,11 @@
+// PR debug/42800
+// { dg-options "-gdwarf-2 -dA" }
+// { dg-final { scan-assembler "DW_AT_upper_bound" } }
+
+int
+f (int i)
+{
+ char a[i];
+
+ return a[0];
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/fmax-errors.c b/gcc-4.9/gcc/testsuite/c-c++-common/fmax-errors.c
new file mode 100644
index 000000000..1ef78eb9e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/fmax-errors.c
@@ -0,0 +1,11 @@
+/* PR c/44782 */
+/* { dg-do compile } */
+/* { dg-options "-fmax-errors=3" } */
+
+void foo (unsigned int i, unsigned int j)
+{
+ (i) (); /* { dg-error "" } */
+ (j) (); /* { dg-error "" } */
+ (i+j) (); /* { dg-error "" } */
+ (i*j) (); /* no error here due to -fmax-errors */
+} /* { dg-prune-output "compilation terminated" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/fold-bitand-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/fold-bitand-4.c
new file mode 100644
index 000000000..a5d3168be
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/fold-bitand-4.c
@@ -0,0 +1,45 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+/* { dg-additional-options "-fno-common" { target hppa*-*-hpux* } } */
+
+typedef char char4[4] __attribute__ ((aligned (4)));
+char4 c4[4] __attribute__ ((aligned (16)));
+
+typedef char char16[16] __attribute__ ((aligned (16)));
+char16 c16[4] __attribute__ ((aligned (4)));
+
+int f1 (void)
+{
+ /* 12 */
+ return 15 & (__SIZE_TYPE__)&c4[3];
+}
+
+int f2 (int i)
+{
+ /* Indeterminate */
+ return 15 & (__SIZE_TYPE__)&c4[i];
+}
+
+int f3 (int i)
+{
+ /* 0 */
+ return 3 & (__SIZE_TYPE__)&c4[i];
+}
+
+int f4 (int i)
+{
+ /* Indeterminate */
+ return 7 & (__SIZE_TYPE__)&c16[i];
+}
+
+int f5 (int i)
+{
+ /* 0 */
+ return 3 & (__SIZE_TYPE__)&c16[i];
+}
+
+/* { dg-final { scan-tree-dump-times "return \[^\n0-9\]*12;" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "\& 15" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "return \[^\n0-9\]*0;" 2 "original" } } */
+/* { dg-final { scan-tree-dump-times "\& 7" 1 "original" } } */
+/* { dg-final { cleanup-tree-dump "original" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/fold-divmul-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/fold-divmul-1.c
new file mode 100644
index 000000000..5c867923d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/fold-divmul-1.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+int *
+fx (int *b, int *e)
+{
+ return b + (e - b);
+}
+
+/* { dg-final { scan-tree-dump-not "/\\\[ex\\\]" "original" } } */
+/* { dg-final { cleanup-tree-dump "original" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-1.c
new file mode 100644
index 000000000..3e4bc569b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-1.c
@@ -0,0 +1,99 @@
+/* { dg-do compile } */
+
+int x;
+volatile int y;
+volatile unsigned char z;
+
+void f1(void)
+{
+ #pragma omp atomic
+ x++;
+ #pragma omp atomic
+ x--;
+ #pragma omp atomic
+ ++x;
+ #pragma omp atomic
+ --x;
+ #pragma omp atomic
+ x += 1;
+ #pragma omp atomic
+ x -= y;
+ #pragma omp atomic
+ x |= 1;
+ #pragma omp atomic
+ x &= 1;
+ #pragma omp atomic
+ x ^= 1;
+ #pragma omp atomic
+ x *= 3;
+ #pragma omp atomic
+ x /= 3;
+ #pragma omp atomic
+ x /= 3;
+ #pragma omp atomic
+ x <<= 3;
+ #pragma omp atomic
+ x >>= 3;
+}
+
+void f2(void)
+{
+ #pragma omp atomic
+ y++;
+ #pragma omp atomic
+ y--;
+ #pragma omp atomic
+ ++y;
+ #pragma omp atomic
+ --y;
+ #pragma omp atomic
+ y += 1;
+ #pragma omp atomic
+ y -= x;
+ #pragma omp atomic
+ y |= 1;
+ #pragma omp atomic
+ y &= 1;
+ #pragma omp atomic
+ y ^= 1;
+ #pragma omp atomic
+ y *= 3;
+ #pragma omp atomic
+ y /= 3;
+ #pragma omp atomic
+ y /= 3;
+ #pragma omp atomic
+ y <<= 3;
+ #pragma omp atomic
+ y >>= 3;
+}
+
+void f3(void)
+{
+ #pragma omp atomic
+ z++;
+ #pragma omp atomic
+ z--;
+ #pragma omp atomic
+ ++z;
+ #pragma omp atomic
+ --z;
+ #pragma omp atomic
+ z += 1;
+ #pragma omp atomic
+ z |= 1;
+ #pragma omp atomic
+ z &= 1;
+ #pragma omp atomic
+ z ^= 1;
+ #pragma omp atomic
+ z *= 3;
+ #pragma omp atomic
+ z /= 3;
+ #pragma omp atomic
+ z /= 3;
+ #pragma omp atomic
+ z <<= 3;
+ #pragma omp atomic
+ z >>= 3;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-10.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-10.c
new file mode 100644
index 000000000..21d035e15
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-10.c
@@ -0,0 +1,25 @@
+/* PR middle-end/28046 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-ompexp" } */
+/* { dg-require-effective-target cas_int } */
+
+int a[3], b;
+struct C { int x; int y; } c;
+
+int bar (void), *baz (void);
+
+void
+foo (void)
+{
+#pragma omp atomic
+ a[2] += bar ();
+#pragma omp atomic
+ b += bar ();
+#pragma omp atomic
+ c.y += bar ();
+#pragma omp atomic
+ *baz () += bar ();
+}
+
+/* { dg-final { scan-tree-dump-times "__atomic_fetch_add" 4 "ompexp" } } */
+/* { dg-final { cleanup-tree-dump "ompexp" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-12.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-12.c
new file mode 100644
index 000000000..618c4c8e6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-12.c
@@ -0,0 +1,306 @@
+/* PR middle-end/45423 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple -g0" } */
+/* atomicvar should never be referenced in between the barrier and
+ following #pragma omp atomic_load. */
+/* { dg-final { scan-tree-dump-not "barrier\[^#\]*atomicvar" "gimple" } } */
+/* { dg-final { cleanup-tree-dump "gimple" } } */
+
+#ifdef __cplusplus
+bool atomicvar, c;
+#else
+_Bool atomicvar, c;
+#endif
+int i, atomicvar2, c2;
+
+int
+foo (void)
+{
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar |= -1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar |= 0;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar |= 1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar |= 2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar |= c;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar ^= -1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar ^= 0;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar ^= 1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar ^= 2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar ^= c;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar &= -1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar &= 0;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar &= 1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar &= 2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar &= c;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar += -1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar += 0;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar += 1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar += 2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar += c;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar -= -1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar -= 0;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar -= 1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar -= 2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar -= c;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar *= -1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar *= 0;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar *= 1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar *= 2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar *= c;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar /= -1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar /= 1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar /= 2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar /= c;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar <<= 0;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar <<= 1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar <<= 2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar <<= i;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar >>= 0;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar >>= 1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar >>= 2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar >>= i;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar++;
+ #pragma omp barrier
+ #pragma omp atomic
+ ++atomicvar;
+ #pragma omp barrier
+#ifndef __cplusplus
+ #pragma omp atomic
+ atomicvar--;
+ #pragma omp barrier
+ #pragma omp atomic
+ --atomicvar;
+ #pragma omp barrier
+#endif
+ return 0;
+}
+
+int
+bar (void)
+{
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 |= -1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 |= 0;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 |= 1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 |= 2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 |= c2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 ^= -1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 ^= 0;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 ^= 1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 ^= 2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 ^= c2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 &= -1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 &= 0;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 &= 1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 &= 2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 &= c2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 += -1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 += 0;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 += 1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 += 2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 += c2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 -= -1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 -= 0;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 -= 1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 -= 2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 -= c2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 *= -1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 *= 0;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 *= 1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 *= 2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 *= c2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 /= -1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 /= 1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 /= 2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 /= c2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 <<= 0;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 <<= 1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 <<= 2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 <<= i;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 >>= 0;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 >>= 1;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 >>= 2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2 >>= i;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2++;
+ #pragma omp barrier
+ #pragma omp atomic
+ ++atomicvar2;
+ #pragma omp barrier
+ #pragma omp atomic
+ atomicvar2--;
+ #pragma omp barrier
+ #pragma omp atomic
+ --atomicvar2;
+ #pragma omp barrier
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-13.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-13.c
new file mode 100644
index 000000000..0146825f2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-13.c
@@ -0,0 +1,9 @@
+/* PR middle-end/45423 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-gimple -g0 -O2" } */
+/* atomicvar should never be referenced in between the barrier and
+ following #pragma omp atomic_load. */
+/* { dg-final { scan-tree-dump-not "barrier\[^#\]*atomicvar" "gimple" } } */
+/* { dg-final { cleanup-tree-dump "gimple" } } */
+
+#include "atomic-12.c"
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-14.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-14.c
new file mode 100644
index 000000000..f8fc9d872
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-14.c
@@ -0,0 +1,43 @@
+/* PR middle-end/45423 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+#ifdef __cplusplus
+bool *baz ();
+#else
+_Bool *baz ();
+#endif
+int *bar ();
+
+int
+foo (void)
+{
+ #pragma omp barrier
+ #pragma omp atomic
+ (*bar ())++;
+ #pragma omp barrier
+ #pragma omp atomic
+ ++(*bar ());
+ #pragma omp barrier
+ #pragma omp atomic
+ (*bar ())--;
+ #pragma omp barrier
+ #pragma omp atomic
+ --(*bar ());
+ #pragma omp barrier
+ #pragma omp atomic
+ (*baz ())++;
+ #pragma omp barrier
+ #pragma omp atomic
+ ++(*baz ());
+#ifndef __cplusplus
+ #pragma omp barrier
+ #pragma omp atomic
+ (*baz ())--;
+ #pragma omp barrier
+ #pragma omp atomic
+ --(*baz ());
+ #pragma omp barrier
+#endif
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-15.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-15.c
new file mode 100644
index 000000000..5e669fa35
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-15.c
@@ -0,0 +1,44 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+int x = 6;
+
+int
+main ()
+{
+ int v;
+ #pragma omp atomic
+ x = x * 7 + 6; /* { dg-error "expected|invalid form of" } */
+ #pragma omp atomic
+ x = x * 7 ^ 6; /* { dg-error "expected|invalid form of" } */
+ #pragma omp atomic update
+ x = x - 8 + 6; /* { dg-error "expected|invalid form of" } */
+ #pragma omp atomic
+ x = x ^ 7 | 2; /* { dg-error "expected|invalid form of" } */
+ #pragma omp atomic
+ x = x / 7 * 2; /* { dg-error "expected|invalid form of" } */
+ #pragma omp atomic
+ x = x / 7 / 2; /* { dg-error "expected|invalid form of" } */
+ #pragma omp atomic capture
+ { v = x; x = x * 7 + 6; } /* { dg-error "expected" "" { target c++ } } */
+ #pragma omp atomic capture
+ { v = x; x = x * 7 ^ 6; } /* { dg-error "expected" "" { target c++ } } */
+ #pragma omp atomic capture
+ { v = x; x = x - 8 + 6; } /* { dg-error "expected" "" { target c++ } } */
+ #pragma omp atomic capture
+ { v = x; x = x ^ 7 | 2; } /* { dg-error "expected" "" { target c++ } } */
+ #pragma omp atomic capture
+ { v = x; x = x / 7 * 2; } /* { dg-error "expected" "" { target c++ } } */
+ #pragma omp atomic capture
+ { v = x; x = x / 7 / 2; } /* { dg-error "expected" "" { target c++ } } */
+ #pragma omp atomic capture
+ { x = x * 7 + 6; v = x; } /* { dg-error "expected|uses two different expressions for memory" } */
+ #pragma omp atomic capture
+ { x = x * 7 ^ 6; v = x; } /* { dg-error "expected|uses two different expressions for memory" } */
+ #pragma omp atomic capture
+ { x = x - 8 + 6; v = x; } /* { dg-error "expected|uses two different expressions for memory" } */
+ #pragma omp atomic capture
+ { x = x ^ 7 | 2; v = x; } /* { dg-error "expected|uses two different expressions for memory" } */
+ (void) v;
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-16.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-16.c
new file mode 100644
index 000000000..87fbaa233
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-16.c
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+int x = 6;
+
+void
+foo ()
+{
+ int v;
+ #pragma omp atomic seq_cst load /* { dg-error "expected end of line" } */
+ v = x; /* { dg-error "invalid form" } */
+ #pragma omp atomic seq_cst, load /* { dg-error "expected end of line" } */
+ v = x; /* { dg-error "invalid form" } */
+ #pragma omp atomic seq_cst store /* { dg-error "expected end of line" } */
+ x = v; /* { dg-error "invalid form" } */
+ #pragma omp atomic seq_cst ,store /* { dg-error "expected end of line" } */
+ x = v; /* { dg-error "invalid form" } */
+ #pragma omp atomic seq_cst update /* { dg-error "expected end of line" } */
+ x += v;
+ #pragma omp atomic seq_cst , update /* { dg-error "expected end of line" } */
+ x += v;
+ #pragma omp atomic seq_cst capture /* { dg-error "expected end of line" } */
+ v = x += 2; /* { dg-error "invalid form" } */
+ #pragma omp atomic seq_cst, capture /* { dg-error "expected end of line" } */
+ v = x += 2; /* { dg-error "invalid form" } */
+ #pragma omp atomic load , seq_cst /* { dg-error "expected end of line" } */
+ v = x; /* { dg-error "invalid form" } */
+ #pragma omp atomic store ,seq_cst /* { dg-error "expected end of line" } */
+ x = v; /* { dg-error "invalid form" } */
+ #pragma omp atomic update, seq_cst /* { dg-error "expected end of line" } */
+ x += v;
+ #pragma omp atomic capture, seq_cst /* { dg-error "expected end of line" } */
+ v = x += 2;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-2.c
new file mode 100644
index 000000000..720ec9e8b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-2.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+
+float x, y;
+
+void f1(void)
+{
+ #pragma omp atomic
+ x++;
+ #pragma omp atomic
+ x--;
+ #pragma omp atomic
+ ++x;
+ #pragma omp atomic
+ --x;
+ #pragma omp atomic
+ x += 1;
+ #pragma omp atomic
+ x -= y;
+ #pragma omp atomic
+ x *= 3;
+ #pragma omp atomic
+ x /= 3;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-3.c
new file mode 100644
index 000000000..5b9e60cde
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-3.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-ompexp" } */
+/* { dg-require-effective-target cas_int } */
+
+int *xyzzy;
+
+void f1(void)
+{
+ #pragma omp atomic
+ xyzzy++;
+}
+
+/* { dg-final { scan-tree-dump-times "xyzzy, 4" 1 "ompexp" } } */
+/* { dg-final { cleanup-tree-dump "ompexp" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-4.c
new file mode 100644
index 000000000..7f27370d5
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-4.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+
+int a[4];
+int *p;
+struct S { int x; int y[4]; } s;
+int *bar(void);
+
+void f1(void)
+{
+ #pragma omp atomic
+ a[4] += 1;
+ #pragma omp atomic
+ *p += 1;
+ #pragma omp atomic
+ s.x += 1;
+ #pragma omp atomic
+ s.y[*p] += 1;
+ #pragma omp atomic
+ s.y[*p] *= 42;
+ #pragma omp atomic
+ *bar() += 1;
+ #pragma omp atomic
+ *bar() *= 42;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-7.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-7.c
new file mode 100644
index 000000000..612e97f45
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-7.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+
+double x, y;
+
+void f2(void)
+{
+ #pragma omp atomic
+ y++;
+ #pragma omp atomic
+ y--;
+ #pragma omp atomic
+ ++y;
+ #pragma omp atomic
+ --y;
+ #pragma omp atomic
+ y += 1;
+ #pragma omp atomic
+ y -= x;
+ #pragma omp atomic
+ y *= 3;
+ #pragma omp atomic
+ y /= 3;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-8.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-8.c
new file mode 100644
index 000000000..2f04151f0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-8.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+long double z;
+
+void f3(void)
+{
+ #pragma omp atomic
+ z++;
+ #pragma omp atomic
+ z--;
+ #pragma omp atomic
+ ++z;
+ #pragma omp atomic
+ --z;
+ #pragma omp atomic
+ z += 1;
+ #pragma omp atomic
+ z *= 3;
+ #pragma omp atomic
+ z /= 3;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-9.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-9.c
new file mode 100644
index 000000000..ff5cb4091
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/atomic-9.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-ompexp" } */
+/* { dg-require-effective-target cas_int } */
+
+volatile int *bar(void);
+
+void f1(void)
+{
+ #pragma omp atomic
+ *bar() += 1;
+}
+
+/* { dg-final { scan-tree-dump-times "__atomic_fetch_add" 1 "ompexp" } } */
+/* { dg-final { cleanup-tree-dump "ompexp" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/cancel-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/cancel-1.c
new file mode 100644
index 000000000..d8f7bc1b8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/cancel-1.c
@@ -0,0 +1,396 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+void
+f1 (void)
+{
+ #pragma omp cancel parallel /* { dg-error "orphaned" } */
+ #pragma omp cancel for /* { dg-error "orphaned" } */
+ #pragma omp cancel sections /* { dg-error "orphaned" } */
+ #pragma omp cancel taskgroup /* { dg-error "orphaned" } */
+ #pragma omp cancellation point parallel /* { dg-error "orphaned" } */
+ #pragma omp cancellation point for /* { dg-error "orphaned" } */
+ #pragma omp cancellation point sections /* { dg-error "orphaned" } */
+ #pragma omp cancellation point taskgroup /* { dg-error "orphaned" } */
+}
+
+void
+f2 (void)
+{
+ int i;
+ #pragma omp parallel
+ {
+ #pragma omp cancel parallel
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp master
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
+ }
+ #pragma omp single
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
+ }
+ #pragma omp critical
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
+ }
+ #pragma omp taskgroup
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
+ }
+ #pragma omp task
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup
+ }
+ #pragma omp for
+ for (i = 0; i < 10; i++)
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup/* { dg-error "not closely nested inside" } */
+ }
+ #pragma omp for ordered
+ for (i = 0; i < 10; i++)
+ #pragma omp ordered
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup/* { dg-error "not closely nested inside" } */
+ }
+ #pragma omp sections
+ {
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections
+ #pragma omp cancellation point taskgroup/* { dg-error "not closely nested inside" } */
+ }
+ #pragma omp section
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections
+ #pragma omp cancellation point taskgroup/* { dg-error "not closely nested inside" } */
+ }
+ }
+ #pragma omp target data
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
+ }
+ #pragma omp target
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
+ }
+ }
+ #pragma omp target data
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
+ }
+ #pragma omp target
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
+ }
+ #pragma omp target teams
+ {
+ #pragma omp cancel parallel /* { dg-error "only distribute or parallel constructs are allowed to be closely nested" } */
+ #pragma omp cancel for /* { dg-error "only distribute or parallel constructs are allowed to be closely nested" } */
+ #pragma omp cancel sections /* { dg-error "only distribute or parallel constructs are allowed to be closely nested" } */
+ #pragma omp cancel taskgroup /* { dg-error "only distribute or parallel constructs are allowed to be closely nested" } */
+ #pragma omp cancellation point parallel /* { dg-error "only distribute or parallel constructs are allowed to be closely nested" } */
+ #pragma omp cancellation point for /* { dg-error "only distribute or parallel constructs are allowed to be closely nested" } */
+ #pragma omp cancellation point sections /* { dg-error "only distribute or parallel constructs are allowed to be closely nested" } */
+ #pragma omp cancellation point taskgroup /* { dg-error "only distribute or parallel constructs are allowed to be closely nested" } */
+ }
+ #pragma omp target teams distribute
+ for (i = 0; i < 10; i++)
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
+ }
+ #pragma omp for
+ for (i = 0; i < 10; i++)
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
+ }
+ #pragma omp for
+ for (i = 0; i < 10; i++)
+ #pragma omp target data
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
+ }
+ #pragma omp for
+ for (i = 0; i < 10; i++)
+ #pragma omp target
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
+ }
+ #pragma omp for ordered
+ for (i = 0; i < 10; i++)
+ #pragma omp ordered
+ #pragma omp target data
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup/* { dg-error "not closely nested inside" } */
+ }
+ #pragma omp for ordered
+ for (i = 0; i < 10; i++)
+ #pragma omp ordered
+ #pragma omp target
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup/* { dg-error "not closely nested inside" } */
+ }
+ #pragma omp sections
+ {
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections
+ #pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
+ }
+ #pragma omp section
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections
+ #pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
+ }
+ }
+ #pragma omp sections
+ {
+ #pragma omp target data
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
+ }
+ #pragma omp section
+ #pragma omp target data
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
+ }
+ }
+ #pragma omp sections
+ {
+ #pragma omp target
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
+ }
+ #pragma omp section
+ #pragma omp target
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
+ }
+ }
+ #pragma omp task
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup
+ #pragma omp taskgroup
+ {
+ #pragma omp cancel parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancel taskgroup /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point parallel /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point for /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point sections /* { dg-error "not closely nested inside" } */
+ #pragma omp cancellation point taskgroup /* { dg-error "not closely nested inside" } */
+ }
+ }
+}
+
+void
+f3 (void)
+{
+ int i;
+ #pragma omp for nowait
+ for (i = 0; i < 10; i++)
+ {
+ #pragma omp cancel for /* { dg-warning "nowait" } */
+ }
+ #pragma omp sections nowait
+ {
+ {
+ #pragma omp cancel sections /* { dg-warning "nowait" } */
+ }
+ #pragma omp section
+ {
+ #pragma omp cancel sections /* { dg-warning "nowait" } */
+ }
+ }
+ #pragma omp for ordered
+ for (i = 0; i < 10; i++)
+ {
+ #pragma omp cancel for /* { dg-warning "ordered" } */
+ #pragma omp ordered
+ {
+ }
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/depend-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/depend-1.c
new file mode 100644
index 000000000..8a5850e45
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/depend-1.c
@@ -0,0 +1,79 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+extern int a[][10], a2[][10];
+int b[10], c[10][2], d[10], e[10], f[10];
+int b2[10], c2[10][2], d2[10], e2[10], f2[10];
+int k[10], l[10], m[10], n[10], o;
+int *p;
+void bar (void);
+int t[10];
+#pragma omp threadprivate (t)
+
+void
+foo (int g[3][10], int h[4][8], int i[2][10], int j[][9],
+ int g2[3][10], int h2[4][8], int i2[2][10], int j2[][9])
+{
+ #pragma omp task depend(in: bar[2:5]) /* { dg-error "is not a variable" } */
+ ;
+ #pragma omp task depend(out: t[2:5])
+ ;
+ #pragma omp task depend(inout: k[0.5:]) /* { dg-error "low bound \[^\n\r]* of array section does not have integral type" } */
+ ;
+ #pragma omp task depend(in: l[:7.5f]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
+ ;
+ #pragma omp task depend(out: m[p:]) /* { dg-error "low bound \[^\n\r]* of array section does not have integral type" } */
+ ;
+ #pragma omp task depend(inout: n[:p]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
+ ;
+ #pragma omp task depend(in: o[2:5]) /* { dg-error "does not have pointer or array type" } */
+ ;
+ #pragma omp task depend(out: a[:][2:4]) /* { dg-error "array type length expression must be specified" } */
+ ;
+ #pragma omp task depend(inout: b[-1:]) /* { dg-error "negative low bound in array section" } */
+ ;
+ #pragma omp task depend(inout: c[:-3][1:1]) /* { dg-error "negative length in array section" } */
+ ;
+ #pragma omp task depend(in: d[11:]) /* { dg-error "low bound \[^\n\r]* above array section size" } */
+ ;
+ #pragma omp task depend(out: e[:11]) /* { dg-error "length \[^\n\r]* above array section size" } */
+ ;
+ #pragma omp task depend(out: f[1:10]) /* { dg-error "high bound \[^\n\r]* above array section size" } */
+ ;
+ #pragma omp task depend(in: g[:][2:4]) /* { dg-error "for pointer type length expression must be specified" } */
+ ;
+ #pragma omp task depend(in: h[2:2][-1:]) /* { dg-error "negative low bound in array section" } */
+ ;
+ #pragma omp task depend(inout: h[:1][:-3]) /* { dg-error "negative length in array section" } */
+ ;
+ #pragma omp task depend(out: i[:1][11:]) /* { dg-error "low bound \[^\n\r]* above array section size" } */
+ ;
+ #pragma omp task depend(in: j[3:4][:10]) /* { dg-error "length \[^\n\r]* above array section size" } */
+ ;
+ #pragma omp task depend(out: j[30:10][5:5]) /* { dg-error "high bound \[^\n\r]* above array section size" } */
+ ;
+ #pragma omp task depend(out: a2[:3][2:4])
+ ;
+ #pragma omp task depend(inout: b2[0:])
+ ;
+ #pragma omp task depend(inout: c2[:3][1:1])
+ ;
+ #pragma omp task depend(in: d2[9:])
+ ;
+ #pragma omp task depend(out: e2[:10])
+ ;
+ #pragma omp task depend(out: f2[1:9])
+ ;
+ #pragma omp task depend(in: g2[:2][2:4])
+ ;
+ #pragma omp task depend(in: h2[2:2][0:])
+ ;
+ #pragma omp task depend(inout: h2[:1][:3])
+ ;
+ #pragma omp task depend(out: i2[:1][9:])
+ ;
+ #pragma omp task depend(in: j2[3:4][:9])
+ ;
+ #pragma omp task depend(out: j2[30:10][5:4])
+ ;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/depend-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/depend-2.c
new file mode 100644
index 000000000..99bf8ae1b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/depend-2.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+void bar (int a[10][10][10]);
+void
+foo (int a[10][10][10], int **b)
+{
+ int c[10][10][10];
+ #pragma omp task depend(out: a[2:4][3:][:7], b[1:7][2:8])
+ bar (a);
+ int i = 1, j = 3, k = 2, l = 6;
+ #pragma omp task depend(in: a[++i:++j][++k:][:++l])
+ bar (a);
+ #pragma omp task depend(out: a[7:2][:][:], c[5:2][:][:])
+ {
+ bar (c);
+ bar (a);
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/map-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/map-1.c
new file mode 100644
index 000000000..5dad7d6a9
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/map-1.c
@@ -0,0 +1,109 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+extern int a[][10], a2[][10];
+int b[10], c[10][2], d[10], e[10], f[10];
+int b2[10], c2[10][2], d2[10], e2[10], f2[10];
+int k[10], l[10], m[10], n[10], o;
+int *p;
+int **q;
+int r[4][4][4][4][4];
+extern struct s s1;
+extern struct s s2[1]; /* { dg-error "array type has incomplete element type" "" { target c } } */
+int t[10];
+#pragma omp threadprivate (t)
+#pragma omp declare target
+void bar (int *);
+#pragma omp end declare target
+
+void
+foo (int g[3][10], int h[4][8], int i[2][10], int j[][9],
+ int g2[3][10], int h2[4][8], int i2[2][10], int j2[][9])
+{
+ #pragma omp target map(to: bar[2:5]) /* { dg-error "is not a variable" } */
+ ;
+ #pragma omp target map(from: t[2:5]) /* { dg-error "is threadprivate variable" } */
+ ;
+ #pragma omp target map(tofrom: k[0.5:]) /* { dg-error "low bound \[^\n\r]* of array section does not have integral type" } */
+ ;
+ #pragma omp target map(from: l[:7.5f]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
+ ;
+ #pragma omp target map(to: m[p:]) /* { dg-error "low bound \[^\n\r]* of array section does not have integral type" } */
+ ;
+ #pragma omp target map(tofrom: n[:p]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
+ ;
+ #pragma omp target map(to: o[2:5]) /* { dg-error "does not have pointer or array type" } */
+ ;
+ #pragma omp target map(alloc: s1) /* { dg-error "'s1' does not have a mappable type in 'map' clause" } */
+ ;
+ #pragma omp target map(alloc: s2) /* { dg-error "'s2' does not have a mappable type in 'map' clause" } */
+ ;
+ #pragma omp target map(to: a[:][:]) /* { dg-error "array type length expression must be specified" } */
+ bar (&a[0][0]); /* { dg-error "referenced in target region does not have a mappable type" } */
+ #pragma omp target map(tofrom: b[-1:]) /* { dg-error "negative low bound in array section" } */
+ bar (b);
+ #pragma omp target map(tofrom: c[:-3][:]) /* { dg-error "negative length in array section" } */
+ bar (&c[0][0]);
+ #pragma omp target map(from: d[11:]) /* { dg-error "low bound \[^\n\r]* above array section size" } */
+ bar (d);
+ #pragma omp target map(to: e[:11]) /* { dg-error "length \[^\n\r]* above array section size" } */
+ bar (e);
+ #pragma omp target map(to: f[1:10]) /* { dg-error "high bound \[^\n\r]* above array section size" } */
+ bar (f);
+ #pragma omp target map(from: g[:][0:10]) /* { dg-error "for pointer type length expression must be specified" } */
+ bar (&g[0][0]);
+ #pragma omp target map(from: h[2:1][-1:]) /* { dg-error "negative low bound in array section" } */
+ bar (&h[0][0]);
+ #pragma omp target map(tofrom: h[:1][:-3]) /* { dg-error "negative length in array section" } */
+ bar (&h[0][0]);
+ #pragma omp target map(i[:1][11:]) /* { dg-error "low bound \[^\n\r]* above array section size" } */
+ bar (&i[0][0]);
+ #pragma omp target map(from: j[3:1][:10]) /* { dg-error "length \[^\n\r]* above array section size" } */
+ bar (&j[0][0]);
+ #pragma omp target map(to: j[30:1][5:5]) /* { dg-error "high bound \[^\n\r]* above array section size" } */
+ bar (&j[0][0]);
+ #pragma omp target map(to: a2[:1][2:4])
+ bar (&a2[0][0]);
+ #pragma omp target map(a2[3:5][:])
+ bar (&a2[0][0]);
+ #pragma omp target map(to: a2[3:5][:10])
+ bar (&a2[0][0]);
+ #pragma omp target map(tofrom: b2[0:])
+ bar (b2);
+ #pragma omp target map(tofrom: c2[:3][:])
+ bar (&c2[0][0]);
+ #pragma omp target map(from: d2[9:])
+ bar (d2);
+ #pragma omp target map(to: e2[:10])
+ bar (e2);
+ #pragma omp target map(to: f2[1:9])
+ bar (f2);
+ #pragma omp target map(g2[:1][2:4])
+ bar (&g2[0][0]);
+ #pragma omp target map(from: h2[2:2][0:])
+ bar (&h2[0][0]);
+ #pragma omp target map(tofrom: h2[:1][:3])
+ bar (&h2[0][0]);
+ #pragma omp target map(to: i2[:1][9:])
+ bar (&i2[0][0]);
+ #pragma omp target map(from: j2[3:4][:9])
+ bar (&j2[0][0]);
+ #pragma omp target map(to: j2[30:1][5:4])
+ bar (&j2[0][0]);
+ #pragma omp target map(q[1:2])
+ ;
+ #pragma omp target map(tofrom: q[3:5][:10]) /* { dg-error "array section is not contiguous" } */
+ ;
+ #pragma omp target map(r[3:][2:1][1:2])
+ ;
+ #pragma omp target map(r[3:][2:1][1:2][:][0:4])
+ ;
+ #pragma omp target map(r[3:][2:1][1:2][1:][0:4]) /* { dg-error "array section is not contiguous" } */
+ ;
+ #pragma omp target map(r[3:][2:1][1:2][:3][0:4]) /* { dg-error "array section is not contiguous" } */
+ ;
+ #pragma omp target map(r[3:][2:1][1:2][:][1:]) /* { dg-error "array section is not contiguous" } */
+ ;
+ #pragma omp target map(r[3:][2:1][1:2][:][:3]) /* { dg-error "array section is not contiguous" } */
+ ;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr51360.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr51360.c
new file mode 100644
index 000000000..c32242e65
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr51360.c
@@ -0,0 +1,27 @@
+/* PR c/51360 */
+/* { dg-do compile } */
+/* { dg-options "-Wunused -W -fopenmp" } */
+
+void
+foo (int a, int b, int c, int d)
+{
+ int m, n, o, p, i;
+ m = 6;
+ n = 1;
+ o = 5;
+ p = 1;
+ a = 6;
+ b = 1;
+ c = 5;
+ d = 1;
+ #pragma omp parallel for num_threads (m) if (n) schedule (static, o)
+ for (i = 0; i < 10; i++)
+ ;
+ #pragma omp parallel for num_threads (a) if (b) schedule (static, c)
+ for (i = 0; i < 10; i++)
+ ;
+ #pragma omp task final (p)
+ ;
+ #pragma omp task final (d)
+ ;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr53580.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr53580.c
new file mode 100644
index 000000000..941a90d22
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr53580.c
@@ -0,0 +1,19 @@
+/* PR middle-end/53580 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+int
+main ()
+{
+ int x, y, v = 0;
+
+#pragma omp parallel
+ #pragma omp for
+ for (x = 0; x < 10; x++)
+ {
+ #pragma omp for reduction(+: v) /* { dg-error "work-sharing region may not be closely nested inside of work-sharing" } */
+ for (y = 0; y < 10; y++)
+ v++;
+ }
+ return v - 100;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr54017.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr54017.c
new file mode 100644
index 000000000..724efe136
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr54017.c
@@ -0,0 +1,65 @@
+/* PR middle-end/54017 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+void
+f1 (void)
+{
+#pragma omp parallel sections
+ {
+#pragma omp section
+ {
+ for (;;)
+ ;
+ }
+ }
+}
+
+int
+f2 (void)
+{
+ int i = 0;
+#pragma omp parallel
+#pragma omp sections reduction(+:i)
+ {
+#pragma omp section
+ {
+ for (;;)
+ ;
+ }
+ }
+ return i;
+}
+
+void
+f3 (void)
+{
+#pragma omp parallel sections
+ {
+#pragma omp section
+ {
+ for (;;)
+ ;
+ }
+#pragma omp section
+ ;
+ }
+}
+
+int
+f4 (void)
+{
+ int i = 0;
+#pragma omp parallel
+#pragma omp sections reduction(+:i)
+ {
+#pragma omp section
+ {
+ for (;;)
+ ;
+ }
+#pragma omp section
+ ;
+ }
+ return i;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr56883.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr56883.c
new file mode 100644
index 000000000..443906d86
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr56883.c
@@ -0,0 +1,57 @@
+/* PR middle-end/56883 */
+/* { dg-do compile }
+/* { dg-options "-O2 -fopenmp" } */
+
+void
+f1 (int ***x)
+{
+ int i, j, k;
+#pragma omp parallel for
+ for (i = 0; i < 10; ++i)
+ {
+ #pragma omp parallel shared(j)
+ #pragma omp for
+ for (j = 0; j < 10; ++j)
+ {
+ #pragma omp parallel for
+ for (k = 0; k < 10; ++k)
+ x[i][j][k] = k;
+ }
+ }
+}
+
+void
+f2 (int ***x)
+{
+ int i, j, k;
+#pragma omp parallel for schedule(static,1)
+ for (i = 0; i < 10; ++i)
+ {
+ #pragma omp parallel shared(j)
+ #pragma omp for schedule(static,1)
+ for (j = 0; j < 10; ++j)
+ {
+ #pragma omp parallel for schedule(static,1)
+ for (k = 0; k < 10; ++k)
+ x[i][j][k] = k;
+ }
+ }
+}
+
+void
+f3 (int ***x)
+{
+ int i, j, k;
+#pragma omp parallel for schedule(runtime)
+ for (i = 0; i < 10; ++i)
+ {
+ #pragma omp parallel shared(j)
+ #pragma omp for schedule(runtime)
+ for (j = 0; j < 10; ++j)
+ {
+ #pragma omp parallel for schedule(runtime)
+ for (k = 0; k < 10; ++k)
+ x[i][j][k] = k;
+ }
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr57824.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr57824.c
new file mode 100644
index 000000000..a303da24c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr57824.c
@@ -0,0 +1,14 @@
+/* PR preprocessor/57824 */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -fopenmp" { target c } } */
+/* { dg-options "-std=c++11 -fopenmp" { target c++ } } */
+
+void bar ();
+
+void foo ()
+{
+#pragma omp parallel num_threads(sizeof R"(
+abc
+)")
+ bar ();
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr58257.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr58257.c
new file mode 100644
index 000000000..8f8d24a99
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr58257.c
@@ -0,0 +1,15 @@
+/* PR middle-end/58257 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -Wall" } */
+
+int
+foo (int n)
+{
+ int a[10][10];
+ int x, y;
+#pragma omp parallel for collapse(2) /* { dg-bogus "may be used uninitialized in this function" } */
+ for (x = 0; x < n; x++) /* { dg-bogus "may be used uninitialized in this function" } */
+ for (y = 0; y < n; y++)
+ a[x][y] = x + y * y;
+ return a[0][0];
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr58472.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr58472.c
new file mode 100644
index 000000000..355ca4008
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr58472.c
@@ -0,0 +1,16 @@
+/* PR tree-optimization/58472 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wall -fopenmp" } */
+
+float a[1024], b[1024];
+
+float
+foo ()
+{
+ float s = 0.f;
+ unsigned int i;
+#pragma omp simd reduction(+:s)
+ for (i = 0; i < 1024; ++i)
+ s += a[i] * b[i];
+ return s;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr58551.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr58551.c
new file mode 100644
index 000000000..e2db70f9e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr58551.c
@@ -0,0 +1,33 @@
+/* PR middle-end/58551 */
+/* { dg-do compile } */
+/* { dg-options "-O0 -fopenmp" } */
+
+void
+foo (int *a)
+{
+ int i;
+ for (i = 0; i < 8; i++)
+ #pragma omp task
+ if (a[i])
+ __builtin_abort ();
+}
+
+void bar (int, int);
+
+void
+baz (int *a)
+{
+ int i;
+ for (i = 0; i < 8; i++)
+ #pragma omp task
+ if (a[i])
+ {
+ int j, k;
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 8; k++)
+ bar (j, k);
+ for (k = 0; k < 12; k++)
+ bar (-1, k);
+ __builtin_abort ();
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr58703.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr58703.c
new file mode 100644
index 000000000..6a3a5f505
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr58703.c
@@ -0,0 +1,6 @@
+/* PR c++/58703 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+#pragma omp declare reduction (+ : char[] : omp_out += omp_in) /* { dg-error "function or array type" } */
+#pragma omp declare reduction (+ : char() : omp_out += omp_in) /* { dg-error "function or array type" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr58809.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr58809.c
new file mode 100644
index 000000000..f4fd7c483
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr58809.c
@@ -0,0 +1,31 @@
+/* PR middle-end/58809 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+_Complex int j;
+_Complex double d;
+
+void
+foo (void)
+{
+ #pragma omp parallel reduction (&:j) /* { dg-error "has invalid type for|user defined reduction not found for" } */
+ ;
+ #pragma omp parallel reduction (|:j) /* { dg-error "has invalid type for|user defined reduction not found for" } */
+ ;
+ #pragma omp parallel reduction (^:j) /* { dg-error "has invalid type for|user defined reduction not found for" } */
+ ;
+ #pragma omp parallel reduction (min:j) /* { dg-error "has invalid type for|user defined reduction not found for" } */
+ ;
+ #pragma omp parallel reduction (max:j) /* { dg-error "has invalid type for|user defined reduction not found for" } */
+ ;
+ #pragma omp parallel reduction (&:d) /* { dg-error "has invalid type for|user defined reduction not found for" } */
+ ;
+ #pragma omp parallel reduction (|:d) /* { dg-error "has invalid type for|user defined reduction not found for" } */
+ ;
+ #pragma omp parallel reduction (^:d) /* { dg-error "has invalid type for|user defined reduction not found for" } */
+ ;
+ #pragma omp parallel reduction (min:d) /* { dg-error "has invalid type for|user defined reduction not found for" } */
+ ;
+ #pragma omp parallel reduction (max:d) /* { dg-error "has invalid type for|user defined reduction not found for" } */
+ ;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr59152.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr59152.c
new file mode 100644
index 000000000..bcccb1be3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr59152.c
@@ -0,0 +1,40 @@
+/* PR middle-end/59152 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fipa-pure-const" } */
+
+extern int b[];
+void
+foo (void)
+{
+ unsigned long v1, v2, v3;
+ #pragma omp parallel for schedule(static, 32) collapse(3)
+ for (v1 = 0; v1 < 20; v1 += 2)
+ for (v2 = __LONG_MAX__; v2 > __LONG_MAX__ - 30; v2 -= 3)
+ for (v3 = 10; v3 > 0; v3--)
+ #pragma omp atomic
+ b[v3]++;
+}
+
+void
+bar (void)
+{
+ unsigned long v1, v2, v3;
+ #pragma omp parallel for schedule(static) collapse(3)
+ for (v1 = 0; v1 < 20; v1 += 2)
+ for (v2 = __LONG_MAX__; v2 > __LONG_MAX__ - 30; v2 -= 3)
+ for (v3 = 10; v3 > 0; v3--)
+ #pragma omp atomic
+ b[v3]++;
+}
+
+void
+baz (void)
+{
+ unsigned long v1, v2, v3;
+ #pragma omp parallel for schedule(runtime) collapse(3)
+ for (v1 = 0; v1 < 20; v1 += 2)
+ for (v2 = __LONG_MAX__; v2 > __LONG_MAX__ - 30; v2 -= 3)
+ for (v3 = 10; v3 > 0; v3--)
+ #pragma omp atomic
+ b[v3]++;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr59467.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr59467.c
new file mode 100644
index 000000000..475182a62
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr59467.c
@@ -0,0 +1,68 @@
+/* PR libgomp/59467 */
+
+int v;
+
+void
+foo (void)
+{
+ int x = 0, y = 0;
+ #pragma omp parallel
+ {
+ int z;
+ #pragma omp single copyprivate (x) /* { dg-error "is not threadprivate or private in outer context" } */
+ {
+ #pragma omp atomic write
+ x = 6;
+ }
+ #pragma omp atomic read
+ z = x;
+ #pragma omp atomic
+ y += z;
+ }
+ #pragma omp parallel
+ {
+ int z;
+ #pragma omp single copyprivate (v) /* { dg-error "is not threadprivate or private in outer context" } */
+ {
+ #pragma omp atomic write
+ v = 6;
+ }
+ #pragma omp atomic read
+ z = v;
+ #pragma omp atomic
+ y += z;
+ }
+ #pragma omp parallel private (x)
+ {
+ int z;
+ #pragma omp single copyprivate (x)
+ {
+ #pragma omp atomic write
+ x = 6;
+ }
+ #pragma omp atomic read
+ z = x;
+ #pragma omp atomic
+ y += z;
+ }
+ x = 0;
+ #pragma omp parallel reduction (+:x)
+ {
+ #pragma omp single copyprivate (x)
+ {
+ #pragma omp atomic write
+ x = 6;
+ }
+ #pragma omp atomic
+ y += x;
+ }
+ #pragma omp single copyprivate (x)
+ {
+ x = 7;
+ }
+ #pragma omp single copyprivate (v) /* { dg-error "is not threadprivate or private in outer context" } */
+ {
+ #pragma omp atomic write
+ v = 6;
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr59917-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr59917-1.c
new file mode 100644
index 000000000..cca3976cc
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr59917-1.c
@@ -0,0 +1,22 @@
+/* PR middle-end/59917 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp" } */
+
+struct J { long buf[8]; };
+extern int setjmp (struct J[1]);
+extern struct J j[1];
+void foo (int);
+
+void
+bar (void)
+{
+ if (setjmp (j) == 0)
+ {
+ int k;
+ foo (-1);
+#pragma omp parallel
+ for (k = 0; k < 10; ++k)
+ foo (k);
+ foo (-2);
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr59917-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr59917-2.c
new file mode 100644
index 000000000..1d603422f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr59917-2.c
@@ -0,0 +1,22 @@
+/* PR middle-end/59917 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp" } */
+
+struct J { long buf[8]; };
+extern int setjmp (struct J[1]);
+void foo (int);
+
+void
+bar (void)
+{
+ int k;
+ foo (-1);
+#pragma omp parallel
+ for (k = 0; k < 10; ++k)
+ {
+ struct J j[1];
+ if (setjmp (j) == 0)
+ foo (k);
+ }
+ foo (-2);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/sections1.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/sections1.c
new file mode 100644
index 000000000..8c8ab91f7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/sections1.c
@@ -0,0 +1,73 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+void bar (int);
+
+void
+foo ()
+{
+ #pragma omp sections
+ {
+ bar (1);
+ #pragma omp section
+ {
+ bar (2);
+ }
+ }
+ #pragma omp sections
+ {
+ #pragma omp section
+ bar (3);
+ #pragma omp section
+ {
+ bar (4);
+ bar (5);
+ }
+ }
+ #pragma omp sections
+ {
+ {
+ bar (6);
+ bar (7);
+ }
+ #pragma omp section
+ bar (8);
+ }
+ #pragma omp sections
+ {
+ #pragma omp section
+ {
+ bar (9);
+ }
+ #pragma omp section
+ bar (10);
+ #pragma omp section
+ bar (11);
+ }
+ #pragma omp sections
+ {
+ } /* { dg-error "expression before" } */
+ #pragma omp sections
+ {
+ bar (12);
+ bar (13); /* { dg-error "pragma omp section" } */
+ #pragma omp section
+ bar (14);
+ }
+ #pragma omp sections
+ {
+ #pragma omp section
+ } /* { dg-error "expression before" } */
+ #pragma omp sections
+ {
+ bar (15);
+ #pragma omp section
+ bar (16);
+ bar (17); /* { dg-error "pragma omp section" } */
+ }
+ #pragma omp sections
+ {
+ bar (18);
+ #pragma omp section
+ } /* { dg-error "expression before" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd1.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd1.c
new file mode 100644
index 000000000..29e464ca0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd1.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+/* { dg-additional-options "-std=c99" { target c } } */
+
+extern int a[1024], b[1024], k, l, m;
+
+void
+foo ()
+{
+ int i;
+ #pragma omp simd safelen(16) aligned(a, b : 32)
+ for (i = 0; i < 1024; i++)
+ a[i] *= b[i];
+}
+
+void
+bar (int *p)
+{
+ int i;
+ #pragma omp simd safelen(16) aligned(a, p : 32) linear(k, l : m + 1)
+ for (i = 0; i < 1024; i++)
+ a[i] *= p[i], k += m + 1;
+}
+
+void
+baz (int *p)
+{
+ #pragma omp simd safelen(16) aligned(a, p : 32) linear(k, l : m + 1)
+ for (int i = 0; i < 1024; i++)
+ a[i] *= p[i], k += m + 1;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd2.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd2.c
new file mode 100644
index 000000000..dda9c62d6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd2.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+/* { dg-additional-options "-std=c99" { target c } } */
+
+extern int a[13][13][13][13], k, l, m;
+
+void
+foo (int *q, float *p)
+{
+ int i, j, n, o;
+#pragma omp simd collapse (4) linear(k : m + 1) aligned(p, q)
+ for (i = 0; i < 13; i++)
+ for (j = 0; j < 13; j++)
+ for (n = 0; n < 13; n++)
+ for (o = 0; o < 13; o += 2)
+ q[k] *= p[k] + 7 * i + 14 * j + 21 * n + 28 * o, k += m + 1;
+}
+
+void
+bar (float *p)
+{
+ int i, j, n, o;
+#pragma omp simd collapse (4) linear(k : m + 1)
+ for (i = 0; i < 13; i++)
+ for (j = 0; j < 13; j++)
+ for (n = 0; n < 13; n++)
+ for (o = 0; o < 13; o += 2)
+ a[i][j][n][o] *= p[k], k += m + 1;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd3.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd3.c
new file mode 100644
index 000000000..e8270fc45
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd3.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+/* { dg-additional-options "-std=c99" { target c } } */
+
+extern int a[13*13*13*13*2], b[1024], *k, l, m;
+
+void
+foo (int *q, float *p)
+{
+ int *i, *j, *n, *o;
+#pragma omp simd collapse (4) linear(k : m + 1) aligned(p, q)
+ for (i = &a[0]; i < &a[13*13*13*13*2]; i += 13*13*13*2)
+ for (j = &a[0]; j < &a[13*13*13*2]; j += 13*13*2)
+ for (n = &a[0]; n < &a[13*13*2]; n += 13*2)
+ for (o = &a[0]; o < &a[13*2]; o += 2)
+ q[k - &a[0]] *= p[k - &a[0]] + 7 * (i-&a[0]) + 14 * (j-&a[0]) + 21 * (n-&a[0]) + 28 * (o-&a[0]), k += m + 1;
+}
+
+void
+bar ()
+{
+ int *i;
+ #pragma omp simd safelen(16) aligned(a, b : 32)
+ for (i = &a[0]; i < &a[1024]; i++)
+ *i *= b[i - &a[0]];
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd4.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd4.c
new file mode 100644
index 000000000..37901b6a0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd4.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+/* { dg-additional-options "-std=c99" { target c } } */
+
+struct S *p; /* { dg-error "forward declaration" "" { target c++ } } */
+float f;
+int j;
+
+void
+foo (void)
+{
+#pragma omp simd linear(p) linear(f : 1)
+ for (int i = 0; i < 10; i++)
+ ;
+#pragma omp simd linear(j : 7.0) /* { dg-error "step expression must be integral" } */
+ for (int i = 0; i < 10; i++)
+ ;
+}
+
+/* { dg-error "linear clause applied to" "" { target *-*-* } 12 } */
+/* { dg-error "(incomplete|undefined) type" "" { target *-*-* } 12 } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd5.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd5.c
new file mode 100644
index 000000000..a57896d87
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd5.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+/* { dg-additional-options "-std=c99" { target c } } */
+
+void baz (void) __attribute__((noreturn));
+
+void
+foo (int x)
+{
+ if (x)
+ #pragma omp simd
+ for (int i = 0; i < 10; i++)
+ baz ();
+#pragma omp simd collapse(3)
+ for (int i = 0; i < 10; i++)
+ for (int j = 0; j < 10; j++)
+ for (int k = 0; k < 10; k++)
+ baz ();
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd6.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd6.c
new file mode 100644
index 000000000..3a90c225e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/simd6.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+extern int a[1024];
+
+struct S { int i; } s;
+
+void
+f1 (int x, float f, int *p)
+{
+ int i;
+ #pragma omp simd aligned(x : 32) /* { dg-error "neither a pointer nor an array" } */
+ for (i = 0; i < 1024; i++)
+ a[i]++;
+ #pragma omp simd aligned(f) /* { dg-error "neither a pointer nor an array" } */
+ for (i = 0; i < 1024; i++)
+ a[i]++;
+ #pragma omp simd aligned(s : 16) /* { dg-error "neither a pointer nor an array" } */
+ for (i = 0; i < 1024; i++)
+ a[i]++;
+ #pragma omp simd aligned(a : 8)
+ for (i = 0; i < 1024; i++)
+ a[i]++;
+ #pragma omp simd aligned(p : 8)
+ for (i = 0; i < 1024; i++)
+ a[i]++;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/single1.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/single1.c
new file mode 100644
index 000000000..c080a8804
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/single1.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+void
+foo (int i)
+{
+ #pragma omp single copyprivate (i)
+ ;
+ #pragma omp single nowait
+ ;
+ #pragma omp single copyprivate (i) nowait /* { dg-error "clause must not be used together with" } */
+ ;
+ #pragma omp single nowait copyprivate (i) /* { dg-error "clause must not be used together with" } */
+ ;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/guality/pr43141.c b/gcc-4.9/gcc/testsuite/c-c++-common/guality/pr43141.c
new file mode 100644
index 000000000..e6fe79a0e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/guality/pr43141.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-options "-g" } */
+
+int i;
+static int f(int) __attribute ((noinline));
+static int f(int x)
+{
+ return i;
+}
+
+int main()
+{
+ return f(42);
+}
+
+/* { dg-final { gdb-test 8 "sizeof (x)" "sizeof (int)" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/init-vec-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/init-vec-1.c
new file mode 100644
index 000000000..68243cd30
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/init-vec-1.c
@@ -0,0 +1,4 @@
+/* Don't ICE or emit spurious errors when init a vector with a scalar. */
+/* { dg-do compile } */
+typedef float v2sf __attribute__ ((vector_size (8)));
+v2sf a = 0.0; /* { dg-error "incompatible types|cannot convert" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/int128-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/int128-1.c
new file mode 100644
index 000000000..dafb2a993
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/int128-1.c
@@ -0,0 +1,41 @@
+/* { dg-do run { target int128 } } */
+/* { dg-options "-std=gnu99" { target c } } */
+/* { dg-options "" { target c++ } } */
+
+#include <stdarg.h>
+
+#ifndef __cplusplus
+extern void abort (void);
+#else
+extern "C" void abort (void);
+#endif
+
+#define MK_CONST128(A,B,C,D) \
+ ( (((unsigned __int128) (unsigned int) A) << 96) \
+ | (((unsigned __int128) (unsigned int) B) << 64) \
+ | (((unsigned __int128) (unsigned int) C) << 32) \
+ | ((unsigned __int128) (unsigned int) D) )
+
+#define MK_CONST128_SIGNED(A,B,C,D) \
+ ((__int128) MK_CONST128(A, B, C, D))
+
+void foo(int i, ...)
+{
+ __int128 q;
+ va_list va;
+
+ va_start(va, i);
+ q = va_arg(va, __int128);
+ va_end(va);
+
+ if (q != MK_CONST128_SIGNED (0xfeffffffU, 2U, 3U, 4U))
+ abort();
+}
+
+int main(void)
+{
+ __int128 q = MK_CONST128_SIGNED (0xfeffffffU, 2U, 3U, 4U);
+
+ foo(1, q);
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/int128-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/int128-2.c
new file mode 100644
index 000000000..36042b022
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/int128-2.c
@@ -0,0 +1,157 @@
+/* { dg-do run { target int128 } } */
+/* { dg-options "-std=gnu99" { target c } } */
+/* { dg-options "" { target c++ } } */
+
+#ifndef __cplusplus
+extern void abort (void);
+#else
+extern "C" void abort (void);
+#endif
+
+#define MK_CONST128(A,B,C,D) \
+ ( (((unsigned __int128) (unsigned int) A) << 96) \
+ | (((unsigned __int128) (unsigned int) B) << 64) \
+ | (((unsigned __int128) (unsigned int) C) << 32) \
+ | ((unsigned __int128) (unsigned int) D) )
+
+#define MK_CONST128_SIGNED(A,B,C,D) \
+ ((__int128) MK_CONST128(A, B, C, D))
+
+#define MINUS_2 MK_CONST128_SIGNED (0xffffffffu, 0xffffffffu, 0xffffffffu, \
+ 0xfffffffeu)
+#define MINUS_3 MK_CONST128_SIGNED (0xffffffffu, 0xffffffffu, 0xffffffffu, \
+ 0xfffffffdu)
+#define MINUS_6 MK_CONST128_SIGNED (0xffffffffu, 0xffffffffu, 0xffffffffu, \
+ 0xfffffffau)
+#define PLUS_1 MK_CONST128_SIGNED (0, 0, 0, 1)
+#define PLUS_2 MK_CONST128_SIGNED (0, 0, 0, 2)
+#define PLUS_3 MK_CONST128_SIGNED (0, 0, 0, 3)
+#define PLUS_6 MK_CONST128_SIGNED (0, 0, 0, 6)
+#define PLUS_10 MK_CONST128_SIGNED (0, 0, 0, 10)
+
+#define U_8 MK_CONST128 (0, 0, 0, 8)
+#define U_MAX MK_CONST128 (0xffffffff,0xffffffff,0xffffffff,0xffffffff)
+#define U_CST1 MK_CONST128 (0xbeeffeed, 0xdeafcafe, 0xaffefade, 0x12345678)
+#define U_CST2 MK_CONST128 (0x41100112, 0x21503501, 0x50010521, 0xedcba987)
+
+signed __int128 foo_neg (signed __int128 v)
+{
+ return -v;
+}
+
+unsigned __int128 foo_xor (unsigned __int128 x, unsigned __int128 y)
+{
+ return x ^ y;
+}
+
+unsigned __int128 foo_inv (unsigned __int128 v)
+{
+ return ~v;
+}
+
+unsigned __int128 foo_rotate_left (unsigned __int128 v)
+{
+ unsigned __int128 c;
+ int i;
+ for (i = 0; i < 128; i++)
+ {
+ c = v >> 127;
+ v <<= 1;
+ v |= c;
+ }
+ return v;
+}
+
+unsigned __int128 foo_rotate_right (unsigned __int128 v)
+{
+ unsigned __int128 c;
+ int i;
+ for (i = 0; i < 128; i++)
+ {
+ c = (v & ((unsigned __int128) 1)) << 127;
+ v >>= 1;
+ v |= c;
+ }
+ return v;
+}
+
+void foo_swap (unsigned __int128 *x, unsigned __int128 *y)
+{
+ unsigned __int128 x1 = x[0];
+ unsigned __int128 y1 = y[0];
+ x1 ^= y1 ^= x1 ^= y1;
+ x[0] = x1;
+ y[0] = y1;
+}
+
+__int128 foo_add (signed __int128 a, unsigned __int128 b)
+{
+ return (__int128) (a + (__int128) b);
+}
+
+__int128 foo_sub (unsigned __int128 a, signed __int128 b)
+{
+ return (__int128) ((__int128) a - b);
+}
+
+__int128 foo_mul (signed __int128 a, signed __int128 b)
+{
+ return a * b;
+}
+
+__int128 foo_div (signed __int128 a, signed __int128 b)
+{
+ return a / b;
+}
+
+__int128 foo_shl (signed __int128 a, int shift)
+{
+ return a << (shift & 127);
+}
+
+__int128 foo_shr (signed __int128 a, int shift)
+{
+ return a >> (shift & 127);
+}
+
+int main(void)
+{
+ __int128 rslt;
+ unsigned __int128 u1, u2;
+
+ rslt = foo_add (MINUS_2, U_8);
+ if (rslt != PLUS_6)
+ abort ();
+ rslt = foo_sub (U_8, MINUS_2);
+ if (rslt != PLUS_10)
+ abort ();
+ rslt = foo_sub ((unsigned __int128) foo_mul (MINUS_2, MINUS_2), MINUS_2);
+ if (rslt != PLUS_6)
+ abort ();
+ if (rslt != foo_shl (PLUS_3, 1))
+ abort ();
+ rslt = foo_shl (MINUS_3, 1);
+ if (rslt != MINUS_6)
+ abort ();
+ if (foo_shr (MINUS_6, 1) != MINUS_3)
+ abort ();
+ if (foo_div (MINUS_6, MINUS_3) != PLUS_2)
+ abort ();
+ if (foo_rotate_left (U_CST1) != U_CST1)
+ abort ();
+ if (foo_rotate_right (U_CST1) != U_CST1)
+ abort ();
+ u1 = U_CST1;
+ u2 = U_8;
+ foo_swap (&u1, &u2);
+ if (u1 != U_8 || u2 != U_CST1)
+ abort ();
+
+ if (foo_inv (U_CST2) != U_CST1)
+ abort ();
+ if (foo_neg (PLUS_2) != MINUS_2)
+ abort ();
+ if (foo_neg ((signed __int128) U_CST1) != foo_add (PLUS_1, foo_xor (U_CST1, U_MAX)))
+ abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/int128-types-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/int128-types-1.c
new file mode 100644
index 000000000..7bee8fcd3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/int128-types-1.c
@@ -0,0 +1,666 @@
+/* Test for valid and invalid combinations of type specifiers using __int128.
+ */
+/* Origin: Kai Tietz <kai.tietz@onevision.com> */
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-std=gnu99" { target c } } */
+/* { dg-options "" { target c++ } } */
+
+typedef char type;
+__int128 *x0;
+void __int128 *x1; /* { dg-error "" } */
+char __int128 *x2; /* { dg-error "" } */
+short __int128 *x3; /* { dg-error "" } */
+int __int128 *x4; /* { dg-error "" } */
+__int128 void *x5; /* { dg-error "" } */
+__int128 char *x6; /* { dg-error "" } */
+__int128 short *x7; /* { dg-error "" } */
+__int128 int *x8; /* { dg-error "" } */
+__int128 __int128 *x9; /* { dg-error "" } */
+__int128 long *x10; /* { dg-error "" } */
+__int128 float *x11; /* { dg-error "" } */
+__int128 double *x12; /* { dg-error "" } */
+__int128 signed *x13;
+__int128 unsigned *x14;
+__int128 _Bool *x15; /* { dg-error "" } */
+__int128 _Complex *x16;
+long __int128 *x17; /* { dg-error "" } */
+float __int128 *x18; /* { dg-error "" } */
+double __int128 *x19; /* { dg-error "" } */
+signed __int128 *x20;
+unsigned __int128 *x21;
+_Bool __int128 *x22; /* { dg-error "" } */
+_Complex __int128 *x23;
+type __int128 *x24; /* { dg-error "" } */
+char signed __int128 *x25; /* { dg-error "" } */
+char unsigned __int128 *x26; /* { dg-error "" } */
+char _Complex __int128 *x27; /* { dg-error "" } */
+short int __int128 *x28; /* { dg-error "" } */
+short signed __int128 *x29; /* { dg-error "" } */
+short unsigned __int128 *x30; /* { dg-error "" } */
+short _Complex __int128 *x31; /* { dg-error "" } */
+int short __int128 *x32; /* { dg-error "" } */
+int long __int128 *x33; /* { dg-error "" } */
+int signed __int128 *x34; /* { dg-error "" } */
+int unsigned __int128 *x35; /* { dg-error "" } */
+int _Complex __int128 *x36; /* { dg-error "" } */
+__int128 signed void *x37; /* { dg-error "" } */
+__int128 signed char *x38; /* { dg-error "" } */
+__int128 signed short *x39; /* { dg-error "" } */
+__int128 signed int *x40; /* { dg-error "" } */
+__int128 signed __int128 *x41; /* { dg-error "" } */
+__int128 signed long *x42; /* { dg-error "" } */
+__int128 signed float *x43; /* { dg-error "" } */
+__int128 signed double *x44; /* { dg-error "" } */
+__int128 signed signed *x45; /* { dg-error "" } */
+__int128 signed unsigned *x46; /* { dg-error "" } */
+__int128 signed _Bool *x47; /* { dg-error "" } */
+__int128 signed _Complex *x48;
+__int128 unsigned void *x49; /* { dg-error "" } */
+__int128 unsigned char *x50; /* { dg-error "" } */
+__int128 unsigned short *x51; /* { dg-error "" } */
+__int128 unsigned int *x52; /* { dg-error "" } */
+__int128 unsigned __int128 *x53; /* { dg-error "" } */
+__int128 unsigned long *x54; /* { dg-error "" } */
+__int128 unsigned float *x55; /* { dg-error "" } */
+__int128 unsigned double *x56; /* { dg-error "" } */
+__int128 unsigned signed *x57; /* { dg-error "" } */
+__int128 unsigned unsigned *x58; /* { dg-error "" } */
+__int128 unsigned _Bool *x59; /* { dg-error "" } */
+__int128 unsigned _Complex *x60;
+__int128 _Complex void *x61; /* { dg-error "" } */
+__int128 _Complex char *x62; /* { dg-error "" } */
+__int128 _Complex short *x63; /* { dg-error "" } */
+__int128 _Complex int *x64; /* { dg-error "" } */
+__int128 _Complex __int128 *x65; /* { dg-error "" } */
+__int128 _Complex long *x66; /* { dg-error "" } */
+__int128 _Complex float *x67; /* { dg-error "" } */
+__int128 _Complex double *x68; /* { dg-error "" } */
+__int128 _Complex signed *x69;
+__int128 _Complex unsigned *x70;
+__int128 _Complex _Bool *x71; /* { dg-error "" } */
+__int128 _Complex _Complex *x72; /* { dg-error "" } */
+long int __int128 *x73; /* { dg-error "" } */
+long long __int128 *x74; /* { dg-error "" } */
+long double __int128 *x75; /* { dg-error "" } */
+long signed __int128 *x76; /* { dg-error "" } */
+long unsigned __int128 *x77; /* { dg-error "" } */
+long _Complex __int128 *x78; /* { dg-error "" } */
+float _Complex __int128 *x79; /* { dg-error "" } */
+double long __int128 *x80; /* { dg-error "" } */
+double _Complex __int128 *x81; /* { dg-error "" } */
+signed char __int128 *x82; /* { dg-error "" } */
+signed short __int128 *x83; /* { dg-error "" } */
+signed int __int128 *x84; /* { dg-error "" } */
+signed __int128 void *x85; /* { dg-error "" } */
+signed __int128 char *x86; /* { dg-error "" } */
+signed __int128 short *x87; /* { dg-error "" } */
+signed __int128 int *x88; /* { dg-error "" } */
+signed __int128 __int128 *x89; /* { dg-error "" } */
+signed __int128 long *x90; /* { dg-error "" } */
+signed __int128 float *x91; /* { dg-error "" } */
+signed __int128 double *x92; /* { dg-error "" } */
+signed __int128 signed *x93; /* { dg-error "" } */
+signed __int128 unsigned *x94; /* { dg-error "" } */
+signed __int128 _Bool *x95; /* { dg-error "" } */
+signed __int128 _Complex *x96;
+signed long __int128 *x97; /* { dg-error "" } */
+signed _Complex __int128 *x98;
+unsigned char __int128 *x99; /* { dg-error "" } */
+unsigned short __int128 *x100; /* { dg-error "" } */
+unsigned int __int128 *x101; /* { dg-error "" } */
+unsigned __int128 void *x102; /* { dg-error "" } */
+unsigned __int128 char *x103; /* { dg-error "" } */
+unsigned __int128 short *x104; /* { dg-error "" } */
+unsigned __int128 int *x105; /* { dg-error "" } */
+unsigned __int128 __int128 *x106; /* { dg-error "" } */
+unsigned __int128 long *x107; /* { dg-error "" } */
+unsigned __int128 float *x108; /* { dg-error "" } */
+unsigned __int128 double *x109; /* { dg-error "" } */
+unsigned __int128 signed *x110; /* { dg-error "" } */
+unsigned __int128 unsigned *x111; /* { dg-error "" } */
+unsigned __int128 _Bool *x112; /* { dg-error "" } */
+unsigned __int128 _Complex *x113;
+unsigned long __int128 *x114; /* { dg-error "" } */
+unsigned _Complex __int128 *x115;
+_Complex char __int128 *x116; /* { dg-error "" } */
+_Complex short __int128 *x117; /* { dg-error "" } */
+_Complex int __int128 *x118; /* { dg-error "" } */
+_Complex __int128 void *x119; /* { dg-error "" } */
+_Complex __int128 char *x120; /* { dg-error "" } */
+_Complex __int128 short *x121; /* { dg-error "" } */
+_Complex __int128 int *x122; /* { dg-error "" } */
+_Complex __int128 __int128 *x123; /* { dg-error "" } */
+_Complex __int128 long *x124; /* { dg-error "" } */
+_Complex __int128 float *x125; /* { dg-error "" } */
+_Complex __int128 double *x126; /* { dg-error "" } */
+_Complex __int128 signed *x127;
+_Complex __int128 unsigned *x128;
+_Complex __int128 _Bool *x129; /* { dg-error "" } */
+_Complex __int128 _Complex *x130; /* { dg-error "" } */
+_Complex long __int128 *x131; /* { dg-error "" } */
+_Complex float __int128 *x132; /* { dg-error "" } */
+_Complex double __int128 *x133; /* { dg-error "" } */
+_Complex signed __int128 *x134;
+_Complex unsigned __int128 *x135;
+char signed _Complex __int128 *x136; /* { dg-error "" } */
+char unsigned _Complex __int128 *x137; /* { dg-error "" } */
+char _Complex signed __int128 *x138; /* { dg-error "" } */
+char _Complex unsigned __int128 *x139; /* { dg-error "" } */
+short int signed __int128 *x140; /* { dg-error "" } */
+short int unsigned __int128 *x141; /* { dg-error "" } */
+short int _Complex __int128 *x142; /* { dg-error "" } */
+short signed int __int128 *x143; /* { dg-error "" } */
+short signed _Complex __int128 *x144; /* { dg-error "" } */
+short unsigned int __int128 *x145; /* { dg-error "" } */
+short unsigned _Complex __int128 *x146; /* { dg-error "" } */
+short _Complex int __int128 *x147; /* { dg-error "" } */
+short _Complex signed __int128 *x148; /* { dg-error "" } */
+short _Complex unsigned __int128 *x149; /* { dg-error "" } */
+int short signed __int128 *x150; /* { dg-error "" } */
+int short unsigned __int128 *x151; /* { dg-error "" } */
+int short _Complex __int128 *x152; /* { dg-error "" } */
+int long long __int128 *x153; /* { dg-error "" } */
+int long signed __int128 *x154; /* { dg-error "" } */
+int long unsigned __int128 *x155; /* { dg-error "" } */
+int long _Complex __int128 *x156; /* { dg-error "" } */
+int signed short __int128 *x157; /* { dg-error "" } */
+int signed long __int128 *x158; /* { dg-error "" } */
+int signed _Complex __int128 *x159; /* { dg-error "" } */
+int unsigned short __int128 *x160; /* { dg-error "" } */
+int unsigned long __int128 *x161; /* { dg-error "" } */
+int unsigned _Complex __int128 *x162; /* { dg-error "" } */
+int _Complex short __int128 *x163; /* { dg-error "" } */
+int _Complex long __int128 *x164; /* { dg-error "" } */
+int _Complex signed __int128 *x165; /* { dg-error "" } */
+int _Complex unsigned __int128 *x166; /* { dg-error "" } */
+__int128 signed _Complex void *x167; /* { dg-error "" } */
+__int128 signed _Complex char *x168; /* { dg-error "" } */
+__int128 signed _Complex short *x169; /* { dg-error "" } */
+__int128 signed _Complex int *x170; /* { dg-error "" } */
+__int128 signed _Complex __int128 *x171; /* { dg-error "" } */
+__int128 signed _Complex long *x172; /* { dg-error "" } */
+__int128 signed _Complex float *x173; /* { dg-error "" } */
+__int128 signed _Complex double *x174; /* { dg-error "" } */
+__int128 signed _Complex signed *x175; /* { dg-error "" } */
+__int128 signed _Complex unsigned *x176; /* { dg-error "" } */
+__int128 signed _Complex _Bool *x177; /* { dg-error "" } */
+__int128 signed _Complex _Complex *x178; /* { dg-error "" } */
+__int128 unsigned _Complex void *x179; /* { dg-error "" } */
+__int128 unsigned _Complex char *x180; /* { dg-error "" } */
+__int128 unsigned _Complex short *x181; /* { dg-error "" } */
+__int128 unsigned _Complex int *x182; /* { dg-error "" } */
+__int128 unsigned _Complex __int128 *x183; /* { dg-error "" } */
+__int128 unsigned _Complex long *x184; /* { dg-error "" } */
+__int128 unsigned _Complex float *x185; /* { dg-error "" } */
+__int128 unsigned _Complex double *x186; /* { dg-error "" } */
+__int128 unsigned _Complex signed *x187; /* { dg-error "" } */
+__int128 unsigned _Complex unsigned *x188; /* { dg-error "" } */
+__int128 unsigned _Complex _Bool *x189; /* { dg-error "" } */
+__int128 unsigned _Complex _Complex *x190; /* { dg-error "" } */
+__int128 _Complex signed void *x191; /* { dg-error "" } */
+__int128 _Complex signed char *x192; /* { dg-error "" } */
+__int128 _Complex signed short *x193; /* { dg-error "" } */
+__int128 _Complex signed int *x194; /* { dg-error "" } */
+__int128 _Complex signed __int128 *x195; /* { dg-error "" } */
+__int128 _Complex signed long *x196; /* { dg-error "" } */
+__int128 _Complex signed float *x197; /* { dg-error "" } */
+__int128 _Complex signed double *x198; /* { dg-error "" } */
+__int128 _Complex signed signed *x199; /* { dg-error "" } */
+__int128 _Complex signed unsigned *x200; /* { dg-error "" } */
+__int128 _Complex signed _Bool *x201; /* { dg-error "" } */
+__int128 _Complex signed _Complex *x202; /* { dg-error "" } */
+__int128 _Complex unsigned void *x203; /* { dg-error "" } */
+__int128 _Complex unsigned char *x204; /* { dg-error "" } */
+__int128 _Complex unsigned short *x205; /* { dg-error "" } */
+__int128 _Complex unsigned int *x206; /* { dg-error "" } */
+__int128 _Complex unsigned __int128 *x207; /* { dg-error "" } */
+__int128 _Complex unsigned long *x208; /* { dg-error "" } */
+__int128 _Complex unsigned float *x209; /* { dg-error "" } */
+__int128 _Complex unsigned double *x210; /* { dg-error "" } */
+__int128 _Complex unsigned signed *x211; /* { dg-error "" } */
+__int128 _Complex unsigned unsigned *x212; /* { dg-error "" } */
+__int128 _Complex unsigned _Bool *x213; /* { dg-error "" } */
+__int128 _Complex unsigned _Complex *x214; /* { dg-error "" } */
+long int long __int128 *x215; /* { dg-error "" } */
+long int signed __int128 *x216; /* { dg-error "" } */
+long int unsigned __int128 *x217; /* { dg-error "" } */
+long int _Complex __int128 *x218; /* { dg-error "" } */
+long long int __int128 *x219; /* { dg-error "" } */
+long long signed __int128 *x220; /* { dg-error "" } */
+long long unsigned __int128 *x221; /* { dg-error "" } */
+long long _Complex __int128 *x222; /* { dg-error "" } */
+long double _Complex __int128 *x223; /* { dg-error "" } */
+long signed int __int128 *x224; /* { dg-error "" } */
+long signed long __int128 *x225; /* { dg-error "" } */
+long signed _Complex __int128 *x226; /* { dg-error "" } */
+long unsigned int __int128 *x227; /* { dg-error "" } */
+long unsigned long __int128 *x228; /* { dg-error "" } */
+long unsigned _Complex __int128 *x229; /* { dg-error "" } */
+long _Complex int __int128 *x230; /* { dg-error "" } */
+long _Complex long __int128 *x231; /* { dg-error "" } */
+long _Complex double __int128 *x232; /* { dg-error "" } */
+long _Complex signed __int128 *x233; /* { dg-error "" } */
+long _Complex unsigned __int128 *x234; /* { dg-error "" } */
+double long _Complex __int128 *x235; /* { dg-error "" } */
+double _Complex long __int128 *x236; /* { dg-error "" } */
+signed char _Complex __int128 *x237; /* { dg-error "" } */
+signed short int __int128 *x238; /* { dg-error "" } */
+signed short _Complex __int128 *x239; /* { dg-error "" } */
+signed int short __int128 *x240; /* { dg-error "" } */
+signed int long __int128 *x241; /* { dg-error "" } */
+signed int _Complex __int128 *x242; /* { dg-error "" } */
+signed __int128 _Complex void *x243; /* { dg-error "" } */
+signed __int128 _Complex char *x244; /* { dg-error "" } */
+signed __int128 _Complex short *x245; /* { dg-error "" } */
+signed __int128 _Complex int *x246; /* { dg-error "" } */
+signed __int128 _Complex __int128 *x247; /* { dg-error "" } */
+signed __int128 _Complex long *x248; /* { dg-error "" } */
+signed __int128 _Complex float *x249; /* { dg-error "" } */
+signed __int128 _Complex double *x250; /* { dg-error "" } */
+signed __int128 _Complex signed *x251; /* { dg-error "" } */
+signed __int128 _Complex unsigned *x252; /* { dg-error "" } */
+signed __int128 _Complex _Bool *x253; /* { dg-error "" } */
+signed __int128 _Complex _Complex *x254; /* { dg-error "" } */
+signed long int __int128 *x255; /* { dg-error "" } */
+signed long long __int128 *x256; /* { dg-error "" } */
+signed long _Complex __int128 *x257; /* { dg-error "" } */
+signed _Complex char __int128 *x258; /* { dg-error "" } */
+signed _Complex short __int128 *x259; /* { dg-error "" } */
+signed _Complex int __int128 *x260; /* { dg-error "" } */
+signed _Complex __int128 void *x261; /* { dg-error "" } */
+signed _Complex __int128 char *x262; /* { dg-error "" } */
+signed _Complex __int128 short *x263; /* { dg-error "" } */
+signed _Complex __int128 int *x264; /* { dg-error "" } */
+signed _Complex __int128 __int128 *x265; /* { dg-error "" } */
+signed _Complex __int128 long *x266; /* { dg-error "" } */
+signed _Complex __int128 float *x267; /* { dg-error "" } */
+signed _Complex __int128 double *x268; /* { dg-error "" } */
+signed _Complex __int128 signed *x269; /* { dg-error "" } */
+signed _Complex __int128 unsigned *x270; /* { dg-error "" } */
+signed _Complex __int128 _Bool *x271; /* { dg-error "" } */
+signed _Complex __int128 _Complex *x272; /* { dg-error "" } */
+signed _Complex long __int128 *x273; /* { dg-error "" } */
+unsigned char _Complex __int128 *x274; /* { dg-error "" } */
+unsigned short int __int128 *x275; /* { dg-error "" } */
+unsigned short _Complex __int128 *x276; /* { dg-error "" } */
+unsigned int short __int128 *x277; /* { dg-error "" } */
+unsigned int long __int128 *x278; /* { dg-error "" } */
+unsigned int _Complex __int128 *x279; /* { dg-error "" } */
+unsigned __int128 _Complex void *x280; /* { dg-error "" } */
+unsigned __int128 _Complex char *x281; /* { dg-error "" } */
+unsigned __int128 _Complex short *x282; /* { dg-error "" } */
+unsigned __int128 _Complex int *x283; /* { dg-error "" } */
+unsigned __int128 _Complex __int128 *x284; /* { dg-error "" } */
+unsigned __int128 _Complex long *x285; /* { dg-error "" } */
+unsigned __int128 _Complex float *x286; /* { dg-error "" } */
+unsigned __int128 _Complex double *x287; /* { dg-error "" } */
+unsigned __int128 _Complex signed *x288; /* { dg-error "" } */
+unsigned __int128 _Complex unsigned *x289; /* { dg-error "" } */
+unsigned __int128 _Complex _Bool *x290; /* { dg-error "" } */
+unsigned __int128 _Complex _Complex *x291; /* { dg-error "" } */
+unsigned long int __int128 *x292; /* { dg-error "" } */
+unsigned long long __int128 *x293; /* { dg-error "" } */
+unsigned long _Complex __int128 *x294; /* { dg-error "" } */
+unsigned _Complex char __int128 *x295; /* { dg-error "" } */
+unsigned _Complex short __int128 *x296; /* { dg-error "" } */
+unsigned _Complex int __int128 *x297; /* { dg-error "" } */
+unsigned _Complex __int128 void *x298; /* { dg-error "" } */
+unsigned _Complex __int128 char *x299; /* { dg-error "" } */
+unsigned _Complex __int128 short *x300; /* { dg-error "" } */
+unsigned _Complex __int128 int *x301; /* { dg-error "" } */
+unsigned _Complex __int128 __int128 *x302; /* { dg-error "" } */
+unsigned _Complex __int128 long *x303; /* { dg-error "" } */
+unsigned _Complex __int128 float *x304; /* { dg-error "" } */
+unsigned _Complex __int128 double *x305; /* { dg-error "" } */
+unsigned _Complex __int128 signed *x306; /* { dg-error "" } */
+unsigned _Complex __int128 unsigned *x307; /* { dg-error "" } */
+unsigned _Complex __int128 _Bool *x308; /* { dg-error "" } */
+unsigned _Complex __int128 _Complex *x309; /* { dg-error "" } */
+unsigned _Complex long __int128 *x310; /* { dg-error "" } */
+_Complex char signed __int128 *x311; /* { dg-error "" } */
+_Complex char unsigned __int128 *x312; /* { dg-error "" } */
+_Complex short int __int128 *x313; /* { dg-error "" } */
+_Complex short signed __int128 *x314; /* { dg-error "" } */
+_Complex short unsigned __int128 *x315; /* { dg-error "" } */
+_Complex int short __int128 *x316; /* { dg-error "" } */
+_Complex int long __int128 *x317; /* { dg-error "" } */
+_Complex int signed __int128 *x318; /* { dg-error "" } */
+_Complex int unsigned __int128 *x319; /* { dg-error "" } */
+_Complex __int128 signed void *x320; /* { dg-error "" } */
+_Complex __int128 signed char *x321; /* { dg-error "" } */
+_Complex __int128 signed short *x322; /* { dg-error "" } */
+_Complex __int128 signed int *x323; /* { dg-error "" } */
+_Complex __int128 signed __int128 *x324; /* { dg-error "" } */
+_Complex __int128 signed long *x325; /* { dg-error "" } */
+_Complex __int128 signed float *x326; /* { dg-error "" } */
+_Complex __int128 signed double *x327; /* { dg-error "" } */
+_Complex __int128 signed signed *x328; /* { dg-error "" } */
+_Complex __int128 signed unsigned *x329; /* { dg-error "" } */
+_Complex __int128 signed _Bool *x330; /* { dg-error "" } */
+_Complex __int128 signed _Complex *x331; /* { dg-error "" } */
+_Complex __int128 unsigned void *x332; /* { dg-error "" } */
+_Complex __int128 unsigned char *x333; /* { dg-error "" } */
+_Complex __int128 unsigned short *x334; /* { dg-error "" } */
+_Complex __int128 unsigned int *x335; /* { dg-error "" } */
+_Complex __int128 unsigned __int128 *x336; /* { dg-error "" } */
+_Complex __int128 unsigned long *x337; /* { dg-error "" } */
+_Complex __int128 unsigned float *x338; /* { dg-error "" } */
+_Complex __int128 unsigned double *x339; /* { dg-error "" } */
+_Complex __int128 unsigned signed *x340; /* { dg-error "" } */
+_Complex __int128 unsigned unsigned *x341; /* { dg-error "" } */
+_Complex __int128 unsigned _Bool *x342; /* { dg-error "" } */
+_Complex __int128 unsigned _Complex *x343; /* { dg-error "" } */
+_Complex long int __int128 *x344; /* { dg-error "" } */
+_Complex long long __int128 *x345; /* { dg-error "" } */
+_Complex long double __int128 *x346; /* { dg-error "" } */
+_Complex long signed __int128 *x347; /* { dg-error "" } */
+_Complex long unsigned __int128 *x348; /* { dg-error "" } */
+_Complex double long __int128 *x349; /* { dg-error "" } */
+_Complex signed char __int128 *x350; /* { dg-error "" } */
+_Complex signed short __int128 *x351; /* { dg-error "" } */
+_Complex signed int __int128 *x352; /* { dg-error "" } */
+_Complex signed __int128 void *x353; /* { dg-error "" } */
+_Complex signed __int128 char *x354; /* { dg-error "" } */
+_Complex signed __int128 short *x355; /* { dg-error "" } */
+_Complex signed __int128 int *x356; /* { dg-error "" } */
+_Complex signed __int128 __int128 *x357; /* { dg-error "" } */
+_Complex signed __int128 long *x358; /* { dg-error "" } */
+_Complex signed __int128 float *x359; /* { dg-error "" } */
+_Complex signed __int128 double *x360; /* { dg-error "" } */
+_Complex signed __int128 signed *x361; /* { dg-error "" } */
+_Complex signed __int128 unsigned *x362; /* { dg-error "" } */
+_Complex signed __int128 _Bool *x363; /* { dg-error "" } */
+_Complex signed __int128 _Complex *x364; /* { dg-error "" } */
+_Complex signed long __int128 *x365; /* { dg-error "" } */
+_Complex unsigned char __int128 *x366; /* { dg-error "" } */
+_Complex unsigned short __int128 *x367; /* { dg-error "" } */
+_Complex unsigned int __int128 *x368; /* { dg-error "" } */
+_Complex unsigned __int128 void *x369; /* { dg-error "" } */
+_Complex unsigned __int128 char *x370; /* { dg-error "" } */
+_Complex unsigned __int128 short *x371; /* { dg-error "" } */
+_Complex unsigned __int128 int *x372; /* { dg-error "" } */
+_Complex unsigned __int128 __int128 *x373; /* { dg-error "" } */
+_Complex unsigned __int128 long *x374; /* { dg-error "" } */
+_Complex unsigned __int128 float *x375; /* { dg-error "" } */
+_Complex unsigned __int128 double *x376; /* { dg-error "" } */
+_Complex unsigned __int128 signed *x377; /* { dg-error "" } */
+_Complex unsigned __int128 unsigned *x378; /* { dg-error "" } */
+_Complex unsigned __int128 _Bool *x379; /* { dg-error "" } */
+_Complex unsigned __int128 _Complex *x380; /* { dg-error "" } */
+_Complex unsigned long __int128 *x381; /* { dg-error "" } */
+short int signed _Complex __int128 *x382; /* { dg-error "" } */
+short int unsigned _Complex __int128 *x383; /* { dg-error "" } */
+short int _Complex signed __int128 *x384; /* { dg-error "" } */
+short int _Complex unsigned __int128 *x385; /* { dg-error "" } */
+short signed int _Complex __int128 *x386; /* { dg-error "" } */
+short signed _Complex int __int128 *x387; /* { dg-error "" } */
+short unsigned int _Complex __int128 *x388; /* { dg-error "" } */
+short unsigned _Complex int __int128 *x389; /* { dg-error "" } */
+short _Complex int signed __int128 *x390; /* { dg-error "" } */
+short _Complex int unsigned __int128 *x391; /* { dg-error "" } */
+short _Complex signed int __int128 *x392; /* { dg-error "" } */
+short _Complex unsigned int __int128 *x393; /* { dg-error "" } */
+int short signed _Complex __int128 *x394; /* { dg-error "" } */
+int short unsigned _Complex __int128 *x395; /* { dg-error "" } */
+int short _Complex signed __int128 *x396; /* { dg-error "" } */
+int short _Complex unsigned __int128 *x397; /* { dg-error "" } */
+int long long signed __int128 *x398; /* { dg-error "" } */
+int long long unsigned __int128 *x399; /* { dg-error "" } */
+int long long _Complex __int128 *x400; /* { dg-error "" } */
+int long signed long __int128 *x401; /* { dg-error "" } */
+int long signed _Complex __int128 *x402; /* { dg-error "" } */
+int long unsigned long __int128 *x403; /* { dg-error "" } */
+int long unsigned _Complex __int128 *x404; /* { dg-error "" } */
+int long _Complex long __int128 *x405; /* { dg-error "" } */
+int long _Complex signed __int128 *x406; /* { dg-error "" } */
+int long _Complex unsigned __int128 *x407; /* { dg-error "" } */
+int signed short _Complex __int128 *x408; /* { dg-error "" } */
+int signed long long __int128 *x409; /* { dg-error "" } */
+int signed long _Complex __int128 *x410; /* { dg-error "" } */
+int signed _Complex short __int128 *x411; /* { dg-error "" } */
+int signed _Complex long __int128 *x412; /* { dg-error "" } */
+int unsigned short _Complex __int128 *x413; /* { dg-error "" } */
+int unsigned long long __int128 *x414; /* { dg-error "" } */
+int unsigned long _Complex __int128 *x415; /* { dg-error "" } */
+int unsigned _Complex short __int128 *x416; /* { dg-error "" } */
+int unsigned _Complex long __int128 *x417; /* { dg-error "" } */
+int _Complex short signed __int128 *x418; /* { dg-error "" } */
+int _Complex short unsigned __int128 *x419; /* { dg-error "" } */
+int _Complex long long __int128 *x420; /* { dg-error "" } */
+int _Complex long signed __int128 *x421; /* { dg-error "" } */
+int _Complex long unsigned __int128 *x422; /* { dg-error "" } */
+int _Complex signed short __int128 *x423; /* { dg-error "" } */
+int _Complex signed long __int128 *x424; /* { dg-error "" } */
+int _Complex unsigned short __int128 *x425; /* { dg-error "" } */
+int _Complex unsigned long __int128 *x426; /* { dg-error "" } */
+long int long signed __int128 *x427; /* { dg-error "" } */
+long int long unsigned __int128 *x428; /* { dg-error "" } */
+long int long _Complex __int128 *x429; /* { dg-error "" } */
+long int signed long __int128 *x430; /* { dg-error "" } */
+long int signed _Complex __int128 *x431; /* { dg-error "" } */
+long int unsigned long __int128 *x432; /* { dg-error "" } */
+long int unsigned _Complex __int128 *x433; /* { dg-error "" } */
+long int _Complex long __int128 *x434; /* { dg-error "" } */
+long int _Complex signed __int128 *x435; /* { dg-error "" } */
+long int _Complex unsigned __int128 *x436; /* { dg-error "" } */
+long long int signed __int128 *x437; /* { dg-error "" } */
+long long int unsigned __int128 *x438; /* { dg-error "" } */
+long long int _Complex __int128 *x439; /* { dg-error "" } */
+long long signed int __int128 *x440; /* { dg-error "" } */
+long long signed _Complex __int128 *x441; /* { dg-error "" } */
+long long unsigned int __int128 *x442; /* { dg-error "" } */
+long long unsigned _Complex __int128 *x443; /* { dg-error "" } */
+long long _Complex int __int128 *x444; /* { dg-error "" } */
+long long _Complex signed __int128 *x445; /* { dg-error "" } */
+long long _Complex unsigned __int128 *x446; /* { dg-error "" } */
+long signed int long __int128 *x447; /* { dg-error "" } */
+long signed int _Complex __int128 *x448; /* { dg-error "" } */
+long signed long int __int128 *x449; /* { dg-error "" } */
+long signed long _Complex __int128 *x450; /* { dg-error "" } */
+long signed _Complex int __int128 *x451; /* { dg-error "" } */
+long signed _Complex long __int128 *x452; /* { dg-error "" } */
+long unsigned int long __int128 *x453; /* { dg-error "" } */
+long unsigned int _Complex __int128 *x454; /* { dg-error "" } */
+long unsigned long int __int128 *x455; /* { dg-error "" } */
+long unsigned long _Complex __int128 *x456; /* { dg-error "" } */
+long unsigned _Complex int __int128 *x457; /* { dg-error "" } */
+long unsigned _Complex long __int128 *x458; /* { dg-error "" } */
+long _Complex int long __int128 *x459; /* { dg-error "" } */
+long _Complex int signed __int128 *x460; /* { dg-error "" } */
+long _Complex int unsigned __int128 *x461; /* { dg-error "" } */
+long _Complex long int __int128 *x462; /* { dg-error "" } */
+long _Complex long signed __int128 *x463; /* { dg-error "" } */
+long _Complex long unsigned __int128 *x464; /* { dg-error "" } */
+long _Complex signed int __int128 *x465; /* { dg-error "" } */
+long _Complex signed long __int128 *x466; /* { dg-error "" } */
+long _Complex unsigned int __int128 *x467; /* { dg-error "" } */
+long _Complex unsigned long __int128 *x468; /* { dg-error "" } */
+signed short int _Complex __int128 *x469; /* { dg-error "" } */
+signed short _Complex int __int128 *x470; /* { dg-error "" } */
+signed int short _Complex __int128 *x471; /* { dg-error "" } */
+signed int long long __int128 *x472; /* { dg-error "" } */
+signed int long _Complex __int128 *x473; /* { dg-error "" } */
+signed int _Complex short __int128 *x474; /* { dg-error "" } */
+signed int _Complex long __int128 *x475; /* { dg-error "" } */
+signed long int long __int128 *x476; /* { dg-error "" } */
+signed long int _Complex __int128 *x477; /* { dg-error "" } */
+signed long long int __int128 *x478; /* { dg-error "" } */
+signed long long _Complex __int128 *x479; /* { dg-error "" } */
+signed long _Complex int __int128 *x480; /* { dg-error "" } */
+signed long _Complex long __int128 *x481; /* { dg-error "" } */
+signed _Complex short int __int128 *x482; /* { dg-error "" } */
+signed _Complex int short __int128 *x483; /* { dg-error "" } */
+signed _Complex int long __int128 *x484; /* { dg-error "" } */
+signed _Complex long int __int128 *x485; /* { dg-error "" } */
+signed _Complex long long __int128 *x486; /* { dg-error "" } */
+unsigned short int _Complex __int128 *x487; /* { dg-error "" } */
+unsigned short _Complex int __int128 *x488; /* { dg-error "" } */
+unsigned int short _Complex __int128 *x489; /* { dg-error "" } */
+unsigned int long long __int128 *x490; /* { dg-error "" } */
+unsigned int long _Complex __int128 *x491; /* { dg-error "" } */
+unsigned int _Complex short __int128 *x492; /* { dg-error "" } */
+unsigned int _Complex long __int128 *x493; /* { dg-error "" } */
+unsigned long int long __int128 *x494; /* { dg-error "" } */
+unsigned long int _Complex __int128 *x495; /* { dg-error "" } */
+unsigned long long int __int128 *x496; /* { dg-error "" } */
+unsigned long long _Complex __int128 *x497; /* { dg-error "" } */
+unsigned long _Complex int __int128 *x498; /* { dg-error "" } */
+unsigned long _Complex long __int128 *x499; /* { dg-error "" } */
+unsigned _Complex short int __int128 *x500; /* { dg-error "" } */
+unsigned _Complex int short __int128 *x501; /* { dg-error "" } */
+unsigned _Complex int long __int128 *x502; /* { dg-error "" } */
+unsigned _Complex long int __int128 *x503; /* { dg-error "" } */
+unsigned _Complex long long __int128 *x504; /* { dg-error "" } */
+_Complex short int signed __int128 *x505; /* { dg-error "" } */
+_Complex short int unsigned __int128 *x506; /* { dg-error "" } */
+_Complex short signed int __int128 *x507; /* { dg-error "" } */
+_Complex short unsigned int __int128 *x508; /* { dg-error "" } */
+_Complex int short signed __int128 *x509; /* { dg-error "" } */
+_Complex int short unsigned __int128 *x510; /* { dg-error "" } */
+_Complex int long long __int128 *x511; /* { dg-error "" } */
+_Complex int long signed __int128 *x512; /* { dg-error "" } */
+_Complex int long unsigned __int128 *x513; /* { dg-error "" } */
+_Complex int signed short __int128 *x514; /* { dg-error "" } */
+_Complex int signed long __int128 *x515; /* { dg-error "" } */
+_Complex int unsigned short __int128 *x516; /* { dg-error "" } */
+_Complex int unsigned long __int128 *x517; /* { dg-error "" } */
+_Complex long int long __int128 *x518; /* { dg-error "" } */
+_Complex long int signed __int128 *x519; /* { dg-error "" } */
+_Complex long int unsigned __int128 *x520; /* { dg-error "" } */
+_Complex long long int __int128 *x521; /* { dg-error "" } */
+_Complex long long signed __int128 *x522; /* { dg-error "" } */
+_Complex long long unsigned __int128 *x523; /* { dg-error "" } */
+_Complex long signed int __int128 *x524; /* { dg-error "" } */
+_Complex long signed long __int128 *x525; /* { dg-error "" } */
+_Complex long unsigned int __int128 *x526; /* { dg-error "" } */
+_Complex long unsigned long __int128 *x527; /* { dg-error "" } */
+_Complex signed short int __int128 *x528; /* { dg-error "" } */
+_Complex signed int short __int128 *x529; /* { dg-error "" } */
+_Complex signed int long __int128 *x530; /* { dg-error "" } */
+_Complex signed long int __int128 *x531; /* { dg-error "" } */
+_Complex signed long long __int128 *x532; /* { dg-error "" } */
+_Complex unsigned short int __int128 *x533; /* { dg-error "" } */
+_Complex unsigned int short __int128 *x534; /* { dg-error "" } */
+_Complex unsigned int long __int128 *x535; /* { dg-error "" } */
+_Complex unsigned long int __int128 *x536; /* { dg-error "" } */
+_Complex unsigned long long __int128 *x537; /* { dg-error "" } */
+int long long signed _Complex __int128 *x538; /* { dg-error "" } */
+int long long unsigned _Complex __int128 *x539; /* { dg-error "" } */
+int long long _Complex signed __int128 *x540; /* { dg-error "" } */
+int long long _Complex unsigned __int128 *x541; /* { dg-error "" } */
+int long signed long _Complex __int128 *x542; /* { dg-error "" } */
+int long signed _Complex long __int128 *x543; /* { dg-error "" } */
+int long unsigned long _Complex __int128 *x544; /* { dg-error "" } */
+int long unsigned _Complex long __int128 *x545; /* { dg-error "" } */
+int long _Complex long signed __int128 *x546; /* { dg-error "" } */
+int long _Complex long unsigned __int128 *x547; /* { dg-error "" } */
+int long _Complex signed long __int128 *x548; /* { dg-error "" } */
+int long _Complex unsigned long __int128 *x549; /* { dg-error "" } */
+int signed long long _Complex __int128 *x550; /* { dg-error "" } */
+int signed long _Complex long __int128 *x551; /* { dg-error "" } */
+int signed _Complex long long __int128 *x552; /* { dg-error "" } */
+int unsigned long long _Complex __int128 *x553; /* { dg-error "" } */
+int unsigned long _Complex long __int128 *x554; /* { dg-error "" } */
+int unsigned _Complex long long __int128 *x555; /* { dg-error "" } */
+int _Complex long long signed __int128 *x556; /* { dg-error "" } */
+int _Complex long long unsigned __int128 *x557; /* { dg-error "" } */
+int _Complex long signed long __int128 *x558; /* { dg-error "" } */
+int _Complex long unsigned long __int128 *x559; /* { dg-error "" } */
+int _Complex signed long long __int128 *x560; /* { dg-error "" } */
+int _Complex unsigned long long __int128 *x561; /* { dg-error "" } */
+long int long signed _Complex __int128 *x562; /* { dg-error "" } */
+long int long unsigned _Complex __int128 *x563; /* { dg-error "" } */
+long int long _Complex signed __int128 *x564; /* { dg-error "" } */
+long int long _Complex unsigned __int128 *x565; /* { dg-error "" } */
+long int signed long _Complex __int128 *x566; /* { dg-error "" } */
+long int signed _Complex long __int128 *x567; /* { dg-error "" } */
+long int unsigned long _Complex __int128 *x568; /* { dg-error "" } */
+long int unsigned _Complex long __int128 *x569; /* { dg-error "" } */
+long int _Complex long signed __int128 *x570; /* { dg-error "" } */
+long int _Complex long unsigned __int128 *x571; /* { dg-error "" } */
+long int _Complex signed long __int128 *x572; /* { dg-error "" } */
+long int _Complex unsigned long __int128 *x573; /* { dg-error "" } */
+long long int signed _Complex __int128 *x574; /* { dg-error "" } */
+long long int unsigned _Complex __int128 *x575; /* { dg-error "" } */
+long long int _Complex signed __int128 *x576; /* { dg-error "" } */
+long long int _Complex unsigned __int128 *x577; /* { dg-error "" } */
+long long signed int _Complex __int128 *x578; /* { dg-error "" } */
+long long signed _Complex int __int128 *x579; /* { dg-error "" } */
+long long unsigned int _Complex __int128 *x580; /* { dg-error "" } */
+long long unsigned _Complex int __int128 *x581; /* { dg-error "" } */
+long long _Complex int signed __int128 *x582; /* { dg-error "" } */
+long long _Complex int unsigned __int128 *x583; /* { dg-error "" } */
+long long _Complex signed int __int128 *x584; /* { dg-error "" } */
+long long _Complex unsigned int __int128 *x585; /* { dg-error "" } */
+long signed int long _Complex __int128 *x586; /* { dg-error "" } */
+long signed int _Complex long __int128 *x587; /* { dg-error "" } */
+long signed long int _Complex __int128 *x588; /* { dg-error "" } */
+long signed long _Complex int __int128 *x589; /* { dg-error "" } */
+long signed _Complex int long __int128 *x590; /* { dg-error "" } */
+long signed _Complex long int __int128 *x591; /* { dg-error "" } */
+long unsigned int long _Complex __int128 *x592; /* { dg-error "" } */
+long unsigned int _Complex long __int128 *x593; /* { dg-error "" } */
+long unsigned long int _Complex __int128 *x594; /* { dg-error "" } */
+long unsigned long _Complex int __int128 *x595; /* { dg-error "" } */
+long unsigned _Complex int long __int128 *x596; /* { dg-error "" } */
+long unsigned _Complex long int __int128 *x597; /* { dg-error "" } */
+long _Complex int long signed __int128 *x598; /* { dg-error "" } */
+long _Complex int long unsigned __int128 *x599; /* { dg-error "" } */
+long _Complex int signed long __int128 *x600; /* { dg-error "" } */
+long _Complex int unsigned long __int128 *x601; /* { dg-error "" } */
+long _Complex long int signed __int128 *x602; /* { dg-error "" } */
+long _Complex long int unsigned __int128 *x603; /* { dg-error "" } */
+long _Complex long signed int __int128 *x604; /* { dg-error "" } */
+long _Complex long unsigned int __int128 *x605; /* { dg-error "" } */
+long _Complex signed int long __int128 *x606; /* { dg-error "" } */
+long _Complex signed long int __int128 *x607; /* { dg-error "" } */
+long _Complex unsigned int long __int128 *x608; /* { dg-error "" } */
+long _Complex unsigned long int __int128 *x609; /* { dg-error "" } */
+signed int long long _Complex __int128 *x610; /* { dg-error "" } */
+signed int long _Complex long __int128 *x611; /* { dg-error "" } */
+signed int _Complex long long __int128 *x612; /* { dg-error "" } */
+signed long int long _Complex __int128 *x613; /* { dg-error "" } */
+signed long int _Complex long __int128 *x614; /* { dg-error "" } */
+signed long long int _Complex __int128 *x615; /* { dg-error "" } */
+signed long long _Complex int __int128 *x616; /* { dg-error "" } */
+signed long _Complex int long __int128 *x617; /* { dg-error "" } */
+signed long _Complex long int __int128 *x618; /* { dg-error "" } */
+signed _Complex int long long __int128 *x619; /* { dg-error "" } */
+signed _Complex long int long __int128 *x620; /* { dg-error "" } */
+signed _Complex long long int __int128 *x621; /* { dg-error "" } */
+unsigned int long long _Complex __int128 *x622; /* { dg-error "" } */
+unsigned int long _Complex long __int128 *x623; /* { dg-error "" } */
+unsigned int _Complex long long __int128 *x624; /* { dg-error "" } */
+unsigned long int long _Complex __int128 *x625; /* { dg-error "" } */
+unsigned long int _Complex long __int128 *x626; /* { dg-error "" } */
+unsigned long long int _Complex __int128 *x627; /* { dg-error "" } */
+unsigned long long _Complex int __int128 *x628; /* { dg-error "" } */
+unsigned long _Complex int long __int128 *x629; /* { dg-error "" } */
+unsigned long _Complex long int __int128 *x630; /* { dg-error "" } */
+unsigned _Complex int long long __int128 *x631; /* { dg-error "" } */
+unsigned _Complex long int long __int128 *x632; /* { dg-error "" } */
+unsigned _Complex long long int __int128 *x633; /* { dg-error "" } */
+_Complex int long long signed __int128 *x634; /* { dg-error "" } */
+_Complex int long long unsigned __int128 *x635; /* { dg-error "" } */
+_Complex int long signed long __int128 *x636; /* { dg-error "" } */
+_Complex int long unsigned long __int128 *x637; /* { dg-error "" } */
+_Complex int signed long long __int128 *x638; /* { dg-error "" } */
+_Complex int unsigned long long __int128 *x639; /* { dg-error "" } */
+_Complex long int long signed __int128 *x640; /* { dg-error "" } */
+_Complex long int long unsigned __int128 *x641; /* { dg-error "" } */
+_Complex long int signed long __int128 *x642; /* { dg-error "" } */
+_Complex long int unsigned long __int128 *x643; /* { dg-error "" } */
+_Complex long long int signed __int128 *x644; /* { dg-error "" } */
+_Complex long long int unsigned __int128 *x645; /* { dg-error "" } */
+_Complex long long signed int __int128 *x646; /* { dg-error "" } */
+_Complex long long unsigned int __int128 *x647; /* { dg-error "" } */
+_Complex long signed int long __int128 *x648; /* { dg-error "" } */
+_Complex long signed long int __int128 *x649; /* { dg-error "" } */
+_Complex long unsigned int long __int128 *x650; /* { dg-error "" } */
+_Complex long unsigned long int __int128 *x651; /* { dg-error "" } */
+_Complex signed int long long __int128 *x652; /* { dg-error "" } */
+_Complex signed long int long __int128 *x653; /* { dg-error "" } */
+_Complex signed long long int __int128 *x654; /* { dg-error "" } */
+_Complex unsigned int long long __int128 *x655; /* { dg-error "" } */
+_Complex unsigned long int long __int128 *x656; /* { dg-error "" } */
+_Complex unsigned long long int __int128 *x657; /* { dg-error "" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/opaque-vector.c b/gcc-4.9/gcc/testsuite/c-c++-common/opaque-vector.c
new file mode 100644
index 000000000..bac3497be
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/opaque-vector.c
@@ -0,0 +1,22 @@
+#define B_TEST(TYPE) { TYPE v __attribute__((vector_size(16))); (void)((v < v) < v); }
+#ifdef __cplusplus
+#define T_TEST(TYPE) { TYPE s; TYPE v __attribute__((vector_size(16))); __typeof((v<v)[0]) iv __attribute__((vector_size(16))); (void)((iv ? s : s) < v); }
+#else
+#define T_TEST(TYPE)
+#endif
+#define T(TYPE) B_TEST(TYPE) T_TEST(TYPE)
+
+void f ()
+{
+ T(short)
+ T(int)
+ T(long)
+ T(long long)
+
+ T_TEST(float)
+ T_TEST(double)
+ /* Avoid trouble with non-power-of-two sizes. */
+#if !defined(__i386__) && !defined(__x86_64__) && !defined(__m68k__) && !defined(__ia64__) && !defined(__hppa__)
+ T_TEST(long double)
+#endif
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr20000.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr20000.c
new file mode 100644
index 000000000..17aadd9a3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr20000.c
@@ -0,0 +1,32 @@
+/* PR c/20000 We only want to warn if the function returns
+ explicitly. We do not care about the return type. */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+int g(void) __attribute__((noreturn));
+int g2(void) __attribute__((noreturn)); /* { dg-bogus ".noreturn. function returns non-void value" } */
+void h(void) __attribute__((noreturn));
+
+
+int g(void) {
+ return 1; /* { dg-warning "function declared 'noreturn' has a 'return' statement" "has return" } */
+} /* { dg-warning "'noreturn' function does return" "does return" { target *-*-* } 12 } */
+
+int g2(void) {
+ h();
+}
+
+typedef int ft(void);
+volatile ft vg;
+volatile ft vg2;
+
+int vg(void);
+int vg2(void); /* { dg-bogus ".noreturn. function returns non-void value" } */
+
+int vg(void) {
+ return 1; /* { dg-warning "function declared 'noreturn' has a 'return' statement" "has return" { target c } 27 } */
+} /* { dg-warning "'noreturn' function does return" "does return" { target c } 27 } */
+
+int vg2(void) {
+ h();
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr20318.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr20318.c
new file mode 100644
index 000000000..c6e9639fc
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr20318.c
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+
+extern int f() __attribute__((returns_nonnull)); /* { dg-error "not returning a pointer" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr28656.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr28656.c
new file mode 100644
index 000000000..a0c2339f5
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr28656.c
@@ -0,0 +1,29 @@
+/* PR c++/28656 */
+/* { dg-do compile } */
+/* { dg-options "-Wnonnull" } */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern void *memcpy (void *__restrict, const void *__restrict, __SIZE_TYPE__)
+ __attribute__((nonnull (1), nonnull (2), nonnull (1, 2), nonnull));
+#ifdef __cplusplus
+}
+#endif
+
+extern void bar (void *p1, void *p2, void *p3, void *p4, void *p5)
+ __attribute__((nonnull (1), nonnull (1, 3), nonnull (3, 5), nonnull (4)));
+
+void
+foo (void)
+{
+ memcpy (0, 0, 0);
+ bar (0, 0, 0, 0, 0);
+}
+
+/* { dg-warning "null argument where non-null required\[^\n\r\]*argument 1" "" { target *-*-* } 20 } */
+/* { dg-warning "null argument where non-null required\[^\n\r\]*argument 2" "" { target *-*-* } 20 } */
+/* { dg-warning "null argument where non-null required\[^\n\r\]*argument 1" "" { target *-*-* } 21 } */
+/* { dg-warning "null argument where non-null required\[^\n\r\]*argument 3" "" { target *-*-* } 21 } */
+/* { dg-warning "null argument where non-null required\[^\n\r\]*argument 4" "" { target *-*-* } 21 } */
+/* { dg-warning "null argument where non-null required\[^\n\r\]*argument 5" "" { target *-*-* } 21 } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr33193.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr33193.c
new file mode 100644
index 000000000..2d1929848
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr33193.c
@@ -0,0 +1,19 @@
+/* PR c/33193 */
+/* { dg-do compile } */
+
+struct a {float x, y; };
+
+float f(struct a b)
+{
+ /* The error messages here are different between C and C++, so just
+ make sure we get an error. */
+ float x = __real b; /* { dg-error "" } */
+ float y = __imag b; /* { dg-error "" } */
+ return x / y;
+}
+int f1(int *b)
+{
+ float x = __imag b; /* { dg-error "wrong type argument" } */
+ float y = __real b; /* { dg-error "wrong type argument" } */
+ return x - y;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr33763.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr33763.c
new file mode 100644
index 000000000..dbdfa77fc
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr33763.c
@@ -0,0 +1,60 @@
+/* PR tree-optimization/33763 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef struct
+{
+ void *a;
+ void *b;
+} T;
+extern void *foo (const char *, const char *);
+extern void *bar (void *, const char *, T);
+extern int baz (const char *, int);
+
+extern inline __attribute__ ((always_inline, gnu_inline)) int
+baz (const char *x, int y)
+{
+ return 2;
+}
+
+int
+baz (const char *x, int y)
+{
+ return 1;
+}
+
+int xa, xb;
+
+static void *
+inl (const char *x, const char *y)
+{
+ T t = { &xa, &xb };
+ int *f = (int *) __builtin_malloc (sizeof (int));
+ const char *z;
+ int o = 0;
+ void *r = 0;
+
+ for (z = y; *z; z++)
+ {
+ if (*z == 'r')
+ o |= 1;
+ if (*z == 'w')
+ o |= 2;
+ }
+ if (o == 1)
+ *f = baz (x, 0);
+ if (o == 2)
+ *f = baz (x, 1);
+ if (o == 3)
+ *f = baz (x, 2);
+
+ if (o && *f > 0)
+ r = bar (f, "w", t);
+ return r;
+}
+
+void *
+foo (const char *x, const char *y)
+{
+ return inl (x, y);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr36282-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr36282-1.c
new file mode 100644
index 000000000..abe11e7ec
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr36282-1.c
@@ -0,0 +1,12 @@
+/* PR middle-end/36282 */
+/* { dg-do compile } */
+
+#pragma weak bar
+
+extern void *baz (void *dest, const void *src, __SIZE_TYPE__ n);
+extern __typeof (baz) baz __asm("bazfn"); /* { dg-bogus "asm declaration ignored due to conflict with previous rename" } */
+
+void
+foo (void)
+{
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr36282-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr36282-2.c
new file mode 100644
index 000000000..86d3ad657
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr36282-2.c
@@ -0,0 +1,10 @@
+/* PR middle-end/36282 */
+/* { dg-do compile } */
+
+extern void *baz (void *dest, const void *src, __SIZE_TYPE__ n);
+extern __typeof (baz) baz __asm("bazfn"); /* { dg-bogus "asm declaration ignored due to conflict with previous rename" } */
+
+void
+foo (void)
+{
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr36282-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr36282-3.c
new file mode 100644
index 000000000..8982470c0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr36282-3.c
@@ -0,0 +1,13 @@
+/* PR middle-end/36282 */
+/* { dg-do compile } */
+
+void bar (void);
+#pragma weak bar
+
+extern void *baz (void *dest, const void *src, __SIZE_TYPE__ n);
+extern __typeof (baz) baz __asm("bazfn"); /* { dg-bogus "asm declaration ignored due to conflict with previous rename" } */
+
+void
+foo (void)
+{
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr36282-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr36282-4.c
new file mode 100644
index 000000000..f6f40f8e4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr36282-4.c
@@ -0,0 +1,13 @@
+/* PR middle-end/36282 */
+/* { dg-do compile } */
+
+#pragma weak bar
+void bar (void);
+
+extern void *baz (void *dest, const void *src, __SIZE_TYPE__ n);
+extern __typeof (baz) baz __asm("bazfn"); /* { dg-bogus "asm declaration ignored due to conflict with previous rename" } */
+
+void
+foo (void)
+{
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr36513-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr36513-2.c
new file mode 100644
index 000000000..3c12e1ae8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr36513-2.c
@@ -0,0 +1,13 @@
+/* PR 36513: -Wlogical-op warns about strchr */
+/* { dg-do compile } */
+/* { dg-options "-Wlogical-op" } */
+#ifdef __cplusplus
+#include <cstring>
+#else
+#include <string.h>
+#endif
+int main2 ()
+{
+ char *s, t;
+ strchr (s, t);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr36513.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr36513.c
new file mode 100644
index 000000000..026325410
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr36513.c
@@ -0,0 +1,15 @@
+/* PR 36513: -Wlogical-op warns about strchr */
+/* { dg-do compile } */
+/* { dg-options "-Wlogical-op" } */
+
+extern void *__rawmemchr (const void *__s, int __c);
+int main1 ()
+{
+ char *s, t;
+ (__extension__ (__builtin_constant_p (t)
+ && !__builtin_constant_p (s)
+ && (t) == '\0'
+ ? (char *) __rawmemchr (s, t)
+ : __builtin_strchr (s, t)));
+}
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr37743.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr37743.c
new file mode 100644
index 000000000..2ea678e09
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr37743.c
@@ -0,0 +1,13 @@
+/* PR c/37743 */
+/* This needs to be run only on targets where __UINT32_TYPE__ is defined
+ to unsigned int. */
+/* { dg-do compile { target *-*-linux-gnu* } } */
+/* { dg-options "-Wformat" } */
+
+int foo (const char *, ...) __attribute__ ((format (printf, 1, 2)));
+
+void
+bar (unsigned int x)
+{
+ foo ("%x", __builtin_bswap32 (x));
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr41779.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr41779.c
new file mode 100644
index 000000000..25b0b681c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr41779.c
@@ -0,0 +1,56 @@
+/* PR41779: Wconversion cannot see through real*integer promotions. */
+/* { dg-do compile } */
+/* { dg-skip-if "doubles are floats" { "avr-*-*" } { "*" } { "" } } */
+/* { dg-options "-std=c99 -Wconversion" { target c } } */
+/* { dg-options "-Wconversion" { target c++ } } */
+/* { dg-require-effective-target large_double } */
+
+float f1(float x, unsigned short y)
+{
+ return x * y;
+}
+
+float f2(float x, short y)
+{
+ return x * y;
+}
+
+float f3(float x, char y)
+{
+ return x * y;
+}
+
+float f4(float x, unsigned char y)
+{
+ return x * y;
+}
+
+float f5(float x, int y)
+{
+ return x * y; /* { dg-warning "conversion" } */
+}
+
+double c1(float x, unsigned short y, int z)
+{
+ return z ? x + x : y;
+}
+
+double c2(float x, short y, int z)
+{
+ return z ? x + x : y;
+}
+
+double c3(float x, char y, int z)
+{
+ return z ? x + x : y;
+}
+
+double c4(float x, unsigned char y, int z)
+{
+ return z ? x + x : y;
+}
+
+double c5(float x, int y, int z)
+{
+ return z ? x + x : y; /* { dg-warning "conversion" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr41935.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr41935.c
new file mode 100644
index 000000000..3279e7559
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr41935.c
@@ -0,0 +1,70 @@
+/* { dg-options "-Warray-bounds" } */
+/* { dg-do compile } */
+
+struct A
+{
+ int i;
+ char p[1];
+};
+
+struct B
+{
+ struct A a;
+ int i;
+};
+
+struct C
+{
+ int i;
+ struct A a;
+};
+
+union D
+{
+ char p[1];
+ struct A a;
+ struct B b;
+ struct C c;
+};
+
+struct E
+{
+ int i;
+ union D d;
+};
+
+struct F
+{
+ union D d;
+ int i;
+};
+
+union G
+{
+ int i;
+ union D d;
+};
+
+void
+f0 ()
+{
+ __builtin_offsetof (struct A, p[4]); /* OK */
+ __builtin_offsetof (struct B, a.p[4]); /* { dg-warning "greater than size" } */
+ __builtin_offsetof (struct C, a.p[4]); /* OK */
+ __builtin_offsetof (union D, p[4]); /* OK */
+ __builtin_offsetof (union D, a.p[4]); /* OK */
+ __builtin_offsetof (union D, b.a.p[4]); /* { dg-warning "greater than size" } */
+ __builtin_offsetof (union D, c.a.p[4]); /* OK */
+ __builtin_offsetof (struct E, d.p[4]); /* OK */
+ __builtin_offsetof (struct E, d.a.p[4]); /* OK */
+ __builtin_offsetof (struct E, d.b.a.p[4]); /* { dg-warning "greater than size" } */
+ __builtin_offsetof (struct E, d.c.a.p[4]); /* OK */
+ __builtin_offsetof (struct F, d.p[4]); /* { dg-warning "greater than size" } */
+ __builtin_offsetof (struct F, d.a.p[4]); /* { dg-warning "greater than size" } */
+ __builtin_offsetof (struct F, d.b.a.p[4]); /* { dg-warning "greater than size" } */
+ __builtin_offsetof (struct F, d.c.a.p[4]); /* { dg-warning "greater than size" } */
+ __builtin_offsetof (union G, d.p[4]); /* OK */
+ __builtin_offsetof (union G, d.a.p[4]); /* OK */
+ __builtin_offsetof (union G, d.b.a.p[4]); /* { dg-warning "greater than size" } */
+ __builtin_offsetof (union G, d.c.a.p[4]); /* OK */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr42674.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr42674.c
new file mode 100644
index 000000000..ae6730c50
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr42674.c
@@ -0,0 +1,13 @@
+/* PR middle-end/42674 */
+/* { dg-do compile } */
+/* { dg-options "-Wreturn-type" } */
+
+extern void bar (void);
+static int foo (void) __attribute__ ((__noreturn__, __used__));
+
+static int
+foo (void)
+{
+ while (1)
+ bar ();
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr43690.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr43690.c
new file mode 100644
index 000000000..67c6cb0f8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr43690.c
@@ -0,0 +1,13 @@
+/* PR middle-end/43690 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void
+foo (char *x)
+{
+ asm ("" : : "m" (x++)); /* { dg-error "is not directly addressable" } */
+ asm ("" : : "m" (++x)); /* { dg-error "is not directly addressable" } */
+ asm ("" : : "m" (x--)); /* { dg-error "is not directly addressable" } */
+ asm ("" : : "m" (--x)); /* { dg-error "is not directly addressable" } */
+ asm ("" : : "m" (x + 1)); /* { dg-error "is not directly addressable" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr43772.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr43772.c
new file mode 100644
index 000000000..8bf09a420
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr43772.c
@@ -0,0 +1,45 @@
+/* { dg-do compile } */
+/* { dg-options "-Wlogical-op -Wtype-limits" } */
+#include <limits.h>
+long long
+emacs_lseek (long long offset)
+{
+ return -1-9223372036854775807LL <= offset && offset <= 9223372036854775807LL;
+}
+
+long long
+foo (long long offset)
+{
+ return -1-9223372036854775807LL > offset && offset > 9223372036854775807LL;
+}
+
+long long
+foo3 (long long offset)
+{
+ return -1-9223372036854775807LL > offset && offset < 9223372036854775807LL;
+}
+
+long long
+foo2 (long long offset)
+{
+ if (-1-9223372036854775807LL <= offset) return 0;
+ if (offset <= 9223372036854775807LL) return 0;
+ if (-1-9223372036854775807LL > offset) return 0;
+ if (offset > 9223372036854775807LL) return 0;
+ return 1;
+}
+
+# define BOT INT_MIN
+# define TOP INT_MAX
+
+long long get_intmax(void);
+int get_int(void);
+extern void do_something(void);
+int main(void)
+{
+ int i = get_int();
+ long long x = get_intmax();
+ i = (i > BOT && i < TOP); //OK
+ i = (i >= BOT+1 && i <= TOP-1); //OK
+ i = (i >= BOT && i <= TOP); //Oops!
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr43942.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr43942.c
new file mode 100644
index 000000000..3d97db662
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr43942.c
@@ -0,0 +1,33 @@
+/* PR debug/43942 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcompare-debug" } */
+
+extern int f1 (int);
+
+int
+f2 (int x)
+{
+ extern int v;
+ return f1 (x);
+}
+
+void
+f3 (void)
+{
+ f2 (0);
+}
+
+static inline int
+f4 (int x)
+{
+ extern int w;
+ if (w)
+ return f1 (x);
+ return 0;
+}
+
+void
+f5 (void)
+{
+ f4 (0);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr44832.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr44832.c
new file mode 100644
index 000000000..b57e525ea
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr44832.c
@@ -0,0 +1,162 @@
+/* PR debug/44832 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcompare-debug" } */
+/* { dg-options "-O2 -fcompare-debug -fno-short-enums" {target short_enums} } */
+/* { dg-require-effective-target int32plus } */
+
+struct rtx_def;
+typedef struct rtx_def *rtx;
+typedef const struct rtx_def *const_rtx;
+struct rtvec_def;
+typedef struct rtvec_def *rtvec;
+extern int ix86_isa_flags;
+
+enum machine_mode
+{
+ VOIDmode,
+ V8HImode,
+ V16QImode,
+ V4SImode,
+ V2DImode,
+ V32QImode,
+ MAX_MACHINE_MODE,
+
+ NUM_MACHINE_MODES = MAX_MACHINE_MODE
+};
+extern unsigned char mode_size[NUM_MACHINE_MODES];
+extern const unsigned char mode_inner[NUM_MACHINE_MODES];
+extern const unsigned char mode_nunits[NUM_MACHINE_MODES];
+enum rtx_code {
+
+CONST_INT ,
+
+CONST_FIXED ,
+
+CONST_DOUBLE
+
+ };
+union rtunion_def
+{
+ rtvec rt_rtvec;
+};
+typedef union rtunion_def rtunion;
+struct rtx_def {
+
+ __extension__ enum rtx_code code: 16;
+
+ __extension__ enum machine_mode mode : 8;
+
+ union u {
+ rtunion fld[1];
+ } u;
+};
+struct rtvec_def {
+ rtx elem[1];
+};
+extern int rtx_equal_p (const_rtx, const_rtx);
+extern rtx gen_reg_rtx (enum machine_mode);
+
+extern void
+ix86_expand_vector_init_concat (enum machine_mode mode,
+ rtx target, rtx *ops, int n);
+
+static void
+ix86_expand_vector_init_general (unsigned char mmx_ok, enum machine_mode mode,
+ rtx target, rtx vals)
+{
+ rtx ops[32], op0, op1;
+ enum machine_mode half_mode = VOIDmode;
+ int n, i;
+
+ switch (mode)
+ {
+ case V4SImode:
+ case V2DImode:
+ n = mode_nunits[mode];
+ ix86_expand_vector_init_concat (mode, target, ops, n);
+ return;
+
+ case V32QImode:
+ goto half;
+half:
+{
+ typedef int eger;
+ if (mode != V4SImode)
+ ops[0] = 0;
+}
+ n = mode_nunits[mode];
+ for (i = 0; i < n; i++)
+ ops[i] = (((((vals)->u.fld[0]).rt_rtvec))->elem[i]);
+ op0 = gen_reg_rtx (VOIDmode);
+ return;
+
+ case V16QImode:
+ if (!((ix86_isa_flags & (1 << 19)) != 0))
+ break;
+
+ case V8HImode:
+ if (!((ix86_isa_flags & (1 << 17)) != 0))
+ break;
+
+ n = mode_nunits[mode];
+ for (i = 0; i < n; i++)
+ ops[i] = (((((vals)->u.fld[0]).rt_rtvec))->elem[i]);
+ return;
+
+ default:
+ ;
+ }
+
+ {
+ int n_words;
+
+ n_words = ((unsigned short) mode_size[mode]) / 4;
+
+ if (n_words == 4)
+ ix86_expand_vector_init_general (0, V4SImode, 0, 0);
+ }
+}
+
+
+void
+ix86_expand_vector_init (unsigned char mmx_ok, rtx target, rtx vals)
+{
+ enum machine_mode mode = ((enum machine_mode) (target)->mode);
+ enum machine_mode inner_mode = ((enum machine_mode) mode_inner[mode]);
+ int n_elts = mode_nunits[mode];
+ int n_var = 0, one_var = -1;
+ unsigned char all_same = 1, all_const_zero = 1;
+ int i;
+ rtx x;
+
+ for (i = 0; i < n_elts; ++i)
+ {
+ x = (((((vals)->u.fld[0]).rt_rtvec))->elem[i]);
+ if (!((((enum rtx_code) (x)->code) == CONST_INT)
+ || ((enum rtx_code) (x)->code) == CONST_DOUBLE
+ || ((enum rtx_code) (x)->code) == CONST_FIXED))
+ n_var++, one_var = i;
+ else
+ all_const_zero = 0;
+ if (i > 0 && !rtx_equal_p (x, (((((vals)->u.fld[0]).rt_rtvec))->elem[0])))
+ all_same = 0;
+ }
+
+
+ if (n_var == 0)
+ {
+ return;
+ }
+
+ if (all_same)
+ return;
+
+ if (n_var == 1)
+ {
+ if (all_const_zero)
+ return;
+
+ }
+
+ ix86_expand_vector_init_general (mmx_ok, mode, target, vals);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr46562-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr46562-2.c
new file mode 100644
index 000000000..45bf5cf71
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr46562-2.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fno-tree-ccp -fno-tree-forwprop -fdump-tree-fre1" } */
+
+static const int a[4] = {};
+int foo(void)
+{
+ int i = 1;
+ const int *p = &a[i];
+ return *p;
+}
+
+/* { dg-final { scan-tree-dump "= 0;" "fre1" } } */
+/* { dg-final { cleanup-tree-dump "fre1" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr46562.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr46562.c
new file mode 100644
index 000000000..30659070f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr46562.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-ccp1" } */
+
+static const int a[4] = {};
+int foo(void)
+{
+ int i = 1;
+ const int *p = &a[i];
+ return *p;
+}
+
+/* { dg-final { scan-tree-dump "return 0;" "ccp1" } } */
+/* { dg-final { cleanup-tree-dump "ccp1" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr48418.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr48418.c
new file mode 100644
index 000000000..95ff855b8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr48418.c
@@ -0,0 +1,20 @@
+/* PR c/48418 */
+/* { dg-do compile } */
+/* { dg-options "-Wall -O2" } */
+
+int
+foo (int x)
+{
+ const int a = sizeof (int) * __CHAR_BIT__;
+ const int b = -7;
+ int c = 0;
+ c += x << a; /* { dg-warning "left shift count >= width of type" } */
+ c += x << b; /* { dg-warning "left shift count is negative" } */
+ c += x << (sizeof (int) * __CHAR_BIT__); /* { dg-warning "left shift count >= width of type" } */
+ c += x << -7; /* { dg-warning "left shift count is negative" } */
+ c += x >> a; /* { dg-warning "right shift count >= width of type" } */
+ c += x >> b; /* { dg-warning "right shift count is negative" } */
+ c += x >> (sizeof (int) * __CHAR_BIT__); /* { dg-warning "right shift count >= width of type" } */
+ c += x >> -7; /* { dg-warning "right shift count is negative" } */
+ return c;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr51294.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr51294.c
new file mode 100644
index 000000000..395e6b2df
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr51294.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-Wconversion -Wsign-conversion" } */
+
+void foo(int haveBar, char bar_)
+{
+ char zuul = haveBar?bar_:0;
+ char zuul2 = haveBar?bar_:bar_;
+ char zuul3 = haveBar?0:bar_;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr51712.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr51712.c
new file mode 100644
index 000000000..69e316d24
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr51712.c
@@ -0,0 +1,19 @@
+/* PR c/51712 */
+/* { dg-do compile } */
+/* { dg-options "-Wtype-limits" } */
+/* { dg-additional-options "-fno-short-enums" { target short_enums } } */
+
+enum test_enum {
+ FOO,
+ BAR
+};
+
+int valid(enum test_enum arg)
+{
+ return arg >= 0 && arg <= BAR;
+}
+
+int valid2(unsigned int arg2)
+{
+ return arg2 >= FOO && arg2 <= BAR; /* { dg-bogus "comparison of unsigned expression" "" { xfail *-*-* } } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr51768.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr51768.c
new file mode 100644
index 000000000..082594cca
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr51768.c
@@ -0,0 +1,25 @@
+/* PR middle-end/51768 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void
+foo (void)
+{
+ asm goto ("" : : : : lab, lab, lab2, lab); /* { dg-error "duplicate asm operand name" } */
+lab:;
+lab2:;
+}
+
+void
+bar (void)
+{
+ asm goto ("" : : [lab] "i" (0) : : lab); /* { dg-error "duplicate asm operand name" } */
+lab:;
+}
+
+void
+baz (void)
+{
+ int x;
+ asm ("" : [lab] "=r" (x) : [lab] "r" (x)); /* { dg-error "duplicate asm operand name" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr52177.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr52177.c
new file mode 100644
index 000000000..165acdef2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr52177.c
@@ -0,0 +1,23 @@
+/* PR middle-end/52177 */
+/* { dg-do compile } */
+/* { dg-options "-O -fno-tree-ccp" } */
+
+int *s;
+
+static inline int
+foo ()
+{
+ return sizeof (int);
+}
+
+int
+bar ()
+{
+ return __atomic_always_lock_free (foo (), s);
+}
+
+int
+baz ()
+{
+ return __atomic_is_lock_free (foo (), s);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr52181.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr52181.c
new file mode 100644
index 000000000..e09bc92fc
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr52181.c
@@ -0,0 +1,13 @@
+/* PR c/52181 */
+/* { dg-do compile } */
+
+extern const int v1[];
+const int __attribute__((aligned(16))) v1[] = { 1 };
+extern const int __attribute__((aligned(16))) v2[];
+const int v2[] = { 1 };
+extern const int __attribute__((aligned(16))) v3[];
+const int __attribute__((aligned(16))) v3[] = { 1 };
+const int __attribute__((aligned(16))) v4[] = { 1 };
+int test[(__alignof__ (v4) != __alignof__ (v1) /* { dg-bogus "is negative" } */
+ || __alignof__ (v4) != __alignof__ (v2)
+ || __alignof__ (v4) != __alignof__ (v3)) ? -1 : 0];
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr53633.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr53633.c
new file mode 100644
index 000000000..db7e1ceb8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr53633.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target naked_functions } */
+/* { dg-options "-O2 -Wall" } */
+/* Check that we do not get warnings about missing return statements
+ or bogus looking noreturn functions. */
+int __attribute__((naked))
+foo(void)
+{
+ __asm__ ("");
+}
+
+int __attribute__((naked,noreturn))
+bar(void)
+{
+ __asm__ ("");
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr54486.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr54486.c
new file mode 100644
index 000000000..b4bcf3b10
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr54486.c
@@ -0,0 +1,33 @@
+/* PR middle-end/54486 */
+/* { dg-do compile } */
+/* { dg-options "-Wformat" } */
+/* { dg-skip-if "no POSIX printf" { *-*-mingw* } { "*" } { "" } } */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef __SIZE_TYPE__ size_t;
+extern int printf (const char *, ...);
+extern size_t strspn (const char *, const char *);
+extern size_t strcspn (const char *, const char *);
+extern size_t strlen (const char *);
+#ifdef __cplusplus
+}
+#endif
+
+void
+foo (void)
+{
+ printf ("%zu\n", strspn ("abc", "abcdefg"));
+ printf ("%zu\n", (size_t) strspn ("abc", "abcdefg"));
+ printf ("%zu\n", __builtin_strspn ("abc", "abcdefg"));
+ printf ("%zu\n", (size_t) __builtin_strspn ("abc", "abcdefg"));
+ printf ("%zu\n", strcspn ("abc", "abcdefg"));
+ printf ("%zu\n", (size_t) strcspn ("abc", "abcdefg"));
+ printf ("%zu\n", __builtin_strcspn ("abc", "abcdefg"));
+ printf ("%zu\n", (size_t) __builtin_strcspn ("abc", "abcdefg"));
+ printf ("%zu\n", strlen ("abc"));
+ printf ("%zu\n", (size_t) strlen ("abc"));
+ printf ("%zu\n", __builtin_strlen ("abc"));
+ printf ("%zu\n", (size_t) __builtin_strlen ("abc"));
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr54988.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr54988.c
new file mode 100644
index 000000000..59406d6ab
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr54988.c
@@ -0,0 +1,20 @@
+/* PR c++/54988 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-msse2" { target { i?86-*-* x86_64-*-* } } } */
+
+#if defined(__i386__) || defined(__x86_64__)
+#pragma GCC target "fpmath=sse"
+#endif
+
+static inline __attribute__ ((always_inline)) int
+foo (int x)
+{
+ return x;
+}
+
+int
+bar (int x)
+{
+ return foo (x);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr55619.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr55619.c
new file mode 100644
index 000000000..f1b4e9c00
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr55619.c
@@ -0,0 +1,11 @@
+/* PR c++/55619 */
+/* { dg-do compile } */
+
+int y[4];
+
+void
+f ()
+{
+ int x[4] = { 0, 1, 2, 3 };
+ __asm volatile ("" : : "m" (x), "m" (y));
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr55771.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr55771.c
new file mode 100644
index 000000000..16f02442c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr55771.c
@@ -0,0 +1,12 @@
+/* { dg-do run } */
+
+float global;
+int main()
+{
+ unsigned long z = 1;
+ float x = -z;
+ global = x;
+ if (global < 0)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr56302.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr56302.c
new file mode 100644
index 000000000..fb67d1271
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr56302.c
@@ -0,0 +1,9 @@
+/* PR c++/56302 */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+void
+foo (int x)
+{
+ __asm__ __volatile__ ("" : : "n" (-1 * (int) sizeof (&x)));
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr56566.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr56566.c
new file mode 100644
index 000000000..e753d933a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr56566.c
@@ -0,0 +1,14 @@
+/* PR c/56566 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+struct S1 { enum E1 { N1 = -1, Z1 = 0 } e : 1; };
+struct S2 { enum E2 { N2 = -1 } e : 1; };
+struct S3 { enum E3 { Z3 = 0 } e : 1; };
+struct S4 { enum E4 { N4 = -2, Z4 = 1 } e : 2; };
+struct S5 { enum E5 { N5 = -3, Z5 = 1 } e : 3; };
+struct S6 { enum E6 { N6 = -2, Z6 = 1 } e : 1; }; // { dg-warning "too small|narrower" }
+struct S7 { enum E7 { N7 = -3, Z7 = 1 } e : 2; }; // { dg-warning "too small|narrower" }
+struct S8 { enum E8 { Z8 = 1 } e : 1; };
+struct S9 { enum E9 { Z9 = 2 } e : 2; };
+struct S0 { enum E0 { Z0 = 2 } e : 1; }; // { dg-warning "too small|narrower" }
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr56607.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr56607.c
new file mode 100644
index 000000000..d7faa8115
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr56607.c
@@ -0,0 +1,29 @@
+/* PR c++/56607 */
+/* { dg-do compile { target { { lp64 || ilp32 } || llp64 } } } */
+/* { dg-options "-O2 -Wdiv-by-zero" } */
+
+int
+f1 (void)
+{
+ return 1 / (sizeof (char) - 1); /* { dg-warning "division by zero" } */
+}
+
+int
+f2 (void)
+{
+ const int x = sizeof (char) - 1;
+ return 1 / x; /* { dg-warning "division by zero" "" { target c++ } } */
+}
+
+int
+f3 (void)
+{
+ return 1 / (sizeof (int) / 3 - 1); /* { dg-warning "division by zero" } */
+}
+
+int
+f4 (void)
+{
+ const int x = sizeof (int) / 3 - 1;
+ return 1 / x; /* { dg-warning "division by zero" "" { target c++ } } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr57793.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr57793.c
new file mode 100644
index 000000000..f2719529e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr57793.c
@@ -0,0 +1,23 @@
+/* PR c++/57793 */
+
+struct A { unsigned a : 1; unsigned b : 1; };
+struct B /* { dg-error "type .B. is too large" "" { target { c++ && ilp32 } } } */
+{
+ unsigned char c[0x40000000]; /* { dg-error "size of array .c. is too large" "" { target { ! int32plus } } } */
+ unsigned char d[0x40000ff0];/* { dg-error "size of array .d. is too large" "" { target { ! int32plus } } } */
+ struct A e;
+}; /* { dg-error "type .struct B. is too large" "" { target { c && ilp32 } } } */
+
+void *foo (struct B *p)
+{
+ if (p->e.a)
+ return (void *) 0;
+ p->e.b = 1;
+ return p->c;
+}
+
+void
+bar (struct B *p)
+{
+ foo (p);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr58346-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr58346-1.c
new file mode 100644
index 000000000..371fcf484
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr58346-1.c
@@ -0,0 +1,24 @@
+/* PR c/58346 */
+/* { dg-do compile } */
+
+struct U {
+#ifdef __cplusplus
+ char a[0];
+#endif
+};
+static struct U b[6];
+static struct U *u1, *u2;
+
+int
+foo (struct U *p, struct U *q)
+{
+ return q - p; /* { dg-error "arithmetic on pointer to an empty aggregate" } */
+}
+
+void
+bar (void)
+{
+ __PTRDIFF_TYPE__ d = u1 - u2; /* { dg-error "arithmetic on pointer to an empty aggregate" } */
+ __asm volatile ("" : "+g" (d));
+ foo (&b[0], &b[4]);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr58346-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr58346-2.c
new file mode 100644
index 000000000..195060e42
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr58346-2.c
@@ -0,0 +1,8 @@
+/* PR c/58346 */
+/* { dg-do compile } */
+
+__PTRDIFF_TYPE__
+foo (int p[3][0], int q[3][0])
+{
+ return p - q; /* { dg-error "arithmetic on pointer to an empty aggregate" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr58346-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr58346-3.c
new file mode 100644
index 000000000..41627ed95
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr58346-3.c
@@ -0,0 +1,16 @@
+/* PR c/58346 */
+/* { dg-do compile } */
+
+void
+foo (void)
+{
+ __PTRDIFF_TYPE__ d;
+ const int i = 0;
+ int a1[2][0], a2[2][0];
+ int b1[3][i], b2[4][i];
+ d = a1 - a2; /* { dg-error "arithmetic on pointer to an empty aggregate" } */
+ __asm volatile ("" : "+g" (d));
+ /* No error here for C. */
+ d = b1 - b2; /* { dg-error "arithmetic on pointer to an empty aggregate" "" { target c++ } } */
+ __asm volatile ("" : "+g" (d));
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr59032.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr59032.c
new file mode 100644
index 000000000..327f5aeb6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr59032.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void
+foo()
+{
+ float v __attribute__((vector_size(8)));
+ v++;
+}
+
+void
+foo2 ()
+{
+ float v __attribute__((vector_size(8)));
+ ++v;
+}
+
+void
+foo3 ()
+{
+ float v __attribute__((vector_size(8)));
+ v--;
+}
+
+void
+foo4 ()
+{
+ float v __attribute__((vector_size(8)));
+ --v;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr59037.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr59037.c
new file mode 100644
index 000000000..fae13c2fa
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr59037.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+typedef int v4si __attribute__ ((vector_size (16)));
+
+int
+main (int argc, char** argv)
+{
+ v4si x = {0,1,2,3};
+ x = (v4si) {(x)[3], (x)[2], (x)[1], (x)[0]};
+ return x[4];
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr59223.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr59223.c
new file mode 100644
index 000000000..471c0625d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr59223.c
@@ -0,0 +1,13 @@
+/* PR c/59223 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wmaybe-uninitialized" } */
+
+int foo (int x)
+{
+ int y;
+ if (x == 0)
+ y = 1;
+ else if (x == 1)
+ y = 2;
+ return y; /* { dg-warning "may be used uninitialized in this function" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr59280.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr59280.c
new file mode 100644
index 000000000..779f0fb85
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr59280.c
@@ -0,0 +1,4 @@
+/* PR c/59280 */
+/* { dg-do compile } */
+
+void bar (char *) __attribute__((constructor(foo))); /* { dg-error "constructor priorities must be integers|was not declared|constructor priorities are not supported" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr60101.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr60101.c
new file mode 100644
index 000000000..b1634c49f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr60101.c
@@ -0,0 +1,112 @@
+/* PR c/60101 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wall" } */
+
+extern int *a, b, *c, *d;
+
+void
+foo (double _Complex *x, double _Complex *y, double _Complex *z, unsigned int l, int w)
+{
+ unsigned int e = (unsigned int) a[3];
+ double _Complex (*v)[l][4][e][l][4] = (double _Complex (*)[l][4][e][l][4]) z;
+ double _Complex (*f)[l][b][l] = (double _Complex (*)[l][b][l]) y;
+ unsigned int g = c[0] * c[1] * c[2];
+ unsigned int h = d[0] + c[0] * (d[1] + c[1] * d[2]);
+ unsigned int i;
+
+ for (i = 0; i < e; i++)
+ {
+ int j = e * d[3] + i;
+
+ unsigned int n0, n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11;
+ float _Complex s = 0.;
+ unsigned int t = 0;
+
+ for (n0 = 0; n0 < l; n0++)
+ for (n1 = 0; n1 < l; n1++)
+ for (n2 = 0; n2 < l; n2++)
+ for (n3 = 0; n3 < l; n3++)
+ for (n4 = 0; n4 < l; n4++)
+ for (n5 = 0; n5 < l; n5++)
+ for (n6 = 0; n6 < l; n6++)
+ for (n7 = 0; n7 < l; n7++)
+ for (n8 = 0; n8 < l; n8++)
+ for (n9 = 0; n9 < l; n9++)
+ for (n10 = 0; n10 < l; n10++)
+ for (n11 = 0; n11 < l; n11++)
+ {
+ if (t % g == h)
+ s
+ += f[n0][n4][j][n8] * f[n1][n5][j][n9] * ~(f[n2][n6][w][n10]) * ~(f[n3][n7][w][n11])
+ * (+0.25 * v[0][n2][0][i][n9][1] * v[0][n3][0][i][n5][1] * v[0][n10][0][i][n4][1]
+ * v[0][n7][1][i][n8][0] * v[0][n11][1][i][n1][0] * v[0][n6][1][i][n0][0]
+ + 0.25 * v[0][n2][0][i][n9][1] * v[0][n3][0][i][n5][1] * v[0][n10][0][i][n4][1]
+ * v[0][n11][1][i][n8][0] * v[0][n6][1][i][n1][0] * v[0][n7][1][i][n0][0]
+ - 0.5 * v[0][n2][0][i][n9][1] * v[0][n3][0][i][n5][1] * v[0][n10][0][i][n4][1]
+ * v[0][n11][1][i][n8][0] * v[0][n7][1][i][n1][0] * v[0][n6][1][i][n0][0]
+ + 0.25 * v[0][n2][0][i][n9][1] * v[0][n10][0][i][n5][1] * v[0][n3][0][i][n4][1]
+ * v[0][n7][1][i][n8][0] * v[0][n6][1][i][n1][0] * v[0][n11][1][i][n0][0]
+ - 0.5 * v[0][n2][0][i][n9][1] * v[0][n10][0][i][n5][1] * v[0][n3][0][i][n4][1]
+ * v[0][n11][1][i][n8][0] * v[0][n6][1][i][n1][0] * v[0][n7][1][i][n0][0]
+ + 0.25 * v[0][n2][0][i][n9][1] * v[0][n10][0][i][n5][1] * v[0][n3][0][i][n4][1]
+ * v[0][n11][1][i][n8][0] * v[0][n7][1][i][n1][0] * v[0][n6][1][i][n0][0]
+ + 0.25 * v[0][n3][0][i][n9][1] * v[0][n2][0][i][n5][1] * v[0][n10][0][i][n4][1]
+ * v[0][n6][1][i][n8][0] * v[0][n11][1][i][n1][0] * v[0][n7][1][i][n0][0]
+ - 0.5 * v[0][n3][0][i][n9][1] * v[0][n2][0][i][n5][1] * v[0][n10][0][i][n4][1]
+ * v[0][n11][1][i][n8][0] * v[0][n6][1][i][n1][0] * v[0][n7][1][i][n0][0]
+ + 0.25 * v[0][n3][0][i][n9][1] * v[0][n2][0][i][n5][1] * v[0][n10][0][i][n4][1]
+ * v[0][n11][1][i][n8][0] * v[0][n7][1][i][n1][0] * v[0][n6][1][i][n0][0]
+ + 0.25 * v[0][n3][0][i][n9][1] * v[0][n10][0][i][n5][1] * v[0][n2][0][i][n4][1]
+ * v[0][n6][1][i][n8][0] * v[0][n7][1][i][n1][0] * v[0][n11][1][i][n0][0]
+ + 0.25 * v[0][n3][0][i][n9][1] * v[0][n10][0][i][n5][1] * v[0][n2][0][i][n4][1]
+ * v[0][n11][1][i][n8][0] * v[0][n6][1][i][n1][0] * v[0][n7][1][i][n0][0]
+ - 0.5 * v[0][n3][0][i][n9][1] * v[0][n10][0][i][n5][1] * v[0][n2][0][i][n4][1]
+ * v[0][n11][1][i][n8][0] * v[0][n7][1][i][n1][0] * v[0][n6][1][i][n0][0]
+ + 0.25 * v[0][n10][0][i][n9][1] * v[0][n2][0][i][n5][1] * v[0][n3][0][i][n4][1]
+ * v[0][n6][1][i][n8][0] * v[0][n7][1][i][n1][0] * v[0][n11][1][i][n0][0]
+ - 0.5 * v[0][n10][0][i][n9][1] * v[0][n2][0][i][n5][1] * v[0][n3][0][i][n4][1]
+ * v[0][n6][1][i][n8][0] * v[0][n11][1][i][n1][0] * v[0][n7][1][i][n0][0]
+ - 0.5 * v[0][n10][0][i][n9][1] * v[0][n2][0][i][n5][1] * v[0][n3][0][i][n4][1]
+ * v[0][n7][1][i][n8][0] * v[0][n6][1][i][n1][0] * v[0][n11][1][i][n0][0]
+ + 0.25 * v[0][n10][0][i][n9][1] * v[0][n2][0][i][n5][1] * v[0][n3][0][i][n4][1]
+ * v[0][n7][1][i][n8][0] * v[0][n11][1][i][n1][0] * v[0][n6][1][i][n0][0]
+ + 1. * v[0][n10][0][i][n9][1] * v[0][n2][0][i][n5][1] * v[0][n3][0][i][n4][1]
+ * v[0][n11][1][i][n8][0] * v[0][n6][1][i][n1][0] * v[0][n7][1][i][n0][0]
+ - 0.5 * v[0][n10][0][i][n9][1] * v[0][n2][0][i][n5][1] * v[0][n3][0][i][n4][1]
+ * v[0][n11][1][i][n8][0] * v[0][n7][1][i][n1][0] * v[0][n6][1][i][n0][0]
+ - 0.5 * v[0][n10][0][i][n9][1] * v[0][n3][0][i][n5][1] * v[0][n2][0][i][n4][1]
+ * v[0][n6][1][i][n8][0] * v[0][n7][1][i][n1][0] * v[0][n11][1][i][n0][0]
+ + 0.25 * v[0][n10][0][i][n9][1] * v[0][n3][0][i][n5][1] * v[0][n2][0][i][n4][1]
+ * v[0][n6][1][i][n8][0] * v[0][n11][1][i][n1][0] * v[0][n7][1][i][n0][0]
+ + 0.25 * v[0][n10][0][i][n9][1] * v[0][n3][0][i][n5][1] * v[0][n2][0][i][n4][1]
+ * v[0][n7][1][i][n8][0] * v[0][n6][1][i][n1][0] * v[0][n11][1][i][n0][0]
+ - 0.5 * v[0][n10][0][i][n9][1] * v[0][n3][0][i][n5][1] * v[0][n2][0][i][n4][1]
+ * v[0][n7][1][i][n8][0] * v[0][n11][1][i][n1][0] * v[0][n6][1][i][n0][0]
+ - 0.5 * v[0][n10][0][i][n9][1] * v[0][n3][0][i][n5][1] * v[0][n2][0][i][n4][1]
+ * v[0][n11][1][i][n8][0] * v[0][n6][1][i][n1][0] * v[0][n7][1][i][n0][0]
+ + 1. * v[0][n10][0][i][n9][1] * v[0][n3][0][i][n5][1] * v[0][n2][0][i][n4][1]
+ * v[0][n11][1][i][n8][0] * v[0][n7][1][i][n1][0] * v[0][n6][1][i][n0][0]
+ + 0.5 * v[0][n6][1][i][n4][1] * v[0][n2][0][i][n9][1] * v[0][n3][0][i][n5][1]
+ * v[0][n7][1][i][n1][0] * v[0][n11][1][i][n0][0] * v[0][n10][0][i][n8][0]
+ - 0.25 * v[0][n6][1][i][n4][1] * v[0][n2][0][i][n9][1] * v[0][n3][0][i][n5][1]
+ * v[0][n11][1][i][n1][0] * v[0][n7][1][i][n0][0] * v[0][n10][0][i][n8][0]
+ - 0.25 * v[0][n6][1][i][n4][1] * v[0][n2][0][i][n9][1] * v[0][n3][0][i][n5][1]
+ * v[0][n7][1][i][n8][0] * v[0][n11][1][i][n0][0] * v[0][n10][0][i][n1][0]
+ + 0.25 * v[0][n6][1][i][n4][1] * v[0][n2][0][i][n9][1] * v[0][n3][0][i][n5][1]
+ * v[0][n7][1][i][n8][0] * v[0][n11][1][i][n1][0] * v[0][n10][0][i][n0][0]
+ + 0.25 * v[0][n6][1][i][n4][1] * v[0][n2][0][i][n9][1] * v[0][n3][0][i][n5][1]
+ * v[0][n11][1][i][n8][0] * v[0][n7][1][i][n0][0] * v[0][n10][0][i][n1][0]
+ - 0.5 * v[0][n6][1][i][n4][1] * v[0][n2][0][i][n9][1] * v[0][n3][0][i][n5][1]
+ * v[0][n11][1][i][n8][0] * v[0][n7][1][i][n1][0] * v[0][n10][0][i][n0][0]
+ - 0.25 * v[0][n6][1][i][n4][1] * v[0][n2][0][i][n9][1] * v[0][n10][0][i][n5][1]
+ * v[0][n7][1][i][n1][0] * v[0][n11][1][i][n0][0] * v[0][n3][0][i][n8][0]
+ - 0.25 * v[0][n6][1][i][n4][1] * v[0][n2][0][i][n9][1] * v[0][n10][0][i][n5][1]
+ * v[0][n7][1][i][n8][0] * v[0][n11][1][i][n0][0] * v[0][n3][0][i][n1][0]);
+ t++;
+ }
+ int u = (j - w + b) % b;
+ int q = (j >= w ? +1 : -1);
+ int r = q;
+ x[u] += r * s;
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-1.c
new file mode 100644
index 000000000..199a3c6c8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-1.c
@@ -0,0 +1,141 @@
+// { dg-do run }
+// { dg-require-effective-target wchar }
+// { dg-options "-std=gnu99 -Wno-c++-compat -trigraphs" { target c } }
+// { dg-options "-std=c++0x" { target c++ } }
+
+#ifndef __cplusplus
+#include <wchar.h>
+
+typedef __CHAR16_TYPE__ char16_t;
+typedef __CHAR32_TYPE__ char32_t;
+#endif
+
+const char s0[] = R"(a\
+\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb
+c)";
+const char s1[] = "a\\\n\\u010d\\U0000010D\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc";
+const char s2[] = R"*|*(a\
+b
+c)"
+c)*|"
+c)*|*";
+const char s3[] = "a\\\nb\nc)\"\nc)*|\"\nc";
+// The ) in ??) below is part of the raw string suffix )".
+const char s4[] = R"(??/
+??/
+??(??<??=??'??!??-??>??)";
+const char s5[] = "?\?/\n?\?/\n?\?(?\?<?\?=?\?'?\?!?\?-?\?>?\?";
+
+const char t0[] = u8R"(a\
+\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb
+c)";
+const char t1[] = u8"a\\\n\\u010d\\U0000010D\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc";
+const char t2[] = u8R"*|*(a\
+b
+c)"
+c)*|"
+c)*|*";
+const char t3[] = u8"a\\\nb\nc)\"\nc)*|\"\nc";
+const char t4[] = u8R"(??/
+??/
+??(??<??=??'??!??-??>??)";
+const char t5[] = u8"?\?/\n?\?/\n?\?(?\?<?\?=?\?'?\?!?\?-?\?>?\?";
+
+const char16_t u0[] = uR"(a\
+\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb
+c)";
+const char16_t u1[] = u"a\\\n\\u010d\\U0000010D\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc";
+const char16_t u2[] = uR"*|*(a\
+b
+c)"
+c)*|"
+c)*|*";
+const char16_t u3[] = u"a\\\nb\nc)\"\nc)*|\"\nc";
+const char16_t u4[] = uR"(??/
+??/
+??(??<??=??'??!??-??>??)";
+const char16_t u5[] = u"?\?/\n?\?/\n?\?(?\?<?\?=?\?'?\?!?\?-?\?>?\?";
+
+const char32_t U0[] = UR"(a\
+\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb
+c)";
+const char32_t U1[] = U"a\\\n\\u010d\\U0000010D\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc";
+const char32_t U2[] = UR"*|*(a\
+b
+c)"
+c)*|"
+c)*|*";
+const char32_t U3[] = U"a\\\nb\nc)\"\nc)*|\"\nc";
+const char32_t U4[] = UR"(??/
+??/
+??(??<??=??'??!??-??>??)";
+const char32_t U5[] = U"?\?/\n?\?/\n?\?(?\?<?\?=?\?'?\?!?\?-?\?>?\?";
+
+const wchar_t L0[] = LR"(a\
+\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb
+c)";
+const wchar_t L1[] = L"a\\\n\\u010d\\U0000010D\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc";
+const wchar_t L2[] = LR"*|*(a\
+b
+c)"
+c)*|"
+c)*|*";
+const wchar_t L3[] = L"a\\\nb\nc)\"\nc)*|\"\nc";
+const wchar_t L4[] = LR"(??/
+??/
+??(??<??=??'??!??-??>??)";
+const wchar_t L5[] = L"?\?/\n?\?/\n?\?(?\?<?\?=?\?'?\?!?\?-?\?>?\?";
+
+int
+main (void)
+{
+ if (sizeof (s0) != sizeof (s1)
+ || __builtin_memcmp (s0, s1, sizeof (s0)) != 0)
+ __builtin_abort ();
+ if (sizeof (s2) != sizeof (s3)
+ || __builtin_memcmp (s2, s3, sizeof (s2)) != 0)
+ __builtin_abort ();
+ if (sizeof (s4) != sizeof (s5)
+ || __builtin_memcmp (s4, s5, sizeof (s4)) != 0)
+ __builtin_abort ();
+ if (sizeof (t0) != sizeof (t1)
+ || __builtin_memcmp (t0, t1, sizeof (t0)) != 0)
+ __builtin_abort ();
+ if (sizeof (t2) != sizeof (t3)
+ || __builtin_memcmp (t2, t3, sizeof (t2)) != 0)
+ __builtin_abort ();
+ if (sizeof (t4) != sizeof (t5)
+ || __builtin_memcmp (t4, t5, sizeof (t4)) != 0)
+ __builtin_abort ();
+ if (sizeof (u0) != sizeof (u1)
+ || __builtin_memcmp (u0, u1, sizeof (u0)) != 0)
+ __builtin_abort ();
+ if (sizeof (u2) != sizeof (u3)
+ || __builtin_memcmp (u2, u3, sizeof (u2)) != 0)
+ __builtin_abort ();
+ if (sizeof (u4) != sizeof (u5)
+ || __builtin_memcmp (u4, u5, sizeof (u4)) != 0)
+ __builtin_abort ();
+ if (sizeof (U0) != sizeof (U1)
+ || __builtin_memcmp (U0, U1, sizeof (U0)) != 0)
+ __builtin_abort ();
+ if (sizeof (U2) != sizeof (U3)
+ || __builtin_memcmp (U2, U3, sizeof (U2)) != 0)
+ __builtin_abort ();
+ if (sizeof (U4) != sizeof (U5)
+ || __builtin_memcmp (U4, U5, sizeof (U4)) != 0)
+ __builtin_abort ();
+ if (sizeof (L0) != sizeof (L1)
+ || __builtin_memcmp (L0, L1, sizeof (L0)) != 0)
+ __builtin_abort ();
+ if (sizeof (L2) != sizeof (L3)
+ || __builtin_memcmp (L2, L3, sizeof (L2)) != 0)
+ __builtin_abort ();
+ if (sizeof (L4) != sizeof (L5)
+ || __builtin_memcmp (L4, L5, sizeof (L4)) != 0)
+ __builtin_abort ();
+ if (sizeof (R"*()*") != 1
+ || __builtin_memcmp (R"*()*", "", 1) != 0)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-10.c b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-10.c
new file mode 100644
index 000000000..76ed34e60
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-10.c
@@ -0,0 +1,20 @@
+// Test that we don't revert trigraphs and line splicing when a raw string
+// literal is formed by token pasting.
+// { dg-options "-std=gnu99 -trigraphs" { target c } }
+// { dg-options "-std=c++0x" { target c++ } }
+// { dg-do run }
+
+#define PASTE(X,Y) X##Y
+
+const char a[] = PASTE(R,"(??>\
+)");
+
+#define TEST(str, val) \
+ if (sizeof (str) != sizeof (val) \
+ || __builtin_memcmp (str, val, sizeof (str)) != 0) \
+ __builtin_abort ()
+
+int main()
+{
+ TEST (a, "}");
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-11.c b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-11.c
new file mode 100644
index 000000000..49ceba225
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-11.c
@@ -0,0 +1,13 @@
+// PR preprocessor/48740
+// { dg-options "-std=gnu99 -trigraphs -save-temps" { target c } }
+// { dg-options "-std=c++0x -save-temps" { target c++ } }
+// { dg-do run }
+
+int main ()
+{
+ return __builtin_memcmp (R"raw(foo%sbar%sfred%sbob?????)raw",
+ "foo%sbar%sfred%sbob?""?""?""?""?",
+ sizeof ("foo%sbar%sfred%sbob?""?""?""?""?"));
+}
+
+// { dg-final { cleanup-saved-temps } }
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-12.c b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-12.c
new file mode 100644
index 000000000..5bdf3b9d8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-12.c
Binary files differ
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-13.c b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-13.c
new file mode 100644
index 000000000..1b37405ce
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-13.c
@@ -0,0 +1,272 @@
+// PR preprocessor/57620
+// { dg-do run }
+// { dg-require-effective-target wchar }
+// { dg-options "-std=gnu99 -Wno-c++-compat -trigraphs" { target c } }
+// { dg-options "-std=c++11" { target c++ } }
+
+#ifndef __cplusplus
+#include <wchar.h>
+
+typedef __CHAR16_TYPE__ char16_t;
+typedef __CHAR32_TYPE__ char32_t;
+#endif
+
+#define R
+#define u
+#define uR
+#define U
+#define UR
+#define u8
+#define u8R
+#define L
+#define LR
+
+const char s00[] = R"??=??(??<??>??)??'??!??-\
+(a)#[{}]^|~";
+)??=??";
+const char s01[] = R"a(
+)\
+a"
+)a";
+const char s02[] = R"a(
+)a\
+"
+)a";
+const char s03[] = R"ab(
+)a\
+b"
+)ab";
+const char s04[] = R"a??/(x)a??/";
+const char s05[] = R"abcdefghijklmn??(abc)abcdefghijklmn??";
+const char s06[] = R"abcdefghijklm??/(abc)abcdefghijklm??/";
+const char s07[] = R"abc(??)\
+abc";)abc";
+const char s08[] = R"def(de)\
+def";)def";
+const char s09[] = R"a(??)\
+a"
+)a";
+const char s10[] = R"a(??)a\
+"
+)a";
+const char s11[] = R"ab(??)a\
+b"
+)ab";
+const char s12[] = R"a#(a#)a??=)a#";
+const char s13[] = R"a#(??)a??=??)a#";
+const char s14[] = R"??/(x)??/
+";)??/";
+const char s15[] = R"??/(??)??/
+";)??/";
+const char s16[] = R"??(??)??";
+const char s17[] = R"?(?)??)?";
+const char s18[] = R"??(??)??)??)??";
+
+const char16_t u00[] = uR"??=??(??<??>??)??'??!??-\
+(a)#[{}]^|~";
+)??=??";
+const char16_t u01[] = uR"a(
+)\
+a"
+)a";
+const char16_t u02[] = uR"a(
+)a\
+"
+)a";
+const char16_t u03[] = uR"ab(
+)a\
+b"
+)ab";
+const char16_t u04[] = uR"a??/(x)a??/";
+const char16_t u05[] = uR"abcdefghijklmn??(abc)abcdefghijklmn??";
+const char16_t u06[] = uR"abcdefghijklm??/(abc)abcdefghijklm??/";
+const char16_t u07[] = uR"abc(??)\
+abc";)abc";
+const char16_t u08[] = uR"def(de)\
+def";)def";
+const char16_t u09[] = uR"a(??)\
+a"
+)a";
+const char16_t u10[] = uR"a(??)a\
+"
+)a";
+const char16_t u11[] = uR"ab(??)a\
+b"
+)ab";
+const char16_t u12[] = uR"a#(a#)a??=)a#";
+const char16_t u13[] = uR"a#(??)a??=??)a#";
+const char16_t u14[] = uR"??/(x)??/
+";)??/";
+const char16_t u15[] = uR"??/(??)??/
+";)??/";
+const char16_t u16[] = uR"??(??)??";
+const char16_t u17[] = uR"?(?)??)?";
+const char16_t u18[] = uR"??(??)??)??)??";
+
+const char32_t U00[] = UR"??=??(??<??>??)??'??!??-\
+(a)#[{}]^|~";
+)??=??";
+const char32_t U01[] = UR"a(
+)\
+a"
+)a";
+const char32_t U02[] = UR"a(
+)a\
+"
+)a";
+const char32_t U03[] = UR"ab(
+)a\
+b"
+)ab";
+const char32_t U04[] = UR"a??/(x)a??/";
+const char32_t U05[] = UR"abcdefghijklmn??(abc)abcdefghijklmn??";
+const char32_t U06[] = UR"abcdefghijklm??/(abc)abcdefghijklm??/";
+const char32_t U07[] = UR"abc(??)\
+abc";)abc";
+const char32_t U08[] = UR"def(de)\
+def";)def";
+const char32_t U09[] = UR"a(??)\
+a"
+)a";
+const char32_t U10[] = UR"a(??)a\
+"
+)a";
+const char32_t U11[] = UR"ab(??)a\
+b"
+)ab";
+const char32_t U12[] = UR"a#(a#)a??=)a#";
+const char32_t U13[] = UR"a#(??)a??=??)a#";
+const char32_t U14[] = UR"??/(x)??/
+";)??/";
+const char32_t U15[] = UR"??/(??)??/
+";)??/";
+const char32_t U16[] = UR"??(??)??";
+const char32_t U17[] = UR"?(?)??)?";
+const char32_t U18[] = UR"??(??)??)??)??";
+
+const wchar_t L00[] = LR"??=??(??<??>??)??'??!??-\
+(a)#[{}]^|~";
+)??=??";
+const wchar_t L01[] = LR"a(
+)\
+a"
+)a";
+const wchar_t L02[] = LR"a(
+)a\
+"
+)a";
+const wchar_t L03[] = LR"ab(
+)a\
+b"
+)ab";
+const wchar_t L04[] = LR"a??/(x)a??/";
+const wchar_t L05[] = LR"abcdefghijklmn??(abc)abcdefghijklmn??";
+const wchar_t L06[] = LR"abcdefghijklm??/(abc)abcdefghijklm??/";
+const wchar_t L07[] = LR"abc(??)\
+abc";)abc";
+const wchar_t L08[] = LR"def(de)\
+def";)def";
+const wchar_t L09[] = LR"a(??)\
+a"
+)a";
+const wchar_t L10[] = LR"a(??)a\
+"
+)a";
+const wchar_t L11[] = LR"ab(??)a\
+b"
+)ab";
+const wchar_t L12[] = LR"a#(a#)a??=)a#";
+const wchar_t L13[] = LR"a#(??)a??=??)a#";
+const wchar_t L14[] = LR"??/(x)??/
+";)??/";
+const wchar_t L15[] = LR"??/(??)??/
+";)??/";
+const wchar_t L16[] = LR"??(??)??";
+const wchar_t L17[] = LR"?(?)??)?";
+const wchar_t L18[] = LR"??(??)??)??)??";
+
+int
+main (void)
+{
+#define TEST(str, val) \
+ if (sizeof (str) != sizeof (val) \
+ || __builtin_memcmp (str, val, sizeof (str)) != 0) \
+ __builtin_abort ()
+ TEST (s00, "??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
+ TEST (s01, "\n)\\\na\"\n");
+ TEST (s02, "\n)a\\\n\"\n");
+ TEST (s03, "\n)a\\\nb\"\n");
+ TEST (s04, "x");
+ TEST (s05, "abc");
+ TEST (s06, "abc");
+ TEST (s07, "??"")\\\nabc\";");
+ TEST (s08, "de)\\\ndef\";");
+ TEST (s09, "??"")\\\na\"\n");
+ TEST (s10, "??"")a\\\n\"\n");
+ TEST (s11, "??"")a\\\nb\"\n");
+ TEST (s12, "a#)a??""=");
+ TEST (s13, "??"")a??""=??");
+ TEST (s14, "x)??""/\n\";");
+ TEST (s15, "??"")??""/\n\";");
+ TEST (s16, "??");
+ TEST (s17, "?)??");
+ TEST (s18, "??"")??"")??");
+ TEST (u00, u"??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
+ TEST (u01, u"\n)\\\na\"\n");
+ TEST (u02, u"\n)a\\\n\"\n");
+ TEST (u03, u"\n)a\\\nb\"\n");
+ TEST (u04, u"x");
+ TEST (u05, u"abc");
+ TEST (u06, u"abc");
+ TEST (u07, u"??"")\\\nabc\";");
+ TEST (u08, u"de)\\\ndef\";");
+ TEST (u09, u"??"")\\\na\"\n");
+ TEST (u10, u"??"")a\\\n\"\n");
+ TEST (u11, u"??"")a\\\nb\"\n");
+ TEST (u12, u"a#)a??""=");
+ TEST (u13, u"??"")a??""=??");
+ TEST (u14, u"x)??""/\n\";");
+ TEST (u15, u"??"")??""/\n\";");
+ TEST (u16, u"??");
+ TEST (u17, u"?)??");
+ TEST (u18, u"??"")??"")??");
+ TEST (U00, U"??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
+ TEST (U01, U"\n)\\\na\"\n");
+ TEST (U02, U"\n)a\\\n\"\n");
+ TEST (U03, U"\n)a\\\nb\"\n");
+ TEST (U04, U"x");
+ TEST (U05, U"abc");
+ TEST (U06, U"abc");
+ TEST (U07, U"??"")\\\nabc\";");
+ TEST (U08, U"de)\\\ndef\";");
+ TEST (U09, U"??"")\\\na\"\n");
+ TEST (U10, U"??"")a\\\n\"\n");
+ TEST (U11, U"??"")a\\\nb\"\n");
+ TEST (U12, U"a#)a??""=");
+ TEST (U13, U"??"")a??""=??");
+ TEST (U14, U"x)??""/\n\";");
+ TEST (U15, U"??"")??""/\n\";");
+ TEST (U16, U"??");
+ TEST (U17, U"?)??");
+ TEST (U18, U"??"")??"")??");
+ TEST (L00, L"??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
+ TEST (L01, L"\n)\\\na\"\n");
+ TEST (L02, L"\n)a\\\n\"\n");
+ TEST (L03, L"\n)a\\\nb\"\n");
+ TEST (L04, L"x");
+ TEST (L05, L"abc");
+ TEST (L06, L"abc");
+ TEST (L07, L"??"")\\\nabc\";");
+ TEST (L08, L"de)\\\ndef\";");
+ TEST (L09, L"??"")\\\na\"\n");
+ TEST (L10, L"??"")a\\\n\"\n");
+ TEST (L11, L"??"")a\\\nb\"\n");
+ TEST (L12, L"a#)a??""=");
+ TEST (L13, L"??"")a??""=??");
+ TEST (L14, L"x)??""/\n\";");
+ TEST (L15, L"??"")??""/\n\";");
+ TEST (L16, L"??");
+ TEST (L17, L"?)??");
+ TEST (L18, L"??"")??"")??");
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-14.c b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-14.c
new file mode 100644
index 000000000..2eeb7258f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-14.c
@@ -0,0 +1,39 @@
+// PR preprocessor/57620
+// { dg-do compile }
+// { dg-options "-std=gnu99 -trigraphs" { target c } }
+// { dg-options "-std=c++11" { target c++ } }
+
+const void *s0 = R"abc\
+def()abcdef";
+ // { dg-error "invalid character" "invalid" { target *-*-* } 6 }
+ // { dg-error "stray" "stray" { target *-*-* } 6 }
+const void *s1 = R"??/
+()??/";
+ // { dg-error "invalid new-line" "invalid" { target *-*-* } 10 }
+ // { dg-error "stray" "stray" { target *-*-* } 10 }
+ // { dg-warning "missing terminating" "missing" { target *-*-* } 10 }
+ // { dg-error "missing terminating" "missing" { target *-*-* } 10 }
+const void *s2 = R"abcdefghijklmn??/(a)abcdefghijklmn???";
+ // { dg-error "raw string delimiter longer" "longer" { target *-*-* } 16 }
+ // { dg-error "stray" "stray" { target *-*-* } 16 }
+ // { dg-error "expected" "expected" { target *-*-* } 16 }
+const void *s3 = R"abcdefghijklmno??/(a)abcdefghijklmno???";
+ // { dg-error "raw string delimiter longer" "longer" { target *-*-* } 20 }
+ // { dg-error "stray" "stray" { target *-*-* } 20 }
+const void *s4 = R"abcdefghijklmnop??=(a)abcdefghijklmnop??=";
+ // { dg-error "raw string delimiter longer" "longer" { target *-*-* } 23 }
+ // { dg-error "stray" "stray" { target *-*-* } 23 }
+const void *s5 = R"abc\
+()abcdef";
+ // { dg-error "invalid character" "invalid" { target *-*-* } 26 }
+ // { dg-error "stray" "stray" { target *-*-* } 26 }
+const void *s6 = R"\
+()";
+ // { dg-error "invalid character" "invalid" { target *-*-* } 30 }
+ // { dg-error "stray" "stray" { target *-*-* } 30 }
+const void *s7 = R"\
+a()a";
+ // { dg-error "invalid character" "invalid" { target *-*-* } 34 }
+ // { dg-error "stray" "stray" { target *-*-* } 34 }
+
+int main () {}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-15.c b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-15.c
new file mode 100644
index 000000000..9dfdaabd8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-15.c
@@ -0,0 +1,272 @@
+// PR preprocessor/57620
+// { dg-do run }
+// { dg-require-effective-target wchar }
+// { dg-options "-std=gnu99 -Wno-c++-compat -Wtrigraphs" { target c } }
+// { dg-options "-std=gnu++11 -Wtrigraphs" { target c++ } }
+
+#ifndef __cplusplus
+#include <wchar.h>
+
+typedef __CHAR16_TYPE__ char16_t;
+typedef __CHAR32_TYPE__ char32_t;
+#endif
+
+#define R
+#define u
+#define uR
+#define U
+#define UR
+#define u8
+#define u8R
+#define L
+#define LR
+
+const char s00[] = R"??=??(??<??>??)??'??!??-\
+(a)#[{}]^|~";
+)??=??";
+const char s01[] = R"a(
+)\
+a"
+)a";
+const char s02[] = R"a(
+)a\
+"
+)a";
+const char s03[] = R"ab(
+)a\
+b"
+)ab";
+const char s04[] = R"a??/(x)a??/";
+const char s05[] = R"abcdefghijklmn??(abc)abcdefghijklmn??";
+const char s06[] = R"abcdefghijklm??/(abc)abcdefghijklm??/";
+const char s07[] = R"abc(??)\
+abc";)abc";
+const char s08[] = R"def(de)\
+def";)def";
+const char s09[] = R"a(??)\
+a"
+)a";
+const char s10[] = R"a(??)a\
+"
+)a";
+const char s11[] = R"ab(??)a\
+b"
+)ab";
+const char s12[] = R"a#(a#)a??=)a#";
+const char s13[] = R"a#(??)a??=??)a#";
+const char s14[] = R"??/(x)??/
+";)??/";
+const char s15[] = R"??/(??)??/
+";)??/";
+const char s16[] = R"??(??)??";
+const char s17[] = R"?(?)??)?";
+const char s18[] = R"??(??)??)??)??";
+
+const char16_t u00[] = uR"??=??(??<??>??)??'??!??-\
+(a)#[{}]^|~";
+)??=??";
+const char16_t u01[] = uR"a(
+)\
+a"
+)a";
+const char16_t u02[] = uR"a(
+)a\
+"
+)a";
+const char16_t u03[] = uR"ab(
+)a\
+b"
+)ab";
+const char16_t u04[] = uR"a??/(x)a??/";
+const char16_t u05[] = uR"abcdefghijklmn??(abc)abcdefghijklmn??";
+const char16_t u06[] = uR"abcdefghijklm??/(abc)abcdefghijklm??/";
+const char16_t u07[] = uR"abc(??)\
+abc";)abc";
+const char16_t u08[] = uR"def(de)\
+def";)def";
+const char16_t u09[] = uR"a(??)\
+a"
+)a";
+const char16_t u10[] = uR"a(??)a\
+"
+)a";
+const char16_t u11[] = uR"ab(??)a\
+b"
+)ab";
+const char16_t u12[] = uR"a#(a#)a??=)a#";
+const char16_t u13[] = uR"a#(??)a??=??)a#";
+const char16_t u14[] = uR"??/(x)??/
+";)??/";
+const char16_t u15[] = uR"??/(??)??/
+";)??/";
+const char16_t u16[] = uR"??(??)??";
+const char16_t u17[] = uR"?(?)??)?";
+const char16_t u18[] = uR"??(??)??)??)??";
+
+const char32_t U00[] = UR"??=??(??<??>??)??'??!??-\
+(a)#[{}]^|~";
+)??=??";
+const char32_t U01[] = UR"a(
+)\
+a"
+)a";
+const char32_t U02[] = UR"a(
+)a\
+"
+)a";
+const char32_t U03[] = UR"ab(
+)a\
+b"
+)ab";
+const char32_t U04[] = UR"a??/(x)a??/";
+const char32_t U05[] = UR"abcdefghijklmn??(abc)abcdefghijklmn??";
+const char32_t U06[] = UR"abcdefghijklm??/(abc)abcdefghijklm??/";
+const char32_t U07[] = UR"abc(??)\
+abc";)abc";
+const char32_t U08[] = UR"def(de)\
+def";)def";
+const char32_t U09[] = UR"a(??)\
+a"
+)a";
+const char32_t U10[] = UR"a(??)a\
+"
+)a";
+const char32_t U11[] = UR"ab(??)a\
+b"
+)ab";
+const char32_t U12[] = UR"a#(a#)a??=)a#";
+const char32_t U13[] = UR"a#(??)a??=??)a#";
+const char32_t U14[] = UR"??/(x)??/
+";)??/";
+const char32_t U15[] = UR"??/(??)??/
+";)??/";
+const char32_t U16[] = UR"??(??)??";
+const char32_t U17[] = UR"?(?)??)?";
+const char32_t U18[] = UR"??(??)??)??)??";
+
+const wchar_t L00[] = LR"??=??(??<??>??)??'??!??-\
+(a)#[{}]^|~";
+)??=??";
+const wchar_t L01[] = LR"a(
+)\
+a"
+)a";
+const wchar_t L02[] = LR"a(
+)a\
+"
+)a";
+const wchar_t L03[] = LR"ab(
+)a\
+b"
+)ab";
+const wchar_t L04[] = LR"a??/(x)a??/";
+const wchar_t L05[] = LR"abcdefghijklmn??(abc)abcdefghijklmn??";
+const wchar_t L06[] = LR"abcdefghijklm??/(abc)abcdefghijklm??/";
+const wchar_t L07[] = LR"abc(??)\
+abc";)abc";
+const wchar_t L08[] = LR"def(de)\
+def";)def";
+const wchar_t L09[] = LR"a(??)\
+a"
+)a";
+const wchar_t L10[] = LR"a(??)a\
+"
+)a";
+const wchar_t L11[] = LR"ab(??)a\
+b"
+)ab";
+const wchar_t L12[] = LR"a#(a#)a??=)a#";
+const wchar_t L13[] = LR"a#(??)a??=??)a#";
+const wchar_t L14[] = LR"??/(x)??/
+";)??/";
+const wchar_t L15[] = LR"??/(??)??/
+";)??/";
+const wchar_t L16[] = LR"??(??)??";
+const wchar_t L17[] = LR"?(?)??)?";
+const wchar_t L18[] = LR"??(??)??)??)??";
+
+int
+main (void)
+{
+#define TEST(str, val) \
+ if (sizeof (str) != sizeof (val) \
+ || __builtin_memcmp (str, val, sizeof (str)) != 0) \
+ __builtin_abort ()
+ TEST (s00, "??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
+ TEST (s01, "\n)\\\na\"\n");
+ TEST (s02, "\n)a\\\n\"\n");
+ TEST (s03, "\n)a\\\nb\"\n");
+ TEST (s04, "x");
+ TEST (s05, "abc");
+ TEST (s06, "abc");
+ TEST (s07, "??"")\\\nabc\";");
+ TEST (s08, "de)\\\ndef\";");
+ TEST (s09, "??"")\\\na\"\n");
+ TEST (s10, "??"")a\\\n\"\n");
+ TEST (s11, "??"")a\\\nb\"\n");
+ TEST (s12, "a#)a??""=");
+ TEST (s13, "??"")a??""=??");
+ TEST (s14, "x)??""/\n\";");
+ TEST (s15, "??"")??""/\n\";");
+ TEST (s16, "??");
+ TEST (s17, "?)??");
+ TEST (s18, "??"")??"")??");
+ TEST (u00, u"??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
+ TEST (u01, u"\n)\\\na\"\n");
+ TEST (u02, u"\n)a\\\n\"\n");
+ TEST (u03, u"\n)a\\\nb\"\n");
+ TEST (u04, u"x");
+ TEST (u05, u"abc");
+ TEST (u06, u"abc");
+ TEST (u07, u"??"")\\\nabc\";");
+ TEST (u08, u"de)\\\ndef\";");
+ TEST (u09, u"??"")\\\na\"\n");
+ TEST (u10, u"??"")a\\\n\"\n");
+ TEST (u11, u"??"")a\\\nb\"\n");
+ TEST (u12, u"a#)a??""=");
+ TEST (u13, u"??"")a??""=??");
+ TEST (u14, u"x)??""/\n\";");
+ TEST (u15, u"??"")??""/\n\";");
+ TEST (u16, u"??");
+ TEST (u17, u"?)??");
+ TEST (u18, u"??"")??"")??");
+ TEST (U00, U"??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
+ TEST (U01, U"\n)\\\na\"\n");
+ TEST (U02, U"\n)a\\\n\"\n");
+ TEST (U03, U"\n)a\\\nb\"\n");
+ TEST (U04, U"x");
+ TEST (U05, U"abc");
+ TEST (U06, U"abc");
+ TEST (U07, U"??"")\\\nabc\";");
+ TEST (U08, U"de)\\\ndef\";");
+ TEST (U09, U"??"")\\\na\"\n");
+ TEST (U10, U"??"")a\\\n\"\n");
+ TEST (U11, U"??"")a\\\nb\"\n");
+ TEST (U12, U"a#)a??""=");
+ TEST (U13, U"??"")a??""=??");
+ TEST (U14, U"x)??""/\n\";");
+ TEST (U15, U"??"")??""/\n\";");
+ TEST (U16, U"??");
+ TEST (U17, U"?)??");
+ TEST (U18, U"??"")??"")??");
+ TEST (L00, L"??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
+ TEST (L01, L"\n)\\\na\"\n");
+ TEST (L02, L"\n)a\\\n\"\n");
+ TEST (L03, L"\n)a\\\nb\"\n");
+ TEST (L04, L"x");
+ TEST (L05, L"abc");
+ TEST (L06, L"abc");
+ TEST (L07, L"??"")\\\nabc\";");
+ TEST (L08, L"de)\\\ndef\";");
+ TEST (L09, L"??"")\\\na\"\n");
+ TEST (L10, L"??"")a\\\n\"\n");
+ TEST (L11, L"??"")a\\\nb\"\n");
+ TEST (L12, L"a#)a??""=");
+ TEST (L13, L"??"")a??""=??");
+ TEST (L14, L"x)??""/\n\";");
+ TEST (L15, L"??"")??""/\n\";");
+ TEST (L16, L"??");
+ TEST (L17, L"?)??");
+ TEST (L18, L"??"")??"")??");
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-16.c b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-16.c
new file mode 100644
index 000000000..c277fdaff
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-16.c
@@ -0,0 +1,33 @@
+// PR preprocessor/57620
+// { dg-do compile }
+// { dg-options "-std=gnu99 -Wtrigraphs" { target c } }
+// { dg-options "-std=gnu++11 -Wtrigraphs" { target c++ } }
+
+const void *s0 = R"abc\
+def()abcdef";
+ // { dg-error "invalid character" "invalid" { target *-*-* } 6 }
+ // { dg-error "stray" "stray" { target *-*-* } 6 }
+const void *s1 = R"abcdefghijklmn??/(a)abcdefghijklmn???";
+ // { dg-error "raw string delimiter longer" "longer" { target *-*-* } 10 }
+ // { dg-error "stray" "stray" { target *-*-* } 10 }
+
+const void *s2 = R"abcdefghijklmno??/(a)abcdefghijklmno???";
+ // { dg-error "raw string delimiter longer" "longer" { target *-*-* } 14 }
+ // { dg-error "stray" "stray" { target *-*-* } 14 }
+const void *s3 = R"abcdefghijklmnop??=(a)abcdefghijklmnop??=?"; // { dg-warning "trigraph ..= ignored" }
+ // { dg-error "raw string delimiter longer" "longer" { target *-*-* } 17 }
+ // { dg-error "stray" "stray" { target *-*-* } 17 }
+const void *s4 = R"abc\
+()abcdef";
+ // { dg-error "invalid character" "invalid" { target *-*-* } 20 }
+ // { dg-error "stray" "stray" { target *-*-* } 20 }
+const void *s5 = R"\
+()";
+ // { dg-error "invalid character" "invalid" { target *-*-* } 24 }
+ // { dg-error "stray" "stray" { target *-*-* } 24 }
+const void *s6 = R"\
+a()a";
+ // { dg-error "invalid character" "invalid" { target *-*-* } 28 }
+ // { dg-error "stray" "stray" { target *-*-* } 28 }
+
+int main () {}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-17.c b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-17.c
new file mode 100644
index 000000000..30df02008
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-17.c
@@ -0,0 +1,30 @@
+/* PR preprocessor/57824 */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" { target c } } */
+/* { dg-options "-std=c++11" { target c++ } } */
+
+#define S(s) s
+#define T(s) s "\n"
+
+const char x[] = R"(
+abc
+)";
+const char y[] = S(R"(
+abc
+)");
+const char z[] = "\nabc\n";
+const char w[] = T(R"(
+abc)");
+
+int
+main ()
+{
+ if (sizeof x != sizeof y
+ || sizeof x != sizeof z
+ || sizeof x != sizeof w
+ || __builtin_memcmp (x, y, sizeof x)
+ || __builtin_memcmp (x, z, sizeof x)
+ || __builtin_memcmp (x, w, sizeof x))
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-18.c b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-18.c
new file mode 100644
index 000000000..8d4381d13
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-18.c
@@ -0,0 +1,21 @@
+/* PR preprocessor/57824 */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -fdump-tree-optimized-lineno" { target c } } */
+/* { dg-options "-std=c++11 -fdump-tree-optimized-lineno" { target c++ } } */
+
+const char x[] = R"(
+abc
+def
+ghi
+)";
+
+int
+main ()
+{
+ extern void foo (); foo ();
+ return 0;
+}
+
+/* Verify call to foo is on line 15. */
+/* { dg-final { scan-tree-dump ": 15\[]:]\[^\n\r]*foo" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-19.c b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-19.c
new file mode 100644
index 000000000..08121a89f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-19.c
@@ -0,0 +1,22 @@
+/* PR preprocessor/57824 */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -fdump-tree-optimized-lineno -save-temps" { target c } } */
+/* { dg-options "-std=c++11 -fdump-tree-optimized-lineno -save-temps" { target c++ } } */
+
+const char x[] = R"(
+abc
+def
+ghi
+)";
+
+int
+main ()
+{
+ extern void foo (); foo ();
+ return 0;
+}
+
+/* Verify call to foo is on line 15. */
+/* { dg-final { scan-tree-dump ": 15\[]:]\[^\n\r]*foo" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
+/* { dg-final { cleanup-saved-temps } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-2.c
new file mode 100644
index 000000000..6f2e37d47
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-2.c
@@ -0,0 +1,113 @@
+// { dg-do run }
+// { dg-require-effective-target wchar }
+// { dg-options "-std=gnu99 -Wno-c++-compat -trigraphs" { target c } }
+// { dg-options "-std=c++0x" { target c++ } }
+
+#ifndef __cplusplus
+#include <wchar.h>
+
+typedef __CHAR16_TYPE__ char16_t;
+typedef __CHAR32_TYPE__ char32_t;
+#endif
+
+#define R
+#define u
+#define uR
+#define U
+#define UR
+#define u8
+#define u8R
+#define L
+#define LR
+
+const char s00[] = R"(a)" "(b)";
+const char s01[] = "(a)" R"*(b)*";
+const char s02[] = R"(a)" R"(b)";
+const char s03[] = R"-(a)-" u8"(b)";
+const char s04[] = "(a)" u8R"MNOPQRSTUVWXYZ(b)MNOPQRSTUVWXYZ";
+const char s05[] = R"(a)" u8R"wxyzABCDEFGHIJKL(b)wxyzABCDEFGHIJKL";
+const char s06[] = u8R";[(a);[" "(b)";
+const char s07[] = u8"(a)" R"(b)";
+const char s08[] = u8R"(a)" R"_{}#[]<>%:;.?*+-(b)_{}#[]<>%:;.?*+-";
+const char s09[] = u8R"/^&|~!=,"'(a)/^&|~!=,"'" u8"(b)";
+const char s10[] = u8"(a)" u8R"0123456789abcdef(b)0123456789abcdef";
+const char s11[] = u8R"ghijklmnopqrstuv(a)ghijklmnopqrstuv" u8R"w(b)w";
+
+const char16_t u03[] = R"-(a)-" u"(b)";
+const char16_t u04[] = "(a)" uR"MNOPQRSTUVWXYZ(b)MNOPQRSTUVWXYZ";
+const char16_t u05[] = R"(a)" uR"wxyzABCDEFGHIJKL(b)wxyzABCDEFGHIJKL";
+const char16_t u06[] = uR";[(a);[" "(b)";
+const char16_t u07[] = u"(a)" R"(b)";
+const char16_t u08[] = uR"(a)" R"_{}#[]<>%:;.?*+-(b)_{}#[]<>%:;.?*+-";
+const char16_t u09[] = uR"/^&|~!=,"'(a)/^&|~!=,"'" u"(b)";
+const char16_t u10[] = u"(a)" uR"0123456789abcdef(b)0123456789abcdef";
+const char16_t u11[] = uR"ghijklmnopqrstuv(a)ghijklmnopqrstuv" uR"w(b)w";
+
+const char32_t U03[] = R"-(a)-" U"(b)";
+const char32_t U04[] = "(a)" UR"MNOPQRSTUVWXYZ(b)MNOPQRSTUVWXYZ";
+const char32_t U05[] = R"(a)" UR"wxyzABCDEFGHIJKL(b)wxyzABCDEFGHIJKL";
+const char32_t U06[] = UR";[(a);[" "(b)";
+const char32_t U07[] = U"(a)" R"(b)";
+const char32_t U08[] = UR"(a)" R"_{}#[]<>%:;.?*+-(b)_{}#[]<>%:;.?*+-";
+const char32_t U09[] = UR"/^&|~!=,"'(a)/^&|~!=,"'" U"(b)";
+const char32_t U10[] = U"(a)" UR"0123456789abcdef(b)0123456789abcdef";
+const char32_t U11[] = UR"ghijklmnopqrstuv(a)ghijklmnopqrstuv" UR"w(b)w";
+
+const wchar_t L03[] = R"-(a)-" L"(b)";
+const wchar_t L04[] = "(a)" LR"MNOPQRSTUVWXYZ(b)MNOPQRSTUVWXYZ";
+const wchar_t L05[] = R"(a)" LR"wxyzABCDEFGHIJKL(b)wxyzABCDEFGHIJKL";
+const wchar_t L06[] = LR";[(a);[" "(b)";
+const wchar_t L07[] = L"(a)" R"(b)";
+const wchar_t L08[] = LR"(a)" R"_{}#[]<>%:;.?*+-(b)_{}#[]<>%:;.?*+-";
+const wchar_t L09[] = LR"/^&|~!=,"'(a)/^&|~!=,"'" L"(b)";
+const wchar_t L10[] = L"(a)" LR"0123456789abcdef(b)0123456789abcdef";
+const wchar_t L11[] = LR"ghijklmnopqrstuv(a)ghijklmnopqrstuv" LR"w(b)w";
+
+int
+main (void)
+{
+#define TEST(str, val) \
+ if (sizeof (str) != sizeof (val) \
+ || __builtin_memcmp (str, val, sizeof (str)) != 0) \
+ __builtin_abort ()
+ TEST (s00, "a(b)");
+ TEST (s01, "(a)b");
+ TEST (s02, "ab");
+ TEST (s03, "a(b)");
+ TEST (s04, "(a)b");
+ TEST (s05, "ab");
+ TEST (s06, "a(b)");
+ TEST (s07, "(a)b");
+ TEST (s08, "ab");
+ TEST (s09, "a(b)");
+ TEST (s10, "(a)b");
+ TEST (s11, "ab");
+ TEST (u03, u"a(b)");
+ TEST (u04, u"(a)b");
+ TEST (u05, u"ab");
+ TEST (u06, u"a(b)");
+ TEST (u07, u"(a)b");
+ TEST (u08, u"ab");
+ TEST (u09, u"a(b)");
+ TEST (u10, u"(a)b");
+ TEST (u11, u"ab");
+ TEST (U03, U"a(b)");
+ TEST (U04, U"(a)b");
+ TEST (U05, U"ab");
+ TEST (U06, U"a(b)");
+ TEST (U07, U"(a)b");
+ TEST (U08, U"ab");
+ TEST (U09, U"a(b)");
+ TEST (U10, U"(a)b");
+ TEST (U11, U"ab");
+ TEST (L03, L"a(b)");
+ TEST (L04, L"(a)b");
+ TEST (L05, L"ab");
+ TEST (L06, L"a(b)");
+ TEST (L07, L"(a)b");
+ TEST (L08, L"ab");
+ TEST (L09, L"a(b)");
+ TEST (L10, L"(a)b");
+ TEST (L11, L"ab");
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-3.c
new file mode 100644
index 000000000..1dde113d2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-3.c
@@ -0,0 +1,59 @@
+// If not c++0x/gnu99, the {,u,u8,U,L}R prefix should be parsed as separate
+// token.
+// { dg-do compile }
+// { dg-options "" { target c } }
+// { dg-options "-std=c++98" { target c++ } }
+
+const void *s0 = R"(a)"; // { dg-error "was not declared|undeclared" "undeclared" }
+ // { dg-error "expected ',' or ';'" "expected" { target c } 7 }
+const void *s1 = uR"(a)"; // { dg-error "was not declared|undeclared" "undeclared" }
+ // { dg-error "expected ',' or ';'" "expected" { target c } 9 }
+const void *s2 = UR"(a)"; // { dg-error "was not declared|undeclared" "undeclared" }
+ // { dg-error "expected ',' or ';'" "expected" { target c } 11 }
+const void *s3 = u8R"(a)"; // { dg-error "was not declared|undeclared" "undeclared" }
+ // { dg-error "expected ',' or ';'" "expected" { target c } 13 }
+const void *s4 = LR"(a)"; // { dg-error "was not declared|undeclared" "undeclared" }
+ // { dg-error "expected ',' or ';'" "expected" { target c } 15 }
+
+const int i0 = R'a'; // { dg-error "was not declared" "undeclared" { target c++ } }
+ // { dg-error "expected ',' or ';'" "expected" { target c } 18 }
+const int i1 = uR'a'; // { dg-error "was not declared" "undeclared" { target c++ } }
+ // { dg-error "expected ',' or ';'" "expected" { target c } 20 }
+const int i2 = UR'a'; // { dg-error "was not declared" "undeclared" { target c++ } }
+ // { dg-error "expected ',' or ';'" "expected" { target c } 22 }
+const int i3 = u8R'a'; // { dg-error "was not declared" "undeclared" { target c++ } }
+ // { dg-error "expected ',' or ';'" "expected" { target c } 24 }
+const int i4 = LR'a'; // { dg-error "was not declared" "undeclared" { target c++ } }
+ // { dg-error "expected ',' or ';'" "expected" { target c } 26 }
+
+#define R "a"
+#define uR "b"
+#define UR "c"
+#define u8R "d"
+#define LR "e"
+
+const void *s5 = R"(a)";
+const void *s6 = uR"(a)";
+const void *s7 = UR"(a)";
+const void *s8 = u8R"(a)";
+const void *s9 = LR"(a)";
+
+#undef R
+#undef uR
+#undef UR
+#undef u8R
+#undef LR
+
+#define R 1 +
+#define uR 2 +
+#define UR 3 +
+#define u8R 4 +
+#define LR 5 +
+
+const int i5 = R'a';
+const int i6 = uR'a';
+const int i7 = UR'a';
+const int i8 = u8R'a';
+const int i9 = LR'a';
+
+int main () {}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-4.c
new file mode 100644
index 000000000..40b42aa64
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-4.c
@@ -0,0 +1,29 @@
+// R is not applicable for character literals.
+// { dg-do compile }
+// { dg-options "-std=gnu99" { target c } }
+// { dg-options "-std=c++0x" { target c++ } }
+
+const int i0 = R'a'; // { dg-error "was not declared|undeclared" "undeclared" }
+ // { dg-error "expected ',' or ';'" "expected" { target c } 6 }
+const int i1 = uR'a'; // { dg-error "was not declared|undeclared" "undeclared" }
+ // { dg-error "expected ',' or ';'" "expected" { target c } 8 }
+const int i2 = UR'a'; // { dg-error "was not declared|undeclared" "undeclared" }
+ // { dg-error "expected ',' or ';'" "expected" { target c } 10 }
+const int i3 = u8R'a'; // { dg-error "was not declared|undeclared" "undeclared" }
+ // { dg-error "expected ',' or ';'" "expected" { target c } 12 }
+const int i4 = LR'a'; // { dg-error "was not declared|undeclared" "undeclared" }
+ // { dg-error "expected ',' or ';'" "expected" { target c } 14 }
+
+#define R 1 +
+#define uR 2 +
+#define UR 3 +
+#define u8R 4 +
+#define LR 5 +
+
+const int i5 = R'a';
+const int i6 = uR'a';
+const int i7 = UR'a';
+const int i8 = u8R'a';
+const int i9 = LR'a';
+
+int main () {}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-5.c b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-5.c
new file mode 100644
index 000000000..a26b87dc6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-5.c
@@ -0,0 +1,27 @@
+// { dg-do compile }
+// { dg-options "-std=gnu99" { target c } }
+// { dg-options "-std=c++0x" { target c++ } }
+
+const void *s0 = R"0123456789abcdefg()0123456789abcdefg";
+ // { dg-error "raw string delimiter longer" "longer" { target *-*-* } 5 }
+ // { dg-error "stray" "stray" { target *-*-* } 5 }
+const void *s1 = R" () ";
+ // { dg-error "invalid character" "invalid" { target *-*-* } 8 }
+ // { dg-error "stray" "stray" { target *-*-* } 8 }
+const void *s2 = R" () ";
+ // { dg-error "invalid character" "invalid" { target *-*-* } 11 }
+ // { dg-error "stray" "stray" { target *-*-* } 11 }
+const void *s3 = R")())";
+ // { dg-error "invalid character" "invalid" { target *-*-* } 14 }
+ // { dg-error "stray" "stray" { target *-*-* } 14 }
+const void *s4 = R"@()@";
+ // { dg-error "invalid character" "invalid" { target *-*-* } 17 }
+ // { dg-error "stray" "stray" { target *-*-* } 17 }
+const void *s5 = R"$()$";
+ // { dg-error "invalid character" "invalid" { target *-*-* } 20 }
+ // { dg-error "stray" "stray" { target *-*-* } 20 }
+const void *s6 = R"\u0040()\u0040";
+ // { dg-error "invalid character" "invalid" { target *-*-* } 23 }
+ // { dg-error "stray" "stray" { target *-*-* } 23 }
+
+int main () {}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-6.c b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-6.c
new file mode 100644
index 000000000..87ee4c1c4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-6.c
@@ -0,0 +1,6 @@
+// { dg-do compile }
+// { dg-options "-std=gnu99" { target c } }
+// { dg-options "-std=c++0x" { target c++ } }
+
+const void *s0 = R"ouch()ouCh"; // { dg-error "at end of input" "end" }
+ // { dg-error "unterminated raw string" "unterminated" { target *-*-* } 5 }
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-7.c b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-7.c
new file mode 100644
index 000000000..0c556639c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-7.c
@@ -0,0 +1,24 @@
+// The trailing whitespace after \ and before newline extension
+// breaks full compliance for raw strings.
+// { dg-do run { xfail *-*-* } }
+// { dg-options "-std=gnu99" { target c } }
+// { dg-options "-std=c++0x" { target c++ } }
+
+// Note, there is a single space after \ on the following line.
+const char *s0 = R"(\
+)";
+// { dg-bogus "backslash and newline separated by space" "" { xfail *-*-* } 8 }
+
+// Note, there is a single tab after \ on the following line.
+const char *s1 = R"(\
+)";
+// { dg-bogus "backslash and newline separated by space" "" { xfail *-*-* } 13 }
+
+int
+main (void)
+{
+ if (__builtin_strcmp (s0, "\\ \n") != 0
+ || __builtin_strcmp (s1, "\\\t\n") != 0)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-8.c b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-8.c
new file mode 100644
index 000000000..685b2ef68
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-8.c
@@ -0,0 +1,10 @@
+// Test that we track line numbers properly across newlines
+// both escaped and not in raw strings.
+// { dg-options "-std=gnu99" { target c } }
+// { dg-options "-std=c++0x" { target c++ } }
+
+const char a[] = R"(\
+
+)";
+
+T t; // { dg-error "" }
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-9.c b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-9.c
new file mode 100644
index 000000000..6ba6b1a33
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/raw-string-9.c
@@ -0,0 +1,19 @@
+// Make sure that we properly handle trigraphs in raw strings when
+// trigraphs are disabled, too.
+// { dg-options "-std=gnu99" { target c } }
+// { dg-options "-std=gnu++0x" { target c++ } }
+// { dg-do run }
+
+const char b[] = "??>"; // { dg-message "-trigraphs" }
+const char a[] = R"(??>??)??/
+??)";
+
+#define TEST(str, val) \
+ if (sizeof (str) != sizeof (val) \
+ || __builtin_memcmp (str, val, sizeof (str)) != 0) \
+ __builtin_abort ()
+
+int main()
+{
+ TEST (a, "?\?>?\?)?\?/\n?\?");
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/restrict-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/restrict-1.c
new file mode 100644
index 000000000..08fc10f56
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/restrict-1.c
@@ -0,0 +1,20 @@
+/* { dg-do link } */
+/* { dg-options "-O -fno-strict-aliasing -fdump-tree-optimized" } */
+
+extern void link_error (void);
+
+void bar0 (int * __restrict__ arr1, int * __restrict__ arr2)
+{
+ arr1[0] = 1;
+ arr2[0] = 1;
+ if (arr1[0] != 1)
+ link_error ();
+}
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-not "link_error" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/restrict-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/restrict-2.c
new file mode 100644
index 000000000..3f71b77b9
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/restrict-2.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fno-strict-aliasing -fdump-tree-lim1-details" } */
+
+void foo (float * __restrict__ a, float * __restrict__ b, int n, int j)
+{
+ int i;
+ for(i = 0; i < n; ++i)
+ a[i] = (b[j+50] + b[j-50]) * 0.5f;
+}
+
+/* We should move the RHS of the store out of the loop. */
+
+/* { dg-final { scan-tree-dump-times "Moving statement" 11 "lim1" } } */
+/* { dg-final { cleanup-tree-dump "lim1" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/restrict-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/restrict-4.c
new file mode 100644
index 000000000..3a36def25
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/restrict-4.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-lim1-details" } */
+
+struct Foo
+{
+ int n;
+ int * __restrict__ p;
+};
+void bar(struct Foo f, int * __restrict__ q)
+{
+ int i;
+ for (i = 0; i < f.n; ++i)
+ {
+ *q += f.p[i];
+ }
+}
+
+/* { dg-final { scan-tree-dump "Executing store motion" "lim1" } } */
+/* { dg-final { cleanup-tree-dump "lim1" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/rotate-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/rotate-1.c
new file mode 100644
index 000000000..afdaa289a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/rotate-1.c
@@ -0,0 +1,581 @@
+/* Check rotate pattern detection. */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "r\[<>]\[<>]" 96 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
+
+unsigned int
+f1 (unsigned int x, unsigned int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y));
+}
+
+unsigned int
+f2 (unsigned int x, unsigned long int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y));
+}
+
+unsigned int
+f3 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) | (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
+}
+
+unsigned int
+f4 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) | (x >> 1);
+}
+
+unsigned short int
+f5 (unsigned short int x, unsigned int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
+}
+
+unsigned short int
+f6 (unsigned short int x, unsigned long int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
+}
+
+unsigned char
+f7 (unsigned char x, unsigned int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ - y));
+}
+
+unsigned char
+f8 (unsigned char x, unsigned long int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ - y));
+}
+
+unsigned int
+f9 (unsigned int x, unsigned int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y));
+}
+
+unsigned int
+f10 (unsigned int x, unsigned long int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y));
+}
+
+unsigned int
+f11 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) | (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1));
+}
+
+unsigned int
+f12 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)) | (x >> 1);
+}
+
+unsigned short int
+f13 (unsigned short int x, unsigned int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y));
+}
+
+unsigned short int
+f14 (unsigned short int x, unsigned long int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y));
+}
+
+unsigned char
+f15 (unsigned char x, unsigned int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y));
+}
+
+unsigned char
+f16 (unsigned char x, unsigned long int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y));
+}
+
+unsigned int
+f17 (unsigned int x, unsigned int y)
+{
+ return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x << y);
+}
+
+unsigned int
+f18 (unsigned int x, unsigned long int y)
+{
+ return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x << y);
+}
+
+unsigned int
+f19 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) ^ (x << 1);
+}
+
+unsigned int
+f20 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> 1) ^ (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
+}
+
+unsigned short int
+f21 (unsigned short int x, unsigned int y)
+{
+ return (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x << y);
+}
+
+unsigned short int
+f22 (unsigned short int x, unsigned long int y)
+{
+ return (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x << y);
+}
+
+unsigned char
+f23 (unsigned char x, unsigned int y)
+{
+ return (x >> (__CHAR_BIT__ - y)) ^ (x << y);
+}
+
+unsigned char
+f24 (unsigned char x, unsigned long int y)
+{
+ return (x >> (__CHAR_BIT__ - y)) ^ (x << y);
+}
+
+unsigned int
+f25 (unsigned int x, unsigned int y)
+{
+ return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x << y);
+}
+
+unsigned int
+f26 (unsigned int x, unsigned long int y)
+{
+ return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x << y);
+}
+
+unsigned int
+f27 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1)) ^ (x << 1);
+}
+
+unsigned int
+f28 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> 1) ^ (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1));
+}
+
+unsigned short int
+f29 (unsigned short int x, unsigned int y)
+{
+ return (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x << y);
+}
+
+unsigned short int
+f30 (unsigned short int x, unsigned long int y)
+{
+ return (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x << y);
+}
+
+unsigned char
+f31 (unsigned char x, unsigned int y)
+{
+ return (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x << y);
+}
+
+unsigned char
+f32 (unsigned char x, unsigned long int y)
+{
+ return (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x << y);
+}
+
+unsigned int
+f33 (unsigned int x, unsigned int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y));
+}
+
+unsigned int
+f34 (unsigned int x, unsigned long int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y));
+}
+
+unsigned int
+f35 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> 1) | (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
+}
+
+unsigned int
+f36 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) | (x << 1);
+}
+
+unsigned short int
+f37 (unsigned short int x, unsigned int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
+}
+
+unsigned short int
+f38 (unsigned short int x, unsigned long int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
+}
+
+unsigned char
+f39 (unsigned char x, unsigned int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ - y));
+}
+
+unsigned char
+f40 (unsigned char x, unsigned long int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ - y));
+}
+
+unsigned int
+f41 (unsigned int x, unsigned int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned int) - y));
+}
+
+unsigned int
+f42 (unsigned int x, unsigned long int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned int) - y));
+}
+
+unsigned int
+f43 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> 1) | (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1));
+}
+
+unsigned int
+f44 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1)) | (x << 1);
+}
+
+unsigned short int
+f45 (unsigned short int x, unsigned int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned short) - y));
+}
+
+unsigned short int
+f46 (unsigned short int x, unsigned long int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned short) - y));
+}
+
+unsigned char
+f47 (unsigned char x, unsigned int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned char) - y));
+}
+
+unsigned char
+f48 (unsigned char x, unsigned long int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned char) - y));
+}
+
+unsigned int
+f49 (unsigned int x, unsigned int y)
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x >> y);
+}
+
+unsigned int
+f50 (unsigned int x, unsigned long int y)
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x >> y);
+}
+
+unsigned int
+f51 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) ^ (x >> 1);
+}
+
+unsigned int
+f52 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) ^ (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
+}
+
+unsigned short int
+f53 (unsigned short int x, unsigned int y)
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x >> y);
+}
+
+unsigned short int
+f54 (unsigned short int x, unsigned long int y)
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x >> y);
+}
+
+unsigned char
+f55 (unsigned char x, unsigned int y)
+{
+ return (x << (__CHAR_BIT__ - y)) ^ (x >> y);
+}
+
+unsigned char
+f56 (unsigned char x, unsigned long int y)
+{
+ return (x << (__CHAR_BIT__ - y)) ^ (x >> y);
+}
+
+unsigned int
+f57 (unsigned int x, unsigned int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x >> y);
+}
+
+unsigned int
+f58 (unsigned int x, unsigned long int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x >> y);
+}
+
+unsigned int
+f59 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)) ^ (x >> 1);
+}
+
+unsigned int
+f60 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) ^ (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1));
+}
+
+unsigned short int
+f61 (unsigned short int x, unsigned int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x >> y);
+}
+
+unsigned short int
+f62 (unsigned short int x, unsigned long int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x >> y);
+}
+
+unsigned char
+f63 (unsigned char x, unsigned int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x >> y);
+}
+
+unsigned char
+f64 (unsigned char x, unsigned long int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x >> y);
+}
+
+unsigned int
+f65 (unsigned int x, unsigned int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y));
+}
+
+unsigned int
+f66 (unsigned int x, unsigned long int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y));
+}
+
+unsigned int
+f67 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) + (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
+}
+
+unsigned int
+f68 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) + (x >> 1);
+}
+
+unsigned short int
+f69 (unsigned short int x, unsigned int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
+}
+
+unsigned short int
+f70 (unsigned short int x, unsigned long int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
+}
+
+unsigned char
+f71 (unsigned char x, unsigned int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ - y));
+}
+
+unsigned char
+f72 (unsigned char x, unsigned long int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ - y));
+}
+
+unsigned int
+f73 (unsigned int x, unsigned int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y));
+}
+
+unsigned int
+f74 (unsigned int x, unsigned long int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y));
+}
+
+unsigned int
+f75 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) + (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1));
+}
+
+unsigned int
+f76 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)) + (x >> 1);
+}
+
+unsigned short int
+f77 (unsigned short int x, unsigned int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y));
+}
+
+unsigned short int
+f78 (unsigned short int x, unsigned long int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y));
+}
+
+unsigned char
+f79 (unsigned char x, unsigned int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y));
+}
+
+unsigned char
+f80 (unsigned char x, unsigned long int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y));
+}
+
+unsigned int
+f81 (unsigned int x, unsigned int y)
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)) + (x >> y);
+}
+
+unsigned int
+f82 (unsigned int x, unsigned long int y)
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)) + (x >> y);
+}
+
+unsigned int
+f83 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) + (x >> 1);
+}
+
+unsigned int
+f84 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) + (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
+}
+
+unsigned short int
+f85 (unsigned short int x, unsigned int y)
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) + (x >> y);
+}
+
+unsigned short int
+f86 (unsigned short int x, unsigned long int y)
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) + (x >> y);
+}
+
+unsigned char
+f87 (unsigned char x, unsigned int y)
+{
+ return (x << (__CHAR_BIT__ - y)) + (x >> y);
+}
+
+unsigned char
+f88 (unsigned char x, unsigned long int y)
+{
+ return (x << (__CHAR_BIT__ - y)) + (x >> y);
+}
+
+unsigned int
+f89 (unsigned int x, unsigned int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)) + (x >> y);
+}
+
+unsigned int
+f90 (unsigned int x, unsigned long int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)) + (x >> y);
+}
+
+unsigned int
+f91 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)) + (x >> 1);
+}
+
+unsigned int
+f92 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) + (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1));
+}
+
+unsigned short int
+f93 (unsigned short int x, unsigned int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)) + (x >> y);
+}
+
+unsigned short int
+f94 (unsigned short int x, unsigned long int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)) + (x >> y);
+}
+
+unsigned char
+f95 (unsigned char x, unsigned int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)) + (x >> y);
+}
+
+unsigned char
+f96 (unsigned char x, unsigned long int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)) + (x >> y);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/rotate-1a.c b/gcc-4.9/gcc/testsuite/c-c++-common/rotate-1a.c
new file mode 100644
index 000000000..07f65e540
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/rotate-1a.c
@@ -0,0 +1,49 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -Wno-overflow" } */
+
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void abort (void);
+
+#ifndef ROTATE_N
+#define ROTATE_N "rotate-1.c"
+#endif
+
+#include ROTATE_N
+
+unsigned int expected[] = {
+0x91a2b3c0, 0x91a2b3c0, 0x2468acf0, 0x91a2b3c, 0xb3c2, 0xb3c2, 0xc3, 0xc3,
+0x91a2b3c0, 0x91a2b3c0, 0x2468acf0, 0x91a2b3c, 0xb3c2, 0xb3c2, 0xc3, 0xc3,
+0x91a2b3c0, 0x91a2b3c0, 0x2468acf0, 0x91a2b3c, 0xb3c2, 0xb3c2, 0xc3, 0xc3,
+0x91a2b3c0, 0x91a2b3c0, 0x2468acf0, 0x91a2b3c, 0xb3c2, 0xb3c2, 0xc3, 0xc3,
+0x2468acf, 0x2468acf, 0x91a2b3c, 0x2468acf0, 0xacf, 0xacf, 0xf, 0xf,
+0x2468acf, 0x2468acf, 0x91a2b3c, 0x2468acf0, 0xacf, 0xacf, 0xf, 0xf,
+0x2468acf, 0x2468acf, 0x91a2b3c, 0x2468acf0, 0xacf, 0xacf, 0xf, 0xf,
+0x2468acf, 0x2468acf, 0x91a2b3c, 0x2468acf0, 0xacf, 0xacf, 0xf, 0xf,
+0x91a2b3c0, 0x91a2b3c0, 0x2468acf0, 0x91a2b3c, 0xb3c2, 0xb3c2, 0xc3, 0xc3,
+0x91a2b3c0, 0x91a2b3c0, 0x2468acf0, 0x91a2b3c, 0xb3c2, 0xb3c2, 0xc3, 0xc3,
+0x2468acf, 0x2468acf, 0x91a2b3c, 0x2468acf0, 0xacf, 0xacf, 0xf, 0xf,
+0x2468acf, 0x2468acf, 0x91a2b3c, 0x2468acf0, 0xacf, 0xacf, 0xf, 0xf };
+
+#define F(n) __typeof (f##n) f##n __attribute__((noinline, noclone));
+#define D(n) F(n##0) F(n##1) F(n##2) F(n##3) F(n##4) F(n##5) F(n##6) F(n##7) F(n##8) F(n##9)
+#define ALL \
+F(1) F(2) F(3) F(4) F(5) F(6) F(7) F(8) F(9) \
+D(1) D(2) D(3) D(4) D(5) D(6) D(7) D(8) \
+F(90) F(91) F(92) F(93) F(94) F(95) F(96)
+ALL
+
+int
+main ()
+{
+#if __CHAR_BIT__ != 8 || __SIZEOF_SHORT__ != 2 || __SIZEOF_INT__ != 4
+ return 0;
+#else
+#undef F
+#define F(n) if ((unsigned int) f##n (0x12345678U, 3) != expected[n - 1]) abort ();
+ ALL
+ return 0;
+#endif
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/rotate-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/rotate-2.c
new file mode 100644
index 000000000..109fd32bc
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/rotate-2.c
@@ -0,0 +1,583 @@
+/* Check rotate pattern detection. */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* Rotates should be recognized only in functions with | instead of + or ^,
+ or in functions that have constant shift counts (unused attribute on y). */
+/* { dg-final { scan-tree-dump-times "r\[<>]\[<>]" 48 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
+
+unsigned int
+f1 (unsigned int x, unsigned int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned int
+f2 (unsigned int x, unsigned long int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned int
+f3 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) | (x >> ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned int
+f4 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) | (x >> 1);
+}
+
+unsigned short int
+f5 (unsigned short int x, unsigned int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1)));
+}
+
+unsigned short int
+f6 (unsigned short int x, unsigned long int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1)));
+}
+
+unsigned char
+f7 (unsigned char x, unsigned int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1)));
+}
+
+unsigned char
+f8 (unsigned char x, unsigned long int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1)));
+}
+
+unsigned int
+f9 (unsigned int x, unsigned int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned int
+f10 (unsigned int x, unsigned long int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned int
+f11 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) | (x >> ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned int
+f12 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) | (x >> 1);
+}
+
+unsigned short int
+f13 (unsigned short int x, unsigned int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1)));
+}
+
+unsigned short int
+f14 (unsigned short int x, unsigned long int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1)));
+}
+
+unsigned char
+f15 (unsigned char x, unsigned int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1)));
+}
+
+unsigned char
+f16 (unsigned char x, unsigned long int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1)));
+}
+
+unsigned int
+f17 (unsigned int x, unsigned int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x << y);
+}
+
+unsigned int
+f18 (unsigned int x, unsigned long int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x << y);
+}
+
+unsigned int
+f19 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x << 1);
+}
+
+unsigned int
+f20 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> 1) ^ (x << ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned short int
+f21 (unsigned short int x, unsigned int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))) ^ (x << y);
+}
+
+unsigned short int
+f22 (unsigned short int x, unsigned long int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))) ^ (x << y);
+}
+
+unsigned char
+f23 (unsigned char x, unsigned int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ - 1))) ^ (x << y);
+}
+
+unsigned char
+f24 (unsigned char x, unsigned long int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ - 1))) ^ (x << y);
+}
+
+unsigned int
+f25 (unsigned int x, unsigned int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x << y);
+}
+
+unsigned int
+f26 (unsigned int x, unsigned long int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x << y);
+}
+
+unsigned int
+f27 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x << 1);
+}
+
+unsigned int
+f28 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> 1) ^ (x << ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned short int
+f29 (unsigned short int x, unsigned int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))) ^ (x << y);
+}
+
+unsigned short int
+f30 (unsigned short int x, unsigned long int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))) ^ (x << y);
+}
+
+unsigned char
+f31 (unsigned char x, unsigned int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) ^ (x << y);
+}
+
+unsigned char
+f32 (unsigned char x, unsigned long int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) ^ (x << y);
+}
+
+unsigned int
+f33 (unsigned int x, unsigned int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned int
+f34 (unsigned int x, unsigned long int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned int
+f35 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> 1) | (x << ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned int
+f36 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) | (x << 1);
+}
+
+unsigned short int
+f37 (unsigned short int x, unsigned int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1)));
+}
+
+unsigned short int
+f38 (unsigned short int x, unsigned long int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1)));
+}
+
+unsigned char
+f39 (unsigned char x, unsigned int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ - 1)));
+}
+
+unsigned char
+f40 (unsigned char x, unsigned long int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ - 1)));
+}
+
+unsigned int
+f41 (unsigned int x, unsigned int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned int
+f42 (unsigned int x, unsigned long int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned int
+f43 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> 1) | (x << ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned int
+f44 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) | (x << 1);
+}
+
+unsigned short int
+f45 (unsigned short int x, unsigned int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1)));
+}
+
+unsigned short int
+f46 (unsigned short int x, unsigned long int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1)));
+}
+
+unsigned char
+f47 (unsigned char x, unsigned int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1)));
+}
+
+unsigned char
+f48 (unsigned char x, unsigned long int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1)));
+}
+
+unsigned int
+f49 (unsigned int x, unsigned int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x >> y);
+}
+
+unsigned int
+f50 (unsigned int x, unsigned long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x >> y);
+}
+
+unsigned int
+f51 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x >> 1);
+}
+
+unsigned int
+f52 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) ^ (x >> ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned short int
+f53 (unsigned short int x, unsigned int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))) ^ (x >> y);
+}
+
+unsigned short int
+f54 (unsigned short int x, unsigned long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))) ^ (x >> y);
+}
+
+unsigned char
+f55 (unsigned char x, unsigned int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ - 1))) ^ (x >> y);
+}
+
+unsigned char
+f56 (unsigned char x, unsigned long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ - 1))) ^ (x >> y);
+}
+
+unsigned int
+f57 (unsigned int x, unsigned int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x >> y);
+}
+
+unsigned int
+f58 (unsigned int x, unsigned long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x >> y);
+}
+
+unsigned int
+f59 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x >> 1);
+}
+
+unsigned int
+f60 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) ^ (x >> ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned short int
+f61 (unsigned short int x, unsigned int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))) ^ (x >> y);
+}
+
+unsigned short int
+f62 (unsigned short int x, unsigned long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))) ^ (x >> y);
+}
+
+unsigned char
+f63 (unsigned char x, unsigned int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) ^ (x >> y);
+}
+
+unsigned char
+f64 (unsigned char x, unsigned long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) ^ (x >> y);
+}
+
+unsigned int
+f65 (unsigned int x, unsigned int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned int
+f66 (unsigned int x, unsigned long int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned int
+f67 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) + (x >> ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned int
+f68 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) + (x >> 1);
+}
+
+unsigned short int
+f69 (unsigned short int x, unsigned int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1)));
+}
+
+unsigned short int
+f70 (unsigned short int x, unsigned long int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1)));
+}
+
+unsigned char
+f71 (unsigned char x, unsigned int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ - 1)));
+}
+
+unsigned char
+f72 (unsigned char x, unsigned long int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ - 1)));
+}
+
+unsigned int
+f73 (unsigned int x, unsigned int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned int
+f74 (unsigned int x, unsigned long int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned int
+f75 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) + (x >> ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned int
+f76 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) + (x >> 1);
+}
+
+unsigned short int
+f77 (unsigned short int x, unsigned int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1)));
+}
+
+unsigned short int
+f78 (unsigned short int x, unsigned long int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1)));
+}
+
+unsigned char
+f79 (unsigned char x, unsigned int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1)));
+}
+
+unsigned char
+f80 (unsigned char x, unsigned long int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1)));
+}
+
+unsigned int
+f81 (unsigned int x, unsigned int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) + (x >> y);
+}
+
+unsigned int
+f82 (unsigned int x, unsigned long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) + (x >> y);
+}
+
+unsigned int
+f83 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) + (x >> 1);
+}
+
+unsigned int
+f84 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) + (x >> ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned short int
+f85 (unsigned short int x, unsigned int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))) + (x >> y);
+}
+
+unsigned short int
+f86 (unsigned short int x, unsigned long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))) + (x >> y);
+}
+
+unsigned char
+f87 (unsigned char x, unsigned int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ - 1))) + (x >> y);
+}
+
+unsigned char
+f88 (unsigned char x, unsigned long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ - 1))) + (x >> y);
+}
+
+unsigned int
+f89 (unsigned int x, unsigned int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) + (x >> y);
+}
+
+unsigned int
+f90 (unsigned int x, unsigned long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) + (x >> y);
+}
+
+unsigned int
+f91 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) + (x >> 1);
+}
+
+unsigned int
+f92 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) + (x >> ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned short int
+f93 (unsigned short int x, unsigned int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))) + (x >> y);
+}
+
+unsigned short int
+f94 (unsigned short int x, unsigned long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))) + (x >> y);
+}
+
+unsigned char
+f95 (unsigned char x, unsigned int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) + (x >> y);
+}
+
+unsigned char
+f96 (unsigned char x, unsigned long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) + (x >> y);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/rotate-2a.c b/gcc-4.9/gcc/testsuite/c-c++-common/rotate-2a.c
new file mode 100644
index 000000000..d709c0d36
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/rotate-2a.c
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -Wno-overflow" } */
+
+#define ROTATE_N "rotate-2.c"
+
+#include "rotate-1a.c"
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/rotate-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/rotate-3.c
new file mode 100644
index 000000000..8dc8313ee
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/rotate-3.c
@@ -0,0 +1,581 @@
+/* Check rotate pattern detection. */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "r\[<>]\[<>]" 96 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
+
+unsigned int
+f1 (unsigned int x, int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y));
+}
+
+unsigned int
+f2 (unsigned int x, long int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y));
+}
+
+unsigned int
+f3 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) | (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
+}
+
+unsigned int
+f4 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) | (x >> 1);
+}
+
+unsigned short int
+f5 (unsigned short int x, int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
+}
+
+unsigned short int
+f6 (unsigned short int x, long int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
+}
+
+unsigned char
+f7 (unsigned char x, int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ - y));
+}
+
+unsigned char
+f8 (unsigned char x, long int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ - y));
+}
+
+unsigned int
+f9 (unsigned int x, int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y));
+}
+
+unsigned int
+f10 (unsigned int x, long int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y));
+}
+
+unsigned int
+f11 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) | (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1));
+}
+
+unsigned int
+f12 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)) | (x >> 1);
+}
+
+unsigned short int
+f13 (unsigned short int x, int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y));
+}
+
+unsigned short int
+f14 (unsigned short int x, long int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y));
+}
+
+unsigned char
+f15 (unsigned char x, int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y));
+}
+
+unsigned char
+f16 (unsigned char x, long int y)
+{
+ return (x << y) | (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y));
+}
+
+unsigned int
+f17 (unsigned int x, int y)
+{
+ return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x << y);
+}
+
+unsigned int
+f18 (unsigned int x, long int y)
+{
+ return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x << y);
+}
+
+unsigned int
+f19 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) ^ (x << 1);
+}
+
+unsigned int
+f20 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> 1) ^ (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
+}
+
+unsigned short int
+f21 (unsigned short int x, int y)
+{
+ return (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x << y);
+}
+
+unsigned short int
+f22 (unsigned short int x, long int y)
+{
+ return (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x << y);
+}
+
+unsigned char
+f23 (unsigned char x, int y)
+{
+ return (x >> (__CHAR_BIT__ - y)) ^ (x << y);
+}
+
+unsigned char
+f24 (unsigned char x, long int y)
+{
+ return (x >> (__CHAR_BIT__ - y)) ^ (x << y);
+}
+
+unsigned int
+f25 (unsigned int x, int y)
+{
+ return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x << y);
+}
+
+unsigned int
+f26 (unsigned int x, long int y)
+{
+ return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x << y);
+}
+
+unsigned int
+f27 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1)) ^ (x << 1);
+}
+
+unsigned int
+f28 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> 1) ^ (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1));
+}
+
+unsigned short int
+f29 (unsigned short int x, int y)
+{
+ return (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x << y);
+}
+
+unsigned short int
+f30 (unsigned short int x, long int y)
+{
+ return (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x << y);
+}
+
+unsigned char
+f31 (unsigned char x, int y)
+{
+ return (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x << y);
+}
+
+unsigned char
+f32 (unsigned char x, long int y)
+{
+ return (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x << y);
+}
+
+unsigned int
+f33 (unsigned int x, int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y));
+}
+
+unsigned int
+f34 (unsigned int x, long int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y));
+}
+
+unsigned int
+f35 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> 1) | (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
+}
+
+unsigned int
+f36 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) | (x << 1);
+}
+
+unsigned short int
+f37 (unsigned short int x, int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
+}
+
+unsigned short int
+f38 (unsigned short int x, long int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
+}
+
+unsigned char
+f39 (unsigned char x, int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ - y));
+}
+
+unsigned char
+f40 (unsigned char x, long int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ - y));
+}
+
+unsigned int
+f41 (unsigned int x, int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned int) - y));
+}
+
+unsigned int
+f42 (unsigned int x, long int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned int) - y));
+}
+
+unsigned int
+f43 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> 1) | (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1));
+}
+
+unsigned int
+f44 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1)) | (x << 1);
+}
+
+unsigned short int
+f45 (unsigned short int x, int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned short) - y));
+}
+
+unsigned short int
+f46 (unsigned short int x, long int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned short) - y));
+}
+
+unsigned char
+f47 (unsigned char x, int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned char) - y));
+}
+
+unsigned char
+f48 (unsigned char x, long int y)
+{
+ return (x >> y) | (x << (__CHAR_BIT__ * sizeof (unsigned char) - y));
+}
+
+unsigned int
+f49 (unsigned int x, int y)
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x >> y);
+}
+
+unsigned int
+f50 (unsigned int x, long int y)
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)) ^ (x >> y);
+}
+
+unsigned int
+f51 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) ^ (x >> 1);
+}
+
+unsigned int
+f52 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) ^ (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
+}
+
+unsigned short int
+f53 (unsigned short int x, int y)
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x >> y);
+}
+
+unsigned short int
+f54 (unsigned short int x, long int y)
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) ^ (x >> y);
+}
+
+unsigned char
+f55 (unsigned char x, int y)
+{
+ return (x << (__CHAR_BIT__ - y)) ^ (x >> y);
+}
+
+unsigned char
+f56 (unsigned char x, long int y)
+{
+ return (x << (__CHAR_BIT__ - y)) ^ (x >> y);
+}
+
+unsigned int
+f57 (unsigned int x, int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x >> y);
+}
+
+unsigned int
+f58 (unsigned int x, long int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)) ^ (x >> y);
+}
+
+unsigned int
+f59 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)) ^ (x >> 1);
+}
+
+unsigned int
+f60 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) ^ (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1));
+}
+
+unsigned short int
+f61 (unsigned short int x, int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x >> y);
+}
+
+unsigned short int
+f62 (unsigned short int x, long int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)) ^ (x >> y);
+}
+
+unsigned char
+f63 (unsigned char x, int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x >> y);
+}
+
+unsigned char
+f64 (unsigned char x, long int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)) ^ (x >> y);
+}
+
+unsigned int
+f65 (unsigned int x, int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y));
+}
+
+unsigned int
+f66 (unsigned int x, long int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - y));
+}
+
+unsigned int
+f67 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) + (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
+}
+
+unsigned int
+f68 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) + (x >> 1);
+}
+
+unsigned short int
+f69 (unsigned short int x, int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
+}
+
+unsigned short int
+f70 (unsigned short int x, long int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ * __SIZEOF_SHORT__ - y));
+}
+
+unsigned char
+f71 (unsigned char x, int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ - y));
+}
+
+unsigned char
+f72 (unsigned char x, long int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ - y));
+}
+
+unsigned int
+f73 (unsigned int x, int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y));
+}
+
+unsigned int
+f74 (unsigned int x, long int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned int) - y));
+}
+
+unsigned int
+f75 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) + (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1));
+}
+
+unsigned int
+f76 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)) + (x >> 1);
+}
+
+unsigned short int
+f77 (unsigned short int x, int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y));
+}
+
+unsigned short int
+f78 (unsigned short int x, long int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned short) - y));
+}
+
+unsigned char
+f79 (unsigned char x, int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y));
+}
+
+unsigned char
+f80 (unsigned char x, long int y)
+{
+ return (x << y) + (x >> (__CHAR_BIT__ * sizeof (unsigned char) - y));
+}
+
+unsigned int
+f81 (unsigned int x, int y)
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)) + (x >> y);
+}
+
+unsigned int
+f82 (unsigned int x, long int y)
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - y)) + (x >> y);
+}
+
+unsigned int
+f83 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_INT__ - 1)) + (x >> 1);
+}
+
+unsigned int
+f84 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) + (x >> (__CHAR_BIT__ * __SIZEOF_INT__ - 1));
+}
+
+unsigned short int
+f85 (unsigned short int x, int y)
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) + (x >> y);
+}
+
+unsigned short int
+f86 (unsigned short int x, long int y)
+{
+ return (x << (__CHAR_BIT__ * __SIZEOF_SHORT__ - y)) + (x >> y);
+}
+
+unsigned char
+f87 (unsigned char x, int y)
+{
+ return (x << (__CHAR_BIT__ - y)) + (x >> y);
+}
+
+unsigned char
+f88 (unsigned char x, long int y)
+{
+ return (x << (__CHAR_BIT__ - y)) + (x >> y);
+}
+
+unsigned int
+f89 (unsigned int x, int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)) + (x >> y);
+}
+
+unsigned int
+f90 (unsigned int x, long int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned int) - y)) + (x >> y);
+}
+
+unsigned int
+f91 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned int) - 1)) + (x >> 1);
+}
+
+unsigned int
+f92 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) + (x >> (__CHAR_BIT__ * sizeof (unsigned int) - 1));
+}
+
+unsigned short int
+f93 (unsigned short int x, int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)) + (x >> y);
+}
+
+unsigned short int
+f94 (unsigned short int x, long int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned short) - y)) + (x >> y);
+}
+
+unsigned char
+f95 (unsigned char x, int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)) + (x >> y);
+}
+
+unsigned char
+f96 (unsigned char x, long int y)
+{
+ return (x << (__CHAR_BIT__ * sizeof (unsigned char) - y)) + (x >> y);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/rotate-3a.c b/gcc-4.9/gcc/testsuite/c-c++-common/rotate-3a.c
new file mode 100644
index 000000000..450fc22d7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/rotate-3a.c
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -Wno-overflow" } */
+
+#define ROTATE_N "rotate-4.c"
+
+#include "rotate-1a.c"
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/rotate-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/rotate-4.c
new file mode 100644
index 000000000..2f433b332
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/rotate-4.c
@@ -0,0 +1,583 @@
+/* Check rotate pattern detection. */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* Rotates should be recognized only in functions with | instead of + or ^,
+ or in functions that have constant shift counts (unused attribute on y). */
+/* { dg-final { scan-tree-dump-times "r\[<>]\[<>]" 48 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
+
+unsigned int
+f1 (unsigned int x, int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned int
+f2 (unsigned int x, long int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned int
+f3 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) | (x >> ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned int
+f4 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) | (x >> 1);
+}
+
+unsigned short int
+f5 (unsigned short int x, int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1)));
+}
+
+unsigned short int
+f6 (unsigned short int x, long int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1)));
+}
+
+unsigned char
+f7 (unsigned char x, int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1)));
+}
+
+unsigned char
+f8 (unsigned char x, long int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ - 1)));
+}
+
+unsigned int
+f9 (unsigned int x, int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned int
+f10 (unsigned int x, long int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned int
+f11 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) | (x >> ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned int
+f12 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) | (x >> 1);
+}
+
+unsigned short int
+f13 (unsigned short int x, int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1)));
+}
+
+unsigned short int
+f14 (unsigned short int x, long int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1)));
+}
+
+unsigned char
+f15 (unsigned char x, int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1)));
+}
+
+unsigned char
+f16 (unsigned char x, long int y)
+{
+ return (x << y) | (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1)));
+}
+
+unsigned int
+f17 (unsigned int x, int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x << y);
+}
+
+unsigned int
+f18 (unsigned int x, long int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x << y);
+}
+
+unsigned int
+f19 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x << 1);
+}
+
+unsigned int
+f20 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> 1) ^ (x << ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned short int
+f21 (unsigned short int x, int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))) ^ (x << y);
+}
+
+unsigned short int
+f22 (unsigned short int x, long int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))) ^ (x << y);
+}
+
+unsigned char
+f23 (unsigned char x, int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ - 1))) ^ (x << y);
+}
+
+unsigned char
+f24 (unsigned char x, long int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ - 1))) ^ (x << y);
+}
+
+unsigned int
+f25 (unsigned int x, int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x << y);
+}
+
+unsigned int
+f26 (unsigned int x, long int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x << y);
+}
+
+unsigned int
+f27 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x << 1);
+}
+
+unsigned int
+f28 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> 1) ^ (x << ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned short int
+f29 (unsigned short int x, int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))) ^ (x << y);
+}
+
+unsigned short int
+f30 (unsigned short int x, long int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))) ^ (x << y);
+}
+
+unsigned char
+f31 (unsigned char x, int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) ^ (x << y);
+}
+
+unsigned char
+f32 (unsigned char x, long int y)
+{
+ return (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) ^ (x << y);
+}
+
+unsigned int
+f33 (unsigned int x, int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned int
+f34 (unsigned int x, long int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned int
+f35 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> 1) | (x << ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned int
+f36 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) | (x << 1);
+}
+
+unsigned short int
+f37 (unsigned short int x, int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1)));
+}
+
+unsigned short int
+f38 (unsigned short int x, long int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1)));
+}
+
+unsigned char
+f39 (unsigned char x, int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ - 1)));
+}
+
+unsigned char
+f40 (unsigned char x, long int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ - 1)));
+}
+
+unsigned int
+f41 (unsigned int x, int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned int
+f42 (unsigned int x, long int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned int
+f43 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> 1) | (x << ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned int
+f44 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x >> ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) | (x << 1);
+}
+
+unsigned short int
+f45 (unsigned short int x, int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1)));
+}
+
+unsigned short int
+f46 (unsigned short int x, long int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1)));
+}
+
+unsigned char
+f47 (unsigned char x, int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1)));
+}
+
+unsigned char
+f48 (unsigned char x, long int y)
+{
+ return (x >> y) | (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1)));
+}
+
+unsigned int
+f49 (unsigned int x, int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x >> y);
+}
+
+unsigned int
+f50 (unsigned int x, long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x >> y);
+}
+
+unsigned int
+f51 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) ^ (x >> 1);
+}
+
+unsigned int
+f52 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) ^ (x >> ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned short int
+f53 (unsigned short int x, int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))) ^ (x >> y);
+}
+
+unsigned short int
+f54 (unsigned short int x, long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))) ^ (x >> y);
+}
+
+unsigned char
+f55 (unsigned char x, int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ - 1))) ^ (x >> y);
+}
+
+unsigned char
+f56 (unsigned char x, long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ - 1))) ^ (x >> y);
+}
+
+unsigned int
+f57 (unsigned int x, int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x >> y);
+}
+
+unsigned int
+f58 (unsigned int x, long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x >> y);
+}
+
+unsigned int
+f59 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) ^ (x >> 1);
+}
+
+unsigned int
+f60 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) ^ (x >> ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned short int
+f61 (unsigned short int x, int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))) ^ (x >> y);
+}
+
+unsigned short int
+f62 (unsigned short int x, long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))) ^ (x >> y);
+}
+
+unsigned char
+f63 (unsigned char x, int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) ^ (x >> y);
+}
+
+unsigned char
+f64 (unsigned char x, long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) ^ (x >> y);
+}
+
+unsigned int
+f65 (unsigned int x, int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned int
+f66 (unsigned int x, long int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned int
+f67 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) + (x >> ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned int
+f68 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) + (x >> 1);
+}
+
+unsigned short int
+f69 (unsigned short int x, int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1)));
+}
+
+unsigned short int
+f70 (unsigned short int x, long int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1)));
+}
+
+unsigned char
+f71 (unsigned char x, int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ - 1)));
+}
+
+unsigned char
+f72 (unsigned char x, long int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ - 1)));
+}
+
+unsigned int
+f73 (unsigned int x, int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned int
+f74 (unsigned int x, long int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned int
+f75 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) + (x >> ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned int
+f76 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) + (x >> 1);
+}
+
+unsigned short int
+f77 (unsigned short int x, int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1)));
+}
+
+unsigned short int
+f78 (unsigned short int x, long int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1)));
+}
+
+unsigned char
+f79 (unsigned char x, int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1)));
+}
+
+unsigned char
+f80 (unsigned char x, long int y)
+{
+ return (x << y) + (x >> ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1)));
+}
+
+unsigned int
+f81 (unsigned int x, int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) + (x >> y);
+}
+
+unsigned int
+f82 (unsigned int x, long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) + (x >> y);
+}
+
+unsigned int
+f83 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1))) + (x >> 1);
+}
+
+unsigned int
+f84 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) + (x >> ((-1) & (__CHAR_BIT__ * __SIZEOF_INT__ - 1)));
+}
+
+unsigned short int
+f85 (unsigned short int x, int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))) + (x >> y);
+}
+
+unsigned short int
+f86 (unsigned short int x, long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * __SIZEOF_SHORT__ - 1))) + (x >> y);
+}
+
+unsigned char
+f87 (unsigned char x, int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ - 1))) + (x >> y);
+}
+
+unsigned char
+f88 (unsigned char x, long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ - 1))) + (x >> y);
+}
+
+unsigned int
+f89 (unsigned int x, int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) + (x >> y);
+}
+
+unsigned int
+f90 (unsigned int x, long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) + (x >> y);
+}
+
+unsigned int
+f91 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1))) + (x >> 1);
+}
+
+unsigned int
+f92 (unsigned int x, int y __attribute__((unused)))
+{
+ return (x << 1) + (x >> ((-1) & (__CHAR_BIT__ * sizeof (unsigned int) - 1)));
+}
+
+unsigned short int
+f93 (unsigned short int x, int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))) + (x >> y);
+}
+
+unsigned short int
+f94 (unsigned short int x, long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned short) - 1))) + (x >> y);
+}
+
+unsigned char
+f95 (unsigned char x, int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) + (x >> y);
+}
+
+unsigned char
+f96 (unsigned char x, long int y)
+{
+ return (x << ((-y) & (__CHAR_BIT__ * sizeof (unsigned char) - 1))) + (x >> y);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/rotate-4a.c b/gcc-4.9/gcc/testsuite/c-c++-common/rotate-4a.c
new file mode 100644
index 000000000..450fc22d7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/rotate-4a.c
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -Wno-overflow" } */
+
+#define ROTATE_N "rotate-4.c"
+
+#include "rotate-1a.c"
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/rotate-5.c b/gcc-4.9/gcc/testsuite/c-c++-common/rotate-5.c
new file mode 100644
index 000000000..35b14b86c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/rotate-5.c
@@ -0,0 +1,43 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void abort (void);
+
+#if __CHAR_BIT__ * __SIZEOF_LONG_LONG__ == 64
+__attribute__((noinline, noclone))
+unsigned long long
+f1 (unsigned long long x, unsigned int y)
+{
+ return (x << y) | (x >> ((-y) & 63));
+}
+
+#if __CHAR_BIT__ * __SIZEOF_INT128__ == 128
+__attribute__((noinline, noclone))
+unsigned __int128
+f2 (unsigned __int128 x, unsigned int y)
+{
+ return (x << y) | (x >> ((-y) & 128));
+}
+#endif
+#endif
+
+int
+main ()
+{
+#if __CHAR_BIT__ * __SIZEOF_LONG_LONG__ == 64
+ if (f1 (0x123456789abcdef0ULL, 0) != 0x123456789abcdef0ULL)
+ abort ();
+#if __CHAR_BIT__ * __SIZEOF_INT128__ == 128
+ if (f2 ((((unsigned __int128) 0x123456789abcdef0ULL) << 64)
+ | 0x0fedcba987654321ULL, 0)
+ != ((((unsigned __int128) 0x123456789abcdef0ULL) << 64)
+ | 0x0fedcba987654321ULL))
+ abort ();
+#endif
+#endif
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/scal-to-vec1.c b/gcc-4.9/gcc/testsuite/c-c++-common/scal-to-vec1.c
new file mode 100644
index 000000000..52cc2e39a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/scal-to-vec1.c
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-options "-Wno-long-long" } */
+/* { dg-options "-Wno-long-long -mabi=altivec" { target { { powerpc*-*-linux* } && ilp32 } } } */
+
+#define vector(elcount, type) \
+__attribute__((vector_size((elcount)*sizeof(type)))) type
+
+#define vidx(type, vec, idx) (*((type *) &(vec) + idx))
+
+
+extern float sfl;
+extern int sint;
+extern long long sll;
+
+int main (int argc, char *argv[]) {
+ vector(8, short) v0 = {(short)argc, 1,2,3,4,5,6,7};
+ vector(8, short) v1;
+
+ vector(4, float) f0 = {1., 2., 3., 4.};
+ vector(4, float) f1, f2;
+
+ vector(4, int) i0 = {1,2,3,4};
+ vector(4, int) i1, i2;
+
+
+ int i = 12;
+ double d = 3.;
+
+ v1 = i + v0; /* { dg-error "conversion of scalar \[^\\n\]* to vector" "scalar to vector" { target { ! int16 } } } */
+ v1 = 99999 + v0; /* { dg-error "conversion of scalar \[^\\n\]* to vector" } */
+
+ f1 = d + f0; /* { dg-error "conversion of scalar \[^\\n\]* to vector" "scalar to vector" { target { large_double } } } */
+ f1 = 1.3 + f0; /* { dg-error "conversion of scalar \[^\\n\]* to vector" "scalar to vector" { target { large_double } } } */
+ f1 = sll + f0; /* { dg-error "conversion of scalar \[^\\n\]* to vector" } */
+ f1 = ((int)998769576) + f0; /* { dg-error "conversion of scalar \[^\\n\]* to vector" "scalar to vector" { target { ! int16 } } } */
+
+ /* convert.c should take care of this. */
+ i1 = sfl + i0; /* { dg-error "can't convert value to a vector|invalid operands" } */
+ i1 = 1.5 + i0; /* { dg-error "can't convert value to a vector|invalid operands" } */
+ v1 = d + v0; /* { dg-error "can't convert value to a vector|invalid operands" } */
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/scal-to-vec2.c b/gcc-4.9/gcc/testsuite/c-c++-common/scal-to-vec2.c
new file mode 100644
index 000000000..e2c93eedd
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/scal-to-vec2.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fno-common" { target hppa*-*-hpux* } } */
+/* { dg-options "-mabi=altivec" { target { { powerpc*-*-linux* } && ilp32 } } } */
+/* { dg-options "-msse2" { target { i?86-*-* x86_64-*-* } } } */
+/* Ignore warning on some powerpc-ibm-aix configurations. */
+/* { dg-prune-output "non-standard ABI extension" } */
+
+/* Test for C_MAYBE_CONST are folded correctly when
+ expanding an expression to vector. */
+
+int f(void);
+unsigned int g(void);
+unsigned int h;
+
+typedef unsigned int vec __attribute__((vector_size(16)));
+
+vec i;
+
+
+vec fv1(void) { return i + (h ? f() : g()); }
+vec fv2(void) { return (h ? f() : g()) + i; }
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/simulate-thread/bitfields-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/simulate-thread/bitfields-1.c
new file mode 100644
index 000000000..9ca3a67f3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/simulate-thread/bitfields-1.c
@@ -0,0 +1,71 @@
+/* { dg-do link } */
+/* { dg-options "--param allow-store-data-races=0" } */
+/* { dg-final { simulate-thread } } */
+
+#include <stdio.h>
+#include "../../gcc.dg/simulate-thread/simulate-thread.h"
+
+/* Test that we don't store past VAR.A. */
+
+struct S
+{
+ volatile unsigned int a : 4;
+ unsigned char b;
+ unsigned int c : 6;
+} var = { 1, 2, 3 };
+
+static int global = 0;
+
+/* Called before each instruction, simulating another thread
+ executing. */
+void simulate_thread_other_threads()
+{
+ global++;
+ var.b = global;
+ /* Don't go past the 6 bits var.c can hold. */
+ var.c = global % 64;
+}
+
+/* Called after each instruction. Returns 1 if any inconsistency is
+ found, 0 otherwise. */
+int simulate_thread_step_verify()
+{
+ int ret = 0;
+ if (var.b != global)
+ {
+ printf("FAIL: invalid intermediate value for <b>.\n");
+ ret = 1;
+ }
+ if (var.c != global % 64)
+ {
+ printf("FAIL: invalid intermediate value for <c>.\n");
+ ret = 1;
+ }
+ return ret;
+}
+
+/* Called at the end of the program (simulate_thread_fini == 1). Verifies
+ the state of the program and returns 1 if any inconsistency is
+ found, 0 otherwise. */
+int simulate_thread_final_verify()
+{
+ if (var.a != 12)
+ {
+ printf("FAIL: invalid final result for <a>.\n");
+ return 1;
+ }
+ return 0;
+}
+
+__attribute__((noinline))
+void simulate_thread_main()
+{
+ var.a = 12;
+}
+
+int main()
+{
+ simulate_thread_main();
+ simulate_thread_done();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/simulate-thread/bitfields-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/simulate-thread/bitfields-2.c
new file mode 100644
index 000000000..0b29ffb68
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/simulate-thread/bitfields-2.c
@@ -0,0 +1,59 @@
+/* { dg-do link { target { ! int16 } } } */
+/* { dg-options "--param allow-store-data-races=0" } */
+/* { dg-final { simulate-thread } } */
+
+#include <stdio.h>
+#include "../../gcc.dg/simulate-thread/simulate-thread.h"
+
+/* Test that we don't store past VAR.K. */
+
+struct S
+{
+ volatile int i;
+ volatile int j: 32;
+ volatile int k: 15;
+ volatile unsigned char c[2];
+} var;
+
+static int global = 0;
+
+void simulate_thread_other_threads()
+{
+ global++;
+ var.c[0] = global % 256;
+ var.c[1] = global % 256;
+}
+
+int simulate_thread_step_verify()
+{
+ if (var.c[0] != global % 256
+ || var.c[1] != global % 256)
+ {
+ printf("FAIL: invalid intermediate result for <var.c[]>.\n");
+ return 1;
+ }
+ return 0;
+}
+
+int simulate_thread_final_verify()
+{
+ if (var.k != 13)
+ {
+ printf("FAIL: invalid final result\n");
+ return 1;
+ }
+ return 0;
+}
+
+__attribute__((noinline))
+void simulate_thread_main()
+{
+ var.k = 13;
+}
+
+int main()
+{
+ simulate_thread_main();
+ simulate_thread_done();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/simulate-thread/bitfields-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/simulate-thread/bitfields-3.c
new file mode 100644
index 000000000..78f4d75c8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/simulate-thread/bitfields-3.c
@@ -0,0 +1,63 @@
+/* { dg-do link } */
+/* { dg-options "--param allow-store-data-races=0" } */
+/* { dg-final { simulate-thread } } */
+
+#include <stdio.h>
+#include "../../gcc.dg/simulate-thread/simulate-thread.h"
+
+/* Store into <c> should not clobber <d>. */
+
+struct bits
+{
+ char a;
+ int b:7;
+ int c:9;
+ unsigned char d;
+} var;
+
+static int global = 0;
+
+void simulate_thread_other_threads()
+{
+ global++;
+ var.d = global;
+}
+
+int simulate_thread_step_verify()
+{
+ if (var.d != global)
+ {
+ printf("FAIL: invalid intermediate result\n");
+ return 1;
+ }
+ return 0;
+}
+
+int simulate_thread_final_verify()
+{
+ if (var.c != 5)
+ {
+ printf("FAIL: invalid final result\n");
+ return 1;
+ }
+ return 0;
+}
+
+__attribute__((noinline))
+void update_c(struct bits *p, int val)
+{
+ p -> c = val;
+}
+
+__attribute__((noinline))
+void simulate_thread_main()
+{
+ update_c(&var, 5);
+}
+
+int main()
+{
+ simulate_thread_main();
+ simulate_thread_done();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/simulate-thread/bitfields-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/simulate-thread/bitfields-4.c
new file mode 100644
index 000000000..cd6badf33
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/simulate-thread/bitfields-4.c
@@ -0,0 +1,60 @@
+/* { dg-do link } */
+/* { dg-options "--param allow-store-data-races=0" } */
+/* { dg-final { simulate-thread } } */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "../../gcc.dg/simulate-thread/simulate-thread.h"
+
+struct bits
+{
+ char a;
+ int b:7;
+ int c:9;
+ unsigned char d;
+} *p;
+
+static int global = 0;
+
+void simulate_thread_other_threads()
+{
+ global++;
+ p->d = global % 256;
+}
+
+int simulate_thread_step_verify()
+{
+ if (p->d != global % 256)
+ {
+ printf("FAIL: invalid intermediate result\n");
+ return 1;
+ }
+ return 0;
+}
+
+int simulate_thread_final_verify()
+{
+ if (p->c != 55)
+ {
+ printf("FAIL: invalid final result\n");
+ return 1;
+ }
+ return 0;
+}
+
+/* Store into <c> should not clobber <d>. */
+/* We should not use a 32-bit move to store into p->, but a smaller move. */
+__attribute__((noinline))
+void simulate_thread_main()
+{
+ p -> c = 55;
+}
+
+
+int main()
+{
+ p = (struct bits *) calloc (1, sizeof (struct bits));
+ simulate_thread_main();
+ simulate_thread_done();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/20100127.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/20100127.c
new file mode 100644
index 000000000..c25336d68
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/20100127.c
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O -fdump-tree-tmmark" } */
+
+/* Test that `nontrxn' doesn't end up inside the transaction. */
+
+typedef struct node {
+ int * val;
+ struct node *next;
+} node_t;
+
+node_t *next;
+int nontrxn1, nontrxn;
+
+static int set_remove(int * val)
+{
+ int result;
+ int * v;
+ __transaction_relaxed {
+ v = next->val;
+ result = (v == val);
+ if (result)
+ result = 2;
+ }
+ return result;
+}
+
+void test(void *data)
+{
+ extern void bark(void);
+ if (set_remove(0))
+ bark();
+ nontrxn = 99; /* Should be outside transaction. */
+}
+
+/* { dg-final { scan-tree-dump-times "_ITM_W.*nontrxn" 0 "tmmark" } } */
+/* { dg-final { cleanup-tree-dump "tmmark" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/20111206.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/20111206.c
new file mode 100644
index 000000000..74a551966
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/20111206.c
@@ -0,0 +1,53 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O2" } */
+/* This test case triggered block sharing between the two transactions. */
+
+void func1 (void) __attribute__ ((transaction_callable, used));
+long func2 (void) __attribute__ ((transaction_callable, used));
+unsigned long rand (void);
+
+void client_run (void)
+{
+ long types[100];
+ long i;
+
+ for (i = 0; i < 100; i++)
+ {
+ long action = rand ();
+
+ switch (action)
+ {
+ case 0:
+ {
+ __transaction_relaxed
+ {
+ long bill = func2 ();
+ if (bill >= 0)
+ {
+ func1 ();
+ }
+ }
+ break;
+ }
+
+ case 1:
+ {
+ long n;
+ __transaction_relaxed
+ {
+ for (n = 0; n < 100; n++)
+ {
+ long t = types[n];
+ switch (t)
+ {
+ case 0:
+ func1 ();
+ break;
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/abort-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/abort-1.c
new file mode 100644
index 000000000..90830f41c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/abort-1.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+
+void f(void)
+{
+ __transaction_cancel; /* { dg-error "without transactional" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/abort-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/abort-2.c
new file mode 100644
index 000000000..727c63432
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/abort-2.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+int g;
+void f(void)
+{
+ __transaction_atomic {
+ if (g == 0)
+ __transaction_cancel;
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/abort-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/abort-3.c
new file mode 100644
index 000000000..f2cf5b5dc
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/abort-3.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+
+void f(void)
+{
+ __transaction_atomic { /* { dg-error "__transaction_atomic. without trans" } */
+ __transaction_cancel; /* { dg-error "_cancel. without trans" } */
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/atomic-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/atomic-1.c
new file mode 100644
index 000000000..e301f1f48
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/atomic-1.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+
+int g;
+void f(void)
+{
+ __transaction_atomic { /* { dg-error "without transactional memory" } */
+ g++;
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/atomic-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/atomic-2.c
new file mode 100644
index 000000000..f23276624
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/atomic-2.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+int g;
+void f(void)
+{
+ __transaction_atomic {
+ g++;
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/attrib-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/attrib-1.c
new file mode 100644
index 000000000..534fa0e9e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/attrib-1.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -ftrack-macro-expansion=0" } */
+
+#define TC __attribute__((transaction_callable))
+#define TU __attribute__((transaction_unsafe))
+#define TP __attribute__((transaction_pure))
+#define TS __attribute__((transaction_safe))
+extern void f1(void) TC;
+extern void f2(void) TU;
+extern void f3(void) TP;
+extern void f4(void) TS;
+
+extern void g1(void) TC TS; /* { dg-error "previously declared" } */
+
+extern int v1 TP; /* { dg-warning "ignored" } */
+
+typedef void t1(void) TC;
+typedef void (*t2)(void) TC;
+typedef int t3 TC; /* { dg-warning "ignored" } */
+
+typedef void u0(void);
+typedef u0 u1 TC;
+typedef u1 u2 TP; /* { dg-error "previously declared" } */
+typedef u0 *u3 TS;
+typedef u3 u4 TU; /* { dg-error "previously declared" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/cancel-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/cancel-1.c
new file mode 100644
index 000000000..6d60f2648
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/cancel-1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+void unsafe(void) __attribute__((transaction_unsafe));
+
+void
+f(void)
+{
+ int a;
+ __transaction_atomic {
+ a = 1;
+ __transaction_atomic {
+ __transaction_cancel;
+ }
+ }
+ unsafe();
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/freq.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/freq.c
new file mode 100644
index 000000000..31df167fa
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/freq.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O" } */
+
+extern __attribute__((transaction_safe)) void TMreleaseNode ();
+
+int global;
+
+__attribute__((transaction_safe))
+void
+TMrbtree_insert ()
+{
+ if (global)
+ TMreleaseNode();
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/inline-asm-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/inline-asm-2.c
new file mode 100644
index 000000000..7d429fbbc
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/inline-asm-2.c
@@ -0,0 +1,8 @@
+// { dg-do compile }
+// { dg-options "-fgnu-tm" }
+
+__attribute__((transaction_callable))
+void func()
+{
+ __asm__ ("");
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/inline-asm.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/inline-asm.c
new file mode 100644
index 000000000..eefd347dc
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/inline-asm.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O1" } */
+
+static inline void
+inline_death ()
+{
+ __asm__ (""); /* { dg-error "asm not allowed" } */
+}
+
+void
+tranfunction ()
+{
+ __transaction_atomic
+ {
+ inline_death ();
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/ipa-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/ipa-1.c
new file mode 100644
index 000000000..961f7fe79
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/ipa-1.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O -fdump-ipa-tmipa" } */
+
+int val, george;
+
+extern void func();
+
+int set_remove(void)
+{
+ int result = 8;
+ __transaction_atomic {
+ result = george;
+ if (val)
+ goto out;
+ }
+ out:
+ func();
+ return result;
+}
+
+
+/* { dg-final { scan-ipa-dump-not "getTMCloneOrIrrevocable" "tmipa" } } */
+/* { dg-final { cleanup-ipa-dump "tmipa" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/malloc.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/malloc.c
new file mode 100644
index 000000000..81bcc56fc
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/malloc.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-tree-tmmark" } */
+
+#include <stdlib.h>
+
+char *z;
+
+void foobar(void)
+{
+ char *p, *q;
+ __transaction_atomic {
+ p = (char *)malloc(123);
+ q = (char *)calloc(555,1);
+ free(q);
+ free(p);
+ }
+ z = (char *)malloc (666);
+}
+
+/* { dg-final { scan-tree-dump-times " malloc .666" 1 "tmmark" { target { ! { *-*-solaris2* && c++ } } } } } */
+/* Solaris 2 headers are C++-aware and declare std::malloc. */
+/* { dg-final { scan-tree-dump-times " std::malloc .666" 1 "tmmark" { target { *-*-solaris2* && c++ } } } } */
+/* { dg-final { scan-tree-dump-times "__builtin__ITM_malloc" 1 "tmmark" } } */
+/* { dg-final { scan-tree-dump-times "__builtin__ITM_calloc" 1 "tmmark" } } */
+/* { dg-final { scan-tree-dump-times "__builtin__ITM_free" 2 "tmmark" } } */
+/* { dg-final { cleanup-tree-dump "tmmark" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/memcpy-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/memcpy-1.c
new file mode 100644
index 000000000..873e14bb1
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/memcpy-1.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+typedef __SIZE_TYPE__ size_t;
+#ifdef __cplusplus
+extern "C"
+#endif
+void *memcpy (void *__restrict, const void *__restrict, size_t);
+
+__attribute__((transaction_safe))
+void *wmemcpy(void *dest, const void *src, size_t n)
+{
+ return memcpy(dest, src, n);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/omp.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/omp.c
new file mode 100644
index 000000000..b664a6f11
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/omp.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fopenmp" } */
+/* { dg-require-effective-target pthread } */
+
+__attribute__ ((transaction_pure))
+unsigned long rdtsc();
+
+typedef struct ENTER_EXIT_TIMES
+{
+ unsigned long enter;
+} times_t;
+
+void ParClassify()
+{
+ void * Parent;
+#pragma omp parallel private(Parent)
+ {
+ times_t inside;
+ __transaction_atomic {
+ inside.enter = rdtsc();
+ }
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/outer-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/outer-1.c
new file mode 100644
index 000000000..7dbf2e831
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/outer-1.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+void mco(void) __attribute__((transaction_may_cancel_outer));
+
+void
+f(void)
+{
+ mco(); /* { dg-error "" } */
+ __transaction_atomic {
+ mco(); /* { dg-error "" } */
+ }
+ __transaction_relaxed {
+ mco(); /* { dg-error "" } */
+ }
+ __transaction_atomic [[outer]] {
+ mco();
+ }
+}
+
+void __attribute__((transaction_may_cancel_outer))
+g(void)
+{
+ mco();
+ __transaction_atomic {
+ mco();
+ }
+ __transaction_atomic [[outer]] { /* { dg-error "" } */
+ mco();
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/pr54893.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/pr54893.c
new file mode 100644
index 000000000..8967f384a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/pr54893.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-ipa-tmipa" } */
+
+/* Test that volatiles are allowed inside relaxed transactions. */
+
+volatile int test_var = 0;
+
+int main()
+{
+ __transaction_relaxed {
+ test_var++;
+ }
+}
+
+/* { dg-final { scan-ipa-dump "GTMA_DOES_GO_IRREVOCABLE" "tmipa" } } */
+/* { dg-final { cleanup-ipa-dump "tmipa" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/safe-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/safe-1.c
new file mode 100644
index 000000000..b2a435305
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/safe-1.c
@@ -0,0 +1,69 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+void ts(void) __attribute__((transaction_safe));
+void tp(void) __attribute__((transaction_pure));
+void tc(void) __attribute__((transaction_callable));
+void ti(void) __attribute__((transaction_unsafe));
+void tm(void) __attribute__((transaction_may_cancel_outer));
+void tu(void);
+int fc(int) __attribute__((const));
+
+typedef void (*Fs) (void) __attribute__((transaction_safe));
+typedef void (*Fc) (void) __attribute__((transaction_callable));
+typedef void (*Fi) (void) __attribute__((transaction_unsafe));
+typedef void (*Fm) (void) __attribute__((transaction_may_cancel_outer));
+extern Fs ps;
+extern Fc pc;
+extern Fi pi;
+extern Fm pm;
+extern void (*pu)(void);
+
+int __attribute__((transaction_safe))
+foo(void)
+{
+ int i;
+
+ ts();
+ tp();
+ tc(); /* { dg-error "unsafe function call" } */
+ ti(); /* { dg-error "unsafe function call" } */
+
+ /* ??? Direct function calls without markups are handled later
+ than pass_diagnose_tm_blocks, which means we'll exit with
+ errors before getting there. This test moved to safe-3.c. */
+ /* tu(); */
+
+ (*ps)();
+ (*pc)(); /* { dg-error "unsafe function call" } */
+ (*pi)(); /* { dg-error "unsafe function call" } */
+ (*pu)(); /* { dg-error "unsafe function call" } */
+
+ asm(""); /* { dg-error "asm not allowed" } */
+ asm("" : "=g"(i)); /* { dg-error "asm not allowed" } */
+
+ return fc(i);
+}
+
+int __attribute__((transaction_may_cancel_outer))
+bar(void)
+{
+ int i;
+
+ ts();
+ tp();
+ tc(); /* { dg-error "unsafe function call" } */
+ ti(); /* { dg-error "unsafe function call" } */
+ tm();
+
+ (*ps)();
+ (*pc)(); /* { dg-error "unsafe function call" } */
+ (*pi)(); /* { dg-error "unsafe function call" } */
+ (*pm)();
+ (*pu)(); /* { dg-error "unsafe function call" } */
+
+ asm(""); /* { dg-error "asm not allowed" } */
+ asm("" : "=g"(i)); /* { dg-error "asm not allowed" } */
+
+ return fc(i);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/safe-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/safe-2.c
new file mode 100644
index 000000000..a6729ba42
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/safe-2.c
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+void mco(void) __attribute__((transaction_may_cancel_outer));
+
+void
+f(void)
+{
+ mco(); /* { dg-error "" } */
+ __transaction_atomic {
+ mco(); /* { dg-error "" } */
+ }
+ __transaction_relaxed {
+ mco(); /* { dg-error "" } */
+ }
+ __transaction_atomic [[outer]] {
+ mco();
+ }
+ __transaction_atomic [[outer]] {
+ __transaction_atomic {
+ __transaction_atomic {
+ __transaction_atomic {
+ mco();
+ }
+ }
+ }
+ }
+}
+
+void __attribute__((transaction_may_cancel_outer))
+g(void)
+{
+ mco();
+ __transaction_atomic {
+ __transaction_atomic {
+ __transaction_atomic {
+ __transaction_atomic {
+ mco();
+ }
+ }
+ }
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/safe-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/safe-3.c
new file mode 100644
index 000000000..8a883db5e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/safe-3.c
@@ -0,0 +1,48 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+void f_extern (void);
+void f_first (void);
+void f_later (void);
+
+extern int x;
+
+void f_first (void) { x++; }
+
+void __attribute__((transaction_safe))
+test_safe (void)
+{
+ f_extern (); /* { dg-error "unsafe function call" } */
+ f_first ();
+ f_later ();
+}
+
+void __attribute__((transaction_may_cancel_outer))
+test_mco (void)
+{
+ f_extern (); /* { dg-error "unsafe function call" } */
+ f_first ();
+ f_later ();
+}
+
+void
+test_atomic (void)
+{
+ __transaction_atomic {
+ f_extern (); /* { dg-error "unsafe function call" } */
+ f_first ();
+ f_later ();
+ }
+ __transaction_relaxed {
+ f_extern ();
+ f_first ();
+ f_later ();
+ }
+ __transaction_atomic [[outer]] {
+ f_extern (); /* { dg-error "unsafe function call" } */
+ f_first ();
+ f_later ();
+ }
+}
+
+void f_later () { f_first(); test_safe(); }
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/trxn-expr-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/trxn-expr-2.c
new file mode 100644
index 000000000..0ef6526db
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/trxn-expr-2.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* Make sure that we don't just crash without -fgnu-tm enabled. */
+/* { dg-options "" } */
+
+int x;
+
+int foo(void)
+{
+ return __transaction_atomic (x + 1); /* { dg-error "" } */
+}
+
+int bar(void)
+{
+ return __transaction_relaxed (x + 1); /* { dg-error "" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/trxn-expr-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/trxn-expr-3.c
new file mode 100644
index 000000000..db66873dc
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/trxn-expr-3.c
@@ -0,0 +1,14 @@
+// { dg-do compile }
+// { dg-options "-fgnu-tm -O -fdump-tree-tmmark" }
+
+int global;
+
+int f2()
+{
+ return __transaction_atomic (global + 3)
+ + __transaction_atomic (global + 4);
+}
+
+/* { dg-final { scan-tree-dump-times "ITM_RU" 2 "tmmark" } } */
+/* { dg-final { scan-tree-dump-times "ITM_commitTransaction" 4 "tmmark" } } */
+/* { dg-final { cleanup-tree-dump "tmmark" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/trxn-expr.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/trxn-expr.c
new file mode 100644
index 000000000..53d4677e3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/trxn-expr.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-tree-tmmark" } */
+
+int y, x, york;
+
+void foobar(void)
+{
+ x = y + __transaction_atomic (york);
+}
+
+/* { dg-final { scan-tree-dump-times "_ITM_RU.*york" 1 "tmmark" } } */
+/* { dg-final { scan-tree-dump-times "_ITM_RU" 1 "tmmark" } } */
+/* { dg-final { cleanup-tree-dump "tmmark" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tm/wrap-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/tm/wrap-1.c
new file mode 100644
index 000000000..04b5b6f0d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tm/wrap-1.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-tree-optimized" } */
+
+void orig(void);
+void xyzzy(void) __attribute__((transaction_wrap (orig)));
+
+void foo() { __transaction_relaxed { orig (); } }
+
+/* { dg-final { scan-tree-dump-times "xyzzy" 1 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-alias-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-alias-1.c
new file mode 100644
index 000000000..cdf832d63
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-alias-1.c
@@ -0,0 +1,35 @@
+/* Accesses to complex numbers were sometimes marked as scalar and
+ sometimes as struct accesses. */
+/* { dg-do run } */
+/* { dg-options "-std=c99" { target c } } */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern void abort (void);
+#ifdef __cplusplus
+}
+#endif
+static double _Complex *fp_cxd(double _Complex *cx) {
+ return cx;
+}
+
+int main( ) {
+ double _Complex cx = 4.0 + 3.0*(__extension__ 1.0iF);
+ double _Complex cx43 = 4.0 + 3.0*(__extension__ 1.0iF);
+ double _Complex cx11 = 1.0 + 1.0*(__extension__ 1.0iF);
+
+ *fp_cxd(&cx) *= cx11;
+ *fp_cxd(&cx) /= cx11;
+
+ double r_cx = __real__(cx);
+ double i_cx = __imag__(cx);
+ double r_cx43 = __real__(cx43);
+ double i_cx43 = __imag__(cx43);
+
+ if( (r_cx == r_cx43) && (i_cx == i_cx43) ) {
+ return 0;
+ } else {
+ abort ();
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-add.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-add.c
new file mode 100644
index 000000000..bcaf8bba9
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-add.c
@@ -0,0 +1,55 @@
+/* Test complex arithmetic with signed zeros. Pure complex
+ addition. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" { target c } } */
+
+#include "complex-sign.h"
+
+#define CHECK_ADD(TYPE, COPY, ZERO, ZEROI) \
+ do { \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, +, +, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, +, +, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, +, -, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, +, -, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, -, +, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, -, +, -, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, -, -, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, -, -, -, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, +, +, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, +, +, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, +, -, +, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, +, -, -, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, -, +, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, -, +, -, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, -, -, +, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, -, -, -, -, -); \
+ } while (0)
+
+void
+check_add_float (void)
+{
+#ifndef __SPU__
+ CHECK_ADD (float, __builtin_copysignf, 0.0f, 0.0if);
+#endif
+}
+
+void
+check_add_double (void)
+{
+ CHECK_ADD (double, __builtin_copysign, 0.0, 0.0i);
+}
+
+void
+check_add_long_double (void)
+{
+ CHECK_ADD (long double, __builtin_copysignl, 0.0l, 0.0il);
+}
+
+int
+main (void)
+{
+ check_add_float ();
+ check_add_double ();
+ check_add_long_double ();
+ exit (0);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-add.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-add.c
new file mode 100644
index 000000000..caea562e8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-add.c
@@ -0,0 +1,55 @@
+/* Test complex arithmetic with signed zeros. Mixed real/complex
+ addition. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" { target c } } */
+
+#include "complex-sign.h"
+
+#define CHECK_ADD(TYPE, COPY, ZERO, ZEROI) \
+ do { \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, +, +, +, +, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, +, +, -, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, +, -, +, +, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, +, -, -, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, -, +, +, +, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, -, +, -, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, -, -, +, -, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, -, -, -, -, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, +, +, +, ZERO, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, +, +, -, ZERO, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, +, -, +, ZERO, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, +, -, -, ZERO, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, -, +, +, ZERO, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, -, +, -, ZERO, -, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, -, -, +, ZERO, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, -, -, -, ZERO, -, -); \
+ } while (0)
+
+void
+check_add_float (void)
+{
+#ifndef __SPU__
+ CHECK_ADD (float, __builtin_copysignf, 0.0f, 0.0if);
+#endif
+}
+
+void
+check_add_double (void)
+{
+ CHECK_ADD (double, __builtin_copysign, 0.0, 0.0i);
+}
+
+void
+check_add_long_double (void)
+{
+ CHECK_ADD (long double, __builtin_copysignl, 0.0l, 0.0il);
+}
+
+int
+main (void)
+{
+ check_add_float ();
+ check_add_double ();
+ check_add_long_double ();
+ exit (0);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-div.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-div.c
new file mode 100644
index 000000000..269d5ec42
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-div.c
@@ -0,0 +1,47 @@
+/* Test complex arithmetic with signed zeros. Mixed real/complex
+ division. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" { target c } } */
+
+#include "complex-sign.h"
+
+#define CHECK_DIV(TYPE, COPY, ZERO, ZEROI, ONE) \
+ do { \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, +, +, +, ONE, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, +, +, -, ONE, -, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, +, -, +, ONE, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, +, -, -, ONE, -, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, -, +, +, ONE, -, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, -, +, -, ONE, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, -, -, +, ONE, -, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, -, -, -, ONE, +, +); \
+ } while (0)
+
+void
+check_div_float (void)
+{
+#ifndef __SPU__
+ CHECK_DIV (float, __builtin_copysignf, 0.0f, 0.0if, 1.0f);
+#endif
+}
+
+void
+check_div_double (void)
+{
+ CHECK_DIV (double, __builtin_copysign, 0.0, 0.0i, 1.0);
+}
+
+void
+check_div_long_double (void)
+{
+ CHECK_DIV (long double, __builtin_copysignl, 0.0l, 0.0il, 1.0l);
+}
+
+int
+main (void)
+{
+ check_div_float ();
+ check_div_double ();
+ check_div_long_double ();
+ exit (0);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-mul.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-mul.c
new file mode 100644
index 000000000..e79db6d45
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-mul.c
@@ -0,0 +1,55 @@
+/* Test complex arithmetic with signed zeros. Mixed real/complex
+ multiplication. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" { target c } } */
+
+#include "complex-sign.h"
+
+#define CHECK_MUL(TYPE, COPY, ZERO, ZEROI) \
+ do { \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, +, +, +, +, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, +, +, -, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, +, -, +, -, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, +, -, -, -, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, -, +, +, -, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, -, +, -, -, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, -, -, +, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, -, -, -, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, +, +, +, ZERO, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, +, +, -, ZERO, -, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, +, -, +, ZERO, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, +, -, -, ZERO, -, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, -, +, +, ZERO, -, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, -, +, -, ZERO, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, -, -, +, ZERO, -, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, -, -, -, ZERO, +, +); \
+ } while (0)
+
+void
+check_mul_float (void)
+{
+#ifndef __SPU__
+ CHECK_MUL (float, __builtin_copysignf, 0.0f, 0.0if);
+#endif
+}
+
+void
+check_mul_double (void)
+{
+ CHECK_MUL (double, __builtin_copysign, 0.0, 0.0i);
+}
+
+void
+check_mul_long_double (void)
+{
+ CHECK_MUL (long double, __builtin_copysignl, 0.0l, 0.0il);
+}
+
+int
+main (void)
+{
+ check_mul_float ();
+ check_mul_double ();
+ check_mul_long_double ();
+ exit (0);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-sub.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-sub.c
new file mode 100644
index 000000000..d9e083cfd
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-sub.c
@@ -0,0 +1,55 @@
+/* Test complex arithmetic with signed zeros. Mixed real/complex
+ subtraction. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" { target c } } */
+
+#include "complex-sign.h"
+
+#define CHECK_SUB(TYPE, COPY, ZERO, ZEROI) \
+ do { \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, +, +, +, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, +, +, -, +, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, +, -, +, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, +, -, -, +, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, -, +, +, -, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, -, +, -, -, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, -, -, +, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, -, -, -, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, +, +, +, ZERO, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, +, +, -, ZERO, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, +, -, +, ZERO, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, +, -, -, ZERO, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, -, +, +, ZERO, -, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, -, +, -, ZERO, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, -, -, +, ZERO, -, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, -, -, -, ZERO, +, -); \
+ } while (0)
+
+void
+check_sub_float (void)
+{
+#ifndef __SPU__
+ CHECK_SUB (float, __builtin_copysignf, 0.0f, 0.0if);
+#endif
+}
+
+void
+check_sub_double (void)
+{
+ CHECK_SUB (double, __builtin_copysign, 0.0, 0.0i);
+}
+
+void
+check_sub_long_double (void)
+{
+ CHECK_SUB (long double, __builtin_copysignl, 0.0l, 0.0il);
+}
+
+int
+main (void)
+{
+ check_sub_float ();
+ check_sub_double ();
+ check_sub_long_double ();
+ exit (0);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mul-minus-one.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mul-minus-one.c
new file mode 100644
index 000000000..d20b5e6c8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mul-minus-one.c
@@ -0,0 +1,63 @@
+/* Test complex arithmetic with signed zeros. Pure complex
+ multiplication with -1.0 + 0.0i. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" { target c } } */
+
+#include "complex-sign.h"
+
+#define CHECK_MUL_INT(TYPE, COPY, ZERO, ZEROI, ONE, S1, S2, SR, SI) \
+ do { \
+ _Complex TYPE a1, b1, c1; \
+ volatile _Complex TYPE a2, b2, c2; \
+ a1 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a1, COPY, S1, S2); \
+ b1 = -ONE + ZEROI; \
+ c1 = a1 * b1; \
+ CHECK_RES (c1, COPY, SR, SI); \
+ c1 = a1 * (-ONE + ZEROI); \
+ CHECK_RES (c1, COPY, SR, SI); \
+ a2 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a2, COPY, S1, S2); \
+ b2 = -ONE + ZEROI; \
+ c2 = a2 * b2; \
+ CHECK_RES (c2, COPY, SR, SI); \
+ c2 = a2 * (-ONE + ZEROI); \
+ CHECK_RES (c2, COPY, SR, SI); \
+ } while (0)
+
+#define CHECK_MUL(TYPE, COPY, ZERO, ZEROI, ONE) \
+ do { \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, +, +, -, +); \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, +, -, +, +); \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, -, +, +, -); \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, -, -, +, +); \
+ } while (0)
+
+void
+check_mul_float (void)
+{
+#ifndef __SPU__
+ CHECK_MUL (float, __builtin_copysignf, 0.0f, 0.0if, 1.0f);
+#endif
+}
+
+void
+check_mul_double (void)
+{
+ CHECK_MUL (double, __builtin_copysign, 0.0, 0.0i, 1.0);
+}
+
+void
+check_mul_long_double (void)
+{
+ CHECK_MUL (long double, __builtin_copysignl, 0.0l, 0.0il, 1.0l);
+}
+
+int
+main (void)
+{
+ check_mul_float ();
+ check_mul_double ();
+ check_mul_long_double ();
+ exit (0);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mul-one.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mul-one.c
new file mode 100644
index 000000000..ad02a2cd6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mul-one.c
@@ -0,0 +1,63 @@
+/* Test complex arithmetic with signed zeros. Pure complex
+ multiplication with 1.0 + 0.0i. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" { target c } } */
+
+#include "complex-sign.h"
+
+#define CHECK_MUL_INT(TYPE, COPY, ZERO, ZEROI, ONE, S1, S2, SR, SI) \
+ do { \
+ _Complex TYPE a1, b1, c1; \
+ volatile _Complex TYPE a2, b2, c2; \
+ a1 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a1, COPY, S1, S2); \
+ b1 = ONE + ZEROI; \
+ c1 = a1 * b1; \
+ CHECK_RES (c1, COPY, SR, SI); \
+ c1 = a1 * (ONE + ZEROI); \
+ CHECK_RES (c1, COPY, SR, SI); \
+ a2 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a2, COPY, S1, S2); \
+ b2 = ONE + ZEROI; \
+ c2 = a2 * b2; \
+ CHECK_RES (c2, COPY, SR, SI); \
+ c2 = a2 * (ONE + ZEROI); \
+ CHECK_RES (c2, COPY, SR, SI); \
+ } while (0)
+
+#define CHECK_MUL(TYPE, COPY, ZERO, ZEROI, ONE) \
+ do { \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, +, +, +, +); \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, +, -, +, +); \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, -, +, -, +); \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, -, -, +, -); \
+ } while (0)
+
+void
+check_mul_float (void)
+{
+#ifndef __SPU__
+ CHECK_MUL (float, __builtin_copysignf, 0.0f, 0.0if, 1.0f);
+#endif
+}
+
+void
+check_mul_double (void)
+{
+ CHECK_MUL (double, __builtin_copysign, 0.0, 0.0i, 1.0);
+}
+
+void
+check_mul_long_double (void)
+{
+ CHECK_MUL (long double, __builtin_copysignl, 0.0l, 0.0il, 1.0l);
+}
+
+int
+main (void)
+{
+ check_mul_float ();
+ check_mul_double ();
+ check_mul_long_double ();
+ exit (0);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mul.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mul.c
new file mode 100644
index 000000000..a3274d2ea
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-mul.c
@@ -0,0 +1,55 @@
+/* Test complex arithmetic with signed zeros. Pure complex
+ multiplication. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" { target c } } */
+
+#include "complex-sign.h"
+
+#define CHECK_MUL(TYPE, COPY, ZERO, ZEROI) \
+ do { \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, +, +, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, +, +, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, +, -, +, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, +, -, -, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, -, +, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, -, +, -, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, -, -, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, -, -, -, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, +, +, +, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, +, +, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, +, -, +, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, +, -, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, -, +, +, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, -, +, -, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, -, -, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, -, -, -, +, +); \
+ } while (0)
+
+void
+check_mul_float (void)
+{
+#ifndef __SPU__
+ CHECK_MUL (float, __builtin_copysignf, 0.0f, 0.0if);
+#endif
+}
+
+void
+check_mul_double (void)
+{
+ CHECK_MUL (double, __builtin_copysign, 0.0, 0.0i);
+}
+
+void
+check_mul_long_double (void)
+{
+ CHECK_MUL (long double, __builtin_copysignl, 0.0l, 0.0il);
+}
+
+int
+main (void)
+{
+ check_mul_float ();
+ check_mul_double ();
+ check_mul_long_double ();
+ exit (0);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-sub.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-sub.c
new file mode 100644
index 000000000..0a4e3029e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign-sub.c
@@ -0,0 +1,55 @@
+/* Test complex arithmetic with signed zeros. Pure complex
+ subtraction. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" { target c } } */
+
+#include "complex-sign.h"
+
+#define CHECK_SUB(TYPE, COPY, ZERO, ZEROI) \
+ do { \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, +, +, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, +, +, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, +, -, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, +, -, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, -, +, +, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, -, +, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, -, -, +, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, -, -, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, +, +, +, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, +, +, -, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, +, -, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, +, -, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, -, +, +, -, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, -, +, -, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, -, -, +, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, -, -, -, +, +); \
+ } while (0)
+
+void
+check_sub_float (void)
+{
+#ifndef __SPU__
+ CHECK_SUB (float, __builtin_copysignf, 0.0f, 0.0if);
+#endif
+}
+
+void
+check_sub_double (void)
+{
+ CHECK_SUB (double, __builtin_copysign, 0.0, 0.0i);
+}
+
+void
+check_sub_long_double (void)
+{
+ CHECK_SUB (long double, __builtin_copysignl, 0.0l, 0.0il);
+}
+
+int
+main (void)
+{
+ check_sub_float ();
+ check_sub_double ();
+ check_sub_long_double ();
+ exit (0);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign.h b/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign.h
new file mode 100644
index 000000000..96261101c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/complex-sign.h
@@ -0,0 +1,80 @@
+/* Common header for complex arithmetic sign tests. */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern void abort (void);
+extern void exit (int);
+#ifdef __cplusplus
+}
+#endif
+
+#define CHECK_RES(VALUE, COPY, SIGN_REAL, SIGN_IMAG) \
+ do { \
+ if ((VALUE) != 0 \
+ || COPY (1.0, __real__ (VALUE)) != SIGN_REAL 1.0 \
+ || COPY (1.0, __imag__ (VALUE)) != SIGN_IMAG 1.0) \
+ abort (); \
+ } while (0)
+
+/* This definition is intended to work with or without imaginary
+ types, as long as mixed real/complex arithmetic is handled
+ correctly. */
+#define ENCODE(ZERO, ZEROI, SA, SB) \
+ (SA 1 == 1 \
+ ? SB 1 == 1 ? ZERO + ZEROI : ZERO - ZEROI \
+ : SB 1 == 1 ? -(ZERO - ZEROI) : -(ZERO + ZEROI))
+
+#define CHECK_ARITH(TYPE, COPY, ZERO, ZEROI, OP, S1, S2, S3, S4, SR, SI) \
+ do { \
+ _Complex TYPE a1, b1, c1; \
+ volatile _Complex TYPE a2, b2, c2; \
+ a1 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a1, COPY, S1, S2); \
+ b1 = ENCODE(ZERO, ZEROI, S3, S4); \
+ CHECK_RES (b1, COPY, S3, S4); \
+ c1 = a1 OP b1; \
+ CHECK_RES (c1, COPY, SR, SI); \
+ a2 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a2, COPY, S1, S2); \
+ b2 = ENCODE(ZERO, ZEROI, S3, S4); \
+ CHECK_RES (b2, COPY, S3, S4); \
+ c2 = a2 OP b2; \
+ CHECK_RES (c2, COPY, SR, SI); \
+ } while (0)
+
+#define CHECK_ARITH_RC(TYPE, COPY, ZERO, ZEROI, OP, S1, S3, S4, SR, SI) \
+ do { \
+ TYPE a1; \
+ _Complex TYPE b1, c1; \
+ volatile TYPE a2; \
+ volatile _Complex TYPE b2, c2; \
+ a1 = S1 ZERO; \
+ b1 = ENCODE(ZERO, ZEROI, S3, S4); \
+ CHECK_RES (b1, COPY, S3, S4); \
+ c1 = a1 OP b1; \
+ CHECK_RES (c1, COPY, SR, SI); \
+ a2 = S1 ZERO; \
+ b2 = ENCODE(ZERO, ZEROI, S3, S4); \
+ CHECK_RES (b2, COPY, S3, S4); \
+ c2 = a2 OP b2; \
+ CHECK_RES (c2, COPY, SR, SI); \
+ } while (0)
+
+#define CHECK_ARITH_CR(TYPE, COPY, ZERO, ZEROI, OP, S1, S2, S3, V3, SR, SI) \
+ do { \
+ _Complex TYPE a1, c1; \
+ TYPE b1; \
+ volatile _Complex TYPE a2, c2; \
+ volatile TYPE b2; \
+ a1 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a1, COPY, S1, S2); \
+ b1 = S3 V3; \
+ c1 = a1 OP b1; \
+ CHECK_RES (c1, COPY, SR, SI); \
+ a2 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a2, COPY, S1, S2); \
+ b2 = S3 V3; \
+ c2 = a2 OP b2; \
+ CHECK_RES (c2, COPY, SR, SI); \
+ } while (0)
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr42834.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr42834.c
new file mode 100644
index 000000000..a1ba49e46
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr42834.c
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+
+void __attribute__((noinline,noclone))
+foo(int *p, float *q) { __asm__ volatile ("" : : : "memory"); }
+
+int main()
+{
+ if (sizeof (int) == sizeof (float))
+ {
+ int i;
+ float f;
+ int *p;
+ /* Prevent i and f from being rewritten into SSA form. */
+ foo (&i, &f);
+ i = 0;
+ f = 1.0;
+ p = (int *)&f;
+ __builtin_memcpy (&i, p, 4);
+ if (*(float *)&i != 1.0)
+ __builtin_abort ();
+ }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr46137.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr46137.c
new file mode 100644
index 000000000..3e44ff6b7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr46137.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+struct X { };
+
+static inline void *
+bar (void *dst, void *src)
+{
+ return __builtin___memcpy_chk (dst, src, sizeof (struct X),
+ __builtin_object_size (dst, 0));
+}
+
+struct X
+foo (struct X *x)
+{
+ struct X any;
+ bar (&any, x);
+ return any;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr53505.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr53505.c
new file mode 100644
index 000000000..922711025
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr53505.c
@@ -0,0 +1,42 @@
+/* PR tree-optimization/53505 */
+/* { dg-do run } */
+
+#include <stdbool.h>
+
+struct A
+{
+ unsigned int a;
+ unsigned char c1, c2;
+ bool b1 : 1;
+ bool b2 : 1;
+ bool b3 : 1;
+};
+
+void
+foo (const struct A *x, int y)
+{
+ int s = 0, i;
+ for (i = 0; i < y; ++i)
+ {
+ const struct A a = x[i];
+ s += a.b1 ? 1 : 0;
+ }
+ if (s != 0)
+ __builtin_abort ();
+}
+
+int
+main ()
+{
+ struct A x[100];
+ int i;
+ __builtin_memset (x, -1, sizeof (x));
+ for (i = 0; i < 100; i++)
+ {
+ x[i].b1 = false;
+ x[i].b2 = false;
+ x[i].b3 = false;
+ }
+ foo (x, 100);
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr57945.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr57945.c
new file mode 100644
index 000000000..0803e8ff2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr57945.c
@@ -0,0 +1,11 @@
+/* PR c++/57945 */
+/* { dg-do compile } */
+
+extern int j;
+static int i __attribute__((weakref("j")));
+
+int
+foo (void)
+{
+ return &i ? i : 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr58794-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr58794-1.c
new file mode 100644
index 000000000..175629fec
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr58794-1.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+
+struct S0
+{
+ int f;
+};
+
+struct S1
+{
+ struct S0 f1;
+ volatile int f2;
+};
+
+struct S2
+{
+ struct S1 g;
+} a, b;
+
+static int *c[1][2] = {{0, (int *)&a.g.f2}};
+static int d;
+
+int
+main ()
+{
+ for (d = 0; d < 1; d++)
+ for (b.g.f1.f = 0; b.g.f1.f < 1; b.g.f1.f++)
+ *c[b.g.f1.f][d + 1] = 0;
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr58794-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr58794-2.c
new file mode 100644
index 000000000..767798806
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr58794-2.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+struct S
+{
+ volatile int f;
+} a;
+
+unsigned int b;
+
+static int *c[1][2] = {{0, (int *)&a.f}};
+static unsigned int d;
+
+int
+main ()
+{
+ for (; d < 1; d++)
+ for (; b < 1; b++)
+ *c[b][d + 1] = 0;
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr60026.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr60026.c
new file mode 100644
index 000000000..1cc5f55a4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/pr60026.c
@@ -0,0 +1,28 @@
+/* PR ipa/60026 */
+/* { dg-do compile } */
+
+struct S { int f; } a;
+
+__attribute__((optimize (0)))
+struct S foo (int x, struct S y)
+{
+ int b = y.f;
+ return a;
+}
+
+void
+bar ()
+{
+ while (a.f)
+ {
+ struct S c = {0};
+ foo (0, c);
+ }
+}
+
+int
+main ()
+{
+ bar ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-compare-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-compare-1.c
new file mode 100644
index 000000000..4cdfcf718
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-compare-1.c
@@ -0,0 +1,124 @@
+/* { dg-do run } */
+#define vector(elcount, type) \
+__attribute__((vector_size((elcount)*sizeof(type)))) type
+
+#define check_compare(count, res, i0, i1, op, fmt) \
+do { \
+ int __i; \
+ for (__i = 0; __i < count; __i ++) { \
+ if ((res)[__i] != ((i0)[__i] op (i1)[__i] ? -1 : 0)) \
+ { \
+ __builtin_printf ("%i != ((" fmt " " #op " " fmt " ? -1 : 0) ", \
+ (res)[__i], (i0)[__i], (i1)[__i]); \
+ __builtin_abort (); \
+ } \
+ } \
+} while (0)
+
+#define test(count, v0, v1, res, fmt); \
+do { \
+ res = (v0 > v1); \
+ check_compare (count, res, v0, v1, >, fmt); \
+ res = (v0 < v1); \
+ check_compare (count, res, v0, v1, <, fmt); \
+ res = (v0 >= v1); \
+ check_compare (count, res, v0, v1, >=, fmt); \
+ res = (v0 <= v1); \
+ check_compare (count, res, v0, v1, <=, fmt); \
+ res = (v0 == v1); \
+ check_compare (count, res, v0, v1, ==, fmt); \
+ res = (v0 != v1); \
+ check_compare (count, res, v0, v1, !=, fmt); \
+} while (0)
+
+
+int main (int argc, char *argv[]) {
+#define INT int
+ vector (4, INT) i0;
+ vector (4, INT) i1;
+ vector (4, int) ires;
+ int i;
+
+ i0 = (vector (4, INT)){(INT)argc, 1, 2, 10};
+ i1 = (vector (4, INT)){0, 3, 2, (INT)-23};
+ test (4, i0, i1, ires, "%i");
+#undef INT
+
+#define INT unsigned int
+ vector (4, int) ures;
+ vector (4, INT) u0;
+ vector (4, INT) u1;
+
+ u0 = (vector (4, INT)){(INT)argc, 1, 2, 10};
+ u1 = (vector (4, INT)){0, 3, 2, (INT)-23};
+ test (4, u0, u1, ures, "%u");
+#undef INT
+
+
+#define SHORT short
+ vector (8, SHORT) s0;
+ vector (8, SHORT) s1;
+ vector (8, short) sres;
+
+ s0 = (vector (8, SHORT)){(SHORT)argc, 1, 2, 10, 6, 87, (SHORT)-5, 2};
+ s1 = (vector (8, SHORT)){0, 3, 2, (SHORT)-23, 12, 10, (SHORT)-2, 0};
+ test (8, s0, s1, sres, "%i");
+#undef SHORT
+
+#define SHORT unsigned short
+ vector (8, SHORT) us0;
+ vector (8, SHORT) us1;
+ vector (8, short) usres;
+
+ us0 = (vector (8, SHORT)){(SHORT)argc, 1, 2, 10, 6, 87, (SHORT)-5, 2};
+ us1 = (vector (8, SHORT)){0, 3, 2, (SHORT)-23, 12, 10, (SHORT)-2, 0};
+ test (8, us0, us1, usres, "%u");
+#undef SHORT
+
+#define CHAR signed char
+ vector (16, CHAR) c0;
+ vector (16, CHAR) c1;
+ vector (16, signed char) cres;
+
+ c0 = (vector (16, CHAR)){(CHAR)argc, 1, 2, 10, 6, 87, (CHAR)-5, 2, \
+ (CHAR)argc, 1, 2, 10, 6, 87, (CHAR)-5, 2 };
+
+ c1 = (vector (16, CHAR)){0, 3, 2, (CHAR)-23, 12, 10, (CHAR)-2, 0, \
+ 0, 3, 2, (CHAR)-23, 12, 10, (CHAR)-2, 0};
+ test (16, c0, c1, cres, "%i");
+#undef CHAR
+
+#define CHAR unsigned char
+ vector (16, CHAR) uc0;
+ vector (16, CHAR) uc1;
+ vector (16, signed char) ucres;
+
+ uc0 = (vector (16, CHAR)){(CHAR)argc, 1, 2, 10, 6, 87, (CHAR)-5, 2, \
+ (CHAR)argc, 1, 2, 10, 6, 87, (CHAR)-5, 2 };
+
+ uc1 = (vector (16, CHAR)){0, 3, 2, (CHAR)-23, 12, 10, (CHAR)-2, 0, \
+ 0, 3, 2, (CHAR)-23, 12, 10, (CHAR)-2, 0};
+ test (16, uc0, uc1, ucres, "%u");
+#undef CHAR
+/* Float comparison. */
+ vector (4, float) f0;
+ vector (4, float) f1;
+ __typeof (f0 == f1) ifres;
+
+ f0 = (vector (4, float)){(float)argc, 1., 2., 10.};
+ f1 = (vector (4, float)){0., 3., 2., (float)-23};
+ test (4, f0, f1, ifres, "%f");
+
+/* Double comparison. */
+ vector (2, double) d0;
+ vector (2, double) d1;
+ __typeof (d0 == d1) idres;
+
+ d0 = (vector (2, double)){(double)argc, 10.};
+ d1 = (vector (2, double)){0., (double)-23};
+ test (2, d0, d1, idres, "%f");
+
+
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-compare-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-compare-2.c
new file mode 100644
index 000000000..628a69903
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-compare-2.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-options "-Wno-psabi -w" } */
+#define vector(elcount, type) \
+__attribute__((vector_size((elcount)*sizeof(type)))) type
+
+/* Check that constant folding in
+ these simple cases works. */
+vector (4, int)
+foo (vector (4, int) x)
+{
+ return (x == x) + (x != x) + (x > x)
+ + (x < x) + (x >= x) + (x <= x);
+}
+
+int
+main (int argc, char *argv[])
+{
+ vector (4, int) t = {argc, 2, argc, 42};
+ vector (4, int) r;
+ int i;
+
+ r = foo (t);
+
+ for (i = 0; i < 4; i++)
+ if (r[i] != -3)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-shift.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-shift.c
new file mode 100644
index 000000000..f690b7c3d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-shift.c
@@ -0,0 +1,49 @@
+/* { dg-do run } */
+
+#define vector __attribute__((vector_size(sizeof(int)*4) ))
+
+static vector int allones = {1, 1, 1, 1};
+static vector int allzeros = {0, 0, 0, 0};
+static vector int numbers = {0, 1, 2, 3};
+static vector int numbersleftshiftallones = {0, 2, 4, 6};
+static vector int numbersrightshiftallones = {0, 0, 1, 1};
+
+
+static vector unsigned int uallones = {1, 1, 1, 1};
+static vector unsigned int uallzeros = {0, 0, 0, 0};
+static vector unsigned int unumbers = {0, 1, 2, 3};
+static vector unsigned int unumbersleftshiftallones = {0, 2, 4, 6};
+static vector unsigned int unumbersrightshiftallones = {0, 0, 1, 1};
+
+#define TEST(result, expected) \
+do { \
+ __typeof__(result) result1 = result; \
+ if(sizeof (result1) != sizeof (expected)) \
+ __builtin_abort (); \
+ if (__builtin_memcmp (&result1, &expected, sizeof(result1)) != 0) \
+ __builtin_abort (); \
+}while (0);
+
+int main(void)
+{
+ vector int result;
+ TEST ((numbers << allzeros), numbers);
+ TEST ((numbers >> allzeros), numbers);
+ TEST((numbers << allones), numbersleftshiftallones);
+ TEST((numbers >> allones), numbersrightshiftallones);
+ /* Test left shift followed by a right shift, numbers should be back as
+ numbers are all small numbers and no lose of precision happens. */
+ TEST((numbers << allones) >> allones, numbers);
+
+
+
+ TEST ((unumbers << uallzeros), unumbers);
+ TEST ((unumbers >> uallzeros), unumbers);
+ TEST((unumbers << uallones), unumbersleftshiftallones);
+ TEST((unumbers >> uallones), unumbersrightshiftallones);
+ /* Test left shift followed by a right shift, numbers should be back as
+ numbers are all small numbers and no lose of precision happens. */
+ TEST((unumbers << uallones) >> uallones, unumbers);
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-shift1.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-shift1.c
new file mode 100644
index 000000000..e6e31daf5
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-shift1.c
@@ -0,0 +1,18 @@
+/* { dg-do run } */
+#define vector __attribute__((vector_size(8*sizeof(short))))
+
+int main (int argc, char *argv[]) {
+ vector short v0 = {argc,2,3,4,5,6,7};
+ vector short v1 = {2,2,2,2,2,2,2};
+ vector short r1,r2,r3,r4;
+ int i = 8;
+
+ r1 = v0 << 1;
+ r2 = v0 >> 1;
+
+ r3 = v0 << v1;
+ r4 = v0 >> v1;
+
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-shift2.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-shift2.c
new file mode 100644
index 000000000..d3a2ef87c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-shift2.c
@@ -0,0 +1,60 @@
+/* { dg-do run } */
+#define vector(elcount, type) \
+__attribute__((vector_size((elcount)*sizeof(type)))) type
+
+#define vidx(type, vec, idx) (*((type *) &(vec) + idx))
+#define uint unsigned int
+
+int main (int argc, char *argv[]) {
+ vector(4, uint) vuint = { 1, 2, 3, 4};
+ vector(4, int) vint0 = { 1, 1, 1, 1};
+ vector(4, int) vint1 = {-1, -1, -1, -1};
+
+ vector(4, int) i1, i2, i3;
+ vector(4, uint) u1, u2, u3;
+
+ i1 = vint1<< vint0;
+
+ if (vidx(int, i1, 0) != ((int)-1 << (int)1))
+ __builtin_abort ();
+ if (vidx(int, i1, 1) != ((int)-1 << (int)1))
+ __builtin_abort ();
+ if (vidx(int, i1, 2) != ((int)-1 << (int)1))
+ __builtin_abort ();
+ if (vidx(int, i1, 3) != ((int)-1 << (int)1))
+ __builtin_abort ();
+
+ u1 = vuint << vint0;
+
+ if (vidx(int, u1, 0) != ((uint)1 << (int)1))
+ __builtin_abort ();
+ if (vidx(int, u1, 1) != ((uint)2 << (int)1))
+ __builtin_abort ();
+ if (vidx(int, u1, 2) != ((uint)3 << (int)1))
+ __builtin_abort ();
+ if (vidx(int, u1, 3) != ((uint)4 << (int)1))
+ __builtin_abort ();
+
+
+ i2 = vint1 >> vuint;
+
+ if (vidx(int, i2, 0) != ((int)-1 >> (uint)1))
+ __builtin_abort ();
+ if (vidx(int, i2, 1) != ((int)-1 >> (uint)2))
+ __builtin_abort ();
+ if (vidx(int, i2, 2) != ((int)-1 >> (uint)3))
+ __builtin_abort ();
+ if (vidx(int, i2, 3) != ((int)-1 >> (uint)4))
+ __builtin_abort ();
+
+
+ vint1 >>= vuint;
+
+ vuint <<= vint0;
+ vuint <<= vint1;
+
+
+ return 0;
+}
+
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-subscript-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-subscript-1.c
new file mode 100644
index 000000000..6152e7c78
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-subscript-1.c
@@ -0,0 +1,61 @@
+/* { dg-do run } */
+/* { dg-options "-fno-common" { target { hppa*-*-hpux* } } } */
+#define vector __attribute__((vector_size(sizeof(int)*4) ))
+
+/* Check to make sure that we extract and insert the vector at the same
+ location for vector subscripting and that vectors layout are the same
+ as arrays. */
+
+struct TV4
+{
+ vector int v;
+};
+
+typedef struct TV4 MYV4;
+static inline int *f(MYV4 *a, int i)
+{
+ return &(a->v[i]);
+}
+
+static inline MYV4 myfunc2( int x, int y, int z, int w )
+{
+ MYV4 temp;
+ *f(&temp, 0 ) = x;
+ *f(&temp, 1 ) = y;
+ *f(&temp, 2 ) = z;
+ *f(&temp, 3 ) = w;
+ return temp;
+}
+
+MYV4 val3;
+
+__attribute__((noinline)) void modify (void)
+{
+ val3 = myfunc2( 1, 2, 3, 4 );
+}
+
+int main( int argc, char* argv[] )
+{
+ int a[4];
+ int i;
+
+ modify();
+
+ if (*f(&val3, 0 ) != 1)
+ __builtin_abort ();
+ if (*f(&val3, 1 ) != 2)
+ __builtin_abort ();
+ if (*f(&val3, 2 ) != 3)
+ __builtin_abort ();
+ if (*f(&val3, 3 ) != 4)
+ __builtin_abort ();
+
+ __builtin_memcpy (a, &val3, sizeof(a));
+ for(i = 0; i < 4; i++)
+ if (a[i] != i+1)
+ __builtin_abort ();
+
+
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-subscript-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-subscript-2.c
new file mode 100644
index 000000000..202b3d95a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-subscript-2.c
@@ -0,0 +1,69 @@
+/* { dg-do run } */
+/* { dg-options "-fno-common" { target hppa*-*-hpux* } } */
+#define vector __attribute__((vector_size(sizeof(int)*4) ))
+
+/* Check to make sure that we extract and insert the vector at the same
+ location for vector subscripting (with constant indexes) and
+ that vectors layout are the same as arrays. */
+
+struct TV4
+{
+ vector int v;
+};
+
+typedef struct TV4 MYV4;
+
+static inline MYV4 myfunc2( int x, int y, int z, int w )
+{
+ MYV4 temp;
+ temp.v[0] = x;
+ temp.v[1] = y;
+ temp.v[2] = z;
+ temp.v[3] = w;
+ return temp;
+}
+MYV4 val3;
+__attribute__((noinline)) void modify (void)
+{
+ val3 = myfunc2( 1, 2, 3, 4 );
+}
+int main( int argc, char* argv[] )
+{
+ int a[4];
+ int i;
+
+ /* Set up the vector. */
+ modify();
+
+ /* Check the vector via the global variable. */
+ if (val3.v[0] != 1)
+ __builtin_abort ();
+ if (val3.v[1] != 2)
+ __builtin_abort ();
+ if (val3.v[2] != 3)
+ __builtin_abort ();
+ if (val3.v[3] != 4)
+ __builtin_abort ();
+
+ vector int a1 = val3.v;
+
+ /* Check the vector via a local variable. */
+ if (a1[0] != 1)
+ __builtin_abort ();
+ if (a1[1] != 2)
+ __builtin_abort ();
+ if (a1[2] != 3)
+ __builtin_abort ();
+ if (a1[3] != 4)
+ __builtin_abort ();
+
+ __builtin_memcpy(a, &val3, sizeof(a));
+ /* Check the vector via copying it to an array. */
+ for(i = 0; i < 4; i++)
+ if (a[i] != i+1)
+ __builtin_abort ();
+
+
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-subscript-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-subscript-3.c
new file mode 100644
index 000000000..bb5c91485
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-subscript-3.c
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+#define vector __attribute__((vector_size(16) ))
+
+/* Check whether register declaration of vector type still
+ allow us to subscript this type. */
+
+typedef vector short myvec_t;
+
+struct vec_s {
+ vector short member;
+};
+
+
+int main () {
+ register short vector v0 = {1,2,3,4,5,6,7};
+ register myvec_t v1 = {1,2,3,4,5,6,7};
+ register struct vec_s v2;
+
+ v2.member = v1;
+
+ short r = v0[0] + v1[1] + v2.member[2];
+ if (r != 6)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-16.inc b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-16.inc
new file mode 100644
index 000000000..68f2646d8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-16.inc
@@ -0,0 +1,81 @@
+/* Test fragment for vectors with 16 elements. */
+
+#ifndef UNSUPPORTED
+
+struct S
+{
+ V in;
+ VI mask;
+ V out;
+};
+
+struct S tests[] = {
+ {
+ { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, },
+ { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
+ },
+ {
+ { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
+ { 0x10, 0x21, 0x32, 0x43, 0x54, 0x65, 0x76, 0x87,
+ 0x98, 0xa9, 0xba, 0xcb, 0xdc, 0xed, 0xfe, 0xff },
+ { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
+ },
+ {
+ { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
+ { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 },
+ { 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 },
+ },
+ {
+ { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
+ { 0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 15 },
+ { 1, 3, 5, 7, 9, 11, 13, 15, 2, 4, 6, 8, 10, 12, 14, 16 },
+ },
+ {
+ { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
+ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
+ { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 },
+ },
+};
+
+struct S2
+{
+ V in1, in2;
+ VI mask;
+ V out;
+};
+
+struct S2 tests2[] = {
+ {
+ { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 },
+ { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45 },
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
+ { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 },
+ },
+ {
+ { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 },
+ { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45 },
+ { 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 },
+ { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45 },
+ },
+ {
+ { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 },
+ { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45 },
+ { 7, 6, 5, 4, 16, 17, 18, 19, 31, 30, 29, 28, 3, 2, 1, 0 },
+ { 17, 16, 15, 14, 30, 31, 32, 33, 45, 44, 43, 42, 13, 12, 11, 10 },
+ },
+ {
+ { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 },
+ { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 },
+ },
+ {
+ { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 },
+ { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45 },
+ { 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63 },
+ { 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45 },
+ },
+};
+
+#endif
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-2.inc b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-2.inc
new file mode 100644
index 000000000..ef778e594
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-2.inc
@@ -0,0 +1,38 @@
+/* Test fragment for vectors of 2 elements. */
+
+#ifndef UNSUPPORTED
+
+struct S
+{
+ V in;
+ VI mask;
+ V out;
+};
+
+struct S tests[] = {
+ { { A, B }, { 0, 1 }, { A, B } },
+ { { A, B }, { -16, -1 }, { A, B } },
+ { { A, B }, { 1, 0 }, { B, A } },
+ { { A, B }, { 0, 0 }, { A, A } },
+ { { X, Y }, { 1, 1 }, { Y, Y } },
+ { { X, Y }, { 1, 0 }, { Y, X } },
+};
+
+struct S2
+{
+ V in1, in2;
+ VI mask;
+ V out;
+};
+
+struct S2 tests2[] = {
+ { { A, B }, { X, Y }, { 0, 1 }, { A, B } },
+ { { A, B }, { X, Y }, { 2, 3 }, { X, Y } },
+ { { A, B }, { X, Y }, { 0, 2 }, { A, X } },
+ { { A, B }, { X, Y }, { 2, 1 }, { X, B } },
+ { { A, B }, { X, Y }, { 3, 0 }, { Y, A } },
+ { { A, B }, { X, Y }, { 0, 0 }, { A, A } },
+ { { A, B }, { X, Y }, { 3, 3 }, { Y, Y } },
+};
+
+#endif
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-4.inc b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-4.inc
new file mode 100644
index 000000000..d6e6e1022
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-4.inc
@@ -0,0 +1,39 @@
+/* Test fragment for vectors of 4 elements. */
+
+#ifndef UNSUPPORTED
+
+struct S
+{
+ V in;
+ VI mask;
+ V out;
+};
+
+struct S tests[] = {
+ { { A, B, C, D }, { 0, 1, 2, 3 }, { A, B, C, D }, },
+ { { A, B, C, D }, { 0+1*4, 1+2*4, 2+3*4, 3+4*4 }, { A, B, C, D } },
+ { { A, B, C, D }, { 3, 2, 1, 0 }, { D, C, B, A } },
+ { { A, B, C, D }, { 0, 3, 2, 1 }, { A, D, C, B } },
+ { { A, B, C, D }, { 0, 2, 1, 3 }, { A, C, B, D } },
+ { { W, X, Y, Z }, { 3, 1, 2, 0 }, { Z, X, Y, W } },
+ { { W, X, Y, Z }, { 0, 0, 0, 0 }, { W, W, W, W } },
+ { { W, X, Y, Z }, { 1, 2, 1, 2 }, { X, Y, X, Y } },
+};
+
+struct S2
+{
+ V in1, in2;
+ VI mask;
+ V out;
+};
+
+struct S2 tests2[] = {
+ { { A, B, C, D }, { W, X, Y, Z }, { 0, 1, 2, 3 }, { A, B, C, D } },
+ { { A, B, C, D }, { W, X, Y, Z }, { 4, 5, 6, 7 }, { W, X, Y, Z } },
+ { { A, B, C, D }, { W, X, Y, Z }, { 0, 4, 1, 5 }, { A, W, B, X } },
+ { { A, B, C, D }, { W, X, Y, Z }, { 0, 7, 4, 3 }, { A, Z, W, D } },
+ { { A, B, C, D }, { W, X, Y, Z }, { 0, 0, 0, 0 }, { A, A, A, A } },
+ { { A, B, C, D }, { W, X, Y, Z }, { 7, 7, 7, 7 }, { Z, Z, Z, Z } },
+};
+
+#endif
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-8.inc b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-8.inc
new file mode 100644
index 000000000..e6475226a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-8.inc
@@ -0,0 +1,101 @@
+/* Test fragment for vectors of 8 elements. */
+
+#ifndef UNSUPPORTED
+
+struct S
+{
+ V in;
+ VI mask;
+ V out;
+};
+
+struct S tests[] = {
+ {
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { 0, 1, 2, 3, 4, 5, 6, 7 },
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ },
+ {
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { 0x10, 0x21, 0x32, 0x43, 0x54, 0x65, 0x76, 0x87 },
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ },
+ {
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { 7, 6, 5, 4, 3, 2, 1, 0 },
+ { H1, G1, F1, E1, D1, C1, B1, A1 },
+ },
+ {
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { 7, 0, 5, 3, 2, 4, 1, 6 },
+ { H1, A1, F1, D1, C1, E1, B1, G1 },
+ },
+ {
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { 0, 2, 1, 3, 4, 6, 5, 7 },
+ { A1, C1, B1, D1, E1, G1, F1, H1 },
+ },
+ {
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ { 3, 1, 2, 0, 7, 5, 6, 4 },
+ { D2, B2, C2, A2, H2, F2, G2, E2 },
+ },
+ {
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ { 0, 0, 0, 0 },
+ { A2, A2, A2, A2, A2, A2, A2, A2 },
+ },
+ {
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ { 1, 6, 1, 6, 1, 6, 1, 6 },
+ { B2, G2, B2, G2, B2, G2, B2, G2 },
+ }
+};
+
+struct S2
+{
+ V in1, in2;
+ VI mask;
+ V out;
+};
+
+struct S2 tests2[] = {
+ {
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ { 0, 1, 2, 3, 4, 5, 6, 7 },
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ },
+ {
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ { 8, 9, 10, 11, 12, 13, 14, 15 },
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ },
+ {
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ { 0, 8, 1, 9, 2, 10, 3, 11 },
+ { A1, A2, B1, B2, C1, C2, D1, D2 },
+ },
+ {
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ { 0, 15, 4, 11, 12, 3, 7, 8 },
+ { A1, H2, E1, D2, E2, D1, H1, A2 },
+ },
+ {
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { A1, A1, A1, A1, A1, A1, A1, A1 },
+ },
+ {
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ { 0x1e, 0x2e, 0x3e, 0x4e, 0x5e, 0x6e, 0x7e, 0x8e },
+ { G2, G2, G2, G2, G2, G2, G2, G2 },
+ },
+};
+
+#endif
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-main.inc b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-main.inc
new file mode 100644
index 000000000..8487131b1
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-main.inc
@@ -0,0 +1,26 @@
+/* Driver fragment for __builtin_shuffle of any vector shape. */
+
+extern void abort(void);
+
+int main()
+{
+#ifndef UNSUPPORTED
+ int i;
+
+ for (i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i)
+ {
+ V r = __builtin_shuffle(tests[i].in, tests[i].mask);
+ if (__builtin_memcmp(&r, &tests[i].out, sizeof(V)) != 0)
+ abort();
+ }
+
+ for (i = 0; i < sizeof(tests2)/sizeof(tests2[0]); ++i)
+ {
+ V r = __builtin_shuffle(tests2[i].in1, tests2[i].in2, tests2[i].mask);
+ if (__builtin_memcmp(&r, &tests2[i].out, sizeof(V)) != 0)
+ abort();
+ }
+#endif
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v16hi.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v16hi.c
new file mode 100644
index 000000000..98b329dbf
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v16hi.c
@@ -0,0 +1,5 @@
+typedef unsigned short V __attribute__((vector_size(32)));
+typedef V VI;
+
+#include "vshuf-16.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v16qi.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v16qi.c
new file mode 100644
index 000000000..dcd1de1e6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v16qi.c
@@ -0,0 +1,5 @@
+typedef unsigned char V __attribute__((vector_size(16)));
+typedef V VI;
+
+#include "vshuf-16.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v2df.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v2df.c
new file mode 100644
index 000000000..e88ec08dd
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v2df.c
@@ -0,0 +1,15 @@
+#if __SIZEOF_DOUBLE__ == 8 && __SIZEOF_LONG_LONG__ == 8
+typedef double V __attribute__((vector_size(16)));
+typedef unsigned long long VI __attribute__((vector_size(16)));
+#else
+#define UNSUPPORTED
+#endif
+
+#define A 0.69314718055994530942
+#define B 2.7182818284590452354
+
+#define X 3.14159265358979323846
+#define Y 1.41421356237309504880
+
+#include "vshuf-2.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v2di.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v2di.c
new file mode 100644
index 000000000..0985a0de0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v2di.c
@@ -0,0 +1,15 @@
+#if __SIZEOF_LONG_LONG__ == 8
+typedef unsigned long long V __attribute__((vector_size(16)));
+typedef V VI;
+#else
+#define UNSUPPORTED
+#endif
+
+#define A 0x1112131415161718
+#define B 0x2122232425262728
+
+#define X 0xc1c2c3c4c5c6c7c8
+#define Y 0xd1d2d3d4d5d6d7d8
+
+#include "vshuf-2.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v2sf.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v2sf.c
new file mode 100644
index 000000000..f9c40b223
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v2sf.c
@@ -0,0 +1,21 @@
+#if __SIZEOF_FLOAT__ == 4
+typedef float V __attribute__((vector_size(8)));
+# if __SIZEOF_INT__ == 4
+typedef unsigned int VI __attribute__((vector_size(8)));
+# elif __SIZEOF_LONG__ == 4
+typedef unsigned long VI __attribute__((vector_size(8)));
+# else
+# define UNSUPPORTED
+# endif
+#else
+# define UNSUPPORTED
+#endif
+
+#define A 0.69314718055994530942f
+#define B 2.7182818284590452354f
+
+#define X 3.14159265358979323846f
+#define Y 1.41421356237309504880f
+
+#include "vshuf-2.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v2si.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v2si.c
new file mode 100644
index 000000000..414743c89
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v2si.c
@@ -0,0 +1,18 @@
+#if __SIZEOF_INT__ == 4
+typedef unsigned int V __attribute__((vector_size(8)));
+typedef V VI;
+#elif __SIZEOF_LONG__ == 4
+typedef unsigned long V __attribute__((vector_size(8)));
+typedef V VI;
+#else
+#define UNSUPPORTED
+#endif
+
+#define A 0x11121314
+#define B 0x21222324
+
+#define X 0xd1d2d3d4
+#define Y 0xe1e2e3e4
+
+#include "vshuf-2.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v4df.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v4df.c
new file mode 100644
index 000000000..c4030a7db
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v4df.c
@@ -0,0 +1,19 @@
+#if __SIZEOF_DOUBLE__ == 8 && __SIZEOF_LONG_LONG__ == 8
+typedef double V __attribute__((vector_size(32)));
+typedef unsigned long long VI __attribute__((vector_size(32)));
+#else
+#define UNSUPPORTED
+#endif
+
+#define A 0.69314718055994530942
+#define B 2.7182818284590452354
+#define C 2.30258509299404568402
+#define D 1.4426950408889634074
+
+#define W 0.31830988618379067154
+#define X 3.14159265358979323846
+#define Y 1.41421356237309504880
+#define Z 0.70710678118654752440
+
+#include "vshuf-4.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v4di.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v4di.c
new file mode 100644
index 000000000..a84aebefb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v4di.c
@@ -0,0 +1,19 @@
+#if __SIZEOF_LONG_LONG__ == 8
+typedef unsigned long long V __attribute__((vector_size(32)));
+typedef V VI;
+#else
+#define UNSUPPORTED
+#endif
+
+#define A 0x1112131415161718
+#define B 0x2122232425262728
+#define C 0x3132333435363738
+#define D 0x4142434445464748
+
+#define W 0xc1c2c3c4c5c6c7c8
+#define X 0xd1d2d3d4d5d6d7d8
+#define Y 0xe1e2e3e4e5e6e7e8
+#define Z 0xf1f2f3f4f5f6f7f8
+
+#include "vshuf-4.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v4hi.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v4hi.c
new file mode 100644
index 000000000..64a2bb4ac
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v4hi.c
@@ -0,0 +1,15 @@
+typedef unsigned short V __attribute__((vector_size(8)));
+typedef V VI;
+
+#define A 0x1112
+#define B 0x2122
+#define C 0x3132
+#define D 0x4142
+
+#define W 0xc1c2
+#define X 0xd1d2
+#define Y 0xe1e2
+#define Z 0xf1f2
+
+#include "vshuf-4.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v4sf.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v4sf.c
new file mode 100644
index 000000000..283672560
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v4sf.c
@@ -0,0 +1,25 @@
+#if __SIZEOF_FLOAT__ == 4
+typedef float V __attribute__((vector_size(16)));
+# if __SIZEOF_INT__ == 4
+typedef unsigned int VI __attribute__((vector_size(16)));
+# elif __SIZEOF_LONG__ == 4
+typedef unsigned long VI __attribute__((vector_size(16)));
+# else
+# define UNSUPPORTED
+# endif
+#else
+# define UNSUPPORTED
+#endif
+
+#define A 0.69314718055994530942f
+#define B 2.7182818284590452354f
+#define C 2.30258509299404568402f
+#define D 1.4426950408889634074f
+
+#define W 0.31830988618379067154f
+#define X 3.14159265358979323846f
+#define Y 1.41421356237309504880f
+#define Z 0.70710678118654752440f
+
+#include "vshuf-4.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v4si.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v4si.c
new file mode 100644
index 000000000..289ec1b50
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v4si.c
@@ -0,0 +1,22 @@
+#if __SIZEOF_INT__ == 4
+typedef unsigned int V __attribute__((vector_size(16)));
+typedef V VI;
+#elif __SIZEOF_LONG__ == 4
+typedef unsigned long V __attribute__((vector_size(16)));
+typedef V VI;
+#else
+# define UNSUPPORTED
+#endif
+
+#define A 0x11121314
+#define B 0x21222324
+#define C 0x31323334
+#define D 0x41424344
+
+#define W 0xc1c2c3c4
+#define X 0xd1d2d3d4
+#define Y 0xe1e2e3e4
+#define Z 0xf1f2f3f4
+
+#include "vshuf-4.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v8hi.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v8hi.c
new file mode 100644
index 000000000..ce442c5d9
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v8hi.c
@@ -0,0 +1,23 @@
+typedef unsigned short V __attribute__((vector_size(16)));
+typedef V VI;
+
+#define A1 0x1112
+#define B1 0x2122
+#define C1 0x3132
+#define D1 0x4142
+#define E1 0x5152
+#define F1 0x6162
+#define G1 0x7172
+#define H1 0x8182
+
+#define A2 0x9192
+#define B2 0xa1a2
+#define C2 0xb1b2
+#define D2 0xc1c2
+#define E2 0xd1d2
+#define F2 0xe1e2
+#define G2 0xf1f2
+#define H2 0x0102
+
+#include "vshuf-8.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v8qi.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v8qi.c
new file mode 100644
index 000000000..349ec6db6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v8qi.c
@@ -0,0 +1,23 @@
+typedef unsigned char V __attribute__((vector_size(8)));
+typedef V VI;
+
+#define A1 0x11
+#define B1 0x12
+#define C1 0x13
+#define D1 0x14
+#define E1 0x15
+#define F1 0x16
+#define G1 0x17
+#define H1 0x18
+
+#define A2 0xf1
+#define B2 0xf2
+#define C2 0xf3
+#define D2 0xf4
+#define E2 0xf5
+#define F2 0xf6
+#define G2 0xf7
+#define H2 0xf8
+
+#include "vshuf-8.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v8si.c b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v8si.c
new file mode 100644
index 000000000..5b0a2c33e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/torture/vshuf-v8si.c
@@ -0,0 +1,30 @@
+#if __SIZEOF_INT__ == 4
+typedef unsigned int V __attribute__((vector_size(32)));
+typedef V VI;
+#elif __SIZEOF_LONG__ == 4
+typedef unsigned long V __attribute__((vector_size(32)));
+typedef V VI;
+#else
+# define UNSUPPORTED
+#endif
+
+#define A1 0x11121314
+#define B1 0x21222324
+#define C1 0x31323334
+#define D1 0x41424344
+#define E1 0x51525354
+#define F1 0x61626364
+#define G1 0x71727374
+#define H1 0x81828384
+
+#define A2 0x91929394
+#define B2 0xa1a2a3a4
+#define C2 0xb1b2b3b4
+#define D2 0xc1c2c3c4
+#define E2 0xd1d2d3d4
+#define F2 0xe1e2e3e4
+#define G2 0xf1f2f3f4
+#define H2 0x01020304
+
+#include "vshuf-8.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/transparent-union-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/transparent-union-1.c
new file mode 100644
index 000000000..3fb6e782a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/transparent-union-1.c
@@ -0,0 +1,5 @@
+/* PR c++/51228 */
+
+typedef union {} U __attribute__((transparent_union)); /* { dg-warning "ignored" } */
+
+void foo(U u) {}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/atomic_stack.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/atomic_stack.c
new file mode 100644
index 000000000..6a3795120
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/atomic_stack.c
@@ -0,0 +1,31 @@
+/* { dg-shouldfail "tsan" } */
+
+#include <pthread.h>
+#include <unistd.h>
+
+int Global;
+
+void *Thread1(void *x) {
+ sleep(1);
+ __atomic_fetch_add(&Global, 1, __ATOMIC_RELAXED);
+ return NULL;
+}
+
+void *Thread2(void *x) {
+ Global++;
+ return NULL;
+}
+
+int main() {
+ pthread_t t[2];
+ pthread_create(&t[0], NULL, Thread1, NULL);
+ pthread_create(&t[1], NULL, Thread2, NULL);
+ pthread_join(t[0], NULL);
+ pthread_join(t[1], NULL);
+ return 0;
+}
+
+/* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r)" } */
+/* { dg-output " Atomic write of size 4.*" } */
+/* { dg-output " #0 __tsan_atomic32_fetch_add.*" } */
+/* { dg-output " #1 Thread1.*" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/fd_pipe_race.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/fd_pipe_race.c
new file mode 100644
index 000000000..28cd630d2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/fd_pipe_race.c
@@ -0,0 +1,36 @@
+/* { dg-shouldfail "tsan" } */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <unistd.h>
+
+int fds[2];
+
+void *Thread1(void *x) {
+ write(fds[1], "a", 1);
+ return NULL;
+}
+
+void *Thread2(void *x) {
+ sleep(1);
+ close(fds[0]);
+ close(fds[1]);
+ return NULL;
+}
+
+int main() {
+ pipe(fds);
+ pthread_t t[2];
+ pthread_create(&t[0], NULL, Thread1, NULL);
+ pthread_create(&t[1], NULL, Thread2, NULL);
+ pthread_join(t[0], NULL);
+ pthread_join(t[1], NULL);
+}
+
+/* { dg-output "WARNING: ThreadSanitizer: data race.*\n" } */
+/* { dg-output " Write of size 8.*\n" } */
+/* { dg-output " #0 close.*\n" } */
+/* { dg-output " #1 Thread2.*\n" } */
+/* { dg-output " Previous read of size 8.*\n" } */
+/* { dg-output " #0 write.*\n" } */
+/* { dg-output " #1 Thread1.*\n" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/free_race.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/free_race.c
new file mode 100644
index 000000000..258f7b742
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/free_race.c
@@ -0,0 +1,27 @@
+/* { dg-shouldfail "tsan" } */
+
+#include <stdlib.h>
+
+void __attribute__((noinline)) foo(int *mem) {
+ free(mem);
+}
+
+void __attribute__((noinline)) bar(int *mem) {
+ mem[0] = 42;
+}
+
+int main() {
+ int *mem =(int*)malloc (100);
+ foo(mem);
+ bar(mem);
+ return 0;
+}
+
+/* { dg-output "WARNING: ThreadSanitizer: heap-use-after-free.*(\n|\r\n|\r)" } */
+/* { dg-output " Write of size 4 at.* by main thread:(\n|\r\n|\r)" } */
+/* { dg-output " #0 bar.*(\n|\r\n|\r)" } */
+/* { dg-output " #1 main.*(\n|\r\n|\r)" } */
+/* { dg-output " Previous write of size 8 at.* by main thread:(\n|\r\n|\r)" } */
+/* { dg-output " #0 free.*(\n|\r\n|\r)" } */
+/* { dg-output " #\(1|2\) foo.*(\n|\r\n|\r)" } */
+/* { dg-output " #\(2|3\) main.*(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/free_race2.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/free_race2.c
new file mode 100644
index 000000000..3971180c2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/free_race2.c
@@ -0,0 +1,28 @@
+/* { dg-shouldfail "tsan" } */
+
+#include <stdlib.h>
+
+void __attribute__((noinline)) foo(int *mem) {
+ free(mem);
+}
+
+void __attribute__((noinline)) bar(int *mem) {
+ mem[0] = 42;
+}
+
+int main() {
+ int *mem = (int*)malloc(100);
+ foo(mem);
+ bar(mem);
+ return 0;
+}
+
+/* { dg-output "WARNING: ThreadSanitizer: heap-use-after-free.*(\n|\r\n|\r)" } */
+/* { dg-output " Write of size 4.* by main thread:(\n|\r\n|\r)" } */
+/* { dg-output " #0 bar.*" } */
+/* { dg-output " #1 main .*" } */
+/* { dg-output " Previous write of size 8 at .* by main thread:(\n|\r\n|\r)" } */
+/* { dg-output " #0 free .*" } */
+/* { dg-output " #\(1|2\) foo.*(\n|\r\n|\r)" } */
+/* { dg-output " #\(2|3\) main .*" } */
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/mutexset1.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/mutexset1.c
new file mode 100644
index 000000000..7c32a8524
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/mutexset1.c
@@ -0,0 +1,40 @@
+/* { dg-shouldfail "tsan" } */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <unistd.h>
+
+int Global;
+pthread_mutex_t mtx;
+
+void *Thread1(void *x) {
+ sleep(1);
+ pthread_mutex_lock(&mtx);
+ Global++;
+ pthread_mutex_unlock(&mtx);
+ return NULL;
+}
+
+void *Thread2(void *x) {
+ Global--;
+ return NULL;/* { dg-output ".*" } */
+
+}
+
+int main() {
+ pthread_mutex_init(&mtx, 0);
+ pthread_t t[2];
+ pthread_create(&t[0], NULL, Thread1, NULL);
+ pthread_create(&t[1], NULL, Thread2, NULL);
+ pthread_join(t[0], NULL);
+ pthread_join(t[1], NULL);
+ pthread_mutex_destroy(&mtx);
+ return 0;
+}
+
+/* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r)" } */
+/* { dg-output " Read of size 4 at 0x\[0-9a-f\]+ by thread T1 \\(mutexes: write M\[0-9\]\\):.*" } */
+/* { dg-output " Previous write of size 4 at 0x\[0-9a-f\]+ by thread T2:.*" } */
+/* { dg-output " Mutex M\[0-9\] created at:.*" } */
+/* { dg-output " #0 pthread_mutex_init.*" } */
+/* { dg-output " #1 main (.*mutexset1.c|\\?{2}):\[0-9]+.*" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_barrier.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_barrier.c
new file mode 100644
index 000000000..0a0e5faba
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_barrier.c
@@ -0,0 +1,32 @@
+/* { dg-shouldfail "tsan" } */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stddef.h>
+#include <unistd.h>
+
+pthread_barrier_t B;
+int Global;
+
+void *Thread1(void *x) {
+ pthread_barrier_init(&B, 0, 2);
+ pthread_barrier_wait(&B);
+ return NULL;
+}
+
+void *Thread2(void *x) {
+ sleep(1);
+ pthread_barrier_wait(&B);
+ return NULL;
+}
+
+int main() {
+ pthread_t t;
+ pthread_create(&t, NULL, Thread1, NULL);
+ Thread2(0);
+ pthread_join(t, NULL);
+ pthread_barrier_destroy(&B);
+ return 0;
+}
+
+/* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_barrier2.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_barrier2.c
new file mode 100644
index 000000000..b01a5cc21
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_barrier2.c
@@ -0,0 +1,32 @@
+/* { dg-shouldfail "tsan" } */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stddef.h>
+#include <unistd.h>
+
+pthread_barrier_t B;
+int Global;
+
+void *Thread1(void *x) {
+ if (pthread_barrier_wait(&B) == PTHREAD_BARRIER_SERIAL_THREAD)
+ pthread_barrier_destroy(&B);
+ return NULL;
+}
+
+void *Thread2(void *x) {
+ if (pthread_barrier_wait(&B) == PTHREAD_BARRIER_SERIAL_THREAD)
+ pthread_barrier_destroy(&B);
+ return NULL;
+}
+
+int main() {
+ pthread_barrier_init(&B, 0, 2);
+ pthread_t t;
+ pthread_create(&t, NULL, Thread1, NULL);
+ Thread2(0);
+ pthread_join(t, NULL);
+ return 0;
+}
+
+/* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c
new file mode 100644
index 000000000..5dad345d8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c
@@ -0,0 +1,43 @@
+/* { dg-shouldfail "tsan" } */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stddef.h>
+#include <unistd.h>
+
+pthread_mutex_t Mtx;
+int Global;
+
+void *Thread1(void *x) {
+ pthread_mutex_init(&Mtx, 0);
+ pthread_mutex_lock(&Mtx);
+ Global = 42;
+ pthread_mutex_unlock(&Mtx);
+ return NULL;
+}
+
+void *Thread2(void *x) {
+ sleep(1);
+ pthread_mutex_lock(&Mtx);
+ Global = 43;
+ pthread_mutex_unlock(&Mtx);
+ return NULL;
+}
+
+int main() {
+ pthread_t t[2];
+ pthread_create(&t[0], NULL, Thread1, NULL);
+ pthread_create(&t[1], NULL, Thread2, NULL);
+ pthread_join(t[0], NULL);
+ pthread_join(t[1], NULL);
+ pthread_mutex_destroy(&Mtx);
+ return 0;
+}
+
+/* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r)" } */
+/* { dg-output " Atomic read of size 1 at .* by thread T2:(\n|\r\n|\r)" } */
+/* { dg-output " #0 pthread_mutex_lock.*" } */
+/* { dg-output " #1 Thread2.* .*(race_on_mutex.c:21|\\?{2}:0) (.*)" } */
+/* { dg-output " Previous write of size 1 at .* by thread T1:(\n|\r\n|\r)" } */
+/* { dg-output " #0 pthread_mutex_init .* (.)*" } */
+/* { dg-output " #1 Thread1.* .*(race_on_mutex.c:12|\\?{2}:0) .*" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_mutex2.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_mutex2.c
new file mode 100644
index 000000000..80a6fb6c0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_mutex2.c
@@ -0,0 +1,25 @@
+/* { dg-shouldfail "tsan" } */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stddef.h>
+#include <unistd.h>
+
+void *Thread(void *x) {
+ pthread_mutex_lock((pthread_mutex_t*)x);
+ pthread_mutex_unlock((pthread_mutex_t*)x);
+ return 0;
+}
+
+int main() {
+ pthread_mutex_t Mtx;
+ pthread_mutex_init(&Mtx, 0);
+ pthread_t t;
+ pthread_create(&t, 0, Thread, &Mtx);
+ sleep(1);
+ pthread_mutex_destroy(&Mtx);
+ pthread_join(t, 0);
+ return 0;
+}
+
+/* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/simple_race.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/simple_race.c
new file mode 100644
index 000000000..a40accd40
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/simple_race.c
@@ -0,0 +1,50 @@
+/* { dg-set-target-env-var TSAN_OPTIONS "halt_on_error=1" } */
+/* { dg-shouldfail "tsan" } */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#define MAX_ITERATIONS_NUMBER 100
+#define SLEEP_STEP 128000
+
+unsigned int delay_time = 1000;
+
+static inline void delay () {
+ usleep(delay_time);
+}
+
+extern int main_1();
+
+int main() {
+ int i;
+ for (i = 0; i < MAX_ITERATIONS_NUMBER; i++) {
+ main_1();
+ delay_time += delay_time < 256000 ? delay_time : SLEEP_STEP;
+ }
+ return 0;
+}
+
+int Global;
+
+void *Thread1(void *x) {
+ delay();
+ Global = 42;
+ return NULL;
+}
+
+void *Thread2(void *x) {
+ Global = 43;
+ return NULL;
+}
+
+int main_1() {
+ pthread_t t[2];
+ pthread_create(&t[0], NULL, Thread1, NULL);
+ pthread_create(&t[1], NULL, Thread2, NULL);
+ pthread_join(t[0], NULL);
+ pthread_join(t[1], NULL);
+ return 0;
+}
+
+/* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/simple_stack.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/simple_stack.c
new file mode 100644
index 000000000..b66a67085
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/simple_stack.c
@@ -0,0 +1,65 @@
+/* { dg-shouldfail "tsan" } */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <unistd.h>
+
+int Global;
+
+void __attribute__((noinline)) foo1() {
+ Global = 42;
+}
+
+void __attribute__((noinline)) bar1() {
+ volatile int tmp = 42; (void)tmp;
+ foo1();
+}
+
+void __attribute__((noinline)) foo2() {
+ volatile int v = Global; (void)v;
+}
+
+void __attribute__((noinline)) bar2() {
+ volatile int tmp = 42; (void)tmp;
+ foo2();
+}
+
+void *Thread1(void *x) {
+ sleep(1);
+ bar1();
+ return NULL;
+}
+
+void *Thread2(void *x) {
+ bar2();
+ return NULL;
+}
+
+void StartThread(pthread_t *t, void *(*f)(void*)) {
+ pthread_create(t, NULL, f, NULL);
+}
+
+int main() {
+ pthread_t t[2];
+ StartThread(&t[0], Thread1);
+ StartThread(&t[1], Thread2);
+ pthread_join(t[0], NULL);
+ pthread_join(t[1], NULL);
+ return 0;
+}
+
+/* { dg-output "WARNING: ThreadSanitizer: data race.*" } */
+/* { dg-output " Write of size 4 at .* by thread T1:(\n|\r\n|\r)" } */
+/* { dg-output " #0 foo1.* .*(simple_stack.c:10|\\?{2}:0) (.*)" } */
+/* { dg-output " #1 bar1.* .*(simple_stack.c:15|\\?{2}:0) (.*)" } */
+/* { dg-output " #2 Thread1.* .*(simple_stack.c:29|\\?{2}:0) (.*)" } */
+/* { dg-output " Previous read of size 4 at .* by thread T2:(\n|\r\n|\r)" } */
+/* { dg-output " #0 foo2.* .*(simple_stack.c:19|\\?{2}:0) (.*)" } */
+/* { dg-output " #1 bar2.* .*(simple_stack.c:24|\\?{2}:0) (.*)" } */
+/* { dg-output " #2 Thread2.* .*(simple_stack.c:34|\\?{2}:0) (.*)" } */
+/* { dg-output " Thread T1 \\(tid=.*, running\\) created by main thread at:(\n|\r\n|\r)" } */
+/* { dg-output " #0 pthread_create .* (.*)" } */
+/* { dg-output " #1 StartThread.* .*(simple_stack.c:39|\\?{2}:0) (.*)" } */
+/* { dg-output " Thread T2 (.*) created by main thread at:(\n|\r\n|\r)" } */
+/* { dg-output " #0 pthread_create .* (.*)" } */
+/* { dg-output " #1 StartThread.* .*(simple_stack.c:39|\\?{2}:0) (.*)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/sleep_sync.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/sleep_sync.c
new file mode 100644
index 000000000..44d44554c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/sleep_sync.c
@@ -0,0 +1,30 @@
+/* { dg-shouldfail "tsan" } */
+
+#include <pthread.h>
+#include <unistd.h>
+
+int X = 0;
+
+void MySleep() {
+ sleep(1);
+}
+
+void *Thread(void *p) {
+ MySleep(); // Assume the main thread has done the write.
+ X = 42;
+ return 0;
+}
+
+int main() {
+ pthread_t t;
+ pthread_create(&t, 0, Thread, 0);
+ X = 43;
+ pthread_join(t, 0);
+ return 0;
+}
+
+/* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r).*} */
+/* { dg-output " As if synchronized via sleep:(\n|\r\n|\r)} */
+/* { dg-output " #0 sleep.*"*} */
+/* { dg-output " #1 MySleep.*"*} */
+/* { dg-output " #2 Thread.*"*} */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/thread_leak.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/thread_leak.c
new file mode 100644
index 000000000..02deaba58
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/thread_leak.c
@@ -0,0 +1,16 @@
+#include <pthread.h>
+#include <stdio.h>
+
+void *Thread(void *x) {
+ return 0;
+}
+
+int main() {
+ pthread_t t;
+ pthread_create(&t, 0, Thread, 0);
+ pthread_join(t, 0);
+ printf("PASS\n");
+ return 0;
+}
+
+/* { dg-prune-output "WARNING: ThreadSanitizer: thread leak.*" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/thread_leak1.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/thread_leak1.c
new file mode 100644
index 000000000..ce28ee487
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/thread_leak1.c
@@ -0,0 +1,18 @@
+/* { dg-shouldfail "tsan" } */
+
+#include <pthread.h>
+#include <unistd.h>
+
+void *Thread(void *x) {
+ return 0;
+}
+
+int main() {
+ pthread_t t;
+ pthread_create(&t, 0, Thread, 0);
+ sleep(1);
+ return 0;
+}
+
+/* { dg-output "WARNING: ThreadSanitizer: thread leak.*(\n|\r\n|\r)" } */
+/* { dg-output "SUMMARY: ThreadSanitizer: thread leak.*main.*(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/thread_leak2.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/thread_leak2.c
new file mode 100644
index 000000000..c9b804665
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/thread_leak2.c
@@ -0,0 +1,21 @@
+/* { dg-shouldfail "tsan" } */
+
+#include <pthread.h>
+#include <unistd.h>
+
+void *Thread(void *x) {
+ return 0;
+}
+
+int main() {
+ int i;
+ for (i = 0; i < 5; i++) {
+ pthread_t t;
+ pthread_create(&t, 0, Thread, 0);
+ }
+ sleep(1);
+ return 0;
+}
+
+/* { dg-output "WARNING: ThreadSanitizer: thread leak.*(\n|\r\n|\r)" } */
+/* { dg-output " And 4 more similar thread leaks.*" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/tiny_race.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/tiny_race.c
new file mode 100644
index 000000000..962497b28
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/tiny_race.c
@@ -0,0 +1,22 @@
+/* { dg-shouldfail "tsan" } */
+
+#include <pthread.h>
+#include <unistd.h>
+
+int Global;
+
+void *Thread1(void *x) {
+ sleep(1);
+ Global = 42;
+ return x;
+}
+
+int main() {
+ pthread_t t;
+ pthread_create(&t, 0, Thread1, 0);
+ Global = 43;
+ pthread_join(t, 0);
+ return Global;
+}
+
+/* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/tls_race.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/tls_race.c
new file mode 100644
index 000000000..423867e38
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/tls_race.c
@@ -0,0 +1,20 @@
+/* { dg-shouldfail "tsan" } */
+
+#include <pthread.h>
+#include <stddef.h>
+
+void *Thread(void *a) {
+ *(int*)a = 43;
+ return 0;
+}
+
+int main() {
+ static __thread int Var = 42;
+ pthread_t t;
+ pthread_create(&t, 0, Thread, &Var);
+ Var = 43;
+ pthread_join(t, 0);
+}
+
+/* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r).*" } */
+/* { dg-output " Location is TLS of main thread.(\n|\r\n|\r).*" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/write_in_reader_lock.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/write_in_reader_lock.c
new file mode 100644
index 000000000..898d23d50
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/write_in_reader_lock.c
@@ -0,0 +1,36 @@
+/* { dg-shouldfail "tsan" } */
+
+#include <pthread.h>
+#include <unistd.h>
+
+pthread_rwlock_t rwlock;
+int GLOB;
+
+void *Thread1(void *p) {
+ (void)p;
+ pthread_rwlock_rdlock(&rwlock);
+ // Write under reader lock.
+ sleep(1);
+ GLOB++;
+ pthread_rwlock_unlock(&rwlock);
+ return 0;
+}
+
+int main(int argc, char *argv[]) {
+ pthread_rwlock_init(&rwlock, NULL);
+ pthread_rwlock_rdlock(&rwlock);
+ pthread_t t;
+ pthread_create(&t, 0, Thread1, 0);
+ volatile int x = GLOB;
+ (void)x;
+ pthread_rwlock_unlock(&rwlock);
+ pthread_join(t, 0);
+ pthread_rwlock_destroy(&rwlock);
+ return 0;
+}
+
+/* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r)" } */
+/* { dg-output " Write of size 4 at 0x\[0-9a-f\]+ by thread T1.*:(\n|\r\n|\r).*" } */
+/* { dg-output " #0 Thread1.*\(write_in_reader_lock.c|\\?{2}\):\[0-9\]+ .*" } */
+/* { dg-output " Previous read of size 4 at.* by main thread.*:(\n|\r\n|\r).*" } */
+/* { dg-output " #0 main.*\(write_in_reader_lock.c|\\?{2}\):\[0-9\]+.*" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/attrib-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/attrib-1.c
new file mode 100644
index 000000000..2e9141ca0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/attrib-1.c
@@ -0,0 +1,33 @@
+/* PR sanitizer/58411 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=undefined -w" } */
+
+__attribute__((no_sanitize_undefined)) int
+f1 (int i)
+{
+ return 16 << i;
+}
+
+int f2 (int i);
+int f2 (int i) __attribute__((no_sanitize_undefined));
+int f2 (int i) __attribute__((no_sanitize_undefined));
+int f2 (int i);
+
+int
+f2 (int i)
+{
+ return 1 / i;
+}
+
+void f3 (void);
+__typeof (f3) f3 __attribute__((__no_sanitize_undefined__));
+
+void
+f3 (void)
+{
+ __builtin_unreachable ();
+}
+
+/* { dg-final { scan-assembler-not "__ubsan_handle_shift_out_of_bounds" } } */
+/* { dg-final { scan-assembler-not "__ubsan_handle_divrem_overflow" } } */
+/* { dg-final { scan-assembler-not "__ubsan_handle_builtin_unreachable" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/const-char-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/const-char-1.c
new file mode 100644
index 000000000..6c2c3f8c3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/const-char-1.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=shift" } */
+
+void
+foo (void)
+{
+ int y = 1 << 2;
+ __builtin_printf ("%d\n", y);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/const-expr-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/const-expr-1.c
new file mode 100644
index 000000000..f474ec64e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/const-expr-1.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=shift -w" } */
+
+enum e { A = 1 << 1, B, };
+const int arr[] = {
+ 1 << 2,
+ 1 << 3,
+};
+
+int
+bar (int a, int b)
+{
+ return a >> b;
+}
+
+int
+foo (void)
+{
+ int i = 1;
+ int vla[B << 3];
+ return bar (A, (i <<= 6, i + 2));
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-1.c
new file mode 100644
index 000000000..ec391e40b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-1.c
@@ -0,0 +1,24 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=integer-divide-by-zero -Wno-div-by-zero" } */
+
+int
+main (void)
+{
+ volatile int a = 0;
+ volatile long long int b = 0;
+ volatile unsigned int c = 1;
+
+ a / b;
+ 0 / 0;
+ a / 0;
+ 0 / b;
+ 2 / --c;
+
+ return 0;
+}
+
+/* { dg-output "division by zero(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*division by zero(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*division by zero(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*division by zero(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*division by zero" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-2.c
new file mode 100644
index 000000000..c8820fa94
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-2.c
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=integer-divide-by-zero -Wno-div-by-zero" } */
+
+int
+main (void)
+{
+ volatile const unsigned long int o = 1UL;
+ int zero = 0;
+
+ o / 0;
+ 1UL / 0;
+ 1UL / zero;
+ o / zero;
+ o / (++zero - 1);
+
+ return 0;
+}
+
+/* { dg-output "division by zero(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*division by zero(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*division by zero(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*division by zero(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*division by zero" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-3.c
new file mode 100644
index 000000000..399071ee7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-3.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=integer-divide-by-zero -Wno-overflow" } */
+
+#include <limits.h>
+
+int
+main (void)
+{
+ volatile int min = INT_MIN;
+ volatile int zero = 0;
+
+ INT_MIN / -1;
+ min / -1;
+ min / (10 * zero - (2 - 1));
+
+ return 0;
+}
+
+/* { dg-output "division of -2147483648 by -1 cannot be represented in type 'int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*division of -2147483648 by -1 cannot be represented in type 'int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*division of -2147483648 by -1 cannot be represented in type 'int'" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-4.c
new file mode 100644
index 000000000..02162e139
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-4.c
@@ -0,0 +1,11 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=integer-divide-by-zero -Wno-overflow" } */
+
+#define INT_MIN (-__INT_MAX__ - 1)
+
+int
+main (void)
+{
+ /* This should not fail. */
+ return (unsigned int) INT_MIN / -1;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-5.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-5.c
new file mode 100644
index 000000000..7a28bacd1
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/div-by-zero-5.c
@@ -0,0 +1,8 @@
+/* { dg-do compile} */
+/* { dg-options "-fsanitize=integer-divide-by-zero" } */
+
+void
+foo (void)
+{
+ int A[-2 / -1] = {};
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/load-bool-enum.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/load-bool-enum.c
new file mode 100644
index 000000000..96f7984f8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/load-bool-enum.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=bool,enum" } */
+
+#ifndef __cplusplus
+#define bool _Bool
+#endif
+enum A { B = -3, C = 2 } a;
+bool b;
+
+__attribute__((noinline, noclone)) enum A
+foo (bool *p)
+{
+ *p = b; /* { dg-output "load-bool-enum.c:13:\[^\n\r]*runtime error: load of value 4, which is not a valid value for type '(_B|b)ool'(\n|\r\n|\r)*" } */
+ return a; /* { dg-output "\[^\n\r]*load-bool-enum.c:14:\[^\n\r]*runtime error: load of value 9, which is not a valid value for type 'A'(\n|\r\n|\r)*" { target c++ } } */
+}
+
+int
+main ()
+{
+ char c = 4;
+ int d = 9;
+ if (sizeof (int) != sizeof (a) || sizeof (b) != 1)
+ return 0;
+ __builtin_memcpy (&a, &d, sizeof (int));
+ __builtin_memcpy (&b, &c, 1);
+ bool e;
+ foo (&e);
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-1.c
new file mode 100644
index 000000000..08d547f3a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-1.c
@@ -0,0 +1,12 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=null -w" } */
+/* { dg-shouldfail "ubsan" } */
+
+int
+main (void)
+{
+ int *p = 0;
+ return *p;
+}
+
+/* { dg-output "load of null pointer of type 'int'(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-10.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-10.c
new file mode 100644
index 000000000..c3d61a01d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-10.c
@@ -0,0 +1,13 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=null -w" } */
+/* { dg-shouldfail "ubsan" } */
+
+int
+main (void)
+{
+ short *p = 0, *u;
+ *(u + *p) = 23;
+ return 0;
+}
+
+/* { dg-output "load of null pointer of type 'short int'(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-11.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-11.c
new file mode 100644
index 000000000..6645f2acf
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-11.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=null -w" } */
+/* { dg-shouldfail "ubsan" } */
+
+struct S {
+ int i;
+};
+
+int
+main (void)
+{
+ struct S **s = 0;
+ return (*s)->i;
+}
+
+/* { dg-output "load of null pointer of type 'struct S \\*'(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-2.c
new file mode 100644
index 000000000..cb3907fa5
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-2.c
@@ -0,0 +1,12 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=null -w" } */
+/* { dg-shouldfail "ubsan" } */
+
+int
+main (void)
+{
+ int ***ppp = 0;
+ return ***ppp;
+}
+
+/* { dg-output "load of null pointer of type 'int \\*\\*'(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-3.c
new file mode 100644
index 000000000..f58562c63
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-3.c
@@ -0,0 +1,18 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=null -w" } */
+/* { dg-shouldfail "ubsan" } */
+
+int
+foo (int *p)
+{
+ return *p;
+}
+
+int
+main (void)
+{
+ int **p = 0;
+ return foo (*p);
+}
+
+/* { dg-output "load of null pointer of type 'int \\*'(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-4.c
new file mode 100644
index 000000000..18506afb3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-4.c
@@ -0,0 +1,14 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=null -w" } */
+/* { dg-shouldfail "ubsan" } */
+
+int
+main (void)
+{
+ _Complex double *p = 0;
+ if (p[0])
+ return 42;
+ return 0;
+}
+
+/* { dg-output "load of null pointer of type 'complex double'(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-5.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-5.c
new file mode 100644
index 000000000..c3c45b7c4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-5.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=null -w" } */
+/* { dg-shouldfail "ubsan" } */
+
+typedef volatile const _Complex float *T;
+
+int
+main (void)
+{
+ T t = 0;
+ if (*t)
+ return 42;
+ return 0;
+}
+
+/* { dg-output "load of null pointer of type 'volatile const complex float'(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-6.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-6.c
new file mode 100644
index 000000000..63fade5a6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-6.c
@@ -0,0 +1,13 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=null -w" } */
+/* { dg-shouldfail "ubsan" } */
+
+int
+main (void)
+{
+ unsigned long int *p = 0;
+ *p = 42;
+ return 0;
+}
+
+/* { dg-output "store to null pointer of type 'long unsigned int'(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-7.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-7.c
new file mode 100644
index 000000000..bf30a0b9b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-7.c
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=null -w" } */
+/* { dg-shouldfail "ubsan" } */
+
+int *
+gao (void)
+{
+ return 0;
+}
+
+int
+main (void)
+{
+ return *gao ();
+}
+
+/* { dg-output "load of null pointer of type 'int'(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-8.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-8.c
new file mode 100644
index 000000000..170377ee4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-8.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=null -w" } */
+/* { dg-shouldfail "ubsan" } */
+
+struct S {
+ int i;
+};
+
+int
+main (void)
+{
+ struct S *s = 0;
+ return s->i;
+}
+
+/* { dg-output "member access within null pointer of type 'struct S'(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-9.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-9.c
new file mode 100644
index 000000000..ab43d22a3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-9.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=null -w" } */
+/* { dg-shouldfail "ubsan" } */
+
+union U {
+ int i;
+};
+
+int
+main (void)
+{
+ union U *u = 0;
+ return u->i;
+}
+
+/* { dg-output "member access within null pointer of type 'union U'(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-1.c
new file mode 100644
index 000000000..68199551b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-1.c
@@ -0,0 +1,269 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=signed-integer-overflow" } */
+
+#include <stdio.h>
+
+#ifndef ASM1
+# define ASM1(a) /* Nothing */
+#endif
+#ifndef ASM2
+# define ASM2(a, b) /* Nothing */
+#endif
+
+#define CHECK(A, B) ({ if ((A) != (B)) __builtin_abort (); })
+
+#define FN1(T1, T2, OP) \
+ ({ \
+ T1 a = 14; \
+ T2 b = 9; \
+ ASM2 (a, b); \
+ a OP b; \
+ })
+
+#define FN2(T, OP) \
+ ({ \
+ T a = 14; \
+ ASM1 (a); \
+ a OP 7; \
+ })
+
+#define FN3(T1, T2, OP) \
+ ({ \
+ T1 a = 4; \
+ T2 b = 1; \
+ ASM2 (a, b); \
+ ~a OP b; \
+ })
+
+#define FN4(T1, T2, OP) \
+ ({ \
+ T1 a = 4; \
+ T2 b = 1; \
+ ASM2 (a, b); \
+ a OP ~b; \
+ })
+
+#define FN5(T) \
+ ({ \
+ T a = 77; \
+ ASM1 (a); \
+ -a; \
+ })
+
+int
+main (void)
+{
+ fputs ("UBSAN TEST START\n", stderr);
+
+ CHECK (FN1 (char, char, +), 23);
+ CHECK (FN1 (char, char, -), 5);
+ CHECK (FN1 (char, char, *), 126);
+ CHECK (FN1 (unsigned char, unsigned char, +), 23);
+ CHECK (FN1 (unsigned char, unsigned char, -), 5);
+ CHECK (FN1 (unsigned char, unsigned char, *), 126);
+ CHECK (FN1 (short, short, +), 23);
+ CHECK (FN1 (short, short, -), 5);
+ CHECK (FN1 (short, short, *), 126);
+ CHECK (FN1 (unsigned short, unsigned short, +), 23);
+ CHECK (FN1 (unsigned short, unsigned short, -), 5);
+ CHECK (FN1 (unsigned short, unsigned short, *), 126);
+ CHECK (FN1 (int, int, +), 23);
+ CHECK (FN1 (int, int, -), 5);
+ CHECK (FN1 (int, int, *), 126);
+ CHECK (FN1 (unsigned int, unsigned int, +), 23);
+ CHECK (FN1 (unsigned int, unsigned int, -), 5);
+ CHECK (FN1 (unsigned int, unsigned int, *), 126);
+ CHECK (FN1 (long int, long int, +), 23);
+ CHECK (FN1 (long int, long int, -), 5);
+ CHECK (FN1 (long int, long int, *), 126);
+ CHECK (FN1 (unsigned long int, unsigned long int, +), 23);
+ CHECK (FN1 (unsigned long int, unsigned long int, -), 5);
+ CHECK (FN1 (unsigned long int, unsigned long int, *), 126);
+ CHECK (FN1 (long long int, long int, +), 23);
+ CHECK (FN1 (long long int, long int, -), 5);
+ CHECK (FN1 (long long int, long int, *), 126);
+ CHECK (FN1 (unsigned long long int, unsigned long long int, +), 23);
+ CHECK (FN1 (unsigned long long int, unsigned long long int, -), 5);
+ CHECK (FN1 (unsigned long long int, unsigned long long int, *), 126);
+ CHECK (FN1 (int, unsigned char, +), 23);
+ CHECK (FN1 (int, unsigned char, -), 5);
+ CHECK (FN1 (int, unsigned char, *), 126);
+ CHECK (FN1 (unsigned char, int, +), 23);
+ CHECK (FN1 (unsigned char, int, -), 5);
+ CHECK (FN1 (unsigned char, int, *), 126);
+ CHECK (FN1 (int, long int, +), 23);
+ CHECK (FN1 (int, long int, -), 5);
+ CHECK (FN1 (int, long int, *), 126);
+ CHECK (FN1 (long int, int, +), 23);
+ CHECK (FN1 (long int, int, -), 5);
+ CHECK (FN1 (long int, int, *), 126);
+ CHECK (FN1 (unsigned int, int, +), 23);
+ CHECK (FN1 (unsigned int, int, -), 5);
+ CHECK (FN1 (unsigned int, int, *), 126);
+ CHECK (FN1 (int, unsigned int, +), 23);
+ CHECK (FN1 (int, unsigned int, -), 5);
+ CHECK (FN1 (int, unsigned int, *), 126);
+ CHECK (FN1 (unsigned long int, int, +), 23);
+ CHECK (FN1 (unsigned long int, int, -), 5);
+ CHECK (FN1 (unsigned long int, int, *), 126);
+ CHECK (FN1 (int, unsigned long int, +), 23);
+ CHECK (FN1 (int, unsigned long int, -), 5);
+ CHECK (FN1 (int, unsigned long int, *), 126);
+
+ CHECK (FN2 (char, +), 21);
+ CHECK (FN2 (char, -), 7);
+ CHECK (FN2 (char, *), 98);
+ CHECK (FN2 (unsigned char, +), 21);
+ CHECK (FN2 (unsigned char, -), 7);
+ CHECK (FN2 (unsigned char, *), 98);
+ CHECK (FN2 (short, +), 21);
+ CHECK (FN2 (short, -), 7);
+ CHECK (FN2 (short, *), 98);
+ CHECK (FN2 (unsigned short, +), 21);
+ CHECK (FN2 (unsigned short, -), 7);
+ CHECK (FN2 (unsigned short, *), 98);
+ CHECK (FN2 (int, +), 21);
+ CHECK (FN2 (int, -), 7);
+ CHECK (FN2 (int, *), 98);
+ CHECK (FN2 (unsigned int, +), 21);
+ CHECK (FN2 (unsigned int, -), 7);
+ CHECK (FN2 (unsigned int, *), 98);
+ CHECK (FN2 (long int, +), 21);
+ CHECK (FN2 (long int, -), 7);
+ CHECK (FN2 (long int, *), 98);
+ CHECK (FN2 (unsigned long int, +), 21);
+ CHECK (FN2 (unsigned long int, -), 7);
+ CHECK (FN2 (unsigned long int, *), 98);
+ CHECK (FN2 (long long int, +), 21);
+ CHECK (FN2 (long long int, -), 7);
+ CHECK (FN2 (long long int, *), 98);
+ CHECK (FN2 (unsigned long long int, +), 21);
+ CHECK (FN2 (unsigned long long int, -), 7);
+ CHECK (FN2 (unsigned long long int, *), 98);
+
+ CHECK (FN3 (char, char, +), -4);
+ CHECK (FN3 (char, char, -), -6);
+ CHECK (FN3 (char, char, *), -5);
+ CHECK (FN3 (unsigned char, unsigned char, +), -4);
+ CHECK (FN3 (unsigned char, unsigned char, -), -6);
+ CHECK (FN3 (unsigned char, unsigned char, *), -5);
+ CHECK (FN3 (short, short, +), -4);
+ CHECK (FN3 (short, short, -), -6);
+ CHECK (FN3 (short, short, *), -5);
+ CHECK (FN3 (unsigned short, unsigned short, +), -4);
+ CHECK (FN3 (unsigned short, unsigned short, -), -6);
+ CHECK (FN3 (unsigned short, unsigned short, *), -5);
+ CHECK (FN3 (int, int, +), -4);
+ CHECK (FN3 (int, int, -), -6);
+ CHECK (FN3 (int, int, *), -5);
+ CHECK (FN3 (unsigned int, unsigned int, +), -4);
+ CHECK (FN3 (unsigned int, unsigned int, -), -6);
+ CHECK (FN3 (unsigned int, unsigned int, *), -5);
+ CHECK (FN3 (long int, long int, +), -4);
+ CHECK (FN3 (long int, long int, -), -6);
+ CHECK (FN3 (long int, long int, *), -5);
+ CHECK (FN3 (unsigned long int, unsigned long int, +), -4);
+ CHECK (FN3 (unsigned long int, unsigned long int, -), -6);
+ CHECK (FN3 (unsigned long int, unsigned long int, *), -5);
+ CHECK (FN3 (long long int, long int, +), -4);
+ CHECK (FN3 (long long int, long int, -), -6);
+ CHECK (FN3 (long long int, long int, *), -5);
+ CHECK (FN3 (unsigned long long int, unsigned long long int, +), -4);
+ CHECK (FN3 (unsigned long long int, unsigned long long int, -), -6);
+ CHECK (FN3 (unsigned long long int, unsigned long long int, *), -5);
+ CHECK (FN3 (int, unsigned char, +), -4);
+ CHECK (FN3 (int, unsigned char, -), -6);
+ CHECK (FN3 (int, unsigned char, *), -5);
+ CHECK (FN3 (unsigned char, int, +), -4);
+ CHECK (FN3 (unsigned char, int, -), -6);
+ CHECK (FN3 (unsigned char, int, *), -5);
+ CHECK (FN3 (int, long int, +), -4);
+ CHECK (FN3 (int, long int, -), -6);
+ CHECK (FN3 (int, long int, *), -5);
+ CHECK (FN3 (long int, int, +), -4);
+ CHECK (FN3 (long int, int, -), -6);
+ CHECK (FN3 (long int, int, *), -5);
+ CHECK (FN3 (unsigned int, int, +), -4);
+ CHECK (FN3 (unsigned int, int, -), -6);
+ CHECK (FN3 (unsigned int, int, *), -5);
+ CHECK (FN3 (int, unsigned int, +), -4);
+ CHECK (FN3 (int, unsigned int, -), -6);
+ CHECK (FN3 (int, unsigned int, *), -5);
+ CHECK (FN3 (unsigned long int, int, +), -4);
+ CHECK (FN3 (unsigned long int, int, -), -6);
+ CHECK (FN3 (unsigned long int, int, *), -5);
+ CHECK (FN3 (int, unsigned long int, +), -4);
+ CHECK (FN3 (int, unsigned long int, -), -6);
+ CHECK (FN3 (int, unsigned long int, *), -5);
+
+ CHECK (FN4 (char, char, +), 2);
+ CHECK (FN4 (char, char, -), 6);
+ CHECK (FN4 (char, char, *), -8);
+ CHECK (FN4 (unsigned char, unsigned char, +), 2);
+ CHECK (FN4 (unsigned char, unsigned char, -), 6);
+ CHECK (FN4 (unsigned char, unsigned char, *), -8);
+ CHECK (FN4 (short, short, +), 2);
+ CHECK (FN4 (short, short, -), 6);
+ CHECK (FN4 (short, short, *), -8);
+ CHECK (FN4 (unsigned short, unsigned short, +), 2);
+ CHECK (FN4 (unsigned short, unsigned short, -), 6);
+ CHECK (FN4 (unsigned short, unsigned short, *), -8);
+ CHECK (FN4 (int, int, +), 2);
+ CHECK (FN4 (int, int, -), 6);
+ CHECK (FN4 (int, int, *), -8);
+ CHECK (FN4 (unsigned int, unsigned int, +), 2);
+ CHECK (FN4 (unsigned int, unsigned int, -), 6);
+ CHECK (FN4 (unsigned int, unsigned int, *), -8);
+ CHECK (FN4 (long int, long int, +), 2);
+ CHECK (FN4 (long int, long int, -), 6);
+ CHECK (FN4 (long int, long int, *), -8);
+ CHECK (FN4 (unsigned long int, unsigned long int, +), 2);
+ CHECK (FN4 (unsigned long int, unsigned long int, -), 6);
+ CHECK (FN4 (unsigned long int, unsigned long int, *), -8);
+ CHECK (FN4 (long long int, long int, +), 2);
+ CHECK (FN4 (long long int, long int, -), 6);
+ CHECK (FN4 (long long int, long int, *), -8);
+ CHECK (FN4 (unsigned long long int, unsigned long long int, +), 2);
+ CHECK (FN4 (unsigned long long int, unsigned long long int, -), 6);
+ CHECK (FN4 (unsigned long long int, unsigned long long int, *), -8);
+ CHECK (FN4 (int, unsigned char, +), 2);
+ CHECK (FN4 (int, unsigned char, -), 6);
+ CHECK (FN4 (int, unsigned char, *), -8);
+ CHECK (FN4 (unsigned char, int, +), 2);
+ CHECK (FN4 (unsigned char, int, -), 6);
+ CHECK (FN4 (unsigned char, int, *), -8);
+ CHECK (FN4 (int, long int, +), 2);
+ CHECK (FN4 (int, long int, -), 6);
+ CHECK (FN4 (int, long int, *), -8);
+ CHECK (FN4 (long int, int, +), 2);
+ CHECK (FN4 (long int, int, -), 6);
+ CHECK (FN4 (long int, int, *), -8);
+ CHECK (FN4 (unsigned int, int, +), 2);
+ CHECK (FN4 (unsigned int, int, -), 6);
+ CHECK (FN4 (unsigned int, int, *), -8);
+ CHECK (FN4 (int, unsigned int, +), 2);
+ CHECK (FN4 (int, unsigned int, -), 6);
+ CHECK (FN4 (int, unsigned int, *), -8);
+ CHECK (FN4 (unsigned long int, int, +), 2);
+ CHECK (FN4 (unsigned long int, int, -), 6);
+ CHECK (FN4 (unsigned long int, int, *), -8);
+ CHECK (FN4 (int, unsigned long int, +), 2);
+ CHECK (FN4 (int, unsigned long int, -), 6);
+ CHECK (FN4 (int, unsigned long int, *), -8);
+
+ CHECK (FN5 (char), -77);
+ CHECK (FN5 (unsigned char), -77);
+ CHECK (FN5 (short), -77);
+ CHECK (FN5 (unsigned short), -77);
+ CHECK (FN5 (int), -77);
+ CHECK (FN5 (unsigned int), -77);
+ CHECK (FN5 (long int), -77);
+ CHECK (FN5 (unsigned long int), -77);
+ CHECK (FN5 (long long int), -77);
+ CHECK (FN5 (unsigned long long int), -77);
+
+ fputs ("UBSAN TEST END\n", stderr);
+ return 0;
+}
+
+/* { dg-output "UBSAN TEST START(\n|\r\n|\r)UBSAN TEST END" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-2.c
new file mode 100644
index 000000000..aeca04d34
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-2.c
@@ -0,0 +1,7 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=signed-integer-overflow" } */
+
+#define ASM1(a) asm volatile ("" : "+g" (a))
+#define ASM2(a, b) asm volatile ("" : "+g" (a), "+g" (b))
+
+#include "overflow-1.c"
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-add-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-add-1.c
new file mode 100644
index 000000000..fd6c6d325
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-add-1.c
@@ -0,0 +1,67 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=signed-integer-overflow -Wno-unused-variable" } */
+
+#include <stdio.h>
+
+#define SCHAR_MAX __SCHAR_MAX__
+#define SHRT_MAX __SHRT_MAX__
+#define INT_MAX __INT_MAX__
+#define INT_MIN (-__INT_MAX__ - 1)
+
+void __attribute__((noinline,noclone))
+check (int i, int j)
+{
+ if (i != j)
+ __builtin_abort ();
+}
+
+int
+main (void)
+{
+ fputs ("UBSAN TEST START\n", stderr);
+
+#if __INT_MAX__ == 2147483647
+ /* Here, nothing should fail. */
+ volatile int j = INT_MAX;
+ volatile int i = -1;
+ volatile int k = j + i;
+ check (k, 2147483646);
+ k = i + j;
+ check (k, 2147483646);
+ j--;
+ check (j, 2147483646);
+
+ i = 1;
+ j = INT_MIN;
+ k = i + j;
+ check (k, -2147483647);
+ k = j + i;
+ check (k, -2147483647);
+ j++;
+ check (j, -2147483647);
+#endif
+
+ /* Test integer promotion. */
+#if __SCHAR_MAX__ == 127
+ volatile signed char a = SCHAR_MAX;
+ volatile signed char b = 1;
+ volatile signed char c = a + b;
+ check (c, -128);
+ a++;
+ check (a, -128);
+#endif
+
+#if __SHRT_MAX__ == 32767
+ volatile short d = SHRT_MAX;
+ volatile short e = 1;
+ volatile short f = d + e;
+ check (f, -32768);
+ d++;
+ check (d, -32768);
+#endif
+
+ fputs ("UBSAN TEST END\n", stderr);
+ return 0;
+}
+
+/* { dg-output "UBSAN TEST START(\n|\r\n|\r)UBSAN TEST END" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-add-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-add-2.c
new file mode 100644
index 000000000..85499d86c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-add-2.c
@@ -0,0 +1,60 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=signed-integer-overflow -Wno-unused-variable" } */
+
+#define INT_MAX __INT_MAX__
+#define INT_MIN (-__INT_MAX__ - 1)
+#define LONG_MAX __LONG_MAX__
+#define LONG_MIN (-__LONG_MAX__ - 1L)
+#define LLONG_MAX __LONG_LONG_MAX__
+#define LLONG_MIN (-__LONG_LONG_MAX__ - 1L)
+
+int
+main (void)
+{
+ volatile int j = INT_MAX;
+ volatile int i = 1;
+ volatile int k = j + i;
+ k = i + j;
+ j++;
+ j = INT_MAX - 100;
+ j += (1 << 10);
+
+ j = INT_MIN;
+ i = -1;
+ k = i + j;
+ k = j + i;
+ j = INT_MIN + 100;
+ j += -(1 << 10);
+
+ volatile long int m = LONG_MAX;
+ volatile long int n = 1;
+ volatile long int o = m + n;
+ o = n + m;
+ m++;
+ m = LONG_MAX - 100;
+ m += (1 << 10);
+
+ m = LONG_MIN;
+ n = -1;
+ o = m + n;
+ o = n + m;
+ m = LONG_MIN + 100;
+ m += -(1 << 10);
+
+ return 0;
+}
+
+/* { dg-output "signed integer overflow: 2147483647 \\+ 1 cannot be represented in type 'int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: 1 \\+ 2147483647 cannot be represented in type 'int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: 2147483647 \\+ 1 cannot be represented in type 'int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: 2147483547 \\+ 1024 cannot be represented in type 'int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: -1 \\+ -2147483648 cannot be represented in type 'int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: -2147483648 \\+ -1 cannot be represented in type 'int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: -2147483548 \\+ -1024 cannot be represented in type 'int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: \[^\n\r]* \\+ 1 cannot be represented in type 'long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: 1 \\+ \[^\n\r]* cannot be represented in type 'long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: \[^\n\r]* \\+ 1 cannot be represented in type 'long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: \[^\n\r]* \\+ 1024 cannot be represented in type 'long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: -\[^\n\r]* \\+ -1 cannot be represented in type 'long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: -1 \\+ -\[^\n\r]* cannot be represented in type 'long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: -\[^\n\r]* \\+ -1024 cannot be represented in type 'long int'" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-int128.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-int128.c
new file mode 100644
index 000000000..9a850243d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-int128.c
@@ -0,0 +1,47 @@
+/* { dg-do run } */
+/* { dg-require-effective-target int128 } */
+/* { dg-options "-fsanitize=signed-integer-overflow" } */
+
+/* 2^127 - 1 */
+#define INT128_MAX (__int128) (((unsigned __int128) 1 << ((__SIZEOF_INT128__ * __CHAR_BIT__) - 1)) - 1)
+#define INT128_MIN (-INT128_MAX - 1)
+
+int
+main (void)
+{
+ volatile __int128 i = INT128_MAX;
+ volatile __int128 j = 1;
+ volatile __int128 k = i + j;
+ k = j + i;
+ i++;
+ j = INT128_MAX - 100;
+ j += (1 << 10);
+
+ j = INT128_MIN;
+ i = -1;
+ k = i + j;
+ k = j + i;
+ j--;
+ j = INT128_MIN + 100;
+ j += -(1 << 10);
+
+ i = INT128_MAX;
+ j = 2;
+ k = i * j;
+
+ i = INT128_MIN;
+ i = -i;
+
+ return 0;
+}
+
+/* { dg-output "signed integer overflow: 0x7fffffffffffffffffffffffffffffff \\+ 1 cannot be represented in type '__int128'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: 1 \\+ 0x7fffffffffffffffffffffffffffffff cannot be represented in type '__int128'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: 0x7fffffffffffffffffffffffffffffff \\+ 1 cannot be represented in type '__int128'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: 0x7fffffffffffffffffffffffffffff9b \\+ 1024 cannot be represented in type '__int128'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: -1 \\+ 0x80000000000000000000000000000000 cannot be represented in type '__int128'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: 0x80000000000000000000000000000000 \\+ -1 cannot be represented in type '__int128'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: 0x80000000000000000000000000000000 \\+ -1 cannot be represented in type '__int128'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: 0x80000000000000000000000000000064 \\+ -1024 cannot be represented in type '__int128'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: 0x7fffffffffffffffffffffffffffffff \\* 2 cannot be represented in type '__int128'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*negation of 0x80000000000000000000000000000000 cannot be represented in type '__int128'; cast to an unsigned type to negate this value to itself(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-mul-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-mul-1.c
new file mode 100644
index 000000000..afb1a2596
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-mul-1.c
@@ -0,0 +1,53 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=signed-integer-overflow -Wno-unused-variable" } */
+
+#include <stdio.h>
+
+#define SCHAR_MAX __SCHAR_MAX__
+#define SHRT_MAX __SHRT_MAX__
+#define INT_MAX __INT_MAX__
+#define INT_MIN (-__INT_MAX__ - 1)
+
+void __attribute__((noinline,noclone))
+check (int i, int j)
+{
+ if (i != j)
+ __builtin_abort ();
+}
+
+int
+main (void)
+{
+ fputs ("UBSAN TEST START\n", stderr);
+
+ /* Test integer promotion. */
+#if __SCHAR_MAX__ == 127
+ volatile signed char a = -2;
+ volatile signed char b = SCHAR_MAX;
+ volatile signed char c = a * b;
+ check (c, 2);
+#endif
+
+#if __SHRT_MAX__ == 32767
+ volatile short d = SHRT_MAX;
+ volatile short e = 2;
+ volatile short f = d * e;
+ check (f, -2);
+#endif
+
+#if __INT_MAX__ == 2147483647
+ volatile int m = INT_MAX;
+ volatile int n = 1;
+ volatile int o = m * n;
+ check (o, INT_MAX);
+
+ m = INT_MIN;
+ o = m * n;
+ check (o, INT_MIN);
+#endif
+
+ fputs ("UBSAN TEST END\n", stderr);
+ return 0;
+}
+
+/* { dg-output "UBSAN TEST START(\n|\r\n|\r)UBSAN TEST END" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-mul-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-mul-2.c
new file mode 100644
index 000000000..ece25a354
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-mul-2.c
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=signed-integer-overflow -Wno-unused-variable" } */
+
+#define INT_MAX __INT_MAX__
+#define LONG_MAX __LONG_MAX__
+
+int
+main (void)
+{
+ volatile int j = INT_MAX;
+ volatile int i = 2;
+ volatile int k = j * i;
+ k = i * j;
+
+ volatile long int m = LONG_MAX;
+ volatile long int n = 2;
+ volatile long int o = m * n;
+ o = n * m;
+
+ return 0;
+}
+
+/* { dg-output "signed integer overflow: 2147483647 \\* 2 cannot be represented in type 'int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: 2 \\* 2147483647 cannot be represented in type 'int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: \[^\n\r]* \\* 2 cannot be represented in type 'long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: 2 \\* \[^\n\r]* cannot be represented in type 'long int'" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-mul-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-mul-3.c
new file mode 100644
index 000000000..037609be0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-mul-3.c
@@ -0,0 +1,46 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=signed-integer-overflow" } */
+
+#include <stdio.h>
+
+__attribute__((noinline, noclone)) long long
+mul (long long x, long long y)
+{
+ return x * y;
+}
+
+long long tab[] = {
+ 0x7fffffffLL, 0x7fffffffLL, 0x3fffffff00000001LL,
+ -0x80000000LL, -0x80000000LL, 0x4000000000000000LL,
+ 0x7fffffffLL, -0x80000000LL, -0x3fffffff80000000LL,
+ -0x80000000LL, 0x7fffffffLL, -0x3fffffff80000000LL,
+ 3LL, 5LL, 15LL,
+ -3LL, -9LL, 27LL,
+ 6LL, -7LL, -42LL,
+ -12LL, 13LL, -156LL,
+ 0x1555555555555555LL, 6LL, 0x7ffffffffffffffeLL,
+ -0x1555555555555555LL, -6LL, 0x7ffffffffffffffeLL,
+ 0x1555555555555555LL, -6LL, -0x7ffffffffffffffeLL,
+ -0x1555555555555555LL, 6LL, -0x7ffffffffffffffeLL,
+ 0x81234567LL, 0xfdbe971fLL, 0x7fffffffbea72879LL,
+ -0x81234567LL, -0xfdbe971fLL, 0x7fffffffbea72879LL,
+ 0x81234567LL, -0xfdbe971fLL, -0x7fffffffbea72879LL,
+ -0x81234567LL, 0xfdbe971fLL, -0x7fffffffbea72879LL
+};
+
+int
+main ()
+{
+ fputs ("UBSAN TEST START\n", stderr);
+
+ unsigned int i;
+ for (i = 0; i < sizeof (tab) / sizeof (long long); i += 3)
+ if (mul (tab[i], tab[i + 1]) != tab[i + 2]
+ || mul (tab[i + 1], tab[i]) != tab[i + 2])
+ __builtin_abort ();
+
+ fputs ("UBSAN TEST END\n", stderr);
+ return 0;
+}
+
+/* { dg-output "UBSAN TEST START(\n|\r\n|\r)UBSAN TEST END" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-mul-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-mul-4.c
new file mode 100644
index 000000000..82e114001
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-mul-4.c
@@ -0,0 +1,86 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=signed-integer-overflow" } */
+
+
+int
+main ()
+{
+#define MUL_WITH_CHECK(xv, yv, zv) \
+ do { \
+ long long x = xv; \
+ long long y = yv; \
+ long long z; \
+ asm ("" : "+g" (x)); \
+ asm ("" : "+g" (y)); \
+ z = x * y; \
+ asm ("" : "+g" (z)); \
+ if (z != zv) \
+ __builtin_abort (); \
+ } while (0)
+ MUL_WITH_CHECK (0x1555555555555556LL, 6LL, -0x7ffffffffffffffcLL);
+ MUL_WITH_CHECK (-0x1555555555555556LL, -6LL, -0x7ffffffffffffffcLL);
+ MUL_WITH_CHECK (0x1555555555555556LL, -6LL, 0x7ffffffffffffffcLL);
+ MUL_WITH_CHECK (-0x1555555555555556LL, 6LL, 0x7ffffffffffffffcLL);
+ MUL_WITH_CHECK (0x81234568LL, 0xfdbe971fLL, -0x7fffffff439a4068LL);
+ MUL_WITH_CHECK (-0x81234568LL, -0xfdbe971fLL, -0x7fffffff439a4068LL);
+ MUL_WITH_CHECK (0x81234568LL, -0xfdbe971fLL, 0x7fffffff439a4068LL);
+ MUL_WITH_CHECK (-0x81234568LL, 0xfdbe971fLL, 0x7fffffff439a4068LL);
+ MUL_WITH_CHECK (0x1555555555555555LL, 7LL, -0x6aaaaaaaaaaaaaadLL);
+ MUL_WITH_CHECK (-0x1555555555555555LL, -7LL, -0x6aaaaaaaaaaaaaadLL);
+ MUL_WITH_CHECK (0x1555555555555555LL, -7LL, 0x6aaaaaaaaaaaaaadLL);
+ MUL_WITH_CHECK (-0x1555555555555555LL, 7LL, 0x6aaaaaaaaaaaaaadLL);
+ MUL_WITH_CHECK (0x81234567LL, 0xfdbe9720LL, -0x7fffffffc0359220LL);
+ MUL_WITH_CHECK (-0x81234567LL, -0xfdbe9720LL, -0x7fffffffc0359220LL);
+ MUL_WITH_CHECK (0x81234567LL, -0xfdbe9720LL, 0x7fffffffc0359220LL);
+ MUL_WITH_CHECK (-0x81234567LL, 0xfdbe9720LL, 0x7fffffffc0359220LL);
+ MUL_WITH_CHECK (6LL, 0x1555555555555556LL, -0x7ffffffffffffffcLL);
+ MUL_WITH_CHECK (-6LL, -0x1555555555555556LL, -0x7ffffffffffffffcLL);
+ MUL_WITH_CHECK (-6LL, 0x1555555555555556LL, 0x7ffffffffffffffcLL);
+ MUL_WITH_CHECK (6LL, -0x1555555555555556LL, 0x7ffffffffffffffcLL);
+ MUL_WITH_CHECK (0xfdbe971fLL, 0x81234568LL, -0x7fffffff439a4068LL);
+ MUL_WITH_CHECK (-0xfdbe971fLL, -0x81234568LL, -0x7fffffff439a4068LL);
+ MUL_WITH_CHECK (-0xfdbe971fLL, 0x81234568LL, 0x7fffffff439a4068LL);
+ MUL_WITH_CHECK (0xfdbe971fLL, -0x81234568LL, 0x7fffffff439a4068LL);
+ MUL_WITH_CHECK (7LL, 0x1555555555555555LL, -0x6aaaaaaaaaaaaaadLL);
+ MUL_WITH_CHECK (-7LL, -0x1555555555555555LL, -0x6aaaaaaaaaaaaaadLL);
+ MUL_WITH_CHECK (-7LL, 0x1555555555555555LL, 0x6aaaaaaaaaaaaaadLL);
+ MUL_WITH_CHECK (7LL, -0x1555555555555555LL, 0x6aaaaaaaaaaaaaadLL);
+ MUL_WITH_CHECK (0xfdbe9720LL, 0x81234567LL, -0x7fffffffc0359220LL);
+ MUL_WITH_CHECK (-0xfdbe9720LL, -0x81234567LL, -0x7fffffffc0359220LL);
+ MUL_WITH_CHECK (-0xfdbe9720LL, 0x81234567LL, 0x7fffffffc0359220LL);
+ MUL_WITH_CHECK (0xfdbe9720LL, -0x81234567LL, 0x7fffffffc0359220LL);
+ return 0;
+}
+
+/* { dg-output "overflow-mul-4.c:20:\[^\n\r]*signed integer overflow: 1537228672809129302 \\* 6 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:21:\[^\n\r]*signed integer overflow: -1537228672809129302 \\* -6 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:22:\[^\n\r]*signed integer overflow: 1537228672809129302 \\* -6 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:23:\[^\n\r]*signed integer overflow: -1537228672809129302 \\* 6 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:24:\[^\n\r]*signed integer overflow: 2166572392 \\* 4257126175 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:25:\[^\n\r]*signed integer overflow: -2166572392 \\* -4257126175 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:26:\[^\n\r]*signed integer overflow: 2166572392 \\* -4257126175 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:27:\[^\n\r]*signed integer overflow: -2166572392 \\* 4257126175 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:28:\[^\n\r]*signed integer overflow: 1537228672809129301 \\* 7 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:29:\[^\n\r]*signed integer overflow: -1537228672809129301 \\* -7 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:30:\[^\n\r]*signed integer overflow: 1537228672809129301 \\* -7 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:31:\[^\n\r]*signed integer overflow: -1537228672809129301 \\* 7 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:32:\[^\n\r]*signed integer overflow: 2166572391 \\* 4257126176 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:33:\[^\n\r]*signed integer overflow: -2166572391 \\* -4257126176 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:34:\[^\n\r]*signed integer overflow: 2166572391 \\* -4257126176 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:35:\[^\n\r]*signed integer overflow: -2166572391 \\* 4257126176 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:36:\[^\n\r]*signed integer overflow: 6 \\* 1537228672809129302 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:37:\[^\n\r]*signed integer overflow: -6 \\* -1537228672809129302 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:38:\[^\n\r]*signed integer overflow: -6 \\* 1537228672809129302 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:39:\[^\n\r]*signed integer overflow: 6 \\* -1537228672809129302 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:40:\[^\n\r]*signed integer overflow: 4257126175 \\* 2166572392 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:41:\[^\n\r]*signed integer overflow: -4257126175 \\* -2166572392 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:42:\[^\n\r]*signed integer overflow: -4257126175 \\* 2166572392 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:43:\[^\n\r]*signed integer overflow: 4257126175 \\* -2166572392 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:44:\[^\n\r]*signed integer overflow: 7 \\* 1537228672809129301 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:45:\[^\n\r]*signed integer overflow: -7 \\* -1537228672809129301 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:46:\[^\n\r]*signed integer overflow: -7 \\* 1537228672809129301 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:47:\[^\n\r]*signed integer overflow: 7 \\* -1537228672809129301 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:48:\[^\n\r]*signed integer overflow: 4257126176 \\* 2166572391 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:49:\[^\n\r]*signed integer overflow: -4257126176 \\* -2166572391 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:50:\[^\n\r]*signed integer overflow: -4257126176 \\* 2166572391 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*overflow-mul-4.c:51:\[^\n\r]*signed integer overflow: 4257126176 \\* -2166572391 cannot be represented in type 'long long int'" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-negate-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-negate-1.c
new file mode 100644
index 000000000..85f81d8b5
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-negate-1.c
@@ -0,0 +1,38 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=signed-integer-overflow -Wno-unused-variable" } */
+
+#define INT_MIN (-__INT_MAX__ - 1)
+#define LONG_MIN (-__LONG_MAX__ - 1L)
+#define LLONG_MIN (-__LONG_LONG_MAX__ - 1LL)
+
+int
+main (void)
+{
+ int e = 1, f = -1;
+ volatile int i = INT_MIN;
+ volatile int i2 = i & (((((((-i) + 1) - 1) + 1) - 1) + 1) - 1);
+ i2 = -(i + e + f);
+ i = -i;
+
+ volatile long int li = LONG_MIN;
+ volatile long int li2 = li & (((((((-li) + 1) - 1) + 1) - 1) + 1) - 1);
+ li2 = -(li + e + f);
+ li = -li;
+
+ volatile long long int lli = LLONG_MIN;
+ volatile long long int lli2 = lli & (((((((-lli) + 1) - 1) + 1) - 1) + 1) - 1);
+ lli2 = -(lli + e + f);
+ lli = -lli;
+
+ return 0;
+}
+
+/* { dg-output "negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*negation of -\[^\n\r]* cannot be represented in type 'long int'; cast to an unsigned type to negate this value to itself(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*negation of -\[^\n\r]* cannot be represented in type 'long int'; cast to an unsigned type to negate this value to itself(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*negation of -\[^\n\r]* cannot be represented in type 'long int'; cast to an unsigned type to negate this value to itself(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*negation of -9223372036854775808 cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*negation of -9223372036854775808 cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*negation of -9223372036854775808 cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-negate-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-negate-2.c
new file mode 100644
index 000000000..6a4f288bb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-negate-2.c
@@ -0,0 +1,45 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=signed-integer-overflow -Wno-unused-variable" } */
+
+#include <stdio.h>
+
+#define SCHAR_MIN (-__SCHAR_MAX__ - 1)
+#define SHRT_MIN (-__SHRT_MAX__ - 1)
+#define INT_MIN (-__INT_MAX__ - 1)
+#define LONG_MIN (-__LONG_MAX__ - 1L)
+#define LLONG_MIN (-__LONG_LONG_MAX__ - 1LL)
+
+#define CHECK(A, B) ({ if ((A) != (B)) __builtin_abort (); })
+
+int
+main (void)
+{
+ fputs ("UBSAN TEST START\n", stderr);
+
+ volatile signed char c = -SCHAR_MIN;
+ CHECK (c, -128);
+
+ volatile short s = -SHRT_MIN;
+ CHECK (s, -32768);
+
+ volatile int i = INT_MIN;
+ i = -(unsigned) i;
+ CHECK (i, -0x80000000);
+
+ volatile long int li = LONG_MIN;
+ li = -(unsigned long) li;
+#if __LONG_MAX__ == 2147483647L
+ CHECK (li, -0x80000000L);
+#elif __LONG_MAX__ == 9223372036854775807L
+ CHECK (li, -0x8000000000000000L);
+#endif
+
+ volatile long long lli = LLONG_MIN;
+ lli = -(unsigned long long) lli;
+ CHECK (lli, -0x8000000000000000L);
+
+ fputs ("UBSAN TEST END\n", stderr);
+ return 0;
+}
+
+/* { dg-output "UBSAN TEST START(\n|\r\n|\r)UBSAN TEST END" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-sub-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-sub-1.c
new file mode 100644
index 000000000..15f04455e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-sub-1.c
@@ -0,0 +1,69 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=signed-integer-overflow -Wno-unused-variable" } */
+
+#include <stdio.h>
+
+#define SCHAR_MAX __SCHAR_MAX__
+#define SCHAR_MIN (-__SCHAR_MAX__ - 1)
+#define SHRT_MAX __SHRT_MAX__
+#define SHRT_MIN (-__SHRT_MAX__ - 1)
+#define INT_MAX __INT_MAX__
+#define INT_MIN (-__INT_MAX__ - 1)
+
+void __attribute__((noinline,noclone))
+check (int i, int j)
+{
+ if (i != j)
+ __builtin_abort ();
+}
+
+int
+main (void)
+{
+ fputs ("UBSAN TEST START\n", stderr);
+
+#if __INT_MAX__ == 2147483647
+ /* Here, nothing should fail. */
+ volatile int i = -1;
+ volatile int j = INT_MIN;
+ volatile int k = j - i;
+ check (k, -2147483647);
+ k = i - j;
+ check (k, 2147483647);
+ j++;
+ check (j, -2147483647);
+
+ i = 1;
+ j = INT_MAX;
+ k = i - j;
+ check (k, -2147483646);
+ k = j - i;
+ check (k, 2147483646);
+ j--;
+ check (k, 2147483646);
+#endif
+
+ /* Test integer promotion. */
+#if __SCHAR_MAX__ == 127
+ volatile signed char a = SCHAR_MIN;
+ volatile signed char b = 1;
+ volatile signed char c = a - b;
+ check (c, 127);
+ a--;
+ check (a, 127);
+#endif
+
+#if __SHRT_MAX__ == 32767
+ volatile short d = SHRT_MIN;
+ volatile short e = 1;
+ volatile short f = d - e;
+ check (f, 32767);
+ d--;
+ check (d, 32767);
+#endif
+
+ fputs ("UBSAN TEST END\n", stderr);
+ return 0;
+}
+
+/* { dg-output "UBSAN TEST START(\n|\r\n|\r)UBSAN TEST END" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-sub-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-sub-2.c
new file mode 100644
index 000000000..6476b65d2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-sub-2.c
@@ -0,0 +1,54 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=signed-integer-overflow -Wno-unused-variable" } */
+
+#define INT_MAX __INT_MAX__
+#define INT_MIN (-__INT_MAX__ - 1)
+#define LONG_MAX __LONG_MAX__
+#define LONG_MIN (-__LONG_MAX__ - 1L)
+#define LLONG_MAX __LONG_LONG_MAX__
+#define LLONG_MIN (-__LONG_LONG_MAX__ - 1L)
+
+int
+main (void)
+{
+ volatile int j = INT_MIN;
+ volatile int i = 1;
+ volatile int k = j - i;
+ j--;
+ j = INT_MIN + 100;
+ j -= (1 << 10);
+
+ j = INT_MIN;
+ i = -1;
+ k = j - -i;
+
+ i = INT_MIN + 1000;
+ i -= (1 << 20);
+
+ volatile long int l = LONG_MIN;
+ volatile long int m = 1;
+ volatile long int n = l - m;
+ l--;
+ l = LONG_MIN + 100;
+ l -= (1 << 10);
+
+ l = LONG_MIN;
+ m = -1;
+ n = l - -m;
+
+ m = LONG_MIN + 1000;
+ m -= (1 << 20);
+
+ return 0;
+}
+
+/* { dg-output "signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: -2147483648 \\+ -1 cannot be represented in type 'int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: -2147483548 \\+ -1024 cannot be represented in type 'int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: -2147483648 \\+ -1 cannot be represented in type 'int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: -2147482648 \\+ -1048576 cannot be represented in type 'int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: -\[^\n\r]* - 1 cannot be represented in type 'long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: -\[^\n\r]* \\+ -1 cannot be represented in type 'long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: -\[^\n\r]* \\+ -1024 cannot be represented in type 'long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: -\[^\n\r]* \\+ -1 cannot be represented in type 'long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: -\[^\n\r]* \\+ -1048576 cannot be represented in type 'long int'" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr58443-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr58443-1.c
new file mode 100644
index 000000000..76f1dda07
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr58443-1.c
@@ -0,0 +1,11 @@
+/* PR sanitizer/58443 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=shift,unreachable -w" } */
+
+int
+foo (int u, int o)
+{
+ return u / o;
+}
+
+/* { dg-final { scan-assembler-not "__ubsan_handle_divrem_overflow" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr58443-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr58443-2.c
new file mode 100644
index 000000000..a135758a8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr58443-2.c
@@ -0,0 +1,11 @@
+/* PR sanitizer/58443 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=unreachable,integer-divide-by-zero -w" } */
+
+int
+foo (int u, int o)
+{
+ return u >> o;
+}
+
+/* { dg-final { scan-assembler-not "__ubsan_handle_shift_out_of_bounds" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr58443-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr58443-3.c
new file mode 100644
index 000000000..5696a62df
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr58443-3.c
@@ -0,0 +1,18 @@
+/* PR sanitizer/58443 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=undefined -w" } */
+
+int
+foo (int u, int o)
+{
+ return u >> o;
+}
+
+int
+bar (int u, int o)
+{
+ return u / o;
+}
+
+/* { dg-final { scan-assembler "__ubsan_handle_divrem_overflow" } } */
+/* { dg-final { scan-assembler "__ubsan_handle_shift_out_of_bounds" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr59333.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr59333.c
new file mode 100644
index 000000000..b68775702
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr59333.c
@@ -0,0 +1,18 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=undefined" } */
+
+long long int __attribute__ ((noinline, noclone))
+foo (long long int i, long long int j)
+{
+ asm ("");
+ return i + j;
+}
+
+int
+main (void)
+{
+ foo (2LL, __LONG_LONG_MAX__);
+ return 0;
+}
+
+/* { dg-output "signed integer overflow: 2 \\+ 9223372036854775807 cannot be represented in type 'long long int'" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr59397.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr59397.c
new file mode 100644
index 000000000..0de025835
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr59397.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=signed-integer-overflow" } */
+
+typedef enum E { A = -1 } e;
+int
+foo (void)
+{
+ e e = A;
+ return e + 1;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr59503.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr59503.c
new file mode 100644
index 000000000..1637f01b5
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr59503.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=signed-integer-overflow" } */
+
+#include <stdio.h>
+
+int
+main (void)
+{
+ fputs ("UBSAN TEST START\n", stderr);
+
+ long long int a = 14;
+ long int b = 9;
+ asm volatile ("" : "+r" (a), "+r" (b));
+ if ((a - b) != 5)
+ __builtin_abort ();
+
+ fputs ("UBSAN TEST END\n", stderr);
+ return 0;
+}
+
+/* { dg-output "UBSAN TEST START(\n|\r\n|\r)UBSAN TEST END" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr59667.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr59667.c
new file mode 100644
index 000000000..7fad70299
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr59667.c
@@ -0,0 +1,14 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=undefined" } */
+/* { dg-shouldfail "ubsan" } */
+
+int
+main (void)
+{
+ unsigned int len = 1;
+ float (*P)[len][len] = 0;
+ (*P)[0][0] = 1;
+ return 0;
+}
+
+/* { dg-output "store to null pointer of type 'float'(\n|\r\n|\r)" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr60613-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr60613-1.c
new file mode 100644
index 000000000..6794532a4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr60613-1.c
@@ -0,0 +1,41 @@
+/* PR sanitizer/60613 */
+/* { dg-do run } */
+/* { dg-options "-fsanitize=undefined" } */
+
+#include <stdio.h>
+
+long long y;
+
+__attribute__((noinline, noclone)) long long
+foo (long long x)
+{
+ asm ("");
+ if (x >= 0 || x < -2040)
+ return 23;
+ x += 2040;
+ return x - y;
+}
+
+__attribute__((noinline, noclone)) long long
+bar (long long x)
+{
+ asm ("");
+ return 8LL - x;
+}
+
+int
+main ()
+{
+ fputs ("UBSAN TEST START\n", stderr);
+
+ y = 1;
+ if (foo (8 - 2040) != 8 - 1)
+ __builtin_abort ();
+ if (bar (1) != 8 - 1)
+ __builtin_abort ();
+
+ fputs ("UBSAN TEST END\n", stderr);
+ return 0;
+}
+
+/* { dg-output "UBSAN TEST START(\n|\r\n|\r)UBSAN TEST END" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr60613-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr60613-2.c
new file mode 100644
index 000000000..92c2de81e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/pr60613-2.c
@@ -0,0 +1,36 @@
+/* PR sanitizer/60613 */
+/* { dg-do run } */
+/* { dg-options "-fsanitize=undefined" } */
+
+long long y;
+
+__attribute__((noinline, noclone)) long long
+foo (long long x)
+{
+ asm ("");
+ if (x >= 0 || x < -2040)
+ return 23;
+ x += 2040;
+ return x - y;
+}
+
+__attribute__((noinline, noclone)) long long
+bar (long long x)
+{
+ asm ("");
+ return 8LL - x;
+}
+
+int
+main ()
+{
+ y = -__LONG_LONG_MAX__ + 6;
+ if (foo (8 - 2040) != -__LONG_LONG_MAX__)
+ __builtin_abort ();
+ if (bar (-__LONG_LONG_MAX__ + 5) != -__LONG_LONG_MAX__ + 1)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-output "signed integer overflow: 8 \\- -9223372036854775801 cannot be represented in type 'long long int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*signed integer overflow: 8 \\- -9223372036854775802 cannot be represented in type 'long long int'" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/save-expr-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/save-expr-1.c
new file mode 100644
index 000000000..19b1eb08b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/save-expr-1.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=shift -Wall -Werror -O" } */
+
+#include <stdio.h>
+
+static int x;
+int
+main (void)
+{
+ fputs ("UBSAN TEST START\n", stderr);
+
+ int o = 1;
+ int y = x << o;
+
+ fputs ("UBSAN TEST END\n", stderr);
+ return y;
+}
+
+/* { dg-output "UBSAN TEST START(\n|\r\n|\r)UBSAN TEST END" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/save-expr-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/save-expr-2.c
new file mode 100644
index 000000000..14ac17def
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/save-expr-2.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=shift -Wall -Werror -O" } */
+
+int
+foo (int i, unsigned int u)
+{
+ return u / i;
+}
+
+int
+bar (int i, unsigned int u)
+{
+ return u % i;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/save-expr-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/save-expr-3.c
new file mode 100644
index 000000000..dd2903bd6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/save-expr-3.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=shift -Wall -Werror -O" } */
+
+int x;
+
+int
+foo (int i, int u)
+{
+ return (i << u) << x;
+}
+
+int
+bar (int i, int u)
+{
+ return (i >> u) >> x;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/save-expr-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/save-expr-4.c
new file mode 100644
index 000000000..aa34a70ed
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/save-expr-4.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=shift -Wall -Werror -O" } */
+
+int x;
+
+int
+foo (int i, unsigned int u)
+{
+ return (i % u) << (x / u);
+}
+
+int
+bar (int i, unsigned int u)
+{
+ return (((x % u) << (u / i)) >> x);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-1.c
new file mode 100644
index 000000000..d2538802a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-1.c
@@ -0,0 +1,31 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=shift -w" } */
+
+typedef const unsigned long long int CULLI;
+typedef volatile int VI;
+struct s { signed long int a; };
+
+int
+main (void)
+{
+ int a = 1;
+ struct s s = { .a = 400 };
+ CULLI culli = 42;
+ VI vi = 370;
+ volatile int shiftcount = 153;
+
+ a <<= 152;
+ 1 << shiftcount;
+ 1 << 154;
+ culli << 524;
+ 1 << vi++;
+ (long) 1 << (s.a + 2);
+
+ return 0;
+}
+/* { dg-output "shift exponent 152 is too large for \[^\n\r]*-bit type 'int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*shift exponent 153 is too large for \[^\n\r]*-bit type 'int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*shift exponent 154 is too large for \[^\n\r]*-bit type 'int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*shift exponent 524 is too large for \[^\n\r]*-bit type 'long long unsigned int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*shift exponent 370 is too large for \[^\n\r]*-bit type 'int'(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*shift exponent 402 is too large for \[^\n\r]*-bit type 'long int'" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-2.c
new file mode 100644
index 000000000..aaaeb6fcc
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-2.c
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=shift -w" } */
+
+int
+main (void)
+{
+ int a = 1;
+ volatile int b = -5;
+ long long int c = -6;
+
+ a << -3;
+ 1 << -4;
+ 1 << b;
+ a << c;
+ a << (b + c);
+
+ return 0;
+}
+/* { dg-output "shift exponent -3 is negative(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*shift exponent -4 is negative(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*shift exponent -5 is negative(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*shift exponent -6 is negative(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*shift exponent -11 is negative" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-3.c
new file mode 100644
index 000000000..65ee5d882
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-3.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=shift -w" } */
+
+#include <stdio.h>
+
+int
+main (void)
+{
+ fputs ("UBSAN TEST START\n", stderr);
+
+ unsigned int a = 1;
+ a <<= 31;
+ a <<= 1;
+
+ fputs ("UBSAN TEST END\n", stderr);
+ return 0;
+}
+
+/* { dg-output "UBSAN TEST START(\n|\r\n|\r)UBSAN TEST END" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-4.c
new file mode 100644
index 000000000..5f095b61a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-4.c
@@ -0,0 +1,14 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=shift -w" } */
+
+struct S { unsigned long long int b:40; } s;
+
+int
+main ()
+{
+ s.b = 2;
+ s.b <<= 120;
+ return 0;
+}
+
+/* { dg-output "shift exponent 120 is too large\[^\n\r]*" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-5.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-5.c
new file mode 100644
index 000000000..6f9c52a72
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-5.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=shift -w" } */
+/* { dg-shouldfail "ubsan" } */
+
+int x;
+int
+foo (void)
+{
+ /* None of the following should pass. */
+ switch (x)
+ {
+ case 1 >> -1:
+/* { dg-error "case label does not reduce to an integer constant" "" {target c } 12 } */
+/* { dg-error "is not a constant expression" "" { target c++ } 12 } */
+ case -1 >> -1:
+/* { dg-error "case label does not reduce to an integer constant" "" {target c } 15 } */
+/* { dg-error "is not a constant expression" "" { target c++ } 15 } */
+ case 1 << -1:
+/* { dg-error "case label does not reduce to an integer constant" "" {target c } 18 } */
+/* { dg-error "is not a constant expression" "" { target c++ } 18 } */
+ case -1 << -1:
+/* { dg-error "case label does not reduce to an integer constant" "" {target c } 21 } */
+/* { dg-error "is not a constant expression" "" { target c++ } 21 } */
+ case -1 >> 200:
+/* { dg-error "case label does not reduce to an integer constant" "" {target c } 24 } */
+/* { dg-error "is not a constant expression" "" { target c++ } 24 } */
+ case 1 << 200:
+/* { dg-error "case label does not reduce to an integer constant" "" {target c } 27 } */
+/* { dg-error "is not a constant expression" "" { target c++ } 27 } */
+ return 1;
+ }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-6.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-6.c
new file mode 100644
index 000000000..d88a42910
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-6.c
@@ -0,0 +1,38 @@
+/* PR sanitizer/58413 */
+/* { dg-do run { target int32plus } } */
+/* { dg-options "-fsanitize=shift -w" } */
+
+#include <stdio.h>
+
+int x = 7;
+int
+main (void)
+{
+ fputs ("UBSAN TEST START\n", stderr);
+
+ /* All of the following should pass. */
+ int A[128 >> 5] = {};
+ int B[128 << 5] = {};
+
+ static int e =
+ ((int)
+ (0x00000000 | ((31 & ((1 << (4)) - 1)) << (((15) + 6) + 4)) |
+ ((0) << ((15) + 6)) | ((0) << (15))));
+
+ if (e != 503316480)
+ __builtin_abort ();
+
+ switch (x)
+ {
+ case 1 >> 4:
+ case 1 << 4:
+ case 128 << (4 + 1):
+ case 128 >> (4 + 1):
+ return 1;
+ }
+
+ fputs ("UBSAN TEST END\n", stderr);
+ return 0;
+}
+
+/* { dg-output "UBSAN TEST START(\n|\r\n|\r)UBSAN TEST END" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/typedef-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/typedef-1.c
new file mode 100644
index 000000000..8dcf451c3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/typedef-1.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=undefined" } */
+
+typedef int V;
+int
+foo (void)
+{
+ V v = 9;
+ int a = 3;
+ v += v % a;
+ return v / 3;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/undefined-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/undefined-1.c
new file mode 100644
index 000000000..d1b9ce787
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/undefined-1.c
@@ -0,0 +1,33 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=undefined" } */
+
+#include <stdio.h>
+
+int
+foo (int x, int y)
+{
+ const int z = 2;
+ if (z & 1)
+ return x << y;
+ return 0;
+}
+
+int
+bar (int x, int y)
+{
+ return x + y;
+}
+
+int
+main (void)
+{
+ fputs ("UBSAN TEST START\n", stderr);
+
+ foo (3, 2);
+ bar (12, 42);
+
+ fputs ("UBSAN TEST END\n", stderr);
+ return 0;
+}
+
+/* { dg-output "UBSAN TEST START(\n|\r\n|\r)UBSAN TEST END" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/unreachable-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/unreachable-1.c
new file mode 100644
index 000000000..336240c96
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/unreachable-1.c
@@ -0,0 +1,10 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=unreachable" } */
+/* { dg-shouldfail "ubsan" } */
+
+int
+main (void)
+{
+ __builtin_unreachable ();
+}
+ /* { dg-output "execution reached a __builtin_unreachable\\(\\) call" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/vla-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/vla-1.c
new file mode 100644
index 000000000..0fecfa2a3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/vla-1.c
@@ -0,0 +1,119 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=vla-bound -Wall -Wno-unused-variable" } */
+
+typedef long int V;
+int x = -1;
+double di = -3.2;
+V v = -6;
+
+static int __attribute__ ((noinline, noclone))
+bar (void)
+{
+ return -4;
+}
+
+static void __attribute__ ((noinline, noclone))
+fn1 (void)
+{
+ int a[x];
+}
+
+static void __attribute__ ((noinline, noclone))
+fn2 (void)
+{
+ int a[x][x];
+}
+
+static void __attribute__ ((noinline, noclone))
+fn3 (void)
+{
+ int a[x][x][x];
+}
+
+static void __attribute__ ((noinline, noclone))
+fn4 (void)
+{
+ int b[x - 4];
+}
+
+static void __attribute__ ((noinline, noclone))
+fn5 (void)
+{
+ int c[(int) di];
+}
+
+static void __attribute__ ((noinline, noclone))
+fn6 (void)
+{
+ int d[1 + x];
+}
+
+static void __attribute__ ((noinline, noclone))
+fn7 (void)
+{
+ int e[1 ? x : -1];
+}
+
+static void __attribute__ ((noinline, noclone))
+fn8 (void)
+{
+ int f[++x];
+}
+
+static void __attribute__ ((noinline, noclone))
+fn9 (void)
+{
+ int g[(signed char) --x];
+}
+
+static void __attribute__ ((noinline, noclone))
+fn10 (void)
+{
+ int h[(++x, --x, x)];
+}
+
+static void __attribute__ ((noinline, noclone))
+fn11 (void)
+{
+ int i[v];
+}
+
+static void __attribute__ ((noinline, noclone))
+fn12 (void)
+{
+ int j[bar ()];
+}
+
+int
+main (void)
+{
+ fn1 ();
+ fn2 ();
+ fn3 ();
+ fn4 ();
+ fn5 ();
+ fn6 ();
+ fn7 ();
+ fn8 ();
+ fn9 ();
+ fn10 ();
+ fn11 ();
+ fn12 ();
+ return 0;
+}
+
+/* { dg-output "variable length array bound evaluates to non-positive value -1(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -1(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -1(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -1(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -1(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -1(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -5(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -3(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value 0(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -1(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value 0(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -1(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -1(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -6(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -4" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/vla-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/vla-2.c
new file mode 100644
index 000000000..a11e4e722
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/vla-2.c
@@ -0,0 +1,22 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=vla-bound -Wall -Wno-unused-variable" } */
+
+#include <stdio.h>
+
+int
+main (void)
+{
+ fputs ("UBSAN TEST START\n", stderr);
+
+ const int t = 0;
+ struct s {
+ int x;
+ /* Don't instrument this one. */
+ int g[t];
+ };
+
+ fputs ("UBSAN TEST END\n", stderr);
+ return 0;
+}
+
+/* { dg-output "UBSAN TEST START(\n|\r\n|\r)UBSAN TEST END" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/vla-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/vla-3.c
new file mode 100644
index 000000000..7772857fd
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/vla-3.c
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=vla-bound" } */
+
+#include <stdio.h>
+
+/* Don't instrument the arrays here. */
+int
+foo (int n, int a[])
+{
+ return a[n - 1];
+}
+
+int
+main (void)
+{
+ fputs ("UBSAN TEST START\n", stderr);
+
+ int a[6] = { };
+ int ret = foo (3, a);
+
+ fputs ("UBSAN TEST END\n", stderr);
+ return ret;
+}
+
+/* { dg-output "UBSAN TEST START(\n|\r\n|\r)UBSAN TEST END" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/vla-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/vla-4.c
new file mode 100644
index 000000000..8a7bbac9a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/vla-4.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=vla-bound" } */
+
+#include <stdio.h>
+
+int
+main (void)
+{
+ fputs ("UBSAN TEST START\n", stderr);
+
+ int x = 1;
+ /* Check that the size of an array is evaluated only once. */
+ int a[++x];
+ if (x != 2)
+ __builtin_abort ();
+
+ fputs ("UBSAN TEST END\n", stderr);
+ return 0;
+}
+
+/* { dg-output "UBSAN TEST START(\n|\r\n|\r)UBSAN TEST END" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/uninit-17.c b/gcc-4.9/gcc/testsuite/c-c++-common/uninit-17.c
new file mode 100644
index 000000000..fd773da78
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/uninit-17.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wuninitialized -fno-ivopts" } */
+
+inline int foo(int x)
+{
+ return x;
+}
+static void bar(int a, int *ptr)
+{
+ do
+ {
+ int b; /* { dg-message "declared" } */
+ if (b < 40) {
+ ptr[0] = b; /* { dg-warning "may be used uninitialized" } */
+ }
+ b += 1;
+ ptr++;
+ }
+ while (--a != 0);
+}
+void foobar(int a, int *ptr)
+{
+ bar(foo(a), ptr);
+}
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/uninit-D-O0.c b/gcc-4.9/gcc/testsuite/c-c++-common/uninit-D-O0.c
new file mode 100644
index 000000000..e63cb80ae
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/uninit-D-O0.c
@@ -0,0 +1,9 @@
+/* Test we do not warn about initializing variable with self. */
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized" } */
+
+int f()
+{
+ int i = i;
+ return i;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/uninit-D.c b/gcc-4.9/gcc/testsuite/c-c++-common/uninit-D.c
new file mode 100644
index 000000000..ea957e49e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/uninit-D.c
@@ -0,0 +1,9 @@
+/* Test we do not warn about initializing variable with self. */
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized" } */
+
+int f()
+{
+ int i = i;
+ return i;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/uninit-E-O0.c b/gcc-4.9/gcc/testsuite/c-c++-common/uninit-E-O0.c
new file mode 100644
index 000000000..2cc245966
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/uninit-E-O0.c
@@ -0,0 +1,9 @@
+/* Test we do warn about initializing variable with self when -Winit-self is supplied. */
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized -Winit-self" } */
+
+int f()
+{
+ int i = i; /* { dg-warning "i" "uninitialized variable warning" } */
+ return i;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/uninit-E.c b/gcc-4.9/gcc/testsuite/c-c++-common/uninit-E.c
new file mode 100644
index 000000000..eb356c3ee
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/uninit-E.c
@@ -0,0 +1,9 @@
+/* Test we do warn about initializing variable with self when -Winit-self is supplied. */
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized -Winit-self" } */
+
+int f()
+{
+ int i = i; /* { dg-warning "i" "uninitialized variable warning" } */
+ return i;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/uninit-F-O0.c b/gcc-4.9/gcc/testsuite/c-c++-common/uninit-F-O0.c
new file mode 100644
index 000000000..737cc6500
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/uninit-F-O0.c
@@ -0,0 +1,9 @@
+/* Test we do warn about initializing variable with self in the initialization. */
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized" } */
+
+int f()
+{
+ int i = i + 1; /* { dg-warning "i" "uninitialized variable warning" } */
+ return i;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/uninit-F.c b/gcc-4.9/gcc/testsuite/c-c++-common/uninit-F.c
new file mode 100644
index 000000000..1dbb365e5
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/uninit-F.c
@@ -0,0 +1,9 @@
+/* Test we do warn about initializing variable with self in the initialization. */
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized" } */
+
+int f()
+{
+ int i = i + 1; /* { dg-warning "i" "uninitialized variable warning" } */
+ return i;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/uninit-G-O0.c b/gcc-4.9/gcc/testsuite/c-c++-common/uninit-G-O0.c
new file mode 100644
index 000000000..d6edffede
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/uninit-G-O0.c
@@ -0,0 +1,9 @@
+/* Test we do not warn about initializing variable with address of self in the initialization. */
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized" } */
+
+void *f()
+{
+ void *i = &i;
+ return i;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/uninit-G.c b/gcc-4.9/gcc/testsuite/c-c++-common/uninit-G.c
new file mode 100644
index 000000000..08f5f5321
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/uninit-G.c
@@ -0,0 +1,9 @@
+/* Test we do not warn about initializing variable with address of self in the initialization. */
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized" } */
+
+void *f()
+{
+ void *i = &i;
+ return i;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/uninit-pr51010.c b/gcc-4.9/gcc/testsuite/c-c++-common/uninit-pr51010.c
new file mode 100644
index 000000000..f28da4656
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/uninit-pr51010.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized" } */
+
+int f (int j)
+{
+ int a [10];
+ return a [j]; /* { dg-warning "a\\\[j\\\]. is used uninitialized" } */
+}
+int g (int j)
+{
+ int a [10];
+ return a [j+1]; /* { dg-warning "a\\\[<unknown>\\\]. is used uninitialized" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/vector-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/vector-1.c
new file mode 100644
index 000000000..288dd1e92
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/vector-1.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+/* Check for application of ~ on vector types. */
+
+#define vector __attribute__((vector_size(16) ))
+
+vector float a;
+vector int a1;
+
+int f(void)
+{
+ a = ~a; /* { dg-error "" } */
+ a1 = ~a1;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/vector-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/vector-2.c
new file mode 100644
index 000000000..e9f40a358
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/vector-2.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+/* Check for application of |, ^, and & on vector types. */
+#define vector __attribute__((vector_size(16) ))
+
+vector float a;
+vector int a1;
+vector float b;
+vector int b1;
+
+int f(void)
+{
+ a = a | b; /* { dg-error "" } */
+ a = a & b; /* { dg-error "" } */
+ a = a ^ b; /* { dg-error "" } */
+ a1 = a1 | b1;
+ a1 = a1 & b1;
+ a1 = a1 ^ b1;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/vector-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/vector-3.c
new file mode 100644
index 000000000..0f5d3c411
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/vector-3.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+
+/* Check that we error out when using vector_size on the bool type. */
+
+#ifdef __cplusplus
+#define _Bool bool
+#endif
+__attribute__((vector_size(16) )) _Bool a; /* { dg-error "" } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/vector-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/vector-4.c
new file mode 100644
index 000000000..cc4d5041f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/vector-4.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-fno-common" { target { { hppa*-*-hpux* } && { ! lp64 } } } } */
+#define vector __attribute__((vector_size(4*sizeof(int)) ))
+
+vector int a, b, c;
+
+
+/* Test that remainder works for vectors. */
+void f(void)
+{
+ a = b % c;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/vector-compare-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/vector-compare-1.c
new file mode 100644
index 000000000..8416c8df5
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/vector-compare-1.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-mabi=altivec" { target { { powerpc*-*-linux* } && ilp32 } } } */
+/* { dg-prune-output "operand types are" } */
+/* Ignore warning on some powerpc-ibm-aix configurations. */
+/* { dg-prune-output "non-standard ABI extension" } */
+
+#define vector(elcount, type) \
+__attribute__((vector_size((elcount)*sizeof(type)))) type
+
+void
+foo (vector (4, int) x, vector (4, float) y)
+{
+ vector (4, int) p4;
+ vector (4, int) r4;
+ vector (4, unsigned int) q4;
+ vector (8, int) r8;
+ vector (4, float) f4;
+
+ r4 = x > y; /* { dg-error "comparing vectors with different element types" } */
+ r8 = (x != p4); /* { dg-error "incompatible types when assigning to type|cannot convert" } */
+ r8 == r4; /* { dg-error "comparing vectors with different number of elements" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/vector-compare-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/vector-compare-2.c
new file mode 100644
index 000000000..5ebe9e3ca
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/vector-compare-2.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-fno-common" { target hppa*-*-hpux* } } */
+/* { dg-options "-mabi=altivec" { target { { powerpc*-*-linux* } && ilp32 } } } */
+/* { dg-options "-msse2" { target { i?86-*-* x86_64-*-* } } } */
+/* Ignore warning on some powerpc-ibm-aix configurations. */
+/* { dg-prune-output "non-standard ABI extension" } */
+
+/* Test if C_MAYBE_CONST are folded correctly when
+ creating VEC_COND_EXPR. */
+
+typedef int vec __attribute__((vector_size(16)));
+
+vec i,j;
+extern vec a, b, c;
+
+extern int p, q, z;
+extern vec foo (int);
+
+vec
+foo (int x)
+{
+ return foo (p ? q :z) > a;
+}
+
+vec
+bar (int x)
+{
+ return b > foo (p ? q :z);
+}
+
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/vector-compare-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/vector-compare-3.c
new file mode 100644
index 000000000..d6b0dac7c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/vector-compare-3.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef int v4i __attribute__((vector_size(4*sizeof(int))));
+
+// fold should not turn (vec_other)(x<y) into (x<y)?vec_other(-1):vec_other(0).
+
+void use (v4i const *z);
+
+void
+f (v4i *x, v4i *y)
+{
+ v4i const zz = *x < *y;
+ use (&zz);
+}
+
+// Optimizations shouldn't introduce a boolean type in there
+
+void
+g (v4i *x, v4i const *y, v4i *z, v4i *t)
+{
+ *z = *x < *y | *x == *y;
+ *t = *x < *y & *x > *y;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/vector-init-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/vector-init-1.c
new file mode 100644
index 000000000..5baf95688
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/vector-init-1.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+
+/* PR C/31499, test that the C front-end treats vectors like an array. */
+
+#define vector __attribute__((__vector_size__(4*sizeof(int)) ))
+vector signed int v1[]={0,1,2,3,4,5,6,7};
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/vector-init-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/vector-init-2.c
new file mode 100644
index 000000000..6527f495d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/vector-init-2.c
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+
+/* PR C/31499, test that the C front-end treats vectors like an array
+ and that it works at runtime. */
+
+#define vector __attribute__((__vector_size__(4*sizeof(int)) ))
+vector signed int v1[]={0,1,2,3,4,5,6,7};
+
+
+int main(void)
+{
+ int i;
+ for (i = 0; i < sizeof(v1)/sizeof(v1[0]); i++)
+ {
+ vector int t = v1[i];
+ int *d = (int*)&t;
+ int j;
+ for (j = 0; j < 4; j++)
+ {
+ if (d[j] != i * 4 + j)
+ __builtin_abort ();
+ }
+ }
+ return 0;
+} \ No newline at end of file
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/vector-scalar-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/vector-scalar-2.c
new file mode 100644
index 000000000..f624c4c75
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/vector-scalar-2.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-gimple" } */
+
+typedef int veci __attribute__ ((vector_size (4 * sizeof (int))));
+
+int c;
+
+void f (veci *a)
+{
+ *a = *a + ++c;
+}
+
+/* { dg-final { scan-tree-dump-times " \\\+ 1" 1 "gimple" } } */
+/* { dg-final { cleanup-tree-dump "gimple" } } */
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/vector-scalar.c b/gcc-4.9/gcc/testsuite/c-c++-common/vector-scalar.c
new file mode 100644
index 000000000..1b32cc67b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/vector-scalar.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+
+typedef float vecf __attribute__ ((vector_size (4 * sizeof (float))));
+typedef short veci __attribute__ ((vector_size (8 * sizeof (short))));
+
+void f (vecf *d, veci *i)
+{
+ (void) ((*d *= 2) < 0);
+ (void) ((((*i - 1) >> 2) != 0) | *i);
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/vector-shift.c b/gcc-4.9/gcc/testsuite/c-c++-common/vector-shift.c
new file mode 100644
index 000000000..593bb3669
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/vector-shift.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-prune-output "in evaluation of" } */
+#define vector(elcount, type) \
+__attribute__((vector_size((elcount)*sizeof(type)))) type
+
+int main (int argc, char *argv[]) {
+ vector(4,char) vchar = {1,2,3,4};
+ vector(4, int) vint = {1,1,1,1};
+
+ vint <<= vchar; /* { dg-error "nvalid operands to binary <<" } */
+ vchar >>= vint; /* { dg-error "nvalid operands to binary >>" } */
+
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/vector-shift1.c b/gcc-4.9/gcc/testsuite/c-c++-common/vector-shift1.c
new file mode 100644
index 000000000..db8035667
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/vector-shift1.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-prune-output "in evaluation of" } */
+#define vector(elcount, type) \
+__attribute__((vector_size((elcount)*sizeof(type)))) type
+
+int main (int argc, char *argv[]) {
+ vector(4, float) vfloat0 = {1., 2., 3., 4.};
+ vector(4, float) vfloat1 = {1., 2., 3., 4.};
+
+ vector(4, int) vint = {1, 1, 1, 1 };
+
+ vint <<= vfloat0; /* { dg-error "nvalid operands to binary <<" } */
+ vfloat0 >>= vint; /* { dg-error "nvalid operands to binary >>" } */
+
+ vfloat0 <<= vfloat1; /* { dg-error "nvalid operands" } */
+
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/vector-shift3.c b/gcc-4.9/gcc/testsuite/c-c++-common/vector-shift3.c
new file mode 100644
index 000000000..c26fb8d98
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/vector-shift3.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#define vector(elcount, type) \
+__attribute__((vector_size((elcount)*sizeof(type)))) type
+
+
+int main (int argc, char *argv[]) {
+ vector(8, short) v0 = {(short)argc,2,3,4,5,6,7};
+ short sc;
+
+
+ scalar1 <<= v0; /* { dg-error "scalar1.*(undeclared|was not declared)" } */
+
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/vector-subscript-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/vector-subscript-1.c
new file mode 100644
index 000000000..c18b7b674
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/vector-subscript-1.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-w" } */
+
+#define vector __attribute__((vector_size(16) ))
+/* Check that vector[index] works and index[vector] is rejected. */
+
+float vf(vector float a)
+{
+ return 0[a]; /* { dg-error "subscripted value is neither array nor pointer nor vector|invalid types .* for array subscript" } */
+}
+
+
+float fv(vector float a)
+{
+ return a[0];
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/vector-subscript-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/vector-subscript-2.c
new file mode 100644
index 000000000..84d55b91d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/vector-subscript-2.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+
+/* Check that subscripting of vectors work with register storage class decls. */
+
+#define vector __attribute__((vector_size(16) ))
+
+
+float vf(int i)
+{
+ register vector float a;
+ return a[0];
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/vector-subscript-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/vector-subscript-3.c
new file mode 100644
index 000000000..22cd089ad
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/vector-subscript-3.c
@@ -0,0 +1,18 @@
+/* Check the case when index is out of bound */
+/* { dg-do compile } */
+/* { dg-options "-Warray-bounds" } */
+
+#define vector __attribute__((vector_size(16) ))
+
+
+int test0(void)
+{
+ vector int a;
+ return a[10]; /* { dg-warning "index value is out of bound" } */
+}
+
+int test1(void)
+{
+ vector int a;
+ return a[-1]; /* { dg-warning "index value is out of bound" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/vla-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/vla-1.c
new file mode 100644
index 000000000..401c4e055
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/vla-1.c
@@ -0,0 +1,21 @@
+/* Test that changes to a variable are reflected in a VLA later in the
+ expression. */
+/* { dg-options "" } */
+
+#ifdef __cplusplus
+extern "C"
+#endif
+void abort();
+
+int i = 4;
+int f()
+{
+ return i;
+}
+
+int main()
+{
+ if (i+=2, sizeof(*(int(*)[f()])0) != 6*sizeof(int))
+ abort();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/warn-ommitted-condop.c b/gcc-4.9/gcc/testsuite/c-c++-common/warn-ommitted-condop.c
new file mode 100644
index 000000000..0726f0439
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/warn-ommitted-condop.c
@@ -0,0 +1,29 @@
+/* { dg-options "-Wparentheses -ftrack-macro-expansion=0" } */
+
+extern void f2 (int);
+
+void bar (int x, int y, int z)
+{
+#define T(op) f2 (x op y ? : 1)
+#define T2(op) f2 (x op y ? 2 : 1)
+
+ T(<); /* { dg-warning "omitted middle operand" } */
+ T(>); /* { dg-warning "omitted middle operand" } */
+ T(<=); /* { dg-warning "omitted middle operand" } */
+ T(>=); /* { dg-warning "omitted middle operand" } */
+ T(==); /* { dg-warning "omitted middle operand" } */
+ T(!=); /* { dg-warning "omitted middle operand" } */
+ T(||); /* { dg-warning "omitted middle operand" } */
+ T(&&); /* { dg-warning "omitted middle operand" } */
+ f2 (!x ? : 1); /* { dg-warning "omitted middle operand" } */
+ T2(<); /* { dg-bogus "omitted middle operand" } */
+ T2(>); /* { dg-bogus "omitted middle operand" } */
+ T2(==); /* { dg-bogus "omitted middle operand" } */
+ T2(||); /* { dg-bogus "omitted middle operand" } */
+ T2(&&); /* { dg-bogus "omitted middle operand" } */
+ T(+); /* { dg-bogus "omitted middle operand" } */
+ T(-); /* { dg-bogus "omitted middle operand" } */
+ T(*); /* { dg-bogus "omitted middle operand" } */
+ T(/); /* { dg-bogus "omitted middle operand" } */
+ T(^); /* { dg-bogus "omitted middle operand" } */
+}