This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug in gcc


Hello Marcus,

Thanks much for your reply, I appreciate it.

Both Microsoft C++ compiler and
Sun Workshop C compiler evaluates
the expression and increments B and C
twice.

Regards,
Swami

----- Original Message -----
From: "Marcus Meissner" <meissner@suse.de>
To: "Swaminathan Venkatakrishnaprasad" <vswami@agere.com>
Cc: <bug-gcc@prep.ai.mit.edu>
Sent: Thursday, February 13, 2003 11:23 AM
Subject: Re: Bug in gcc


> On Thu, Feb 13, 2003 at 11:16:38AM -0500, Swaminathan Venkatakrishnaprasad
wrote:
> > Hello,
> >
> > The program below when excuted yields incorrect result:
> >
> > main()
> > {
> >    int A,B,C;
> >
> >    A=0; B=1;C=2;
> >
> >    A = B++ + B++ + C++ + C++;
>
> You are modifying C twice, this is undefined behaviour.
>
> Ciao, Marcus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]