(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
20070507-1.c
       1  /* This failed on s390x due to bug in loop.c.
       2     loop.c failed to remove a REG_EQUAL note when
       3     hoisting an insn from a loop body.  */
       4  
       5  /* { dg-options "-O3 -fPIC" } */
       6  /* { dg-do run { target fpic } } */
       7  
       8  typedef __SIZE_TYPE__ size_t;
       9  int memcmp(const void *s1, const void *s2, size_t n);
      10  
      11  typedef struct
      12  {
      13    char name[30];
      14    int a;
      15  } LOCAL;
      16  
      17  int global = 0;
      18  int sy = 1;
      19  int subroutine_offset;
      20  
      21  LOCAL local = { "local", 0 };
      22  LOCAL keywords = { "keywords", 1 };
      23  int local_table = 0;
      24  int keywords_table = 0;
      25  
      26  void __attribute__((noinline)) bar (char *p_buffer)
      27  {
      28    p_buffer[255] = 1;
      29  }
      30  
      31  int __attribute__((noinline)) foo (char *p_str1)
      32  {
      33    global = 1;
      34    return 1;
      35  }
      36  
      37  int __attribute__((noinline)) loop_next (int *p_table, char *p_table_head)
      38  {
      39    static int loop_next = 0;
      40  
      41    if (loop_next == 1)
      42      return 1;
      43  
      44    loop_next = 1;
      45    return 0;
      46  }
      47  
      48  int
      49  main ()
      50  {
      51    char buffer[256];
      52    int ende = 0;
      53    int index;
      54    int local_base = 2;
      55  
      56    keywords.a = 1;
      57    for (sy = 0;; sy++)
      58      {
      59        for (index = 1;;)
      60  	{
      61  	  bar (buffer);
      62  	  if (buffer[sy] != 0)
      63  	    {
      64  	      ende = 1;
      65  	      break;
      66  	    };
      67  	  if (foo (buffer))
      68  	    {
      69  	      keywords.a += index - 1;
      70  	      break;
      71  	    }
      72  	  index++;
      73  	}
      74        if (ende)
      75  	break;
      76      }
      77  
      78    subroutine_offset = 0;
      79  
      80    for (;;)
      81      {
      82        if (loop_next (&keywords_table, (char*)&keywords))
      83  	break;
      84  
      85        if ((!memcmp (keywords.name, "+++", 3)))
      86  	local_base = 100;
      87        else
      88  	local_base = 0;
      89  
      90        if ((!memcmp (keywords.name, "+++", 3)))
      91  	subroutine_offset += local_table;
      92  
      93        for (;;)
      94  	{
      95  	  if (loop_next (&local_table, (char*)&local))
      96  	    break;;
      97  	  if ((local.a == 0))
      98  	    continue;;
      99  	  foo (local.name);
     100  	}
     101      }
     102    return 0;
     103  }