typedef'd pointer type and volatile interact (egcs-1.0.3 release)

Mike Stump mrs@wrs.com
Wed Oct 14 13:36:00 GMT 1998


> From: Martin Dorey <MDorey@Madge.com>
> Date: Wed, 14 Oct 1998 15:23:53 +0100

> typedef unsigned char* BYTE_P;

>   while ((b = *(volatile BYTE_P) (0)));

> Produces assembler that includes the patently bogus while loop:

> .L2:
> 	testb %al,%al
> 	jne .L2

Not a bug.  Your knowledge of volatile, pointers and typedefs isn't
complete.  Try using:

    (*(volatile unsigned char *)0)

instead.



More information about the Gcc-bugs mailing list