1  /* { dg-do run } */
       2  /* { dg-options "-std=c99" } */
       3  
       4  #include "../isr-test.h"
       5  
       6  int volatile v;
       7  
       8  __attribute__((noinline,noclone))
       9  void inc_v (void)
      10  {
      11    v++;
      12  }
      13  
      14  /**********************************************************************/
      15  
      16  ISR (1, signal)
      17  {
      18    inc_v();
      19  }
      20  
      21  MK_RUN_ISR (1, 0)
      22  
      23  void test1 (void)
      24  {
      25    run_isr_1();
      26    if (v != 1)
      27      __builtin_abort();
      28  }
      29  
      30  /**********************************************************************/
      31  
      32  ISR (2, signal)
      33  {
      34    if (v == 1)
      35      inc_v();
      36    else
      37      v += 2;
      38  }
      39  
      40  MK_RUN_ISR (2, 0)
      41  
      42  void test2 (void)
      43  {
      44    run_isr_2();
      45    if (v != 2)
      46      __builtin_abort();
      47    run_isr_2();
      48    if (v != 4)
      49      __builtin_abort();
      50  }
      51  
      52  
      53  /**********************************************************************/
      54  
      55  int main (void)
      56  {
      57    test1();
      58    test2();
      59    return 0;
      60  }