From ee8f136a72fe40cfa88ed44c141218d2a8ae606f Mon Sep 17 00:00:00 2001 From: Ilya Enkovich Date: Tue, 10 Mar 2015 09:39:59 +0000 Subject: [PATCH] mpx-dg.exp (mpx_link_flags): New. gcc/testsuites/ * gcc/testsuite/lib/mpx-dg.exp (mpx_link_flags): New. (mpx_init): New. (mpx_finish): New. * gcc.target/i386/mpx/alloca-1-lbv.c: New. * gcc.target/i386/mpx/alloca-1-nov.c: New. * gcc.target/i386/mpx/alloca-1-ubv.c: New. * gcc.target/i386/mpx/arg-addr-1-lbv.c: New. * gcc.target/i386/mpx/arg-addr-1-nov.c: New. * gcc.target/i386/mpx/arg-addr-1-ubv.c: New. * gcc.target/i386/mpx/bitfields-1-lbv.c: New. * gcc.target/i386/mpx/bitfields-1-nov.c: New. * gcc.target/i386/mpx/bitfields-1-ubv.c: New. * gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-1-lbv.c: New. * gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-1-nov.c: New. * gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-1-ubv.c: New. * gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-2.c: New. * gcc.target/i386/mpx/builtin-bnd-chk-ptr-lbounds-1-lbv.c: New. * gcc.target/i386/mpx/builtin-bnd-chk-ptr-lbounds-1-nov.c: New. * gcc.target/i386/mpx/builtin-bnd-chk-ptr-lbounds-2.c: New. * gcc.target/i386/mpx/builtin-bnd-chk-ptr-ubounds-1-nov.c: New. * gcc.target/i386/mpx/builtin-bnd-chk-ptr-ubounds-1-ubv.c: New. * gcc.target/i386/mpx/builtin-bnd-chk-ptr-ubounds-2.c: New. * gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-1.c: New. * gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-2-lbv.c: New. * gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-2-nov.c: New. * gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-2-ubv.c: New. * gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-3.c: New. * gcc.target/i386/mpx/builtin-bnd-get-ptr-lbound-1.c: New. * gcc.target/i386/mpx/builtin-bnd-get-ptr-lbound-2.c: New. * gcc.target/i386/mpx/builtin-bnd-get-ptr-ubound-1.c: New. * gcc.target/i386/mpx/builtin-bnd-get-ptr-ubound-2.c: New. * gcc.target/i386/mpx/builtin-bnd-init-ptr-bounds-1.c: New. * gcc.target/i386/mpx/builtin-bnd-init-ptr-bounds-2-nov.c: New. * gcc.target/i386/mpx/builtin-bnd-init-ptr-bounds-3.c: New. * gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-1.c: New. * gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-2-lbv.c: New. * gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-2-nov.c: New. * gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-2-ubv.c: New. * gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-3-lbv.c: New. * gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-3-nov.c: New. * gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-3-ubv.c: New. * gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-4.c: New. * gcc.target/i386/mpx/builtin-bnd-null-ptr-bounds-1-bbv.c: New. * gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-1.c: New. * gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-2-lbv.c: New. * gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-2-nov.c: New. * gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-2-ubv.c: New. * gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-3.c: New. * gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-1-lbv.c: New. * gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-1-nov.c: New. * gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-1-ubv.c: New. * gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-2.c: New. * gcc.target/i386/mpx/fastcall-1-lbv.c: New. * gcc.target/i386/mpx/fastcall-1-nov.c: New. * gcc.target/i386/mpx/fastcall-1-ubv.c: New. * gcc.target/i386/mpx/fastcall-2-lbv.c: New. * gcc.target/i386/mpx/fastcall-2-nov.c: New. * gcc.target/i386/mpx/fastcall-2-ubv.c: New. * gcc.target/i386/mpx/field-addr-1-lbv.c: New. * gcc.target/i386/mpx/field-addr-1-nov.c: New. * gcc.target/i386/mpx/field-addr-1-ubv.c: New. * gcc.target/i386/mpx/field-addr-10-lbv.c: New. * gcc.target/i386/mpx/field-addr-10-nov.c: New. * gcc.target/i386/mpx/field-addr-10-ubv.c: New. * gcc.target/i386/mpx/field-addr-2-lbv.c: New. * gcc.target/i386/mpx/field-addr-2-nov.c: New. * gcc.target/i386/mpx/field-addr-2-ubv.c: New. * gcc.target/i386/mpx/field-addr-3-lbv.c: New. * gcc.target/i386/mpx/field-addr-3-nov.c: New. * gcc.target/i386/mpx/field-addr-3-ubv.c: New. * gcc.target/i386/mpx/field-addr-4-lbv.c: New. * gcc.target/i386/mpx/field-addr-4-nov.c: New. * gcc.target/i386/mpx/field-addr-4-ubv.c: New. * gcc.target/i386/mpx/field-addr-5-lbv.c: New. * gcc.target/i386/mpx/field-addr-5-nov.c: New. * gcc.target/i386/mpx/field-addr-5-ubv.c: New. * gcc.target/i386/mpx/field-addr-6-lbv.c: New. * gcc.target/i386/mpx/field-addr-6-nov.c: New. * gcc.target/i386/mpx/field-addr-6-ubv.c: New. * gcc.target/i386/mpx/field-addr-7-lbv.c: New. * gcc.target/i386/mpx/field-addr-7-nov.c: New. * gcc.target/i386/mpx/field-addr-7-ubv.c: New. * gcc.target/i386/mpx/field-addr-8-lbv.c: New. * gcc.target/i386/mpx/field-addr-8-nov.c: New. * gcc.target/i386/mpx/field-addr-8-ubv.c: New. * gcc.target/i386/mpx/field-addr-9-lbv.c: New. * gcc.target/i386/mpx/field-addr-9-nov.c: New. * gcc.target/i386/mpx/field-addr-9-ubv.c: New. * gcc.target/i386/mpx/frame-address-1-nov.c: New. * gcc.target/i386/mpx/hard-reg-1-nov.c: New. * gcc.target/i386/mpx/if-stmt-1-lbv.c: New. * gcc.target/i386/mpx/if-stmt-1-nov.c: New. * gcc.target/i386/mpx/if-stmt-1-ubv.c: New. * gcc.target/i386/mpx/if-stmt-2-lbv.c: New. * gcc.target/i386/mpx/if-stmt-2-nov.c: New. * gcc.target/i386/mpx/if-stmt-2-ubv.c: New. * gcc.target/i386/mpx/label-address-1.c: New. * gcc.target/i386/mpx/legacy-1-nov.c: New. * gcc.target/i386/mpx/macro.c: New. * gcc.target/i386/mpx/mpx-check.h: New. * gcc.target/i386/mpx/mpx.exp: New. * gcc.target/i386/mpx/nested-function-1-lbv.c: New. * gcc.target/i386/mpx/nested-function-1-nov.c: New. * gcc.target/i386/mpx/nested-function-1-ubv.c: New. * gcc.target/i386/mpx/pointer-arg-1-lbv.c: New. * gcc.target/i386/mpx/pointer-arg-1-nov.c: New. * gcc.target/i386/mpx/pointer-arg-1-ubv.c: New. * gcc.target/i386/mpx/pointer-arg-2-lbv.c: New. * gcc.target/i386/mpx/pointer-arg-2-nov.c: New. * gcc.target/i386/mpx/pointer-arg-2-ubv.c: New. * gcc.target/i386/mpx/pointer-arg-3-lbv.c: New. * gcc.target/i386/mpx/pointer-arg-3-nov.c: New. * gcc.target/i386/mpx/pointer-arg-3-ubv.c: New. * gcc.target/i386/mpx/pointer-arg-4-lbv.c: New. * gcc.target/i386/mpx/pointer-arg-4-nov.c: New. * gcc.target/i386/mpx/pointer-arg-4-ubv.c: New. * gcc.target/i386/mpx/pointer-arg-5-lbv.c: New. * gcc.target/i386/mpx/pointer-arg-5-nov.c: New. * gcc.target/i386/mpx/pointer-arg-5-ubv.c: New. * gcc.target/i386/mpx/pointer-store-1-lbv.c: New. * gcc.target/i386/mpx/pointer-store-1-nov.c: New. * gcc.target/i386/mpx/pointer-store-1-ubv.c: New. * gcc.target/i386/mpx/reference-1-lbv.c: New. * gcc.target/i386/mpx/reference-1-nov.c: New. * gcc.target/i386/mpx/reference-1-ubv.c: New. * gcc.target/i386/mpx/reference-2-lbv.c: New. * gcc.target/i386/mpx/reference-2-nov.c: New. * gcc.target/i386/mpx/reference-2-ubv.c: New. * gcc.target/i386/mpx/reference-3-lbv.c: New. * gcc.target/i386/mpx/reference-3-nov.c: New. * gcc.target/i386/mpx/reference-3-ubv.c: New. * gcc.target/i386/mpx/reference-4-lbv.c: New. * gcc.target/i386/mpx/reference-4-nov.c: New. * gcc.target/i386/mpx/reference-4-ubv.c: New. * gcc.target/i386/mpx/return-pointer-1-lbv.c: New. * gcc.target/i386/mpx/return-pointer-1-nov.c: New. * gcc.target/i386/mpx/return-pointer-1-ubv.c: New. * gcc.target/i386/mpx/return-struct-1-lbv.c: New. * gcc.target/i386/mpx/return-struct-1-nov.c: New. * gcc.target/i386/mpx/return-struct-1-ubv.c: New. * gcc.target/i386/mpx/return-struct-2-lbv.c: New. * gcc.target/i386/mpx/return-struct-2-nov.c: New. * gcc.target/i386/mpx/return-struct-2-ubv.c: New. * gcc.target/i386/mpx/return-struct-3-lbv.c: New. * gcc.target/i386/mpx/return-struct-3-nov.c: New. * gcc.target/i386/mpx/return-struct-3-ubv.c: New. * gcc.target/i386/mpx/return-struct-4-lbv.c: New. * gcc.target/i386/mpx/return-struct-4-nov.c: New. * gcc.target/i386/mpx/return-struct-4-ubv.c: New. * gcc.target/i386/mpx/return-struct-5-lbv.c: New. * gcc.target/i386/mpx/return-struct-5-nov.c: New. * gcc.target/i386/mpx/return-struct-5-ubv.c: New. * gcc.target/i386/mpx/return-struct-6-lbv.c: New. * gcc.target/i386/mpx/return-struct-6-nov.c: New. * gcc.target/i386/mpx/return-struct-6-ubv.c: New. * gcc.target/i386/mpx/sincos-1-nov.c: New. * gcc.target/i386/mpx/static-array-1-lbv.c: New. * gcc.target/i386/mpx/static-array-1-nov.c: New. * gcc.target/i386/mpx/static-array-1-ubv.c: New. * gcc.target/i386/mpx/static-init-1-lbv.c: New. * gcc.target/i386/mpx/static-init-1-nov.c: New. * gcc.target/i386/mpx/static-init-1-ubv.c: New. * gcc.target/i386/mpx/static-init-2-lbv.c: New. * gcc.target/i386/mpx/static-init-2-nov.c: New. * gcc.target/i386/mpx/static-init-2-ubv.c: New. * gcc.target/i386/mpx/static-init-3-lbv.c: New. * gcc.target/i386/mpx/static-init-3-nov.c: New. * gcc.target/i386/mpx/static-init-3-ubv.c: New. * gcc.target/i386/mpx/static-init-4-lbv.c: New. * gcc.target/i386/mpx/static-init-4-nov.c: New. * gcc.target/i386/mpx/static-init-4-ubv.c: New. * gcc.target/i386/mpx/static-init-5-lbv.c: New. * gcc.target/i386/mpx/static-init-5-nov.c: New. * gcc.target/i386/mpx/static-init-5-ubv.c: New. * gcc.target/i386/mpx/static-init-6-lbv.c: New. * gcc.target/i386/mpx/static-init-6-nov.c: New. * gcc.target/i386/mpx/static-init-6-ubv.c: New. * gcc.target/i386/mpx/static-string-1-lbv.c: New. * gcc.target/i386/mpx/static-string-1-nov.c: New. * gcc.target/i386/mpx/static-string-1-ubv.c: New. * gcc.target/i386/mpx/struct-arg-1-lbv.c: New. * gcc.target/i386/mpx/struct-arg-1-nov.c: New. * gcc.target/i386/mpx/struct-arg-1-ubv.c: New. * gcc.target/i386/mpx/struct-arg-10-lbv.c: New. * gcc.target/i386/mpx/struct-arg-10-nov.c: New. * gcc.target/i386/mpx/struct-arg-10-ubv.c: New. * gcc.target/i386/mpx/struct-arg-2-lbv.c: New. * gcc.target/i386/mpx/struct-arg-2-nov.c: New. * gcc.target/i386/mpx/struct-arg-2-ubv.c: New. * gcc.target/i386/mpx/struct-arg-3-lbv.c: New. * gcc.target/i386/mpx/struct-arg-3-nov.c: New. * gcc.target/i386/mpx/struct-arg-3-ubv.c: New. * gcc.target/i386/mpx/struct-arg-4-lbv.c: New. * gcc.target/i386/mpx/struct-arg-4-nov.c: New. * gcc.target/i386/mpx/struct-arg-4-ubv.c: New. * gcc.target/i386/mpx/struct-arg-5-lbv.c: New. * gcc.target/i386/mpx/struct-arg-5-nov.c: New. * gcc.target/i386/mpx/struct-arg-5-ubv.c: New. * gcc.target/i386/mpx/struct-arg-6-lbv.c: New. * gcc.target/i386/mpx/struct-arg-6-nov.c: New. * gcc.target/i386/mpx/struct-arg-6-ubv.c: New. * gcc.target/i386/mpx/struct-arg-7-lbv.c: New. * gcc.target/i386/mpx/struct-arg-7-nov.c: New. * gcc.target/i386/mpx/struct-arg-7-ubv.c: New. * gcc.target/i386/mpx/struct-arg-8-lbv.c: New. * gcc.target/i386/mpx/struct-arg-8-nov.c: New. * gcc.target/i386/mpx/struct-arg-8-ubv.c: New. * gcc.target/i386/mpx/struct-arg-9-lbv.c: New. * gcc.target/i386/mpx/struct-arg-9-nov.c: New. * gcc.target/i386/mpx/struct-arg-9-ubv.c: New. * gcc.target/i386/mpx/struct-copy-1-lbv.c: New. * gcc.target/i386/mpx/struct-copy-1-nov.c: New. * gcc.target/i386/mpx/struct-copy-1-ubv.c: New. * gcc.target/i386/mpx/struct-copy-2-lbv.c: New. * gcc.target/i386/mpx/struct-copy-2-nov.c: New. * gcc.target/i386/mpx/struct-copy-2-ubv.c: New. * gcc.target/i386/mpx/thread-local-var-1-lbv.c: New. * gcc.target/i386/mpx/thread-local-var-1-nov.c: New. * gcc.target/i386/mpx/thread-local-var-1-ubv.c: New. * gcc.target/i386/mpx/union-arg-1-lbv.c: New. * gcc.target/i386/mpx/union-arg-1-nov.c: New. * gcc.target/i386/mpx/union-arg-1-ubv.c: New. * gcc.target/i386/mpx/va-arg-pack-1-lbv.c: New. * gcc.target/i386/mpx/va-arg-pack-1-nov.c: New. * gcc.target/i386/mpx/va-arg-pack-1-ubv.c: New. * gcc.target/i386/mpx/va-arg-pack-2-lbv.c: New. * gcc.target/i386/mpx/va-arg-pack-2-nov.c: New. * gcc.target/i386/mpx/va-arg-pack-2-ubv.c: New. * gcc.target/i386/mpx/vararg-1-lbv.c: New. * gcc.target/i386/mpx/vararg-1-nov.c: New. * gcc.target/i386/mpx/vararg-1-ubv.c: New. * gcc.target/i386/mpx/vararg-2-lbv.c: New. * gcc.target/i386/mpx/vararg-2-nov.c: New. * gcc.target/i386/mpx/vararg-2-ubv.c: New. * gcc.target/i386/mpx/vararg-3-lbv.c: New. * gcc.target/i386/mpx/vararg-3-nov.c: New. * gcc.target/i386/mpx/vararg-3-ubv.c: New. * gcc.target/i386/mpx/vararg-4-lbv.c: New. * gcc.target/i386/mpx/vararg-4-nov.c: New. * gcc.target/i386/mpx/vararg-4-ubv.c: New. * gcc.target/i386/mpx/vararg-5-lbv.c: New. * gcc.target/i386/mpx/vararg-5-nov.c: New. * gcc.target/i386/mpx/vararg-5-ubv.c: New. * gcc.target/i386/mpx/vararg-6-lbv.c: New. * gcc.target/i386/mpx/vararg-6-nov.c: New. * gcc.target/i386/mpx/vararg-6-ubv.c: New. * gcc.target/i386/mpx/vararg-7-lbv.c: New. * gcc.target/i386/mpx/vararg-7-nov.c: New. * gcc.target/i386/mpx/vararg-7-ubv.c: New. * gcc.target/i386/mpx/vararg-8-lbv.c: New. * gcc.target/i386/mpx/vararg-8-nov.c: New. * gcc.target/i386/mpx/vararg-8-ubv.c: New. * gcc.target/i386/mpx/vla-1-lbv.c: New. * gcc.target/i386/mpx/vla-1-nov.c: New. * gcc.target/i386/mpx/vla-1-ubv.c: New. * gcc.target/i386/mpx/vla-2-lbv.c: New. * gcc.target/i386/mpx/vla-2-nov.c: New. * gcc.target/i386/mpx/vla-2-ubv.c: New. From-SVN: r221312 --- gcc/testsuite/ChangeLog | 261 ++++++++++++++++++ .../gcc.target/i386/mpx/alloca-1-lbv.c | 24 ++ .../gcc.target/i386/mpx/alloca-1-nov.c | 22 ++ .../gcc.target/i386/mpx/alloca-1-ubv.c | 24 ++ .../gcc.target/i386/mpx/arg-addr-1-lbv.c | 27 ++ .../gcc.target/i386/mpx/arg-addr-1-nov.c | 24 ++ .../gcc.target/i386/mpx/arg-addr-1-ubv.c | 27 ++ .../gcc.target/i386/mpx/bitfields-1-lbv.c | 33 +++ .../gcc.target/i386/mpx/bitfields-1-nov.c | 31 +++ .../gcc.target/i386/mpx/bitfields-1-ubv.c | 33 +++ .../mpx/builtin-bnd-chk-ptr-bounds-1-lbv.c | 16 ++ .../mpx/builtin-bnd-chk-ptr-bounds-1-nov.c | 13 + .../mpx/builtin-bnd-chk-ptr-bounds-1-ubv.c | 16 ++ .../i386/mpx/builtin-bnd-chk-ptr-bounds-2.c | 14 + .../mpx/builtin-bnd-chk-ptr-lbounds-1-lbv.c | 16 ++ .../mpx/builtin-bnd-chk-ptr-lbounds-1-nov.c | 13 + .../i386/mpx/builtin-bnd-chk-ptr-lbounds-2.c | 13 + .../mpx/builtin-bnd-chk-ptr-ubounds-1-nov.c | 13 + .../mpx/builtin-bnd-chk-ptr-ubounds-1-ubv.c | 16 ++ .../i386/mpx/builtin-bnd-chk-ptr-ubounds-2.c | 13 + .../i386/mpx/builtin-bnd-copy-ptr-bounds-1.c | 13 + .../mpx/builtin-bnd-copy-ptr-bounds-2-lbv.c | 18 ++ .../mpx/builtin-bnd-copy-ptr-bounds-2-nov.c | 16 ++ .../mpx/builtin-bnd-copy-ptr-bounds-2-ubv.c | 18 ++ .../i386/mpx/builtin-bnd-copy-ptr-bounds-3.c | 13 + .../i386/mpx/builtin-bnd-get-ptr-lbound-1.c | 13 + .../i386/mpx/builtin-bnd-get-ptr-lbound-2.c | 13 + .../i386/mpx/builtin-bnd-get-ptr-ubound-1.c | 13 + .../i386/mpx/builtin-bnd-get-ptr-ubound-2.c | 13 + .../i386/mpx/builtin-bnd-init-ptr-bounds-1.c | 13 + .../mpx/builtin-bnd-init-ptr-bounds-2-nov.c | 16 ++ .../i386/mpx/builtin-bnd-init-ptr-bounds-3.c | 13 + .../mpx/builtin-bnd-narrow-ptr-bounds-1.c | 13 + .../mpx/builtin-bnd-narrow-ptr-bounds-2-lbv.c | 17 ++ .../mpx/builtin-bnd-narrow-ptr-bounds-2-nov.c | 15 + .../mpx/builtin-bnd-narrow-ptr-bounds-2-ubv.c | 17 ++ .../mpx/builtin-bnd-narrow-ptr-bounds-3-lbv.c | 17 ++ .../mpx/builtin-bnd-narrow-ptr-bounds-3-nov.c | 15 + .../mpx/builtin-bnd-narrow-ptr-bounds-3-ubv.c | 17 ++ .../mpx/builtin-bnd-narrow-ptr-bounds-4.c | 13 + .../mpx/builtin-bnd-null-ptr-bounds-1-bbv.c | 17 ++ .../i386/mpx/builtin-bnd-set-ptr-bounds-1.c | 13 + .../mpx/builtin-bnd-set-ptr-bounds-2-lbv.c | 17 ++ .../mpx/builtin-bnd-set-ptr-bounds-2-nov.c | 15 + .../mpx/builtin-bnd-set-ptr-bounds-2-ubv.c | 17 ++ .../i386/mpx/builtin-bnd-set-ptr-bounds-3.c | 13 + .../mpx/builtin-bnd-store-ptr-bounds-1-lbv.c | 20 ++ .../mpx/builtin-bnd-store-ptr-bounds-1-nov.c | 18 ++ .../mpx/builtin-bnd-store-ptr-bounds-1-ubv.c | 20 ++ .../i386/mpx/builtin-bnd-store-ptr-bounds-2.c | 16 ++ .../gcc.target/i386/mpx/fastcall-1-lbv.c | 26 ++ .../gcc.target/i386/mpx/fastcall-1-nov.c | 24 ++ .../gcc.target/i386/mpx/fastcall-1-ubv.c | 26 ++ .../gcc.target/i386/mpx/fastcall-2-lbv.c | 26 ++ .../gcc.target/i386/mpx/fastcall-2-nov.c | 24 ++ .../gcc.target/i386/mpx/fastcall-2-ubv.c | 26 ++ .../gcc.target/i386/mpx/field-addr-1-lbv.c | 29 ++ .../gcc.target/i386/mpx/field-addr-1-nov.c | 27 ++ .../gcc.target/i386/mpx/field-addr-1-ubv.c | 29 ++ .../gcc.target/i386/mpx/field-addr-10-lbv.c | 29 ++ .../gcc.target/i386/mpx/field-addr-10-nov.c | 27 ++ .../gcc.target/i386/mpx/field-addr-10-ubv.c | 29 ++ .../gcc.target/i386/mpx/field-addr-2-lbv.c | 30 ++ .../gcc.target/i386/mpx/field-addr-2-nov.c | 27 ++ .../gcc.target/i386/mpx/field-addr-2-ubv.c | 30 ++ .../gcc.target/i386/mpx/field-addr-3-lbv.c | 29 ++ .../gcc.target/i386/mpx/field-addr-3-nov.c | 27 ++ .../gcc.target/i386/mpx/field-addr-3-ubv.c | 29 ++ .../gcc.target/i386/mpx/field-addr-4-lbv.c | 35 +++ .../gcc.target/i386/mpx/field-addr-4-nov.c | 33 +++ .../gcc.target/i386/mpx/field-addr-4-ubv.c | 35 +++ .../gcc.target/i386/mpx/field-addr-5-lbv.c | 35 +++ .../gcc.target/i386/mpx/field-addr-5-nov.c | 33 +++ .../gcc.target/i386/mpx/field-addr-5-ubv.c | 35 +++ .../gcc.target/i386/mpx/field-addr-6-lbv.c | 36 +++ .../gcc.target/i386/mpx/field-addr-6-nov.c | 34 +++ .../gcc.target/i386/mpx/field-addr-6-ubv.c | 36 +++ .../gcc.target/i386/mpx/field-addr-7-lbv.c | 42 +++ .../gcc.target/i386/mpx/field-addr-7-nov.c | 40 +++ .../gcc.target/i386/mpx/field-addr-7-ubv.c | 42 +++ .../gcc.target/i386/mpx/field-addr-8-lbv.c | 43 +++ .../gcc.target/i386/mpx/field-addr-8-nov.c | 43 +++ .../gcc.target/i386/mpx/field-addr-8-ubv.c | 43 +++ .../gcc.target/i386/mpx/field-addr-9-lbv.c | 44 +++ .../gcc.target/i386/mpx/field-addr-9-nov.c | 42 +++ .../gcc.target/i386/mpx/field-addr-9-ubv.c | 44 +++ .../gcc.target/i386/mpx/frame-address-1-nov.c | 12 + .../gcc.target/i386/mpx/hard-reg-1-nov.c | 20 ++ .../gcc.target/i386/mpx/if-stmt-1-lbv.c | 30 ++ .../gcc.target/i386/mpx/if-stmt-1-nov.c | 28 ++ .../gcc.target/i386/mpx/if-stmt-1-ubv.c | 30 ++ .../gcc.target/i386/mpx/if-stmt-2-lbv.c | 30 ++ .../gcc.target/i386/mpx/if-stmt-2-nov.c | 28 ++ .../gcc.target/i386/mpx/if-stmt-2-ubv.c | 30 ++ .../gcc.target/i386/mpx/label-address-1.c | 14 + .../gcc.target/i386/mpx/legacy-1-nov.c | 25 ++ gcc/testsuite/gcc.target/i386/mpx/macro.c | 18 ++ gcc/testsuite/gcc.target/i386/mpx/mpx-check.h | 41 +++ gcc/testsuite/gcc.target/i386/mpx/mpx.exp | 39 +++ .../i386/mpx/nested-function-1-lbv.c | 22 ++ .../i386/mpx/nested-function-1-nov.c | 20 ++ .../i386/mpx/nested-function-1-ubv.c | 22 ++ .../gcc.target/i386/mpx/pointer-arg-1-lbv.c | 26 ++ .../gcc.target/i386/mpx/pointer-arg-1-nov.c | 24 ++ .../gcc.target/i386/mpx/pointer-arg-1-ubv.c | 26 ++ .../gcc.target/i386/mpx/pointer-arg-2-lbv.c | 26 ++ .../gcc.target/i386/mpx/pointer-arg-2-nov.c | 24 ++ .../gcc.target/i386/mpx/pointer-arg-2-ubv.c | 26 ++ .../gcc.target/i386/mpx/pointer-arg-3-lbv.c | 26 ++ .../gcc.target/i386/mpx/pointer-arg-3-nov.c | 24 ++ .../gcc.target/i386/mpx/pointer-arg-3-ubv.c | 26 ++ .../gcc.target/i386/mpx/pointer-arg-4-lbv.c | 27 ++ .../gcc.target/i386/mpx/pointer-arg-4-nov.c | 25 ++ .../gcc.target/i386/mpx/pointer-arg-4-ubv.c | 27 ++ .../gcc.target/i386/mpx/pointer-arg-5-lbv.c | 27 ++ .../gcc.target/i386/mpx/pointer-arg-5-nov.c | 25 ++ .../gcc.target/i386/mpx/pointer-arg-5-ubv.c | 27 ++ .../gcc.target/i386/mpx/pointer-store-1-lbv.c | 31 +++ .../gcc.target/i386/mpx/pointer-store-1-nov.c | 29 ++ .../gcc.target/i386/mpx/pointer-store-1-ubv.c | 31 +++ .../gcc.target/i386/mpx/reference-1-lbv.cpp | 33 +++ .../gcc.target/i386/mpx/reference-1-nov.cpp | 31 +++ .../gcc.target/i386/mpx/reference-1-ubv.cpp | 33 +++ .../gcc.target/i386/mpx/reference-2-lbv.cpp | 33 +++ .../gcc.target/i386/mpx/reference-2-nov.cpp | 31 +++ .../gcc.target/i386/mpx/reference-2-ubv.cpp | 33 +++ .../gcc.target/i386/mpx/reference-3-lbv.cpp | 27 ++ .../gcc.target/i386/mpx/reference-3-nov.cpp | 25 ++ .../gcc.target/i386/mpx/reference-3-ubv.cpp | 27 ++ .../gcc.target/i386/mpx/reference-4-lbv.cpp | 31 +++ .../gcc.target/i386/mpx/reference-4-nov.cpp | 29 ++ .../gcc.target/i386/mpx/reference-4-ubv.cpp | 31 +++ .../i386/mpx/return-pointer-1-lbv.c | 43 +++ .../i386/mpx/return-pointer-1-nov.c | 41 +++ .../i386/mpx/return-pointer-1-ubv.c | 43 +++ .../gcc.target/i386/mpx/return-struct-1-lbv.c | 38 +++ .../gcc.target/i386/mpx/return-struct-1-nov.c | 36 +++ .../gcc.target/i386/mpx/return-struct-1-ubv.c | 38 +++ .../gcc.target/i386/mpx/return-struct-2-lbv.c | 41 +++ .../gcc.target/i386/mpx/return-struct-2-nov.c | 39 +++ .../gcc.target/i386/mpx/return-struct-2-ubv.c | 41 +++ .../gcc.target/i386/mpx/return-struct-3-lbv.c | 41 +++ .../gcc.target/i386/mpx/return-struct-3-nov.c | 39 +++ .../gcc.target/i386/mpx/return-struct-3-ubv.c | 41 +++ .../gcc.target/i386/mpx/return-struct-4-lbv.c | 40 +++ .../gcc.target/i386/mpx/return-struct-4-nov.c | 38 +++ .../gcc.target/i386/mpx/return-struct-4-ubv.c | 40 +++ .../gcc.target/i386/mpx/return-struct-5-lbv.c | 40 +++ .../gcc.target/i386/mpx/return-struct-5-nov.c | 38 +++ .../gcc.target/i386/mpx/return-struct-5-ubv.c | 40 +++ .../gcc.target/i386/mpx/return-struct-6-lbv.c | 42 +++ .../gcc.target/i386/mpx/return-struct-6-nov.c | 40 +++ .../gcc.target/i386/mpx/return-struct-6-ubv.c | 42 +++ .../gcc.target/i386/mpx/sincos-1-nov.c | 18 ++ .../gcc.target/i386/mpx/static-array-1-lbv.c | 16 ++ .../gcc.target/i386/mpx/static-array-1-nov.c | 14 + .../gcc.target/i386/mpx/static-array-1-ubv.c | 16 ++ .../gcc.target/i386/mpx/static-init-1-lbv.c | 18 ++ .../gcc.target/i386/mpx/static-init-1-nov.c | 16 ++ .../gcc.target/i386/mpx/static-init-1-ubv.c | 18 ++ .../gcc.target/i386/mpx/static-init-2-lbv.c | 24 ++ .../gcc.target/i386/mpx/static-init-2-nov.c | 22 ++ .../gcc.target/i386/mpx/static-init-2-ubv.c | 24 ++ .../gcc.target/i386/mpx/static-init-3-lbv.c | 25 ++ .../gcc.target/i386/mpx/static-init-3-nov.c | 23 ++ .../gcc.target/i386/mpx/static-init-3-ubv.c | 25 ++ .../gcc.target/i386/mpx/static-init-4-lbv.c | 18 ++ .../gcc.target/i386/mpx/static-init-4-nov.c | 16 ++ .../gcc.target/i386/mpx/static-init-4-ubv.c | 18 ++ .../gcc.target/i386/mpx/static-init-5-lbv.c | 30 ++ .../gcc.target/i386/mpx/static-init-5-nov.c | 34 +++ .../gcc.target/i386/mpx/static-init-5-ubv.c | 30 ++ .../gcc.target/i386/mpx/static-init-6-lbv.c | 30 ++ .../gcc.target/i386/mpx/static-init-6-nov.c | 28 ++ .../gcc.target/i386/mpx/static-init-6-ubv.c | 30 ++ .../gcc.target/i386/mpx/static-string-1-lbv.c | 29 ++ .../gcc.target/i386/mpx/static-string-1-nov.c | 26 ++ .../gcc.target/i386/mpx/static-string-1-ubv.c | 29 ++ .../gcc.target/i386/mpx/struct-arg-1-lbv.c | 36 +++ .../gcc.target/i386/mpx/struct-arg-1-nov.c | 38 +++ .../gcc.target/i386/mpx/struct-arg-1-ubv.c | 36 +++ .../gcc.target/i386/mpx/struct-arg-10-lbv.c | 33 +++ .../gcc.target/i386/mpx/struct-arg-10-nov.c | 31 +++ .../gcc.target/i386/mpx/struct-arg-10-ubv.c | 33 +++ .../gcc.target/i386/mpx/struct-arg-2-lbv.c | 36 +++ .../gcc.target/i386/mpx/struct-arg-2-nov.c | 38 +++ .../gcc.target/i386/mpx/struct-arg-2-ubv.c | 36 +++ .../gcc.target/i386/mpx/struct-arg-3-lbv.c | 37 +++ .../gcc.target/i386/mpx/struct-arg-3-nov.c | 39 +++ .../gcc.target/i386/mpx/struct-arg-3-ubv.c | 37 +++ .../gcc.target/i386/mpx/struct-arg-4-lbv.c | 37 +++ .../gcc.target/i386/mpx/struct-arg-4-nov.c | 39 +++ .../gcc.target/i386/mpx/struct-arg-4-ubv.c | 37 +++ .../gcc.target/i386/mpx/struct-arg-5-lbv.c | 37 +++ .../gcc.target/i386/mpx/struct-arg-5-nov.c | 39 +++ .../gcc.target/i386/mpx/struct-arg-5-ubv.c | 37 +++ .../gcc.target/i386/mpx/struct-arg-6-lbv.c | 37 +++ .../gcc.target/i386/mpx/struct-arg-6-nov.c | 39 +++ .../gcc.target/i386/mpx/struct-arg-6-ubv.c | 37 +++ .../gcc.target/i386/mpx/struct-arg-7-lbv.c | 37 +++ .../gcc.target/i386/mpx/struct-arg-7-nov.c | 39 +++ .../gcc.target/i386/mpx/struct-arg-7-ubv.c | 37 +++ .../gcc.target/i386/mpx/struct-arg-8-lbv.c | 31 +++ .../gcc.target/i386/mpx/struct-arg-8-nov.c | 29 ++ .../gcc.target/i386/mpx/struct-arg-8-ubv.c | 31 +++ .../gcc.target/i386/mpx/struct-arg-9-lbv.c | 31 +++ .../gcc.target/i386/mpx/struct-arg-9-nov.c | 29 ++ .../gcc.target/i386/mpx/struct-arg-9-ubv.c | 31 +++ .../gcc.target/i386/mpx/struct-copy-1-lbv.c | 32 +++ .../gcc.target/i386/mpx/struct-copy-1-nov.c | 36 +++ .../gcc.target/i386/mpx/struct-copy-1-ubv.c | 32 +++ .../gcc.target/i386/mpx/struct-copy-2-lbv.c | 31 +++ .../gcc.target/i386/mpx/struct-copy-2-nov.c | 29 ++ .../gcc.target/i386/mpx/struct-copy-2-ubv.c | 31 +++ .../i386/mpx/thread-local-var-1-lbv.c | 34 +++ .../i386/mpx/thread-local-var-1-nov.c | 33 +++ .../i386/mpx/thread-local-var-1-ubv.c | 34 +++ .../gcc.target/i386/mpx/union-arg-1-lbv.c | 43 +++ .../gcc.target/i386/mpx/union-arg-1-nov.c | 45 +++ .../gcc.target/i386/mpx/union-arg-1-ubv.c | 43 +++ .../gcc.target/i386/mpx/va-arg-pack-1-lbv.c | 42 +++ .../gcc.target/i386/mpx/va-arg-pack-1-nov.c | 40 +++ .../gcc.target/i386/mpx/va-arg-pack-1-ubv.c | 42 +++ .../gcc.target/i386/mpx/va-arg-pack-2-lbv.c | 45 +++ .../gcc.target/i386/mpx/va-arg-pack-2-nov.c | 43 +++ .../gcc.target/i386/mpx/va-arg-pack-2-ubv.c | 45 +++ .../gcc.target/i386/mpx/vararg-1-lbv.c | 37 +++ .../gcc.target/i386/mpx/vararg-1-nov.c | 35 +++ .../gcc.target/i386/mpx/vararg-1-ubv.c | 37 +++ .../gcc.target/i386/mpx/vararg-2-lbv.c | 38 +++ .../gcc.target/i386/mpx/vararg-2-nov.c | 36 +++ .../gcc.target/i386/mpx/vararg-2-ubv.c | 38 +++ .../gcc.target/i386/mpx/vararg-3-lbv.c | 38 +++ .../gcc.target/i386/mpx/vararg-3-nov.c | 36 +++ .../gcc.target/i386/mpx/vararg-3-ubv.c | 38 +++ .../gcc.target/i386/mpx/vararg-4-lbv.c | 38 +++ .../gcc.target/i386/mpx/vararg-4-nov.c | 36 +++ .../gcc.target/i386/mpx/vararg-4-ubv.c | 38 +++ .../gcc.target/i386/mpx/vararg-5-lbv.c | 38 +++ .../gcc.target/i386/mpx/vararg-5-nov.c | 36 +++ .../gcc.target/i386/mpx/vararg-5-ubv.c | 38 +++ .../gcc.target/i386/mpx/vararg-6-lbv.c | 38 +++ .../gcc.target/i386/mpx/vararg-6-nov.c | 36 +++ .../gcc.target/i386/mpx/vararg-6-ubv.c | 38 +++ .../gcc.target/i386/mpx/vararg-7-lbv.c | 37 +++ .../gcc.target/i386/mpx/vararg-7-nov.c | 35 +++ .../gcc.target/i386/mpx/vararg-7-ubv.c | 37 +++ .../gcc.target/i386/mpx/vararg-8-lbv.c | 40 +++ .../gcc.target/i386/mpx/vararg-8-nov.c | 38 +++ .../gcc.target/i386/mpx/vararg-8-ubv.c | 40 +++ gcc/testsuite/gcc.target/i386/mpx/vla-1-lbv.c | 29 ++ gcc/testsuite/gcc.target/i386/mpx/vla-1-nov.c | 27 ++ gcc/testsuite/gcc.target/i386/mpx/vla-1-ubv.c | 29 ++ gcc/testsuite/gcc.target/i386/mpx/vla-2-lbv.c | 27 ++ gcc/testsuite/gcc.target/i386/mpx/vla-2-nov.c | 25 ++ gcc/testsuite/gcc.target/i386/mpx/vla-2-ubv.c | 27 ++ gcc/testsuite/lib/mpx-dg.exp | 100 +++++++ 257 files changed, 7872 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/mpx/alloca-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/alloca-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/alloca-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/arg-addr-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/arg-addr-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/arg-addr-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/bitfields-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/bitfields-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/bitfields-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-2.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-lbounds-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-lbounds-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-lbounds-2.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-ubounds-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-ubounds-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-ubounds-2.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-1.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-2-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-2-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-2-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-3.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-get-ptr-lbound-1.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-get-ptr-lbound-2.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-get-ptr-ubound-1.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-get-ptr-ubound-2.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-init-ptr-bounds-1.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-init-ptr-bounds-2-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-init-ptr-bounds-3.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-1.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-2-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-2-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-2-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-3-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-3-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-3-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-4.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-null-ptr-bounds-1-bbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-1.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-2-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-2-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-2-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-3.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-2.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/fastcall-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/fastcall-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/fastcall-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/fastcall-2-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/fastcall-2-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/fastcall-2-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-10-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-10-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-10-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-2-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-2-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-2-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-3-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-3-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-3-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-4-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-4-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-4-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-5-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-5-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-5-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-6-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-6-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-6-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-7-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-7-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-7-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-8-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-8-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-8-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-9-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-9-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/field-addr-9-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/frame-address-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/hard-reg-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/if-stmt-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/if-stmt-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/if-stmt-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/if-stmt-2-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/if-stmt-2-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/if-stmt-2-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/label-address-1.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/legacy-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/macro.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/mpx-check.h create mode 100644 gcc/testsuite/gcc.target/i386/mpx/mpx.exp create mode 100644 gcc/testsuite/gcc.target/i386/mpx/nested-function-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/nested-function-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/nested-function-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pointer-arg-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pointer-arg-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pointer-arg-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pointer-arg-2-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pointer-arg-2-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pointer-arg-2-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pointer-arg-3-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pointer-arg-3-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pointer-arg-3-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pointer-arg-4-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pointer-arg-4-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pointer-arg-4-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pointer-arg-5-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pointer-arg-5-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pointer-arg-5-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pointer-store-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pointer-store-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pointer-store-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/reference-1-lbv.cpp create mode 100644 gcc/testsuite/gcc.target/i386/mpx/reference-1-nov.cpp create mode 100644 gcc/testsuite/gcc.target/i386/mpx/reference-1-ubv.cpp create mode 100644 gcc/testsuite/gcc.target/i386/mpx/reference-2-lbv.cpp create mode 100644 gcc/testsuite/gcc.target/i386/mpx/reference-2-nov.cpp create mode 100644 gcc/testsuite/gcc.target/i386/mpx/reference-2-ubv.cpp create mode 100644 gcc/testsuite/gcc.target/i386/mpx/reference-3-lbv.cpp create mode 100644 gcc/testsuite/gcc.target/i386/mpx/reference-3-nov.cpp create mode 100644 gcc/testsuite/gcc.target/i386/mpx/reference-3-ubv.cpp create mode 100644 gcc/testsuite/gcc.target/i386/mpx/reference-4-lbv.cpp create mode 100644 gcc/testsuite/gcc.target/i386/mpx/reference-4-nov.cpp create mode 100644 gcc/testsuite/gcc.target/i386/mpx/reference-4-ubv.cpp create mode 100644 gcc/testsuite/gcc.target/i386/mpx/return-pointer-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/return-pointer-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/return-pointer-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/return-struct-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/return-struct-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/return-struct-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/return-struct-2-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/return-struct-2-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/return-struct-2-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/return-struct-3-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/return-struct-3-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/return-struct-3-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/return-struct-4-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/return-struct-4-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/return-struct-4-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/return-struct-5-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/return-struct-5-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/return-struct-5-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/return-struct-6-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/return-struct-6-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/return-struct-6-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/sincos-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-array-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-array-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-array-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-init-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-init-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-init-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-init-2-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-init-2-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-init-2-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-init-3-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-init-3-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-init-3-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-init-4-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-init-4-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-init-4-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-init-5-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-init-5-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-init-5-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-init-6-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-init-6-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-init-6-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-string-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-string-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/static-string-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-10-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-10-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-10-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-2-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-2-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-2-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-3-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-3-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-3-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-4-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-4-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-4-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-5-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-5-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-5-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-6-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-6-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-6-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-7-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-7-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-7-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-8-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-8-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-8-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-9-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-9-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-arg-9-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-copy-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-copy-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-copy-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-copy-2-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-copy-2-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/struct-copy-2-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/thread-local-var-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/thread-local-var-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/thread-local-var-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/union-arg-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/union-arg-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/union-arg-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-2-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-2-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-2-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-2-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-2-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-2-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-3-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-3-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-3-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-4-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-4-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-4-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-5-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-5-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-5-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-6-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-6-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-6-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-7-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-7-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-7-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-8-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-8-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vararg-8-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vla-1-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vla-1-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vla-1-ubv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vla-2-lbv.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vla-2-nov.c create mode 100644 gcc/testsuite/gcc.target/i386/mpx/vla-2-ubv.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3d5e5fe38cf..9a48aed4728 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,264 @@ +2015-03-10 Ilya Enkovich + + * gcc/testsuite/lib/mpx-dg.exp (mpx_link_flags): New. + (mpx_init): New. + (mpx_finish): New. + * gcc.target/i386/mpx/alloca-1-lbv.c: New. + * gcc.target/i386/mpx/alloca-1-nov.c: New. + * gcc.target/i386/mpx/alloca-1-ubv.c: New. + * gcc.target/i386/mpx/arg-addr-1-lbv.c: New. + * gcc.target/i386/mpx/arg-addr-1-nov.c: New. + * gcc.target/i386/mpx/arg-addr-1-ubv.c: New. + * gcc.target/i386/mpx/bitfields-1-lbv.c: New. + * gcc.target/i386/mpx/bitfields-1-nov.c: New. + * gcc.target/i386/mpx/bitfields-1-ubv.c: New. + * gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-1-lbv.c: New. + * gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-1-nov.c: New. + * gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-1-ubv.c: New. + * gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-2.c: New. + * gcc.target/i386/mpx/builtin-bnd-chk-ptr-lbounds-1-lbv.c: New. + * gcc.target/i386/mpx/builtin-bnd-chk-ptr-lbounds-1-nov.c: New. + * gcc.target/i386/mpx/builtin-bnd-chk-ptr-lbounds-2.c: New. + * gcc.target/i386/mpx/builtin-bnd-chk-ptr-ubounds-1-nov.c: New. + * gcc.target/i386/mpx/builtin-bnd-chk-ptr-ubounds-1-ubv.c: New. + * gcc.target/i386/mpx/builtin-bnd-chk-ptr-ubounds-2.c: New. + * gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-1.c: New. + * gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-2-lbv.c: New. + * gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-2-nov.c: New. + * gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-2-ubv.c: New. + * gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-3.c: New. + * gcc.target/i386/mpx/builtin-bnd-get-ptr-lbound-1.c: New. + * gcc.target/i386/mpx/builtin-bnd-get-ptr-lbound-2.c: New. + * gcc.target/i386/mpx/builtin-bnd-get-ptr-ubound-1.c: New. + * gcc.target/i386/mpx/builtin-bnd-get-ptr-ubound-2.c: New. + * gcc.target/i386/mpx/builtin-bnd-init-ptr-bounds-1.c: New. + * gcc.target/i386/mpx/builtin-bnd-init-ptr-bounds-2-nov.c: New. + * gcc.target/i386/mpx/builtin-bnd-init-ptr-bounds-3.c: New. + * gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-1.c: New. + * gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-2-lbv.c: New. + * gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-2-nov.c: New. + * gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-2-ubv.c: New. + * gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-3-lbv.c: New. + * gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-3-nov.c: New. + * gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-3-ubv.c: New. + * gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-4.c: New. + * gcc.target/i386/mpx/builtin-bnd-null-ptr-bounds-1-bbv.c: New. + * gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-1.c: New. + * gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-2-lbv.c: New. + * gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-2-nov.c: New. + * gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-2-ubv.c: New. + * gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-3.c: New. + * gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-1-lbv.c: New. + * gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-1-nov.c: New. + * gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-1-ubv.c: New. + * gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-2.c: New. + * gcc.target/i386/mpx/fastcall-1-lbv.c: New. + * gcc.target/i386/mpx/fastcall-1-nov.c: New. + * gcc.target/i386/mpx/fastcall-1-ubv.c: New. + * gcc.target/i386/mpx/fastcall-2-lbv.c: New. + * gcc.target/i386/mpx/fastcall-2-nov.c: New. + * gcc.target/i386/mpx/fastcall-2-ubv.c: New. + * gcc.target/i386/mpx/field-addr-1-lbv.c: New. + * gcc.target/i386/mpx/field-addr-1-nov.c: New. + * gcc.target/i386/mpx/field-addr-1-ubv.c: New. + * gcc.target/i386/mpx/field-addr-10-lbv.c: New. + * gcc.target/i386/mpx/field-addr-10-nov.c: New. + * gcc.target/i386/mpx/field-addr-10-ubv.c: New. + * gcc.target/i386/mpx/field-addr-2-lbv.c: New. + * gcc.target/i386/mpx/field-addr-2-nov.c: New. + * gcc.target/i386/mpx/field-addr-2-ubv.c: New. + * gcc.target/i386/mpx/field-addr-3-lbv.c: New. + * gcc.target/i386/mpx/field-addr-3-nov.c: New. + * gcc.target/i386/mpx/field-addr-3-ubv.c: New. + * gcc.target/i386/mpx/field-addr-4-lbv.c: New. + * gcc.target/i386/mpx/field-addr-4-nov.c: New. + * gcc.target/i386/mpx/field-addr-4-ubv.c: New. + * gcc.target/i386/mpx/field-addr-5-lbv.c: New. + * gcc.target/i386/mpx/field-addr-5-nov.c: New. + * gcc.target/i386/mpx/field-addr-5-ubv.c: New. + * gcc.target/i386/mpx/field-addr-6-lbv.c: New. + * gcc.target/i386/mpx/field-addr-6-nov.c: New. + * gcc.target/i386/mpx/field-addr-6-ubv.c: New. + * gcc.target/i386/mpx/field-addr-7-lbv.c: New. + * gcc.target/i386/mpx/field-addr-7-nov.c: New. + * gcc.target/i386/mpx/field-addr-7-ubv.c: New. + * gcc.target/i386/mpx/field-addr-8-lbv.c: New. + * gcc.target/i386/mpx/field-addr-8-nov.c: New. + * gcc.target/i386/mpx/field-addr-8-ubv.c: New. + * gcc.target/i386/mpx/field-addr-9-lbv.c: New. + * gcc.target/i386/mpx/field-addr-9-nov.c: New. + * gcc.target/i386/mpx/field-addr-9-ubv.c: New. + * gcc.target/i386/mpx/frame-address-1-nov.c: New. + * gcc.target/i386/mpx/hard-reg-1-nov.c: New. + * gcc.target/i386/mpx/if-stmt-1-lbv.c: New. + * gcc.target/i386/mpx/if-stmt-1-nov.c: New. + * gcc.target/i386/mpx/if-stmt-1-ubv.c: New. + * gcc.target/i386/mpx/if-stmt-2-lbv.c: New. + * gcc.target/i386/mpx/if-stmt-2-nov.c: New. + * gcc.target/i386/mpx/if-stmt-2-ubv.c: New. + * gcc.target/i386/mpx/label-address-1.c: New. + * gcc.target/i386/mpx/legacy-1-nov.c: New. + * gcc.target/i386/mpx/macro.c: New. + * gcc.target/i386/mpx/mpx-check.h: New. + * gcc.target/i386/mpx/mpx.exp: New. + * gcc.target/i386/mpx/nested-function-1-lbv.c: New. + * gcc.target/i386/mpx/nested-function-1-nov.c: New. + * gcc.target/i386/mpx/nested-function-1-ubv.c: New. + * gcc.target/i386/mpx/pointer-arg-1-lbv.c: New. + * gcc.target/i386/mpx/pointer-arg-1-nov.c: New. + * gcc.target/i386/mpx/pointer-arg-1-ubv.c: New. + * gcc.target/i386/mpx/pointer-arg-2-lbv.c: New. + * gcc.target/i386/mpx/pointer-arg-2-nov.c: New. + * gcc.target/i386/mpx/pointer-arg-2-ubv.c: New. + * gcc.target/i386/mpx/pointer-arg-3-lbv.c: New. + * gcc.target/i386/mpx/pointer-arg-3-nov.c: New. + * gcc.target/i386/mpx/pointer-arg-3-ubv.c: New. + * gcc.target/i386/mpx/pointer-arg-4-lbv.c: New. + * gcc.target/i386/mpx/pointer-arg-4-nov.c: New. + * gcc.target/i386/mpx/pointer-arg-4-ubv.c: New. + * gcc.target/i386/mpx/pointer-arg-5-lbv.c: New. + * gcc.target/i386/mpx/pointer-arg-5-nov.c: New. + * gcc.target/i386/mpx/pointer-arg-5-ubv.c: New. + * gcc.target/i386/mpx/pointer-store-1-lbv.c: New. + * gcc.target/i386/mpx/pointer-store-1-nov.c: New. + * gcc.target/i386/mpx/pointer-store-1-ubv.c: New. + * gcc.target/i386/mpx/reference-1-lbv.c: New. + * gcc.target/i386/mpx/reference-1-nov.c: New. + * gcc.target/i386/mpx/reference-1-ubv.c: New. + * gcc.target/i386/mpx/reference-2-lbv.c: New. + * gcc.target/i386/mpx/reference-2-nov.c: New. + * gcc.target/i386/mpx/reference-2-ubv.c: New. + * gcc.target/i386/mpx/reference-3-lbv.c: New. + * gcc.target/i386/mpx/reference-3-nov.c: New. + * gcc.target/i386/mpx/reference-3-ubv.c: New. + * gcc.target/i386/mpx/reference-4-lbv.c: New. + * gcc.target/i386/mpx/reference-4-nov.c: New. + * gcc.target/i386/mpx/reference-4-ubv.c: New. + * gcc.target/i386/mpx/return-pointer-1-lbv.c: New. + * gcc.target/i386/mpx/return-pointer-1-nov.c: New. + * gcc.target/i386/mpx/return-pointer-1-ubv.c: New. + * gcc.target/i386/mpx/return-struct-1-lbv.c: New. + * gcc.target/i386/mpx/return-struct-1-nov.c: New. + * gcc.target/i386/mpx/return-struct-1-ubv.c: New. + * gcc.target/i386/mpx/return-struct-2-lbv.c: New. + * gcc.target/i386/mpx/return-struct-2-nov.c: New. + * gcc.target/i386/mpx/return-struct-2-ubv.c: New. + * gcc.target/i386/mpx/return-struct-3-lbv.c: New. + * gcc.target/i386/mpx/return-struct-3-nov.c: New. + * gcc.target/i386/mpx/return-struct-3-ubv.c: New. + * gcc.target/i386/mpx/return-struct-4-lbv.c: New. + * gcc.target/i386/mpx/return-struct-4-nov.c: New. + * gcc.target/i386/mpx/return-struct-4-ubv.c: New. + * gcc.target/i386/mpx/return-struct-5-lbv.c: New. + * gcc.target/i386/mpx/return-struct-5-nov.c: New. + * gcc.target/i386/mpx/return-struct-5-ubv.c: New. + * gcc.target/i386/mpx/return-struct-6-lbv.c: New. + * gcc.target/i386/mpx/return-struct-6-nov.c: New. + * gcc.target/i386/mpx/return-struct-6-ubv.c: New. + * gcc.target/i386/mpx/sincos-1-nov.c: New. + * gcc.target/i386/mpx/static-array-1-lbv.c: New. + * gcc.target/i386/mpx/static-array-1-nov.c: New. + * gcc.target/i386/mpx/static-array-1-ubv.c: New. + * gcc.target/i386/mpx/static-init-1-lbv.c: New. + * gcc.target/i386/mpx/static-init-1-nov.c: New. + * gcc.target/i386/mpx/static-init-1-ubv.c: New. + * gcc.target/i386/mpx/static-init-2-lbv.c: New. + * gcc.target/i386/mpx/static-init-2-nov.c: New. + * gcc.target/i386/mpx/static-init-2-ubv.c: New. + * gcc.target/i386/mpx/static-init-3-lbv.c: New. + * gcc.target/i386/mpx/static-init-3-nov.c: New. + * gcc.target/i386/mpx/static-init-3-ubv.c: New. + * gcc.target/i386/mpx/static-init-4-lbv.c: New. + * gcc.target/i386/mpx/static-init-4-nov.c: New. + * gcc.target/i386/mpx/static-init-4-ubv.c: New. + * gcc.target/i386/mpx/static-init-5-lbv.c: New. + * gcc.target/i386/mpx/static-init-5-nov.c: New. + * gcc.target/i386/mpx/static-init-5-ubv.c: New. + * gcc.target/i386/mpx/static-init-6-lbv.c: New. + * gcc.target/i386/mpx/static-init-6-nov.c: New. + * gcc.target/i386/mpx/static-init-6-ubv.c: New. + * gcc.target/i386/mpx/static-string-1-lbv.c: New. + * gcc.target/i386/mpx/static-string-1-nov.c: New. + * gcc.target/i386/mpx/static-string-1-ubv.c: New. + * gcc.target/i386/mpx/struct-arg-1-lbv.c: New. + * gcc.target/i386/mpx/struct-arg-1-nov.c: New. + * gcc.target/i386/mpx/struct-arg-1-ubv.c: New. + * gcc.target/i386/mpx/struct-arg-10-lbv.c: New. + * gcc.target/i386/mpx/struct-arg-10-nov.c: New. + * gcc.target/i386/mpx/struct-arg-10-ubv.c: New. + * gcc.target/i386/mpx/struct-arg-2-lbv.c: New. + * gcc.target/i386/mpx/struct-arg-2-nov.c: New. + * gcc.target/i386/mpx/struct-arg-2-ubv.c: New. + * gcc.target/i386/mpx/struct-arg-3-lbv.c: New. + * gcc.target/i386/mpx/struct-arg-3-nov.c: New. + * gcc.target/i386/mpx/struct-arg-3-ubv.c: New. + * gcc.target/i386/mpx/struct-arg-4-lbv.c: New. + * gcc.target/i386/mpx/struct-arg-4-nov.c: New. + * gcc.target/i386/mpx/struct-arg-4-ubv.c: New. + * gcc.target/i386/mpx/struct-arg-5-lbv.c: New. + * gcc.target/i386/mpx/struct-arg-5-nov.c: New. + * gcc.target/i386/mpx/struct-arg-5-ubv.c: New. + * gcc.target/i386/mpx/struct-arg-6-lbv.c: New. + * gcc.target/i386/mpx/struct-arg-6-nov.c: New. + * gcc.target/i386/mpx/struct-arg-6-ubv.c: New. + * gcc.target/i386/mpx/struct-arg-7-lbv.c: New. + * gcc.target/i386/mpx/struct-arg-7-nov.c: New. + * gcc.target/i386/mpx/struct-arg-7-ubv.c: New. + * gcc.target/i386/mpx/struct-arg-8-lbv.c: New. + * gcc.target/i386/mpx/struct-arg-8-nov.c: New. + * gcc.target/i386/mpx/struct-arg-8-ubv.c: New. + * gcc.target/i386/mpx/struct-arg-9-lbv.c: New. + * gcc.target/i386/mpx/struct-arg-9-nov.c: New. + * gcc.target/i386/mpx/struct-arg-9-ubv.c: New. + * gcc.target/i386/mpx/struct-copy-1-lbv.c: New. + * gcc.target/i386/mpx/struct-copy-1-nov.c: New. + * gcc.target/i386/mpx/struct-copy-1-ubv.c: New. + * gcc.target/i386/mpx/struct-copy-2-lbv.c: New. + * gcc.target/i386/mpx/struct-copy-2-nov.c: New. + * gcc.target/i386/mpx/struct-copy-2-ubv.c: New. + * gcc.target/i386/mpx/thread-local-var-1-lbv.c: New. + * gcc.target/i386/mpx/thread-local-var-1-nov.c: New. + * gcc.target/i386/mpx/thread-local-var-1-ubv.c: New. + * gcc.target/i386/mpx/union-arg-1-lbv.c: New. + * gcc.target/i386/mpx/union-arg-1-nov.c: New. + * gcc.target/i386/mpx/union-arg-1-ubv.c: New. + * gcc.target/i386/mpx/va-arg-pack-1-lbv.c: New. + * gcc.target/i386/mpx/va-arg-pack-1-nov.c: New. + * gcc.target/i386/mpx/va-arg-pack-1-ubv.c: New. + * gcc.target/i386/mpx/va-arg-pack-2-lbv.c: New. + * gcc.target/i386/mpx/va-arg-pack-2-nov.c: New. + * gcc.target/i386/mpx/va-arg-pack-2-ubv.c: New. + * gcc.target/i386/mpx/vararg-1-lbv.c: New. + * gcc.target/i386/mpx/vararg-1-nov.c: New. + * gcc.target/i386/mpx/vararg-1-ubv.c: New. + * gcc.target/i386/mpx/vararg-2-lbv.c: New. + * gcc.target/i386/mpx/vararg-2-nov.c: New. + * gcc.target/i386/mpx/vararg-2-ubv.c: New. + * gcc.target/i386/mpx/vararg-3-lbv.c: New. + * gcc.target/i386/mpx/vararg-3-nov.c: New. + * gcc.target/i386/mpx/vararg-3-ubv.c: New. + * gcc.target/i386/mpx/vararg-4-lbv.c: New. + * gcc.target/i386/mpx/vararg-4-nov.c: New. + * gcc.target/i386/mpx/vararg-4-ubv.c: New. + * gcc.target/i386/mpx/vararg-5-lbv.c: New. + * gcc.target/i386/mpx/vararg-5-nov.c: New. + * gcc.target/i386/mpx/vararg-5-ubv.c: New. + * gcc.target/i386/mpx/vararg-6-lbv.c: New. + * gcc.target/i386/mpx/vararg-6-nov.c: New. + * gcc.target/i386/mpx/vararg-6-ubv.c: New. + * gcc.target/i386/mpx/vararg-7-lbv.c: New. + * gcc.target/i386/mpx/vararg-7-nov.c: New. + * gcc.target/i386/mpx/vararg-7-ubv.c: New. + * gcc.target/i386/mpx/vararg-8-lbv.c: New. + * gcc.target/i386/mpx/vararg-8-nov.c: New. + * gcc.target/i386/mpx/vararg-8-ubv.c: New. + * gcc.target/i386/mpx/vla-1-lbv.c: New. + * gcc.target/i386/mpx/vla-1-nov.c: New. + * gcc.target/i386/mpx/vla-1-ubv.c: New. + * gcc.target/i386/mpx/vla-2-lbv.c: New. + * gcc.target/i386/mpx/vla-2-nov.c: New. + * gcc.target/i386/mpx/vla-2-ubv.c: New. + 2015-03-10 James Greenhalgh * gcc.dg/vect/pr65310.c (c): Reduce alignment to 4-bytes. diff --git a/gcc/testsuite/gcc.target/i386/mpx/alloca-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/alloca-1-lbv.c new file mode 100644 index 00000000000..f81a5e25f32 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/alloca-1-lbv.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *buf = (int *)alloca (100 * sizeof(int)); + + rd (buf, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/alloca-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/alloca-1-nov.c new file mode 100644 index 00000000000..162b4d57270 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/alloca-1-nov.c @@ -0,0 +1,22 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *buf = (int *)alloca (100 * sizeof(int)); + + rd (buf, 0); + rd (buf, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/alloca-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/alloca-1-ubv.c new file mode 100644 index 00000000000..9af3f11ac49 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/alloca-1-ubv.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *buf = (int *)alloca (100 * sizeof(int)); + + rd (buf, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/arg-addr-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/arg-addr-1-lbv.c new file mode 100644 index 00000000000..1fd2036cf06 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/arg-addr-1-lbv.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int foo (int i, int j) +{ + return rd(&i, j); +} + +int mpx_test (int argc, const char **argv) +{ + foo (1, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/arg-addr-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/arg-addr-1-nov.c new file mode 100644 index 00000000000..4e338c76f7c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/arg-addr-1-nov.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int foo (int i, int j) +{ + return rd(&i, j); +} + +int mpx_test (int argc, const char **argv) +{ + foo (1, 0); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/arg-addr-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/arg-addr-1-ubv.c new file mode 100644 index 00000000000..65cb46bcd3f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/arg-addr-1-ubv.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int foo (int i, int j) +{ + return rd(&i, j); +} + +int mpx_test (int argc, const char **argv) +{ + foo (1, 1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/bitfields-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/bitfields-1-lbv.c new file mode 100644 index 00000000000..deca6fd6a97 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/bitfields-1-lbv.c @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s { + int a; + int b : 10; + int c : 1; + int e : 10; +} s; + +#define HH (unsigned char)1 + +int foo (struct s *p) +{ + int val = p->b; + printf ("%d\n", val); + return val == HH; +} + +int mpx_test (int argc, const char **argv) +{ + struct s buf[100]; + + foo (buf - 1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/bitfields-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/bitfields-1-nov.c new file mode 100644 index 00000000000..0a7913a256d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/bitfields-1-nov.c @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct s { + int a; + int b : 10; + int c : 1; + int e : 10; +} s; + +#define HH (unsigned char)1 + +int foo (struct s *p) +{ + int val = p->b; + printf ("%d\n", val); + return val == HH; +} + +int mpx_test (int argc, const char **argv) +{ + struct s buf[100]; + + foo (buf); + foo (buf + 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/bitfields-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/bitfields-1-ubv.c new file mode 100644 index 00000000000..a20a7897fce --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/bitfields-1-ubv.c @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s { + int a; + int b : 10; + int c : 1; + int e : 10; +} s; + +#define HH (unsigned char)1 + +int foo (struct s *p) +{ + int val = p->b; + printf ("%d\n", val); + return val == HH; +} + +int mpx_test (int argc, const char **argv) +{ + struct s buf[100]; + + foo (buf + 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-1-lbv.c new file mode 100644 index 00000000000..140848e0158 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-1-lbv.c @@ -0,0 +1,16 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + __bnd_chk_ptr_bounds (buf - 1, sizeof (int)); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-1-nov.c new file mode 100644 index 00000000000..055b61d649c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-1-nov.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + __bnd_chk_ptr_bounds (buf, sizeof (int) * 100); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-1-ubv.c new file mode 100644 index 00000000000..f811694b9ee --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-1-ubv.c @@ -0,0 +1,16 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + __bnd_chk_ptr_bounds (buf + 100, sizeof (int)); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-2.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-2.c new file mode 100644 index 00000000000..47e62e7834d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-bounds-2.c @@ -0,0 +1,14 @@ +/* { dg-do run } */ +/* { dg-options "-fno-check-pointer-bounds" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + __bnd_chk_ptr_bounds (buf - 1, sizeof (int)); + __bnd_chk_ptr_bounds (buf + 100, sizeof (int)); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-lbounds-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-lbounds-1-lbv.c new file mode 100644 index 00000000000..085166fc142 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-lbounds-1-lbv.c @@ -0,0 +1,16 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + __bnd_chk_ptr_lbounds (buf - 1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-lbounds-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-lbounds-1-nov.c new file mode 100644 index 00000000000..3a666d8e300 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-lbounds-1-nov.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + __bnd_chk_ptr_lbounds (buf); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-lbounds-2.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-lbounds-2.c new file mode 100644 index 00000000000..87b80e0b62c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-lbounds-2.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "-fno-check-pointer-bounds" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + __bnd_chk_ptr_lbounds (buf - 1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-ubounds-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-ubounds-1-nov.c new file mode 100644 index 00000000000..8a73fe367d1 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-ubounds-1-nov.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + __bnd_chk_ptr_ubounds (buf + 99); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-ubounds-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-ubounds-1-ubv.c new file mode 100644 index 00000000000..eb22dd1936a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-ubounds-1-ubv.c @@ -0,0 +1,16 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + __bnd_chk_ptr_ubounds (buf + 100); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-ubounds-2.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-ubounds-2.c new file mode 100644 index 00000000000..503bd53a60b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-chk-ptr-ubounds-2.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "-fno-check-pointer-bounds" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + __bnd_chk_ptr_ubounds (buf + 100); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-1.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-1.c new file mode 100644 index 00000000000..0949f6acd87 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-1.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + assert (buf + 10 == __bnd_copy_ptr_bounds (buf + 10, buf)); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-2-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-2-lbv.c new file mode 100644 index 00000000000..a7317e71785 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-2-lbv.c @@ -0,0 +1,18 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + int *p = __bnd_set_ptr_bounds (buf + 10, sizeof (int) * 10); + int *p1 = __bnd_copy_ptr_bounds (buf, p); + p1[9] = argc; + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-2-nov.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-2-nov.c new file mode 100644 index 00000000000..6b6423e3c6d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-2-nov.c @@ -0,0 +1,16 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + int *p = __bnd_set_ptr_bounds (buf + 10, sizeof (int) * 10); + int *p1 = __bnd_copy_ptr_bounds (buf, p); + p1[10] = argc; + p1[19] = argc; + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-2-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-2-ubv.c new file mode 100644 index 00000000000..2893d9be1f9 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-2-ubv.c @@ -0,0 +1,18 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + int *p = __bnd_set_ptr_bounds (buf + 10, sizeof (int) * 10); + int *p1 = __bnd_copy_ptr_bounds (buf, p); + p1[20] = argc; + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-3.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-3.c new file mode 100644 index 00000000000..4d0137579eb --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-copy-ptr-bounds-3.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "-fno-check-pointer-bounds" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + assert (buf + 10 == __bnd_copy_ptr_bounds (buf + 10, buf)); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-get-ptr-lbound-1.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-get-ptr-lbound-1.c new file mode 100644 index 00000000000..2a7f46ff2d6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-get-ptr-lbound-1.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +char buf[100]; + +int mpx_test (int argc, const char **argv) +{ + assert (buf == __bnd_get_ptr_lbound (buf)); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-get-ptr-lbound-2.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-get-ptr-lbound-2.c new file mode 100644 index 00000000000..70b49e312b6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-get-ptr-lbound-2.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "-fno-check-pointer-bounds" } */ + + +#include "mpx-check.h" + +char buf[100]; + +int mpx_test (int argc, const char **argv) +{ + assert ((void *)0 == __bnd_get_ptr_lbound (buf)); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-get-ptr-ubound-1.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-get-ptr-ubound-1.c new file mode 100644 index 00000000000..a9111f35d7d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-get-ptr-ubound-1.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +char buf[100]; + +int mpx_test (int argc, const char **argv) +{ + assert (buf + 99 == __bnd_get_ptr_ubound (buf)); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-get-ptr-ubound-2.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-get-ptr-ubound-2.c new file mode 100644 index 00000000000..cf0aca14a6b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-get-ptr-ubound-2.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "-fno-check-pointer-bounds" } */ + + +#include "mpx-check.h" + +char buf[100]; + +int mpx_test (int argc, const char **argv) +{ + assert ((void *)-1 == __bnd_get_ptr_ubound (buf)); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-init-ptr-bounds-1.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-init-ptr-bounds-1.c new file mode 100644 index 00000000000..ee259cc9fb6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-init-ptr-bounds-1.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + assert (buf + 10 == __bnd_init_ptr_bounds (buf + 10)); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-init-ptr-bounds-2-nov.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-init-ptr-bounds-2-nov.c new file mode 100644 index 00000000000..da44e7a9642 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-init-ptr-bounds-2-nov.c @@ -0,0 +1,16 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + int *p = __bnd_set_ptr_bounds (buf + 10, sizeof (int) * 10); + p = __bnd_init_ptr_bounds (p); + p[-1] = argc; + p[10] = argc; + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-init-ptr-bounds-3.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-init-ptr-bounds-3.c new file mode 100644 index 00000000000..8c1527025f6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-init-ptr-bounds-3.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "-fno-check-pointer-bounds" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + assert (buf + 10 == __bnd_init_ptr_bounds (buf + 10)); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-1.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-1.c new file mode 100644 index 00000000000..4ac49abd70a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-1.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + assert (buf + 10 == __bnd_narrow_ptr_bounds (buf + 10, buf, 4)); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-2-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-2-lbv.c new file mode 100644 index 00000000000..21a8f927f47 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-2-lbv.c @@ -0,0 +1,17 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + int *p = __bnd_narrow_ptr_bounds (buf - 10, buf, sizeof (int) * 20); + p[9] = argc; + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-2-nov.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-2-nov.c new file mode 100644 index 00000000000..8182d029e07 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-2-nov.c @@ -0,0 +1,15 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + int *p = __bnd_narrow_ptr_bounds (buf - 10, buf, sizeof (int) * 20); + p[10] = argc; + p[19] = argc; + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-2-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-2-ubv.c new file mode 100644 index 00000000000..6ff90cee593 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-2-ubv.c @@ -0,0 +1,17 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + int *p = __bnd_narrow_ptr_bounds (buf - 10, buf, sizeof (int) * 20); + p[20] = argc; + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-3-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-3-lbv.c new file mode 100644 index 00000000000..69b4a51b490 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-3-lbv.c @@ -0,0 +1,17 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + int *p = __bnd_narrow_ptr_bounds (buf + 10, buf, sizeof (int) * 100); + p[-1] = argc; + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-3-nov.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-3-nov.c new file mode 100644 index 00000000000..0c13b123d8f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-3-nov.c @@ -0,0 +1,15 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + int *p = __bnd_narrow_ptr_bounds (buf + 10, buf, sizeof (int) * 100); + p[0] = argc; + p[89] = argc; + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-3-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-3-ubv.c new file mode 100644 index 00000000000..445e3375834 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-3-ubv.c @@ -0,0 +1,17 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + int *p = __bnd_narrow_ptr_bounds (buf + 10, buf, sizeof (int) * 100); + p[90] = argc; + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-4.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-4.c new file mode 100644 index 00000000000..144855cfabd --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-narrow-ptr-bounds-4.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "-fno-check-pointer-bounds" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + assert (buf - 10 == __bnd_narrow_ptr_bounds (buf - 10, buf, 4)); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-null-ptr-bounds-1-bbv.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-null-ptr-bounds-1-bbv.c new file mode 100644 index 00000000000..5497ef1d2da --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-null-ptr-bounds-1-bbv.c @@ -0,0 +1,17 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + int *p = __bnd_null_ptr_bounds (buf + 10); + p[0] = argc; + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-1.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-1.c new file mode 100644 index 00000000000..8abb2576654 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-1.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + assert (buf + 10 == __bnd_set_ptr_bounds (buf + 10, 4)); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-2-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-2-lbv.c new file mode 100644 index 00000000000..bbc578abd2c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-2-lbv.c @@ -0,0 +1,17 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + int *p = __bnd_set_ptr_bounds (buf + 10, sizeof (int) * 10); + p[-1] = argc; + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-2-nov.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-2-nov.c new file mode 100644 index 00000000000..39df101ad50 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-2-nov.c @@ -0,0 +1,15 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + int *p = __bnd_set_ptr_bounds (buf + 10, sizeof (int) * 10); + p[0] = argc; + p[9] = argc; + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-2-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-2-ubv.c new file mode 100644 index 00000000000..c2d27e71065 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-2-ubv.c @@ -0,0 +1,17 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + int *p = __bnd_set_ptr_bounds (buf + 10, sizeof (int) * 10); + p[10] = argc; + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-3.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-3.c new file mode 100644 index 00000000000..811cdb4e116 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-set-ptr-bounds-3.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "-fno-check-pointer-bounds" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + assert (buf + 10 == __bnd_set_ptr_bounds (buf + 10, sizeof (int) * 10)); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-1-lbv.c new file mode 100644 index 00000000000..af6c8dbe59c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-1-lbv.c @@ -0,0 +1,20 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; +int *p; + +int mpx_test (int argc, const char **argv) +{ + int *p1 = __bnd_set_ptr_bounds (buf + 10, sizeof (int) * 10); + p = buf; + __bnd_store_ptr_bounds ((void **)&p, p1 - 10); + p[9] = argc; + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-1-nov.c new file mode 100644 index 00000000000..9e9ea305ae8 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-1-nov.c @@ -0,0 +1,18 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; +int *p; + +int mpx_test (int argc, const char **argv) +{ + int *p1 = __bnd_set_ptr_bounds (buf + 10, sizeof (int) * 10); + p = buf; + __bnd_store_ptr_bounds ((void **)&p, p1 - 10); + p[10] = argc; + p[19] = argc; + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-1-ubv.c new file mode 100644 index 00000000000..62aca8c131b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-1-ubv.c @@ -0,0 +1,20 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; +int *p; + +int mpx_test (int argc, const char **argv) +{ + int *p1 = __bnd_set_ptr_bounds (buf + 10, sizeof (int) * 10); + p = buf; + __bnd_store_ptr_bounds ((void **)&p, p1 - 10); + p[20] = argc; + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-2.c b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-2.c new file mode 100644 index 00000000000..a2ca7900915 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/builtin-bnd-store-ptr-bounds-2.c @@ -0,0 +1,16 @@ +/* { dg-do run } */ +/* { dg-options "-fno-check-pointer-bounds" } */ + + +#include "mpx-check.h" + +int buf[100]; +int *p; + +int mpx_test (int argc, const char **argv) +{ + int *p1 = __bnd_set_ptr_bounds (buf + 10, sizeof (int) * 10); + p = buf; + __bnd_store_ptr_bounds ((void **)&p, p1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/fastcall-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/fastcall-1-lbv.c new file mode 100644 index 00000000000..6f9ba88fed5 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/fastcall-1-lbv.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-require-effective-target ia32 } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +__attribute__((fastcall)) int rd (int *p1, int *p2, int i) +{ + int res = p1[i]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, buf, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/fastcall-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/fastcall-1-nov.c new file mode 100644 index 00000000000..6a2896e0125 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/fastcall-1-nov.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ +/* { dg-require-effective-target ia32 } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +__attribute__((fastcall)) int rd (int *p1, int *p2, int i) +{ + int res = p1[i]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, buf, 0); + rd (buf1, buf, 9); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/fastcall-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/fastcall-1-ubv.c new file mode 100644 index 00000000000..b5edc438f27 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/fastcall-1-ubv.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-require-effective-target ia32 } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +__attribute__((fastcall)) int rd (int *p1, int *p2, int i) +{ + int res = p1[i]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, buf, 10); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/fastcall-2-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/fastcall-2-lbv.c new file mode 100644 index 00000000000..cbe7343e018 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/fastcall-2-lbv.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-require-effective-target ia32 } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +__attribute__((fastcall)) int rd (int *p1, int *p2, int i) +{ + int res = p2[i]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + rd (buf, buf1, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/fastcall-2-nov.c b/gcc/testsuite/gcc.target/i386/mpx/fastcall-2-nov.c new file mode 100644 index 00000000000..83773d0d90c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/fastcall-2-nov.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ +/* { dg-require-effective-target ia32 } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +__attribute__((fastcall)) int rd (int *p1, int *p2, int i) +{ + int res = p2[i]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + rd (buf, buf1, 0); + rd (buf, buf1, 9); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/fastcall-2-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/fastcall-2-ubv.c new file mode 100644 index 00000000000..1a614fa3610 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/fastcall-2-ubv.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-require-effective-target ia32 } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +__attribute__((fastcall)) int rd (int *p1, int *p2, int i) +{ + int res = p2[i]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + rd (buf, buf1, 10); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-1-lbv.c new file mode 100644 index 00000000000..46a58123bf4 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-1-lbv.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S { + int a; + int b[100]; + int c; +} S; + +int foo (int *i, int k) +{ + printf ("%d\n", i[k]); + return i[k]; +} + +int mpx_test (int argc, const char **argv) +{ + struct S s; + + foo(&s.a, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-1-nov.c new file mode 100644 index 00000000000..b8500ff333d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-1-nov.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct S { + int a; + int b[100]; + int c; +} S; + +int foo (int *i, int k) +{ + printf ("%d\n", i[k]); + return i[k]; +} + +int mpx_test (int argc, const char **argv) +{ + struct S s; + + foo(&s.a, 0); + foo(&s.a, 101); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-1-ubv.c new file mode 100644 index 00000000000..990adee3bb2 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-1-ubv.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S { + int a; + int b[100]; + int c; +} S; + +int foo (int *i, int k) +{ + printf ("%d\n", i[k]); + return i[k]; +} + +int mpx_test (int argc, const char **argv) +{ + struct S s; + + foo(&s.a, 102); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-10-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-10-lbv.c new file mode 100644 index 00000000000..cd8d59afd22 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-10-lbv.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +/* { dg-additional-options "-fchkp-narrow-to-innermost-array" } */ + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S { + int arr[100]; +} S; + +struct S sa[10]; + +int rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (&sa[argc].arr[0], -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-10-nov.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-10-nov.c new file mode 100644 index 00000000000..90f79a0eaed --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-10-nov.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +/* { dg-additional-options "-fchkp-narrow-to-innermost-array" } */ + +#include "mpx-check.h" + +struct S { + int arr[100]; +} S; + +struct S sa[10]; + +int rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (&sa[argc].arr[0], 0); + rd (&sa[argc].arr[0], 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-10-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-10-ubv.c new file mode 100644 index 00000000000..b6a9ad07071 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-10-ubv.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +/* { dg-additional-options "-fchkp-narrow-to-innermost-array" } */ + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S { + int arr[100]; +} S; + +struct S sa[10]; + +int rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (&sa[argc].arr[0], 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-2-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-2-lbv.c new file mode 100644 index 00000000000..fdf39672315 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-2-lbv.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +/* { dg-additional-options "-fchkp-first-field-has-own-bounds" } */ + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S { + int a; + int b[100]; + int c; +} S; + +int foo (int *i, int k) +{ + printf ("%d\n", i[k]); + return i[k]; +} + +int mpx_test (int argc, const char **argv) +{ + struct S s; + + foo(&s.a, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-2-nov.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-2-nov.c new file mode 100644 index 00000000000..2a685036ca0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-2-nov.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +/* { dg-additional-options "-fchkp-first-field-has-own-bounds" } */ + +#include "mpx-check.h" + +struct S { + int a; + int b[100]; + int c; +} S; + +int foo (int *i, int k) +{ + printf ("%d\n", i[k]); + return i[k]; +} + +int mpx_test (int argc, const char **argv) +{ + struct S s; + + foo(&s.a, 0); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-2-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-2-ubv.c new file mode 100644 index 00000000000..b07b09ff808 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-2-ubv.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +/* { dg-additional-options "-fchkp-first-field-has-own-bounds" } */ + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S { + int a; + int b[100]; + int c; +} S; + +int foo (int *i, int k) +{ + printf ("%d\n", i[k]); + return i[k]; +} + +int mpx_test (int argc, const char **argv) +{ + struct S s; + + foo(&s.a, 1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-3-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-3-lbv.c new file mode 100644 index 00000000000..ea919d80fbc --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-3-lbv.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S { + int a; + int b[100]; + int c; +} S; + +int foo (int *p, int i) +{ + printf ("%d\n", p[i]); + return p[i]; +} + +struct S s; + +int mpx_test (int argc, const char **argv) +{ + foo (&s.b[0], -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-3-nov.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-3-nov.c new file mode 100644 index 00000000000..12f42c4d289 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-3-nov.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct S { + int a; + int b[100]; + int c; +} S; + +int foo (int *p, int i) +{ + printf ("%d\n", p[i]); + return p[i]; +} + +struct S s; + +int mpx_test (int argc, const char **argv) +{ + foo (&s.b[0], 0); + foo (&s.b[0], 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-3-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-3-ubv.c new file mode 100644 index 00000000000..55a8af3a0ce --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-3-ubv.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S { + int a; + int b[100]; + int c; +} S; + +int foo (int *p, int i) +{ + printf ("%d\n", p[i]); + return p[i]; +} + +struct S s; + +int mpx_test (int argc, const char **argv) +{ + foo (&s.b[0], 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-4-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-4-lbv.c new file mode 100644 index 00000000000..23cf71ed6df --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-4-lbv.c @@ -0,0 +1,35 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S { + int a; + int b[100]; + int c; +} S; + +struct S1 { + int x; + struct S a[10]; + struct S b; +} S1; + +int foo (int *p, int i) +{ + printf ("%d\n", p[i]); + return p[i]; +} + +struct S1 s1; + +int mpx_test (int argc, const char **argv) +{ + foo (&s1.a[0].a, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-4-nov.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-4-nov.c new file mode 100644 index 00000000000..791753244f3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-4-nov.c @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct S { + int a; + int b[100]; + int c; +} S; + +struct S1 { + int x; + struct S a[10]; + struct S b; +} S1; + +int foo (int *p, int i) +{ + printf ("%d\n", p[i]); + return p[i]; +} + +struct S1 s1; + +int mpx_test (int argc, const char **argv) +{ + foo (&s1.a[9].c, 0); + foo (&s1.a[0].a, 0); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-4-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-4-ubv.c new file mode 100644 index 00000000000..0d4ac020cf3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-4-ubv.c @@ -0,0 +1,35 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S { + int a; + int b[100]; + int c; +} S; + +struct S1 { + int x; + struct S a[10]; + struct S b; +} S1; + +int foo (int *p, int i) +{ + printf ("%d\n", p[i]); + return p[i]; +} + +struct S1 s1; + +int mpx_test (int argc, const char **argv) +{ + foo (&s1.a[9].c, 1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-5-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-5-lbv.c new file mode 100644 index 00000000000..c00d42f3213 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-5-lbv.c @@ -0,0 +1,35 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S { + int a; + int b[100]; + int c; +} S; + +struct S1 { + int x; + struct S a[10]; + struct S b; +} S1; + +int foo (int *p, int i) +{ + printf ("%d\n", p[i]); + return p[i]; +} + +struct S1 s1; + +int mpx_test (int argc, const char **argv) +{ + foo (&s1.b.b[0], -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-5-nov.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-5-nov.c new file mode 100644 index 00000000000..b69895e1d20 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-5-nov.c @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct S { + int a; + int b[100]; + int c; +} S; + +struct S1 { + int x; + struct S a[10]; + struct S b; +} S1; + +int foo (int *p, int i) +{ + printf ("%d\n", p[i]); + return p[i]; +} + +struct S1 s1; + +int mpx_test (int argc, const char **argv) +{ + foo (&s1.b.b[0], 0); + foo (&s1.b.b[0], 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-5-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-5-ubv.c new file mode 100644 index 00000000000..d00f41eb86e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-5-ubv.c @@ -0,0 +1,35 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S { + int a; + int b[100]; + int c; +} S; + +struct S1 { + int x; + struct S a[10]; + struct S b; +} S1; + +int foo (int *p, int i) +{ + printf ("%d\n", p[i]); + return p[i]; +} + +struct S1 s1; + +int mpx_test (int argc, const char **argv) +{ + foo (&s1.b.b[0], 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-6-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-6-lbv.c new file mode 100644 index 00000000000..91b64bf462d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-6-lbv.c @@ -0,0 +1,36 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S { + int a; + int b[100]; + int c; +} S; + +struct S1 { + int x; + struct S a[10]; + struct S b; +} S1; + +int foo (int *p, int i) +{ + printf ("%d\n", p[i]); + return p[i]; +} + +struct S1 s1; +struct S1 *s2 = &s1; + +int mpx_test (int argc, const char **argv) +{ + foo (&(s2->a[0].a), -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-6-nov.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-6-nov.c new file mode 100644 index 00000000000..f837f57a421 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-6-nov.c @@ -0,0 +1,34 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct S { + int a; + int b[100]; + int c; +} S; + +struct S1 { + int x; + struct S a[10]; + struct S b; +} S1; + +int foo (int *p, int i) +{ + printf ("%d\n", p[i]); + return p[i]; +} + +struct S1 s1; +struct S1 *s2 = &s1; + +int mpx_test (int argc, const char **argv) +{ + foo (&(s2->a[0].a), 0); + foo (&(s2->a[9].a), 101); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-6-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-6-ubv.c new file mode 100644 index 00000000000..97ef911406e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-6-ubv.c @@ -0,0 +1,36 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S { + int a; + int b[100]; + int c; +} S; + +struct S1 { + int x; + struct S a[10]; + struct S b; +} S1; + +int foo (int *p, int i) +{ + printf ("%d\n", p[i]); + return p[i]; +} + +struct S1 s1; +struct S1 *s2 = &s1; + +int mpx_test (int argc, const char **argv) +{ + foo (&(s2->a[9].a), 102); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-7-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-7-lbv.c new file mode 100644 index 00000000000..176971168e5 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-7-lbv.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S { + int a[10]; + int b; +} S; + +struct S1 { + int a; + struct S b[10]; + int c; +} S1; + +struct S2 { + int x; + struct S1 a[10]; + struct S1 b; +} S2; + +int foo (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +struct S2 s1; +struct S2 *s2 = &s1; + +int mpx_test (int argc, const char **argv) +{ + foo (&(s2->a[-1].a), 0); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-7-nov.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-7-nov.c new file mode 100644 index 00000000000..19c09b8271e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-7-nov.c @@ -0,0 +1,40 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct S { + int a[10]; + int b; +} S; + +struct S1 { + int a; + struct S b[10]; + int c; +} S1; + +struct S2 { + int x; + struct S1 a[10]; + struct S1 b; +} S2; + +int foo (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +struct S2 s1; +struct S2 *s2 = &s1; + +int mpx_test (int argc, const char **argv) +{ + foo (&(s2->a[0].a), 0); + foo (&(s2->a[9].c), 0); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-7-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-7-ubv.c new file mode 100644 index 00000000000..c9e8ae2442c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-7-ubv.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S { + int a[10]; + int b; +} S; + +struct S1 { + int a; + struct S b[10]; + int c; +} S1; + +struct S2 { + int x; + struct S1 a[10]; + struct S1 b; +} S2; + +int foo (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +struct S2 s1; +struct S2 *s2 = &s1; + +int mpx_test (int argc, const char **argv) +{ + foo (&(s2->a[10].a), 0); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-8-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-8-lbv.c new file mode 100644 index 00000000000..cac6784175b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-8-lbv.c @@ -0,0 +1,43 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +/* { dg-additional-options "-fchkp-narrow-to-innermost-array" } */ + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S { + int a[10]; + int b; +} S; + +struct S1 { + int a; + struct S b[10]; + int c; +} S1; + +struct S2 { + int x; + struct S1 a[10]; + struct S1 b; +} S2; + +int foo (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +struct S2 s1; +struct S2 *s2 = &s1; + +int mpx_test (int argc, const char **argv) +{ + foo (&(s1.a[argc].b[-1].a[0]), 9); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-8-nov.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-8-nov.c new file mode 100644 index 00000000000..e7243a989f9 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-8-nov.c @@ -0,0 +1,43 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +/* { dg-additional-options "-fchkp-narrow-to-innermost-array" } */ + +#include "mpx-check.h" + +struct S { + int a[10]; + int b; +} S; + +struct S1 { + int a; + struct S b[10]; + int c; +} S1; + +struct S2 { + int x; + struct S1 a[10]; + struct S1 b; +} S2; + +int foo (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +struct S2 s1; +struct S2 *s2 = &s1; + +int mpx_test (int argc, const char **argv) +{ + foo (&(s1.a[argc].b[0].a[0]), 0); + foo (&(s1.a[argc].b[0].a[0]), 9); + foo (&(s1.a[argc].b[9].a[0]), 0); + foo (&(s1.a[argc].b[9].a[0]), 9); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-8-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-8-ubv.c new file mode 100644 index 00000000000..d2792e1bba4 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-8-ubv.c @@ -0,0 +1,43 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +/* { dg-additional-options "-fchkp-narrow-to-innermost-array" } */ + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S { + int a[10]; + int b; +} S; + +struct S1 { + int a; + struct S b[10]; + int c; +} S1; + +struct S2 { + int x; + struct S1 a[10]; + struct S1 b; +} S2; + +int foo (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +struct S2 s1; +struct S2 *s2 = &s1; + +int mpx_test (int argc, const char **argv) +{ + foo (&(s1.a[argc].b[10].a[0]), 9); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-9-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-9-lbv.c new file mode 100644 index 00000000000..127d0966330 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-9-lbv.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +/* { dg-additional-options "-fchkp-narrow-to-innermost-array" } */ + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S { + int first; + int a[10]; + int b; +} S; + +struct S1 { + int a; + struct S b[10]; + int c; +} S1; + +struct S2 { + int x; + struct S1 a[10]; + struct S1 b; +} S2; + +int foo (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +struct S2 s1; +struct S2 *s2 = &s1; + +int mpx_test (int argc, const char **argv) +{ + foo (&(s2->a[argc].b[5].a[0]), -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-9-nov.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-9-nov.c new file mode 100644 index 00000000000..7f98b0188a3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-9-nov.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +/* { dg-additional-options "-fchkp-narrow-to-innermost-array" } */ + +#include "mpx-check.h" + +struct S { + int first; + int a[10]; + int b; +} S; + +struct S1 { + int a; + struct S b[10]; + int c; +} S1; + +struct S2 { + int x; + struct S1 a[10]; + struct S1 b; +} S2; + +int foo (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +struct S2 s1; +struct S2 *s2 = &s1; + +int mpx_test (int argc, const char **argv) +{ + foo (&(s2->a[argc].b[5].a[0]), 0); + foo (&(s2->a[argc].b[5].a[0]), 9); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/field-addr-9-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/field-addr-9-ubv.c new file mode 100644 index 00000000000..a65b8f0d17f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/field-addr-9-ubv.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +/* { dg-additional-options "-fchkp-narrow-to-innermost-array" } */ + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S { + int first; + int a[10]; + int b; +} S; + +struct S1 { + int a; + struct S b[10]; + int c; +} S1; + +struct S2 { + int x; + struct S1 a[10]; + struct S1 b; +} S2; + +int foo (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +struct S2 s1; +struct S2 *s2 = &s1; + +int mpx_test (int argc, const char **argv) +{ + foo (&(s2->a[argc].b[5].a[0]), 10); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/frame-address-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/frame-address-1-nov.c new file mode 100644 index 00000000000..87cc2dd1cfc --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/frame-address-1-nov.c @@ -0,0 +1,12 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int mpx_test (int argc, const char **argv) +{ + void **fa = (void **)__builtin_frame_address (0); + printf ("%p\n", *fa); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/hard-reg-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/hard-reg-1-nov.c new file mode 100644 index 00000000000..86276791e06 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/hard-reg-1-nov.c @@ -0,0 +1,20 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + register int *frame __asm__("rsp"); + rd (frame, 1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/if-stmt-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/if-stmt-1-lbv.c new file mode 100644 index 00000000000..29fa443697f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/if-stmt-1-lbv.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int rd (int *p1, int *p2, int i) +{ + int res; + + if (p1 < p2) + p1 = p2; + + res = p1[i]; + printf ("%d\n", res); + return res; +} + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + int *p = __bnd_set_ptr_bounds (buf + 1, 40); + rd (buf, p, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/if-stmt-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/if-stmt-1-nov.c new file mode 100644 index 00000000000..576ea8487e3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/if-stmt-1-nov.c @@ -0,0 +1,28 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int rd (int *p1, int *p2, int i) +{ + int res; + + if (p1 < p2) + p1 = p2; + + res = p1[i]; + printf ("%d\n", res); + return res; +} + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + int *p = __bnd_set_ptr_bounds (buf + 1, 40); + rd (buf, p, 0); + rd (buf, p, 9); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/if-stmt-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/if-stmt-1-ubv.c new file mode 100644 index 00000000000..021a3aed267 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/if-stmt-1-ubv.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int rd (int *p1, int *p2, int i) +{ + int res; + + if (p1 < p2) + p1 = p2; + + res = p1[i]; + printf ("%d\n", res); + return res; +} + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + int *p = __bnd_set_ptr_bounds (buf + 1, 40); + rd (buf, p, 10); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/if-stmt-2-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/if-stmt-2-lbv.c new file mode 100644 index 00000000000..5d7fe6299a5 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/if-stmt-2-lbv.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int rd (int *p1, int *p2, int i) +{ + int res; + + if (p1 > p2) + p1 = p2; + + res = p1[i]; + printf ("%d\n", res); + return res; +} + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + int *p = __bnd_set_ptr_bounds (buf + 1, 40); + rd (buf, p, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/if-stmt-2-nov.c b/gcc/testsuite/gcc.target/i386/mpx/if-stmt-2-nov.c new file mode 100644 index 00000000000..327c108f789 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/if-stmt-2-nov.c @@ -0,0 +1,28 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int rd (int *p1, int *p2, int i) +{ + int res; + + if (p1 > p2) + p1 = p2; + + res = p1[i]; + printf ("%d\n", res); + return res; +} + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + int *p = __bnd_set_ptr_bounds (buf + 1, 40); + rd (buf, p, 0); + rd (buf, p, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/if-stmt-2-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/if-stmt-2-ubv.c new file mode 100644 index 00000000000..3047f7b5104 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/if-stmt-2-ubv.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int rd (int *p1, int *p2, int i) +{ + int res; + + if (p1 > p2) + p1 = p2; + + res = p1[i]; + printf ("%d\n", res); + return res; +} + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + int *p = __bnd_set_ptr_bounds (buf + 1, 40); + rd (buf, p, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/label-address-1.c b/gcc/testsuite/gcc.target/i386/mpx/label-address-1.c new file mode 100644 index 00000000000..f4cd360b1d4 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/label-address-1.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +void *p; +int mpx_test (int argc, const char **argv) +{ + p = &&label; + + label: + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/legacy-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/legacy-1-nov.c new file mode 100644 index 00000000000..b51ac7f0271 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/legacy-1-nov.c @@ -0,0 +1,25 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; + +__attribute__((bnd_legacy)) +int rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *p = __bnd_set_ptr_bounds (buf + 1, 10); + + rd (p, -1); + rd (p, 10); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/macro.c b/gcc/testsuite/gcc.target/i386/mpx/macro.c new file mode 100644 index 00000000000..00d467bd19d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/macro.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +#ifndef __MPX__ +#error -mmpx is required +#endif + +#ifndef __CHKP__ +#error -fcheck-pointer-bounds is required +#endif + +int mpx_test (int argc, const char **argv) +{ + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/mpx-check.h b/gcc/testsuite/gcc.target/i386/mpx/mpx-check.h new file mode 100644 index 00000000000..3afa46093d1 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/mpx-check.h @@ -0,0 +1,41 @@ +#include +#include +#include + +#include "cpuid.h" + +static int +__attribute__ ((noinline)) +mpx_test (int, const char **); + +#ifdef SHOULDFAIL +#define NORUNRES 1 +#else +#define NORUNRES 0 +#endif + +#define DEBUG + +int +main (int argc, const char **argv) +{ + unsigned int eax, ebx, ecx, edx; + + if (__get_cpuid_max (0, NULL) < 7) + return 0; + + __cpuid_count (7, 0, eax, ebx, ecx, edx); + + /* Run MPX test only if host has MPX support. */ + if (ebx & bit_MPX) + mpx_test (argc, argv); + else + { +#ifdef DEBUG + printf ("SKIPPED\n"); +#endif + return NORUNRES; + } + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/mpx.exp b/gcc/testsuite/gcc.target/i386/mpx/mpx.exp new file mode 100644 index 00000000000..757c8e9f20d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/mpx.exp @@ -0,0 +1,39 @@ +# Copyright (C) 2014 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# Exit immediately if this isn't a x86 target. +if { ![istarget i?86*-*-*] && ![istarget x86_64-*-*] } then { + return +} + +# Load support procs. +load_lib gcc-dg.exp +load_lib mpx-dg.exp + +# Initialize. +dg-init +mpx_init + +if [check_effective_target_mpx] { + # Run all tests. + gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c*]] "" "" +} + +# All done. +mpx_finish +dg-finish diff --git a/gcc/testsuite/gcc.target/i386/mpx/nested-function-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/nested-function-1-lbv.c new file mode 100644 index 00000000000..0e9d657fcbd --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/nested-function-1-lbv.c @@ -0,0 +1,22 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int mpx_test (int argc, const char **argv) +{ + int a[100]; + + void rd (int i) + { + printf ("%d\n", a[i]); + } + + rd (-1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/nested-function-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/nested-function-1-nov.c new file mode 100644 index 00000000000..dd985466328 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/nested-function-1-nov.c @@ -0,0 +1,20 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int mpx_test (int argc, const char **argv) +{ + int a[100]; + + void rd (int i) + { + printf ("%d\n", a[i]); + } + + rd (0); + rd (99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/nested-function-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/nested-function-1-ubv.c new file mode 100644 index 00000000000..b5cf6cc29b3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/nested-function-1-ubv.c @@ -0,0 +1,22 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int mpx_test (int argc, const char **argv) +{ + int a[100]; + + void rd (int i) + { + printf ("%d\n", a[i]); + } + + rd (100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-1-lbv.c new file mode 100644 index 00000000000..58692efb0e3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-1-lbv.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + rd (buf, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-1-nov.c new file mode 100644 index 00000000000..01279be8d3b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-1-nov.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + rd (buf, 0); + rd (buf, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-1-ubv.c new file mode 100644 index 00000000000..c377c57eb6b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-1-ubv.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + rd (buf, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-2-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-2-lbv.c new file mode 100644 index 00000000000..ebe76cb8263 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-2-lbv.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int rd (int t1, int t2, int t3, int t4, int t5, int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + rd (0, 0, 0, 0, 0, buf, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-2-nov.c b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-2-nov.c new file mode 100644 index 00000000000..8b9fce2e297 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-2-nov.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int rd (int t1, int t2, int t3, int t4, int t5, int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + rd (0, 0, 0, 0, 0, buf, 0); + rd (0, 0, 0, 0, 0, buf, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-2-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-2-ubv.c new file mode 100644 index 00000000000..525140e2d79 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-2-ubv.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int rd (int t1, int t2, int t3, int t4, int t5, int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + rd (0, 0, 0, 0, 0, buf, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-3-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-3-lbv.c new file mode 100644 index 00000000000..d6571be44b5 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-3-lbv.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int rd (int t1, int t2, int t3, int t4, int t5, int t6, int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + rd (0, 0, 0, 0, 0, 0, buf, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-3-nov.c b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-3-nov.c new file mode 100644 index 00000000000..e42ecba4e2a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-3-nov.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int rd (int t1, int t2, int t3, int t4, int t5, int t6, int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + rd (0, 0, 0, 0, 0, 0, buf, 0); + rd (0, 0, 0, 0, 0, 0, buf, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-3-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-3-ubv.c new file mode 100644 index 00000000000..8da6252a03a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-3-ubv.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int rd (int t1, int t2, int t3, int t4, int t5, int t6, int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + rd (0, 0, 0, 0, 0, 0, buf, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-4-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-4-lbv.c new file mode 100644 index 00000000000..5a6842512db --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-4-lbv.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; +int buf1[10]; + +int rd (int *t1, int *t2, int *t3, int *t4, int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + rd (buf1, buf1, buf1, buf1, buf, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-4-nov.c b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-4-nov.c new file mode 100644 index 00000000000..bb2bc46a6f3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-4-nov.c @@ -0,0 +1,25 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; +int buf1[10]; + +int rd (int *t1, int *t2, int *t3, int *t4, int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + rd (buf1, buf1, buf1, buf1, buf, 0); + rd (buf1, buf1, buf1, buf1, buf, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-4-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-4-ubv.c new file mode 100644 index 00000000000..cf3a5c48f1b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-4-ubv.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; +int buf1[10]; + +int rd (int *t1, int *t2, int *t3, int *t4, int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + rd (buf1, buf1, buf1, buf1, buf, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-5-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-5-lbv.c new file mode 100644 index 00000000000..7c3bd867204 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-5-lbv.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; +int buf1[10]; + +int rd (int *t1, int *t2, int *t3, int *t4, int *t5, int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + rd (buf1, buf1, buf1, buf1, buf1, buf, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-5-nov.c b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-5-nov.c new file mode 100644 index 00000000000..27e4a7130b0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-5-nov.c @@ -0,0 +1,25 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; +int buf1[10]; + +int rd (int *t1, int *t2, int *t3, int *t4, int *t5, int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + rd (buf1, buf1, buf1, buf1, buf1, buf, 0); + rd (buf1, buf1, buf1, buf1, buf1, buf, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-5-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-5-ubv.c new file mode 100644 index 00000000000..68e2654b91a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pointer-arg-5-ubv.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; +int buf1[10]; + +int rd (int *t1, int *t2, int *t3, int *t4, int *t5, int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + rd (buf1, buf1, buf1, buf1, buf1, buf, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pointer-store-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/pointer-store-1-lbv.c new file mode 100644 index 00000000000..bde8c76e4b7 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pointer-store-1-lbv.c @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int *buf1[100]; +int buf2[100]; + +void wr (int i) +{ + buf1[i] = buf2; +} + +int rd(int i, int j) +{ + int res = buf1[i][j]; + printf("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + wr(10); + rd(10, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pointer-store-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/pointer-store-1-nov.c new file mode 100644 index 00000000000..269e3af17f0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pointer-store-1-nov.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int *buf1[100]; +int buf2[100]; + +void wr (int i) +{ + buf1[i] = buf2; +} + +int rd(int i, int j) +{ + int res = buf1[i][j]; + printf("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + wr(10); + rd(10, 0); + rd(10, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pointer-store-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/pointer-store-1-ubv.c new file mode 100644 index 00000000000..4c8d45e003f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pointer-store-1-ubv.c @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int *buf1[100]; +int buf2[100]; + +void wr (int i) +{ + buf1[i] = buf2; +} + +int rd(int i, int j) +{ + int res = buf1[i][j]; + printf("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + wr(10); + rd(10, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/reference-1-lbv.cpp b/gcc/testsuite/gcc.target/i386/mpx/reference-1-lbv.cpp new file mode 100644 index 00000000000..ec5f546c081 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/reference-1-lbv.cpp @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int __attribute((nothrow)) +rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +void set_p (int *&ref) +{ + ref = buf; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + set_p (p); + rd (p, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/reference-1-nov.cpp b/gcc/testsuite/gcc.target/i386/mpx/reference-1-nov.cpp new file mode 100644 index 00000000000..98f1622349a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/reference-1-nov.cpp @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int __attribute((nothrow)) +rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +void set_p (int *&ref) +{ + ref = buf; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + set_p (p); + rd (p, 0); + rd (p, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/reference-1-ubv.cpp b/gcc/testsuite/gcc.target/i386/mpx/reference-1-ubv.cpp new file mode 100644 index 00000000000..d2135e7270f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/reference-1-ubv.cpp @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int __attribute((nothrow)) +rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +void set_p (int *&ref) +{ + ref = buf; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + set_p (p); + rd (p, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/reference-2-lbv.cpp b/gcc/testsuite/gcc.target/i386/mpx/reference-2-lbv.cpp new file mode 100644 index 00000000000..907cb06616c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/reference-2-lbv.cpp @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int __attribute((nothrow)) +rd (int *&p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +void set_p (int *&ref) +{ + ref = buf; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + set_p (p); + rd (p, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/reference-2-nov.cpp b/gcc/testsuite/gcc.target/i386/mpx/reference-2-nov.cpp new file mode 100644 index 00000000000..cdd927c891e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/reference-2-nov.cpp @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int __attribute((nothrow)) +rd (int *&p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +void set_p (int *&ref) +{ + ref = buf; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + set_p (p); + rd (p, 0); + rd (p, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/reference-2-ubv.cpp b/gcc/testsuite/gcc.target/i386/mpx/reference-2-ubv.cpp new file mode 100644 index 00000000000..2f75375d251 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/reference-2-ubv.cpp @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int __attribute((nothrow)) +rd (int *&p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +void set_p (int *&ref) +{ + ref = buf; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + set_p (p); + rd (p, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/reference-3-lbv.cpp b/gcc/testsuite/gcc.target/i386/mpx/reference-3-lbv.cpp new file mode 100644 index 00000000000..1330359797d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/reference-3-lbv.cpp @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; +int buf1[10]; + +int rd (int (&p)[100], int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + rd (buf, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/reference-3-nov.cpp b/gcc/testsuite/gcc.target/i386/mpx/reference-3-nov.cpp new file mode 100644 index 00000000000..9a5519318a4 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/reference-3-nov.cpp @@ -0,0 +1,25 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; +int buf1[10]; + +int rd (int (&p)[100], int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + rd (buf, 0); + rd (buf, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/reference-3-ubv.cpp b/gcc/testsuite/gcc.target/i386/mpx/reference-3-ubv.cpp new file mode 100644 index 00000000000..0a874fabb09 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/reference-3-ubv.cpp @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; +int buf1[10]; + +int rd (int (&p)[100], int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + rd (buf, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/reference-4-lbv.cpp b/gcc/testsuite/gcc.target/i386/mpx/reference-4-lbv.cpp new file mode 100644 index 00000000000..2442c6a4a9a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/reference-4-lbv.cpp @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int rd (int (&p)[100], int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int (&get_buf ()) [100] +{ + return buf; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + rd (get_buf (), -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/reference-4-nov.cpp b/gcc/testsuite/gcc.target/i386/mpx/reference-4-nov.cpp new file mode 100644 index 00000000000..9646cc0645d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/reference-4-nov.cpp @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int rd (int (&p)[100], int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int (&get_buf ()) [100] +{ + return buf; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + rd (get_buf (), 0); + rd (get_buf (), 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/reference-4-ubv.cpp b/gcc/testsuite/gcc.target/i386/mpx/reference-4-ubv.cpp new file mode 100644 index 00000000000..da3382357ab --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/reference-4-ubv.cpp @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int rd (int (&p)[100], int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int (&get_buf ()) [100] +{ + return buf; +} + +int mpx_test (int argc, const char **argv) +{ + int *p; + + rd (get_buf (), 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/return-pointer-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/return-pointer-1-lbv.c new file mode 100644 index 00000000000..9a209b8d304 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/return-pointer-1-lbv.c @@ -0,0 +1,43 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int *_buf1[100]; +int _buf2[100]; + +int **get_buf1 () +{ + return _buf1; +} + +int *get_buf2 () +{ + return _buf2; +} + +void wr (int i, int **buf1, int *buf2) +{ + buf1[i] = buf2; +} + +int rd (int i, int j, int **buf) +{ + int res = buf[i][j]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int **buf1 = get_buf1 (); + int *buf2 = get_buf2 (); + wr(10, buf1, buf2); + rd(10, -1, buf1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/return-pointer-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/return-pointer-1-nov.c new file mode 100644 index 00000000000..62d05013909 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/return-pointer-1-nov.c @@ -0,0 +1,41 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int *_buf1[100]; +int _buf2[100]; + +int **get_buf1 () +{ + return _buf1; +} + +int *get_buf2 () +{ + return _buf2; +} + +void wr (int i, int **buf1, int *buf2) +{ + buf1[i] = buf2; +} + +int rd (int i, int j, int **buf) +{ + int res = buf[i][j]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int **buf1 = get_buf1 (); + int *buf2 = get_buf2 (); + wr(10, buf1, buf2); + rd(10, 0, buf1); + rd(10, 99, buf1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/return-pointer-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/return-pointer-1-ubv.c new file mode 100644 index 00000000000..4658aef1714 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/return-pointer-1-ubv.c @@ -0,0 +1,43 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int *_buf1[100]; +int _buf2[100]; + +int **get_buf1 () +{ + return _buf1; +} + +int *get_buf2 () +{ + return _buf2; +} + +void wr (int i, int **buf1, int *buf2) +{ + buf1[i] = buf2; +} + +int rd (int i, int j, int **buf) +{ + int res = buf[i][j]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int **buf1 = get_buf1 (); + int *buf2 = get_buf2 (); + wr(10, buf1, buf2); + rd(10, 100, buf1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/return-struct-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/return-struct-1-lbv.c new file mode 100644 index 00000000000..ef29427fff3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/return-struct-1-lbv.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int *p; +} s1; + +int buf[100]; + +struct s1 __attribute__((noinline)) get () +{ + struct s1 s; + s.p = buf; + return s; +} + +int __attribute__((noinline)) rd (struct s1 s, int i) +{ + int res = s.p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = get (); + + rd (s, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/return-struct-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/return-struct-1-nov.c new file mode 100644 index 00000000000..12e1edd6c4c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/return-struct-1-nov.c @@ -0,0 +1,36 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct s1 +{ + int *p; +} s1; + +int buf[100]; + +struct s1 __attribute__((noinline)) get () +{ + struct s1 s; + s.p = buf; + return s; +} + +int __attribute__((noinline)) rd (struct s1 s, int i) +{ + int res = s.p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = get (); + + rd (s, 0); + rd (s, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/return-struct-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/return-struct-1-ubv.c new file mode 100644 index 00000000000..dda908b2203 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/return-struct-1-ubv.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int *p; +} s1; + +int buf[100]; + +struct s1 __attribute__((noinline)) get () +{ + struct s1 s; + s.p = buf; + return s; +} + +int __attribute__((noinline)) rd (struct s1 s, int i) +{ + int res = s.p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = get (); + + rd (s, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/return-struct-2-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/return-struct-2-lbv.c new file mode 100644 index 00000000000..bf370669d1c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/return-struct-2-lbv.c @@ -0,0 +1,41 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int *p1; +} s1; + +int buf[100]; +int buf1[10]; + +struct s1 __attribute__((noinline)) get () +{ + struct s1 s; + s.p = buf; + s.p1 = buf1; + return s; +} + +int __attribute__((noinline)) rd (struct s1 s, int i) +{ + int res = s.p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = get (); + + rd (s, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/return-struct-2-nov.c b/gcc/testsuite/gcc.target/i386/mpx/return-struct-2-nov.c new file mode 100644 index 00000000000..577e3ab5dc1 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/return-struct-2-nov.c @@ -0,0 +1,39 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int *p1; +} s1; + +int buf[100]; +int buf1[10]; + +struct s1 __attribute__((noinline)) get () +{ + struct s1 s; + s.p = buf; + s.p1 = buf1; + return s; +} + +int __attribute__((noinline)) rd (struct s1 s, int i) +{ + int res = s.p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = get (); + + rd (s, 0); + rd (s, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/return-struct-2-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/return-struct-2-ubv.c new file mode 100644 index 00000000000..c5a7ad002af --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/return-struct-2-ubv.c @@ -0,0 +1,41 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int *p1; +} s1; + +int buf[100]; +int buf1[10]; + +struct s1 __attribute__((noinline)) get () +{ + struct s1 s; + s.p = buf; + s.p1 = buf1; + return s; +} + +int __attribute__((noinline)) rd (struct s1 s, int i) +{ + int res = s.p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = get (); + + rd (s, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/return-struct-3-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/return-struct-3-lbv.c new file mode 100644 index 00000000000..1802ca837cf --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/return-struct-3-lbv.c @@ -0,0 +1,41 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int *p1; + int *p; +} s1; + +int buf[100]; +int buf1[10]; + +struct s1 __attribute__((noinline)) get () +{ + struct s1 s; + s.p = buf; + s.p1 = buf1; + return s; +} + +int __attribute__((noinline)) rd (struct s1 s, int i) +{ + int res = s.p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = get (); + + rd (s, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/return-struct-3-nov.c b/gcc/testsuite/gcc.target/i386/mpx/return-struct-3-nov.c new file mode 100644 index 00000000000..2e5214a8278 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/return-struct-3-nov.c @@ -0,0 +1,39 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct s1 +{ + int *p1; + int *p; +} s1; + +int buf[100]; +int buf1[10]; + +struct s1 __attribute__((noinline)) get () +{ + struct s1 s; + s.p = buf; + s.p1 = buf1; + return s; +} + +int __attribute__((noinline)) rd (struct s1 s, int i) +{ + int res = s.p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = get (); + + rd (s, 0); + rd (s, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/return-struct-3-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/return-struct-3-ubv.c new file mode 100644 index 00000000000..83b81da8390 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/return-struct-3-ubv.c @@ -0,0 +1,41 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int *p1; + int *p; +} s1; + +int buf[100]; +int buf1[10]; + +struct s1 __attribute__((noinline)) get () +{ + struct s1 s; + s.p = buf; + s.p1 = buf1; + return s; +} + +int __attribute__((noinline)) rd (struct s1 s, int i) +{ + int res = s.p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = get (); + + rd (s, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/return-struct-4-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/return-struct-4-lbv.c new file mode 100644 index 00000000000..7937514d67c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/return-struct-4-lbv.c @@ -0,0 +1,40 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int i1; + int i2; +} s1; + +int buf[100]; + +struct s1 __attribute__((noinline)) get () +{ + struct s1 s; + s.p = buf; + return s; +} + +int __attribute__((noinline)) rd (struct s1 s, int i) +{ + int res = s.p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = get (); + + rd (s, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/return-struct-4-nov.c b/gcc/testsuite/gcc.target/i386/mpx/return-struct-4-nov.c new file mode 100644 index 00000000000..352b5723266 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/return-struct-4-nov.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int i1; + int i2; +} s1; + +int buf[100]; + +struct s1 __attribute__((noinline)) get () +{ + struct s1 s; + s.p = buf; + return s; +} + +int __attribute__((noinline)) rd (struct s1 s, int i) +{ + int res = s.p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = get (); + + rd (s, 0); + rd (s, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/return-struct-4-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/return-struct-4-ubv.c new file mode 100644 index 00000000000..14ba0bddb26 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/return-struct-4-ubv.c @@ -0,0 +1,40 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int i1; + int i2; +} s1; + +int buf[100]; + +struct s1 __attribute__((noinline)) get () +{ + struct s1 s; + s.p = buf; + return s; +} + +int __attribute__((noinline)) rd (struct s1 s, int i) +{ + int res = s.p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = get (); + + rd (s, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/return-struct-5-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/return-struct-5-lbv.c new file mode 100644 index 00000000000..2bd871a8562 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/return-struct-5-lbv.c @@ -0,0 +1,40 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int i1; + int i2; + int *p; +} s1; + +int buf[100]; + +struct s1 __attribute__((noinline)) get () +{ + struct s1 s; + s.p = buf; + return s; +} + +int __attribute__((noinline)) rd (struct s1 s, int i) +{ + int res = s.p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = get (); + + rd (s, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/return-struct-5-nov.c b/gcc/testsuite/gcc.target/i386/mpx/return-struct-5-nov.c new file mode 100644 index 00000000000..978b4930675 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/return-struct-5-nov.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct s1 +{ + int i1; + int i2; + int *p; +} s1; + +int buf[100]; + +struct s1 __attribute__((noinline)) get () +{ + struct s1 s; + s.p = buf; + return s; +} + +int __attribute__((noinline)) rd (struct s1 s, int i) +{ + int res = s.p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = get (); + + rd (s, 0); + rd (s, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/return-struct-5-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/return-struct-5-ubv.c new file mode 100644 index 00000000000..633e15dbe67 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/return-struct-5-ubv.c @@ -0,0 +1,40 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int i1; + int i2; + int *p; +} s1; + +int buf[100]; + +struct s1 __attribute__((noinline)) get () +{ + struct s1 s; + s.p = buf; + return s; +} + +int __attribute__((noinline)) rd (struct s1 s, int i) +{ + int res = s.p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = get (); + + rd (s, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/return-struct-6-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/return-struct-6-lbv.c new file mode 100644 index 00000000000..9e2cf2cc26a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/return-struct-6-lbv.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int i1; + int i2; + int *p; + int i3; + int i4; +} s1; + +int buf[100]; + +struct s1 __attribute__((noinline)) get () +{ + struct s1 s; + s.p = buf; + return s; +} + +int __attribute__((noinline)) rd (struct s1 s, int i) +{ + int res = s.p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = get (); + + rd (s, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/return-struct-6-nov.c b/gcc/testsuite/gcc.target/i386/mpx/return-struct-6-nov.c new file mode 100644 index 00000000000..f2d60f470f3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/return-struct-6-nov.c @@ -0,0 +1,40 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct s1 +{ + int i1; + int i2; + int *p; + int i3; + int i4; +} s1; + +int buf[100]; + +struct s1 __attribute__((noinline)) get () +{ + struct s1 s; + s.p = buf; + return s; +} + +int __attribute__((noinline)) rd (struct s1 s, int i) +{ + int res = s.p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = get (); + + rd (s, 0); + rd (s, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/return-struct-6-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/return-struct-6-ubv.c new file mode 100644 index 00000000000..637051238b6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/return-struct-6-ubv.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int i1; + int i2; + int *p; + int i3; + int i4; +} s1; + +int buf[100]; + +struct s1 __attribute__((noinline)) get () +{ + struct s1 s; + s.p = buf; + return s; +} + +int __attribute__((noinline)) rd (struct s1 s, int i) +{ + int res = s.p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = get (); + + rd (s, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/sincos-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/sincos-1-nov.c new file mode 100644 index 00000000000..da5f301a19a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/sincos-1-nov.c @@ -0,0 +1,18 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ +/* { dg-additional-options "-lm" } */ + + +#include "mpx-check.h" +#include "math.h" + +int mpx_test (int argc, const char **argv) +{ + double d1, d2; + d1 = sin(argc); + d2 = cos(argc); + + printf ("%f %f\n", d1, d2); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-array-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/static-array-1-lbv.c new file mode 100644 index 00000000000..cc1cf8ddd83 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-array-1-lbv.c @@ -0,0 +1,16 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + printf("%d\n", buf[-1]); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-array-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/static-array-1-nov.c new file mode 100644 index 00000000000..13d30c55ae5 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-array-1-nov.c @@ -0,0 +1,14 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + printf("%d\n", buf[0]); + printf("%d\n", buf[99]); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-array-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/static-array-1-ubv.c new file mode 100644 index 00000000000..e3cac3cfa5d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-array-1-ubv.c @@ -0,0 +1,16 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + printf("%d\n", buf[100]); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-init-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/static-init-1-lbv.c new file mode 100644 index 00000000000..7c0367e01e7 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-init-1-lbv.c @@ -0,0 +1,18 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; +int *p = buf; + +int mpx_test (int argc, const char *argv[]) +{ + printf ("%d\n", p[-1]); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-init-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/static-init-1-nov.c new file mode 100644 index 00000000000..0c91615239a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-init-1-nov.c @@ -0,0 +1,16 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; +int *p = buf; + +int mpx_test (int argc, const char *argv[]) +{ + printf ("%d\n", p[0]); + printf ("%d\n", p[99]); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-init-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/static-init-1-ubv.c new file mode 100644 index 00000000000..a19d92708d6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-init-1-ubv.c @@ -0,0 +1,18 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; +int *p = buf; + +int mpx_test (int argc, const char *argv[]) +{ + printf ("%d\n", p[100]); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-init-2-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/static-init-2-lbv.c new file mode 100644 index 00000000000..1ad3be8ff63 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-init-2-lbv.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s { + int a; + int *p; +} s; + +int buf[100]; + +struct s s1 = {0, buf}; + +int mpx_test (int argc, const char *argv[]) +{ + printf ("%d\n", s1.p[-1]); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-init-2-nov.c b/gcc/testsuite/gcc.target/i386/mpx/static-init-2-nov.c new file mode 100644 index 00000000000..6ef755f8971 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-init-2-nov.c @@ -0,0 +1,22 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct s { + int a; + int *p; +} s; + +int buf[100]; + +struct s s1 = {0, buf}; + +int mpx_test (int argc, const char *argv[]) +{ + printf ("%d\n", s1.p[0]); + printf ("%d\n", s1.p[99]); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-init-2-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/static-init-2-ubv.c new file mode 100644 index 00000000000..3681ebe03ea --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-init-2-ubv.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s { + int a; + int *p; +} s; + +int buf[100]; + +struct s s1 = {0, buf}; + +int mpx_test (int argc, const char *argv[]) +{ + printf ("%d\n", s1.p[100]); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-init-3-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/static-init-3-lbv.c new file mode 100644 index 00000000000..3aa21ca3619 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-init-3-lbv.c @@ -0,0 +1,25 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; +int *p = buf; + +int foo (int i) +{ + static int **pp = &p; + + return (*pp)[i]; +} + +int mpx_test (int argc, const char *argv[]) +{ + printf ("%d\n", foo (-1)); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-init-3-nov.c b/gcc/testsuite/gcc.target/i386/mpx/static-init-3-nov.c new file mode 100644 index 00000000000..7bdc5af0911 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-init-3-nov.c @@ -0,0 +1,23 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; +int *p = buf; + +int foo (int i) +{ + static int **pp = &p; + + return (*pp)[i]; +} + +int mpx_test (int argc, const char *argv[]) +{ + printf ("%d\n", foo (0)); + printf ("%d\n", foo (99)); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-init-3-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/static-init-3-ubv.c new file mode 100644 index 00000000000..fb8411aa4cb --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-init-3-ubv.c @@ -0,0 +1,25 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; +int *p = buf; + +int foo (int i) +{ + static int **pp = &p; + + return (*pp)[i]; +} + +int mpx_test (int argc, const char *argv[]) +{ + printf ("%d\n", foo (100)); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-init-4-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/static-init-4-lbv.c new file mode 100644 index 00000000000..896838ec0ab --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-init-4-lbv.c @@ -0,0 +1,18 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; +int *p[1] = { buf }; + +int mpx_test (int argc, const char *argv[]) +{ + printf ("%d\n", p[0][-1]); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-init-4-nov.c b/gcc/testsuite/gcc.target/i386/mpx/static-init-4-nov.c new file mode 100644 index 00000000000..3bdb5ec5162 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-init-4-nov.c @@ -0,0 +1,16 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf[100]; +int *p[1] = { buf }; + +int mpx_test (int argc, const char *argv[]) +{ + printf ("%d\n", p[0][0]); + printf ("%d\n", p[0][99]); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-init-4-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/static-init-4-ubv.c new file mode 100644 index 00000000000..47bca2fc07f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-init-4-ubv.c @@ -0,0 +1,18 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf[100]; +int *p[1] = { buf }; + +int mpx_test (int argc, const char *argv[]) +{ + printf ("%d\n", p[0][100]); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-init-5-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/static-init-5-lbv.c new file mode 100644 index 00000000000..bd47a4a73aa --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-init-5-lbv.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf1[100]; +int buf2[200]; + +struct s1 { + int a; + int *p[2]; +} s1; + +struct s2 { + int a; + struct s1 b[2]; +} s2; + +struct s2 s = { 1, { {1, { buf1, buf2 }}, {2, { buf2, buf1} } } }; + +int mpx_test (int argc, const char **argv) +{ + printf ("%d\n", s.b[0].p[0][-1]); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-init-5-nov.c b/gcc/testsuite/gcc.target/i386/mpx/static-init-5-nov.c new file mode 100644 index 00000000000..87fe35d4742 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-init-5-nov.c @@ -0,0 +1,34 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf1[100]; +int buf2[200]; + +struct s1 { + int a; + int *p[2]; +} s1; + +struct s2 { + int a; + struct s1 b[2]; +} s2; + +struct s2 s = { 1, { {1, { buf1, buf2 }}, {2, { buf2, buf1} } } }; + +int mpx_test (int argc, const char **argv) +{ + printf ("%d\n", s.b[0].p[0][0]); + printf ("%d\n", s.b[0].p[0][99]); + printf ("%d\n", s.b[0].p[1][0]); + printf ("%d\n", s.b[0].p[1][199]); + printf ("%d\n", s.b[1].p[0][0]); + printf ("%d\n", s.b[1].p[0][199]); + printf ("%d\n", s.b[1].p[1][0]); + printf ("%d\n", s.b[1].p[1][99]); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-init-5-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/static-init-5-ubv.c new file mode 100644 index 00000000000..7f136253b0e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-init-5-ubv.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf1[100]; +int buf2[200]; + +struct s1 { + int a; + int *p[2]; +} s1; + +struct s2 { + int a; + struct s1 b[2]; +} s2; + +struct s2 s = { 1, { {1, { buf1, buf2 }}, {2, { buf2, buf1} } } }; + +int mpx_test (int argc, const char **argv) +{ + printf ("%d\n", s.b[0].p[0][100]); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-init-6-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/static-init-6-lbv.c new file mode 100644 index 00000000000..9b90cee6a14 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-init-6-lbv.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf1[100]; +int buf2[200]; + +struct s1 { + int a; + int *p[2]; +} s1; + +struct s2 { + int a; + struct s1 b[2]; +} s2; + +int mpx_test (int argc, const char **argv) +{ + struct s2 s = { 1, { {1, { buf1, buf2 }}, {2, { buf2, buf1} } } }; + + printf ("%d\n", s.b[0].p[0][-1]); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-init-6-nov.c b/gcc/testsuite/gcc.target/i386/mpx/static-init-6-nov.c new file mode 100644 index 00000000000..a125024ecc3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-init-6-nov.c @@ -0,0 +1,28 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf1[100]; +int buf2[200]; + +struct s1 { + int a; + int *p[2]; +} s1; + +struct s2 { + int a; + struct s1 b[2]; +} s2; + +int mpx_test (int argc, const char **argv) +{ + struct s2 s = { 1, { {1, { buf1, buf2 }}, {2, { buf2, buf1} } } }; + + printf ("%d\n", s.b[0].p[0][0]); + printf ("%d\n", s.b[0].p[0][99]); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-init-6-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/static-init-6-ubv.c new file mode 100644 index 00000000000..a60c4e0befc --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-init-6-ubv.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf1[100]; +int buf2[200]; + +struct s1 { + int a; + int *p[2]; +} s1; + +struct s2 { + int a; + struct s1 b[2]; +} s2; + +int mpx_test (int argc, const char **argv) +{ + struct s2 s = { 1, { {1, { buf1, buf2 }}, {2, { buf2, buf1} } } }; + + printf ("%d\n", s.b[0].p[0][100]); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-string-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/static-string-1-lbv.c new file mode 100644 index 00000000000..e2443804f74 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-string-1-lbv.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +char *str="dddd"; + +int foo1 (char** ptr) +{ + *ptr=str; +} + +int foo (char *ptr) +{ + char *tmp = 0; + foo1 (&ptr); + tmp = ptr; + return tmp[-1]; +} + +int mpx_test (int argc, const char **argv) +{ + printf ("%d\n", foo ("ddddd")); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-string-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/static-string-1-nov.c new file mode 100644 index 00000000000..d513638688f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-string-1-nov.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +char *str="dddd"; + +int foo1 (char** ptr) +{ + *ptr=str; +} + +int foo (char *ptr) +{ + char *tmp = 0; + foo1 (&ptr); + tmp = ptr; + return tmp[0] + tmp[4]; +} + +int mpx_test (int argc, const char **argv) +{ + printf ("%d\n", foo ("ddddd")); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/static-string-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/static-string-1-ubv.c new file mode 100644 index 00000000000..e0f3634c324 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/static-string-1-ubv.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +char *str="dddd"; + +int foo1 (char** ptr) +{ + *ptr=str; +} + +int foo (char *ptr) +{ + char *tmp = 0; + foo1 (&ptr); + tmp = ptr; + return tmp[5]; +} + +int mpx_test (int argc, const char **argv) +{ + printf ("%d\n", foo ("ddddd")); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-1-lbv.c new file mode 100644 index 00000000000..a9e1890b18e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-1-lbv.c @@ -0,0 +1,36 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int i1; + int i2; +} s1; + +int rd (struct s1 s) +{ + int res = s.p[s.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + s.i1 = 50; + s.i2 = -51; + + rd (s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-1-nov.c new file mode 100644 index 00000000000..b1cfeacafbb --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-1-nov.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int i1; + int i2; +} s1; + +int rd (struct s1 s) +{ + int res = s.p[s.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + s.i1 = 50; + s.i2 = -50; + + rd (s); + + s.i1 = 50; + s.i2 = 49; + + rd (s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-1-ubv.c new file mode 100644 index 00000000000..c4ca68d682a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-1-ubv.c @@ -0,0 +1,36 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int i1; + int i2; +} s1; + +int rd (struct s1 s) +{ + int res = s.p[s.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + s.i1 = 50; + s.i2 = 51; + + rd (s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-10-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-10-lbv.c new file mode 100644 index 00000000000..8375aa1b820 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-10-lbv.c @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int *p; +} s1; + +int rd (int *p1, int *p2, int *p3, int *p4, int *p5, int *p6, struct s1 s, int i) +{ + int res = s.p[i]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + + rd (buf1, buf1, buf1, buf1, buf1, buf1, s, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-10-nov.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-10-nov.c new file mode 100644 index 00000000000..b246448346d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-10-nov.c @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct s1 +{ + int *p; +} s1; + +int rd (int *p1, int *p2, int *p3, int *p4, int *p5, int *p6, struct s1 s, int i) +{ + int res = s.p[i]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + + rd (buf1, buf1, buf1, buf1, buf1, buf1, s, 0); + rd (buf1, buf1, buf1, buf1, buf1, buf1, s, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-10-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-10-ubv.c new file mode 100644 index 00000000000..b3b13f86672 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-10-ubv.c @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int *p; +} s1; + +int rd (int *p1, int *p2, int *p3, int *p4, int *p5, int *p6, struct s1 s, int i) +{ + int res = s.p[i]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + + rd (buf1, buf1, buf1, buf1, buf1, buf1, s, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-2-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-2-lbv.c new file mode 100644 index 00000000000..d796ced340d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-2-lbv.c @@ -0,0 +1,36 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int i1; + int i2; + int *p; +} s1; + +int rd (struct s1 s) +{ + int res = s.p[s.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + s.i1 = 50; + s.i2 = -51; + + rd (s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-2-nov.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-2-nov.c new file mode 100644 index 00000000000..6a1a087b23f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-2-nov.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct s1 +{ + int i1; + int i2; + int *p; +} s1; + +int rd (struct s1 s) +{ + int res = s.p[s.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + s.i1 = 50; + s.i2 = -50; + + rd (s); + + s.i1 = 50; + s.i2 = 49; + + rd (s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-2-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-2-ubv.c new file mode 100644 index 00000000000..b285cbc8320 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-2-ubv.c @@ -0,0 +1,36 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int i1; + int i2; + int *p; +} s1; + +int rd (struct s1 s) +{ + int res = s.p[s.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + s.i1 = 50; + s.i2 = 51; + + rd (s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-3-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-3-lbv.c new file mode 100644 index 00000000000..34d4ab18581 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-3-lbv.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int i1; + int i2; +} s1; + +int rd (int *p1, struct s1 s) +{ + int res = s.p[s.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + s.i1 = 50; + s.i2 = -51; + + rd (buf1, s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-3-nov.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-3-nov.c new file mode 100644 index 00000000000..8e238ef657e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-3-nov.c @@ -0,0 +1,39 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int i1; + int i2; +} s1; + +int rd (int *p1, struct s1 s) +{ + int res = s.p[s.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + s.i1 = 50; + s.i2 = -50; + + rd (buf1, s); + + s.i1 = 50; + s.i2 = 49; + + rd (buf1, s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-3-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-3-ubv.c new file mode 100644 index 00000000000..bd947e5859d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-3-ubv.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int i1; + int i2; +} s1; + +int rd (int *p1, struct s1 s) +{ + int res = s.p[s.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + s.i1 = 50; + s.i2 = 50; + + rd (buf1, s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-4-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-4-lbv.c new file mode 100644 index 00000000000..c0666d389a1 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-4-lbv.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int i1; + int i2; +} s1; + +int rd (int *p1, int *p2, struct s1 s) +{ + int res = s.p[s.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + s.i1 = 50; + s.i2 = -51; + + rd (buf1, buf1, s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-4-nov.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-4-nov.c new file mode 100644 index 00000000000..17366c55ca7 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-4-nov.c @@ -0,0 +1,39 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int i1; + int i2; +} s1; + +int rd (int *p1, int *p2, struct s1 s) +{ + int res = s.p[s.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + s.i1 = 50; + s.i2 = -50; + + rd (buf1, buf1, s); + + s.i1 = 50; + s.i2 = 49; + + rd (buf1, buf1, s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-4-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-4-ubv.c new file mode 100644 index 00000000000..f2f8281dc36 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-4-ubv.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int i1; + int i2; +} s1; + +int rd (int *p1, int *p2, struct s1 s) +{ + int res = s.p[s.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + s.i1 = 50; + s.i2 = 50; + + rd (buf1, buf1, s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-5-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-5-lbv.c new file mode 100644 index 00000000000..357bb6ac746 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-5-lbv.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int i1; + int i2; +} s1; + +int rd (int *p1, int *p2, int *p3, struct s1 s) +{ + int res = s.p[s.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + s.i1 = 50; + s.i2 = -51; + + rd (buf1, buf1, buf1, s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-5-nov.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-5-nov.c new file mode 100644 index 00000000000..a4acd38939e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-5-nov.c @@ -0,0 +1,39 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int i1; + int i2; +} s1; + +int rd (int *p1, int *p2, int *p3, struct s1 s) +{ + int res = s.p[s.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + s.i1 = 50; + s.i2 = -50; + + rd (buf1, buf1, buf1, s); + + s.i1 = 50; + s.i2 = 49; + + rd (buf1, buf1, buf1, s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-5-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-5-ubv.c new file mode 100644 index 00000000000..c94ae1c24aa --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-5-ubv.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int i1; + int i2; +} s1; + +int rd (int *p1, int *p2, int *p3, struct s1 s) +{ + int res = s.p[s.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + s.i1 = 50; + s.i2 = 50; + + rd (buf1, buf1, buf1, s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-6-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-6-lbv.c new file mode 100644 index 00000000000..ceee8d0c69d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-6-lbv.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int i1; + int i2; +} s1; + +int rd (int *p1, int *p2, int *p3, int *p4, struct s1 s) +{ + int res = s.p[s.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + s.i1 = 50; + s.i2 = -51; + + rd (buf1, buf1, buf1, buf1, s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-6-nov.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-6-nov.c new file mode 100644 index 00000000000..913f5a28dc2 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-6-nov.c @@ -0,0 +1,39 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int i1; + int i2; +} s1; + +int rd (int *p1, int *p2, int *p3, int *p4, struct s1 s) +{ + int res = s.p[s.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + s.i1 = 50; + s.i2 = -50; + + rd (buf1, buf1, buf1, buf1, s); + + s.i1 = 50; + s.i2 = 49; + + rd (buf1, buf1, buf1, buf1, s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-6-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-6-ubv.c new file mode 100644 index 00000000000..f92476a7854 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-6-ubv.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int i1; + int i2; +} s1; + +int rd (int *p1, int *p2, int *p3, int *p4, struct s1 s) +{ + int res = s.p[s.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + s.i1 = 50; + s.i2 = 50; + + rd (buf1, buf1, buf1, buf1, s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-7-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-7-lbv.c new file mode 100644 index 00000000000..b0ecc176cd5 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-7-lbv.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int i1; + int i2; +} s1; + +int rd (int *p1, int *p2, int *p3, int *p4, int *p5, struct s1 s) +{ + int res = s.p[s.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + s.i1 = 50; + s.i2 = -51; + + rd (buf1, buf1, buf1, buf1, buf1, s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-7-nov.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-7-nov.c new file mode 100644 index 00000000000..ec63dc7ef47 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-7-nov.c @@ -0,0 +1,39 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int i1; + int i2; +} s1; + +int rd (int *p1, int *p2, int *p3, int *p4, int *p5, struct s1 s) +{ + int res = s.p[s.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + s.i1 = 50; + s.i2 = -50; + + rd (buf1, buf1, buf1, buf1, buf1, s); + + s.i1 = 50; + s.i2 = 49; + + rd (buf1, buf1, buf1, buf1, buf1, s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-7-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-7-ubv.c new file mode 100644 index 00000000000..c9e682252c1 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-7-ubv.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + int *p; + int i1; + int i2; +} s1; + +int rd (int *p1, int *p2, int *p3, int *p4, int *p5, struct s1 s) +{ + int res = s.p[s.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.p = buf; + s.i1 = 50; + s.i2 = 50; + + rd (buf1, buf1, buf1, buf1, buf1, s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-8-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-8-lbv.c new file mode 100644 index 00000000000..58d03e783d8 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-8-lbv.c @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 { + int *p[2]; +} s1; + +int rd (struct s1 s, int i) +{ + int res = s.p[0][i]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[100]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = { {buf, buf1} }; + + rd (s, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-8-nov.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-8-nov.c new file mode 100644 index 00000000000..d9072ec49c9 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-8-nov.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct s1 { + int *p[2]; +} s1; + +int rd (struct s1 s, int i) +{ + int res = s.p[0][i]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[100]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = { {buf, buf1} }; + + rd (s, 0); + rd (s, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-8-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-8-ubv.c new file mode 100644 index 00000000000..fdcfc9ffb39 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-8-ubv.c @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 { + int *p[2]; +} s1; + +int rd (struct s1 s, int i) +{ + int res = s.p[0][i]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[100]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = { {buf, buf1} }; + + rd (s, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-9-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-9-lbv.c new file mode 100644 index 00000000000..acce18334ad --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-9-lbv.c @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 { + int *p[2]; +} s1; + +int rd (struct s1 s, int i) +{ + int res = s.p[1][i]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[100]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = { {buf, buf1} }; + + rd (s, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-9-nov.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-9-nov.c new file mode 100644 index 00000000000..03ce6687f62 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-9-nov.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct s1 { + int *p[2]; +} s1; + +int rd (struct s1 s, int i) +{ + int res = s.p[1][i]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[100]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = { {buf, buf1} }; + + rd (s, 0); + rd (s, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-arg-9-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-9-ubv.c new file mode 100644 index 00000000000..449b2c5dd58 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-arg-9-ubv.c @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 { + int *p[2]; +} s1; + +int rd (struct s1 s, int i) +{ + int res = s.p[1][i]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[100]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s = { {buf, buf1} }; + + rd (s, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-copy-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-copy-1-lbv.c new file mode 100644 index 00000000000..3f1ac74d9a7 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-copy-1-lbv.c @@ -0,0 +1,32 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf1[100]; +int buf2[200]; + +struct s1 { + int a; + int *p[2]; +} s1; + +struct s2 { + int a; + struct s1 b[2]; +} s2; + +struct s2 s = { 1, { {1, { buf1, buf2 }}, {2, { buf2, buf1} } } }; + +int mpx_test (int argc, const char *argv[]) +{ + struct s2 ss = s; + + printf ("%d\n", ss.b[0].p[0][-1]); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-copy-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/struct-copy-1-nov.c new file mode 100644 index 00000000000..5a709bc8546 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-copy-1-nov.c @@ -0,0 +1,36 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +int buf1[100]; +int buf2[200]; + +struct s1 { + int a; + int *p[2]; +} s1; + +struct s2 { + int a; + struct s1 b[2]; +} s2; + +struct s2 s = { 1, { {1, { buf1, buf2 }}, {2, { buf2, buf1} } } }; + +int mpx_test (int argc, const char *argv[]) +{ + struct s2 ss = s; + + printf("%d\n", ss.b[0].p[0][0]); + printf("%d\n", ss.b[0].p[0][99]); + printf("%d\n", ss.b[0].p[1][0]); + printf("%d\n", ss.b[0].p[1][199]); + printf("%d\n", ss.b[1].p[0][0]); + printf("%d\n", ss.b[1].p[0][199]); + printf("%d\n", ss.b[1].p[1][0]); + printf("%d\n", ss.b[1].p[1][99]); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-copy-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-copy-1-ubv.c new file mode 100644 index 00000000000..b0fe8f46143 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-copy-1-ubv.c @@ -0,0 +1,32 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int buf1[100]; +int buf2[200]; + +struct s1 { + int a; + int *p[2]; +} s1; + +struct s2 { + int a; + struct s1 b[2]; +} s2; + +struct s2 s = { 1, { {1, { buf1, buf2 }}, {2, { buf2, buf1} } } }; + +int mpx_test (int argc, const char *argv[]) +{ + struct s2 ss = s; + + printf ("%d\n", ss.b[0].p[0][100]); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-copy-2-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-copy-2-lbv.c new file mode 100644 index 00000000000..0cb6440a1d6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-copy-2-lbv.c @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S { + int a; + int b[100]; + int c; +} S; + +int foo (void *p, int k) +{ + struct S *s = (struct S*)p; + int res = s->b[k]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct S s; + + foo (&s.a, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-copy-2-nov.c b/gcc/testsuite/gcc.target/i386/mpx/struct-copy-2-nov.c new file mode 100644 index 00000000000..01f5b679faf --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-copy-2-nov.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct S { + int a; + int b[100]; + int c; +} S; + +int foo (void *p, int k) +{ + struct S *s = (struct S*)p; + int res = s->b[k]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct S s; + + foo (&s.a, 0); + foo (&s.a, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/struct-copy-2-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/struct-copy-2-ubv.c new file mode 100644 index 00000000000..c500bb4b77b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/struct-copy-2-ubv.c @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S { + int a; + int b[100]; + int c; +} S; + +int foo (void *p, int k) +{ + struct S *s = (struct S*)p; + int res = s->b[k]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct S s; + + foo (&s.a, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/thread-local-var-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/thread-local-var-1-lbv.c new file mode 100644 index 00000000000..3275fe03db8 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/thread-local-var-1-lbv.c @@ -0,0 +1,34 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +/* { dg-additional-options "-lpthread" } */ + +#define SHOULDFAIL + +#include "mpx-check.h" +#include "pthread.h" + +__thread int prebuf[100]; +__thread int buf[100]; +__thread int postbuf[100]; + +int rd (int *p, int i) +{ + int res = p[i]; + printf("%d\n", res); + return res; +} + +void *thred_func (void *ptr) +{ + rd (buf, -1); +} + +int mpx_test (int argc, const char **argv) +{ + pthread_t thread; + pthread_create (&thread, NULL, thred_func, 0); + pthread_join (thread, NULL); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/thread-local-var-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/thread-local-var-1-nov.c new file mode 100644 index 00000000000..2e0483b1c29 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/thread-local-var-1-nov.c @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +/* { dg-additional-options "-lpthread" } */ + + +#include "mpx-check.h" +#include "pthread.h" + +__thread int prebuf[100]; +__thread int buf[100]; +__thread int postbuf[100]; + +int rd (int *p, int i) +{ + int res = p[i]; + printf("%d\n", res); + return res; +} + +void *thred_func (void *ptr) +{ + rd (buf, 0); + rd (buf, 99); +} + +int mpx_test (int argc, const char **argv) +{ + pthread_t thread; + pthread_create (&thread, NULL, thred_func, 0); + pthread_join (thread, NULL); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/thread-local-var-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/thread-local-var-1-ubv.c new file mode 100644 index 00000000000..86116e87e4d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/thread-local-var-1-ubv.c @@ -0,0 +1,34 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +/* { dg-additional-options "-lpthread" } */ + +#define SHOULDFAIL + +#include "mpx-check.h" +#include "pthread.h" + +__thread int prebuf[100]; +__thread int buf[100]; +__thread int postbuf[100]; + +int rd (int *p, int i) +{ + int res = p[i]; + printf("%d\n", res); + return res; +} + +void *thred_func (void *ptr) +{ + rd (buf, 100); +} + +int mpx_test (int argc, const char **argv) +{ + pthread_t thread; + pthread_create (&thread, NULL, thred_func, 0); + pthread_join (thread, NULL); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/union-arg-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/union-arg-1-lbv.c new file mode 100644 index 00000000000..c2559829bfd --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/union-arg-1-lbv.c @@ -0,0 +1,43 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + union { + int i1; + int i3; + } v; + int i2; + union { + int *p; + int p2; + } u; +} s1; + +int rd (struct s1 s) +{ + int res = s.u.p[s.v.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.u.p = buf; + s.v.i1 = 50; + s.i2 = -51; + + rd (s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/union-arg-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/union-arg-1-nov.c new file mode 100644 index 00000000000..f96689f479a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/union-arg-1-nov.c @@ -0,0 +1,45 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct s1 +{ + union { + int i1; + int i3; + } v; + int i2; + union { + int *p; + int p2; + } u; +} s1; + +int rd (struct s1 s) +{ + int res = s.u.p[s.v.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.u.p = buf; + s.v.i1 = 50; + s.i2 = -50; + + rd (s); + + s.v.i1 = 50; + s.i2 = 49; + + rd (s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/union-arg-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/union-arg-1-ubv.c new file mode 100644 index 00000000000..6d65e5a73fe --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/union-arg-1-ubv.c @@ -0,0 +1,43 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct s1 +{ + union { + int i1; + int i3; + } v; + int i2; + union { + int *p; + int p2; + } u; +} s1; + +int rd (struct s1 s) +{ + int res = s.u.p[s.v.i1 + s.i2]; + printf ("%d\n", res); + return res; +} + +int buf[100]; +int buf1[10]; + +int mpx_test (int argc, const char **argv) +{ + struct s1 s; + s.u.p = buf; + s.v.i1 = 50; + s.i2 = 50; + + rd (s); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-1-lbv.c new file mode 100644 index 00000000000..5aa60072df3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-1-lbv.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +/* { dg-additional-options "-Wno-attributes" } */ + +#define SHOULDFAIL + +#include "mpx-check.h" +#include + +int +foo2 (int i1, int *p1, ...) +{ + va_list argp; + int i; + int res; + + va_start(argp, p1); + i = va_arg(argp, int); + + res = p1[i + i1]; + printf("%d\n", res); + + return res; +} + +static __attribute__((always_inline)) int +foo1 (int *p1, ...) +{ + return foo2 (10, p1, __va_arg_pack ()); +} + +int prebuf[100]; +int buf[100]; +int postbuf[100]; + +int mpx_test (int argc, const char **argv) +{ + foo1 (buf, -11); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-1-nov.c new file mode 100644 index 00000000000..55c65d92bd9 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-1-nov.c @@ -0,0 +1,40 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +/* { dg-additional-options "-Wno-attributes" } */ + +#include "mpx-check.h" +#include + +int +foo2 (int i1, int *p1, ...) +{ + va_list argp; + int i; + int res; + + va_start(argp, p1); + i = va_arg(argp, int); + + res = p1[i + i1]; + printf("%d\n", res); + + return res; +} + +static __attribute__((always_inline)) int +foo1 (int *p1, ...) +{ + return foo2 (10, p1, __va_arg_pack ()); +} + +int prebuf[100]; +int buf[100]; +int postbuf[100]; + +int mpx_test (int argc, const char **argv) +{ + foo1 (buf, 89); + foo1 (buf, -9); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-1-ubv.c new file mode 100644 index 00000000000..11b498eba47 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-1-ubv.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +/* { dg-additional-options "-Wno-attributes" } */ + +#define SHOULDFAIL + +#include "mpx-check.h" +#include + +int +foo2 (int i1, int *p1, ...) +{ + va_list argp; + int i; + int res; + + va_start(argp, p1); + i = va_arg(argp, int); + + res = p1[i + i1]; + printf("%d\n", res); + + return res; +} + +static __attribute__((always_inline)) int +foo1 (int *p1, ...) +{ + return foo2 (10, p1, __va_arg_pack ()); +} + +int prebuf[100]; +int buf[100]; +int postbuf[100]; + +int mpx_test (int argc, const char **argv) +{ + foo1 (buf, 90); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-2-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-2-lbv.c new file mode 100644 index 00000000000..9f1941d69f1 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-2-lbv.c @@ -0,0 +1,45 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +/* { dg-additional-options "-Wno-attributes" } */ + +#define SHOULDFAIL + +#include "mpx-check.h" +#include + +int +foo2 (int i1, int *p1, ...) +{ + va_list argp; + int *p; + int i; + int res; + + va_start(argp, p1); + p = va_arg(argp, int *); + i = va_arg(argp, int); + + res = p[i + i1]; + printf("%d\n", res); + + return res; +} + +static __attribute__((always_inline)) int +foo1 (int *p1, ...) +{ + return foo2 (10, p1, __va_arg_pack ()); +} + +int prebuf[100]; +int buf[100]; +int buf1[100]; +int postbuf[100]; + +int mpx_test (int argc, const char **argv) +{ + foo1 (buf, buf1, -11); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-2-nov.c b/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-2-nov.c new file mode 100644 index 00000000000..903afbce292 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-2-nov.c @@ -0,0 +1,43 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +/* { dg-additional-options "-Wno-attributes" } */ + +#include "mpx-check.h" +#include + +int +foo2 (int i1, int *p1, ...) +{ + va_list argp; + int *p; + int i; + int res; + + va_start(argp, p1); + p = va_arg(argp, int *); + i = va_arg(argp, int); + + res = p[i + i1]; + printf("%d\n", res); + + return res; +} + +static __attribute__((always_inline)) int +foo1 (int *p1, ...) +{ + return foo2 (10, p1, __va_arg_pack ()); +} + +int prebuf[100]; +int buf[100]; +int buf1[100]; +int postbuf[100]; + +int mpx_test (int argc, const char **argv) +{ + foo1 (buf, buf1, 89); + foo1 (buf, buf1, -9); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-2-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-2-ubv.c new file mode 100644 index 00000000000..f5d842abf0d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-2-ubv.c @@ -0,0 +1,45 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +/* { dg-additional-options "-Wno-attributes" } */ + +#define SHOULDFAIL + +#include "mpx-check.h" +#include + +int +foo2 (int i1, int *p1, ...) +{ + va_list argp; + int *p; + int i; + int res; + + va_start(argp, p1); + p = va_arg(argp, int *); + i = va_arg(argp, int); + + res = p[i + i1]; + printf("%d\n", res); + + return res; +} + +static __attribute__((always_inline)) int +foo1 (int *p1, ...) +{ + return foo2 (10, p1, __va_arg_pack ()); +} + +int prebuf[100]; +int buf[100]; +int buf1[100]; +int postbuf[100]; + +int mpx_test (int argc, const char **argv) +{ + foo1 (buf, buf1, 90); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-1-lbv.c new file mode 100644 index 00000000000..89faa9281e8 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-1-lbv.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" +#include "stdarg.h" + +int buf[100]; +int buf1[10]; + +int rd (int *pppp, int n, ...) +{ + va_list argp; + int *p; + int i; + int res; + + va_start (argp, n); + for (; n > 0; n--) + va_arg (argp, int *); + p = va_arg (argp, int *); + i = va_arg (argp, int); + + res = p[i]; + printf ("%d\n", res); + + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, 0, buf, -1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-1-nov.c new file mode 100644 index 00000000000..e1e12a6d70b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-1-nov.c @@ -0,0 +1,35 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" +#include "stdarg.h" + +int buf[100]; +int buf1[10]; + +int rd (int *pppp, int n, ...) +{ + va_list argp; + int *p; + int i; + int res; + + va_start (argp, n); + for (; n > 0; n--) + va_arg (argp, int *); + p = va_arg (argp, int *); + i = va_arg (argp, int); + + res = p[i]; + printf ("%d\n", res); + + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, 0, buf, 0); + rd (buf1, 0, buf, 99); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-1-ubv.c new file mode 100644 index 00000000000..14206a0f5a9 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-1-ubv.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" +#include "stdarg.h" + +int buf[100]; +int buf1[10]; + +int rd (int *pppp, int n, ...) +{ + va_list argp; + int *p; + int i; + int res; + + va_start (argp, n); + for (; n > 0; n--) + va_arg (argp, int *); + p = va_arg (argp, int *); + i = va_arg (argp, int); + + res = p[i]; + printf ("%d\n", res); + + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, 0, buf, 100); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-2-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-2-lbv.c new file mode 100644 index 00000000000..8af925f45a3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-2-lbv.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" +#include "stdarg.h" + +int buf[100]; +int buf1[10]; + +int +rd (int *pppp, int n, ...) +{ + va_list argp; + int *p; + int i; + int res; + + va_start (argp, n); + for (; n > 0; n--) + va_arg (argp, int *); + p = va_arg (argp, int *); + i = va_arg (argp, int); + + res = p[i]; + printf ("%d\n", res); + + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, 1, buf1, buf, -1, buf1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-2-nov.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-2-nov.c new file mode 100644 index 00000000000..5c2f422dc3f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-2-nov.c @@ -0,0 +1,36 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" +#include "stdarg.h" + +int buf[100]; +int buf1[10]; + +int +rd (int *pppp, int n, ...) +{ + va_list argp; + int *p; + int i; + int res; + + va_start (argp, n); + for (; n > 0; n--) + va_arg (argp, int *); + p = va_arg (argp, int *); + i = va_arg (argp, int); + + res = p[i]; + printf ("%d\n", res); + + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, 1, buf1, buf, 0, buf1); + rd (buf1, 1, buf1, buf, 99, buf1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-2-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-2-ubv.c new file mode 100644 index 00000000000..b4463712e2b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-2-ubv.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" +#include "stdarg.h" + +int buf[100]; +int buf1[10]; + +int +rd (int *pppp, int n, ...) +{ + va_list argp; + int *p; + int i; + int res; + + va_start (argp, n); + for (; n > 0; n--) + va_arg (argp, int *); + p = va_arg (argp, int *); + i = va_arg (argp, int); + + res = p[i]; + printf ("%d\n", res); + + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, 1, buf1, buf, 100, buf1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-3-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-3-lbv.c new file mode 100644 index 00000000000..b1f9f240622 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-3-lbv.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" +#include "stdarg.h" + +int buf[100]; +int buf1[10]; + +int +rd (int *pppp, int n, ...) +{ + va_list argp; + int *p; + int i; + int res; + + va_start (argp, n); + for (; n > 0; n--) + va_arg (argp, int *); + p = va_arg (argp, int *); + i = va_arg (argp, int); + + res = p[i]; + printf ("%d\n", res); + + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, 2, buf1, buf1, buf, -1, buf1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-3-nov.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-3-nov.c new file mode 100644 index 00000000000..93f9eb810b4 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-3-nov.c @@ -0,0 +1,36 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" +#include "stdarg.h" + +int buf[100]; +int buf1[10]; + +int +rd (int *pppp, int n, ...) +{ + va_list argp; + int *p; + int i; + int res; + + va_start (argp, n); + for (; n > 0; n--) + va_arg (argp, int *); + p = va_arg (argp, int *); + i = va_arg (argp, int); + + res = p[i]; + printf ("%d\n", res); + + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, 2, buf1, buf1, buf, 0, buf1); + rd (buf1, 2, buf1, buf1, buf, 99, buf1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-3-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-3-ubv.c new file mode 100644 index 00000000000..dddf3563599 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-3-ubv.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" +#include "stdarg.h" + +int buf[100]; +int buf1[10]; + +int +rd (int *pppp, int n, ...) +{ + va_list argp; + int *p; + int i; + int res; + + va_start (argp, n); + for (; n > 0; n--) + va_arg (argp, int *); + p = va_arg (argp, int *); + i = va_arg (argp, int); + + res = p[i]; + printf ("%d\n", res); + + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, 2, buf1, buf1, buf, 100, buf1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-4-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-4-lbv.c new file mode 100644 index 00000000000..274ccc2469e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-4-lbv.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" +#include "stdarg.h" + +int buf[100]; +int buf1[10]; + +int +rd (int *pppp, int n, ...) +{ + va_list argp; + int *p; + int i; + int res; + + va_start (argp, n); + for (; n > 0; n--) + va_arg (argp, int *); + p = va_arg (argp, int *); + i = va_arg (argp, int); + + res = p[i]; + printf ("%d\n", res); + + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, 3, buf1, buf1, buf1, buf, -1, buf1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-4-nov.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-4-nov.c new file mode 100644 index 00000000000..5412d113223 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-4-nov.c @@ -0,0 +1,36 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" +#include "stdarg.h" + +int buf[100]; +int buf1[10]; + +int +rd (int *pppp, int n, ...) +{ + va_list argp; + int *p; + int i; + int res; + + va_start (argp, n); + for (; n > 0; n--) + va_arg (argp, int *); + p = va_arg (argp, int *); + i = va_arg (argp, int); + + res = p[i]; + printf ("%d\n", res); + + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, 3, buf1, buf1, buf1, buf, 0, buf1); + rd (buf1, 3, buf1, buf1, buf1, buf, 99, buf1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-4-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-4-ubv.c new file mode 100644 index 00000000000..e8f06e36a3a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-4-ubv.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" +#include "stdarg.h" + +int buf[100]; +int buf1[10]; + +int +rd (int *pppp, int n, ...) +{ + va_list argp; + int *p; + int i; + int res; + + va_start (argp, n); + for (; n > 0; n--) + va_arg (argp, int *); + p = va_arg (argp, int *); + i = va_arg (argp, int); + + res = p[i]; + printf ("%d\n", res); + + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, 3, buf1, buf1, buf1, buf, 100, buf1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-5-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-5-lbv.c new file mode 100644 index 00000000000..1dae013f0ec --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-5-lbv.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" +#include "stdarg.h" + +int buf[100]; +int buf1[10]; + +int +rd (int *pppp, int n, ...) +{ + va_list argp; + int *p; + int i; + int res; + + va_start (argp, n); + for (; n > 0; n--) + va_arg (argp, int *); + p = va_arg (argp, int *); + i = va_arg (argp, int); + + res = p[i]; + printf ("%d\n", res); + + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, 4, buf1, buf1, buf1, buf1, buf, -1, buf1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-5-nov.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-5-nov.c new file mode 100644 index 00000000000..bd15e0fde6f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-5-nov.c @@ -0,0 +1,36 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" +#include "stdarg.h" + +int buf[100]; +int buf1[10]; + +int +rd (int *pppp, int n, ...) +{ + va_list argp; + int *p; + int i; + int res; + + va_start (argp, n); + for (; n > 0; n--) + va_arg (argp, int *); + p = va_arg (argp, int *); + i = va_arg (argp, int); + + res = p[i]; + printf ("%d\n", res); + + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, 4, buf1, buf1, buf1, buf1, buf, 0, buf1); + rd (buf1, 4, buf1, buf1, buf1, buf1, buf, 99, buf1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-5-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-5-ubv.c new file mode 100644 index 00000000000..de3721dfdd5 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-5-ubv.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" +#include "stdarg.h" + +int buf[100]; +int buf1[10]; + +int +rd (int *pppp, int n, ...) +{ + va_list argp; + int *p; + int i; + int res; + + va_start (argp, n); + for (; n > 0; n--) + va_arg (argp, int *); + p = va_arg (argp, int *); + i = va_arg (argp, int); + + res = p[i]; + printf ("%d\n", res); + + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, 4, buf1, buf1, buf1, buf1, buf, 100, buf1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-6-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-6-lbv.c new file mode 100644 index 00000000000..822d32a7b7b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-6-lbv.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" +#include "stdarg.h" + +int buf[100]; +int buf1[10]; + +int rd (int *pp, ...) +{ + va_list argp; + int *p; + int i; + int res; + int n = 4; + + va_start (argp, pp); + for (; n > 0; n--) + va_arg (argp, int *); + p = va_arg (argp, int *); + i = va_arg (argp, int); + + res = p[i]; + printf ("%d\n", res); + + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, buf1, buf1, buf1, buf1, buf, -1, buf1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-6-nov.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-6-nov.c new file mode 100644 index 00000000000..c5c4b125725 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-6-nov.c @@ -0,0 +1,36 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" +#include "stdarg.h" + +int buf[100]; +int buf1[10]; + +int rd (int *pp, ...) +{ + va_list argp; + int *p; + int i; + int res; + int n = 4; + + va_start (argp, pp); + for (; n > 0; n--) + va_arg (argp, int *); + p = va_arg (argp, int *); + i = va_arg (argp, int); + + res = p[i]; + printf ("%d\n", res); + + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, buf1, buf1, buf1, buf1, buf, 0, buf1); + rd (buf1, buf1, buf1, buf1, buf1, buf, 99, buf1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-6-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-6-ubv.c new file mode 100644 index 00000000000..635a48fc16d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-6-ubv.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" +#include "stdarg.h" + +int buf[100]; +int buf1[10]; + +int rd (int *pp, ...) +{ + va_list argp; + int *p; + int i; + int res; + int n = 4; + + va_start (argp, pp); + for (; n > 0; n--) + va_arg (argp, int *); + p = va_arg (argp, int *); + i = va_arg (argp, int); + + res = p[i]; + printf ("%d\n", res); + + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, buf1, buf1, buf1, buf1, buf, 100, buf1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-7-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-7-lbv.c new file mode 100644 index 00000000000..1121577f912 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-7-lbv.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" +#include "stdarg.h" + +int buf[100]; +int buf1[10]; + +int rd (int *pppp, int n, ...) +{ + va_list argp; + int *p; + int i; + int res; + + va_start (argp, n); + for (; n > 0; n--) + va_arg (argp, double); + p = va_arg (argp, int *); + i = va_arg (argp, int); + + res = p[i]; + printf ("%d\n", res); + + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, 2, 10.0d, 10.0d, buf, -1, buf1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-7-nov.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-7-nov.c new file mode 100644 index 00000000000..525a93d9d87 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-7-nov.c @@ -0,0 +1,35 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" +#include "stdarg.h" + +int buf[100]; +int buf1[10]; + +int rd (int *pppp, int n, ...) +{ + va_list argp; + int *p; + int i; + int res; + + va_start (argp, n); + for (; n > 0; n--) + va_arg (argp, double); + p = va_arg (argp, int *); + i = va_arg (argp, int); + + res = p[i]; + printf ("%d\n", res); + + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, 2, 10.0d, 10.0d, buf, 0, buf1); + rd (buf1, 2, 10.0d, 10.0d, buf, 99, buf1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-7-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-7-ubv.c new file mode 100644 index 00000000000..0e8d21e9940 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-7-ubv.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" +#include "stdarg.h" + +int buf[100]; +int buf1[10]; + +int rd (int *pppp, int n, ...) +{ + va_list argp; + int *p; + int i; + int res; + + va_start (argp, n); + for (; n > 0; n--) + va_arg (argp, double); + p = va_arg (argp, int *); + i = va_arg (argp, int); + + res = p[i]; + printf ("%d\n", res); + + return res; +} + +int mpx_test (int argc, const char **argv) +{ + rd (buf1, 2, 10.0d, 10.0d, buf, 100, buf1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-8-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-8-lbv.c new file mode 100644 index 00000000000..bb58ac594b9 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-8-lbv.c @@ -0,0 +1,40 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" +#include + +int buf[100]; +int buf1[10]; + +void vararg (int *p, va_list al) +{ + int i; + int res; + + p = va_arg (al, int *); + i = va_arg (al, int); + + res = p[i]; + printf ("%d\n", res); +} + +void foo (int *p, ...) +{ + va_list args; + + va_start (args, p); + vararg (p, args); + va_end (args); +} + +int mpx_test (int argc, const char **argv) +{ + foo (buf1, buf, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-8-nov.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-8-nov.c new file mode 100644 index 00000000000..59596f27166 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-8-nov.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" +#include + +int buf[100]; +int buf1[10]; + +void vararg (int *p, va_list al) +{ + int i; + int res; + + p = va_arg (al, int *); + i = va_arg (al, int); + + res = p[i]; + printf ("%d\n", res); +} + +void foo (int *p, ...) +{ + va_list args; + + va_start (args, p); + vararg (p, args); + va_end (args); +} + +int mpx_test (int argc, const char **argv) +{ + foo (buf1, buf, 0); + foo (buf1, buf, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vararg-8-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/vararg-8-ubv.c new file mode 100644 index 00000000000..c03bcef08ec --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vararg-8-ubv.c @@ -0,0 +1,40 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" +#include + +int buf[100]; +int buf1[10]; + +void vararg (int *p, va_list al) +{ + int i; + int res; + + p = va_arg (al, int *); + i = va_arg (al, int); + + res = p[i]; + printf ("%d\n", res); +} + +void foo (int *p, ...) +{ + va_list args; + + va_start (args, p); + vararg (p, args); + va_end (args); +} + +int mpx_test (int argc, const char **argv) +{ + foo (buf1, buf, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vla-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/vla-1-lbv.c new file mode 100644 index 00000000000..1994df9d0a1 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vla-1-lbv.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S +{ + int a; + int p[0]; +}; + +int rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct S *s = (struct S *)alloca (sizeof(struct S) + sizeof (int)*100); + rd (s->p, -2); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vla-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/vla-1-nov.c new file mode 100644 index 00000000000..1a828495833 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vla-1-nov.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct S +{ + int a; + int p[0]; +}; + +int rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct S *s = (struct S *)alloca (sizeof(struct S) + sizeof (int)*100); + rd (s->p, 0); + rd (s->p, 99); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vla-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/vla-1-ubv.c new file mode 100644 index 00000000000..b0f6d456e35 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vla-1-ubv.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct S +{ + int a; + int p[0]; +}; + +int rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + struct S *s = (struct S *)alloca (sizeof(struct S) + sizeof (int)*100); + rd (s->p, 100); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vla-2-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/vla-2-lbv.c new file mode 100644 index 00000000000..128f13980af --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vla-2-lbv.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct Foo { + int buf[10] __attribute__((bnd_variable_size)); +}; + +int rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) { + struct Foo *foo = (struct Foo *) alloca (20 * sizeof(int)); + + rd (foo->buf, -1); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vla-2-nov.c b/gcc/testsuite/gcc.target/i386/mpx/vla-2-nov.c new file mode 100644 index 00000000000..2469b7da2b1 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vla-2-nov.c @@ -0,0 +1,25 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include "mpx-check.h" + +struct Foo { + int buf[10] __attribute__((bnd_variable_size)); +}; + +int rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) { + struct Foo *foo = (struct Foo *) alloca (20 * sizeof(int)); + + rd (foo->buf, 0); + rd (foo->buf, 19); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/vla-2-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/vla-2-ubv.c new file mode 100644 index 00000000000..63a6b279215 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/vla-2-ubv.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +struct Foo { + int buf[10] __attribute__((bnd_variable_size)); +}; + +int rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) { + struct Foo *foo = (struct Foo *) alloca (20 * sizeof(int)); + + rd (foo->buf, 20); + + return 0; +} diff --git a/gcc/testsuite/lib/mpx-dg.exp b/gcc/testsuite/lib/mpx-dg.exp index 9dc9e58cd84..e1b5f2fe96d 100644 --- a/gcc/testsuite/lib/mpx-dg.exp +++ b/gcc/testsuite/lib/mpx-dg.exp @@ -23,3 +23,103 @@ proc check_effective_target_mpx {} { int main (void) { return foo ((void *)0) == 0; } } "-fcheck-pointer-bounds -mmpx"] } + +# +# mpx_link_flags -- compute library path and flags to find libmpx. +# + +proc mpx_link_flags { paths } { + global srcdir + global ld_library_path + global shlib_ext + global mpx_saved_library_path + + set gccpath ${paths} + set flags "" + + set shlib_ext [get_shlib_extension] + set mpx_saved_library_path $ld_library_path + + if { $gccpath != "" } { + if { [file exists "${gccpath}/libmpx/mpxrt/.libs/libmpx.a"] + || [file exists "${gccpath}/libmpx/mpxrt/.libs/libmpx.${shlib_ext}"] } { + append flags " -B${gccpath}/libmpx/ " + append flags " -B${gccpath}/libmpx/mpxrt " + append flags " -L${gccpath}/libmpx/mpxrt/.libs " + append ld_library_path ":${gccpath}/libmpx/mpxrt/.libs" + } + } else { + global tool_root_dir + + set libmpx [lookfor_file ${tool_root_dir} libmpx] + if { $libmpx != "" } { + append flags "-L${libmpx} " + append ld_library_path ":${libmpx}" + } + } + + set_ld_library_path_env_vars + + return "$flags" +} + +# +# mpx_init -- called at the start of each subdir of tests +# + +proc mpx_init { args } { + global TEST_ALWAYS_FLAGS + global ALWAYS_CXXFLAGS + global TOOL_OPTIONS + global mpx_saved_TEST_ALWAYS_FLAGS + global mpx_saved_ALWAYS_CXXFLAGS + + setenv CHKP_RT_MODE "stop" + + set link_flags "" + if ![is_remote host] { + if [info exists TOOL_OPTIONS] { + set link_flags "[mpx_link_flags [get_multilibs ${TOOL_OPTIONS}]]" + } else { + set link_flags "[mpx_link_flags [get_multilibs]]" + } + } + + if [info exists TEST_ALWAYS_FLAGS] { + set mpx_saved_TEST_ALWAYS_FLAGS $TEST_ALWAYS_FLAGS + } + if [info exists ALWAYS_CXXFLAGS] { + set mpx_saved_ALWAYS_CXXFLAGS $ALWAYS_CXXFLAGS + set ALWAYS_CXXFLAGS [concat "{ldflags=$link_flags}" $ALWAYS_CXXFLAGS] + } else { + if [info exists TEST_ALWAYS_FLAGS] { + set TEST_ALWAYS_FLAGS "$link_flags $TEST_ALWAYS_FLAGS" + } else { + set TEST_ALWAYS_FLAGS "$link_flags" + } + } +} + +# +# mpx_finish -- called at the end of each subdir of tests +# + +proc mpx_finish { args } { + global TEST_ALWAYS_FLAGS + global mpx_saved_TEST_ALWAYS_FLAGS + global mpx_saved_ALWAYS_CXXFLAGS + global mpx_saved_library_path + global ld_library_path + + if [info exists mpx_saved_ALWAYS_CXXFLAGS ] { + set ALWAYS_CXXFLAGS $mpx_saved_ALWAYS_CXXFLAGS + } else { + if [info exists mpx_saved_TEST_ALWAYS_FLAGS] { + set TEST_ALWAYS_FLAGS $mpx_saved_TEST_ALWAYS_FLAGS + } else { + unset TEST_ALWAYS_FLAGS + } + } + set ld_library_path $mpx_saved_library_path + set_ld_library_path_env_vars +} -- 2.30.2