[testsuite,obvious] Fix gcc.dg/pr92301.c on targets that don't support argc/argv.

Message ID 4aac5e64-ec17-5ff8-9cad-1e09c20076ab@codesourcery.com
State New
Headers show
Series
  • [testsuite,obvious] Fix gcc.dg/pr92301.c on targets that don't support argc/argv.
Related show

Commit Message

Sandra Loosemore March 25, 2020, 3:10 p.m.
I've checked in this trivial patch to fix another test failure I found 
on nios2-elf, due to the BSP we use for simulator testing on this target 
not having support for argc/argv.  This testcase doesn't actually use 
any command-line arguments and I think just does the argc test to avoid 
optimizing the interesting things away, so I tweaked it to allow argc == 
0 in addition to argc == 1.

-Sandra

Patch

commit 0fca105f8ca95747fad3d3315e642ea9dc6936e0
Author: Sandra Loosemore <sandra@codesourcery.com>
Date:   Wed Mar 25 08:01:50 2020 -0700

    Fix gcc.dg/pr92301.c on targets that don't support argc/argv.
    
    2020-03-25  Sandra Loosemore  <sandra@codesourcery.com>
    
    	gcc/testsuite/
    	* gcc.dg/pr92301.c (main): Allow argc to be 0 to support
    	embedded targets.

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 86d3b71..5fa61f9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@ 
+2020-03-25  Sandra Loosemore  <sandra@codesourcery.com>
+
+	* gcc.dg/pr92301.c (main): Allow argc to be 0 to support
+	embedded targets.
+
 2020-03-25  Jakub Jelinek  <jakub@redhat.com>
 
 	PR debug/94296
diff --git a/gcc/testsuite/gcc.dg/pr92301.c b/gcc/testsuite/gcc.dg/pr92301.c
index 9a47e12..3ade201 100644
--- a/gcc/testsuite/gcc.dg/pr92301.c
+++ b/gcc/testsuite/gcc.dg/pr92301.c
@@ -23,7 +23,7 @@  int main(int argc, char **argv)
   for (unsigned i = 0; i < N; i++)
     a[i] = i;
 
-  if (argc == 1)
+  if (argc < 2)
     m = 17;
 
   unsigned int r = df_count_refs(1);