Subject: Re: CVS commit: src/sys/arch/newsmips/newsmips
To: Christos Zoulas <firstname.lastname@example.org>
From: Nathan J. Williams <email@example.com>
Date: 08/27/2006 13:17:55
firstname.lastname@example.org (Christos Zoulas) writes:
> >I.e. the question is "doesn't gcc4 assume such static variables might
> >be changed in the interrupt context in the same source?"
> This is what I meant; gcc does not know that this can happen. How could it?
In most of our code we should only be looking at such values after a
round of splfoo()/splx(), and we can arrange for gcc to not think it
can keep global values across those function calls. That's the normal
way for device drivers to communicate "things might change
asynchronously" to the compiler; for this case, where we know exactly
what code might synchronously trigger it and really want to force a
re-check, making the variable volatile (or perhaps using a *(volatile
int *)&badaddr_flag construct?) seems reasonable.