diff mbox series

[committed] testsuite: Fix for targets not passing argc/argv [PR116154]

Message ID 20240731163940.426064-1-dimitar@dinux.eu
State New
Headers show
Series [committed] testsuite: Fix for targets not passing argc/argv [PR116154] | expand

Commit Message

Dimitar Dimitrov July 31, 2024, 4:39 p.m. UTC
PRU and other simulator targets do not pass any argv arguments
to main.  Instead of erroneously relying on argc==0, use a volatile
variable instead.

I reverted the fix for PR67947 in r6-3891-g8a18fcf4aa1d5c, and made sure
that the updated test case still fails for x86_64:

  $ make check-gcc-c RUNTESTFLAGS="dg-torture.exp=pr67947.c"
  ...
  FAIL: gcc.dg/torture/pr67947.c   -O1  execution test
  ...
  # of expected passes            8
  # of unexpected failures        8

Fix was suggested by Andrew Pinski in PR116154.  Committed as obvious.

	PR testsuite/116154

gcc/testsuite/ChangeLog:

	* gcc.dg/torture/pr67947.c: Use volatile variable instead of
	argc.

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

Comments

Jeff Law July 31, 2024, 4:48 p.m. UTC | #1
On 7/31/24 10:39 AM, Dimitar Dimitrov wrote:
> PRU and other simulator targets do not pass any argv arguments
> to main.  Instead of erroneously relying on argc==0, use a volatile
> variable instead.
> 
> I reverted the fix for PR67947 in r6-3891-g8a18fcf4aa1d5c, and made sure
> that the updated test case still fails for x86_64:
> 
>    $ make check-gcc-c RUNTESTFLAGS="dg-torture.exp=pr67947.c"
>    ...
>    FAIL: gcc.dg/torture/pr67947.c   -O1  execution test
>    ...
>    # of expected passes            8
>    # of unexpected failures        8
> 
> Fix was suggested by Andrew Pinski in PR116154.  Committed as obvious.
> 
> 	PR testsuite/116154
> 
> gcc/testsuite/ChangeLog:
> 
> 	* gcc.dg/torture/pr67947.c: Use volatile variable instead of
> 	argc.
Thanks.  I'd noted this failing in various targets in my tester and 
assumed it was the argc issue, but hadn't had the time to test a change.

jeff
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.dg/torture/pr67947.c b/gcc/testsuite/gcc.dg/torture/pr67947.c
index 368a8b20cbf..1016f2579cb 100644
--- a/gcc/testsuite/gcc.dg/torture/pr67947.c
+++ b/gcc/testsuite/gcc.dg/torture/pr67947.c
@@ -11,11 +11,13 @@  __attribute__((noinline, noclone)) void foo (int x)
     c++;
 }
 
+volatile int t = 1;
+
 int
 main (int argc, char* argv[])
 {
   int j, k, b = 0;
-  if (argc == 0)
+  if (t == 0)
     b = 1;
   for (j = 0; j < 3; j++)
     for (k = 0; k < 1; k++)