This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Bug in loop optimize (TREE stage)
- To: dewar at gnat dot com (Robert Dewar)
- Subject: Re: Bug in loop optimize (TREE stage)
- From: Denis Chertykov <denisc at overta dot ru>
- Date: 27 Dec 2000 22:07:30 +0300
- Cc: denisc at overta dot ru, dkorn at pixelpower dot com, gcc at gcc dot gnu dot org
- References: <20001227134849.C170C34D81@nile.gnat.com>
dewar@gnat.com (Robert Dewar) writes:
> << This is undefined behaviour. Since you haven't initialised variable p,
> the compiler is free to implement whatever it likes here. In particular,
> >>
>
> Presumably with warnings switched on, you would have got the appropriate
> warning which would have saved you submitting the bogus example :-)
Which warnings ?
Why I have so different result if I change 0xffffffff to 0xfffffffe ?
Or
Why I have a right result if I change `volatile unsigned char *p' to
`volatile unsigned int *p' ?
So, I can only repeat:
volatile unsigned char * volatile p;
/* ^^^^^^^^
I have added this keyword without any results in output. */
volatile unsigned char i;
/* Compiler don't know anything about P because it's a `volatile'
variable. IE any part of program can change P in any time
(interrupts, hardware, etc...).
Also, compiler must save P to it's memory location immediately
after any modification of P. */
int main(void) {
do {
i++;
} while(p++<(unsigned char *)0xffffffff);
return 0;
}
Denis.