Skip to content

Commit

Permalink
Compiler interrupt bug
Browse files Browse the repository at this point in the history
  • Loading branch information
MJoergen committed Oct 29, 2020
1 parent a4d4061 commit 2e5172c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions c/test_programs/issue_177.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// This is a small test program to test Issue #177.
// When compiled without optimization, it generates incorrect assembly.
// When compiled with optimization, it generates correct assembly.

#include <sysdef.h>

long a = 0;
long b = 0;

// convenient mechanism to access QNICE's Memory Mapped IO registers
#define MMIO( __x ) *((unsigned int volatile *) __x )

static __interrupt void isr(void)
{
if (!a)
return;
b += 1;
}

int main()
{
// Enable timer interrupt @ 10000 Hz
MMIO(IO_TIMER_0_INT) = (unsigned int) isr;

return 0;
}

0 comments on commit 2e5172c

Please sign in to comment.