Multiple jumps in one instruction

Jonathan Buzzard jonathan@buzzard.org.uk
Fri May 25 12:38:00 GMT 2001


tm2@best.com said:

[SNIP]

> This scheme has huge problems.
> Consider this:
>
> static int a = 5;
> void func1(void)
> {
> 	return a *= 5;
> }
> void func2(void)
> {
> 	return a *= 3;
> }
> void main(void)
> {
> 	printf("%d\n", func1() + func2());
> }
>
> This program semi-randomly print either 90 or 100 depending on the
> timing between threads.

The same sort of problem that any multi-threaded program has. I know all
about the potential problems and ISO volations. The question still remains
can I do it. All I can say is for the processor in question it makes sense
to do this. The semi-random nature as you put it presumes the existence of
only one execution unit by the way.

JAB.

-- 
Jonathan A. Buzzard                 Email: jonathan@buzzard.org.uk
Northumberland, United Kingdom.       Tel: +44(0)1661-832195



-- 
Jonathan A. Buzzard                 Email: jonathan@buzzard.org.uk
Northumberland, United Kingdom.       Tel: +44(0)1661-832195




More information about the Gcc mailing list