aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/Wcast-align.c
diff options
context:
space:
mode:
authorDimitar Dimitrov <dimitar@dinux.eu>2022-04-03 22:27:12 +0300
committerDimitar Dimitrov <dimitar@dinux.eu>2022-06-28 18:45:40 +0300
commit5745301983191f5a6fea9d05e36643e339dd2b52 (patch)
treef4e4bbdd88faf2dd2223d4f4d86e9982731cc530 /gcc/testsuite/c-c++-common/Wcast-align.c
parent243b5396106c4b1eb813fd06c2bc6f0a3009bae8 (diff)
downloadgcc-5745301983191f5a6fea9d05e36643e339dd2b52.zip
gcc-5745301983191f5a6fea9d05e36643e339dd2b52.tar.gz
gcc-5745301983191f5a6fea9d05e36643e339dd2b52.tar.bz2
testsuite: Add new target check for no_alignment_constraints
A few testcases were marked for avr target, which has no alignment requirements. But those tests in fact should filter for any target having __BIGGEST_ALIGNMENT__=1. A new effective target check is introduced: no_alignment_constraints. It checks whether __BIGGEST_ALIGNMENT__ is declared as 1. This change fixes the testsuite cases for PRU target. It was regression-tested on x86_64-pc-linux-gnu. The following two existing macros were considered, but they check for subtly different target behaviour: 1. non_strict_align If true, non-aligned access is permitted. But it also allows variables to be naturally aligned, which is not true for no_alignment_constraints. 2. default_packed Whether structures are packed by default is not necessarily the same as lacking constraints for non-aggregate types. For example, BIGGEST_FIELD_ALIGNMENT or ADJUST_FIELD_ALIGN could be defined for a target as something other than BIGGEST_ALIGNMENT. gcc/ChangeLog: * doc/sourcebuild.texi: Document new no_alignment_constraints effective target check. gcc/testsuite/ChangeLog: * c-c++-common/Wcast-align.c: Silence warnings for targets with no_alignment_constraints. * gcc.dg/c11-align-4.c: Skip for no_alignment_constraints. * gcc.dg/strlenopt-10.c: Replace checks for avr with checks for any target with no_alignment_constraints. * gcc.dg/strlenopt-11.c: Ditto. * gcc.dg/strlenopt-13.c: Ditto. * lib/target-supports.exp (check_effective_target_no_alignment_constraints): New. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
Diffstat (limited to 'gcc/testsuite/c-c++-common/Wcast-align.c')
-rw-r--r--gcc/testsuite/c-c++-common/Wcast-align.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/testsuite/c-c++-common/Wcast-align.c b/gcc/testsuite/c-c++-common/Wcast-align.c
index c296c7f..1087b10 100644
--- a/gcc/testsuite/c-c++-common/Wcast-align.c
+++ b/gcc/testsuite/c-c++-common/Wcast-align.c
@@ -16,8 +16,8 @@ struct t { double x; } *q;
void
foo (void)
{
- y = (c *) x; /* { dg-warning "7:cast \[^\n\r]* required alignment of target type" } */
- z = (d *) x; /* { dg-warning "7:cast \[^\n\r]* required alignment of target type" } */
+ y = (c *) x; /* { dg-warning "7:cast \[^\n\r]* required alignment of target type" "" { target { ! no_alignment_constraints } } } */
+ z = (d *) x; /* { dg-warning "7:cast \[^\n\r]* required alignment of target type" "" { target { ! no_alignment_constraints } } } */
(long long *) p; /* { dg-bogus "alignment" } */
(double *) q; /* { dg-bogus "alignment" } */
}