public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] testsuite: Remove reliance on argc in lto/pr101868_0.c
@ 2022-06-23 21:21 Dimitar Dimitrov
  2022-06-24  6:54 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Dimitar Dimitrov @ 2022-06-23 21:21 UTC (permalink / raw)
  To: gcc-patches

Some embedded targets do not pass any argv arguments.  When argc is
zero, this causes spurious failures for lto/pr101868_0.c.  Fix by
following the strategy in r0-114701-g2c49569ecea56d.  Use a volatile
variable instead of argc to inject a runtime value into the test.

I validated the following:
  - No changes in testresults for x86_64-pc-linux-gnu.
  - The spurious failures are fixed for PRU target.
  - lto/pr101868_0.c still fails on x86_64-pc-linux-gnu, if
    the PR/101868 fix (r12-2254-gfedcf3c476aff7) is reverted.

Ok for trunk?

	PR tree-optimization/101868

gcc/testsuite/ChangeLog:

	* gcc.dg/lto/pr101868_0.c (zero): New volatile variable.
	(main): Use it instead of argc.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
---
 gcc/testsuite/gcc.dg/lto/pr101868_0.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/lto/pr101868_0.c b/gcc/testsuite/gcc.dg/lto/pr101868_0.c
index c84d19b0267..03124308267 100644
--- a/gcc/testsuite/gcc.dg/lto/pr101868_0.c
+++ b/gcc/testsuite/gcc.dg/lto/pr101868_0.c
@@ -22,12 +22,13 @@ repro(VALUE dummy, VALUE hash)
 
 static VALUE (*that)(VALUE dummy, VALUE hash) = repro;
 
+volatile int zero = 0;
+
 int
 main(int argc, char **argv)
 {
-        argc--;
-        that(0, argc);
+        that(0, zero);
 
-        rb_check_type(argc, argc);
+        rb_check_type(zero, zero);
 
 }
-- 
2.36.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] testsuite: Remove reliance on argc in lto/pr101868_0.c
  2022-06-23 21:21 [PATCH] testsuite: Remove reliance on argc in lto/pr101868_0.c Dimitar Dimitrov
@ 2022-06-24  6:54 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2022-06-24  6:54 UTC (permalink / raw)
  To: Dimitar Dimitrov; +Cc: GCC Patches

On Thu, Jun 23, 2022 at 11:23 PM Dimitar Dimitrov <dimitar@dinux.eu> wrote:
>
> Some embedded targets do not pass any argv arguments.  When argc is
> zero, this causes spurious failures for lto/pr101868_0.c.  Fix by
> following the strategy in r0-114701-g2c49569ecea56d.  Use a volatile
> variable instead of argc to inject a runtime value into the test.
>
> I validated the following:
>   - No changes in testresults for x86_64-pc-linux-gnu.
>   - The spurious failures are fixed for PRU target.
>   - lto/pr101868_0.c still fails on x86_64-pc-linux-gnu, if
>     the PR/101868 fix (r12-2254-gfedcf3c476aff7) is reverted.
>
> Ok for trunk?

OK

>         PR tree-optimization/101868
>
> gcc/testsuite/ChangeLog:
>
>         * gcc.dg/lto/pr101868_0.c (zero): New volatile variable.
>         (main): Use it instead of argc.
>
> Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
> ---
>  gcc/testsuite/gcc.dg/lto/pr101868_0.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/gcc/testsuite/gcc.dg/lto/pr101868_0.c b/gcc/testsuite/gcc.dg/lto/pr101868_0.c
> index c84d19b0267..03124308267 100644
> --- a/gcc/testsuite/gcc.dg/lto/pr101868_0.c
> +++ b/gcc/testsuite/gcc.dg/lto/pr101868_0.c
> @@ -22,12 +22,13 @@ repro(VALUE dummy, VALUE hash)
>
>  static VALUE (*that)(VALUE dummy, VALUE hash) = repro;
>
> +volatile int zero = 0;
> +
>  int
>  main(int argc, char **argv)
>  {
> -        argc--;
> -        that(0, argc);
> +        that(0, zero);
>
> -        rb_check_type(argc, argc);
> +        rb_check_type(zero, zero);
>
>  }
> --
> 2.36.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-24  6:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-23 21:21 [PATCH] testsuite: Remove reliance on argc in lto/pr101868_0.c Dimitar Dimitrov
2022-06-24  6:54 ` Richard Biener

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).