testsuite: Handle "packed" targets in c-c++-common/auto-init-7.c and -8.c

Looks like there's a failed assumption that
sizeof (union U { char u1[5]; int u2; float u3; }) == 8.
However, for "packed" targets like cris-elf, it's 5.

These two tests have always failed for cris-elf.  I see from
https://gcc.gnu.org/pipermail/gcc-testresults/2023-February/777912.html
that they fail on pru-elf too, but I don't know if the cause
(and/or remedy) is the same.

IMHO this is preferred over the alternative; splitting up
that last line into two lines, like:
/* { dg-final { scan-tree-dump "temp4 = \
 .DEFERRED_INIT \\(8, 2, \&\"temp4\"" "gimple" { target { ! default_packed } } } } */
/* { dg-final { scan-tree-dump "temp4 = \
 .DEFERRED_INIT \\(5, 2, \&\"temp4\"" "gimple" { target default_packed } } } */

gcc/testsuite:
	* c-c++-common/auto-init-7.c, c-c++-common/auto-init-8.c: Also
	match targets where sizeof (union U) == 5, like "packed" targets.
This commit is contained in:
Hans-Peter Nilsson 2023-02-15 20:11:58 +01:00 committed by Hans-Peter Nilsson
parent c88a7c6348
commit 854a268dcc
2 changed files with 2 additions and 2 deletions

View File

@ -32,4 +32,4 @@ double foo()
/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(12, 2, \&\"temp1\"" "gimple" } } */
/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(24, 2, \&\"temp2\"" "gimple" } } */
/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(28, 2, \&\"temp3\"" "gimple" } } */
/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(8, 2, \&\"temp4\"" "gimple" } } */
/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\((8|5), 2, \&\"temp4\"" "gimple" } } */

View File

@ -32,4 +32,4 @@ double foo()
/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(12, 1, \&\"temp1\"" "gimple" } } */
/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(24, 1, \&\"temp2\"" "gimple" } } */
/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(28, 1, \&\"temp3\"" "gimple" } } */
/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(8, 1, \&\"temp4\"" "gimple" } } */
/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\((8|5), 1, \&\"temp4\"" "gimple" } } */