This fixes a few aarch64 specific testcases after the move to default to GNU C23. For the SME testcases, I decided to add a new one for the GNU C23 case as `()` changing to mean `(void)` instead of a non-prototype declaration and add `-std=gnu17` to the old one. For pic-*.c `-Wno-old-style-definition` was added not to warn about old style definitions. For pr113573.c, I added `-std=gnu17` since I was not sure if `(...)` with C23 would invoke the same issue.
tested for aarch64-linux-gnu. PR testsuite/117680 gcc/testsuite/ChangeLog: * gcc.target/aarch64/pic-constantpool1.c: Add -Wno-old-style-definition. * gcc.target/aarch64/pic-symrefplus.c: Likewise. * gcc.target/aarch64/pr113573.c: Add `-std=gnu17` * gcc.target/aarch64/sme/streaming_mode_1.c: Likewise. * gcc.target/aarch64/sme/za_state_1.c: Likewise. * gcc.target/aarch64/sme/za_state_2.c: Likewise. * gcc.target/aarch64/sme/streaming_mode_5.c: New test. * gcc.target/aarch64/sme/za_state_7.c: New test. * gcc.target/aarch64/sme/za_state_8.c: New test. Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com> --- .../gcc.target/aarch64/pic-constantpool1.c | 2 +- .../gcc.target/aarch64/pic-symrefplus.c | 2 +- gcc/testsuite/gcc.target/aarch64/pr113573.c | 2 +- .../gcc.target/aarch64/sme/streaming_mode_1.c | 2 +- .../gcc.target/aarch64/sme/streaming_mode_5.c | 133 +++++++++++++++ .../gcc.target/aarch64/sme/za_state_1.c | 2 +- .../gcc.target/aarch64/sme/za_state_2.c | 2 +- .../gcc.target/aarch64/sme/za_state_7.c | 160 ++++++++++++++++++ .../gcc.target/aarch64/sme/za_state_8.c | 77 +++++++++ 9 files changed, 376 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/sme/streaming_mode_5.c create mode 100644 gcc/testsuite/gcc.target/aarch64/sme/za_state_7.c create mode 100644 gcc/testsuite/gcc.target/aarch64/sme/za_state_8.c diff --git a/gcc/testsuite/gcc.target/aarch64/pic-constantpool1.c b/gcc/testsuite/gcc.target/aarch64/pic-constantpool1.c index 755c0b67ea4..1a5da9aacfa 100644 --- a/gcc/testsuite/gcc.target/aarch64/pic-constantpool1.c +++ b/gcc/testsuite/gcc.target/aarch64/pic-constantpool1.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -mcmodel=small -fPIC" } */ +/* { dg-options "-Wno-old-style-definition -O2 -mcmodel=small -fPIC" } */ /* { dg-do compile } */ /* { dg-require-effective-target fpic } */ diff --git a/gcc/testsuite/gcc.target/aarch64/pic-symrefplus.c b/gcc/testsuite/gcc.target/aarch64/pic-symrefplus.c index 0c5e7fe7fb4..ca019ce3b33 100644 --- a/gcc/testsuite/gcc.target/aarch64/pic-symrefplus.c +++ b/gcc/testsuite/gcc.target/aarch64/pic-symrefplus.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -mcmodel=small -fPIC -fno-builtin" } */ +/* { dg-options "-Wno-old-style-definition -O2 -mcmodel=small -fPIC -fno-builtin" } */ /* { dg-do compile } */ /* { dg-require-effective-target fpic } */ diff --git a/gcc/testsuite/gcc.target/aarch64/pr113573.c b/gcc/testsuite/gcc.target/aarch64/pr113573.c index fc8607f7218..30175c4cb5c 100644 --- a/gcc/testsuite/gcc.target/aarch64/pr113573.c +++ b/gcc/testsuite/gcc.target/aarch64/pr113573.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2" } */ +/* { dg-options "-O2 -std=gnu17" } */ #pragma GCC aarch64 "arm_neon.h" typedef __Uint8x8_t uint8x8_t; diff --git a/gcc/testsuite/gcc.target/aarch64/sme/streaming_mode_1.c b/gcc/testsuite/gcc.target/aarch64/sme/streaming_mode_1.c index 8874b05b882..40a79c5e600 100644 --- a/gcc/testsuite/gcc.target/aarch64/sme/streaming_mode_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sme/streaming_mode_1.c @@ -1,4 +1,4 @@ -// { dg-options "" } +// { dg-options "-std=gnu17" } void sc_a () [[arm::streaming_compatible]]; void sc_a (); // { dg-error "conflicting types" } diff --git a/gcc/testsuite/gcc.target/aarch64/sme/streaming_mode_5.c b/gcc/testsuite/gcc.target/aarch64/sme/streaming_mode_5.c new file mode 100644 index 00000000000..dbc332b7d2f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sme/streaming_mode_5.c @@ -0,0 +1,133 @@ +// { dg-options "" } + +// This is the GNU C23+ version oftreaming_mode_1.c +// () means (void) rather than not a prototype declaration + +void sc_a () [[arm::streaming_compatible]]; +void sc_a (); // { dg-error "conflicting types" } + +void sc_b (); +void sc_b () [[arm::streaming_compatible]]; // { dg-error "conflicting types" } + +void sc_c () [[arm::streaming_compatible]]; +void sc_c () {} // { dg-error "conflicting types" } + +void sc_d (); +void sc_d () [[arm::streaming_compatible]] {} // { dg-error "conflicting types" } + +void sc_e () [[arm::streaming_compatible]] {} +void sc_e (); // { dg-error "conflicting types" } + +void sc_f () {} +void sc_f () [[arm::streaming_compatible]]; // { dg-error "conflicting types" } + +extern void (*sc_g) (); +extern void (*sc_g) () [[arm::streaming_compatible]]; // { dg-error "conflicting types" } + +extern void (*sc_h) () [[arm::streaming_compatible]]; +extern void (*sc_h) (); // { dg-error "conflicting types" } + +//---------------------------------------------------------------------------- + +void s_a () [[arm::streaming]]; +void s_a (); // { dg-error "conflicting types" } + +void s_b (); +void s_b () [[arm::streaming]]; // { dg-error "conflicting types" } + +void s_c () [[arm::streaming]]; +void s_c () {} // { dg-error "conflicting types" } + +void s_d (); +void s_d () [[arm::streaming]] {} // { dg-error "conflicting types" } + +void s_e () [[arm::streaming]] {} +void s_e (); // { dg-error "conflicting types" } + +void s_f () {} +void s_f () [[arm::streaming]]; // { dg-error "conflicting types" } + +extern void (*s_g) (); +extern void (*s_g) () [[arm::streaming]]; // { dg-error "conflicting types" } + +extern void (*s_h) () [[arm::streaming]]; +extern void (*s_h) (); // { dg-error "conflicting types" } + +//---------------------------------------------------------------------------- + +void mixed_a () [[arm::streaming]]; +void mixed_a () [[arm::streaming_compatible]]; // { dg-error "conflicting types" } + +void mixed_b () [[arm::streaming_compatible]]; +void mixed_b () [[arm::streaming]]; // { dg-error "conflicting types" } + +void mixed_c () [[arm::streaming]]; +void mixed_c () [[arm::streaming_compatible]] {} // { dg-error "conflicting types" } + +void mixed_d () [[arm::streaming_compatible]]; +void mixed_d () [[arm::streaming]] {} // { dg-error "conflicting types" } + +void mixed_e () [[arm::streaming]] {} +void mixed_e () [[arm::streaming_compatible]]; // { dg-error "conflicting types" } + +void mixed_f () [[arm::streaming_compatible]] {} +void mixed_f () [[arm::streaming]]; // { dg-error "conflicting types" } + +extern void (*mixed_g) () [[arm::streaming_compatible]]; +extern void (*mixed_g) () [[arm::streaming]]; // { dg-error "conflicting types" } + +extern void (*mixed_h) () [[arm::streaming]]; +extern void (*mixed_h) () [[arm::streaming_compatible]]; // { dg-error "conflicting types" } + +//---------------------------------------------------------------------------- + +void contradiction_1 () [[arm::streaming, arm::streaming_compatible]]; // { dg-warning "conflicts with attribute" } +void contradiction_2 () [[arm::streaming_compatible, arm::streaming]]; // { dg-warning "conflicts with attribute" } + +int [[arm::streaming_compatible]] int_attr; // { dg-warning "only applies to function types" } +void [[arm::streaming_compatible]] ret_attr (); // { dg-warning "only applies to function types" } +void *[[arm::streaming]] ptr_attr; // { dg-warning "only applies to function types" } + +typedef void s_callback () [[arm::streaming]]; +typedef void sc_callback () [[arm::streaming_compatible]]; + +typedef void contradiction_callback_1 () [[arm::streaming, arm::streaming_compatible]]; // { dg-warning "conflicts with attribute" } +typedef void contradiction_callback_2 () [[arm::streaming_compatible, arm::streaming]]; // { dg-warning "conflicts with attribute" } + +void (*contradiction_callback_ptr_1) () [[arm::streaming, arm::streaming_compatible]]; // { dg-warning "conflicts with attribute" } +void (*contradiction_callback_ptr_2) () [[arm::streaming_compatible, arm::streaming]]; // { dg-warning "conflicts with attribute" } + +struct s { + void (*contradiction_callback_ptr_1) () [[arm::streaming, arm::streaming_compatible]]; // { dg-warning "conflicts with attribute" } + void (*contradiction_callback_ptr_2) () [[arm::streaming_compatible, arm::streaming]]; // { dg-warning "conflicts with attribute" } +}; + +//---------------------------------------------------------------------------- + +void keyword_ok_1 () __arm_streaming; +void keyword_ok_1 () __arm_streaming; + +void keyword_ok_2 () __arm_streaming; +void keyword_ok_2 () [[arm::streaming]]; + +void keyword_ok_3 () [[arm::streaming]]; +void keyword_ok_3 () __arm_streaming; + +void keyword_ok_4 () __arm_streaming [[arm::streaming]]; + +void keyword_ok_5 () __arm_streaming_compatible; +void keyword_ok_5 () [[arm::streaming_compatible]]; + +//---------------------------------------------------------------------------- + +void keyword_contradiction_1 () __arm_streaming; +void keyword_contradiction_1 (); // { dg-error "conflicting types" } + +void keyword_contradiction_2 (); +void keyword_contradiction_2 () __arm_streaming; // { dg-error "conflicting types" } + +void keyword_contradiction_3 () __arm_streaming; +void keyword_contradiction_3 () [[arm::streaming_compatible]]; // { dg-error "conflicting types" } + +void keyword_contradiction_4 () [[arm::streaming_compatible]]; +void keyword_contradiction_4 () __arm_streaming; // { dg-error "conflicting types" } diff --git a/gcc/testsuite/gcc.target/aarch64/sme/za_state_1.c b/gcc/testsuite/gcc.target/aarch64/sme/za_state_1.c index 856880e2109..9bdd4aad17e 100644 --- a/gcc/testsuite/gcc.target/aarch64/sme/za_state_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sme/za_state_1.c @@ -1,4 +1,4 @@ -// { dg-options "" } +// { dg-options "-std=gnu17" } void shared_a () [[arm::inout("za")]]; void shared_a (); // { dg-error "conflicting types" } diff --git a/gcc/testsuite/gcc.target/aarch64/sme/za_state_2.c b/gcc/testsuite/gcc.target/aarch64/sme/za_state_2.c index 572ff309f8d..89dd3043a38 100644 --- a/gcc/testsuite/gcc.target/aarch64/sme/za_state_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sme/za_state_2.c @@ -1,4 +1,4 @@ -// { dg-options "" } +// { dg-options "-std=gnu17" } [[arm::new("za")]] void new_za_a (); void new_za_a (); diff --git a/gcc/testsuite/gcc.target/aarch64/sme/za_state_7.c b/gcc/testsuite/gcc.target/aarch64/sme/za_state_7.c new file mode 100644 index 00000000000..a3e3db761d3 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sme/za_state_7.c @@ -0,0 +1,160 @@ +// { dg-options "" } + +// This is the GNU C23+ version of za_state_1.c +// `()` means `(void)` instead of previously it was not a non-prototype declaration.za_state_1.c +// `()` means `(void)` instead of previously it was not a non-prototype declaration.za_state_1.c +// `()` means `(void)` instead of previously it was not a non-prototype declaration.za_state_1.c +// `()` means `(void)` instead of previously it was not a non-prototype declaration. + +void shared_a () [[arm::inout("za")]]; +void shared_a (); // { dg-error "conflicting types" } + +void shared_b (); +void shared_b () [[arm::inout("za")]]; // { dg-error "conflicting types" } + +void shared_c () [[arm::inout("za")]]; +void shared_c () {} // { dg-error "conflicting types" } + +void shared_d (); +void shared_d () [[arm::inout("za")]] {} // { dg-error "conflicting types" } + +void shared_e () [[arm::inout("za")]] {} +void shared_e (); // { dg-error "conflicting types" } + +void shared_f () {} +void shared_f () [[arm::inout("za")]]; // { dg-error "conflicting types" } + +extern void (*shared_g) (); +extern void (*shared_g) () [[arm::inout("za")]]; // { dg-error "conflicting types" } + +extern void (*shared_h) () [[arm::inout("za")]]; +extern void (*shared_h) (); // { dg-error "conflicting types" } + +//---------------------------------------------------------------------------- + +void preserved_a () [[arm::preserves("za")]]; +void preserved_a (); // { dg-error "conflicting types" } + +void preserved_b (); +void preserved_b () [[arm::preserves("za")]]; // { dg-error "conflicting types" } + +void preserved_c () [[arm::preserves("za")]]; +void preserved_c () {} // { dg-error "conflicting types" } + +void preserved_d (); +void preserved_d () [[arm::preserves("za")]] {} // { dg-error "conflicting types" } + +void preserved_e () [[arm::preserves("za")]] {} +void preserved_e (); // { dg-error "conflicting types" } + +void preserved_f () {} +void preserved_f () [[arm::preserves("za")]]; // { dg-error "conflicting types" } + +extern void (*preserved_g) (); +extern void (*preserved_g) () [[arm::preserves("za")]]; // { dg-error "conflicting types" } + +extern void (*preserved_h) () [[arm::preserves("za")]]; +extern void (*preserved_h) (); // { dg-error "conflicting types" } + +//---------------------------------------------------------------------------- + +void replicated_1 () [[arm::in("za", "za"), arm::in("za")]]; +void replicated_2 () [[arm::out("za", "za"), arm::out("za")]]; +void replicated_3 () [[arm::inout("za", "za"), arm::inout("za")]]; +void replicated_4 () [[arm::preserves("za", "za"), arm::preserves("za")]]; + +//---------------------------------------------------------------------------- + +void invalid_1 () [[arm::in]]; // { dg-error "wrong number of arguments" } +void invalid_2 () [[arm::in()]]; // { dg-error "parentheses must be omitted" } + // { dg-error "wrong number of arguments" "" { target *-*-* } .-1 } +void invalid_3 () [[arm::in("")]]; // { dg-error "unrecognized state string ''" } +void invalid_4 () [[arm::in("foo")]]; // { dg-error "unrecognized state string 'foo'" } +void invalid_5 () [[arm::in(42)]]; // { dg-error "the arguments to 'in' must be constant strings" } +void invalid_6 () [[arm::in(*(int *)0 ? "za" : "za")]]; // { dg-error "the arguments to 'in' must be constant strings" } + +//---------------------------------------------------------------------------- + +void mixed_a () [[arm::preserves("za")]]; +void mixed_a () [[arm::inout("za")]]; // { dg-error "conflicting types" } + +void mixed_b () [[arm::inout("za")]]; +void mixed_b () [[arm::preserves("za")]]; // { dg-error "conflicting types" } + +void mixed_c () [[arm::preserves("za")]]; +void mixed_c () [[arm::in("za")]] {} // { dg-error "conflicting types" } + +void mixed_d () [[arm::inout("za")]]; +void mixed_d () [[arm::in("za")]] {} // { dg-error "conflicting types" } + +void mixed_e () [[arm::out("za")]] {} +void mixed_e () [[arm::in("za")]]; // { dg-error "conflicting types" } + +void mixed_f () [[arm::inout("za")]] {} +void mixed_f () [[arm::out("za")]]; // { dg-error "conflicting types" } + +extern void (*mixed_g) () [[arm::in("za")]]; +extern void (*mixed_g) () [[arm::preserves("za")]]; // { dg-error "conflicting types" } + +extern void (*mixed_h) () [[arm::preserves("za")]]; +extern void (*mixed_h) () [[arm::out("za")]]; // { dg-error "conflicting types" } + +//---------------------------------------------------------------------------- + +void contradiction_1 () [[arm::preserves("za"), arm::inout("za")]]; // { dg-error "inconsistent attributes for state 'za'" } +void contradiction_2 () [[arm::inout("za"), arm::preserves("za")]]; // { dg-error "inconsistent attributes for state 'za'" } + +int [[arm::inout("za")]] int_attr; // { dg-warning "only applies to function types" } +void *[[arm::preserves("za")]] ptr_attr; // { dg-warning "only applies to function types" } + +typedef void preserved_callback () [[arm::preserves("za")]]; +typedef void shared_callback () [[arm::inout("za")]]; + +void (*preserved_callback_ptr) () [[arm::preserves("za")]]; +void (*shared_callback_ptr) () [[arm::inout("za")]]; + +typedef void contradiction_callback_1 () [[arm::preserves("za"), arm::inout("za")]]; // { dg-error "inconsistent attributes for state 'za'" } +typedef void contradiction_callback_2 () [[arm::inout("za"), arm::preserves("za")]]; // { dg-error "inconsistent attributes for state 'za'" } + +void (*contradiction_callback_ptr_1) () [[arm::preserves("za"), arm::inout("za")]]; // { dg-error "inconsistent attributes for state 'za'" } +void (*contradiction_callback_ptr_2) () [[arm::inout("za"), arm::preserves("za")]]; // { dg-error "inconsistent attributes for state 'za'" } + +struct s { + void (*contradiction_callback_ptr_1) () [[arm::preserves("za"), arm::inout("za")]]; // { dg-error "inconsistent attributes for state 'za'" } + void (*contradiction_callback_ptr_2) () [[arm::inout("za"), arm::preserves("za")]]; // { dg-error "inconsistent attributes for state 'za'" } +}; + +//---------------------------------------------------------------------------- + +void keyword_ok_1 () __arm_inout("za"); +void keyword_ok_1 () __arm_inout("za"); + +void keyword_ok_2 () __arm_in("za"); +void keyword_ok_2 () [[arm::in("za")]]; + +void keyword_ok_3 () [[arm::out("za")]]; +void keyword_ok_3 () __arm_out("za"); + +void keyword_ok_4 () __arm_inout("za") [[arm::inout("za")]]; + +void keyword_ok_5 () __arm_preserves("za"); +void keyword_ok_5 () [[arm::preserves("za")]]; + +__arm_new("za") void keyword_ok_6 () {} + +//---------------------------------------------------------------------------- + +void keyword_conflict_1 () __arm_inout("za"); +void keyword_conflict_1 (); // { dg-error "conflicting types" } + +void keyword_conflict_2 (); +void keyword_conflict_2 () __arm_inout("za"); // { dg-error "conflicting types" } + +void keyword_conflict_3 () __arm_inout("za"); +void keyword_conflict_3 () [[arm::preserves("za")]]; // { dg-error "conflicting types" } + +void keyword_conflict_4 () [[arm::preserves("za")]]; +void keyword_conflict_4 () __arm_inout("za"); // { dg-error "conflicting types" } + +__arm_new("za") void keyword_conflict_5 () __arm_inout("za") {} // { dg-error "cannot create a new 'za' scope since 'za' is shared with callers" } +__arm_new("za") void keyword_conflict_6 () __arm_preserves("za") {} // { dg-error "cannot create a new 'za' scope since 'za' is shared with callers" } diff --git a/gcc/testsuite/gcc.target/aarch64/sme/za_state_8.c b/gcc/testsuite/gcc.target/aarch64/sme/za_state_8.c new file mode 100644 index 00000000000..b33439bd77e --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sme/za_state_8.c @@ -0,0 +1,77 @@ +// { dg-options "" } + +// This is the GNU23 version of za_state_2.c +// `()` means `(void)` now instead of a non-prototype declaration. + + +[[arm::new("za")]] void new_za_a (); +void new_za_a (); + +void new_za_b (); +[[arm::new("za")]] void new_za_b (); + +[[arm::new("za")]] void new_za_c (); +void new_za_c () {} + +void new_za_d (); +[[arm::new("za")]] void new_za_d () {} + +[[arm::new("za")]] void new_za_e () {} +void new_za_e (); + +void new_za_f () {} +[[arm::new("za")]] void new_za_f (); // { dg-error "cannot apply attribute 'new' to 'new_za_f' after the function has been defined" } + +//---------------------------------------------------------------------------- + +[[arm::new("za")]] void shared_a (); +void shared_a () [[arm::inout("za")]]; // { dg-error "conflicting types" } + +void shared_b () [[arm::inout("za")]]; +[[arm::new("za")]] void shared_b (); // { dg-error "conflicting types" } + +[[arm::new("za")]] void shared_c (); +void shared_c () [[arm::in("za")]] {} // { dg-error "conflicting types" } + +void shared_d () [[arm::in("za")]]; +[[arm::new("za")]] void shared_d () {} // { dg-error "conflicting types" } + +[[arm::new("za")]] void shared_e () {} +void shared_e () [[arm::out("za")]]; // { dg-error "conflicting types" } + +void shared_f () [[arm::out("za")]] {} +[[arm::new("za")]] void shared_f (); // { dg-error "conflicting types" } + +[[arm::new("za")]] void shared_g () {} +void shared_g () [[arm::preserves("za")]]; // { dg-error "conflicting types" } + +void shared_h () [[arm::preserves("za")]] {} +[[arm::new("za")]] void shared_h (); // { dg-error "conflicting types" } + +//---------------------------------------------------------------------------- + +[[arm::new("za")]] void contradiction_1 () [[arm::inout("za")]]; // { dg-error "cannot create a new 'za' scope since 'za' is shared with callers" } +void contradiction_2 [[arm::new("za")]] () [[arm::inout("za")]]; // { dg-error "cannot create a new 'za' scope since 'za' is shared with callers" } +[[arm::new("za")]] void contradiction_3 () [[arm::preserves("za")]]; // { dg-error "cannot create a new 'za' scope since 'za' is shared with callers" } +void contradiction_4 [[arm::new("za")]] () [[arm::preserves("za")]]; // { dg-error "cannot create a new 'za' scope since 'za' is shared with callers" } + +int [[arm::new("za")]] int_attr; // { dg-warning "does not apply to types" } +[[arm::new("za")]] int int_var_attr; // { dg-error "applies only to function definitions" } +typedef void new_za_callback () [[arm::new("za")]]; // { dg-warning "does not apply to types" } +[[arm::new("za")]] void (*new_za_var_callback) (); // { dg-error "applies only to function definitions" } + +//---------------------------------------------------------------------------- + +[[arm::new("za")]] void complementary_1 () [[arm::streaming]] {} +void complementary_2 [[arm::new("za")]] () [[arm::streaming]] {} +[[arm::new("za")]] void complementary_3 () [[arm::streaming_compatible]] {} +void complementary_4 [[arm::new("za")]] () [[arm::streaming_compatible]] {} + +//---------------------------------------------------------------------------- + +#pragma GCC target "+nosme" + +[[arm::new("za")]] void bereft_1 (); +[[arm::new("za")]] void bereft_2 () {} // { dg-error "functions with SME state require the ISA extension 'sme'" } +void bereft_3 () [[arm::inout("za")]]; +void bereft_4 () [[arm::inout("za")]] {} // { dg-error "functions with SME state require the ISA extension 'sme'" } -- 2.43.0