(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
pr78185.c
       1  /* { dg-do run { target *-*-linux* *-*-gnu* *-*-uclinux* } } */
       2  /* { dg-options "-O" } */
       3  
       4  #include <unistd.h>
       5  #include <signal.h>
       6  #include <stdlib.h>
       7  
       8  static char var1 = 0L;
       9  static char *var2 = &var1;
      10  
      11  void do_exit (int i)
      12  {
      13    exit (0);
      14  }
      15  
      16  int main(void)
      17  {
      18    struct sigaction s;
      19    sigemptyset (&s.sa_mask);
      20    s.sa_handler = do_exit;
      21    s.sa_flags = 0;
      22    sigaction (SIGALRM, &s, NULL);
      23    alarm (1);
      24    /* The following loop is infinite, the division by zero should not
      25       be hoisted out of it.  */
      26    for (; (var1 == 0 ? 0 : (100 / var1)) == *var2; );
      27    return 0;
      28  }