This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Tree generation bug or a feature?
- To: Yuri Pudgorodsky <yur at asplinux dot ru>
- Subject: Re: Tree generation bug or a feature?
- From: dvv at dvv dot ru (Dima Volodin)
- Date: Wed, 24 May 2000 13:04:01 GMT
- Cc: gcc at gcc dot gnu dot org
- Organization: Huh?
- References: <392BCFAF.FC593DC7@asplinux.ru>
On Wed, 24 May 2000 16:48:47 +0400, you wrote:
>Hi!
>
>
>With the following two statements, I supposed to get identical result:
>
>x = 2; y = ++x * ++x;
>x = 2; y = (x+=1) * (x+=1);
>
>However, under gcc ++x variant gives me 16 instead if 12,
>as well as x++ * x++ incorrectly (I suppose) gives 4.
>
>
>Digital C compiler from DU 4.0 show correct values:
>
>++x * ++x = 12
>(x+=1) * (x+=1) = 12
>
>as well as gdb builtin C expression parser.
>
>
>Sounds like a tree generation bug, isn't it?
In these code snippets, you are trying to modify x's value more than
once, which makes these snippets undefined as per section 6.3 of the
ANSI/ISO C Standard. That is you cannot expect any particular result at
all.
>Yuri Pudgorodsky
Dima