From: Qing Zhao <qing.zhao@oracle.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Richard Biener <rguenther@suse.de>,
Richard Sandiford <richard.sandiford@arm.com>,
Nick Alcock via Gcc-patches <gcc-patches@gcc.gnu.org>,
kees Cook <keescook@chromium.org>
Subject: Re: [PATCH] testsuite: Fix c-c++-common/auto-init-* tests
Date: Sat, 11 Sep 2021 16:58:01 +0000 [thread overview]
Message-ID: <BFE994C2-8882-4CDC-9ED0-9A4E726ED27D@oracle.com> (raw)
In-Reply-To: <20210911080320.GA304296@tucnak>
Hi, Jakub,
Thanks a lot for your patch to the testing cases in c-c++-common.
Actually I had a local fix too, and I planed to submitted it after I fixed all the failure for dg.target/i386 failures on different platforms..;-)
> On Sep 11, 2021, at 3:03 AM, Jakub Jelinek <jakub@redhat.com> wrote:
>
> On Fri, Sep 03, 2021 at 02:47:11PM +0000, Qing Zhao via Gcc-patches wrote:
>>> 2021-08-20 qing zhao <qing.zhao@oracle.com>
>>>
>>> * c-c++-common/auto-init-1.c: New test.
>>> * c-c++-common/auto-init-10.c: New test.
>>> * c-c++-common/auto-init-11.c: New test.
>>> * c-c++-common/auto-init-12.c: New test.
>>> * c-c++-common/auto-init-13.c: New test.
>>> * c-c++-common/auto-init-14.c: New test.
>>> * c-c++-common/auto-init-15.c: New test.
>>> * c-c++-common/auto-init-16.c: New test.
>>> * c-c++-common/auto-init-2.c: New test.
>>> * c-c++-common/auto-init-3.c: New test.
>>> * c-c++-common/auto-init-4.c: New test.
>>> * c-c++-common/auto-init-5.c: New test.
>>> * c-c++-common/auto-init-6.c: New test.
>>> * c-c++-common/auto-init-7.c: New test.
>>> * c-c++-common/auto-init-8.c: New test.
>>> * c-c++-common/auto-init-9.c: New test.
>>> * c-c++-common/auto-init-esra.c: New test.
>>> * c-c++-common/auto-init-padding-1.c: New test.
>>> * c-c++-common/auto-init-padding-2.c: New test.
>>> * c-c++-common/auto-init-padding-3.c: New test.
>
> This fails on many targets, e.g. i686-linux or x86_64-linux with -m32.
>
> The main problem is hardcoding type sizes and structure layout expectations
> that are valid only on some lp64 targets.
> On ilp32 long and pointer are 32-bit, and there are targets that are neither
> ilp32 nor lp64 and there even other sizes can't be taken for granted.
> Also, long double depending on target and options is either 8, 12 or 16 byte
> (the first one when it is the same as double, the second e.g. for ia32
> extended long double (which is under the hood 10 byte), the last either
> the same hw type on x86_64 or IBM double double or IEEE quad).
Is there any testing directive keyword to distinguish this, I see: (https://gcc.gnu.org/onlinedocs/gccint/Effective-Target-Keywords.html)
longdouble128
Target has 128-bit long double.
> In the last test, one problem is that unsigned long is on ilp32 32-bit
> instead of 64-bit, but even just changing to long long is not enough,
> as long long in structures on ia32 is only 4 byte aligned instead of 8.
>
> Tested on x86_64-linux -m32/-m64, ok for trunk?
>
> Note, the gcc.dg/i386/auto-init* tests fail also, just don't have time to
> deal with that right now, just try
> make check-gcc RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} i386.exp=auto-init*'
> Guess some of those tests should be restricted to lp64 in there, others
> where it might be easier to check all of lp64, x32 and ia32 code generation
> could have different matches.
Yes, I am working on this right now, will fix this the beginning of next week.
> Wonder also about the aarch64 tests, there is
> also -mabi=ilp32...
I expected that aarch64 tests with ilp32 might have similar issue.
> +FAIL: gcc.target/i386/auto-init-2.c scan-rtl-dump-times expand "0xfefefefefefefefe" 3
> +FAIL: gcc.target/i386/auto-init-2.c scan-rtl-dump-times expand "0xfffffffffefefefe" 2
> +FAIL: gcc.target/i386/auto-init-3.c scan-assembler-times pxor\\t\\\\%xmm0, \\\\%xmm0 3
> +FAIL: gcc.target/i386/auto-init-4.c scan-rtl-dump-times expand "0xfffffffffefefefe" 1
> +FAIL: gcc.target/i386/auto-init-4.c scan-rtl-dump-times expand "0xfffffffffffffffe\\\\]\\\\) repeated x16" 1
> +FAIL: gcc.target/i386/auto-init-4.c scan-rtl-dump-times expand "\\\\[0xfefefefefefefefe\\\\]" 1
> +FAIL: gcc.target/i386/auto-init-5.c scan-assembler-times \\\\.long\\t0 14
> +FAIL: gcc.target/i386/auto-init-6.c scan-rtl-dump-times expand "0xfffffffffffffffe\\\\]\\\\) repeated x16" 2
> +FAIL: gcc.target/i386/auto-init-6.c scan-rtl-dump-times expand "\\\\[0xfefefefefefefefe\\\\]" 1
> +FAIL: gcc.target/i386/auto-init-7.c scan-rtl-dump-times expand "const_int 0 \\\\[0\\\\]\\\\) repeated x16" 2
> +FAIL: gcc.target/i386/auto-init-7.c scan-rtl-dump-times expand "const_int 0 \\\\[0\\\\]\\\\)\\\\)" 3
> +FAIL: gcc.target/i386/auto-init-8.c scan-rtl-dump-times expand "0xfffffffffefefefe" 1
> +FAIL: gcc.target/i386/auto-init-8.c scan-rtl-dump-times expand "0xfffffffffffffffe\\\\]\\\\) repeated x16" 2
> +FAIL: gcc.target/i386/auto-init-8.c scan-rtl-dump-times expand "\\\\[0xfefefefefefefefe\\\\]" 2
> +FAIL: gcc.target/i386/auto-init-padding-1.c scan-rtl-dump-times expand "const_int 0 \\\\[0\\\\]\\\\) repeated x16" 1
> +FAIL: gcc.target/i386/auto-init-padding-10.c scan-rtl-dump-times expand "0xfffffffffffffffe\\\\]\\\\) repeated x16" 1
> +FAIL: gcc.target/i386/auto-init-padding-11.c scan-rtl-dump-times expand "const_int 0 \\\\[0\\\\]\\\\) repeated x16" 1
> +FAIL: gcc.target/i386/auto-init-padding-12.c scan-rtl-dump-times expand "0xfffffffffffffffe\\\\]\\\\) repeated x16" 1
> +FAIL: gcc.target/i386/auto-init-padding-2.c scan-rtl-dump-times expand "0xfffffffffffffffe\\\\]\\\\) repeated x16" 1
> +FAIL: gcc.target/i386/auto-init-padding-3.c scan-assembler movl\\t\\\\\$16,
> +FAIL: gcc.target/i386/auto-init-padding-3.c scan-assembler rep stosq
> +FAIL: gcc.target/i386/auto-init-padding-4.c scan-rtl-dump-times expand "0xfffffffffffffffe\\\\]\\\\) repeated x16" 1
> +FAIL: gcc.target/i386/auto-init-padding-5.c scan-rtl-dump-times expand "const_int 0 \\\\[0\\\\]\\\\) repeated x16" 1
> +FAIL: gcc.target/i386/auto-init-padding-6.c scan-rtl-dump-times expand "0xfffffffffffffffe\\\\]\\\\) repeated x16" 1
> +FAIL: gcc.target/i386/auto-init-padding-7.c scan-assembler-times movq\\t\\\\\$0, 2
> +FAIL: gcc.target/i386/auto-init-padding-8.c scan-assembler-times movq\\t\\\\\$0, 2
> +FAIL: gcc.target/i386/auto-init-padding-9.c scan-assembler rep stosq
>
> 2021-09-11 Jakub Jelinek <jakub@redhat.com>
>
> * c-c++-common/auto-init-1.c: Enable test only on ilp32 or lp64
> targets, expect different long and pointer sizes between ilp32 and
> lp64.
> * c-c++-common/auto-init-2.c: Likewise.
> * c-c++-common/auto-init-3.c: Expect one of the common long double
> sizes (8/12/16 bytes) instead of hardcoding 16 bytes.
> * c-c++-common/auto-init-4.c: Likewise.
> * c-c++-common/auto-init-5.c: Expect one of the common
> _Complex long double sizes (16/24/32 bytes) instead of hardcoding 32
> bytes.
> * c-c++-common/auto-init-6.c: Likewise.
> * c-c++-common/auto-init-padding-1.c: Enable test only on ilp32 or lp64
> targets.
> (struct test_small_hole): Change type of four to unsigned long long
> and add aligned attribute.
>
> --- gcc/testsuite/c-c++-common/auto-init-1.c.jj 2021-09-11 09:33:37.896331809 +0200
> +++ gcc/testsuite/c-c++-common/auto-init-1.c 2021-09-11 09:37:05.108368101 +0200
> @@ -1,5 +1,5 @@
> /* Verify zero initialization for integer and pointer type automatic variables. */
> -/* { dg-do compile } */
> +/* { dg-do compile { target { ilp32 || lp64 } } } */
> /* { dg-options "-ftrivial-auto-var-init=zero -fdump-tree-gimple" } */
>
> #ifndef __cplusplus
> @@ -33,7 +33,9 @@ void foo()
> /* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(2, 2, 0\\)" "gimple" } } */
> /* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" } } */
> /* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" } } */
> -/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */
> +/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" { target ilp32 } } } */
Should we add llp64 for “long type” too? I.e.
+/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" { target { ilp32 || llp64 } } } } */
From https://gcc.gnu.org/onlinedocs/gccint/Effective-Target-Keywords.html
=========
7.2.3.2 Data type sizes
ilp32
Target has 32-bit int, long, and pointers.
lp64
Target has 32-bit int, 64-bit long and pointers.
llp64
Target has 32-bit int and long, 64-bit long long and pointers.
In the above, looks like that “llp64” also has 32-bit long.
Again, thanks a lot for helping.
Qing
> +/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" { target lp64 } } } */
> /* { dg-final { scan-tree-dump "temp6 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */
> -/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */
> +/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" { target ilp32 } } } */
> +/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" { target lp64 } } } */
> /* { dg-final { scan-tree-dump "temp8 = .DEFERRED_INIT \\(1, 2, 0\\)" "gimple" } } */
> --- gcc/testsuite/c-c++-common/auto-init-2.c.jj 2021-09-11 09:33:37.897331795 +0200
> +++ gcc/testsuite/c-c++-common/auto-init-2.c 2021-09-11 09:38:10.908426977 +0200
> @@ -1,5 +1,5 @@
> /* Verify pattern initialization for integer and pointer type automatic variables. */
> -/* { dg-do compile } */
> +/* { dg-do compile { target { ilp32 || lp64 } } } */
> /* { dg-options "-ftrivial-auto-var-init=pattern -fdump-tree-gimple" } */
>
> #ifndef __cplusplus
> @@ -33,7 +33,9 @@ void foo()
> /* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(2, 1, 0\\)" "gimple" } } */
> /* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" } } */
> /* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" } } */
> -/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" } } */
> +/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" { target ilp32 } } } */
> +/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" { target lp64 } } } */
> /* { dg-final { scan-tree-dump "temp6 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" } } */
> -/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" } } */
> +/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" { target ilp32 } } } */
> +/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" { target lp64 } } } */
> /* { dg-final { scan-tree-dump "temp8 = .DEFERRED_INIT \\(1, 1, 0\\)" "gimple" } } */
> --- gcc/testsuite/c-c++-common/auto-init-3.c.jj 2021-09-11 09:33:37.897331795 +0200
> +++ gcc/testsuite/c-c++-common/auto-init-3.c 2021-09-11 09:39:40.626143763 +0200
> @@ -16,4 +16,4 @@ long double foo()
>
> /* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" } } */
> /* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */
> -/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(16, 2, 0\\)" "gimple" } } */
> +/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((8|12|16), 2, 0\\)" "gimple" } } */
> --- gcc/testsuite/c-c++-common/auto-init-4.c.jj 2021-09-11 09:33:37.897331795 +0200
> +++ gcc/testsuite/c-c++-common/auto-init-4.c 2021-09-11 09:42:50.645427377 +0200
> @@ -16,4 +16,4 @@ long double foo()
>
> /* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" } } */
> /* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" } } */
> -/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(16, 1, 0\\)" "gimple" } } */
> +/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((8|12|16), 1, 0\\)" "gimple" } } */
> --- gcc/testsuite/c-c++-common/auto-init-5.c.jj 2021-09-11 09:33:37.897331795 +0200
> +++ gcc/testsuite/c-c++-common/auto-init-5.c 2021-09-11 09:43:14.909080575 +0200
> @@ -17,5 +17,5 @@ _Complex long double foo()
>
> /* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */
> /* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(16, 2, 0\\)" "gimple" } } */
> -/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(32, 2, 0\\)" "gimple" } } */
> +/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((16|24|32), 2, 0\\)" "gimple" } } */
>
> --- gcc/testsuite/c-c++-common/auto-init-6.c.jj 2021-09-11 09:33:37.897331795 +0200
> +++ gcc/testsuite/c-c++-common/auto-init-6.c 2021-09-11 09:43:34.316803177 +0200
> @@ -17,5 +17,5 @@ _Complex long double foo()
>
> /* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" } } */
> /* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(16, 1, 0\\)" "gimple" } } */
> -/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(32, 1, 0\\)" "gimple" } } */
> +/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((16|24|32), 1, 0\\)" "gimple" } } */
>
> --- gcc/testsuite/c-c++-common/auto-init-padding-1.c.jj 2021-09-11 09:33:37.897331795 +0200
> +++ gcc/testsuite/c-c++-common/auto-init-padding-1.c 2021-09-11 09:48:21.651696258 +0200
> @@ -1,6 +1,6 @@
> /* Verify the padding initialization for pattern initialization, we always emit
> * a call to __builtin_clear_padding to initialize the paddings to zero. */
> -/* { dg-do compile } */
> +/* { dg-do compile { target { ilp32 || lp64 } } } */
> /* { dg-options "-ftrivial-auto-var-init=pattern -fdump-tree-gimple" } */
>
>
> @@ -9,7 +9,7 @@ struct test_small_hole {
> char two;
> /* 3 byte padding hole here. */
> int three;
> - unsigned long four;
> + unsigned long long four __attribute__((aligned (8)));
> };
>
> extern void g (struct test_small_hole);
>
>
> Jakub
>
next prev parent reply other threads:[~2021-09-11 16:58 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-21 20:07 [patch][version 8]add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc Qing Zhao
2021-09-03 14:47 ` Qing Zhao
2021-09-11 8:03 ` [PATCH] testsuite: Fix c-c++-common/auto-init-* tests Jakub Jelinek
2021-09-11 11:45 ` Richard Biener
2021-09-11 16:58 ` Qing Zhao [this message]
2021-09-15 17:59 ` Qing Zhao
2021-09-16 9:19 ` Jakub Jelinek
2021-09-16 14:49 ` Qing Zhao
2021-09-16 14:56 ` Jakub Jelinek
2021-09-16 15:39 ` Qing Zhao
2021-09-16 15:47 ` Jakub Jelinek
2021-09-16 17:11 ` Qing Zhao
2021-09-16 17:39 ` Iain Sandoe
2021-09-16 18:55 ` Qing Zhao
2021-09-06 10:16 ` [patch][version 8]add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc Richard Biener
2021-09-07 16:57 ` Qing Zhao
2021-09-07 18:33 ` Qing Zhao
2021-09-09 22:49 ` [COMMITTED][patch][version 9]add " Qing Zhao
2021-09-09 23:10 ` Kees Cook
2021-09-10 7:23 ` Richard Biener
2021-09-10 13:46 ` Jose E. Marchesi
2021-09-10 14:36 ` Qing Zhao
2021-09-13 9:32 ` Richard Biener
2021-09-13 14:38 ` Jose E. Marchesi
2021-09-10 8:47 ` Christophe LYON
2021-09-10 9:08 ` Martin Liška
2021-09-10 14:01 ` Jeff Law
2021-09-10 9:40 ` Thomas Schwinge
2021-09-10 14:30 ` Qing Zhao
2021-09-10 14:26 ` Qing Zhao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BFE994C2-8882-4CDC-9ED0-9A4E726ED27D@oracle.com \
--to=qing.zhao@oracle.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=keescook@chromium.org \
--cc=rguenther@suse.de \
--cc=richard.sandiford@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).